var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&re(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function ee(){return g?!0:!(e.unstable_now()-Tt&&ee());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&re(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(E)};else if(typeof MessageChannel<`u`){var te=new MessageChannel,ne=te.port2;te.port1.onmessage=E,D=function(){ne.postMessage(null)}}else D=function(){_(E,0)};function re(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,re(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function ee(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function E(e,t){return ee(e.type,t,e.props)}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function te(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ne=/\/+/g;function re(e,t){return typeof e==`object`&&e&&e.key!=null?te(``+e.key):t.toString(36)}function O(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function ie(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,ie(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+re(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ne,`$&/`)+`/`),ie(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ne,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=d()})),p=o((e=>{var t=f();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=u(),n=f(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1le||(e.current=ce[le],ce[le]=null,le--)}function fe(e,t){le++,ce[le]=e.current,e.current=t}var pe=ue(null),me=ue(null),he=ue(null),ge=ue(null);function _e(e,t){switch(fe(he,t),fe(me,e),fe(pe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Qd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Qd(t),e=$d(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}de(pe),fe(pe,e)}function ve(){de(pe),de(me),de(he)}function ye(e){e.memoizedState!==null&&fe(ge,e);var t=pe.current,n=$d(t,e.type);t!==n&&(fe(me,e),fe(pe,n))}function be(e){me.current===e&&(de(pe),de(me)),ge.current===e&&(de(ge),lp._currentValue=se)}var xe,Se;function Ce(e){if(xe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);xe=t&&t[1]||``,Se=-1)`:-1i||c[r]!==l[i]){var u=` `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{we=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ce(n):``}function Ee(e,t){switch(e.tag){case 26:case 27:case 5:return Ce(e.type);case 16:return Ce(`Lazy`);case 13:return e.child!==t&&t!==null?Ce(`Suspense Fallback`):Ce(`Suspense`);case 19:return Ce(`SuspenseList`);case 0:case 15:return Te(e.type,!1);case 11:return Te(e.type.render,!1);case 1:return Te(e.type,!0);case 31:return Ce(`Activity`);default:return``}}function De(e){try{var t=``,n=null;do t+=Ee(e,n),n=e,e=e.return;while(e);return t}catch(e){return` Error generating stack: `+e.message+` `+e.stack}}var Oe=Object.prototype.hasOwnProperty,ke=t.unstable_scheduleCallback,Ae=t.unstable_cancelCallback,je=t.unstable_shouldYield,Me=t.unstable_requestPaint,Ne=t.unstable_now,Pe=t.unstable_getCurrentPriorityLevel,Fe=t.unstable_ImmediatePriority,Ie=t.unstable_UserBlockingPriority,Le=t.unstable_NormalPriority,Re=t.unstable_LowPriority,ze=t.unstable_IdlePriority,Be=t.log,Ve=t.unstable_setDisableYieldValue,He=null,Ue=null;function We(e){if(typeof Be==`function`&&Ve(e),Ue&&typeof Ue.setStrictMode==`function`)try{Ue.setStrictMode(He,e)}catch{}}var Ge=Math.clz32?Math.clz32:Je,Ke=Math.log,qe=Math.LN2;function Je(e){return e>>>=0,e===0?32:31-(Ke(e)/qe|0)|0}var Ye=256,Xe=262144,Ze=4194304;function Qe(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function $e(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Qe(n))):i=Qe(o):i=Qe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Qe(n))):i=Qe(o)):i=Qe(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function et(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function tt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function nt(){var e=Ze;return Ze<<=1,!(Ze&62914560)&&(Ze=4194304),e}function rt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function it(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function at(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0=tr),ir=` `,ar=!1;function or(e,t){switch(e){case`keyup`:return $n.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function sr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var cr=!1;function lr(e,t){switch(e){case`compositionend`:return sr(t);case`keypress`:return t.which===32?(ar=!0,ir):null;case`textInput`:return e=t.data,e===ir&&ar?null:e;default:return null}}function ur(e,t){if(cr)return e===`compositionend`||!er&&or(e,t)?(e=Cn(),Sn=xn=bn=null,cr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Mr(n)}}function Pr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Pr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Fr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Wt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Wt(e.document)}return t}function Ir(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Lr=_n&&`documentMode`in document&&11>=document.documentMode,Rr=null,zr=null,Br=null,Vr=!1;function Hr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Vr||Rr==null||Rr!==Wt(r)||(r=Rr,`selectionStart`in r&&Ir(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Br&&jr(Br,r)||(Br=r,r=Id(zr,`onSelect`),0>=o,i-=o,Pi=1<<32-Ge(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),j&&Ii(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),j&&Ii(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return j&&Ii(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),j&&Ii(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===D&&Pa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Va(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===y?(c=xi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=bi(o.type,o.key,o.props,null,e.mode,c),Va(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=wi(o,e.mode,c),c.return=e,e=c}return s(e);case D:return o=Pa(o),b(e,r,o,c)}if(oe(o))return h(e,r,o,c);if(O(o)){if(l=O(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Ba(o),c);if(o.$$typeof===C)return b(e,r,ua(e,o),c);Ha(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Si(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{za=0;var i=b(e,t,n,r);return Ra=null,i}catch(t){if(t===Oa||t===Aa)throw t;var a=gi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Wa=Ua(!0),Ga=Ua(!1),Ka=!1;function qa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ja(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ya(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Xa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Kl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=pi(e),fi(e,null,n),t}return li(e,r,t,n),pi(e)}function Za(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,st(e,n)}}function Qa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var $a=!1;function eo(){if($a){var e=ba;if(e!==null)throw e}}function to(e,t,n,r){$a=!1;var i=e.updateQueue;Ka=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(B&f)===f:(r&f)===f){f!==0&&f===ya&&($a=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Ka=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),eu|=o,e.lanes=o,e.memoizedState=d}}function no(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function ro(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=k.T,s={};k.T=s,Hs(e,!1,t,n);try{var c=i(),l=k.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Vs(e,t,Sa(c,r),Su(e)):Vs(e,t,r,Su(e))}catch(n){Vs(e,t,{then:function(){},status:`rejected`,reason:n},Su())}finally{A.p=a,o!==null&&s.types!==null&&(o.types=s.types),k.T=o}}function js(){}function Ms(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ns(e).queue;As(e,a,t,se,n===null?js:function(){return Ps(e),n(r)})}function Ns(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wo,lastRenderedState:se},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ps(e){var t=Ns(e);t.next===null&&(t=e.alternate.memoizedState),Vs(e,t.next.queue,{},Su())}function Fs(){return la(lp)}function Is(){return zo().memoizedState}function Ls(){return zo().memoizedState}function Rs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Su();e=Ya(n);var r=Xa(t,e,n);r!==null&&(wu(r,t,n),Za(r,t,n)),t={cache:ga()},e.payload=t;return}t=t.return}}function zs(e,t,n){var r=Su();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Us(e)?Ws(t,n):(n=ui(e,t,n,r),n!==null&&(wu(n,e,r),Gs(n,t,r)))}function Bs(e,t,n){Vs(e,t,n,Su())}function Vs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Us(e))Ws(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Ar(s,o))return li(e,t,i,0),ql===null&&ci(),!1}catch{}if(n=ui(e,t,i,r),n!==null)return wu(n,e,r),Gs(n,t,r),!0}return!1}function Hs(e,t,n,r){if(r={lane:2,revertLane:xd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Us(e)){if(t)throw Error(i(479))}else t=ui(e,n,r,2),t!==null&&wu(t,e,2)}function Us(e){var t=e.alternate;return e===P||t!==null&&t===P}function Ws(e,t){Co=So=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Gs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,st(e,n)}}var Ks={readContext:la,use:Ho,useCallback:ko,useContext:ko,useEffect:ko,useImperativeHandle:ko,useLayoutEffect:ko,useInsertionEffect:ko,useMemo:ko,useReducer:ko,useRef:ko,useState:ko,useDebugValue:ko,useDeferredValue:ko,useTransition:ko,useSyncExternalStore:ko,useId:ko,useHostTransitionStatus:ko,useFormState:ko,useActionState:ko,useOptimistic:ko,useMemoCache:ko,useCacheRefresh:ko};Ks.useEffectEvent=ko;var qs={readContext:la,use:Ho,useCallback:function(e,t){return Ro().memoizedState=[e,t===void 0?null:t],e},useContext:la,useEffect:_s,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),hs(4194308,4,Cs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return hs(4194308,4,e,t)},useInsertionEffect:function(e,t){hs(4,2,e,t)},useMemo:function(e,t){var n=Ro();t=t===void 0?null:t;var r=e();if(wo){We(!0);try{e()}finally{We(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ro();if(n!==void 0){var i=n(t);if(wo){We(!0);try{n(t)}finally{We(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=zs.bind(null,P,e),[r.memoizedState,e]},useRef:function(e){var t=Ro();return e={current:e},t.memoizedState=e},useState:function(e){e=es(e);var t=e.queue,n=Bs.bind(null,P,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ts,useDeferredValue:function(e,t){return Os(Ro(),e,t)},useTransition:function(){var e=es(!1);return e=As.bind(null,P,e.queue,!0,!1),Ro().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=P,a=Ro();if(j){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),ql===null)throw Error(i(349));B&127||Yo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,_s(Zo.bind(null,r,o,e),[e]),r.flags|=2048,ps(9,{destroy:void 0},Xo.bind(null,r,o,n,t),null),n},useId:function(){var e=Ro(),t=ql.identifierPrefix;if(j){var n=Fi,r=Pi;n=(r&~(1<<32-Ge(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=To++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[mt]=t,o[ht]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Gd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Vc(t)}}return Kc(t),Hc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Vc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=he.current,Yi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Vi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[mt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Hd(e.nodeValue,n)),e||Ki(t,!0)}else e=Zd(e).createTextNode(r),e[mt]=t,t.stateNode=e}return Kc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Yi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[mt]=t}else Xi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Kc(t),e=!1}else n=Zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(go(t),t):(go(t),null);if(t.flags&128)throw Error(i(558))}return Kc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Yi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[mt]=t}else Xi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Kc(t),a=!1}else a=Zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(go(t),t):(go(t),null)}return go(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Wc(t,t.updateQueue),Kc(t),null);case 4:return ve(),e===null&&Md(t.stateNode.containerInfo),Kc(t),null;case 10:return ra(t.type),Kc(t),null;case 19:if(de(_o),r=t.memoizedState,r===null)return Kc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Gc(r,!1);else{if($l!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=vo(e),o!==null){for(t.flags|=128,Gc(r,!1),e=o.updateQueue,t.updateQueue=e,Wc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)yi(n,e),n=n.sibling;return fe(_o,_o.current&1|2),j&&Ii(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ne()>uu&&(t.flags|=128,a=!0,Gc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=vo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Wc(t,e),Gc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!j)return Kc(t),null}else 2*Ne()-r.renderingStartTime>uu&&n!==536870912&&(t.flags|=128,a=!0,Gc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Kc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ne(),e.sibling=null,n=_o.current,fe(_o,a?n&1|2:n&1),j&&Ii(t,r.treeForkCount),e);case 22:case 23:return go(t),co(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Kc(t),t.subtreeFlags&6&&(t.flags|=8192)):Kc(t),n=t.updateQueue,n!==null&&Wc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&de(wa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ra(ha),Kc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Jc(e,t){switch(zi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ra(ha),ve(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return be(t),null;case 31:if(t.memoizedState!==null){if(go(t),t.alternate===null)throw Error(i(340));Xi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(go(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Xi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return de(_o),null;case 4:return ve(),null;case 10:return ra(t.type),null;case 22:case 23:return go(t),co(),e!==null&&de(wa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ra(ha),null;case 25:return null;default:return null}}function Yc(e,t){switch(zi(t),t.tag){case 3:ra(ha),ve();break;case 26:case 27:case 5:be(t);break;case 4:ve();break;case 31:t.memoizedState!==null&&go(t);break;case 13:go(t);break;case 19:de(_o);break;case 10:ra(t.type);break;case 22:case 23:go(t),co(),e!==null&&de(wa);break;case 24:ra(ha)}}function Xc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){ed(t,t.return,e)}}function Zc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){ed(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){ed(t,t.return,e)}}function Qc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{ro(t,n)}catch(t){ed(e,e.return,t)}}}function $c(e,t,n){n.props=ec(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){ed(e,t,n)}}function el(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){ed(e,t,n)}}function tl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){ed(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){ed(e,t,n)}else n.current=null}}function nl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){ed(e,e.return,t)}}function rl(e,t,n){try{var r=e.stateNode;Kd(r,e.type,n,t),r[ht]=t}catch(t){ed(e,e.return,t)}}function il(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&lf(e.type)||e.tag===4}function al(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||il(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&lf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ol(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=cn));else if(r!==4&&(r===27&&lf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(ol(e,t,n),e=e.sibling;e!==null;)ol(e,t,n),e=e.sibling}function sl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&lf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(sl(e,t,n),e=e.sibling;e!==null;)sl(e,t,n),e=e.sibling}function cl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Gd(t,r,n),t[mt]=e,t[ht]=n}catch(t){ed(e,e.return,t)}}var ll=!1,ul=!1,dl=!1,fl=typeof WeakSet==`function`?WeakSet:Set,pl=null;function ml(e,t){if(e=e.containerInfo,Yd=vp,e=Fr(e),Ir(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Xd={focusedElem:e,selectionRange:n},vp=!1,pl=t;pl!==null;)if(t=pl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,pl=e;else for(;pl!==null;){switch(t=pl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Gd(o,r,n),o[mt]=e,Dt(o),r=o;break a;case`link`:var s=Qf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=Nr(s,h),v=Nr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,k.T=null,n=vu,vu=null;var o=mu,s=gu;if(pu=0,hu=mu=null,gu=0,Kl&6)throw Error(i(331));var c=Kl;if(Kl|=4,Vl(o.current),Pl(o,o.current,s,n),Kl=c,md(0,!1),Ue&&typeof Ue.onPostCommitFiberRoot==`function`)try{Ue.onPostCommitFiberRoot(He,o)}catch{}return!0}finally{A.p=a,k.T=r,Xu(e,t)}}function $u(e,t,n){t=Ei(n,t),t=oc(e.stateNode,t,2),e=Xa(e,t,2),e!==null&&(it(e,2),pd(e))}function ed(e,t,n){if(e.tag===3)$u(e,e,n);else for(;t!==null;){if(t.tag===3){$u(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(fu===null||!fu.has(r))){e=Ei(n,e),n=sc(2),r=Xa(t,n,2),r!==null&&(cc(n,r,t,e),it(r,2),pd(r));break}}t=t.return}}function td(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Gl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Zl=!0,i.add(n),e=nd.bind(null,e,t,n),t.then(e,e))}function nd(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ql===e&&(B&n)===n&&($l===4||$l===3&&(B&62914560)===B&&300>Ne()-cu?!(Kl&2)&&ju(e,0):nu|=n,iu===B&&(iu=0)),pd(e)}function rd(e,t){t===0&&(t=nt()),e=di(e,t),e!==null&&(it(e,t),pd(e))}function id(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),rd(e,n)}function ad(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),rd(e,n)}function od(e,t){return ke(e,t)}var sd=null,cd=null,ld=!1,ud=!1,dd=!1,fd=0;function pd(e){e!==cd&&e.next===null&&(cd===null?sd=cd=e:cd=cd.next=e),ud=!0,ld||(ld=!0,bd())}function md(e,t){if(!dd&&ud){dd=!0;do for(var n=!1,r=sd;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ge(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,yd(r,a))}else a=B,a=$e(r,r===ql?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||et(r,a)||(n=!0,yd(r,a))}r=r.next}while(n);dd=!1}}function hd(){gd()}function gd(){ud=ld=!1;var e=0;fd!==0&&nf()&&(e=fd);for(var t=Ne(),n=null,r=sd;r!==null;){var i=r.next,a=_d(r,t);a===0?(r.next=null,n===null?sd=i:n.next=i,i===null&&(cd=n)):(n=r,(e!==0||a&3)&&(ud=!0)),r=i}pu!==0&&pu!==5||md(e,!1),fd!==0&&(fd=0)}function _d(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&qd(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function Mf(e,t,n){var r=jf;if(r&&typeof t==`string`&&t){var i=Kt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Ef.has(i)||(Ef.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Gd(t,`link`,e),Dt(t),r.head.appendChild(t)))}}function Nf(e){Of.D(e),Mf(`dns-prefetch`,e,null)}function Pf(e,t){Of.C(e,t),Mf(`preconnect`,e,t)}function Ff(e,t,n){Of.L(e,t,n);var r=jf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Kt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Kt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Kt(n.imageSizes)+`"]`)):i+=`[href="`+Kt(e)+`"]`;var a=i;switch(t){case`style`:a=Vf(e);break;case`script`:a=Gf(e)}Tf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Tf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Hf(a))||t===`script`&&r.querySelector(Kf(a))||(t=r.createElement(`link`),Gd(t,`link`,e),Dt(t),r.head.appendChild(t)))}}function If(e,t){Of.m(e,t);var n=jf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Kt(r)+`"][href="`+Kt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Gf(e)}if(!Tf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),Tf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Kf(a)))return}r=n.createElement(`link`),Gd(r,`link`,e),Dt(r),n.head.appendChild(r)}}}function Lf(e,t,n){Of.S(e,t,n);var r=jf;if(r&&e){var i=Et(r).hoistableStyles,a=Vf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Hf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Tf.get(a))&&Yf(e,n);var c=o=r.createElement(`link`);Dt(c),Gd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Jf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Rf(e,t){Of.X(e,t);var n=jf;if(n&&e){var r=Et(n).hoistableScripts,i=Gf(e),a=r.get(i);a||(a=n.querySelector(Kf(i)),a||(e=h({src:e,async:!0},t),(t=Tf.get(i))&&Xf(e,t),a=n.createElement(`script`),Dt(a),Gd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function zf(e,t){Of.M(e,t);var n=jf;if(n&&e){var r=Et(n).hoistableScripts,i=Gf(e),a=r.get(i);a||(a=n.querySelector(Kf(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=Tf.get(i))&&Xf(e,t),a=n.createElement(`script`),Dt(a),Gd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Bf(e,t,n,r){var a=(a=he.current)?Df(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Vf(n.href),n=Et(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Vf(n.href);var o=Et(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Hf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Tf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Tf.set(e,n),o||Wf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Gf(n),n=Et(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Vf(e){return`href="`+Kt(e)+`"`}function Hf(e){return`link[rel="stylesheet"][`+e+`]`}function Uf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Wf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Gd(t,`link`,n),Dt(t),e.head.appendChild(t))}function Gf(e){return`[src="`+Kt(e)+`"]`}function Kf(e){return`script[async]`+e}function qf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Kt(n.href)+`"]`);if(r)return t.instance=r,Dt(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Dt(r),Gd(r,`style`,a),Jf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Vf(n.href);var o=e.querySelector(Hf(a));if(o)return t.state.loading|=4,t.instance=o,Dt(o),o;r=Uf(n),(a=Tf.get(a))&&Yf(r,a),o=(e.ownerDocument||e).createElement(`link`),Dt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Gd(o,`link`,r),t.state.loading|=4,Jf(o,n.precedence,e),t.instance=o;case`script`:return o=Gf(n.src),(a=e.querySelector(Kf(o)))?(t.instance=a,Dt(a),a):(r=n,(a=Tf.get(o))&&(r=h({},n),Xf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Dt(a),Gd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Jf(r,n.precedence,e));return t.instance}function Jf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function ep(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function tp(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function np(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Vf(r.href),a=t.querySelector(Hf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ap.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Dt(a);return}a=t.ownerDocument||t,r=Uf(r),(i=Tf.get(i))&&Yf(r,i),a=a.createElement(`link`),Dt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Gd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ap.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var rp=0;function ip(e,t){return e.stylesheets&&e.count===0&&sp(e,e.stylesheets),0rp?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function ap(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)sp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var op=null;function sp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,op=new Map,t.forEach(cp,e),op=null,ap.call(e))}function cp(e,t){if(!(t.state.loading&4)){var n=op.get(e);if(n)var r=n.get(null);else{n=new Map,op.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),v=o(((e,t)=>{t.exports=_()})),y=c(f(),1),b=v(),x=y.createContext(void 0),S=e=>{let t=y.useContext(x);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},C=({client:e,children:t})=>(y.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,b.jsx)(x.Provider,{value:e,children:t})),w={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},T=new class{#e=w;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function ee(e){setTimeout(e,0)}var E=typeof window>`u`||`Deno`in globalThis;function D(){}function te(e,t){return typeof e==`function`?e(t):e}function ne(e){return typeof e==`number`&&e>=0&&e!==1/0}function re(e,t){return Math.max(e+(t||0)-Date.now(),0)}function O(e,t){return typeof e==`function`?e(t):e}function ie(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==oe(o,t.options))return!1}else if(!A(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function ae(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(k(t.options.mutationKey)!==k(a))return!1}else if(!A(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function oe(e,t){return(t?.queryKeyHashFn||k)(e)}function k(e){return JSON.stringify(e,(e,t)=>de(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function A(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n500)return t;let r=ue(e)&&ue(t);if(!r&&!(de(e)&&de(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{T.setTimeout(t,e)})}function me(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ce(e,t)}function he(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ge(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var _e=Symbol();function ve(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===_e?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ye(e,t){return typeof e==`function`?e(...t):!!e}function be(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r||(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0})),i)}),e}var xe=()=>E,Se=()=>xe(),Ce=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},we=new class extends Ce{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Te=ee;function Ee(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Te,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var De=Ee(),Oe=new class extends Ce{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function ke(e){return Math.min(1e3*2**e,3e4)}function Ae(e){return(e??`online`)!==`online`||Oe.isOnline()}var je=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Me(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(D);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new je(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>we.isFocused()&&(e.networkMode===`always`||Oe.isOnline())&&e.canRun(),p=()=>Ae(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(Se()?0:3),a=e.retryDelay??ke,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&nf()?void 0:g()).then(()=>{t?h(r):_()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Ne=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ne(this.gcTime)&&(this.#e=T.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Se()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(T.clearTimeout(this.#e),this.#e=void 0)}};function Pe(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{be(e,()=>t.signal,()=>n=!0)},u=ve(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ge:he;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Ie:Fe,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Fe(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Fe(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ie(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Le=class extends Ne{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Be(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Be(this.options);e.data!==void 0&&(this.setState(ze(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=me(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(D).catch(D):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>O(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===_e||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>O(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!re(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ve(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Pe(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Me({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof je&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof je){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Re(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...ze(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),De.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Re(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ae(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function ze(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Be(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Ve=class extends Ce{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ue(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return We(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return We(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof O(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!le(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Ge(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||O(this.options.enabled,this.#t)!==O(t.enabled,this.#t)||O(this.options.staleTime,this.#t)!==O(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||O(this.options.enabled,this.#t)!==O(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return le(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(D)),t}#h(e){return!Se()&&O(this.options.enabled,this.#t)!==!1&&ne(e)}#g(){this.#b();let e=O(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=re(this.#r.dataUpdatedAt,e)+1;this.#u=T.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return O(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=T.setInterval(()=>{(this.options.refetchIntervalInBackground||we.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(T.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(T.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ue(e,t),o=i&&Ge(e,n,t,r);(a||o)&&(l={...l,...Re(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=me(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=me(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Ke(e,t),refetch:this.refetch,isEnabled:O(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),le(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();De.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function He(e,t){return O(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||O(t.retryOnMount,e)!==!1)}function Ue(e,t){return He(e,t)||e.state.data!==void 0&&We(e,t,t.refetchOnMount)}function We(e,t,n){if(O(t.enabled,e)!==!1&&O(t.staleTime,e)!==`static`){let r=O(n,e);return r===`always`||r!==!1&&Ke(e,t)}return!1}function Ge(e,t,n,r){return(e!==t||O(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ke(e,n)}function Ke(e,t){return O(t.enabled,e)!==!1&&e.isStaleByTime(O(t.staleTime,e))}var qe=class extends Ne{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Je(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=Me({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),De.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Je(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ye=class extends Ce{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new qe({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Xe(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Xe(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Xe(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Xe(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){De.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ae(t,e))}findAll(e={}){return this.getAll().filter(t=>ae(e,t))}notify(e){De.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return De.batch(()=>Promise.all(e.map(e=>e.continue().catch(D))))}};function Xe(e){return e.options.scope?.id}var Ze=class extends Ce{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),le(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&k(t.mutationKey)!==k(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Je();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){De.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Qe=class extends Ce{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??oe(r,t),a=this.get(i);return a||(a=new Le({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){De.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ie(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ie(e,t)):t}notify(e){De.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){De.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){De.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},$e=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Qe,this.#t=e.mutationCache||new Ye,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=we.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Oe.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(O(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=te(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return De.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;De.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return De.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=De.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(D).catch(D)}invalidateQueries(e,t={}){return De.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=De.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(D)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(D)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(O(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(O(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(D).catch(D)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(D).catch(D)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Oe.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(k(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{A(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(k(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{A(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=oe(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===_e&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},et=y.createContext(!1),tt=()=>y.useContext(et);et.Provider;function nt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var rt=y.createContext(nt()),it=()=>y.useContext(rt),at=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ye(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},ot=e=>{y.useEffect(()=>{e.clearReset()},[e])},st=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ye(n,[e.error,r])),ct=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},lt=(e,t)=>e?.suspense&&t.isPending,ut=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function dt(e,t,n){let r=tt(),i=it(),a=S(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,ct(o),at(o,i,s),ot(i);let[l]=y.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(y.useSyncExternalStore(y.useCallback(e=>{let t=d?l.subscribe(De.batchCalls(e)):D;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),y.useEffect(()=>{l.setOptions(o)},[o,l]),lt(o,u))throw ut(o,l,i);if(st({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function ft(e,t){return dt(e,Ve,t)}function pt(e,t){let n=S(t),[r]=y.useState(()=>new Ze(n,e));y.useEffect(()=>{r.setOptions(e)},[r,e]);let i=y.useSyncExternalStore(y.useCallback(e=>r.subscribe(De.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=y.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(D)},[r]);if(i.error&&ye(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var mt=g(),ht=()=>new $e({defaultOptions:{queries:{retry:!1},mutations:{retry:!1}}}),gt=y.useLayoutEffect;function _t(e){return e[e.length-1]}function vt(e,t){return typeof e==`function`?e(t):e}var yt=Object.prototype.hasOwnProperty;function bt(e){for(let t in e)if(yt.call(e,t))return!0;return!1}var xt=()=>Object.create(null),St=(e,t)=>Ct(e,t,!0);function Ct(e,t,n,r=0){if(e===t)return e;if(r++>500)return t;let i=Array.isArray(e)&&Array.isArray(t);if(!i&&!(wt(e)&&wt(t)))return t;let a=Object.keys(e),o=a.length,s=Object.keys(t),c=s.length;if(i?o!==e.length||c!==t.length||o&&_t(a)!==`${o-1}`||c&&_t(s)!==`${c-1}`:o!==Object.getOwnPropertyNames(e).length||c!==Object.getOwnPropertyNames(t).length||Object.getOwnPropertySymbols(t).length)return t;let l=0,u,d,f;if(i){for(;ll&&(u=t[f],u=d===u?d:typeof d==`object`?Ct(d,u,n,r):u),p[f]=o`{}]/g;function Dt(e){return e.replace(Et,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function Ot(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Dt(t)}var kt=[`http:`,`https:`,`mailto:`,`tel:`];function At(e){if(e[0]!==`/`&&e.includes(`:`))return/^[\x00-\x20]*([a-z][a-z\d+.\t\n\r-]*:)/i.exec(e)?.[1]?.replace(/[\t\n\r]/g,``).toLowerCase()}var jt=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function Mt(e,t){if(!e)return!1;if(jt.test(e))return!0;let n=At(e);return n?!t.has(n):!1}function Nt(e){if(!e)return e;let t=e;if(/[%\\\x00-\x1f\x7f]/.test(e)){let n=/%25|%5C/gi,r=0,i;for(t=``;(i=n.exec(e))!==null;)t+=Ot(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=Ot(r?e.slice(r):e)}return t}function Pt(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Ft(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function Bt(e){return zt(Rt(e))}function Vt(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Ht(e,t,n=`never`,r){if(t.includes(`//`)&&(t=Lt(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=Lt(e)),o=e.split(`/`);o.length>1&&_t(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(_t(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?Lt(s):s)||`/`;return a&&r&&r.set(a,c),c}function Ut(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=new RegExp([...t.keys()].join(`|`).replace(/[.*()]/g,`\\$&`),`g`);return e=>e.replace(n,e=>t.get(e)??e)}function Wt(e){return e==null||e===``}function Gt(e,t,n){if(typeof t!=`string`)return``+(t??void 0);let r=e===`_splat`;if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let i=encodeURIComponent(t);return r&&(i=i.replaceAll(`%2F`,`/`)),n?n(i):i}function Kt(e,t,n,r,i){let a=e.endsWith(`/`)?`/`:``,o=``;for(let e of t){if(typeof e==`string`){o+=e;continue}let[t,s,c,l]=e,u=t===2,d=u&&l!==void 0?l+a:l,f=n[s];if(t!==3||f!=null){if(i&&(i[s]=f,u&&(i[`*`]=f)),u&&Wt(f)){if(c===`/`&&!d)continue;f=``}o+=c+Gt(s,f,r)+(d||``)}}return o+a||`/`}function qt(e){return e?.isNotFound===!0}function Jt(){try{return sessionStorage}catch{return}}var Yt=`tsr-scroll-restoration-v1_3`,Xt=Jt();function Zt(){try{return JSON.parse(Xt?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}var Qt=Zt(),$t=`data-scroll-restoration-id`,en=e=>e.state.__TSR_key||e.href;function tn(e){let t=e.getAttribute($t);if(t)return`[${$t}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var nn=!1,rn=`window`;function an(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function on(e){let t=new Set;for(let n of e){if(n===rn)continue;let e=an(n);e&&t.add(e)}return t}function sn(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.e=!0);let i=e.options.getScrollRestorationKey||en,a=new Set,o=e=>{let t=Qt[e]||={};for(let e of a)e===document?t[rn]={scrollX,scrollY}:e.isConnected&&(t[tn(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.s&&(r.s=!0,nn=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{nn||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{history.scrollRestoration=`auto`,o(i(e.stores.resolvedLocation.get()??e.stores.location.get()));try{Xt?.setItem(Yt,JSON.stringify(Qt))}catch{}}),addEventListener(`pageshow`,e=>{e.persisted&&(history.scrollRestoration=`manual`)})),!r.r&&(r.r=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.n,c=r.h,l;if(a.clear(),r.n=!0,r.h=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.e&&d&&d!==u){let e=Qt[d];if(e){let t=Qt[u];for(let n in e){if(n===rn){if(s)continue}else{let e=an(n);if(!e||s&&o&&(l??=on(o),l.has(e)))continue}t||=Qt[u]={},t[n]??=e[n]}}}nn=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=on(o));let t=e&&i&&c,s=r.e?Qt[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===rn){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=an(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{nn=!1}}))}function cn(e,t=String){let n;for(let r in e){let i=e[r];i!==void 0&&(n||=new URLSearchParams).set(r,t(i))}return n?n.toString():``}function ln(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function un(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=ln(r):Array.isArray(t)?t.push(ln(r)):n[e]=[t,ln(r)]}return n}var dn=/^(?:\s|["[{\d-]|fa|nu|tr)/,fn=mn(JSON.parse),pn=hn(JSON.stringify,JSON.parse);function mn(e){let t=e===JSON.parse;return n=>{n[0]===`?`&&(n=n.substring(1));let r=un(n);for(let n in r){let i=r[n];if(typeof i==`string`){if(t&&!dn.test(i))continue;try{r[n]=e(i)}catch{}}}return r}}function hn(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!dn.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=cn(e,r);return t?`?${t}`:``}}var gn=`__root__`;function _n(e){e.statusCode=e.statusCode||e.code||307;let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function vn(e){return e instanceof Response&&!!e.options}function yn(e){let t=new Map,n,r;return{get(e){let n=t.get(e);if(n)return n.visited=!0,n.value},set(i,a){let o=t.get(i);if(o){o.value=a;return}if(t.size>=e){let e=n?.next().value;for(;!e||e.visited;)e?e.visited=!1:n=t.values(),e=n.next().value;e===r&&(n=void 0),t.delete(e.key)}let s={key:i,value:a,visited:!1};r=s,t.set(i,s)},clear(){t.clear(),n=void 0,r=void 0}}}var bn=4,xn=5;function Sn(e){let t=e.names;if(t)return t;let n=[];for(let t of e)typeof t!=`string`&&n.push(t[1]);return e.names=n}function Cn(e,t,n){let r=e.substring(t,n);if(r.charCodeAt(0)===36)return r.length===1?[2,`_splat`,``,void 0]:[1,r.substring(1),``,``];let i=r.indexOf(`{`);if(i>=0){let a=r.indexOf(`}`,i),o=r.charCodeAt(i+1)===45,s=i+(o?3:2);if(a>=0&&r.charCodeAt(s-1)===36&&(!o||s!e.parse&&e.caseSensitive===_&&e.prefix===h&&e.suffix===g);if(y)c=y;else{let e=En(r,t,_,h,g);c=e,v.push(e),v.length===2&&i?.push(v)}}r=c}p&&m=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(a){if(_)continue;let e=t.slice(u).join(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;ee.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===bn)>(e.node.kind===bn)||t.node.kind===bn==(e.node.kind===bn)&&t.node.depth>e.node.depth)))}function Vn(e,t,n){let r=Bt(e),i=`/${r}`,a=t?i:i.toLowerCase(),o=`${a}/`,s={input:({url:e})=>{let n=t?e.pathname:e.pathname.toLowerCase();return n===a?e.pathname=`/`:n.startsWith(o)&&(e.pathname=e.pathname.slice(i.length)),e},output:({url:e})=>(e.pathname=Lt(`/${r}${e.pathname}`),e)};return n?{input:({url:e})=>Hn(n,s.input({url:e})),output:({url:e})=>s.output({url:Un(n,e)})}:s}function Hn(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Un(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Wn(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{Ft(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var Gn=`__TSR_index`,Kn=`popstate`,qn=`beforeunload`,Jn=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function Yn(e){let t=Jn.exec(e);return t?`/`+e.slice(t[0].length):e}function Xn(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,e=>` \r`.includes(e)?``:encodeURIComponent(e))),Yn(e)}function Zn(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=er(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[Gn];i=Qn(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[Gn];i=Qn(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t,n?.ignoreBlocker??!1),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[Gn]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r,_getBlockers:()=>e.getBlockers?.()??[]}}function Qn(e,t){let n=tr();return{...t,key:n,__TSR_key:n,[Gn]:e}}function $n(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=t=>Xn(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>er(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=tr();t.history.replaceState({[Gn]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(t,n,r)=>{let i=e?.createHref?s(n):void 0,a=!!g;a||(u=l),l=er(n,r),g=[i??l.href,r,g?.[2]||t],a||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(m=!1,f){f=!1;return}let e=c(),n=e.state[Gn]-l.state[Gn],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let r=a();if(typeof document<`u`&&r.length){for(let i of r)if(await i.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(-n),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0||typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=Zn({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0,m=!0),t.history.back()),forward:e=>{e&&(p=!0,m=!0),t.history.forward()},go:(e,n)=>{d=!0,n&&(p=!0,m=!0),t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(qn,x,{capture:!0}),t.removeEventListener(Kn,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return S._ignoreNextBeforeUnload=e=>{m=!1;try{e=new URL(e,t.document.baseURI).href,m=/^https?:/.test(e)&&(!e.includes(`#`)||e.split(`#`)[0]!==t.location.href.split(`#`)[0])}catch{}},t.addEventListener(qn,x,{capture:!0}),t.addEventListener(Kn,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function er(e,t){let n=Xn(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=tr();t={[Gn]:0,key:e,__TSR_key:e}}return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t}}function tr(){return(Math.random()+1).toString(36).substring(7)}function nr(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function rr(e){return e.pathname+e.search+e.hash}function ir(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function ar(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function or({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function sr(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function cr(e,t,n,r,i,a){r&&(t=t.slice(0,r)),i&&(n=n.slice(0,i));for(let r of t){if(a&&e._tx!==a)return;n.some(e=>e.routeId===r.routeId)||e.routesById[r.routeId].options.onLeave?.(r)}for(let r of n){if(a&&e._tx!==a)return;e.routesById[r.routeId].options[t.some(e=>e.routeId===r.routeId)?`onStay`:`onEnter`]?.(r)}}var lr=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={n:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options;this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.staticLocations=new WeakMap,this.protocolAllowlist=new Set(this.options.protocolAllowlist),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:$n()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`;let n=this.options.basepath??`/`,r=this.options.rewrite,i=this.basepath!==n||t?.rewrite!==r||t?.caseSensitive!==this.options.caseSensitive;if(i&&(this.basepath=n,this.rewrite=n!==`/`&&Bt(n)?Vn(n,this.options.caseSensitive,r):r),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;e=this.buildRouteTree(),this.setRoutes(e)}if(this.stores)i&&this.stores.location.set(this.latestLocation);else if(this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Wn(this.latestLocation,e),sn(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=jn(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&Dn(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:yn(1e3)}},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i},a)=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:Nt(e),external:!1,searchStr:o,search:St(t?.search,i),hash:Nt(r.slice(1)),state:Ct(t?.state,a)}}let o=Hn(this.rewrite,new URL(i,this.origin)),s=this.options.parseSearch(o.search),c=this.options.stringifySearch(s);return o.search=c,{href:o.href.replace(o.origin,``),publicHref:i,pathname:Nt(Yn(o.pathname)),external:!!this.rewrite&&nr(o,this.origin),searchStr:c,search:St(t?.search,s),hash:Nt(o.hash.slice(1)),state:Ct(t?.state,a)}},r=n(e,e.state),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i,{...i.state,__tempLocation:void 0,key:r.state.key,__TSR_key:r.state.__TSR_key});return e.maskedLocation=r,e}return r},this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=An(zt(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{{let t=this.staticLocations.get(e);if(t)return t}let t=!1,n=(n={})=>{if(n.href){let e=er(n.href,{});n={...n,to:Hn(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let r=n._fromLocation||this._pendingLocation||this.latestLocation,i,a=()=>(t=!0,r),o=()=>(t=!0,i??=this.matchRoutesLightweight(r)),s=n.to?`${n.to}`:`.`,c=Ht(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s,this.options.trailingSlash,this.resolvePathCache),l=this.routesByPath[zt(c)],u=c.includes(`$`),d;if(l)d=l._branch??=Pn(l);else if(u)d=[];else{let[e,t,n]=this.getMatchedRoutes(c);d=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(d=[...d,this.options.notFoundRoute])}let f=u?l?._interpolation??wn(!1,{fullPath:c},0):void 0,p;for(let e of d){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){let e=o()[3];if(p??=mr(n.params,e),!bt(p))break;p===e&&(p=Object.assign(xt(),p));try{Object.assign(p,t(p))}catch{}}}p??=mr(n.params,hr(n.params,f)?o()[3]:gr);let m=e.leaveParams?c:Yn(Nt(f?Kt(c,f,p,this.pathParamsDecoder):c)),h=_r(d,e._includeValidateSearch),g=()=>{let t=o()[2];if(e._includeValidateSearch&&this.options.search?.strict){let e={};d.forEach(n=>{if(n.options.validateSearch)try{Object.assign(e,pr(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},_=h.length?vr(h,g(),n):n.search===!0?g():typeof n.search==`function`?n.search(g()):n.search||gr,v=this.options.stringifySearch(_),y=n.hash===!0?a().hash:typeof n.hash==`function`?n.hash(a().hash):n.hash||void 0,b=y?`#${y}`:``,x=n.state?n.state===!0?a().state:typeof n.state==`function`?n.state(a().state):n.state:gr,S=`${m}${v}${b}`,C,w,T=!1;if(this.rewrite){let e=new URL(S,this.origin),t=e.origin,n=Un(this.rewrite,e);C=rr(e),nr(n,t)?(w=n.href,T=!0):w=Yn(rr(n))}else C=Pt(S),w=C;return{publicHref:w,href:C,pathname:m,search:_,searchStr:v,state:x,hash:y??``,external:T,unmaskOnReload:n.unmaskOnReload}},r=n(e);if(e.mask)r.maskedLocation=n({from:e.from,...e.mask});else if(this.options.routeMasks){let t=On(r.pathname,this.processedTree);if(t){let i=Object.assign(xt(),t.rawParams),{from:a,params:o,...s}=t.route,c=mr(o,i);r.maskedLocation=n({from:e.from,...s,params:c})}}return!t&&e._fromLocation&&!r.maskedLocation&&this.staticLocations.set(e,r),r},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r=n.maskedLocation??n;if(r.external)return ur(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=zt(this.latestLocation.href)===zt(n.href)&&Tt(or(n.state),or(this.latestLocation.state)),o=this._commitPromise,s,c=new Promise(e=>{s=e});if(c.resolve=()=>{s(),o?.resolve()},this._commitPromise=c,a)this.load();else{let{maskedLocation:r,hashScrollIntoView:a,...o}=n;r&&(o={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state={...o.state,__hashScrollIntoViewOptions:a??this.options.defaultHashScrollIntoView??!0},this.shouldViewTransition=e,i=n.replace?`REPLACE`:`PUSH`,this.history[i===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.n=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=n?At(n):void 0;if(a||t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i}),a=t.maskedLocation??t;n??=a.publicHref,r??=a.publicHref}let t=!a&&r?r:n;return ur(this,t,i)}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.h=e.action.type===`PUSH`||e.action.type===`REPLACE`),await ui(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(ar(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set,a=e=>{(!n||n(e))&&i.add(e.id)};t.forEach(a),this._cache.forEach(a),r?.forEach(e=>e.forEach(a)),this._tx?.[3].forEach(a);let o=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),o.push(e));let s=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&ir(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(s);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i){let t=this._flights?.get(e);this._flights?.delete(e),t&&!t[2]&&o.push(t[1])}for(let e of o)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.options,n=e.headers.get(`Location`)||t.href;if(!n){let e=this.buildLocation(t);n=(e.maskedLocation??e).publicHref||`/`}let r;if(jt.test(n)||(r=At(n))&&!this.protocolAllowlist.has(r))throw Error(`Redirect blocked: unsafe protocol`);if(r===`http:`||r===`https:`){let e=new URL(n);e.pathname.startsWith(`//`)?n=e.href:nr(e,this.origin)||(n=rr(e),r=void 0)}return r&&(t.reloadDocument=!0),t.href=n,e.headers.set(`Location`,n),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=Cr,this.preloadRoute=e=>di(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?Ht(e.from||``,e.to,this.options.trailingSlash,this.resolvePathCache):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=kn(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!Tt(o.rawParams,e.params,!0)?!1:t?.includeSearch??!0?Tt(a.search,r.search,!0)?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=Ut(e.pathParamsAllowedCharacters)),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??pn,parseSearch:e.parseSearch??fn,protocolAllowlist:e.protocolAllowlist??kt}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes(e){Object.assign(this,e),this.lightweightCache=new WeakMap,this.staticLocations=new WeakMap;let t=this.options.notFoundRoute;t&&(t.init(99999999999),this.routesById[t.id]!==t&&(t._interpolation=wn(!1,t,0)),this.routesById[t.id]=t)}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:zt(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?yr(this.options.notFoundMode,a):void 0,c=Array(a.length),l=this._committed,u=(e,t)=>{let n=l[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?l.find(t=>t.routeId===e.id):void 0},d;for(let n=0;ntypeof t!=`string`&&!yt.call(e,t[1]))}var gr=Object.freeze({});function _r(e,t){let n=[];for(let r=0;r{let n=t(i.preSearchFilters?i.preSearchFilters.reduce((e,t)=>t(e),e):e);return i.postSearchFilters?i.postSearchFilters.reduce((e,t)=>t(e),n):n});let a=i.validateSearch;t&&a&&n.push(({search:e,next:t,meta:n})=>{let r=t(e);try{let e=pr(a,r);if(n&&e)for(let t in e)t in r||(n.defaulted||=new Map).set(t,e[t]);return{...r,...e}}catch{}return r})}return n}function vr(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=vt(n.search,i);return a&&(a.explicit=e),e}return e[t]({search:i,next:(e,n)=>{if(n){let n=a||{};return{search:r(t+1,e,n),meta:n}}return r(t+1,e,a)},meta:a})};return r(0,t)}function yr(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return gn}function br(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function xr(e,t){return e.options[t]?.preload?.()}function Sr(e,t){let n=xr(e,`component`),r=xr(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function Cr(e,t,n){let r=()=>t===!1?void 0:t?xr(e,t):Sr(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function wr(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).then(()=>t.removeEventListener(`abort`,i))})}function Mr(e,t){return e.routesById[t.routeId]}function Nr(e,t,n){return vn(e)?[Or,e]:qt(e)?(e.routeId||=n,[Dr,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[Er,e]):[Tr,e]}function Pr(e,t){let n=Nr(t,!0,e.id);if(n[0]!==Er)return n;try{e.options.onError?.(n[1])}catch(t){n=Nr(t,!0,e.id)}return n}function Fr(e,t,n,r,i){return i[0].signal.aborted?kr:Zr(e,t,n,Pr(n,r),i)}async function Ir(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;ie.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return Rr(e,r),[i,Fr(e,t,u,a,n)]}if(c.aborted)return[i,kr];let p=r.paramsError??r.searchError;if(p!==void 0)return Rr(e,r),[i,Fr(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{Vr(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?jr(a,c):a);if(c.aborted)return[i,kr];let s=Zr(e,t,u,Nr(o,!1,u.id),n);if(s[0]!==Tr)return Rr(e,r),[i,s];r.context={...r.context,...o}}catch(a){return Rr(e,r),[i,Fr(e,t,u,a,n)]}finally{r.status=h,Vr(e,r,!1,n[0])}}i()}function Lr(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function Rr(e,t){let n=t._flight;t._flight=void 0,Lr(e,t,n)?.abort()}function zr(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=Lr(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function Br(e){for(let t of e){let e=t._flight;e&&e[2]++}}function Vr(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function Hr(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation:s}),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function Ur(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return kr;if(!i)return[Tr,void 0];let l=n._flight;Vr(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(Hr(e,t,n,r,s,a,!!o[3]))).then(e=>Nr(e,!1,r.id),e=>Nr(e,!0,r.id)).then(t=>(t[0]!==Tr&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===Er&&l[2]?Pr(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Zr(e,t,r,await jr(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return Rr(e,n),kr}finally{Vr(e,n,!1,s)}}function Wr(e,t,n){t[0]!==Or&&(e.status=`success`,e.error=void 0,t[0]===Tr?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function Gr(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&Rr(e,r)}function Kr(e,t){return t[0]===Er||t[0]===Dr?{...e,status:t[0]===Er?`error`:`notFound`,error:t[1],_flight:void 0}:e}function qr(e,t,n,r,i,a,o){let s=t[1][n],c=Mr(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(Hr(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=kr)),!p){if(s.status!==`success`)f=!0;else{let t=l||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,Rr(e,s),p=Fr(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!(!m||!f||s.status!==`success`||l||a[4]||((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)===`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),S=n>=o?a[7]:void 0,C=c.lazyFn&&c._lazy!==!0?S:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,Lr(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?Ur(e,t,s,c,g,i,a).then(t=>(Wr(s,t,l),t[0]===Tr&&(m&&!a[0].signal.aborted&&Gr(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[Tr,s.loaderData]),T=(async()=>{try{let e=Cr(c,void 0,C);e&&await jr(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,Fr(e,t,c,r,a)]}let r=await w;x&&r[0]===Tr&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,T]),!y)return w.then(e=>Kr(s,e));let ee={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let E=Ur(e,t,ee,c,g,i,a).then(e=>(s.isFetching=!1,Wr(ee,e,!1),e));return(t[2]??=[]).push([n,E,T,ee]),E.then(e=>Kr(ee,e))}async function Jr(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=Mr(e,t[n]);try{let e=Cr(i,!1);e&&await jr(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function Yr(e,t){t[2]&&=(zr(e,t[2].map(e=>e[3])),void 0)}async function Xr(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=Or)throw[a,t];!i&&t[0]!==Tr&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===Or)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Zr(e,t,n,r,i,a){for(;r[0]===Or;){let o=r[1],s=o.options;try{if((s.href||o.headers.has(`Location`))&&(e.resolveRedirect(o),s.reloadDocument)||(s.reloadDocument?i[3]:i[1]>=20))return r;let n=e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0}),a=n.maskedLocation??n;if(a.external){let t=o.clone();return t.options={...s},t.headers.set(`Location`,a.publicHref),e.resolveRedirect(t),i[3]?[Or,t]:[Or,t,a]}return[Or,o,n]}catch(e){r=a?[Er,e]:Pr(n,e),a=!0}}return r}async function Qr(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===Dr?Jr(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=Or)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==Tr&&t[0]=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=Or){let n=s[1];if(n[0]!==Or||n[1].options.reloadDocument||n[2])return Yr(e,t),n;c=!0,s=[0,[Er,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===Er?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};p(),i||a?.();let m=Mr(e,u);try{await jr(i?Promise.resolve().then(()=>Cr(m,l===Er?`errorComponent`:`notFoundComponent`)):Promise.all([Cr(m),Cr(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return Yr(e,t),kr}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),Yr(e,t),zr(e,o),p()):u.status=`success`}return t}async function $r(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;te._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await Jr(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l{for(let t=d;t=Or&&(c=0);p()}if(!a.aborted&&!r[3]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let h=Qr(e,i,u,r[0],Xr(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=Xr(i[2],void 0,void 0,h.then(e=>Ar(e)?0:wr(n).length,()=>0))),o=await h}catch(t){if(Yr(e,i),t===a&&a.aborted)return kr;throw t}return Ar(o)?o:$r(e,o,a,r[6]===n.length?r[6]:0)}function ti(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a0){i[3]=setTimeout(()=>ti(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function ni(e,t){let n=e._pending;(e._tx===t||!e._tx?.[3].some(e=>e.id===n?.[1]))&&(clearTimeout(n?.[3]),e._pending=void 0)}async function ri(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!wr(t[3]).some(e=>e.id===n[1]))return;let i;try{await jr(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function ii(e,t){e._committed=t,e.stores.setMatches(t)}function ai(e,t,n,r){let i=e._committed,a=e._lifecycleEnd,o=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let s=wr(n).length,c=new Map;{let t=Date.now(),r=new Set;for(let e=0;e=(n.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||c.set(n.id,o.get(n.id)===n?n:{...n,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=c;let l=e._lifecycleEnd=sr(n);ii(e,n),zr(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),cr(e,i,n,a,l,t)}async function oi(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function si(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:(i.maskedLocation??i).publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function ci(e,t,n,r,i){let a=n.map(e=>({...e}));Br(a);for(let t of r)Rr(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await Qr(e,o,r,t[0],i)}catch(t){throw zr(e,a),t}if(Ar(s))zr(e,a),s[0]===Or&&e._tx===t&&e._committed===n&&await si(e,t,s);else if(await $r(e,s,t[0].signal),e._tx!==t||e._committed!==n)zr(e,a);else{for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),Rr(e,n))}ii(e,a),zr(e,n,a)}}async function li(e,t,n,r,i,a){let o=await ei(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(Ar(o)){let n=o[0]===Or&&e._tx===t;if((!n||o[1].options.reloadDocument)&&ni(e,t),zr(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){ni(e,t);return}await si(e,t,o);return}let s=o[1];if(e._tx===t&&await ri(e,t),e._tx!==t){ni(e,t),zr(e,s),Yr(e,o);return}let c=t[2],l=ar(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await ri(e,t),e._tx!==t){ni(e,t),zr(e,s),Yr(e,o);return}let n=await e.startTransition(()=>{ni(e,t),ai(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);e._tx===t?(u?.length&&ci(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)):Yr(e,o)})}async function ui(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),!u.signal.aborted){let t=ar(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await oi(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});Br(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){zr(e,m),await oi(e,n);return}e._preflight=void 0;let g,_=()=>li(e,y,f,()=>ti(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_),y=[p,s,a,m,Date.now(),v.then(()=>oi(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&Vr(e,t,!1)}n[0].abort(),zr(e,n[3],y[3],!0)}e._tx===y?(e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&ti(e,y),g?.(_()),await y[5]):(zr(e,y[3]),y[3]=[],g?.(),await oi(e,y))}async function di(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),Br(a),o=(e._preloads??=new Map).set(i,a),s=await ei(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),zr(e,a)),i.abort()}if(!Ar(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){qt(e)||console.error(e);return}}}var fi=`Error preloading route! ☝️`,pi=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e,this._branch=void 0;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=gn:this.parentRoute||It();let r=n?gn:t?.path;r&&r!==`/`&&(r=Rt(r));let i=t?.id||r,a=n?gn:Lt((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:Lt(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=zt(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>_n({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},mi=class extends pi{constructor(e){super(e)}},hi=class extends y.Component{constructor(...e){super(...e),this.state={error:0},this.reset=()=>{this.setState({error:0})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:0}:{resetKey:n}}static getDerivedStateFromError(e){return{error:[e]}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?y.createElement(this.props.errorComponent??gi,{error:e[0],reset:this.reset}):this.props.children}};function gi({error:e}){let[t,n]=y.useState(!1);return(0,b.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,b.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,b.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,b.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,b.jsx)(`div`,{children:(0,b.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e?.message?(0,b.jsx)(`code`,{children:e.message}):null})}):null]})}var _i=()=>!0,vi=()=>!1;function yi({children:e,fallback:t=null}){return(0,b.jsx)(y.Fragment,{children:bi()?e:t})}function bi(e=!0){return y.useSyncExternalStore(xi,_i,e?vi:_i)}function xi(){return()=>{}}var Si=y.createContext(null);function Ci(e){return y.useContext(Si)}var wi=y.createContext(void 0),Ti=y.createContext(void 0);function Ei({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0)n=e.nextSub;else{for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Di(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Oi=[],ki=0,{link:Ai,unlink:ji,propagate:Mi,checkDirty:Ni,shallowPropagate:Pi}=Ei({update(e){return e._update()},notify(e){Oi[Ii++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Bi(e))}}),Fi=0,Ii=0,Li,Ri=0;function zi(e){try{++Ri,e()}finally{--Ri||Vi()}}function Bi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=ji(n,e)}function Vi(){if(!(Ri>0)){for(;Fi{i.get(),n.current?(Li=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Li,o=t?.compare??Object.is;if(n)Li=i,++ki,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Li=a,n&&(i.flags&=-5),Bi(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Ni(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Pi(e)}}else e&32&&(i.flags=e&-33);return Li!==void 0&&Ai(i,Li,ki),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Mi(e),Pi(e),Vi())}},i}function j(e){let t=()=>{let t=Li;Li=n,++ki,n.depsTail=void 0,n.flags=6;try{return e()}finally{Li=t,n.flags&=-5,Bi(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Ni(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Bi(this)}};return t(),n}var Ui=o((e=>{var t=f();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Wi=o(((e,t)=>{t.exports=Ui()})),Gi=o((e=>{var t=f(),n=Wi();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Ki=o(((e,t)=>{t.exports=Gi()}))();function qi(e,t){return e===t}function Ji(e,t=e=>e,n){let r=n?.compare??qi,i=(0,y.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,y.useCallback)(()=>e.get(),[e]);return(0,Ki.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var Yi={};function Xi(e,t){let n=y.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=Ct(n.current,i):i}}function Zi(e){let t=Ci(),n=y.useContext(e.from?Ti:wi),r=e.from??n,i=t.stores.getMatchStore(r),a=Xi(e,t),o=Ji(i,e=>e?a(e):Yi);if(o!==Yi)return o;(e.shouldThrow??!0)&&It()}function Qi(e){return Zi({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function $i(e){let{select:t,...n}=e;return Zi({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function ea(e){return Zi({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function ta(e){return Zi({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function na(e){let t=Ci();return y.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function ra(e){return Zi({...e,select:t=>e.select?e.select(t.context):t.context})}function ia(...e){let t=y.useRef(e),n=t.current;return e.forEach((e,t)=>{Tt(n[t],e,!1,!0)||(n[t]=e)}),t.current}function aa(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(fi)})}var oa={compare:(e,t)=>e[0]===t[0]&&e[1]===t[1]};function sa(e,t){let n=typeof e==`string`&&At(e);if(n)return t.has(n)?e:null}function ca(e,t,n,r,i){let a=Vt(e.pathname,r),o=Vt(t.pathname,r);return(n?.exact?a!==o:!a.startsWith(o)||a.length!==o.length&&a[o.length]!==`/`)||(n?.includeSearch??!0)&&!Tt(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||i&&e.hash===t.hash}function la(e,t,n){let r=Ci(),i=y.useRef(null),a=y.useCallback(e=>{if(i.current=e,typeof t==`function`)return t(e);t&&(t.current=e)},[t]),{activeOptions:o,to:s,preload:c,preloadDelay:l,hashScrollIntoView:u,replace:d,startTransition:f,resetScroll:p,viewTransition:m,ignoreBlocker:h,disabled:g,target:_,onClick:v,onBlur:b,onFocus:x,onMouseEnter:S,onMouseLeave:C,onTouchStart:w}=e,T=bi(!!o?.includeHash),[ee,E,D]=ia(e.search,e.params,o),[te,ne]=y.useMemo(()=>[e,{...e}],[r,e.from,e._fromLocation,e.hash,e.to,ee,E,e.state,e.mask,e.unsafeRelative]),re=y.useCallback(e=>{let t=sa(s,r.protocolAllowlist);if(t!==void 0)return[t??void 0];te._fromLocation||(ne._fromLocation=e);let n=r.buildLocation(ne),i=va(n,r,g);return[i,!g&&(!i||At(i))?void 0:ca(e,n,D,r.basepath,T)]},[D,g,T,te,ne,r,s]),[O,ie]=Ji(r.stores.location,re,oa),ae=ie===void 0?O:void 0,oe=g||O===void 0,k=y.useRef(!1),A=e.reloadDocument||ae||oe?!1:c??r.options.defaultPreload,se=l??r.options.defaultPreloadDelay??0,ce=y.useCallback(e=>{let t=e?.isIntersecting;t??A===`intent`?se?ha.has(i)||ha.set(i,setTimeout(()=>{ha.delete(i),aa(r,te)},se)):aa(r,te):t===!1&&ga(i)},[r,te,i,A,se]);y.useEffect(()=>{if(!A)return;A===`render`&&!k.current&&(k.current=!0,aa(r,te));let e=!0,t;return A===`viewport`&&i.current&&typeof IntersectionObserver==`function`&&(t=new IntersectionObserver(t=>{e&&ce(t.pop())},{rootMargin:`100px`}),t.observe(i.current)),()=>{e=!1,t?.disconnect(),ga(i)}},[r,te,A,ce,i]);let le=pa(e,n);if(le.ref=t?a:i,ae)return le.href=ae,le;let ue=e=>{let t=_??e.currentTarget.getAttribute(`target`);!oe&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!t||t===`_self`)&&e.button===0&&(e.preventDefault(),r.navigate({...te,replace:d,resetScroll:p,hashScrollIntoView:u,startTransition:f,viewTransition:m,ignoreBlocker:h}))},de=()=>{A===`intent`&&aa(r,te)},fe=()=>{A===`intent`&&ga(i)};return le.onClick=_a(v,ue),le.onBlur=_a(b,fe),le.onFocus=_a(x,ce),le.onMouseEnter=_a(S,ce),le.onMouseLeave=_a(C,fe),le.onTouchStart=_a(w,de),ma(le,e,ie,O,oe,n)}var ua={},da={className:`active`},fa=new Set([`to`,`params`,`search`,`hash`,`state`,`mask`,`from`,`unsafeRelative`,`_fromLocation`,`reloadDocument`,`preload`,`preloadDelay`,`preloadIntentProximity`,`hashScrollIntoView`,`replace`,`startTransition`,`resetScroll`,`viewTransition`,`ignoreBlocker`,`activeProps`,`inactiveProps`,`activeOptions`,`_asChild`]);function pa(e,t){let n={};for(let r in e)fa.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function ma(e,t,n,r,i,a){let{activeProps:o,inactiveProps:s,className:c,style:l,target:u}=t,d=vt(n?o:s,{})??(n?da:ua);Object.assign(e,d),e.href=r,a!==`a`&&(e.disabled=i),e.target=u;let f=d.style;(l||f)&&(e.style=l&&f?{...l,...f}:l||f);let p=d.className;return(c||p)&&(e.className=c?p?`${c} ${p}`:c:p),i&&(e.role=`link`,e[`aria-disabled`]=!0),n&&(e[`data-status`]=`active`,e[`aria-current`]=`page`),e}var ha=new WeakMap,ga=e=>{clearTimeout(ha.get(e)),ha.delete(e)},_a=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function va(e,t,n){if(n)return;let r=e.maskedLocation??e,i=r.external?r.publicHref:t.history.createHref(r.publicHref)||`/`;if(!r.external&&i===r.publicHref||!Mt(i,t.protocolAllowlist))return i}var M=y.memo(y.forwardRef((e,t)=>{let n=e._asChild||`a`,r=la(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return y.createElement(n,r,i)}),ya);function ya(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!fa.has(r)||!Tt(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}var ba=class extends pi{constructor(e){super(e),this.useMatch=e=>Zi({...e,from:this.id}),this.useRouteContext=e=>ra({...e,from:this.id}),this.useSearch=e=>ta({...e,from:this.id}),this.useParams=e=>ea({...e,from:this.id}),this.useLoaderDeps=e=>$i({...e,from:this.id}),this.useLoaderData=e=>Qi({...e,from:this.id}),this.useNavigate=()=>na({from:this.fullPath}),this.Link=y.forwardRef((e,t)=>(0,b.jsx)(M,{ref:t,from:this.fullPath,...e}))}};function N(e){return new ba(e)}var xa=class extends mi{constructor(e){super(e),this.useMatch=e=>Zi({...e,from:this.id}),this.useRouteContext=e=>ra({...e,from:this.id}),this.useSearch=e=>ta({...e,from:this.id}),this.useParams=e=>ea({...e,from:this.id}),this.useLoaderDeps=e=>$i({...e,from:this.id}),this.useLoaderData=e=>Qi({...e,from:this.id}),this.useNavigate=()=>na({from:this.fullPath}),this.Link=y.forwardRef((e,t)=>(0,b.jsx)(M,{ref:t,from:this.fullPath,...e}))}};function Sa(e){return new xa(e)}function Ca(e){let t=Ci(),n=`not-found-${Ji(t.stores.location,e=>e.pathname)}-${Ji(t.stores.status)}`;return(0,b.jsx)(hi,{getResetKey:()=>n,onCatch:(t,n)=>{if(qt(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(qt(t))return e.fallback?.(t);throw t},children:e.children})}function wa(){return(0,b.jsx)(`p`,{children:`Not Found`})}function Ta(e){return(0,b.jsx)(b.Fragment,{children:e.children})}function Ea(e,t,n){return t.options.notFoundComponent?(0,b.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,b.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,b.jsx)(wa,{})}function Da(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,b.jsx)(n,{}):null}var Oa=(e,t)=>e[0]===t[0]&&e[1]===t[1],ka=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,Aa=y.memo(function({routeId:e}){let t=Ci();return(0,b.jsx)(ja,{router:t,match:Ji(t.stores.getMatchStore(e))})});function ja({router:e,match:t}){let n=e.routesById[t.routeId],r=Da(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=ka(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?y.Suspense:Ta,l=i?hi:Ta,u=o?Ca:Ta;return(0,b.jsxs)(n.isRoot?n.options.shellComponent??Ta:Ta,{children:[(0,b.jsx)(wi.Provider,{value:t.routeId,children:(0,b.jsx)(c,{fallback:r,children:(0,b.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(qt(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:(0,b.jsx)(u,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return y.createElement(o,e)},children:s?(0,b.jsx)(yi,{fallback:r,children:(0,b.jsx)(Ma,{match:t})}):(0,b.jsx)(Ma,{match:t})})})})}),null]})}var Ma=y.memo(function({match:e}){let t=Ci(),n=e.routeId,r=t.routesById[n],i=y.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=y.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,b.jsx)(e,{},i):(0,b.jsx)(Na,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!ka(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return Da(t,r)}if(e.status===`notFound`)return Ea(t,r,e.error);if(e.status===`error`)throw e.error;return a}),Na=y.memo(function(){let e=Ci(),t=y.useContext(wi),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=Ji(a,e=>[!!e._notFound,e.error],{compare:Oa}),i=Ji(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return Ea(e,e.routesById[t],r);if(!i)return null;let a=(0,b.jsx)(Aa,{routeId:i});return t===`__root__`?(0,b.jsx)(y.Suspense,{fallback:Da(e),children:a}):a});function Pa(e,t){let n=e[1];e.length=0,n?.(t)}function Fa({t:e}){let t=Ci(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{Pa(n,!1),n.push(i,a),e(t),y.startTransition(r)}),gt(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(zt(r.publicHref)!==zt(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...ar(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function Ia(){let e=Ci(),t=e.routesById[gn],n=Da(e,t),r=e.ssr?Ta:y.Suspense,i=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(Fa,{t:y.useState()[1]}),(0,b.jsx)(r,{fallback:n,children:(0,b.jsx)(La,{})})]});return e.options.InnerWrap?(0,b.jsx)(e.options.InnerWrap,{children:i}):i}function La(){let e=Ci(),t=e._rendered,n=Ji(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;gt(()=>{t[0]===n&&Pa(t,!0)},[t,n]);let a=i?(0,b.jsx)(Aa,{routeId:i}):null;return(0,b.jsx)(wi.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,b.jsx)(hi,{getResetKey:()=>r,onCatch:void 0,children:a})})}var Ra=e=>({createMutableStore:Hi,createReadonlyStore:Hi,batch:zi}),za=e=>new Ba(e),Ba=class extends lr{constructor(e){super(e,Ra)}};function Va({router:e,children:t,...n}){bt(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,b.jsx)(Si.Provider,{value:e,children:t});return e.options.Wrap?(0,b.jsx)(e.options.Wrap,{children:r}):r}function Ha({router:e,...t}){return(0,b.jsx)(Va,{router:e,...t,children:(0,b.jsx)(Ia,{})})}var Ua=Object.freeze({density:`comfortable`,style:Object.freeze({}),theme:`light`}),Wa=typeof y.createContext==`function`?y.createContext(Ua):null,Ga=({children:e,value:t})=>Wa===null?(0,b.jsx)(b.Fragment,{children:e}):(0,b.jsx)(Wa,{value:t,children:e}),Ka=[`kind`,`schemaVersion`,`themeId`,`logoAssetId`,`light`,`dark`],qa=[`mode`,`roles`,`decorative`,`contrast`],Ja=[`primary`,`onPrimary`,`secondary`,`accent`,`accentSubtle`],Ya=/^#[0-9A-F]{6}$/u,Xa=(e,t,n)=>{if(typeof e!=`object`||!e||Object.getPrototypeOf(e)!==Object.prototype)throw TypeError(`${n} must be a plain data object`);if(Object.getOwnPropertySymbols(e).length!==0)throw TypeError(`${n} must not contain symbol properties`);let r=Object.getOwnPropertyDescriptors(e),i=Object.keys(r).sort(),a=[...t].sort();if(i.length!==a.length||i.some((e,t)=>e!==a[t]))throw TypeError(`${n} has an invalid structure`);for(let e of Object.values(r))if(!(`value`in e))throw TypeError(`${n} must not contain accessors`);return Object.fromEntries(Object.entries(r).map(([e,t])=>[e,t.value]))},Za=(e,t)=>{let n=Xa(e,Ka,`tenantTheme`);if(n.kind!==`leans-workspace-brand-theme`||n.schemaVersion!==1)throw TypeError(`tenantTheme is not a compiled Leans workspace theme`);if(typeof n.themeId!=`string`||n.themeId.length===0)throw TypeError(`tenantTheme.themeId is invalid`);let r=Xa(n[t],qa,`tenantTheme.${t}`);if(r.mode!==t)throw TypeError(`tenantTheme.${t}.mode is invalid`);let i=Xa(r.roles,Ja,`tenantTheme.${t}.roles`),a={};for(let e of Ja){let n=i[e];if(typeof n!=`string`||!Ya.test(n))throw TypeError(`tenantTheme.${t}.roles.${e} is invalid`);a[e]=n}return Object.freeze(a)},Qa=(e,t)=>{if(e==null)return{};let n=Za(e,t);return{"--leans-semantic-color-primary":n.primary,"--leans-semantic-color-on-primary":n.onPrimary,"--leans-semantic-color-text-secondary":n.secondary,"--leans-semantic-color-accent":n.accent,"--leans-semantic-color-accent-subtle":n.accentSubtle}},$a=e=>Object.fromEntries(Object.entries(e).filter(([e])=>e.startsWith(`--leans-`))),eo=({children:e,className:t,density:n=`comfortable`,style:r,tenantTheme:i,theme:a=`light`,...o})=>{let s=t===void 0?`leans-provider`:`leans-provider ${t}`,c={...Qa(i,a),...r},l={density:n,style:$a(c),theme:a};return(0,b.jsx)(Ga,{value:l,children:(0,b.jsx)(`div`,{...o,className:s,"data-leans-density":n,"data-leans-theme":a,style:c,children:e})})};function to(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}var no=typeof document<`u`?y.useLayoutEffect:()=>{},ro={prefix:String(Math.round(Math.random()*1e10)),current:0},io=y.createContext(ro),ao=y.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement;var oo=new WeakMap;function so(e=!1){let t=(0,y.useContext)(io),n=(0,y.useRef)(null);if(n.current===null&&!e){let e=y.default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(e){let n=oo.get(e);n==null?oo.set(e,{id:t.current,state:e.memoizedState}):e.memoizedState!==n.state&&(t.current=n.id,oo.delete(e))}n.current=++t.current}return n.current}function co(e){let t=(0,y.useContext)(io),n=so(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function lo(e){let t=y.useId(),[n]=(0,y.useState)(ho()),r=n?`react-aria`:`react-aria${ro.prefix}`;return e||`${r}-${t}`}var uo=typeof y.useId==`function`?lo:co;function fo(){return!1}function po(){return!0}function mo(e){return()=>{}}function ho(){return typeof y.useSyncExternalStore==`function`?y.useSyncExternalStore(mo,fo,po):(0,y.useContext)(ao)}var go=!!(typeof window<`u`&&window.document&&window.document.createElement),_o=new Map,vo;typeof FinalizationRegistry<`u`&&(vo=new FinalizationRegistry(e=>{_o.delete(e)}));var yo=new WeakMap;function P(e){let[t,n]=(0,y.useState)(e),r=(0,y.useRef)(null),i=uo(t),a=(0,y.useRef)(null),o=yo.get(a);if(vo&&o!==i&&(o!=null&&vo.unregister(a),vo.register(a,i,a),yo.set(a,i)),go){let e=_o.get(i);e&&!e.includes(r)?e.push(r):_o.set(i,[r])}return no(()=>{let e=i;return()=>{vo&&(vo.unregister(a),yo.delete(a)),_o.delete(e)}},[i]),(0,y.useEffect)(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),i}function bo(e,t){if(e===t)return e;let n=_o.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=_o.get(t);return r?(r.forEach(t=>t.current=e),e):t}function xo(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=So(e,t);return n||=typeof r==`function`,r});if(n)return()=>{r.forEach((t,n)=>{typeof t==`function`?t():So(e[n],null)})}}}function So(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Co(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t=65&&e.charCodeAt(2)<=90?t[e]=to(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=wo(n,i):e===`id`&&n&&i?t.id=bo(n,i):e===`ref`&&n&&i?t.ref=xo(n,i):t[e]=i===void 0?n:i}}return t}function Eo(e){let t=(0,y.useRef)(null),n=(0,y.useRef)(void 0),r=(0,y.useCallback)(t=>{if(typeof e==`function`){let n=e,r=n(t);return()=>{typeof r==`function`?r():n(null)}}if(e)return e.current=t,()=>{e.current=null}},[e]);return(0,y.useMemo)(()=>({get current(){return t.current},set current(e){t.current=e,n.current&&=(n.current(),void 0),e!=null&&(n.current=r(e))}}),[r])}var Do=Symbol(`default`);function Oo(e){let{className:t,style:n,children:r,defaultClassName:i,defaultChildren:a,defaultStyle:o,values:s,render:c}=e;return(0,y.useMemo)(()=>{let e,l,u;return e=typeof t==`function`?t({...s,defaultClassName:i}):t,l=typeof n==`function`?n({...s,defaultStyle:o||{}}):n,u=typeof r==`function`?r({...s,defaultChildren:a}):r??a,{className:e??i,style:l||o?{...o,...l}:void 0,children:u??a,"data-rac":``,render:c?e=>c(e,s):void 0}},[t,n,r,i,a,o,s,c])}function ko(e,t){let n=(0,y.useContext)(e);if(t===null)return null;if(n&&typeof n==`object`&&`slots`in n&&n.slots){let e=t||Do;if(!n.slots[e]){let e=new Intl.ListFormat().format(Object.keys(n.slots).map(e=>`"${e}"`)),r=t?`Invalid slot "${t}".`:`A slot prop is required.`;throw Error(`${r} Valid slot names are ${e}.`)}return n.slots[e]}return n}function Ao(e,t,n){let{ref:r,...i}=ko(n,e.slot)||{},a=Eo((0,y.useMemo)(()=>xo(t,r),[t,r])),o=To(i,e);return`style`in i&&i.style&&`style`in e&&e.style&&(o.style=typeof i.style==`function`||typeof e.style==`function`?t=>{let n=typeof i.style==`function`?i.style(t):i.style,r={...t.defaultStyle,...n},a=typeof e.style==`function`?e.style({...t,defaultStyle:r}):e.style;return{...r,...a}}:{...i.style,...e.style}),[o,a]}function jo(e,t,n){let{render:r,...i}=t,a=(0,y.useRef)(null),o=(0,y.useMemo)(()=>xo(n,a),[n,a]);no(()=>{},[e,r]);let s={...i,ref:o};return r?r(s,void 0):y.createElement(e,s)}var Mo={},No=new Proxy({},{get(e,t){if(typeof t!=`string`)return;let n=Mo[t];return n||(n=(0,y.forwardRef)(jo.bind(null,t)),Mo[t]=n),n}});typeof HTMLTemplateElement<`u`&&(Object.defineProperty(HTMLTemplateElement.prototype,"firstChild",{configurable:!0,enumerable:!0,get:function(){return this.content.firstChild}}),Object.defineProperty(HTMLTemplateElement.prototype,"appendChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.appendChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"removeChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.removeChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"insertBefore",{configurable:!0,enumerable:!0,value:function(e,t){return this.content.insertBefore(e,t)}}));var Po=(0,y.createContext)(!1);function Fo(e){let t=(t,n)=>(0,y.useContext)(Po)?null:e(t,n);return t.displayName=e.displayName||e.name,(0,y.forwardRef)(t)}var Io=new Set([`id`]),Lo=new Set([`aria-label`,`aria-labelledby`,`aria-describedby`,`aria-details`]),Ro=new Set([`href`,`hrefLang`,`target`,`rel`,`download`,`ping`,`referrerPolicy`]),zo=new Set([`dir`,`lang`,`hidden`,`inert`,`translate`]),Bo=new Set(`onClick.onAuxClick.onContextMenu.onDoubleClick.onMouseDown.onMouseEnter.onMouseLeave.onMouseMove.onMouseOut.onMouseOver.onMouseUp.onTouchCancel.onTouchEnd.onTouchMove.onTouchStart.onPointerDown.onPointerMove.onPointerUp.onPointerCancel.onPointerEnter.onPointerLeave.onPointerOver.onPointerOut.onGotPointerCapture.onLostPointerCapture.onScroll.onWheel.onAnimationStart.onAnimationEnd.onAnimationIteration.onTransitionCancel.onTransitionEnd.onTransitionRun.onTransitionStart`.split(`.`)),Vo=/^(data-.*)$/;function Ho(e,t={}){let{labelable:n,isLink:r,global:i,events:a=i,propNames:o}=t,s={};for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(Io.has(t)||n&&Lo.has(t)||r&&Ro.has(t)||i&&zo.has(t)||a&&(Bo.has(t)||t.endsWith(`Capture`)&&Bo.has(t.slice(0,-7)))||o?.has(t)||Vo.test(t))&&(s[t]=e[t]);return s}var Uo=(0,y.createContext)(null),Wo=7e3,Go=null;function Ko(e,t=`assertive`,n=Wo){Go?Go.announce(e,t,n):(Go=new qo,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?Go.announce(e,t,n):setTimeout(()=>{Go?.isAttached()&&Go?.announce(e,t,n)},100))}var qo=class{constructor(){this.node=null,this.assertiveLog=null,this.politeLog=null,typeof document<`u`&&(this.node=document.createElement(`div`),this.node.dataset.liveAnnouncer=`true`,Object.assign(this.node.style,{border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`}),this.assertiveLog=this.createLog(`assertive`),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog(`polite`),this.node.appendChild(this.politeLog),document.body.prepend(this.node))}isAttached(){return this.node?.isConnected}createLog(e){let t=document.createElement(`div`);return t.setAttribute(`role`,`log`),t.setAttribute(`aria-live`,e),t.setAttribute(`aria-relevant`,`additions`),t}destroy(){this.node&&=(document.body.removeChild(this.node),null)}announce(e,t=`assertive`,n=Wo){if(!this.node)return;let r=document.createElement(`div`);typeof e==`object`?(r.setAttribute(`role`,`img`),r.setAttribute(`aria-labelledby`,e[`aria-labelledby`])):r.textContent=e,t===`assertive`?this.assertiveLog?.appendChild(r):this.politeLog?.appendChild(r),e!==``&&setTimeout(()=>{r.remove()},n)}clear(e){this.node&&((!e||e===`assertive`)&&this.assertiveLog&&(this.assertiveLog.innerHTML=``),(!e||e===`polite`)&&this.politeLog&&(this.politeLog.innerHTML=``))}};function Jo(e){if(Xo())e.focus({preventScroll:!0});else{let t=Zo(e);e.focus(),Qo(t)}}var Yo=null;function Xo(){if(Yo==null){Yo=!1;try{document.createElement(`div`).focus({get preventScroll(){return Yo=!0,!0}})}catch{}}return Yo}function Zo(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeightns(e)?e.document:rs(e)?e:e?.ownerDocument??(typeof document<`u`?document:void 0),es=e=>$o(e)?.defaultView??(typeof window<`u`?window:void 0);function ts(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function ns(e){return typeof e==`object`&&!!e&&`window`in e&&e.window===e}function rs(e){return ts(e)&&e.nodeType===9}function is(e){return ts(e)&&e.nodeType===11&&`host`in e}var as=!1;function os(){return as}function ss(e,t){if(!os())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n=typeof n.assignedElements!=`function`&&n.assignedSlot?.parentNode?n.assignedSlot.parentNode:is(n)?n.host:n.parentNode}return!1}var cs=(e=document)=>{if(!os())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function F(e){if(os()&&e.target instanceof Element&&e.target.shadowRoot){if(`composedPath`in e)return e.composedPath()[0]??null;if(`composedPath`in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}var ls=typeof Element<`u`&&`checkVisibility`in Element.prototype;function us(e){let t=es(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:r}=e.style,i=n!==`none`&&r!==`hidden`&&r!==`collapse`;if(i){let{getComputedStyle:t}=es(e),{display:n,visibility:r}=t(e);i=n!==`none`&&r!==`hidden`&&r!==`collapse`}return i}function ds(e,t){return!e.hasAttribute(`hidden`)&&!e.hasAttribute(`data-react-aria-prevent-focus`)&&(e.nodeName===`DETAILS`&&t&&t.nodeName!==`SUMMARY`?e.hasAttribute(`open`):!0)}function fs(e,t){return ls?e.checkVisibility({visibilityProperty:!0})&&!e.closest(`[data-react-aria-prevent-focus]`):e.nodeName!==`#comment`&&us(e)&&ds(e,t)&&(!e.parentElement||fs(e.parentElement,e))}var ps=[`input:not([disabled]):not([type=hidden])`,`select:not([disabled])`,`textarea:not([disabled])`,`button:not([disabled])`,`a[href]`,`area[href]`,`summary`,`iframe`,`object`,`embed`,`audio[controls]`,`video[controls]`,`[contenteditable]:not([contenteditable^="false"])`,`permission`],ms=ps.join(`:not([hidden]),`)+`,[tabindex]:not([disabled]):not([hidden])`;ps.push(`[tabindex]:not([tabindex="-1"]):not([disabled])`),ps.join(`:not([hidden]):not([tabindex="-1"]),`);function hs(e,t){return e.matches(ms)&&!gs(e)&&(t?.skipVisibilityCheck||fs(e))}function gs(e){let t=e;for(;t!=null;){if(t instanceof es(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}function _s(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function vs(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function ys(e){let t=(0,y.useRef)({isFocused:!1,observer:null});return no(()=>{let e=t.current;return()=>{e.observer&&=(e.observer.disconnect(),null)}},[]),(0,y.useCallback)(n=>{let r=F(n);if(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement){t.current.isFocused=!0;let n=r;n.addEventListener(`focusout`,r=>{if(t.current.isFocused=!1,n.disabled){let t=_s(r);e?.(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)},{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&n.disabled){t.current.observer?.disconnect();let e=n===cs()?null:cs();n.dispatchEvent(new FocusEvent(`blur`,{relatedTarget:e})),n.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0,relatedTarget:e}))}}),t.current.observer.observe(n,{attributes:!0,attributeFilter:[`disabled`]})}},[e])}var bs=!1;function xs(e){for(;e&&!hs(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=cs(es(e).document);if(!t||t===e)return;let n=e?.getRootNode(),r=n!=null&&is(n)?n:es(e),i=t=>t===e||t!=null&&ss(e,t),a=e=>e===t||t!=null&&e!=null&&ss(t,e);bs=!0;let o=!1,s=e=>{(a(F(e))||o)&&e.stopImmediatePropagation()},c=n=>{(a(F(n))||o)&&(n.stopImmediatePropagation(),!e&&!o&&(o=!0,Jo(t),d()))},l=e=>{(i(F(e))||o)&&e.stopImmediatePropagation()},u=e=>{(i(F(e))||o)&&(e.stopImmediatePropagation(),o||(o=!0,Jo(t),d()))};r.addEventListener(`blur`,s,!0),r.addEventListener(`focusout`,c,!0),r.addEventListener(`focusin`,u,!0),r.addEventListener(`focus`,l,!0);let d=()=>{cancelAnimationFrame(f),r.removeEventListener(`blur`,s,!0),r.removeEventListener(`focusout`,c,!0),r.removeEventListener(`focusin`,u,!0),r.removeEventListener(`focus`,l,!0),bs=!1,o=!1},f=requestAnimationFrame(d);return d}function Ss(e){if(typeof window>`u`||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(t=>e.test(t.brand))||e.test(window.navigator.userAgent)}function Cs(e){return typeof window<`u`&&window.navigator!=null&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function ws(e){let t=null;return()=>(t??=e(),t)}var Ts=ws(function(){return Cs(/^Mac/i)}),Es=ws(function(){return Cs(/^iPhone/i)}),Ds=ws(function(){return Cs(/^iPad/i)||Ts()&&navigator.maxTouchPoints>1}),Os=ws(function(){return Es()||Ds()}),ks=ws(function(){return Ss(/AppleWebKit/i)&&(Os()||!As())}),As=ws(function(){return Ss(/Chrome|CriOS|CrMo/i)}),js=ws(function(){return Ss(/Android/i)}),Ms=ws(function(){return Ss(/(Firefox|FxiOS)/i)});function Ns(e){return e.pointerType===``&&e.isTrusted?!0:js()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Ps(e){return!js()&&e.width===0&&e.height===0||js()&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`}function Fs(e,t,n=!0){let{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}=t;!ks()&&Ms()&&window.event?.type?.startsWith(`key`)&&e.target===`_blank`&&(Ts()?r=!0:i=!0);let s=ks()&&Ts()&&!Ds()?new KeyboardEvent(`keydown`,{keyIdentifier:`Enter`,metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}):new MouseEvent(`click`,{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o,detail:1,bubbles:!0,cancelable:!0});Fs.isOpening=n,Jo(e),e.dispatchEvent(s),Fs.isOpening=!1}Fs.isOpening=!1;var Is=null,Ls=new Set,Rs=new Map,zs=!1,Bs=!1,Vs={Tab:!0,Escape:!0};function Hs(e,t){for(let n of Ls)n(e,t)}function Us(e){return!(e.metaKey||!Ts()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function Ws(e){zs=!0,!Fs.isOpening&&Us(e)&&(Is=`keyboard`,Hs(`keyboard`,e))}function Gs(e){Is=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(zs=!0,Hs(`pointer`,e))}function Ks(e){!Fs.isOpening&&Ns(e)&&(zs=!0,Is=`virtual`)}function qs(e){if(bs)return;let t=F(e),n=es(t),r=$o(t);t===n?Bs=!0:t!==r&&e.isTrusted&&(!zs&&!Bs&&(Is=`virtual`,Hs(`virtual`,e)),zs=!1,Bs=!1)}function Js(){bs||(zs=!1,Bs=!0)}function Ys(e){if(typeof window>`u`||typeof document>`u`)return;let t=es(e),n=$o(e);if(Rs.get(t))return;let r=t.HTMLElement.prototype.focus;Reflect.defineProperty(t.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(){zs=!0,r.apply(this,arguments)}}),n.addEventListener(`keydown`,Ws,!0),n.addEventListener(`keyup`,Ws,!0),n.addEventListener(`click`,Ks,!0),t.addEventListener(`focus`,qs,!0),t.addEventListener(`blur`,Js,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,Gs,!0),n.addEventListener(`pointermove`,Gs,!0),n.addEventListener(`pointerup`,Gs,!0)),t.addEventListener(`beforeunload`,()=>{Xs(e)},{once:!0}),Rs.set(t,{focus:r})}var Xs=(e,t)=>{let n=es(e),r=$o(e);t&&r.removeEventListener(`DOMContentLoaded`,t),Rs.has(n)&&(Reflect.defineProperty(n.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:Rs.get(n).focus}),r.removeEventListener(`keydown`,Ws,!0),r.removeEventListener(`keyup`,Ws,!0),r.removeEventListener(`click`,Ks,!0),n.removeEventListener(`focus`,qs,!0),n.removeEventListener(`blur`,Js,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,Gs,!0),r.removeEventListener(`pointermove`,Gs,!0),r.removeEventListener(`pointerup`,Gs,!0)),Rs.delete(n))};function Zs(e){let t=$o(e),n;return t.readyState===`loading`?(n=()=>{Ys(e)},t.addEventListener(`DOMContentLoaded`,n)):Ys(e),()=>Xs(e,n)}typeof document<`u`&&Zs();function Qs(){return Is!==`pointer`}function $s(){return Is}var ec=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function tc(e,t,n){let r=n?F(n):void 0,i=$o(r),a=es(r),o=a===void 0?HTMLInputElement:a.HTMLInputElement,s=a===void 0?HTMLTextAreaElement:a.HTMLTextAreaElement,c=a===void 0?HTMLElement:a.HTMLElement,l=a===void 0?KeyboardEvent:a.KeyboardEvent,u=cs(i);return e=e||u instanceof o&&!ec.has(u.type)||u instanceof s||u instanceof c&&u.isContentEditable,!(e&&t===`keyboard`&&n instanceof l&&!Vs[n.key])}function nc(e,t,n){Ys(),(0,y.useEffect)(()=>{if(n?.enabled===!1)return;let t=(t,r)=>{tc(!!n?.isTextInput,t,r)&&e(Qs())};return Ls.add(t),()=>{Ls.delete(t)}},t)}var rc=new Map,ic=new Set;function ac(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{let r=F(t);if(!e(t)||!r)return;let i=rc.get(r);i||(i=new Set,rc.set(r,i),r.addEventListener(`transitioncancel`,n,{once:!0})),i.add(t.propertyName)},n=t=>{let r=F(t);if(!e(t)||!r)return;let i=rc.get(r);if(i&&(i.delete(t.propertyName),i.size===0&&(r.removeEventListener(`transitioncancel`,n),rc.delete(r)),rc.size===0)){for(let e of ic)e();ic.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,ac):ac());function oc(){for(let[e]of rc)`isConnected`in e&&!e.isConnected&&rc.delete(e)}function sc(e){requestAnimationFrame(()=>{oc(),rc.size===0?e():ic.add(e)})}function cc(e){if(!e.isConnected)return;let t=$o(e);if($s()===`virtual`){let n=cs(t);sc(()=>{let r=cs(t);(r===n||r===t.body)&&e.isConnected&&Jo(e)})}else Jo(e)}function lc(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:i}=e,a=(0,y.useCallback)(e=>{if(F(e)===e.currentTarget)return r&&r(e),i&&i(!1),!0},[r,i]),o=ys(a),s=(0,y.useCallback)(e=>{let t=F(e),r=$o(t),a=r?cs(r):cs();t===e.currentTarget&&t===a&&(n&&n(e),i&&i(!0),o(e))},[i,n,o]);return{focusProps:{onFocus:!t&&(n||i||r)?s:void 0,onBlur:!t&&(r||i)?a:void 0}}}function uc(e){if(e)return t=>{let n=!0;e({...t,preventDefault(){t.preventDefault()},isDefaultPrevented(){return t.isDefaultPrevented()},stopPropagation(){n=!0},continuePropagation(){n=!1,typeof t.continuePropagation==`function`&&t.continuePropagation()},isPropagationStopped(){return n}}),n&&!(typeof t.isPropagationStopped==`function`&&t.isPropagationStopped())&&t.stopPropagation()}}var dc=new Set([`shift`,`alt`,`control`,`meta`,`mod`]),fc=[`Alt`,`Control`,`Meta`,`Shift`];function pc(e){let t=new Set;return e.alt&&t.add(`Alt`),e.shift&&t.add(`Shift`),e.ctrl&&t.add(`Control`),e.meta&&t.add(`Meta`),e.mod&&t.add(Ts()?`Meta`:`Control`),t}function mc(e){let t=new Set;return e.altKey&&t.add(`Alt`),e.ctrlKey&&t.add(`Control`),e.metaKey&&t.add(`Meta`),e.shiftKey&&t.add(`Shift`),t}function hc(e){return fc.filter(t=>e.has(t))}function gc(e){let t=e.split(`+`).reduce((e,t)=>{let n=t.toLowerCase();return dc.has(n)?n===`shift`?e.shift=!0:n===`alt`?e.alt=!0:n===`control`?e.ctrl=!0:n===`meta`?e.meta=!0:n===`mod`&&(e.mod=!0):e.key=t,e},{shift:!1,alt:!1,ctrl:!1,meta:!1,mod:!1,key:``});if(t.key===``)throw Error(`Invalid keyboard shortcut: "${e}". Must include exactly one non-modifier key (e.g. "a", "Enter", "ArrowDown"). Combine any of Shift, Alt, Ctrl, Meta, and Mod.`);return t}function _c(e){return e.toLowerCase()}var vc={space:` `,esc:`escape`,del:`delete`,ins:`insert`,left:`arrowleft`,right:`arrowright`,up:`arrowup`,down:`arrowdown`,pageup:`pageup`,pagedown:`pagedown`};function yc(e){let t=_c(e);return vc[t]??t}function bc(e){let t=hc(pc(e)),n=yc(e.key);return t.length>0?`${t.join(`+`)}+${n}`:n}function xc(e){let t=hc(mc(e)),n=_c(e.key);return(t.length>0?`${t.join(`+`)}+`:``)+n}function Sc(e){let t=new Map;for(let[n,r]of Object.entries(e)){let e=gc(n);t.set(bc(e),r)}return e=>{let n=xc(e),r=t.get(n),i=r?.(e);i===void 0&&r!==void 0?i={shouldContinuePropagation:!1,shouldPreventDefault:!0}:typeof i==`boolean`&&(i={shouldContinuePropagation:!i,shouldPreventDefault:i}),i?.shouldPreventDefault&&e.preventDefault(),(!r||i?.shouldContinuePropagation)&&e.continuePropagation()}}function Cc(e){let{shortcuts:t,allowRepeats:n=!1,allowComposing:r=!1}=e,i,a;if(t){let o=Sc(t),s=uc(e=>{ss(e.currentTarget,F(e))?e.nativeEvent?.repeat&&!n||e.nativeEvent?.isComposing&&!r?e.continuePropagation():o(e):e.continuePropagation()}),c=uc(e=>{ss(e.currentTarget,F(e))&&(e.nativeEvent?.repeat&&!n||e.nativeEvent?.isComposing),e.continuePropagation()});i=e.onKeyDown?to(e.onKeyDown,s):s,a=e.onKeyUp?to(e.onKeyUp,c):c}else i=uc(e.onKeyDown),a=uc(e.onKeyUp);return{keyboardProps:e.isDisabled?{}:{onKeyDown:i,onKeyUp:a}}}function wc(e,t){no(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}var Tc=y.createContext(null);function Ec(e){let t=(0,y.useContext)(Tc)||{};wc(t,e);let{ref:n,...r}=t;return r}function Dc(e,t){let{focusProps:n}=lc(e),{keyboardProps:r}=Cc(e),i=To(n,r),a=Ec(t),o=e.isDisabled?{}:a,s=(0,y.useRef)(e.autoFocus);(0,y.useEffect)(()=>{s.current&&t.current&&cc(t.current),s.current=!1},[t]);let c=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(c=void 0),{focusableProps:To({...i,tabIndex:c},o)}}var Oc=`default`,kc=``,Ac=new WeakMap;function jc(e){if(Os()&&ks()){if(Oc==="default"){let t=$o(e);kc=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect=`none`}Oc=`disabled`}else if(e instanceof HTMLElement||e instanceof SVGElement){let t=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;Ac.set(e,e.style[t]),e.style[t]=`none`}}function Mc(e){if(Os()&&ks()){if(Oc!==`disabled`)return;Oc=`restoring`,setTimeout(()=>{sc(()=>{if(Oc===`restoring`){let t=$o(e);t.documentElement.style.webkitUserSelect===`none`&&(t.documentElement.style.webkitUserSelect=kc||``),kc=``,Oc=`default`}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&Ac.has(e)){let t=Ac.get(e),n=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;e.style[n]===`none`&&(e.style[n]=t),e.getAttribute(`style`)===``&&e.removeAttribute(`style`),Ac.delete(e)}}function Nc(e,t){let n=es(t),r=$o(t);if(r==null||n==null)return;let i,a=`meta[name="${CSS.escape(e)}"], meta[property="${CSS.escape(e)}"]`,o=r.querySelector(a);return o&&o instanceof n.HTMLMetaElement&&(e===`csp-nonce`&&o.nonce&&(i??=o.nonce||void 0),o.content&&(i??=o.content||void 0)),e===`csp-nonce`&&(i??=n.__webpack_nonce__||globalThis.__webpack_nonce__||void 0),i}var Pc=new WeakMap;function Fc(e){let t=$o(e),n=Pc.get(t);return n??=Nc(`csp-nonce`,t),n!==void 0&&Pc.set(t,n),n}var Ic=y.createContext({register:()=>{}});Ic.displayName=`PressResponderContext`;var Lc=y.useInsertionEffect??no;function Rc(e){let t=(0,y.useRef)(null);return Lc(()=>{t.current=e},[e]),(0,y.useCallback)((...e)=>{let n=t.current;return n?.(...e)},[])}function zc(){let e=(0,y.useRef)(new Map),t=(0,y.useCallback)((t,n,r,i)=>{let a=i?.once?(...t)=>{e.current.delete(r),r(...t)}:r;e.current.set(r,{type:n,eventTarget:t,fn:a,options:i}),t.addEventListener(n,a,i)},[]),n=(0,y.useCallback)((t,n,r,i)=>{let a=e.current.get(r)?.fn||r;t.removeEventListener(n,a,i),e.current.delete(r)},[]),r=(0,y.useCallback)(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return(0,y.useEffect)(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}var Bc=m();function Vc(e){let t=(0,y.useContext)(Ic);if(t){let{register:n,ref:r,...i}=t;e=To(i,e),n()}return wc(t,e.ref),e}var Hc=class{#e;constructor(e,t,n,r){this.#e=!0;let i=(r?.target??n.currentTarget)?.getBoundingClientRect(),a,o=0,s,c=null;n.clientX!=null&&n.clientY!=null&&(s=n.clientX,c=n.clientY),i&&(s!=null&&c!=null?(a=s-i.left,o=c-i.top):(a=i.width/2,o=i.height/2)),this.type=e,this.pointerType=t,this.target=n.currentTarget,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.x=a,this.y=o,this.key=n.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}},Uc=Symbol(`linkClicked`),Wc=`react-aria-pressable-style`,Gc=`data-react-aria-pressable`;function Kc(e){let{onPress:t,onPressChange:n,onPressStart:r,onPressEnd:i,onPressUp:a,onClick:o,isDisabled:s,isPressed:c,preventFocusOnPress:l,shouldCancelOnPointerExit:u,allowTextSelectionOnPress:d,ref:f,...p}=Vc(e),[m,h]=(0,y.useState)(!1),g=(0,y.useRef)({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:_,removeAllGlobalListeners:v}=zc(),b=(0,y.useCallback)((e,t)=>{let i=g.current;if(s||i.didFirePressStart)return!1;let a=!0;if(i.isTriggeringEvent=!0,r){let n=new Hc(`pressstart`,t,e);r(n),a=n.shouldStopPropagation}return n&&n(!0),i.isTriggeringEvent=!1,i.didFirePressStart=!0,h(!0),a},[s,r,n]),x=(0,y.useCallback)((e,r,a=!0)=>{let o=g.current;if(!o.didFirePressStart)return!1;o.didFirePressStart=!1,o.isTriggeringEvent=!0;let c=!0;if(i){let t=new Hc(`pressend`,r,e);i(t),c=t.shouldStopPropagation}if(n&&n(!1),h(!1),t&&a&&!s){let n=new Hc(`press`,r,e);t(n),c&&=n.shouldStopPropagation}return o.isTriggeringEvent=!1,c},[s,i,n,t]),S=Rc(x),C=Rc((0,y.useCallback)((e,t)=>{let n=g.current;if(s)return!1;if(a){n.isTriggeringEvent=!0;let r=new Hc(`pressup`,t,e);return a(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[s,a])),w=(0,y.useCallback)(e=>{let t=g.current;if(t.isPressed&&t.target){t.didFirePressStart&&t.pointerType!=null&&x(Yc(t.target,e),t.pointerType,!1),t.isPressed=!1,t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,v(),d||Mc(t.target);for(let e of t.disposables)e();t.disposables=[]}},[d,v,x]),T=Rc(w);(0,y.useEffect)(()=>{s&&g.current.isPressed&&T({currentTarget:g.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[s]);let ee=(0,y.useCallback)(e=>{u&&w(e)},[u,w]),E=(0,y.useCallback)(e=>{s||o?.(e)},[s,o]),D=(0,y.useCallback)((e,t)=>{if(!s&&o){let n=new MouseEvent(`click`,e);vs(n,t),o(_s(n))}},[s,o]),te=(0,y.useMemo)(()=>{let e=g.current,t={onKeyDown(t){if(Jc(t.nativeEvent,t.currentTarget)&&ss(t.currentTarget,F(t))){Zc(F(t),t.key)&&t.preventDefault();let r=!0;!e.isPressed&&!t.repeat&&(e.target=t.currentTarget,e.isPressed=!0,e.pointerType=`keyboard`,r=b(t,`keyboard`));let i=t.currentTarget;_($o(t.currentTarget),`keyup`,to(t=>{Jc(t,i)&&!t.repeat&&ss(i,F(t))&&e.target&&C(Yc(e.target,t),`keyboard`)},n),!0),r&&t.stopPropagation(),t.metaKey&&Ts()&&e.metaKeyEvents?.set(t.key,t.nativeEvent)}else t.key===`Meta`&&(e.metaKeyEvents=new Map)},onClick(t){if((!t||ss(t.currentTarget,F(t)))&&t&&t.button===0&&!e.isTriggeringEvent&&!Fs.isOpening){let n=!0;if(s&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType===`virtual`||Ns(t.nativeEvent))){let e=b(t,`virtual`),r=C(t,`virtual`),i=S(t,`virtual`);E(t),n=e&&r&&i}else if(e.isPressed&&e.pointerType!==`keyboard`){let r=e.pointerType||t.nativeEvent.pointerType||`virtual`,i=C(Yc(t.currentTarget,t),r),a=S(Yc(t.currentTarget,t),r,!0);n=i&&a,e.isOverTarget=!1,E(t),T(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}},n=t=>{if(e.isPressed&&e.target&&Jc(t,e.target)){Zc(F(t),t.key)&&t.preventDefault();let n=F(t),r=ss(e.target,n);S(Yc(e.target,t),`keyboard`,r),r&&D(t,e.target),v(),t.key!==`Enter`&&qc(e.target)&&ss(e.target,n)&&!t[Uc]&&(t[Uc]=!0,Fs(e.target,t,!1)),e.isPressed=!1,e.metaKeyEvents?.delete(t.key)}else if(t.key===`Meta`&&e.metaKeyEvents?.size){let t=e.metaKeyEvents;e.metaKeyEvents=void 0;for(let n of t.values())e.target?.dispatchEvent(new KeyboardEvent(`keyup`,n))}};if(typeof PointerEvent<`u`){t.onPointerDown=t=>{if(t.button!==0||!ss(t.currentTarget,F(t)))return;if(Ps(t.nativeEvent)){e.pointerType=`virtual`;return}e.pointerType=t.pointerType;let i=!0;if(!e.isPressed){e.isPressed=!0,e.isOverTarget=!0,e.activePointerId=t.pointerId,e.target=t.currentTarget,d||jc(e.target),i=b(t,e.pointerType);let a=F(t);`releasePointerCapture`in a&&(`hasPointerCapture`in a?a.hasPointerCapture(t.pointerId)&&a.releasePointerCapture(t.pointerId):a.releasePointerCapture(t.pointerId)),_($o(t.currentTarget),`pointerup`,n,!1),_($o(t.currentTarget),`pointercancel`,r,!1)}i&&t.stopPropagation()},t.onMouseDown=t=>{if(ss(t.currentTarget,F(t))&&t.button===0){if(l){let n=xs(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{ss(t.currentTarget,F(t))&&e.pointerType!==`virtual`&&t.button===0&&!e.isPressed&&C(t,e.pointerType||t.pointerType)},t.onPointerEnter=t=>{t.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,b(Yc(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,S(Yc(e.target,t),e.pointerType,!1),ee(t))};let n=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&t.button===0&&e.target){if(ss(e.target,F(t))&&e.pointerType!=null){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?T(t):(Jo(e.target),e.target.click()))},80);_(t.currentTarget,`click`,()=>n=!0,!0),e.disposables.push(()=>clearTimeout(r))}else T(t);e.isOverTarget=!1}},r=e=>{T(e)};t.onDragStart=e=>{ss(e.currentTarget,F(e))&&T(e)}}return t},[_,s,l,v,d,ee,b,E,D]);return(0,y.useEffect)(()=>{if(!f)return;let e=$o(f.current);if(!e||!e.head||e.getElementById(Wc))return;let t=e.createElement(`style`);t.id=Wc;let n=Fc(e);n&&(t.nonce=n),t.textContent=` @layer { [${Gc}] { touch-action: pan-x pan-y pinch-zoom; } } `.trim(),e.head.prepend(t)},[f]),(0,y.useEffect)(()=>{let e=g.current;return()=>{d||Mc(e.target??void 0);for(let t of e.disposables)t();e.disposables=[]}},[d]),{isPressed:c||m,pressProps:To(p,te,{[Gc]:!0})}}function qc(e){return e.tagName===`A`&&e.hasAttribute(`href`)}function Jc(e,t){let{key:n,code:r}=e,i=t,a=i.getAttribute(`role`);return(n===`Enter`||n===` `||n===`Spacebar`||r===`Space`)&&!(i instanceof es(i).HTMLInputElement&&!$c(i,n)||i instanceof es(i).HTMLTextAreaElement||i.isContentEditable)&&!((a===`link`||!a&&qc(i))&&n!==`Enter`)}function Yc(e,t){let n=t.clientX,r=t.clientY;return{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:n,clientY:r,key:t.key}}function Xc(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!==`submit`&&e.type!==`reset`:!qc(e)}function Zc(e,t){return Ts()&&t===`Enter`?!1:e instanceof HTMLInputElement?t===`Enter`&&(e.type===`checkbox`||e.type===`radio`)?!1:!$c(e,t):Xc(e)}var Qc=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function $c(e,t){return e.type===`checkbox`||e.type===`radio`?t===` `:Qc.has(e.type)}function el(e,t){let{elementType:n=`button`,isDisabled:r,onPress:i,onPressStart:a,onPressEnd:o,onPressUp:s,onPressChange:c,preventFocusOnPress:l,allowFocusWhenDisabled:u,onClick:d,href:f,target:p,rel:m,type:h=`button`}=e,g;g=n===`button`?{type:h,disabled:r,form:e.form,formAction:e.formAction,formEncType:e.formEncType,formMethod:e.formMethod,formNoValidate:e.formNoValidate,formTarget:e.formTarget,name:e.name,value:e.value}:{role:`button`,href:n===`a`&&!r?f:void 0,target:n===`a`?p:void 0,type:n===`input`?h:void 0,disabled:n===`input`?r:void 0,"aria-disabled":!r||n===`input`?void 0:r,rel:n===`a`?m:void 0};let{pressProps:_,isPressed:v}=Kc({onPressStart:a,onPressEnd:o,onPressChange:c,onPress:i,onPressUp:s,onClick:d,isDisabled:r,preventFocusOnPress:l,ref:t}),{focusableProps:y}=Dc(e,t);u&&(y.tabIndex=r?-1:y.tabIndex);let b=To(y,_,Ho(e,{labelable:!0}));return{isPressed:v,buttonProps:To(g,b,{"aria-haspopup":e[`aria-haspopup`],"aria-expanded":e[`aria-expanded`],"aria-controls":e[`aria-controls`],"aria-pressed":e[`aria-pressed`],"aria-current":e[`aria-current`],"aria-disabled":e[`aria-disabled`]})}}function tl(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=e,a=(0,y.useRef)({isFocusWithin:!1}),{addGlobalListener:o,removeAllGlobalListeners:s}=zc(),c=(0,y.useCallback)(e=>{ss(e.currentTarget,F(e))&&a.current.isFocusWithin&&!ss(e.currentTarget,e.relatedTarget)&&(a.current.isFocusWithin=!1,s(),n&&n(e),i&&i(!1))},[n,i,a,s]),l=ys(c),u=(0,y.useCallback)(e=>{if(!ss(e.currentTarget,F(e)))return;let t=F(e),n=$o(t),s=cs(n);if(!a.current.isFocusWithin&&s===t){r&&r(e),i&&i(!0),a.current.isFocusWithin=!0,l(e);let t=e.currentTarget;o(n,`focus`,e=>{let r=F(e);if(a.current.isFocusWithin&&!ss(t,r)){let e=new n.defaultView.FocusEvent(`blur`,{relatedTarget:r});vs(e,t);let i=_s(e);c(i)}},{capture:!0})}},[r,i,l,o,c]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:c}}}function nl(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,i=(0,y.useRef)({isFocused:!1,isFocusVisible:t||Qs()}),[a,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(()=>i.current.isFocused&&i.current.isFocusVisible),l=(0,y.useCallback)(()=>c(i.current.isFocused&&i.current.isFocusVisible),[]),u=(0,y.useCallback)(e=>{i.current.isFocused=e,i.current.isFocusVisible=Qs(),o(e),l()},[l]);nc(e=>{i.current.isFocusVisible=e,l()},[n,a],{enabled:a,isTextInput:n});let{focusProps:d}=lc({isDisabled:r,onFocusChange:u}),{focusWithinProps:f}=tl({isDisabled:!r,onFocusWithinChange:u});return{isFocused:a,isFocusVisible:s,focusProps:r?f:d}}var rl=!1,il=0;function al(){rl=!0,setTimeout(()=>{rl=!1},500)}function ol(e){e.pointerType===`touch`&&al()}function sl(){let e=$o(null);if(e!==void 0)return il===0&&typeof PointerEvent<`u`&&e.addEventListener(`pointerup`,ol),il++,()=>{il--,!(il>0)&&typeof PointerEvent<`u`&&e.removeEventListener(`pointerup`,ol)}}function cl(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:i}=e,[a,o]=(0,y.useState)(!1),s=(0,y.useRef)({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:``,target:null}).current;(0,y.useEffect)(sl,[]);let{addGlobalListener:c,removeAllGlobalListeners:l}=zc(),{hoverProps:u,triggerHoverEnd:d}=(0,y.useMemo)(()=>{let e=(e,r)=>{if(s.pointerType=r,i||r===`touch`||s.isHovered||!ss(e.currentTarget,F(e)))return;s.isHovered=!0;let l=e.currentTarget;s.target=l,c($o(F(e)),`pointerover`,e=>{s.isHovered&&s.target&&!ss(s.target,F(e))&&a(e,e.pointerType)},{capture:!0}),t&&t({type:`hoverstart`,target:l,pointerType:r}),n&&n(!0),o(!0)},a=(e,t)=>{let i=s.target;s.pointerType=``,s.target=null,t!==`touch`&&s.isHovered&&i&&(s.isHovered=!1,l(),r&&r({type:`hoverend`,target:i,pointerType:t}),n&&n(!1),o(!1))},u={};return typeof PointerEvent<`u`&&(u.onPointerEnter=t=>{rl&&t.pointerType===`mouse`||e(t,t.pointerType)},u.onPointerLeave=e=>{!i&&ss(e.currentTarget,F(e))&&a(e,e.pointerType)}),{hoverProps:u,triggerHoverEnd:a}},[t,n,r,i,s,c,l]);return(0,y.useEffect)(()=>{i&&d({currentTarget:s.target},s.pointerType)},[i]),{hoverProps:u,isHovered:a}}var ll=(0,y.createContext)({}),ul=Fo(function(e,t){[e,t]=Ao(e,t,ll);let n=e,{isPending:r}=n,{buttonProps:i,isPressed:a}=el(e,t);i=fl(i,r);let{focusProps:o,isFocused:s,isFocusVisible:c}=nl(e),{hoverProps:l,isHovered:u}=cl({...e,isDisabled:e.isDisabled||r}),d={isHovered:u,isPressed:(n.isPressed||a)&&!r,isFocused:s,isFocusVisible:c,isDisabled:e.isDisabled||!1,isPending:r??!1},f=Oo({...e,values:d,defaultClassName:`react-aria-Button`}),p=P(i.id),m=P(),h=i[`aria-labelledby`];r&&(h?h=`${h} ${m}`:i[`aria-label`]&&(h=`${p} ${m}`));let g=(0,y.useRef)(r);(0,y.useEffect)(()=>{let e={"aria-labelledby":h||p};(!g.current&&s&&r||g.current&&s&&!r)&&Ko(e,`assertive`),g.current=r},[r,s,h,p]);let _=Ho(e,{global:!0});return delete _.onClick,y.createElement(No.button,{...To(_,f,i,o,l),type:i.type===`submit`&&r?`button`:i.type,id:p,ref:t,"aria-labelledby":h,slot:e.slot||void 0,"aria-disabled":r?`true`:i[`aria-disabled`],"data-disabled":e.isDisabled||void 0,"data-pressed":d.isPressed||void 0,"data-hovered":u||void 0,"data-focused":s||void 0,"data-pending":r||void 0,"data-focus-visible":c||void 0},y.createElement(Uo.Provider,{value:{id:m}},f.children))}),dl=/Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;function fl(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!dl.test(t)&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}var pl=(e,t)=>t===void 0||t.length===0?e:`${e} ${t}`,ml=(e,t)=>n=>pl(t,typeof e==`function`?e(n):e),hl=(e,t,n)=>(r,i)=>{let a=t===void 0&&!n?{}:{"aria-busy":n?!0:t},o={...r,...a};return e===void 0?(0,b.jsx)(`button`,{...o}):e(o,i)},I=({"aria-busy":e,className:t,isPending:n=!1,render:r,variant:i=`primary`,...a})=>(0,b.jsx)(ul,{...a,className:ml(t,`leans-button`),"data-variant":i,isPending:n,render:hl(r,e,n)});Object.freeze({status:`aborted`});function L(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;en?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var gl=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},_l=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},vl={};function yl(e){return e&&Object.assign(vl,e),vl}function bl(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function xl(e,t){return typeof t==`bigint`?t.toString():t}function Sl(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Cl(e){return e==null}function wl(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Tl(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var El=Symbol(`evaluating`);function Dl(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==El)return r===void 0&&(r=El,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ol(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function kl(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Al(e){return JSON.stringify(e)}function jl(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Ml=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Nl(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Pl=Sl(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Fl(e){if(Nl(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Nl(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Il(e){return Fl(e)?{...e}:Array.isArray(e)?[...e]:e}var Ll=new Set([`string`,`number`,`symbol`]);function Rl(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function zl(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function R(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Bl(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Vl={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Hl(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return zl(e,kl(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ol(this,`shape`,e),e},checks:[]}))}function Ul(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return zl(e,kl(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ol(this,`shape`,r),r},checks:[]}))}function Wl(e,t){if(!Fl(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return zl(e,kl(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ol(this,`shape`,n),n}}))}function Gl(e,t){if(!Fl(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return zl(e,kl(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ol(this,`shape`,n),n}}))}function Kl(e,t){return zl(e,kl(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ol(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function ql(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return zl(t,kl(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Ol(this,`shape`,i),i},checks:[]}))}function z(e,t,n){return zl(t,kl(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Ol(this,`shape`,i),i}}))}function B(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Jl(e){return typeof e==`string`?e:e?.message}function Yl(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=Jl(e.inst?._zod.def?.error?.(e))??Jl(t?.error?.(e))??Jl(n.customError?.(e))??Jl(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Xl(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Zl(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ql=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,xl,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},$l=L(`$ZodError`,Ql),eu=L(`$ZodError`,Ql,{Parent:Error});function tu(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function nu(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new gl;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Yl(e,a,yl())));throw Ml(t,i?.callee),t}return o.value},iu=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Yl(e,a,yl())));throw Ml(t,i?.callee),t}return o.value},au=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new gl;return a.issues.length?{success:!1,error:new(e??$l)(a.issues.map(e=>Yl(e,i,yl())))}:{success:!0,data:a.value}},ou=au(eu),su=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Yl(e,i,yl())))}:{success:!0,data:a.value}},cu=su(eu),lu=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ru(e)(t,n,i)},uu=e=>(t,n,r)=>ru(e)(t,n,r),du=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return iu(e)(t,n,i)},fu=e=>async(t,n,r)=>iu(e)(t,n,r),pu=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return au(e)(t,n,i)},mu=e=>(t,n,r)=>au(e)(t,n,r),hu=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return su(e)(t,n,i)},gu=e=>async(t,n,r)=>su(e)(t,n,r),_u=/^[cC][^\s-]{8,}$/,vu=/^[0-9a-z]+$/,yu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,bu=/^[0-9a-vA-V]{20}$/,xu=/^[A-Za-z0-9]{27}$/,Su=/^[a-zA-Z0-9_-]{21}$/,Cu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,wu=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Tu=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Eu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Du=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Ou(){return new RegExp(Du,`u`)}var ku=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Au=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ju=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Mu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Nu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Pu=/^[A-Za-z0-9_-]*$/,Fu=/^\+[1-9]\d{6,14}$/,Iu=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Lu=RegExp(`^${Iu}$`);function Ru(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function zu(e){return RegExp(`^${Ru(e)}$`)}function Bu(e){let t=Ru({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Iu}T(?:${r})$`)}var Vu=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Hu=/^-?\d+$/,Uu=/^-?\d+(?:\.\d+)?$/,Wu=/^(?:true|false)$/i,Gu=/^null$/i,Ku=/^[^A-Z]*$/,qu=/^[^a-z]*$/,Ju=L(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Yu={number:`number`,bigint:`bigint`,object:`date`},Xu=L(`$ZodCheckLessThan`,(e,t)=>{Ju.init(e,t);let n=Yu[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value{(t.inclusive?r.value<=t.value:r.value{Ju.init(e,t);let n=Yu[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Qu=L(`$ZodCheckMultipleOf`,(e,t)=>{Ju.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Tl(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),$u=L(`$ZodCheckNumberFormat`,(e,t)=>{Ju.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Vl[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Hu)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),ed=L(`$ZodCheckMaxLength`,(e,t)=>{var n;Ju.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Cl(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum{let r=n.value;if(r.length<=t.maximum)return;let i=Xl(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),td=L(`$ZodCheckMinLength`,(e,t)=>{var n;Ju.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Cl(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Xl(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),nd=L(`$ZodCheckLengthEquals`,(e,t)=>{var n;Ju.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Cl(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Xl(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),rd=L(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Ju.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),id=L(`$ZodCheckRegex`,(e,t)=>{rd.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ad=L(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ku,rd.init(e,t)}),od=L(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=qu,rd.init(e,t)}),sd=L(`$ZodCheckIncludes`,(e,t)=>{Ju.init(e,t);let n=Rl(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),cd=L(`$ZodCheckStartsWith`,(e,t)=>{Ju.init(e,t);let n=RegExp(`^${Rl(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ld=L(`$ZodCheckEndsWith`,(e,t)=>{Ju.init(e,t);let n=RegExp(`.*${Rl(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ud=L(`$ZodCheckOverwrite`,(e,t)=>{Ju.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),dd=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(` `))}},fd={major:4,minor:3,patch:6},pd=L(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=fd;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=B(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new gl;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=B(e,t))});else{if(e.issues.length===t)continue;r||=B(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(B(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new gl;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new gl;return o.then(e=>t(e,r,a))}return t(o,r,a)}}Dl(e,`~standard`,()=>({validate:t=>{try{let n=ou(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return cu(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),md=L(`$ZodString`,(e,t)=>{pd.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Vu(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),hd=L(`$ZodStringFormat`,(e,t)=>{rd.init(e,t),md.init(e,t)}),gd=L(`$ZodGUID`,(e,t)=>{t.pattern??=wu,hd.init(e,t)}),_d=L(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Tu(e)}else t.pattern??=Tu();hd.init(e,t)}),vd=L(`$ZodEmail`,(e,t)=>{t.pattern??=Eu,hd.init(e,t)}),yd=L(`$ZodURL`,(e,t)=>{hd.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),n.value=t.normalize?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),bd=L(`$ZodEmoji`,(e,t)=>{t.pattern??=Ou(),hd.init(e,t)}),xd=L(`$ZodNanoID`,(e,t)=>{t.pattern??=Su,hd.init(e,t)}),Sd=L(`$ZodCUID`,(e,t)=>{t.pattern??=_u,hd.init(e,t)}),Cd=L(`$ZodCUID2`,(e,t)=>{t.pattern??=vu,hd.init(e,t)}),wd=L(`$ZodULID`,(e,t)=>{t.pattern??=yu,hd.init(e,t)}),Td=L(`$ZodXID`,(e,t)=>{t.pattern??=bu,hd.init(e,t)}),Ed=L(`$ZodKSUID`,(e,t)=>{t.pattern??=xu,hd.init(e,t)}),Dd=L(`$ZodISODateTime`,(e,t)=>{t.pattern??=Bu(t),hd.init(e,t)}),Od=L(`$ZodISODate`,(e,t)=>{t.pattern??=Lu,hd.init(e,t)}),kd=L(`$ZodISOTime`,(e,t)=>{t.pattern??=zu(t),hd.init(e,t)}),H=L(`$ZodISODuration`,(e,t)=>{t.pattern??=Cu,hd.init(e,t)}),Ad=L(`$ZodIPv4`,(e,t)=>{t.pattern??=ku,hd.init(e,t),e._zod.bag.format=`ipv4`}),jd=L(`$ZodIPv6`,(e,t)=>{t.pattern??=Au,hd.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Md=L(`$ZodCIDRv4`,(e,t)=>{t.pattern??=ju,hd.init(e,t)}),Nd=L(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Mu,hd.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Pd(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Fd=L(`$ZodBase64`,(e,t)=>{t.pattern??=Nu,hd.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Pd(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Id(e){if(!Pu.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Pd(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Ld=L(`$ZodBase64URL`,(e,t)=>{t.pattern??=Pu,hd.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Id(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Rd=L(`$ZodE164`,(e,t)=>{t.pattern??=Fu,hd.init(e,t)});function zd(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Bd=L(`$ZodJWT`,(e,t)=>{hd.init(e,t),e._zod.check=n=>{zd(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Vd=L(`$ZodNumber`,(e,t)=>{pd.init(e,t),e._zod.pattern=e._zod.bag.pattern??Uu,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Hd=L(`$ZodNumberFormat`,(e,t)=>{$u.init(e,t),Vd.init(e,t)}),Ud=L(`$ZodBoolean`,(e,t)=>{pd.init(e,t),e._zod.pattern=Wu,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Wd=L(`$ZodNull`,(e,t)=>{pd.init(e,t),e._zod.pattern=Gu,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Gd=L(`$ZodUnknown`,(e,t)=>{pd.init(e,t),e._zod.parse=e=>e}),Kd=L(`$ZodNever`,(e,t)=>{pd.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function qd(e,t,n){e.issues.length&&t.issues.push(...V(n,e.issues)),t.value[n]=e.value}var Jd=L(`$ZodArray`,(e,t)=>{pd.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;eqd(t,n,e))):qd(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Yd(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...V(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Xd(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Bl(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Zd(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Yd(e,n,i,t,u))):Yd(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Qd=L(`$ZodObject`,(e,t)=>{if(pd.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=Sl(()=>Xd(t));Dl(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Nl,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>Yd(n,t,e,s,r))):Yd(i,t,e,s,r)}return i?Zd(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),$d=L(`$ZodObjectJIT`,(e,t)=>{Qd.init(e,t);let n=e._zod.parse,r=Sl(()=>Xd(t)),i=e=>{let t=new dd([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Al(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Al(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(` if (${n}.issues.length) { if (${o} in input) { payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ ...iss, path: iss.path ? [${o}, ...iss.path] : [${o}] }))); } } if (${n}.value === undefined) { if (${o} in input) { newResult[${o}] = undefined; } } else { newResult[${o}] = ${n}.value; } `):t.write(` if (${n}.issues.length) { payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ ...iss, path: iss.path ? [${o}, ...iss.path] : [${o}] }))); } if (${n}.value === undefined) { if (${o} in input) { newResult[${o}] = undefined; } } else { newResult[${o}] = ${n}.value; } `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Nl,s=!vl.jitless,c=s&&Pl.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Zd([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function ef(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!B(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Yl(e,r,yl())))}),t)}var tf=L(`$ZodUnion`,(e,t)=>{pd.init(e,t),Dl(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Dl(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Dl(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Dl(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>wl(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>ef(t,i,e,a)):ef(s,i,e,a)}}),nf=L(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,tf.init(e,t);let n=e._zod.parse;Dl(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Sl(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!Nl(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),rf=L(`$ZodIntersection`,(e,t)=>{pd.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>of(e,t,n)):of(e,i,a)}});function af(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Fl(e)&&Fl(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=af(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;re.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),B(e))return e;let o=af(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var sf=L(`$ZodRecord`,(e,t)=>{pd.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Fl(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...V(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...V(e,o.issues)),n.value[e]=o.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Uu.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Yl(e,r,yl())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...V(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...V(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),cf=L(`$ZodEnum`,(e,t)=>{pd.init(e,t);let n=bl(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Ll.has(typeof e)).map(e=>typeof e==`string`?Rl(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),lf=L(`$ZodLiteral`,(e,t)=>{if(pd.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Rl(e):e?Rl(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),uf=L(`$ZodTransform`,(e,t)=>{pd.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new _l(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new gl;return n.value=i,n}});function df(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var ff=L(`$ZodOptional`,(e,t)=>{pd.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Dl(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Dl(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${wl(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>df(t,e.value)):df(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),pf=L(`$ZodExactOptional`,(e,t)=>{ff.init(e,t),Dl(e._zod,`values`,()=>t.innerType._zod.values),Dl(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),mf=L(`$ZodNullable`,(e,t)=>{pd.init(e,t),Dl(e._zod,`optin`,()=>t.innerType._zod.optin),Dl(e._zod,`optout`,()=>t.innerType._zod.optout),Dl(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${wl(e.source)}|null)$`):void 0}),Dl(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),hf=L(`$ZodDefault`,(e,t)=>{pd.init(e,t),e._zod.optin=`optional`,Dl(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>gf(e,t)):gf(r,t)}});function gf(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var _f=L(`$ZodPrefault`,(e,t)=>{pd.init(e,t),e._zod.optin=`optional`,Dl(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),vf=L(`$ZodNonOptional`,(e,t)=>{pd.init(e,t),Dl(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>yf(t,e)):yf(i,e)}});function yf(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var bf=L(`$ZodCatch`,(e,t)=>{pd.init(e,t),Dl(e._zod,`optin`,()=>t.innerType._zod.optin),Dl(e._zod,`optout`,()=>t.innerType._zod.optout),Dl(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Yl(e,n,yl()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Yl(e,n,yl()))},input:e.value}),e.issues=[]),e)}}),xf=L(`$ZodPipe`,(e,t)=>{pd.init(e,t),Dl(e._zod,`values`,()=>t.in._zod.values),Dl(e._zod,`optin`,()=>t.in._zod.optin),Dl(e._zod,`optout`,()=>t.out._zod.optout),Dl(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Sf(e,t.in,n)):Sf(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Sf(e,t.out,n)):Sf(r,t.out,n)}});function Sf(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Cf=L(`$ZodReadonly`,(e,t)=>{pd.init(e,t),Dl(e._zod,`propValues`,()=>t.innerType._zod.propValues),Dl(e._zod,`values`,()=>t.innerType._zod.values),Dl(e._zod,`optin`,()=>t.innerType?._zod?.optin),Dl(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(wf):wf(r)}});function wf(e){return e.value=Object.freeze(e.value),e}var Tf=L(`$ZodCustom`,(e,t)=>{Ju.init(e,t),pd.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Ef(t,n,r,e));Ef(i,n,r,e)}});function Ef(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Zl(e))}}var Df,Of=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function kf(){return new Of}(Df=globalThis).__zod_globalRegistry??(Df.__zod_globalRegistry=kf());var Af=globalThis.__zod_globalRegistry;function jf(e,t){return new e({type:`string`,...R(t)})}function Mf(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...R(t)})}function Nf(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...R(t)})}function Pf(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...R(t)})}function Ff(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...R(t)})}function If(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...R(t)})}function Lf(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...R(t)})}function Rf(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...R(t)})}function zf(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...R(t)})}function Bf(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...R(t)})}function Vf(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...R(t)})}function Hf(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...R(t)})}function Uf(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...R(t)})}function Wf(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...R(t)})}function Gf(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...R(t)})}function Kf(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...R(t)})}function qf(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...R(t)})}function Jf(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...R(t)})}function Yf(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...R(t)})}function Xf(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...R(t)})}function Zf(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...R(t)})}function Qf(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...R(t)})}function $f(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...R(t)})}function ep(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...R(t)})}function tp(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...R(t)})}function np(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...R(t)})}function rp(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...R(t)})}function ip(e,t){return new e({type:`number`,checks:[],...R(t)})}function ap(e,t){return new e({type:`number`,coerce:!0,checks:[],...R(t)})}function op(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...R(t)})}function sp(e,t){return new e({type:`boolean`,...R(t)})}function cp(e,t){return new e({type:`null`,...R(t)})}function lp(e){return new e({type:`unknown`})}function up(e,t){return new e({type:`never`,...R(t)})}function dp(e,t){return new Xu({check:`less_than`,...R(t),value:e,inclusive:!1})}function fp(e,t){return new Xu({check:`less_than`,...R(t),value:e,inclusive:!0})}function pp(e,t){return new Zu({check:`greater_than`,...R(t),value:e,inclusive:!1})}function mp(e,t){return new Zu({check:`greater_than`,...R(t),value:e,inclusive:!0})}function hp(e,t){return new Qu({check:`multiple_of`,...R(t),value:e})}function gp(e,t){return new ed({check:`max_length`,...R(t),maximum:e})}function _p(e,t){return new td({check:`min_length`,...R(t),minimum:e})}function vp(e,t){return new nd({check:`length_equals`,...R(t),length:e})}function yp(e,t){return new id({check:`string_format`,format:`regex`,...R(t),pattern:e})}function bp(e){return new ad({check:`string_format`,format:`lowercase`,...R(e)})}function xp(e){return new od({check:`string_format`,format:`uppercase`,...R(e)})}function Sp(e,t){return new sd({check:`string_format`,format:`includes`,...R(t),includes:e})}function Cp(e,t){return new cd({check:`string_format`,format:`starts_with`,...R(t),prefix:e})}function wp(e,t){return new ld({check:`string_format`,format:`ends_with`,...R(t),suffix:e})}function Tp(e){return new ud({check:`overwrite`,tx:e})}function Ep(e){return Tp(t=>t.normalize(e))}function Dp(){return Tp(e=>e.trim())}function Op(){return Tp(e=>e.toLowerCase())}function kp(){return Tp(e=>e.toUpperCase())}function Ap(){return Tp(e=>jl(e))}function jp(e,t,n){return new e({type:`array`,element:t,...R(n)})}function Mp(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...R(n)})}function Np(e){let t=Pp(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(Zl(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(Zl(r))}},e(n.value,n)));return t}function Pp(e,t){let n=new Ju({check:`custom`,...R(t)});return n._zod.check=e,n}function Fp(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Af,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Ip(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Ip(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&zp(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Lp(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}}function Rp(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Vp(t,`input`,e.processors),output:Vp(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function zp(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return zp(r.element,n);if(r.type===`set`)return zp(r.valueType,n);if(r.type===`lazy`)return zp(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return zp(r.innerType,n);if(r.type===`intersection`)return zp(r.left,n)||zp(r.right,n);if(r.type===`record`||r.type===`map`)return zp(r.keyType,n)||zp(r.valueType,n);if(r.type===`pipe`)return zp(r.in,n)||zp(r.out,n);if(r.type===`object`){for(let e in r.shape)if(zp(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(zp(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(zp(e,n))return!0;return!!(r.rest&&zp(r.rest,n))}return!1}var Bp=(e,t={})=>n=>{let r=Fp({...n,processors:t});return Ip(e,r),Lp(r,e),Rp(r,e)},Vp=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Fp({...i??{},target:a,io:t,processors:n});return Ip(e,o),Lp(o,e),Rp(o,e)},Hp={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Up=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Hp[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Wp=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},Gp=(e,t,n,r)=>{n.type=`boolean`},Kp=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},qp=(e,t,n,r)=>{n.not={}},Jp=(e,t,n,r)=>{let i=e._zod.def,a=bl(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Yp=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Xp=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Zp=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Qp=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Ip(a.element,t,{...r,path:[...r.path,`items`]})},$p=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Ip(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Ip(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},em=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ip(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},tm=(e,t,n,r)=>{let i=e._zod.def,a=Ip(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ip(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},nm=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Ip(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Ip(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Ip(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},rm=(e,t,n,r)=>{let i=e._zod.def,a=Ip(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},im=(e,t,n,r)=>{let i=e._zod.def;Ip(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},am=(e,t,n,r)=>{let i=e._zod.def;Ip(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},om=(e,t,n,r)=>{let i=e._zod.def;Ip(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},sm=(e,t,n,r)=>{let i=e._zod.def;Ip(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},cm=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Ip(a,t,r);let o=t.seen.get(e);o.ref=a},lm=(e,t,n,r)=>{let i=e._zod.def;Ip(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},um=(e,t,n,r)=>{let i=e._zod.def;Ip(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},dm=L(`ZodISODateTime`,(e,t)=>{Dd.init(e,t),Fm.init(e,t)});function U(e){return ep(dm,e)}var fm=L(`ZodISODate`,(e,t)=>{Od.init(e,t),Fm.init(e,t)});function pm(e){return tp(fm,e)}var mm=L(`ZodISOTime`,(e,t)=>{kd.init(e,t),Fm.init(e,t)});function hm(e){return np(mm,e)}var gm=L(`ZodISODuration`,(e,t)=>{H.init(e,t),Fm.init(e,t)});function _m(e){return rp(gm,e)}var vm=(e,t)=>{$l.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>nu(e,t)},flatten:{value:t=>tu(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,xl,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,xl,2)}},isEmpty:{get(){return e.issues.length===0}}})};L(`ZodError`,vm);var ym=L(`ZodError`,vm,{Parent:Error}),bm=ru(ym),xm=iu(ym),Sm=au(ym),Cm=su(ym),wm=lu(ym),Tm=uu(ym),Em=du(ym),Dm=fu(ym),Om=pu(ym),km=mu(ym),Am=hu(ym),jm=gu(ym),Mm=L(`ZodType`,(e,t)=>(pd.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Vp(e,`input`),output:Vp(e,`output`)}}),e.toJSONSchema=Bp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(kl(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>zl(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>bm(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Sm(e,t,n),e.parseAsync=async(t,n)=>xm(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Cm(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>wm(e,t,n),e.decode=(t,n)=>Tm(e,t,n),e.encodeAsync=async(t,n)=>Em(e,t,n),e.decodeAsync=async(t,n)=>Dm(e,t,n),e.safeEncode=(t,n)=>Om(e,t,n),e.safeDecode=(t,n)=>km(e,t,n),e.safeEncodeAsync=async(t,n)=>Am(e,t,n),e.safeDecodeAsync=async(t,n)=>jm(e,t,n),e.refine=(t,n)=>e.check(Jh(t,n)),e.superRefine=t=>e.check(Yh(t)),e.overwrite=t=>e.check(Tp(t)),e.optional=()=>Ah(e),e.exactOptional=()=>Mh(e),e.nullable=()=>Ph(e),e.nullish=()=>Ah(Ph(e)),e.nonoptional=t=>Bh(e,t),e.array=()=>K(e),e.or=t=>vh([e,t]),e.and=t=>Sh(e,t),e.transform=t=>Wh(e,Oh(t)),e.default=t=>Ih(e,t),e.prefault=t=>Rh(e,t),e.catch=t=>Hh(e,t),e.pipe=t=>Wh(e,t),e.readonly=()=>Kh(e),e.describe=t=>{let n=e.clone();return Af.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return Af.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Af.get(e);let n=e.clone();return Af.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Nm=L(`_ZodString`,(e,t)=>{md.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Up(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(yp(...t)),e.includes=(...t)=>e.check(Sp(...t)),e.startsWith=(...t)=>e.check(Cp(...t)),e.endsWith=(...t)=>e.check(wp(...t)),e.min=(...t)=>e.check(_p(...t)),e.max=(...t)=>e.check(gp(...t)),e.length=(...t)=>e.check(vp(...t)),e.nonempty=(...t)=>e.check(_p(1,...t)),e.lowercase=t=>e.check(bp(t)),e.uppercase=t=>e.check(xp(t)),e.trim=()=>e.check(Dp()),e.normalize=(...t)=>e.check(Ep(...t)),e.toLowerCase=()=>e.check(Op()),e.toUpperCase=()=>e.check(kp()),e.slugify=()=>e.check(Ap())}),Pm=L(`ZodString`,(e,t)=>{md.init(e,t),Nm.init(e,t),e.email=t=>e.check(Mf(Im,t)),e.url=t=>e.check(Rf(zm,t)),e.jwt=t=>e.check($f(th,t)),e.emoji=t=>e.check(zf(Vm,t)),e.guid=t=>e.check(Nf(Lm,t)),e.uuid=t=>e.check(Pf(Rm,t)),e.uuidv4=t=>e.check(Ff(Rm,t)),e.uuidv6=t=>e.check(If(Rm,t)),e.uuidv7=t=>e.check(Lf(Rm,t)),e.nanoid=t=>e.check(Bf(Hm,t)),e.guid=t=>e.check(Nf(Lm,t)),e.cuid=t=>e.check(Vf(Um,t)),e.cuid2=t=>e.check(Hf(Wm,t)),e.ulid=t=>e.check(Uf(Gm,t)),e.base64=t=>e.check(Xf(Qm,t)),e.base64url=t=>e.check(Zf($m,t)),e.xid=t=>e.check(Wf(Km,t)),e.ksuid=t=>e.check(Gf(qm,t)),e.ipv4=t=>e.check(Kf(Jm,t)),e.ipv6=t=>e.check(qf(Ym,t)),e.cidrv4=t=>e.check(Jf(Xm,t)),e.cidrv6=t=>e.check(Yf(Zm,t)),e.e164=t=>e.check(Qf(eh,t)),e.datetime=t=>e.check(U(t)),e.date=t=>e.check(pm(t)),e.time=t=>e.check(hm(t)),e.duration=t=>e.check(_m(t))});function W(e){return jf(Pm,e)}var Fm=L(`ZodStringFormat`,(e,t)=>{hd.init(e,t),Nm.init(e,t)}),Im=L(`ZodEmail`,(e,t)=>{vd.init(e,t),Fm.init(e,t)}),Lm=L(`ZodGUID`,(e,t)=>{gd.init(e,t),Fm.init(e,t)}),Rm=L(`ZodUUID`,(e,t)=>{_d.init(e,t),Fm.init(e,t)});function G(e){return Pf(Rm,e)}var zm=L(`ZodURL`,(e,t)=>{yd.init(e,t),Fm.init(e,t)});function Bm(e){return Rf(zm,e)}var Vm=L(`ZodEmoji`,(e,t)=>{bd.init(e,t),Fm.init(e,t)}),Hm=L(`ZodNanoID`,(e,t)=>{xd.init(e,t),Fm.init(e,t)}),Um=L(`ZodCUID`,(e,t)=>{Sd.init(e,t),Fm.init(e,t)}),Wm=L(`ZodCUID2`,(e,t)=>{Cd.init(e,t),Fm.init(e,t)}),Gm=L(`ZodULID`,(e,t)=>{wd.init(e,t),Fm.init(e,t)}),Km=L(`ZodXID`,(e,t)=>{Td.init(e,t),Fm.init(e,t)}),qm=L(`ZodKSUID`,(e,t)=>{Ed.init(e,t),Fm.init(e,t)}),Jm=L(`ZodIPv4`,(e,t)=>{Ad.init(e,t),Fm.init(e,t)}),Ym=L(`ZodIPv6`,(e,t)=>{jd.init(e,t),Fm.init(e,t)}),Xm=L(`ZodCIDRv4`,(e,t)=>{Md.init(e,t),Fm.init(e,t)}),Zm=L(`ZodCIDRv6`,(e,t)=>{Nd.init(e,t),Fm.init(e,t)}),Qm=L(`ZodBase64`,(e,t)=>{Fd.init(e,t),Fm.init(e,t)}),$m=L(`ZodBase64URL`,(e,t)=>{Ld.init(e,t),Fm.init(e,t)}),eh=L(`ZodE164`,(e,t)=>{Rd.init(e,t),Fm.init(e,t)}),th=L(`ZodJWT`,(e,t)=>{Bd.init(e,t),Fm.init(e,t)}),nh=L(`ZodNumber`,(e,t)=>{Vd.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wp(e,t,n,r),e.gt=(t,n)=>e.check(pp(t,n)),e.gte=(t,n)=>e.check(mp(t,n)),e.min=(t,n)=>e.check(mp(t,n)),e.lt=(t,n)=>e.check(dp(t,n)),e.lte=(t,n)=>e.check(fp(t,n)),e.max=(t,n)=>e.check(fp(t,n)),e.int=t=>e.check(ah(t)),e.safe=t=>e.check(ah(t)),e.positive=t=>e.check(pp(0,t)),e.nonnegative=t=>e.check(mp(0,t)),e.negative=t=>e.check(dp(0,t)),e.nonpositive=t=>e.check(fp(0,t)),e.multipleOf=(t,n)=>e.check(hp(t,n)),e.step=(t,n)=>e.check(hp(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function rh(e){return ip(nh,e)}var ih=L(`ZodNumberFormat`,(e,t)=>{Hd.init(e,t),nh.init(e,t)});function ah(e){return op(ih,e)}var oh=L(`ZodBoolean`,(e,t)=>{Ud.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gp(e,t,n,r)});function sh(e){return sp(oh,e)}var ch=L(`ZodNull`,(e,t)=>{Wd.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kp(e,t,n,r)});function lh(e){return cp(ch,e)}var uh=L(`ZodUnknown`,(e,t)=>{Gd.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function dh(){return lp(uh)}var fh=L(`ZodNever`,(e,t)=>{Kd.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qp(e,t,n,r)});function ph(e){return up(fh,e)}var mh=L(`ZodArray`,(e,t)=>{Jd.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qp(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(_p(t,n)),e.nonempty=t=>e.check(_p(1,t)),e.max=(t,n)=>e.check(gp(t,n)),e.length=(t,n)=>e.check(vp(t,n)),e.unwrap=()=>e.element});function K(e,t){return jp(mh,e,t)}var hh=L(`ZodObject`,(e,t)=>{$d.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$p(e,t,n,r),Dl(e,`shape`,()=>t.shape),e.keyof=()=>J(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:dh()}),e.loose=()=>e.clone({...e._zod.def,catchall:dh()}),e.strict=()=>e.clone({...e._zod.def,catchall:ph()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Wl(e,t),e.safeExtend=t=>Gl(e,t),e.merge=t=>Kl(e,t),e.pick=t=>Hl(e,t),e.omit=t=>Ul(e,t),e.partial=(...t)=>ql(kh,e,t[0]),e.required=(...t)=>z(zh,e,t[0])});function gh(e,t){return new hh({type:`object`,shape:e??{},...R(t)})}function q(e,t){return new hh({type:`object`,shape:e,catchall:ph(),...R(t)})}var _h=L(`ZodUnion`,(e,t)=>{tf.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>em(e,t,n,r),e.options=t.options});function vh(e,t){return new _h({type:`union`,options:e,...R(t)})}var yh=L(`ZodDiscriminatedUnion`,(e,t)=>{_h.init(e,t),nf.init(e,t)});function bh(e,t,n){return new yh({type:`union`,options:t,discriminator:e,...R(n)})}var xh=L(`ZodIntersection`,(e,t)=>{rf.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tm(e,t,n,r)});function Sh(e,t){return new xh({type:`intersection`,left:e,right:t})}var Ch=L(`ZodRecord`,(e,t)=>{sf.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nm(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function wh(e,t,n){return new Ch({type:`record`,keyType:e,valueType:t,...R(n)})}var Th=L(`ZodEnum`,(e,t)=>{cf.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jp(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Th({...t,checks:[],...R(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Th({...t,checks:[],...R(r),entries:i})}});function J(e,t){return new Th({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...R(t)})}var Eh=L(`ZodLiteral`,(e,t)=>{lf.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yp(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Y(e,t){return new Eh({type:`literal`,values:Array.isArray(e)?e:[e],...R(t)})}var Dh=L(`ZodTransform`,(e,t)=>{uf.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zp(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new _l(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Zl(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Zl(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Oh(e){return new Dh({type:`transform`,transform:e})}var kh=L(`ZodOptional`,(e,t)=>{ff.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>um(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ah(e){return new kh({type:`optional`,innerType:e})}var jh=L(`ZodExactOptional`,(e,t)=>{pf.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>um(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mh(e){return new jh({type:`optional`,innerType:e})}var Nh=L(`ZodNullable`,(e,t)=>{mf.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rm(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ph(e){return new Nh({type:`nullable`,innerType:e})}var Fh=L(`ZodDefault`,(e,t)=>{hf.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>am(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ih(e,t){return new Fh({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Il(t)}})}var Lh=L(`ZodPrefault`,(e,t)=>{_f.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>om(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rh(e,t){return new Lh({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Il(t)}})}var zh=L(`ZodNonOptional`,(e,t)=>{vf.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>im(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bh(e,t){return new zh({type:`nonoptional`,innerType:e,...R(t)})}var Vh=L(`ZodCatch`,(e,t)=>{bf.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sm(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Hh(e,t){return new Vh({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Uh=L(`ZodPipe`,(e,t)=>{xf.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cm(e,t,n,r),e.in=t.in,e.out=t.out});function Wh(e,t){return new Uh({type:`pipe`,in:e,out:t})}var Gh=L(`ZodReadonly`,(e,t)=>{Cf.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lm(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kh(e){return new Gh({type:`readonly`,innerType:e})}var qh=L(`ZodCustom`,(e,t)=>{Tf.init(e,t),Mm.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xp(e,t,n,r)});function Jh(e,t={}){return Mp(qh,e,t)}function Yh(e){return Np(e)}function Xh(e){return ap(nh,e)}gh({workspaceId:G()}).extend({caseId:G()});var Zh=q({status:J([`open`,`escalated`,`decided`]).optional(),priority:J([`low`,`normal`,`high`,`urgent`]).optional(),cursor:G().optional(),limit:Xh().int().min(1).max(50).default(20)});bh(`action`,[q({action:Y(`decision`),moderationStatus:J([`visible`,`hidden`,`removed`]),reason:W().trim().min(1).max(1e3)}),q({action:Y(`escalate`),reason:W().trim().min(1).max(1e3)}),q({action:Y(`appeal`),reason:W().trim().min(1).max(1e3),disputedDecisionId:G().optional()}),q({action:Y(`claim`),reason:W().trim().min(1).max(1e3)}),q({action:Y(`assign`),assignedUserId:G(),reason:W().trim().min(1).max(1e3)})]),gh({"if-match":W().regex(/^"[1-9][0-9]*"$/u),"idempotency-key":G()});var Qh=gh({caseId:G(),workspaceId:G().nullable(),customerUserId:G().nullable(),threadId:W().min(1).max(256).nullable(),purpose:Y(`support_moderation`).nullable(),deliveryId:G().nullable(),postId:G().nullable(),targetKind:J([`marathon_feed_post`,`marathon_feed_comment`,`chat_message`,`live_message`,`support_message`]),targetId:G(),commentId:G().nullable(),chatId:G().nullable(),streamId:G().nullable(),assignedUserId:G().nullable(),priority:J([`low`,`normal`,`high`,`urgent`]),status:J([`open`,`escalated`,`decided`]),revision:W(),reason:W(),openedAt:U(),dueAt:U().nullable(),updatedAt:U(),overdue:sh(),slaBreachedAt:U().nullable()}),$h=q({dueAt:U(),reason:W().trim().min(1).max(1e3)}),eg=q({previousDueAt:U().nullable(),nextDueAt:U(),previousOverdue:sh(),breachedAt:U().nullable()}),tg=gh({auditId:G(),action:W(),reason:W(),userId:G(),revision:W(),occurredAt:U(),slaChange:eg.nullable()}),ng=Qh.extend({capabilities:q({canSetSla:sh()}),context:gh({title:W().max(400),text:W().max(2e3),teamId:G().nullable(),moderationStatus:J([`visible`,`hidden`,`removed`]),platformModerationStatus:J([`visible`,`hidden`,`removed`]),tenantModerationStatus:J([`visible`,`hidden`,`removed`])}).nullable(),history:K(tg)}),rg=gh({items:K(Qh),nextCursor:G().nullable()});q({caseId:G()});var ig=G(),ag=W().regex(/^[1-9][0-9]{0,18}$/u),og=J([`open`,`assigned`,`resolved`,`cancelled`]);q({workspaceId:ig,humanReviewTaskId:ig});var sg=q({status:og.optional(),cursor:ig.optional(),limit:Xh().int().min(1).max(50).default(20)});gh({"idempotency-key":G(),"if-match":W().regex(/^"[1-9][0-9]{0,18}"$/u).refine(e=>/^"[1-9][0-9]{0,18}"$/u.test(e)&&BigInt(e.slice(1,-1))<=9223372036854775807n)});var cg=W().trim().min(1).max(500),lg=bh(`action`,[q({action:Y(`assign`),reason:cg}),q({action:Y(`reassign`),assigneeUserId:ig,reason:cg}),q({action:Y(`resolve`),decision:J([`allow`,`block`]),reason:cg,note:W().trim().min(1).max(2e3).optional()})]),ug=q({humanReviewTaskId:ig,agentRunId:ig,workspaceId:ig,status:og,revision:ag,reasonCode:W().max(100),assignedToUserId:ig.nullable(),resolutionCode:W().max(100).nullable(),resolutionNote:W().max(2e3).nullable(),resolvedAt:W().datetime().nullable(),createdAt:W().datetime(),updatedAt:W().datetime()}),dg=q({agentRunId:ig,status:J([`queued`,`running`,`waiting_review`,`succeeded`,`failed`,`cancelled`]),failureCode:W().nullable(),approvedOutputAvailable:sh()}),fg=q({task:ug,run:dg,action:J([`assign`,`reassign`,`resolve`])}),pg=q({items:K(ug).max(50),nextCursor:ig.nullable()}),mg=q({task:ug,run:dg,context:q({guardRole:J([`input_guard`,`output_guard`]).nullable(),candidatePrimaryText:W().max(8e3).nullable(),candidateInputText:W().max(8e3).nullable(),truncated:sh()}),allowedDecisions:K(J([`allow`,`block`])).max(2),history:K(q({commandId:ig,action:J([`assign`,`reassign`,`resolve`]),actorUserId:ig,reason:W().max(500),createdAt:W().datetime(),taskRevision:ag,resultStatus:og,resolutionCode:W().nullable()})).max(50),nextCursor:ig.nullable()}),hg=G(),gg=q({workspaceId:hg,caseId:hg}),_g=W().regex(/^[A-Za-z0-9._:-]{1,128}$/u),vg=gg.extend({assetId:_g});q({assetVersion:W().min(1).max(200).optional(),rendition:Y(`poster`).optional()});var yg=q({assetId:_g,assetVersion:W().min(1).max(200).nullable(),kind:J([`image`,`audio`,`file`]),contentType:W().min(1).max(100),sizeBytes:rh().int().positive().max(67108864),checksum:W().regex(/^[a-f0-9]{64}$/u),sourceAssetId:_g.optional(),sourceKind:Y(`video`).optional(),rendition:Y(`poster`).optional()}).superRefine((e,t)=>{(e.rendition!==void 0||e.sourceAssetId!==void 0||e.sourceKind!==void 0)&&(e.rendition!==`poster`||e.sourceKind!==`video`||e.sourceAssetId!==e.assetId||e.kind!==`image`||e.contentType!==`image/jpeg`||e.assetVersion!==null)&&t.addIssue({code:`custom`,message:`Video poster must be bound to its unversioned parent asset`})}),bg=q({caseRevision:W().regex(/^[1-9][0-9]*$/u),items:K(yg).max(100)});vg.shape.assetId,q({workspaceId:G(),caseId:G()});var xg=q({outcome:J([`retain_removed`,`lift_platform_removal`]),reason:W().trim().min(1).max(1e3)});gh({"if-match":W().regex(/^"[a-f0-9]{64}"$/u),"idempotency-key":G(),"x-csrf-token":W().length(43)});var Sg=q({caseId:G(),workspaceId:G(),targetKind:J([`marathon_feed_post`,`marathon_feed_comment`,`chat_message`,`live_message`]),targetId:G(),caseRevision:W(),revision:W().regex(/^[a-f0-9]{64}$/u),originalDecision:q({auditId:G(),userId:G(),occurredAt:U(),reason:W().max(1e3)}),context:q({title:W().max(400),text:W().max(2e3),teamId:G().nullable(),moderationStatus:J([`visible`,`hidden`,`removed`]),platformModerationStatus:J([`visible`,`hidden`,`removed`]),tenantModerationStatus:J([`visible`,`hidden`,`removed`])}),history:K(q({reviewId:G(),reviewerUserId:G(),outcome:J([`retain_removed`,`lift_platform_removal`]),reason:W().max(1e3),occurredAt:U(),sourceRevision:W()})).max(100),capabilities:q({canResolve:sh()})}),Cg=G(),wg=W().regex(/^[1-9][0-9]*$/u).pipe(W().refine(e=>BigInt(e)<=2147483647n)),Tg=W().regex(/^[a-f0-9]{64}$/u),Eg=J([`cross_workspace_abuse`,`legal_case_linkage`,`security_case_linkage`]),Dg=W().trim().min(1).max(1e3).refine(e=>!e.includes(`\0`));q({investigationId:Cg});var Og=q({status:J([`open`,`closed`]).optional(),purpose:Eg.optional(),cursor:Cg.optional(),limit:Xh().int().min(1).max(20).default(20)});gh({"idempotency-key":Cg,"x-csrf-token":W().length(43)}).extend({"if-match":W().regex(/^"[1-9][0-9]*"$/u).pipe(W().refine(e=>BigInt(e.slice(1,-1))<=2147483647n))});var kg=q({workspaceId:Cg.nullable(),caseId:Cg}),Ag=q({purpose:Eg,reason:Dg,caseRef:kg}),jg=q({caseRef:kg,reason:Dg}),Mg=q({reason:Dg}),Ng=q({investigationId:Cg,purpose:Eg,status:Y(`open`),revision:Y(`1`),openedAt:U()}),Pg=q({investigationId:Cg,purpose:Eg,status:J([`open`,`closed`]),reason:Dg,assignedInvestigatorUserId:Cg,revision:wg,openedAt:U(),closedAt:U().nullable(),linkCount:rh().int().min(1).max(10)}),Fg=J([`visible`,`hidden`,`removed`]),Ig=q({caseRevision:wg,status:J([`open`,`escalated`,`decided`]),targetKind:J([`marathon_feed_post`,`marathon_feed_comment`,`chat_message`,`live_message`,`support_message`]),targetId:Cg,decisionAuditId:Cg.nullable(),contextFingerprint:Tg,context:q({title:W().max(400),text:W().max(2e3),teamId:Cg.nullable(),moderationStatus:Fg,tenantModerationStatus:Fg,platformModerationStatus:Fg})}),Lg=q({linkId:Cg,workspaceId:Cg.nullable(),caseId:Cg,capturedCaseRevision:wg,capturedDecisionAuditId:Cg.nullable(),capturedContextFingerprint:Tg,linkedAt:U(),linkedByUserId:Cg,reason:Dg,contextChanged:sh(),caseChanged:sh(),current:Ig}).refine(e=>e.workspaceId===null==(e.current.targetKind===`support_message`)&&(e.current.targetKind!==`support_message`||e.current.context.teamId===null),`Exact owner case scope required`),Rg=q({auditId:Cg,action:J([`created`,`case_linked`,`closed`]),reason:Dg,userId:Cg,revision:wg,occurredAt:U()}),zg=Pg.extend({links:K(Lg).min(1).max(10),history:K(Rg).max(100)}).refine(e=>e.links.length===e.linkCount&&new Set(e.links.map(e=>e.caseId)).size===e.links.length),Bg=q({items:K(Pg).max(20),nextCursor:Cg.nullable()}),Vg=G(),Hg=W().regex(/^[a-f0-9]{64}$/u),Ug=J([`visible`,`hidden`,`removed`]),Wg=W().trim().min(1).max(1e3).refine(e=>!e.includes(`\0`));q({workspaceId:Vg,caseId:Vg,disputedDecisionId:Vg}).omit({workspaceId:!0});var Gg=q({outcome:J([`uphold_platform_decision`,`set_visible`,`set_hidden`]),reason:Wg});gh({"if-match":W().regex(/^"[a-f0-9]{64}"$/u),"idempotency-key":Vg,"x-csrf-token":W().length(43)});var Kg=q({caseId:Vg,workspaceId:Vg.nullable(),disputedDecisionId:Vg,intakeAuditId:Vg,targetKind:J([`marathon_feed_post`,`marathon_feed_comment`,`chat_message`,`live_message`,`support_message`]),targetId:Vg,caseRevision:W().regex(/^[1-9][0-9]*$/u),revision:Hg,status:J([`pending`,`resolved`]),disputedDecision:q({auditId:Vg,userId:Vg,occurredAt:U(),reason:Wg,platformStatus:Ug}),context:q({title:W().max(400),text:W().max(2e3),teamId:Vg.nullable(),moderationStatus:Ug,platformModerationStatus:Ug,tenantModerationStatus:Ug}),history:K(q({reviewId:Vg,reviewerUserId:Vg,outcome:J([`uphold_platform_decision`,`set_visible`,`set_hidden`]),reason:Wg,occurredAt:U(),sourceRevision:Hg})).max(100),capabilities:q({canResolve:sh(),statusReason:J([`pending`,`resolved`,`removed_requires_separate_review`,`source_changed`])})}).refine(e=>e.disputedDecision.auditId===e.disputedDecisionId&&e.workspaceId===null==(e.targetKind===`support_message`)&&(e.targetKind!==`support_message`||e.context.teamId===null),`Exact disputed decision and owner case scope required`),qg=G(),Jg=W().regex(/^[a-f0-9]{64}$/u),Yg=W().regex(/^[1-9][0-9]*$/u).pipe(W().refine(e=>BigInt(e)<=2147483647n)),Xg=J([`draft`,`active`,`revoked`]),Zg=K(J([`text_input`,`text_output`,`streaming`,`structured_output`,`external_assistant`])).min(1).max(5).refine(e=>new Set(e).size===e.length),Qg=W().trim().min(1).max(1e3).refine(e=>!e.includes(`\0`)),$g=q({status:Xg.optional(),cursor:qg.optional(),limit:Xh().int().min(1).max(20).default(20)}),e_=q({reason:Qg});gh({"idempotency-key":qg,"x-csrf-token":W().length(43),"if-match":W().regex(/^"[1-9][0-9]*"$/u).pipe(W().refine(e=>BigInt(e.slice(1,-1))<=2147483646n))}),q({approvedProviderModelId:qg}).extend({approvedProviderModelVersionId:qg}),q({approvedExecutionProfileId:qg}).extend({approvedExecutionProfileVersionId:qg});var t_=q({approvedProviderModelId:qg,providerKey:W().min(1).max(64),modelId:W().min(1).max(200),status:Xg,lifecycleRevision:Yg,activeVersionId:qg.nullable(),createdAt:U(),updatedAt:U()}),n_=q({approvedExecutionProfileId:qg,approvedProviderModelId:qg,profileKey:W().min(2).max(128),status:Xg,lifecycleRevision:Yg,activeVersionId:qg.nullable(),createdAt:U(),updatedAt:U()}),r_=K(q({versionId:qg,version:rh().int().positive(),checksum:Jg,createdAt:U()})).max(100),i_=K(q({commandId:qg,actorUserId:qg,reason:Qg,occurredAt:U(),expectedRevision:Yg,resultRevision:Yg})).max(100),a_=q({canRevoke:sh()}),o_=q({resource:t_,versions:r_,history:i_,capabilities:a_}),s_=q({resource:n_,versions:r_,history:i_,capabilities:a_}),c_=q({items:K(t_).max(20),nextCursor:qg.nullable()}),l_=q({items:K(n_).max(20),nextCursor:qg.nullable()}),u_={qualificationEvidenceId:qg,evidenceRevision:W().min(1).max(200),evidenceChecksum:Jg,evidenceSource:Y(`live_provider`),qualifiedAt:U(),createdAt:U()},d_=q({...u_,approvedProviderModelVersionId:qg,approvedProviderModelId:qg,version:rh().int().positive(),supportedCapabilities:Zg,contextWindowTokens:rh().int().min(1).max(1e6),maximumOutputTokens:rh().int().min(1).max(1e6),checksum:Jg}),f_=q({...u_,approvedExecutionProfileId:qg,approvedExecutionProfileVersionId:qg,approvedProviderModelId:qg,approvedProviderModelVersionId:qg,profileVersionKey:W().min(2).max(128),version:rh().int().positive(),modelClass:J([`dialog`,`reasoning`]),protocol:J([`responses`,`chat_completions`]),reasoningEffort:J([`none`,`low`,`medium`,`high`]),maximumOutputTokens:rh().int().min(1).max(1e6),effectiveCapabilities:Zg,executionSettings:q({schemaVersion:Y(1),store:Y(!1),toolChoice:Y(`none`),parallelToolCalls:Y(!1),textOnly:Y(!0),responseMode:Y(`streaming`)}),checksum:Jg}),p_=G(),m_=U(),h_=W().regex(/^[a-f0-9]{64}$/u),g_=rh().int().min(0).max(2147483647),__=W().regex(/^[1-9][0-9]*$/u).pipe(W().refine(e=>BigInt(e)<=2147483647n)),v_=J([`pending`,`processing`,`retry_scheduled`,`completed`,`failed_terminal`]),y_=J([`direct`,`group`,`label`,`invite`]),b_=W().trim().min(10).max(1e3).refine(e=>!e.includes(`\0`)),x_={workspaceId:p_,deliveryId:p_,ruleId:p_,jobId:p_};q(x_),q({workspaceId:p_});var S_=q({cursor:p_.optional(),limit:Xh().int().min(1).max(20).default(20)}),C_=q({fingerprint:h_,jobUpdatedAt:m_,reason:b_});gh({"if-match":W().regex(/^"[1-9][0-9]*"$/u).pipe(W().refine(e=>BigInt(e.slice(1,-1))<=2147483646n)),"idempotency-key":p_,"x-csrf-token":W().length(43)});var w_=q({jobId:p_,status:v_,totalCount:g_,processedCount:g_,attemptCount:g_,updatedAt:m_,completedAt:m_.nullable(),needsAttention:sh(),itemResultsAvailableUntil:m_.nullable()}),T_=q({...x_,commandId:p_,ruleRevision:__,effect:J([`admission`,`cleanup`]),reason:W().min(1).max(2e3),previous:w_,current:w_,acceptedAt:m_}),E_=q({...x_,status:v_,processedCount:g_,totalCount:g_,activeOriginCount:g_,revokedOriginCount:g_,preservedByOtherOriginCount:g_,acceptedCommandId:p_.nullable()}),D_=q({...x_,originType:y_,sourceFingerprint:h_,sourceStatus:J([`active`,`archived`,`inactive`,`missing`]),available:sh(),eligibleParticipantCount:g_,scopeExpiresAt:m_.nullable()}),O_=q({preview:q({...x_,ruleRevision:__,originType:y_,ruleStatus:J([`active`,`suspended`,`revoked`]),effect:J([`admission`,`cleanup`]),job:w_,canRecover:sh(),impact:q({eligibleParticipantCount:g_,affectedEnrollmentCount:g_,preservedByOtherOriginCount:g_}),checks:K(q({requirement:J([`workspace`,`grant`,`grant_window`,`pinned_release`,`source`,`rule`,`configuration`,`policy_window`,`generation`,`latest_job`,`failed_job`,`retention`]),ready:sh()})).max(12),fingerprint:h_,generatedAt:m_}),history:K(T_).max(50),result:E_,capabilities:q({canRecover:sh()})}),k_=q({receipt:T_,result:E_}),A_=q({items:K(q({...x_,ruleRevision:__,ruleStatus:J([`active`,`suspended`,`revoked`]),originType:y_,jobStatus:v_,processedCount:g_,totalCount:g_,updatedAt:m_})).max(20),nextCursor:p_.nullable()});q({assetId:G()}).extend({requestId:G()});var j_=W().regex(/^[1-9][0-9]{0,9}$/u).refine(e=>Number(e)<=2147483647),M_=W().trim().min(1).max(1e3).refine(e=>!e.includes(`\0`)),N_=U(),P_=q({sourceFingerprint:W().regex(/^[a-f0-9]{64}$/u),reason:M_}),F_=P_.extend({basisRef:W().regex(/^[A-Za-z0-9._:/-]{1,200}$/u).refine(e=>!e.includes(`://`)),reviewAt:N_}),I_=P_.extend({mode:J([`regular_cleanup`,`manual_review`])});gh({"if-match":W().regex(/^"[1-9][0-9]{0,9}"$/u).refine(e=>Number(e.slice(1,-1))<=2147483647),"idempotency-key":G()});var L_=q({assetId:G(),revision:j_,sourceFingerprint:W().regex(/^[a-f0-9]{64}$/u),kind:Y(`mutable_source`),phase:J([`created`,`sealed`,`deleting`,`completed`,`reconciliation_required`]),necessityEndedAt:N_.nullable(),writeCapabilityExpiresAt:N_.nullable(),hold:q({holdId:G(),status:J([`active`,`released`]),basisRef:W(),reason:M_,reviewAt:N_,placedAt:N_,placedByUserId:G(),releasedAt:N_.nullable()}).nullable(),manualRequest:q({requestId:G(),status:J([`reserved`,`pending_approval`,`approved`,`completed`,`reconciliation_required`]),requestedByUserId:G(),approvedByUserId:G().nullable(),reason:M_,requestedAt:N_,approvedAt:N_.nullable()}).nullable(),history:K(q({commandId:G(),action:J([`hold_set`,`hold_released`,`deletion_requested`,`deletion_approved`,`source_deleted`,`source_reconciled`,`source_deletion_admitted`,`source_reconciliation_required`]),actorUserId:G().nullable(),reason:M_.nullable(),revision:j_,occurredAt:N_,requestId:G().nullable()})).max(50),capabilities:q({maySetHold:sh(),mayReleaseHold:sh(),mayRequestDeletion:sh(),mayApproveDeletion:sh()}),manualActivation:J([`disabled`,`isolated`])}),R_=W().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u),X=G(),z_=W().regex(/^[1-9][0-9]{0,18}$/u).refine(e=>BigInt(e)<=9223372036854775807n),B_=W().refine(e=>Array.from(e).length<=2e3&&!e.includes(`\0`)).pipe(W().trim().min(1)),V_=gh({status:J([`submitted`,`reviewing`,`approved`,`rejected`,`cancelled`]).optional(),cursor:X.optional(),limit:Xh().int().min(1).max(50).default(20)}),H_=q({workspaceId:X,requestId:X,revision:z_,status:J([`submitted`,`reviewing`,`approved`,`rejected`,`cancelled`]),offer:q({offerId:X,revision:z_,entityType:J([`course`,`marathon`,`training_simulator`]),entityId:X,title:W().max(400),description:W().max(2e3),availableFrom:U().nullable(),availableUntil:U().nullable()}),reason:B_,createdAt:U(),updatedAt:U(),decision:q({reason:B_,occurredAt:U()}).nullable(),grant:q({grantId:X,status:J([`active`,`suspended`,`revoked`])}).nullable()}),U_=q({workspaceId:X,items:K(H_).max(50),nextCursor:X.nullable(),generatedAt:U()}),W_=q({action:J([`approve`,`reject`]),reason:B_}),G_=q({workspaceId:X,requestId:X,commandId:X,revision:z_,status:J([`approved`,`rejected`]),reason:B_,grantId:X.nullable(),occurredAt:U()}),K_=q({accountId:R_,csrf:W().length(43),authenticatedAt:U(),expiresAt:U(),elevation:q({expiresAt:U(),reason:W().min(1).max(500)}).nullable()}),q_=q({reason:W().trim().min(1).max(500)});gh({"if-match":W().regex(/^"[1-9][0-9]{0,18}"$/u),"idempotency-key":G(),"x-csrf-token":W().length(43)}),q({version:Y(1),type:Y(`identity.account-security.v1`),eventId:R_,issuer:W(),realm:Y(`workforce`),occurredAt:rh().int().nonnegative(),account:q({id:R_,status:J([`active`,`disabled`,`deletion_pending`,`deleted`]),securityRevision:rh().int().positive()}),closureOperationId:R_.nullable()}),q({version:Y(1),type:Y(`identity.product-session.v1`),eventId:R_,issuer:W(),brokerIssuer:W(),realm:Y(`workforce`),occurredAt:rh().int().nonnegative(),accountId:R_,sourceSessionReference:R_,sessionRevision:rh().int().positive(),status:J([`active`,`revoked`,`expired`])});var J_=q({items:K(q({workspaceId:X.nullable(),resourceId:X.optional(),disputedDecisionId:X.optional(),deliveryId:X.optional(),ruleId:X.optional(),kind:J([`content_grants`,`content_requests`,`governance_requests`,`moderation_cases`,`support_moderation_cases`,`ai_human_reviews`,`incidents`,`removed_reviews`,`case_investigations`,`independent_appeals`,`ai_provider_models`,`ai_execution_profiles`,`assignment_recoveries`,`media_source_cleanups`])}).refine(e=>e.kind!==`removed_reviews`||e.workspaceId!==null&&e.resourceId!==void 0,`Exact removed review resource required`).refine(e=>e.kind!==`case_investigations`||e.workspaceId===null,`Investigation directory uses its global scope`).refine(e=>e.kind!==`independent_appeals`||e.resourceId!==void 0&&e.disputedDecisionId!==void 0,`Exact independent appeal references required`).refine(e=>![`ai_provider_models`,`ai_execution_profiles`].includes(e.kind)||e.workspaceId===null,`Exact AI registry scope required`).refine(e=>e.kind!==`assignment_recoveries`||e.workspaceId!==null&&(e.resourceId===void 0&&e.deliveryId===void 0&&e.ruleId===void 0||e.resourceId!==void 0&&e.deliveryId!==void 0&&e.ruleId!==void 0),`Exact assignment recovery references required`).refine(e=>e.kind!==`media_source_cleanups`||e.workspaceId===null&&e.resourceId!==void 0,`Exact media source cleanup required`)).max(1e3)}),Y_=gh({status:J([`pending`,`cancelled`,`rejected`,`approved`]).optional(),cursor:X.optional(),limit:Xh().int().min(1).max(50).default(20)}),X_=q({requestId:X,workspaceId:X,kind:J([`ownership_transfer`,`owner_add`,`owner_remove`,`workspace_suspension`,`workspace_closure`,`workspace_deletion`,`workspace_reactivation`,`legal_organization_change`,`limit_increase`]),reason:B_,targetMembershipId:X.nullable(),status:J([`pending`,`cancelled`,`rejected`,`approved`]),revision:z_,createdAt:U(),updatedAt:U(),decision:q({action:J([`approve`,`reject`]),reason:B_,decidedAt:U(),effect:wh(W(),vh([W(),rh()])).optional()}).optional()}),Z_=q({workspaceId:X,items:K(X_.omit({reason:!0,decision:!0})).max(50),nextCursor:X.nullable()}),Q_=W().regex(/^(0|[1-9][0-9]{0,18})$/u).refine(e=>BigInt(e)<=9223372036854775807n),$_=e=>W().trim().min(1).max(e),ev=$_(253).toLowerCase().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/),tv=q({legalName:$_(300),registrationNumber:$_(100).nullable(),taxIdentifier:$_(100).nullable(),registeredAddress:$_(1e3).nullable(),verifiedDomains:K(ev).max(20).refine(e=>new Set(e).size===e.length,`Domains must be unique`)}),nv=bh(`kind`,[q({kind:Y(`ownership_transfer`),ownerMembershipId:X,ownerAccessRevision:Q_,targetAccessRevision:Q_}),...[`owner_add`,`owner_remove`].map(e=>q({kind:Y(e),targetAccessRevision:Q_})),...[`workspace_suspension`,`workspace_closure`,`workspace_deletion`,`workspace_reactivation`].map(e=>q({kind:Y(e),revision:Q_})),q({kind:Y(`legal_organization_change`),revision:Q_,profile:tv}),q({kind:Y(`limit_increase`),revision:Q_,maxActiveMembers:rh().int().min(1).max(1e5)})]),rv=X_.extend({approvalContext:q({lifecycle:q({status:W(),revision:Q_}),legal:q({revision:Q_,profile:tv.nullable()}),capacity:q({configured:sh(),revision:Q_,maxActiveMembers:rh().int().positive().nullable(),activeMembers:rh().int().nonnegative()}),owner:q({membershipId:X,accessRevision:Q_}).nullable(),target:q({membershipId:X,accessRevision:Q_,status:W(),role:W()}).nullable()})}),iv=bh(`action`,[q({action:Y(`reject`),reason:B_}),q({action:Y(`approve`),reason:B_,effect:nv})]),av=gh({search:W().trim().max(200).optional(),cursor:X.optional(),limit:Xh().int().min(1).max(100).default(20)}),ov=q({id:X,workspaceId:X,entityType:J([`course`,`marathon`,`training_simulator`]),entityId:X,status:J([`active`,`suspended`,`revoked`]),availableFrom:U().nullable(),availableUntil:U().nullable(),revision:z_.optional()}),sv=q({items:K(ov).max(100),nextCursor:X.nullable()}),cv=q({grant:ov.extend({revision:z_}),history:K(q({id:X,operationId:J([`createOperationsWorkspaceContentGrant`,`updateOperationsWorkspaceContentGrant`]),actorUserId:X,createdAt:U(),reason:W().nullable(),snapshot:ov})).max(100),nextCursor:X.nullable()}),lv=q({entityType:J([`course`,`marathon`,`training_simulator`]),entityId:X,availableFrom:U().nullable().optional(),availableUntil:U().nullable().optional()}),uv=q({reason:W().trim().min(1).max(500),status:J([`active`,`suspended`,`revoked`]).optional(),availableFrom:U().nullable().optional(),availableUntil:U().nullable().optional()}).refine(e=>e.status!==void 0||e.availableFrom!==void 0||e.availableUntil!==void 0,`Grant change required`),dv=class extends Error{status;code;retryAfterSeconds;constructor(e,t,n){super(t),this.status=e,this.code=t,this.retryAfterSeconds=n}},fv,pv=!1,mv=e=>{pv||(fv=e)},hv=()=>{pv=!0,fv=void 0},gv=async(e,t,n,r)=>{if(pv)throw new dv(401,`session_departed`);let i=async()=>{if(pv)throw new dv(401,`session_departed`);let i=await fetch(e,{method:n.method??`GET`,credentials:`same-origin`,redirect:n.redirect,cache:`no-store`,signal:n.signal?AbortSignal.any([n.signal,AbortSignal.timeout(5e3)]):AbortSignal.timeout(5e3),headers:{accept:r,...n.method?{"content-type":`application/json`,"x-csrf-token":fv??``}:{},...n.headers},...n.body?{body:JSON.stringify(n.body)}:{}});if(!i.ok){let e=`request_failed`;try{let t=await i.json();t&&typeof t==`object`&&`code`in t&&typeof t.code==`string`&&(e=t.code)}catch{}let t=i.headers.get(`Retry-After`),n=i.status===429&&t&&/^[1-9][0-9]{0,4}$/u.test(t)&&Number(t)<=3600?Number(t):void 0;throw new dv(i.status,e,n)}if(pv)throw new dv(401,`session_departed`);return t(i)};if(!navigator.locks)throw new dv(503,`browser_session_locks_required`);return navigator.locks.request(`operations-session`,{mode:n.method?`exclusive`:`shared`,signal:n.signal},i)},Z=(e,t,n={})=>gv(e,async e=>t.parse(await e.json()),n,`application/json`),_v=(e,t)=>!e.startsWith(`/api/`)||new URL(e,window.location.origin).origin!==window.location.origin?Promise.reject(new dv(503,`media_unavailable`)):gv(e,async e=>{let n=e.headers.get(`content-type`)?.split(`;`)[0]?.trim().toLowerCase();if(!Number.isInteger(t.maxBytes)||t.maxBytes<=0||t.maxBytes>67108864||n!==t.contentType||e.headers.get(`content-encoding`)&&e.headers.get(`content-encoding`)!==`identity`)throw new dv(503,`media_unavailable`);let r=e.body?.getReader();if(!r)throw new dv(503,`media_unavailable`);let i=[],a=0;try{for(;;){let e=await r.read();if(e.done)break;if(a+=e.value.byteLength,a>t.maxBytes||pv)throw new dv(pv?401:503,pv?`session_departed`:`media_unavailable`);i.push(new Uint8Array(e.value))}}finally{await r.cancel().catch(()=>void 0)}if(pv)throw new dv(401,`session_departed`);if(a!==t.maxBytes)throw new dv(503,`media_unavailable`);return new Blob(i,{type:n})},{signal:t.signal,redirect:`error`},t.contentType),vv=async()=>{await navigator.locks.request(`operations-session`,{mode:`exclusive`},async()=>{let e=await fetch(`/api/session/logout`,{method:`POST`,credentials:`same-origin`,headers:{"x-csrf-token":fv??``},signal:AbortSignal.timeout(5e3)});if(!e.ok&&e.status!==401)throw new dv(e.status,`logout_failed`);hv()})},yv=async e=>{let t=await Z(`/api/session`,K_,{signal:e});return mv(t.csrf),t},bv=e=>Z(`/api/session/elevation`,K_,{method:`POST`,body:q_.parse({reason:e})}),xv=()=>vv(),Sv=()=>hv(),Cv=()=>ft({queryKey:[`session`],queryFn:({signal:e})=>yv(e),retry:!1,staleTime:1e4,refetchInterval:15e3}),wv=()=>{let e=S();return pt({mutationFn:bv,retry:!1,onSuccess:async t=>{e.setQueryData([`session`],t),await e.invalidateQueries({queryKey:[`operations`]})}})},Q=({error:e})=>{let t=e instanceof dv?e.code:`request_failed`,n=e instanceof dv&&e.status===429?`Лимит операций. ${e.retryAfterSeconds?`Повторите прежнюю команду через ${e.retryAfterSeconds} сек.`:`Дождитесь восстановления лимита.`}`:e instanceof dv&&e.status===409?`Заявка изменилась. Загрузите актуальную карточку.`:e instanceof dv&&e.status===401?`Сессия или MFA истекли. Войдите снова.`:e instanceof dv&&e.status===403?`Нет текущего назначения или elevation.`:`Операция недоступна. Результат команды мог сохраниться: повторяйте с прежним ключом.`;return(0,b.jsxs)(`p`,{role:`alert`,children:[n,` `,(0,b.jsx)(`small`,{children:t})]})},Tv=()=>{let e=Cv(),t=wv(),n=S(),[r,i]=(0,y.useState)(``),[a,o]=(0,y.useState)(null),s=async()=>{try{await xv(),n.clear(),window.location.assign(`/`)}catch(e){o(e instanceof Error?e:Error(`logout_failed`))}};return e.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Проверяем workforce-сессию…`}):e.isError?(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h1`,{children:`Operators Platform`}),(0,b.jsx)(`p`,{children:`Вход сотрудников с обязательным MFA.`}),(0,b.jsx)(Q,{error:e.error}),(0,b.jsx)(I,{onPress:()=>{Sv(),n.clear(),window.location.assign(`/api/auth/login`)},children:`Войти с MFA`})]}):(0,b.jsxs)(`section`,{"aria-label":`Workforce-сессия`,className:`identity`,children:[(0,b.jsxs)(`p`,{children:[`Workforce ·`,` `,e.data.accountId,(0,b.jsx)(`br`,{}),`MFA до`,` `,new Date(e.data.expiresAt).toLocaleTimeString(`ru`)]}),(0,b.jsx)(I,{variant:`quiet`,onPress:()=>{s()},children:`Выйти`}),a?(0,b.jsx)(Q,{error:a}):null,e.data.elevation?(0,b.jsxs)(`p`,{role:`status`,children:[`Elevation до`,` `,new Date(e.data.elevation.expiresAt).toLocaleTimeString(`ru`),` `,`·`,e.data.elevation.reason]}):null,(0,b.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),t.mutate(r)},children:[(0,b.jsxs)(`label`,{children:[`Причина доступа`,(0,b.jsx)(`input`,{required:!0,maxLength:500,value:r,onChange:e=>i(e.target.value)})]}),(0,b.jsx)(I,{type:`submit`,isDisabled:!r.trim()||t.isPending,children:`Открыть доступ на 3 минуты`})]}),t.isError?(0,b.jsx)(Q,{error:t.error}):null]})};function Ev(e){return typeof e==`object`?e.key:e}function Dv(e,t){let n=e.length;return new Proxy(e,{get(e,r,i){if(typeof r==`string`){let i=r.charCodeAt(0);if(i>=48&&i<=57){let i=+r;if(Number.isInteger(i)&&i>=0&&ir[t]!==e))&&(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1),i}return o.updateDeps=e=>{r=e},o}function kv(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var Av=(e,t)=>Math.abs(e-t)<1.01,jv=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})},Mv,Nv=()=>{if(Mv!==void 0)return Mv;if(typeof navigator>`u`)return Mv=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Mv=!0;let e=navigator.maxTouchPoints;return Mv=navigator.platform===`MacIntel`&&e!==void 0&&e>0},Pv=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Fv=e=>e,Iv=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(Pv(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(Pv(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},Rv={passive:!0},zv=typeof window>`u`||`onscrollend`in window,Bv=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&zv,o=0,s=a?null:jv(i,()=>t(n(r),!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,Rv),a&&r.addEventListener(`scrollend`,u,Rv),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},Vv=(e,t)=>Bv(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),Hv=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},Uv=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})};function Wv(e,t,n,r){if(t===0)return!1;let i=r(0),a=new Set,o=0;for(;o=t)return!1;for(let e=0;e{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(t.isConnected)this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this));else{this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}}};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Fv,rangeExtractor:Iv,onChange:()=>{},measureElement:Hv,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=this._singleLaneMeasurements?.items??s,l=e=>Ev(c[e]),u=e>0?l(0):null,d=e>0?l(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==u||t.getItemKey(o-1)!==d)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>0&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==d)&&(o>e||Wv(e,o,l,t.getItemKey))&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:a,getItemKey:c}=this.options,l=0;for(;l{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=Ov(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._clampedAdjustment=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.targetWindow=this.scrollElement&&`ownerDocument`in this.scrollElement?this.scrollElement.ownerDocument.defaultView:this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this._clampedAdjustment!==null&&Math.abs(e-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null),this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,Nv()&&this.targetWindow!=null&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,Rv),e.addEventListener(`touchend`,n,Rv),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(Nv()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this.scrollState?.behavior===`smooth`&&!Av(this.getScrollOffset()-i,this.scrollState.lastTargetOffset)||this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}this._retryClampedAdjustment()},this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled)return;let{target:e,maxAtWrite:t}=this._clampedAdjustment,n=this.getMaxScrollOffset();n>t+.5&&(this._clampedAdjustment=e>n+.5?{target:e,maxAtWrite:n}:null,this._scrollToOffset(e,{adjustments:void 0,behavior:void 0}))},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;if(this._iosDeferredAdjustment<0&&e>=t-1){this._iosDeferredAdjustment=0;return}let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=Ov(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.isIndexInRange=e=>e>=0&&e[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._singleLaneMeasurements?.flat;if(!a||a.length0&&e.set(a.subarray(0,u*2)),a=e}let o=u===0?Array(e):this._singleLaneMeasurements.items.slice(),c;if(u===0)c=t+n;else{let e=u-1;c=a[e*2]+a[e*2+1]+s}for(let t=u;t1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;rthis.options.debug}),this.calculateRange=Ov(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=Jv(e,t,n,r,r===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Ov(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(!this.isIndexInRange(e))return;let n,r,i,a=this._singleLaneMeasurements?.flat;if(this.options.lanes===1&&a!=null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=this.itemSizeCache.get(i)??n,s=t-o;if(s!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,c=a?this.getTotalSize():0,l=this.getScrollOffset()+this.scrollAdjustments,u=this.itemSizeCache.has(i)?r+o<=l&&this.scrollDirection!==`backward`:r[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;rthis.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._singleLaneMeasurements?.flat,r=this.options.lanes===1&&n!=null;return kv(t[Kv(0,t.length-1,r?e=>n[e*2]:e=>kv(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`){if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t]}if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0;let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0,e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{this.options.count>0?this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e}):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._singleLaneMeasurements?.flat;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){if(e===0)return!1;if(Nv()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded))return this._iosDeferredAdjustment+=e,!1;{let n=this.getScrollOffset()+this.scrollAdjustments+e,r=this.scrollElement,i=r!==null&&(`scrollHeight`in r||`document`in r)?this.getMaxScrollOffset():null;return this._clampedAdjustment=i!==null&&n>i+.5?{target:n,maxAtWrite:i}:null,this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0}}scheduleScrollReconcile(){this.targetWindow?this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}):this.scrollState=null}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&Av(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},Kv=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(ar)t=i-1;else return i}return e>0?e-1:0};function qv(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(an)t=i-1;else return i}return r>0?r-1:0}function Jv(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=qv(i,a,n),r=e,o=n+t;for(;re[t].start,n),s=o;if(r===1)for(;s1){let i=Array(r).fill(0);for(;se=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var Yv=typeof document<`u`?y.useLayoutEffect:y.useEffect;function Xv({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=y.useReducer(e=>e+1,0)[1],a=y.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=y.useRef(!1),s=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}},c=e=>{let t=a.current;if(!t.enabled||!t.container)return;s(e);let n=!!e.options.horizontal,r=t.mode===`transform`,i=n?`left`:`top`,o=e.options.scrollMargin,c=e.getVirtualItems();for(let a of c){let s=a.start-o,c=e.elementsCache.get(a.key);c&&t.lastPositions.get(c)!==s&&(t.lastPositions.set(c,s),r?c.style.transform=n?`translate3d(${s}px, 0, 0)`:`translate3d(0, ${s}px, 0)`:c.style[i]=`${s}px`)}},l={...r,onChange:(t,n)=>{var s;let l=a.current,u=!0;if(l.enabled){c(t);let e=t.range,n=l.prevRange;u=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,u&&(l.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}u&&(e&&n&&!o.current?(0,Bc.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[u]=y.useState(()=>{let e=new Gv(l),t=e.measureElement;return e.measureElement=e=>{o.current=!0;try{t(e)}finally{o.current=!1}},Object.assign(e,{containerRef:t=>{let n=a.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?`width`:`height`;t.style[i]=`${r}px`}}})});return u.setOptions(l),Yv(()=>u._didMount(),[]),Yv(()=>(s(u),u._willUpdate())),Yv(()=>{c(u)}),u}function Zv(e){return Xv({observeElementRect:Lv,observeElementOffset:Vv,scrollToFn:Uv,...e})}var Qv=e=>`/api/workspaces/${encodeURIComponent(e)}/governance-requests`,$v=(e,t,n)=>Z(Qv(e)+`?`+new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])),Z_,{signal:n}),ey=(e,t,n)=>Z(Qv(e)+`/`+encodeURIComponent(t),rv,{signal:n}),ty=e=>Z(Qv(e.workspaceId)+`/`+encodeURIComponent(e.requestId)+`/decisions`,X_,{method:`POST`,headers:{"if-match":`"${e.revision}"`,"idempotency-key":e.key},body:iv.parse(e.command)}),ny=(e,t)=>ft({queryKey:[`operations`,`governance`,e,t],queryFn:({signal:n})=>$v(e,t,n),retry:!1}),ry=(e,t)=>ft({queryKey:[`operations`,`governance`,e,t],queryFn:({signal:n})=>ey(e,t,n),retry:!1}),iy=()=>{let e=S();return pt({mutationFn:ty,retry:!1,onSuccess:async()=>{await e.invalidateQueries({queryKey:[`operations`,`governance`]})}})},ay=({workspaceId:e,search:t})=>{let n=ny(e,t),r=na(),i=(0,y.useRef)(null),a=Zv({count:n.data?.items.length??0,getScrollElement:()=>i.current,estimateSize:()=>72});return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h1`,{children:`Governance · очередь`}),(0,b.jsxs)(`label`,{children:[`Статус`,(0,b.jsxs)(`select`,{value:t.status??``,onChange:t=>{let n=t.target.value;r({to:`/workspaces/$workspaceId/governance-requests`,params:{workspaceId:e},search:{limit:20,status:n||void 0}})},children:[(0,b.jsx)(`option`,{value:``,children:`Все`}),(0,b.jsx)(`option`,{value:`pending`,children:`Ожидают`}),(0,b.jsx)(`option`,{value:`rejected`,children:`Отклонены`}),(0,b.jsx)(`option`,{value:`approved`,children:`Одобрены`}),(0,b.jsx)(`option`,{value:`cancelled`,children:`Отменены`})]})]}),n.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Загружаем governance…`}):null,n.isError?(0,b.jsx)(Q,{error:n.error}):null,n.data&&!n.data.items.length?(0,b.jsx)(`p`,{children:`Заявок нет.`}):null,(0,b.jsx)(`div`,{ref:i,style:{height:400,overflow:`auto`},tabIndex:0,"aria-label":`Governance очередь`,children:(0,b.jsx)(`div`,{style:{height:a.getTotalSize(),position:`relative`},children:a.getVirtualItems().map(t=>{let r=n.data.items[t.index];return(0,b.jsxs)(`div`,{style:{position:`absolute`,top:0,transform:`translateY(${t.start}px)`},children:[(0,b.jsx)(M,{to:`/workspaces/$workspaceId/governance-requests/$requestId`,params:{workspaceId:e,requestId:r.requestId},children:`${r.kind} · ${r.requestId}`}),(0,b.jsx)(`p`,{children:r.status})]},r.requestId)})})}),n.data?.nextCursor?(0,b.jsx)(I,{onPress:()=>{r({to:`/workspaces/$workspaceId/governance-requests`,params:{workspaceId:e},search:{...t,cursor:n.data.nextCursor}})},children:`Следующая страница`}):null]})},oy=({item:e})=>{let t=iy(),[n]=(0,y.useState)(e),[r,i]=(0,y.useState)(``),[a,o]=(0,y.useState)(null),s=n.approvalContext.legal.profile,[c,l]=(0,y.useState)(s?.legalName??``),[u,d]=(0,y.useState)(s?.registrationNumber??``),[f,p]=(0,y.useState)(s?.taxIdentifier??``),[m,h]=(0,y.useState)(s?.registeredAddress??``),[g,_]=(0,y.useState)(s?.verifiedDomains.join(`,`)??``),[v,x]=(0,y.useState)(String((e.approvalContext.capacity.maxActiveMembers??0)+1)),S=n.approvalContext,C=e.revision!==n.revision||JSON.stringify(e.approvalContext)!==JSON.stringify(S),w=nv.safeParse(e.kind===`ownership_transfer`?{kind:e.kind,ownerMembershipId:S.owner?.membershipId,ownerAccessRevision:S.owner?.accessRevision,targetAccessRevision:S.target?.accessRevision}:e.kind===`owner_add`||e.kind===`owner_remove`?{kind:e.kind,targetAccessRevision:S.target?.accessRevision}:e.kind===`legal_organization_change`?{kind:e.kind,revision:S.legal.revision,profile:{legalName:c,registrationNumber:u.trim()||null,taxIdentifier:f.trim()||null,registeredAddress:m.trim()||null,verifiedDomains:g.split(`,`).map(e=>e.trim()).filter(Boolean)}}:e.kind===`limit_increase`?{kind:e.kind,revision:S.capacity.revision,maxActiveMembers:Number(v)}:{kind:e.kind,revision:S.lifecycle.revision}),T={workspace_suspension:[`active`],workspace_closure:[`active`,`suspended`],workspace_deletion:[`closure_requested`],workspace_reactivation:[`suspended`]},ee=e.kind===`ownership_transfer`?S.target?.status===`active`&&S.target.role!==`owner`&&!!S.owner:e.kind===`owner_add`?S.target?.status===`active`&&S.target.role!==`owner`:e.kind===`owner_remove`?S.target?.status===`active`&&S.target.role===`owner`:e.kind===`limit_increase`?S.capacity.configured&&Number(v)>(S.capacity.maxActiveMembers??0):e.kind===`legal_organization_change`||!!T[e.kind]?.includes(S.lifecycle.status),E=n=>{if(t.isPending)return;if(a){t.mutate(a);return}if(C)return;let i=iv.safeParse(n===`approve`&&w.success?{action:n,reason:r,effect:w.data}:{action:n,reason:r});if(!i.success||!window.confirm(`Подтвердить ${n} для ${e.kind}, заявки ${e.requestId}, revision ${e.revision}? ${n===`approve`&&w.success?JSON.stringify(w.data):`Компания увидит отказ и причину.`}`))return;let s={workspaceId:e.workspaceId,requestId:e.requestId,revision:e.revision,key:crypto.randomUUID(),command:i.data};o(s),t.mutate(s)};return(0,b.jsxs)(`section`,{"aria-label":`Решение governance`,children:[(0,b.jsx)(`h2`,{children:`Разрешённое изменение компании`}),C?(0,b.jsx)(`p`,{role:`alert`,children:`Контекст компании изменился. Сверьте сохранённый результат и проверьте актуальные последствия перед новым решением.`}):null,T[e.kind]?(0,b.jsx)(`p`,{children:`Текущее состояние компании: ${S.lifecycle.status}, revision ${S.lifecycle.revision}.`}):null,e.kind===`legal_organization_change`?(0,b.jsx)(`p`,{children:`Юридические реквизиты revision ${S.legal.revision}.`}):null,e.kind===`ownership_transfer`?(0,b.jsx)(`p`,{children:`Владелец ${S.owner?.membershipId??`не определён`} → участник ${e.targetMembershipId??`не указан`}. Текущий владелец станет администратором; персональные overrides будут очищены.`}):null,e.kind===`owner_add`?(0,b.jsx)(`p`,{children:`Добавить владельца: участник ${S.target?.membershipId??`не определён`}, роль ${S.target?.role??`не определена`}, access revision ${S.target?.accessRevision??`не определена`}. Core проверит действующую identity и MFA eligibility; персональные overrides будут очищены.`}):null,e.kind===`owner_remove`?(0,b.jsx)(`p`,{children:`Снять роль владельца с ${S.target?.membershipId??`не определён`}, access revision ${S.target?.accessRevision??`не определена`}. Участник станет администратором; персональные overrides будут очищены. Core откажет, если не останется допустимого подтверждённого владельца.`}):null,e.kind===`legal_organization_change`?(0,b.jsxs)(`fieldset`,{disabled:!!a,children:[(0,b.jsx)(`legend`,{children:`Проверенные юридические реквизиты`}),(0,b.jsxs)(`label`,{children:[`Юридическое наименование`,(0,b.jsx)(`input`,{"aria-label":`Юридическое наименование`,value:c,maxLength:300,onChange:e=>{l(e.target.value)}})]}),(0,b.jsxs)(`label`,{children:[`Регистрационный номер`,(0,b.jsx)(`input`,{"aria-label":`Регистрационный номер`,value:u,maxLength:100,onChange:e=>{d(e.target.value)}})]}),(0,b.jsxs)(`label`,{children:[`Налоговый идентификатор`,(0,b.jsx)(`input`,{"aria-label":`Налоговый идентификатор`,value:f,maxLength:100,onChange:e=>{p(e.target.value)}})]}),(0,b.jsxs)(`label`,{children:[`Юридический адрес`,(0,b.jsx)(`input`,{"aria-label":`Юридический адрес`,value:m,maxLength:1e3,onChange:e=>{h(e.target.value)}})]}),(0,b.jsxs)(`label`,{children:[`Проверенные домены через запятую`,(0,b.jsx)(`input`,{"aria-label":`Проверенные домены через запятую`,value:g,maxLength:5100,onChange:e=>{_(e.target.value)}})]})]}):null,e.kind===`limit_increase`?(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{children:`Текущий лимит активных участников: ${S.capacity.maxActiveMembers??`не настроен`}; активных ${S.capacity.activeMembers}; revision ${S.capacity.revision}.`}),(0,b.jsxs)(`label`,{children:[`Новый лимит активных участников`,(0,b.jsx)(`input`,{"aria-label":`Новый лимит активных участников`,type:`number`,min:1,max:1e5,value:v,disabled:!!a,onChange:e=>{x(e.target.value)}})]})]}):null,e.kind===`workspace_reactivation`?(0,b.jsx)(`p`,{children:`Перед возобновлением Core повторно проверит подтверждённого владельца, MFA, профиль, соглашения, доступы и здоровье Identity/Company.`}):null,(0,b.jsxs)(`label`,{children:[`Причина governance решения`,(0,b.jsx)(`textarea`,{"aria-label":`Причина governance решения`,value:r,maxLength:2e3,disabled:!!a,onChange:e=>{i(e.target.value)}})]}),a?(0,b.jsx)(I,{isDisabled:t.isPending,onPress:()=>{E(a.command.action)},children:`Повторить то же governance решение`}):(0,b.jsxs)(`div`,{children:[(0,b.jsx)(I,{isDisabled:!r.trim()||!w.success||!ee||C||t.isPending,onPress:()=>{E(`approve`)},children:`Одобрить governance заявку`}),(0,b.jsx)(I,{variant:`danger`,isDisabled:!r.trim()||C||t.isPending,onPress:()=>{E(`reject`)},children:`Отклонить governance заявку`})]}),t.isError?(0,b.jsx)(Q,{error:t.error}):null]})},sy=({workspaceId:e,requestId:t})=>{let n=ry(e,t),[r,i]=(0,y.useState)(0);if(n.isPending)return(0,b.jsx)(`p`,{role:`status`,children:`Загружаем governance карточку…`});if(n.isError)return(0,b.jsx)(Q,{error:n.error});let a=n.data,o=async()=>{(await n.refetch()).isSuccess&&i(e=>e+1)};return(0,b.jsxs)(`article`,{children:[(0,b.jsx)(M,{to:`/workspaces/$workspaceId/governance-requests`,params:{workspaceId:e},search:{limit:20},children:`← Governance очередь`}),(0,b.jsx)(`h1`,{children:a.kind}),(0,b.jsx)(`p`,{children:a.reason}),(0,b.jsx)(`p`,{children:a.status}),(0,b.jsx)(`p`,{children:a.requestId}),a.targetMembershipId?(0,b.jsx)(`p`,{children:a.targetMembershipId}):null,a.decision?(0,b.jsxs)(`section`,{"aria-label":`Сохранённый governance результат`,children:[(0,b.jsx)(`h2`,{children:`Сохранённый governance результат`}),(0,b.jsx)(`p`,{children:a.decision.reason}),(0,b.jsx)(`p`,{children:new Date(a.decision.decidedAt).toLocaleString(`ru`)}),a.decision.effect?(0,b.jsx)(`dl`,{children:Object.entries(a.decision.effect).map(([e,t])=>(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:e}),(0,b.jsx)(`dd`,{children:String(t)})]},e))}):null]}):null,a.status===`pending`?(0,b.jsx)(oy,{item:a},`${a.requestId}:${a.revision}:${r}`):null,(0,b.jsx)(I,{onPress:()=>{o()},children:`Сверить сохранённый governance результат`})]})},cy=e=>e===null?`/api/support-moderation-cases`:`/api/workspaces/${encodeURIComponent(e)}/moderation-cases`,ly=(e,t,n)=>Z(cy(e)+`?`+new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])),rg,{signal:n}),uy=(e,t,n)=>Z(cy(e)+`/`+encodeURIComponent(t),ng,{signal:n}),dy=e=>Z(cy(e.workspaceId)+`/`+encodeURIComponent(e.caseId)+`/commands`,ng,{method:`POST`,body:e.command,headers:{"if-match":`"${e.revision}"`,"idempotency-key":e.key}}),fy=(e,t)=>ft({queryKey:[`operations`,`moderation`,e,t],queryFn:({signal:n})=>ly(e,t,n),retry:!1}),py=(e,t)=>ft({queryKey:[`operations`,`moderation`,e,t],queryFn:({signal:n})=>uy(e,t,n),retry:!1}),my=()=>{let e=S();return pt({mutationFn:dy,retry:!1,onSuccess:async()=>{await e.invalidateQueries({queryKey:[`operations`,`moderation`]})}})},hy=({workspaceId:e,search:t})=>{let n=fy(e,t),r=na(),i=(0,y.useRef)(null),a=Zv({count:n.data?.items.length??0,getScrollElement:()=>i.current,estimateSize:()=>160,getItemKey:e=>n.data?.items[e]?.caseId??e,overscan:4}),o=t=>{r(e===null?{to:`/support-moderation-cases`,search:t}:{to:`/workspaces/$workspaceId/moderation-cases`,params:{workspaceId:e},search:t})};return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h1`,{children:e===null?`Support · назначенные cases`:`Модерация · назначенные cases`}),(0,b.jsxs)(`label`,{children:[`Статус`,(0,b.jsxs)(`select`,{value:t.status??``,onChange:e=>{let n=e.target.value;o({...t,cursor:void 0,status:n||void 0})},children:[(0,b.jsx)(`option`,{value:``,children:`Все`}),(0,b.jsx)(`option`,{value:`open`,children:`Открыты`}),(0,b.jsx)(`option`,{value:`escalated`,children:`Эскалация / appeal`}),(0,b.jsx)(`option`,{value:`decided`,children:`Решены`})]})]}),(0,b.jsxs)(`label`,{children:[`Приоритет`,(0,b.jsxs)(`select`,{value:t.priority??``,onChange:e=>{let n=e.target.value;o({...t,cursor:void 0,priority:n||void 0})},children:[(0,b.jsx)(`option`,{value:``,children:`Все`}),(0,b.jsx)(`option`,{value:`urgent`,children:`Срочный`}),(0,b.jsx)(`option`,{value:`high`,children:`Высокий`}),(0,b.jsx)(`option`,{value:`normal`,children:`Обычный`}),(0,b.jsx)(`option`,{value:`low`,children:`Низкий`})]})]}),n.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Загружаем назначенные cases…`}):null,n.isError?(0,b.jsx)(Q,{error:n.error}):null,n.data&&!n.data.items.length?(0,b.jsx)(`p`,{children:`Назначенных cases нет.`}):null,(0,b.jsx)(`div`,{ref:i,tabIndex:0,role:`region`,"aria-label":`Назначенные moderation cases`,style:{height:400,overflow:`auto`},children:(0,b.jsx)(`div`,{style:{height:a.getTotalSize(),position:`relative`},children:a.getVirtualItems().map(t=>{let r=n.data.items[t.index];return(0,b.jsxs)(`div`,{"data-index":t.index,ref:a.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,boxSizing:`border-box`,padding:`12px 0`,overflowWrap:`anywhere`,transform:`translateY(${t.start}px)`},children:[e===null?(0,b.jsx)(M,{to:`/support-moderation-cases/$caseId`,params:{caseId:r.caseId},children:`Support case · ${r.caseId}`}):(0,b.jsx)(M,{to:`/workspaces/$workspaceId/moderation-cases/$caseId`,params:{workspaceId:e,caseId:r.caseId},children:`Case · ${r.caseId}`}),(0,b.jsx)(`p`,{children:`${r.targetKind} · ${r.targetId}`}),(0,b.jsx)(`p`,{children:`${r.status} · ${r.priority} · ${r.dueAt?`SLA `+new Date(r.dueAt).toLocaleString(`ru`):`Срок не назначен`}${r.overdue?` · ПРОСРОЧЕН`:``}`})]},t.key)})})}),n.data?.nextCursor?(0,b.jsx)(I,{onPress:()=>{o({...t,cursor:n.data.nextCursor})},children:`Следующая страница`}):null]})},gy=e=>{let t=new URL(e.url),n=[`127.0.0.1`,`localhost`].includes(window.location.hostname)&&[`127.0.0.1`,`localhost`].includes(t.hostname);if(t.protocol!==`wss:`&&!(n&&t.protocol===`ws:`)||t.pathname!==`/realtime/socket`||t.username||t.password||t.hash||t.search)throw Error(`Qualified Gateway destination required`);let r=new WebSocket(t),i=window.setTimeout(()=>r.close(),5e3);return r.onopen=()=>{window.clearTimeout(i),e.onOpen()},r.onmessage=t=>{typeof t.data!=`string`||t.data.length>65536?r.close(1009):e.onFrame(t.data)},r.onclose=()=>{window.clearTimeout(i),e.onClose()},r.onerror=()=>r.close(),{send:e=>{r.readyState===WebSocket.OPEN&&r.send(JSON.stringify(e))},close:()=>{window.clearTimeout(i),r.close()}}},_y=q({epoch:W().min(1).max(200),sequence:rh().int().nonnegative().max(2147483647)}),vy=gh({family:Y(`marathon_feed`),resourceId:G(),workspaceId:G(),deliveryId:G(),teamId:G().nullable()}),yy=vh([q({ticket:W().regex(/^[A-Za-z0-9_-]{43}$/u),expiresAt:U(),family:J([`marathon_feed`,`live`,`chat`]),cursor:_y,url:Bm(),workspaceId:G(),deliveryId:G(),resourceId:G(),teamId:G().nullable()}).refine(e=>e.family!==`live`||e.teamId===null),q({ticket:W().regex(/^[A-Za-z0-9_-]{43}$/u),expiresAt:U(),family:Y(`chat`),cursor:_y,url:Bm(),workspaceId:lh(),deliveryId:lh(),resourceId:G(),teamId:lh(),supportCaseId:G(),messageId:G()})]),by=gh({type:J([`subscription.ready`,`subscription.checkpoint`]),cursor:_y}),xy=bh(`streamFamily`,[gh({type:Y(`event`),streamFamily:Y(`marathon_feed`),streamId:G(),scope:vy,eventType:Y(`feed.updated`),epoch:W().min(1).max(200),serverSequence:rh().int().positive().max(2147483647)}),gh({type:Y(`event`),streamFamily:Y(`live`),streamId:G(),scope:gh({family:Y(`live`),resourceId:G(),workspaceId:G(),deliveryId:G(),teamId:lh()}),eventType:Y(`live.message.updated`),epoch:W().min(1).max(200),serverSequence:rh().int().positive().max(2147483647),payload:q({kind:Y(`live_reference`)})}),gh({type:Y(`event`),streamFamily:Y(`chat`),streamId:G(),scope:vh([gh({family:Y(`chat`),resourceId:G(),workspaceId:G(),deliveryId:G(),teamId:G().nullable()}),gh({family:Y(`chat`),resourceId:G(),workspaceId:lh(),deliveryId:lh(),teamId:lh(),supportCaseId:G()})]),eventType:Y(`message.updated`),epoch:W().min(1).max(200),serverSequence:rh().int().positive().max(2147483647),payload:q({kind:Y(`chat_reference`),messageId:G().nullable()})})]),Sy=gh({type:J([`snapshot.required`,`stream.reset`]),recoveryAction:Y(`reload_snapshot`),snapshot:gh({family:J([`marathon_feed`,`live`,`chat`]),resourceId:G()})}),Cy=async e=>{let t=await Z(`${e.workspaceId===null?`/api/support-moderation-cases`:`/api/workspaces/${encodeURIComponent(e.workspaceId)}/moderation-cases`}/${encodeURIComponent(e.caseId)}/realtime-ticket`,yy,{method:`POST`,body:{},signal:e.signal});if(e.signal.aborted)return()=>{};let n=new URL(t.url),r=[`127.0.0.1`,`localhost`].includes(window.location.hostname)&&[`127.0.0.1`,`localhost`].includes(n.hostname);if(Date.parse(t.expiresAt)<=Date.now()||t.workspaceId!==e.workspaceId||n.protocol!==`wss:`&&!(r&&n.protocol===`ws:`)||n.pathname!==`/realtime/socket`||n.search||n.hash||n.username||n.password)throw Error(`Qualified Gateway destination required`);if(t.workspaceId===null&&t.supportCaseId!==e.caseId)throw Error(`Qualified support case ticket required`);let i=t.cursor,a=gy({url:n.toString(),onOpen:()=>a.send({type:`authenticate`,product:`operations`,ticket:t.ticket}),onFrame:n=>{if(e.signal.aborted)return;if(typeof n!=`string`||n.length>65536){a.close();return}let r;try{r=JSON.parse(n)}catch{a.close();return}let o=by.safeParse(r);if(o.success){let t=o.data.cursor;if(t.epoch!==i.epoch){e.onInvalidate(),a.close();return}let n=t.sequence>i.sequence;n&&(i=t),(o.data.type===`subscription.ready`||n)&&e.onInvalidate(),e.onState(`connected`),a.send({type:`ack`,cursor:i});return}let s=xy.safeParse(r);if(s.success){let n=s.data;if(n.streamFamily!==t.family||n.scope.family!==t.family||n.streamId!==t.resourceId||n.scope.resourceId!==t.resourceId||n.scope.workspaceId!==t.workspaceId||n.scope.deliveryId!==t.deliveryId||n.scope.teamId!==t.teamId||t.workspaceId===null&&(n.streamFamily!==`chat`||n.scope.workspaceId!==null||n.scope.supportCaseId!==t.supportCaseId||n.payload.messageId!==t.messageId)){a.close();return}if(n.epoch!==i.epoch||n.streamFamily===`marathon_feed`&&n.serverSequence>i.sequence+1){e.onInvalidate(),a.close();return}n.serverSequence>i.sequence&&(i={epoch:n.epoch,sequence:n.serverSequence},e.onInvalidate()),a.send({type:`ack`,cursor:i});return}let c=Sy.safeParse(r);c.success&&c.data.snapshot.family===t.family&&c.data.snapshot.resourceId===t.resourceId&&e.onInvalidate(),a.close()},onClose:()=>{e.signal.aborted||(e.onState(`disconnected`),e.onInvalidate())}});return e.signal.addEventListener(`abort`,()=>a.close(),{once:!0}),()=>a.close()},wy=(e,t,n)=>{let r=S(),[i,a]=(0,y.useState)(0),[o,s]=(0,y.useState)(`connecting`);return(0,y.useEffect)(()=>{if(!n){s(`unavailable`);return}s(`connecting`);let i=new AbortController,a,o,c=!1,l=!1,u=()=>{i.signal.aborted||c||o!==void 0||(o=window.setTimeout(()=>{o=void 0,!i.signal.aborted&&l&&(l=!1,c=!0,r.isFetching({queryKey:[`operations`,`moderation`,e,t],exact:!0})>0&&(l=!0),r.invalidateQueries({queryKey:[`operations`,`moderation`,e,t]},{cancelRefetch:!1}).finally(()=>{c=!1,l&&u()}))},50))};return Cy({workspaceId:e,caseId:t,signal:i.signal,onState:s,onInvalidate:()=>{l=!0,u()}}).then(e=>{a=e}).catch(()=>{i.signal.aborted||s(`unavailable`)}),()=>{i.abort(),o!==void 0&&window.clearTimeout(o),a?.()}},[t,n,i,r,e]),{state:o,reconnect:()=>{s(`connecting`),a(e=>e+1)}}},Ty=(e,t)=>`${e===null?`/api/support-moderation-cases`:`/api/workspaces/`+encodeURIComponent(e)+`/moderation-cases`}/${encodeURIComponent(t)}/media`,Ey=(e,t,n)=>Z(Ty(e,t),bg,{signal:n}),Dy=async(e,t,n,r)=>{let i=new URLSearchParams({...n.assetVersion?{assetVersion:n.assetVersion}:{},...n.rendition?{rendition:n.rendition}:{}}),a=await _v(`${Ty(e,t)}/${encodeURIComponent(n.assetId)}${i.size?`?`+i:``}`,{signal:r,maxBytes:n.sizeBytes,contentType:n.contentType}),o=Array.from(new Uint8Array(await crypto.subtle.digest(`SHA-256`,await a.arrayBuffer()))).map(e=>e.toString(16).padStart(2,`0`)).join(``);if(r.throwIfAborted(),o!==n.checksum)throw Error(`media_checksum_rejected`);return a},Oy=(e,t)=>ft({queryKey:[`operations`,`moderation`,e,t,`media`],queryFn:({signal:n})=>Ey(e,t,n),retry:!1}),ky=(e,t,n)=>ft({queryKey:[`operations`,`moderation`,e,t,`mediaBytes`,n.assetId,n.assetVersion,n.rendition,n.checksum],queryFn:({signal:r})=>Dy(e,t,n,r),retry:!1,gcTime:0,staleTime:0}),Ay=({workspaceId:e,caseId:t,asset:n})=>{let r=ky(e,t,n),[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(null);return(0,y.useEffect)(()=>{if(!r.isSuccess||!r.data){a(null),s(null);return}let e=URL.createObjectURL(r.data),t=new AbortController;return a(e),n.kind===`file`&&r.data.text().then(e=>{t.signal.aborted||s(e)}),()=>{t.abort(),URL.revokeObjectURL(e)}},[n.kind,r.data,r.isSuccess]),r.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Загружаем разрешённые media bytes…`}):r.isError?(0,b.jsx)(Q,{error:r.error}):(0,b.jsxs)(`section`,{"aria-label":`Проверенное media содержимое`,children:[n.kind===`image`&&i?(0,b.jsx)(`img`,{src:i,alt:`${n.rendition===`poster`?`Кадр видео case`:`Материал case`} · ${n.assetId}`}):null,n.kind===`audio`&&i?(0,b.jsx)(`audio`,{controls:!0,src:i,"aria-label":`Аудио case · ${n.assetId}`}):null,n.kind===`file`&&o!==null?(0,b.jsx)(`pre`,{children:o}):null]})},jy=({workspaceId:e,caseId:t})=>{let n=Oy(e,t),[r,i]=(0,y.useState)(null);if(n.isPending)return(0,b.jsx)(`p`,{role:`status`,children:`Загружаем разрешённые media…`});if(n.isError)return n.error instanceof dv&&n.error.status===403?(0,b.jsx)(`p`,{role:`status`,children:`Для просмотра media требуется отдельное текущее назначение.`}):(0,b.jsx)(Q,{error:n.error});let a=n.data.items.find(e=>JSON.stringify([e.assetId,e.assetVersion,e.rendition])===r);return(0,b.jsxs)(`section`,{"aria-label":`Media материалы case`,children:[(0,b.jsx)(`h2`,{children:`Media материалы case`}),n.data.items.length===0?(0,b.jsx)(`p`,{children:`Разрешённых media материалов нет.`}):(0,b.jsx)(`ul`,{children:n.data.items.map(e=>{let t=e.kind===`image`?[`image/jpeg`,`image/png`,`image/webp`]:e.kind===`audio`?[`audio/mpeg`,`audio/mp4`,`audio/ogg`,`audio/webm`]:[`text/plain`],n=e.kind===`image`?15728640:e.kind===`audio`?67108864:1048576,r=e.rendition===`poster`,a=t.includes(e.contentType)&&e.sizeBytes>0&&e.sizeBytes<=n;return(0,b.jsxs)(`li`,{children:[(0,b.jsx)(`p`,{children:`${r?`Кадр видео`:e.kind} · ${e.contentType} · ${e.sizeBytes} bytes · ${e.assetId}`}),r?(0,b.jsx)(`p`,{children:`Предоставлен кадр видео для проверки. Воспроизведение видео в этой карточке недоступно.`}):null,a?(0,b.jsx)(I,{onPress:()=>{i(JSON.stringify([e.assetId,e.assetVersion,e.rendition]))},children:`Открыть ${r?`кадр видео`:e.kind} · ${e.assetId}${e.assetVersion?` · version `+e.assetVersion:``}`}):(0,b.jsx)(`p`,{children:`Этот формат не поддерживается для просмотра.`})]},JSON.stringify([e.assetId,e.assetVersion,e.rendition]))})}),a?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(I,{onPress:()=>{i(null)},children:`Закрыть media содержимое`}),(0,b.jsx)(Ay,{workspaceId:e,caseId:t,asset:a},`${a.assetId}:${a.assetVersion}:${a.rendition}:${a.checksum}`)]}):null]})},My=e=>Z((e.workspaceId===null?`/api/support-moderation-cases`:`/api/workspaces/${encodeURIComponent(e.workspaceId)}/moderation-cases`)+`/${encodeURIComponent(e.caseId)}/sla`,ng,{method:`POST`,body:$h.parse(e.command),headers:{"if-match":`"${e.revision}"`,"idempotency-key":e.key}}),Ny=()=>{let e=S();return pt({mutationFn:My,retry:!1,onSuccess:async()=>{await e.invalidateQueries({queryKey:[`operations`,`moderation`]})}})},Py=({item:e,disabled:t=!1})=>{let[n]=(0,y.useState)(e),r=e.workspaceId===null?`support case`:`case`,[i,a]=(0,y.useState)(e.dueAt?new Date(Date.parse(e.dueAt)-new Date(e.dueAt).getTimezoneOffset()*6e4).toISOString().slice(0,-1):``),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)(null),u=Ny(),d=i?new Date(i).getTime():NaN,f=Number.isFinite(d)&&d>Date.now()?$h.safeParse({dueAt:new Date(d).toISOString(),reason:o}):void 0,p=e.revision!==n.revision||e.dueAt!==n.dueAt||e.assignedUserId!==n.assignedUserId,m=()=>{if(t||u.isPending)return;if(c){u.mutate(c);return}if(!f?.success||p||!e.capabilities?.canSetSla||e.status!==`open`||!e.assignedUserId||!window.confirm(`Установить SLA ${f.data.dueAt} для ${r} ${e.caseId}, revision ${n.revision}? Ранее наступившая просрочка сохранится в истории.`))return;let i={workspaceId:e.workspaceId,caseId:e.caseId,revision:n.revision,key:crypto.randomUUID(),command:f.data};l(i),u.mutate(i)};return(0,b.jsxs)(`section`,{"aria-label":`Назначение SLA ${r}`,children:[(0,b.jsx)(`h2`,{children:`Срок SLA ${r}`}),(0,b.jsx)(`p`,{children:`Местное время браузера: ${Intl.DateTimeFormat().resolvedOptions().timeZone}. Укажите будущий срок; Core проверит время и отдельное право SLA.`}),(0,b.jsxs)(`label`,{children:[`Срок SLA ${r}`,(0,b.jsx)(`input`,{"aria-label":`Срок SLA ${r}`,type:`datetime-local`,step:`0.001`,value:i,disabled:t||!!c||u.isPending,onChange:e=>{a(e.target.value)}})]}),(0,b.jsxs)(`label`,{children:[`Причина изменения SLA`,(0,b.jsx)(`textarea`,{"aria-label":`Причина изменения SLA`,maxLength:1e3,value:o,disabled:t||!!c||u.isPending,onChange:e=>{s(e.target.value)}})]}),p?(0,b.jsx)(`p`,{role:`alert`,children:`Case изменился. Сверьте сохранённый результат перед новым SLA.`}):null,c?(0,b.jsx)(I,{isDisabled:t||u.isPending,onPress:m,children:`Повторить то же изменение SLA`}):(0,b.jsx)(I,{isDisabled:t||!f?.success||p||u.isPending,onPress:m,children:`Сохранить срок SLA ${r}`}),u.isError?(0,b.jsx)(Q,{error:u.error}):null,u.isSuccess?(0,b.jsx)(`p`,{role:`status`,children:`SLA сохранён. История предыдущих сроков и просрочки сохранена.`}):null]})},Fy=({workspaceId:e,caseId:t})=>{let n=py(e,t),r=my(),[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)(null),[u,d]=(0,y.useState)(0),[f,p]=(0,y.useState)(!1),[m,h]=(0,y.useState)(``),g=!!(n.data?.assignedUserId&&(e===null?n.data.targetKind===`support_message`:n.data.deliveryId&&(n.data.targetKind===`marathon_feed_post`||n.data.targetKind===`marathon_feed_comment`||n.data.targetKind===`live_message`||n.data.targetKind===`chat_message`))),_=wy(e,t,g),v=r.isPending||f,x=async()=>{if(!v){p(!0);try{(await n.refetch()).isSuccess&&(l(null),d(e=>e+1),r.reset())}finally{p(!1)}}};if(n.isPending)return(0,b.jsx)(`p`,{role:`status`,children:f?`Сверяем сохранённый moderation результат…`:`Загружаем moderation case…`});if(n.isError)return(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`h1`,{children:`Moderation case`}),(0,b.jsx)(Q,{error:n.error}),f?(0,b.jsx)(`p`,{role:`status`,children:`Сверяем сохранённый moderation результат…`}):null,(0,b.jsx)(I,{isDisabled:v,onPress:()=>{x()},children:`Сверить сохранённый moderation результат`})]});let S=n.data,C=S.context?.platformModerationStatus===`removed`,w=S.history.filter(e=>e.action===`decision`).at(-1),T=m===w?.auditId?m:w?.auditId,ee=S.targetKind===`marathon_feed_post`?`публикацию`:S.targetKind===`marathon_feed_comment`?`комментарий`:`сообщение`,E=n=>{if(v||!i.trim())return;let a=c??{workspaceId:e,caseId:t,revision:S.revision,key:crypto.randomUUID(),command:n};(c||window.confirm(`Сохранить moderation команду с указанной причиной?`))&&(l(a),r.mutate(a))};return(0,b.jsxs)(`article`,{children:[e===null?(0,b.jsx)(M,{to:`/support-moderation-cases`,search:{limit:20},children:`← Назначенные support cases`}):(0,b.jsx)(M,{to:`/workspaces/$workspaceId/moderation-cases`,params:{workspaceId:e},search:{limit:20},children:`← Назначенная очередь`}),(0,b.jsx)(`h1`,{children:`Moderation case`}),f?(0,b.jsx)(`p`,{role:`status`,children:`Сверяем сохранённый moderation результат…`}):null,g?(0,b.jsx)(`p`,{role:`status`,children:`Gateway: ${_.state}`}):(0,b.jsx)(`p`,{children:`Realtime для этого материала недоступен. Сверяйте сохранённый результат карточки.`}),g&&(_.state===`disconnected`||_.state===`unavailable`)?(0,b.jsx)(I,{onPress:_.reconnect,children:`Повторно авторизовать Gateway`}):null,(0,b.jsx)(`p`,{children:S.caseId}),(0,b.jsx)(`p`,{children:S.reason}),e===null?(0,b.jsx)(`p`,{children:`Purpose: ${S.purpose} · Customer: ${S.customerUserId} · Thread: ${S.threadId}`}):null,(0,b.jsx)(`p`,{children:`Статус: ${S.status} · Приоритет: ${S.priority}`}),(0,b.jsx)(`p`,{children:S.dueAt?`SLA: ${new Date(S.dueAt).toLocaleString(`ru`)}${S.overdue?` · ПРОСРОЧЕН`:``}`:`Срок не назначен`}),S.slaBreachedAt?(0,b.jsx)(`p`,{children:`Сохранённая просрочка SLA: ${new Date(S.slaBreachedAt).toLocaleString(`ru`)}. Новый срок не отменяет эту просрочку.`}):null,S.capabilities?.canSetSla?null:(0,b.jsx)(`p`,{children:`Изменение SLA требует отдельного текущего назначения. Срок и история доступны для просмотра.`}),(0,b.jsx)(`p`,{children:`Назначенный оператор: ${S.assignedUserId??`Не назначен`}`}),(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h2`,{children:`Разрешённый контекст`}),S.context?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h3`,{children:S.context.title}),(0,b.jsx)(`p`,{children:S.context.text})]}):(0,b.jsx)(`p`,{children:`Контекст доступен после принятия case в работу.`}),(0,b.jsx)(`p`,{children:`Материал: ${S.targetKind} · ${S.targetId}`}),S.postId?(0,b.jsx)(`p`,{children:`Публикация: ${S.postId}`}):null,S.commentId?(0,b.jsx)(`p`,{children:`Комментарий: ${S.commentId}`}):null,S.chatId?(0,b.jsx)(`p`,{children:`Chat: ${S.chatId}`}):null,S.streamId?(0,b.jsx)(`p`,{children:`Live stream: ${S.streamId}`}):null,S.context?(0,b.jsx)(`p`,{children:`Текущий статус: ${S.context.moderationStatus}; платформа: ${S.context.platformModerationStatus}; компания: ${S.context.tenantModerationStatus}`}):null]}),S.status===`open`&&S.assignedUserId!==null&&S.capabilities?.canSetSla?(0,b.jsx)(Py,{item:S,disabled:f},`${t}:${u}`):null,(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h2`,{children:`Решение / escalation / appeal`}),S.assignedUserId===null?(0,b.jsx)(`p`,{children:`Примите case в работу перед решением или передачей. Core проверит ваше текущее точное назначение.`}):null,C?(0,b.jsx)(`p`,{children:`Удаление платформой можно подтвердить или передать на отдельный owner review. Снять это удаление из текущей карточки нельзя.`}):null,S.context&&S.context.tenantModerationStatus!==`visible`?(0,b.jsx)(`p`,{children:`Ограничение компании (${S.context.tenantModerationStatus}) сохранится после решения платформы.`}):null,(0,b.jsxs)(`label`,{children:[`Причина moderation команды`,(0,b.jsx)(`textarea`,{value:i,maxLength:1e3,disabled:!!c||f,onChange:e=>a(e.target.value)})]}),c?(0,b.jsx)(I,{isDisabled:v,onPress:()=>{v||r.mutate(c)},children:`Повторить ту же moderation команду`}):(0,b.jsx)(b.Fragment,{children:S.status===`decided`?(0,b.jsxs)(b.Fragment,{children:[w?(0,b.jsxs)(`label`,{children:[`Оспариваемое решение`,(0,b.jsx)(`select`,{"aria-label":`Оспариваемое решение`,value:T,disabled:v||C,onChange:e=>{h(e.target.value)},children:(0,b.jsx)(`option`,{value:w.auditId,children:`${w.auditId} · ${w.occurredAt}`})})]}):(0,b.jsx)(`p`,{children:`Текущее immutable decision отсутствует в разрешённой истории. Сверьте карточку перед appeal.`}),(0,b.jsx)(I,{isDisabled:!i.trim()||v||C||!T||T!==w?.auditId,onPress:()=>{T&&E({action:`appeal`,reason:i.trim(),disputedDecisionId:T})},children:`Открыть appeal`})]}):(0,b.jsx)(b.Fragment,{children:S.assignedUserId===null?(0,b.jsx)(I,{isDisabled:!i.trim()||v,onPress:()=>E({action:`claim`,reason:i.trim()}),children:`Принять case в работу`}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(I,{variant:`danger`,isDisabled:C||!i.trim()||v,onPress:()=>E({action:`decision`,moderationStatus:`hidden`,reason:i.trim()}),children:`Скрыть ${ee}`}),(0,b.jsx)(I,{variant:`danger`,isDisabled:S.assignedUserId===null||!i.trim()||v,onPress:()=>E({action:`decision`,moderationStatus:`removed`,reason:i.trim()}),children:`Удалить ${ee}`}),(0,b.jsx)(I,{isDisabled:S.assignedUserId===null||C||!i.trim()||v,onPress:()=>E({action:`decision`,moderationStatus:`visible`,reason:i.trim()}),children:`Снять ограничение платформы`}),S.status===`open`?(0,b.jsx)(I,{isDisabled:S.assignedUserId===null||!i.trim()||v,onPress:()=>E({action:`escalate`,reason:i.trim()}),children:`Эскалировать case`}):null,(0,b.jsxs)(`label`,{children:[`Идентификатор назначенного оператора`,(0,b.jsx)(`input`,{value:o,disabled:S.assignedUserId===null||!!c||f,onChange:e=>s(e.target.value)})]}),(0,b.jsx)(I,{isDisabled:S.assignedUserId===null||!i.trim()||!o||v,onPress:()=>E({action:`assign`,assignedUserId:o,reason:i.trim()}),children:`Передать назначенному оператору`})]})})}),r.isError?(0,b.jsx)(Q,{error:r.error}):null,(0,b.jsx)(I,{isDisabled:v,onPress:()=>{x()},children:`Сверить сохранённый moderation результат`})]}),S.assignedUserId!==null&&(S.targetKind===`marathon_feed_post`||S.targetKind===`marathon_feed_comment`||S.targetKind===`chat_message`||S.targetKind===`support_message`)?(0,b.jsx)(jy,{workspaceId:e,caseId:t}):null,(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h2`,{children:`Неизменяемый аудит case`}),S.history.length?(0,b.jsx)(`ol`,{children:S.history.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsx)(`p`,{children:`${e.revision} · ${e.action} · ${e.reason} · ${new Date(e.occurredAt).toLocaleString(`ru`)}`}),e.slaChange?(0,b.jsx)(`p`,{children:`Срок SLA: ${e.slaChange.previousDueAt??`Не установлен`} → ${e.slaChange.nextDueAt}; до изменения ${e.slaChange.previousOverdue?`уже наступила просрочка`:`просрочка не наступила`}${e.slaChange.breachedAt?`; сохранённая просрочка `+e.slaChange.breachedAt:``}.`}):null]},e.auditId))}):(0,b.jsx)(`p`,{children:`Команд пока нет.`})]})]})},Iy=(e,t)=>`/api/workspaces/${encodeURIComponent(e)}/moderation-cases/${encodeURIComponent(t)}/removed-review`,Ly=(e,t,n)=>Z(Iy(e,t),Sg,{signal:n}),Ry=e=>Z(Iy(e.workspaceId,e.caseId),Sg,{method:`POST`,body:xg.parse(e.command),headers:{"if-match":`"${e.revision}"`,"idempotency-key":e.key}}),zy=(e,t)=>[`operations`,`removed-review`,e,t],By=(e,t)=>ft({queryKey:zy(e,t),queryFn:({signal:n})=>Ly(e,t,n),retry:!1}),Vy=()=>{let e=S();return pt({mutationFn:Ry,retry:!1,onSuccess:(t,n)=>{e.setQueryData(zy(n.workspaceId,n.caseId),t)}})},Hy=({workspaceId:e,caseId:t})=>{let n=By(e,t),r=Vy(),[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(null),[c,l]=(0,y.useState)(!1),u=r.isPending||c,d=async()=>{if(!u){l(!0);try{(await n.refetch()).isSuccess&&(s(null),r.reset())}finally{l(!1)}}};if(n.isPending)return(0,b.jsx)(`p`,{role:`status`,children:`Загружаем owner review…`});if(n.isError)return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h1`,{children:`Пересмотр удаления платформой`}),(0,b.jsx)(Q,{error:n.error}),(0,b.jsx)(I,{isDisabled:u,onPress:()=>{d()},children:`Сверить сохранённый review`})]});let f=n.data,p=n=>{if(u||!f.capabilities.canResolve||!i.trim()||!window.confirm(n===`lift_platform_removal`?`Снять только удаление платформы? Ограничение компании сохранится.`:`Сохранить удаление платформы с указанной причиной?`))return;let a={workspaceId:e,caseId:t,revision:f.revision,key:crypto.randomUUID(),command:{outcome:n,reason:i.trim()}};s(a),r.mutate(a)};return(0,b.jsxs)(`article`,{children:[(0,b.jsx)(M,{to:`/`,children:`← Назначения`}),(0,b.jsx)(`h1`,{children:`Пересмотр удаления платформой`}),(0,b.jsx)(`p`,{children:f.caseId}),(0,b.jsx)(`p`,{children:`Точное назначение reviewer и текущая MFA/elevation проверяются Core. Автор первоначального решения не может рассмотреть его самостоятельно.`}),c?(0,b.jsx)(`p`,{role:`status`,children:`Сверяем сохранённый review…`}):null,(0,b.jsxs)(`section`,{"aria-label":`Первоначальное решение`,children:[(0,b.jsx)(`h2`,{children:`Первоначальное решение`}),(0,b.jsx)(`p`,{children:`${f.originalDecision.auditId} · ${f.originalDecision.userId} · ${f.originalDecision.occurredAt}`}),(0,b.jsx)(`p`,{children:f.originalDecision.reason})]}),(0,b.jsxs)(`section`,{"aria-label":`Разрешённый review контекст`,children:[(0,b.jsx)(`h2`,{children:f.context.title}),(0,b.jsx)(`p`,{children:f.context.text}),(0,b.jsx)(`p`,{children:`${f.targetKind} · ${f.targetId}`}),(0,b.jsx)(`p`,{children:`Платформа: ${f.context.platformModerationStatus}; компания: ${f.context.tenantModerationStatus}; итог: ${f.context.moderationStatus}`}),(0,b.jsx)(`p`,{children:`Снятие платформенного удаления не меняет ограничение компании.`})]}),(0,b.jsxs)(`label`,{children:[`Причина решения review`,(0,b.jsx)(`textarea`,{"aria-label":`Причина решения review`,maxLength:1e3,value:i,disabled:!!o||u||!f.capabilities.canResolve,onChange:e=>{a(e.target.value)}})]}),o?(0,b.jsx)(I,{isDisabled:u||!f.capabilities.canResolve,onPress:()=>{!u&&f.capabilities.canResolve&&r.mutate(o)},children:`Повторить то же решение review`}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(I,{isDisabled:u||!i.trim()||!f.capabilities.canResolve,onPress:()=>{p(`retain_removed`)},children:`Сохранить удаление платформы`}),(0,b.jsx)(I,{isDisabled:u||!i.trim()||!f.capabilities.canResolve,onPress:()=>{p(`lift_platform_removal`)},children:`Снять только удаление платформы`})]}),f.capabilities.canResolve?null:(0,b.jsx)(`p`,{children:`Решение недоступно по текущим owner facts. Сохранённый результат доступен для сверки.`}),r.isError?(0,b.jsx)(Q,{error:r.error}):null,r.isSuccess?(0,b.jsx)(`p`,{role:`status`,children:`Решение review сохранено владельцем.`}):null,(0,b.jsx)(I,{isDisabled:u,onPress:()=>{d()},children:`Сверить сохранённый review`}),(0,b.jsxs)(`section`,{"aria-label":`История review`,children:[(0,b.jsx)(`h2`,{children:`Неизменяемая история review`}),(0,b.jsx)(`ol`,{children:f.history.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsx)(`p`,{children:`${e.outcome} · ${e.reason} · ${e.reviewerUserId} · ${e.occurredAt}`}),(0,b.jsx)(`p`,{children:`Исходная ревизия: ${e.sourceRevision}`})]},e.reviewId))})]})]})},Uy=(e,t,n)=>(e===null?`/api/support-moderation-cases`:`/api/workspaces/${encodeURIComponent(e)}/moderation-cases`)+`/${encodeURIComponent(t)}/appeals/${encodeURIComponent(n)}`,Wy=(e,t,n,r)=>Z(Uy(e,t,n),Kg,{signal:r}),Gy=e=>Z(Uy(e.workspaceId,e.caseId,e.disputedDecisionId),Kg,{method:`POST`,body:Gg.parse(e.command),headers:{"if-match":`"${e.revision}"`,"idempotency-key":e.key}}),Ky=(e,t,n)=>[`operations`,`independent-appeal`,e,t,n],qy=(e,t,n)=>ft({queryKey:Ky(e,t,n),queryFn:({signal:r})=>Wy(e,t,n,r),retry:!1}),Jy=()=>{let e=S();return pt({mutationFn:Gy,retry:!1,onSuccess:(t,n)=>{e.setQueryData(Ky(n.workspaceId,n.caseId,n.disputedDecisionId),t)}})},Yy=({workspaceId:e,caseId:t,disputedDecisionId:n})=>{let r=qy(e,t,n),i=Jy(),[a,o]=(0,y.useState)(``),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(!1),d=i.isPending||l,f=async()=>{if(!d){u(!0);try{(await r.refetch()).isSuccess&&(c(null),i.reset())}finally{u(!1)}}};if(r.isPending)return(0,b.jsx)(`p`,{role:`status`,children:`Загружаем независимый appeal…`});if(r.isError)return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h1`,{children:`Независимый пересмотр appeal`}),(0,b.jsx)(Q,{error:r.error}),(0,b.jsx)(I,{isDisabled:d,onPress:()=>{f()},children:`Сверить сохранённый appeal`})]});let p=r.data,m=p.capabilities.statusReason===`removed_requires_separate_review`,h=r=>{if(d||s||!p.capabilities.canResolve||!a.trim()||!window.confirm(`Сохранить независимое решение только о platform state? Ограничения компании сохранятся.`))return;let o={workspaceId:e,caseId:t,disputedDecisionId:n,revision:p.revision,key:crypto.randomUUID(),command:{outcome:r,reason:a.trim()}};c(o),i.mutate(o)};return(0,b.jsxs)(`article`,{style:{overflowWrap:`anywhere`},children:[(0,b.jsx)(M,{to:`/`,children:`← Назначения`}),(0,b.jsx)(`h1`,{children:`Независимый пересмотр appeal`}),(0,b.jsx)(`p`,{children:p.caseId}),(0,b.jsx)(`p`,{children:`Статус appeal: ${p.status}`}),(0,b.jsx)(`p`,{children:`Reviewer имеет отдельное точное назначение и отличается от автора оспариваемого решения. Закреплённое решение и новое решение сохраняются в аудите.`}),l?(0,b.jsx)(`p`,{role:`status`,children:`Сверяем сохранённый appeal…`}):null,(0,b.jsxs)(`section`,{"aria-label":`Оспариваемое решение`,children:[(0,b.jsx)(`h2`,{children:`Оспариваемое решение`}),(0,b.jsx)(`p`,{children:p.disputedDecision.auditId}),(0,b.jsx)(`p`,{children:`${p.disputedDecision.userId} · ${p.disputedDecision.occurredAt} · platform ${p.disputedDecision.platformStatus}`}),(0,b.jsx)(`p`,{children:p.disputedDecision.reason}),(0,b.jsx)(`p`,{children:`Intake audit: ${p.intakeAuditId}`})]}),(0,b.jsxs)(`section`,{"aria-label":`Разрешённый appeal контекст`,children:[(0,b.jsx)(`h2`,{children:p.context.title}),(0,b.jsx)(`p`,{children:p.context.text}),(0,b.jsx)(`p`,{children:`${p.targetKind} · ${p.targetId}`}),(0,b.jsx)(`p`,{children:`Платформа: ${p.context.platformModerationStatus}; компания: ${p.context.tenantModerationStatus}; итог: ${p.context.moderationStatus}`})]}),m?(0,b.jsx)(`p`,{role:`alert`,children:`Текущее удаление платформой требует отдельного removed-review с отдельным назначением. Этот appeal недоступен для решения.`}):null,p.capabilities.statusReason===`source_changed`?(0,b.jsx)(`p`,{role:`alert`,children:`Оспариваемый источник изменился. Сохранённый appeal требует сверки owner facts.`}):null,(0,b.jsxs)(`label`,{children:[`Причина решения appeal`,(0,b.jsx)(`textarea`,{"aria-label":`Причина решения appeal`,maxLength:1e3,value:a,disabled:d||!!s||!p.capabilities.canResolve,onChange:e=>{o(e.target.value)}})]}),s?(0,b.jsx)(I,{isDisabled:d||m,onPress:()=>{!d&&!m&&i.mutate(s)},children:`Повторить то же решение appeal`}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(I,{isDisabled:d||!a.trim()||!p.capabilities.canResolve,onPress:()=>{h(`uphold_platform_decision`)},children:`Подтвердить решение платформы`}),(0,b.jsx)(I,{isDisabled:d||!a.trim()||!p.capabilities.canResolve,onPress:()=>{h(`set_visible`)},children:`Разрешить платформой`}),(0,b.jsx)(I,{isDisabled:d||!a.trim()||!p.capabilities.canResolve,onPress:()=>{h(`set_hidden`)},children:`Скрыть платформой`})]}),i.isError?(0,b.jsx)(Q,{error:i.error}):null,i.isSuccess?(0,b.jsx)(`p`,{role:`status`,children:`Независимое решение appeal сохранено владельцем.`}):null,(0,b.jsx)(I,{isDisabled:d,onPress:()=>{f()},children:`Сверить сохранённый appeal`}),(0,b.jsxs)(`section`,{"aria-label":`История независимого appeal`,children:[(0,b.jsx)(`h2`,{children:`Неизменяемая история appeal`}),(0,b.jsx)(`ol`,{children:p.history.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsx)(`p`,{children:`${e.outcome} · ${e.reason} · ${e.reviewerUserId} · ${e.occurredAt}`}),(0,b.jsx)(`p`,{children:`Source revision: ${e.sourceRevision}`})]},e.reviewId))})]})]})},Xy=G();q({workspaceId:Xy}).extend({incidentId:Xy});var Zy=W().trim().min(10).max(1e3).refine(e=>!e.includes(`\0`)&&Array.from(e).length>=10);gh({"idempotency-key":G(),"if-match":W().regex(/^"[1-9][0-9]{0,8}"$/u)});var Qy=q({sourceOutboxId:Xy,reason:Zy});q({});var $y=q({reason:Zy,reconciliationRevision:rh().int().positive()}),eb=q({status:J([`open`,`recovery_requested`,`resolved`]).optional(),cursor:Xy.optional(),limit:Xh().int().min(1).max(50).default(20)}),tb=q({outboxId:Xy,status:J([`pending`,`locked`,`retry_scheduled`,`dispatched`,`dead_lettered`]),attemptCount:rh().int().nonnegative(),topic:W().max(200),targetType:Y(`rabbitmq`),ownerCommandProcessed:sh(),recoverySafe:sh(),failureCode:W().regex(/^[a-z0-9_]{1,64}$/u).nullable(),deadLetteredAt:U().nullable()}),nb=q({eventId:Xy,actorUserId:Xy,action:J([`discovered`,`recovery_requested`,`resolved`]),reason:Zy,revision:rh().int().positive(),occurredAt:U()}),rb=q({incidentId:Xy,workspaceId:Xy,sourceOutboxId:Xy,assigneeUserId:Xy,status:J([`open`,`recovery_requested`,`resolved`]),revision:rh().int().positive(),createdAt:U(),updatedAt:U()}),ib=rb.extend({source:tb,history:K(nb).max(100)}),ab=q({items:K(rb).max(50),deadLetters:K(tb).max(50),nextCursor:Xy.nullable()}),ob=q({incidentId:Xy,revision:rh().int().positive(),source:tb,reconciledAt:U(),recoveryAllowed:sh()}),sb=q({incidentId:Xy,revision:rh().int().positive(),status:J([`recovery_requested`,`resolved`]),commandId:Xy,sourceOutboxId:Xy,auditOutboxId:Xy.nullable(),occurredAt:U()}),cb=q({items:K(q({connectionId:Xy,provider:W().max(100),status:W().max(100),revision:rh().int().positive(),lastTestedAt:U().nullable()})).max(50),observedAt:U()}),lb=q({items:K(q({notificationId:Xy,incidentId:Xy,action:W().max(50),occurredAt:U()})).max(50)}),ub=e=>`/api/workspaces/${encodeURIComponent(e)}`,db=(e,t,n)=>{let r=new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)]));return Z(ub(e)+`/incidents?${r}`,ab,{signal:n})},fb=(e,t,n)=>Z(ub(e)+`/incidents/${encodeURIComponent(t)}`,ib,{signal:n}),pb=e=>Z(ub(e.workspaceId)+`/incidents/discover`,ib,{method:`POST`,body:Qy.parse({sourceOutboxId:e.sourceOutboxId,reason:e.reason})}),mb=(e,t)=>Z(ub(e)+`/incidents/${encodeURIComponent(t)}/reconciliation`,ob,{method:`POST`,body:{}}),hb=e=>Z(ub(e.workspaceId)+`/incidents/${encodeURIComponent(e.incidentId)}/recover`,sb,{method:`POST`,body:$y.parse({reason:e.reason,reconciliationRevision:e.reconciliationRevision}),headers:{"if-match":`"${e.revision}"`,"idempotency-key":e.key}}),gb=(e,t)=>Z(ub(e)+`/integration-health`,cb,{signal:t}),_b=(e,t)=>Z(ub(e)+`/incident-notifications`,lb,{signal:t}),vb=(e,t)=>ft({queryKey:[`operations`,`incidents`,e,t],queryFn:({signal:n})=>db(e,t,n),retry:!1}),yb=(e,t)=>ft({queryKey:[`operations`,`incidents`,e,t],queryFn:({signal:n})=>fb(e,t,n),retry:!1}),bb=()=>{let e=S();return pt({mutationFn:pb,retry:!1,onSuccess:async()=>{await e.invalidateQueries({queryKey:[`operations`,`incidents`]})}})},xb=()=>pt({mutationFn:e=>mb(e.workspaceId,e.incidentId),retry:!1}),Sb=()=>{let e=S();return pt({mutationFn:hb,retry:!1,onSuccess:async()=>{await e.invalidateQueries({queryKey:[`operations`,`incidents`]}),await e.invalidateQueries({queryKey:[`operations`,`incident-notifications`]})}})},Cb=e=>ft({queryKey:[`operations`,`integration-health`,e],queryFn:({signal:t})=>gb(e,t),retry:!1}),wb=e=>ft({queryKey:[`operations`,`incident-notifications`,e],queryFn:({signal:t})=>_b(e,t),retry:!1}),Tb=({workspaceId:e,search:t})=>{let n=vb(e,t),r=bb(),i=na(),[a,o]=(0,y.useState)(``);return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h1`,{children:`Инциденты доставки`}),(0,b.jsx)(`p`,{children:`Защищённая DLQ содержит только разрешённые сообщения этой компании. Открытие инцидента назначает его вам.`}),(0,b.jsxs)(`label`,{children:[`Статус`,(0,b.jsxs)(`select`,{value:t.status??``,onChange:n=>{i({to:`/workspaces/$workspaceId/incidents`,params:{workspaceId:e},search:{limit:t.limit,status:n.target.value?n.target.value:void 0}})},children:[(0,b.jsx)(`option`,{value:``,children:`Все`}),(0,b.jsx)(`option`,{value:`open`,children:`open`}),(0,b.jsx)(`option`,{value:`recovery_requested`,children:`recovery_requested`}),(0,b.jsx)(`option`,{value:`resolved`,children:`resolved`})]})]}),n.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Загружаем инциденты…`}):null,n.isError?(0,b.jsx)(Q,{error:n.error}):null,n.data?.items.length===0?(0,b.jsx)(`p`,{children:`Назначенных инцидентов нет.`}):null,(0,b.jsx)(`ul`,{children:n.data?.items.map(t=>(0,b.jsxs)(`li`,{children:[(0,b.jsx)(M,{to:`/workspaces/$workspaceId/incidents/$incidentId`,params:{workspaceId:e,incidentId:t.incidentId},children:t.incidentId}),` · ${t.status} · revision ${t.revision}`]},t.incidentId))}),n.data?.nextCursor?(0,b.jsx)(I,{onPress:()=>{i({to:`/workspaces/$workspaceId/incidents`,params:{workspaceId:e},search:{...t,cursor:n.data.nextCursor}})},children:`Следующая страница`}):null,(0,b.jsx)(`h2`,{children:`Защищённая DLQ`}),(0,b.jsxs)(`label`,{children:[`Причина принятия инцидента`,(0,b.jsx)(`textarea`,{minLength:10,maxLength:1e3,value:a,onChange:e=>o(e.target.value)})]}),n.data?.deadLetters.length===0?(0,b.jsx)(`p`,{children:`Сообщений в защищённой DLQ нет.`}):null,(0,b.jsx)(`ul`,{children:n.data?.deadLetters.map(t=>(0,b.jsxs)(`li`,{children:[`${t.topic} · attempts ${t.attemptCount} · ${t.outboxId}`,(0,b.jsx)(I,{isDisabled:a.trim().length<10||r.isPending,onPress:()=>r.mutate({workspaceId:e,sourceOutboxId:t.outboxId,reason:a.trim()},{onSuccess:t=>{i({to:`/workspaces/$workspaceId/incidents/$incidentId`,params:{workspaceId:e,incidentId:t.incidentId}})}}),children:`Принять инцидент`})]},t.outboxId))}),r.isError?(0,b.jsx)(Q,{error:r.error}):null,(0,b.jsx)(I,{variant:`quiet`,onPress:()=>{n.refetch()},children:`Обновить очередь`}),(0,b.jsxs)(`p`,{children:[(0,b.jsx)(M,{to:`/workspaces/$workspaceId/integration-health`,params:{workspaceId:e},children:`Состояние AI интеграций`}),` · `,(0,b.jsx)(M,{to:`/workspaces/$workspaceId/incident-notifications`,params:{workspaceId:e},children:`Уведомления`})]})]})},Eb=({workspaceId:e,incidentId:t,revision:n,status:r})=>{let[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(null),c=xb(),l=Sb(),u=c.data,d=u?.incidentId===t&&u.revision===n&&(u.recoveryAllowed||u.source.status===`dispatched`||u.source.ownerCommandProcessed);return(0,b.jsxs)(`section`,{"aria-label":`Восстановление доставки`,children:[(0,b.jsx)(`h2`,{children:`Восстановление доставки`}),(0,b.jsx)(`p`,{children:`Сначала сверяем сохранённый результат. При неопределённом ответе повтор разрешён только после новой сверки и с тем же ключом.`}),(0,b.jsx)(I,{isDisabled:c.isPending||l.isPending,onPress:()=>c.mutate({workspaceId:e,incidentId:t}),children:`Сверить состояние доставки`}),c.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Сверяем owner состояние…`}):null,c.isError?(0,b.jsx)(Q,{error:c.error}):null,u?(0,b.jsx)(`p`,{role:`status`,children:`Сверено: ${u.source.status} · revision ${u.revision}`}):null,(0,b.jsxs)(`label`,{children:[`Причина восстановления`,(0,b.jsx)(`textarea`,{minLength:10,maxLength:1e3,value:i,disabled:o!==null,onChange:e=>a(e.target.value)})]}),o?(0,b.jsx)(I,{isDisabled:!u||c.isPending||l.isPending,onPress:()=>{c.reset(),l.mutate(o,{onSuccess:()=>{s(null),c.reset()}})},children:`Повторить сохранённый запрос после сверки`}):(0,b.jsx)(I,{isDisabled:!d||i.trim().length<10||l.isPending||r===`resolved`,onPress:()=>{if(!u||!d||i.trim().length<10||!window.confirm(u.source.status===`dispatched`||u.source.ownerCommandProcessed?`Зафиксировать подтверждённую доставку и закрыть инцидент?`:`Повторить доставку только этого сообщения? Подтверждено, что оно находится в DLQ.`))return;let r={workspaceId:e,incidentId:t,revision:n,reconciliationRevision:u.revision,reason:i.trim(),key:crypto.randomUUID()};s(r),c.reset(),l.mutate(r,{onSuccess:()=>{s(null),c.reset()}})},children:u?.source.status===`dispatched`?`Закрыть подтверждённый инцидент`:`Восстановить доставку`}),l.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Сохраняем recovery…`}):null,l.isError?(0,b.jsx)(Q,{error:l.error}):null,l.isSuccess?(0,b.jsx)(`p`,{role:`status`,children:`Сохранённый recovery результат: ${l.data.status} · ${l.data.commandId}`}):null]})},Db=({workspaceId:e,incidentId:t})=>{let n=yb(e,t);if(n.isPending)return(0,b.jsx)(`p`,{role:`status`,children:`Загружаем инцидент…`});if(n.isError)return(0,b.jsx)(Q,{error:n.error});let r=n.data;return(0,b.jsxs)(`article`,{children:[(0,b.jsx)(M,{to:`/workspaces/$workspaceId/incidents`,params:{workspaceId:e},search:{limit:20},children:`← Инциденты`}),(0,b.jsx)(`h1`,{children:`Инцидент доставки`}),(0,b.jsxs)(`dl`,{children:[(0,b.jsx)(`dt`,{children:`Инцидент`}),(0,b.jsx)(`dd`,{children:r.incidentId}),(0,b.jsx)(`dt`,{children:`Статус`}),(0,b.jsx)(`dd`,{children:r.status}),(0,b.jsx)(`dt`,{children:`Revision`}),(0,b.jsx)(`dd`,{children:r.revision}),(0,b.jsx)(`dt`,{children:`Назначен оператору`}),(0,b.jsx)(`dd`,{children:r.assigneeUserId}),(0,b.jsx)(`dt`,{children:`Сообщение`}),(0,b.jsx)(`dd`,{children:r.sourceOutboxId}),(0,b.jsx)(`dt`,{children:`Доставка`}),(0,b.jsx)(`dd`,{children:r.source.status}),(0,b.jsx)(`dt`,{children:`Код сбоя`}),(0,b.jsx)(`dd`,{children:r.source.failureCode??`Нет текущего сбоя`}),(0,b.jsx)(`dt`,{children:`Тип сообщения`}),(0,b.jsx)(`dd`,{children:r.source.topic})]}),(0,b.jsx)(Eb,{workspaceId:e,incidentId:t,revision:r.revision,status:r.status},`${e}:${t}`),(0,b.jsx)(`h2`,{children:`Неизменяемый аудит`}),(0,b.jsx)(`ol`,{children:r.history.map(e=>(0,b.jsx)(`li`,{children:`${e.action} · ${e.reason} · ${e.actorUserId} · ${new Date(e.occurredAt).toLocaleString(`ru`)}`},e.eventId))}),(0,b.jsx)(I,{variant:`quiet`,onPress:()=>{n.refetch()},children:`Обновить инцидент`})]})},Ob=({workspaceId:e})=>{let t=Cb(e);return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h1`,{children:`Состояние AI интеграций`}),(0,b.jsx)(`p`,{children:`Сохранённое состояние существующего AI owner. Проверки provider и изменения credentials выполняются только разрешёнными owner процедурами.`}),t.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Загружаем состояние…`}):null,t.isError?(0,b.jsx)(Q,{error:t.error}):null,t.data?.items.length===0?(0,b.jsx)(`p`,{children:`AI подключения этой компании отсутствуют.`}):null,(0,b.jsx)(`ul`,{children:t.data?.items.map(e=>(0,b.jsx)(`li`,{children:`${e.provider} · ${e.status} · revision ${e.revision} · ${e.lastTestedAt?new Date(e.lastTestedAt).toLocaleString(`ru`):`проверка не выполнена`}`},e.connectionId))}),(0,b.jsx)(I,{onPress:()=>{t.refetch()},children:`Обновить состояние интеграций`})]})},kb=({workspaceId:e})=>{let t=wb(e);return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h1`,{children:`Уведомления оператора`}),t.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Загружаем уведомления…`}):null,t.isError?(0,b.jsx)(Q,{error:t.error}):null,t.data?.items.length===0?(0,b.jsx)(`p`,{children:`Уведомлений нет.`}):null,(0,b.jsx)(`ul`,{children:t.data?.items.map(t=>(0,b.jsxs)(`li`,{children:[(0,b.jsx)(M,{to:`/workspaces/$workspaceId/incidents/$incidentId`,params:{workspaceId:e,incidentId:t.incidentId},children:t.action}),` · ${new Date(t.occurredAt).toLocaleString(`ru`)}`]},t.notificationId))}),(0,b.jsx)(I,{onPress:()=>{t.refetch()},children:`Обновить уведомления`})]})},Ab=e=>`/api/workspaces/${encodeURIComponent(e.workspaceId)}/deliveries/${encodeURIComponent(e.deliveryId)}/assignment-rules/${encodeURIComponent(e.ruleId)}/jobs/${encodeURIComponent(e.jobId)}`,jb=(e,t,n)=>{let r=new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)]));return Z(`/api/workspaces/${encodeURIComponent(e)}/assignment-recoveries?${r}`,A_,{signal:n})},Mb=(e,t)=>Z(Ab(e)+`/recovery`,O_,{signal:t}),Nb=(e,t)=>Z(Ab(e)+`/source`,D_,{signal:t}),Pb=(e,t)=>Z(Ab(e)+`/result`,E_,{signal:t}),Fb=e=>Z(Ab(e)+`/recovery`,k_,{method:`POST`,body:C_.parse(e.command),headers:{"if-match":`"${e.revision}"`,"idempotency-key":e.key}}),Ib=e=>[`operations`,`assignment-recovery`,e.workspaceId,e.deliveryId,e.ruleId,e.jobId],Lb=(e,t)=>ft({queryKey:[`operations`,`assignment-recovery`,`queue`,e,t],queryFn:({signal:n})=>jb(e,t,n),retry:!1}),Rb=e=>ft({queryKey:[...Ib(e),`preview`],queryFn:({signal:t})=>Mb(e,t),refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1}),zb=e=>ft({queryKey:[...Ib(e),`source`],queryFn:({signal:t})=>Nb(e,t),enabled:!1,retry:!1}),Bb=e=>ft({queryKey:[...Ib(e),`result`],queryFn:({signal:t})=>Pb(e,t),enabled:!1,retry:!1}),Vb=()=>{let e=S();return pt({mutationFn:Fb,retry:!1,onSuccess:async(t,n)=>{await e.resetQueries({queryKey:[...Ib(n),`result`],exact:!0}),await e.invalidateQueries({queryKey:Ib(n)}),await e.invalidateQueries({queryKey:[`operations`,`assignment-recovery`,`queue`,n.workspaceId]})}})},Hb=({workspaceId:e,search:t})=>{let n=Lb(e,t),r=na(),i=(0,y.useRef)(null),a=n.isSuccess?n.data.items:[],o=Zv({count:a.length,getScrollElement:()=>i.current,estimateSize:()=>200,overscan:4});return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(M,{to:`/`,children:`← Назначения`}),(0,b.jsx)(`h1`,{children:`Восстановление назначений`}),n.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Загружаем разрешённые задания…`}):null,n.isError?(0,b.jsx)(Q,{error:n.error}):null,(0,b.jsx)(I,{isDisabled:n.isFetching,onPress:()=>{n.refetch()},children:`Обновить очередь назначений`}),n.isSuccess&&a.length===0?(0,b.jsx)(`p`,{children:`Разрешённых заданий нет.`}):null,(0,b.jsx)(`div`,{ref:i,tabIndex:0,role:`region`,"aria-label":`Задания назначения`,style:{height:400,overflow:`auto`},children:(0,b.jsx)(`div`,{style:{height:o.getTotalSize(),position:`relative`},children:o.getVirtualItems().map(e=>{let t=a[e.index];return(0,b.jsxs)(`div`,{"data-index":e.index,ref:o.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,boxSizing:`border-box`,padding:`12px 0`,overflowWrap:`anywhere`,transform:`translateY(${e.start}px)`},children:[(0,b.jsx)(M,{to:`/workspaces/$workspaceId/deliveries/$deliveryId/assignment-rules/$ruleId/jobs/$jobId/recovery`,params:{workspaceId:t.workspaceId,deliveryId:t.deliveryId,ruleId:t.ruleId,jobId:t.jobId},children:t.jobId}),(0,b.jsx)(`p`,{children:`${t.originType} · ${t.jobStatus} · ${t.processedCount}/${t.totalCount}`}),(0,b.jsx)(`p`,{children:`Rule ${t.ruleId} · revision ${t.ruleRevision} · ${t.ruleStatus}`})]},t.jobId)})})}),n.isSuccess&&n.data.nextCursor?(0,b.jsx)(I,{onPress:()=>{r({to:`/workspaces/$workspaceId/assignment-recoveries`,params:{workspaceId:e},search:{...t,cursor:n.data.nextCursor}})},children:`Следующая страница`}):null]})},Ub=e=>{let t=S(),n=Rb(e),r=zb(e),i=Bb(e),a=Vb(),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)(!1),[u,d]=(0,y.useState)(null),[f,p]=(0,y.useState)(!1),[m,h]=(0,y.useState)(!1),g=a.isPending||f||n.isFetching||r.isFetching||i.isFetching,_=async()=>{if(!g){p(!0);try{await t.resetQueries({queryKey:[...Ib(e),`result`],exact:!0});let a=await n.refetch(),o=await r.refetch(),s=await i.refetch();h(!!(u&&a.isSuccess&&o.isSuccess&&s.isSuccess))}finally{p(!1)}}};if(n.isPending)return(0,b.jsx)(`p`,{role:`status`,children:`Загружаем assignment owner snapshot…`});if(n.isError)return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h1`,{children:`Восстановление назначения`}),(0,b.jsx)(Q,{error:n.error}),(0,b.jsx)(I,{isDisabled:g,onPress:()=>{_()},children:`Сверить сохранённое назначение`})]});let v=n.data,x=v.preview,C=r.isSuccess&&!r.isFetching&&r.data.workspaceId===e.workspaceId&&r.data.deliveryId===e.deliveryId&&r.data.ruleId===e.ruleId&&r.data.jobId===e.jobId&&(r.data.scopeExpiresAt===null||Date.parse(r.data.scopeExpiresAt)>Date.now()),w=C_.safeParse({fingerprint:x.fingerprint,jobUpdatedAt:x.job.updatedAt,reason:o}),T=v.capabilities.canRecover&&x.canRecover&&C&&w.success&&c,ee=()=>{if(g||u||!T||!w.success)return;let t={...e,revision:x.ruleRevision,key:crypto.randomUUID(),command:w.data};d(t),h(!1),a.mutate(t)},E=i.isSuccess&&!i.isFetching?i.data:v.result;return(0,b.jsxs)(`article`,{style:{overflowWrap:`anywhere`},children:[(0,b.jsx)(M,{to:`/workspaces/$workspaceId/assignment-recoveries`,params:{workspaceId:e.workspaceId},search:{limit:20},children:`← Восстановление назначений`}),(0,b.jsx)(`h1`,{children:`Восстановление назначения`}),(0,b.jsx)(`p`,{children:e.jobId}),(0,b.jsx)(`p`,{children:`Rule: ${e.ruleId} · revision ${x.ruleRevision} · ${x.ruleStatus}`}),(0,b.jsx)(`p`,{children:`Origin: ${x.originType} · effect ${x.effect}`}),(0,b.jsx)(`p`,{children:`Задание: ${x.job.status} · ${x.job.processedCount}/${x.job.totalCount} · attempt ${x.job.attemptCount}`}),(0,b.jsx)(`p`,{children:`Срок item results: ${x.job.itemResultsAvailableUntil??`Не установлен`}`}),(0,b.jsxs)(`section`,{"aria-label":`Owner preview назначения`,children:[(0,b.jsx)(`h2`,{children:`Текущий owner preview`}),(0,b.jsx)(`p`,{children:`Fingerprint: ${x.fingerprint} · ${x.generatedAt}`}),(0,b.jsx)(`p`,{children:`Eligible: ${x.impact.eligibleParticipantCount} · affected: ${x.impact.affectedEnrollmentCount} · другие origins: ${x.impact.preservedByOtherOriginCount}`}),(0,b.jsx)(`ul`,{children:x.checks.map(e=>(0,b.jsx)(`li`,{children:`${e.requirement}: ${e.ready?`ready`:`blocked`}`},e.requirement))})]}),(0,b.jsx)(I,{isDisabled:g,onPress:()=>{_()},children:`Сверить owner snapshot`}),f?(0,b.jsx)(`p`,{role:`status`,children:`Сверяем owner snapshot и фактический результат…`}):null,r.isError?(0,b.jsx)(Q,{error:r.error}):null,r.isSuccess&&C?(0,b.jsxs)(`section`,{"aria-label":`Источник назначения`,children:[(0,b.jsx)(`h2`,{children:`Источник назначения`}),(0,b.jsx)(`p`,{children:`${r.data.originType} · ${r.data.sourceStatus} · eligible ${r.data.eligibleParticipantCount}`}),(0,b.jsx)(`p`,{children:`Source fingerprint: ${r.data.sourceFingerprint}`})]}):null,(0,b.jsxs)(`label`,{children:[`Причина восстановления назначения`,(0,b.jsx)(`textarea`,{"aria-label":`Причина восстановления назначения`,minLength:10,maxLength:1e3,value:o,disabled:g||!!u,onChange:e=>{s(e.target.value)}})]}),(0,b.jsxs)(`label`,{children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:c,disabled:g||!!u,onChange:e=>{l(e.target.checked)}}),`Подтверждаю восстановление только этого задания`]}),u?(0,b.jsx)(I,{isDisabled:g||!C||!m,onPress:()=>{!g&&C&&m&&(h(!1),a.mutate(u))},children:`Повторить сохранённый recovery запрос`}):(0,b.jsx)(I,{isDisabled:g||!T,onPress:ee,children:`Запросить восстановление`}),u&&!m?(0,b.jsx)(`p`,{children:`Перед повтором того же запроса сверяйте текущий owner snapshot.`}):null,a.isError?(0,b.jsx)(Q,{error:a.error}):null,a.isSuccess?(0,b.jsx)(`p`,{role:`status`,children:`Recovery принят: ${a.data.receipt.commandId} · ${a.data.result.status}. Выполнение подтверждается owner результатом отдельно.`}):null,(0,b.jsxs)(`section`,{"aria-label":`Фактический owner результат`,children:[(0,b.jsx)(`h2`,{children:`Фактический owner результат`}),i.isError?(0,b.jsx)(Q,{error:i.error}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{children:`Owner статус: ${E.status} · обработано ${E.processedCount}/${E.totalCount}`}),(0,b.jsx)(`p`,{children:`EnrollmentOrigin: active ${E.activeOriginCount} · revoked ${E.revokedOriginCount} · preserved ${E.preservedByOtherOriginCount}`}),E.status===`completed`?(0,b.jsx)(`p`,{role:`status`,children:`Owner завершил задание. Фактические origin effects сохранены.`}):(0,b.jsx)(`p`,{children:`Recovery acceptance и доставка очереди сами по себе не завершают owner эффект.`})]})]}),(0,b.jsx)(I,{isDisabled:g,onPress:()=>{_()},children:`Сверить сохранённое назначение`}),(0,b.jsxs)(`section`,{"aria-label":`История восстановления назначения`,children:[(0,b.jsx)(`h2`,{children:`Неизменяемая история recovery`}),(0,b.jsx)(`ol`,{children:v.history.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsx)(`p`,{children:`${e.commandId} · ${e.reason} · ${e.previous.status} → ${e.current.status} · ${e.acceptedAt}`})},e.commandId))})]})]})},Wb=e=>`/api/media-assets/${encodeURIComponent(e)}/source-cleanup`,Gb=(e,t)=>Z(Wb(e),L_,{signal:t}),Kb=e=>{let t=e.action===`set_hold`?`/hold`:e.action===`release_hold`?`/hold/release`:e.action===`request_deletion`?`/deletion-requests`:`/deletion-requests/${encodeURIComponent(e.requestId)}/approve`;return Z(Wb(e.assetId)+t,L_,{method:`POST`,body:e.command,headers:{"if-match":`"${e.revision}"`,"idempotency-key":e.key}})},qb=e=>[`operations`,`media-source-cleanup`,e],Jb=e=>ft({queryKey:qb(e),queryFn:({signal:t})=>Gb(e,t),retry:!1}),Yb=()=>{let e=S();return pt({mutationFn:Kb,retry:!1,onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:qb(n.assetId)})}})},Xb={created:`Создан`,sealed:`Готов к очистке`,deleting:`Удаляется`,completed:`Очищен`,reconciliation_required:`Требует сверки`},Zb={reserved:`Зарезервирован`,pending_approval:`Ожидает независимого подтверждения`,approved:`Подтверждён`,completed:`Очистка завершена`,reconciliation_required:`Требует сверки`},Qb={hold_set:`Удержание установлено`,hold_released:`Удержание снято`,deletion_requested:`Удаление запрошено`,deletion_approved:`Удаление независимо подтверждено`,source_deleted:`Источник очищен`,source_reconciled:`Результат очистки сверен`,source_deletion_admitted:`Очистка источника допущена`,source_reconciliation_required:`Требуется сверка очистки источника`},$b=({assetId:e})=>{let t=Jb(e),n=Yb(),[r,i]=(0,y.useState)(``),[a,o]=(0,y.useState)(``),[s,c]=(0,y.useState)(``),[l,u]=(0,y.useState)(`manual_review`),[d,f]=(0,y.useState)(!1),[p,m]=(0,y.useState)(null),[h,g]=(0,y.useState)(!1),[_,v]=(0,y.useState)(!1),x=t.isFetching||n.isPending||h,S=async(e=!1)=>{if(!x){g(!0);try{let r=await t.refetch();v(r.isSuccess),e&&r.isSuccess&&n.isSuccess&&(m(null),i(``),f(!1),n.reset())}finally{g(!1)}}};if(t.isPending)return(0,b.jsx)(`p`,{role:`status`,children:`Загружаем временный источник…`});if(t.isError)return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h1`,{children:`Очистка временного источника`}),(0,b.jsx)(Q,{error:t.error}),(0,b.jsx)(I,{isDisabled:x,onPress:()=>{S()},children:`Сверить сохранённый результат`})]});let C=t.data,w={sourceFingerprint:C.sourceFingerprint,reason:r},T=P_.safeParse(w),ee=new Date(s).getTime(),E=F_.safeParse({...w,basisRef:a,reviewAt:Number.isFinite(ee)?new Date(ee).toISOString():s}),D=I_.safeParse({...w,mode:l}),te=x||!!p,ne=C.manualActivation===`isolated`,re=t=>{if(te)return;let r={assetId:e,revision:C.revision,key:crypto.randomUUID()},i;if(t===`set_hold`){if(!C.capabilities.maySetHold||!E.success||ee<=Date.now())return;i={...r,action:t,command:E.data}}else if(t===`release_hold`){if(!C.capabilities.mayReleaseHold||!D.success)return;i={...r,action:t,command:D.data}}else if(t===`request_deletion`){if(!ne||!C.capabilities.mayRequestDeletion||!T.success||!d)return;i={...r,action:t,command:T.data}}else{if(!ne||!C.capabilities.mayApproveDeletion||!C.manualRequest||!T.success||!d)return;i={...r,action:t,requestId:C.manualRequest.requestId,command:T.data}}m(i),v(!1),n.mutate(i)};return(0,b.jsxs)(`article`,{style:{overflowWrap:`anywhere`},children:[(0,b.jsx)(M,{to:`/`,children:`← Назначенные очереди`}),(0,b.jsx)(`h1`,{children:`Очистка временного источника`}),(0,b.jsx)(`p`,{children:e}),(0,b.jsx)(`p`,{children:`Временный источник загрузки.`}),(0,b.jsx)(`p`,{children:`Статус источника: ${Xb[C.phase]}`}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:`Технические сведения`}),(0,b.jsx)(`p`,{children:`Revision: ${C.revision}`}),(0,b.jsx)(`p`,{children:`Fingerprint: ${C.sourceFingerprint}`})]}),(0,b.jsx)(`p`,{children:`Необходимость источника завершена: ${C.necessityEndedAt??`Не подтверждено`}`}),C.writeCapabilityExpiresAt?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{children:`Доступ для загрузки действует до: ${C.writeCapabilityExpiresAt}`}),C.phase!==`completed`&&!C.capabilities.mayApproveDeletion?(0,b.jsx)(`p`,{children:`Для подтверждения очистки требуется завершение этого периода и проверка остальных условий.`}):null]}):null,ne?(0,b.jsx)(`p`,{children:`Изолированный контур`}):null,ne?null:(0,b.jsx)(`p`,{children:`Ручное удаление недоступно в этом контуре.`}),C.phase===`completed`?(0,b.jsx)(`p`,{role:`status`,children:`Очистка временного источника завершена.`}):(0,b.jsx)(`p`,{children:`Сохранённое подтверждение и завершение очистки отображаются отдельно.`}),C.phase===`reconciliation_required`?(0,b.jsx)(`p`,{role:`alert`,children:`Результат очистки требует сверки.`}):null,(0,b.jsxs)(`section`,{"aria-label":`Правовое удержание`,children:[(0,b.jsx)(`h2`,{children:`Правовое удержание`}),C.hold?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{children:`Удержание: ${C.hold.holdId} · ${C.hold.status===`active`?`Активно`:`Снято`}`}),(0,b.jsx)(`p`,{children:`Основание: ${C.hold.basisRef} · ${C.hold.reason}`}),(0,b.jsx)(`p`,{children:`Пересмотр: ${C.hold.reviewAt} · установлен ${C.hold.placedAt}`}),(0,b.jsx)(`p`,{children:`Удержание блокирует физическую очистку этого временного источника. Дата пересмотра не снимает удержание автоматически.`})]}):(0,b.jsx)(`p`,{children:`Правовое удержание не установлено.`}),(0,b.jsxs)(`label`,{children:[`Основание удержания`,(0,b.jsx)(`input`,{"aria-label":`Основание удержания`,value:a,maxLength:200,disabled:te,onChange:e=>{o(e.target.value)}})]}),(0,b.jsxs)(`label`,{children:[`Дата пересмотра удержания`,(0,b.jsx)(`input`,{"aria-label":`Дата пересмотра удержания`,type:`datetime-local`,value:s,disabled:te,onChange:e=>{c(e.target.value)}})]}),(0,b.jsx)(`p`,{children:`Дата пересмотра задаётся в часовом поясе браузера: ${Intl.DateTimeFormat().resolvedOptions().timeZone}`}),(0,b.jsx)(I,{isDisabled:te||!C.capabilities.maySetHold||!E.success||ee<=Date.now(),onPress:()=>{re(`set_hold`)},children:`Установить удержание`}),(0,b.jsxs)(`label`,{children:[`Действие после снятия удержания`,(0,b.jsxs)(`select`,{style:{minWidth:0,width:`100%`,maxWidth:`100%`},"aria-label":`Действие после снятия удержания`,value:l,disabled:te,onChange:e=>{u(e.target.value===`regular_cleanup`?`regular_cleanup`:`manual_review`)},children:[(0,b.jsx)(`option`,{value:`manual_review`,children:`Дождаться независимого подтверждения`}),(0,b.jsx)(`option`,{value:`regular_cleanup`,children:`Вернуть в обычную очистку`})]})]}),(0,b.jsx)(I,{isDisabled:te||!C.capabilities.mayReleaseHold||!D.success,onPress:()=>{re(`release_hold`)},children:`Снять удержание`})]}),(0,b.jsxs)(`label`,{children:[`Причина решения`,(0,b.jsx)(`textarea`,{"aria-label":`Причина решения`,value:r,maxLength:1e3,disabled:te,onChange:e=>{i(e.target.value)}})]}),(0,b.jsxs)(`section`,{"aria-label":`Независимое подтверждение удаления`,children:[(0,b.jsx)(`h2`,{children:`Независимое подтверждение удаления`}),C.manualRequest?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{children:`Запрос: ${C.manualRequest.requestId} · ${Zb[C.manualRequest.status]}`}),(0,b.jsx)(`p`,{children:`Инициатор: ${C.manualRequest.requestedByUserId} · Подтвердил: ${C.manualRequest.approvedByUserId??`Нет подтверждения`}`}),(0,b.jsx)(`p`,{children:`${C.manualRequest.reason} · ${C.manualRequest.requestedAt}`})]}):(0,b.jsx)(`p`,{children:`Запрос удаления отсутствует.`}),(0,b.jsx)(`p`,{children:`Подтверждение выполняет другой уполномоченный оператор.`}),(0,b.jsxs)(`label`,{style:{display:`flex`,alignItems:`flex-start`},children:[(0,b.jsx)(`input`,{style:{flex:`none`,width:`auto`},type:`checkbox`,checked:d,disabled:te,onChange:e=>{f(e.target.checked)}}),(0,b.jsx)(`span`,{children:`Подтверждаю очистку только этого временного источника`})]}),(0,b.jsx)(I,{isDisabled:te||!ne||!C.capabilities.mayRequestDeletion||!T.success||!d,onPress:()=>{re(`request_deletion`)},children:`Создать запрос удаления`}),(0,b.jsx)(I,{isDisabled:te||!ne||!C.capabilities.mayApproveDeletion||!C.manualRequest||!T.success||!d,onPress:()=>{re(`approve_deletion`)},children:`Независимо подтвердить удаление`})]}),p?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(I,{isDisabled:x||!_,onPress:()=>{!x&&_&&(v(!1),n.mutate(p))},children:`Повторить сохранённый запрос`}),_?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{children:`Это не отменяет уже принятое решение. Дальнейшие действия доступны по текущему состоянию источника.`}),(0,b.jsx)(I,{isDisabled:x,onPress:()=>{!x&&_&&(m(null),i(``),f(!1),v(!1),n.reset())},children:`Закрыть сохранённый запрос`})]}):null,n.isSuccess?(0,b.jsx)(I,{isDisabled:x,onPress:()=>{S(!0)},children:`Подготовить следующее действие`}):null]}):null,n.isError?(0,b.jsx)(Q,{error:n.error}):null,n.isSuccess?(0,b.jsx)(`p`,{role:`status`,children:`Решение сохранено. Завершение очистки указано в статусе источника.`}):null,(0,b.jsx)(I,{isDisabled:x,onPress:()=>{S()},children:`Сверить сохранённый результат`}),h?(0,b.jsx)(`p`,{role:`status`,children:`Сверяем сохранённый результат…`}):null,(0,b.jsx)(`h2`,{children:`История решений и очистки`}),(0,b.jsx)(`ol`,{children:C.history.map(e=>(0,b.jsx)(`li`,{children:`${Qb[e.action]} · ${e.reason??`Очистка временного источника`} · ${e.actorUserId??`Выполнено Core`} · ${e.occurredAt}${e.requestId?` · запрос ${e.requestId}`:``}`},e.commandId))})]})},ex=gh({workspaceIds:W().max(739).default(``).refine(e=>{if(!e)return!0;let t=e.split(`,`).map(e=>e.trim());return t.length<=20&&new Set(t).size===t.length&&t.every(e=>W().uuid().safeParse(e).success)},{message:`Exact unique UUID scopes required`}),from:U().optional(),to:U().optional()}),tx=q({workspaceIds:K(W().uuid()).min(1).max(20),purpose:W().trim().min(10).max(300),from:U(),to:U()}).refine(e=>new Set(e.workspaceIds).size===e.workspaceIds.length&&Date.parse(e.to)>Date.parse(e.from)&&Date.parse(e.to)-Date.parse(e.from)<=26784e5&&Date.parse(e.to)<=Date.now(),{message:`Unique scopes and past period up to 31 days required`}),nx=rh().int().nonnegative(),rx=q({total:nx,pending:nx,approved:nx,rejected:nx}),ix=q({reportId:W().uuid(),purpose:W(),from:U(),to:U(),generatedAt:U(),semantics:Y(`created_in_period_current_status`),workspaceIds:K(W().uuid()).max(20),rows:K(q({workspaceId:W().uuid(),content:rx,governance:rx,moderation:q({total:nx,open:nx,resolved:nx,overdue:nx,slaUnset:nx,slaMet:nx,slaBreached:nx})})).max(20)}),ax=e=>Z(`/api/reports/workspaces`,ix,{method:`POST`,body:tx.parse(e)}),ox=()=>pt({mutationKey:[`operations`,`reports`],mutationFn:ax,retry:!1}),sx=({search:e,onError:t})=>{let n=na(),[r,i]=(0,y.useState)(e.workspaceIds);return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`label`,{children:[`UUID компаний через запятую`,(0,b.jsx)(`input`,{"aria-label":`Компании отчёта`,value:r,maxLength:739,onChange:e=>{i(e.target.value)}})]}),(0,b.jsx)(I,{onPress:()=>{let i=ex.safeParse({...e,workspaceIds:r});i.success?(t(null),n({to:`/reports`,search:i.data})):t(Error(`Укажите до 20 различных UUID компаний.`))},children:`Применить компании`})]})},cx=({search:e})=>{let t=na(),n=ox(),[r,i]=(0,y.useState)(``),[a,o]=(0,y.useState)(null);return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h1`,{children:`Отчёты по компаниям`}),(0,b.jsx)(`p`,{children:`Текущие статусы заявок и SLA для объектов, созданных в периоде. Каждая компания требует отдельного назначения. Доступ и цель сохраняются в аудите.`}),(0,b.jsx)(sx,{search:e,onError:o},e.workspaceIds),(0,b.jsxs)(`label`,{children:[`Начало периода UTC`,(0,b.jsx)(`input`,{"aria-label":`Начало периода UTC`,type:`datetime-local`,value:e.from?.slice(0,16)??``,onChange:n=>{t({to:`/reports`,search:{...e,from:n.target.value?`${n.target.value}:00Z`:void 0}})}})]}),(0,b.jsxs)(`label`,{children:[`Конец периода UTC`,(0,b.jsx)(`input`,{"aria-label":`Конец периода UTC`,type:`datetime-local`,value:e.to?.slice(0,16)??``,onChange:n=>{t({to:`/reports`,search:{...e,to:n.target.value?`${n.target.value}:00Z`:void 0}})}})]}),(0,b.jsxs)(`label`,{children:[`Цель отчёта`,(0,b.jsx)(`textarea`,{"aria-label":`Цель отчёта`,value:r,maxLength:300,onChange:e=>{i(e.target.value)}})]}),(0,b.jsx)(I,{isDisabled:n.isPending,onPress:()=>{let t=tx.safeParse({workspaceIds:e.workspaceIds.split(`,`).map(e=>e.trim()).filter(Boolean),purpose:r,from:e.from,to:e.to});t.success?(o(null),n.mutate(t.data)):o(Error(`Укажите цель, точные UUID компаний и завершённый период до 31 дня.`))},children:`Сформировать отчёт`}),a?(0,b.jsx)(`p`,{role:`alert`,children:a.message}):null,n.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Формируем отчёт…`}):null,n.isError?(0,b.jsx)(Q,{error:n.error}):null,n.data?(0,b.jsxs)(`section`,{"aria-label":`Результат отчёта`,children:[(0,b.jsx)(`p`,{children:`Аудит: ${n.data.reportId}. Цель: ${n.data.purpose}`}),(0,b.jsx)(`p`,{children:`Период: ${n.data.from} — ${n.data.to}. Сформирован: ${n.data.generatedAt}`}),(0,b.jsx)(`div`,{role:`region`,"aria-label":`Показатели отчёта`,tabIndex:0,style:{overflowX:`auto`},children:(0,b.jsxs)(`table`,{children:[(0,b.jsx)(`caption`,{children:`Минимизированные показатели по компаниям`}),(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{scope:`col`,children:`Компания`}),(0,b.jsx)(`th`,{scope:`col`,children:`Контент: всего / ожидание / approve / reject`}),(0,b.jsx)(`th`,{scope:`col`,children:`Governance: всего / ожидание / approve / reject`}),(0,b.jsx)(`th`,{scope:`col`,children:`Модерация: всего / открыто / решено / текущая просрочка`}),(0,b.jsx)(`th`,{scope:`col`,children:`SLA: не назначен / выполнен / нарушен`})]})}),(0,b.jsx)(`tbody`,{children:n.data.rows.map(e=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{scope:`row`,children:e.workspaceId}),(0,b.jsx)(`td`,{children:`${e.content.total} / ${e.content.pending} / ${e.content.approved} / ${e.content.rejected}`}),(0,b.jsx)(`td`,{children:`${e.governance.total} / ${e.governance.pending} / ${e.governance.approved} / ${e.governance.rejected}`}),(0,b.jsx)(`td`,{children:`${e.moderation.total} / ${e.moderation.open} / ${e.moderation.resolved} / ${e.moderation.overdue}`}),(0,b.jsx)(`td`,{children:`${e.moderation.slaUnset} / ${e.moderation.slaMet} / ${e.moderation.slaBreached}`})]},e.workspaceId))})]})})]}):null]})},lx=(e,t,n)=>{let r=sg.parse(t),i=new URLSearchParams(Object.entries(r).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)]));return Z(`/api/workspaces/${encodeURIComponent(e)}/ai/human-reviews?${i}`,pg,{signal:n})},ux=(e,t,n,r)=>{let i=sg.omit({status:!0}).parse(n),a=new URLSearchParams({limit:String(i.limit),...i.cursor?{cursor:i.cursor}:{}});return Z(`/api/workspaces/${encodeURIComponent(e)}/ai/human-reviews/${encodeURIComponent(t)}?${a}`,mg,{signal:r})},dx=e=>Z(`/api/workspaces/${encodeURIComponent(e.workspaceId)}/ai/human-reviews/${encodeURIComponent(e.humanReviewTaskId)}/commands`,fg,{method:`POST`,body:lg.parse(e.command),headers:{"if-match":`"${e.revision}"`,"idempotency-key":e.key}}),fx=(e,t)=>ft({queryKey:[`operations`,`humanReviews`,e,`list`,t],queryFn:({signal:n})=>lx(e,t,n),retry:!1}),px=(e,t,n)=>ft({queryKey:[`operations`,`humanReviews`,e,`detail`,t,n],queryFn:({signal:r})=>ux(e,t,n,r),retry:!1}),mx=()=>{let e=S();return pt({mutationFn:dx,retry:!1,onSuccess:async()=>{await e.invalidateQueries({queryKey:[`operations`,`humanReviews`]})}})},hx=({workspaceId:e,search:t})=>{let n=fx(e,t),r=na(),i=(0,y.useRef)(null),a=Zv({count:n.data?.items.length??0,getScrollElement:()=>i.current,estimateSize:()=>160,getItemKey:e=>n.data?.items[e]?.humanReviewTaskId??e,overscan:4});return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h1`,{children:`AI · HumanReview tasks`}),(0,b.jsxs)(`label`,{children:[`Статус HumanReview`,(0,b.jsxs)(`select`,{value:t.status??``,onChange:n=>{r({to:`/workspaces/$workspaceId/ai/human-reviews`,params:{workspaceId:e},search:{limit:t.limit,status:n.target.value?n.target.value:void 0}})},children:[(0,b.jsx)(`option`,{value:``,children:`Все`}),(0,b.jsx)(`option`,{value:`open`,children:`Открыты`}),(0,b.jsx)(`option`,{value:`assigned`,children:`В работе`}),(0,b.jsx)(`option`,{value:`resolved`,children:`Решены`}),(0,b.jsx)(`option`,{value:`cancelled`,children:`Отменены`})]})]}),n.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Загружаем HumanReview tasks…`}):null,n.isError?(0,b.jsx)(Q,{error:n.error}):null,n.data&&n.data.items.length===0?(0,b.jsx)(`p`,{children:`HumanReview tasks с такими фильтрами нет.`}):null,(0,b.jsx)(`div`,{ref:i,className:`queue-scroll`,tabIndex:0,"aria-label":`Очередь HumanReview`,children:(0,b.jsx)(`div`,{style:{height:a.getTotalSize(),position:`relative`},children:a.getVirtualItems().map(t=>{let r=n.data.items[t.index];return(0,b.jsxs)(`div`,{className:`queue-row`,"data-index":t.index,ref:a.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,boxSizing:`border-box`,overflowWrap:`anywhere`,transform:`translateY(${t.start}px)`},children:[(0,b.jsx)(M,{to:`/workspaces/$workspaceId/ai/human-reviews/$humanReviewTaskId`,params:{workspaceId:e,humanReviewTaskId:r.humanReviewTaskId},search:{limit:20},children:`HumanReview · ${r.humanReviewTaskId}`}),(0,b.jsx)(`p`,{children:`${r.status} · ${r.reasonCode} · ${new Date(r.createdAt).toLocaleString(`ru`)}`})]},t.key)})})}),n.data?.nextCursor?(0,b.jsx)(I,{onPress:()=>{r({to:`/workspaces/$workspaceId/ai/human-reviews`,params:{workspaceId:e},search:{...t,cursor:n.data.nextCursor}})},children:`Следующая страница HumanReview`}):null,t.cursor?(0,b.jsx)(M,{to:`/workspaces/$workspaceId/ai/human-reviews`,params:{workspaceId:e},search:{status:t.status,limit:t.limit},children:`В начало HumanReview`}):null]})},gx=q({epoch:W().min(1).max(200),sequence:rh().int().nonnegative().max(2147483647)}),_x=q({ticket:W().regex(/^[A-Za-z0-9_-]{43}$/u),expiresAt:U(),family:Y(`ai_review`),cursor:gx,url:Bm(),workspaceId:G(),resourceId:G()}),vx=gh({type:J([`subscription.ready`,`subscription.checkpoint`]),cursor:gx}),yx=gh({type:Y(`event`),streamFamily:Y(`ai_review`),streamId:G(),scope:gh({family:Y(`ai_review`),resourceId:G(),workspaceId:G(),deliveryId:G().nullable(),teamId:lh()}),eventType:Y(`review.updated`),epoch:W().min(1).max(200),serverSequence:rh().int().positive().max(2147483647),payload:q({kind:Y(`ai_review_reference`),humanReviewTaskId:G()})}),bx=gh({type:J([`snapshot.required`,`stream.reset`]),recoveryAction:Y(`reload_snapshot`),snapshot:q({family:Y(`ai_review`),resourceId:G()})}),xx=async e=>{let t=await Z(`/api/workspaces/${encodeURIComponent(e.workspaceId)}/ai/human-reviews/${encodeURIComponent(e.humanReviewTaskId)}/realtime-ticket`,_x,{method:`POST`,body:{},signal:e.signal});if(e.signal.aborted)return()=>{};if(Date.parse(t.expiresAt)<=Date.now()||t.workspaceId!==e.workspaceId||t.resourceId!==e.humanReviewTaskId)throw Error(`Qualified HumanReview Gateway ticket required`);let n=t.cursor,r=gy({url:t.url,onOpen:()=>r.send({type:`authenticate`,product:`operations`,ticket:t.ticket}),onFrame:i=>{if(e.signal.aborted)return;if(typeof i!=`string`||i.length>65536){r.close();return}let a;try{a=JSON.parse(i)}catch{r.close();return}let o=vx.safeParse(a);if(o.success){if(o.data.cursor.epoch!==n.epoch){e.onInvalidate(),r.close();return}let t=o.data.cursor.sequence>n.sequence;t&&(n=o.data.cursor),(o.data.type===`subscription.ready`||t)&&e.onInvalidate(),e.onState(`connected`),r.send({type:`ack`,cursor:n});return}let s=yx.safeParse(a);if(s.success){let i=s.data;if(i.streamId!==t.resourceId||i.scope.resourceId!==t.resourceId||i.scope.workspaceId!==t.workspaceId||i.payload.humanReviewTaskId!==t.resourceId){r.close();return}if(i.epoch!==n.epoch){e.onInvalidate(),r.close();return}i.serverSequence>n.sequence&&(n={epoch:i.epoch,sequence:i.serverSequence},e.onInvalidate()),r.send({type:`ack`,cursor:n});return}let c=bx.safeParse(a);c.success&&c.data.snapshot.resourceId===t.resourceId&&e.onInvalidate(),r.close()},onClose:()=>{e.signal.aborted||(e.onState(`disconnected`),e.onInvalidate())}});return e.signal.addEventListener(`abort`,()=>r.close(),{once:!0}),()=>r.close()},Sx=(e,t)=>{let n=S(),[r,i]=(0,y.useState)(0),[a,o]=(0,y.useState)(`connecting`);return(0,y.useEffect)(()=>{let r=new AbortController,i,a,s=!1,c=!1,l=[`operations`,`humanReviews`,e,`detail`,t],u=()=>{r.signal.aborted||s||a!==void 0||(a=window.setTimeout(()=>{a=void 0,!r.signal.aborted&&c&&(c=!1,s=!0,n.isFetching({queryKey:l})>0&&(c=!0),n.invalidateQueries({queryKey:l},{cancelRefetch:!1}).finally(()=>{s=!1,c&&u()}))},50))};return xx({workspaceId:e,humanReviewTaskId:t,signal:r.signal,onState:o,onInvalidate:()=>{c=!0,u()}}).then(e=>{i=e}).catch(()=>{r.signal.aborted||o(`unavailable`)}),()=>{r.abort(),a!==void 0&&window.clearTimeout(a),i?.()}},[t,r,n,e]),{state:a,reconnect:()=>{o(`connecting`),i(e=>e+1)}}},Cx=({item:e})=>{let[t]=(0,y.useState)(e),[n,r]=(0,y.useState)(``),[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)(null),[u,d]=(0,y.useState)(!1),f=mx(),p=e.task.revision!==t.task.revision||JSON.stringify(e.allowedDecisions)!==JSON.stringify(t.allowedDecisions),m=r=>{if(f.isPending)return;if(c){f.mutate(c);return}if(p)return;let a=lg.safeParse(r===`assign`?{action:r,reason:n}:r===`reassign`?{action:r,assigneeUserId:o,reason:n}:{action:`resolve`,decision:r,reason:n,...i.trim()?{note:i.trim()}:{}});if(d(!a.success),!a.success||!window.confirm(`Сохранить ${r} для HumanReviewTask ${e.task.humanReviewTaskId}, revision ${t.task.revision}? Решение использует только разрешённый текущим owner outcome; повторный provider send не выполняется.`))return;let s={workspaceId:e.task.workspaceId,humanReviewTaskId:e.task.humanReviewTaskId,revision:t.task.revision,key:crypto.randomUUID(),command:a.data};l(s),f.mutate(s)},h=!n.trim()||f.isPending||p;return(0,b.jsxs)(`section`,{"aria-label":`Команда HumanReview`,children:[(0,b.jsx)(`h2`,{children:`Назначение и решение HumanReview`}),p?(0,b.jsx)(`p`,{role:`alert`,children:`Задача изменилась. Сверьте сохранённый owner outcome перед новой командой.`}):null,(0,b.jsxs)(`fieldset`,{disabled:!!c,children:[(0,b.jsx)(`legend`,{children:`Проверенное намерение`}),(0,b.jsxs)(`label`,{children:[`Причина HumanReview команды`,(0,b.jsx)(`textarea`,{"aria-label":`Причина HumanReview команды`,value:n,required:!0,maxLength:500,onChange:e=>{r(e.target.value)}})]}),(0,b.jsxs)(`label`,{children:[`Примечание решения HumanReview`,(0,b.jsx)(`textarea`,{"aria-label":`Примечание решения HumanReview`,value:i,maxLength:2e3,onChange:e=>{a(e.target.value)}})]}),(0,b.jsxs)(`label`,{children:[`Новый назначенный оператор HumanReview`,(0,b.jsx)(`input`,{"aria-label":`Новый назначенный оператор HumanReview`,value:o,onChange:e=>{s(e.target.value)}})]})]}),c?(0,b.jsx)(I,{isDisabled:f.isPending,onPress:()=>{m(`assign`)},children:`Повторить ту же HumanReview команду`}):(0,b.jsxs)(`div`,{className:`actions`,children:[t.task.status===`open`?(0,b.jsx)(I,{isDisabled:h,onPress:()=>{m(`assign`)},children:`Принять HumanReview в работу`}):null,(0,b.jsx)(I,{isDisabled:h||!o.trim(),onPress:()=>{m(`reassign`)},children:`Передать HumanReview оператору`}),(0,b.jsx)(I,{isDisabled:h||!t.allowedDecisions.includes(`allow`),onPress:()=>{m(`allow`)},children:`Принять разрешённый AI outcome`}),(0,b.jsx)(I,{variant:`danger`,isDisabled:h||!t.allowedDecisions.includes(`block`),onPress:()=>{m(`block`)},children:`Заблокировать AI outcome`})]}),(0,b.jsx)(`p`,{children:`Allow применяет разрешённый owner контракт: утверждённый результат, продолжение pipeline или reconciliation. Заблокированный output не становится автоматически публичным.`}),u?(0,b.jsx)(`p`,{role:`alert`,children:`Проверьте причину, примечание и UUID назначенного оператора.`}):null,f.isError?(0,b.jsx)(Q,{error:f.error}):null,f.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Сохраняем HumanReview команду…`}):null,f.isSuccess?(0,b.jsx)(`p`,{role:`status`,children:`HumanReview команда сохранена. Сверьте текущий owner outcome.`}):null]})},wx=({workspaceId:e,humanReviewTaskId:t,search:n})=>{let r=px(e,t,n),i=na(),a=Sx(e,t),[o,s]=(0,y.useState)(0);if(r.isPending)return(0,b.jsx)(`p`,{role:`status`,children:`Загружаем HumanReview task…`});if(r.isError)return(0,b.jsxs)(`section`,{"aria-label":`Ошибка загрузки HumanReview`,children:[(0,b.jsx)(Q,{error:r.error}),(0,b.jsx)(I,{isDisabled:r.isFetching,onPress:()=>{r.refetch()},children:`Повторить загрузку HumanReview`})]});let c=r.data,{task:l,run:u,context:d,history:f}=c,p=async()=>{(await r.refetch()).isSuccess&&s(e=>e+1)};return(0,b.jsxs)(`article`,{children:[(0,b.jsx)(M,{to:`/workspaces/$workspaceId/ai/human-reviews`,params:{workspaceId:e},search:{limit:20},children:`← HumanReview очередь`}),(0,b.jsx)(`h1`,{children:`HumanReviewTask ${l.humanReviewTaskId}`}),(0,b.jsx)(`p`,{role:`status`,children:`HumanReview Gateway: ${a.state}`}),a.state===`disconnected`||a.state===`unavailable`?(0,b.jsx)(I,{onPress:a.reconnect,children:`Повторно авторизовать HumanReview Gateway`}):null,(0,b.jsxs)(`dl`,{children:[(0,b.jsx)(`dt`,{children:`Статус задачи`}),(0,b.jsx)(`dd`,{children:l.status}),(0,b.jsx)(`dt`,{children:`Revision HumanReview`}),(0,b.jsx)(`dd`,{children:l.revision}),(0,b.jsx)(`dt`,{children:`Причина escalate`}),(0,b.jsx)(`dd`,{children:l.reasonCode}),(0,b.jsx)(`dt`,{children:`Назначенный оператор`}),(0,b.jsx)(`dd`,{children:l.assignedToUserId??`Не назначен`}),(0,b.jsx)(`dt`,{children:`Создана`}),(0,b.jsx)(`dd`,{children:new Date(l.createdAt).toLocaleString(`ru`)})]}),(0,b.jsxs)(`section`,{"aria-label":`Разрешённый HumanReview контекст`,children:[(0,b.jsx)(`h2`,{children:`Разрешённый HumanReview контекст`}),(0,b.jsx)(`p`,{children:`Guard role: ${d.guardRole??`Reconciliation / owner review`}`}),d.guardRole===`input_guard`?(0,b.jsx)(`p`,{children:`Разрешение input guard продолжает оставшиеся роли pipeline. Публичный ответ появится только после принятия результата владельцем runtime.`}):null,l.reasonCode.startsWith(`agent_reconciliation_`)?(0,b.jsx)(`p`,{children:`Разрешение review возвращает существующий reconciliation job в обработку. Его фактический результат проверяется отдельно; повторный provider send не выполняется.`}):null,d.guardRole===`input_guard`?(0,b.jsxs)(`section`,{"aria-label":`Подтверждённый исходный ввод HumanReview`,children:[(0,b.jsx)(`h3`,{children:`Подтверждённый исходный ввод`}),d.candidateInputText?(0,b.jsx)(`p`,{children:d.candidateInputText}):(0,b.jsx)(`p`,{children:`Подтверждённый исходный ввод не доступен; разрешение блокируется владельцем.`})]}):null,d.candidatePrimaryText?(0,b.jsx)(`p`,{children:d.candidatePrimaryText}):d.guardRole===`input_guard`?null:(0,b.jsx)(`p`,{children:`Owner не предоставил текст результата для этой задачи.`}),d.truncated?(0,b.jsx)(`p`,{children:`Контекст ограничен owner policy.`}):null]}),(0,b.jsxs)(`section`,{"aria-label":`Сохранённый AI owner outcome`,children:[(0,b.jsx)(`h2`,{children:`Сохранённый AI owner outcome`}),(0,b.jsx)(`p`,{children:`Run ${u.agentRunId}: ${u.status}`}),u.failureCode?(0,b.jsx)(`p`,{children:u.failureCode}):null,(0,b.jsx)(`p`,{children:u.approvedOutputAvailable?`Owner подтвердил доступность утверждённого результата.`:`Утверждённый публичный результат не доступен.`}),l.resolutionCode?(0,b.jsx)(`p`,{children:`Resolution: ${l.resolutionCode}`}):null,l.resolutionNote?(0,b.jsx)(`p`,{children:l.resolutionNote}):null,l.resolvedAt?(0,b.jsx)(`p`,{children:new Date(l.resolvedAt).toLocaleString(`ru`)}):null]}),l.status===`open`||l.status===`assigned`?(0,b.jsx)(Cx,{item:c},`${l.humanReviewTaskId}:${o}`):(0,b.jsx)(`p`,{children:`Задача terminal; новое разрешение не выполняется.`}),(0,b.jsx)(I,{onPress:()=>{p()},children:`Сверить сохранённый HumanReview outcome`}),(0,b.jsxs)(`section`,{"aria-label":`История HumanReview`,children:[(0,b.jsx)(`h2`,{children:`Неизменяемая история HumanReview`}),f.length===0?(0,b.jsx)(`p`,{children:`Сохранённых операторских команд пока нет.`}):(0,b.jsx)(`ol`,{children:f.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsx)(`p`,{children:`${e.action} · revision ${e.taskRevision} · ${e.resultStatus} · ${new Date(e.createdAt).toLocaleString(`ru`)}`}),(0,b.jsx)(`p`,{children:e.reason}),e.resolutionCode?(0,b.jsx)(`p`,{children:e.resolutionCode}):null]},e.commandId))}),c.nextCursor?(0,b.jsx)(I,{onPress:()=>{i({to:`/workspaces/$workspaceId/ai/human-reviews/$humanReviewTaskId`,params:{workspaceId:e,humanReviewTaskId:t},search:{...n,cursor:c.nextCursor}})},children:`Следующая страница истории HumanReview`}):null,n.cursor?(0,b.jsx)(M,{to:`/workspaces/$workspaceId/ai/human-reviews/$humanReviewTaskId`,params:{workspaceId:e,humanReviewTaskId:t},search:{limit:n.limit},children:`Последние изменения HumanReview`}):null]})]})},Tx=(e,t)=>Z(`/api/case-investigations?${new URLSearchParams(Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)]))}`,Bg,{signal:t}),Ex=(e,t)=>Z(`/api/case-investigations/${encodeURIComponent(e)}`,zg,{signal:t}),Dx=e=>Z(`/api/case-investigations`,Ng,{method:`POST`,body:Ag.parse(e.command),headers:{"idempotency-key":e.key}}),Ox=e=>Z(`/api/case-investigations/${encodeURIComponent(e.investigationId)}/${e.action}`,zg,{method:`POST`,body:e.action===`links`?jg.parse(e.command):Mg.parse(e.command),headers:{"if-match":`"${e.revision}"`,"idempotency-key":e.key}}),kx=e=>[`operations`,`case-investigations`,`detail`,e],Ax=e=>ft({queryKey:[`operations`,`case-investigations`,`queue`,e],queryFn:({signal:t})=>Tx(e,t),retry:!1}),jx=e=>ft({queryKey:kx(e),queryFn:({signal:t})=>Ex(e,t),retry:!1}),Mx=()=>{let e=S();return pt({mutationFn:Dx,retry:!1,onSuccess:async()=>{await e.invalidateQueries({queryKey:[`operations`,`case-investigations`,`queue`]})}})},Nx=()=>{let e=S();return pt({mutationFn:Ox,retry:!1,onSuccess:async(t,n)=>{e.setQueryData(kx(n.investigationId),t),await e.invalidateQueries({queryKey:[`operations`,`case-investigations`,`queue`]})}})},Px=()=>{let e=Mx(),t=na(),[n,r]=(0,y.useState)(`cross_workspace_abuse`),[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)(``),[u,d]=(0,y.useState)(`workspace`),[f,p]=(0,y.useState)(null),m=Ag.safeParse({purpose:n,reason:i,caseRef:{workspaceId:u===`support`?null:o,caseId:c}});return(0,b.jsxs)(`section`,{"aria-label":`Создание расследования`,children:[(0,b.jsx)(`h2`,{children:`Создание расследования`}),(0,b.jsx)(`p`,{children:`Цель классифицирует связанные moderation cases. Доступ к каждому case и расследованию проверяется отдельно.`}),(0,b.jsxs)(`label`,{children:[`Цель расследования`,(0,b.jsxs)(`select`,{"aria-label":`Цель расследования`,value:n,disabled:!!f||e.isPending,onChange:e=>{r(e.target.value)},children:[(0,b.jsx)(`option`,{value:`cross_workspace_abuse`,children:`Межкомпанийный abuse`}),(0,b.jsx)(`option`,{value:`legal_case_linkage`,children:`Связанность cases · legal`}),(0,b.jsx)(`option`,{value:`security_case_linkage`,children:`Связанность cases · security`})]})]}),(0,b.jsxs)(`label`,{children:[`Область первого case`,(0,b.jsxs)(`select`,{"aria-label":`Область первого case`,value:u,disabled:!!f||e.isPending,onChange:e=>{d(e.target.value)},children:[(0,b.jsx)(`option`,{value:`workspace`,children:`Case компании`}),(0,b.jsx)(`option`,{value:`support`,children:`Конкретный support case`})]})]}),u===`support`?(0,b.jsx)(`p`,{children:`Будет проверен только выбранный support case с отдельным текущим назначением и закреплённым owner thread.`}):null,u===`workspace`?(0,b.jsxs)(`label`,{children:[`Компания первого case`,(0,b.jsx)(`input`,{"aria-label":`Компания первого case`,value:o,disabled:!!f||e.isPending,onChange:e=>{s(e.target.value)}})]}):null,(0,b.jsxs)(`label`,{children:[`Идентификатор первого case`,(0,b.jsx)(`input`,{"aria-label":`Идентификатор первого case`,value:c,disabled:!!f||e.isPending,onChange:e=>{l(e.target.value)}})]}),(0,b.jsxs)(`label`,{children:[`Причина создания`,(0,b.jsx)(`textarea`,{"aria-label":`Причина создания`,maxLength:1e3,value:i,disabled:!!f||e.isPending,onChange:e=>{a(e.target.value)}})]}),(0,b.jsx)(I,{isDisabled:e.isPending||!f&&!m.success,onPress:()=>{if(e.isPending)return;let n=f??(m.success?{key:crypto.randomUUID(),command:m.data}:null);n&&(f||window.confirm(`Создать расследование с неизменяемой ссылкой на первый разрешённый case?`))&&(p(n),e.mutate(n,{onSuccess:e=>{t({to:`/case-investigations/$investigationId`,params:{investigationId:e.investigationId}})}}))},children:f?`Повторить то же создание расследования`:`Создать расследование`}),e.isError?(0,b.jsx)(Q,{error:e.error}):null]})},Fx=({search:e})=>{let t=Ax(e),n=na(),r=(0,y.useRef)(null),i=t.isSuccess?t.data.items:[],a=Zv({count:i.length,getScrollElement:()=>r.current,estimateSize:()=>180,getItemKey:e=>i[e]?.investigationId??e,overscan:4}),o=e=>{n({to:`/case-investigations`,search:e})};return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(M,{to:`/`,children:`← Назначения`}),(0,b.jsx)(`h1`,{children:`Расследования`}),(0,b.jsxs)(`label`,{children:[`Статус расследования`,(0,b.jsxs)(`select`,{"aria-label":`Статус расследования`,value:e.status??``,onChange:t=>{o({...e,cursor:void 0,status:t.target.value?t.target.value:void 0})},children:[(0,b.jsx)(`option`,{value:``,children:`Все`}),(0,b.jsx)(`option`,{value:`open`,children:`Открыты`}),(0,b.jsx)(`option`,{value:`closed`,children:`Закрыты`})]})]}),(0,b.jsxs)(`label`,{children:[`Фильтр цели`,(0,b.jsxs)(`select`,{"aria-label":`Фильтр цели`,value:e.purpose??``,onChange:t=>{o({...e,cursor:void 0,purpose:t.target.value?t.target.value:void 0})},children:[(0,b.jsx)(`option`,{value:``,children:`Все`}),(0,b.jsx)(`option`,{value:`cross_workspace_abuse`,children:`Межкомпанийный abuse`}),(0,b.jsx)(`option`,{value:`legal_case_linkage`,children:`Связанность cases · legal`}),(0,b.jsx)(`option`,{value:`security_case_linkage`,children:`Связанность cases · security`})]})]}),t.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Загружаем расследования…`}):null,t.isError?(0,b.jsx)(Q,{error:t.error}):null,(0,b.jsx)(I,{isDisabled:t.isFetching,onPress:()=>{t.refetch()},children:`Обновить очередь расследований`}),t.isSuccess&&i.length===0?(0,b.jsx)(`p`,{children:`Назначенных расследований нет.`}):null,(0,b.jsx)(`div`,{ref:r,tabIndex:0,role:`region`,"aria-label":`Назначенные расследования`,style:{height:400,overflow:`auto`},children:(0,b.jsx)(`div`,{style:{height:a.getTotalSize(),position:`relative`},children:a.getVirtualItems().map(e=>{let t=i[e.index];return(0,b.jsxs)(`div`,{"data-index":e.index,ref:a.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,boxSizing:`border-box`,padding:`12px 0`,overflowWrap:`anywhere`,transform:`translateY(${e.start}px)`},children:[(0,b.jsx)(M,{to:`/case-investigations/$investigationId`,params:{investigationId:t.investigationId},children:t.investigationId}),(0,b.jsx)(`p`,{children:`${t.purpose} · ${t.status} · revision ${t.revision}`}),(0,b.jsx)(`p`,{children:t.reason}),(0,b.jsx)(`p`,{children:`Ссылок: ${t.linkCount} · Investigator: ${t.assignedInvestigatorUserId}`})]},e.key)})})}),t.isSuccess&&t.data.nextCursor?(0,b.jsx)(I,{onPress:()=>{o({...e,cursor:t.data.nextCursor})},children:`Следующая страница`}):null,(0,b.jsx)(Px,{})]})},Ix=({investigationId:e})=>{let t=jx(e),n=Nx(),[r,i]=(0,y.useState)(``),[a,o]=(0,y.useState)(``),[s,c]=(0,y.useState)(``),[l,u]=(0,y.useState)(``),[d,f]=(0,y.useState)(`workspace`),[p,m]=(0,y.useState)(null),[h,g]=(0,y.useState)(!1),_=n.isPending||h,v=async()=>{if(!_){g(!0);try{(await t.refetch()).isSuccess&&(m(null),n.reset())}finally{g(!1)}}};if(t.isPending)return(0,b.jsx)(`p`,{role:`status`,children:`Загружаем расследование…`});if(t.isError)return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h1`,{children:`Расследование`}),(0,b.jsx)(Q,{error:t.error}),(0,b.jsx)(I,{isDisabled:_,onPress:()=>{v()},children:`Сверить сохранённое расследование`})]});let x=t.data,S=jg.safeParse({caseRef:{workspaceId:d===`support`?null:r,caseId:a},reason:s}),C=Mg.safeParse({reason:l});return(0,b.jsxs)(`article`,{style:{overflowWrap:`anywhere`},children:[(0,b.jsx)(M,{to:`/case-investigations`,search:{limit:20},children:`← Расследования`}),(0,b.jsx)(`h1`,{children:`Расследование`}),(0,b.jsx)(`p`,{children:x.investigationId}),(0,b.jsx)(`p`,{children:`${x.purpose} · ${x.status} · revision ${x.revision}`}),(0,b.jsx)(`p`,{children:x.reason}),(0,b.jsx)(`p`,{children:`Investigator: ${x.assignedInvestigatorUserId} · Открыто: ${x.openedAt}`}),x.closedAt?(0,b.jsx)(`p`,{children:`Закрыто: ${x.closedAt}`}):null,(0,b.jsx)(`p`,{children:`Связи сохраняют owner references и исходные ревизии. Доступ и команды каждого case проверяются отдельно; закрытие расследования сохраняет metadata.`}),h?(0,b.jsx)(`p`,{role:`status`,children:`Сверяем сохранённое расследование…`}):null,(0,b.jsxs)(`section`,{"aria-label":`Связанные cases`,children:[(0,b.jsx)(`h2`,{children:`Связанные cases`}),x.links.map(e=>(0,b.jsxs)(`section`,{"data-case-id":e.caseId,children:[(0,b.jsx)(`h3`,{children:e.caseId}),(0,b.jsx)(`p`,{children:e.workspaceId===null?`Область: конкретный support case`:`Компания: ${e.workspaceId}`}),(0,b.jsx)(`p`,{children:`Captured case revision: ${e.capturedCaseRevision}; audit: ${e.capturedDecisionAuditId??`нет решения`}`}),(0,b.jsx)(`p`,{children:`Captured bounded context fingerprint: ${e.capturedContextFingerprint}`}),(0,b.jsx)(`p`,{children:`${e.reason} · ${e.linkedByUserId} · ${e.linkedAt}`}),e.caseChanged?(0,b.jsx)(`p`,{children:`Ревизия case или audit решения изменились. Исходная ссылка сохранена.`}):null,e.contextChanged?(0,b.jsx)(`p`,{children:`Разрешённый фрагмент контекста изменился после связывания. Исходный fingerprint сохранён.`}):null,(0,b.jsx)(`h4`,{children:e.current.context.title}),(0,b.jsx)(`p`,{children:e.current.context.text}),(0,b.jsx)(`p`,{children:`${e.current.targetKind} · ${e.current.targetId} · ${e.current.status}`}),(0,b.jsx)(`p`,{children:`Платформа: ${e.current.context.platformModerationStatus}; компания: ${e.current.context.tenantModerationStatus}; итог: ${e.current.context.moderationStatus}`}),e.workspaceId===null?(0,b.jsx)(M,{to:`/support-moderation-cases/$caseId`,params:{caseId:e.caseId},children:`Открыть отдельно разрешённый support case`}):(0,b.jsx)(M,{to:`/workspaces/$workspaceId/moderation-cases/$caseId`,params:{workspaceId:e.workspaceId,caseId:e.caseId},children:`Открыть отдельно разрешённый case`})]},e.linkId))]}),x.status===`open`&&!p?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`section`,{"aria-label":`Связывание case`,children:[(0,b.jsx)(`h2`,{children:`Связать case`}),(0,b.jsxs)(`label`,{children:[`Область case`,(0,b.jsxs)(`select`,{"aria-label":`Область case`,value:d,disabled:_,onChange:e=>{f(e.target.value)},children:[(0,b.jsx)(`option`,{value:`workspace`,children:`Case компании`}),(0,b.jsx)(`option`,{value:`support`,children:`Конкретный support case`})]})]}),d===`support`?(0,b.jsx)(`p`,{children:`Scope choice не заменяет отдельное назначение на конкретный support case.`}):null,d===`workspace`?(0,b.jsxs)(`label`,{children:[`Компания case`,(0,b.jsx)(`input`,{"aria-label":`Компания case`,value:r,disabled:_,onChange:e=>{i(e.target.value)}})]}):null,(0,b.jsxs)(`label`,{children:[`Идентификатор case`,(0,b.jsx)(`input`,{"aria-label":`Идентификатор case`,value:a,disabled:_,onChange:e=>{o(e.target.value)}})]}),(0,b.jsxs)(`label`,{children:[`Причина связывания`,(0,b.jsx)(`textarea`,{"aria-label":`Причина связывания`,value:s,maxLength:1e3,disabled:_,onChange:e=>{c(e.target.value)}})]}),(0,b.jsx)(I,{isDisabled:_||!S.success||x.linkCount>=10,onPress:()=>{if(_||p||x.status!==`open`||!S.success||x.linkCount>=10||!window.confirm(`Сохранить неизменяемую ссылку на отдельно разрешённый case?`))return;let t={investigationId:e,revision:x.revision,key:crypto.randomUUID(),action:`links`,command:S.data};m(t),n.mutate(t)},children:`Связать case`})]}),(0,b.jsxs)(`section`,{"aria-label":`Закрытие расследования`,children:[(0,b.jsxs)(`label`,{children:[`Причина закрытия`,(0,b.jsx)(`textarea`,{"aria-label":`Причина закрытия`,value:l,maxLength:1e3,disabled:_,onChange:e=>{u(e.target.value)}})]}),(0,b.jsx)(I,{isDisabled:_||!C.success,onPress:()=>{if(_||p||x.status!==`open`||!C.success||!window.confirm(`Закрыть metadata расследования? Решения по связанным cases выполняются отдельно.`))return;let t={investigationId:e,revision:x.revision,key:crypto.randomUUID(),action:`close`,command:C.data};m(t),n.mutate(t)},children:`Закрыть расследование`})]})]}):null,p?(0,b.jsx)(I,{isDisabled:_,onPress:()=>{_||n.mutate(p)},children:`Повторить ту же команду расследования`}):null,n.isError?(0,b.jsx)(Q,{error:n.error}):null,n.isSuccess?(0,b.jsx)(`p`,{role:`status`,children:`Команда расследования сохранена владельцем.`}):null,(0,b.jsx)(I,{isDisabled:_,onPress:()=>{v()},children:`Сверить сохранённое расследование`}),(0,b.jsxs)(`section`,{"aria-label":`История расследования`,children:[(0,b.jsx)(`h2`,{children:`Неизменяемая история расследования`}),(0,b.jsx)(`ol`,{children:x.history.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsx)(`p`,{children:`${e.revision} · ${e.action} · ${e.reason} · ${e.userId} · ${e.occurredAt}`})},e.auditId))})]})]})},Lx=e=>e===`models`?`/api/ai/provider-models`:`/api/ai/execution-profiles`,Rx=async(e,t,n)=>{let r=new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)]));return e===`models`?Z(Lx(e)+`?`+r,c_,{signal:n}):Z(Lx(e)+`?`+r,l_,{signal:n})},zx=async(e,t,n)=>e===`models`?Z(Lx(e)+`/`+encodeURIComponent(t),o_,{signal:n}):Z(Lx(e)+`/`+encodeURIComponent(t),s_,{signal:n}),Bx=async(e,t,n,r)=>e===`models`?Z(Lx(e)+`/`+encodeURIComponent(t)+`/versions/`+encodeURIComponent(n),d_,{signal:r}):Z(Lx(e)+`/`+encodeURIComponent(t)+`/versions/`+encodeURIComponent(n),f_,{signal:r}),Vx=async e=>{let t={method:`POST`,body:e_.parse(e.command),headers:{"if-match":`"${e.revision}"`,"idempotency-key":e.key}};return e.kind===`models`?Z(Lx(e.kind)+`/`+encodeURIComponent(e.resourceId)+`/revoke`,o_,t):Z(Lx(e.kind)+`/`+encodeURIComponent(e.resourceId)+`/revoke`,s_,t)},Hx=(e,t)=>[`operations`,`ai-registry`,e,`detail`,t],Ux=(e,t)=>ft({queryKey:[`operations`,`ai-registry`,e,`list`,t],queryFn:({signal:n})=>Rx(e,t,n),retry:!1}),Wx=(e,t)=>ft({queryKey:Hx(e,t),queryFn:({signal:n})=>zx(e,t,n),retry:!1}),Gx=(e,t,n)=>ft({queryKey:[`operations`,`ai-registry`,e,`version`,t,n],queryFn:({signal:r})=>Bx(e,t,n,r),retry:!1}),Kx=()=>{let e=S();return pt({mutationFn:Vx,retry:!1,onSuccess:async(t,n)=>{e.setQueryData(Hx(n.kind,n.resourceId),t),await e.invalidateQueries({queryKey:[`operations`,`ai-registry`,n.kind,`list`]})}})},qx=({kind:e,search:t})=>{let n=Ux(e,t),r=na(),i=(0,y.useRef)(null),a=n.isSuccess?n.data.items:[],o=Zv({count:a.length,getScrollElement:()=>i.current,estimateSize:()=>180,overscan:4}),s=t=>{r({to:e===`models`?`/ai/provider-models`:`/ai/execution-profiles`,search:t})};return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(M,{to:`/`,children:`← Назначения`}),(0,b.jsx)(`h1`,{children:e===`models`?`AI модели`:`Execution profiles`}),(0,b.jsxs)(`label`,{children:[`Статус AI ресурса`,(0,b.jsxs)(`select`,{"aria-label":`Статус AI ресурса`,value:t.status??``,onChange:e=>{s({...t,cursor:void 0,status:e.target.value?e.target.value:void 0})},children:[(0,b.jsx)(`option`,{value:``,children:`Все`}),(0,b.jsx)(`option`,{value:`draft`,children:`draft`}),(0,b.jsx)(`option`,{value:`active`,children:`active`}),(0,b.jsx)(`option`,{value:`revoked`,children:`revoked`})]})]}),n.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Загружаем назначенные AI ресурсы…`}):null,n.isError?(0,b.jsx)(Q,{error:n.error}):null,(0,b.jsx)(I,{isDisabled:n.isFetching,onPress:()=>{n.refetch()},children:`Обновить AI реестр`}),n.isSuccess&&a.length===0?(0,b.jsx)(`p`,{children:`Разрешённых ресурсов нет.`}):null,(0,b.jsx)(`div`,{ref:i,tabIndex:0,role:`region`,"aria-label":`Назначенные AI ресурсы`,style:{height:400,overflow:`auto`},children:(0,b.jsx)(`div`,{style:{height:o.getTotalSize(),position:`relative`},children:o.getVirtualItems().map(e=>{let t=a[e.index],n=`modelId`in t,r=n?t.approvedProviderModelId:t.approvedExecutionProfileId;return(0,b.jsxs)(`div`,{"data-index":e.index,ref:o.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,boxSizing:`border-box`,padding:`12px 0`,overflowWrap:`anywhere`,transform:`translateY(${e.start}px)`},children:[n?(0,b.jsx)(M,{to:`/ai/provider-models/$resourceId`,params:{resourceId:r},children:`${t.providerKey} / ${t.modelId}`}):(0,b.jsx)(M,{to:`/ai/execution-profiles/$resourceId`,params:{resourceId:r},children:t.profileKey}),(0,b.jsx)(`p`,{children:r}),(0,b.jsx)(`p`,{children:`Статус: ${t.status} · revision ${t.lifecycleRevision}`})]},r)})})}),n.isSuccess&&n.data.nextCursor?(0,b.jsx)(I,{onPress:()=>{s({...t,cursor:n.data.nextCursor})},children:`Следующая страница`}):null]})},Jx=({kind:e,resourceId:t})=>{let n=Wx(e,t),r=Kx(),[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(null),[c,l]=(0,y.useState)(!1),u=r.isPending||c,d=async()=>{if(!u){l(!0);try{(await n.refetch()).isSuccess&&(s(null),r.reset())}finally{l(!1)}}};if(n.isPending)return(0,b.jsx)(`p`,{role:`status`,children:`Загружаем AI ресурс…`});if(n.isError)return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h1`,{children:e===`models`?`AI модель`:`Execution profile`}),(0,b.jsx)(Q,{error:n.error}),(0,b.jsx)(I,{isDisabled:u,onPress:()=>{d()},children:`Сверить сохранённый AI ресурс`})]});let f=n.data,p=f.resource,m=e_.safeParse({reason:i});return(0,b.jsxs)(`article`,{style:{overflowWrap:`anywhere`},children:[(0,b.jsx)(M,{to:e===`models`?`/ai/provider-models`:`/ai/execution-profiles`,search:{limit:20},children:`← AI реестр`}),(0,b.jsx)(`h1`,{children:e===`models`?`AI модель`:`Execution profile`}),(0,b.jsx)(`p`,{children:t}),(0,b.jsx)(`h2`,{children:`modelId`in p?`${p.providerKey} / ${p.modelId}`:p.profileKey}),(0,b.jsx)(`p`,{children:`Статус: ${p.status} · revision ${p.lifecycleRevision}`}),(0,b.jsx)(`p`,{children:`Активная версия: ${p.activeVersionId??`нет`}`}),(0,b.jsx)(`p`,{children:`Создан: ${p.createdAt} · Обновлён: ${p.updatedAt}`}),`profileKey`in p?(0,b.jsx)(`p`,{children:`Owner модель: ${p.approvedProviderModelId}`}):null,c?(0,b.jsx)(`p`,{role:`status`,children:`Сверяем сохранённый AI ресурс…`}):null,p.status===`revoked`?(0,b.jsx)(`p`,{children:`Отзыв terminal: owner policy запрещает восстановление этого ресурса.`}):null,(0,b.jsxs)(`section`,{"aria-label":`Неизменяемые версии AI ресурса`,children:[(0,b.jsx)(`h2`,{children:`Неизменяемые версии`}),(0,b.jsx)(`p`,{children:`Чтение полной версии требует отдельного точного назначения.`}),(0,b.jsx)(`ul`,{children:f.versions.map(n=>(0,b.jsxs)(`li`,{children:[(0,b.jsx)(M,{to:e===`models`?`/ai/provider-models/$resourceId/versions/$versionId`:`/ai/execution-profiles/$resourceId/versions/$versionId`,params:{resourceId:t,versionId:n.versionId},children:`Версия ${n.version} · ${n.versionId}`}),(0,b.jsx)(`p`,{children:`${n.checksum} · ${n.createdAt}`})]},n.versionId))})]}),(0,b.jsxs)(`label`,{children:[`Причина отзыва AI ресурса`,(0,b.jsx)(`textarea`,{"aria-label":`Причина отзыва AI ресурса`,maxLength:1e3,value:i,disabled:u||!!o||!f.capabilities.canRevoke,onChange:e=>{a(e.target.value)}})]}),o?(0,b.jsx)(I,{isDisabled:u,onPress:()=>{u||r.mutate(o)},children:`Повторить тот же отзыв`}):(0,b.jsx)(I,{isDisabled:u||!m.success||!f.capabilities.canRevoke||p.status===`revoked`,onPress:()=>{if(u||!m.success||!f.capabilities.canRevoke||p.status===`revoked`||!window.confirm(`Отозвать AI ресурс? Immutable версии и published lineage сохранятся.`))return;let n={kind:e,resourceId:t,revision:p.lifecycleRevision,key:crypto.randomUUID(),command:m.data};s(n),r.mutate(n)},children:e===`models`?`Отозвать модель`:`Отозвать profile`}),f.capabilities.canRevoke?null:(0,b.jsx)(`p`,{children:`Для отзыва требуется отдельное текущее назначение и квалификация workforce.`}),r.isError?(0,b.jsx)(Q,{error:r.error}):null,r.isSuccess?(0,b.jsx)(`p`,{role:`status`,children:`Отзыв сохранён владельцем.`}):null,(0,b.jsx)(I,{isDisabled:u,onPress:()=>{d()},children:`Сверить сохранённый AI ресурс`}),(0,b.jsxs)(`section`,{"aria-label":`История отзывов AI ресурса`,children:[(0,b.jsx)(`h2`,{children:`Неизменяемая история`}),(0,b.jsx)(`ol`,{children:f.history.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsx)(`p`,{children:`${e.actorUserId} · ${e.reason} · ${e.expectedRevision} → ${e.resultRevision} · ${e.occurredAt}`})},e.commandId))})]})]})},Yx=({kind:e,resourceId:t,versionId:n})=>{let r=Gx(e,t,n);if(r.isPending)return(0,b.jsx)(`p`,{role:`status`,children:`Загружаем неизменяемую версию…`});if(r.isError)return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(Q,{error:r.error}),(0,b.jsx)(I,{isDisabled:r.isFetching,onPress:()=>{r.refetch()},children:`Повторить чтение версии`})]});let i=r.data;return(0,b.jsxs)(`article`,{style:{overflowWrap:`anywhere`},children:[(0,b.jsx)(M,{to:e===`models`?`/ai/provider-models/$resourceId`:`/ai/execution-profiles/$resourceId`,params:{resourceId:t},children:`← AI ресурс`}),(0,b.jsx)(`h1`,{children:e===`models`?`Неизменяемая версия модели`:`Неизменяемая версия profile`}),(0,b.jsx)(`p`,{children:n}),(0,b.jsx)(`p`,{children:`Версия: ${i.version} · checksum ${i.checksum}`}),(0,b.jsx)(`p`,{children:`Evidence: ${i.qualificationEvidenceId} · ${i.evidenceRevision} · ${i.evidenceChecksum}`}),(0,b.jsx)(`p`,{children:`Записанный источник evidence: ${i.evidenceSource} · ${i.qualifiedAt}`}),`supportedCapabilities`in i?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{children:`Capabilities: ${i.supportedCapabilities.join(`, `)}`}),(0,b.jsx)(`p`,{children:`Bounds: context ${i.contextWindowTokens} · output ${i.maximumOutputTokens}`})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{children:i.profileVersionKey}),(0,b.jsx)(`p`,{children:`${i.modelClass} · ${i.protocol} · ${i.reasoningEffort} · output ${i.maximumOutputTokens}`}),(0,b.jsx)(`p`,{children:`Модель: ${i.approvedProviderModelId} · версия ${i.approvedProviderModelVersionId}`}),(0,b.jsx)(`p`,{children:`Capabilities: ${i.effectiveCapabilities.join(`, `)}`}),(0,b.jsx)(`p`,{children:`Immutable settings: store ${String(i.executionSettings.store)} · tools ${i.executionSettings.toolChoice} · parallel ${String(i.executionSettings.parallelToolCalls)} · text ${String(i.executionSettings.textOnly)} · ${i.executionSettings.responseMode}`})]}),(0,b.jsx)(`p`,{children:`Создана: ${i.createdAt}`})]})},Xx=e=>Z(`/api/queues`,J_,{signal:e}),Zx=(e,t,n)=>{let r=new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)]));return Z(`/api/workspaces/${encodeURIComponent(e)}/content-requests?${r}`,U_,{signal:n})},Qx=(e,t,n)=>Z(`/api/workspaces/${encodeURIComponent(e)}/content-requests/${encodeURIComponent(t)}`,H_,{signal:n}),$x=e=>Z(`/api/workspaces/${encodeURIComponent(e.workspaceId)}/content-requests/${encodeURIComponent(e.requestId)}/decisions`,G_,{method:`POST`,body:W_.parse({action:e.action,reason:e.reason}),headers:{"idempotency-key":e.key,"if-match":`"${e.revision}"`}}),eS=e=>ft({queryKey:[`operations`,`queues`],queryFn:({signal:e})=>Xx(e),enabled:e,retry:!1}),tS=(e,t)=>ft({queryKey:[`operations`,`content`,e,t],queryFn:({signal:n})=>Zx(e,t,n),retry:!1}),nS=(e,t)=>ft({queryKey:[`operations`,`content`,e,`request`,t],queryFn:({signal:n})=>Qx(e,t,n),retry:!1}),rS=()=>{let e=S();return pt({mutationFn:$x,retry:!1,onSuccess:async()=>{await e.invalidateQueries({queryKey:[`operations`,`content`]})}})},iS=({workspaceId:e,requestId:t,revision:n})=>{let[r,i]=(0,y.useState)(``),[a,o]=(0,y.useState)(null),s=rS(),c=i=>{if(!r.trim()||s.isPending)return;let c=a&&a.workspaceId===e&&a.requestId===t&&a.action===i&&a.reason===r.trim(),l=c?a:{workspaceId:e,requestId:t,action:i,reason:r.trim(),revision:n,key:crypto.randomUUID()};l&&(c||window.confirm(i===`approve`?`Одобрить заявку и выдать компании grant на этот контент?`:`Отклонить заявку? Компания увидит указанную причину.`))&&(o(l),s.mutate(l))};return(0,b.jsxs)(`section`,{"aria-label":`Решение по заявке`,children:[(0,b.jsxs)(`label`,{children:[`Причина решения`,(0,b.jsx)(`textarea`,{required:!0,maxLength:2e3,value:r,onChange:e=>i(e.target.value)})]}),(0,b.jsx)(`p`,{children:`Причина и результат будут видны компании. Approve выдаёт grant; reject сохраняет отказ.`}),(0,b.jsxs)(`div`,{className:`actions`,children:[(0,b.jsx)(I,{isDisabled:!r.trim()||s.isPending,onPress:()=>c(`approve`),children:`Одобрить`}),(0,b.jsx)(I,{variant:`danger`,isDisabled:!r.trim()||s.isPending,onPress:()=>c(`reject`),children:`Отклонить`})]}),s.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Сохраняем решение…`}):null,s.isError?(0,b.jsx)(Q,{error:s.error}):null,s.isSuccess?(0,b.jsxs)(`p`,{role:`status`,children:[`Решение сохранено ·`,s.data.status,` `,`·`,s.data.commandId]}):null]})},aS=({workspaceId:e,requestId:t})=>{let n=nS(e,t);if(n.isPending)return(0,b.jsx)(`p`,{role:`status`,children:`Загружаем карточку…`});if(n.isError)return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(Q,{error:n.error}),(0,b.jsx)(I,{onPress:()=>{n.refetch()},children:`Загрузить актуальную карточку`})]});let r=n.data;return(0,b.jsxs)(`article`,{children:[(0,b.jsx)(M,{to:`/workspaces/$workspaceId/content-requests`,params:{workspaceId:e},search:{limit:20},children:`← Очередь`}),(0,b.jsx)(`h1`,{children:r.offer.title}),(0,b.jsx)(`p`,{children:r.offer.description}),(0,b.jsxs)(`dl`,{children:[(0,b.jsx)(`dt`,{children:`Статус`}),(0,b.jsx)(`dd`,{children:r.status}),(0,b.jsx)(`dt`,{children:`Заявка`}),(0,b.jsxs)(`dd`,{children:[r.requestId,` `,`· revision`,` `,r.revision]}),(0,b.jsx)(`dt`,{children:`Компания`}),(0,b.jsx)(`dd`,{children:r.workspaceId}),(0,b.jsx)(`dt`,{children:`Причина компании`}),(0,b.jsx)(`dd`,{children:r.reason}),(0,b.jsx)(`dt`,{children:`Создана`}),(0,b.jsx)(`dd`,{children:new Date(r.createdAt).toLocaleString(`ru`)})]}),r.decision?(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h2`,{children:`Сохранённый результат`}),(0,b.jsx)(`p`,{children:r.decision.reason}),(0,b.jsx)(`p`,{children:new Date(r.decision.occurredAt).toLocaleString(`ru`)}),(0,b.jsxs)(`p`,{children:[`Grant:`,r.grant?`${r.grant.grantId} · ${r.grant.status}`:`не выдан`]}),r.grant?(0,b.jsx)(M,{to:`/workspaces/$workspaceId/content-grants/$grantId`,params:{workspaceId:e,grantId:r.grant.grantId},search:{limit:50},children:`Карточка и история grant`}):null]}):null,r.status===`submitted`||r.status===`reviewing`?(0,b.jsx)(iS,{workspaceId:e,requestId:t,revision:r.revision},`${e}:${t}`):null,(0,b.jsx)(I,{variant:`quiet`,onPress:()=>{n.refetch()},children:`Обновить карточку`})]})},oS=({workspaceId:e,search:t})=>{let n=tS(e,t),r=na(),i=(0,y.useRef)(null),a=Zv({count:n.data?.items.length??0,getScrollElement:()=>i.current,estimateSize:()=>100,overscan:4});return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h1`,{children:`Заявки на контент`}),(0,b.jsx)(M,{to:`/workspaces/$workspaceId/content-grants`,params:{workspaceId:e},search:{limit:20},children:`Существующие grants и история изменений`}),(0,b.jsxs)(`p`,{children:[`Компания:`,e]}),(0,b.jsxs)(`label`,{children:[`Статус`,(0,b.jsxs)(`select`,{value:t.status??``,onChange:n=>{r({to:`/workspaces/$workspaceId/content-requests`,params:{workspaceId:e},search:{limit:t.limit,status:n.target.value?n.target.value:void 0}})},children:[(0,b.jsx)(`option`,{value:``,children:`Все`}),[`submitted`,`reviewing`,`approved`,`rejected`,`cancelled`].map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))]})]}),n.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Загружаем очередь…`}):null,n.isError?(0,b.jsx)(Q,{error:n.error}):null,n.data&&n.data.items.length===0?(0,b.jsx)(`p`,{children:`Заявок с такими фильтрами нет.`}):null,(0,b.jsx)(`div`,{ref:i,className:`queue-scroll`,tabIndex:0,"aria-label":`Очередь заявок`,children:(0,b.jsx)(`div`,{style:{height:a.getTotalSize(),position:`relative`},children:a.getVirtualItems().map(t=>{let r=n.data.items[t.index];return(0,b.jsxs)(`div`,{className:`queue-row`,style:{position:`absolute`,top:0,left:0,width:`100%`,height:t.size,transform:`translateY(${t.start}px)`},children:[(0,b.jsx)(M,{to:`/workspaces/$workspaceId/content-requests/$requestId`,params:{workspaceId:e,requestId:r.requestId},children:r.offer.title}),(0,b.jsxs)(`p`,{children:[r.status,` `,`·`,` `,new Date(r.createdAt).toLocaleString(`ru`)]})]},r.requestId)})})}),n.data?.nextCursor?(0,b.jsx)(I,{onPress:()=>{r({to:`/workspaces/$workspaceId/content-requests`,params:{workspaceId:e},search:{...t,cursor:n.data.nextCursor}})},children:`Следующая страница`}):null,t.cursor?(0,b.jsx)(M,{to:`/workspaces/$workspaceId/content-requests`,params:{workspaceId:e},search:{status:t.status,limit:t.limit},children:`В начало`}):null]})},sS=({enabled:e})=>{let t=eS(e);return e?t.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Загружаем назначения…`}):t.isError?(0,b.jsx)(Q,{error:t.error}):(0,b.jsxs)(`section`,{children:[(0,b.jsx)(`h1`,{children:`Назначенные очереди`}),(0,b.jsx)(M,{to:`/reports`,search:{workspaceIds:``},children:`Отчёты по назначенным компаниям`}),t.data.items.length?(0,b.jsx)(`ul`,{children:t.data.items.map(e=>(0,b.jsxs)(`li`,{children:[e.kind===`media_source_cleanups`&&e.resourceId?(0,b.jsx)(M,{to:`/media-assets/$assetId/source-cleanup`,params:{assetId:e.resourceId},children:`Очистка временного источника · ${e.resourceId}`}):null,e.kind===`assignment_recoveries`&&e.workspaceId?e.resourceId&&e.deliveryId&&e.ruleId?(0,b.jsx)(M,{to:`/workspaces/$workspaceId/deliveries/$deliveryId/assignment-rules/$ruleId/jobs/$jobId/recovery`,params:{workspaceId:e.workspaceId,deliveryId:e.deliveryId,ruleId:e.ruleId,jobId:e.resourceId},children:`Восстановление назначения · ${e.resourceId}`}):(0,b.jsx)(M,{to:`/workspaces/$workspaceId/assignment-recoveries`,params:{workspaceId:e.workspaceId},search:{limit:20},children:`Восстановление назначений · ${e.workspaceId}`}):null,e.kind===`ai_provider_models`?e.resourceId?(0,b.jsx)(M,{to:`/ai/provider-models/$resourceId`,params:{resourceId:e.resourceId},children:`AI модель · ${e.resourceId}`}):(0,b.jsx)(M,{to:`/ai/provider-models`,search:{limit:20},children:`AI модели · назначенный реестр`}):null,e.kind===`ai_execution_profiles`?e.resourceId?(0,b.jsx)(M,{to:`/ai/execution-profiles/$resourceId`,params:{resourceId:e.resourceId},children:`Execution profile · ${e.resourceId}`}):(0,b.jsx)(M,{to:`/ai/execution-profiles`,search:{limit:20},children:`Execution profiles · назначенный реестр`}):null,e.kind===`independent_appeals`&&e.resourceId&&e.disputedDecisionId?e.workspaceId===null?(0,b.jsx)(M,{to:`/support-moderation-cases/$caseId/appeals/$disputedDecisionId`,params:{caseId:e.resourceId,disputedDecisionId:e.disputedDecisionId},children:`Независимый appeal · ${e.disputedDecisionId}`}):(0,b.jsx)(M,{to:`/workspaces/$workspaceId/moderation-cases/$caseId/appeals/$disputedDecisionId`,params:{workspaceId:e.workspaceId,caseId:e.resourceId,disputedDecisionId:e.disputedDecisionId},children:`Независимый appeal · ${e.disputedDecisionId}`}):null,e.kind===`case_investigations`?(0,b.jsx)(M,{to:`/case-investigations`,search:{limit:20},children:`Расследования · назначенные cases`}):null,e.workspaceId!==null&&e.kind===`removed_reviews`&&e.resourceId?(0,b.jsx)(M,{to:`/workspaces/$workspaceId/moderation-cases/$caseId/removed-review`,params:{workspaceId:e.workspaceId,caseId:e.resourceId},children:`Owner review · ${e.resourceId}`}):null,e.kind===`support_moderation_cases`?(0,b.jsx)(M,{to:`/support-moderation-cases`,search:{limit:20},children:`Support · назначенные cases`}):null,e.workspaceId!==null&&e.kind===`content_requests`?(0,b.jsx)(M,{to:`/workspaces/$workspaceId/content-requests`,params:{workspaceId:e.workspaceId},search:{status:`submitted`,limit:20},children:`Контент · ${e.workspaceId}`}):null,e.workspaceId!==null&&e.kind===`content_grants`?(0,b.jsx)(M,{to:`/workspaces/$workspaceId/content-grants`,params:{workspaceId:e.workspaceId},search:{limit:20},children:`Grants · ${e.workspaceId}`}):null,e.workspaceId!==null&&e.kind===`ai_human_reviews`?(0,b.jsx)(M,{to:`/workspaces/$workspaceId/ai/human-reviews`,params:{workspaceId:e.workspaceId},search:{limit:20},children:`AI HumanReview · ${e.workspaceId}`}):null,e.workspaceId!==null&&e.kind===`governance_requests`?(0,b.jsx)(M,{to:`/workspaces/$workspaceId/governance-requests`,params:{workspaceId:e.workspaceId},search:{status:`pending`,limit:20},children:`Governance · ${e.workspaceId}`}):null,e.workspaceId!==null&&e.kind===`moderation_cases`?(0,b.jsx)(M,{to:`/workspaces/$workspaceId/moderation-cases`,params:{workspaceId:e.workspaceId},search:{limit:20},children:`Модерация · ${e.workspaceId}`}):null,e.workspaceId!==null&&e.kind===`incidents`?(0,b.jsx)(M,{to:`/workspaces/$workspaceId/incidents`,params:{workspaceId:e.workspaceId},search:{limit:20},children:`Инциденты · ${e.workspaceId}`}):null]},`${e.kind}:${e.workspaceId}:${e.resourceId??``}:${e.disputedDecisionId??``}`))}):(0,b.jsx)(`p`,{children:`Текущих назначений нет.`})]}):(0,b.jsx)(`p`,{children:`Укажите причину доступа для открытия назначенных очередей.`})},cS=(e,t,n)=>{let r=av.parse(t),i=new URLSearchParams(Object.entries(r).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)]));return Z(`/api/workspaces/${encodeURIComponent(e)}/content-grants?${i}`,sv,{signal:n})},lS=(e,t,n,r,i)=>{let a=av.omit({search:!0}).parse({limit:n,cursor:r}),o=new URLSearchParams({limit:String(a.limit),...a.cursor?{cursor:a.cursor}:{}});return Z(`/api/workspaces/${encodeURIComponent(e)}/content-grants/${encodeURIComponent(t)}?${o}`,cv,{signal:i})},uS=e=>Z(`/api/workspaces/${encodeURIComponent(e.workspaceId)}/content-grants/${encodeURIComponent(e.grantId)}`,ov,{method:`PATCH`,body:uv.parse(e.command),headers:{"idempotency-key":e.key,"if-match":`"${e.revision}"`}}),dS=e=>Z(`/api/workspaces/${encodeURIComponent(e.workspaceId)}/content-grants`,ov,{method:`POST`,body:lv.parse(e.command),headers:{"idempotency-key":e.key}}),fS=(e,t)=>ft({queryKey:[`operations`,`grants`,e,`list`,t],queryFn:({signal:n})=>cS(e,t,n),retry:!1}),pS=(e,t,n,r)=>ft({queryKey:[`operations`,`grants`,e,`detail`,t,{limit:n,cursor:r}],queryFn:({signal:i})=>lS(e,t,n,r,i),retry:!1}),mS=()=>{let e=S();return pt({mutationFn:uS,retry:!1,onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:[`operations`,`grants`]}),e.invalidateQueries({queryKey:[`operations`,`content`]})])}})},hS=()=>{let e=S();return pt({mutationFn:dS,retry:!1,onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:[`operations`,`grants`]}),e.invalidateQueries({queryKey:[`operations`,`content`]})])}})},gS=({workspaceId:e})=>{let[t,n]=(0,y.useState)(`training_simulator`),[r,i]=(0,y.useState)(``),[a,o]=(0,y.useState)(``),[s,c]=(0,y.useState)(null),l=hS(),u=lv.safeParse({entityType:t,entityId:r.trim(),availableUntil:a.trim()||null});return(0,b.jsxs)(`section`,{"aria-label":`Выдать материал компании`,children:[(0,b.jsx)(`h2`,{children:`Выдать опубликованный материал`}),(0,b.jsx)(`p`,{children:`Для выдачи нужен подтверждённый Operations-доступ с причиной. Core проверит полномочия и опубликованную версию.`}),(0,b.jsxs)(`fieldset`,{disabled:!!s,children:[(0,b.jsx)(`legend`,{children:`Материал для этой компании`}),(0,b.jsxs)(`label`,{children:[`Тип материала`,(0,b.jsxs)(`select`,{"aria-label":`Тип выдаваемого материала`,value:t,onChange:e=>{n(lv.shape.entityType.parse(e.target.value))},children:[(0,b.jsx)(`option`,{value:`training_simulator`,children:`Тренажёр`}),(0,b.jsx)(`option`,{value:`course`,children:`Курс`}),(0,b.jsx)(`option`,{value:`marathon`,children:`Марафон`})]})]}),(0,b.jsxs)(`label`,{children:[`ID опубликованного материала`,(0,b.jsx)(`input`,{"aria-label":`ID выдаваемого материала`,value:r,maxLength:36,onChange:e=>{i(e.target.value)}})]}),(0,b.jsxs)(`label`,{children:[`Доступен до · ISO UTC, пусто — без ограничения`,(0,b.jsx)(`input`,{"aria-label":`Материал доступен до`,value:a,maxLength:30,placeholder:`2026-10-14T08:47:00.000Z`,onChange:e=>{o(e.target.value)}})]})]}),(0,b.jsx)(I,{isDisabled:l.isPending||l.isSuccess||!s&&!u.success,onPress:()=>{if(l.isPending||l.isSuccess)return;if(s){l.mutate(s);return}if(!u.success)return;let t={workspaceId:e,key:crypto.randomUUID(),command:u.data};c(t),l.mutate(t)},children:s?`Повторить ту же выдачу`:`Выдать материал`}),l.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Сохраняем выдачу…`}):null,l.isError?(0,b.jsx)(Q,{error:l.error}):null,l.isSuccess?(0,b.jsx)(`p`,{role:`status`,children:`Материал выдан · ${l.data.id}`}):null]})},_S=({workspaceId:e,search:t})=>{let n=fS(e,t),r=na(),[i,a]=(0,y.useState)(t.search??``),o=(0,y.useRef)(null),s=Zv({count:n.data?.items.length??0,getScrollElement:()=>o.current,estimateSize:()=>100,overscan:4});return(0,b.jsxs)(`section`,{children:[(0,b.jsx)(M,{to:`/workspaces/$workspaceId/content-requests`,params:{workspaceId:e},search:{limit:20},children:`← Заявки на контент`}),(0,b.jsx)(`h1`,{children:`Content grants`}),(0,b.jsx)(gS,{workspaceId:e},e),(0,b.jsx)(`p`,{children:`Компания: ${e}`}),(0,b.jsxs)(`form`,{onSubmit:n=>{n.preventDefault(),r({to:`/workspaces/$workspaceId/content-grants`,params:{workspaceId:e},search:{limit:t.limit,search:i.trim()||void 0}})},children:[(0,b.jsxs)(`label`,{children:[`Поиск grants`,(0,b.jsx)(`input`,{"aria-label":`Поиск grants`,value:i,maxLength:200,onChange:e=>{a(e.target.value)}})]}),(0,b.jsx)(I,{type:`submit`,children:`Применить поиск grants`})]}),n.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Загружаем grants…`}):null,n.isError?(0,b.jsx)(Q,{error:n.error}):null,n.data&&n.data.items.length===0?(0,b.jsx)(`p`,{children:`Grants с такими фильтрами нет.`}):null,(0,b.jsx)(`div`,{ref:o,className:`queue-scroll`,tabIndex:0,"aria-label":`Очередь grants`,children:(0,b.jsx)(`div`,{style:{height:s.getTotalSize(),position:`relative`},children:s.getVirtualItems().map(t=>{let r=n.data.items[t.index];return(0,b.jsxs)(`div`,{className:`queue-row`,style:{position:`absolute`,top:0,left:0,width:`100%`,height:t.size,transform:`translateY(${t.start}px)`},children:[(0,b.jsx)(M,{to:`/workspaces/$workspaceId/content-grants/$grantId`,params:{workspaceId:e,grantId:r.id},search:{limit:50},children:`${r.entityType} · ${r.id}`}),(0,b.jsx)(`p`,{children:`${r.status} · ${r.entityId}`})]},r.id)})})}),n.data?.nextCursor?(0,b.jsx)(I,{onPress:()=>{r({to:`/workspaces/$workspaceId/content-grants`,params:{workspaceId:e},search:{...t,cursor:n.data.nextCursor}})},children:`Следующая страница grants`}):null,t.cursor?(0,b.jsx)(M,{to:`/workspaces/$workspaceId/content-grants`,params:{workspaceId:e},search:{search:t.search,limit:t.limit},children:`В начало grants`}):null]})},vS=({grant:e})=>{let[t]=(0,y.useState)(e),[n,r]=(0,y.useState)(``),[i,a]=(0,y.useState)(e.availableFrom??``),[o,s]=(0,y.useState)(e.availableUntil??``),[c,l]=(0,y.useState)(null),u=mS(),d=t.revision!==e.revision,f=e=>{if(u.isPending)return;if(c){u.mutate(c);return}if(d||t.status===`revoked`)return;let r=uv.safeParse(e===`amend`?{reason:n,availableFrom:i.trim()||null,availableUntil:o.trim()||null}:{reason:n,status:e});if(!r.success)return;let a=e===`revoked`?`Отзыв закрывает runtime access и окончателен: восстановление этого grant запрещено.`:e===`suspended`?`Приостановка запрещает новые допуски; существующий runtime доступ сохраняется по policy владельца.`:e===`active`?`Возобновить приостановленный grant по текущей policy владельца.`:`Изменить окно доступности grant.`;if(!window.confirm(`${a} Grant ${t.id}, revision ${t.revision}. ${JSON.stringify(r.data)}`))return;let s={workspaceId:t.workspaceId,grantId:t.id,revision:t.revision,key:crypto.randomUUID(),command:r.data};l(s),u.mutate(s)},p=uv.safeParse({reason:n,availableFrom:i.trim()||null,availableUntil:o.trim()||null}).success,m=!n.trim()||n.trim().length>500||u.isPending||d;return(0,b.jsxs)(`section`,{"aria-label":`Управление grant`,children:[(0,b.jsx)(`h2`,{children:`Разрешённое изменение grant`}),d?(0,b.jsx)(`p`,{role:`alert`,children:`Grant изменился. Сверьте сохранённый результат перед новым изменением.`}):null,(0,b.jsx)(`p`,{children:`Приостановка блокирует новые допуски. Отзыв закрывает runtime доступ и окончателен.`}),(0,b.jsxs)(`fieldset`,{disabled:!!c,children:[(0,b.jsx)(`legend`,{children:`Окно доступности`}),(0,b.jsxs)(`label`,{children:[`Доступен с · ISO UTC, пусто — без ограничения`,(0,b.jsx)(`input`,{"aria-label":`Grant доступен с`,value:i,placeholder:`2026-10-13T12:00:00.000Z`,onChange:e=>{a(e.target.value)}})]}),(0,b.jsxs)(`label`,{children:[`Доступен до · ISO UTC, пусто — без ограничения`,(0,b.jsx)(`input`,{"aria-label":`Grant доступен до`,value:o,placeholder:`2026-11-13T12:00:00.000Z`,onChange:e=>{s(e.target.value)}})]}),(0,b.jsxs)(`label`,{children:[`Причина изменения grant`,(0,b.jsx)(`textarea`,{"aria-label":`Причина изменения grant`,required:!0,maxLength:500,value:n,onChange:e=>{r(e.target.value)}})]})]}),c?(0,b.jsx)(I,{isDisabled:u.isPending,onPress:()=>{f(`amend`)},children:`Повторить то же изменение grant`}):(0,b.jsxs)(`div`,{className:`actions`,children:[(0,b.jsx)(I,{isDisabled:m||!p,onPress:()=>{f(`amend`)},children:`Изменить окно grant`}),t.status===`active`?(0,b.jsx)(I,{isDisabled:m,onPress:()=>{f(`suspended`)},children:`Приостановить grant`}):null,t.status===`suspended`?(0,b.jsx)(I,{isDisabled:m,onPress:()=>{f(`active`)},children:`Возобновить grant`}):null,(0,b.jsx)(I,{variant:`danger`,isDisabled:m,onPress:()=>{f(`revoked`)},children:`Отозвать grant`})]}),u.isPending?(0,b.jsx)(`p`,{role:`status`,children:`Сохраняем изменение grant…`}):null,u.isError?(0,b.jsx)(Q,{error:u.error}):null,u.isSuccess?(0,b.jsx)(`p`,{role:`status`,children:`Изменение grant сохранено · ${u.data.status} · revision ${u.data.revision}`}):null]})},yS=({workspaceId:e,grantId:t,limit:n,cursor:r})=>{let i=pS(e,t,n,r),a=na(),[o,s]=(0,y.useState)(0);if(i.isPending)return(0,b.jsx)(`p`,{role:`status`,children:`Загружаем grant…`});if(i.isError)return(0,b.jsx)(Q,{error:i.error});let{grant:c,history:l,nextCursor:u}=i.data,d=async()=>{(await i.refetch()).isSuccess&&s(e=>e+1)};return(0,b.jsxs)(`article`,{children:[(0,b.jsx)(M,{to:`/workspaces/$workspaceId/content-grants`,params:{workspaceId:e},search:{limit:20},children:`← Grants`}),(0,b.jsx)(`h1`,{children:`Grant ${c.id}`}),(0,b.jsxs)(`dl`,{children:[(0,b.jsx)(`dt`,{children:`Компания`}),(0,b.jsx)(`dd`,{children:c.workspaceId}),(0,b.jsx)(`dt`,{children:`Контент`}),(0,b.jsx)(`dd`,{children:`${c.entityType} · ${c.entityId}`}),(0,b.jsx)(`dt`,{children:`Статус grant`}),(0,b.jsx)(`dd`,{children:c.status}),(0,b.jsx)(`dt`,{children:`Revision grant`}),(0,b.jsx)(`dd`,{children:c.revision}),(0,b.jsx)(`dt`,{children:`Доступен с`}),(0,b.jsx)(`dd`,{children:c.availableFrom??`Без ограничения`}),(0,b.jsx)(`dt`,{children:`Доступен до`}),(0,b.jsx)(`dd`,{children:c.availableUntil??`Без ограничения`})]}),c.status===`revoked`?(0,b.jsx)(`p`,{children:`Grant окончательно отозван. Восстановление этого grant запрещено policy владельца.`}):(0,b.jsx)(vS,{grant:c},`${c.id}:${o}`),(0,b.jsx)(I,{onPress:()=>{d()},children:`Сверить сохранённый grant`}),(0,b.jsxs)(`section`,{"aria-label":`История grant`,children:[(0,b.jsx)(`h2`,{children:`История grant`}),l.length===0?(0,b.jsx)(`p`,{children:`Сохранённых команд пока нет.`}):(0,b.jsx)(`ol`,{children:l.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsx)(`p`,{children:`${e.operationId} · ${e.id} · ${new Date(e.createdAt).toLocaleString(`ru`)}`}),(0,b.jsx)(`p`,{children:`Результат: ${e.snapshot.status} · ${e.snapshot.availableFrom??`Без ограничения`} → ${e.snapshot.availableUntil??`Без ограничения`}`}),e.reason?(0,b.jsx)(`p`,{children:e.reason}):(0,b.jsx)(`p`,{children:`У исторической команды причина не сохранена.`})]},e.id))}),u?(0,b.jsx)(I,{onPress:()=>{a({to:`/workspaces/$workspaceId/content-grants/$grantId`,params:{workspaceId:e,grantId:t},search:{cursor:u,limit:n}})},children:`Следующая страница истории grant`}):null,r?(0,b.jsx)(M,{to:`/workspaces/$workspaceId/content-grants/$grantId`,params:{workspaceId:e,grantId:t},search:{limit:n},children:`Последние изменения grant`}):null]})]})},bS=()=>{let e=Cv();return(0,b.jsxs)(`main`,{children:[(0,b.jsx)(`header`,{children:(0,b.jsx)(M,{to:`/`,children:`Leans · Operators`})}),(0,b.jsx)(Tv,{}),e.isSuccess?(0,b.jsx)(Na,{}):null]})},xS=()=>{let e=Cv();return(0,b.jsx)(sS,{enabled:!!e.data?.elevation})},SS=()=>{let{workspaceId:e}=NS.useParams(),t=NS.useSearch();return(0,b.jsx)(oS,{workspaceId:e,search:t})},CS=()=>{let{workspaceId:e,requestId:t}=PS.useParams();return(0,b.jsx)(aS,{workspaceId:e,requestId:t})},wS=()=>{let{workspaceId:e}=FS.useParams();return(0,b.jsx)(_S,{workspaceId:e,search:FS.useSearch()},`${e}:${FS.useSearch().search??``}`)},TS=()=>{let{workspaceId:e,grantId:t}=IS.useParams();return(0,b.jsx)(yS,{workspaceId:e,grantId:t,limit:IS.useSearch().limit,cursor:IS.useSearch().cursor},`${e}:${t}`)},ES=()=>{let{workspaceId:e}=LS.useParams();return(0,b.jsx)(hx,{workspaceId:e,search:LS.useSearch()})},DS=()=>{let{workspaceId:e,humanReviewTaskId:t}=RS.useParams();return(0,b.jsx)(wx,{workspaceId:e,humanReviewTaskId:t,search:RS.useSearch()},`${e}:${t}`)},OS=()=>{let{workspaceId:e}=zS.useParams();return(0,b.jsx)(ay,{workspaceId:e,search:zS.useSearch()})},kS=()=>{let{workspaceId:e,requestId:t}=BS.useParams();return(0,b.jsx)(sy,{workspaceId:e,requestId:t},`${e}:${t}`)},AS=()=>(0,b.jsx)(hy,{workspaceId:null,search:VS.useSearch()}),jS=()=>{let{caseId:e}=HS.useParams();return(0,b.jsx)(Fy,{workspaceId:null,caseId:e},`support:${e}`)},$=Sa({component:bS}),MS=N({getParentRoute:()=>$,path:`/`,component:xS}),NS=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/content-requests`,validateSearch:e=>V_.parse(e),component:SS}),PS=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/content-requests/$requestId`,component:CS}),FS=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/content-grants`,validateSearch:e=>av.parse(e),component:wS}),IS=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/content-grants/$grantId`,validateSearch:e=>av.omit({search:!0}).parse(e),component:TS}),LS=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/ai/human-reviews`,validateSearch:e=>sg.parse(e),component:ES}),RS=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/ai/human-reviews/$humanReviewTaskId`,validateSearch:e=>sg.omit({status:!0}).parse(e),component:DS}),zS=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/governance-requests`,validateSearch:e=>Y_.parse(e),component:OS}),BS=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/governance-requests/$requestId`,component:kS}),VS=N({getParentRoute:()=>$,path:`/support-moderation-cases`,validateSearch:e=>Zh.parse(e),component:AS}),HS=N({getParentRoute:()=>$,path:`/support-moderation-cases/$caseId`,component:jS}),US=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/moderation-cases`,validateSearch:e=>Zh.parse(e),component:()=>(0,b.jsx)(hy,{workspaceId:US.useParams().workspaceId,search:US.useSearch()})}),WS=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/moderation-cases/$caseId`,component:()=>(0,b.jsx)(Fy,{...WS.useParams()},WS.useParams().caseId)}),GS=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/moderation-cases/$caseId/removed-review`,component:()=>(0,b.jsx)(Hy,{...GS.useParams()},GS.useParams().caseId)}),KS=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/moderation-cases/$caseId/appeals/$disputedDecisionId`,component:()=>(0,b.jsx)(Yy,{...KS.useParams()},`${KS.useParams().caseId}:${KS.useParams().disputedDecisionId}`)}),qS=N({getParentRoute:()=>$,path:`/support-moderation-cases/$caseId/appeals/$disputedDecisionId`,component:()=>(0,b.jsx)(Yy,{workspaceId:null,caseId:qS.useParams().caseId,disputedDecisionId:qS.useParams().disputedDecisionId},`${qS.useParams().caseId}:${qS.useParams().disputedDecisionId}`)}),JS=N({getParentRoute:()=>$,path:`/case-investigations`,validateSearch:e=>Og.parse(e),component:()=>(0,b.jsx)(Fx,{search:JS.useSearch()})}),YS=N({getParentRoute:()=>$,path:`/case-investigations/$investigationId`,component:()=>(0,b.jsx)(Ix,{...YS.useParams()},YS.useParams().investigationId)}),XS=N({getParentRoute:()=>$,path:`/ai/provider-models`,validateSearch:e=>$g.parse(e),component:()=>(0,b.jsx)(qx,{kind:`models`,search:XS.useSearch()})}),ZS=N({getParentRoute:()=>$,path:`/ai/execution-profiles`,validateSearch:e=>$g.parse(e),component:()=>(0,b.jsx)(qx,{kind:`profiles`,search:ZS.useSearch()})}),QS=N({getParentRoute:()=>$,path:`/ai/provider-models/$resourceId`,component:()=>(0,b.jsx)(Jx,{kind:`models`,resourceId:QS.useParams().resourceId},QS.useParams().resourceId)}),$S=N({getParentRoute:()=>$,path:`/ai/execution-profiles/$resourceId`,component:()=>(0,b.jsx)(Jx,{kind:`profiles`,resourceId:$S.useParams().resourceId},$S.useParams().resourceId)}),eC=N({getParentRoute:()=>$,path:`/ai/provider-models/$resourceId/versions/$versionId`,component:()=>(0,b.jsx)(Yx,{kind:`models`,resourceId:eC.useParams().resourceId,versionId:eC.useParams().versionId},eC.useParams().versionId)}),tC=N({getParentRoute:()=>$,path:`/ai/execution-profiles/$resourceId/versions/$versionId`,component:()=>(0,b.jsx)(Yx,{kind:`profiles`,resourceId:tC.useParams().resourceId,versionId:tC.useParams().versionId},tC.useParams().versionId)}),nC=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/incidents`,validateSearch:e=>eb.parse(e),component:()=>(0,b.jsx)(Tb,{workspaceId:nC.useParams().workspaceId,search:nC.useSearch()})}),rC=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/incidents/$incidentId`,component:()=>(0,b.jsx)(Db,{...rC.useParams()},rC.useParams().incidentId)}),iC=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/assignment-recoveries`,validateSearch:e=>S_.parse(e),component:()=>(0,b.jsx)(Hb,{workspaceId:iC.useParams().workspaceId,search:iC.useSearch()})}),aC=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/deliveries/$deliveryId/assignment-rules/$ruleId/jobs/$jobId/recovery`,component:()=>(0,b.jsx)(Ub,{workspaceId:aC.useParams().workspaceId,deliveryId:aC.useParams().deliveryId,ruleId:aC.useParams().ruleId,jobId:aC.useParams().jobId},aC.useParams().jobId)}),oC=N({getParentRoute:()=>$,path:`/media-assets/$assetId/source-cleanup`,component:()=>(0,b.jsx)($b,{assetId:oC.useParams().assetId},oC.useParams().assetId)}),sC=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/integration-health`,component:()=>(0,b.jsx)(Ob,{workspaceId:sC.useParams().workspaceId})}),cC=N({getParentRoute:()=>$,path:`/workspaces/$workspaceId/incident-notifications`,component:()=>(0,b.jsx)(kb,{workspaceId:cC.useParams().workspaceId})}),lC=N({getParentRoute:()=>$,path:`/reports`,validateSearch:e=>ex.parse(e),component:()=>(0,b.jsx)(cx,{search:lC.useSearch()})}),uC=za({routeTree:$.addChildren([MS,NS,PS,FS,IS,LS,RS,zS,BS,VS,HS,US,WS,GS,KS,qS,JS,YS,XS,ZS,QS,$S,eC,tC,nC,rC,iC,aC,oC,sC,cC,lC])});(0,mt.createRoot)(document.getElementById(`root`)).render((0,b.jsx)(()=>{let[e]=(0,y.useState)(()=>ht());return(0,b.jsx)(eo,{children:(0,b.jsx)(C,{client:e,children:(0,b.jsx)(Ha,{router:uC})})})},{}));