blockmine 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,14 +38,14 @@ function ahe(e,t){for(var n=0;n<t.length;n++){const o=t[n];if(typeof o!="string"
38
38
  *
39
39
  * This source code is licensed under the MIT license found in the
40
40
  * LICENSE file in the root directory of this source tree.
41
- */var DZ;function dhe(){if(DZ)return mf;DZ=1;var e=lhe(),t=sp(),n=kJ();function o(r){var c="https://react.dev/errors/"+r;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)c+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+r+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function i(r){var c=r,f=r;if(r.alternate)for(;c.return;)c=c.return;else{r=c;do c=r,(c.flags&4098)!==0&&(f=c.return),r=c.return;while(r)}return c.tag===3?f:null}function s(r){if(r.tag===13){var c=r.memoizedState;if(c===null&&(r=r.alternate,r!==null&&(c=r.memoizedState)),c!==null)return c.dehydrated}return null}function l(r){if(i(r)!==r)throw Error(o(188))}function d(r){var c=r.alternate;if(!c){if(c=i(r),c===null)throw Error(o(188));return c!==r?null:r}for(var f=r,g=c;;){var w=f.return;if(w===null)break;var S=w.alternate;if(S===null){if(g=w.return,g!==null){f=g;continue}break}if(w.child===S.child){for(S=w.child;S;){if(S===f)return l(w),r;if(S===g)return l(w),c;S=S.sibling}throw Error(o(188))}if(f.return!==g.return)f=w,g=S;else{for(var $=!1,B=w.child;B;){if(B===f){$=!0,f=w,g=S;break}if(B===g){$=!0,g=w,f=S;break}B=B.sibling}if(!$){for(B=S.child;B;){if(B===f){$=!0,f=S,g=w;break}if(B===g){$=!0,g=S,f=w;break}B=B.sibling}if(!$)throw Error(o(189))}}if(f.alternate!==g)throw Error(o(190))}if(f.tag!==3)throw Error(o(188));return f.stateNode.current===f?r:c}function h(r){var c=r.tag;if(c===5||c===26||c===27||c===6)return r;for(r=r.child;r!==null;){if(c=h(r),c!==null)return c;r=r.sibling}return null}var p=Object.assign,m=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),_=Symbol.for("react.provider"),N=Symbol.for("react.consumer"),A=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),Z=Symbol.iterator;function q(r){return r===null||typeof r!="object"?null:(r=Z&&r[Z]||r["@@iterator"],typeof r=="function"?r:null)}var G=Symbol.for("react.client.reference");function E(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===G?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case M:return"Fragment";case C:return"Profiler";case b:return"StrictMode";case R:return"Suspense";case j:return"SuspenseList";case U:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case x:return"Portal";case A:return(r.displayName||"Context")+".Provider";case N:return(r._context.displayName||"Context")+".Consumer";case I:var c=r.render;return r=r.displayName,r||(r=c.displayName||c.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case D:return c=r.displayName||null,c!==null?c:E(r.type)||"Memo";case H:c=r._payload,r=r._init;try{return E(r(c))}catch{}}return null}var O=Array.isArray,P=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},V=[],L=-1;function Y(r){return{current:r}}function F(r){0>L||(r.current=V[L],V[L]=null,L--)}function T(r,c){L++,V[L]=r.current,r.current=c}var K=Y(null),Q=Y(null),ne=Y(null),te=Y(null);function ce(r,c){switch(T(ne,c),T(Q,r),T(K,null),c.nodeType){case 9:case 11:r=(r=c.documentElement)&&(r=r.namespaceURI)?oZ(r):0;break;default:if(r=c.tagName,c=c.namespaceURI)c=oZ(c),r=aZ(c,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}F(K),T(K,r)}function me(){F(K),F(Q),F(ne)}function ke(r){r.memoizedState!==null&&T(te,r);var c=K.current,f=aZ(c,r.type);c!==f&&(T(Q,r),T(K,f))}function Ee(r){Q.current===r&&(F(K),F(Q)),te.current===r&&(F(te),uf._currentValue=W)}var Ie=Object.prototype.hasOwnProperty,Te=e.unstable_scheduleCallback,qe=e.unstable_cancelCallback,ct=e.unstable_shouldYield,jt=e.unstable_requestPaint,We=e.unstable_now,Le=e.unstable_getCurrentPriorityLevel,Rt=e.unstable_ImmediatePriority,eo=e.unstable_UserBlockingPriority,An=e.unstable_NormalPriority,wn=e.unstable_LowPriority,On=e.unstable_IdlePriority,so=e.log,wo=e.unstable_setDisableYieldValue,fe=null,be=null;function Oe(r){if(typeof so=="function"&&wo(r),be&&typeof be.setStrictMode=="function")try{be.setStrictMode(fe,r)}catch{}}var He=Math.clz32?Math.clz32:tn,kt=Math.log,ft=Math.LN2;function tn(r){return r>>>=0,r===0?32:31-(kt(r)/ft|0)|0}var Kt=256,bn=4194304;function rn(r){var c=r&42;if(c!==0)return c;switch(r&-r){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:case 262144:case 524288:case 1048576:case 2097152:return r&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function At(r,c,f){var g=r.pendingLanes;if(g===0)return 0;var w=0,S=r.suspendedLanes,$=r.pingedLanes;r=r.warmLanes;var B=g&134217727;return B!==0?(g=B&~S,g!==0?w=rn(g):($&=B,$!==0?w=rn($):f||(f=B&~r,f!==0&&(w=rn(f))))):(B=g&~S,B!==0?w=rn(B):$!==0?w=rn($):f||(f=g&~r,f!==0&&(w=rn(f)))),w===0?0:c!==0&&c!==w&&(c&S)===0&&(S=w&-w,f=c&-c,S>=f||S===32&&(f&4194048)!==0)?c:w}function Dt(r,c){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&c)===0}function En(r,c){switch(r){case 1:case 2:case 4:case 8:case 64:return c+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 c+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 Qa(){var r=Kt;return Kt<<=1,(Kt&4194048)===0&&(Kt=256),r}function Ja(){var r=bn;return bn<<=1,(bn&62914560)===0&&(bn=4194304),r}function er(r){for(var c=[],f=0;31>f;f++)c.push(r);return c}function tr(r,c){r.pendingLanes|=c,c!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function ra(r,c,f,g,w,S){var $=r.pendingLanes;r.pendingLanes=f,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=f,r.entangledLanes&=f,r.errorRecoveryDisabledLanes&=f,r.shellSuspendCounter=0;var B=r.entanglements,J=r.expirationTimes,se=r.hiddenUpdates;for(f=$&~f;0<f;){var ye=31-He(f),we=1<<ye;B[ye]=0,J[ye]=-1;var ue=se[ye];if(ue!==null)for(se[ye]=null,ye=0;ye<ue.length;ye++){var he=ue[ye];he!==null&&(he.lane&=-536870913)}f&=~we}g!==0&&Pr(r,g,0),S!==0&&w===0&&r.tag!==0&&(r.suspendedLanes|=S&~($&~c))}function Pr(r,c,f){r.pendingLanes|=c,r.suspendedLanes&=~c;var g=31-He(c);r.entangledLanes|=c,r.entanglements[g]=r.entanglements[g]|1073741824|f&4194090}function $r(r,c){var f=r.entangledLanes|=c;for(r=r.entanglements;f;){var g=31-He(f),w=1<<g;w&c|r[g]&c&&(r[g]|=c),f&=~w}}function qs(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Hs(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function ee(){var r=X.p;return r!==0?r:(r=window.event,r===void 0?32:MZ(r.type))}function re(r,c){var f=X.p;try{return X.p=r,c()}finally{X.p=f}}var de=Math.random().toString(36).slice(2),xe="__reactFiber$"+de,Ce="__reactProps$"+de,Pe="__reactContainer$"+de,Ke="__reactEvents$"+de,Re="__reactListeners$"+de,Fe="__reactHandles$"+de,Ue="__reactResources$"+de,Qe="__reactMarker$"+de;function Ve(r){delete r[xe],delete r[Ce],delete r[Ke],delete r[Re],delete r[Fe]}function tt(r){var c=r[xe];if(c)return c;for(var f=r.parentNode;f;){if(c=f[Pe]||f[xe]){if(f=c.alternate,c.child!==null||f!==null&&f.child!==null)for(r=cZ(r);r!==null;){if(f=r[xe])return f;r=cZ(r)}return c}r=f,f=r.parentNode}return null}function Mt(r){if(r=r[xe]||r[Pe]){var c=r.tag;if(c===5||c===6||c===13||c===26||c===27||c===3)return r}return null}function Vt(r){var c=r.tag;if(c===5||c===26||c===27||c===6)return r.stateNode;throw Error(o(33))}function Qt(r){var c=r[Ue];return c||(c=r[Ue]={hoistableStyles:new Map,hoistableScripts:new Map}),c}function St(r){r[Qe]=!0}var xt=new Set,nr={};function to(r,c){bo(r,c),bo(r+"Capture",c)}function bo(r,c){for(nr[r]=c,r=0;r<c.length;r++)xt.add(c[r])}var no=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),or={},ar={};function Vs(r){return Ie.call(ar,r)?!0:Ie.call(or,r)?!1:no.test(r)?ar[r]=!0:(or[r]=!0,!1)}function Mo(r,c,f){if(Vs(c))if(f===null)r.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":r.removeAttribute(c);return;case"boolean":var g=c.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){r.removeAttribute(c);return}}r.setAttribute(c,""+f)}}function ja(r,c,f){if(f===null)r.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttribute(c,""+f)}}function dt(r,c,f,g){if(g===null)r.removeAttribute(f);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(f);return}r.setAttributeNS(c,f,""+g)}}var qn,Do;function zo(r){if(qn===void 0)try{throw Error()}catch(f){var c=f.stack.trim().match(/\n( *(at )?)/);qn=c&&c[1]||"",Do=-1<f.stack.indexOf(`
41
+ */var DZ;function dhe(){if(DZ)return mf;DZ=1;var e=lhe(),t=sp(),n=kJ();function o(r){var c="https://react.dev/errors/"+r;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)c+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+r+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function i(r){var c=r,f=r;if(r.alternate)for(;c.return;)c=c.return;else{r=c;do c=r,(c.flags&4098)!==0&&(f=c.return),r=c.return;while(r)}return c.tag===3?f:null}function s(r){if(r.tag===13){var c=r.memoizedState;if(c===null&&(r=r.alternate,r!==null&&(c=r.memoizedState)),c!==null)return c.dehydrated}return null}function l(r){if(i(r)!==r)throw Error(o(188))}function d(r){var c=r.alternate;if(!c){if(c=i(r),c===null)throw Error(o(188));return c!==r?null:r}for(var f=r,g=c;;){var w=f.return;if(w===null)break;var S=w.alternate;if(S===null){if(g=w.return,g!==null){f=g;continue}break}if(w.child===S.child){for(S=w.child;S;){if(S===f)return l(w),r;if(S===g)return l(w),c;S=S.sibling}throw Error(o(188))}if(f.return!==g.return)f=w,g=S;else{for(var $=!1,B=w.child;B;){if(B===f){$=!0,f=w,g=S;break}if(B===g){$=!0,g=w,f=S;break}B=B.sibling}if(!$){for(B=S.child;B;){if(B===f){$=!0,f=S,g=w;break}if(B===g){$=!0,g=S,f=w;break}B=B.sibling}if(!$)throw Error(o(189))}}if(f.alternate!==g)throw Error(o(190))}if(f.tag!==3)throw Error(o(188));return f.stateNode.current===f?r:c}function h(r){var c=r.tag;if(c===5||c===26||c===27||c===6)return r;for(r=r.child;r!==null;){if(c=h(r),c!==null)return c;r=r.sibling}return null}var p=Object.assign,m=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),_=Symbol.for("react.provider"),N=Symbol.for("react.consumer"),A=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),Z=Symbol.iterator;function q(r){return r===null||typeof r!="object"?null:(r=Z&&r[Z]||r["@@iterator"],typeof r=="function"?r:null)}var G=Symbol.for("react.client.reference");function E(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===G?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case M:return"Fragment";case C:return"Profiler";case b:return"StrictMode";case R:return"Suspense";case j:return"SuspenseList";case U:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case x:return"Portal";case A:return(r.displayName||"Context")+".Provider";case N:return(r._context.displayName||"Context")+".Consumer";case I:var c=r.render;return r=r.displayName,r||(r=c.displayName||c.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case D:return c=r.displayName||null,c!==null?c:E(r.type)||"Memo";case H:c=r._payload,r=r._init;try{return E(r(c))}catch{}}return null}var O=Array.isArray,P=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},V=[],L=-1;function Y(r){return{current:r}}function F(r){0>L||(r.current=V[L],V[L]=null,L--)}function T(r,c){L++,V[L]=r.current,r.current=c}var K=Y(null),Q=Y(null),ne=Y(null),te=Y(null);function ce(r,c){switch(T(ne,c),T(Q,r),T(K,null),c.nodeType){case 9:case 11:r=(r=c.documentElement)&&(r=r.namespaceURI)?oZ(r):0;break;default:if(r=c.tagName,c=c.namespaceURI)c=oZ(c),r=aZ(c,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}F(K),T(K,r)}function me(){F(K),F(Q),F(ne)}function ke(r){r.memoizedState!==null&&T(te,r);var c=K.current,f=aZ(c,r.type);c!==f&&(T(Q,r),T(K,f))}function Ee(r){Q.current===r&&(F(K),F(Q)),te.current===r&&(F(te),uf._currentValue=W)}var Ie=Object.prototype.hasOwnProperty,Te=e.unstable_scheduleCallback,qe=e.unstable_cancelCallback,ct=e.unstable_shouldYield,jt=e.unstable_requestPaint,We=e.unstable_now,Le=e.unstable_getCurrentPriorityLevel,Rt=e.unstable_ImmediatePriority,eo=e.unstable_UserBlockingPriority,An=e.unstable_NormalPriority,wn=e.unstable_LowPriority,On=e.unstable_IdlePriority,so=e.log,wo=e.unstable_setDisableYieldValue,fe=null,be=null;function Oe(r){if(typeof so=="function"&&wo(r),be&&typeof be.setStrictMode=="function")try{be.setStrictMode(fe,r)}catch{}}var He=Math.clz32?Math.clz32:tn,kt=Math.log,ft=Math.LN2;function tn(r){return r>>>=0,r===0?32:31-(kt(r)/ft|0)|0}var Kt=256,bn=4194304;function rn(r){var c=r&42;if(c!==0)return c;switch(r&-r){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:case 262144:case 524288:case 1048576:case 2097152:return r&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function At(r,c,f){var g=r.pendingLanes;if(g===0)return 0;var w=0,S=r.suspendedLanes,$=r.pingedLanes;r=r.warmLanes;var B=g&134217727;return B!==0?(g=B&~S,g!==0?w=rn(g):($&=B,$!==0?w=rn($):f||(f=B&~r,f!==0&&(w=rn(f))))):(B=g&~S,B!==0?w=rn(B):$!==0?w=rn($):f||(f=g&~r,f!==0&&(w=rn(f)))),w===0?0:c!==0&&c!==w&&(c&S)===0&&(S=w&-w,f=c&-c,S>=f||S===32&&(f&4194048)!==0)?c:w}function Dt(r,c){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&c)===0}function En(r,c){switch(r){case 1:case 2:case 4:case 8:case 64:return c+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 c+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 Qa(){var r=Kt;return Kt<<=1,(Kt&4194048)===0&&(Kt=256),r}function Ja(){var r=bn;return bn<<=1,(bn&62914560)===0&&(bn=4194304),r}function er(r){for(var c=[],f=0;31>f;f++)c.push(r);return c}function tr(r,c){r.pendingLanes|=c,c!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function ra(r,c,f,g,w,S){var $=r.pendingLanes;r.pendingLanes=f,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=f,r.entangledLanes&=f,r.errorRecoveryDisabledLanes&=f,r.shellSuspendCounter=0;var B=r.entanglements,J=r.expirationTimes,se=r.hiddenUpdates;for(f=$&~f;0<f;){var ye=31-He(f),we=1<<ye;B[ye]=0,J[ye]=-1;var ue=se[ye];if(ue!==null)for(se[ye]=null,ye=0;ye<ue.length;ye++){var he=ue[ye];he!==null&&(he.lane&=-536870913)}f&=~we}g!==0&&Pr(r,g,0),S!==0&&w===0&&r.tag!==0&&(r.suspendedLanes|=S&~($&~c))}function Pr(r,c,f){r.pendingLanes|=c,r.suspendedLanes&=~c;var g=31-He(c);r.entangledLanes|=c,r.entanglements[g]=r.entanglements[g]|1073741824|f&4194090}function $r(r,c){var f=r.entangledLanes|=c;for(r=r.entanglements;f;){var g=31-He(f),w=1<<g;w&c|r[g]&c&&(r[g]|=c),f&=~w}}function qs(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Hs(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function ee(){var r=X.p;return r!==0?r:(r=window.event,r===void 0?32:MZ(r.type))}function re(r,c){var f=X.p;try{return X.p=r,c()}finally{X.p=f}}var de=Math.random().toString(36).slice(2),xe="__reactFiber$"+de,Ce="__reactProps$"+de,Pe="__reactContainer$"+de,Ke="__reactEvents$"+de,Re="__reactListeners$"+de,Fe="__reactHandles$"+de,Ue="__reactResources$"+de,Qe="__reactMarker$"+de;function Ve(r){delete r[xe],delete r[Ce],delete r[Ke],delete r[Re],delete r[Fe]}function tt(r){var c=r[xe];if(c)return c;for(var f=r.parentNode;f;){if(c=f[Pe]||f[xe]){if(f=c.alternate,c.child!==null||f!==null&&f.child!==null)for(r=cZ(r);r!==null;){if(f=r[xe])return f;r=cZ(r)}return c}r=f,f=r.parentNode}return null}function Mt(r){if(r=r[xe]||r[Pe]){var c=r.tag;if(c===5||c===6||c===13||c===26||c===27||c===3)return r}return null}function Bt(r){var c=r.tag;if(c===5||c===26||c===27||c===6)return r.stateNode;throw Error(o(33))}function Qt(r){var c=r[Ue];return c||(c=r[Ue]={hoistableStyles:new Map,hoistableScripts:new Map}),c}function St(r){r[Qe]=!0}var xt=new Set,nr={};function to(r,c){bo(r,c),bo(r+"Capture",c)}function bo(r,c){for(nr[r]=c,r=0;r<c.length;r++)xt.add(c[r])}var no=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),or={},ar={};function Vs(r){return Ie.call(ar,r)?!0:Ie.call(or,r)?!1:no.test(r)?ar[r]=!0:(or[r]=!0,!1)}function Mo(r,c,f){if(Vs(c))if(f===null)r.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":r.removeAttribute(c);return;case"boolean":var g=c.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){r.removeAttribute(c);return}}r.setAttribute(c,""+f)}}function ja(r,c,f){if(f===null)r.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttribute(c,""+f)}}function dt(r,c,f,g){if(g===null)r.removeAttribute(f);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(f);return}r.setAttributeNS(c,f,""+g)}}var qn,Do;function zo(r){if(qn===void 0)try{throw Error()}catch(f){var c=f.stack.trim().match(/\n( *(at )?)/);qn=c&&c[1]||"",Do=-1<f.stack.indexOf(`
42
42
  at`)?" (<anonymous>)":-1<f.stack.indexOf("@")?"@unknown:0:0":""}return`
43
43
  `+qn+r+Do}var Dr=!1;function zt(r,c){if(!r||Dr)return"";Dr=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var g={DetermineComponentFrameRoot:function(){try{if(c){var we=function(){throw Error()};if(Object.defineProperty(we.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(we,[])}catch(he){var ue=he}Reflect.construct(r,[],we)}else{try{we.call()}catch(he){ue=he}r.call(we.prototype)}}else{try{throw Error()}catch(he){ue=he}(we=r())&&typeof we.catch=="function"&&we.catch(function(){})}}catch(he){if(he&&ue&&typeof he.stack=="string")return[he.stack,ue.stack]}return[null,null]}};g.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var w=Object.getOwnPropertyDescriptor(g.DetermineComponentFrameRoot,"name");w&&w.configurable&&Object.defineProperty(g.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var S=g.DetermineComponentFrameRoot(),$=S[0],B=S[1];if($&&B){var J=$.split(`
44
44
  `),se=B.split(`
45
45
  `);for(w=g=0;g<J.length&&!J[g].includes("DetermineComponentFrameRoot");)g++;for(;w<se.length&&!se[w].includes("DetermineComponentFrameRoot");)w++;if(g===J.length||w===se.length)for(g=J.length-1,w=se.length-1;1<=g&&0<=w&&J[g]!==se[w];)w--;for(;1<=g&&0<=w;g--,w--)if(J[g]!==se[w]){if(g!==1||w!==1)do if(g--,w--,0>w||J[g]!==se[w]){var ye=`
46
46
  `+J[g].replace(" at new "," at ");return r.displayName&&ye.includes("<anonymous>")&&(ye=ye.replace("<anonymous>",r.displayName)),ye}while(1<=g&&0<=w);break}}}finally{Dr=!1,Error.prepareStackTrace=f}return(f=r?r.displayName||r.name:"")?zo(f):""}function xi(r){switch(r.tag){case 26:case 27:case 5:return zo(r.type);case 16:return zo("Lazy");case 13:return zo("Suspense");case 19:return zo("SuspenseList");case 0:case 15:return zt(r.type,!1);case 11:return zt(r.type.render,!1);case 1:return zt(r.type,!0);case 31:return zo("Activity");default:return""}}function w2(r){try{var c="";do c+=xi(r),r=r.return;while(r);return c}catch(f){return`
47
47
  Error generating stack: `+f.message+`
48
- `+f.stack}}function _o(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function QF(r){var c=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function Jue(r){var c=QF(r)?"checked":"value",f=Object.getOwnPropertyDescriptor(r.constructor.prototype,c),g=""+r[c];if(!r.hasOwnProperty(c)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var w=f.get,S=f.set;return Object.defineProperty(r,c,{configurable:!0,get:function(){return w.call(this)},set:function($){g=""+$,S.call(this,$)}}),Object.defineProperty(r,c,{enumerable:f.enumerable}),{getValue:function(){return g},setValue:function($){g=""+$},stopTracking:function(){r._valueTracker=null,delete r[c]}}}}function qp(r){r._valueTracker||(r._valueTracker=Jue(r))}function JF(r){if(!r)return!1;var c=r._valueTracker;if(!c)return!0;var f=c.getValue(),g="";return r&&(g=QF(r)?r.checked?"true":"false":r.value),r=g,r!==f?(c.setValue(r),!0):!1}function Hp(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var ede=/[\n"\\]/g;function ia(r){return r.replace(ede,function(c){return"\\"+c.charCodeAt(0).toString(16)+" "})}function U$(r,c,f,g,w,S,$,B){r.name="",$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?r.type=$:r.removeAttribute("type"),c!=null?$==="number"?(c===0&&r.value===""||r.value!=c)&&(r.value=""+_o(c)):r.value!==""+_o(c)&&(r.value=""+_o(c)):$!=="submit"&&$!=="reset"||r.removeAttribute("value"),c!=null?G$(r,$,_o(c)):f!=null?G$(r,$,_o(f)):g!=null&&r.removeAttribute("value"),w==null&&S!=null&&(r.defaultChecked=!!S),w!=null&&(r.checked=w&&typeof w!="function"&&typeof w!="symbol"),B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?r.name=""+_o(B):r.removeAttribute("name")}function eU(r,c,f,g,w,S,$,B){if(S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(r.type=S),c!=null||f!=null){if(!(S!=="submit"&&S!=="reset"||c!=null))return;f=f!=null?""+_o(f):"",c=c!=null?""+_o(c):f,B||c===r.value||(r.value=c),r.defaultValue=c}g=g??w,g=typeof g!="function"&&typeof g!="symbol"&&!!g,r.checked=B?r.checked:!!g,r.defaultChecked=!!g,$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"&&(r.name=$)}function G$(r,c,f){c==="number"&&Hp(r.ownerDocument)===r||r.defaultValue===""+f||(r.defaultValue=""+f)}function x1(r,c,f,g){if(r=r.options,c){c={};for(var w=0;w<f.length;w++)c["$"+f[w]]=!0;for(f=0;f<r.length;f++)w=c.hasOwnProperty("$"+r[f].value),r[f].selected!==w&&(r[f].selected=w),w&&g&&(r[f].defaultSelected=!0)}else{for(f=""+_o(f),c=null,w=0;w<r.length;w++){if(r[w].value===f){r[w].selected=!0,g&&(r[w].defaultSelected=!0);return}c!==null||r[w].disabled||(c=r[w])}c!==null&&(c.selected=!0)}}function tU(r,c,f){if(c!=null&&(c=""+_o(c),c!==r.value&&(r.value=c),f==null)){r.defaultValue!==c&&(r.defaultValue=c);return}r.defaultValue=f!=null?""+_o(f):""}function nU(r,c,f,g){if(c==null){if(g!=null){if(f!=null)throw Error(o(92));if(O(g)){if(1<g.length)throw Error(o(93));g=g[0]}f=g}f==null&&(f=""),c=f}f=_o(c),r.defaultValue=f,g=r.textContent,g===f&&g!==""&&g!==null&&(r.value=g)}function w1(r,c){if(c){var f=r.firstChild;if(f&&f===r.lastChild&&f.nodeType===3){f.nodeValue=c;return}}r.textContent=c}var tde=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function oU(r,c,f){var g=c.indexOf("--")===0;f==null||typeof f=="boolean"||f===""?g?r.setProperty(c,""):c==="float"?r.cssFloat="":r[c]="":g?r.setProperty(c,f):typeof f!="number"||f===0||tde.has(c)?c==="float"?r.cssFloat=f:r[c]=(""+f).trim():r[c]=f+"px"}function aU(r,c,f){if(c!=null&&typeof c!="object")throw Error(o(62));if(r=r.style,f!=null){for(var g in f)!f.hasOwnProperty(g)||c!=null&&c.hasOwnProperty(g)||(g.indexOf("--")===0?r.setProperty(g,""):g==="float"?r.cssFloat="":r[g]="");for(var w in c)g=c[w],c.hasOwnProperty(w)&&f[w]!==g&&oU(r,w,g)}else for(var S in c)c.hasOwnProperty(S)&&oU(r,S,c[S])}function X$(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var nde=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),ode=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Vp(r){return ode.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}var Z$=null;function Y$(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var b1=null,M1=null;function rU(r){var c=Mt(r);if(c&&(r=c.stateNode)){var f=r[Ce]||null;e:switch(r=c.stateNode,c.type){case"input":if(U$(r,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name),c=f.name,f.type==="radio"&&c!=null){for(f=r;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll('input[name="'+ia(""+c)+'"][type="radio"]'),c=0;c<f.length;c++){var g=f[c];if(g!==r&&g.form===r.form){var w=g[Ce]||null;if(!w)throw Error(o(90));U$(g,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(c=0;c<f.length;c++)g=f[c],g.form===r.form&&JF(g)}break e;case"textarea":tU(r,f.value,f.defaultValue);break e;case"select":c=f.value,c!=null&&x1(r,!!f.multiple,c,!1)}}}var W$=!1;function iU(r,c,f){if(W$)return r(c,f);W$=!0;try{var g=r(c);return g}finally{if(W$=!1,(b1!==null||M1!==null)&&(Ny(),b1&&(c=b1,r=M1,M1=b1=null,rU(c),r)))for(c=0;c<r.length;c++)rU(r[c])}}function b2(r,c){var f=r.stateNode;if(f===null)return null;var g=f[Ce]||null;if(g===null)return null;f=g[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(r=r.type,g=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!g;break e;default:r=!1}if(r)return null;if(f&&typeof f!="function")throw Error(o(231,c,typeof f));return f}var zr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),K$=!1;if(zr)try{var M2={};Object.defineProperty(M2,"passive",{get:function(){K$=!0}}),window.addEventListener("test",M2,M2),window.removeEventListener("test",M2,M2)}catch{K$=!1}var wi=null,Q$=null,Bp=null;function sU(){if(Bp)return Bp;var r,c=Q$,f=c.length,g,w="value"in wi?wi.value:wi.textContent,S=w.length;for(r=0;r<f&&c[r]===w[r];r++);var $=f-r;for(g=1;g<=$&&c[f-g]===w[S-g];g++);return Bp=w.slice(r,1<g?1-g:void 0)}function Fp(r){var c=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&c===13&&(r=13)):r=c,r===10&&(r=13),32<=r||r===13?r:0}function Up(){return!0}function cU(){return!1}function So(r){function c(f,g,w,S,$){this._reactName=f,this._targetInst=w,this.type=g,this.nativeEvent=S,this.target=$,this.currentTarget=null;for(var B in r)r.hasOwnProperty(B)&&(f=r[B],this[B]=f?f(S):S[B]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?Up:cU,this.isPropagationStopped=cU,this}return p(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var f=this.nativeEvent;f&&(f.preventDefault?f.preventDefault():typeof f.returnValue!="unknown"&&(f.returnValue=!1),this.isDefaultPrevented=Up)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=Up)},persist:function(){},isPersistent:Up}),c}var Bs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gp=So(Bs),_2=p({},Bs,{view:0,detail:0}),ade=So(_2),J$,eD,S2,Xp=p({},_2,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nD,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==S2&&(S2&&r.type==="mousemove"?(J$=r.screenX-S2.screenX,eD=r.screenY-S2.screenY):eD=J$=0,S2=r),J$)},movementY:function(r){return"movementY"in r?r.movementY:eD}}),lU=So(Xp),rde=p({},Xp,{dataTransfer:0}),ide=So(rde),sde=p({},_2,{relatedTarget:0}),tD=So(sde),cde=p({},Bs,{animationName:0,elapsedTime:0,pseudoElement:0}),lde=So(cde),ude=p({},Bs,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),dde=So(ude),hde=p({},Bs,{data:0}),uU=So(hde),fde={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pde={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},yde={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function mde(r){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(r):(r=yde[r])?!!c[r]:!1}function nD(){return mde}var gde=p({},_2,{key:function(r){if(r.key){var c=fde[r.key]||r.key;if(c!=="Unidentified")return c}return r.type==="keypress"?(r=Fp(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?pde[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nD,charCode:function(r){return r.type==="keypress"?Fp(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Fp(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),vde=So(gde),kde=p({},Xp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),dU=So(kde),xde=p({},_2,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nD}),wde=So(xde),bde=p({},Bs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Mde=So(bde),_de=p({},Xp,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Sde=So(_de),Cde=p({},Bs,{newState:0,oldState:0}),Nde=So(Cde),Lde=[9,13,27,32],oD=zr&&"CompositionEvent"in window,C2=null;zr&&"documentMode"in document&&(C2=document.documentMode);var jde=zr&&"TextEvent"in window&&!C2,hU=zr&&(!oD||C2&&8<C2&&11>=C2),fU=" ",pU=!1;function yU(r,c){switch(r){case"keyup":return Lde.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function mU(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var _1=!1;function Ade(r,c){switch(r){case"compositionend":return mU(c);case"keypress":return c.which!==32?null:(pU=!0,fU);case"textInput":return r=c.data,r===fU&&pU?null:r;default:return null}}function Ede(r,c){if(_1)return r==="compositionend"||!oD&&yU(r,c)?(r=sU(),Bp=Q$=wi=null,_1=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return hU&&c.locale!=="ko"?null:c.data;default:return null}}var Ide={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function gU(r){var c=r&&r.nodeName&&r.nodeName.toLowerCase();return c==="input"?!!Ide[r.type]:c==="textarea"}function vU(r,c,f,g){b1?M1?M1.push(g):M1=[g]:b1=g,c=Ty(c,"onChange"),0<c.length&&(f=new Gp("onChange","change",null,f,g),r.push({event:f,listeners:c}))}var N2=null,L2=null;function Tde(r){QX(r,0)}function Zp(r){var c=Vt(r);if(JF(c))return r}function kU(r,c){if(r==="change")return c}var xU=!1;if(zr){var aD;if(zr){var rD="oninput"in document;if(!rD){var wU=document.createElement("div");wU.setAttribute("oninput","return;"),rD=typeof wU.oninput=="function"}aD=rD}else aD=!1;xU=aD&&(!document.documentMode||9<document.documentMode)}function bU(){N2&&(N2.detachEvent("onpropertychange",MU),L2=N2=null)}function MU(r){if(r.propertyName==="value"&&Zp(L2)){var c=[];vU(c,L2,r,Y$(r)),iU(Tde,c)}}function Rde(r,c,f){r==="focusin"?(bU(),N2=c,L2=f,N2.attachEvent("onpropertychange",MU)):r==="focusout"&&bU()}function Pde(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Zp(L2)}function $de(r,c){if(r==="click")return Zp(c)}function Dde(r,c){if(r==="input"||r==="change")return Zp(c)}function zde(r,c){return r===c&&(r!==0||1/r===1/c)||r!==r&&c!==c}var Oo=typeof Object.is=="function"?Object.is:zde;function j2(r,c){if(Oo(r,c))return!0;if(typeof r!="object"||r===null||typeof c!="object"||c===null)return!1;var f=Object.keys(r),g=Object.keys(c);if(f.length!==g.length)return!1;for(g=0;g<f.length;g++){var w=f[g];if(!Ie.call(c,w)||!Oo(r[w],c[w]))return!1}return!0}function _U(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function SU(r,c){var f=_U(r);r=0;for(var g;f;){if(f.nodeType===3){if(g=r+f.textContent.length,r<=c&&g>=c)return{node:f,offset:c-r};r=g}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=_U(f)}}function CU(r,c){return r&&c?r===c?!0:r&&r.nodeType===3?!1:c&&c.nodeType===3?CU(r,c.parentNode):"contains"in r?r.contains(c):r.compareDocumentPosition?!!(r.compareDocumentPosition(c)&16):!1:!1}function NU(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var c=Hp(r.document);c instanceof r.HTMLIFrameElement;){try{var f=typeof c.contentWindow.location.href=="string"}catch{f=!1}if(f)r=c.contentWindow;else break;c=Hp(r.document)}return c}function iD(r){var c=r&&r.nodeName&&r.nodeName.toLowerCase();return c&&(c==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||c==="textarea"||r.contentEditable==="true")}var Ode=zr&&"documentMode"in document&&11>=document.documentMode,S1=null,sD=null,A2=null,cD=!1;function LU(r,c,f){var g=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;cD||S1==null||S1!==Hp(g)||(g=S1,"selectionStart"in g&&iD(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),A2&&j2(A2,g)||(A2=g,g=Ty(sD,"onSelect"),0<g.length&&(c=new Gp("onSelect","select",null,c,f),r.push({event:c,listeners:g}),c.target=S1)))}function Fs(r,c){var f={};return f[r.toLowerCase()]=c.toLowerCase(),f["Webkit"+r]="webkit"+c,f["Moz"+r]="moz"+c,f}var C1={animationend:Fs("Animation","AnimationEnd"),animationiteration:Fs("Animation","AnimationIteration"),animationstart:Fs("Animation","AnimationStart"),transitionrun:Fs("Transition","TransitionRun"),transitionstart:Fs("Transition","TransitionStart"),transitioncancel:Fs("Transition","TransitionCancel"),transitionend:Fs("Transition","TransitionEnd")},lD={},jU={};zr&&(jU=document.createElement("div").style,"AnimationEvent"in window||(delete C1.animationend.animation,delete C1.animationiteration.animation,delete C1.animationstart.animation),"TransitionEvent"in window||delete C1.transitionend.transition);function Us(r){if(lD[r])return lD[r];if(!C1[r])return r;var c=C1[r],f;for(f in c)if(c.hasOwnProperty(f)&&f in jU)return lD[r]=c[f];return r}var AU=Us("animationend"),EU=Us("animationiteration"),IU=Us("animationstart"),qde=Us("transitionrun"),Hde=Us("transitionstart"),Vde=Us("transitioncancel"),TU=Us("transitionend"),RU=new Map,uD="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");uD.push("scrollEnd");function Aa(r,c){RU.set(r,c),to(c,[r])}var PU=new WeakMap;function sa(r,c){if(typeof r=="object"&&r!==null){var f=PU.get(r);return f!==void 0?f:(c={value:r,source:c,stack:w2(c)},PU.set(r,c),c)}return{value:r,source:c,stack:w2(c)}}var ca=[],N1=0,dD=0;function Yp(){for(var r=N1,c=dD=N1=0;c<r;){var f=ca[c];ca[c++]=null;var g=ca[c];ca[c++]=null;var w=ca[c];ca[c++]=null;var S=ca[c];if(ca[c++]=null,g!==null&&w!==null){var $=g.pending;$===null?w.next=w:(w.next=$.next,$.next=w),g.pending=w}S!==0&&$U(f,w,S)}}function Wp(r,c,f,g){ca[N1++]=r,ca[N1++]=c,ca[N1++]=f,ca[N1++]=g,dD|=g,r.lanes|=g,r=r.alternate,r!==null&&(r.lanes|=g)}function hD(r,c,f,g){return Wp(r,c,f,g),Kp(r)}function L1(r,c){return Wp(r,null,null,c),Kp(r)}function $U(r,c,f){r.lanes|=f;var g=r.alternate;g!==null&&(g.lanes|=f);for(var w=!1,S=r.return;S!==null;)S.childLanes|=f,g=S.alternate,g!==null&&(g.childLanes|=f),S.tag===22&&(r=S.stateNode,r===null||r._visibility&1||(w=!0)),r=S,S=S.return;return r.tag===3?(S=r.stateNode,w&&c!==null&&(w=31-He(f),r=S.hiddenUpdates,g=r[w],g===null?r[w]=[c]:g.push(c),c.lane=f|536870912),S):null}function Kp(r){if(50<tf)throw tf=0,vz=null,Error(o(185));for(var c=r.return;c!==null;)r=c,c=r.return;return r.tag===3?r.stateNode:null}var j1={};function Bde(r,c,f,g){this.tag=r,this.key=f,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qo(r,c,f,g){return new Bde(r,c,f,g)}function fD(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Or(r,c){var f=r.alternate;return f===null?(f=qo(r.tag,c,r.key,r.mode),f.elementType=r.elementType,f.type=r.type,f.stateNode=r.stateNode,f.alternate=r,r.alternate=f):(f.pendingProps=c,f.type=r.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=r.flags&65011712,f.childLanes=r.childLanes,f.lanes=r.lanes,f.child=r.child,f.memoizedProps=r.memoizedProps,f.memoizedState=r.memoizedState,f.updateQueue=r.updateQueue,c=r.dependencies,f.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},f.sibling=r.sibling,f.index=r.index,f.ref=r.ref,f.refCleanup=r.refCleanup,f}function DU(r,c){r.flags&=65011714;var f=r.alternate;return f===null?(r.childLanes=0,r.lanes=c,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=f.childLanes,r.lanes=f.lanes,r.child=f.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=f.memoizedProps,r.memoizedState=f.memoizedState,r.updateQueue=f.updateQueue,r.type=f.type,c=f.dependencies,r.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),r}function Qp(r,c,f,g,w,S){var $=0;if(g=r,typeof r=="function")fD(r)&&($=1);else if(typeof r=="string")$=U1e(r,f,K.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case U:return r=qo(31,f,c,w),r.elementType=U,r.lanes=S,r;case M:return Gs(f.children,w,S,c);case b:$=8,w|=24;break;case C:return r=qo(12,f,c,w|2),r.elementType=C,r.lanes=S,r;case R:return r=qo(13,f,c,w),r.elementType=R,r.lanes=S,r;case j:return r=qo(19,f,c,w),r.elementType=j,r.lanes=S,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case _:case A:$=10;break e;case N:$=9;break e;case I:$=11;break e;case D:$=14;break e;case H:$=16,g=null;break e}$=29,f=Error(o(130,r===null?"null":typeof r,"")),g=null}return c=qo($,f,c,w),c.elementType=r,c.type=g,c.lanes=S,c}function Gs(r,c,f,g){return r=qo(7,r,g,c),r.lanes=f,r}function pD(r,c,f){return r=qo(6,r,null,c),r.lanes=f,r}function yD(r,c,f){return c=qo(4,r.children!==null?r.children:[],r.key,c),c.lanes=f,c.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},c}var A1=[],E1=0,Jp=null,ey=0,la=[],ua=0,Xs=null,qr=1,Hr="";function Zs(r,c){A1[E1++]=ey,A1[E1++]=Jp,Jp=r,ey=c}function zU(r,c,f){la[ua++]=qr,la[ua++]=Hr,la[ua++]=Xs,Xs=r;var g=qr;r=Hr;var w=32-He(g)-1;g&=~(1<<w),f+=1;var S=32-He(c)+w;if(30<S){var $=w-w%5;S=(g&(1<<$)-1).toString(32),g>>=$,w-=$,qr=1<<32-He(c)+w|f<<w|g,Hr=S+r}else qr=1<<S|f<<w|g,Hr=r}function mD(r){r.return!==null&&(Zs(r,1),zU(r,1,0))}function gD(r){for(;r===Jp;)Jp=A1[--E1],A1[E1]=null,ey=A1[--E1],A1[E1]=null;for(;r===Xs;)Xs=la[--ua],la[ua]=null,Hr=la[--ua],la[ua]=null,qr=la[--ua],la[ua]=null}var fo=null,hn=null,Et=!1,Ys=null,rr=!1,vD=Error(o(519));function Ws(r){var c=Error(o(418,""));throw T2(sa(c,r)),vD}function OU(r){var c=r.stateNode,f=r.type,g=r.memoizedProps;switch(c[xe]=r,c[Ce]=g,f){case"dialog":bt("cancel",c),bt("close",c);break;case"iframe":case"object":case"embed":bt("load",c);break;case"video":case"audio":for(f=0;f<of.length;f++)bt(of[f],c);break;case"source":bt("error",c);break;case"img":case"image":case"link":bt("error",c),bt("load",c);break;case"details":bt("toggle",c);break;case"input":bt("invalid",c),eU(c,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0),qp(c);break;case"select":bt("invalid",c);break;case"textarea":bt("invalid",c),nU(c,g.value,g.defaultValue,g.children),qp(c)}f=g.children,typeof f!="string"&&typeof f!="number"&&typeof f!="bigint"||c.textContent===""+f||g.suppressHydrationWarning===!0||nZ(c.textContent,f)?(g.popover!=null&&(bt("beforetoggle",c),bt("toggle",c)),g.onScroll!=null&&bt("scroll",c),g.onScrollEnd!=null&&bt("scrollend",c),g.onClick!=null&&(c.onclick=Ry),c=!0):c=!1,c||Ws(r)}function qU(r){for(fo=r.return;fo;)switch(fo.tag){case 5:case 13:rr=!1;return;case 27:case 3:rr=!0;return;default:fo=fo.return}}function E2(r){if(r!==fo)return!1;if(!Et)return qU(r),Et=!0,!1;var c=r.tag,f;if((f=c!==3&&c!==27)&&((f=c===5)&&(f=r.type,f=!(f!=="form"&&f!=="button")||Rz(r.type,r.memoizedProps)),f=!f),f&&hn&&Ws(r),qU(r),c===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(o(317));e:{for(r=r.nextSibling,c=0;r;){if(r.nodeType===8)if(f=r.data,f==="/$"){if(c===0){hn=Ia(r.nextSibling);break e}c--}else f!=="$"&&f!=="$!"&&f!=="$?"||c++;r=r.nextSibling}hn=null}}else c===27?(c=hn,Di(r.type)?(r=zz,zz=null,hn=r):hn=c):hn=fo?Ia(r.stateNode.nextSibling):null;return!0}function I2(){hn=fo=null,Et=!1}function HU(){var r=Ys;return r!==null&&(Lo===null?Lo=r:Lo.push.apply(Lo,r),Ys=null),r}function T2(r){Ys===null?Ys=[r]:Ys.push(r)}var kD=Y(null),Ks=null,Vr=null;function bi(r,c,f){T(kD,c._currentValue),c._currentValue=f}function Br(r){r._currentValue=kD.current,F(kD)}function xD(r,c,f){for(;r!==null;){var g=r.alternate;if((r.childLanes&c)!==c?(r.childLanes|=c,g!==null&&(g.childLanes|=c)):g!==null&&(g.childLanes&c)!==c&&(g.childLanes|=c),r===f)break;r=r.return}}function wD(r,c,f,g){var w=r.child;for(w!==null&&(w.return=r);w!==null;){var S=w.dependencies;if(S!==null){var $=w.child;S=S.firstContext;e:for(;S!==null;){var B=S;S=w;for(var J=0;J<c.length;J++)if(B.context===c[J]){S.lanes|=f,B=S.alternate,B!==null&&(B.lanes|=f),xD(S.return,f,r),g||($=null);break e}S=B.next}}else if(w.tag===18){if($=w.return,$===null)throw Error(o(341));$.lanes|=f,S=$.alternate,S!==null&&(S.lanes|=f),xD($,f,r),$=null}else $=w.child;if($!==null)$.return=w;else for($=w;$!==null;){if($===r){$=null;break}if(w=$.sibling,w!==null){w.return=$.return,$=w;break}$=$.return}w=$}}function R2(r,c,f,g){r=null;for(var w=c,S=!1;w!==null;){if(!S){if((w.flags&524288)!==0)S=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var $=w.alternate;if($===null)throw Error(o(387));if($=$.memoizedProps,$!==null){var B=w.type;Oo(w.pendingProps.value,$.value)||(r!==null?r.push(B):r=[B])}}else if(w===te.current){if($=w.alternate,$===null)throw Error(o(387));$.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(r!==null?r.push(uf):r=[uf])}w=w.return}r!==null&&wD(c,r,f,g),c.flags|=262144}function ty(r){for(r=r.firstContext;r!==null;){if(!Oo(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Qs(r){Ks=r,Vr=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function co(r){return VU(Ks,r)}function ny(r,c){return Ks===null&&Qs(r),VU(r,c)}function VU(r,c){var f=c._currentValue;if(c={context:c,memoizedValue:f,next:null},Vr===null){if(r===null)throw Error(o(308));Vr=c,r.dependencies={lanes:0,firstContext:c},r.flags|=524288}else Vr=Vr.next=c;return f}var Fde=typeof AbortController<"u"?AbortController:function(){var r=[],c=this.signal={aborted:!1,addEventListener:function(f,g){r.push(g)}};this.abort=function(){c.aborted=!0,r.forEach(function(f){return f()})}},Ude=e.unstable_scheduleCallback,Gde=e.unstable_NormalPriority,Hn={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bD(){return{controller:new Fde,data:new Map,refCount:0}}function P2(r){r.refCount--,r.refCount===0&&Ude(Gde,function(){r.controller.abort()})}var $2=null,MD=0,I1=0,T1=null;function Xde(r,c){if($2===null){var f=$2=[];MD=0,I1=Sz(),T1={status:"pending",value:void 0,then:function(g){f.push(g)}}}return MD++,c.then(BU,BU),c}function BU(){if(--MD===0&&$2!==null){T1!==null&&(T1.status="fulfilled");var r=$2;$2=null,I1=0,T1=null;for(var c=0;c<r.length;c++)(0,r[c])()}}function Zde(r,c){var f=[],g={status:"pending",value:null,reason:null,then:function(w){f.push(w)}};return r.then(function(){g.status="fulfilled",g.value=c;for(var w=0;w<f.length;w++)(0,f[w])(c)},function(w){for(g.status="rejected",g.reason=w,w=0;w<f.length;w++)(0,f[w])(void 0)}),g}var FU=P.S;P.S=function(r,c){typeof c=="object"&&c!==null&&typeof c.then=="function"&&Xde(r,c),FU!==null&&FU(r,c)};var Js=Y(null);function _D(){var r=Js.current;return r!==null?r:Ft.pooledCache}function oy(r,c){c===null?T(Js,Js.current):T(Js,c.pool)}function UU(){var r=_D();return r===null?null:{parent:Hn._currentValue,pool:r}}var D2=Error(o(460)),GU=Error(o(474)),ay=Error(o(542)),SD={then:function(){}};function XU(r){return r=r.status,r==="fulfilled"||r==="rejected"}function ry(){}function ZU(r,c,f){switch(f=r[f],f===void 0?r.push(c):f!==c&&(c.then(ry,ry),c=f),c.status){case"fulfilled":return c.value;case"rejected":throw r=c.reason,WU(r),r;default:if(typeof c.status=="string")c.then(ry,ry);else{if(r=Ft,r!==null&&100<r.shellSuspendCounter)throw Error(o(482));r=c,r.status="pending",r.then(function(g){if(c.status==="pending"){var w=c;w.status="fulfilled",w.value=g}},function(g){if(c.status==="pending"){var w=c;w.status="rejected",w.reason=g}})}switch(c.status){case"fulfilled":return c.value;case"rejected":throw r=c.reason,WU(r),r}throw z2=c,D2}}var z2=null;function YU(){if(z2===null)throw Error(o(459));var r=z2;return z2=null,r}function WU(r){if(r===D2||r===ay)throw Error(o(483))}var Mi=!1;function CD(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ND(r,c){r=r.updateQueue,c.updateQueue===r&&(c.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function _i(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Si(r,c,f){var g=r.updateQueue;if(g===null)return null;if(g=g.shared,(Pt&2)!==0){var w=g.pending;return w===null?c.next=c:(c.next=w.next,w.next=c),g.pending=c,c=Kp(r),$U(r,null,f),c}return Wp(r,g,c,f),Kp(r)}function O2(r,c,f){if(c=c.updateQueue,c!==null&&(c=c.shared,(f&4194048)!==0)){var g=c.lanes;g&=r.pendingLanes,f|=g,c.lanes=f,$r(r,f)}}function LD(r,c){var f=r.updateQueue,g=r.alternate;if(g!==null&&(g=g.updateQueue,f===g)){var w=null,S=null;if(f=f.firstBaseUpdate,f!==null){do{var $={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};S===null?w=S=$:S=S.next=$,f=f.next}while(f!==null);S===null?w=S=c:S=S.next=c}else w=S=c;f={baseState:g.baseState,firstBaseUpdate:w,lastBaseUpdate:S,shared:g.shared,callbacks:g.callbacks},r.updateQueue=f;return}r=f.lastBaseUpdate,r===null?f.firstBaseUpdate=c:r.next=c,f.lastBaseUpdate=c}var jD=!1;function q2(){if(jD){var r=T1;if(r!==null)throw r}}function H2(r,c,f,g){jD=!1;var w=r.updateQueue;Mi=!1;var S=w.firstBaseUpdate,$=w.lastBaseUpdate,B=w.shared.pending;if(B!==null){w.shared.pending=null;var J=B,se=J.next;J.next=null,$===null?S=se:$.next=se,$=J;var ye=r.alternate;ye!==null&&(ye=ye.updateQueue,B=ye.lastBaseUpdate,B!==$&&(B===null?ye.firstBaseUpdate=se:B.next=se,ye.lastBaseUpdate=J))}if(S!==null){var we=w.baseState;$=0,ye=se=J=null,B=S;do{var ue=B.lane&-536870913,he=ue!==B.lane;if(he?(Ct&ue)===ue:(g&ue)===ue){ue!==0&&ue===I1&&(jD=!0),ye!==null&&(ye=ye.next={lane:0,tag:B.tag,payload:B.payload,callback:null,next:null});e:{var at=r,Je=B;ue=c;var Ht=f;switch(Je.tag){case 1:if(at=Je.payload,typeof at=="function"){we=at.call(Ht,we,ue);break e}we=at;break e;case 3:at.flags=at.flags&-65537|128;case 0:if(at=Je.payload,ue=typeof at=="function"?at.call(Ht,we,ue):at,ue==null)break e;we=p({},we,ue);break e;case 2:Mi=!0}}ue=B.callback,ue!==null&&(r.flags|=64,he&&(r.flags|=8192),he=w.callbacks,he===null?w.callbacks=[ue]:he.push(ue))}else he={lane:ue,tag:B.tag,payload:B.payload,callback:B.callback,next:null},ye===null?(se=ye=he,J=we):ye=ye.next=he,$|=ue;if(B=B.next,B===null){if(B=w.shared.pending,B===null)break;he=B,B=he.next,he.next=null,w.lastBaseUpdate=he,w.shared.pending=null}}while(!0);ye===null&&(J=we),w.baseState=J,w.firstBaseUpdate=se,w.lastBaseUpdate=ye,S===null&&(w.shared.lanes=0),Ti|=$,r.lanes=$,r.memoizedState=we}}function KU(r,c){if(typeof r!="function")throw Error(o(191,r));r.call(c)}function QU(r,c){var f=r.callbacks;if(f!==null)for(r.callbacks=null,r=0;r<f.length;r++)KU(f[r],c)}var R1=Y(null),iy=Y(0);function JU(r,c){r=Wr,T(iy,r),T(R1,c),Wr=r|c.baseLanes}function AD(){T(iy,Wr),T(R1,R1.current)}function ED(){Wr=iy.current,F(R1),F(iy)}var Ci=0,pt=null,Ot=null,In=null,sy=!1,P1=!1,ec=!1,cy=0,V2=0,$1=null,Yde=0;function Mn(){throw Error(o(321))}function ID(r,c){if(c===null)return!1;for(var f=0;f<c.length&&f<r.length;f++)if(!Oo(r[f],c[f]))return!1;return!0}function TD(r,c,f,g,w,S){return Ci=S,pt=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,P.H=r===null||r.memoizedState===null?$G:DG,ec=!1,S=f(g,w),ec=!1,P1&&(S=tG(c,f,g,w)),eG(r),S}function eG(r){P.H=py;var c=Ot!==null&&Ot.next!==null;if(Ci=0,In=Ot=pt=null,sy=!1,V2=0,$1=null,c)throw Error(o(300));r===null||Xn||(r=r.dependencies,r!==null&&ty(r)&&(Xn=!0))}function tG(r,c,f,g){pt=r;var w=0;do{if(P1&&($1=null),V2=0,P1=!1,25<=w)throw Error(o(301));if(w+=1,In=Ot=null,r.updateQueue!=null){var S=r.updateQueue;S.lastEffect=null,S.events=null,S.stores=null,S.memoCache!=null&&(S.memoCache.index=0)}P.H=n1e,S=c(f,g)}while(P1);return S}function Wde(){var r=P.H,c=r.useState()[0];return c=typeof c.then=="function"?B2(c):c,r=r.useState()[0],(Ot!==null?Ot.memoizedState:null)!==r&&(pt.flags|=1024),c}function RD(){var r=cy!==0;return cy=0,r}function PD(r,c,f){c.updateQueue=r.updateQueue,c.flags&=-2053,r.lanes&=~f}function $D(r){if(sy){for(r=r.memoizedState;r!==null;){var c=r.queue;c!==null&&(c.pending=null),r=r.next}sy=!1}Ci=0,In=Ot=pt=null,P1=!1,V2=cy=0,$1=null}function Co(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return In===null?pt.memoizedState=In=r:In=In.next=r,In}function Tn(){if(Ot===null){var r=pt.alternate;r=r!==null?r.memoizedState:null}else r=Ot.next;var c=In===null?pt.memoizedState:In.next;if(c!==null)In=c,Ot=r;else{if(r===null)throw pt.alternate===null?Error(o(467)):Error(o(310));Ot=r,r={memoizedState:Ot.memoizedState,baseState:Ot.baseState,baseQueue:Ot.baseQueue,queue:Ot.queue,next:null},In===null?pt.memoizedState=In=r:In=In.next=r}return In}function DD(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function B2(r){var c=V2;return V2+=1,$1===null&&($1=[]),r=ZU($1,r,c),c=pt,(In===null?c.memoizedState:In.next)===null&&(c=c.alternate,P.H=c===null||c.memoizedState===null?$G:DG),r}function ly(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return B2(r);if(r.$$typeof===A)return co(r)}throw Error(o(438,String(r)))}function zD(r){var c=null,f=pt.updateQueue;if(f!==null&&(c=f.memoCache),c==null){var g=pt.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(c={data:g.data.map(function(w){return w.slice()}),index:0})))}if(c==null&&(c={data:[],index:0}),f===null&&(f=DD(),pt.updateQueue=f),f.memoCache=c,f=c.data[c.index],f===void 0)for(f=c.data[c.index]=Array(r),g=0;g<r;g++)f[g]=z;return c.index++,f}function Fr(r,c){return typeof c=="function"?c(r):c}function uy(r){var c=Tn();return OD(c,Ot,r)}function OD(r,c,f){var g=r.queue;if(g===null)throw Error(o(311));g.lastRenderedReducer=f;var w=r.baseQueue,S=g.pending;if(S!==null){if(w!==null){var $=w.next;w.next=S.next,S.next=$}c.baseQueue=w=S,g.pending=null}if(S=r.baseState,w===null)r.memoizedState=S;else{c=w.next;var B=$=null,J=null,se=c,ye=!1;do{var we=se.lane&-536870913;if(we!==se.lane?(Ct&we)===we:(Ci&we)===we){var ue=se.revertLane;if(ue===0)J!==null&&(J=J.next={lane:0,revertLane:0,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null}),we===I1&&(ye=!0);else if((Ci&ue)===ue){se=se.next,ue===I1&&(ye=!0);continue}else we={lane:0,revertLane:se.revertLane,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},J===null?(B=J=we,$=S):J=J.next=we,pt.lanes|=ue,Ti|=ue;we=se.action,ec&&f(S,we),S=se.hasEagerState?se.eagerState:f(S,we)}else ue={lane:we,revertLane:se.revertLane,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},J===null?(B=J=ue,$=S):J=J.next=ue,pt.lanes|=we,Ti|=we;se=se.next}while(se!==null&&se!==c);if(J===null?$=S:J.next=B,!Oo(S,r.memoizedState)&&(Xn=!0,ye&&(f=T1,f!==null)))throw f;r.memoizedState=S,r.baseState=$,r.baseQueue=J,g.lastRenderedState=S}return w===null&&(g.lanes=0),[r.memoizedState,g.dispatch]}function qD(r){var c=Tn(),f=c.queue;if(f===null)throw Error(o(311));f.lastRenderedReducer=r;var g=f.dispatch,w=f.pending,S=c.memoizedState;if(w!==null){f.pending=null;var $=w=w.next;do S=r(S,$.action),$=$.next;while($!==w);Oo(S,c.memoizedState)||(Xn=!0),c.memoizedState=S,c.baseQueue===null&&(c.baseState=S),f.lastRenderedState=S}return[S,g]}function nG(r,c,f){var g=pt,w=Tn(),S=Et;if(S){if(f===void 0)throw Error(o(407));f=f()}else f=c();var $=!Oo((Ot||w).memoizedState,f);$&&(w.memoizedState=f,Xn=!0),w=w.queue;var B=rG.bind(null,g,w,r);if(F2(2048,8,B,[r]),w.getSnapshot!==c||$||In!==null&&In.memoizedState.tag&1){if(g.flags|=2048,D1(9,dy(),aG.bind(null,g,w,f,c),null),Ft===null)throw Error(o(349));S||(Ci&124)!==0||oG(g,c,f)}return f}function oG(r,c,f){r.flags|=16384,r={getSnapshot:c,value:f},c=pt.updateQueue,c===null?(c=DD(),pt.updateQueue=c,c.stores=[r]):(f=c.stores,f===null?c.stores=[r]:f.push(r))}function aG(r,c,f,g){c.value=f,c.getSnapshot=g,iG(c)&&sG(r)}function rG(r,c,f){return f(function(){iG(c)&&sG(r)})}function iG(r){var c=r.getSnapshot;r=r.value;try{var f=c();return!Oo(r,f)}catch{return!0}}function sG(r){var c=L1(r,2);c!==null&&Uo(c,r,2)}function HD(r){var c=Co();if(typeof r=="function"){var f=r;if(r=f(),ec){Oe(!0);try{f()}finally{Oe(!1)}}}return c.memoizedState=c.baseState=r,c.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fr,lastRenderedState:r},c}function cG(r,c,f,g){return r.baseState=f,OD(r,Ot,typeof g=="function"?g:Fr)}function Kde(r,c,f,g,w){if(fy(r))throw Error(o(485));if(r=c.action,r!==null){var S={payload:w,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function($){S.listeners.push($)}};P.T!==null?f(!0):S.isTransition=!1,g(S),f=c.pending,f===null?(S.next=c.pending=S,lG(c,S)):(S.next=f.next,c.pending=f.next=S)}}function lG(r,c){var f=c.action,g=c.payload,w=r.state;if(c.isTransition){var S=P.T,$={};P.T=$;try{var B=f(w,g),J=P.S;J!==null&&J($,B),uG(r,c,B)}catch(se){VD(r,c,se)}finally{P.T=S}}else try{S=f(w,g),uG(r,c,S)}catch(se){VD(r,c,se)}}function uG(r,c,f){f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(function(g){dG(r,c,g)},function(g){return VD(r,c,g)}):dG(r,c,f)}function dG(r,c,f){c.status="fulfilled",c.value=f,hG(c),r.state=f,c=r.pending,c!==null&&(f=c.next,f===c?r.pending=null:(f=f.next,c.next=f,lG(r,f)))}function VD(r,c,f){var g=r.pending;if(r.pending=null,g!==null){g=g.next;do c.status="rejected",c.reason=f,hG(c),c=c.next;while(c!==g)}r.action=null}function hG(r){r=r.listeners;for(var c=0;c<r.length;c++)(0,r[c])()}function fG(r,c){return c}function pG(r,c){if(Et){var f=Ft.formState;if(f!==null){e:{var g=pt;if(Et){if(hn){t:{for(var w=hn,S=rr;w.nodeType!==8;){if(!S){w=null;break t}if(w=Ia(w.nextSibling),w===null){w=null;break t}}S=w.data,w=S==="F!"||S==="F"?w:null}if(w){hn=Ia(w.nextSibling),g=w.data==="F!";break e}}Ws(g)}g=!1}g&&(c=f[0])}}return f=Co(),f.memoizedState=f.baseState=c,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fG,lastRenderedState:c},f.queue=g,f=TG.bind(null,pt,g),g.dispatch=f,g=HD(!1),S=XD.bind(null,pt,!1,g.queue),g=Co(),w={state:c,dispatch:null,action:r,pending:null},g.queue=w,f=Kde.bind(null,pt,w,S,f),w.dispatch=f,g.memoizedState=r,[c,f,!1]}function yG(r){var c=Tn();return mG(c,Ot,r)}function mG(r,c,f){if(c=OD(r,c,fG)[0],r=uy(Fr)[0],typeof c=="object"&&c!==null&&typeof c.then=="function")try{var g=B2(c)}catch($){throw $===D2?ay:$}else g=c;c=Tn();var w=c.queue,S=w.dispatch;return f!==c.memoizedState&&(pt.flags|=2048,D1(9,dy(),Qde.bind(null,w,f),null)),[g,S,r]}function Qde(r,c){r.action=c}function gG(r){var c=Tn(),f=Ot;if(f!==null)return mG(c,f,r);Tn(),c=c.memoizedState,f=Tn();var g=f.queue.dispatch;return f.memoizedState=r,[c,g,!1]}function D1(r,c,f,g){return r={tag:r,create:f,deps:g,inst:c,next:null},c=pt.updateQueue,c===null&&(c=DD(),pt.updateQueue=c),f=c.lastEffect,f===null?c.lastEffect=r.next=r:(g=f.next,f.next=r,r.next=g,c.lastEffect=r),r}function dy(){return{destroy:void 0,resource:void 0}}function vG(){return Tn().memoizedState}function hy(r,c,f,g){var w=Co();g=g===void 0?null:g,pt.flags|=r,w.memoizedState=D1(1|c,dy(),f,g)}function F2(r,c,f,g){var w=Tn();g=g===void 0?null:g;var S=w.memoizedState.inst;Ot!==null&&g!==null&&ID(g,Ot.memoizedState.deps)?w.memoizedState=D1(c,S,f,g):(pt.flags|=r,w.memoizedState=D1(1|c,S,f,g))}function kG(r,c){hy(8390656,8,r,c)}function xG(r,c){F2(2048,8,r,c)}function wG(r,c){return F2(4,2,r,c)}function bG(r,c){return F2(4,4,r,c)}function MG(r,c){if(typeof c=="function"){r=r();var f=c(r);return function(){typeof f=="function"?f():c(null)}}if(c!=null)return r=r(),c.current=r,function(){c.current=null}}function _G(r,c,f){f=f!=null?f.concat([r]):null,F2(4,4,MG.bind(null,c,r),f)}function BD(){}function SG(r,c){var f=Tn();c=c===void 0?null:c;var g=f.memoizedState;return c!==null&&ID(c,g[1])?g[0]:(f.memoizedState=[r,c],r)}function CG(r,c){var f=Tn();c=c===void 0?null:c;var g=f.memoizedState;if(c!==null&&ID(c,g[1]))return g[0];if(g=r(),ec){Oe(!0);try{r()}finally{Oe(!1)}}return f.memoizedState=[g,c],g}function FD(r,c,f){return f===void 0||(Ci&1073741824)!==0?r.memoizedState=c:(r.memoizedState=f,r=jX(),pt.lanes|=r,Ti|=r,f)}function NG(r,c,f,g){return Oo(f,c)?f:R1.current!==null?(r=FD(r,f,g),Oo(r,c)||(Xn=!0),r):(Ci&42)===0?(Xn=!0,r.memoizedState=f):(r=jX(),pt.lanes|=r,Ti|=r,c)}function LG(r,c,f,g,w){var S=X.p;X.p=S!==0&&8>S?S:8;var $=P.T,B={};P.T=B,XD(r,!1,c,f);try{var J=w(),se=P.S;if(se!==null&&se(B,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var ye=Zde(J,g);U2(r,c,ye,Fo(r))}else U2(r,c,g,Fo(r))}catch(we){U2(r,c,{then:function(){},status:"rejected",reason:we},Fo())}finally{X.p=S,P.T=$}}function Jde(){}function UD(r,c,f,g){if(r.tag!==5)throw Error(o(476));var w=jG(r).queue;LG(r,w,c,W,f===null?Jde:function(){return AG(r),f(g)})}function jG(r){var c=r.memoizedState;if(c!==null)return c;c={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fr,lastRenderedState:W},next:null};var f={};return c.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fr,lastRenderedState:f},next:null},r.memoizedState=c,r=r.alternate,r!==null&&(r.memoizedState=c),c}function AG(r){var c=jG(r).next.queue;U2(r,c,{},Fo())}function GD(){return co(uf)}function EG(){return Tn().memoizedState}function IG(){return Tn().memoizedState}function e1e(r){for(var c=r.return;c!==null;){switch(c.tag){case 24:case 3:var f=Fo();r=_i(f);var g=Si(c,r,f);g!==null&&(Uo(g,c,f),O2(g,c,f)),c={cache:bD()},r.payload=c;return}c=c.return}}function t1e(r,c,f){var g=Fo();f={lane:g,revertLane:0,action:f,hasEagerState:!1,eagerState:null,next:null},fy(r)?RG(c,f):(f=hD(r,c,f,g),f!==null&&(Uo(f,r,g),PG(f,c,g)))}function TG(r,c,f){var g=Fo();U2(r,c,f,g)}function U2(r,c,f,g){var w={lane:g,revertLane:0,action:f,hasEagerState:!1,eagerState:null,next:null};if(fy(r))RG(c,w);else{var S=r.alternate;if(r.lanes===0&&(S===null||S.lanes===0)&&(S=c.lastRenderedReducer,S!==null))try{var $=c.lastRenderedState,B=S($,f);if(w.hasEagerState=!0,w.eagerState=B,Oo(B,$))return Wp(r,c,w,0),Ft===null&&Yp(),!1}catch{}finally{}if(f=hD(r,c,w,g),f!==null)return Uo(f,r,g),PG(f,c,g),!0}return!1}function XD(r,c,f,g){if(g={lane:2,revertLane:Sz(),action:g,hasEagerState:!1,eagerState:null,next:null},fy(r)){if(c)throw Error(o(479))}else c=hD(r,f,g,2),c!==null&&Uo(c,r,2)}function fy(r){var c=r.alternate;return r===pt||c!==null&&c===pt}function RG(r,c){P1=sy=!0;var f=r.pending;f===null?c.next=c:(c.next=f.next,f.next=c),r.pending=c}function PG(r,c,f){if((f&4194048)!==0){var g=c.lanes;g&=r.pendingLanes,f|=g,c.lanes=f,$r(r,f)}}var py={readContext:co,use:ly,useCallback:Mn,useContext:Mn,useEffect:Mn,useImperativeHandle:Mn,useLayoutEffect:Mn,useInsertionEffect:Mn,useMemo:Mn,useReducer:Mn,useRef:Mn,useState:Mn,useDebugValue:Mn,useDeferredValue:Mn,useTransition:Mn,useSyncExternalStore:Mn,useId:Mn,useHostTransitionStatus:Mn,useFormState:Mn,useActionState:Mn,useOptimistic:Mn,useMemoCache:Mn,useCacheRefresh:Mn},$G={readContext:co,use:ly,useCallback:function(r,c){return Co().memoizedState=[r,c===void 0?null:c],r},useContext:co,useEffect:kG,useImperativeHandle:function(r,c,f){f=f!=null?f.concat([r]):null,hy(4194308,4,MG.bind(null,c,r),f)},useLayoutEffect:function(r,c){return hy(4194308,4,r,c)},useInsertionEffect:function(r,c){hy(4,2,r,c)},useMemo:function(r,c){var f=Co();c=c===void 0?null:c;var g=r();if(ec){Oe(!0);try{r()}finally{Oe(!1)}}return f.memoizedState=[g,c],g},useReducer:function(r,c,f){var g=Co();if(f!==void 0){var w=f(c);if(ec){Oe(!0);try{f(c)}finally{Oe(!1)}}}else w=c;return g.memoizedState=g.baseState=w,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:w},g.queue=r,r=r.dispatch=t1e.bind(null,pt,r),[g.memoizedState,r]},useRef:function(r){var c=Co();return r={current:r},c.memoizedState=r},useState:function(r){r=HD(r);var c=r.queue,f=TG.bind(null,pt,c);return c.dispatch=f,[r.memoizedState,f]},useDebugValue:BD,useDeferredValue:function(r,c){var f=Co();return FD(f,r,c)},useTransition:function(){var r=HD(!1);return r=LG.bind(null,pt,r.queue,!0,!1),Co().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,c,f){var g=pt,w=Co();if(Et){if(f===void 0)throw Error(o(407));f=f()}else{if(f=c(),Ft===null)throw Error(o(349));(Ct&124)!==0||oG(g,c,f)}w.memoizedState=f;var S={value:f,getSnapshot:c};return w.queue=S,kG(rG.bind(null,g,S,r),[r]),g.flags|=2048,D1(9,dy(),aG.bind(null,g,S,f,c),null),f},useId:function(){var r=Co(),c=Ft.identifierPrefix;if(Et){var f=Hr,g=qr;f=(g&~(1<<32-He(g)-1)).toString(32)+f,c="«"+c+"R"+f,f=cy++,0<f&&(c+="H"+f.toString(32)),c+="»"}else f=Yde++,c="«"+c+"r"+f.toString(32)+"»";return r.memoizedState=c},useHostTransitionStatus:GD,useFormState:pG,useActionState:pG,useOptimistic:function(r){var c=Co();c.memoizedState=c.baseState=r;var f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return c.queue=f,c=XD.bind(null,pt,!0,f),f.dispatch=c,[r,c]},useMemoCache:zD,useCacheRefresh:function(){return Co().memoizedState=e1e.bind(null,pt)}},DG={readContext:co,use:ly,useCallback:SG,useContext:co,useEffect:xG,useImperativeHandle:_G,useInsertionEffect:wG,useLayoutEffect:bG,useMemo:CG,useReducer:uy,useRef:vG,useState:function(){return uy(Fr)},useDebugValue:BD,useDeferredValue:function(r,c){var f=Tn();return NG(f,Ot.memoizedState,r,c)},useTransition:function(){var r=uy(Fr)[0],c=Tn().memoizedState;return[typeof r=="boolean"?r:B2(r),c]},useSyncExternalStore:nG,useId:EG,useHostTransitionStatus:GD,useFormState:yG,useActionState:yG,useOptimistic:function(r,c){var f=Tn();return cG(f,Ot,r,c)},useMemoCache:zD,useCacheRefresh:IG},n1e={readContext:co,use:ly,useCallback:SG,useContext:co,useEffect:xG,useImperativeHandle:_G,useInsertionEffect:wG,useLayoutEffect:bG,useMemo:CG,useReducer:qD,useRef:vG,useState:function(){return qD(Fr)},useDebugValue:BD,useDeferredValue:function(r,c){var f=Tn();return Ot===null?FD(f,r,c):NG(f,Ot.memoizedState,r,c)},useTransition:function(){var r=qD(Fr)[0],c=Tn().memoizedState;return[typeof r=="boolean"?r:B2(r),c]},useSyncExternalStore:nG,useId:EG,useHostTransitionStatus:GD,useFormState:gG,useActionState:gG,useOptimistic:function(r,c){var f=Tn();return Ot!==null?cG(f,Ot,r,c):(f.baseState=r,[r,f.queue.dispatch])},useMemoCache:zD,useCacheRefresh:IG},z1=null,G2=0;function yy(r){var c=G2;return G2+=1,z1===null&&(z1=[]),ZU(z1,r,c)}function X2(r,c){c=c.props.ref,r.ref=c!==void 0?c:null}function my(r,c){throw c.$$typeof===m?Error(o(525)):(r=Object.prototype.toString.call(c),Error(o(31,r==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":r)))}function zG(r){var c=r._init;return c(r._payload)}function OG(r){function c(ae,oe){if(r){var ie=ae.deletions;ie===null?(ae.deletions=[oe],ae.flags|=16):ie.push(oe)}}function f(ae,oe){if(!r)return null;for(;oe!==null;)c(ae,oe),oe=oe.sibling;return null}function g(ae){for(var oe=new Map;ae!==null;)ae.key!==null?oe.set(ae.key,ae):oe.set(ae.index,ae),ae=ae.sibling;return oe}function w(ae,oe){return ae=Or(ae,oe),ae.index=0,ae.sibling=null,ae}function S(ae,oe,ie){return ae.index=ie,r?(ie=ae.alternate,ie!==null?(ie=ie.index,ie<oe?(ae.flags|=67108866,oe):ie):(ae.flags|=67108866,oe)):(ae.flags|=1048576,oe)}function $(ae){return r&&ae.alternate===null&&(ae.flags|=67108866),ae}function B(ae,oe,ie,ve){return oe===null||oe.tag!==6?(oe=pD(ie,ae.mode,ve),oe.return=ae,oe):(oe=w(oe,ie),oe.return=ae,oe)}function J(ae,oe,ie,ve){var $e=ie.type;return $e===M?ye(ae,oe,ie.props.children,ve,ie.key):oe!==null&&(oe.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===H&&zG($e)===oe.type)?(oe=w(oe,ie.props),X2(oe,ie),oe.return=ae,oe):(oe=Qp(ie.type,ie.key,ie.props,null,ae.mode,ve),X2(oe,ie),oe.return=ae,oe)}function se(ae,oe,ie,ve){return oe===null||oe.tag!==4||oe.stateNode.containerInfo!==ie.containerInfo||oe.stateNode.implementation!==ie.implementation?(oe=yD(ie,ae.mode,ve),oe.return=ae,oe):(oe=w(oe,ie.children||[]),oe.return=ae,oe)}function ye(ae,oe,ie,ve,$e){return oe===null||oe.tag!==7?(oe=Gs(ie,ae.mode,ve,$e),oe.return=ae,oe):(oe=w(oe,ie),oe.return=ae,oe)}function we(ae,oe,ie){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return oe=pD(""+oe,ae.mode,ie),oe.return=ae,oe;if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case v:return ie=Qp(oe.type,oe.key,oe.props,null,ae.mode,ie),X2(ie,oe),ie.return=ae,ie;case x:return oe=yD(oe,ae.mode,ie),oe.return=ae,oe;case H:var ve=oe._init;return oe=ve(oe._payload),we(ae,oe,ie)}if(O(oe)||q(oe))return oe=Gs(oe,ae.mode,ie,null),oe.return=ae,oe;if(typeof oe.then=="function")return we(ae,yy(oe),ie);if(oe.$$typeof===A)return we(ae,ny(ae,oe),ie);my(ae,oe)}return null}function ue(ae,oe,ie,ve){var $e=oe!==null?oe.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return $e!==null?null:B(ae,oe,""+ie,ve);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case v:return ie.key===$e?J(ae,oe,ie,ve):null;case x:return ie.key===$e?se(ae,oe,ie,ve):null;case H:return $e=ie._init,ie=$e(ie._payload),ue(ae,oe,ie,ve)}if(O(ie)||q(ie))return $e!==null?null:ye(ae,oe,ie,ve,null);if(typeof ie.then=="function")return ue(ae,oe,yy(ie),ve);if(ie.$$typeof===A)return ue(ae,oe,ny(ae,ie),ve);my(ae,ie)}return null}function he(ae,oe,ie,ve,$e){if(typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint")return ae=ae.get(ie)||null,B(oe,ae,""+ve,$e);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case v:return ae=ae.get(ve.key===null?ie:ve.key)||null,J(oe,ae,ve,$e);case x:return ae=ae.get(ve.key===null?ie:ve.key)||null,se(oe,ae,ve,$e);case H:var mt=ve._init;return ve=mt(ve._payload),he(ae,oe,ie,ve,$e)}if(O(ve)||q(ve))return ae=ae.get(ie)||null,ye(oe,ae,ve,$e,null);if(typeof ve.then=="function")return he(ae,oe,ie,yy(ve),$e);if(ve.$$typeof===A)return he(ae,oe,ie,ny(oe,ve),$e);my(oe,ve)}return null}function at(ae,oe,ie,ve){for(var $e=null,mt=null,Ge=oe,nt=oe=0,Yn=null;Ge!==null&&nt<ie.length;nt++){Ge.index>nt?(Yn=Ge,Ge=null):Yn=Ge.sibling;var Lt=ue(ae,Ge,ie[nt],ve);if(Lt===null){Ge===null&&(Ge=Yn);break}r&&Ge&&Lt.alternate===null&&c(ae,Ge),oe=S(Lt,oe,nt),mt===null?$e=Lt:mt.sibling=Lt,mt=Lt,Ge=Yn}if(nt===ie.length)return f(ae,Ge),Et&&Zs(ae,nt),$e;if(Ge===null){for(;nt<ie.length;nt++)Ge=we(ae,ie[nt],ve),Ge!==null&&(oe=S(Ge,oe,nt),mt===null?$e=Ge:mt.sibling=Ge,mt=Ge);return Et&&Zs(ae,nt),$e}for(Ge=g(Ge);nt<ie.length;nt++)Yn=he(Ge,ae,nt,ie[nt],ve),Yn!==null&&(r&&Yn.alternate!==null&&Ge.delete(Yn.key===null?nt:Yn.key),oe=S(Yn,oe,nt),mt===null?$e=Yn:mt.sibling=Yn,mt=Yn);return r&&Ge.forEach(function(Vi){return c(ae,Vi)}),Et&&Zs(ae,nt),$e}function Je(ae,oe,ie,ve){if(ie==null)throw Error(o(151));for(var $e=null,mt=null,Ge=oe,nt=oe=0,Yn=null,Lt=ie.next();Ge!==null&&!Lt.done;nt++,Lt=ie.next()){Ge.index>nt?(Yn=Ge,Ge=null):Yn=Ge.sibling;var Vi=ue(ae,Ge,Lt.value,ve);if(Vi===null){Ge===null&&(Ge=Yn);break}r&&Ge&&Vi.alternate===null&&c(ae,Ge),oe=S(Vi,oe,nt),mt===null?$e=Vi:mt.sibling=Vi,mt=Vi,Ge=Yn}if(Lt.done)return f(ae,Ge),Et&&Zs(ae,nt),$e;if(Ge===null){for(;!Lt.done;nt++,Lt=ie.next())Lt=we(ae,Lt.value,ve),Lt!==null&&(oe=S(Lt,oe,nt),mt===null?$e=Lt:mt.sibling=Lt,mt=Lt);return Et&&Zs(ae,nt),$e}for(Ge=g(Ge);!Lt.done;nt++,Lt=ie.next())Lt=he(Ge,ae,nt,Lt.value,ve),Lt!==null&&(r&&Lt.alternate!==null&&Ge.delete(Lt.key===null?nt:Lt.key),oe=S(Lt,oe,nt),mt===null?$e=Lt:mt.sibling=Lt,mt=Lt);return r&&Ge.forEach(function(ohe){return c(ae,ohe)}),Et&&Zs(ae,nt),$e}function Ht(ae,oe,ie,ve){if(typeof ie=="object"&&ie!==null&&ie.type===M&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case v:e:{for(var $e=ie.key;oe!==null;){if(oe.key===$e){if($e=ie.type,$e===M){if(oe.tag===7){f(ae,oe.sibling),ve=w(oe,ie.props.children),ve.return=ae,ae=ve;break e}}else if(oe.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===H&&zG($e)===oe.type){f(ae,oe.sibling),ve=w(oe,ie.props),X2(ve,ie),ve.return=ae,ae=ve;break e}f(ae,oe);break}else c(ae,oe);oe=oe.sibling}ie.type===M?(ve=Gs(ie.props.children,ae.mode,ve,ie.key),ve.return=ae,ae=ve):(ve=Qp(ie.type,ie.key,ie.props,null,ae.mode,ve),X2(ve,ie),ve.return=ae,ae=ve)}return $(ae);case x:e:{for($e=ie.key;oe!==null;){if(oe.key===$e)if(oe.tag===4&&oe.stateNode.containerInfo===ie.containerInfo&&oe.stateNode.implementation===ie.implementation){f(ae,oe.sibling),ve=w(oe,ie.children||[]),ve.return=ae,ae=ve;break e}else{f(ae,oe);break}else c(ae,oe);oe=oe.sibling}ve=yD(ie,ae.mode,ve),ve.return=ae,ae=ve}return $(ae);case H:return $e=ie._init,ie=$e(ie._payload),Ht(ae,oe,ie,ve)}if(O(ie))return at(ae,oe,ie,ve);if(q(ie)){if($e=q(ie),typeof $e!="function")throw Error(o(150));return ie=$e.call(ie),Je(ae,oe,ie,ve)}if(typeof ie.then=="function")return Ht(ae,oe,yy(ie),ve);if(ie.$$typeof===A)return Ht(ae,oe,ny(ae,ie),ve);my(ae,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,oe!==null&&oe.tag===6?(f(ae,oe.sibling),ve=w(oe,ie),ve.return=ae,ae=ve):(f(ae,oe),ve=pD(ie,ae.mode,ve),ve.return=ae,ae=ve),$(ae)):f(ae,oe)}return function(ae,oe,ie,ve){try{G2=0;var $e=Ht(ae,oe,ie,ve);return z1=null,$e}catch(Ge){if(Ge===D2||Ge===ay)throw Ge;var mt=qo(29,Ge,null,ae.mode);return mt.lanes=ve,mt.return=ae,mt}finally{}}}var O1=OG(!0),qG=OG(!1),da=Y(null),ir=null;function Ni(r){var c=r.alternate;T(Vn,Vn.current&1),T(da,r),ir===null&&(c===null||R1.current!==null||c.memoizedState!==null)&&(ir=r)}function HG(r){if(r.tag===22){if(T(Vn,Vn.current),T(da,r),ir===null){var c=r.alternate;c!==null&&c.memoizedState!==null&&(ir=r)}}else Li()}function Li(){T(Vn,Vn.current),T(da,da.current)}function Ur(r){F(da),ir===r&&(ir=null),F(Vn)}var Vn=Y(0);function gy(r){for(var c=r;c!==null;){if(c.tag===13){var f=c.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||f.data==="$?"||Dz(f)))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===r)break;for(;c.sibling===null;){if(c.return===null||c.return===r)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}function ZD(r,c,f,g){c=r.memoizedState,f=f(g,c),f=f==null?c:p({},c,f),r.memoizedState=f,r.lanes===0&&(r.updateQueue.baseState=f)}var YD={enqueueSetState:function(r,c,f){r=r._reactInternals;var g=Fo(),w=_i(g);w.payload=c,f!=null&&(w.callback=f),c=Si(r,w,g),c!==null&&(Uo(c,r,g),O2(c,r,g))},enqueueReplaceState:function(r,c,f){r=r._reactInternals;var g=Fo(),w=_i(g);w.tag=1,w.payload=c,f!=null&&(w.callback=f),c=Si(r,w,g),c!==null&&(Uo(c,r,g),O2(c,r,g))},enqueueForceUpdate:function(r,c){r=r._reactInternals;var f=Fo(),g=_i(f);g.tag=2,c!=null&&(g.callback=c),c=Si(r,g,f),c!==null&&(Uo(c,r,f),O2(c,r,f))}};function VG(r,c,f,g,w,S,$){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(g,S,$):c.prototype&&c.prototype.isPureReactComponent?!j2(f,g)||!j2(w,S):!0}function BG(r,c,f,g){r=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(f,g),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(f,g),c.state!==r&&YD.enqueueReplaceState(c,c.state,null)}function tc(r,c){var f=c;if("ref"in c){f={};for(var g in c)g!=="ref"&&(f[g]=c[g])}if(r=r.defaultProps){f===c&&(f=p({},f));for(var w in r)f[w]===void 0&&(f[w]=r[w])}return f}var vy=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var c=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(c))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)};function FG(r){vy(r)}function UG(r){console.error(r)}function GG(r){vy(r)}function ky(r,c){try{var f=r.onUncaughtError;f(c.value,{componentStack:c.stack})}catch(g){setTimeout(function(){throw g})}}function XG(r,c,f){try{var g=r.onCaughtError;g(f.value,{componentStack:f.stack,errorBoundary:c.tag===1?c.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function WD(r,c,f){return f=_i(f),f.tag=3,f.payload={element:null},f.callback=function(){ky(r,c)},f}function ZG(r){return r=_i(r),r.tag=3,r}function YG(r,c,f,g){var w=f.type.getDerivedStateFromError;if(typeof w=="function"){var S=g.value;r.payload=function(){return w(S)},r.callback=function(){XG(c,f,g)}}var $=f.stateNode;$!==null&&typeof $.componentDidCatch=="function"&&(r.callback=function(){XG(c,f,g),typeof w!="function"&&(Ri===null?Ri=new Set([this]):Ri.add(this));var B=g.stack;this.componentDidCatch(g.value,{componentStack:B!==null?B:""})})}function o1e(r,c,f,g,w){if(f.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(c=f.alternate,c!==null&&R2(c,f,w,!0),f=da.current,f!==null){switch(f.tag){case 13:return ir===null?xz():f.alternate===null&&fn===0&&(fn=3),f.flags&=-257,f.flags|=65536,f.lanes=w,g===SD?f.flags|=16384:(c=f.updateQueue,c===null?f.updateQueue=new Set([g]):c.add(g),bz(r,g,w)),!1;case 22:return f.flags|=65536,g===SD?f.flags|=16384:(c=f.updateQueue,c===null?(c={transitions:null,markerInstances:null,retryQueue:new Set([g])},f.updateQueue=c):(f=c.retryQueue,f===null?c.retryQueue=new Set([g]):f.add(g)),bz(r,g,w)),!1}throw Error(o(435,f.tag))}return bz(r,g,w),xz(),!1}if(Et)return c=da.current,c!==null?((c.flags&65536)===0&&(c.flags|=256),c.flags|=65536,c.lanes=w,g!==vD&&(r=Error(o(422),{cause:g}),T2(sa(r,f)))):(g!==vD&&(c=Error(o(423),{cause:g}),T2(sa(c,f))),r=r.current.alternate,r.flags|=65536,w&=-w,r.lanes|=w,g=sa(g,f),w=WD(r.stateNode,g,w),LD(r,w),fn!==4&&(fn=2)),!1;var S=Error(o(520),{cause:g});if(S=sa(S,f),ef===null?ef=[S]:ef.push(S),fn!==4&&(fn=2),c===null)return!0;g=sa(g,f),f=c;do{switch(f.tag){case 3:return f.flags|=65536,r=w&-w,f.lanes|=r,r=WD(f.stateNode,g,r),LD(f,r),!1;case 1:if(c=f.type,S=f.stateNode,(f.flags&128)===0&&(typeof c.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(Ri===null||!Ri.has(S))))return f.flags|=65536,w&=-w,f.lanes|=w,w=ZG(w),YG(w,r,f,g),LD(f,w),!1}f=f.return}while(f!==null);return!1}var WG=Error(o(461)),Xn=!1;function oo(r,c,f,g){c.child=r===null?qG(c,null,f,g):O1(c,r.child,f,g)}function KG(r,c,f,g,w){f=f.render;var S=c.ref;if("ref"in g){var $={};for(var B in g)B!=="ref"&&($[B]=g[B])}else $=g;return Qs(c),g=TD(r,c,f,$,S,w),B=RD(),r!==null&&!Xn?(PD(r,c,w),Gr(r,c,w)):(Et&&B&&mD(c),c.flags|=1,oo(r,c,g,w),c.child)}function QG(r,c,f,g,w){if(r===null){var S=f.type;return typeof S=="function"&&!fD(S)&&S.defaultProps===void 0&&f.compare===null?(c.tag=15,c.type=S,JG(r,c,S,g,w)):(r=Qp(f.type,null,g,c,c.mode,w),r.ref=c.ref,r.return=c,c.child=r)}if(S=r.child,!az(r,w)){var $=S.memoizedProps;if(f=f.compare,f=f!==null?f:j2,f($,g)&&r.ref===c.ref)return Gr(r,c,w)}return c.flags|=1,r=Or(S,g),r.ref=c.ref,r.return=c,c.child=r}function JG(r,c,f,g,w){if(r!==null){var S=r.memoizedProps;if(j2(S,g)&&r.ref===c.ref)if(Xn=!1,c.pendingProps=g=S,az(r,w))(r.flags&131072)!==0&&(Xn=!0);else return c.lanes=r.lanes,Gr(r,c,w)}return KD(r,c,f,g,w)}function eX(r,c,f){var g=c.pendingProps,w=g.children,S=r!==null?r.memoizedState:null;if(g.mode==="hidden"){if((c.flags&128)!==0){if(g=S!==null?S.baseLanes|f:f,r!==null){for(w=c.child=r.child,S=0;w!==null;)S=S|w.lanes|w.childLanes,w=w.sibling;c.childLanes=S&~g}else c.childLanes=0,c.child=null;return tX(r,c,g,f)}if((f&536870912)!==0)c.memoizedState={baseLanes:0,cachePool:null},r!==null&&oy(c,S!==null?S.cachePool:null),S!==null?JU(c,S):AD(),HG(c);else return c.lanes=c.childLanes=536870912,tX(r,c,S!==null?S.baseLanes|f:f,f)}else S!==null?(oy(c,S.cachePool),JU(c,S),Li(),c.memoizedState=null):(r!==null&&oy(c,null),AD(),Li());return oo(r,c,w,f),c.child}function tX(r,c,f,g){var w=_D();return w=w===null?null:{parent:Hn._currentValue,pool:w},c.memoizedState={baseLanes:f,cachePool:w},r!==null&&oy(c,null),AD(),HG(c),r!==null&&R2(r,c,g,!0),null}function xy(r,c){var f=c.ref;if(f===null)r!==null&&r.ref!==null&&(c.flags|=4194816);else{if(typeof f!="function"&&typeof f!="object")throw Error(o(284));(r===null||r.ref!==f)&&(c.flags|=4194816)}}function KD(r,c,f,g,w){return Qs(c),f=TD(r,c,f,g,void 0,w),g=RD(),r!==null&&!Xn?(PD(r,c,w),Gr(r,c,w)):(Et&&g&&mD(c),c.flags|=1,oo(r,c,f,w),c.child)}function nX(r,c,f,g,w,S){return Qs(c),c.updateQueue=null,f=tG(c,g,f,w),eG(r),g=RD(),r!==null&&!Xn?(PD(r,c,S),Gr(r,c,S)):(Et&&g&&mD(c),c.flags|=1,oo(r,c,f,S),c.child)}function oX(r,c,f,g,w){if(Qs(c),c.stateNode===null){var S=j1,$=f.contextType;typeof $=="object"&&$!==null&&(S=co($)),S=new f(g,S),c.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=YD,c.stateNode=S,S._reactInternals=c,S=c.stateNode,S.props=g,S.state=c.memoizedState,S.refs={},CD(c),$=f.contextType,S.context=typeof $=="object"&&$!==null?co($):j1,S.state=c.memoizedState,$=f.getDerivedStateFromProps,typeof $=="function"&&(ZD(c,f,$,g),S.state=c.memoizedState),typeof f.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||($=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),$!==S.state&&YD.enqueueReplaceState(S,S.state,null),H2(c,g,S,w),q2(),S.state=c.memoizedState),typeof S.componentDidMount=="function"&&(c.flags|=4194308),g=!0}else if(r===null){S=c.stateNode;var B=c.memoizedProps,J=tc(f,B);S.props=J;var se=S.context,ye=f.contextType;$=j1,typeof ye=="object"&&ye!==null&&($=co(ye));var we=f.getDerivedStateFromProps;ye=typeof we=="function"||typeof S.getSnapshotBeforeUpdate=="function",B=c.pendingProps!==B,ye||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(B||se!==$)&&BG(c,S,g,$),Mi=!1;var ue=c.memoizedState;S.state=ue,H2(c,g,S,w),q2(),se=c.memoizedState,B||ue!==se||Mi?(typeof we=="function"&&(ZD(c,f,we,g),se=c.memoizedState),(J=Mi||VG(c,f,J,g,ue,se,$))?(ye||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(c.flags|=4194308)):(typeof S.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=g,c.memoizedState=se),S.props=g,S.state=se,S.context=$,g=J):(typeof S.componentDidMount=="function"&&(c.flags|=4194308),g=!1)}else{S=c.stateNode,ND(r,c),$=c.memoizedProps,ye=tc(f,$),S.props=ye,we=c.pendingProps,ue=S.context,se=f.contextType,J=j1,typeof se=="object"&&se!==null&&(J=co(se)),B=f.getDerivedStateFromProps,(se=typeof B=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||($!==we||ue!==J)&&BG(c,S,g,J),Mi=!1,ue=c.memoizedState,S.state=ue,H2(c,g,S,w),q2();var he=c.memoizedState;$!==we||ue!==he||Mi||r!==null&&r.dependencies!==null&&ty(r.dependencies)?(typeof B=="function"&&(ZD(c,f,B,g),he=c.memoizedState),(ye=Mi||VG(c,f,ye,g,ue,he,J)||r!==null&&r.dependencies!==null&&ty(r.dependencies))?(se||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(g,he,J),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(g,he,J)),typeof S.componentDidUpdate=="function"&&(c.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof S.componentDidUpdate!="function"||$===r.memoizedProps&&ue===r.memoizedState||(c.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||$===r.memoizedProps&&ue===r.memoizedState||(c.flags|=1024),c.memoizedProps=g,c.memoizedState=he),S.props=g,S.state=he,S.context=J,g=ye):(typeof S.componentDidUpdate!="function"||$===r.memoizedProps&&ue===r.memoizedState||(c.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||$===r.memoizedProps&&ue===r.memoizedState||(c.flags|=1024),g=!1)}return S=g,xy(r,c),g=(c.flags&128)!==0,S||g?(S=c.stateNode,f=g&&typeof f.getDerivedStateFromError!="function"?null:S.render(),c.flags|=1,r!==null&&g?(c.child=O1(c,r.child,null,w),c.child=O1(c,null,f,w)):oo(r,c,f,w),c.memoizedState=S.state,r=c.child):r=Gr(r,c,w),r}function aX(r,c,f,g){return I2(),c.flags|=256,oo(r,c,f,g),c.child}var QD={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function JD(r){return{baseLanes:r,cachePool:UU()}}function ez(r,c,f){return r=r!==null?r.childLanes&~f:0,c&&(r|=ha),r}function rX(r,c,f){var g=c.pendingProps,w=!1,S=(c.flags&128)!==0,$;if(($=S)||($=r!==null&&r.memoizedState===null?!1:(Vn.current&2)!==0),$&&(w=!0,c.flags&=-129),$=(c.flags&32)!==0,c.flags&=-33,r===null){if(Et){if(w?Ni(c):Li(),Et){var B=hn,J;if(J=B){e:{for(J=B,B=rr;J.nodeType!==8;){if(!B){B=null;break e}if(J=Ia(J.nextSibling),J===null){B=null;break e}}B=J}B!==null?(c.memoizedState={dehydrated:B,treeContext:Xs!==null?{id:qr,overflow:Hr}:null,retryLane:536870912,hydrationErrors:null},J=qo(18,null,null,0),J.stateNode=B,J.return=c,c.child=J,fo=c,hn=null,J=!0):J=!1}J||Ws(c)}if(B=c.memoizedState,B!==null&&(B=B.dehydrated,B!==null))return Dz(B)?c.lanes=32:c.lanes=536870912,null;Ur(c)}return B=g.children,g=g.fallback,w?(Li(),w=c.mode,B=wy({mode:"hidden",children:B},w),g=Gs(g,w,f,null),B.return=c,g.return=c,B.sibling=g,c.child=B,w=c.child,w.memoizedState=JD(f),w.childLanes=ez(r,$,f),c.memoizedState=QD,g):(Ni(c),tz(c,B))}if(J=r.memoizedState,J!==null&&(B=J.dehydrated,B!==null)){if(S)c.flags&256?(Ni(c),c.flags&=-257,c=nz(r,c,f)):c.memoizedState!==null?(Li(),c.child=r.child,c.flags|=128,c=null):(Li(),w=g.fallback,B=c.mode,g=wy({mode:"visible",children:g.children},B),w=Gs(w,B,f,null),w.flags|=2,g.return=c,w.return=c,g.sibling=w,c.child=g,O1(c,r.child,null,f),g=c.child,g.memoizedState=JD(f),g.childLanes=ez(r,$,f),c.memoizedState=QD,c=w);else if(Ni(c),Dz(B)){if($=B.nextSibling&&B.nextSibling.dataset,$)var se=$.dgst;$=se,g=Error(o(419)),g.stack="",g.digest=$,T2({value:g,source:null,stack:null}),c=nz(r,c,f)}else if(Xn||R2(r,c,f,!1),$=(f&r.childLanes)!==0,Xn||$){if($=Ft,$!==null&&(g=f&-f,g=(g&42)!==0?1:qs(g),g=(g&($.suspendedLanes|f))!==0?0:g,g!==0&&g!==J.retryLane))throw J.retryLane=g,L1(r,g),Uo($,r,g),WG;B.data==="$?"||xz(),c=nz(r,c,f)}else B.data==="$?"?(c.flags|=192,c.child=r.child,c=null):(r=J.treeContext,hn=Ia(B.nextSibling),fo=c,Et=!0,Ys=null,rr=!1,r!==null&&(la[ua++]=qr,la[ua++]=Hr,la[ua++]=Xs,qr=r.id,Hr=r.overflow,Xs=c),c=tz(c,g.children),c.flags|=4096);return c}return w?(Li(),w=g.fallback,B=c.mode,J=r.child,se=J.sibling,g=Or(J,{mode:"hidden",children:g.children}),g.subtreeFlags=J.subtreeFlags&65011712,se!==null?w=Or(se,w):(w=Gs(w,B,f,null),w.flags|=2),w.return=c,g.return=c,g.sibling=w,c.child=g,g=w,w=c.child,B=r.child.memoizedState,B===null?B=JD(f):(J=B.cachePool,J!==null?(se=Hn._currentValue,J=J.parent!==se?{parent:se,pool:se}:J):J=UU(),B={baseLanes:B.baseLanes|f,cachePool:J}),w.memoizedState=B,w.childLanes=ez(r,$,f),c.memoizedState=QD,g):(Ni(c),f=r.child,r=f.sibling,f=Or(f,{mode:"visible",children:g.children}),f.return=c,f.sibling=null,r!==null&&($=c.deletions,$===null?(c.deletions=[r],c.flags|=16):$.push(r)),c.child=f,c.memoizedState=null,f)}function tz(r,c){return c=wy({mode:"visible",children:c},r.mode),c.return=r,r.child=c}function wy(r,c){return r=qo(22,r,null,c),r.lanes=0,r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},r}function nz(r,c,f){return O1(c,r.child,null,f),r=tz(c,c.pendingProps.children),r.flags|=2,c.memoizedState=null,r}function iX(r,c,f){r.lanes|=c;var g=r.alternate;g!==null&&(g.lanes|=c),xD(r.return,c,f)}function oz(r,c,f,g,w){var S=r.memoizedState;S===null?r.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:g,tail:f,tailMode:w}:(S.isBackwards=c,S.rendering=null,S.renderingStartTime=0,S.last=g,S.tail=f,S.tailMode=w)}function sX(r,c,f){var g=c.pendingProps,w=g.revealOrder,S=g.tail;if(oo(r,c,g.children,f),g=Vn.current,(g&2)!==0)g=g&1|2,c.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=c.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&iX(r,f,c);else if(r.tag===19)iX(r,f,c);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===c)break e;for(;r.sibling===null;){if(r.return===null||r.return===c)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}g&=1}switch(T(Vn,g),w){case"forwards":for(f=c.child,w=null;f!==null;)r=f.alternate,r!==null&&gy(r)===null&&(w=f),f=f.sibling;f=w,f===null?(w=c.child,c.child=null):(w=f.sibling,f.sibling=null),oz(c,!1,w,f,S);break;case"backwards":for(f=null,w=c.child,c.child=null;w!==null;){if(r=w.alternate,r!==null&&gy(r)===null){c.child=w;break}r=w.sibling,w.sibling=f,f=w,w=r}oz(c,!0,f,null,S);break;case"together":oz(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Gr(r,c,f){if(r!==null&&(c.dependencies=r.dependencies),Ti|=c.lanes,(f&c.childLanes)===0)if(r!==null){if(R2(r,c,f,!1),(f&c.childLanes)===0)return null}else return null;if(r!==null&&c.child!==r.child)throw Error(o(153));if(c.child!==null){for(r=c.child,f=Or(r,r.pendingProps),c.child=f,f.return=c;r.sibling!==null;)r=r.sibling,f=f.sibling=Or(r,r.pendingProps),f.return=c;f.sibling=null}return c.child}function az(r,c){return(r.lanes&c)!==0?!0:(r=r.dependencies,!!(r!==null&&ty(r)))}function a1e(r,c,f){switch(c.tag){case 3:ce(c,c.stateNode.containerInfo),bi(c,Hn,r.memoizedState.cache),I2();break;case 27:case 5:ke(c);break;case 4:ce(c,c.stateNode.containerInfo);break;case 10:bi(c,c.type,c.memoizedProps.value);break;case 13:var g=c.memoizedState;if(g!==null)return g.dehydrated!==null?(Ni(c),c.flags|=128,null):(f&c.child.childLanes)!==0?rX(r,c,f):(Ni(c),r=Gr(r,c,f),r!==null?r.sibling:null);Ni(c);break;case 19:var w=(r.flags&128)!==0;if(g=(f&c.childLanes)!==0,g||(R2(r,c,f,!1),g=(f&c.childLanes)!==0),w){if(g)return sX(r,c,f);c.flags|=128}if(w=c.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),T(Vn,Vn.current),g)break;return null;case 22:case 23:return c.lanes=0,eX(r,c,f);case 24:bi(c,Hn,r.memoizedState.cache)}return Gr(r,c,f)}function cX(r,c,f){if(r!==null)if(r.memoizedProps!==c.pendingProps)Xn=!0;else{if(!az(r,f)&&(c.flags&128)===0)return Xn=!1,a1e(r,c,f);Xn=(r.flags&131072)!==0}else Xn=!1,Et&&(c.flags&1048576)!==0&&zU(c,ey,c.index);switch(c.lanes=0,c.tag){case 16:e:{r=c.pendingProps;var g=c.elementType,w=g._init;if(g=w(g._payload),c.type=g,typeof g=="function")fD(g)?(r=tc(g,r),c.tag=1,c=oX(null,c,g,r,f)):(c.tag=0,c=KD(null,c,g,r,f));else{if(g!=null){if(w=g.$$typeof,w===I){c.tag=11,c=KG(null,c,g,r,f);break e}else if(w===D){c.tag=14,c=QG(null,c,g,r,f);break e}}throw c=E(g)||g,Error(o(306,c,""))}}return c;case 0:return KD(r,c,c.type,c.pendingProps,f);case 1:return g=c.type,w=tc(g,c.pendingProps),oX(r,c,g,w,f);case 3:e:{if(ce(c,c.stateNode.containerInfo),r===null)throw Error(o(387));g=c.pendingProps;var S=c.memoizedState;w=S.element,ND(r,c),H2(c,g,null,f);var $=c.memoizedState;if(g=$.cache,bi(c,Hn,g),g!==S.cache&&wD(c,[Hn],f,!0),q2(),g=$.element,S.isDehydrated)if(S={element:g,isDehydrated:!1,cache:$.cache},c.updateQueue.baseState=S,c.memoizedState=S,c.flags&256){c=aX(r,c,g,f);break e}else if(g!==w){w=sa(Error(o(424)),c),T2(w),c=aX(r,c,g,f);break e}else{switch(r=c.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(hn=Ia(r.firstChild),fo=c,Et=!0,Ys=null,rr=!0,f=qG(c,null,g,f),c.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling}else{if(I2(),g===w){c=Gr(r,c,f);break e}oo(r,c,g,f)}c=c.child}return c;case 26:return xy(r,c),r===null?(f=hZ(c.type,null,c.pendingProps,null))?c.memoizedState=f:Et||(f=c.type,r=c.pendingProps,g=Py(ne.current).createElement(f),g[xe]=c,g[Ce]=r,ro(g,f,r),St(g),c.stateNode=g):c.memoizedState=hZ(c.type,r.memoizedProps,c.pendingProps,r.memoizedState),null;case 27:return ke(c),r===null&&Et&&(g=c.stateNode=lZ(c.type,c.pendingProps,ne.current),fo=c,rr=!0,w=hn,Di(c.type)?(zz=w,hn=Ia(g.firstChild)):hn=w),oo(r,c,c.pendingProps.children,f),xy(r,c),r===null&&(c.flags|=4194304),c.child;case 5:return r===null&&Et&&((w=g=hn)&&(g=I1e(g,c.type,c.pendingProps,rr),g!==null?(c.stateNode=g,fo=c,hn=Ia(g.firstChild),rr=!1,w=!0):w=!1),w||Ws(c)),ke(c),w=c.type,S=c.pendingProps,$=r!==null?r.memoizedProps:null,g=S.children,Rz(w,S)?g=null:$!==null&&Rz(w,$)&&(c.flags|=32),c.memoizedState!==null&&(w=TD(r,c,Wde,null,null,f),uf._currentValue=w),xy(r,c),oo(r,c,g,f),c.child;case 6:return r===null&&Et&&((r=f=hn)&&(f=T1e(f,c.pendingProps,rr),f!==null?(c.stateNode=f,fo=c,hn=null,r=!0):r=!1),r||Ws(c)),null;case 13:return rX(r,c,f);case 4:return ce(c,c.stateNode.containerInfo),g=c.pendingProps,r===null?c.child=O1(c,null,g,f):oo(r,c,g,f),c.child;case 11:return KG(r,c,c.type,c.pendingProps,f);case 7:return oo(r,c,c.pendingProps,f),c.child;case 8:return oo(r,c,c.pendingProps.children,f),c.child;case 12:return oo(r,c,c.pendingProps.children,f),c.child;case 10:return g=c.pendingProps,bi(c,c.type,g.value),oo(r,c,g.children,f),c.child;case 9:return w=c.type._context,g=c.pendingProps.children,Qs(c),w=co(w),g=g(w),c.flags|=1,oo(r,c,g,f),c.child;case 14:return QG(r,c,c.type,c.pendingProps,f);case 15:return JG(r,c,c.type,c.pendingProps,f);case 19:return sX(r,c,f);case 31:return g=c.pendingProps,f=c.mode,g={mode:g.mode,children:g.children},r===null?(f=wy(g,f),f.ref=c.ref,c.child=f,f.return=c,c=f):(f=Or(r.child,g),f.ref=c.ref,c.child=f,f.return=c,c=f),c;case 22:return eX(r,c,f);case 24:return Qs(c),g=co(Hn),r===null?(w=_D(),w===null&&(w=Ft,S=bD(),w.pooledCache=S,S.refCount++,S!==null&&(w.pooledCacheLanes|=f),w=S),c.memoizedState={parent:g,cache:w},CD(c),bi(c,Hn,w)):((r.lanes&f)!==0&&(ND(r,c),H2(c,null,null,f),q2()),w=r.memoizedState,S=c.memoizedState,w.parent!==g?(w={parent:g,cache:g},c.memoizedState=w,c.lanes===0&&(c.memoizedState=c.updateQueue.baseState=w),bi(c,Hn,g)):(g=S.cache,bi(c,Hn,g),g!==w.cache&&wD(c,[Hn],f,!0))),oo(r,c,c.pendingProps.children,f),c.child;case 29:throw c.pendingProps}throw Error(o(156,c.tag))}function Xr(r){r.flags|=4}function lX(r,c){if(c.type!=="stylesheet"||(c.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!gZ(c)){if(c=da.current,c!==null&&((Ct&4194048)===Ct?ir!==null:(Ct&62914560)!==Ct&&(Ct&536870912)===0||c!==ir))throw z2=SD,GU;r.flags|=8192}}function by(r,c){c!==null&&(r.flags|=4),r.flags&16384&&(c=r.tag!==22?Ja():536870912,r.lanes|=c,B1|=c)}function Z2(r,c){if(!Et)switch(r.tailMode){case"hidden":c=r.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?r.tail=null:f.sibling=null;break;case"collapsed":f=r.tail;for(var g=null;f!==null;)f.alternate!==null&&(g=f),f=f.sibling;g===null?c||r.tail===null?r.tail=null:r.tail.sibling=null:g.sibling=null}}function sn(r){var c=r.alternate!==null&&r.alternate.child===r.child,f=0,g=0;if(c)for(var w=r.child;w!==null;)f|=w.lanes|w.childLanes,g|=w.subtreeFlags&65011712,g|=w.flags&65011712,w.return=r,w=w.sibling;else for(w=r.child;w!==null;)f|=w.lanes|w.childLanes,g|=w.subtreeFlags,g|=w.flags,w.return=r,w=w.sibling;return r.subtreeFlags|=g,r.childLanes=f,c}function r1e(r,c,f){var g=c.pendingProps;switch(gD(c),c.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sn(c),null;case 1:return sn(c),null;case 3:return f=c.stateNode,g=null,r!==null&&(g=r.memoizedState.cache),c.memoizedState.cache!==g&&(c.flags|=2048),Br(Hn),me(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(r===null||r.child===null)&&(E2(c)?Xr(c):r===null||r.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,HU())),sn(c),null;case 26:return f=c.memoizedState,r===null?(Xr(c),f!==null?(sn(c),lX(c,f)):(sn(c),c.flags&=-16777217)):f?f!==r.memoizedState?(Xr(c),sn(c),lX(c,f)):(sn(c),c.flags&=-16777217):(r.memoizedProps!==g&&Xr(c),sn(c),c.flags&=-16777217),null;case 27:Ee(c),f=ne.current;var w=c.type;if(r!==null&&c.stateNode!=null)r.memoizedProps!==g&&Xr(c);else{if(!g){if(c.stateNode===null)throw Error(o(166));return sn(c),null}r=K.current,E2(c)?OU(c):(r=lZ(w,g,f),c.stateNode=r,Xr(c))}return sn(c),null;case 5:if(Ee(c),f=c.type,r!==null&&c.stateNode!=null)r.memoizedProps!==g&&Xr(c);else{if(!g){if(c.stateNode===null)throw Error(o(166));return sn(c),null}if(r=K.current,E2(c))OU(c);else{switch(w=Py(ne.current),r){case 1:r=w.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:r=w.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":r=w.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":r=w.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":r=w.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild);break;case"select":r=typeof g.is=="string"?w.createElement("select",{is:g.is}):w.createElement("select"),g.multiple?r.multiple=!0:g.size&&(r.size=g.size);break;default:r=typeof g.is=="string"?w.createElement(f,{is:g.is}):w.createElement(f)}}r[xe]=c,r[Ce]=g;e:for(w=c.child;w!==null;){if(w.tag===5||w.tag===6)r.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===c)break e;for(;w.sibling===null;){if(w.return===null||w.return===c)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}c.stateNode=r;e:switch(ro(r,f,g),f){case"button":case"input":case"select":case"textarea":r=!!g.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Xr(c)}}return sn(c),c.flags&=-16777217,null;case 6:if(r&&c.stateNode!=null)r.memoizedProps!==g&&Xr(c);else{if(typeof g!="string"&&c.stateNode===null)throw Error(o(166));if(r=ne.current,E2(c)){if(r=c.stateNode,f=c.memoizedProps,g=null,w=fo,w!==null)switch(w.tag){case 27:case 5:g=w.memoizedProps}r[xe]=c,r=!!(r.nodeValue===f||g!==null&&g.suppressHydrationWarning===!0||nZ(r.nodeValue,f)),r||Ws(c)}else r=Py(r).createTextNode(g),r[xe]=c,c.stateNode=r}return sn(c),null;case 13:if(g=c.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(w=E2(c),g!==null&&g.dehydrated!==null){if(r===null){if(!w)throw Error(o(318));if(w=c.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(o(317));w[xe]=c}else I2(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;sn(c),w=!1}else w=HU(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=w),w=!0;if(!w)return c.flags&256?(Ur(c),c):(Ur(c),null)}if(Ur(c),(c.flags&128)!==0)return c.lanes=f,c;if(f=g!==null,r=r!==null&&r.memoizedState!==null,f){g=c.child,w=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(w=g.alternate.memoizedState.cachePool.pool);var S=null;g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(S=g.memoizedState.cachePool.pool),S!==w&&(g.flags|=2048)}return f!==r&&f&&(c.child.flags|=8192),by(c,c.updateQueue),sn(c),null;case 4:return me(),r===null&&jz(c.stateNode.containerInfo),sn(c),null;case 10:return Br(c.type),sn(c),null;case 19:if(F(Vn),w=c.memoizedState,w===null)return sn(c),null;if(g=(c.flags&128)!==0,S=w.rendering,S===null)if(g)Z2(w,!1);else{if(fn!==0||r!==null&&(r.flags&128)!==0)for(r=c.child;r!==null;){if(S=gy(r),S!==null){for(c.flags|=128,Z2(w,!1),r=S.updateQueue,c.updateQueue=r,by(c,r),c.subtreeFlags=0,r=f,f=c.child;f!==null;)DU(f,r),f=f.sibling;return T(Vn,Vn.current&1|2),c.child}r=r.sibling}w.tail!==null&&We()>Sy&&(c.flags|=128,g=!0,Z2(w,!1),c.lanes=4194304)}else{if(!g)if(r=gy(S),r!==null){if(c.flags|=128,g=!0,r=r.updateQueue,c.updateQueue=r,by(c,r),Z2(w,!0),w.tail===null&&w.tailMode==="hidden"&&!S.alternate&&!Et)return sn(c),null}else 2*We()-w.renderingStartTime>Sy&&f!==536870912&&(c.flags|=128,g=!0,Z2(w,!1),c.lanes=4194304);w.isBackwards?(S.sibling=c.child,c.child=S):(r=w.last,r!==null?r.sibling=S:c.child=S,w.last=S)}return w.tail!==null?(c=w.tail,w.rendering=c,w.tail=c.sibling,w.renderingStartTime=We(),c.sibling=null,r=Vn.current,T(Vn,g?r&1|2:r&1),c):(sn(c),null);case 22:case 23:return Ur(c),ED(),g=c.memoizedState!==null,r!==null?r.memoizedState!==null!==g&&(c.flags|=8192):g&&(c.flags|=8192),g?(f&536870912)!==0&&(c.flags&128)===0&&(sn(c),c.subtreeFlags&6&&(c.flags|=8192)):sn(c),f=c.updateQueue,f!==null&&by(c,f.retryQueue),f=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),g=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),g!==f&&(c.flags|=2048),r!==null&&F(Js),null;case 24:return f=null,r!==null&&(f=r.memoizedState.cache),c.memoizedState.cache!==f&&(c.flags|=2048),Br(Hn),sn(c),null;case 25:return null;case 30:return null}throw Error(o(156,c.tag))}function i1e(r,c){switch(gD(c),c.tag){case 1:return r=c.flags,r&65536?(c.flags=r&-65537|128,c):null;case 3:return Br(Hn),me(),r=c.flags,(r&65536)!==0&&(r&128)===0?(c.flags=r&-65537|128,c):null;case 26:case 27:case 5:return Ee(c),null;case 13:if(Ur(c),r=c.memoizedState,r!==null&&r.dehydrated!==null){if(c.alternate===null)throw Error(o(340));I2()}return r=c.flags,r&65536?(c.flags=r&-65537|128,c):null;case 19:return F(Vn),null;case 4:return me(),null;case 10:return Br(c.type),null;case 22:case 23:return Ur(c),ED(),r!==null&&F(Js),r=c.flags,r&65536?(c.flags=r&-65537|128,c):null;case 24:return Br(Hn),null;case 25:return null;default:return null}}function uX(r,c){switch(gD(c),c.tag){case 3:Br(Hn),me();break;case 26:case 27:case 5:Ee(c);break;case 4:me();break;case 13:Ur(c);break;case 19:F(Vn);break;case 10:Br(c.type);break;case 22:case 23:Ur(c),ED(),r!==null&&F(Js);break;case 24:Br(Hn)}}function Y2(r,c){try{var f=c.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var w=g.next;f=w;do{if((f.tag&r)===r){g=void 0;var S=f.create,$=f.inst;g=S(),$.destroy=g}f=f.next}while(f!==w)}}catch(B){Bt(c,c.return,B)}}function ji(r,c,f){try{var g=c.updateQueue,w=g!==null?g.lastEffect:null;if(w!==null){var S=w.next;g=S;do{if((g.tag&r)===r){var $=g.inst,B=$.destroy;if(B!==void 0){$.destroy=void 0,w=c;var J=f,se=B;try{se()}catch(ye){Bt(w,J,ye)}}}g=g.next}while(g!==S)}}catch(ye){Bt(c,c.return,ye)}}function dX(r){var c=r.updateQueue;if(c!==null){var f=r.stateNode;try{QU(c,f)}catch(g){Bt(r,r.return,g)}}}function hX(r,c,f){f.props=tc(r.type,r.memoizedProps),f.state=r.memoizedState;try{f.componentWillUnmount()}catch(g){Bt(r,c,g)}}function W2(r,c){try{var f=r.ref;if(f!==null){switch(r.tag){case 26:case 27:case 5:var g=r.stateNode;break;case 30:g=r.stateNode;break;default:g=r.stateNode}typeof f=="function"?r.refCleanup=f(g):f.current=g}}catch(w){Bt(r,c,w)}}function sr(r,c){var f=r.ref,g=r.refCleanup;if(f!==null)if(typeof g=="function")try{g()}catch(w){Bt(r,c,w)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(w){Bt(r,c,w)}else f.current=null}function fX(r){var c=r.type,f=r.memoizedProps,g=r.stateNode;try{e:switch(c){case"button":case"input":case"select":case"textarea":f.autoFocus&&g.focus();break e;case"img":f.src?g.src=f.src:f.srcSet&&(g.srcset=f.srcSet)}}catch(w){Bt(r,r.return,w)}}function rz(r,c,f){try{var g=r.stateNode;N1e(g,r.type,f,c),g[Ce]=c}catch(w){Bt(r,r.return,w)}}function pX(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Di(r.type)||r.tag===4}function iz(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||pX(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&Di(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function sz(r,c,f){var g=r.tag;if(g===5||g===6)r=r.stateNode,c?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(r,c):(c=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,c.appendChild(r),f=f._reactRootContainer,f!=null||c.onclick!==null||(c.onclick=Ry));else if(g!==4&&(g===27&&Di(r.type)&&(f=r.stateNode,c=null),r=r.child,r!==null))for(sz(r,c,f),r=r.sibling;r!==null;)sz(r,c,f),r=r.sibling}function My(r,c,f){var g=r.tag;if(g===5||g===6)r=r.stateNode,c?f.insertBefore(r,c):f.appendChild(r);else if(g!==4&&(g===27&&Di(r.type)&&(f=r.stateNode),r=r.child,r!==null))for(My(r,c,f),r=r.sibling;r!==null;)My(r,c,f),r=r.sibling}function yX(r){var c=r.stateNode,f=r.memoizedProps;try{for(var g=r.type,w=c.attributes;w.length;)c.removeAttributeNode(w[0]);ro(c,g,f),c[xe]=r,c[Ce]=f}catch(S){Bt(r,r.return,S)}}var Zr=!1,_n=!1,cz=!1,mX=typeof WeakSet=="function"?WeakSet:Set,Zn=null;function s1e(r,c){if(r=r.containerInfo,Iz=Hy,r=NU(r),iD(r)){if("selectionStart"in r)var f={start:r.selectionStart,end:r.selectionEnd};else e:{f=(f=r.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&g.rangeCount!==0){f=g.anchorNode;var w=g.anchorOffset,S=g.focusNode;g=g.focusOffset;try{f.nodeType,S.nodeType}catch{f=null;break e}var $=0,B=-1,J=-1,se=0,ye=0,we=r,ue=null;t:for(;;){for(var he;we!==f||w!==0&&we.nodeType!==3||(B=$+w),we!==S||g!==0&&we.nodeType!==3||(J=$+g),we.nodeType===3&&($+=we.nodeValue.length),(he=we.firstChild)!==null;)ue=we,we=he;for(;;){if(we===r)break t;if(ue===f&&++se===w&&(B=$),ue===S&&++ye===g&&(J=$),(he=we.nextSibling)!==null)break;we=ue,ue=we.parentNode}we=he}f=B===-1||J===-1?null:{start:B,end:J}}else f=null}f=f||{start:0,end:0}}else f=null;for(Tz={focusedElem:r,selectionRange:f},Hy=!1,Zn=c;Zn!==null;)if(c=Zn,r=c.child,(c.subtreeFlags&1024)!==0&&r!==null)r.return=c,Zn=r;else for(;Zn!==null;){switch(c=Zn,S=c.alternate,r=c.flags,c.tag){case 0:break;case 11:case 15:break;case 1:if((r&1024)!==0&&S!==null){r=void 0,f=c,w=S.memoizedProps,S=S.memoizedState,g=f.stateNode;try{var at=tc(f.type,w,f.elementType===f.type);r=g.getSnapshotBeforeUpdate(at,S),g.__reactInternalSnapshotBeforeUpdate=r}catch(Je){Bt(f,f.return,Je)}}break;case 3:if((r&1024)!==0){if(r=c.stateNode.containerInfo,f=r.nodeType,f===9)$z(r);else if(f===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":$z(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(o(163))}if(r=c.sibling,r!==null){r.return=c.return,Zn=r;break}Zn=c.return}}function gX(r,c,f){var g=f.flags;switch(f.tag){case 0:case 11:case 15:Ai(r,f),g&4&&Y2(5,f);break;case 1:if(Ai(r,f),g&4)if(r=f.stateNode,c===null)try{r.componentDidMount()}catch($){Bt(f,f.return,$)}else{var w=tc(f.type,c.memoizedProps);c=c.memoizedState;try{r.componentDidUpdate(w,c,r.__reactInternalSnapshotBeforeUpdate)}catch($){Bt(f,f.return,$)}}g&64&&dX(f),g&512&&W2(f,f.return);break;case 3:if(Ai(r,f),g&64&&(r=f.updateQueue,r!==null)){if(c=null,f.child!==null)switch(f.child.tag){case 27:case 5:c=f.child.stateNode;break;case 1:c=f.child.stateNode}try{QU(r,c)}catch($){Bt(f,f.return,$)}}break;case 27:c===null&&g&4&&yX(f);case 26:case 5:Ai(r,f),c===null&&g&4&&fX(f),g&512&&W2(f,f.return);break;case 12:Ai(r,f);break;case 13:Ai(r,f),g&4&&xX(r,f),g&64&&(r=f.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(f=m1e.bind(null,f),R1e(r,f))));break;case 22:if(g=f.memoizedState!==null||Zr,!g){c=c!==null&&c.memoizedState!==null||_n,w=Zr;var S=_n;Zr=g,(_n=c)&&!S?Ei(r,f,(f.subtreeFlags&8772)!==0):Ai(r,f),Zr=w,_n=S}break;case 30:break;default:Ai(r,f)}}function vX(r){var c=r.alternate;c!==null&&(r.alternate=null,vX(c)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(c=r.stateNode,c!==null&&Ve(c)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var nn=null,No=!1;function Yr(r,c,f){for(f=f.child;f!==null;)kX(r,c,f),f=f.sibling}function kX(r,c,f){if(be&&typeof be.onCommitFiberUnmount=="function")try{be.onCommitFiberUnmount(fe,f)}catch{}switch(f.tag){case 26:_n||sr(f,c),Yr(r,c,f),f.memoizedState?f.memoizedState.count--:f.stateNode&&(f=f.stateNode,f.parentNode.removeChild(f));break;case 27:_n||sr(f,c);var g=nn,w=No;Di(f.type)&&(nn=f.stateNode,No=!1),Yr(r,c,f),rf(f.stateNode),nn=g,No=w;break;case 5:_n||sr(f,c);case 6:if(g=nn,w=No,nn=null,Yr(r,c,f),nn=g,No=w,nn!==null)if(No)try{(nn.nodeType===9?nn.body:nn.nodeName==="HTML"?nn.ownerDocument.body:nn).removeChild(f.stateNode)}catch(S){Bt(f,c,S)}else try{nn.removeChild(f.stateNode)}catch(S){Bt(f,c,S)}break;case 18:nn!==null&&(No?(r=nn,sZ(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,f.stateNode),pf(r)):sZ(nn,f.stateNode));break;case 4:g=nn,w=No,nn=f.stateNode.containerInfo,No=!0,Yr(r,c,f),nn=g,No=w;break;case 0:case 11:case 14:case 15:_n||ji(2,f,c),_n||ji(4,f,c),Yr(r,c,f);break;case 1:_n||(sr(f,c),g=f.stateNode,typeof g.componentWillUnmount=="function"&&hX(f,c,g)),Yr(r,c,f);break;case 21:Yr(r,c,f);break;case 22:_n=(g=_n)||f.memoizedState!==null,Yr(r,c,f),_n=g;break;default:Yr(r,c,f)}}function xX(r,c){if(c.memoizedState===null&&(r=c.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{pf(r)}catch(f){Bt(c,c.return,f)}}function c1e(r){switch(r.tag){case 13:case 19:var c=r.stateNode;return c===null&&(c=r.stateNode=new mX),c;case 22:return r=r.stateNode,c=r._retryCache,c===null&&(c=r._retryCache=new mX),c;default:throw Error(o(435,r.tag))}}function lz(r,c){var f=c1e(r);c.forEach(function(g){var w=g1e.bind(null,r,g);f.has(g)||(f.add(g),g.then(w,w))})}function Ho(r,c){var f=c.deletions;if(f!==null)for(var g=0;g<f.length;g++){var w=f[g],S=r,$=c,B=$;e:for(;B!==null;){switch(B.tag){case 27:if(Di(B.type)){nn=B.stateNode,No=!1;break e}break;case 5:nn=B.stateNode,No=!1;break e;case 3:case 4:nn=B.stateNode.containerInfo,No=!0;break e}B=B.return}if(nn===null)throw Error(o(160));kX(S,$,w),nn=null,No=!1,S=w.alternate,S!==null&&(S.return=null),w.return=null}if(c.subtreeFlags&13878)for(c=c.child;c!==null;)wX(c,r),c=c.sibling}var Ea=null;function wX(r,c){var f=r.alternate,g=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Ho(c,r),Vo(r),g&4&&(ji(3,r,r.return),Y2(3,r),ji(5,r,r.return));break;case 1:Ho(c,r),Vo(r),g&512&&(_n||f===null||sr(f,f.return)),g&64&&Zr&&(r=r.updateQueue,r!==null&&(g=r.callbacks,g!==null&&(f=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=f===null?g:f.concat(g))));break;case 26:var w=Ea;if(Ho(c,r),Vo(r),g&512&&(_n||f===null||sr(f,f.return)),g&4){var S=f!==null?f.memoizedState:null;if(g=r.memoizedState,f===null)if(g===null)if(r.stateNode===null){e:{g=r.type,f=r.memoizedProps,w=w.ownerDocument||w;t:switch(g){case"title":S=w.getElementsByTagName("title")[0],(!S||S[Qe]||S[xe]||S.namespaceURI==="http://www.w3.org/2000/svg"||S.hasAttribute("itemprop"))&&(S=w.createElement(g),w.head.insertBefore(S,w.querySelector("head > title"))),ro(S,g,f),S[xe]=r,St(S),g=S;break e;case"link":var $=yZ("link","href",w).get(g+(f.href||""));if($){for(var B=0;B<$.length;B++)if(S=$[B],S.getAttribute("href")===(f.href==null||f.href===""?null:f.href)&&S.getAttribute("rel")===(f.rel==null?null:f.rel)&&S.getAttribute("title")===(f.title==null?null:f.title)&&S.getAttribute("crossorigin")===(f.crossOrigin==null?null:f.crossOrigin)){$.splice(B,1);break t}}S=w.createElement(g),ro(S,g,f),w.head.appendChild(S);break;case"meta":if($=yZ("meta","content",w).get(g+(f.content||""))){for(B=0;B<$.length;B++)if(S=$[B],S.getAttribute("content")===(f.content==null?null:""+f.content)&&S.getAttribute("name")===(f.name==null?null:f.name)&&S.getAttribute("property")===(f.property==null?null:f.property)&&S.getAttribute("http-equiv")===(f.httpEquiv==null?null:f.httpEquiv)&&S.getAttribute("charset")===(f.charSet==null?null:f.charSet)){$.splice(B,1);break t}}S=w.createElement(g),ro(S,g,f),w.head.appendChild(S);break;default:throw Error(o(468,g))}S[xe]=r,St(S),g=S}r.stateNode=g}else mZ(w,r.type,r.stateNode);else r.stateNode=pZ(w,g,r.memoizedProps);else S!==g?(S===null?f.stateNode!==null&&(f=f.stateNode,f.parentNode.removeChild(f)):S.count--,g===null?mZ(w,r.type,r.stateNode):pZ(w,g,r.memoizedProps)):g===null&&r.stateNode!==null&&rz(r,r.memoizedProps,f.memoizedProps)}break;case 27:Ho(c,r),Vo(r),g&512&&(_n||f===null||sr(f,f.return)),f!==null&&g&4&&rz(r,r.memoizedProps,f.memoizedProps);break;case 5:if(Ho(c,r),Vo(r),g&512&&(_n||f===null||sr(f,f.return)),r.flags&32){w=r.stateNode;try{w1(w,"")}catch(he){Bt(r,r.return,he)}}g&4&&r.stateNode!=null&&(w=r.memoizedProps,rz(r,w,f!==null?f.memoizedProps:w)),g&1024&&(cz=!0);break;case 6:if(Ho(c,r),Vo(r),g&4){if(r.stateNode===null)throw Error(o(162));g=r.memoizedProps,f=r.stateNode;try{f.nodeValue=g}catch(he){Bt(r,r.return,he)}}break;case 3:if(zy=null,w=Ea,Ea=$y(c.containerInfo),Ho(c,r),Ea=w,Vo(r),g&4&&f!==null&&f.memoizedState.isDehydrated)try{pf(c.containerInfo)}catch(he){Bt(r,r.return,he)}cz&&(cz=!1,bX(r));break;case 4:g=Ea,Ea=$y(r.stateNode.containerInfo),Ho(c,r),Vo(r),Ea=g;break;case 12:Ho(c,r),Vo(r);break;case 13:Ho(c,r),Vo(r),r.child.flags&8192&&r.memoizedState!==null!=(f!==null&&f.memoizedState!==null)&&(yz=We()),g&4&&(g=r.updateQueue,g!==null&&(r.updateQueue=null,lz(r,g)));break;case 22:w=r.memoizedState!==null;var J=f!==null&&f.memoizedState!==null,se=Zr,ye=_n;if(Zr=se||w,_n=ye||J,Ho(c,r),_n=ye,Zr=se,Vo(r),g&8192)e:for(c=r.stateNode,c._visibility=w?c._visibility&-2:c._visibility|1,w&&(f===null||J||Zr||_n||nc(r)),f=null,c=r;;){if(c.tag===5||c.tag===26){if(f===null){J=f=c;try{if(S=J.stateNode,w)$=S.style,typeof $.setProperty=="function"?$.setProperty("display","none","important"):$.display="none";else{B=J.stateNode;var we=J.memoizedProps.style,ue=we!=null&&we.hasOwnProperty("display")?we.display:null;B.style.display=ue==null||typeof ue=="boolean"?"":(""+ue).trim()}}catch(he){Bt(J,J.return,he)}}}else if(c.tag===6){if(f===null){J=c;try{J.stateNode.nodeValue=w?"":J.memoizedProps}catch(he){Bt(J,J.return,he)}}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===r)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===r)break e;for(;c.sibling===null;){if(c.return===null||c.return===r)break e;f===c&&(f=null),c=c.return}f===c&&(f=null),c.sibling.return=c.return,c=c.sibling}g&4&&(g=r.updateQueue,g!==null&&(f=g.retryQueue,f!==null&&(g.retryQueue=null,lz(r,f))));break;case 19:Ho(c,r),Vo(r),g&4&&(g=r.updateQueue,g!==null&&(r.updateQueue=null,lz(r,g)));break;case 30:break;case 21:break;default:Ho(c,r),Vo(r)}}function Vo(r){var c=r.flags;if(c&2){try{for(var f,g=r.return;g!==null;){if(pX(g)){f=g;break}g=g.return}if(f==null)throw Error(o(160));switch(f.tag){case 27:var w=f.stateNode,S=iz(r);My(r,S,w);break;case 5:var $=f.stateNode;f.flags&32&&(w1($,""),f.flags&=-33);var B=iz(r);My(r,B,$);break;case 3:case 4:var J=f.stateNode.containerInfo,se=iz(r);sz(r,se,J);break;default:throw Error(o(161))}}catch(ye){Bt(r,r.return,ye)}r.flags&=-3}c&4096&&(r.flags&=-4097)}function bX(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var c=r;bX(c),c.tag===5&&c.flags&1024&&c.stateNode.reset(),r=r.sibling}}function Ai(r,c){if(c.subtreeFlags&8772)for(c=c.child;c!==null;)gX(r,c.alternate,c),c=c.sibling}function nc(r){for(r=r.child;r!==null;){var c=r;switch(c.tag){case 0:case 11:case 14:case 15:ji(4,c,c.return),nc(c);break;case 1:sr(c,c.return);var f=c.stateNode;typeof f.componentWillUnmount=="function"&&hX(c,c.return,f),nc(c);break;case 27:rf(c.stateNode);case 26:case 5:sr(c,c.return),nc(c);break;case 22:c.memoizedState===null&&nc(c);break;case 30:nc(c);break;default:nc(c)}r=r.sibling}}function Ei(r,c,f){for(f=f&&(c.subtreeFlags&8772)!==0,c=c.child;c!==null;){var g=c.alternate,w=r,S=c,$=S.flags;switch(S.tag){case 0:case 11:case 15:Ei(w,S,f),Y2(4,S);break;case 1:if(Ei(w,S,f),g=S,w=g.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(se){Bt(g,g.return,se)}if(g=S,w=g.updateQueue,w!==null){var B=g.stateNode;try{var J=w.shared.hiddenCallbacks;if(J!==null)for(w.shared.hiddenCallbacks=null,w=0;w<J.length;w++)KU(J[w],B)}catch(se){Bt(g,g.return,se)}}f&&$&64&&dX(S),W2(S,S.return);break;case 27:yX(S);case 26:case 5:Ei(w,S,f),f&&g===null&&$&4&&fX(S),W2(S,S.return);break;case 12:Ei(w,S,f);break;case 13:Ei(w,S,f),f&&$&4&&xX(w,S);break;case 22:S.memoizedState===null&&Ei(w,S,f),W2(S,S.return);break;case 30:break;default:Ei(w,S,f)}c=c.sibling}}function uz(r,c){var f=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),r=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(r=c.memoizedState.cachePool.pool),r!==f&&(r!=null&&r.refCount++,f!=null&&P2(f))}function dz(r,c){r=null,c.alternate!==null&&(r=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==r&&(c.refCount++,r!=null&&P2(r))}function cr(r,c,f,g){if(c.subtreeFlags&10256)for(c=c.child;c!==null;)MX(r,c,f,g),c=c.sibling}function MX(r,c,f,g){var w=c.flags;switch(c.tag){case 0:case 11:case 15:cr(r,c,f,g),w&2048&&Y2(9,c);break;case 1:cr(r,c,f,g);break;case 3:cr(r,c,f,g),w&2048&&(r=null,c.alternate!==null&&(r=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==r&&(c.refCount++,r!=null&&P2(r)));break;case 12:if(w&2048){cr(r,c,f,g),r=c.stateNode;try{var S=c.memoizedProps,$=S.id,B=S.onPostCommit;typeof B=="function"&&B($,c.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(J){Bt(c,c.return,J)}}else cr(r,c,f,g);break;case 13:cr(r,c,f,g);break;case 23:break;case 22:S=c.stateNode,$=c.alternate,c.memoizedState!==null?S._visibility&2?cr(r,c,f,g):K2(r,c):S._visibility&2?cr(r,c,f,g):(S._visibility|=2,q1(r,c,f,g,(c.subtreeFlags&10256)!==0)),w&2048&&uz($,c);break;case 24:cr(r,c,f,g),w&2048&&dz(c.alternate,c);break;default:cr(r,c,f,g)}}function q1(r,c,f,g,w){for(w=w&&(c.subtreeFlags&10256)!==0,c=c.child;c!==null;){var S=r,$=c,B=f,J=g,se=$.flags;switch($.tag){case 0:case 11:case 15:q1(S,$,B,J,w),Y2(8,$);break;case 23:break;case 22:var ye=$.stateNode;$.memoizedState!==null?ye._visibility&2?q1(S,$,B,J,w):K2(S,$):(ye._visibility|=2,q1(S,$,B,J,w)),w&&se&2048&&uz($.alternate,$);break;case 24:q1(S,$,B,J,w),w&&se&2048&&dz($.alternate,$);break;default:q1(S,$,B,J,w)}c=c.sibling}}function K2(r,c){if(c.subtreeFlags&10256)for(c=c.child;c!==null;){var f=r,g=c,w=g.flags;switch(g.tag){case 22:K2(f,g),w&2048&&uz(g.alternate,g);break;case 24:K2(f,g),w&2048&&dz(g.alternate,g);break;default:K2(f,g)}c=c.sibling}}var Q2=8192;function H1(r){if(r.subtreeFlags&Q2)for(r=r.child;r!==null;)_X(r),r=r.sibling}function _X(r){switch(r.tag){case 26:H1(r),r.flags&Q2&&r.memoizedState!==null&&X1e(Ea,r.memoizedState,r.memoizedProps);break;case 5:H1(r);break;case 3:case 4:var c=Ea;Ea=$y(r.stateNode.containerInfo),H1(r),Ea=c;break;case 22:r.memoizedState===null&&(c=r.alternate,c!==null&&c.memoizedState!==null?(c=Q2,Q2=16777216,H1(r),Q2=c):H1(r));break;default:H1(r)}}function SX(r){var c=r.alternate;if(c!==null&&(r=c.child,r!==null)){c.child=null;do c=r.sibling,r.sibling=null,r=c;while(r!==null)}}function J2(r){var c=r.deletions;if((r.flags&16)!==0){if(c!==null)for(var f=0;f<c.length;f++){var g=c[f];Zn=g,NX(g,r)}SX(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)CX(r),r=r.sibling}function CX(r){switch(r.tag){case 0:case 11:case 15:J2(r),r.flags&2048&&ji(9,r,r.return);break;case 3:J2(r);break;case 12:J2(r);break;case 22:var c=r.stateNode;r.memoizedState!==null&&c._visibility&2&&(r.return===null||r.return.tag!==13)?(c._visibility&=-3,_y(r)):J2(r);break;default:J2(r)}}function _y(r){var c=r.deletions;if((r.flags&16)!==0){if(c!==null)for(var f=0;f<c.length;f++){var g=c[f];Zn=g,NX(g,r)}SX(r)}for(r=r.child;r!==null;){switch(c=r,c.tag){case 0:case 11:case 15:ji(8,c,c.return),_y(c);break;case 22:f=c.stateNode,f._visibility&2&&(f._visibility&=-3,_y(c));break;default:_y(c)}r=r.sibling}}function NX(r,c){for(;Zn!==null;){var f=Zn;switch(f.tag){case 0:case 11:case 15:ji(8,f,c);break;case 23:case 22:if(f.memoizedState!==null&&f.memoizedState.cachePool!==null){var g=f.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:P2(f.memoizedState.cache)}if(g=f.child,g!==null)g.return=f,Zn=g;else e:for(f=r;Zn!==null;){g=Zn;var w=g.sibling,S=g.return;if(vX(g),g===f){Zn=null;break e}if(w!==null){w.return=S,Zn=w;break e}Zn=S}}}var l1e={getCacheForType:function(r){var c=co(Hn),f=c.data.get(r);return f===void 0&&(f=r(),c.data.set(r,f)),f}},u1e=typeof WeakMap=="function"?WeakMap:Map,Pt=0,Ft=null,wt=null,Ct=0,$t=0,Bo=null,Ii=!1,V1=!1,hz=!1,Wr=0,fn=0,Ti=0,oc=0,fz=0,ha=0,B1=0,ef=null,Lo=null,pz=!1,yz=0,Sy=1/0,Cy=null,Ri=null,ao=0,Pi=null,F1=null,U1=0,mz=0,gz=null,LX=null,tf=0,vz=null;function Fo(){if((Pt&2)!==0&&Ct!==0)return Ct&-Ct;if(P.T!==null){var r=I1;return r!==0?r:Sz()}return ee()}function jX(){ha===0&&(ha=(Ct&536870912)===0||Et?Qa():536870912);var r=da.current;return r!==null&&(r.flags|=32),ha}function Uo(r,c,f){(r===Ft&&($t===2||$t===9)||r.cancelPendingCommit!==null)&&(G1(r,0),$i(r,Ct,ha,!1)),tr(r,f),((Pt&2)===0||r!==Ft)&&(r===Ft&&((Pt&2)===0&&(oc|=f),fn===4&&$i(r,Ct,ha,!1)),lr(r))}function AX(r,c,f){if((Pt&6)!==0)throw Error(o(327));var g=!f&&(c&124)===0&&(c&r.expiredLanes)===0||Dt(r,c),w=g?f1e(r,c):wz(r,c,!0),S=g;do{if(w===0){V1&&!g&&$i(r,c,0,!1);break}else{if(f=r.current.alternate,S&&!d1e(f)){w=wz(r,c,!1),S=!1;continue}if(w===2){if(S=c,r.errorRecoveryDisabledLanes&S)var $=0;else $=r.pendingLanes&-536870913,$=$!==0?$:$&536870912?536870912:0;if($!==0){c=$;e:{var B=r;w=ef;var J=B.current.memoizedState.isDehydrated;if(J&&(G1(B,$).flags|=256),$=wz(B,$,!1),$!==2){if(hz&&!J){B.errorRecoveryDisabledLanes|=S,oc|=S,w=4;break e}S=Lo,Lo=w,S!==null&&(Lo===null?Lo=S:Lo.push.apply(Lo,S))}w=$}if(S=!1,w!==2)continue}}if(w===1){G1(r,0),$i(r,c,0,!0);break}e:{switch(g=r,S=w,S){case 0:case 1:throw Error(o(345));case 4:if((c&4194048)!==c)break;case 6:$i(g,c,ha,!Ii);break e;case 2:Lo=null;break;case 3:case 5:break;default:throw Error(o(329))}if((c&62914560)===c&&(w=yz+300-We(),10<w)){if($i(g,c,ha,!Ii),At(g,0,!0)!==0)break e;g.timeoutHandle=rZ(EX.bind(null,g,f,Lo,Cy,pz,c,ha,oc,B1,Ii,S,2,-0,0),w);break e}EX(g,f,Lo,Cy,pz,c,ha,oc,B1,Ii,S,0,-0,0)}}break}while(!0);lr(r)}function EX(r,c,f,g,w,S,$,B,J,se,ye,we,ue,he){if(r.timeoutHandle=-1,we=c.subtreeFlags,(we&8192||(we&16785408)===16785408)&&(lf={stylesheets:null,count:0,unsuspend:G1e},_X(c),we=Z1e(),we!==null)){r.cancelPendingCommit=we(zX.bind(null,r,c,S,f,g,w,$,B,J,ye,1,ue,he)),$i(r,S,$,!se);return}zX(r,c,S,f,g,w,$,B,J)}function d1e(r){for(var c=r;;){var f=c.tag;if((f===0||f===11||f===15)&&c.flags&16384&&(f=c.updateQueue,f!==null&&(f=f.stores,f!==null)))for(var g=0;g<f.length;g++){var w=f[g],S=w.getSnapshot;w=w.value;try{if(!Oo(S(),w))return!1}catch{return!1}}if(f=c.child,c.subtreeFlags&16384&&f!==null)f.return=c,c=f;else{if(c===r)break;for(;c.sibling===null;){if(c.return===null||c.return===r)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function $i(r,c,f,g){c&=~fz,c&=~oc,r.suspendedLanes|=c,r.pingedLanes&=~c,g&&(r.warmLanes|=c),g=r.expirationTimes;for(var w=c;0<w;){var S=31-He(w),$=1<<S;g[S]=-1,w&=~$}f!==0&&Pr(r,f,c)}function Ny(){return(Pt&6)===0?(nf(0),!1):!0}function kz(){if(wt!==null){if($t===0)var r=wt.return;else r=wt,Vr=Ks=null,$D(r),z1=null,G2=0,r=wt;for(;r!==null;)uX(r.alternate,r),r=r.return;wt=null}}function G1(r,c){var f=r.timeoutHandle;f!==-1&&(r.timeoutHandle=-1,j1e(f)),f=r.cancelPendingCommit,f!==null&&(r.cancelPendingCommit=null,f()),kz(),Ft=r,wt=f=Or(r.current,null),Ct=c,$t=0,Bo=null,Ii=!1,V1=Dt(r,c),hz=!1,B1=ha=fz=oc=Ti=fn=0,Lo=ef=null,pz=!1,(c&8)!==0&&(c|=c&32);var g=r.entangledLanes;if(g!==0)for(r=r.entanglements,g&=c;0<g;){var w=31-He(g),S=1<<w;c|=r[w],g&=~S}return Wr=c,Yp(),f}function IX(r,c){pt=null,P.H=py,c===D2||c===ay?(c=YU(),$t=3):c===GU?(c=YU(),$t=4):$t=c===WG?8:c!==null&&typeof c=="object"&&typeof c.then=="function"?6:1,Bo=c,wt===null&&(fn=1,ky(r,sa(c,r.current)))}function TX(){var r=P.H;return P.H=py,r===null?py:r}function RX(){var r=P.A;return P.A=l1e,r}function xz(){fn=4,Ii||(Ct&4194048)!==Ct&&da.current!==null||(V1=!0),(Ti&134217727)===0&&(oc&134217727)===0||Ft===null||$i(Ft,Ct,ha,!1)}function wz(r,c,f){var g=Pt;Pt|=2;var w=TX(),S=RX();(Ft!==r||Ct!==c)&&(Cy=null,G1(r,c)),c=!1;var $=fn;e:do try{if($t!==0&&wt!==null){var B=wt,J=Bo;switch($t){case 8:kz(),$=6;break e;case 3:case 2:case 9:case 6:da.current===null&&(c=!0);var se=$t;if($t=0,Bo=null,X1(r,B,J,se),f&&V1){$=0;break e}break;default:se=$t,$t=0,Bo=null,X1(r,B,J,se)}}h1e(),$=fn;break}catch(ye){IX(r,ye)}while(!0);return c&&r.shellSuspendCounter++,Vr=Ks=null,Pt=g,P.H=w,P.A=S,wt===null&&(Ft=null,Ct=0,Yp()),$}function h1e(){for(;wt!==null;)PX(wt)}function f1e(r,c){var f=Pt;Pt|=2;var g=TX(),w=RX();Ft!==r||Ct!==c?(Cy=null,Sy=We()+500,G1(r,c)):V1=Dt(r,c);e:do try{if($t!==0&&wt!==null){c=wt;var S=Bo;t:switch($t){case 1:$t=0,Bo=null,X1(r,c,S,1);break;case 2:case 9:if(XU(S)){$t=0,Bo=null,$X(c);break}c=function(){$t!==2&&$t!==9||Ft!==r||($t=7),lr(r)},S.then(c,c);break e;case 3:$t=7;break e;case 4:$t=5;break e;case 7:XU(S)?($t=0,Bo=null,$X(c)):($t=0,Bo=null,X1(r,c,S,7));break;case 5:var $=null;switch(wt.tag){case 26:$=wt.memoizedState;case 5:case 27:var B=wt;if(!$||gZ($)){$t=0,Bo=null;var J=B.sibling;if(J!==null)wt=J;else{var se=B.return;se!==null?(wt=se,Ly(se)):wt=null}break t}}$t=0,Bo=null,X1(r,c,S,5);break;case 6:$t=0,Bo=null,X1(r,c,S,6);break;case 8:kz(),fn=6;break e;default:throw Error(o(462))}}p1e();break}catch(ye){IX(r,ye)}while(!0);return Vr=Ks=null,P.H=g,P.A=w,Pt=f,wt!==null?0:(Ft=null,Ct=0,Yp(),fn)}function p1e(){for(;wt!==null&&!ct();)PX(wt)}function PX(r){var c=cX(r.alternate,r,Wr);r.memoizedProps=r.pendingProps,c===null?Ly(r):wt=c}function $X(r){var c=r,f=c.alternate;switch(c.tag){case 15:case 0:c=nX(f,c,c.pendingProps,c.type,void 0,Ct);break;case 11:c=nX(f,c,c.pendingProps,c.type.render,c.ref,Ct);break;case 5:$D(c);default:uX(f,c),c=wt=DU(c,Wr),c=cX(f,c,Wr)}r.memoizedProps=r.pendingProps,c===null?Ly(r):wt=c}function X1(r,c,f,g){Vr=Ks=null,$D(c),z1=null,G2=0;var w=c.return;try{if(o1e(r,w,c,f,Ct)){fn=1,ky(r,sa(f,r.current)),wt=null;return}}catch(S){if(w!==null)throw wt=w,S;fn=1,ky(r,sa(f,r.current)),wt=null;return}c.flags&32768?(Et||g===1?r=!0:V1||(Ct&536870912)!==0?r=!1:(Ii=r=!0,(g===2||g===9||g===3||g===6)&&(g=da.current,g!==null&&g.tag===13&&(g.flags|=16384))),DX(c,r)):Ly(c)}function Ly(r){var c=r;do{if((c.flags&32768)!==0){DX(c,Ii);return}r=c.return;var f=r1e(c.alternate,c,Wr);if(f!==null){wt=f;return}if(c=c.sibling,c!==null){wt=c;return}wt=c=r}while(c!==null);fn===0&&(fn=5)}function DX(r,c){do{var f=i1e(r.alternate,r);if(f!==null){f.flags&=32767,wt=f;return}if(f=r.return,f!==null&&(f.flags|=32768,f.subtreeFlags=0,f.deletions=null),!c&&(r=r.sibling,r!==null)){wt=r;return}wt=r=f}while(r!==null);fn=6,wt=null}function zX(r,c,f,g,w,S,$,B,J){r.cancelPendingCommit=null;do jy();while(ao!==0);if((Pt&6)!==0)throw Error(o(327));if(c!==null){if(c===r.current)throw Error(o(177));if(S=c.lanes|c.childLanes,S|=dD,ra(r,f,S,$,B,J),r===Ft&&(wt=Ft=null,Ct=0),F1=c,Pi=r,U1=f,mz=S,gz=w,LX=g,(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,v1e(An,function(){return BX(),null})):(r.callbackNode=null,r.callbackPriority=0),g=(c.flags&13878)!==0,(c.subtreeFlags&13878)!==0||g){g=P.T,P.T=null,w=X.p,X.p=2,$=Pt,Pt|=4;try{s1e(r,c,f)}finally{Pt=$,X.p=w,P.T=g}}ao=1,OX(),qX(),HX()}}function OX(){if(ao===1){ao=0;var r=Pi,c=F1,f=(c.flags&13878)!==0;if((c.subtreeFlags&13878)!==0||f){f=P.T,P.T=null;var g=X.p;X.p=2;var w=Pt;Pt|=4;try{wX(c,r);var S=Tz,$=NU(r.containerInfo),B=S.focusedElem,J=S.selectionRange;if($!==B&&B&&B.ownerDocument&&CU(B.ownerDocument.documentElement,B)){if(J!==null&&iD(B)){var se=J.start,ye=J.end;if(ye===void 0&&(ye=se),"selectionStart"in B)B.selectionStart=se,B.selectionEnd=Math.min(ye,B.value.length);else{var we=B.ownerDocument||document,ue=we&&we.defaultView||window;if(ue.getSelection){var he=ue.getSelection(),at=B.textContent.length,Je=Math.min(J.start,at),Ht=J.end===void 0?Je:Math.min(J.end,at);!he.extend&&Je>Ht&&($=Ht,Ht=Je,Je=$);var ae=SU(B,Je),oe=SU(B,Ht);if(ae&&oe&&(he.rangeCount!==1||he.anchorNode!==ae.node||he.anchorOffset!==ae.offset||he.focusNode!==oe.node||he.focusOffset!==oe.offset)){var ie=we.createRange();ie.setStart(ae.node,ae.offset),he.removeAllRanges(),Je>Ht?(he.addRange(ie),he.extend(oe.node,oe.offset)):(ie.setEnd(oe.node,oe.offset),he.addRange(ie))}}}}for(we=[],he=B;he=he.parentNode;)he.nodeType===1&&we.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof B.focus=="function"&&B.focus(),B=0;B<we.length;B++){var ve=we[B];ve.element.scrollLeft=ve.left,ve.element.scrollTop=ve.top}}Hy=!!Iz,Tz=Iz=null}finally{Pt=w,X.p=g,P.T=f}}r.current=c,ao=2}}function qX(){if(ao===2){ao=0;var r=Pi,c=F1,f=(c.flags&8772)!==0;if((c.subtreeFlags&8772)!==0||f){f=P.T,P.T=null;var g=X.p;X.p=2;var w=Pt;Pt|=4;try{gX(r,c.alternate,c)}finally{Pt=w,X.p=g,P.T=f}}ao=3}}function HX(){if(ao===4||ao===3){ao=0,jt();var r=Pi,c=F1,f=U1,g=LX;(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?ao=5:(ao=0,F1=Pi=null,VX(r,r.pendingLanes));var w=r.pendingLanes;if(w===0&&(Ri=null),Hs(f),c=c.stateNode,be&&typeof be.onCommitFiberRoot=="function")try{be.onCommitFiberRoot(fe,c,void 0,(c.current.flags&128)===128)}catch{}if(g!==null){c=P.T,w=X.p,X.p=2,P.T=null;try{for(var S=r.onRecoverableError,$=0;$<g.length;$++){var B=g[$];S(B.value,{componentStack:B.stack})}}finally{P.T=c,X.p=w}}(U1&3)!==0&&jy(),lr(r),w=r.pendingLanes,(f&4194090)!==0&&(w&42)!==0?r===vz?tf++:(tf=0,vz=r):tf=0,nf(0)}}function VX(r,c){(r.pooledCacheLanes&=c)===0&&(c=r.pooledCache,c!=null&&(r.pooledCache=null,P2(c)))}function jy(r){return OX(),qX(),HX(),BX()}function BX(){if(ao!==5)return!1;var r=Pi,c=mz;mz=0;var f=Hs(U1),g=P.T,w=X.p;try{X.p=32>f?32:f,P.T=null,f=gz,gz=null;var S=Pi,$=U1;if(ao=0,F1=Pi=null,U1=0,(Pt&6)!==0)throw Error(o(331));var B=Pt;if(Pt|=4,CX(S.current),MX(S,S.current,$,f),Pt=B,nf(0,!1),be&&typeof be.onPostCommitFiberRoot=="function")try{be.onPostCommitFiberRoot(fe,S)}catch{}return!0}finally{X.p=w,P.T=g,VX(r,c)}}function FX(r,c,f){c=sa(f,c),c=WD(r.stateNode,c,2),r=Si(r,c,2),r!==null&&(tr(r,2),lr(r))}function Bt(r,c,f){if(r.tag===3)FX(r,r,f);else for(;c!==null;){if(c.tag===3){FX(c,r,f);break}else if(c.tag===1){var g=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Ri===null||!Ri.has(g))){r=sa(f,r),f=ZG(2),g=Si(c,f,2),g!==null&&(YG(f,g,c,r),tr(g,2),lr(g));break}}c=c.return}}function bz(r,c,f){var g=r.pingCache;if(g===null){g=r.pingCache=new u1e;var w=new Set;g.set(c,w)}else w=g.get(c),w===void 0&&(w=new Set,g.set(c,w));w.has(f)||(hz=!0,w.add(f),r=y1e.bind(null,r,c,f),c.then(r,r))}function y1e(r,c,f){var g=r.pingCache;g!==null&&g.delete(c),r.pingedLanes|=r.suspendedLanes&f,r.warmLanes&=~f,Ft===r&&(Ct&f)===f&&(fn===4||fn===3&&(Ct&62914560)===Ct&&300>We()-yz?(Pt&2)===0&&G1(r,0):fz|=f,B1===Ct&&(B1=0)),lr(r)}function UX(r,c){c===0&&(c=Ja()),r=L1(r,c),r!==null&&(tr(r,c),lr(r))}function m1e(r){var c=r.memoizedState,f=0;c!==null&&(f=c.retryLane),UX(r,f)}function g1e(r,c){var f=0;switch(r.tag){case 13:var g=r.stateNode,w=r.memoizedState;w!==null&&(f=w.retryLane);break;case 19:g=r.stateNode;break;case 22:g=r.stateNode._retryCache;break;default:throw Error(o(314))}g!==null&&g.delete(c),UX(r,f)}function v1e(r,c){return Te(r,c)}var Ay=null,Z1=null,Mz=!1,Ey=!1,_z=!1,ac=0;function lr(r){r!==Z1&&r.next===null&&(Z1===null?Ay=Z1=r:Z1=Z1.next=r),Ey=!0,Mz||(Mz=!0,x1e())}function nf(r,c){if(!_z&&Ey){_z=!0;do for(var f=!1,g=Ay;g!==null;){if(r!==0){var w=g.pendingLanes;if(w===0)var S=0;else{var $=g.suspendedLanes,B=g.pingedLanes;S=(1<<31-He(42|r)+1)-1,S&=w&~($&~B),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(f=!0,YX(g,S))}else S=Ct,S=At(g,g===Ft?S:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(S&3)===0||Dt(g,S)||(f=!0,YX(g,S));g=g.next}while(f);_z=!1}}function k1e(){GX()}function GX(){Ey=Mz=!1;var r=0;ac!==0&&(L1e()&&(r=ac),ac=0);for(var c=We(),f=null,g=Ay;g!==null;){var w=g.next,S=XX(g,c);S===0?(g.next=null,f===null?Ay=w:f.next=w,w===null&&(Z1=f)):(f=g,(r!==0||(S&3)!==0)&&(Ey=!0)),g=w}nf(r)}function XX(r,c){for(var f=r.suspendedLanes,g=r.pingedLanes,w=r.expirationTimes,S=r.pendingLanes&-62914561;0<S;){var $=31-He(S),B=1<<$,J=w[$];J===-1?((B&f)===0||(B&g)!==0)&&(w[$]=En(B,c)):J<=c&&(r.expiredLanes|=B),S&=~B}if(c=Ft,f=Ct,f=At(r,r===c?f:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),g=r.callbackNode,f===0||r===c&&($t===2||$t===9)||r.cancelPendingCommit!==null)return g!==null&&g!==null&&qe(g),r.callbackNode=null,r.callbackPriority=0;if((f&3)===0||Dt(r,f)){if(c=f&-f,c===r.callbackPriority)return c;switch(g!==null&&qe(g),Hs(f)){case 2:case 8:f=eo;break;case 32:f=An;break;case 268435456:f=On;break;default:f=An}return g=ZX.bind(null,r),f=Te(f,g),r.callbackPriority=c,r.callbackNode=f,c}return g!==null&&g!==null&&qe(g),r.callbackPriority=2,r.callbackNode=null,2}function ZX(r,c){if(ao!==0&&ao!==5)return r.callbackNode=null,r.callbackPriority=0,null;var f=r.callbackNode;if(jy()&&r.callbackNode!==f)return null;var g=Ct;return g=At(r,r===Ft?g:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),g===0?null:(AX(r,g,c),XX(r,We()),r.callbackNode!=null&&r.callbackNode===f?ZX.bind(null,r):null)}function YX(r,c){if(jy())return null;AX(r,c,!0)}function x1e(){A1e(function(){(Pt&6)!==0?Te(Rt,k1e):GX()})}function Sz(){return ac===0&&(ac=Qa()),ac}function WX(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Vp(""+r)}function KX(r,c){var f=c.ownerDocument.createElement("input");return f.name=c.name,f.value=c.value,r.id&&f.setAttribute("form",r.id),c.parentNode.insertBefore(f,c),r=new FormData(r),f.parentNode.removeChild(f),r}function w1e(r,c,f,g,w){if(c==="submit"&&f&&f.stateNode===w){var S=WX((w[Ce]||null).action),$=g.submitter;$&&(c=(c=$[Ce]||null)?WX(c.formAction):$.getAttribute("formAction"),c!==null&&(S=c,$=null));var B=new Gp("action","action",null,g,w);r.push({event:B,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(ac!==0){var J=$?KX(w,$):new FormData(w);UD(f,{pending:!0,data:J,method:w.method,action:S},null,J)}}else typeof S=="function"&&(B.preventDefault(),J=$?KX(w,$):new FormData(w),UD(f,{pending:!0,data:J,method:w.method,action:S},S,J))},currentTarget:w}]})}}for(var Cz=0;Cz<uD.length;Cz++){var Nz=uD[Cz],b1e=Nz.toLowerCase(),M1e=Nz[0].toUpperCase()+Nz.slice(1);Aa(b1e,"on"+M1e)}Aa(AU,"onAnimationEnd"),Aa(EU,"onAnimationIteration"),Aa(IU,"onAnimationStart"),Aa("dblclick","onDoubleClick"),Aa("focusin","onFocus"),Aa("focusout","onBlur"),Aa(qde,"onTransitionRun"),Aa(Hde,"onTransitionStart"),Aa(Vde,"onTransitionCancel"),Aa(TU,"onTransitionEnd"),bo("onMouseEnter",["mouseout","mouseover"]),bo("onMouseLeave",["mouseout","mouseover"]),bo("onPointerEnter",["pointerout","pointerover"]),bo("onPointerLeave",["pointerout","pointerover"]),to("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),to("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),to("onBeforeInput",["compositionend","keypress","textInput","paste"]),to("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),to("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),to("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var of="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),_1e=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(of));function QX(r,c){c=(c&4)!==0;for(var f=0;f<r.length;f++){var g=r[f],w=g.event;g=g.listeners;e:{var S=void 0;if(c)for(var $=g.length-1;0<=$;$--){var B=g[$],J=B.instance,se=B.currentTarget;if(B=B.listener,J!==S&&w.isPropagationStopped())break e;S=B,w.currentTarget=se;try{S(w)}catch(ye){vy(ye)}w.currentTarget=null,S=J}else for($=0;$<g.length;$++){if(B=g[$],J=B.instance,se=B.currentTarget,B=B.listener,J!==S&&w.isPropagationStopped())break e;S=B,w.currentTarget=se;try{S(w)}catch(ye){vy(ye)}w.currentTarget=null,S=J}}}}function bt(r,c){var f=c[Ke];f===void 0&&(f=c[Ke]=new Set);var g=r+"__bubble";f.has(g)||(JX(c,r,2,!1),f.add(g))}function Lz(r,c,f){var g=0;c&&(g|=4),JX(f,r,g,c)}var Iy="_reactListening"+Math.random().toString(36).slice(2);function jz(r){if(!r[Iy]){r[Iy]=!0,xt.forEach(function(f){f!=="selectionchange"&&(_1e.has(f)||Lz(f,!1,r),Lz(f,!0,r))});var c=r.nodeType===9?r:r.ownerDocument;c===null||c[Iy]||(c[Iy]=!0,Lz("selectionchange",!1,c))}}function JX(r,c,f,g){switch(MZ(c)){case 2:var w=K1e;break;case 8:w=Q1e;break;default:w=Bz}f=w.bind(null,c,f,r),w=void 0,!K$||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(w=!0),g?w!==void 0?r.addEventListener(c,f,{capture:!0,passive:w}):r.addEventListener(c,f,!0):w!==void 0?r.addEventListener(c,f,{passive:w}):r.addEventListener(c,f,!1)}function Az(r,c,f,g,w){var S=g;if((c&1)===0&&(c&2)===0&&g!==null)e:for(;;){if(g===null)return;var $=g.tag;if($===3||$===4){var B=g.stateNode.containerInfo;if(B===w)break;if($===4)for($=g.return;$!==null;){var J=$.tag;if((J===3||J===4)&&$.stateNode.containerInfo===w)return;$=$.return}for(;B!==null;){if($=tt(B),$===null)return;if(J=$.tag,J===5||J===6||J===26||J===27){g=S=$;continue e}B=B.parentNode}}g=g.return}iU(function(){var se=S,ye=Y$(f),we=[];e:{var ue=RU.get(r);if(ue!==void 0){var he=Gp,at=r;switch(r){case"keypress":if(Fp(f)===0)break e;case"keydown":case"keyup":he=vde;break;case"focusin":at="focus",he=tD;break;case"focusout":at="blur",he=tD;break;case"beforeblur":case"afterblur":he=tD;break;case"click":if(f.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":he=lU;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=ide;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=wde;break;case AU:case EU:case IU:he=lde;break;case TU:he=Mde;break;case"scroll":case"scrollend":he=ade;break;case"wheel":he=Sde;break;case"copy":case"cut":case"paste":he=dde;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=dU;break;case"toggle":case"beforetoggle":he=Nde}var Je=(c&4)!==0,Ht=!Je&&(r==="scroll"||r==="scrollend"),ae=Je?ue!==null?ue+"Capture":null:ue;Je=[];for(var oe=se,ie;oe!==null;){var ve=oe;if(ie=ve.stateNode,ve=ve.tag,ve!==5&&ve!==26&&ve!==27||ie===null||ae===null||(ve=b2(oe,ae),ve!=null&&Je.push(af(oe,ve,ie))),Ht)break;oe=oe.return}0<Je.length&&(ue=new he(ue,at,null,f,ye),we.push({event:ue,listeners:Je}))}}if((c&7)===0){e:{if(ue=r==="mouseover"||r==="pointerover",he=r==="mouseout"||r==="pointerout",ue&&f!==Z$&&(at=f.relatedTarget||f.fromElement)&&(tt(at)||at[Pe]))break e;if((he||ue)&&(ue=ye.window===ye?ye:(ue=ye.ownerDocument)?ue.defaultView||ue.parentWindow:window,he?(at=f.relatedTarget||f.toElement,he=se,at=at?tt(at):null,at!==null&&(Ht=i(at),Je=at.tag,at!==Ht||Je!==5&&Je!==27&&Je!==6)&&(at=null)):(he=null,at=se),he!==at)){if(Je=lU,ve="onMouseLeave",ae="onMouseEnter",oe="mouse",(r==="pointerout"||r==="pointerover")&&(Je=dU,ve="onPointerLeave",ae="onPointerEnter",oe="pointer"),Ht=he==null?ue:Vt(he),ie=at==null?ue:Vt(at),ue=new Je(ve,oe+"leave",he,f,ye),ue.target=Ht,ue.relatedTarget=ie,ve=null,tt(ye)===se&&(Je=new Je(ae,oe+"enter",at,f,ye),Je.target=ie,Je.relatedTarget=Ht,ve=Je),Ht=ve,he&&at)t:{for(Je=he,ae=at,oe=0,ie=Je;ie;ie=Y1(ie))oe++;for(ie=0,ve=ae;ve;ve=Y1(ve))ie++;for(;0<oe-ie;)Je=Y1(Je),oe--;for(;0<ie-oe;)ae=Y1(ae),ie--;for(;oe--;){if(Je===ae||ae!==null&&Je===ae.alternate)break t;Je=Y1(Je),ae=Y1(ae)}Je=null}else Je=null;he!==null&&eZ(we,ue,he,Je,!1),at!==null&&Ht!==null&&eZ(we,Ht,at,Je,!0)}}e:{if(ue=se?Vt(se):window,he=ue.nodeName&&ue.nodeName.toLowerCase(),he==="select"||he==="input"&&ue.type==="file")var $e=kU;else if(gU(ue))if(xU)$e=Dde;else{$e=Pde;var mt=Rde}else he=ue.nodeName,!he||he.toLowerCase()!=="input"||ue.type!=="checkbox"&&ue.type!=="radio"?se&&X$(se.elementType)&&($e=kU):$e=$de;if($e&&($e=$e(r,se))){vU(we,$e,f,ye);break e}mt&&mt(r,ue,se),r==="focusout"&&se&&ue.type==="number"&&se.memoizedProps.value!=null&&G$(ue,"number",ue.value)}switch(mt=se?Vt(se):window,r){case"focusin":(gU(mt)||mt.contentEditable==="true")&&(S1=mt,sD=se,A2=null);break;case"focusout":A2=sD=S1=null;break;case"mousedown":cD=!0;break;case"contextmenu":case"mouseup":case"dragend":cD=!1,LU(we,f,ye);break;case"selectionchange":if(Ode)break;case"keydown":case"keyup":LU(we,f,ye)}var Ge;if(oD)e:{switch(r){case"compositionstart":var nt="onCompositionStart";break e;case"compositionend":nt="onCompositionEnd";break e;case"compositionupdate":nt="onCompositionUpdate";break e}nt=void 0}else _1?yU(r,f)&&(nt="onCompositionEnd"):r==="keydown"&&f.keyCode===229&&(nt="onCompositionStart");nt&&(hU&&f.locale!=="ko"&&(_1||nt!=="onCompositionStart"?nt==="onCompositionEnd"&&_1&&(Ge=sU()):(wi=ye,Q$="value"in wi?wi.value:wi.textContent,_1=!0)),mt=Ty(se,nt),0<mt.length&&(nt=new uU(nt,r,null,f,ye),we.push({event:nt,listeners:mt}),Ge?nt.data=Ge:(Ge=mU(f),Ge!==null&&(nt.data=Ge)))),(Ge=jde?Ade(r,f):Ede(r,f))&&(nt=Ty(se,"onBeforeInput"),0<nt.length&&(mt=new uU("onBeforeInput","beforeinput",null,f,ye),we.push({event:mt,listeners:nt}),mt.data=Ge)),w1e(we,r,se,f,ye)}QX(we,c)})}function af(r,c,f){return{instance:r,listener:c,currentTarget:f}}function Ty(r,c){for(var f=c+"Capture",g=[];r!==null;){var w=r,S=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||S===null||(w=b2(r,f),w!=null&&g.unshift(af(r,w,S)),w=b2(r,c),w!=null&&g.push(af(r,w,S))),r.tag===3)return g;r=r.return}return[]}function Y1(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function eZ(r,c,f,g,w){for(var S=c._reactName,$=[];f!==null&&f!==g;){var B=f,J=B.alternate,se=B.stateNode;if(B=B.tag,J!==null&&J===g)break;B!==5&&B!==26&&B!==27||se===null||(J=se,w?(se=b2(f,S),se!=null&&$.unshift(af(f,se,J))):w||(se=b2(f,S),se!=null&&$.push(af(f,se,J)))),f=f.return}$.length!==0&&r.push({event:c,listeners:$})}var S1e=/\r\n?/g,C1e=/\u0000|\uFFFD/g;function tZ(r){return(typeof r=="string"?r:""+r).replace(S1e,`
48
+ `+f.stack}}function _o(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function QF(r){var c=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function Jue(r){var c=QF(r)?"checked":"value",f=Object.getOwnPropertyDescriptor(r.constructor.prototype,c),g=""+r[c];if(!r.hasOwnProperty(c)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var w=f.get,S=f.set;return Object.defineProperty(r,c,{configurable:!0,get:function(){return w.call(this)},set:function($){g=""+$,S.call(this,$)}}),Object.defineProperty(r,c,{enumerable:f.enumerable}),{getValue:function(){return g},setValue:function($){g=""+$},stopTracking:function(){r._valueTracker=null,delete r[c]}}}}function qp(r){r._valueTracker||(r._valueTracker=Jue(r))}function JF(r){if(!r)return!1;var c=r._valueTracker;if(!c)return!0;var f=c.getValue(),g="";return r&&(g=QF(r)?r.checked?"true":"false":r.value),r=g,r!==f?(c.setValue(r),!0):!1}function Hp(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var ede=/[\n"\\]/g;function ia(r){return r.replace(ede,function(c){return"\\"+c.charCodeAt(0).toString(16)+" "})}function U$(r,c,f,g,w,S,$,B){r.name="",$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?r.type=$:r.removeAttribute("type"),c!=null?$==="number"?(c===0&&r.value===""||r.value!=c)&&(r.value=""+_o(c)):r.value!==""+_o(c)&&(r.value=""+_o(c)):$!=="submit"&&$!=="reset"||r.removeAttribute("value"),c!=null?G$(r,$,_o(c)):f!=null?G$(r,$,_o(f)):g!=null&&r.removeAttribute("value"),w==null&&S!=null&&(r.defaultChecked=!!S),w!=null&&(r.checked=w&&typeof w!="function"&&typeof w!="symbol"),B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?r.name=""+_o(B):r.removeAttribute("name")}function eU(r,c,f,g,w,S,$,B){if(S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(r.type=S),c!=null||f!=null){if(!(S!=="submit"&&S!=="reset"||c!=null))return;f=f!=null?""+_o(f):"",c=c!=null?""+_o(c):f,B||c===r.value||(r.value=c),r.defaultValue=c}g=g??w,g=typeof g!="function"&&typeof g!="symbol"&&!!g,r.checked=B?r.checked:!!g,r.defaultChecked=!!g,$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"&&(r.name=$)}function G$(r,c,f){c==="number"&&Hp(r.ownerDocument)===r||r.defaultValue===""+f||(r.defaultValue=""+f)}function x1(r,c,f,g){if(r=r.options,c){c={};for(var w=0;w<f.length;w++)c["$"+f[w]]=!0;for(f=0;f<r.length;f++)w=c.hasOwnProperty("$"+r[f].value),r[f].selected!==w&&(r[f].selected=w),w&&g&&(r[f].defaultSelected=!0)}else{for(f=""+_o(f),c=null,w=0;w<r.length;w++){if(r[w].value===f){r[w].selected=!0,g&&(r[w].defaultSelected=!0);return}c!==null||r[w].disabled||(c=r[w])}c!==null&&(c.selected=!0)}}function tU(r,c,f){if(c!=null&&(c=""+_o(c),c!==r.value&&(r.value=c),f==null)){r.defaultValue!==c&&(r.defaultValue=c);return}r.defaultValue=f!=null?""+_o(f):""}function nU(r,c,f,g){if(c==null){if(g!=null){if(f!=null)throw Error(o(92));if(O(g)){if(1<g.length)throw Error(o(93));g=g[0]}f=g}f==null&&(f=""),c=f}f=_o(c),r.defaultValue=f,g=r.textContent,g===f&&g!==""&&g!==null&&(r.value=g)}function w1(r,c){if(c){var f=r.firstChild;if(f&&f===r.lastChild&&f.nodeType===3){f.nodeValue=c;return}}r.textContent=c}var tde=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function oU(r,c,f){var g=c.indexOf("--")===0;f==null||typeof f=="boolean"||f===""?g?r.setProperty(c,""):c==="float"?r.cssFloat="":r[c]="":g?r.setProperty(c,f):typeof f!="number"||f===0||tde.has(c)?c==="float"?r.cssFloat=f:r[c]=(""+f).trim():r[c]=f+"px"}function aU(r,c,f){if(c!=null&&typeof c!="object")throw Error(o(62));if(r=r.style,f!=null){for(var g in f)!f.hasOwnProperty(g)||c!=null&&c.hasOwnProperty(g)||(g.indexOf("--")===0?r.setProperty(g,""):g==="float"?r.cssFloat="":r[g]="");for(var w in c)g=c[w],c.hasOwnProperty(w)&&f[w]!==g&&oU(r,w,g)}else for(var S in c)c.hasOwnProperty(S)&&oU(r,S,c[S])}function X$(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var nde=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),ode=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Vp(r){return ode.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}var Z$=null;function Y$(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var b1=null,M1=null;function rU(r){var c=Mt(r);if(c&&(r=c.stateNode)){var f=r[Ce]||null;e:switch(r=c.stateNode,c.type){case"input":if(U$(r,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name),c=f.name,f.type==="radio"&&c!=null){for(f=r;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll('input[name="'+ia(""+c)+'"][type="radio"]'),c=0;c<f.length;c++){var g=f[c];if(g!==r&&g.form===r.form){var w=g[Ce]||null;if(!w)throw Error(o(90));U$(g,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(c=0;c<f.length;c++)g=f[c],g.form===r.form&&JF(g)}break e;case"textarea":tU(r,f.value,f.defaultValue);break e;case"select":c=f.value,c!=null&&x1(r,!!f.multiple,c,!1)}}}var W$=!1;function iU(r,c,f){if(W$)return r(c,f);W$=!0;try{var g=r(c);return g}finally{if(W$=!1,(b1!==null||M1!==null)&&(Ny(),b1&&(c=b1,r=M1,M1=b1=null,rU(c),r)))for(c=0;c<r.length;c++)rU(r[c])}}function b2(r,c){var f=r.stateNode;if(f===null)return null;var g=f[Ce]||null;if(g===null)return null;f=g[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(r=r.type,g=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!g;break e;default:r=!1}if(r)return null;if(f&&typeof f!="function")throw Error(o(231,c,typeof f));return f}var zr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),K$=!1;if(zr)try{var M2={};Object.defineProperty(M2,"passive",{get:function(){K$=!0}}),window.addEventListener("test",M2,M2),window.removeEventListener("test",M2,M2)}catch{K$=!1}var wi=null,Q$=null,Bp=null;function sU(){if(Bp)return Bp;var r,c=Q$,f=c.length,g,w="value"in wi?wi.value:wi.textContent,S=w.length;for(r=0;r<f&&c[r]===w[r];r++);var $=f-r;for(g=1;g<=$&&c[f-g]===w[S-g];g++);return Bp=w.slice(r,1<g?1-g:void 0)}function Fp(r){var c=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&c===13&&(r=13)):r=c,r===10&&(r=13),32<=r||r===13?r:0}function Up(){return!0}function cU(){return!1}function So(r){function c(f,g,w,S,$){this._reactName=f,this._targetInst=w,this.type=g,this.nativeEvent=S,this.target=$,this.currentTarget=null;for(var B in r)r.hasOwnProperty(B)&&(f=r[B],this[B]=f?f(S):S[B]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?Up:cU,this.isPropagationStopped=cU,this}return p(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var f=this.nativeEvent;f&&(f.preventDefault?f.preventDefault():typeof f.returnValue!="unknown"&&(f.returnValue=!1),this.isDefaultPrevented=Up)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=Up)},persist:function(){},isPersistent:Up}),c}var Bs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gp=So(Bs),_2=p({},Bs,{view:0,detail:0}),ade=So(_2),J$,eD,S2,Xp=p({},_2,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nD,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==S2&&(S2&&r.type==="mousemove"?(J$=r.screenX-S2.screenX,eD=r.screenY-S2.screenY):eD=J$=0,S2=r),J$)},movementY:function(r){return"movementY"in r?r.movementY:eD}}),lU=So(Xp),rde=p({},Xp,{dataTransfer:0}),ide=So(rde),sde=p({},_2,{relatedTarget:0}),tD=So(sde),cde=p({},Bs,{animationName:0,elapsedTime:0,pseudoElement:0}),lde=So(cde),ude=p({},Bs,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),dde=So(ude),hde=p({},Bs,{data:0}),uU=So(hde),fde={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pde={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},yde={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function mde(r){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(r):(r=yde[r])?!!c[r]:!1}function nD(){return mde}var gde=p({},_2,{key:function(r){if(r.key){var c=fde[r.key]||r.key;if(c!=="Unidentified")return c}return r.type==="keypress"?(r=Fp(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?pde[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nD,charCode:function(r){return r.type==="keypress"?Fp(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Fp(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),vde=So(gde),kde=p({},Xp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),dU=So(kde),xde=p({},_2,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nD}),wde=So(xde),bde=p({},Bs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Mde=So(bde),_de=p({},Xp,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Sde=So(_de),Cde=p({},Bs,{newState:0,oldState:0}),Nde=So(Cde),Lde=[9,13,27,32],oD=zr&&"CompositionEvent"in window,C2=null;zr&&"documentMode"in document&&(C2=document.documentMode);var jde=zr&&"TextEvent"in window&&!C2,hU=zr&&(!oD||C2&&8<C2&&11>=C2),fU=" ",pU=!1;function yU(r,c){switch(r){case"keyup":return Lde.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function mU(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var _1=!1;function Ade(r,c){switch(r){case"compositionend":return mU(c);case"keypress":return c.which!==32?null:(pU=!0,fU);case"textInput":return r=c.data,r===fU&&pU?null:r;default:return null}}function Ede(r,c){if(_1)return r==="compositionend"||!oD&&yU(r,c)?(r=sU(),Bp=Q$=wi=null,_1=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return hU&&c.locale!=="ko"?null:c.data;default:return null}}var Ide={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function gU(r){var c=r&&r.nodeName&&r.nodeName.toLowerCase();return c==="input"?!!Ide[r.type]:c==="textarea"}function vU(r,c,f,g){b1?M1?M1.push(g):M1=[g]:b1=g,c=Ty(c,"onChange"),0<c.length&&(f=new Gp("onChange","change",null,f,g),r.push({event:f,listeners:c}))}var N2=null,L2=null;function Tde(r){QX(r,0)}function Zp(r){var c=Bt(r);if(JF(c))return r}function kU(r,c){if(r==="change")return c}var xU=!1;if(zr){var aD;if(zr){var rD="oninput"in document;if(!rD){var wU=document.createElement("div");wU.setAttribute("oninput","return;"),rD=typeof wU.oninput=="function"}aD=rD}else aD=!1;xU=aD&&(!document.documentMode||9<document.documentMode)}function bU(){N2&&(N2.detachEvent("onpropertychange",MU),L2=N2=null)}function MU(r){if(r.propertyName==="value"&&Zp(L2)){var c=[];vU(c,L2,r,Y$(r)),iU(Tde,c)}}function Rde(r,c,f){r==="focusin"?(bU(),N2=c,L2=f,N2.attachEvent("onpropertychange",MU)):r==="focusout"&&bU()}function Pde(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Zp(L2)}function $de(r,c){if(r==="click")return Zp(c)}function Dde(r,c){if(r==="input"||r==="change")return Zp(c)}function zde(r,c){return r===c&&(r!==0||1/r===1/c)||r!==r&&c!==c}var Oo=typeof Object.is=="function"?Object.is:zde;function j2(r,c){if(Oo(r,c))return!0;if(typeof r!="object"||r===null||typeof c!="object"||c===null)return!1;var f=Object.keys(r),g=Object.keys(c);if(f.length!==g.length)return!1;for(g=0;g<f.length;g++){var w=f[g];if(!Ie.call(c,w)||!Oo(r[w],c[w]))return!1}return!0}function _U(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function SU(r,c){var f=_U(r);r=0;for(var g;f;){if(f.nodeType===3){if(g=r+f.textContent.length,r<=c&&g>=c)return{node:f,offset:c-r};r=g}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=_U(f)}}function CU(r,c){return r&&c?r===c?!0:r&&r.nodeType===3?!1:c&&c.nodeType===3?CU(r,c.parentNode):"contains"in r?r.contains(c):r.compareDocumentPosition?!!(r.compareDocumentPosition(c)&16):!1:!1}function NU(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var c=Hp(r.document);c instanceof r.HTMLIFrameElement;){try{var f=typeof c.contentWindow.location.href=="string"}catch{f=!1}if(f)r=c.contentWindow;else break;c=Hp(r.document)}return c}function iD(r){var c=r&&r.nodeName&&r.nodeName.toLowerCase();return c&&(c==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||c==="textarea"||r.contentEditable==="true")}var Ode=zr&&"documentMode"in document&&11>=document.documentMode,S1=null,sD=null,A2=null,cD=!1;function LU(r,c,f){var g=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;cD||S1==null||S1!==Hp(g)||(g=S1,"selectionStart"in g&&iD(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),A2&&j2(A2,g)||(A2=g,g=Ty(sD,"onSelect"),0<g.length&&(c=new Gp("onSelect","select",null,c,f),r.push({event:c,listeners:g}),c.target=S1)))}function Fs(r,c){var f={};return f[r.toLowerCase()]=c.toLowerCase(),f["Webkit"+r]="webkit"+c,f["Moz"+r]="moz"+c,f}var C1={animationend:Fs("Animation","AnimationEnd"),animationiteration:Fs("Animation","AnimationIteration"),animationstart:Fs("Animation","AnimationStart"),transitionrun:Fs("Transition","TransitionRun"),transitionstart:Fs("Transition","TransitionStart"),transitioncancel:Fs("Transition","TransitionCancel"),transitionend:Fs("Transition","TransitionEnd")},lD={},jU={};zr&&(jU=document.createElement("div").style,"AnimationEvent"in window||(delete C1.animationend.animation,delete C1.animationiteration.animation,delete C1.animationstart.animation),"TransitionEvent"in window||delete C1.transitionend.transition);function Us(r){if(lD[r])return lD[r];if(!C1[r])return r;var c=C1[r],f;for(f in c)if(c.hasOwnProperty(f)&&f in jU)return lD[r]=c[f];return r}var AU=Us("animationend"),EU=Us("animationiteration"),IU=Us("animationstart"),qde=Us("transitionrun"),Hde=Us("transitionstart"),Vde=Us("transitioncancel"),TU=Us("transitionend"),RU=new Map,uD="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");uD.push("scrollEnd");function Aa(r,c){RU.set(r,c),to(c,[r])}var PU=new WeakMap;function sa(r,c){if(typeof r=="object"&&r!==null){var f=PU.get(r);return f!==void 0?f:(c={value:r,source:c,stack:w2(c)},PU.set(r,c),c)}return{value:r,source:c,stack:w2(c)}}var ca=[],N1=0,dD=0;function Yp(){for(var r=N1,c=dD=N1=0;c<r;){var f=ca[c];ca[c++]=null;var g=ca[c];ca[c++]=null;var w=ca[c];ca[c++]=null;var S=ca[c];if(ca[c++]=null,g!==null&&w!==null){var $=g.pending;$===null?w.next=w:(w.next=$.next,$.next=w),g.pending=w}S!==0&&$U(f,w,S)}}function Wp(r,c,f,g){ca[N1++]=r,ca[N1++]=c,ca[N1++]=f,ca[N1++]=g,dD|=g,r.lanes|=g,r=r.alternate,r!==null&&(r.lanes|=g)}function hD(r,c,f,g){return Wp(r,c,f,g),Kp(r)}function L1(r,c){return Wp(r,null,null,c),Kp(r)}function $U(r,c,f){r.lanes|=f;var g=r.alternate;g!==null&&(g.lanes|=f);for(var w=!1,S=r.return;S!==null;)S.childLanes|=f,g=S.alternate,g!==null&&(g.childLanes|=f),S.tag===22&&(r=S.stateNode,r===null||r._visibility&1||(w=!0)),r=S,S=S.return;return r.tag===3?(S=r.stateNode,w&&c!==null&&(w=31-He(f),r=S.hiddenUpdates,g=r[w],g===null?r[w]=[c]:g.push(c),c.lane=f|536870912),S):null}function Kp(r){if(50<tf)throw tf=0,vz=null,Error(o(185));for(var c=r.return;c!==null;)r=c,c=r.return;return r.tag===3?r.stateNode:null}var j1={};function Bde(r,c,f,g){this.tag=r,this.key=f,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qo(r,c,f,g){return new Bde(r,c,f,g)}function fD(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Or(r,c){var f=r.alternate;return f===null?(f=qo(r.tag,c,r.key,r.mode),f.elementType=r.elementType,f.type=r.type,f.stateNode=r.stateNode,f.alternate=r,r.alternate=f):(f.pendingProps=c,f.type=r.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=r.flags&65011712,f.childLanes=r.childLanes,f.lanes=r.lanes,f.child=r.child,f.memoizedProps=r.memoizedProps,f.memoizedState=r.memoizedState,f.updateQueue=r.updateQueue,c=r.dependencies,f.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},f.sibling=r.sibling,f.index=r.index,f.ref=r.ref,f.refCleanup=r.refCleanup,f}function DU(r,c){r.flags&=65011714;var f=r.alternate;return f===null?(r.childLanes=0,r.lanes=c,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=f.childLanes,r.lanes=f.lanes,r.child=f.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=f.memoizedProps,r.memoizedState=f.memoizedState,r.updateQueue=f.updateQueue,r.type=f.type,c=f.dependencies,r.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),r}function Qp(r,c,f,g,w,S){var $=0;if(g=r,typeof r=="function")fD(r)&&($=1);else if(typeof r=="string")$=U1e(r,f,K.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case U:return r=qo(31,f,c,w),r.elementType=U,r.lanes=S,r;case M:return Gs(f.children,w,S,c);case b:$=8,w|=24;break;case C:return r=qo(12,f,c,w|2),r.elementType=C,r.lanes=S,r;case R:return r=qo(13,f,c,w),r.elementType=R,r.lanes=S,r;case j:return r=qo(19,f,c,w),r.elementType=j,r.lanes=S,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case _:case A:$=10;break e;case N:$=9;break e;case I:$=11;break e;case D:$=14;break e;case H:$=16,g=null;break e}$=29,f=Error(o(130,r===null?"null":typeof r,"")),g=null}return c=qo($,f,c,w),c.elementType=r,c.type=g,c.lanes=S,c}function Gs(r,c,f,g){return r=qo(7,r,g,c),r.lanes=f,r}function pD(r,c,f){return r=qo(6,r,null,c),r.lanes=f,r}function yD(r,c,f){return c=qo(4,r.children!==null?r.children:[],r.key,c),c.lanes=f,c.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},c}var A1=[],E1=0,Jp=null,ey=0,la=[],ua=0,Xs=null,qr=1,Hr="";function Zs(r,c){A1[E1++]=ey,A1[E1++]=Jp,Jp=r,ey=c}function zU(r,c,f){la[ua++]=qr,la[ua++]=Hr,la[ua++]=Xs,Xs=r;var g=qr;r=Hr;var w=32-He(g)-1;g&=~(1<<w),f+=1;var S=32-He(c)+w;if(30<S){var $=w-w%5;S=(g&(1<<$)-1).toString(32),g>>=$,w-=$,qr=1<<32-He(c)+w|f<<w|g,Hr=S+r}else qr=1<<S|f<<w|g,Hr=r}function mD(r){r.return!==null&&(Zs(r,1),zU(r,1,0))}function gD(r){for(;r===Jp;)Jp=A1[--E1],A1[E1]=null,ey=A1[--E1],A1[E1]=null;for(;r===Xs;)Xs=la[--ua],la[ua]=null,Hr=la[--ua],la[ua]=null,qr=la[--ua],la[ua]=null}var fo=null,hn=null,Et=!1,Ys=null,rr=!1,vD=Error(o(519));function Ws(r){var c=Error(o(418,""));throw T2(sa(c,r)),vD}function OU(r){var c=r.stateNode,f=r.type,g=r.memoizedProps;switch(c[xe]=r,c[Ce]=g,f){case"dialog":bt("cancel",c),bt("close",c);break;case"iframe":case"object":case"embed":bt("load",c);break;case"video":case"audio":for(f=0;f<of.length;f++)bt(of[f],c);break;case"source":bt("error",c);break;case"img":case"image":case"link":bt("error",c),bt("load",c);break;case"details":bt("toggle",c);break;case"input":bt("invalid",c),eU(c,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0),qp(c);break;case"select":bt("invalid",c);break;case"textarea":bt("invalid",c),nU(c,g.value,g.defaultValue,g.children),qp(c)}f=g.children,typeof f!="string"&&typeof f!="number"&&typeof f!="bigint"||c.textContent===""+f||g.suppressHydrationWarning===!0||nZ(c.textContent,f)?(g.popover!=null&&(bt("beforetoggle",c),bt("toggle",c)),g.onScroll!=null&&bt("scroll",c),g.onScrollEnd!=null&&bt("scrollend",c),g.onClick!=null&&(c.onclick=Ry),c=!0):c=!1,c||Ws(r)}function qU(r){for(fo=r.return;fo;)switch(fo.tag){case 5:case 13:rr=!1;return;case 27:case 3:rr=!0;return;default:fo=fo.return}}function E2(r){if(r!==fo)return!1;if(!Et)return qU(r),Et=!0,!1;var c=r.tag,f;if((f=c!==3&&c!==27)&&((f=c===5)&&(f=r.type,f=!(f!=="form"&&f!=="button")||Rz(r.type,r.memoizedProps)),f=!f),f&&hn&&Ws(r),qU(r),c===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(o(317));e:{for(r=r.nextSibling,c=0;r;){if(r.nodeType===8)if(f=r.data,f==="/$"){if(c===0){hn=Ia(r.nextSibling);break e}c--}else f!=="$"&&f!=="$!"&&f!=="$?"||c++;r=r.nextSibling}hn=null}}else c===27?(c=hn,Di(r.type)?(r=zz,zz=null,hn=r):hn=c):hn=fo?Ia(r.stateNode.nextSibling):null;return!0}function I2(){hn=fo=null,Et=!1}function HU(){var r=Ys;return r!==null&&(Lo===null?Lo=r:Lo.push.apply(Lo,r),Ys=null),r}function T2(r){Ys===null?Ys=[r]:Ys.push(r)}var kD=Y(null),Ks=null,Vr=null;function bi(r,c,f){T(kD,c._currentValue),c._currentValue=f}function Br(r){r._currentValue=kD.current,F(kD)}function xD(r,c,f){for(;r!==null;){var g=r.alternate;if((r.childLanes&c)!==c?(r.childLanes|=c,g!==null&&(g.childLanes|=c)):g!==null&&(g.childLanes&c)!==c&&(g.childLanes|=c),r===f)break;r=r.return}}function wD(r,c,f,g){var w=r.child;for(w!==null&&(w.return=r);w!==null;){var S=w.dependencies;if(S!==null){var $=w.child;S=S.firstContext;e:for(;S!==null;){var B=S;S=w;for(var J=0;J<c.length;J++)if(B.context===c[J]){S.lanes|=f,B=S.alternate,B!==null&&(B.lanes|=f),xD(S.return,f,r),g||($=null);break e}S=B.next}}else if(w.tag===18){if($=w.return,$===null)throw Error(o(341));$.lanes|=f,S=$.alternate,S!==null&&(S.lanes|=f),xD($,f,r),$=null}else $=w.child;if($!==null)$.return=w;else for($=w;$!==null;){if($===r){$=null;break}if(w=$.sibling,w!==null){w.return=$.return,$=w;break}$=$.return}w=$}}function R2(r,c,f,g){r=null;for(var w=c,S=!1;w!==null;){if(!S){if((w.flags&524288)!==0)S=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var $=w.alternate;if($===null)throw Error(o(387));if($=$.memoizedProps,$!==null){var B=w.type;Oo(w.pendingProps.value,$.value)||(r!==null?r.push(B):r=[B])}}else if(w===te.current){if($=w.alternate,$===null)throw Error(o(387));$.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(r!==null?r.push(uf):r=[uf])}w=w.return}r!==null&&wD(c,r,f,g),c.flags|=262144}function ty(r){for(r=r.firstContext;r!==null;){if(!Oo(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Qs(r){Ks=r,Vr=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function co(r){return VU(Ks,r)}function ny(r,c){return Ks===null&&Qs(r),VU(r,c)}function VU(r,c){var f=c._currentValue;if(c={context:c,memoizedValue:f,next:null},Vr===null){if(r===null)throw Error(o(308));Vr=c,r.dependencies={lanes:0,firstContext:c},r.flags|=524288}else Vr=Vr.next=c;return f}var Fde=typeof AbortController<"u"?AbortController:function(){var r=[],c=this.signal={aborted:!1,addEventListener:function(f,g){r.push(g)}};this.abort=function(){c.aborted=!0,r.forEach(function(f){return f()})}},Ude=e.unstable_scheduleCallback,Gde=e.unstable_NormalPriority,Hn={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bD(){return{controller:new Fde,data:new Map,refCount:0}}function P2(r){r.refCount--,r.refCount===0&&Ude(Gde,function(){r.controller.abort()})}var $2=null,MD=0,I1=0,T1=null;function Xde(r,c){if($2===null){var f=$2=[];MD=0,I1=Sz(),T1={status:"pending",value:void 0,then:function(g){f.push(g)}}}return MD++,c.then(BU,BU),c}function BU(){if(--MD===0&&$2!==null){T1!==null&&(T1.status="fulfilled");var r=$2;$2=null,I1=0,T1=null;for(var c=0;c<r.length;c++)(0,r[c])()}}function Zde(r,c){var f=[],g={status:"pending",value:null,reason:null,then:function(w){f.push(w)}};return r.then(function(){g.status="fulfilled",g.value=c;for(var w=0;w<f.length;w++)(0,f[w])(c)},function(w){for(g.status="rejected",g.reason=w,w=0;w<f.length;w++)(0,f[w])(void 0)}),g}var FU=P.S;P.S=function(r,c){typeof c=="object"&&c!==null&&typeof c.then=="function"&&Xde(r,c),FU!==null&&FU(r,c)};var Js=Y(null);function _D(){var r=Js.current;return r!==null?r:Ut.pooledCache}function oy(r,c){c===null?T(Js,Js.current):T(Js,c.pool)}function UU(){var r=_D();return r===null?null:{parent:Hn._currentValue,pool:r}}var D2=Error(o(460)),GU=Error(o(474)),ay=Error(o(542)),SD={then:function(){}};function XU(r){return r=r.status,r==="fulfilled"||r==="rejected"}function ry(){}function ZU(r,c,f){switch(f=r[f],f===void 0?r.push(c):f!==c&&(c.then(ry,ry),c=f),c.status){case"fulfilled":return c.value;case"rejected":throw r=c.reason,WU(r),r;default:if(typeof c.status=="string")c.then(ry,ry);else{if(r=Ut,r!==null&&100<r.shellSuspendCounter)throw Error(o(482));r=c,r.status="pending",r.then(function(g){if(c.status==="pending"){var w=c;w.status="fulfilled",w.value=g}},function(g){if(c.status==="pending"){var w=c;w.status="rejected",w.reason=g}})}switch(c.status){case"fulfilled":return c.value;case"rejected":throw r=c.reason,WU(r),r}throw z2=c,D2}}var z2=null;function YU(){if(z2===null)throw Error(o(459));var r=z2;return z2=null,r}function WU(r){if(r===D2||r===ay)throw Error(o(483))}var Mi=!1;function CD(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ND(r,c){r=r.updateQueue,c.updateQueue===r&&(c.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function _i(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Si(r,c,f){var g=r.updateQueue;if(g===null)return null;if(g=g.shared,(Pt&2)!==0){var w=g.pending;return w===null?c.next=c:(c.next=w.next,w.next=c),g.pending=c,c=Kp(r),$U(r,null,f),c}return Wp(r,g,c,f),Kp(r)}function O2(r,c,f){if(c=c.updateQueue,c!==null&&(c=c.shared,(f&4194048)!==0)){var g=c.lanes;g&=r.pendingLanes,f|=g,c.lanes=f,$r(r,f)}}function LD(r,c){var f=r.updateQueue,g=r.alternate;if(g!==null&&(g=g.updateQueue,f===g)){var w=null,S=null;if(f=f.firstBaseUpdate,f!==null){do{var $={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};S===null?w=S=$:S=S.next=$,f=f.next}while(f!==null);S===null?w=S=c:S=S.next=c}else w=S=c;f={baseState:g.baseState,firstBaseUpdate:w,lastBaseUpdate:S,shared:g.shared,callbacks:g.callbacks},r.updateQueue=f;return}r=f.lastBaseUpdate,r===null?f.firstBaseUpdate=c:r.next=c,f.lastBaseUpdate=c}var jD=!1;function q2(){if(jD){var r=T1;if(r!==null)throw r}}function H2(r,c,f,g){jD=!1;var w=r.updateQueue;Mi=!1;var S=w.firstBaseUpdate,$=w.lastBaseUpdate,B=w.shared.pending;if(B!==null){w.shared.pending=null;var J=B,se=J.next;J.next=null,$===null?S=se:$.next=se,$=J;var ye=r.alternate;ye!==null&&(ye=ye.updateQueue,B=ye.lastBaseUpdate,B!==$&&(B===null?ye.firstBaseUpdate=se:B.next=se,ye.lastBaseUpdate=J))}if(S!==null){var we=w.baseState;$=0,ye=se=J=null,B=S;do{var ue=B.lane&-536870913,he=ue!==B.lane;if(he?(Ct&ue)===ue:(g&ue)===ue){ue!==0&&ue===I1&&(jD=!0),ye!==null&&(ye=ye.next={lane:0,tag:B.tag,payload:B.payload,callback:null,next:null});e:{var at=r,Je=B;ue=c;var Ht=f;switch(Je.tag){case 1:if(at=Je.payload,typeof at=="function"){we=at.call(Ht,we,ue);break e}we=at;break e;case 3:at.flags=at.flags&-65537|128;case 0:if(at=Je.payload,ue=typeof at=="function"?at.call(Ht,we,ue):at,ue==null)break e;we=p({},we,ue);break e;case 2:Mi=!0}}ue=B.callback,ue!==null&&(r.flags|=64,he&&(r.flags|=8192),he=w.callbacks,he===null?w.callbacks=[ue]:he.push(ue))}else he={lane:ue,tag:B.tag,payload:B.payload,callback:B.callback,next:null},ye===null?(se=ye=he,J=we):ye=ye.next=he,$|=ue;if(B=B.next,B===null){if(B=w.shared.pending,B===null)break;he=B,B=he.next,he.next=null,w.lastBaseUpdate=he,w.shared.pending=null}}while(!0);ye===null&&(J=we),w.baseState=J,w.firstBaseUpdate=se,w.lastBaseUpdate=ye,S===null&&(w.shared.lanes=0),Ti|=$,r.lanes=$,r.memoizedState=we}}function KU(r,c){if(typeof r!="function")throw Error(o(191,r));r.call(c)}function QU(r,c){var f=r.callbacks;if(f!==null)for(r.callbacks=null,r=0;r<f.length;r++)KU(f[r],c)}var R1=Y(null),iy=Y(0);function JU(r,c){r=Wr,T(iy,r),T(R1,c),Wr=r|c.baseLanes}function AD(){T(iy,Wr),T(R1,R1.current)}function ED(){Wr=iy.current,F(R1),F(iy)}var Ci=0,pt=null,Ot=null,In=null,sy=!1,P1=!1,ec=!1,cy=0,V2=0,$1=null,Yde=0;function Mn(){throw Error(o(321))}function ID(r,c){if(c===null)return!1;for(var f=0;f<c.length&&f<r.length;f++)if(!Oo(r[f],c[f]))return!1;return!0}function TD(r,c,f,g,w,S){return Ci=S,pt=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,P.H=r===null||r.memoizedState===null?$G:DG,ec=!1,S=f(g,w),ec=!1,P1&&(S=tG(c,f,g,w)),eG(r),S}function eG(r){P.H=py;var c=Ot!==null&&Ot.next!==null;if(Ci=0,In=Ot=pt=null,sy=!1,V2=0,$1=null,c)throw Error(o(300));r===null||Xn||(r=r.dependencies,r!==null&&ty(r)&&(Xn=!0))}function tG(r,c,f,g){pt=r;var w=0;do{if(P1&&($1=null),V2=0,P1=!1,25<=w)throw Error(o(301));if(w+=1,In=Ot=null,r.updateQueue!=null){var S=r.updateQueue;S.lastEffect=null,S.events=null,S.stores=null,S.memoCache!=null&&(S.memoCache.index=0)}P.H=n1e,S=c(f,g)}while(P1);return S}function Wde(){var r=P.H,c=r.useState()[0];return c=typeof c.then=="function"?B2(c):c,r=r.useState()[0],(Ot!==null?Ot.memoizedState:null)!==r&&(pt.flags|=1024),c}function RD(){var r=cy!==0;return cy=0,r}function PD(r,c,f){c.updateQueue=r.updateQueue,c.flags&=-2053,r.lanes&=~f}function $D(r){if(sy){for(r=r.memoizedState;r!==null;){var c=r.queue;c!==null&&(c.pending=null),r=r.next}sy=!1}Ci=0,In=Ot=pt=null,P1=!1,V2=cy=0,$1=null}function Co(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return In===null?pt.memoizedState=In=r:In=In.next=r,In}function Tn(){if(Ot===null){var r=pt.alternate;r=r!==null?r.memoizedState:null}else r=Ot.next;var c=In===null?pt.memoizedState:In.next;if(c!==null)In=c,Ot=r;else{if(r===null)throw pt.alternate===null?Error(o(467)):Error(o(310));Ot=r,r={memoizedState:Ot.memoizedState,baseState:Ot.baseState,baseQueue:Ot.baseQueue,queue:Ot.queue,next:null},In===null?pt.memoizedState=In=r:In=In.next=r}return In}function DD(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function B2(r){var c=V2;return V2+=1,$1===null&&($1=[]),r=ZU($1,r,c),c=pt,(In===null?c.memoizedState:In.next)===null&&(c=c.alternate,P.H=c===null||c.memoizedState===null?$G:DG),r}function ly(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return B2(r);if(r.$$typeof===A)return co(r)}throw Error(o(438,String(r)))}function zD(r){var c=null,f=pt.updateQueue;if(f!==null&&(c=f.memoCache),c==null){var g=pt.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(c={data:g.data.map(function(w){return w.slice()}),index:0})))}if(c==null&&(c={data:[],index:0}),f===null&&(f=DD(),pt.updateQueue=f),f.memoCache=c,f=c.data[c.index],f===void 0)for(f=c.data[c.index]=Array(r),g=0;g<r;g++)f[g]=z;return c.index++,f}function Fr(r,c){return typeof c=="function"?c(r):c}function uy(r){var c=Tn();return OD(c,Ot,r)}function OD(r,c,f){var g=r.queue;if(g===null)throw Error(o(311));g.lastRenderedReducer=f;var w=r.baseQueue,S=g.pending;if(S!==null){if(w!==null){var $=w.next;w.next=S.next,S.next=$}c.baseQueue=w=S,g.pending=null}if(S=r.baseState,w===null)r.memoizedState=S;else{c=w.next;var B=$=null,J=null,se=c,ye=!1;do{var we=se.lane&-536870913;if(we!==se.lane?(Ct&we)===we:(Ci&we)===we){var ue=se.revertLane;if(ue===0)J!==null&&(J=J.next={lane:0,revertLane:0,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null}),we===I1&&(ye=!0);else if((Ci&ue)===ue){se=se.next,ue===I1&&(ye=!0);continue}else we={lane:0,revertLane:se.revertLane,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},J===null?(B=J=we,$=S):J=J.next=we,pt.lanes|=ue,Ti|=ue;we=se.action,ec&&f(S,we),S=se.hasEagerState?se.eagerState:f(S,we)}else ue={lane:we,revertLane:se.revertLane,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},J===null?(B=J=ue,$=S):J=J.next=ue,pt.lanes|=we,Ti|=we;se=se.next}while(se!==null&&se!==c);if(J===null?$=S:J.next=B,!Oo(S,r.memoizedState)&&(Xn=!0,ye&&(f=T1,f!==null)))throw f;r.memoizedState=S,r.baseState=$,r.baseQueue=J,g.lastRenderedState=S}return w===null&&(g.lanes=0),[r.memoizedState,g.dispatch]}function qD(r){var c=Tn(),f=c.queue;if(f===null)throw Error(o(311));f.lastRenderedReducer=r;var g=f.dispatch,w=f.pending,S=c.memoizedState;if(w!==null){f.pending=null;var $=w=w.next;do S=r(S,$.action),$=$.next;while($!==w);Oo(S,c.memoizedState)||(Xn=!0),c.memoizedState=S,c.baseQueue===null&&(c.baseState=S),f.lastRenderedState=S}return[S,g]}function nG(r,c,f){var g=pt,w=Tn(),S=Et;if(S){if(f===void 0)throw Error(o(407));f=f()}else f=c();var $=!Oo((Ot||w).memoizedState,f);$&&(w.memoizedState=f,Xn=!0),w=w.queue;var B=rG.bind(null,g,w,r);if(F2(2048,8,B,[r]),w.getSnapshot!==c||$||In!==null&&In.memoizedState.tag&1){if(g.flags|=2048,D1(9,dy(),aG.bind(null,g,w,f,c),null),Ut===null)throw Error(o(349));S||(Ci&124)!==0||oG(g,c,f)}return f}function oG(r,c,f){r.flags|=16384,r={getSnapshot:c,value:f},c=pt.updateQueue,c===null?(c=DD(),pt.updateQueue=c,c.stores=[r]):(f=c.stores,f===null?c.stores=[r]:f.push(r))}function aG(r,c,f,g){c.value=f,c.getSnapshot=g,iG(c)&&sG(r)}function rG(r,c,f){return f(function(){iG(c)&&sG(r)})}function iG(r){var c=r.getSnapshot;r=r.value;try{var f=c();return!Oo(r,f)}catch{return!0}}function sG(r){var c=L1(r,2);c!==null&&Uo(c,r,2)}function HD(r){var c=Co();if(typeof r=="function"){var f=r;if(r=f(),ec){Oe(!0);try{f()}finally{Oe(!1)}}}return c.memoizedState=c.baseState=r,c.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fr,lastRenderedState:r},c}function cG(r,c,f,g){return r.baseState=f,OD(r,Ot,typeof g=="function"?g:Fr)}function Kde(r,c,f,g,w){if(fy(r))throw Error(o(485));if(r=c.action,r!==null){var S={payload:w,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function($){S.listeners.push($)}};P.T!==null?f(!0):S.isTransition=!1,g(S),f=c.pending,f===null?(S.next=c.pending=S,lG(c,S)):(S.next=f.next,c.pending=f.next=S)}}function lG(r,c){var f=c.action,g=c.payload,w=r.state;if(c.isTransition){var S=P.T,$={};P.T=$;try{var B=f(w,g),J=P.S;J!==null&&J($,B),uG(r,c,B)}catch(se){VD(r,c,se)}finally{P.T=S}}else try{S=f(w,g),uG(r,c,S)}catch(se){VD(r,c,se)}}function uG(r,c,f){f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(function(g){dG(r,c,g)},function(g){return VD(r,c,g)}):dG(r,c,f)}function dG(r,c,f){c.status="fulfilled",c.value=f,hG(c),r.state=f,c=r.pending,c!==null&&(f=c.next,f===c?r.pending=null:(f=f.next,c.next=f,lG(r,f)))}function VD(r,c,f){var g=r.pending;if(r.pending=null,g!==null){g=g.next;do c.status="rejected",c.reason=f,hG(c),c=c.next;while(c!==g)}r.action=null}function hG(r){r=r.listeners;for(var c=0;c<r.length;c++)(0,r[c])()}function fG(r,c){return c}function pG(r,c){if(Et){var f=Ut.formState;if(f!==null){e:{var g=pt;if(Et){if(hn){t:{for(var w=hn,S=rr;w.nodeType!==8;){if(!S){w=null;break t}if(w=Ia(w.nextSibling),w===null){w=null;break t}}S=w.data,w=S==="F!"||S==="F"?w:null}if(w){hn=Ia(w.nextSibling),g=w.data==="F!";break e}}Ws(g)}g=!1}g&&(c=f[0])}}return f=Co(),f.memoizedState=f.baseState=c,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fG,lastRenderedState:c},f.queue=g,f=TG.bind(null,pt,g),g.dispatch=f,g=HD(!1),S=XD.bind(null,pt,!1,g.queue),g=Co(),w={state:c,dispatch:null,action:r,pending:null},g.queue=w,f=Kde.bind(null,pt,w,S,f),w.dispatch=f,g.memoizedState=r,[c,f,!1]}function yG(r){var c=Tn();return mG(c,Ot,r)}function mG(r,c,f){if(c=OD(r,c,fG)[0],r=uy(Fr)[0],typeof c=="object"&&c!==null&&typeof c.then=="function")try{var g=B2(c)}catch($){throw $===D2?ay:$}else g=c;c=Tn();var w=c.queue,S=w.dispatch;return f!==c.memoizedState&&(pt.flags|=2048,D1(9,dy(),Qde.bind(null,w,f),null)),[g,S,r]}function Qde(r,c){r.action=c}function gG(r){var c=Tn(),f=Ot;if(f!==null)return mG(c,f,r);Tn(),c=c.memoizedState,f=Tn();var g=f.queue.dispatch;return f.memoizedState=r,[c,g,!1]}function D1(r,c,f,g){return r={tag:r,create:f,deps:g,inst:c,next:null},c=pt.updateQueue,c===null&&(c=DD(),pt.updateQueue=c),f=c.lastEffect,f===null?c.lastEffect=r.next=r:(g=f.next,f.next=r,r.next=g,c.lastEffect=r),r}function dy(){return{destroy:void 0,resource:void 0}}function vG(){return Tn().memoizedState}function hy(r,c,f,g){var w=Co();g=g===void 0?null:g,pt.flags|=r,w.memoizedState=D1(1|c,dy(),f,g)}function F2(r,c,f,g){var w=Tn();g=g===void 0?null:g;var S=w.memoizedState.inst;Ot!==null&&g!==null&&ID(g,Ot.memoizedState.deps)?w.memoizedState=D1(c,S,f,g):(pt.flags|=r,w.memoizedState=D1(1|c,S,f,g))}function kG(r,c){hy(8390656,8,r,c)}function xG(r,c){F2(2048,8,r,c)}function wG(r,c){return F2(4,2,r,c)}function bG(r,c){return F2(4,4,r,c)}function MG(r,c){if(typeof c=="function"){r=r();var f=c(r);return function(){typeof f=="function"?f():c(null)}}if(c!=null)return r=r(),c.current=r,function(){c.current=null}}function _G(r,c,f){f=f!=null?f.concat([r]):null,F2(4,4,MG.bind(null,c,r),f)}function BD(){}function SG(r,c){var f=Tn();c=c===void 0?null:c;var g=f.memoizedState;return c!==null&&ID(c,g[1])?g[0]:(f.memoizedState=[r,c],r)}function CG(r,c){var f=Tn();c=c===void 0?null:c;var g=f.memoizedState;if(c!==null&&ID(c,g[1]))return g[0];if(g=r(),ec){Oe(!0);try{r()}finally{Oe(!1)}}return f.memoizedState=[g,c],g}function FD(r,c,f){return f===void 0||(Ci&1073741824)!==0?r.memoizedState=c:(r.memoizedState=f,r=jX(),pt.lanes|=r,Ti|=r,f)}function NG(r,c,f,g){return Oo(f,c)?f:R1.current!==null?(r=FD(r,f,g),Oo(r,c)||(Xn=!0),r):(Ci&42)===0?(Xn=!0,r.memoizedState=f):(r=jX(),pt.lanes|=r,Ti|=r,c)}function LG(r,c,f,g,w){var S=X.p;X.p=S!==0&&8>S?S:8;var $=P.T,B={};P.T=B,XD(r,!1,c,f);try{var J=w(),se=P.S;if(se!==null&&se(B,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var ye=Zde(J,g);U2(r,c,ye,Fo(r))}else U2(r,c,g,Fo(r))}catch(we){U2(r,c,{then:function(){},status:"rejected",reason:we},Fo())}finally{X.p=S,P.T=$}}function Jde(){}function UD(r,c,f,g){if(r.tag!==5)throw Error(o(476));var w=jG(r).queue;LG(r,w,c,W,f===null?Jde:function(){return AG(r),f(g)})}function jG(r){var c=r.memoizedState;if(c!==null)return c;c={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fr,lastRenderedState:W},next:null};var f={};return c.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fr,lastRenderedState:f},next:null},r.memoizedState=c,r=r.alternate,r!==null&&(r.memoizedState=c),c}function AG(r){var c=jG(r).next.queue;U2(r,c,{},Fo())}function GD(){return co(uf)}function EG(){return Tn().memoizedState}function IG(){return Tn().memoizedState}function e1e(r){for(var c=r.return;c!==null;){switch(c.tag){case 24:case 3:var f=Fo();r=_i(f);var g=Si(c,r,f);g!==null&&(Uo(g,c,f),O2(g,c,f)),c={cache:bD()},r.payload=c;return}c=c.return}}function t1e(r,c,f){var g=Fo();f={lane:g,revertLane:0,action:f,hasEagerState:!1,eagerState:null,next:null},fy(r)?RG(c,f):(f=hD(r,c,f,g),f!==null&&(Uo(f,r,g),PG(f,c,g)))}function TG(r,c,f){var g=Fo();U2(r,c,f,g)}function U2(r,c,f,g){var w={lane:g,revertLane:0,action:f,hasEagerState:!1,eagerState:null,next:null};if(fy(r))RG(c,w);else{var S=r.alternate;if(r.lanes===0&&(S===null||S.lanes===0)&&(S=c.lastRenderedReducer,S!==null))try{var $=c.lastRenderedState,B=S($,f);if(w.hasEagerState=!0,w.eagerState=B,Oo(B,$))return Wp(r,c,w,0),Ut===null&&Yp(),!1}catch{}finally{}if(f=hD(r,c,w,g),f!==null)return Uo(f,r,g),PG(f,c,g),!0}return!1}function XD(r,c,f,g){if(g={lane:2,revertLane:Sz(),action:g,hasEagerState:!1,eagerState:null,next:null},fy(r)){if(c)throw Error(o(479))}else c=hD(r,f,g,2),c!==null&&Uo(c,r,2)}function fy(r){var c=r.alternate;return r===pt||c!==null&&c===pt}function RG(r,c){P1=sy=!0;var f=r.pending;f===null?c.next=c:(c.next=f.next,f.next=c),r.pending=c}function PG(r,c,f){if((f&4194048)!==0){var g=c.lanes;g&=r.pendingLanes,f|=g,c.lanes=f,$r(r,f)}}var py={readContext:co,use:ly,useCallback:Mn,useContext:Mn,useEffect:Mn,useImperativeHandle:Mn,useLayoutEffect:Mn,useInsertionEffect:Mn,useMemo:Mn,useReducer:Mn,useRef:Mn,useState:Mn,useDebugValue:Mn,useDeferredValue:Mn,useTransition:Mn,useSyncExternalStore:Mn,useId:Mn,useHostTransitionStatus:Mn,useFormState:Mn,useActionState:Mn,useOptimistic:Mn,useMemoCache:Mn,useCacheRefresh:Mn},$G={readContext:co,use:ly,useCallback:function(r,c){return Co().memoizedState=[r,c===void 0?null:c],r},useContext:co,useEffect:kG,useImperativeHandle:function(r,c,f){f=f!=null?f.concat([r]):null,hy(4194308,4,MG.bind(null,c,r),f)},useLayoutEffect:function(r,c){return hy(4194308,4,r,c)},useInsertionEffect:function(r,c){hy(4,2,r,c)},useMemo:function(r,c){var f=Co();c=c===void 0?null:c;var g=r();if(ec){Oe(!0);try{r()}finally{Oe(!1)}}return f.memoizedState=[g,c],g},useReducer:function(r,c,f){var g=Co();if(f!==void 0){var w=f(c);if(ec){Oe(!0);try{f(c)}finally{Oe(!1)}}}else w=c;return g.memoizedState=g.baseState=w,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:w},g.queue=r,r=r.dispatch=t1e.bind(null,pt,r),[g.memoizedState,r]},useRef:function(r){var c=Co();return r={current:r},c.memoizedState=r},useState:function(r){r=HD(r);var c=r.queue,f=TG.bind(null,pt,c);return c.dispatch=f,[r.memoizedState,f]},useDebugValue:BD,useDeferredValue:function(r,c){var f=Co();return FD(f,r,c)},useTransition:function(){var r=HD(!1);return r=LG.bind(null,pt,r.queue,!0,!1),Co().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,c,f){var g=pt,w=Co();if(Et){if(f===void 0)throw Error(o(407));f=f()}else{if(f=c(),Ut===null)throw Error(o(349));(Ct&124)!==0||oG(g,c,f)}w.memoizedState=f;var S={value:f,getSnapshot:c};return w.queue=S,kG(rG.bind(null,g,S,r),[r]),g.flags|=2048,D1(9,dy(),aG.bind(null,g,S,f,c),null),f},useId:function(){var r=Co(),c=Ut.identifierPrefix;if(Et){var f=Hr,g=qr;f=(g&~(1<<32-He(g)-1)).toString(32)+f,c="«"+c+"R"+f,f=cy++,0<f&&(c+="H"+f.toString(32)),c+="»"}else f=Yde++,c="«"+c+"r"+f.toString(32)+"»";return r.memoizedState=c},useHostTransitionStatus:GD,useFormState:pG,useActionState:pG,useOptimistic:function(r){var c=Co();c.memoizedState=c.baseState=r;var f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return c.queue=f,c=XD.bind(null,pt,!0,f),f.dispatch=c,[r,c]},useMemoCache:zD,useCacheRefresh:function(){return Co().memoizedState=e1e.bind(null,pt)}},DG={readContext:co,use:ly,useCallback:SG,useContext:co,useEffect:xG,useImperativeHandle:_G,useInsertionEffect:wG,useLayoutEffect:bG,useMemo:CG,useReducer:uy,useRef:vG,useState:function(){return uy(Fr)},useDebugValue:BD,useDeferredValue:function(r,c){var f=Tn();return NG(f,Ot.memoizedState,r,c)},useTransition:function(){var r=uy(Fr)[0],c=Tn().memoizedState;return[typeof r=="boolean"?r:B2(r),c]},useSyncExternalStore:nG,useId:EG,useHostTransitionStatus:GD,useFormState:yG,useActionState:yG,useOptimistic:function(r,c){var f=Tn();return cG(f,Ot,r,c)},useMemoCache:zD,useCacheRefresh:IG},n1e={readContext:co,use:ly,useCallback:SG,useContext:co,useEffect:xG,useImperativeHandle:_G,useInsertionEffect:wG,useLayoutEffect:bG,useMemo:CG,useReducer:qD,useRef:vG,useState:function(){return qD(Fr)},useDebugValue:BD,useDeferredValue:function(r,c){var f=Tn();return Ot===null?FD(f,r,c):NG(f,Ot.memoizedState,r,c)},useTransition:function(){var r=qD(Fr)[0],c=Tn().memoizedState;return[typeof r=="boolean"?r:B2(r),c]},useSyncExternalStore:nG,useId:EG,useHostTransitionStatus:GD,useFormState:gG,useActionState:gG,useOptimistic:function(r,c){var f=Tn();return Ot!==null?cG(f,Ot,r,c):(f.baseState=r,[r,f.queue.dispatch])},useMemoCache:zD,useCacheRefresh:IG},z1=null,G2=0;function yy(r){var c=G2;return G2+=1,z1===null&&(z1=[]),ZU(z1,r,c)}function X2(r,c){c=c.props.ref,r.ref=c!==void 0?c:null}function my(r,c){throw c.$$typeof===m?Error(o(525)):(r=Object.prototype.toString.call(c),Error(o(31,r==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":r)))}function zG(r){var c=r._init;return c(r._payload)}function OG(r){function c(ae,oe){if(r){var ie=ae.deletions;ie===null?(ae.deletions=[oe],ae.flags|=16):ie.push(oe)}}function f(ae,oe){if(!r)return null;for(;oe!==null;)c(ae,oe),oe=oe.sibling;return null}function g(ae){for(var oe=new Map;ae!==null;)ae.key!==null?oe.set(ae.key,ae):oe.set(ae.index,ae),ae=ae.sibling;return oe}function w(ae,oe){return ae=Or(ae,oe),ae.index=0,ae.sibling=null,ae}function S(ae,oe,ie){return ae.index=ie,r?(ie=ae.alternate,ie!==null?(ie=ie.index,ie<oe?(ae.flags|=67108866,oe):ie):(ae.flags|=67108866,oe)):(ae.flags|=1048576,oe)}function $(ae){return r&&ae.alternate===null&&(ae.flags|=67108866),ae}function B(ae,oe,ie,ve){return oe===null||oe.tag!==6?(oe=pD(ie,ae.mode,ve),oe.return=ae,oe):(oe=w(oe,ie),oe.return=ae,oe)}function J(ae,oe,ie,ve){var $e=ie.type;return $e===M?ye(ae,oe,ie.props.children,ve,ie.key):oe!==null&&(oe.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===H&&zG($e)===oe.type)?(oe=w(oe,ie.props),X2(oe,ie),oe.return=ae,oe):(oe=Qp(ie.type,ie.key,ie.props,null,ae.mode,ve),X2(oe,ie),oe.return=ae,oe)}function se(ae,oe,ie,ve){return oe===null||oe.tag!==4||oe.stateNode.containerInfo!==ie.containerInfo||oe.stateNode.implementation!==ie.implementation?(oe=yD(ie,ae.mode,ve),oe.return=ae,oe):(oe=w(oe,ie.children||[]),oe.return=ae,oe)}function ye(ae,oe,ie,ve,$e){return oe===null||oe.tag!==7?(oe=Gs(ie,ae.mode,ve,$e),oe.return=ae,oe):(oe=w(oe,ie),oe.return=ae,oe)}function we(ae,oe,ie){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return oe=pD(""+oe,ae.mode,ie),oe.return=ae,oe;if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case v:return ie=Qp(oe.type,oe.key,oe.props,null,ae.mode,ie),X2(ie,oe),ie.return=ae,ie;case x:return oe=yD(oe,ae.mode,ie),oe.return=ae,oe;case H:var ve=oe._init;return oe=ve(oe._payload),we(ae,oe,ie)}if(O(oe)||q(oe))return oe=Gs(oe,ae.mode,ie,null),oe.return=ae,oe;if(typeof oe.then=="function")return we(ae,yy(oe),ie);if(oe.$$typeof===A)return we(ae,ny(ae,oe),ie);my(ae,oe)}return null}function ue(ae,oe,ie,ve){var $e=oe!==null?oe.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return $e!==null?null:B(ae,oe,""+ie,ve);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case v:return ie.key===$e?J(ae,oe,ie,ve):null;case x:return ie.key===$e?se(ae,oe,ie,ve):null;case H:return $e=ie._init,ie=$e(ie._payload),ue(ae,oe,ie,ve)}if(O(ie)||q(ie))return $e!==null?null:ye(ae,oe,ie,ve,null);if(typeof ie.then=="function")return ue(ae,oe,yy(ie),ve);if(ie.$$typeof===A)return ue(ae,oe,ny(ae,ie),ve);my(ae,ie)}return null}function he(ae,oe,ie,ve,$e){if(typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint")return ae=ae.get(ie)||null,B(oe,ae,""+ve,$e);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case v:return ae=ae.get(ve.key===null?ie:ve.key)||null,J(oe,ae,ve,$e);case x:return ae=ae.get(ve.key===null?ie:ve.key)||null,se(oe,ae,ve,$e);case H:var mt=ve._init;return ve=mt(ve._payload),he(ae,oe,ie,ve,$e)}if(O(ve)||q(ve))return ae=ae.get(ie)||null,ye(oe,ae,ve,$e,null);if(typeof ve.then=="function")return he(ae,oe,ie,yy(ve),$e);if(ve.$$typeof===A)return he(ae,oe,ie,ny(oe,ve),$e);my(oe,ve)}return null}function at(ae,oe,ie,ve){for(var $e=null,mt=null,Ge=oe,nt=oe=0,Yn=null;Ge!==null&&nt<ie.length;nt++){Ge.index>nt?(Yn=Ge,Ge=null):Yn=Ge.sibling;var Lt=ue(ae,Ge,ie[nt],ve);if(Lt===null){Ge===null&&(Ge=Yn);break}r&&Ge&&Lt.alternate===null&&c(ae,Ge),oe=S(Lt,oe,nt),mt===null?$e=Lt:mt.sibling=Lt,mt=Lt,Ge=Yn}if(nt===ie.length)return f(ae,Ge),Et&&Zs(ae,nt),$e;if(Ge===null){for(;nt<ie.length;nt++)Ge=we(ae,ie[nt],ve),Ge!==null&&(oe=S(Ge,oe,nt),mt===null?$e=Ge:mt.sibling=Ge,mt=Ge);return Et&&Zs(ae,nt),$e}for(Ge=g(Ge);nt<ie.length;nt++)Yn=he(Ge,ae,nt,ie[nt],ve),Yn!==null&&(r&&Yn.alternate!==null&&Ge.delete(Yn.key===null?nt:Yn.key),oe=S(Yn,oe,nt),mt===null?$e=Yn:mt.sibling=Yn,mt=Yn);return r&&Ge.forEach(function(Vi){return c(ae,Vi)}),Et&&Zs(ae,nt),$e}function Je(ae,oe,ie,ve){if(ie==null)throw Error(o(151));for(var $e=null,mt=null,Ge=oe,nt=oe=0,Yn=null,Lt=ie.next();Ge!==null&&!Lt.done;nt++,Lt=ie.next()){Ge.index>nt?(Yn=Ge,Ge=null):Yn=Ge.sibling;var Vi=ue(ae,Ge,Lt.value,ve);if(Vi===null){Ge===null&&(Ge=Yn);break}r&&Ge&&Vi.alternate===null&&c(ae,Ge),oe=S(Vi,oe,nt),mt===null?$e=Vi:mt.sibling=Vi,mt=Vi,Ge=Yn}if(Lt.done)return f(ae,Ge),Et&&Zs(ae,nt),$e;if(Ge===null){for(;!Lt.done;nt++,Lt=ie.next())Lt=we(ae,Lt.value,ve),Lt!==null&&(oe=S(Lt,oe,nt),mt===null?$e=Lt:mt.sibling=Lt,mt=Lt);return Et&&Zs(ae,nt),$e}for(Ge=g(Ge);!Lt.done;nt++,Lt=ie.next())Lt=he(Ge,ae,nt,Lt.value,ve),Lt!==null&&(r&&Lt.alternate!==null&&Ge.delete(Lt.key===null?nt:Lt.key),oe=S(Lt,oe,nt),mt===null?$e=Lt:mt.sibling=Lt,mt=Lt);return r&&Ge.forEach(function(ohe){return c(ae,ohe)}),Et&&Zs(ae,nt),$e}function Ht(ae,oe,ie,ve){if(typeof ie=="object"&&ie!==null&&ie.type===M&&ie.key===null&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case v:e:{for(var $e=ie.key;oe!==null;){if(oe.key===$e){if($e=ie.type,$e===M){if(oe.tag===7){f(ae,oe.sibling),ve=w(oe,ie.props.children),ve.return=ae,ae=ve;break e}}else if(oe.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===H&&zG($e)===oe.type){f(ae,oe.sibling),ve=w(oe,ie.props),X2(ve,ie),ve.return=ae,ae=ve;break e}f(ae,oe);break}else c(ae,oe);oe=oe.sibling}ie.type===M?(ve=Gs(ie.props.children,ae.mode,ve,ie.key),ve.return=ae,ae=ve):(ve=Qp(ie.type,ie.key,ie.props,null,ae.mode,ve),X2(ve,ie),ve.return=ae,ae=ve)}return $(ae);case x:e:{for($e=ie.key;oe!==null;){if(oe.key===$e)if(oe.tag===4&&oe.stateNode.containerInfo===ie.containerInfo&&oe.stateNode.implementation===ie.implementation){f(ae,oe.sibling),ve=w(oe,ie.children||[]),ve.return=ae,ae=ve;break e}else{f(ae,oe);break}else c(ae,oe);oe=oe.sibling}ve=yD(ie,ae.mode,ve),ve.return=ae,ae=ve}return $(ae);case H:return $e=ie._init,ie=$e(ie._payload),Ht(ae,oe,ie,ve)}if(O(ie))return at(ae,oe,ie,ve);if(q(ie)){if($e=q(ie),typeof $e!="function")throw Error(o(150));return ie=$e.call(ie),Je(ae,oe,ie,ve)}if(typeof ie.then=="function")return Ht(ae,oe,yy(ie),ve);if(ie.$$typeof===A)return Ht(ae,oe,ny(ae,ie),ve);my(ae,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,oe!==null&&oe.tag===6?(f(ae,oe.sibling),ve=w(oe,ie),ve.return=ae,ae=ve):(f(ae,oe),ve=pD(ie,ae.mode,ve),ve.return=ae,ae=ve),$(ae)):f(ae,oe)}return function(ae,oe,ie,ve){try{G2=0;var $e=Ht(ae,oe,ie,ve);return z1=null,$e}catch(Ge){if(Ge===D2||Ge===ay)throw Ge;var mt=qo(29,Ge,null,ae.mode);return mt.lanes=ve,mt.return=ae,mt}finally{}}}var O1=OG(!0),qG=OG(!1),da=Y(null),ir=null;function Ni(r){var c=r.alternate;T(Vn,Vn.current&1),T(da,r),ir===null&&(c===null||R1.current!==null||c.memoizedState!==null)&&(ir=r)}function HG(r){if(r.tag===22){if(T(Vn,Vn.current),T(da,r),ir===null){var c=r.alternate;c!==null&&c.memoizedState!==null&&(ir=r)}}else Li()}function Li(){T(Vn,Vn.current),T(da,da.current)}function Ur(r){F(da),ir===r&&(ir=null),F(Vn)}var Vn=Y(0);function gy(r){for(var c=r;c!==null;){if(c.tag===13){var f=c.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||f.data==="$?"||Dz(f)))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===r)break;for(;c.sibling===null;){if(c.return===null||c.return===r)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}function ZD(r,c,f,g){c=r.memoizedState,f=f(g,c),f=f==null?c:p({},c,f),r.memoizedState=f,r.lanes===0&&(r.updateQueue.baseState=f)}var YD={enqueueSetState:function(r,c,f){r=r._reactInternals;var g=Fo(),w=_i(g);w.payload=c,f!=null&&(w.callback=f),c=Si(r,w,g),c!==null&&(Uo(c,r,g),O2(c,r,g))},enqueueReplaceState:function(r,c,f){r=r._reactInternals;var g=Fo(),w=_i(g);w.tag=1,w.payload=c,f!=null&&(w.callback=f),c=Si(r,w,g),c!==null&&(Uo(c,r,g),O2(c,r,g))},enqueueForceUpdate:function(r,c){r=r._reactInternals;var f=Fo(),g=_i(f);g.tag=2,c!=null&&(g.callback=c),c=Si(r,g,f),c!==null&&(Uo(c,r,f),O2(c,r,f))}};function VG(r,c,f,g,w,S,$){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(g,S,$):c.prototype&&c.prototype.isPureReactComponent?!j2(f,g)||!j2(w,S):!0}function BG(r,c,f,g){r=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(f,g),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(f,g),c.state!==r&&YD.enqueueReplaceState(c,c.state,null)}function tc(r,c){var f=c;if("ref"in c){f={};for(var g in c)g!=="ref"&&(f[g]=c[g])}if(r=r.defaultProps){f===c&&(f=p({},f));for(var w in r)f[w]===void 0&&(f[w]=r[w])}return f}var vy=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var c=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(c))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)};function FG(r){vy(r)}function UG(r){console.error(r)}function GG(r){vy(r)}function ky(r,c){try{var f=r.onUncaughtError;f(c.value,{componentStack:c.stack})}catch(g){setTimeout(function(){throw g})}}function XG(r,c,f){try{var g=r.onCaughtError;g(f.value,{componentStack:f.stack,errorBoundary:c.tag===1?c.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function WD(r,c,f){return f=_i(f),f.tag=3,f.payload={element:null},f.callback=function(){ky(r,c)},f}function ZG(r){return r=_i(r),r.tag=3,r}function YG(r,c,f,g){var w=f.type.getDerivedStateFromError;if(typeof w=="function"){var S=g.value;r.payload=function(){return w(S)},r.callback=function(){XG(c,f,g)}}var $=f.stateNode;$!==null&&typeof $.componentDidCatch=="function"&&(r.callback=function(){XG(c,f,g),typeof w!="function"&&(Ri===null?Ri=new Set([this]):Ri.add(this));var B=g.stack;this.componentDidCatch(g.value,{componentStack:B!==null?B:""})})}function o1e(r,c,f,g,w){if(f.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(c=f.alternate,c!==null&&R2(c,f,w,!0),f=da.current,f!==null){switch(f.tag){case 13:return ir===null?xz():f.alternate===null&&fn===0&&(fn=3),f.flags&=-257,f.flags|=65536,f.lanes=w,g===SD?f.flags|=16384:(c=f.updateQueue,c===null?f.updateQueue=new Set([g]):c.add(g),bz(r,g,w)),!1;case 22:return f.flags|=65536,g===SD?f.flags|=16384:(c=f.updateQueue,c===null?(c={transitions:null,markerInstances:null,retryQueue:new Set([g])},f.updateQueue=c):(f=c.retryQueue,f===null?c.retryQueue=new Set([g]):f.add(g)),bz(r,g,w)),!1}throw Error(o(435,f.tag))}return bz(r,g,w),xz(),!1}if(Et)return c=da.current,c!==null?((c.flags&65536)===0&&(c.flags|=256),c.flags|=65536,c.lanes=w,g!==vD&&(r=Error(o(422),{cause:g}),T2(sa(r,f)))):(g!==vD&&(c=Error(o(423),{cause:g}),T2(sa(c,f))),r=r.current.alternate,r.flags|=65536,w&=-w,r.lanes|=w,g=sa(g,f),w=WD(r.stateNode,g,w),LD(r,w),fn!==4&&(fn=2)),!1;var S=Error(o(520),{cause:g});if(S=sa(S,f),ef===null?ef=[S]:ef.push(S),fn!==4&&(fn=2),c===null)return!0;g=sa(g,f),f=c;do{switch(f.tag){case 3:return f.flags|=65536,r=w&-w,f.lanes|=r,r=WD(f.stateNode,g,r),LD(f,r),!1;case 1:if(c=f.type,S=f.stateNode,(f.flags&128)===0&&(typeof c.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(Ri===null||!Ri.has(S))))return f.flags|=65536,w&=-w,f.lanes|=w,w=ZG(w),YG(w,r,f,g),LD(f,w),!1}f=f.return}while(f!==null);return!1}var WG=Error(o(461)),Xn=!1;function oo(r,c,f,g){c.child=r===null?qG(c,null,f,g):O1(c,r.child,f,g)}function KG(r,c,f,g,w){f=f.render;var S=c.ref;if("ref"in g){var $={};for(var B in g)B!=="ref"&&($[B]=g[B])}else $=g;return Qs(c),g=TD(r,c,f,$,S,w),B=RD(),r!==null&&!Xn?(PD(r,c,w),Gr(r,c,w)):(Et&&B&&mD(c),c.flags|=1,oo(r,c,g,w),c.child)}function QG(r,c,f,g,w){if(r===null){var S=f.type;return typeof S=="function"&&!fD(S)&&S.defaultProps===void 0&&f.compare===null?(c.tag=15,c.type=S,JG(r,c,S,g,w)):(r=Qp(f.type,null,g,c,c.mode,w),r.ref=c.ref,r.return=c,c.child=r)}if(S=r.child,!az(r,w)){var $=S.memoizedProps;if(f=f.compare,f=f!==null?f:j2,f($,g)&&r.ref===c.ref)return Gr(r,c,w)}return c.flags|=1,r=Or(S,g),r.ref=c.ref,r.return=c,c.child=r}function JG(r,c,f,g,w){if(r!==null){var S=r.memoizedProps;if(j2(S,g)&&r.ref===c.ref)if(Xn=!1,c.pendingProps=g=S,az(r,w))(r.flags&131072)!==0&&(Xn=!0);else return c.lanes=r.lanes,Gr(r,c,w)}return KD(r,c,f,g,w)}function eX(r,c,f){var g=c.pendingProps,w=g.children,S=r!==null?r.memoizedState:null;if(g.mode==="hidden"){if((c.flags&128)!==0){if(g=S!==null?S.baseLanes|f:f,r!==null){for(w=c.child=r.child,S=0;w!==null;)S=S|w.lanes|w.childLanes,w=w.sibling;c.childLanes=S&~g}else c.childLanes=0,c.child=null;return tX(r,c,g,f)}if((f&536870912)!==0)c.memoizedState={baseLanes:0,cachePool:null},r!==null&&oy(c,S!==null?S.cachePool:null),S!==null?JU(c,S):AD(),HG(c);else return c.lanes=c.childLanes=536870912,tX(r,c,S!==null?S.baseLanes|f:f,f)}else S!==null?(oy(c,S.cachePool),JU(c,S),Li(),c.memoizedState=null):(r!==null&&oy(c,null),AD(),Li());return oo(r,c,w,f),c.child}function tX(r,c,f,g){var w=_D();return w=w===null?null:{parent:Hn._currentValue,pool:w},c.memoizedState={baseLanes:f,cachePool:w},r!==null&&oy(c,null),AD(),HG(c),r!==null&&R2(r,c,g,!0),null}function xy(r,c){var f=c.ref;if(f===null)r!==null&&r.ref!==null&&(c.flags|=4194816);else{if(typeof f!="function"&&typeof f!="object")throw Error(o(284));(r===null||r.ref!==f)&&(c.flags|=4194816)}}function KD(r,c,f,g,w){return Qs(c),f=TD(r,c,f,g,void 0,w),g=RD(),r!==null&&!Xn?(PD(r,c,w),Gr(r,c,w)):(Et&&g&&mD(c),c.flags|=1,oo(r,c,f,w),c.child)}function nX(r,c,f,g,w,S){return Qs(c),c.updateQueue=null,f=tG(c,g,f,w),eG(r),g=RD(),r!==null&&!Xn?(PD(r,c,S),Gr(r,c,S)):(Et&&g&&mD(c),c.flags|=1,oo(r,c,f,S),c.child)}function oX(r,c,f,g,w){if(Qs(c),c.stateNode===null){var S=j1,$=f.contextType;typeof $=="object"&&$!==null&&(S=co($)),S=new f(g,S),c.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=YD,c.stateNode=S,S._reactInternals=c,S=c.stateNode,S.props=g,S.state=c.memoizedState,S.refs={},CD(c),$=f.contextType,S.context=typeof $=="object"&&$!==null?co($):j1,S.state=c.memoizedState,$=f.getDerivedStateFromProps,typeof $=="function"&&(ZD(c,f,$,g),S.state=c.memoizedState),typeof f.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||($=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),$!==S.state&&YD.enqueueReplaceState(S,S.state,null),H2(c,g,S,w),q2(),S.state=c.memoizedState),typeof S.componentDidMount=="function"&&(c.flags|=4194308),g=!0}else if(r===null){S=c.stateNode;var B=c.memoizedProps,J=tc(f,B);S.props=J;var se=S.context,ye=f.contextType;$=j1,typeof ye=="object"&&ye!==null&&($=co(ye));var we=f.getDerivedStateFromProps;ye=typeof we=="function"||typeof S.getSnapshotBeforeUpdate=="function",B=c.pendingProps!==B,ye||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(B||se!==$)&&BG(c,S,g,$),Mi=!1;var ue=c.memoizedState;S.state=ue,H2(c,g,S,w),q2(),se=c.memoizedState,B||ue!==se||Mi?(typeof we=="function"&&(ZD(c,f,we,g),se=c.memoizedState),(J=Mi||VG(c,f,J,g,ue,se,$))?(ye||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(c.flags|=4194308)):(typeof S.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=g,c.memoizedState=se),S.props=g,S.state=se,S.context=$,g=J):(typeof S.componentDidMount=="function"&&(c.flags|=4194308),g=!1)}else{S=c.stateNode,ND(r,c),$=c.memoizedProps,ye=tc(f,$),S.props=ye,we=c.pendingProps,ue=S.context,se=f.contextType,J=j1,typeof se=="object"&&se!==null&&(J=co(se)),B=f.getDerivedStateFromProps,(se=typeof B=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||($!==we||ue!==J)&&BG(c,S,g,J),Mi=!1,ue=c.memoizedState,S.state=ue,H2(c,g,S,w),q2();var he=c.memoizedState;$!==we||ue!==he||Mi||r!==null&&r.dependencies!==null&&ty(r.dependencies)?(typeof B=="function"&&(ZD(c,f,B,g),he=c.memoizedState),(ye=Mi||VG(c,f,ye,g,ue,he,J)||r!==null&&r.dependencies!==null&&ty(r.dependencies))?(se||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(g,he,J),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(g,he,J)),typeof S.componentDidUpdate=="function"&&(c.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof S.componentDidUpdate!="function"||$===r.memoizedProps&&ue===r.memoizedState||(c.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||$===r.memoizedProps&&ue===r.memoizedState||(c.flags|=1024),c.memoizedProps=g,c.memoizedState=he),S.props=g,S.state=he,S.context=J,g=ye):(typeof S.componentDidUpdate!="function"||$===r.memoizedProps&&ue===r.memoizedState||(c.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||$===r.memoizedProps&&ue===r.memoizedState||(c.flags|=1024),g=!1)}return S=g,xy(r,c),g=(c.flags&128)!==0,S||g?(S=c.stateNode,f=g&&typeof f.getDerivedStateFromError!="function"?null:S.render(),c.flags|=1,r!==null&&g?(c.child=O1(c,r.child,null,w),c.child=O1(c,null,f,w)):oo(r,c,f,w),c.memoizedState=S.state,r=c.child):r=Gr(r,c,w),r}function aX(r,c,f,g){return I2(),c.flags|=256,oo(r,c,f,g),c.child}var QD={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function JD(r){return{baseLanes:r,cachePool:UU()}}function ez(r,c,f){return r=r!==null?r.childLanes&~f:0,c&&(r|=ha),r}function rX(r,c,f){var g=c.pendingProps,w=!1,S=(c.flags&128)!==0,$;if(($=S)||($=r!==null&&r.memoizedState===null?!1:(Vn.current&2)!==0),$&&(w=!0,c.flags&=-129),$=(c.flags&32)!==0,c.flags&=-33,r===null){if(Et){if(w?Ni(c):Li(),Et){var B=hn,J;if(J=B){e:{for(J=B,B=rr;J.nodeType!==8;){if(!B){B=null;break e}if(J=Ia(J.nextSibling),J===null){B=null;break e}}B=J}B!==null?(c.memoizedState={dehydrated:B,treeContext:Xs!==null?{id:qr,overflow:Hr}:null,retryLane:536870912,hydrationErrors:null},J=qo(18,null,null,0),J.stateNode=B,J.return=c,c.child=J,fo=c,hn=null,J=!0):J=!1}J||Ws(c)}if(B=c.memoizedState,B!==null&&(B=B.dehydrated,B!==null))return Dz(B)?c.lanes=32:c.lanes=536870912,null;Ur(c)}return B=g.children,g=g.fallback,w?(Li(),w=c.mode,B=wy({mode:"hidden",children:B},w),g=Gs(g,w,f,null),B.return=c,g.return=c,B.sibling=g,c.child=B,w=c.child,w.memoizedState=JD(f),w.childLanes=ez(r,$,f),c.memoizedState=QD,g):(Ni(c),tz(c,B))}if(J=r.memoizedState,J!==null&&(B=J.dehydrated,B!==null)){if(S)c.flags&256?(Ni(c),c.flags&=-257,c=nz(r,c,f)):c.memoizedState!==null?(Li(),c.child=r.child,c.flags|=128,c=null):(Li(),w=g.fallback,B=c.mode,g=wy({mode:"visible",children:g.children},B),w=Gs(w,B,f,null),w.flags|=2,g.return=c,w.return=c,g.sibling=w,c.child=g,O1(c,r.child,null,f),g=c.child,g.memoizedState=JD(f),g.childLanes=ez(r,$,f),c.memoizedState=QD,c=w);else if(Ni(c),Dz(B)){if($=B.nextSibling&&B.nextSibling.dataset,$)var se=$.dgst;$=se,g=Error(o(419)),g.stack="",g.digest=$,T2({value:g,source:null,stack:null}),c=nz(r,c,f)}else if(Xn||R2(r,c,f,!1),$=(f&r.childLanes)!==0,Xn||$){if($=Ut,$!==null&&(g=f&-f,g=(g&42)!==0?1:qs(g),g=(g&($.suspendedLanes|f))!==0?0:g,g!==0&&g!==J.retryLane))throw J.retryLane=g,L1(r,g),Uo($,r,g),WG;B.data==="$?"||xz(),c=nz(r,c,f)}else B.data==="$?"?(c.flags|=192,c.child=r.child,c=null):(r=J.treeContext,hn=Ia(B.nextSibling),fo=c,Et=!0,Ys=null,rr=!1,r!==null&&(la[ua++]=qr,la[ua++]=Hr,la[ua++]=Xs,qr=r.id,Hr=r.overflow,Xs=c),c=tz(c,g.children),c.flags|=4096);return c}return w?(Li(),w=g.fallback,B=c.mode,J=r.child,se=J.sibling,g=Or(J,{mode:"hidden",children:g.children}),g.subtreeFlags=J.subtreeFlags&65011712,se!==null?w=Or(se,w):(w=Gs(w,B,f,null),w.flags|=2),w.return=c,g.return=c,g.sibling=w,c.child=g,g=w,w=c.child,B=r.child.memoizedState,B===null?B=JD(f):(J=B.cachePool,J!==null?(se=Hn._currentValue,J=J.parent!==se?{parent:se,pool:se}:J):J=UU(),B={baseLanes:B.baseLanes|f,cachePool:J}),w.memoizedState=B,w.childLanes=ez(r,$,f),c.memoizedState=QD,g):(Ni(c),f=r.child,r=f.sibling,f=Or(f,{mode:"visible",children:g.children}),f.return=c,f.sibling=null,r!==null&&($=c.deletions,$===null?(c.deletions=[r],c.flags|=16):$.push(r)),c.child=f,c.memoizedState=null,f)}function tz(r,c){return c=wy({mode:"visible",children:c},r.mode),c.return=r,r.child=c}function wy(r,c){return r=qo(22,r,null,c),r.lanes=0,r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},r}function nz(r,c,f){return O1(c,r.child,null,f),r=tz(c,c.pendingProps.children),r.flags|=2,c.memoizedState=null,r}function iX(r,c,f){r.lanes|=c;var g=r.alternate;g!==null&&(g.lanes|=c),xD(r.return,c,f)}function oz(r,c,f,g,w){var S=r.memoizedState;S===null?r.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:g,tail:f,tailMode:w}:(S.isBackwards=c,S.rendering=null,S.renderingStartTime=0,S.last=g,S.tail=f,S.tailMode=w)}function sX(r,c,f){var g=c.pendingProps,w=g.revealOrder,S=g.tail;if(oo(r,c,g.children,f),g=Vn.current,(g&2)!==0)g=g&1|2,c.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=c.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&iX(r,f,c);else if(r.tag===19)iX(r,f,c);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===c)break e;for(;r.sibling===null;){if(r.return===null||r.return===c)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}g&=1}switch(T(Vn,g),w){case"forwards":for(f=c.child,w=null;f!==null;)r=f.alternate,r!==null&&gy(r)===null&&(w=f),f=f.sibling;f=w,f===null?(w=c.child,c.child=null):(w=f.sibling,f.sibling=null),oz(c,!1,w,f,S);break;case"backwards":for(f=null,w=c.child,c.child=null;w!==null;){if(r=w.alternate,r!==null&&gy(r)===null){c.child=w;break}r=w.sibling,w.sibling=f,f=w,w=r}oz(c,!0,f,null,S);break;case"together":oz(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Gr(r,c,f){if(r!==null&&(c.dependencies=r.dependencies),Ti|=c.lanes,(f&c.childLanes)===0)if(r!==null){if(R2(r,c,f,!1),(f&c.childLanes)===0)return null}else return null;if(r!==null&&c.child!==r.child)throw Error(o(153));if(c.child!==null){for(r=c.child,f=Or(r,r.pendingProps),c.child=f,f.return=c;r.sibling!==null;)r=r.sibling,f=f.sibling=Or(r,r.pendingProps),f.return=c;f.sibling=null}return c.child}function az(r,c){return(r.lanes&c)!==0?!0:(r=r.dependencies,!!(r!==null&&ty(r)))}function a1e(r,c,f){switch(c.tag){case 3:ce(c,c.stateNode.containerInfo),bi(c,Hn,r.memoizedState.cache),I2();break;case 27:case 5:ke(c);break;case 4:ce(c,c.stateNode.containerInfo);break;case 10:bi(c,c.type,c.memoizedProps.value);break;case 13:var g=c.memoizedState;if(g!==null)return g.dehydrated!==null?(Ni(c),c.flags|=128,null):(f&c.child.childLanes)!==0?rX(r,c,f):(Ni(c),r=Gr(r,c,f),r!==null?r.sibling:null);Ni(c);break;case 19:var w=(r.flags&128)!==0;if(g=(f&c.childLanes)!==0,g||(R2(r,c,f,!1),g=(f&c.childLanes)!==0),w){if(g)return sX(r,c,f);c.flags|=128}if(w=c.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),T(Vn,Vn.current),g)break;return null;case 22:case 23:return c.lanes=0,eX(r,c,f);case 24:bi(c,Hn,r.memoizedState.cache)}return Gr(r,c,f)}function cX(r,c,f){if(r!==null)if(r.memoizedProps!==c.pendingProps)Xn=!0;else{if(!az(r,f)&&(c.flags&128)===0)return Xn=!1,a1e(r,c,f);Xn=(r.flags&131072)!==0}else Xn=!1,Et&&(c.flags&1048576)!==0&&zU(c,ey,c.index);switch(c.lanes=0,c.tag){case 16:e:{r=c.pendingProps;var g=c.elementType,w=g._init;if(g=w(g._payload),c.type=g,typeof g=="function")fD(g)?(r=tc(g,r),c.tag=1,c=oX(null,c,g,r,f)):(c.tag=0,c=KD(null,c,g,r,f));else{if(g!=null){if(w=g.$$typeof,w===I){c.tag=11,c=KG(null,c,g,r,f);break e}else if(w===D){c.tag=14,c=QG(null,c,g,r,f);break e}}throw c=E(g)||g,Error(o(306,c,""))}}return c;case 0:return KD(r,c,c.type,c.pendingProps,f);case 1:return g=c.type,w=tc(g,c.pendingProps),oX(r,c,g,w,f);case 3:e:{if(ce(c,c.stateNode.containerInfo),r===null)throw Error(o(387));g=c.pendingProps;var S=c.memoizedState;w=S.element,ND(r,c),H2(c,g,null,f);var $=c.memoizedState;if(g=$.cache,bi(c,Hn,g),g!==S.cache&&wD(c,[Hn],f,!0),q2(),g=$.element,S.isDehydrated)if(S={element:g,isDehydrated:!1,cache:$.cache},c.updateQueue.baseState=S,c.memoizedState=S,c.flags&256){c=aX(r,c,g,f);break e}else if(g!==w){w=sa(Error(o(424)),c),T2(w),c=aX(r,c,g,f);break e}else{switch(r=c.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(hn=Ia(r.firstChild),fo=c,Et=!0,Ys=null,rr=!0,f=qG(c,null,g,f),c.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling}else{if(I2(),g===w){c=Gr(r,c,f);break e}oo(r,c,g,f)}c=c.child}return c;case 26:return xy(r,c),r===null?(f=hZ(c.type,null,c.pendingProps,null))?c.memoizedState=f:Et||(f=c.type,r=c.pendingProps,g=Py(ne.current).createElement(f),g[xe]=c,g[Ce]=r,ro(g,f,r),St(g),c.stateNode=g):c.memoizedState=hZ(c.type,r.memoizedProps,c.pendingProps,r.memoizedState),null;case 27:return ke(c),r===null&&Et&&(g=c.stateNode=lZ(c.type,c.pendingProps,ne.current),fo=c,rr=!0,w=hn,Di(c.type)?(zz=w,hn=Ia(g.firstChild)):hn=w),oo(r,c,c.pendingProps.children,f),xy(r,c),r===null&&(c.flags|=4194304),c.child;case 5:return r===null&&Et&&((w=g=hn)&&(g=I1e(g,c.type,c.pendingProps,rr),g!==null?(c.stateNode=g,fo=c,hn=Ia(g.firstChild),rr=!1,w=!0):w=!1),w||Ws(c)),ke(c),w=c.type,S=c.pendingProps,$=r!==null?r.memoizedProps:null,g=S.children,Rz(w,S)?g=null:$!==null&&Rz(w,$)&&(c.flags|=32),c.memoizedState!==null&&(w=TD(r,c,Wde,null,null,f),uf._currentValue=w),xy(r,c),oo(r,c,g,f),c.child;case 6:return r===null&&Et&&((r=f=hn)&&(f=T1e(f,c.pendingProps,rr),f!==null?(c.stateNode=f,fo=c,hn=null,r=!0):r=!1),r||Ws(c)),null;case 13:return rX(r,c,f);case 4:return ce(c,c.stateNode.containerInfo),g=c.pendingProps,r===null?c.child=O1(c,null,g,f):oo(r,c,g,f),c.child;case 11:return KG(r,c,c.type,c.pendingProps,f);case 7:return oo(r,c,c.pendingProps,f),c.child;case 8:return oo(r,c,c.pendingProps.children,f),c.child;case 12:return oo(r,c,c.pendingProps.children,f),c.child;case 10:return g=c.pendingProps,bi(c,c.type,g.value),oo(r,c,g.children,f),c.child;case 9:return w=c.type._context,g=c.pendingProps.children,Qs(c),w=co(w),g=g(w),c.flags|=1,oo(r,c,g,f),c.child;case 14:return QG(r,c,c.type,c.pendingProps,f);case 15:return JG(r,c,c.type,c.pendingProps,f);case 19:return sX(r,c,f);case 31:return g=c.pendingProps,f=c.mode,g={mode:g.mode,children:g.children},r===null?(f=wy(g,f),f.ref=c.ref,c.child=f,f.return=c,c=f):(f=Or(r.child,g),f.ref=c.ref,c.child=f,f.return=c,c=f),c;case 22:return eX(r,c,f);case 24:return Qs(c),g=co(Hn),r===null?(w=_D(),w===null&&(w=Ut,S=bD(),w.pooledCache=S,S.refCount++,S!==null&&(w.pooledCacheLanes|=f),w=S),c.memoizedState={parent:g,cache:w},CD(c),bi(c,Hn,w)):((r.lanes&f)!==0&&(ND(r,c),H2(c,null,null,f),q2()),w=r.memoizedState,S=c.memoizedState,w.parent!==g?(w={parent:g,cache:g},c.memoizedState=w,c.lanes===0&&(c.memoizedState=c.updateQueue.baseState=w),bi(c,Hn,g)):(g=S.cache,bi(c,Hn,g),g!==w.cache&&wD(c,[Hn],f,!0))),oo(r,c,c.pendingProps.children,f),c.child;case 29:throw c.pendingProps}throw Error(o(156,c.tag))}function Xr(r){r.flags|=4}function lX(r,c){if(c.type!=="stylesheet"||(c.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!gZ(c)){if(c=da.current,c!==null&&((Ct&4194048)===Ct?ir!==null:(Ct&62914560)!==Ct&&(Ct&536870912)===0||c!==ir))throw z2=SD,GU;r.flags|=8192}}function by(r,c){c!==null&&(r.flags|=4),r.flags&16384&&(c=r.tag!==22?Ja():536870912,r.lanes|=c,B1|=c)}function Z2(r,c){if(!Et)switch(r.tailMode){case"hidden":c=r.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?r.tail=null:f.sibling=null;break;case"collapsed":f=r.tail;for(var g=null;f!==null;)f.alternate!==null&&(g=f),f=f.sibling;g===null?c||r.tail===null?r.tail=null:r.tail.sibling=null:g.sibling=null}}function sn(r){var c=r.alternate!==null&&r.alternate.child===r.child,f=0,g=0;if(c)for(var w=r.child;w!==null;)f|=w.lanes|w.childLanes,g|=w.subtreeFlags&65011712,g|=w.flags&65011712,w.return=r,w=w.sibling;else for(w=r.child;w!==null;)f|=w.lanes|w.childLanes,g|=w.subtreeFlags,g|=w.flags,w.return=r,w=w.sibling;return r.subtreeFlags|=g,r.childLanes=f,c}function r1e(r,c,f){var g=c.pendingProps;switch(gD(c),c.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sn(c),null;case 1:return sn(c),null;case 3:return f=c.stateNode,g=null,r!==null&&(g=r.memoizedState.cache),c.memoizedState.cache!==g&&(c.flags|=2048),Br(Hn),me(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(r===null||r.child===null)&&(E2(c)?Xr(c):r===null||r.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,HU())),sn(c),null;case 26:return f=c.memoizedState,r===null?(Xr(c),f!==null?(sn(c),lX(c,f)):(sn(c),c.flags&=-16777217)):f?f!==r.memoizedState?(Xr(c),sn(c),lX(c,f)):(sn(c),c.flags&=-16777217):(r.memoizedProps!==g&&Xr(c),sn(c),c.flags&=-16777217),null;case 27:Ee(c),f=ne.current;var w=c.type;if(r!==null&&c.stateNode!=null)r.memoizedProps!==g&&Xr(c);else{if(!g){if(c.stateNode===null)throw Error(o(166));return sn(c),null}r=K.current,E2(c)?OU(c):(r=lZ(w,g,f),c.stateNode=r,Xr(c))}return sn(c),null;case 5:if(Ee(c),f=c.type,r!==null&&c.stateNode!=null)r.memoizedProps!==g&&Xr(c);else{if(!g){if(c.stateNode===null)throw Error(o(166));return sn(c),null}if(r=K.current,E2(c))OU(c);else{switch(w=Py(ne.current),r){case 1:r=w.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:r=w.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":r=w.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":r=w.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":r=w.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild);break;case"select":r=typeof g.is=="string"?w.createElement("select",{is:g.is}):w.createElement("select"),g.multiple?r.multiple=!0:g.size&&(r.size=g.size);break;default:r=typeof g.is=="string"?w.createElement(f,{is:g.is}):w.createElement(f)}}r[xe]=c,r[Ce]=g;e:for(w=c.child;w!==null;){if(w.tag===5||w.tag===6)r.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===c)break e;for(;w.sibling===null;){if(w.return===null||w.return===c)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}c.stateNode=r;e:switch(ro(r,f,g),f){case"button":case"input":case"select":case"textarea":r=!!g.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Xr(c)}}return sn(c),c.flags&=-16777217,null;case 6:if(r&&c.stateNode!=null)r.memoizedProps!==g&&Xr(c);else{if(typeof g!="string"&&c.stateNode===null)throw Error(o(166));if(r=ne.current,E2(c)){if(r=c.stateNode,f=c.memoizedProps,g=null,w=fo,w!==null)switch(w.tag){case 27:case 5:g=w.memoizedProps}r[xe]=c,r=!!(r.nodeValue===f||g!==null&&g.suppressHydrationWarning===!0||nZ(r.nodeValue,f)),r||Ws(c)}else r=Py(r).createTextNode(g),r[xe]=c,c.stateNode=r}return sn(c),null;case 13:if(g=c.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(w=E2(c),g!==null&&g.dehydrated!==null){if(r===null){if(!w)throw Error(o(318));if(w=c.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(o(317));w[xe]=c}else I2(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;sn(c),w=!1}else w=HU(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=w),w=!0;if(!w)return c.flags&256?(Ur(c),c):(Ur(c),null)}if(Ur(c),(c.flags&128)!==0)return c.lanes=f,c;if(f=g!==null,r=r!==null&&r.memoizedState!==null,f){g=c.child,w=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(w=g.alternate.memoizedState.cachePool.pool);var S=null;g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(S=g.memoizedState.cachePool.pool),S!==w&&(g.flags|=2048)}return f!==r&&f&&(c.child.flags|=8192),by(c,c.updateQueue),sn(c),null;case 4:return me(),r===null&&jz(c.stateNode.containerInfo),sn(c),null;case 10:return Br(c.type),sn(c),null;case 19:if(F(Vn),w=c.memoizedState,w===null)return sn(c),null;if(g=(c.flags&128)!==0,S=w.rendering,S===null)if(g)Z2(w,!1);else{if(fn!==0||r!==null&&(r.flags&128)!==0)for(r=c.child;r!==null;){if(S=gy(r),S!==null){for(c.flags|=128,Z2(w,!1),r=S.updateQueue,c.updateQueue=r,by(c,r),c.subtreeFlags=0,r=f,f=c.child;f!==null;)DU(f,r),f=f.sibling;return T(Vn,Vn.current&1|2),c.child}r=r.sibling}w.tail!==null&&We()>Sy&&(c.flags|=128,g=!0,Z2(w,!1),c.lanes=4194304)}else{if(!g)if(r=gy(S),r!==null){if(c.flags|=128,g=!0,r=r.updateQueue,c.updateQueue=r,by(c,r),Z2(w,!0),w.tail===null&&w.tailMode==="hidden"&&!S.alternate&&!Et)return sn(c),null}else 2*We()-w.renderingStartTime>Sy&&f!==536870912&&(c.flags|=128,g=!0,Z2(w,!1),c.lanes=4194304);w.isBackwards?(S.sibling=c.child,c.child=S):(r=w.last,r!==null?r.sibling=S:c.child=S,w.last=S)}return w.tail!==null?(c=w.tail,w.rendering=c,w.tail=c.sibling,w.renderingStartTime=We(),c.sibling=null,r=Vn.current,T(Vn,g?r&1|2:r&1),c):(sn(c),null);case 22:case 23:return Ur(c),ED(),g=c.memoizedState!==null,r!==null?r.memoizedState!==null!==g&&(c.flags|=8192):g&&(c.flags|=8192),g?(f&536870912)!==0&&(c.flags&128)===0&&(sn(c),c.subtreeFlags&6&&(c.flags|=8192)):sn(c),f=c.updateQueue,f!==null&&by(c,f.retryQueue),f=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),g=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),g!==f&&(c.flags|=2048),r!==null&&F(Js),null;case 24:return f=null,r!==null&&(f=r.memoizedState.cache),c.memoizedState.cache!==f&&(c.flags|=2048),Br(Hn),sn(c),null;case 25:return null;case 30:return null}throw Error(o(156,c.tag))}function i1e(r,c){switch(gD(c),c.tag){case 1:return r=c.flags,r&65536?(c.flags=r&-65537|128,c):null;case 3:return Br(Hn),me(),r=c.flags,(r&65536)!==0&&(r&128)===0?(c.flags=r&-65537|128,c):null;case 26:case 27:case 5:return Ee(c),null;case 13:if(Ur(c),r=c.memoizedState,r!==null&&r.dehydrated!==null){if(c.alternate===null)throw Error(o(340));I2()}return r=c.flags,r&65536?(c.flags=r&-65537|128,c):null;case 19:return F(Vn),null;case 4:return me(),null;case 10:return Br(c.type),null;case 22:case 23:return Ur(c),ED(),r!==null&&F(Js),r=c.flags,r&65536?(c.flags=r&-65537|128,c):null;case 24:return Br(Hn),null;case 25:return null;default:return null}}function uX(r,c){switch(gD(c),c.tag){case 3:Br(Hn),me();break;case 26:case 27:case 5:Ee(c);break;case 4:me();break;case 13:Ur(c);break;case 19:F(Vn);break;case 10:Br(c.type);break;case 22:case 23:Ur(c),ED(),r!==null&&F(Js);break;case 24:Br(Hn)}}function Y2(r,c){try{var f=c.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var w=g.next;f=w;do{if((f.tag&r)===r){g=void 0;var S=f.create,$=f.inst;g=S(),$.destroy=g}f=f.next}while(f!==w)}}catch(B){Ft(c,c.return,B)}}function ji(r,c,f){try{var g=c.updateQueue,w=g!==null?g.lastEffect:null;if(w!==null){var S=w.next;g=S;do{if((g.tag&r)===r){var $=g.inst,B=$.destroy;if(B!==void 0){$.destroy=void 0,w=c;var J=f,se=B;try{se()}catch(ye){Ft(w,J,ye)}}}g=g.next}while(g!==S)}}catch(ye){Ft(c,c.return,ye)}}function dX(r){var c=r.updateQueue;if(c!==null){var f=r.stateNode;try{QU(c,f)}catch(g){Ft(r,r.return,g)}}}function hX(r,c,f){f.props=tc(r.type,r.memoizedProps),f.state=r.memoizedState;try{f.componentWillUnmount()}catch(g){Ft(r,c,g)}}function W2(r,c){try{var f=r.ref;if(f!==null){switch(r.tag){case 26:case 27:case 5:var g=r.stateNode;break;case 30:g=r.stateNode;break;default:g=r.stateNode}typeof f=="function"?r.refCleanup=f(g):f.current=g}}catch(w){Ft(r,c,w)}}function sr(r,c){var f=r.ref,g=r.refCleanup;if(f!==null)if(typeof g=="function")try{g()}catch(w){Ft(r,c,w)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(w){Ft(r,c,w)}else f.current=null}function fX(r){var c=r.type,f=r.memoizedProps,g=r.stateNode;try{e:switch(c){case"button":case"input":case"select":case"textarea":f.autoFocus&&g.focus();break e;case"img":f.src?g.src=f.src:f.srcSet&&(g.srcset=f.srcSet)}}catch(w){Ft(r,r.return,w)}}function rz(r,c,f){try{var g=r.stateNode;N1e(g,r.type,f,c),g[Ce]=c}catch(w){Ft(r,r.return,w)}}function pX(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Di(r.type)||r.tag===4}function iz(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||pX(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&Di(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function sz(r,c,f){var g=r.tag;if(g===5||g===6)r=r.stateNode,c?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(r,c):(c=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,c.appendChild(r),f=f._reactRootContainer,f!=null||c.onclick!==null||(c.onclick=Ry));else if(g!==4&&(g===27&&Di(r.type)&&(f=r.stateNode,c=null),r=r.child,r!==null))for(sz(r,c,f),r=r.sibling;r!==null;)sz(r,c,f),r=r.sibling}function My(r,c,f){var g=r.tag;if(g===5||g===6)r=r.stateNode,c?f.insertBefore(r,c):f.appendChild(r);else if(g!==4&&(g===27&&Di(r.type)&&(f=r.stateNode),r=r.child,r!==null))for(My(r,c,f),r=r.sibling;r!==null;)My(r,c,f),r=r.sibling}function yX(r){var c=r.stateNode,f=r.memoizedProps;try{for(var g=r.type,w=c.attributes;w.length;)c.removeAttributeNode(w[0]);ro(c,g,f),c[xe]=r,c[Ce]=f}catch(S){Ft(r,r.return,S)}}var Zr=!1,_n=!1,cz=!1,mX=typeof WeakSet=="function"?WeakSet:Set,Zn=null;function s1e(r,c){if(r=r.containerInfo,Iz=Hy,r=NU(r),iD(r)){if("selectionStart"in r)var f={start:r.selectionStart,end:r.selectionEnd};else e:{f=(f=r.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&g.rangeCount!==0){f=g.anchorNode;var w=g.anchorOffset,S=g.focusNode;g=g.focusOffset;try{f.nodeType,S.nodeType}catch{f=null;break e}var $=0,B=-1,J=-1,se=0,ye=0,we=r,ue=null;t:for(;;){for(var he;we!==f||w!==0&&we.nodeType!==3||(B=$+w),we!==S||g!==0&&we.nodeType!==3||(J=$+g),we.nodeType===3&&($+=we.nodeValue.length),(he=we.firstChild)!==null;)ue=we,we=he;for(;;){if(we===r)break t;if(ue===f&&++se===w&&(B=$),ue===S&&++ye===g&&(J=$),(he=we.nextSibling)!==null)break;we=ue,ue=we.parentNode}we=he}f=B===-1||J===-1?null:{start:B,end:J}}else f=null}f=f||{start:0,end:0}}else f=null;for(Tz={focusedElem:r,selectionRange:f},Hy=!1,Zn=c;Zn!==null;)if(c=Zn,r=c.child,(c.subtreeFlags&1024)!==0&&r!==null)r.return=c,Zn=r;else for(;Zn!==null;){switch(c=Zn,S=c.alternate,r=c.flags,c.tag){case 0:break;case 11:case 15:break;case 1:if((r&1024)!==0&&S!==null){r=void 0,f=c,w=S.memoizedProps,S=S.memoizedState,g=f.stateNode;try{var at=tc(f.type,w,f.elementType===f.type);r=g.getSnapshotBeforeUpdate(at,S),g.__reactInternalSnapshotBeforeUpdate=r}catch(Je){Ft(f,f.return,Je)}}break;case 3:if((r&1024)!==0){if(r=c.stateNode.containerInfo,f=r.nodeType,f===9)$z(r);else if(f===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":$z(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(o(163))}if(r=c.sibling,r!==null){r.return=c.return,Zn=r;break}Zn=c.return}}function gX(r,c,f){var g=f.flags;switch(f.tag){case 0:case 11:case 15:Ai(r,f),g&4&&Y2(5,f);break;case 1:if(Ai(r,f),g&4)if(r=f.stateNode,c===null)try{r.componentDidMount()}catch($){Ft(f,f.return,$)}else{var w=tc(f.type,c.memoizedProps);c=c.memoizedState;try{r.componentDidUpdate(w,c,r.__reactInternalSnapshotBeforeUpdate)}catch($){Ft(f,f.return,$)}}g&64&&dX(f),g&512&&W2(f,f.return);break;case 3:if(Ai(r,f),g&64&&(r=f.updateQueue,r!==null)){if(c=null,f.child!==null)switch(f.child.tag){case 27:case 5:c=f.child.stateNode;break;case 1:c=f.child.stateNode}try{QU(r,c)}catch($){Ft(f,f.return,$)}}break;case 27:c===null&&g&4&&yX(f);case 26:case 5:Ai(r,f),c===null&&g&4&&fX(f),g&512&&W2(f,f.return);break;case 12:Ai(r,f);break;case 13:Ai(r,f),g&4&&xX(r,f),g&64&&(r=f.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(f=m1e.bind(null,f),R1e(r,f))));break;case 22:if(g=f.memoizedState!==null||Zr,!g){c=c!==null&&c.memoizedState!==null||_n,w=Zr;var S=_n;Zr=g,(_n=c)&&!S?Ei(r,f,(f.subtreeFlags&8772)!==0):Ai(r,f),Zr=w,_n=S}break;case 30:break;default:Ai(r,f)}}function vX(r){var c=r.alternate;c!==null&&(r.alternate=null,vX(c)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(c=r.stateNode,c!==null&&Ve(c)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var nn=null,No=!1;function Yr(r,c,f){for(f=f.child;f!==null;)kX(r,c,f),f=f.sibling}function kX(r,c,f){if(be&&typeof be.onCommitFiberUnmount=="function")try{be.onCommitFiberUnmount(fe,f)}catch{}switch(f.tag){case 26:_n||sr(f,c),Yr(r,c,f),f.memoizedState?f.memoizedState.count--:f.stateNode&&(f=f.stateNode,f.parentNode.removeChild(f));break;case 27:_n||sr(f,c);var g=nn,w=No;Di(f.type)&&(nn=f.stateNode,No=!1),Yr(r,c,f),rf(f.stateNode),nn=g,No=w;break;case 5:_n||sr(f,c);case 6:if(g=nn,w=No,nn=null,Yr(r,c,f),nn=g,No=w,nn!==null)if(No)try{(nn.nodeType===9?nn.body:nn.nodeName==="HTML"?nn.ownerDocument.body:nn).removeChild(f.stateNode)}catch(S){Ft(f,c,S)}else try{nn.removeChild(f.stateNode)}catch(S){Ft(f,c,S)}break;case 18:nn!==null&&(No?(r=nn,sZ(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,f.stateNode),pf(r)):sZ(nn,f.stateNode));break;case 4:g=nn,w=No,nn=f.stateNode.containerInfo,No=!0,Yr(r,c,f),nn=g,No=w;break;case 0:case 11:case 14:case 15:_n||ji(2,f,c),_n||ji(4,f,c),Yr(r,c,f);break;case 1:_n||(sr(f,c),g=f.stateNode,typeof g.componentWillUnmount=="function"&&hX(f,c,g)),Yr(r,c,f);break;case 21:Yr(r,c,f);break;case 22:_n=(g=_n)||f.memoizedState!==null,Yr(r,c,f),_n=g;break;default:Yr(r,c,f)}}function xX(r,c){if(c.memoizedState===null&&(r=c.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{pf(r)}catch(f){Ft(c,c.return,f)}}function c1e(r){switch(r.tag){case 13:case 19:var c=r.stateNode;return c===null&&(c=r.stateNode=new mX),c;case 22:return r=r.stateNode,c=r._retryCache,c===null&&(c=r._retryCache=new mX),c;default:throw Error(o(435,r.tag))}}function lz(r,c){var f=c1e(r);c.forEach(function(g){var w=g1e.bind(null,r,g);f.has(g)||(f.add(g),g.then(w,w))})}function Ho(r,c){var f=c.deletions;if(f!==null)for(var g=0;g<f.length;g++){var w=f[g],S=r,$=c,B=$;e:for(;B!==null;){switch(B.tag){case 27:if(Di(B.type)){nn=B.stateNode,No=!1;break e}break;case 5:nn=B.stateNode,No=!1;break e;case 3:case 4:nn=B.stateNode.containerInfo,No=!0;break e}B=B.return}if(nn===null)throw Error(o(160));kX(S,$,w),nn=null,No=!1,S=w.alternate,S!==null&&(S.return=null),w.return=null}if(c.subtreeFlags&13878)for(c=c.child;c!==null;)wX(c,r),c=c.sibling}var Ea=null;function wX(r,c){var f=r.alternate,g=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Ho(c,r),Vo(r),g&4&&(ji(3,r,r.return),Y2(3,r),ji(5,r,r.return));break;case 1:Ho(c,r),Vo(r),g&512&&(_n||f===null||sr(f,f.return)),g&64&&Zr&&(r=r.updateQueue,r!==null&&(g=r.callbacks,g!==null&&(f=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=f===null?g:f.concat(g))));break;case 26:var w=Ea;if(Ho(c,r),Vo(r),g&512&&(_n||f===null||sr(f,f.return)),g&4){var S=f!==null?f.memoizedState:null;if(g=r.memoizedState,f===null)if(g===null)if(r.stateNode===null){e:{g=r.type,f=r.memoizedProps,w=w.ownerDocument||w;t:switch(g){case"title":S=w.getElementsByTagName("title")[0],(!S||S[Qe]||S[xe]||S.namespaceURI==="http://www.w3.org/2000/svg"||S.hasAttribute("itemprop"))&&(S=w.createElement(g),w.head.insertBefore(S,w.querySelector("head > title"))),ro(S,g,f),S[xe]=r,St(S),g=S;break e;case"link":var $=yZ("link","href",w).get(g+(f.href||""));if($){for(var B=0;B<$.length;B++)if(S=$[B],S.getAttribute("href")===(f.href==null||f.href===""?null:f.href)&&S.getAttribute("rel")===(f.rel==null?null:f.rel)&&S.getAttribute("title")===(f.title==null?null:f.title)&&S.getAttribute("crossorigin")===(f.crossOrigin==null?null:f.crossOrigin)){$.splice(B,1);break t}}S=w.createElement(g),ro(S,g,f),w.head.appendChild(S);break;case"meta":if($=yZ("meta","content",w).get(g+(f.content||""))){for(B=0;B<$.length;B++)if(S=$[B],S.getAttribute("content")===(f.content==null?null:""+f.content)&&S.getAttribute("name")===(f.name==null?null:f.name)&&S.getAttribute("property")===(f.property==null?null:f.property)&&S.getAttribute("http-equiv")===(f.httpEquiv==null?null:f.httpEquiv)&&S.getAttribute("charset")===(f.charSet==null?null:f.charSet)){$.splice(B,1);break t}}S=w.createElement(g),ro(S,g,f),w.head.appendChild(S);break;default:throw Error(o(468,g))}S[xe]=r,St(S),g=S}r.stateNode=g}else mZ(w,r.type,r.stateNode);else r.stateNode=pZ(w,g,r.memoizedProps);else S!==g?(S===null?f.stateNode!==null&&(f=f.stateNode,f.parentNode.removeChild(f)):S.count--,g===null?mZ(w,r.type,r.stateNode):pZ(w,g,r.memoizedProps)):g===null&&r.stateNode!==null&&rz(r,r.memoizedProps,f.memoizedProps)}break;case 27:Ho(c,r),Vo(r),g&512&&(_n||f===null||sr(f,f.return)),f!==null&&g&4&&rz(r,r.memoizedProps,f.memoizedProps);break;case 5:if(Ho(c,r),Vo(r),g&512&&(_n||f===null||sr(f,f.return)),r.flags&32){w=r.stateNode;try{w1(w,"")}catch(he){Ft(r,r.return,he)}}g&4&&r.stateNode!=null&&(w=r.memoizedProps,rz(r,w,f!==null?f.memoizedProps:w)),g&1024&&(cz=!0);break;case 6:if(Ho(c,r),Vo(r),g&4){if(r.stateNode===null)throw Error(o(162));g=r.memoizedProps,f=r.stateNode;try{f.nodeValue=g}catch(he){Ft(r,r.return,he)}}break;case 3:if(zy=null,w=Ea,Ea=$y(c.containerInfo),Ho(c,r),Ea=w,Vo(r),g&4&&f!==null&&f.memoizedState.isDehydrated)try{pf(c.containerInfo)}catch(he){Ft(r,r.return,he)}cz&&(cz=!1,bX(r));break;case 4:g=Ea,Ea=$y(r.stateNode.containerInfo),Ho(c,r),Vo(r),Ea=g;break;case 12:Ho(c,r),Vo(r);break;case 13:Ho(c,r),Vo(r),r.child.flags&8192&&r.memoizedState!==null!=(f!==null&&f.memoizedState!==null)&&(yz=We()),g&4&&(g=r.updateQueue,g!==null&&(r.updateQueue=null,lz(r,g)));break;case 22:w=r.memoizedState!==null;var J=f!==null&&f.memoizedState!==null,se=Zr,ye=_n;if(Zr=se||w,_n=ye||J,Ho(c,r),_n=ye,Zr=se,Vo(r),g&8192)e:for(c=r.stateNode,c._visibility=w?c._visibility&-2:c._visibility|1,w&&(f===null||J||Zr||_n||nc(r)),f=null,c=r;;){if(c.tag===5||c.tag===26){if(f===null){J=f=c;try{if(S=J.stateNode,w)$=S.style,typeof $.setProperty=="function"?$.setProperty("display","none","important"):$.display="none";else{B=J.stateNode;var we=J.memoizedProps.style,ue=we!=null&&we.hasOwnProperty("display")?we.display:null;B.style.display=ue==null||typeof ue=="boolean"?"":(""+ue).trim()}}catch(he){Ft(J,J.return,he)}}}else if(c.tag===6){if(f===null){J=c;try{J.stateNode.nodeValue=w?"":J.memoizedProps}catch(he){Ft(J,J.return,he)}}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===r)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===r)break e;for(;c.sibling===null;){if(c.return===null||c.return===r)break e;f===c&&(f=null),c=c.return}f===c&&(f=null),c.sibling.return=c.return,c=c.sibling}g&4&&(g=r.updateQueue,g!==null&&(f=g.retryQueue,f!==null&&(g.retryQueue=null,lz(r,f))));break;case 19:Ho(c,r),Vo(r),g&4&&(g=r.updateQueue,g!==null&&(r.updateQueue=null,lz(r,g)));break;case 30:break;case 21:break;default:Ho(c,r),Vo(r)}}function Vo(r){var c=r.flags;if(c&2){try{for(var f,g=r.return;g!==null;){if(pX(g)){f=g;break}g=g.return}if(f==null)throw Error(o(160));switch(f.tag){case 27:var w=f.stateNode,S=iz(r);My(r,S,w);break;case 5:var $=f.stateNode;f.flags&32&&(w1($,""),f.flags&=-33);var B=iz(r);My(r,B,$);break;case 3:case 4:var J=f.stateNode.containerInfo,se=iz(r);sz(r,se,J);break;default:throw Error(o(161))}}catch(ye){Ft(r,r.return,ye)}r.flags&=-3}c&4096&&(r.flags&=-4097)}function bX(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var c=r;bX(c),c.tag===5&&c.flags&1024&&c.stateNode.reset(),r=r.sibling}}function Ai(r,c){if(c.subtreeFlags&8772)for(c=c.child;c!==null;)gX(r,c.alternate,c),c=c.sibling}function nc(r){for(r=r.child;r!==null;){var c=r;switch(c.tag){case 0:case 11:case 14:case 15:ji(4,c,c.return),nc(c);break;case 1:sr(c,c.return);var f=c.stateNode;typeof f.componentWillUnmount=="function"&&hX(c,c.return,f),nc(c);break;case 27:rf(c.stateNode);case 26:case 5:sr(c,c.return),nc(c);break;case 22:c.memoizedState===null&&nc(c);break;case 30:nc(c);break;default:nc(c)}r=r.sibling}}function Ei(r,c,f){for(f=f&&(c.subtreeFlags&8772)!==0,c=c.child;c!==null;){var g=c.alternate,w=r,S=c,$=S.flags;switch(S.tag){case 0:case 11:case 15:Ei(w,S,f),Y2(4,S);break;case 1:if(Ei(w,S,f),g=S,w=g.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(se){Ft(g,g.return,se)}if(g=S,w=g.updateQueue,w!==null){var B=g.stateNode;try{var J=w.shared.hiddenCallbacks;if(J!==null)for(w.shared.hiddenCallbacks=null,w=0;w<J.length;w++)KU(J[w],B)}catch(se){Ft(g,g.return,se)}}f&&$&64&&dX(S),W2(S,S.return);break;case 27:yX(S);case 26:case 5:Ei(w,S,f),f&&g===null&&$&4&&fX(S),W2(S,S.return);break;case 12:Ei(w,S,f);break;case 13:Ei(w,S,f),f&&$&4&&xX(w,S);break;case 22:S.memoizedState===null&&Ei(w,S,f),W2(S,S.return);break;case 30:break;default:Ei(w,S,f)}c=c.sibling}}function uz(r,c){var f=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),r=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(r=c.memoizedState.cachePool.pool),r!==f&&(r!=null&&r.refCount++,f!=null&&P2(f))}function dz(r,c){r=null,c.alternate!==null&&(r=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==r&&(c.refCount++,r!=null&&P2(r))}function cr(r,c,f,g){if(c.subtreeFlags&10256)for(c=c.child;c!==null;)MX(r,c,f,g),c=c.sibling}function MX(r,c,f,g){var w=c.flags;switch(c.tag){case 0:case 11:case 15:cr(r,c,f,g),w&2048&&Y2(9,c);break;case 1:cr(r,c,f,g);break;case 3:cr(r,c,f,g),w&2048&&(r=null,c.alternate!==null&&(r=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==r&&(c.refCount++,r!=null&&P2(r)));break;case 12:if(w&2048){cr(r,c,f,g),r=c.stateNode;try{var S=c.memoizedProps,$=S.id,B=S.onPostCommit;typeof B=="function"&&B($,c.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(J){Ft(c,c.return,J)}}else cr(r,c,f,g);break;case 13:cr(r,c,f,g);break;case 23:break;case 22:S=c.stateNode,$=c.alternate,c.memoizedState!==null?S._visibility&2?cr(r,c,f,g):K2(r,c):S._visibility&2?cr(r,c,f,g):(S._visibility|=2,q1(r,c,f,g,(c.subtreeFlags&10256)!==0)),w&2048&&uz($,c);break;case 24:cr(r,c,f,g),w&2048&&dz(c.alternate,c);break;default:cr(r,c,f,g)}}function q1(r,c,f,g,w){for(w=w&&(c.subtreeFlags&10256)!==0,c=c.child;c!==null;){var S=r,$=c,B=f,J=g,se=$.flags;switch($.tag){case 0:case 11:case 15:q1(S,$,B,J,w),Y2(8,$);break;case 23:break;case 22:var ye=$.stateNode;$.memoizedState!==null?ye._visibility&2?q1(S,$,B,J,w):K2(S,$):(ye._visibility|=2,q1(S,$,B,J,w)),w&&se&2048&&uz($.alternate,$);break;case 24:q1(S,$,B,J,w),w&&se&2048&&dz($.alternate,$);break;default:q1(S,$,B,J,w)}c=c.sibling}}function K2(r,c){if(c.subtreeFlags&10256)for(c=c.child;c!==null;){var f=r,g=c,w=g.flags;switch(g.tag){case 22:K2(f,g),w&2048&&uz(g.alternate,g);break;case 24:K2(f,g),w&2048&&dz(g.alternate,g);break;default:K2(f,g)}c=c.sibling}}var Q2=8192;function H1(r){if(r.subtreeFlags&Q2)for(r=r.child;r!==null;)_X(r),r=r.sibling}function _X(r){switch(r.tag){case 26:H1(r),r.flags&Q2&&r.memoizedState!==null&&X1e(Ea,r.memoizedState,r.memoizedProps);break;case 5:H1(r);break;case 3:case 4:var c=Ea;Ea=$y(r.stateNode.containerInfo),H1(r),Ea=c;break;case 22:r.memoizedState===null&&(c=r.alternate,c!==null&&c.memoizedState!==null?(c=Q2,Q2=16777216,H1(r),Q2=c):H1(r));break;default:H1(r)}}function SX(r){var c=r.alternate;if(c!==null&&(r=c.child,r!==null)){c.child=null;do c=r.sibling,r.sibling=null,r=c;while(r!==null)}}function J2(r){var c=r.deletions;if((r.flags&16)!==0){if(c!==null)for(var f=0;f<c.length;f++){var g=c[f];Zn=g,NX(g,r)}SX(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)CX(r),r=r.sibling}function CX(r){switch(r.tag){case 0:case 11:case 15:J2(r),r.flags&2048&&ji(9,r,r.return);break;case 3:J2(r);break;case 12:J2(r);break;case 22:var c=r.stateNode;r.memoizedState!==null&&c._visibility&2&&(r.return===null||r.return.tag!==13)?(c._visibility&=-3,_y(r)):J2(r);break;default:J2(r)}}function _y(r){var c=r.deletions;if((r.flags&16)!==0){if(c!==null)for(var f=0;f<c.length;f++){var g=c[f];Zn=g,NX(g,r)}SX(r)}for(r=r.child;r!==null;){switch(c=r,c.tag){case 0:case 11:case 15:ji(8,c,c.return),_y(c);break;case 22:f=c.stateNode,f._visibility&2&&(f._visibility&=-3,_y(c));break;default:_y(c)}r=r.sibling}}function NX(r,c){for(;Zn!==null;){var f=Zn;switch(f.tag){case 0:case 11:case 15:ji(8,f,c);break;case 23:case 22:if(f.memoizedState!==null&&f.memoizedState.cachePool!==null){var g=f.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:P2(f.memoizedState.cache)}if(g=f.child,g!==null)g.return=f,Zn=g;else e:for(f=r;Zn!==null;){g=Zn;var w=g.sibling,S=g.return;if(vX(g),g===f){Zn=null;break e}if(w!==null){w.return=S,Zn=w;break e}Zn=S}}}var l1e={getCacheForType:function(r){var c=co(Hn),f=c.data.get(r);return f===void 0&&(f=r(),c.data.set(r,f)),f}},u1e=typeof WeakMap=="function"?WeakMap:Map,Pt=0,Ut=null,wt=null,Ct=0,$t=0,Bo=null,Ii=!1,V1=!1,hz=!1,Wr=0,fn=0,Ti=0,oc=0,fz=0,ha=0,B1=0,ef=null,Lo=null,pz=!1,yz=0,Sy=1/0,Cy=null,Ri=null,ao=0,Pi=null,F1=null,U1=0,mz=0,gz=null,LX=null,tf=0,vz=null;function Fo(){if((Pt&2)!==0&&Ct!==0)return Ct&-Ct;if(P.T!==null){var r=I1;return r!==0?r:Sz()}return ee()}function jX(){ha===0&&(ha=(Ct&536870912)===0||Et?Qa():536870912);var r=da.current;return r!==null&&(r.flags|=32),ha}function Uo(r,c,f){(r===Ut&&($t===2||$t===9)||r.cancelPendingCommit!==null)&&(G1(r,0),$i(r,Ct,ha,!1)),tr(r,f),((Pt&2)===0||r!==Ut)&&(r===Ut&&((Pt&2)===0&&(oc|=f),fn===4&&$i(r,Ct,ha,!1)),lr(r))}function AX(r,c,f){if((Pt&6)!==0)throw Error(o(327));var g=!f&&(c&124)===0&&(c&r.expiredLanes)===0||Dt(r,c),w=g?f1e(r,c):wz(r,c,!0),S=g;do{if(w===0){V1&&!g&&$i(r,c,0,!1);break}else{if(f=r.current.alternate,S&&!d1e(f)){w=wz(r,c,!1),S=!1;continue}if(w===2){if(S=c,r.errorRecoveryDisabledLanes&S)var $=0;else $=r.pendingLanes&-536870913,$=$!==0?$:$&536870912?536870912:0;if($!==0){c=$;e:{var B=r;w=ef;var J=B.current.memoizedState.isDehydrated;if(J&&(G1(B,$).flags|=256),$=wz(B,$,!1),$!==2){if(hz&&!J){B.errorRecoveryDisabledLanes|=S,oc|=S,w=4;break e}S=Lo,Lo=w,S!==null&&(Lo===null?Lo=S:Lo.push.apply(Lo,S))}w=$}if(S=!1,w!==2)continue}}if(w===1){G1(r,0),$i(r,c,0,!0);break}e:{switch(g=r,S=w,S){case 0:case 1:throw Error(o(345));case 4:if((c&4194048)!==c)break;case 6:$i(g,c,ha,!Ii);break e;case 2:Lo=null;break;case 3:case 5:break;default:throw Error(o(329))}if((c&62914560)===c&&(w=yz+300-We(),10<w)){if($i(g,c,ha,!Ii),At(g,0,!0)!==0)break e;g.timeoutHandle=rZ(EX.bind(null,g,f,Lo,Cy,pz,c,ha,oc,B1,Ii,S,2,-0,0),w);break e}EX(g,f,Lo,Cy,pz,c,ha,oc,B1,Ii,S,0,-0,0)}}break}while(!0);lr(r)}function EX(r,c,f,g,w,S,$,B,J,se,ye,we,ue,he){if(r.timeoutHandle=-1,we=c.subtreeFlags,(we&8192||(we&16785408)===16785408)&&(lf={stylesheets:null,count:0,unsuspend:G1e},_X(c),we=Z1e(),we!==null)){r.cancelPendingCommit=we(zX.bind(null,r,c,S,f,g,w,$,B,J,ye,1,ue,he)),$i(r,S,$,!se);return}zX(r,c,S,f,g,w,$,B,J)}function d1e(r){for(var c=r;;){var f=c.tag;if((f===0||f===11||f===15)&&c.flags&16384&&(f=c.updateQueue,f!==null&&(f=f.stores,f!==null)))for(var g=0;g<f.length;g++){var w=f[g],S=w.getSnapshot;w=w.value;try{if(!Oo(S(),w))return!1}catch{return!1}}if(f=c.child,c.subtreeFlags&16384&&f!==null)f.return=c,c=f;else{if(c===r)break;for(;c.sibling===null;){if(c.return===null||c.return===r)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function $i(r,c,f,g){c&=~fz,c&=~oc,r.suspendedLanes|=c,r.pingedLanes&=~c,g&&(r.warmLanes|=c),g=r.expirationTimes;for(var w=c;0<w;){var S=31-He(w),$=1<<S;g[S]=-1,w&=~$}f!==0&&Pr(r,f,c)}function Ny(){return(Pt&6)===0?(nf(0),!1):!0}function kz(){if(wt!==null){if($t===0)var r=wt.return;else r=wt,Vr=Ks=null,$D(r),z1=null,G2=0,r=wt;for(;r!==null;)uX(r.alternate,r),r=r.return;wt=null}}function G1(r,c){var f=r.timeoutHandle;f!==-1&&(r.timeoutHandle=-1,j1e(f)),f=r.cancelPendingCommit,f!==null&&(r.cancelPendingCommit=null,f()),kz(),Ut=r,wt=f=Or(r.current,null),Ct=c,$t=0,Bo=null,Ii=!1,V1=Dt(r,c),hz=!1,B1=ha=fz=oc=Ti=fn=0,Lo=ef=null,pz=!1,(c&8)!==0&&(c|=c&32);var g=r.entangledLanes;if(g!==0)for(r=r.entanglements,g&=c;0<g;){var w=31-He(g),S=1<<w;c|=r[w],g&=~S}return Wr=c,Yp(),f}function IX(r,c){pt=null,P.H=py,c===D2||c===ay?(c=YU(),$t=3):c===GU?(c=YU(),$t=4):$t=c===WG?8:c!==null&&typeof c=="object"&&typeof c.then=="function"?6:1,Bo=c,wt===null&&(fn=1,ky(r,sa(c,r.current)))}function TX(){var r=P.H;return P.H=py,r===null?py:r}function RX(){var r=P.A;return P.A=l1e,r}function xz(){fn=4,Ii||(Ct&4194048)!==Ct&&da.current!==null||(V1=!0),(Ti&134217727)===0&&(oc&134217727)===0||Ut===null||$i(Ut,Ct,ha,!1)}function wz(r,c,f){var g=Pt;Pt|=2;var w=TX(),S=RX();(Ut!==r||Ct!==c)&&(Cy=null,G1(r,c)),c=!1;var $=fn;e:do try{if($t!==0&&wt!==null){var B=wt,J=Bo;switch($t){case 8:kz(),$=6;break e;case 3:case 2:case 9:case 6:da.current===null&&(c=!0);var se=$t;if($t=0,Bo=null,X1(r,B,J,se),f&&V1){$=0;break e}break;default:se=$t,$t=0,Bo=null,X1(r,B,J,se)}}h1e(),$=fn;break}catch(ye){IX(r,ye)}while(!0);return c&&r.shellSuspendCounter++,Vr=Ks=null,Pt=g,P.H=w,P.A=S,wt===null&&(Ut=null,Ct=0,Yp()),$}function h1e(){for(;wt!==null;)PX(wt)}function f1e(r,c){var f=Pt;Pt|=2;var g=TX(),w=RX();Ut!==r||Ct!==c?(Cy=null,Sy=We()+500,G1(r,c)):V1=Dt(r,c);e:do try{if($t!==0&&wt!==null){c=wt;var S=Bo;t:switch($t){case 1:$t=0,Bo=null,X1(r,c,S,1);break;case 2:case 9:if(XU(S)){$t=0,Bo=null,$X(c);break}c=function(){$t!==2&&$t!==9||Ut!==r||($t=7),lr(r)},S.then(c,c);break e;case 3:$t=7;break e;case 4:$t=5;break e;case 7:XU(S)?($t=0,Bo=null,$X(c)):($t=0,Bo=null,X1(r,c,S,7));break;case 5:var $=null;switch(wt.tag){case 26:$=wt.memoizedState;case 5:case 27:var B=wt;if(!$||gZ($)){$t=0,Bo=null;var J=B.sibling;if(J!==null)wt=J;else{var se=B.return;se!==null?(wt=se,Ly(se)):wt=null}break t}}$t=0,Bo=null,X1(r,c,S,5);break;case 6:$t=0,Bo=null,X1(r,c,S,6);break;case 8:kz(),fn=6;break e;default:throw Error(o(462))}}p1e();break}catch(ye){IX(r,ye)}while(!0);return Vr=Ks=null,P.H=g,P.A=w,Pt=f,wt!==null?0:(Ut=null,Ct=0,Yp(),fn)}function p1e(){for(;wt!==null&&!ct();)PX(wt)}function PX(r){var c=cX(r.alternate,r,Wr);r.memoizedProps=r.pendingProps,c===null?Ly(r):wt=c}function $X(r){var c=r,f=c.alternate;switch(c.tag){case 15:case 0:c=nX(f,c,c.pendingProps,c.type,void 0,Ct);break;case 11:c=nX(f,c,c.pendingProps,c.type.render,c.ref,Ct);break;case 5:$D(c);default:uX(f,c),c=wt=DU(c,Wr),c=cX(f,c,Wr)}r.memoizedProps=r.pendingProps,c===null?Ly(r):wt=c}function X1(r,c,f,g){Vr=Ks=null,$D(c),z1=null,G2=0;var w=c.return;try{if(o1e(r,w,c,f,Ct)){fn=1,ky(r,sa(f,r.current)),wt=null;return}}catch(S){if(w!==null)throw wt=w,S;fn=1,ky(r,sa(f,r.current)),wt=null;return}c.flags&32768?(Et||g===1?r=!0:V1||(Ct&536870912)!==0?r=!1:(Ii=r=!0,(g===2||g===9||g===3||g===6)&&(g=da.current,g!==null&&g.tag===13&&(g.flags|=16384))),DX(c,r)):Ly(c)}function Ly(r){var c=r;do{if((c.flags&32768)!==0){DX(c,Ii);return}r=c.return;var f=r1e(c.alternate,c,Wr);if(f!==null){wt=f;return}if(c=c.sibling,c!==null){wt=c;return}wt=c=r}while(c!==null);fn===0&&(fn=5)}function DX(r,c){do{var f=i1e(r.alternate,r);if(f!==null){f.flags&=32767,wt=f;return}if(f=r.return,f!==null&&(f.flags|=32768,f.subtreeFlags=0,f.deletions=null),!c&&(r=r.sibling,r!==null)){wt=r;return}wt=r=f}while(r!==null);fn=6,wt=null}function zX(r,c,f,g,w,S,$,B,J){r.cancelPendingCommit=null;do jy();while(ao!==0);if((Pt&6)!==0)throw Error(o(327));if(c!==null){if(c===r.current)throw Error(o(177));if(S=c.lanes|c.childLanes,S|=dD,ra(r,f,S,$,B,J),r===Ut&&(wt=Ut=null,Ct=0),F1=c,Pi=r,U1=f,mz=S,gz=w,LX=g,(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,v1e(An,function(){return BX(),null})):(r.callbackNode=null,r.callbackPriority=0),g=(c.flags&13878)!==0,(c.subtreeFlags&13878)!==0||g){g=P.T,P.T=null,w=X.p,X.p=2,$=Pt,Pt|=4;try{s1e(r,c,f)}finally{Pt=$,X.p=w,P.T=g}}ao=1,OX(),qX(),HX()}}function OX(){if(ao===1){ao=0;var r=Pi,c=F1,f=(c.flags&13878)!==0;if((c.subtreeFlags&13878)!==0||f){f=P.T,P.T=null;var g=X.p;X.p=2;var w=Pt;Pt|=4;try{wX(c,r);var S=Tz,$=NU(r.containerInfo),B=S.focusedElem,J=S.selectionRange;if($!==B&&B&&B.ownerDocument&&CU(B.ownerDocument.documentElement,B)){if(J!==null&&iD(B)){var se=J.start,ye=J.end;if(ye===void 0&&(ye=se),"selectionStart"in B)B.selectionStart=se,B.selectionEnd=Math.min(ye,B.value.length);else{var we=B.ownerDocument||document,ue=we&&we.defaultView||window;if(ue.getSelection){var he=ue.getSelection(),at=B.textContent.length,Je=Math.min(J.start,at),Ht=J.end===void 0?Je:Math.min(J.end,at);!he.extend&&Je>Ht&&($=Ht,Ht=Je,Je=$);var ae=SU(B,Je),oe=SU(B,Ht);if(ae&&oe&&(he.rangeCount!==1||he.anchorNode!==ae.node||he.anchorOffset!==ae.offset||he.focusNode!==oe.node||he.focusOffset!==oe.offset)){var ie=we.createRange();ie.setStart(ae.node,ae.offset),he.removeAllRanges(),Je>Ht?(he.addRange(ie),he.extend(oe.node,oe.offset)):(ie.setEnd(oe.node,oe.offset),he.addRange(ie))}}}}for(we=[],he=B;he=he.parentNode;)he.nodeType===1&&we.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof B.focus=="function"&&B.focus(),B=0;B<we.length;B++){var ve=we[B];ve.element.scrollLeft=ve.left,ve.element.scrollTop=ve.top}}Hy=!!Iz,Tz=Iz=null}finally{Pt=w,X.p=g,P.T=f}}r.current=c,ao=2}}function qX(){if(ao===2){ao=0;var r=Pi,c=F1,f=(c.flags&8772)!==0;if((c.subtreeFlags&8772)!==0||f){f=P.T,P.T=null;var g=X.p;X.p=2;var w=Pt;Pt|=4;try{gX(r,c.alternate,c)}finally{Pt=w,X.p=g,P.T=f}}ao=3}}function HX(){if(ao===4||ao===3){ao=0,jt();var r=Pi,c=F1,f=U1,g=LX;(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?ao=5:(ao=0,F1=Pi=null,VX(r,r.pendingLanes));var w=r.pendingLanes;if(w===0&&(Ri=null),Hs(f),c=c.stateNode,be&&typeof be.onCommitFiberRoot=="function")try{be.onCommitFiberRoot(fe,c,void 0,(c.current.flags&128)===128)}catch{}if(g!==null){c=P.T,w=X.p,X.p=2,P.T=null;try{for(var S=r.onRecoverableError,$=0;$<g.length;$++){var B=g[$];S(B.value,{componentStack:B.stack})}}finally{P.T=c,X.p=w}}(U1&3)!==0&&jy(),lr(r),w=r.pendingLanes,(f&4194090)!==0&&(w&42)!==0?r===vz?tf++:(tf=0,vz=r):tf=0,nf(0)}}function VX(r,c){(r.pooledCacheLanes&=c)===0&&(c=r.pooledCache,c!=null&&(r.pooledCache=null,P2(c)))}function jy(r){return OX(),qX(),HX(),BX()}function BX(){if(ao!==5)return!1;var r=Pi,c=mz;mz=0;var f=Hs(U1),g=P.T,w=X.p;try{X.p=32>f?32:f,P.T=null,f=gz,gz=null;var S=Pi,$=U1;if(ao=0,F1=Pi=null,U1=0,(Pt&6)!==0)throw Error(o(331));var B=Pt;if(Pt|=4,CX(S.current),MX(S,S.current,$,f),Pt=B,nf(0,!1),be&&typeof be.onPostCommitFiberRoot=="function")try{be.onPostCommitFiberRoot(fe,S)}catch{}return!0}finally{X.p=w,P.T=g,VX(r,c)}}function FX(r,c,f){c=sa(f,c),c=WD(r.stateNode,c,2),r=Si(r,c,2),r!==null&&(tr(r,2),lr(r))}function Ft(r,c,f){if(r.tag===3)FX(r,r,f);else for(;c!==null;){if(c.tag===3){FX(c,r,f);break}else if(c.tag===1){var g=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Ri===null||!Ri.has(g))){r=sa(f,r),f=ZG(2),g=Si(c,f,2),g!==null&&(YG(f,g,c,r),tr(g,2),lr(g));break}}c=c.return}}function bz(r,c,f){var g=r.pingCache;if(g===null){g=r.pingCache=new u1e;var w=new Set;g.set(c,w)}else w=g.get(c),w===void 0&&(w=new Set,g.set(c,w));w.has(f)||(hz=!0,w.add(f),r=y1e.bind(null,r,c,f),c.then(r,r))}function y1e(r,c,f){var g=r.pingCache;g!==null&&g.delete(c),r.pingedLanes|=r.suspendedLanes&f,r.warmLanes&=~f,Ut===r&&(Ct&f)===f&&(fn===4||fn===3&&(Ct&62914560)===Ct&&300>We()-yz?(Pt&2)===0&&G1(r,0):fz|=f,B1===Ct&&(B1=0)),lr(r)}function UX(r,c){c===0&&(c=Ja()),r=L1(r,c),r!==null&&(tr(r,c),lr(r))}function m1e(r){var c=r.memoizedState,f=0;c!==null&&(f=c.retryLane),UX(r,f)}function g1e(r,c){var f=0;switch(r.tag){case 13:var g=r.stateNode,w=r.memoizedState;w!==null&&(f=w.retryLane);break;case 19:g=r.stateNode;break;case 22:g=r.stateNode._retryCache;break;default:throw Error(o(314))}g!==null&&g.delete(c),UX(r,f)}function v1e(r,c){return Te(r,c)}var Ay=null,Z1=null,Mz=!1,Ey=!1,_z=!1,ac=0;function lr(r){r!==Z1&&r.next===null&&(Z1===null?Ay=Z1=r:Z1=Z1.next=r),Ey=!0,Mz||(Mz=!0,x1e())}function nf(r,c){if(!_z&&Ey){_z=!0;do for(var f=!1,g=Ay;g!==null;){if(r!==0){var w=g.pendingLanes;if(w===0)var S=0;else{var $=g.suspendedLanes,B=g.pingedLanes;S=(1<<31-He(42|r)+1)-1,S&=w&~($&~B),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(f=!0,YX(g,S))}else S=Ct,S=At(g,g===Ut?S:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(S&3)===0||Dt(g,S)||(f=!0,YX(g,S));g=g.next}while(f);_z=!1}}function k1e(){GX()}function GX(){Ey=Mz=!1;var r=0;ac!==0&&(L1e()&&(r=ac),ac=0);for(var c=We(),f=null,g=Ay;g!==null;){var w=g.next,S=XX(g,c);S===0?(g.next=null,f===null?Ay=w:f.next=w,w===null&&(Z1=f)):(f=g,(r!==0||(S&3)!==0)&&(Ey=!0)),g=w}nf(r)}function XX(r,c){for(var f=r.suspendedLanes,g=r.pingedLanes,w=r.expirationTimes,S=r.pendingLanes&-62914561;0<S;){var $=31-He(S),B=1<<$,J=w[$];J===-1?((B&f)===0||(B&g)!==0)&&(w[$]=En(B,c)):J<=c&&(r.expiredLanes|=B),S&=~B}if(c=Ut,f=Ct,f=At(r,r===c?f:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),g=r.callbackNode,f===0||r===c&&($t===2||$t===9)||r.cancelPendingCommit!==null)return g!==null&&g!==null&&qe(g),r.callbackNode=null,r.callbackPriority=0;if((f&3)===0||Dt(r,f)){if(c=f&-f,c===r.callbackPriority)return c;switch(g!==null&&qe(g),Hs(f)){case 2:case 8:f=eo;break;case 32:f=An;break;case 268435456:f=On;break;default:f=An}return g=ZX.bind(null,r),f=Te(f,g),r.callbackPriority=c,r.callbackNode=f,c}return g!==null&&g!==null&&qe(g),r.callbackPriority=2,r.callbackNode=null,2}function ZX(r,c){if(ao!==0&&ao!==5)return r.callbackNode=null,r.callbackPriority=0,null;var f=r.callbackNode;if(jy()&&r.callbackNode!==f)return null;var g=Ct;return g=At(r,r===Ut?g:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),g===0?null:(AX(r,g,c),XX(r,We()),r.callbackNode!=null&&r.callbackNode===f?ZX.bind(null,r):null)}function YX(r,c){if(jy())return null;AX(r,c,!0)}function x1e(){A1e(function(){(Pt&6)!==0?Te(Rt,k1e):GX()})}function Sz(){return ac===0&&(ac=Qa()),ac}function WX(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Vp(""+r)}function KX(r,c){var f=c.ownerDocument.createElement("input");return f.name=c.name,f.value=c.value,r.id&&f.setAttribute("form",r.id),c.parentNode.insertBefore(f,c),r=new FormData(r),f.parentNode.removeChild(f),r}function w1e(r,c,f,g,w){if(c==="submit"&&f&&f.stateNode===w){var S=WX((w[Ce]||null).action),$=g.submitter;$&&(c=(c=$[Ce]||null)?WX(c.formAction):$.getAttribute("formAction"),c!==null&&(S=c,$=null));var B=new Gp("action","action",null,g,w);r.push({event:B,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(ac!==0){var J=$?KX(w,$):new FormData(w);UD(f,{pending:!0,data:J,method:w.method,action:S},null,J)}}else typeof S=="function"&&(B.preventDefault(),J=$?KX(w,$):new FormData(w),UD(f,{pending:!0,data:J,method:w.method,action:S},S,J))},currentTarget:w}]})}}for(var Cz=0;Cz<uD.length;Cz++){var Nz=uD[Cz],b1e=Nz.toLowerCase(),M1e=Nz[0].toUpperCase()+Nz.slice(1);Aa(b1e,"on"+M1e)}Aa(AU,"onAnimationEnd"),Aa(EU,"onAnimationIteration"),Aa(IU,"onAnimationStart"),Aa("dblclick","onDoubleClick"),Aa("focusin","onFocus"),Aa("focusout","onBlur"),Aa(qde,"onTransitionRun"),Aa(Hde,"onTransitionStart"),Aa(Vde,"onTransitionCancel"),Aa(TU,"onTransitionEnd"),bo("onMouseEnter",["mouseout","mouseover"]),bo("onMouseLeave",["mouseout","mouseover"]),bo("onPointerEnter",["pointerout","pointerover"]),bo("onPointerLeave",["pointerout","pointerover"]),to("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),to("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),to("onBeforeInput",["compositionend","keypress","textInput","paste"]),to("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),to("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),to("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var of="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),_1e=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(of));function QX(r,c){c=(c&4)!==0;for(var f=0;f<r.length;f++){var g=r[f],w=g.event;g=g.listeners;e:{var S=void 0;if(c)for(var $=g.length-1;0<=$;$--){var B=g[$],J=B.instance,se=B.currentTarget;if(B=B.listener,J!==S&&w.isPropagationStopped())break e;S=B,w.currentTarget=se;try{S(w)}catch(ye){vy(ye)}w.currentTarget=null,S=J}else for($=0;$<g.length;$++){if(B=g[$],J=B.instance,se=B.currentTarget,B=B.listener,J!==S&&w.isPropagationStopped())break e;S=B,w.currentTarget=se;try{S(w)}catch(ye){vy(ye)}w.currentTarget=null,S=J}}}}function bt(r,c){var f=c[Ke];f===void 0&&(f=c[Ke]=new Set);var g=r+"__bubble";f.has(g)||(JX(c,r,2,!1),f.add(g))}function Lz(r,c,f){var g=0;c&&(g|=4),JX(f,r,g,c)}var Iy="_reactListening"+Math.random().toString(36).slice(2);function jz(r){if(!r[Iy]){r[Iy]=!0,xt.forEach(function(f){f!=="selectionchange"&&(_1e.has(f)||Lz(f,!1,r),Lz(f,!0,r))});var c=r.nodeType===9?r:r.ownerDocument;c===null||c[Iy]||(c[Iy]=!0,Lz("selectionchange",!1,c))}}function JX(r,c,f,g){switch(MZ(c)){case 2:var w=K1e;break;case 8:w=Q1e;break;default:w=Bz}f=w.bind(null,c,f,r),w=void 0,!K$||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(w=!0),g?w!==void 0?r.addEventListener(c,f,{capture:!0,passive:w}):r.addEventListener(c,f,!0):w!==void 0?r.addEventListener(c,f,{passive:w}):r.addEventListener(c,f,!1)}function Az(r,c,f,g,w){var S=g;if((c&1)===0&&(c&2)===0&&g!==null)e:for(;;){if(g===null)return;var $=g.tag;if($===3||$===4){var B=g.stateNode.containerInfo;if(B===w)break;if($===4)for($=g.return;$!==null;){var J=$.tag;if((J===3||J===4)&&$.stateNode.containerInfo===w)return;$=$.return}for(;B!==null;){if($=tt(B),$===null)return;if(J=$.tag,J===5||J===6||J===26||J===27){g=S=$;continue e}B=B.parentNode}}g=g.return}iU(function(){var se=S,ye=Y$(f),we=[];e:{var ue=RU.get(r);if(ue!==void 0){var he=Gp,at=r;switch(r){case"keypress":if(Fp(f)===0)break e;case"keydown":case"keyup":he=vde;break;case"focusin":at="focus",he=tD;break;case"focusout":at="blur",he=tD;break;case"beforeblur":case"afterblur":he=tD;break;case"click":if(f.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":he=lU;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=ide;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=wde;break;case AU:case EU:case IU:he=lde;break;case TU:he=Mde;break;case"scroll":case"scrollend":he=ade;break;case"wheel":he=Sde;break;case"copy":case"cut":case"paste":he=dde;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=dU;break;case"toggle":case"beforetoggle":he=Nde}var Je=(c&4)!==0,Ht=!Je&&(r==="scroll"||r==="scrollend"),ae=Je?ue!==null?ue+"Capture":null:ue;Je=[];for(var oe=se,ie;oe!==null;){var ve=oe;if(ie=ve.stateNode,ve=ve.tag,ve!==5&&ve!==26&&ve!==27||ie===null||ae===null||(ve=b2(oe,ae),ve!=null&&Je.push(af(oe,ve,ie))),Ht)break;oe=oe.return}0<Je.length&&(ue=new he(ue,at,null,f,ye),we.push({event:ue,listeners:Je}))}}if((c&7)===0){e:{if(ue=r==="mouseover"||r==="pointerover",he=r==="mouseout"||r==="pointerout",ue&&f!==Z$&&(at=f.relatedTarget||f.fromElement)&&(tt(at)||at[Pe]))break e;if((he||ue)&&(ue=ye.window===ye?ye:(ue=ye.ownerDocument)?ue.defaultView||ue.parentWindow:window,he?(at=f.relatedTarget||f.toElement,he=se,at=at?tt(at):null,at!==null&&(Ht=i(at),Je=at.tag,at!==Ht||Je!==5&&Je!==27&&Je!==6)&&(at=null)):(he=null,at=se),he!==at)){if(Je=lU,ve="onMouseLeave",ae="onMouseEnter",oe="mouse",(r==="pointerout"||r==="pointerover")&&(Je=dU,ve="onPointerLeave",ae="onPointerEnter",oe="pointer"),Ht=he==null?ue:Bt(he),ie=at==null?ue:Bt(at),ue=new Je(ve,oe+"leave",he,f,ye),ue.target=Ht,ue.relatedTarget=ie,ve=null,tt(ye)===se&&(Je=new Je(ae,oe+"enter",at,f,ye),Je.target=ie,Je.relatedTarget=Ht,ve=Je),Ht=ve,he&&at)t:{for(Je=he,ae=at,oe=0,ie=Je;ie;ie=Y1(ie))oe++;for(ie=0,ve=ae;ve;ve=Y1(ve))ie++;for(;0<oe-ie;)Je=Y1(Je),oe--;for(;0<ie-oe;)ae=Y1(ae),ie--;for(;oe--;){if(Je===ae||ae!==null&&Je===ae.alternate)break t;Je=Y1(Je),ae=Y1(ae)}Je=null}else Je=null;he!==null&&eZ(we,ue,he,Je,!1),at!==null&&Ht!==null&&eZ(we,Ht,at,Je,!0)}}e:{if(ue=se?Bt(se):window,he=ue.nodeName&&ue.nodeName.toLowerCase(),he==="select"||he==="input"&&ue.type==="file")var $e=kU;else if(gU(ue))if(xU)$e=Dde;else{$e=Pde;var mt=Rde}else he=ue.nodeName,!he||he.toLowerCase()!=="input"||ue.type!=="checkbox"&&ue.type!=="radio"?se&&X$(se.elementType)&&($e=kU):$e=$de;if($e&&($e=$e(r,se))){vU(we,$e,f,ye);break e}mt&&mt(r,ue,se),r==="focusout"&&se&&ue.type==="number"&&se.memoizedProps.value!=null&&G$(ue,"number",ue.value)}switch(mt=se?Bt(se):window,r){case"focusin":(gU(mt)||mt.contentEditable==="true")&&(S1=mt,sD=se,A2=null);break;case"focusout":A2=sD=S1=null;break;case"mousedown":cD=!0;break;case"contextmenu":case"mouseup":case"dragend":cD=!1,LU(we,f,ye);break;case"selectionchange":if(Ode)break;case"keydown":case"keyup":LU(we,f,ye)}var Ge;if(oD)e:{switch(r){case"compositionstart":var nt="onCompositionStart";break e;case"compositionend":nt="onCompositionEnd";break e;case"compositionupdate":nt="onCompositionUpdate";break e}nt=void 0}else _1?yU(r,f)&&(nt="onCompositionEnd"):r==="keydown"&&f.keyCode===229&&(nt="onCompositionStart");nt&&(hU&&f.locale!=="ko"&&(_1||nt!=="onCompositionStart"?nt==="onCompositionEnd"&&_1&&(Ge=sU()):(wi=ye,Q$="value"in wi?wi.value:wi.textContent,_1=!0)),mt=Ty(se,nt),0<mt.length&&(nt=new uU(nt,r,null,f,ye),we.push({event:nt,listeners:mt}),Ge?nt.data=Ge:(Ge=mU(f),Ge!==null&&(nt.data=Ge)))),(Ge=jde?Ade(r,f):Ede(r,f))&&(nt=Ty(se,"onBeforeInput"),0<nt.length&&(mt=new uU("onBeforeInput","beforeinput",null,f,ye),we.push({event:mt,listeners:nt}),mt.data=Ge)),w1e(we,r,se,f,ye)}QX(we,c)})}function af(r,c,f){return{instance:r,listener:c,currentTarget:f}}function Ty(r,c){for(var f=c+"Capture",g=[];r!==null;){var w=r,S=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||S===null||(w=b2(r,f),w!=null&&g.unshift(af(r,w,S)),w=b2(r,c),w!=null&&g.push(af(r,w,S))),r.tag===3)return g;r=r.return}return[]}function Y1(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function eZ(r,c,f,g,w){for(var S=c._reactName,$=[];f!==null&&f!==g;){var B=f,J=B.alternate,se=B.stateNode;if(B=B.tag,J!==null&&J===g)break;B!==5&&B!==26&&B!==27||se===null||(J=se,w?(se=b2(f,S),se!=null&&$.unshift(af(f,se,J))):w||(se=b2(f,S),se!=null&&$.push(af(f,se,J)))),f=f.return}$.length!==0&&r.push({event:c,listeners:$})}var S1e=/\r\n?/g,C1e=/\u0000|\uFFFD/g;function tZ(r){return(typeof r=="string"?r:""+r).replace(S1e,`
49
49
  `).replace(C1e,"")}function nZ(r,c){return c=tZ(c),tZ(r)===c}function Ry(){}function qt(r,c,f,g,w,S){switch(f){case"children":typeof g=="string"?c==="body"||c==="textarea"&&g===""||w1(r,g):(typeof g=="number"||typeof g=="bigint")&&c!=="body"&&w1(r,""+g);break;case"className":ja(r,"class",g);break;case"tabIndex":ja(r,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":ja(r,f,g);break;case"style":aU(r,g,S);break;case"data":if(c!=="object"){ja(r,"data",g);break}case"src":case"href":if(g===""&&(c!=="a"||f!=="href")){r.removeAttribute(f);break}if(g==null||typeof g=="function"||typeof g=="symbol"||typeof g=="boolean"){r.removeAttribute(f);break}g=Vp(""+g),r.setAttribute(f,g);break;case"action":case"formAction":if(typeof g=="function"){r.setAttribute(f,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof S=="function"&&(f==="formAction"?(c!=="input"&&qt(r,c,"name",w.name,w,null),qt(r,c,"formEncType",w.formEncType,w,null),qt(r,c,"formMethod",w.formMethod,w,null),qt(r,c,"formTarget",w.formTarget,w,null)):(qt(r,c,"encType",w.encType,w,null),qt(r,c,"method",w.method,w,null),qt(r,c,"target",w.target,w,null)));if(g==null||typeof g=="symbol"||typeof g=="boolean"){r.removeAttribute(f);break}g=Vp(""+g),r.setAttribute(f,g);break;case"onClick":g!=null&&(r.onclick=Ry);break;case"onScroll":g!=null&&bt("scroll",r);break;case"onScrollEnd":g!=null&&bt("scrollend",r);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(o(61));if(f=g.__html,f!=null){if(w.children!=null)throw Error(o(60));r.innerHTML=f}}break;case"multiple":r.multiple=g&&typeof g!="function"&&typeof g!="symbol";break;case"muted":r.muted=g&&typeof g!="function"&&typeof g!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(g==null||typeof g=="function"||typeof g=="boolean"||typeof g=="symbol"){r.removeAttribute("xlink:href");break}f=Vp(""+g),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":g!=null&&typeof g!="function"&&typeof g!="symbol"?r.setAttribute(f,""+g):r.removeAttribute(f);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":g&&typeof g!="function"&&typeof g!="symbol"?r.setAttribute(f,""):r.removeAttribute(f);break;case"capture":case"download":g===!0?r.setAttribute(f,""):g!==!1&&g!=null&&typeof g!="function"&&typeof g!="symbol"?r.setAttribute(f,g):r.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":g!=null&&typeof g!="function"&&typeof g!="symbol"&&!isNaN(g)&&1<=g?r.setAttribute(f,g):r.removeAttribute(f);break;case"rowSpan":case"start":g==null||typeof g=="function"||typeof g=="symbol"||isNaN(g)?r.removeAttribute(f):r.setAttribute(f,g);break;case"popover":bt("beforetoggle",r),bt("toggle",r),Mo(r,"popover",g);break;case"xlinkActuate":dt(r,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":dt(r,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":dt(r,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":dt(r,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":dt(r,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":dt(r,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":dt(r,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":dt(r,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":dt(r,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":Mo(r,"is",g);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=nde.get(f)||f,Mo(r,f,g))}}function Ez(r,c,f,g,w,S){switch(f){case"style":aU(r,g,S);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(o(61));if(f=g.__html,f!=null){if(w.children!=null)throw Error(o(60));r.innerHTML=f}}break;case"children":typeof g=="string"?w1(r,g):(typeof g=="number"||typeof g=="bigint")&&w1(r,""+g);break;case"onScroll":g!=null&&bt("scroll",r);break;case"onScrollEnd":g!=null&&bt("scrollend",r);break;case"onClick":g!=null&&(r.onclick=Ry);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!nr.hasOwnProperty(f))e:{if(f[0]==="o"&&f[1]==="n"&&(w=f.endsWith("Capture"),c=f.slice(2,w?f.length-7:void 0),S=r[Ce]||null,S=S!=null?S[f]:null,typeof S=="function"&&r.removeEventListener(c,S,w),typeof g=="function")){typeof S!="function"&&S!==null&&(f in r?r[f]=null:r.hasAttribute(f)&&r.removeAttribute(f)),r.addEventListener(c,g,w);break e}f in r?r[f]=g:g===!0?r.setAttribute(f,""):Mo(r,f,g)}}}function ro(r,c,f){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":bt("error",r),bt("load",r);var g=!1,w=!1,S;for(S in f)if(f.hasOwnProperty(S)){var $=f[S];if($!=null)switch(S){case"src":g=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,c));default:qt(r,c,S,$,f,null)}}w&&qt(r,c,"srcSet",f.srcSet,f,null),g&&qt(r,c,"src",f.src,f,null);return;case"input":bt("invalid",r);var B=S=$=w=null,J=null,se=null;for(g in f)if(f.hasOwnProperty(g)){var ye=f[g];if(ye!=null)switch(g){case"name":w=ye;break;case"type":$=ye;break;case"checked":J=ye;break;case"defaultChecked":se=ye;break;case"value":S=ye;break;case"defaultValue":B=ye;break;case"children":case"dangerouslySetInnerHTML":if(ye!=null)throw Error(o(137,c));break;default:qt(r,c,g,ye,f,null)}}eU(r,S,B,J,se,$,w,!1),qp(r);return;case"select":bt("invalid",r),g=$=S=null;for(w in f)if(f.hasOwnProperty(w)&&(B=f[w],B!=null))switch(w){case"value":S=B;break;case"defaultValue":$=B;break;case"multiple":g=B;default:qt(r,c,w,B,f,null)}c=S,f=$,r.multiple=!!g,c!=null?x1(r,!!g,c,!1):f!=null&&x1(r,!!g,f,!0);return;case"textarea":bt("invalid",r),S=w=g=null;for($ in f)if(f.hasOwnProperty($)&&(B=f[$],B!=null))switch($){case"value":g=B;break;case"defaultValue":w=B;break;case"children":S=B;break;case"dangerouslySetInnerHTML":if(B!=null)throw Error(o(91));break;default:qt(r,c,$,B,f,null)}nU(r,g,w,S),qp(r);return;case"option":for(J in f)if(f.hasOwnProperty(J)&&(g=f[J],g!=null))switch(J){case"selected":r.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:qt(r,c,J,g,f,null)}return;case"dialog":bt("beforetoggle",r),bt("toggle",r),bt("cancel",r),bt("close",r);break;case"iframe":case"object":bt("load",r);break;case"video":case"audio":for(g=0;g<of.length;g++)bt(of[g],r);break;case"image":bt("error",r),bt("load",r);break;case"details":bt("toggle",r);break;case"embed":case"source":case"link":bt("error",r),bt("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(se in f)if(f.hasOwnProperty(se)&&(g=f[se],g!=null))switch(se){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,c));default:qt(r,c,se,g,f,null)}return;default:if(X$(c)){for(ye in f)f.hasOwnProperty(ye)&&(g=f[ye],g!==void 0&&Ez(r,c,ye,g,f,void 0));return}}for(B in f)f.hasOwnProperty(B)&&(g=f[B],g!=null&&qt(r,c,B,g,f,null))}function N1e(r,c,f,g){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var w=null,S=null,$=null,B=null,J=null,se=null,ye=null;for(he in f){var we=f[he];if(f.hasOwnProperty(he)&&we!=null)switch(he){case"checked":break;case"value":break;case"defaultValue":J=we;default:g.hasOwnProperty(he)||qt(r,c,he,null,g,we)}}for(var ue in g){var he=g[ue];if(we=f[ue],g.hasOwnProperty(ue)&&(he!=null||we!=null))switch(ue){case"type":S=he;break;case"name":w=he;break;case"checked":se=he;break;case"defaultChecked":ye=he;break;case"value":$=he;break;case"defaultValue":B=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(o(137,c));break;default:he!==we&&qt(r,c,ue,he,g,we)}}U$(r,$,B,J,se,ye,S,w);return;case"select":he=$=B=ue=null;for(S in f)if(J=f[S],f.hasOwnProperty(S)&&J!=null)switch(S){case"value":break;case"multiple":he=J;default:g.hasOwnProperty(S)||qt(r,c,S,null,g,J)}for(w in g)if(S=g[w],J=f[w],g.hasOwnProperty(w)&&(S!=null||J!=null))switch(w){case"value":ue=S;break;case"defaultValue":B=S;break;case"multiple":$=S;default:S!==J&&qt(r,c,w,S,g,J)}c=B,f=$,g=he,ue!=null?x1(r,!!f,ue,!1):!!g!=!!f&&(c!=null?x1(r,!!f,c,!0):x1(r,!!f,f?[]:"",!1));return;case"textarea":he=ue=null;for(B in f)if(w=f[B],f.hasOwnProperty(B)&&w!=null&&!g.hasOwnProperty(B))switch(B){case"value":break;case"children":break;default:qt(r,c,B,null,g,w)}for($ in g)if(w=g[$],S=f[$],g.hasOwnProperty($)&&(w!=null||S!=null))switch($){case"value":ue=w;break;case"defaultValue":he=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(o(91));break;default:w!==S&&qt(r,c,$,w,g,S)}tU(r,ue,he);return;case"option":for(var at in f)if(ue=f[at],f.hasOwnProperty(at)&&ue!=null&&!g.hasOwnProperty(at))switch(at){case"selected":r.selected=!1;break;default:qt(r,c,at,null,g,ue)}for(J in g)if(ue=g[J],he=f[J],g.hasOwnProperty(J)&&ue!==he&&(ue!=null||he!=null))switch(J){case"selected":r.selected=ue&&typeof ue!="function"&&typeof ue!="symbol";break;default:qt(r,c,J,ue,g,he)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Je in f)ue=f[Je],f.hasOwnProperty(Je)&&ue!=null&&!g.hasOwnProperty(Je)&&qt(r,c,Je,null,g,ue);for(se in g)if(ue=g[se],he=f[se],g.hasOwnProperty(se)&&ue!==he&&(ue!=null||he!=null))switch(se){case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(o(137,c));break;default:qt(r,c,se,ue,g,he)}return;default:if(X$(c)){for(var Ht in f)ue=f[Ht],f.hasOwnProperty(Ht)&&ue!==void 0&&!g.hasOwnProperty(Ht)&&Ez(r,c,Ht,void 0,g,ue);for(ye in g)ue=g[ye],he=f[ye],!g.hasOwnProperty(ye)||ue===he||ue===void 0&&he===void 0||Ez(r,c,ye,ue,g,he);return}}for(var ae in f)ue=f[ae],f.hasOwnProperty(ae)&&ue!=null&&!g.hasOwnProperty(ae)&&qt(r,c,ae,null,g,ue);for(we in g)ue=g[we],he=f[we],!g.hasOwnProperty(we)||ue===he||ue==null&&he==null||qt(r,c,we,ue,g,he)}var Iz=null,Tz=null;function Py(r){return r.nodeType===9?r:r.ownerDocument}function oZ(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function aZ(r,c){if(r===0)switch(c){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&c==="foreignObject"?0:r}function Rz(r,c){return r==="textarea"||r==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.children=="bigint"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var Pz=null;function L1e(){var r=window.event;return r&&r.type==="popstate"?r===Pz?!1:(Pz=r,!0):(Pz=null,!1)}var rZ=typeof setTimeout=="function"?setTimeout:void 0,j1e=typeof clearTimeout=="function"?clearTimeout:void 0,iZ=typeof Promise=="function"?Promise:void 0,A1e=typeof queueMicrotask=="function"?queueMicrotask:typeof iZ<"u"?function(r){return iZ.resolve(null).then(r).catch(E1e)}:rZ;function E1e(r){setTimeout(function(){throw r})}function Di(r){return r==="head"}function sZ(r,c){var f=c,g=0,w=0;do{var S=f.nextSibling;if(r.removeChild(f),S&&S.nodeType===8)if(f=S.data,f==="/$"){if(0<g&&8>g){f=g;var $=r.ownerDocument;if(f&1&&rf($.documentElement),f&2&&rf($.body),f&4)for(f=$.head,rf(f),$=f.firstChild;$;){var B=$.nextSibling,J=$.nodeName;$[Qe]||J==="SCRIPT"||J==="STYLE"||J==="LINK"&&$.rel.toLowerCase()==="stylesheet"||f.removeChild($),$=B}}if(w===0){r.removeChild(S),pf(c);return}w--}else f==="$"||f==="$?"||f==="$!"?w++:g=f.charCodeAt(0)-48;else g=0;f=S}while(f);pf(c)}function $z(r){var c=r.firstChild;for(c&&c.nodeType===10&&(c=c.nextSibling);c;){var f=c;switch(c=c.nextSibling,f.nodeName){case"HTML":case"HEAD":case"BODY":$z(f),Ve(f);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(f.rel.toLowerCase()==="stylesheet")continue}r.removeChild(f)}}function I1e(r,c,f,g){for(;r.nodeType===1;){var w=f;if(r.nodeName.toLowerCase()!==c.toLowerCase()){if(!g&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(g){if(!r[Qe])switch(c){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(S=r.getAttribute("rel"),S==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(S!==w.rel||r.getAttribute("href")!==(w.href==null||w.href===""?null:w.href)||r.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin)||r.getAttribute("title")!==(w.title==null?null:w.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(S=r.getAttribute("src"),(S!==(w.src==null?null:w.src)||r.getAttribute("type")!==(w.type==null?null:w.type)||r.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin))&&S&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(c==="input"&&r.type==="hidden"){var S=w.name==null?null:""+w.name;if(w.type==="hidden"&&r.getAttribute("name")===S)return r}else return r;if(r=Ia(r.nextSibling),r===null)break}return null}function T1e(r,c,f){if(c==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!f||(r=Ia(r.nextSibling),r===null))return null;return r}function Dz(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState==="complete"}function R1e(r,c){var f=r.ownerDocument;if(r.data!=="$?"||f.readyState==="complete")c();else{var g=function(){c(),f.removeEventListener("DOMContentLoaded",g)};f.addEventListener("DOMContentLoaded",g),r._reactRetry=g}}function Ia(r){for(;r!=null;r=r.nextSibling){var c=r.nodeType;if(c===1||c===3)break;if(c===8){if(c=r.data,c==="$"||c==="$!"||c==="$?"||c==="F!"||c==="F")break;if(c==="/$")return null}}return r}var zz=null;function cZ(r){r=r.previousSibling;for(var c=0;r;){if(r.nodeType===8){var f=r.data;if(f==="$"||f==="$!"||f==="$?"){if(c===0)return r;c--}else f==="/$"&&c++}r=r.previousSibling}return null}function lZ(r,c,f){switch(c=Py(f),r){case"html":if(r=c.documentElement,!r)throw Error(o(452));return r;case"head":if(r=c.head,!r)throw Error(o(453));return r;case"body":if(r=c.body,!r)throw Error(o(454));return r;default:throw Error(o(451))}}function rf(r){for(var c=r.attributes;c.length;)r.removeAttributeNode(c[0]);Ve(r)}var fa=new Map,uZ=new Set;function $y(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Kr=X.d;X.d={f:P1e,r:$1e,D:D1e,C:z1e,L:O1e,m:q1e,X:V1e,S:H1e,M:B1e};function P1e(){var r=Kr.f(),c=Ny();return r||c}function $1e(r){var c=Mt(r);c!==null&&c.tag===5&&c.type==="form"?AG(c):Kr.r(r)}var W1=typeof document>"u"?null:document;function dZ(r,c,f){var g=W1;if(g&&typeof c=="string"&&c){var w=ia(c);w='link[rel="'+r+'"][href="'+w+'"]',typeof f=="string"&&(w+='[crossorigin="'+f+'"]'),uZ.has(w)||(uZ.add(w),r={rel:r,crossOrigin:f,href:c},g.querySelector(w)===null&&(c=g.createElement("link"),ro(c,"link",r),St(c),g.head.appendChild(c)))}}function D1e(r){Kr.D(r),dZ("dns-prefetch",r,null)}function z1e(r,c){Kr.C(r,c),dZ("preconnect",r,c)}function O1e(r,c,f){Kr.L(r,c,f);var g=W1;if(g&&r&&c){var w='link[rel="preload"][as="'+ia(c)+'"]';c==="image"&&f&&f.imageSrcSet?(w+='[imagesrcset="'+ia(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(w+='[imagesizes="'+ia(f.imageSizes)+'"]')):w+='[href="'+ia(r)+'"]';var S=w;switch(c){case"style":S=K1(r);break;case"script":S=Q1(r)}fa.has(S)||(r=p({rel:"preload",href:c==="image"&&f&&f.imageSrcSet?void 0:r,as:c},f),fa.set(S,r),g.querySelector(w)!==null||c==="style"&&g.querySelector(sf(S))||c==="script"&&g.querySelector(cf(S))||(c=g.createElement("link"),ro(c,"link",r),St(c),g.head.appendChild(c)))}}function q1e(r,c){Kr.m(r,c);var f=W1;if(f&&r){var g=c&&typeof c.as=="string"?c.as:"script",w='link[rel="modulepreload"][as="'+ia(g)+'"][href="'+ia(r)+'"]',S=w;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=Q1(r)}if(!fa.has(S)&&(r=p({rel:"modulepreload",href:r},c),fa.set(S,r),f.querySelector(w)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(cf(S)))return}g=f.createElement("link"),ro(g,"link",r),St(g),f.head.appendChild(g)}}}function H1e(r,c,f){Kr.S(r,c,f);var g=W1;if(g&&r){var w=Qt(g).hoistableStyles,S=K1(r);c=c||"default";var $=w.get(S);if(!$){var B={loading:0,preload:null};if($=g.querySelector(sf(S)))B.loading=5;else{r=p({rel:"stylesheet",href:r,"data-precedence":c},f),(f=fa.get(S))&&Oz(r,f);var J=$=g.createElement("link");St(J),ro(J,"link",r),J._p=new Promise(function(se,ye){J.onload=se,J.onerror=ye}),J.addEventListener("load",function(){B.loading|=1}),J.addEventListener("error",function(){B.loading|=2}),B.loading|=4,Dy($,c,g)}$={type:"stylesheet",instance:$,count:1,state:B},w.set(S,$)}}}function V1e(r,c){Kr.X(r,c);var f=W1;if(f&&r){var g=Qt(f).hoistableScripts,w=Q1(r),S=g.get(w);S||(S=f.querySelector(cf(w)),S||(r=p({src:r,async:!0},c),(c=fa.get(w))&&qz(r,c),S=f.createElement("script"),St(S),ro(S,"link",r),f.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},g.set(w,S))}}function B1e(r,c){Kr.M(r,c);var f=W1;if(f&&r){var g=Qt(f).hoistableScripts,w=Q1(r),S=g.get(w);S||(S=f.querySelector(cf(w)),S||(r=p({src:r,async:!0,type:"module"},c),(c=fa.get(w))&&qz(r,c),S=f.createElement("script"),St(S),ro(S,"link",r),f.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},g.set(w,S))}}function hZ(r,c,f,g){var w=(w=ne.current)?$y(w):null;if(!w)throw Error(o(446));switch(r){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(c=K1(f.href),f=Qt(w).hoistableStyles,g=f.get(c),g||(g={type:"style",instance:null,count:0,state:null},f.set(c,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){r=K1(f.href);var S=Qt(w).hoistableStyles,$=S.get(r);if($||(w=w.ownerDocument||w,$={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},S.set(r,$),(S=w.querySelector(sf(r)))&&!S._p&&($.instance=S,$.state.loading=5),fa.has(r)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},fa.set(r,f),S||F1e(w,r,f,$.state))),c&&g===null)throw Error(o(528,""));return $}if(c&&g!==null)throw Error(o(529,""));return null;case"script":return c=f.async,f=f.src,typeof f=="string"&&c&&typeof c!="function"&&typeof c!="symbol"?(c=Q1(f),f=Qt(w).hoistableScripts,g=f.get(c),g||(g={type:"script",instance:null,count:0,state:null},f.set(c,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,r))}}function K1(r){return'href="'+ia(r)+'"'}function sf(r){return'link[rel="stylesheet"]['+r+"]"}function fZ(r){return p({},r,{"data-precedence":r.precedence,precedence:null})}function F1e(r,c,f,g){r.querySelector('link[rel="preload"][as="style"]['+c+"]")?g.loading=1:(c=r.createElement("link"),g.preload=c,c.addEventListener("load",function(){return g.loading|=1}),c.addEventListener("error",function(){return g.loading|=2}),ro(c,"link",f),St(c),r.head.appendChild(c))}function Q1(r){return'[src="'+ia(r)+'"]'}function cf(r){return"script[async]"+r}function pZ(r,c,f){if(c.count++,c.instance===null)switch(c.type){case"style":var g=r.querySelector('style[data-href~="'+ia(f.href)+'"]');if(g)return c.instance=g,St(g),g;var w=p({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return g=(r.ownerDocument||r).createElement("style"),St(g),ro(g,"style",w),Dy(g,f.precedence,r),c.instance=g;case"stylesheet":w=K1(f.href);var S=r.querySelector(sf(w));if(S)return c.state.loading|=4,c.instance=S,St(S),S;g=fZ(f),(w=fa.get(w))&&Oz(g,w),S=(r.ownerDocument||r).createElement("link"),St(S);var $=S;return $._p=new Promise(function(B,J){$.onload=B,$.onerror=J}),ro(S,"link",g),c.state.loading|=4,Dy(S,f.precedence,r),c.instance=S;case"script":return S=Q1(f.src),(w=r.querySelector(cf(S)))?(c.instance=w,St(w),w):(g=f,(w=fa.get(S))&&(g=p({},f),qz(g,w)),r=r.ownerDocument||r,w=r.createElement("script"),St(w),ro(w,"link",g),r.head.appendChild(w),c.instance=w);case"void":return null;default:throw Error(o(443,c.type))}else c.type==="stylesheet"&&(c.state.loading&4)===0&&(g=c.instance,c.state.loading|=4,Dy(g,f.precedence,r));return c.instance}function Dy(r,c,f){for(var g=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=g.length?g[g.length-1]:null,S=w,$=0;$<g.length;$++){var B=g[$];if(B.dataset.precedence===c)S=B;else if(S!==w)break}S?S.parentNode.insertBefore(r,S.nextSibling):(c=f.nodeType===9?f.head:f,c.insertBefore(r,c.firstChild))}function Oz(r,c){r.crossOrigin==null&&(r.crossOrigin=c.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=c.referrerPolicy),r.title==null&&(r.title=c.title)}function qz(r,c){r.crossOrigin==null&&(r.crossOrigin=c.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=c.referrerPolicy),r.integrity==null&&(r.integrity=c.integrity)}var zy=null;function yZ(r,c,f){if(zy===null){var g=new Map,w=zy=new Map;w.set(f,g)}else w=zy,g=w.get(f),g||(g=new Map,w.set(f,g));if(g.has(r))return g;for(g.set(r,null),f=f.getElementsByTagName(r),w=0;w<f.length;w++){var S=f[w];if(!(S[Qe]||S[xe]||r==="link"&&S.getAttribute("rel")==="stylesheet")&&S.namespaceURI!=="http://www.w3.org/2000/svg"){var $=S.getAttribute(c)||"";$=r+$;var B=g.get($);B?B.push(S):g.set($,[S])}}return g}function mZ(r,c,f){r=r.ownerDocument||r,r.head.insertBefore(f,c==="title"?r.querySelector("head > title"):null)}function U1e(r,c,f){if(f===1||c.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof c.precedence!="string"||typeof c.href!="string"||c.href==="")break;return!0;case"link":if(typeof c.rel!="string"||typeof c.href!="string"||c.href===""||c.onLoad||c.onError)break;switch(c.rel){case"stylesheet":return r=c.disabled,typeof c.precedence=="string"&&r==null;default:return!0}case"script":if(c.async&&typeof c.async!="function"&&typeof c.async!="symbol"&&!c.onLoad&&!c.onError&&c.src&&typeof c.src=="string")return!0}return!1}function gZ(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}var lf=null;function G1e(){}function X1e(r,c,f){if(lf===null)throw Error(o(475));var g=lf;if(c.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var w=K1(f.href),S=r.querySelector(sf(w));if(S){r=S._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(g.count++,g=Oy.bind(g),r.then(g,g)),c.state.loading|=4,c.instance=S,St(S);return}S=r.ownerDocument||r,f=fZ(f),(w=fa.get(w))&&Oz(f,w),S=S.createElement("link"),St(S);var $=S;$._p=new Promise(function(B,J){$.onload=B,$.onerror=J}),ro(S,"link",f),c.instance=S}g.stylesheets===null&&(g.stylesheets=new Map),g.stylesheets.set(c,r),(r=c.state.preload)&&(c.state.loading&3)===0&&(g.count++,c=Oy.bind(g),r.addEventListener("load",c),r.addEventListener("error",c))}}function Z1e(){if(lf===null)throw Error(o(475));var r=lf;return r.stylesheets&&r.count===0&&Hz(r,r.stylesheets),0<r.count?function(c){var f=setTimeout(function(){if(r.stylesheets&&Hz(r,r.stylesheets),r.unsuspend){var g=r.unsuspend;r.unsuspend=null,g()}},6e4);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(f)}}:null}function Oy(){if(this.count--,this.count===0){if(this.stylesheets)Hz(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var qy=null;function Hz(r,c){r.stylesheets=null,r.unsuspend!==null&&(r.count++,qy=new Map,c.forEach(Y1e,r),qy=null,Oy.call(r))}function Y1e(r,c){if(!(c.state.loading&4)){var f=qy.get(r);if(f)var g=f.get(null);else{f=new Map,qy.set(r,f);for(var w=r.querySelectorAll("link[data-precedence],style[data-precedence]"),S=0;S<w.length;S++){var $=w[S];($.nodeName==="LINK"||$.getAttribute("media")!=="not all")&&(f.set($.dataset.precedence,$),g=$)}g&&f.set(null,g)}w=c.instance,$=w.getAttribute("data-precedence"),S=f.get($)||g,S===g&&f.set(null,w),f.set($,w),this.count++,g=Oy.bind(this),w.addEventListener("load",g),w.addEventListener("error",g),S?S.parentNode.insertBefore(w,S.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(w,r.firstChild)),c.state.loading|=4}}var uf={$$typeof:A,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function W1e(r,c,f,g,w,S,$,B){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=er(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=er(0),this.hiddenUpdates=er(null),this.identifierPrefix=g,this.onUncaughtError=w,this.onCaughtError=S,this.onRecoverableError=$,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=B,this.incompleteTransitions=new Map}function vZ(r,c,f,g,w,S,$,B,J,se,ye,we){return r=new W1e(r,c,f,$,B,J,se,we),c=1,S===!0&&(c|=24),S=qo(3,null,null,c),r.current=S,S.stateNode=r,c=bD(),c.refCount++,r.pooledCache=c,c.refCount++,S.memoizedState={element:g,isDehydrated:f,cache:c},CD(S),r}function kZ(r){return r?(r=j1,r):j1}function xZ(r,c,f,g,w,S){w=kZ(w),g.context===null?g.context=w:g.pendingContext=w,g=_i(c),g.payload={element:f},S=S===void 0?null:S,S!==null&&(g.callback=S),f=Si(r,g,c),f!==null&&(Uo(f,r,c),O2(f,r,c))}function wZ(r,c){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var f=r.retryLane;r.retryLane=f!==0&&f<c?f:c}}function Vz(r,c){wZ(r,c),(r=r.alternate)&&wZ(r,c)}function bZ(r){if(r.tag===13){var c=L1(r,67108864);c!==null&&Uo(c,r,67108864),Vz(r,67108864)}}var Hy=!0;function K1e(r,c,f,g){var w=P.T;P.T=null;var S=X.p;try{X.p=2,Bz(r,c,f,g)}finally{X.p=S,P.T=w}}function Q1e(r,c,f,g){var w=P.T;P.T=null;var S=X.p;try{X.p=8,Bz(r,c,f,g)}finally{X.p=S,P.T=w}}function Bz(r,c,f,g){if(Hy){var w=Fz(g);if(w===null)Az(r,c,g,Vy,f),_Z(r,g);else if(ehe(w,r,c,f,g))g.stopPropagation();else if(_Z(r,g),c&4&&-1<J1e.indexOf(r)){for(;w!==null;){var S=Mt(w);if(S!==null)switch(S.tag){case 3:if(S=S.stateNode,S.current.memoizedState.isDehydrated){var $=rn(S.pendingLanes);if($!==0){var B=S;for(B.pendingLanes|=2,B.entangledLanes|=2;$;){var J=1<<31-He($);B.entanglements[1]|=J,$&=~J}lr(S),(Pt&6)===0&&(Sy=We()+500,nf(0))}}break;case 13:B=L1(S,2),B!==null&&Uo(B,S,2),Ny(),Vz(S,2)}if(S=Fz(g),S===null&&Az(r,c,g,Vy,f),S===w)break;w=S}w!==null&&g.stopPropagation()}else Az(r,c,g,null,f)}}function Fz(r){return r=Y$(r),Uz(r)}var Vy=null;function Uz(r){if(Vy=null,r=tt(r),r!==null){var c=i(r);if(c===null)r=null;else{var f=c.tag;if(f===13){if(r=s(c),r!==null)return r;r=null}else if(f===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;r=null}else c!==r&&(r=null)}}return Vy=r,null}function MZ(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Le()){case Rt:return 2;case eo:return 8;case An:case wn:return 32;case On:return 268435456;default:return 32}default:return 32}}var Gz=!1,zi=null,Oi=null,qi=null,df=new Map,hf=new Map,Hi=[],J1e="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function _Z(r,c){switch(r){case"focusin":case"focusout":zi=null;break;case"dragenter":case"dragleave":Oi=null;break;case"mouseover":case"mouseout":qi=null;break;case"pointerover":case"pointerout":df.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":hf.delete(c.pointerId)}}function ff(r,c,f,g,w,S){return r===null||r.nativeEvent!==S?(r={blockedOn:c,domEventName:f,eventSystemFlags:g,nativeEvent:S,targetContainers:[w]},c!==null&&(c=Mt(c),c!==null&&bZ(c)),r):(r.eventSystemFlags|=g,c=r.targetContainers,w!==null&&c.indexOf(w)===-1&&c.push(w),r)}function ehe(r,c,f,g,w){switch(c){case"focusin":return zi=ff(zi,r,c,f,g,w),!0;case"dragenter":return Oi=ff(Oi,r,c,f,g,w),!0;case"mouseover":return qi=ff(qi,r,c,f,g,w),!0;case"pointerover":var S=w.pointerId;return df.set(S,ff(df.get(S)||null,r,c,f,g,w)),!0;case"gotpointercapture":return S=w.pointerId,hf.set(S,ff(hf.get(S)||null,r,c,f,g,w)),!0}return!1}function SZ(r){var c=tt(r.target);if(c!==null){var f=i(c);if(f!==null){if(c=f.tag,c===13){if(c=s(f),c!==null){r.blockedOn=c,re(r.priority,function(){if(f.tag===13){var g=Fo();g=qs(g);var w=L1(f,g);w!==null&&Uo(w,f,g),Vz(f,g)}});return}}else if(c===3&&f.stateNode.current.memoizedState.isDehydrated){r.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}r.blockedOn=null}function By(r){if(r.blockedOn!==null)return!1;for(var c=r.targetContainers;0<c.length;){var f=Fz(r.nativeEvent);if(f===null){f=r.nativeEvent;var g=new f.constructor(f.type,f);Z$=g,f.target.dispatchEvent(g),Z$=null}else return c=Mt(f),c!==null&&bZ(c),r.blockedOn=f,!1;c.shift()}return!0}function CZ(r,c,f){By(r)&&f.delete(c)}function the(){Gz=!1,zi!==null&&By(zi)&&(zi=null),Oi!==null&&By(Oi)&&(Oi=null),qi!==null&&By(qi)&&(qi=null),df.forEach(CZ),hf.forEach(CZ)}function Fy(r,c){r.blockedOn===c&&(r.blockedOn=null,Gz||(Gz=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,the)))}var Uy=null;function NZ(r){Uy!==r&&(Uy=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Uy===r&&(Uy=null);for(var c=0;c<r.length;c+=3){var f=r[c],g=r[c+1],w=r[c+2];if(typeof g!="function"){if(Uz(g||f)===null)continue;break}var S=Mt(f);S!==null&&(r.splice(c,3),c-=3,UD(S,{pending:!0,data:w,method:f.method,action:g},g,w))}}))}function pf(r){function c(J){return Fy(J,r)}zi!==null&&Fy(zi,r),Oi!==null&&Fy(Oi,r),qi!==null&&Fy(qi,r),df.forEach(c),hf.forEach(c);for(var f=0;f<Hi.length;f++){var g=Hi[f];g.blockedOn===r&&(g.blockedOn=null)}for(;0<Hi.length&&(f=Hi[0],f.blockedOn===null);)SZ(f),f.blockedOn===null&&Hi.shift();if(f=(r.ownerDocument||r).$$reactFormReplay,f!=null)for(g=0;g<f.length;g+=3){var w=f[g],S=f[g+1],$=w[Ce]||null;if(typeof S=="function")$||NZ(f);else if($){var B=null;if(S&&S.hasAttribute("formAction")){if(w=S,$=S[Ce]||null)B=$.formAction;else if(Uz(w)!==null)continue}else B=$.action;typeof B=="function"?f[g+1]=B:(f.splice(g,3),g-=3),NZ(f)}}}function Xz(r){this._internalRoot=r}Gy.prototype.render=Xz.prototype.render=function(r){var c=this._internalRoot;if(c===null)throw Error(o(409));var f=c.current,g=Fo();xZ(f,g,r,c,null,null)},Gy.prototype.unmount=Xz.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var c=r.containerInfo;xZ(r.current,2,null,r,null,null),Ny(),c[Pe]=null}};function Gy(r){this._internalRoot=r}Gy.prototype.unstable_scheduleHydration=function(r){if(r){var c=ee();r={blockedOn:null,target:r,priority:c};for(var f=0;f<Hi.length&&c!==0&&c<Hi[f].priority;f++);Hi.splice(f,0,r),f===0&&SZ(r)}};var LZ=t.version;if(LZ!=="19.1.0")throw Error(o(527,LZ,"19.1.0"));X.findDOMNode=function(r){var c=r._reactInternals;if(c===void 0)throw typeof r.render=="function"?Error(o(188)):(r=Object.keys(r).join(","),Error(o(268,r)));return r=d(c),r=r!==null?h(r):null,r=r===null?null:r.stateNode,r};var nhe={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xy=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xy.isDisabled&&Xy.supportsFiber)try{fe=Xy.inject(nhe),be=Xy}catch{}}return mf.createRoot=function(r,c){if(!a(r))throw Error(o(299));var f=!1,g="",w=FG,S=UG,$=GG,B=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(g=c.identifierPrefix),c.onUncaughtError!==void 0&&(w=c.onUncaughtError),c.onCaughtError!==void 0&&(S=c.onCaughtError),c.onRecoverableError!==void 0&&($=c.onRecoverableError),c.unstable_transitionCallbacks!==void 0&&(B=c.unstable_transitionCallbacks)),c=vZ(r,1,!1,null,null,f,g,w,S,$,B,null),r[Pe]=c.current,jz(r),new Xz(c)},mf.hydrateRoot=function(r,c,f){if(!a(r))throw Error(o(299));var g=!1,w="",S=FG,$=UG,B=GG,J=null,se=null;return f!=null&&(f.unstable_strictMode===!0&&(g=!0),f.identifierPrefix!==void 0&&(w=f.identifierPrefix),f.onUncaughtError!==void 0&&(S=f.onUncaughtError),f.onCaughtError!==void 0&&($=f.onCaughtError),f.onRecoverableError!==void 0&&(B=f.onRecoverableError),f.unstable_transitionCallbacks!==void 0&&(J=f.unstable_transitionCallbacks),f.formState!==void 0&&(se=f.formState)),c=vZ(r,1,!0,c,f??null,g,w,S,$,B,J,se),c.context=kZ(null),f=c.current,g=Fo(),g=qs(g),w=_i(g),w.callback=null,Si(f,w,g),f=g,c.current.lanes=f,tr(c,f),lr(c),r[Pe]=c.current,jz(r),new Gy(c)},mf.version="19.1.0",mf}var zZ;function hhe(){if(zZ)return Wz.exports;zZ=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Wz.exports=dhe(),Wz.exports}var fhe=hhe(),gf={},OZ;function phe(){if(OZ)return gf;OZ=1,Object.defineProperty(gf,"__esModule",{value:!0}),gf.parse=s,gf.serialize=h;const e=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,t=/^[\u0021-\u003A\u003C-\u007E]*$/,n=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,o=/^[\u0020-\u003A\u003D-\u007E]*$/,a=Object.prototype.toString,i=(()=>{const v=function(){};return v.prototype=Object.create(null),v})();function s(v,x){const M=new i,b=v.length;if(b<2)return M;const C=(x==null?void 0:x.decode)||p;let _=0;do{const N=v.indexOf("=",_);if(N===-1)break;const A=v.indexOf(";",_),I=A===-1?b:A;if(N>I){_=v.lastIndexOf(";",N-1)+1;continue}const R=l(v,_,N),j=d(v,N,R),D=v.slice(R,j);if(M[D]===void 0){let H=l(v,N+1,I),U=d(v,I,H);const z=C(v.slice(H,U));M[D]=z}_=I+1}while(_<b);return M}function l(v,x,M){do{const b=v.charCodeAt(x);if(b!==32&&b!==9)return x}while(++x<M);return M}function d(v,x,M){for(;x>M;){const b=v.charCodeAt(--x);if(b!==32&&b!==9)return x+1}return M}function h(v,x,M){const b=(M==null?void 0:M.encode)||encodeURIComponent;if(!e.test(v))throw new TypeError(`argument name is invalid: ${v}`);const C=b(x);if(!t.test(C))throw new TypeError(`argument val is invalid: ${x}`);let _=v+"="+C;if(!M)return _;if(M.maxAge!==void 0){if(!Number.isInteger(M.maxAge))throw new TypeError(`option maxAge is invalid: ${M.maxAge}`);_+="; Max-Age="+M.maxAge}if(M.domain){if(!n.test(M.domain))throw new TypeError(`option domain is invalid: ${M.domain}`);_+="; Domain="+M.domain}if(M.path){if(!o.test(M.path))throw new TypeError(`option path is invalid: ${M.path}`);_+="; Path="+M.path}if(M.expires){if(!m(M.expires)||!Number.isFinite(M.expires.valueOf()))throw new TypeError(`option expires is invalid: ${M.expires}`);_+="; Expires="+M.expires.toUTCString()}if(M.httpOnly&&(_+="; HttpOnly"),M.secure&&(_+="; Secure"),M.partitioned&&(_+="; Partitioned"),M.priority)switch(typeof M.priority=="string"?M.priority.toLowerCase():void 0){case"low":_+="; Priority=Low";break;case"medium":_+="; Priority=Medium";break;case"high":_+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${M.priority}`)}if(M.sameSite)switch(typeof M.sameSite=="string"?M.sameSite.toLowerCase():M.sameSite){case!0:case"strict":_+="; SameSite=Strict";break;case"lax":_+="; SameSite=Lax";break;case"none":_+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${M.sameSite}`)}return _}function p(v){if(v.indexOf("%")===-1)return v;try{return decodeURIComponent(v)}catch{return v}}function m(v){return a.call(v)==="[object Date]"}return gf}phe();/**
50
50
  * react-router v7.6.2
51
51
  *
@@ -55,7 +55,7 @@ Error generating stack: `+f.message+`
55
55
  * LICENSE.md file in the root directory of this source tree.
56
56
  *
57
57
  * @license MIT
58
- */var xJ=e=>{throw TypeError(e)},yhe=(e,t,n)=>t.has(e)||xJ("Cannot "+n),eO=(e,t,n)=>(yhe(e,t,"read from private field"),n?n.call(e):t.get(e)),mhe=(e,t,n)=>t.has(e)?xJ("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),qZ="popstate";function ghe(e={}){function t(o,a){let{pathname:i,search:s,hash:l}=o.location;return T0("",{pathname:i,search:s,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(o,a){return typeof a=="string"?a:Ss(a)}return khe(t,n,null,e)}function vt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Cn(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function vhe(){return Math.random().toString(36).substring(2,10)}function HZ(e,t){return{usr:e.state,key:e.key,idx:t}}function T0(e,t,n=null,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Is(t):t,state:n,key:t&&t.key||o||vhe()}}function Ss({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Is(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let o=e.indexOf("?");o>=0&&(t.search=e.substring(o),e=e.substring(0,o)),e&&(t.pathname=e)}return t}function khe(e,t,n,o={}){let{window:a=document.defaultView,v5Compat:i=!1}=o,s=a.history,l="POP",d=null,h=p();h==null&&(h=0,s.replaceState({...s.state,idx:h},""));function p(){return(s.state||{idx:null}).idx}function m(){l="POP";let C=p(),_=C==null?null:C-h;h=C,d&&d({action:l,location:b.location,delta:_})}function v(C,_){l="PUSH";let N=T0(b.location,C,_);h=p()+1;let A=HZ(N,h),I=b.createHref(N);try{s.pushState(A,"",I)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;a.location.assign(I)}i&&d&&d({action:l,location:b.location,delta:1})}function x(C,_){l="REPLACE";let N=T0(b.location,C,_);h=p();let A=HZ(N,h),I=b.createHref(N);s.replaceState(A,"",I),i&&d&&d({action:l,location:b.location,delta:0})}function M(C){return wJ(C)}let b={get action(){return l},get location(){return e(a,s)},listen(C){if(d)throw new Error("A history only accepts one active listener");return a.addEventListener(qZ,m),d=C,()=>{a.removeEventListener(qZ,m),d=null}},createHref(C){return t(a,C)},createURL:M,encodeLocation(C){let _=M(C);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:v,replace:x,go(C){return s.go(C)}};return b}function wJ(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),vt(n,"No window.location.(origin|href) available to create URL");let o=typeof e=="string"?e:Ss(e);return o=o.replace(/ $/,"%20"),!t&&o.startsWith("//")&&(o=n+o),new URL(o,n)}var Rf,VZ=class{constructor(e){if(mhe(this,Rf,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(eO(this,Rf).has(e))return eO(this,Rf).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){eO(this,Rf).set(e,t)}};Rf=new WeakMap;var xhe=new Set(["lazy","caseSensitive","path","id","index","children"]);function whe(e){return xhe.has(e)}var bhe=new Set(["lazy","caseSensitive","path","id","index","unstable_middleware","children"]);function Mhe(e){return bhe.has(e)}function _he(e){return e.index===!0}function zR(e,t,n=[],o={}){return e.map((a,i)=>{let s=[...n,String(i)],l=typeof a.id=="string"?a.id:s.join("-");if(vt(a.index!==!0||!a.children,"Cannot specify children on an index route"),vt(!o[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),_he(a)){let d={...a,...t(a),id:l};return o[l]=d,d}else{let d={...a,...t(a),id:l,children:void 0};return o[l]=d,a.children&&(d.children=zR(a.children,t,s,o)),d}})}function rs(e,t,n="/"){return Lm(e,t,n,!1)}function Lm(e,t,n,o){let a=typeof t=="string"?Is(t):t,i=Ma(a.pathname||"/",n);if(i==null)return null;let s=bJ(e);Che(s);let l=null;for(let d=0;l==null&&d<s.length;++d){let h=Dhe(i);l=Phe(s[d],h,o)}return l}function She(e,t){let{route:n,pathname:o,params:a}=e;return{id:n.id,pathname:o,params:a,data:t[n.id],handle:n.handle}}function bJ(e,t=[],n=[],o=""){let a=(i,s,l)=>{let d={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};d.relativePath.startsWith("/")&&(vt(d.relativePath.startsWith(o),`Absolute route path "${d.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(o.length));let h=kr([o,d.relativePath]),p=n.concat(d);i.children&&i.children.length>0&&(vt(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),bJ(i.children,t,p,h)),!(i.path==null&&!i.index)&&t.push({path:h,score:The(h,i.index),routesMeta:p})};return e.forEach((i,s)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))a(i,s);else for(let d of MJ(i.path))a(i,s,d)}),t}function MJ(e){let t=e.split("/");if(t.length===0)return[];let[n,...o]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(o.length===0)return a?[i,""]:[i];let s=MJ(o.join("/")),l=[];return l.push(...s.map(d=>d===""?i:[i,d].join("/"))),a&&l.push(...s),l.map(d=>e.startsWith("/")&&d===""?"/":d)}function Che(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Rhe(t.routesMeta.map(o=>o.childrenIndex),n.routesMeta.map(o=>o.childrenIndex)))}var Nhe=/^:[\w-]+$/,Lhe=3,jhe=2,Ahe=1,Ehe=10,Ihe=-2,BZ=e=>e==="*";function The(e,t){let n=e.split("/"),o=n.length;return n.some(BZ)&&(o+=Ihe),t&&(o+=jhe),n.filter(a=>!BZ(a)).reduce((a,i)=>a+(Nhe.test(i)?Lhe:i===""?Ahe:Ehe),o)}function Rhe(e,t){return e.length===t.length&&e.slice(0,-1).every((o,a)=>o===t[a])?e[e.length-1]-t[t.length-1]:0}function Phe(e,t,n=!1){let{routesMeta:o}=e,a={},i="/",s=[];for(let l=0;l<o.length;++l){let d=o[l],h=l===o.length-1,p=i==="/"?t:t.slice(i.length)||"/",m=OR({path:d.relativePath,caseSensitive:d.caseSensitive,end:h},p),v=d.route;if(!m&&h&&n&&!o[o.length-1].route.index&&(m=OR({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},p)),!m)return null;Object.assign(a,m.params),s.push({params:a,pathname:kr([i,m.pathname]),pathnameBase:qhe(kr([i,m.pathnameBase])),route:v}),m.pathnameBase!=="/"&&(i=kr([i,m.pathnameBase]))}return s}function OR(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,o]=$he(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let i=a[0],s=i.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:o.reduce((h,{paramName:p,isOptional:m},v)=>{if(p==="*"){let M=l[v]||"";s=i.slice(0,i.length-M.length).replace(/(.)\/+$/,"$1")}const x=l[v];return m&&!x?h[p]=void 0:h[p]=(x||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:s,pattern:e}}function $he(e,t=!1,n=!0){Cn(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let o=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,d)=>(o.push({paramName:l,isOptional:d!=null}),d?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(o.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),o]}function Dhe(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Cn(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ma(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,o=e.charAt(n);return o&&o!=="/"?null:e.slice(n)||"/"}function zhe(e,t="/"){let{pathname:n,search:o="",hash:a=""}=typeof e=="string"?Is(e):e;return{pathname:n?n.startsWith("/")?n:Ohe(n,t):t,search:Hhe(o),hash:Vhe(a)}}function Ohe(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function tO(e,t,n,o){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function _J(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function bP(e){let t=_J(e);return t.map((n,o)=>o===t.length-1?n.pathname:n.pathnameBase)}function MP(e,t,n,o=!1){let a;typeof e=="string"?a=Is(e):(a={...e},vt(!a.pathname||!a.pathname.includes("?"),tO("?","pathname","search",a)),vt(!a.pathname||!a.pathname.includes("#"),tO("#","pathname","hash",a)),vt(!a.search||!a.search.includes("#"),tO("#","search","hash",a)));let i=e===""||a.pathname==="",s=i?"/":a.pathname,l;if(s==null)l=n;else{let m=t.length-1;if(!o&&s.startsWith("..")){let v=s.split("/");for(;v[0]==="..";)v.shift(),m-=1;a.pathname=v.join("/")}l=m>=0?t[m]:"/"}let d=zhe(a,l),h=s&&s!=="/"&&s.endsWith("/"),p=(i||s===".")&&n.endsWith("/");return!d.pathname.endsWith("/")&&(h||p)&&(d.pathname+="/"),d}var kr=e=>e.join("/").replace(/\/\/+/g,"/"),qhe=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Hhe=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Vhe=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,qR=class{constructor(e,t,n,o=!1){this.status=e,this.statusText=t||"",this.internal=o,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function R0(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var SJ=["POST","PUT","PATCH","DELETE"],Bhe=new Set(SJ),Fhe=["GET",...SJ],Uhe=new Set(Fhe),Ghe=new Set([301,302,303,307,308]),Xhe=new Set([307,308]),nO={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Zhe={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},vf={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},mV=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Yhe=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),CJ="remix-router-transitions",NJ=Symbol("ResetLoaderData");function Whe(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";vt(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let o=e.hydrationRouteProperties||[],a=e.mapRouteProperties||Yhe,i={},s=zR(e.routes,a,void 0,i),l,d=e.basename||"/",h=e.dataStrategy||t2e,p={unstable_middleware:!1,...e.future},m=null,v=new Set,x=null,M=null,b=null,C=e.hydrationData!=null,_=rs(s,e.history.location,d),N=!1,A=null,I;if(_==null&&!e.patchRoutesOnNavigation){let ee=ma(404,{pathname:e.history.location.pathname}),{matches:re,route:de}=tY(s);I=!0,_=re,A={[de.id]:ee}}else if(_&&!e.hydrationData&&Pr(_,s,e.history.location.pathname).active&&(_=null),_)if(_.some(ee=>ee.route.lazy))I=!1;else if(!_.some(ee=>ee.route.loader))I=!0;else{let ee=e.hydrationData?e.hydrationData.loaderData:null,re=e.hydrationData?e.hydrationData.errors:null;if(re){let de=_.findIndex(xe=>re[xe.route.id]!==void 0);I=_.slice(0,de+1).every(xe=>!Eq(xe.route,ee,re))}else I=_.every(de=>!Eq(de.route,ee,re))}else{I=!1,_=[];let ee=Pr(null,s,e.history.location.pathname);ee.active&&ee.matches&&(N=!0,_=ee.matches)}let R,j={historyAction:e.history.action,location:e.history.location,matches:_,initialized:I,navigation:nO,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||A,fetchers:new Map,blockers:new Map},D="POP",H=!1,U,z=!1,Z=new Map,q=null,G=!1,E=!1,O=new Set,P=new Map,X=0,W=-1,V=new Map,L=new Set,Y=new Map,F=new Map,T=new Set,K=new Map,Q,ne=null;function te(){if(m=e.history.listen(({action:ee,location:re,delta:de})=>{if(Q){Q(),Q=void 0;return}Cn(K.size===0||de!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let xe=En({currentLocation:j.location,nextLocation:re,historyAction:ee});if(xe&&de!=null){let Ce=new Promise(Pe=>{Q=Pe});e.history.go(de*-1),Dt(xe,{state:"blocked",location:re,proceed(){Dt(xe,{state:"proceeding",proceed:void 0,reset:void 0,location:re}),Ce.then(()=>e.history.go(de))},reset(){let Pe=new Map(j.blockers);Pe.set(xe,vf),ke({blockers:Pe})}});return}return qe(ee,re)}),n){h2e(t,Z);let ee=()=>f2e(t,Z);t.addEventListener("pagehide",ee),q=()=>t.removeEventListener("pagehide",ee)}return j.initialized||qe("POP",j.location,{initialHydration:!0}),R}function ce(){m&&m(),q&&q(),v.clear(),U&&U.abort(),j.fetchers.forEach((ee,re)=>He(re)),j.blockers.forEach((ee,re)=>At(re))}function me(ee){return v.add(ee),()=>v.delete(ee)}function ke(ee,re={}){j={...j,...ee};let de=[],xe=[];j.fetchers.forEach((Ce,Pe)=>{Ce.state==="idle"&&(T.has(Pe)?de.push(Pe):xe.push(Pe))}),T.forEach(Ce=>{!j.fetchers.has(Ce)&&!P.has(Ce)&&de.push(Ce)}),[...v].forEach(Ce=>Ce(j,{deletedFetchers:de,viewTransitionOpts:re.viewTransitionOpts,flushSync:re.flushSync===!0})),de.forEach(Ce=>He(Ce)),xe.forEach(Ce=>j.fetchers.delete(Ce))}function Ee(ee,re,{flushSync:de}={}){var Ue,Qe;let xe=j.actionData!=null&&j.navigation.formMethod!=null&&Yo(j.navigation.formMethod)&&j.navigation.state==="loading"&&((Ue=ee.state)==null?void 0:Ue._isRedirect)!==!0,Ce;re.actionData?Object.keys(re.actionData).length>0?Ce=re.actionData:Ce=null:xe?Ce=j.actionData:Ce=null;let Pe=re.loaderData?JZ(j.loaderData,re.loaderData,re.matches||[],re.errors):j.loaderData,Ke=j.blockers;Ke.size>0&&(Ke=new Map(Ke),Ke.forEach((Ve,tt)=>Ke.set(tt,vf)));let Re=H===!0||j.navigation.formMethod!=null&&Yo(j.navigation.formMethod)&&((Qe=ee.state)==null?void 0:Qe._isRedirect)!==!0;l&&(s=l,l=void 0),G||D==="POP"||(D==="PUSH"?e.history.push(ee,ee.state):D==="REPLACE"&&e.history.replace(ee,ee.state));let Fe;if(D==="POP"){let Ve=Z.get(j.location.pathname);Ve&&Ve.has(ee.pathname)?Fe={currentLocation:j.location,nextLocation:ee}:Z.has(ee.pathname)&&(Fe={currentLocation:ee,nextLocation:j.location})}else if(z){let Ve=Z.get(j.location.pathname);Ve?Ve.add(ee.pathname):(Ve=new Set([ee.pathname]),Z.set(j.location.pathname,Ve)),Fe={currentLocation:j.location,nextLocation:ee}}ke({...re,actionData:Ce,loaderData:Pe,historyAction:D,location:ee,initialized:!0,navigation:nO,revalidation:"idle",restoreScrollPosition:ra(ee,re.matches||j.matches),preventScrollReset:Re,blockers:Ke},{viewTransitionOpts:Fe,flushSync:de===!0}),D="POP",H=!1,z=!1,G=!1,E=!1,ne==null||ne.resolve(),ne=null}async function Ie(ee,re){if(typeof ee=="number"){e.history.go(ee);return}let de=Aq(j.location,j.matches,d,ee,re==null?void 0:re.fromRouteId,re==null?void 0:re.relative),{path:xe,submission:Ce,error:Pe}=FZ(!1,de,re),Ke=j.location,Re=T0(j.location,xe,re&&re.state);Re={...Re,...e.history.encodeLocation(Re)};let Fe=re&&re.replace!=null?re.replace:void 0,Ue="PUSH";Fe===!0?Ue="REPLACE":Fe===!1||Ce!=null&&Yo(Ce.formMethod)&&Ce.formAction===j.location.pathname+j.location.search&&(Ue="REPLACE");let Qe=re&&"preventScrollReset"in re?re.preventScrollReset===!0:void 0,Ve=(re&&re.flushSync)===!0,tt=En({currentLocation:Ke,nextLocation:Re,historyAction:Ue});if(tt){Dt(tt,{state:"blocked",location:Re,proceed(){Dt(tt,{state:"proceeding",proceed:void 0,reset:void 0,location:Re}),Ie(ee,re)},reset(){let Mt=new Map(j.blockers);Mt.set(tt,vf),ke({blockers:Mt})}});return}await qe(Ue,Re,{submission:Ce,pendingError:Pe,preventScrollReset:Qe,replace:re&&re.replace,enableViewTransition:re&&re.viewTransition,flushSync:Ve})}function Te(){ne||(ne=p2e()),wo(),ke({revalidation:"loading"});let ee=ne.promise;return j.navigation.state==="submitting"?ee:j.navigation.state==="idle"?(qe(j.historyAction,j.location,{startUninterruptedRevalidation:!0}),ee):(qe(D||j.historyAction,j.navigation.location,{overrideNavigation:j.navigation,enableViewTransition:z===!0}),ee)}async function qe(ee,re,de){U&&U.abort(),U=null,D=ee,G=(de&&de.startUninterruptedRevalidation)===!0,tr(j.location,j.matches),H=(de&&de.preventScrollReset)===!0,z=(de&&de.enableViewTransition)===!0;let xe=l||s,Ce=de&&de.overrideNavigation,Pe=de!=null&&de.initialHydration&&j.matches&&j.matches.length>0&&!N?j.matches:rs(xe,re,d),Ke=(de&&de.flushSync)===!0;if(Pe&&j.initialized&&!E&&s2e(j.location,re)&&!(de&&de.submission&&Yo(de.submission.formMethod))){Ee(re,{matches:Pe},{flushSync:Ke});return}let Re=Pr(Pe,xe,re.pathname);if(Re.active&&Re.matches&&(Pe=Re.matches),!Pe){let{error:Qt,notFoundMatches:St,route:xt}=Qa(re.pathname);Ee(re,{matches:St,loaderData:{},errors:{[xt.id]:Qt}},{flushSync:Ke});return}U=new AbortController;let Fe=dh(e.history,re,U.signal,de&&de.submission),Ue=new VZ(e.unstable_getContext?await e.unstable_getContext():void 0),Qe;if(de&&de.pendingError)Qe=[Rd(Pe).route.id,{type:"error",error:de.pendingError}];else if(de&&de.submission&&Yo(de.submission.formMethod)){let Qt=await ct(Fe,re,de.submission,Pe,Ue,Re.active,de&&de.initialHydration===!0,{replace:de.replace,flushSync:Ke});if(Qt.shortCircuited)return;if(Qt.pendingActionResult){let[St,xt]=Qt.pendingActionResult;if(Zo(xt)&&R0(xt.error)&&xt.error.status===404){U=null,Ee(re,{matches:Qt.matches,loaderData:{},errors:{[St]:xt.error}});return}}Pe=Qt.matches||Pe,Qe=Qt.pendingActionResult,Ce=oO(re,de.submission),Ke=!1,Re.active=!1,Fe=dh(e.history,Fe.url,Fe.signal)}let{shortCircuited:Ve,matches:tt,loaderData:Mt,errors:Vt}=await jt(Fe,re,Pe,Ue,Re.active,Ce,de&&de.submission,de&&de.fetcherSubmission,de&&de.replace,de&&de.initialHydration===!0,Ke,Qe);Ve||(U=null,Ee(re,{matches:tt||Pe,...eY(Qe),loaderData:Mt,errors:Vt}))}async function ct(ee,re,de,xe,Ce,Pe,Ke,Re={}){wo();let Fe=u2e(re,de);if(ke({navigation:Fe},{flushSync:Re.flushSync===!0}),Pe){let Ve=await $r(xe,re.pathname,ee.signal);if(Ve.type==="aborted")return{shortCircuited:!0};if(Ve.type==="error"){let tt=Rd(Ve.partialMatches).route.id;return{matches:Ve.partialMatches,pendingActionResult:[tt,{type:"error",error:Ve.error}]}}else if(Ve.matches)xe=Ve.matches;else{let{notFoundMatches:tt,error:Mt,route:Vt}=Qa(re.pathname);return{matches:tt,pendingActionResult:[Vt.id,{type:"error",error:Mt}]}}}let Ue,Qe=Pf(xe,re);if(!Qe.route.action&&!Qe.route.lazy)Ue={type:"error",error:ma(405,{method:ee.method,pathname:re.pathname,routeId:Qe.route.id})};else{let Ve=Mh(a,i,ee,xe,Qe,Ke?[]:o,Ce),tt=await On(ee,Ve,Ce,null);if(Ue=tt[Qe.route.id],!Ue){for(let Mt of xe)if(tt[Mt.route.id]){Ue=tt[Mt.route.id];break}}if(ee.signal.aborted)return{shortCircuited:!0}}if(Pd(Ue)){let Ve;return Re&&Re.replace!=null?Ve=Re.replace:Ve=WZ(Ue.response.headers.get("Location"),new URL(ee.url),d)===j.location.pathname+j.location.search,await wn(ee,Ue,!0,{submission:de,replace:Ve}),{shortCircuited:!0}}if(Zo(Ue)){let Ve=Rd(xe,Qe.route.id);return(Re&&Re.replace)!==!0&&(D="PUSH"),{matches:xe,pendingActionResult:[Ve.route.id,Ue,Qe.route.id]}}return{matches:xe,pendingActionResult:[Qe.route.id,Ue]}}async function jt(ee,re,de,xe,Ce,Pe,Ke,Re,Fe,Ue,Qe,Ve){let tt=Pe||oO(re,Ke),Mt=Ke||Re||oY(tt),Vt=!G&&!Ue;if(Ce){if(Vt){let qn=We(Ve);ke({navigation:tt,...qn!==void 0?{actionData:qn}:{}},{flushSync:Qe})}let dt=await $r(de,re.pathname,ee.signal);if(dt.type==="aborted")return{shortCircuited:!0};if(dt.type==="error"){let qn=Rd(dt.partialMatches).route.id;return{matches:dt.partialMatches,loaderData:{},errors:{[qn]:dt.error}}}else if(dt.matches)de=dt.matches;else{let{error:qn,notFoundMatches:Do,route:zo}=Qa(re.pathname);return{matches:Do,loaderData:{},errors:{[zo.id]:qn}}}}let Qt=l||s,{dsMatches:St,revalidatingFetchers:xt}=UZ(ee,xe,a,i,e.history,j,de,Mt,re,Ue?[]:o,Ue===!0,E,O,T,Y,L,Qt,d,e.patchRoutesOnNavigation!=null,Ve);if(W=++X,!e.dataStrategy&&!St.some(dt=>dt.shouldLoad)&&xt.length===0){let dt=Kt();return Ee(re,{matches:de,loaderData:{},errors:Ve&&Zo(Ve[1])?{[Ve[0]]:Ve[1].error}:null,...eY(Ve),...dt?{fetchers:new Map(j.fetchers)}:{}},{flushSync:Qe}),{shortCircuited:!0}}if(Vt){let dt={};if(!Ce){dt.navigation=tt;let qn=We(Ve);qn!==void 0&&(dt.actionData=qn)}xt.length>0&&(dt.fetchers=Le(xt)),ke(dt,{flushSync:Qe})}xt.forEach(dt=>{ft(dt.key),dt.controller&&P.set(dt.key,dt.controller)});let nr=()=>xt.forEach(dt=>ft(dt.key));U&&U.signal.addEventListener("abort",nr);let{loaderResults:to,fetcherResults:bo}=await so(St,xt,ee,xe);if(ee.signal.aborted)return{shortCircuited:!0};U&&U.signal.removeEventListener("abort",nr),xt.forEach(dt=>P.delete(dt.key));let no=Zy(to);if(no)return await wn(ee,no.result,!0,{replace:Fe}),{shortCircuited:!0};if(no=Zy(bo),no)return L.add(no.key),await wn(ee,no.result,!0,{replace:Fe}),{shortCircuited:!0};let{loaderData:or,errors:ar}=QZ(j,de,to,Ve,xt,bo);Ue&&j.errors&&(ar={...j.errors,...ar});let Vs=Kt(),Mo=bn(W),ja=Vs||Mo||xt.length>0;return{matches:de,loaderData:or,errors:ar,...ja?{fetchers:new Map(j.fetchers)}:{}}}function We(ee){if(ee&&!Zo(ee[1]))return{[ee[0]]:ee[1].data};if(j.actionData)return Object.keys(j.actionData).length===0?null:j.actionData}function Le(ee){return ee.forEach(re=>{let de=j.fetchers.get(re.key),xe=kf(void 0,de?de.data:void 0);j.fetchers.set(re.key,xe)}),new Map(j.fetchers)}async function Rt(ee,re,de,xe){ft(ee);let Ce=(xe&&xe.flushSync)===!0,Pe=l||s,Ke=Aq(j.location,j.matches,d,de,re,xe==null?void 0:xe.relative),Re=rs(Pe,Ke,d),Fe=Pr(Re,Pe,Ke);if(Fe.active&&Fe.matches&&(Re=Fe.matches),!Re){be(ee,re,ma(404,{pathname:Ke}),{flushSync:Ce});return}let{path:Ue,submission:Qe,error:Ve}=FZ(!0,Ke,xe);if(Ve){be(ee,re,Ve,{flushSync:Ce});return}let tt=Pf(Re,Ue),Mt=new VZ(e.unstable_getContext?await e.unstable_getContext():void 0),Vt=(xe&&xe.preventScrollReset)===!0;if(Qe&&Yo(Qe.formMethod)){await eo(ee,re,Ue,tt,Re,Mt,Fe.active,Ce,Vt,Qe);return}Y.set(ee,{routeId:re,path:Ue}),await An(ee,re,Ue,tt,Re,Mt,Fe.active,Ce,Vt,Qe)}async function eo(ee,re,de,xe,Ce,Pe,Ke,Re,Fe,Ue){wo(),Y.delete(ee);function Qe(zt){if(!zt.route.action&&!zt.route.lazy){let xi=ma(405,{method:Ue.formMethod,pathname:de,routeId:re});return be(ee,re,xi,{flushSync:Re}),!0}return!1}if(!Ke&&Qe(xe))return;let Ve=j.fetchers.get(ee);fe(ee,d2e(Ue,Ve),{flushSync:Re});let tt=new AbortController,Mt=dh(e.history,de,tt.signal,Ue);if(Ke){let zt=await $r(Ce,de,Mt.signal,ee);if(zt.type==="aborted")return;if(zt.type==="error"){be(ee,re,zt.error,{flushSync:Re});return}else if(zt.matches){if(Ce=zt.matches,xe=Pf(Ce,de),Qe(xe))return}else{be(ee,re,ma(404,{pathname:de}),{flushSync:Re});return}}P.set(ee,tt);let Vt=X,Qt=Mh(a,i,Mt,Ce,xe,o,Pe),xt=(await On(Mt,Qt,Pe,ee))[xe.route.id];if(Mt.signal.aborted){P.get(ee)===tt&&P.delete(ee);return}if(T.has(ee)){if(Pd(xt)||Zo(xt)){fe(ee,Xi(void 0));return}}else{if(Pd(xt))if(P.delete(ee),W>Vt){fe(ee,Xi(void 0));return}else return L.add(ee),fe(ee,kf(Ue)),wn(Mt,xt,!1,{fetcherSubmission:Ue,preventScrollReset:Fe});if(Zo(xt)){be(ee,re,xt.error);return}}let nr=j.navigation.location||j.location,to=dh(e.history,nr,tt.signal),bo=l||s,no=j.navigation.state!=="idle"?rs(bo,j.navigation.location,d):j.matches;vt(no,"Didn't find any matches after fetcher action");let or=++X;V.set(ee,or);let ar=kf(Ue,xt.data);j.fetchers.set(ee,ar);let{dsMatches:Vs,revalidatingFetchers:Mo}=UZ(to,Pe,a,i,e.history,j,no,Ue,nr,o,!1,E,O,T,Y,L,bo,d,e.patchRoutesOnNavigation!=null,[xe.route.id,xt]);Mo.filter(zt=>zt.key!==ee).forEach(zt=>{let xi=zt.key,w2=j.fetchers.get(xi),_o=kf(void 0,w2?w2.data:void 0);j.fetchers.set(xi,_o),ft(xi),zt.controller&&P.set(xi,zt.controller)}),ke({fetchers:new Map(j.fetchers)});let ja=()=>Mo.forEach(zt=>ft(zt.key));tt.signal.addEventListener("abort",ja);let{loaderResults:dt,fetcherResults:qn}=await so(Vs,Mo,to,Pe);if(tt.signal.aborted)return;if(tt.signal.removeEventListener("abort",ja),V.delete(ee),P.delete(ee),Mo.forEach(zt=>P.delete(zt.key)),j.fetchers.has(ee)){let zt=Xi(xt.data);j.fetchers.set(ee,zt)}let Do=Zy(dt);if(Do)return wn(to,Do.result,!1,{preventScrollReset:Fe});if(Do=Zy(qn),Do)return L.add(Do.key),wn(to,Do.result,!1,{preventScrollReset:Fe});let{loaderData:zo,errors:Dr}=QZ(j,no,dt,void 0,Mo,qn);bn(or),j.navigation.state==="loading"&&or>W?(vt(D,"Expected pending action"),U&&U.abort(),Ee(j.navigation.location,{matches:no,loaderData:zo,errors:Dr,fetchers:new Map(j.fetchers)})):(ke({errors:Dr,loaderData:JZ(j.loaderData,zo,no,Dr),fetchers:new Map(j.fetchers)}),E=!1)}async function An(ee,re,de,xe,Ce,Pe,Ke,Re,Fe,Ue){let Qe=j.fetchers.get(ee);fe(ee,kf(Ue,Qe?Qe.data:void 0),{flushSync:Re});let Ve=new AbortController,tt=dh(e.history,de,Ve.signal);if(Ke){let xt=await $r(Ce,de,tt.signal,ee);if(xt.type==="aborted")return;if(xt.type==="error"){be(ee,re,xt.error,{flushSync:Re});return}else if(xt.matches)Ce=xt.matches,xe=Pf(Ce,de);else{be(ee,re,ma(404,{pathname:de}),{flushSync:Re});return}}P.set(ee,Ve);let Mt=X,Vt=Mh(a,i,tt,Ce,xe,o,Pe),St=(await On(tt,Vt,Pe,ee))[xe.route.id];if(P.get(ee)===Ve&&P.delete(ee),!tt.signal.aborted){if(T.has(ee)){fe(ee,Xi(void 0));return}if(Pd(St))if(W>Mt){fe(ee,Xi(void 0));return}else{L.add(ee),await wn(tt,St,!1,{preventScrollReset:Fe});return}if(Zo(St)){be(ee,re,St.error);return}fe(ee,Xi(St.data))}}async function wn(ee,re,de,{submission:xe,fetcherSubmission:Ce,preventScrollReset:Pe,replace:Ke}={}){re.response.headers.has("X-Remix-Revalidate")&&(E=!0);let Re=re.response.headers.get("Location");vt(Re,"Expected a Location header on the redirect Response"),Re=WZ(Re,new URL(ee.url),d);let Fe=T0(j.location,Re,{_isRedirect:!0});if(n){let Vt=!1;if(re.response.headers.has("X-Remix-Reload-Document"))Vt=!0;else if(mV.test(Re)){const Qt=wJ(Re,!0);Vt=Qt.origin!==t.location.origin||Ma(Qt.pathname,d)==null}if(Vt){Ke?t.location.replace(Re):t.location.assign(Re);return}}U=null;let Ue=Ke===!0||re.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Qe,formAction:Ve,formEncType:tt}=j.navigation;!xe&&!Ce&&Qe&&Ve&&tt&&(xe=oY(j.navigation));let Mt=xe||Ce;if(Xhe.has(re.response.status)&&Mt&&Yo(Mt.formMethod))await qe(Ue,Fe,{submission:{...Mt,formAction:Re},preventScrollReset:Pe||H,enableViewTransition:de?z:void 0});else{let Vt=oO(Fe,xe);await qe(Ue,Fe,{overrideNavigation:Vt,fetcherSubmission:Ce,preventScrollReset:Pe||H,enableViewTransition:de?z:void 0})}}async function On(ee,re,de,xe){let Ce,Pe={};try{Ce=await n2e(h,ee,re,xe,de,!1)}catch(Ke){return re.filter(Re=>Re.shouldLoad).forEach(Re=>{Pe[Re.route.id]={type:"error",error:Ke}}),Pe}if(ee.signal.aborted)return Pe;for(let[Ke,Re]of Object.entries(Ce))if(c2e(Re)){let Fe=Re.result;Pe[Ke]={type:"redirect",response:r2e(Fe,ee,Ke,re,d)}}else Pe[Ke]=await a2e(Re);return Pe}async function so(ee,re,de,xe){let Ce=On(de,ee,xe,null),Pe=Promise.all(re.map(async Fe=>{if(Fe.matches&&Fe.match&&Fe.request&&Fe.controller){let Qe=(await On(Fe.request,Fe.matches,xe,Fe.key))[Fe.match.route.id];return{[Fe.key]:Qe}}else return Promise.resolve({[Fe.key]:{type:"error",error:ma(404,{pathname:Fe.path})}})})),Ke=await Ce,Re=(await Pe).reduce((Fe,Ue)=>Object.assign(Fe,Ue),{});return{loaderResults:Ke,fetcherResults:Re}}function wo(){E=!0,Y.forEach((ee,re)=>{P.has(re)&&O.add(re),ft(re)})}function fe(ee,re,de={}){j.fetchers.set(ee,re),ke({fetchers:new Map(j.fetchers)},{flushSync:(de&&de.flushSync)===!0})}function be(ee,re,de,xe={}){let Ce=Rd(j.matches,re);He(ee),ke({errors:{[Ce.route.id]:de},fetchers:new Map(j.fetchers)},{flushSync:(xe&&xe.flushSync)===!0})}function Oe(ee){return F.set(ee,(F.get(ee)||0)+1),T.has(ee)&&T.delete(ee),j.fetchers.get(ee)||Zhe}function He(ee){let re=j.fetchers.get(ee);P.has(ee)&&!(re&&re.state==="loading"&&V.has(ee))&&ft(ee),Y.delete(ee),V.delete(ee),L.delete(ee),T.delete(ee),O.delete(ee),j.fetchers.delete(ee)}function kt(ee){let re=(F.get(ee)||0)-1;re<=0?(F.delete(ee),T.add(ee)):F.set(ee,re),ke({fetchers:new Map(j.fetchers)})}function ft(ee){let re=P.get(ee);re&&(re.abort(),P.delete(ee))}function tn(ee){for(let re of ee){let de=Oe(re),xe=Xi(de.data);j.fetchers.set(re,xe)}}function Kt(){let ee=[],re=!1;for(let de of L){let xe=j.fetchers.get(de);vt(xe,`Expected fetcher: ${de}`),xe.state==="loading"&&(L.delete(de),ee.push(de),re=!0)}return tn(ee),re}function bn(ee){let re=[];for(let[de,xe]of V)if(xe<ee){let Ce=j.fetchers.get(de);vt(Ce,`Expected fetcher: ${de}`),Ce.state==="loading"&&(ft(de),V.delete(de),re.push(de))}return tn(re),re.length>0}function rn(ee,re){let de=j.blockers.get(ee)||vf;return K.get(ee)!==re&&K.set(ee,re),de}function At(ee){j.blockers.delete(ee),K.delete(ee)}function Dt(ee,re){let de=j.blockers.get(ee)||vf;vt(de.state==="unblocked"&&re.state==="blocked"||de.state==="blocked"&&re.state==="blocked"||de.state==="blocked"&&re.state==="proceeding"||de.state==="blocked"&&re.state==="unblocked"||de.state==="proceeding"&&re.state==="unblocked",`Invalid blocker state transition: ${de.state} -> ${re.state}`);let xe=new Map(j.blockers);xe.set(ee,re),ke({blockers:xe})}function En({currentLocation:ee,nextLocation:re,historyAction:de}){if(K.size===0)return;K.size>1&&Cn(!1,"A router only supports one blocker at a time");let xe=Array.from(K.entries()),[Ce,Pe]=xe[xe.length-1],Ke=j.blockers.get(Ce);if(!(Ke&&Ke.state==="proceeding")&&Pe({currentLocation:ee,nextLocation:re,historyAction:de}))return Ce}function Qa(ee){let re=ma(404,{pathname:ee}),de=l||s,{matches:xe,route:Ce}=tY(de);return{notFoundMatches:xe,route:Ce,error:re}}function Ja(ee,re,de){if(x=ee,b=re,M=de||null,!C&&j.navigation===nO){C=!0;let xe=ra(j.location,j.matches);xe!=null&&ke({restoreScrollPosition:xe})}return()=>{x=null,b=null,M=null}}function er(ee,re){return M&&M(ee,re.map(xe=>She(xe,j.loaderData)))||ee.key}function tr(ee,re){if(x&&b){let de=er(ee,re);x[de]=b()}}function ra(ee,re){if(x){let de=er(ee,re),xe=x[de];if(typeof xe=="number")return xe}return null}function Pr(ee,re,de){if(e.patchRoutesOnNavigation)if(ee){if(Object.keys(ee[0].params).length>0)return{active:!0,matches:Lm(re,de,d,!0)}}else return{active:!0,matches:Lm(re,de,d,!0)||[]};return{active:!1,matches:null}}async function $r(ee,re,de,xe){if(!e.patchRoutesOnNavigation)return{type:"success",matches:ee};let Ce=ee;for(;;){let Pe=l==null,Ke=l||s,Re=i;try{await e.patchRoutesOnNavigation({signal:de,path:re,matches:Ce,fetcherKey:xe,patch:(Qe,Ve)=>{de.aborted||GZ(Qe,Ve,Ke,Re,a)}})}catch(Qe){return{type:"error",error:Qe,partialMatches:Ce}}finally{Pe&&!de.aborted&&(s=[...s])}if(de.aborted)return{type:"aborted"};let Fe=rs(Ke,re,d);if(Fe)return{type:"success",matches:Fe};let Ue=Lm(Ke,re,d,!0);if(!Ue||Ce.length===Ue.length&&Ce.every((Qe,Ve)=>Qe.route.id===Ue[Ve].route.id))return{type:"success",matches:null};Ce=Ue}}function qs(ee){i={},l=zR(ee,a,void 0,i)}function Hs(ee,re){let de=l==null;GZ(ee,re,l||s,i,a),de&&(s=[...s],ke({}))}return R={get basename(){return d},get future(){return p},get state(){return j},get routes(){return s},get window(){return t},initialize:te,subscribe:me,enableScrollRestoration:Ja,navigate:Ie,fetch:Rt,revalidate:Te,createHref:ee=>e.history.createHref(ee),encodeLocation:ee=>e.history.encodeLocation(ee),getFetcher:Oe,deleteFetcher:kt,dispose:ce,getBlocker:rn,deleteBlocker:At,patchRoutes:Hs,_internalFetchControllers:P,_internalSetRoutes:qs},R}function Khe(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Aq(e,t,n,o,a,i){let s,l;if(a){s=[];for(let h of t)if(s.push(h),h.route.id===a){l=h;break}}else s=t,l=t[t.length-1];let d=MP(o||".",bP(s),Ma(e.pathname,n)||e.pathname,i==="path");if(o==null&&(d.search=e.search,d.hash=e.hash),(o==null||o===""||o===".")&&l){let h=gV(d.search);if(l.route.index&&!h)d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index";else if(!l.route.index&&h){let p=new URLSearchParams(d.search),m=p.getAll("index");p.delete("index"),m.filter(x=>x).forEach(x=>p.append("index",x));let v=p.toString();d.search=v?`?${v}`:""}}return n!=="/"&&(d.pathname=d.pathname==="/"?n:kr([n,d.pathname])),Ss(d)}function FZ(e,t,n){if(!n||!Khe(n))return{path:t};if(n.formMethod&&!l2e(n.formMethod))return{path:t,error:ma(405,{method:n.formMethod})};let o=()=>({path:t,error:ma(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),s=TJ(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Yo(i))return o();let m=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((v,[x,M])=>`${v}${x}=${M}
58
+ */var xJ=e=>{throw TypeError(e)},yhe=(e,t,n)=>t.has(e)||xJ("Cannot "+n),eO=(e,t,n)=>(yhe(e,t,"read from private field"),n?n.call(e):t.get(e)),mhe=(e,t,n)=>t.has(e)?xJ("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),qZ="popstate";function ghe(e={}){function t(o,a){let{pathname:i,search:s,hash:l}=o.location;return T0("",{pathname:i,search:s,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(o,a){return typeof a=="string"?a:Ss(a)}return khe(t,n,null,e)}function vt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Cn(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function vhe(){return Math.random().toString(36).substring(2,10)}function HZ(e,t){return{usr:e.state,key:e.key,idx:t}}function T0(e,t,n=null,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Is(t):t,state:n,key:t&&t.key||o||vhe()}}function Ss({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Is(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let o=e.indexOf("?");o>=0&&(t.search=e.substring(o),e=e.substring(0,o)),e&&(t.pathname=e)}return t}function khe(e,t,n,o={}){let{window:a=document.defaultView,v5Compat:i=!1}=o,s=a.history,l="POP",d=null,h=p();h==null&&(h=0,s.replaceState({...s.state,idx:h},""));function p(){return(s.state||{idx:null}).idx}function m(){l="POP";let C=p(),_=C==null?null:C-h;h=C,d&&d({action:l,location:b.location,delta:_})}function v(C,_){l="PUSH";let N=T0(b.location,C,_);h=p()+1;let A=HZ(N,h),I=b.createHref(N);try{s.pushState(A,"",I)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;a.location.assign(I)}i&&d&&d({action:l,location:b.location,delta:1})}function x(C,_){l="REPLACE";let N=T0(b.location,C,_);h=p();let A=HZ(N,h),I=b.createHref(N);s.replaceState(A,"",I),i&&d&&d({action:l,location:b.location,delta:0})}function M(C){return wJ(C)}let b={get action(){return l},get location(){return e(a,s)},listen(C){if(d)throw new Error("A history only accepts one active listener");return a.addEventListener(qZ,m),d=C,()=>{a.removeEventListener(qZ,m),d=null}},createHref(C){return t(a,C)},createURL:M,encodeLocation(C){let _=M(C);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:v,replace:x,go(C){return s.go(C)}};return b}function wJ(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),vt(n,"No window.location.(origin|href) available to create URL");let o=typeof e=="string"?e:Ss(e);return o=o.replace(/ $/,"%20"),!t&&o.startsWith("//")&&(o=n+o),new URL(o,n)}var Rf,VZ=class{constructor(e){if(mhe(this,Rf,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(eO(this,Rf).has(e))return eO(this,Rf).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){eO(this,Rf).set(e,t)}};Rf=new WeakMap;var xhe=new Set(["lazy","caseSensitive","path","id","index","children"]);function whe(e){return xhe.has(e)}var bhe=new Set(["lazy","caseSensitive","path","id","index","unstable_middleware","children"]);function Mhe(e){return bhe.has(e)}function _he(e){return e.index===!0}function zR(e,t,n=[],o={}){return e.map((a,i)=>{let s=[...n,String(i)],l=typeof a.id=="string"?a.id:s.join("-");if(vt(a.index!==!0||!a.children,"Cannot specify children on an index route"),vt(!o[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),_he(a)){let d={...a,...t(a),id:l};return o[l]=d,d}else{let d={...a,...t(a),id:l,children:void 0};return o[l]=d,a.children&&(d.children=zR(a.children,t,s,o)),d}})}function rs(e,t,n="/"){return Lm(e,t,n,!1)}function Lm(e,t,n,o){let a=typeof t=="string"?Is(t):t,i=Ma(a.pathname||"/",n);if(i==null)return null;let s=bJ(e);Che(s);let l=null;for(let d=0;l==null&&d<s.length;++d){let h=Dhe(i);l=Phe(s[d],h,o)}return l}function She(e,t){let{route:n,pathname:o,params:a}=e;return{id:n.id,pathname:o,params:a,data:t[n.id],handle:n.handle}}function bJ(e,t=[],n=[],o=""){let a=(i,s,l)=>{let d={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};d.relativePath.startsWith("/")&&(vt(d.relativePath.startsWith(o),`Absolute route path "${d.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(o.length));let h=kr([o,d.relativePath]),p=n.concat(d);i.children&&i.children.length>0&&(vt(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),bJ(i.children,t,p,h)),!(i.path==null&&!i.index)&&t.push({path:h,score:The(h,i.index),routesMeta:p})};return e.forEach((i,s)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))a(i,s);else for(let d of MJ(i.path))a(i,s,d)}),t}function MJ(e){let t=e.split("/");if(t.length===0)return[];let[n,...o]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(o.length===0)return a?[i,""]:[i];let s=MJ(o.join("/")),l=[];return l.push(...s.map(d=>d===""?i:[i,d].join("/"))),a&&l.push(...s),l.map(d=>e.startsWith("/")&&d===""?"/":d)}function Che(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Rhe(t.routesMeta.map(o=>o.childrenIndex),n.routesMeta.map(o=>o.childrenIndex)))}var Nhe=/^:[\w-]+$/,Lhe=3,jhe=2,Ahe=1,Ehe=10,Ihe=-2,BZ=e=>e==="*";function The(e,t){let n=e.split("/"),o=n.length;return n.some(BZ)&&(o+=Ihe),t&&(o+=jhe),n.filter(a=>!BZ(a)).reduce((a,i)=>a+(Nhe.test(i)?Lhe:i===""?Ahe:Ehe),o)}function Rhe(e,t){return e.length===t.length&&e.slice(0,-1).every((o,a)=>o===t[a])?e[e.length-1]-t[t.length-1]:0}function Phe(e,t,n=!1){let{routesMeta:o}=e,a={},i="/",s=[];for(let l=0;l<o.length;++l){let d=o[l],h=l===o.length-1,p=i==="/"?t:t.slice(i.length)||"/",m=OR({path:d.relativePath,caseSensitive:d.caseSensitive,end:h},p),v=d.route;if(!m&&h&&n&&!o[o.length-1].route.index&&(m=OR({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},p)),!m)return null;Object.assign(a,m.params),s.push({params:a,pathname:kr([i,m.pathname]),pathnameBase:qhe(kr([i,m.pathnameBase])),route:v}),m.pathnameBase!=="/"&&(i=kr([i,m.pathnameBase]))}return s}function OR(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,o]=$he(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let i=a[0],s=i.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:o.reduce((h,{paramName:p,isOptional:m},v)=>{if(p==="*"){let M=l[v]||"";s=i.slice(0,i.length-M.length).replace(/(.)\/+$/,"$1")}const x=l[v];return m&&!x?h[p]=void 0:h[p]=(x||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:s,pattern:e}}function $he(e,t=!1,n=!0){Cn(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let o=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,d)=>(o.push({paramName:l,isOptional:d!=null}),d?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(o.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),o]}function Dhe(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Cn(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ma(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,o=e.charAt(n);return o&&o!=="/"?null:e.slice(n)||"/"}function zhe(e,t="/"){let{pathname:n,search:o="",hash:a=""}=typeof e=="string"?Is(e):e;return{pathname:n?n.startsWith("/")?n:Ohe(n,t):t,search:Hhe(o),hash:Vhe(a)}}function Ohe(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function tO(e,t,n,o){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function _J(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function bP(e){let t=_J(e);return t.map((n,o)=>o===t.length-1?n.pathname:n.pathnameBase)}function MP(e,t,n,o=!1){let a;typeof e=="string"?a=Is(e):(a={...e},vt(!a.pathname||!a.pathname.includes("?"),tO("?","pathname","search",a)),vt(!a.pathname||!a.pathname.includes("#"),tO("#","pathname","hash",a)),vt(!a.search||!a.search.includes("#"),tO("#","search","hash",a)));let i=e===""||a.pathname==="",s=i?"/":a.pathname,l;if(s==null)l=n;else{let m=t.length-1;if(!o&&s.startsWith("..")){let v=s.split("/");for(;v[0]==="..";)v.shift(),m-=1;a.pathname=v.join("/")}l=m>=0?t[m]:"/"}let d=zhe(a,l),h=s&&s!=="/"&&s.endsWith("/"),p=(i||s===".")&&n.endsWith("/");return!d.pathname.endsWith("/")&&(h||p)&&(d.pathname+="/"),d}var kr=e=>e.join("/").replace(/\/\/+/g,"/"),qhe=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Hhe=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Vhe=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,qR=class{constructor(e,t,n,o=!1){this.status=e,this.statusText=t||"",this.internal=o,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function R0(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var SJ=["POST","PUT","PATCH","DELETE"],Bhe=new Set(SJ),Fhe=["GET",...SJ],Uhe=new Set(Fhe),Ghe=new Set([301,302,303,307,308]),Xhe=new Set([307,308]),nO={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Zhe={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},vf={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},mV=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Yhe=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),CJ="remix-router-transitions",NJ=Symbol("ResetLoaderData");function Whe(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";vt(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let o=e.hydrationRouteProperties||[],a=e.mapRouteProperties||Yhe,i={},s=zR(e.routes,a,void 0,i),l,d=e.basename||"/",h=e.dataStrategy||t2e,p={unstable_middleware:!1,...e.future},m=null,v=new Set,x=null,M=null,b=null,C=e.hydrationData!=null,_=rs(s,e.history.location,d),N=!1,A=null,I;if(_==null&&!e.patchRoutesOnNavigation){let ee=ma(404,{pathname:e.history.location.pathname}),{matches:re,route:de}=tY(s);I=!0,_=re,A={[de.id]:ee}}else if(_&&!e.hydrationData&&Pr(_,s,e.history.location.pathname).active&&(_=null),_)if(_.some(ee=>ee.route.lazy))I=!1;else if(!_.some(ee=>ee.route.loader))I=!0;else{let ee=e.hydrationData?e.hydrationData.loaderData:null,re=e.hydrationData?e.hydrationData.errors:null;if(re){let de=_.findIndex(xe=>re[xe.route.id]!==void 0);I=_.slice(0,de+1).every(xe=>!Eq(xe.route,ee,re))}else I=_.every(de=>!Eq(de.route,ee,re))}else{I=!1,_=[];let ee=Pr(null,s,e.history.location.pathname);ee.active&&ee.matches&&(N=!0,_=ee.matches)}let R,j={historyAction:e.history.action,location:e.history.location,matches:_,initialized:I,navigation:nO,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||A,fetchers:new Map,blockers:new Map},D="POP",H=!1,U,z=!1,Z=new Map,q=null,G=!1,E=!1,O=new Set,P=new Map,X=0,W=-1,V=new Map,L=new Set,Y=new Map,F=new Map,T=new Set,K=new Map,Q,ne=null;function te(){if(m=e.history.listen(({action:ee,location:re,delta:de})=>{if(Q){Q(),Q=void 0;return}Cn(K.size===0||de!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let xe=En({currentLocation:j.location,nextLocation:re,historyAction:ee});if(xe&&de!=null){let Ce=new Promise(Pe=>{Q=Pe});e.history.go(de*-1),Dt(xe,{state:"blocked",location:re,proceed(){Dt(xe,{state:"proceeding",proceed:void 0,reset:void 0,location:re}),Ce.then(()=>e.history.go(de))},reset(){let Pe=new Map(j.blockers);Pe.set(xe,vf),ke({blockers:Pe})}});return}return qe(ee,re)}),n){h2e(t,Z);let ee=()=>f2e(t,Z);t.addEventListener("pagehide",ee),q=()=>t.removeEventListener("pagehide",ee)}return j.initialized||qe("POP",j.location,{initialHydration:!0}),R}function ce(){m&&m(),q&&q(),v.clear(),U&&U.abort(),j.fetchers.forEach((ee,re)=>He(re)),j.blockers.forEach((ee,re)=>At(re))}function me(ee){return v.add(ee),()=>v.delete(ee)}function ke(ee,re={}){j={...j,...ee};let de=[],xe=[];j.fetchers.forEach((Ce,Pe)=>{Ce.state==="idle"&&(T.has(Pe)?de.push(Pe):xe.push(Pe))}),T.forEach(Ce=>{!j.fetchers.has(Ce)&&!P.has(Ce)&&de.push(Ce)}),[...v].forEach(Ce=>Ce(j,{deletedFetchers:de,viewTransitionOpts:re.viewTransitionOpts,flushSync:re.flushSync===!0})),de.forEach(Ce=>He(Ce)),xe.forEach(Ce=>j.fetchers.delete(Ce))}function Ee(ee,re,{flushSync:de}={}){var Ue,Qe;let xe=j.actionData!=null&&j.navigation.formMethod!=null&&Yo(j.navigation.formMethod)&&j.navigation.state==="loading"&&((Ue=ee.state)==null?void 0:Ue._isRedirect)!==!0,Ce;re.actionData?Object.keys(re.actionData).length>0?Ce=re.actionData:Ce=null:xe?Ce=j.actionData:Ce=null;let Pe=re.loaderData?JZ(j.loaderData,re.loaderData,re.matches||[],re.errors):j.loaderData,Ke=j.blockers;Ke.size>0&&(Ke=new Map(Ke),Ke.forEach((Ve,tt)=>Ke.set(tt,vf)));let Re=H===!0||j.navigation.formMethod!=null&&Yo(j.navigation.formMethod)&&((Qe=ee.state)==null?void 0:Qe._isRedirect)!==!0;l&&(s=l,l=void 0),G||D==="POP"||(D==="PUSH"?e.history.push(ee,ee.state):D==="REPLACE"&&e.history.replace(ee,ee.state));let Fe;if(D==="POP"){let Ve=Z.get(j.location.pathname);Ve&&Ve.has(ee.pathname)?Fe={currentLocation:j.location,nextLocation:ee}:Z.has(ee.pathname)&&(Fe={currentLocation:ee,nextLocation:j.location})}else if(z){let Ve=Z.get(j.location.pathname);Ve?Ve.add(ee.pathname):(Ve=new Set([ee.pathname]),Z.set(j.location.pathname,Ve)),Fe={currentLocation:j.location,nextLocation:ee}}ke({...re,actionData:Ce,loaderData:Pe,historyAction:D,location:ee,initialized:!0,navigation:nO,revalidation:"idle",restoreScrollPosition:ra(ee,re.matches||j.matches),preventScrollReset:Re,blockers:Ke},{viewTransitionOpts:Fe,flushSync:de===!0}),D="POP",H=!1,z=!1,G=!1,E=!1,ne==null||ne.resolve(),ne=null}async function Ie(ee,re){if(typeof ee=="number"){e.history.go(ee);return}let de=Aq(j.location,j.matches,d,ee,re==null?void 0:re.fromRouteId,re==null?void 0:re.relative),{path:xe,submission:Ce,error:Pe}=FZ(!1,de,re),Ke=j.location,Re=T0(j.location,xe,re&&re.state);Re={...Re,...e.history.encodeLocation(Re)};let Fe=re&&re.replace!=null?re.replace:void 0,Ue="PUSH";Fe===!0?Ue="REPLACE":Fe===!1||Ce!=null&&Yo(Ce.formMethod)&&Ce.formAction===j.location.pathname+j.location.search&&(Ue="REPLACE");let Qe=re&&"preventScrollReset"in re?re.preventScrollReset===!0:void 0,Ve=(re&&re.flushSync)===!0,tt=En({currentLocation:Ke,nextLocation:Re,historyAction:Ue});if(tt){Dt(tt,{state:"blocked",location:Re,proceed(){Dt(tt,{state:"proceeding",proceed:void 0,reset:void 0,location:Re}),Ie(ee,re)},reset(){let Mt=new Map(j.blockers);Mt.set(tt,vf),ke({blockers:Mt})}});return}await qe(Ue,Re,{submission:Ce,pendingError:Pe,preventScrollReset:Qe,replace:re&&re.replace,enableViewTransition:re&&re.viewTransition,flushSync:Ve})}function Te(){ne||(ne=p2e()),wo(),ke({revalidation:"loading"});let ee=ne.promise;return j.navigation.state==="submitting"?ee:j.navigation.state==="idle"?(qe(j.historyAction,j.location,{startUninterruptedRevalidation:!0}),ee):(qe(D||j.historyAction,j.navigation.location,{overrideNavigation:j.navigation,enableViewTransition:z===!0}),ee)}async function qe(ee,re,de){U&&U.abort(),U=null,D=ee,G=(de&&de.startUninterruptedRevalidation)===!0,tr(j.location,j.matches),H=(de&&de.preventScrollReset)===!0,z=(de&&de.enableViewTransition)===!0;let xe=l||s,Ce=de&&de.overrideNavigation,Pe=de!=null&&de.initialHydration&&j.matches&&j.matches.length>0&&!N?j.matches:rs(xe,re,d),Ke=(de&&de.flushSync)===!0;if(Pe&&j.initialized&&!E&&s2e(j.location,re)&&!(de&&de.submission&&Yo(de.submission.formMethod))){Ee(re,{matches:Pe},{flushSync:Ke});return}let Re=Pr(Pe,xe,re.pathname);if(Re.active&&Re.matches&&(Pe=Re.matches),!Pe){let{error:Qt,notFoundMatches:St,route:xt}=Qa(re.pathname);Ee(re,{matches:St,loaderData:{},errors:{[xt.id]:Qt}},{flushSync:Ke});return}U=new AbortController;let Fe=dh(e.history,re,U.signal,de&&de.submission),Ue=new VZ(e.unstable_getContext?await e.unstable_getContext():void 0),Qe;if(de&&de.pendingError)Qe=[Rd(Pe).route.id,{type:"error",error:de.pendingError}];else if(de&&de.submission&&Yo(de.submission.formMethod)){let Qt=await ct(Fe,re,de.submission,Pe,Ue,Re.active,de&&de.initialHydration===!0,{replace:de.replace,flushSync:Ke});if(Qt.shortCircuited)return;if(Qt.pendingActionResult){let[St,xt]=Qt.pendingActionResult;if(Zo(xt)&&R0(xt.error)&&xt.error.status===404){U=null,Ee(re,{matches:Qt.matches,loaderData:{},errors:{[St]:xt.error}});return}}Pe=Qt.matches||Pe,Qe=Qt.pendingActionResult,Ce=oO(re,de.submission),Ke=!1,Re.active=!1,Fe=dh(e.history,Fe.url,Fe.signal)}let{shortCircuited:Ve,matches:tt,loaderData:Mt,errors:Bt}=await jt(Fe,re,Pe,Ue,Re.active,Ce,de&&de.submission,de&&de.fetcherSubmission,de&&de.replace,de&&de.initialHydration===!0,Ke,Qe);Ve||(U=null,Ee(re,{matches:tt||Pe,...eY(Qe),loaderData:Mt,errors:Bt}))}async function ct(ee,re,de,xe,Ce,Pe,Ke,Re={}){wo();let Fe=u2e(re,de);if(ke({navigation:Fe},{flushSync:Re.flushSync===!0}),Pe){let Ve=await $r(xe,re.pathname,ee.signal);if(Ve.type==="aborted")return{shortCircuited:!0};if(Ve.type==="error"){let tt=Rd(Ve.partialMatches).route.id;return{matches:Ve.partialMatches,pendingActionResult:[tt,{type:"error",error:Ve.error}]}}else if(Ve.matches)xe=Ve.matches;else{let{notFoundMatches:tt,error:Mt,route:Bt}=Qa(re.pathname);return{matches:tt,pendingActionResult:[Bt.id,{type:"error",error:Mt}]}}}let Ue,Qe=Pf(xe,re);if(!Qe.route.action&&!Qe.route.lazy)Ue={type:"error",error:ma(405,{method:ee.method,pathname:re.pathname,routeId:Qe.route.id})};else{let Ve=Mh(a,i,ee,xe,Qe,Ke?[]:o,Ce),tt=await On(ee,Ve,Ce,null);if(Ue=tt[Qe.route.id],!Ue){for(let Mt of xe)if(tt[Mt.route.id]){Ue=tt[Mt.route.id];break}}if(ee.signal.aborted)return{shortCircuited:!0}}if(Pd(Ue)){let Ve;return Re&&Re.replace!=null?Ve=Re.replace:Ve=WZ(Ue.response.headers.get("Location"),new URL(ee.url),d)===j.location.pathname+j.location.search,await wn(ee,Ue,!0,{submission:de,replace:Ve}),{shortCircuited:!0}}if(Zo(Ue)){let Ve=Rd(xe,Qe.route.id);return(Re&&Re.replace)!==!0&&(D="PUSH"),{matches:xe,pendingActionResult:[Ve.route.id,Ue,Qe.route.id]}}return{matches:xe,pendingActionResult:[Qe.route.id,Ue]}}async function jt(ee,re,de,xe,Ce,Pe,Ke,Re,Fe,Ue,Qe,Ve){let tt=Pe||oO(re,Ke),Mt=Ke||Re||oY(tt),Bt=!G&&!Ue;if(Ce){if(Bt){let qn=We(Ve);ke({navigation:tt,...qn!==void 0?{actionData:qn}:{}},{flushSync:Qe})}let dt=await $r(de,re.pathname,ee.signal);if(dt.type==="aborted")return{shortCircuited:!0};if(dt.type==="error"){let qn=Rd(dt.partialMatches).route.id;return{matches:dt.partialMatches,loaderData:{},errors:{[qn]:dt.error}}}else if(dt.matches)de=dt.matches;else{let{error:qn,notFoundMatches:Do,route:zo}=Qa(re.pathname);return{matches:Do,loaderData:{},errors:{[zo.id]:qn}}}}let Qt=l||s,{dsMatches:St,revalidatingFetchers:xt}=UZ(ee,xe,a,i,e.history,j,de,Mt,re,Ue?[]:o,Ue===!0,E,O,T,Y,L,Qt,d,e.patchRoutesOnNavigation!=null,Ve);if(W=++X,!e.dataStrategy&&!St.some(dt=>dt.shouldLoad)&&xt.length===0){let dt=Kt();return Ee(re,{matches:de,loaderData:{},errors:Ve&&Zo(Ve[1])?{[Ve[0]]:Ve[1].error}:null,...eY(Ve),...dt?{fetchers:new Map(j.fetchers)}:{}},{flushSync:Qe}),{shortCircuited:!0}}if(Bt){let dt={};if(!Ce){dt.navigation=tt;let qn=We(Ve);qn!==void 0&&(dt.actionData=qn)}xt.length>0&&(dt.fetchers=Le(xt)),ke(dt,{flushSync:Qe})}xt.forEach(dt=>{ft(dt.key),dt.controller&&P.set(dt.key,dt.controller)});let nr=()=>xt.forEach(dt=>ft(dt.key));U&&U.signal.addEventListener("abort",nr);let{loaderResults:to,fetcherResults:bo}=await so(St,xt,ee,xe);if(ee.signal.aborted)return{shortCircuited:!0};U&&U.signal.removeEventListener("abort",nr),xt.forEach(dt=>P.delete(dt.key));let no=Zy(to);if(no)return await wn(ee,no.result,!0,{replace:Fe}),{shortCircuited:!0};if(no=Zy(bo),no)return L.add(no.key),await wn(ee,no.result,!0,{replace:Fe}),{shortCircuited:!0};let{loaderData:or,errors:ar}=QZ(j,de,to,Ve,xt,bo);Ue&&j.errors&&(ar={...j.errors,...ar});let Vs=Kt(),Mo=bn(W),ja=Vs||Mo||xt.length>0;return{matches:de,loaderData:or,errors:ar,...ja?{fetchers:new Map(j.fetchers)}:{}}}function We(ee){if(ee&&!Zo(ee[1]))return{[ee[0]]:ee[1].data};if(j.actionData)return Object.keys(j.actionData).length===0?null:j.actionData}function Le(ee){return ee.forEach(re=>{let de=j.fetchers.get(re.key),xe=kf(void 0,de?de.data:void 0);j.fetchers.set(re.key,xe)}),new Map(j.fetchers)}async function Rt(ee,re,de,xe){ft(ee);let Ce=(xe&&xe.flushSync)===!0,Pe=l||s,Ke=Aq(j.location,j.matches,d,de,re,xe==null?void 0:xe.relative),Re=rs(Pe,Ke,d),Fe=Pr(Re,Pe,Ke);if(Fe.active&&Fe.matches&&(Re=Fe.matches),!Re){be(ee,re,ma(404,{pathname:Ke}),{flushSync:Ce});return}let{path:Ue,submission:Qe,error:Ve}=FZ(!0,Ke,xe);if(Ve){be(ee,re,Ve,{flushSync:Ce});return}let tt=Pf(Re,Ue),Mt=new VZ(e.unstable_getContext?await e.unstable_getContext():void 0),Bt=(xe&&xe.preventScrollReset)===!0;if(Qe&&Yo(Qe.formMethod)){await eo(ee,re,Ue,tt,Re,Mt,Fe.active,Ce,Bt,Qe);return}Y.set(ee,{routeId:re,path:Ue}),await An(ee,re,Ue,tt,Re,Mt,Fe.active,Ce,Bt,Qe)}async function eo(ee,re,de,xe,Ce,Pe,Ke,Re,Fe,Ue){wo(),Y.delete(ee);function Qe(zt){if(!zt.route.action&&!zt.route.lazy){let xi=ma(405,{method:Ue.formMethod,pathname:de,routeId:re});return be(ee,re,xi,{flushSync:Re}),!0}return!1}if(!Ke&&Qe(xe))return;let Ve=j.fetchers.get(ee);fe(ee,d2e(Ue,Ve),{flushSync:Re});let tt=new AbortController,Mt=dh(e.history,de,tt.signal,Ue);if(Ke){let zt=await $r(Ce,de,Mt.signal,ee);if(zt.type==="aborted")return;if(zt.type==="error"){be(ee,re,zt.error,{flushSync:Re});return}else if(zt.matches){if(Ce=zt.matches,xe=Pf(Ce,de),Qe(xe))return}else{be(ee,re,ma(404,{pathname:de}),{flushSync:Re});return}}P.set(ee,tt);let Bt=X,Qt=Mh(a,i,Mt,Ce,xe,o,Pe),xt=(await On(Mt,Qt,Pe,ee))[xe.route.id];if(Mt.signal.aborted){P.get(ee)===tt&&P.delete(ee);return}if(T.has(ee)){if(Pd(xt)||Zo(xt)){fe(ee,Xi(void 0));return}}else{if(Pd(xt))if(P.delete(ee),W>Bt){fe(ee,Xi(void 0));return}else return L.add(ee),fe(ee,kf(Ue)),wn(Mt,xt,!1,{fetcherSubmission:Ue,preventScrollReset:Fe});if(Zo(xt)){be(ee,re,xt.error);return}}let nr=j.navigation.location||j.location,to=dh(e.history,nr,tt.signal),bo=l||s,no=j.navigation.state!=="idle"?rs(bo,j.navigation.location,d):j.matches;vt(no,"Didn't find any matches after fetcher action");let or=++X;V.set(ee,or);let ar=kf(Ue,xt.data);j.fetchers.set(ee,ar);let{dsMatches:Vs,revalidatingFetchers:Mo}=UZ(to,Pe,a,i,e.history,j,no,Ue,nr,o,!1,E,O,T,Y,L,bo,d,e.patchRoutesOnNavigation!=null,[xe.route.id,xt]);Mo.filter(zt=>zt.key!==ee).forEach(zt=>{let xi=zt.key,w2=j.fetchers.get(xi),_o=kf(void 0,w2?w2.data:void 0);j.fetchers.set(xi,_o),ft(xi),zt.controller&&P.set(xi,zt.controller)}),ke({fetchers:new Map(j.fetchers)});let ja=()=>Mo.forEach(zt=>ft(zt.key));tt.signal.addEventListener("abort",ja);let{loaderResults:dt,fetcherResults:qn}=await so(Vs,Mo,to,Pe);if(tt.signal.aborted)return;if(tt.signal.removeEventListener("abort",ja),V.delete(ee),P.delete(ee),Mo.forEach(zt=>P.delete(zt.key)),j.fetchers.has(ee)){let zt=Xi(xt.data);j.fetchers.set(ee,zt)}let Do=Zy(dt);if(Do)return wn(to,Do.result,!1,{preventScrollReset:Fe});if(Do=Zy(qn),Do)return L.add(Do.key),wn(to,Do.result,!1,{preventScrollReset:Fe});let{loaderData:zo,errors:Dr}=QZ(j,no,dt,void 0,Mo,qn);bn(or),j.navigation.state==="loading"&&or>W?(vt(D,"Expected pending action"),U&&U.abort(),Ee(j.navigation.location,{matches:no,loaderData:zo,errors:Dr,fetchers:new Map(j.fetchers)})):(ke({errors:Dr,loaderData:JZ(j.loaderData,zo,no,Dr),fetchers:new Map(j.fetchers)}),E=!1)}async function An(ee,re,de,xe,Ce,Pe,Ke,Re,Fe,Ue){let Qe=j.fetchers.get(ee);fe(ee,kf(Ue,Qe?Qe.data:void 0),{flushSync:Re});let Ve=new AbortController,tt=dh(e.history,de,Ve.signal);if(Ke){let xt=await $r(Ce,de,tt.signal,ee);if(xt.type==="aborted")return;if(xt.type==="error"){be(ee,re,xt.error,{flushSync:Re});return}else if(xt.matches)Ce=xt.matches,xe=Pf(Ce,de);else{be(ee,re,ma(404,{pathname:de}),{flushSync:Re});return}}P.set(ee,Ve);let Mt=X,Bt=Mh(a,i,tt,Ce,xe,o,Pe),St=(await On(tt,Bt,Pe,ee))[xe.route.id];if(P.get(ee)===Ve&&P.delete(ee),!tt.signal.aborted){if(T.has(ee)){fe(ee,Xi(void 0));return}if(Pd(St))if(W>Mt){fe(ee,Xi(void 0));return}else{L.add(ee),await wn(tt,St,!1,{preventScrollReset:Fe});return}if(Zo(St)){be(ee,re,St.error);return}fe(ee,Xi(St.data))}}async function wn(ee,re,de,{submission:xe,fetcherSubmission:Ce,preventScrollReset:Pe,replace:Ke}={}){re.response.headers.has("X-Remix-Revalidate")&&(E=!0);let Re=re.response.headers.get("Location");vt(Re,"Expected a Location header on the redirect Response"),Re=WZ(Re,new URL(ee.url),d);let Fe=T0(j.location,Re,{_isRedirect:!0});if(n){let Bt=!1;if(re.response.headers.has("X-Remix-Reload-Document"))Bt=!0;else if(mV.test(Re)){const Qt=wJ(Re,!0);Bt=Qt.origin!==t.location.origin||Ma(Qt.pathname,d)==null}if(Bt){Ke?t.location.replace(Re):t.location.assign(Re);return}}U=null;let Ue=Ke===!0||re.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Qe,formAction:Ve,formEncType:tt}=j.navigation;!xe&&!Ce&&Qe&&Ve&&tt&&(xe=oY(j.navigation));let Mt=xe||Ce;if(Xhe.has(re.response.status)&&Mt&&Yo(Mt.formMethod))await qe(Ue,Fe,{submission:{...Mt,formAction:Re},preventScrollReset:Pe||H,enableViewTransition:de?z:void 0});else{let Bt=oO(Fe,xe);await qe(Ue,Fe,{overrideNavigation:Bt,fetcherSubmission:Ce,preventScrollReset:Pe||H,enableViewTransition:de?z:void 0})}}async function On(ee,re,de,xe){let Ce,Pe={};try{Ce=await n2e(h,ee,re,xe,de,!1)}catch(Ke){return re.filter(Re=>Re.shouldLoad).forEach(Re=>{Pe[Re.route.id]={type:"error",error:Ke}}),Pe}if(ee.signal.aborted)return Pe;for(let[Ke,Re]of Object.entries(Ce))if(c2e(Re)){let Fe=Re.result;Pe[Ke]={type:"redirect",response:r2e(Fe,ee,Ke,re,d)}}else Pe[Ke]=await a2e(Re);return Pe}async function so(ee,re,de,xe){let Ce=On(de,ee,xe,null),Pe=Promise.all(re.map(async Fe=>{if(Fe.matches&&Fe.match&&Fe.request&&Fe.controller){let Qe=(await On(Fe.request,Fe.matches,xe,Fe.key))[Fe.match.route.id];return{[Fe.key]:Qe}}else return Promise.resolve({[Fe.key]:{type:"error",error:ma(404,{pathname:Fe.path})}})})),Ke=await Ce,Re=(await Pe).reduce((Fe,Ue)=>Object.assign(Fe,Ue),{});return{loaderResults:Ke,fetcherResults:Re}}function wo(){E=!0,Y.forEach((ee,re)=>{P.has(re)&&O.add(re),ft(re)})}function fe(ee,re,de={}){j.fetchers.set(ee,re),ke({fetchers:new Map(j.fetchers)},{flushSync:(de&&de.flushSync)===!0})}function be(ee,re,de,xe={}){let Ce=Rd(j.matches,re);He(ee),ke({errors:{[Ce.route.id]:de},fetchers:new Map(j.fetchers)},{flushSync:(xe&&xe.flushSync)===!0})}function Oe(ee){return F.set(ee,(F.get(ee)||0)+1),T.has(ee)&&T.delete(ee),j.fetchers.get(ee)||Zhe}function He(ee){let re=j.fetchers.get(ee);P.has(ee)&&!(re&&re.state==="loading"&&V.has(ee))&&ft(ee),Y.delete(ee),V.delete(ee),L.delete(ee),T.delete(ee),O.delete(ee),j.fetchers.delete(ee)}function kt(ee){let re=(F.get(ee)||0)-1;re<=0?(F.delete(ee),T.add(ee)):F.set(ee,re),ke({fetchers:new Map(j.fetchers)})}function ft(ee){let re=P.get(ee);re&&(re.abort(),P.delete(ee))}function tn(ee){for(let re of ee){let de=Oe(re),xe=Xi(de.data);j.fetchers.set(re,xe)}}function Kt(){let ee=[],re=!1;for(let de of L){let xe=j.fetchers.get(de);vt(xe,`Expected fetcher: ${de}`),xe.state==="loading"&&(L.delete(de),ee.push(de),re=!0)}return tn(ee),re}function bn(ee){let re=[];for(let[de,xe]of V)if(xe<ee){let Ce=j.fetchers.get(de);vt(Ce,`Expected fetcher: ${de}`),Ce.state==="loading"&&(ft(de),V.delete(de),re.push(de))}return tn(re),re.length>0}function rn(ee,re){let de=j.blockers.get(ee)||vf;return K.get(ee)!==re&&K.set(ee,re),de}function At(ee){j.blockers.delete(ee),K.delete(ee)}function Dt(ee,re){let de=j.blockers.get(ee)||vf;vt(de.state==="unblocked"&&re.state==="blocked"||de.state==="blocked"&&re.state==="blocked"||de.state==="blocked"&&re.state==="proceeding"||de.state==="blocked"&&re.state==="unblocked"||de.state==="proceeding"&&re.state==="unblocked",`Invalid blocker state transition: ${de.state} -> ${re.state}`);let xe=new Map(j.blockers);xe.set(ee,re),ke({blockers:xe})}function En({currentLocation:ee,nextLocation:re,historyAction:de}){if(K.size===0)return;K.size>1&&Cn(!1,"A router only supports one blocker at a time");let xe=Array.from(K.entries()),[Ce,Pe]=xe[xe.length-1],Ke=j.blockers.get(Ce);if(!(Ke&&Ke.state==="proceeding")&&Pe({currentLocation:ee,nextLocation:re,historyAction:de}))return Ce}function Qa(ee){let re=ma(404,{pathname:ee}),de=l||s,{matches:xe,route:Ce}=tY(de);return{notFoundMatches:xe,route:Ce,error:re}}function Ja(ee,re,de){if(x=ee,b=re,M=de||null,!C&&j.navigation===nO){C=!0;let xe=ra(j.location,j.matches);xe!=null&&ke({restoreScrollPosition:xe})}return()=>{x=null,b=null,M=null}}function er(ee,re){return M&&M(ee,re.map(xe=>She(xe,j.loaderData)))||ee.key}function tr(ee,re){if(x&&b){let de=er(ee,re);x[de]=b()}}function ra(ee,re){if(x){let de=er(ee,re),xe=x[de];if(typeof xe=="number")return xe}return null}function Pr(ee,re,de){if(e.patchRoutesOnNavigation)if(ee){if(Object.keys(ee[0].params).length>0)return{active:!0,matches:Lm(re,de,d,!0)}}else return{active:!0,matches:Lm(re,de,d,!0)||[]};return{active:!1,matches:null}}async function $r(ee,re,de,xe){if(!e.patchRoutesOnNavigation)return{type:"success",matches:ee};let Ce=ee;for(;;){let Pe=l==null,Ke=l||s,Re=i;try{await e.patchRoutesOnNavigation({signal:de,path:re,matches:Ce,fetcherKey:xe,patch:(Qe,Ve)=>{de.aborted||GZ(Qe,Ve,Ke,Re,a)}})}catch(Qe){return{type:"error",error:Qe,partialMatches:Ce}}finally{Pe&&!de.aborted&&(s=[...s])}if(de.aborted)return{type:"aborted"};let Fe=rs(Ke,re,d);if(Fe)return{type:"success",matches:Fe};let Ue=Lm(Ke,re,d,!0);if(!Ue||Ce.length===Ue.length&&Ce.every((Qe,Ve)=>Qe.route.id===Ue[Ve].route.id))return{type:"success",matches:null};Ce=Ue}}function qs(ee){i={},l=zR(ee,a,void 0,i)}function Hs(ee,re){let de=l==null;GZ(ee,re,l||s,i,a),de&&(s=[...s],ke({}))}return R={get basename(){return d},get future(){return p},get state(){return j},get routes(){return s},get window(){return t},initialize:te,subscribe:me,enableScrollRestoration:Ja,navigate:Ie,fetch:Rt,revalidate:Te,createHref:ee=>e.history.createHref(ee),encodeLocation:ee=>e.history.encodeLocation(ee),getFetcher:Oe,deleteFetcher:kt,dispose:ce,getBlocker:rn,deleteBlocker:At,patchRoutes:Hs,_internalFetchControllers:P,_internalSetRoutes:qs},R}function Khe(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Aq(e,t,n,o,a,i){let s,l;if(a){s=[];for(let h of t)if(s.push(h),h.route.id===a){l=h;break}}else s=t,l=t[t.length-1];let d=MP(o||".",bP(s),Ma(e.pathname,n)||e.pathname,i==="path");if(o==null&&(d.search=e.search,d.hash=e.hash),(o==null||o===""||o===".")&&l){let h=gV(d.search);if(l.route.index&&!h)d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index";else if(!l.route.index&&h){let p=new URLSearchParams(d.search),m=p.getAll("index");p.delete("index"),m.filter(x=>x).forEach(x=>p.append("index",x));let v=p.toString();d.search=v?`?${v}`:""}}return n!=="/"&&(d.pathname=d.pathname==="/"?n:kr([n,d.pathname])),Ss(d)}function FZ(e,t,n){if(!n||!Khe(n))return{path:t};if(n.formMethod&&!l2e(n.formMethod))return{path:t,error:ma(405,{method:n.formMethod})};let o=()=>({path:t,error:ma(400,{type:"invalid-body"})}),i=(n.formMethod||"get").toUpperCase(),s=TJ(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Yo(i))return o();let m=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((v,[x,M])=>`${v}${x}=${M}
59
59
  `,""):String(n.body);return{path:t,submission:{formMethod:i,formAction:s,formEncType:n.formEncType,formData:void 0,json:void 0,text:m}}}else if(n.formEncType==="application/json"){if(!Yo(i))return o();try{let m=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:s,formEncType:n.formEncType,formData:void 0,json:m,text:void 0}}}catch{return o()}}}vt(typeof FormData=="function","FormData is not available in this environment");let l,d;if(n.formData)l=Tq(n.formData),d=n.formData;else if(n.body instanceof FormData)l=Tq(n.body),d=n.body;else if(n.body instanceof URLSearchParams)l=n.body,d=KZ(l);else if(n.body==null)l=new URLSearchParams,d=new FormData;else try{l=new URLSearchParams(n.body),d=KZ(l)}catch{return o()}let h={formMethod:i,formAction:s,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:d,json:void 0,text:void 0};if(Yo(h.formMethod))return{path:t,submission:h};let p=Is(t);return e&&p.search&&gV(p.search)&&l.append("index",""),p.search=`?${l}`,{path:Ss(p),submission:h}}function UZ(e,t,n,o,a,i,s,l,d,h,p,m,v,x,M,b,C,_,N,A){var G;let I=A?Zo(A[1])?A[1].error:A[1].data:void 0,R=a.createURL(i.location),j=a.createURL(d),D;if(p&&i.errors){let E=Object.keys(i.errors)[0];D=s.findIndex(O=>O.route.id===E)}else if(A&&Zo(A[1])){let E=A[0];D=s.findIndex(O=>O.route.id===E)-1}let H=A?A[1].statusCode:void 0,U=H&&H>=400,z={currentUrl:R,currentParams:((G=i.matches[0])==null?void 0:G.params)||{},nextUrl:j,nextParams:s[0].params,...l,actionResult:I,actionStatus:H},Z=s.map((E,O)=>{let{route:P}=E,X=null;if(D!=null&&O>D?X=!1:P.lazy?X=!0:P.loader==null?X=!1:p?X=Eq(P,i.loaderData,i.errors):Qhe(i.loaderData,i.matches[O],E)&&(X=!0),X!==null)return Iq(n,o,e,E,h,t,X);let W=U?!1:m||R.pathname+R.search===j.pathname+j.search||R.search!==j.search||Jhe(i.matches[O],E),V={...z,defaultShouldRevalidate:W},L=HR(E,V);return Iq(n,o,e,E,h,t,L,V)}),q=[];return M.forEach((E,O)=>{if(p||!s.some(T=>T.route.id===E.routeId)||x.has(O))return;let P=i.fetchers.get(O),X=P&&P.state!=="idle"&&P.data===void 0,W=rs(C,E.path,_);if(!W){if(N&&X)return;q.push({key:O,routeId:E.routeId,path:E.path,matches:null,match:null,request:null,controller:null});return}if(b.has(O))return;let V=Pf(W,E.path),L=new AbortController,Y=dh(a,E.path,L.signal),F=null;if(v.has(O))v.delete(O),F=Mh(n,o,Y,W,V,h,t);else if(X)m&&(F=Mh(n,o,Y,W,V,h,t));else{let T={...z,defaultShouldRevalidate:U?!1:m};HR(V,T)&&(F=Mh(n,o,Y,W,V,h,t,T))}F&&q.push({key:O,routeId:E.routeId,path:E.path,matches:F,match:V,request:Y,controller:L})}),{dsMatches:Z,revalidatingFetchers:q}}function Eq(e,t,n){if(e.lazy)return!0;if(!e.loader)return!1;let o=t!=null&&e.id in t,a=n!=null&&n[e.id]!==void 0;return!o&&a?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!o&&!a}function Qhe(e,t,n){let o=!t||n.route.id!==t.route.id,a=!e.hasOwnProperty(n.route.id);return o||a}function Jhe(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function HR(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function GZ(e,t,n,o,a){let i;if(e){let d=o[e];vt(d,`No route found to patch children into: routeId = ${e}`),d.children||(d.children=[]),i=d.children}else i=n;let s=t.filter(d=>!i.some(h=>LJ(d,h))),l=zR(s,a,[e||"_","patch",String((i==null?void 0:i.length)||"0")],o);i.push(...l)}function LJ(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((n,o)=>{var a;return(a=t.children)==null?void 0:a.some(i=>LJ(n,i))}):!1}var XZ=new WeakMap,jJ=({key:e,route:t,manifest:n,mapRouteProperties:o})=>{let a=n[t.id];if(vt(a,"No route found in manifest"),!a.lazy||typeof a.lazy!="object")return;let i=a.lazy[e];if(!i)return;let s=XZ.get(a);s||(s={},XZ.set(a,s));let l=s[e];if(l)return l;let d=(async()=>{let h=whe(e),m=a[e]!==void 0&&e!=="hasErrorBoundary";if(h)Cn(!h,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),s[e]=Promise.resolve();else if(m)Cn(!1,`Route "${a.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let v=await i();v!=null&&(Object.assign(a,{[e]:v}),Object.assign(a,o(a)))}typeof a.lazy=="object"&&(a.lazy[e]=void 0,Object.values(a.lazy).every(v=>v===void 0)&&(a.lazy=void 0))})();return s[e]=d,d},ZZ=new WeakMap;function e2e(e,t,n,o,a){let i=n[e.id];if(vt(i,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let p=ZZ.get(i);if(p)return{lazyRoutePromise:p,lazyHandlerPromise:p};let m=(async()=>{vt(typeof e.lazy=="function","No lazy route function found");let v=await e.lazy(),x={};for(let M in v){let b=v[M];if(b===void 0)continue;let C=Mhe(M),N=i[M]!==void 0&&M!=="hasErrorBoundary";C?Cn(!C,"Route property "+M+" is not a supported property to be returned from a lazy route function. This property will be ignored."):N?Cn(!N,`Route "${i.id}" has a static property "${M}" defined but its lazy function is also returning a value for this property. The lazy route property "${M}" will be ignored.`):x[M]=b}Object.assign(i,x),Object.assign(i,{...o(i),lazy:void 0})})();return ZZ.set(i,m),m.catch(()=>{}),{lazyRoutePromise:m,lazyHandlerPromise:m}}let s=Object.keys(e.lazy),l=[],d;for(let p of s){if(a&&a.includes(p))continue;let m=jJ({key:p,route:e,manifest:n,mapRouteProperties:o});m&&(l.push(m),p===t&&(d=m))}let h=l.length>0?Promise.all(l).then(()=>{}):void 0;return h==null||h.catch(()=>{}),d==null||d.catch(()=>{}),{lazyRoutePromise:h,lazyHandlerPromise:d}}async function YZ(e){let t=e.matches.filter(a=>a.shouldLoad),n={};return(await Promise.all(t.map(a=>a.resolve()))).forEach((a,i)=>{n[t[i].route.id]=a}),n}async function t2e(e){return e.matches.some(t=>t.route.unstable_middleware)?AJ(e,!1,()=>YZ(e),(t,n)=>({[n]:{type:"error",result:t}})):YZ(e)}async function AJ(e,t,n,o){let{matches:a,request:i,params:s,context:l}=e,d={handlerResult:void 0};try{let h=a.flatMap(m=>m.route.unstable_middleware?m.route.unstable_middleware.map(v=>[m.route.id,v]):[]),p=await EJ({request:i,params:s,context:l},h,t,d,n);return t?p:d.handlerResult}catch(h){if(!d.middlewareError)throw h;let p=await o(d.middlewareError.error,d.middlewareError.routeId);return d.handlerResult?Object.assign(d.handlerResult,p):p}}async function EJ(e,t,n,o,a,i=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason?s.signal.reason:new Error(`Request aborted without an \`AbortSignal.reason\`: ${s.method} ${s.url}`);let l=t[i];if(!l)return o.handlerResult=await a(),o.handlerResult;let[d,h]=l,p=!1,m,v=async()=>{if(p)throw new Error("You may only call `next()` once per middleware");p=!0,await EJ(e,t,n,o,a,i+1)};try{let x=await h({request:e.request,params:e.params,context:e.context},v);return p?x===void 0?m:x:v()}catch(x){throw o.middlewareError?o.middlewareError.error!==x&&(o.middlewareError={routeId:d,error:x}):o.middlewareError={routeId:d,error:x},x}}function IJ(e,t,n,o,a){let i=jJ({key:"unstable_middleware",route:o.route,manifest:t,mapRouteProperties:e}),s=e2e(o.route,Yo(n.method)?"action":"loader",t,e,a);return{middleware:i,route:s.lazyRoutePromise,handler:s.lazyHandlerPromise}}function Iq(e,t,n,o,a,i,s,l=null){let d=!1,h=IJ(e,t,n,o,a);return{...o,_lazyPromises:h,shouldLoad:s,unstable_shouldRevalidateArgs:l,unstable_shouldCallHandler(p){return d=!0,l?typeof p=="boolean"?HR(o,{...l,defaultShouldRevalidate:p}):HR(o,l):s},resolve(p){return d||s||p&&n.method==="GET"&&(o.route.lazy||o.route.loader)?o2e({request:n,match:o,lazyHandlerPromise:h==null?void 0:h.handler,lazyRoutePromise:h==null?void 0:h.route,handlerOverride:p,scopedContext:i}):Promise.resolve({type:"data",result:void 0})}}}function Mh(e,t,n,o,a,i,s,l=null){return o.map(d=>d.route.id!==a.route.id?{...d,shouldLoad:!1,unstable_shouldRevalidateArgs:l,unstable_shouldCallHandler:()=>!1,_lazyPromises:IJ(e,t,n,d,i),resolve:()=>Promise.resolve({type:"data",result:void 0})}:Iq(e,t,n,d,i,s,!0,l))}async function n2e(e,t,n,o,a,i){n.some(h=>{var p;return(p=h._lazyPromises)==null?void 0:p.middleware})&&await Promise.all(n.map(h=>{var p;return(p=h._lazyPromises)==null?void 0:p.middleware}));let s={request:t,params:n[0].params,context:a,matches:n},d=await e({...s,fetcherKey:o,unstable_runClientMiddleware:h=>{let p=s;return AJ(p,!1,()=>h({...p,fetcherKey:o,unstable_runClientMiddleware:()=>{throw new Error("Cannot call `unstable_runClientMiddleware()` from within an `unstable_runClientMiddleware` handler")}}),(m,v)=>({[v]:{type:"error",result:m}}))}});try{await Promise.all(n.flatMap(h=>{var p,m;return[(p=h._lazyPromises)==null?void 0:p.handler,(m=h._lazyPromises)==null?void 0:m.route]}))}catch{}return d}async function o2e({request:e,match:t,lazyHandlerPromise:n,lazyRoutePromise:o,handlerOverride:a,scopedContext:i}){let s,l,d=Yo(e.method),h=d?"action":"loader",p=m=>{let v,x=new Promise((C,_)=>v=_);l=()=>v(),e.signal.addEventListener("abort",l);let M=C=>typeof m!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${h}" [routeId: ${t.route.id}]`)):m({request:e,params:t.params,context:i},...C!==void 0?[C]:[]),b=(async()=>{try{return{type:"data",result:await(a?a(_=>M(_)):M())}}catch(C){return{type:"error",result:C}}})();return Promise.race([b,x])};try{let m=d?t.route.action:t.route.loader;if(n||o)if(m){let v,[x]=await Promise.all([p(m).catch(M=>{v=M}),n,o]);if(v!==void 0)throw v;s=x}else{await n;let v=d?t.route.action:t.route.loader;if(v)[s]=await Promise.all([p(v),o]);else if(h==="action"){let x=new URL(e.url),M=x.pathname+x.search;throw ma(405,{method:e.method,pathname:M,routeId:t.route.id})}else return{type:"data",result:void 0}}else if(m)s=await p(m);else{let v=new URL(e.url),x=v.pathname+v.search;throw ma(404,{pathname:x})}}catch(m){return{type:"error",result:m}}finally{l&&e.signal.removeEventListener("abort",l)}return s}async function a2e(e){var o,a,i,s,l,d;let{result:t,type:n}=e;if(RJ(t)){let h;try{let p=t.headers.get("Content-Type");p&&/\bapplication\/json\b/.test(p)?t.body==null?h=null:h=await t.json():h=await t.text()}catch(p){return{type:"error",error:p}}return n==="error"?{type:"error",error:new qR(t.status,t.statusText,h),statusCode:t.status,headers:t.headers}:{type:"data",data:h,statusCode:t.status,headers:t.headers}}return n==="error"?nY(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:(o=t.init)==null?void 0:o.status,headers:(a=t.init)!=null&&a.headers?new Headers(t.init.headers):void 0}:{type:"error",error:new qR(((i=t.init)==null?void 0:i.status)||500,void 0,t.data),statusCode:R0(t)?t.status:void 0,headers:(s=t.init)!=null&&s.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:R0(t)?t.status:void 0}:nY(t)?{type:"data",data:t.data,statusCode:(l=t.init)==null?void 0:l.status,headers:(d=t.init)!=null&&d.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function r2e(e,t,n,o,a){let i=e.headers.get("Location");if(vt(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!mV.test(i)){let s=o.slice(0,o.findIndex(l=>l.route.id===n)+1);i=Aq(new URL(t.url),s,a,i),e.headers.set("Location",i)}return e}function WZ(e,t,n){if(mV.test(e)){let o=e,a=o.startsWith("//")?new URL(t.protocol+o):new URL(o),i=Ma(a.pathname,n)!=null;if(a.origin===t.origin&&i)return a.pathname+a.search+a.hash}return e}function dh(e,t,n,o){let a=e.createURL(TJ(t)).toString(),i={signal:n};if(o&&Yo(o.formMethod)){let{formMethod:s,formEncType:l}=o;i.method=s.toUpperCase(),l==="application/json"?(i.headers=new Headers({"Content-Type":l}),i.body=JSON.stringify(o.json)):l==="text/plain"?i.body=o.text:l==="application/x-www-form-urlencoded"&&o.formData?i.body=Tq(o.formData):i.body=o.formData}return new Request(a,i)}function Tq(e){let t=new URLSearchParams;for(let[n,o]of e.entries())t.append(n,typeof o=="string"?o:o.name);return t}function KZ(e){let t=new FormData;for(let[n,o]of e.entries())t.append(n,o);return t}function i2e(e,t,n,o=!1,a=!1){let i={},s=null,l,d=!1,h={},p=n&&Zo(n[1])?n[1].error:void 0;return e.forEach(m=>{if(!(m.route.id in t))return;let v=m.route.id,x=t[v];if(vt(!Pd(x),"Cannot handle redirect results in processLoaderData"),Zo(x)){let M=x.error;if(p!==void 0&&(M=p,p=void 0),s=s||{},a)s[v]=M;else{let b=Rd(e,v);s[b.route.id]==null&&(s[b.route.id]=M)}o||(i[v]=NJ),d||(d=!0,l=R0(x.error)?x.error.status:500),x.headers&&(h[v]=x.headers)}else i[v]=x.data,x.statusCode&&x.statusCode!==200&&!d&&(l=x.statusCode),x.headers&&(h[v]=x.headers)}),p!==void 0&&n&&(s={[n[0]]:p},n[2]&&(i[n[2]]=void 0)),{loaderData:i,errors:s,statusCode:l||200,loaderHeaders:h}}function QZ(e,t,n,o,a,i){let{loaderData:s,errors:l}=i2e(t,n,o);return a.filter(d=>!d.matches||d.matches.some(h=>h.shouldLoad)).forEach(d=>{let{key:h,match:p,controller:m}=d,v=i[h];if(vt(v,"Did not find corresponding fetcher result"),!(m&&m.signal.aborted))if(Zo(v)){let x=Rd(e.matches,p==null?void 0:p.route.id);l&&l[x.route.id]||(l={...l,[x.route.id]:v.error}),e.fetchers.delete(h)}else if(Pd(v))vt(!1,"Unhandled fetcher revalidation redirect");else{let x=Xi(v.data);e.fetchers.set(h,x)}}),{loaderData:s,errors:l}}function JZ(e,t,n,o){let a=Object.entries(t).filter(([,i])=>i!==NJ).reduce((i,[s,l])=>(i[s]=l,i),{});for(let i of n){let s=i.route.id;if(!t.hasOwnProperty(s)&&e.hasOwnProperty(s)&&i.route.loader&&(a[s]=e[s]),o&&o.hasOwnProperty(s))break}return a}function eY(e){return e?Zo(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Rd(e,t){return(t?e.slice(0,e.findIndex(o=>o.route.id===t)+1):[...e]).reverse().find(o=>o.route.hasErrorBoundary===!0)||e[0]}function tY(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function ma(e,{pathname:t,routeId:n,method:o,type:a,message:i}={}){let s="Unknown Server Error",l="Unknown @remix-run/router error";return e===400?(s="Bad Request",o&&t&&n?l=`You made a ${o} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:a==="invalid-body"&&(l="Unable to encode submission body")):e===403?(s="Forbidden",l=`Route "${n}" does not match URL "${t}"`):e===404?(s="Not Found",l=`No route matches URL "${t}"`):e===405&&(s="Method Not Allowed",o&&t&&n?l=`You made a ${o.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:o&&(l=`Invalid request method "${o.toUpperCase()}"`)),new qR(e||500,s,new Error(l),!0)}function Zy(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[o,a]=t[n];if(Pd(a))return{key:o,result:a}}}function TJ(e){let t=typeof e=="string"?Is(e):e;return Ss({...t,hash:""})}function s2e(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function c2e(e){return RJ(e.result)&&Ghe.has(e.result.status)}function Zo(e){return e.type==="error"}function Pd(e){return(e&&e.type)==="redirect"}function nY(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function RJ(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function l2e(e){return Uhe.has(e.toUpperCase())}function Yo(e){return Bhe.has(e.toUpperCase())}function gV(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Pf(e,t){let n=typeof t=="string"?Is(t).search:t.search;if(e[e.length-1].route.index&&gV(n||""))return e[e.length-1];let o=_J(e);return o[o.length-1]}function oY(e){let{formMethod:t,formAction:n,formEncType:o,text:a,formData:i,json:s}=e;if(!(!t||!n||!o)){if(a!=null)return{formMethod:t,formAction:n,formEncType:o,formData:void 0,json:void 0,text:a};if(i!=null)return{formMethod:t,formAction:n,formEncType:o,formData:i,json:void 0,text:void 0};if(s!==void 0)return{formMethod:t,formAction:n,formEncType:o,formData:void 0,json:s,text:void 0}}}function oO(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function u2e(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function kf(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function d2e(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Xi(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function h2e(e,t){try{let n=e.sessionStorage.getItem(CJ);if(n){let o=JSON.parse(n);for(let[a,i]of Object.entries(o||{}))i&&Array.isArray(i)&&t.set(a,new Set(i||[]))}}catch{}}function f2e(e,t){if(t.size>0){let n={};for(let[o,a]of t)n[o]=[...a];try{e.sessionStorage.setItem(CJ,JSON.stringify(n))}catch(o){Cn(!1,`Failed to save applied view transitions in sessionStorage (${o}).`)}}}function p2e(){let e,t,n=new Promise((o,a)=>{e=async i=>{o(i);try{await n}catch{}},t=async i=>{a(i);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var h1=k.createContext(null);h1.displayName="DataRouter";var cp=k.createContext(null);cp.displayName="DataRouterState";var vV=k.createContext({isTransitioning:!1});vV.displayName="ViewTransition";var PJ=k.createContext(new Map);PJ.displayName="Fetchers";var y2e=k.createContext(null);y2e.displayName="Await";var Za=k.createContext(null);Za.displayName="Navigation";var _P=k.createContext(null);_P.displayName="Location";var _a=k.createContext({outlet:null,matches:[],isDataRoute:!1});_a.displayName="Route";var kV=k.createContext(null);kV.displayName="RouteError";function m2e(e,{relative:t}={}){vt(o2(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:o}=k.useContext(Za),{hash:a,pathname:i,search:s}=lp(e,{relative:t}),l=i;return n!=="/"&&(l=i==="/"?n:kr([n,i])),o.createHref({pathname:l,search:s,hash:a})}function o2(){return k.useContext(_P)!=null}function Er(){return vt(o2(),"useLocation() may be used only in the context of a <Router> component."),k.useContext(_P).location}var $J="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function DJ(e){k.useContext(Za).static||k.useLayoutEffect(e)}function aa(){let{isDataRoute:e}=k.useContext(_a);return e?E2e():g2e()}function g2e(){vt(o2(),"useNavigate() may be used only in the context of a <Router> component.");let e=k.useContext(h1),{basename:t,navigator:n}=k.useContext(Za),{matches:o}=k.useContext(_a),{pathname:a}=Er(),i=JSON.stringify(bP(o)),s=k.useRef(!1);return DJ(()=>{s.current=!0}),k.useCallback((d,h={})=>{if(Cn(s.current,$J),!s.current)return;if(typeof d=="number"){n.go(d);return}let p=MP(d,JSON.parse(i),a,h.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:kr([t,p.pathname])),(h.replace?n.replace:n.push)(p,h.state,h)},[t,n,i,a,e])}var v2e=k.createContext(null);function k2e(e){let t=k.useContext(_a).outlet;return t&&k.createElement(v2e.Provider,{value:e},t)}function gi(){let{matches:e}=k.useContext(_a),t=e[e.length-1];return t?t.params:{}}function lp(e,{relative:t}={}){let{matches:n}=k.useContext(_a),{pathname:o}=Er(),a=JSON.stringify(bP(n));return k.useMemo(()=>MP(e,JSON.parse(a),o,t==="path"),[e,a,o,t])}function x2e(e,t,n,o){vt(o2(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=k.useContext(Za),{matches:i}=k.useContext(_a),s=i[i.length-1],l=s?s.params:{},d=s?s.pathname:"/",h=s?s.pathnameBase:"/",p=s&&s.route;{let _=p&&p.path||"";zJ(d,!p||_.endsWith("*")||_.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${_}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
60
60
 
61
61
  Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}/*`}">.`)}let m=Er(),v;v=m;let x=v.pathname||"/",M=x;if(h!=="/"){let _=h.replace(/^\//,"").split("/");M="/"+x.replace(/^\//,"").split("/").slice(_.length).join("/")}let b=rs(e,{pathname:M});return Cn(p||b!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Cn(b==null||b[b.length-1].route.element!==void 0||b[b.length-1].route.Component!==void 0||b[b.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),S2e(b&&b.map(_=>Object.assign({},_,{params:Object.assign({},l,_.params),pathname:kr([h,a.encodeLocation?a.encodeLocation(_.pathname).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?h:kr([h,a.encodeLocation?a.encodeLocation(_.pathnameBase).pathname:_.pathnameBase])})),i,n,o)}function w2e(){let e=A2e(),t=R0(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:o},i={padding:"2px 4px",backgroundColor:o},s=null;return console.error("Error handled by React Router default ErrorBoundary:",e),s=k.createElement(k.Fragment,null,k.createElement("p",null,"💿 Hey developer 👋"),k.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",k.createElement("code",{style:i},"ErrorBoundary")," or"," ",k.createElement("code",{style:i},"errorElement")," prop on your route.")),k.createElement(k.Fragment,null,k.createElement("h2",null,"Unexpected Application Error!"),k.createElement("h3",{style:{fontStyle:"italic"}},t),n?k.createElement("pre",{style:a},n):null,s)}var b2e=k.createElement(w2e,null),M2e=class extends k.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?k.createElement(_a.Provider,{value:this.props.routeContext},k.createElement(kV.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function _2e({routeContext:e,match:t,children:n}){let o=k.useContext(h1);return o&&o.static&&o.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=t.route.id),k.createElement(_a.Provider,{value:e},n)}function S2e(e,t=[],n=null,o=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,i=n==null?void 0:n.errors;if(i!=null){let d=a.findIndex(h=>h.route.id&&(i==null?void 0:i[h.route.id])!==void 0);vt(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),a=a.slice(0,Math.min(a.length,d+1))}let s=!1,l=-1;if(n)for(let d=0;d<a.length;d++){let h=a[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(l=d),h.route.id){let{loaderData:p,errors:m}=n,v=h.route.loader&&!p.hasOwnProperty(h.route.id)&&(!m||m[h.route.id]===void 0);if(h.route.lazy||v){s=!0,l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}return a.reduceRight((d,h,p)=>{let m,v=!1,x=null,M=null;n&&(m=i&&h.route.id?i[h.route.id]:void 0,x=h.route.errorElement||b2e,s&&(l<0&&p===0?(zJ("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),v=!0,M=null):l===p&&(v=!0,M=h.route.hydrateFallbackElement||null)));let b=t.concat(a.slice(0,p+1)),C=()=>{let _;return m?_=x:v?_=M:h.route.Component?_=k.createElement(h.route.Component,null):h.route.element?_=h.route.element:_=d,k.createElement(_2e,{match:h,routeContext:{outlet:d,matches:b,isDataRoute:n!=null},children:_})};return n&&(h.route.ErrorBoundary||h.route.errorElement||p===0)?k.createElement(M2e,{location:n.location,revalidation:n.revalidation,component:x,error:m,children:C(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):C()},null)}function xV(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function C2e(e){let t=k.useContext(h1);return vt(t,xV(e)),t}function N2e(e){let t=k.useContext(cp);return vt(t,xV(e)),t}function L2e(e){let t=k.useContext(_a);return vt(t,xV(e)),t}function wV(e){let t=L2e(e),n=t.matches[t.matches.length-1];return vt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function j2e(){return wV("useRouteId")}function A2e(){var o;let e=k.useContext(kV),t=N2e("useRouteError"),n=wV("useRouteError");return e!==void 0?e:(o=t.errors)==null?void 0:o[n]}function E2e(){let{router:e}=C2e("useNavigate"),t=wV("useNavigate"),n=k.useRef(!1);return DJ(()=>{n.current=!0}),k.useCallback(async(a,i={})=>{Cn(n.current,$J),n.current&&(typeof a=="number"?e.navigate(a):await e.navigate(a,{fromRouteId:t,...i}))},[e,t])}var aY={};function zJ(e,t,n){!t&&!aY[e]&&(aY[e]=!0,Cn(!1,n))}var rY={};function iY(e,t){!e&&!rY[t]&&(rY[t]=!0,console.warn(t))}function I2e(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&Cn(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:k.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&Cn(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:k.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&Cn(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:k.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var T2e=["HydrateFallback","hydrateFallbackElement"],R2e=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",t(n))}})}};function P2e({router:e,flushSync:t}){let[n,o]=k.useState(e.state),[a,i]=k.useState(),[s,l]=k.useState({isTransitioning:!1}),[d,h]=k.useState(),[p,m]=k.useState(),[v,x]=k.useState(),M=k.useRef(new Map),b=k.useCallback((A,{deletedFetchers:I,flushSync:R,viewTransitionOpts:j})=>{A.fetchers.forEach((H,U)=>{H.data!==void 0&&M.current.set(U,H.data)}),I.forEach(H=>M.current.delete(H)),iY(R===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let D=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(iY(j==null||D,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!j||!D){t&&R?t(()=>o(A)):k.startTransition(()=>o(A));return}if(t&&R){t(()=>{p&&(d&&d.resolve(),p.skipTransition()),l({isTransitioning:!0,flushSync:!0,currentLocation:j.currentLocation,nextLocation:j.nextLocation})});let H=e.window.document.startViewTransition(()=>{t(()=>o(A))});H.finished.finally(()=>{t(()=>{h(void 0),m(void 0),i(void 0),l({isTransitioning:!1})})}),t(()=>m(H));return}p?(d&&d.resolve(),p.skipTransition(),x({state:A,currentLocation:j.currentLocation,nextLocation:j.nextLocation})):(i(A),l({isTransitioning:!0,flushSync:!1,currentLocation:j.currentLocation,nextLocation:j.nextLocation}))},[e.window,t,p,d]);k.useLayoutEffect(()=>e.subscribe(b),[e,b]),k.useEffect(()=>{s.isTransitioning&&!s.flushSync&&h(new R2e)},[s]),k.useEffect(()=>{if(d&&a&&e.window){let A=a,I=d.promise,R=e.window.document.startViewTransition(async()=>{k.startTransition(()=>o(A)),await I});R.finished.finally(()=>{h(void 0),m(void 0),i(void 0),l({isTransitioning:!1})}),m(R)}},[a,d,e.window]),k.useEffect(()=>{d&&a&&n.location.key===a.location.key&&d.resolve()},[d,p,n.location,a]),k.useEffect(()=>{!s.isTransitioning&&v&&(i(v.state),l({isTransitioning:!0,flushSync:!1,currentLocation:v.currentLocation,nextLocation:v.nextLocation}),x(void 0))},[s.isTransitioning,v]);let C=k.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:A=>e.navigate(A),push:(A,I,R)=>e.navigate(A,{state:I,preventScrollReset:R==null?void 0:R.preventScrollReset}),replace:(A,I,R)=>e.navigate(A,{replace:!0,state:I,preventScrollReset:R==null?void 0:R.preventScrollReset})}),[e]),_=e.basename||"/",N=k.useMemo(()=>({router:e,navigator:C,static:!1,basename:_}),[e,C,_]);return k.createElement(k.Fragment,null,k.createElement(h1.Provider,{value:N},k.createElement(cp.Provider,{value:n},k.createElement(PJ.Provider,{value:M.current},k.createElement(vV.Provider,{value:s},k.createElement(z2e,{basename:_,location:n.location,navigationType:n.historyAction,navigator:C},k.createElement($2e,{routes:e.routes,future:e.future,state:n})))))),null)}var $2e=k.memo(D2e);function D2e({routes:e,future:t,state:n}){return x2e(e,void 0,n,t)}function VR({to:e,replace:t,state:n,relative:o}){vt(o2(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=k.useContext(Za);Cn(!a,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=k.useContext(_a),{pathname:s}=Er(),l=aa(),d=MP(e,bP(i),s,o==="path"),h=JSON.stringify(d);return k.useEffect(()=>{l(JSON.parse(h),{replace:t,state:n,relative:o})},[l,h,o,t,n]),null}function bV(e){return k2e(e.context)}function z2e({basename:e="/",children:t=null,location:n,navigationType:o="POP",navigator:a,static:i=!1}){vt(!o2(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),l=k.useMemo(()=>({basename:s,navigator:a,static:i,future:{}}),[s,a,i]);typeof n=="string"&&(n=Is(n));let{pathname:d="/",search:h="",hash:p="",state:m=null,key:v="default"}=n,x=k.useMemo(()=>{let M=Ma(d,s);return M==null?null:{location:{pathname:M,search:h,hash:p,state:m,key:v},navigationType:o}},[s,d,h,p,m,v,o]);return Cn(x!=null,`<Router basename="${s}"> is not able to match the URL "${d}${h}${p}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:k.createElement(Za.Provider,{value:l},k.createElement(_P.Provider,{children:t,value:x}))}var jm="get",Am="application/x-www-form-urlencoded";function SP(e){return e!=null&&typeof e.tagName=="string"}function O2e(e){return SP(e)&&e.tagName.toLowerCase()==="button"}function q2e(e){return SP(e)&&e.tagName.toLowerCase()==="form"}function H2e(e){return SP(e)&&e.tagName.toLowerCase()==="input"}function V2e(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function B2e(e,t){return e.button===0&&(!t||t==="_self")&&!V2e(e)}var Yy=null;function F2e(){if(Yy===null)try{new FormData(document.createElement("form"),0),Yy=!1}catch{Yy=!0}return Yy}var U2e=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function aO(e){return e!=null&&!U2e.has(e)?(Cn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Am}"`),null):e}function G2e(e,t){let n,o,a,i,s;if(q2e(e)){let l=e.getAttribute("action");o=l?Ma(l,t):null,n=e.getAttribute("method")||jm,a=aO(e.getAttribute("enctype"))||Am,i=new FormData(e)}else if(O2e(e)||H2e(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let d=e.getAttribute("formaction")||l.getAttribute("action");if(o=d?Ma(d,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||jm,a=aO(e.getAttribute("formenctype"))||aO(l.getAttribute("enctype"))||Am,i=new FormData(l,e),!F2e()){let{name:h,type:p,value:m}=e;if(p==="image"){let v=h?`${h}.`:"";i.append(`${v}x`,"0"),i.append(`${v}y`,"0")}else h&&i.append(h,m)}}else{if(SP(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=jm,o=null,a=Am,s=e}return i&&a==="text/plain"&&(s=i,i=void 0),{action:o,method:n.toLowerCase(),encType:a,formData:i,body:s}}function MV(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}async function X2e(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Z2e(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Y2e(e,t,n){let o=await Promise.all(e.map(async a=>{let i=t.routes[a.route.id];if(i){let s=await X2e(i,n);return s.links?s.links():[]}return[]}));return J2e(o.flat(1).filter(Z2e).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function sY(e,t,n,o,a,i){let s=(d,h)=>n[h]?d.route.id!==n[h].route.id:!0,l=(d,h)=>{var p;return n[h].pathname!==d.pathname||((p=n[h].route.path)==null?void 0:p.endsWith("*"))&&n[h].params["*"]!==d.params["*"]};return i==="assets"?t.filter((d,h)=>s(d,h)||l(d,h)):i==="data"?t.filter((d,h)=>{var m;let p=o.routes[d.route.id];if(!p||!p.hasLoader)return!1;if(s(d,h)||l(d,h))return!0;if(d.route.shouldRevalidate){let v=d.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((m=n[0])==null?void 0:m.params)||{},nextUrl:new URL(e,window.origin),nextParams:d.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function W2e(e,t,{includeHydrateFallback:n}={}){return K2e(e.map(o=>{let a=t.routes[o.route.id];if(!a)return[];let i=[a.module];return a.clientActionModule&&(i=i.concat(a.clientActionModule)),a.clientLoaderModule&&(i=i.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(i=i.concat(a.hydrateFallbackModule)),a.imports&&(i=i.concat(a.imports)),i}).flat(1))}function K2e(e){return[...new Set(e)]}function Q2e(e){let t={},n=Object.keys(e).sort();for(let o of n)t[o]=e[o];return t}function J2e(e,t){let n=new Set;return new Set(t),e.reduce((o,a)=>{let i=JSON.stringify(Q2e(a));return n.has(i)||(n.add(i),o.push({key:i,link:a})),o},[])}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var efe=new Set([100,101,204,205]);function tfe(e,t){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n.pathname==="/"?n.pathname="_root.data":t&&Ma(n.pathname,t)==="/"?n.pathname=`${t.replace(/\/$/,"")}/_root.data`:n.pathname=`${n.pathname.replace(/\/$/,"")}.data`,n}function OJ(){let e=k.useContext(h1);return MV(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function nfe(){let e=k.useContext(cp);return MV(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var _V=k.createContext(void 0);_V.displayName="FrameworkContext";function qJ(){let e=k.useContext(_V);return MV(e,"You must render this element inside a <HydratedRouter> element"),e}function ofe(e,t){let n=k.useContext(_V),[o,a]=k.useState(!1),[i,s]=k.useState(!1),{onFocus:l,onBlur:d,onMouseEnter:h,onMouseLeave:p,onTouchStart:m}=t,v=k.useRef(null);k.useEffect(()=>{if(e==="render"&&s(!0),e==="viewport"){let b=_=>{_.forEach(N=>{s(N.isIntersecting)})},C=new IntersectionObserver(b,{threshold:.5});return v.current&&C.observe(v.current),()=>{C.disconnect()}}},[e]),k.useEffect(()=>{if(o){let b=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(b)}}},[o]);let x=()=>{a(!0)},M=()=>{a(!1),s(!1)};return n?e!=="intent"?[i,v,{}]:[i,v,{onFocus:xf(l,x),onBlur:xf(d,M),onMouseEnter:xf(h,x),onMouseLeave:xf(p,M),onTouchStart:xf(m,x)}]:[!1,v,{}]}function xf(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function afe({page:e,...t}){let{router:n}=OJ(),o=k.useMemo(()=>rs(n.routes,e,n.basename),[n.routes,e,n.basename]);return o?k.createElement(ife,{page:e,matches:o,...t}):null}function rfe(e){let{manifest:t,routeModules:n}=qJ(),[o,a]=k.useState([]);return k.useEffect(()=>{let i=!1;return Y2e(e,t,n).then(s=>{i||a(s)}),()=>{i=!0}},[e,t,n]),o}function ife({page:e,matches:t,...n}){let o=Er(),{manifest:a,routeModules:i}=qJ(),{basename:s}=OJ(),{loaderData:l,matches:d}=nfe(),h=k.useMemo(()=>sY(e,t,d,a,o,"data"),[e,t,d,a,o]),p=k.useMemo(()=>sY(e,t,d,a,o,"assets"),[e,t,d,a,o]),m=k.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let M=new Set,b=!1;if(t.forEach(_=>{var A;let N=a.routes[_.route.id];!N||!N.hasLoader||(!h.some(I=>I.route.id===_.route.id)&&_.route.id in l&&((A=i[_.route.id])!=null&&A.shouldRevalidate)||N.hasClientLoader?b=!0:M.add(_.route.id))}),M.size===0)return[];let C=tfe(e,s);return b&&M.size>0&&C.searchParams.set("_routes",t.filter(_=>M.has(_.route.id)).map(_=>_.route.id).join(",")),[C.pathname+C.search]},[s,l,o,a,h,t,e,i]),v=k.useMemo(()=>W2e(p,a),[p,a]),x=rfe(p);return k.createElement(k.Fragment,null,m.map(M=>k.createElement("link",{key:M,rel:"prefetch",as:"fetch",href:M,...n})),v.map(M=>k.createElement("link",{key:M,rel:"modulepreload",href:M,...n})),x.map(({key:M,link:b})=>k.createElement("link",{key:M,...b})))}function sfe(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var HJ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{HJ&&(window.__reactRouterVersion="7.6.2")}catch{}function cfe(e,t){return Whe({basename:t==null?void 0:t.basename,unstable_getContext:t==null?void 0:t.unstable_getContext,future:t==null?void 0:t.future,history:ghe({window:t==null?void 0:t.window}),hydrationData:lfe(),routes:e,mapRouteProperties:I2e,hydrationRouteProperties:T2e,dataStrategy:t==null?void 0:t.dataStrategy,patchRoutesOnNavigation:t==null?void 0:t.patchRoutesOnNavigation,window:t==null?void 0:t.window}).initialize()}function lfe(){let e=window==null?void 0:window.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:ufe(e.errors)}),e}function ufe(e){if(!e)return null;let t=Object.entries(e),n={};for(let[o,a]of t)if(a&&a.__type==="RouteErrorResponse")n[o]=new qR(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let i=window[a.__subType];if(typeof i=="function")try{let s=new i(a.message);s.stack="",n[o]=s}catch{}}if(n[o]==null){let i=new Error(a.message);i.stack="",n[o]=i}}else n[o]=a;return n}var VJ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,up=k.forwardRef(function({onClick:t,discover:n="render",prefetch:o="none",relative:a,reloadDocument:i,replace:s,state:l,target:d,to:h,preventScrollReset:p,viewTransition:m,...v},x){let{basename:M}=k.useContext(Za),b=typeof h=="string"&&VJ.test(h),C,_=!1;if(typeof h=="string"&&b&&(C=h,HJ))try{let U=new URL(window.location.href),z=h.startsWith("//")?new URL(U.protocol+h):new URL(h),Z=Ma(z.pathname,M);z.origin===U.origin&&Z!=null?h=Z+z.search+z.hash:_=!0}catch{Cn(!1,`<Link to="${h}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let N=m2e(h,{relative:a}),[A,I,R]=ofe(o,v),j=ffe(h,{replace:s,state:l,target:d,preventScrollReset:p,relative:a,viewTransition:m});function D(U){t&&t(U),U.defaultPrevented||j(U)}let H=k.createElement("a",{...v,...R,href:C||N,onClick:_||i?t:D,ref:sfe(x,I),target:d,"data-discover":!b&&n==="render"?"true":void 0});return A&&!b?k.createElement(k.Fragment,null,H,k.createElement(afe,{page:N})):H});up.displayName="Link";var Oa=k.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:o="",end:a=!1,style:i,to:s,viewTransition:l,children:d,...h},p){let m=lp(s,{relative:h.relative}),v=Er(),x=k.useContext(cp),{navigator:M,basename:b}=k.useContext(Za),C=x!=null&&vfe(m)&&l===!0,_=M.encodeLocation?M.encodeLocation(m).pathname:m.pathname,N=v.pathname,A=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;n||(N=N.toLowerCase(),A=A?A.toLowerCase():null,_=_.toLowerCase()),A&&b&&(A=Ma(A,b)||A);const I=_!=="/"&&_.endsWith("/")?_.length-1:_.length;let R=N===_||!a&&N.startsWith(_)&&N.charAt(I)==="/",j=A!=null&&(A===_||!a&&A.startsWith(_)&&A.charAt(_.length)==="/"),D={isActive:R,isPending:j,isTransitioning:C},H=R?t:void 0,U;typeof o=="function"?U=o(D):U=[o,R?"active":null,j?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let z=typeof i=="function"?i(D):i;return k.createElement(up,{...h,"aria-current":H,className:U,ref:p,style:z,to:s,viewTransition:l},typeof d=="function"?d(D):d)});Oa.displayName="NavLink";var dfe=k.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:o,replace:a,state:i,method:s=jm,action:l,onSubmit:d,relative:h,preventScrollReset:p,viewTransition:m,...v},x)=>{let M=mfe(),b=gfe(l,{relative:h}),C=s.toLowerCase()==="get"?"get":"post",_=typeof l=="string"&&VJ.test(l),N=A=>{if(d&&d(A),A.defaultPrevented)return;A.preventDefault();let I=A.nativeEvent.submitter,R=(I==null?void 0:I.getAttribute("formmethod"))||s;M(I||A.currentTarget,{fetcherKey:t,method:R,navigate:n,replace:a,state:i,relative:h,preventScrollReset:p,viewTransition:m})};return k.createElement("form",{ref:x,method:C,action:b,onSubmit:o?d:N,...v,"data-discover":!_&&e==="render"?"true":void 0})});dfe.displayName="Form";function hfe(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function BJ(e){let t=k.useContext(h1);return vt(t,hfe(e)),t}function ffe(e,{target:t,replace:n,state:o,preventScrollReset:a,relative:i,viewTransition:s}={}){let l=aa(),d=Er(),h=lp(e,{relative:i});return k.useCallback(p=>{if(B2e(p,t)){p.preventDefault();let m=n!==void 0?n:Ss(d)===Ss(h);l(e,{replace:m,state:o,preventScrollReset:a,relative:i,viewTransition:s})}},[d,l,h,n,o,t,e,a,i,s])}var pfe=0,yfe=()=>`__${String(++pfe)}__`;function mfe(){let{router:e}=BJ("useSubmit"),{basename:t}=k.useContext(Za),n=j2e();return k.useCallback(async(o,a={})=>{let{action:i,method:s,encType:l,formData:d,body:h}=G2e(o,t);if(a.navigate===!1){let p=a.fetcherKey||yfe();await e.fetch(p,n,a.action||i,{preventScrollReset:a.preventScrollReset,formData:d,body:h,formMethod:a.method||s,formEncType:a.encType||l,flushSync:a.flushSync})}else await e.navigate(a.action||i,{preventScrollReset:a.preventScrollReset,formData:d,body:h,formMethod:a.method||s,formEncType:a.encType||l,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[e,t,n])}function gfe(e,{relative:t}={}){let{basename:n}=k.useContext(Za),o=k.useContext(_a);vt(o,"useFormAction must be used inside a RouteContext");let[a]=o.matches.slice(-1),i={...lp(e||".",{relative:t})},s=Er();if(e==null){i.search=s.search;let l=new URLSearchParams(i.search),d=l.getAll("index");if(d.some(p=>p==="")){l.delete("index"),d.filter(m=>m).forEach(m=>l.append("index",m));let p=l.toString();i.search=p?`?${p}`:""}}return(!e||e===".")&&a.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:kr([n,i.pathname])),Ss(i)}function vfe(e,t={}){let n=k.useContext(vV);vt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=BJ("useViewTransitionState"),a=lp(e,{relative:t.relative});if(!n.isTransitioning)return!1;let i=Ma(n.currentLocation.pathname,o)||n.currentLocation.pathname,s=Ma(n.nextLocation.pathname,o)||n.nextLocation.pathname;return OR(a.pathname,s)!=null||OR(a.pathname,i)!=null}[...efe];var f1=kJ();const kfe=d1(f1);/**
@@ -67,7 +67,7 @@ Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}
67
67
  * LICENSE.md file in the root directory of this source tree.
68
68
  *
69
69
  * @license MIT
70
- */function xfe(e){return k.createElement(P2e,{flushSync:f1.flushSync,...e})}const cY=e=>{let t;const n=new Set,o=(h,p)=>{const m=typeof h=="function"?h(t):h;if(!Object.is(m,t)){const v=t;t=p??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(x=>x(t,v))}},a=()=>t,l={setState:o,getState:a,getInitialState:()=>d,subscribe:h=>(n.add(h),()=>n.delete(h))},d=t=e(o,a,l);return l},wfe=e=>e?cY(e):cY,bfe=e=>e;function Mfe(e,t=bfe){const n=le.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return le.useDebugValue(n),n}const lY=e=>{const t=wfe(e),n=o=>Mfe(t,o);return Object.assign(n,t),n},FJ=e=>e?lY(e):lY;var UJ=Symbol.for("immer-nothing"),uY=Symbol.for("immer-draftable"),ea=Symbol.for("immer-state");function qa(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Fh=Object.getPrototypeOf;function Uh(e){return!!e&&!!e[ea]}function t1(e){var t;return e?GJ(e)||Array.isArray(e)||!!e[uY]||!!((t=e.constructor)!=null&&t[uY])||NP(e)||LP(e):!1}var _fe=Object.prototype.constructor.toString();function GJ(e){if(!e||typeof e!="object")return!1;const t=Fh(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===_fe}function BR(e,t){CP(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,o)=>t(o,n,e))}function CP(e){const t=e[ea];return t?t.type_:Array.isArray(e)?1:NP(e)?2:LP(e)?3:0}function Rq(e,t){return CP(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function XJ(e,t,n){const o=CP(e);o===2?e.set(t,n):o===3?e.add(n):e[t]=n}function Sfe(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function NP(e){return e instanceof Map}function LP(e){return e instanceof Set}function cc(e){return e.copy_||e.base_}function Pq(e,t){if(NP(e))return new Map(e);if(LP(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=GJ(e);if(t===!0||t==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(e);delete o[ea];let a=Reflect.ownKeys(o);for(let i=0;i<a.length;i++){const s=a[i],l=o[s];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(o[s]={configurable:!0,writable:!0,enumerable:l.enumerable,value:e[s]})}return Object.create(Fh(e),o)}else{const o=Fh(e);if(o!==null&&n)return{...e};const a=Object.create(o);return Object.assign(a,e)}}function SV(e,t=!1){return jP(e)||Uh(e)||!t1(e)||(CP(e)>1&&(e.set=e.add=e.clear=e.delete=Cfe),Object.freeze(e),t&&Object.entries(e).forEach(([n,o])=>SV(o,!0))),e}function Cfe(){qa(2)}function jP(e){return Object.isFrozen(e)}var Nfe={};function n1(e){const t=Nfe[e];return t||qa(0,e),t}var P0;function ZJ(){return P0}function Lfe(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function dY(e,t){t&&(n1("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function $q(e){Dq(e),e.drafts_.forEach(jfe),e.drafts_=null}function Dq(e){e===P0&&(P0=e.parent_)}function hY(e){return P0=Lfe(P0,e)}function jfe(e){const t=e[ea];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function fY(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[ea].modified_&&($q(t),qa(4)),t1(e)&&(e=FR(t,e),t.parent_||UR(t,e)),t.patches_&&n1("Patches").generateReplacementPatches_(n[ea].base_,e,t.patches_,t.inversePatches_)):e=FR(t,n,[]),$q(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==UJ?e:void 0}function FR(e,t,n){if(jP(t))return t;const o=t[ea];if(!o)return BR(t,(a,i)=>pY(e,o,t,a,i,n)),t;if(o.scope_!==e)return t;if(!o.modified_)return UR(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const a=o.copy_;let i=a,s=!1;o.type_===3&&(i=new Set(a),a.clear(),s=!0),BR(i,(l,d)=>pY(e,o,a,l,d,n,s)),UR(e,a,!1),n&&e.patches_&&n1("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function pY(e,t,n,o,a,i,s){if(Uh(a)){const l=i&&t&&t.type_!==3&&!Rq(t.assigned_,o)?i.concat(o):void 0,d=FR(e,a,l);if(XJ(n,o,d),Uh(d))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(t1(a)&&!jP(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;FR(e,a),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,o)&&UR(e,a)}}function UR(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&SV(t,n)}function Afe(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:ZJ(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=o,i=CV;n&&(a=[o],i=$0);const{revoke:s,proxy:l}=Proxy.revocable(a,i);return o.draft_=l,o.revoke_=s,l}var CV={get(e,t){if(t===ea)return e;const n=cc(e);if(!Rq(n,t))return Efe(e,n,t);const o=n[t];return e.finalized_||!t1(o)?o:o===rO(e.base_,t)?(iO(e),e.copy_[t]=Oq(o,e)):o},has(e,t){return t in cc(e)},ownKeys(e){return Reflect.ownKeys(cc(e))},set(e,t,n){const o=YJ(cc(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const a=rO(cc(e),t),i=a==null?void 0:a[ea];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Sfe(n,a)&&(n!==void 0||Rq(e.base_,t)))return!0;iO(e),zq(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return rO(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,iO(e),zq(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=cc(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:o.enumerable,value:n[t]}},defineProperty(){qa(11)},getPrototypeOf(e){return Fh(e.base_)},setPrototypeOf(){qa(12)}},$0={};BR(CV,(e,t)=>{$0[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});$0.deleteProperty=function(e,t){return $0.set.call(this,e,t,void 0)};$0.set=function(e,t,n){return CV.set.call(this,e[0],t,n,e[0])};function rO(e,t){const n=e[ea];return(n?cc(n):e)[t]}function Efe(e,t,n){var a;const o=YJ(t,n);return o?"value"in o?o.value:(a=o.get)==null?void 0:a.call(e.draft_):void 0}function YJ(e,t){if(!(t in e))return;let n=Fh(e);for(;n;){const o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Fh(n)}}function zq(e){e.modified_||(e.modified_=!0,e.parent_&&zq(e.parent_))}function iO(e){e.copy_||(e.copy_=Pq(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Ife=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,o)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(d=i,...h){return s.produce(d,p=>n.call(this,p,...h))}}typeof n!="function"&&qa(6),o!==void 0&&typeof o!="function"&&qa(7);let a;if(t1(t)){const i=hY(this),s=Oq(t,void 0);let l=!0;try{a=n(s),l=!1}finally{l?$q(i):Dq(i)}return dY(i,o),fY(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===UJ&&(a=void 0),this.autoFreeze_&&SV(a,!0),o){const i=[],s=[];n1("Patches").generateReplacementPatches_(t,a,i,s),o(i,s)}return a}else qa(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...l)=>this.produceWithPatches(s,d=>t(d,...l));let o,a;return[this.produce(t,n,(s,l)=>{o=s,a=l}),o,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){t1(e)||qa(8),Uh(e)&&(e=Tfe(e));const t=hY(this),n=Oq(e,void 0);return n[ea].isManual_=!0,Dq(t),n}finishDraft(e,t){const n=e&&e[ea];(!n||!n.isManual_)&&qa(9);const{scope_:o}=n;return dY(o,t),fY(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const a=t[n];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}n>-1&&(t=t.slice(n+1));const o=n1("Patches").applyPatches_;return Uh(e)?o(e,t):this.produce(e,a=>o(a,t))}};function Oq(e,t){const n=NP(e)?n1("MapSet").proxyMap_(e,t):LP(e)?n1("MapSet").proxySet_(e,t):Afe(e,t);return(t?t.scope_:ZJ()).drafts_.push(n),n}function Tfe(e){return Uh(e)||qa(10,e),WJ(e)}function WJ(e){if(!t1(e)||jP(e))return e;const t=e[ea];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Pq(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Pq(e,!0);return BR(n,(o,a)=>{XJ(n,o,WJ(a))}),t&&(t.finalized_=!1),n}var ta=new Ife,KJ=ta.produce;ta.produceWithPatches.bind(ta);ta.setAutoFreeze.bind(ta);ta.setUseStrictShallowCopy.bind(ta);ta.applyPatches.bind(ta);ta.createDraft.bind(ta);ta.finishDraft.bind(ta);const Rfe=e=>(t,n,o)=>(o.setState=(a,i,...s)=>{const l=typeof a=="function"?KJ(a):a;return t(l,i,...s)},e(o.setState,n,o)),QJ=Rfe,Lr=Object.create(null);Lr.open="0";Lr.close="1";Lr.ping="2";Lr.pong="3";Lr.message="4";Lr.upgrade="5";Lr.noop="6";const Em=Object.create(null);Object.keys(Lr).forEach(e=>{Em[Lr[e]]=e});const qq={type:"error",data:"parser error"},JJ=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",eee=typeof ArrayBuffer=="function",tee=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,NV=({type:e,data:t},n,o)=>JJ&&t instanceof Blob?n?o(t):yY(t,o):eee&&(t instanceof ArrayBuffer||tee(t))?n?o(t):yY(new Blob([t]),o):o(Lr[e]+(t||"")),yY=(e,t)=>{const n=new FileReader;return n.onload=function(){const o=n.result.split(",")[1];t("b"+(o||""))},n.readAsDataURL(e)};function mY(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let sO;function Pfe(e,t){if(JJ&&e.data instanceof Blob)return e.data.arrayBuffer().then(mY).then(t);if(eee&&(e.data instanceof ArrayBuffer||tee(e.data)))return t(mY(e.data));NV(e,!1,n=>{sO||(sO=new TextEncoder),t(sO.encode(n))})}const gY="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$f=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<gY.length;e++)$f[gY.charCodeAt(e)]=e;const $fe=e=>{let t=e.length*.75,n=e.length,o,a=0,i,s,l,d;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const h=new ArrayBuffer(t),p=new Uint8Array(h);for(o=0;o<n;o+=4)i=$f[e.charCodeAt(o)],s=$f[e.charCodeAt(o+1)],l=$f[e.charCodeAt(o+2)],d=$f[e.charCodeAt(o+3)],p[a++]=i<<2|s>>4,p[a++]=(s&15)<<4|l>>2,p[a++]=(l&3)<<6|d&63;return h},Dfe=typeof ArrayBuffer=="function",LV=(e,t)=>{if(typeof e!="string")return{type:"message",data:nee(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:zfe(e.substring(1),t)}:Em[n]?e.length>1?{type:Em[n],data:e.substring(1)}:{type:Em[n]}:qq},zfe=(e,t)=>{if(Dfe){const n=$fe(e);return nee(n,t)}else return{base64:!0,data:e}},nee=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},oee="",Ofe=(e,t)=>{const n=e.length,o=new Array(n);let a=0;e.forEach((i,s)=>{NV(i,!1,l=>{o[s]=l,++a===n&&t(o.join(oee))})})},qfe=(e,t)=>{const n=e.split(oee),o=[];for(let a=0;a<n.length;a++){const i=LV(n[a],t);if(o.push(i),i.type==="error")break}return o};function Hfe(){return new TransformStream({transform(e,t){Pfe(e,n=>{const o=n.length;let a;if(o<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,o);else if(o<65536){a=new Uint8Array(3);const i=new DataView(a.buffer);i.setUint8(0,126),i.setUint16(1,o)}else{a=new Uint8Array(9);const i=new DataView(a.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(o))}e.data&&typeof e.data!="string"&&(a[0]|=128),t.enqueue(a),t.enqueue(n)})}})}let cO;function Wy(e){return e.reduce((t,n)=>t+n.length,0)}function Ky(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let o=0;for(let a=0;a<t;a++)n[a]=e[0][o++],o===e[0].length&&(e.shift(),o=0);return e.length&&o<e[0].length&&(e[0]=e[0].slice(o)),n}function Vfe(e,t){cO||(cO=new TextDecoder);const n=[];let o=0,a=-1,i=!1;return new TransformStream({transform(s,l){for(n.push(s);;){if(o===0){if(Wy(n)<1)break;const d=Ky(n,1);i=(d[0]&128)===128,a=d[0]&127,a<126?o=3:a===126?o=1:o=2}else if(o===1){if(Wy(n)<2)break;const d=Ky(n,2);a=new DataView(d.buffer,d.byteOffset,d.length).getUint16(0),o=3}else if(o===2){if(Wy(n)<8)break;const d=Ky(n,8),h=new DataView(d.buffer,d.byteOffset,d.length),p=h.getUint32(0);if(p>Math.pow(2,21)-1){l.enqueue(qq);break}a=p*Math.pow(2,32)+h.getUint32(4),o=3}else{if(Wy(n)<a)break;const d=Ky(n,a);l.enqueue(LV(i?d:cO.decode(d),t)),o=0}if(a===0||a>e){l.enqueue(qq);break}}}})}const aee=4;function $n(e){if(e)return Bfe(e)}function Bfe(e){for(var t in $n.prototype)e[t]=$n.prototype[t];return e}$n.prototype.on=$n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};$n.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};$n.prototype.off=$n.prototype.removeListener=$n.prototype.removeAllListeners=$n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var o,a=0;a<n.length;a++)if(o=n[a],o===t||o.fn===t){n.splice(a,1);break}return n.length===0&&delete this._callbacks["$"+e],this};$n.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],o=1;o<arguments.length;o++)t[o-1]=arguments[o];if(n){n=n.slice(0);for(var o=0,a=n.length;o<a;++o)n[o].apply(this,t)}return this};$n.prototype.emitReserved=$n.prototype.emit;$n.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};$n.prototype.hasListeners=function(e){return!!this.listeners(e).length};const AP=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),ga=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ffe="arraybuffer";function ree(e,...t){return t.reduce((n,o)=>(e.hasOwnProperty(o)&&(n[o]=e[o]),n),{})}const Ufe=ga.setTimeout,Gfe=ga.clearTimeout;function EP(e,t){t.useNativeTimers?(e.setTimeoutFn=Ufe.bind(ga),e.clearTimeoutFn=Gfe.bind(ga)):(e.setTimeoutFn=ga.setTimeout.bind(ga),e.clearTimeoutFn=ga.clearTimeout.bind(ga))}const Xfe=1.33;function Zfe(e){return typeof e=="string"?Yfe(e):Math.ceil((e.byteLength||e.size)*Xfe)}function Yfe(e){let t=0,n=0;for(let o=0,a=e.length;o<a;o++)t=e.charCodeAt(o),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(o++,n+=4);return n}function iee(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Wfe(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Kfe(e){let t={},n=e.split("&");for(let o=0,a=n.length;o<a;o++){let i=n[o].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}class Qfe extends Error{constructor(t,n,o){super(t),this.description=n,this.context=o,this.type="TransportError"}}class jV extends $n{constructor(t){super(),this.writable=!1,EP(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,o){return super.emitReserved("error",new Qfe(t,n,o)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=LV(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=Wfe(t);return n.length?"?"+n:""}}class Jfe extends jV{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let o=0;this._polling&&(o++,this.once("pollComplete",function(){--o||n()})),this.writable||(o++,this.once("drain",function(){--o||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=o=>{if(this.readyState==="opening"&&o.type==="open"&&this.onOpen(),o.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(o)};qfe(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Ofe(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=iee()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let see=!1;try{see=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const e0e=see;function t0e(){}class n0e extends Jfe{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let o=location.port;o||(o=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||o!==t.port}}doWrite(t,n){const o=this.request({method:"POST",data:t});o.on("success",n),o.on("error",(a,i)=>{this.onError("xhr post error",a,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,o)=>{this.onError("xhr poll error",n,o)}),this.pollXhr=t}}let _h=class Im extends $n{constructor(t,n,o){super(),this.createRequest=t,EP(this,o),this._opts=o,this._method=o.method||"GET",this._uri=n,this._data=o.data!==void 0?o.data:null,this._create()}_create(){var t;const n=ree(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const o=this._xhr=this.createRequest(n);try{o.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){o.setDisableHeaderCheck&&o.setDisableHeaderCheck(!0);for(let a in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&o.setRequestHeader(a,this._opts.extraHeaders[a])}}catch{}if(this._method==="POST")try{o.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{o.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(o),"withCredentials"in o&&(o.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(o.timeout=this._opts.requestTimeout),o.onreadystatechange=()=>{var a;o.readyState===3&&((a=this._opts.cookieJar)===null||a===void 0||a.parseCookies(o.getResponseHeader("set-cookie"))),o.readyState===4&&(o.status===200||o.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof o.status=="number"?o.status:0)},0))},o.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}typeof document<"u"&&(this._index=Im.requestsCount++,Im.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=t0e,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Im.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};_h.requestsCount=0;_h.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",vY);else if(typeof addEventListener=="function"){const e="onpagehide"in ga?"pagehide":"unload";addEventListener(e,vY,!1)}}function vY(){for(let e in _h.requests)_h.requests.hasOwnProperty(e)&&_h.requests[e].abort()}const o0e=function(){const e=cee({xdomain:!1});return e&&e.responseType!==null}();class a0e extends n0e{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=o0e&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new _h(cee,this.uri(),t)}}function cee(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||e0e))return new XMLHttpRequest}catch{}if(!t)try{return new ga[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const lee=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class r0e extends jV{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,o=lee?{}:ree(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(o.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,o)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const o=t[n],a=n===t.length-1;NV(o,this.supportsBinary,i=>{try{this.doWrite(o,i)}catch{}a&&AP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=iee()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const lO=ga.WebSocket||ga.MozWebSocket;class i0e extends r0e{createSocket(t,n,o){return lee?new lO(t,n,o):n?new lO(t,n):new lO(t)}doWrite(t,n){this.ws.send(n)}}class s0e extends jV{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=Vfe(Number.MAX_SAFE_INTEGER,this.socket.binaryType),o=t.readable.pipeThrough(n).getReader(),a=Hfe();a.readable.pipeTo(t.writable),this._writer=a.writable.getWriter();const i=()=>{o.read().then(({done:l,value:d})=>{l||(this.onPacket(d),i())}).catch(l=>{})};i();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const o=t[n],a=n===t.length-1;this._writer.write(o).then(()=>{a&&AP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const c0e={websocket:i0e,webtransport:s0e,polling:a0e},l0e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,u0e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Hq(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),o=e.indexOf("]");n!=-1&&o!=-1&&(e=e.substring(0,n)+e.substring(n,o).replace(/:/g,";")+e.substring(o,e.length));let a=l0e.exec(e||""),i={},s=14;for(;s--;)i[u0e[s]]=a[s]||"";return n!=-1&&o!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=d0e(i,i.path),i.queryKey=h0e(i,i.query),i}function d0e(e,t){const n=/\/{2,9}/g,o=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&o.splice(0,1),t.slice(-1)=="/"&&o.splice(o.length-1,1),o}function h0e(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(o,a,i){a&&(n[a]=i)}),n}const Vq=typeof addEventListener=="function"&&typeof removeEventListener=="function",Tm=[];Vq&&addEventListener("offline",()=>{Tm.forEach(e=>e())},!1);class fs extends $n{constructor(t,n){if(super(),this.binaryType=Ffe,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const o=Hq(t);n.hostname=o.host,n.secure=o.protocol==="https"||o.protocol==="wss",n.port=o.port,o.query&&(n.query=o.query)}else n.host&&(n.hostname=Hq(n.host).host);EP(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(o=>{const a=o.prototype.name;this.transports.push(a),this._transportsByName[a]=o}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Kfe(this.opts.query)),Vq&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Tm.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=aee,n.transport=t,this.id&&(n.sid=this.id);const o=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](o)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&fs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",fs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let o=0;o<this.writeBuffer.length;o++){const a=this.writeBuffer[o].data;if(a&&(n+=Zfe(a)),o>0&&n>this._maxPayload)return this.writeBuffer.slice(0,o);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,AP(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,o){return this._sendPacket("message",t,n,o),this}send(t,n,o){return this._sendPacket("message",t,n,o),this}_sendPacket(t,n,o,a){if(typeof n=="function"&&(a=n,n=void 0),typeof o=="function"&&(a=o,o=null),this.readyState==="closing"||this.readyState==="closed")return;o=o||{},o.compress=o.compress!==!1;const i={type:t,data:n,options:o};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),a&&this.once("flush",a),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},o=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?o():t()}):this.upgrading?o():t()),this}_onError(t){if(fs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Vq&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const o=Tm.indexOf(this._offlineEventListener);o!==-1&&Tm.splice(o,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}fs.protocol=aee;class f0e extends fs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),o=!1;fs.priorWebsocketSuccess=!1;const a=()=>{o||(n.send([{type:"ping",data:"probe"}]),n.once("packet",m=>{if(!o)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;fs.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{o||this.readyState!=="closed"&&(p(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=n.name,this.emitReserved("upgradeError",v)}}))};function i(){o||(o=!0,p(),n.close(),n=null)}const s=m=>{const v=new Error("probe error: "+m);v.transport=n.name,i(),this.emitReserved("upgradeError",v)};function l(){s("transport closed")}function d(){s("socket closed")}function h(m){n&&m.name!==n.name&&i()}const p=()=>{n.removeListener("open",a),n.removeListener("error",s),n.removeListener("close",l),this.off("close",d),this.off("upgrading",h)};n.once("open",a),n.once("error",s),n.once("close",l),this.once("close",d),this.once("upgrading",h),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{o||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let o=0;o<t.length;o++)~this.transports.indexOf(t[o])&&n.push(t[o]);return n}}let p0e=class extends f0e{constructor(t,n={}){const o=typeof t=="object"?t:n;(!o.transports||o.transports&&typeof o.transports[0]=="string")&&(o.transports=(o.transports||["polling","websocket","webtransport"]).map(a=>c0e[a]).filter(a=>!!a)),super(t,o)}};function y0e(e,t="",n){let o=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),o=Hq(e)),o.port||(/^(http|ws)$/.test(o.protocol)?o.port="80":/^(http|ws)s$/.test(o.protocol)&&(o.port="443")),o.path=o.path||"/";const i=o.host.indexOf(":")!==-1?"["+o.host+"]":o.host;return o.id=o.protocol+"://"+i+":"+o.port+t,o.href=o.protocol+"://"+i+(n&&n.port===o.port?"":":"+o.port),o}const m0e=typeof ArrayBuffer=="function",g0e=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,uee=Object.prototype.toString,v0e=typeof Blob=="function"||typeof Blob<"u"&&uee.call(Blob)==="[object BlobConstructor]",k0e=typeof File=="function"||typeof File<"u"&&uee.call(File)==="[object FileConstructor]";function AV(e){return m0e&&(e instanceof ArrayBuffer||g0e(e))||v0e&&e instanceof Blob||k0e&&e instanceof File}function Rm(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,o=e.length;n<o;n++)if(Rm(e[n]))return!0;return!1}if(AV(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Rm(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Rm(e[n]))return!0;return!1}function x0e(e){const t=[],n=e.data,o=e;return o.data=Bq(n,t),o.attachments=t.length,{packet:o,buffers:t}}function Bq(e,t){if(!e)return e;if(AV(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let o=0;o<e.length;o++)n[o]=Bq(e[o],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=Bq(e[o],t));return n}return e}function w0e(e,t){return e.data=Fq(e.data,t),delete e.attachments,e}function Fq(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Fq(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Fq(e[n],t));return e}const b0e=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],M0e=5;var _t;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(_t||(_t={}));class _0e{constructor(t){this.replacer=t}encode(t){return(t.type===_t.EVENT||t.type===_t.ACK)&&Rm(t)?this.encodeAsBinary({type:t.type===_t.EVENT?_t.BINARY_EVENT:_t.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===_t.BINARY_EVENT||t.type===_t.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=x0e(t),o=this.encodeAsString(n.packet),a=n.buffers;return a.unshift(o),a}}function kY(e){return Object.prototype.toString.call(e)==="[object Object]"}class EV extends $n{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const o=n.type===_t.BINARY_EVENT;o||n.type===_t.BINARY_ACK?(n.type=o?_t.EVENT:_t.ACK,this.reconstructor=new S0e(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(AV(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const o={type:Number(t.charAt(0))};if(_t[o.type]===void 0)throw new Error("unknown packet type "+o.type);if(o.type===_t.BINARY_EVENT||o.type===_t.BINARY_ACK){const i=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const s=t.substring(i,n);if(s!=Number(s)||t.charAt(n)!=="-")throw new Error("Illegal attachments");o.attachments=Number(s)}if(t.charAt(n+1)==="/"){const i=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););o.nsp=t.substring(i,n)}else o.nsp="/";const a=t.charAt(n+1);if(a!==""&&Number(a)==a){const i=n+1;for(;++n;){const s=t.charAt(n);if(s==null||Number(s)!=s){--n;break}if(n===t.length)break}o.id=Number(t.substring(i,n+1))}if(t.charAt(++n)){const i=this.tryParse(t.substr(n));if(EV.isPayloadValid(o.type,i))o.data=i;else throw new Error("invalid payload")}return o}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case _t.CONNECT:return kY(n);case _t.DISCONNECT:return n===void 0;case _t.CONNECT_ERROR:return typeof n=="string"||kY(n);case _t.EVENT:case _t.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&b0e.indexOf(n[0])===-1);case _t.ACK:case _t.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class S0e{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=w0e(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const C0e=Object.freeze(Object.defineProperty({__proto__:null,Decoder:EV,Encoder:_0e,get PacketType(){return _t},protocol:M0e},Symbol.toStringTag,{value:"Module"}));function Da(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const N0e=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class dee extends $n{constructor(t,n,o){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,o&&o.auth&&(this.auth=o.auth),this._opts=Object.assign({},o),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Da(t,"open",this.onopen.bind(this)),Da(t,"packet",this.onpacket.bind(this)),Da(t,"error",this.onerror.bind(this)),Da(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var o,a,i;if(N0e.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const s={type:_t.EVENT,data:n};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const p=this.ids++,m=n.pop();this._registerAckCallback(p,m),s.id=p}const l=(a=(o=this.io.engine)===null||o===void 0?void 0:o.transport)===null||a===void 0?void 0:a.writable,d=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!l||(d?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(t,n){var o;const a=(o=this.flags.timeout)!==null&&o!==void 0?o:this._opts.ackTimeout;if(a===void 0){this.acks[t]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===t&&this.sendBuffer.splice(l,1);n.call(this,new Error("operation has timed out"))},a),s=(...l)=>{this.io.clearTimeoutFn(i),n.apply(this,l)};s.withError=!0,this.acks[t]=s}emitWithAck(t,...n){return new Promise((o,a)=>{const i=(s,l)=>s?a(s):o(l);i.withError=!0,n.push(i),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const o={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((a,...i)=>o!==this._queue[0]?void 0:(a!==null?o.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...i)),o.pending=!1,this._drainQueue())),this._queue.push(o),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:_t.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(o=>String(o.id)===t)){const o=this.acks[t];delete this.acks[t],o.withError&&o.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case _t.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case _t.EVENT:case _t.BINARY_EVENT:this.onevent(t);break;case _t.ACK:case _t.BINARY_ACK:this.onack(t);break;case _t.DISCONNECT:this.ondisconnect();break;case _t.CONNECT_ERROR:this.destroy();const o=new Error(t.data.message);o.data=t.data.data,this.emitReserved("connect_error",o);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const o of n)o.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let o=!1;return function(...a){o||(o=!0,n.packet({type:_t.ACK,id:t,data:a}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:_t.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let o=0;o<n.length;o++)if(t===n[o])return n.splice(o,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let o=0;o<n.length;o++)if(t===n[o])return n.splice(o,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const o of n)o.apply(this,t.data)}}}function a2(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}a2.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};a2.prototype.reset=function(){this.attempts=0};a2.prototype.setMin=function(e){this.ms=e};a2.prototype.setMax=function(e){this.max=e};a2.prototype.setJitter=function(e){this.jitter=e};class Uq extends $n{constructor(t,n){var o;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,EP(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((o=n.randomizationFactor)!==null&&o!==void 0?o:.5),this.backoff=new a2({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const a=n.parser||C0e;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new p0e(this.uri,this.opts);const n=this.engine,o=this;this._readyState="opening",this.skipReconnect=!1;const a=Da(n,"open",function(){o.onopen(),t&&t()}),i=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},s=Da(n,"error",i);if(this._timeout!==!1){const l=this._timeout,d=this.setTimeoutFn(()=>{a(),i(new Error("timeout")),n.close()},l);this.opts.autoUnref&&d.unref(),this.subs.push(()=>{this.clearTimeoutFn(d)})}return this.subs.push(a),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Da(t,"ping",this.onping.bind(this)),Da(t,"data",this.ondata.bind(this)),Da(t,"error",this.onerror.bind(this)),Da(t,"close",this.onclose.bind(this)),Da(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){AP(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let o=this.nsps[t];return o?this._autoConnect&&!o.active&&o.connect():(o=new dee(this,t,n),this.nsps[t]=o),o}_destroy(t){const n=Object.keys(this.nsps);for(const o of n)if(this.nsps[o].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let o=0;o<n.length;o++)this.engine.write(n[o],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var o;this.cleanup(),(o=this.engine)===null||o===void 0||o.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const o=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(a=>{a?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",a)):t.onreconnect()}))},n);this.opts.autoUnref&&o.unref(),this.subs.push(()=>{this.clearTimeoutFn(o)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const wf={};function Pm(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=y0e(e,t.path||"/socket.io"),o=n.source,a=n.id,i=n.path,s=wf[a]&&i in wf[a].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let d;return l?d=new Uq(o,t):(wf[a]||(wf[a]=new Uq(o,t)),d=wf[a]),n.query&&!t.query&&(t.query=n.queryKey),d.socket(n.path,t)}Object.assign(Pm,{Manager:Uq,Socket:dee,io:Pm,connect:Pm});const L0e=1,j0e=1e6;let uO=0;function A0e(){return uO=(uO+1)%Number.MAX_SAFE_INTEGER,uO.toString()}const dO=new Map,xY=e=>{if(dO.has(e))return;const t=setTimeout(()=>{dO.delete(e),Gf({type:"REMOVE_TOAST",toastId:e})},j0e);dO.set(e,t)},E0e=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,L0e)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?xY(n):e.toasts.forEach(o=>{xY(o.id)}),{...e,toasts:e.toasts.map(o=>o.id===n||n===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},$m=[];let Dm={toasts:[]};function Gf(e){Dm=E0e(Dm,e),$m.forEach(t=>{t(Dm)})}function Gt({...e}){const t=A0e(),n=a=>Gf({type:"UPDATE_TOAST",toast:{...a,id:t}}),o=()=>Gf({type:"DISMISS_TOAST",toastId:t});return Gf({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||o()}}}),{id:t,dismiss:o,update:n}}function Yt(){const[e,t]=k.useState(Dm);return k.useEffect(()=>($m.push(t),()=>{const n=$m.indexOf(t);n>-1&&$m.splice(n,1)}),[e]),{...e,toast:Gt,dismiss:n=>Gf({type:"DISMISS_TOAST",toastId:n})}}const Ne=async(e,t={},n)=>{const o=je.getState().token,a={"Content-Type":"application/json",...t.headers};o&&(a.Authorization=`Bearer ${o}`);const i={...t,headers:a};i.body&&typeof i.body=="object"&&(i.body=JSON.stringify(i.body));try{const s=await fetch(e,i);if(s.status===204||s.headers.get("content-length")==="0")return n&&Gt({title:"Успех!",description:n}),!0;const l=await s.json();if(!s.ok){if(s.status===401){if(!e.endsWith("/api/auth/login")){const{logout:d}=je.getState();d()}throw new Error(l.error||"Ошибка авторизации")}throw new Error(l.error||"Произошла неизвестная ошибка на сервере")}return n&&Gt({title:"Успех!",description:n}),l}catch(s){if(s.message.includes("NetworkError")||s.message.includes("Failed to fetch"))Gt({variant:"destructive",title:"Ошибка сети",description:"Не удается подключиться к серверу"});else if(s.message.includes("Невалидный токен")){const{logout:l}=je.getState();return l(),null}else Gt({variant:"destructive",title:"Ошибка",description:s.message});throw s}},I0e=(e,t)=>({socket:null,bots:[],servers:[],botStatuses:{},botLogs:{},resourceUsage:{},appVersion:"",connectSocket:()=>{const n=t().socket;if(n&&(n.connected||n.connecting)){console.log("[Socket] Соединение уже установлено или в процессе.");return}const o=t().token;if(!o){console.log("[Socket] Подключение отложено, нет токена.");return}const a=window.location.origin,i=Pm(a,{path:"/socket.io/",auth:{token:o},reconnectionAttempts:5,reconnectionDelay:2e3,transports:["websocket","polling"]});i.on("connect",()=>console.log("Socket.IO подключен:",i.id)),i.on("disconnect",s=>console.log("Socket.IO отключен:",s)),i.on("connect_error",s=>console.warn(`[Socket] Ошибка подключения: ${s.message}`)),i.on("bot:status",({botId:s,status:l,message:d})=>{e(h=>({botStatuses:{...h.botStatuses,[s]:l}})),d&&t().appendLog(s,`[SYSTEM] ${d}`)}),i.on("bot:log",({botId:s,log:l})=>t().appendLog(s,l)),i.on("bots:usage",s=>{const l=s.reduce((d,h)=>({...d,[h.botId]:h}),{});e({resourceUsage:l})}),e({socket:i})},disconnectSocket:()=>{const n=t().socket;n&&(n.disconnect(),e({socket:null}))},fetchInitialData:async()=>{try{const[n,o,a,i]=await Promise.all([Ne("/api/bots"),Ne("/api/servers"),Ne("/api/bots/state"),Ne("/api/version")]);e(s=>{s.bots=n||[],s.servers=o||[],s.botStatuses=a.statuses||{},s.appVersion=i.version||"";const l=a.logs||{};for(const d in l){const p=[...s.botLogs[d]||[],...l[d]],m=Array.from(new Map(p.map(v=>[v.id,v])).values());s.botLogs[d]=m.slice(-500)}})}catch(n){console.error("Не удалось загрузить начальные данные:",n.message),e(o=>{o.bots=[],o.servers=[]})}},appendLog:(n,o)=>{e(a=>{const i=a.botLogs[n]||[],s=typeof o=="object"&&o!==null&&o.id?o:{id:Date.now()+Math.random(),content:typeof o=="object"&&o!==null?JSON.stringify(o):o},l=[...i,s],d=Array.from(new Map(l.map(h=>[h.id,h])).values());a.botLogs[n]=d.slice(-500)})}}),T0e=(e,t)=>({createBot:async n=>{const o=await Ne("/api/bots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},"Новый бот успешно создан.");return o&&await t().fetchInitialData(),o},startBot:async n=>{await Ne(`/api/bots/${n}/start`,{method:"POST"})},stopBot:async n=>{await Ne(`/api/bots/${n}/stop`,{method:"POST"})},deleteBot:async n=>{await Ne(`/api/bots/${n}`,{method:"DELETE"},"Бот успешно удален."),await t().fetchInitialData()},startAllBots:async()=>{await Ne("/api/bots/start-all",{method:"POST"},"Команда на запуск всех ботов отправлена.")},stopAllBots:async()=>{await Ne("/api/bots/stop-all",{method:"POST"},"Команда на остановку всех ботов отправлена.")}}),wY=async(e,t,n,o,a)=>{try{const i=await Ne(n,o,a);return await e().fetchInstalledPlugins(t),i}catch(i){throw console.error(`[PluginOperation] Failed: ${n}`,{botId:t,endpoint:n,params:o.body?JSON.parse(o.body):{},error:i.message,stack:i.stack}),i}},R0e=(e,t)=>({installedPlugins:{},pluginUpdates:{},pluginCatalog:[],isCatalogLoading:!0,lastUpdateCheck:(()=>{const o={};for(let a=0;a<localStorage.length;a++){const i=localStorage.key(a);if(i&&i.startsWith("plugin_update_check_")){const s=i.replace("plugin_update_check_",""),l=localStorage.getItem(i);l&&(o[s]=parseInt(l,10))}}return o})(),optimisticallyIncrementDownloadCount:o=>{e(a=>{const i=a.pluginCatalog.find(s=>s.name===o);i&&(i.downloads=(i.downloads||0)+1)})},fetchPluginCatalog:async()=>{if(t().pluginCatalog.length>0){e({isCatalogLoading:!1});return}e({isCatalogLoading:!0});try{const o=await Ne("/api/plugins/catalog");let a=new Map;try{const s=await fetch("http://185.65.200.184:3000/api/stats");if(s.ok){const l=await s.json();a=new Map(((l==null?void 0:l.plugins)||[]).map(d=>[d.pluginName,d.downloadCount]))}}catch(s){console.warn("Не удалось загрузить статистику скачиваний плагинов:",s.message)}const i=(o||[]).map(s=>({...s,downloads:a.get(s.name)||0}));e({pluginCatalog:i,isCatalogLoading:!1})}catch(o){console.error("Не удалось загрузить каталог плагинов:",o.message),e({pluginCatalog:[],isCatalogLoading:!1})}},fetchInstalledPlugins:async o=>{try{const i=(await Ne(`/api/bots/${o}/plugins`)).map(s=>{let l;try{l=s.manifest?JSON.parse(s.manifest):{}}catch{console.error(`Ошибка парсинга манифеста для плагина ${s.name}`),l={}}const d=t().pluginCatalog.find(h=>h.name===s.name);return{...s,manifest:l,author:(d==null?void 0:d.author)||l.author||"Неизвестный автор",description:s.description||l.description||"Нет описания"}});e(s=>{s.installedPlugins[o]=i})}catch(a){console.error("Не удалось загрузить плагины для бота",o,a),e(i=>{i.installedPlugins[o]=[]})}},togglePlugin:async(o,a,i)=>{await Ne(`/api/bots/${o}/plugins/${a}`,{method:"PUT",body:JSON.stringify({isEnabled:i})},"Статус плагина обновлен."),await t().fetchInstalledPlugins(o)},deletePlugin:async(o,a,i)=>{await Ne(`/api/bots/${o}/plugins/${a}`,{method:"DELETE"},`Плагин "${i}" удален.`),await t().fetchInstalledPlugins(o)},installPluginFromRepo:async(o,a,i)=>{i&&t().optimisticallyIncrementDownloadCount(i);try{const s=await Ne(`/api/bots/${o}/plugins/install/github`,{method:"POST",body:JSON.stringify({repoUrl:a})});return Gt({title:"Успех!",description:`Плагин "${s.name}" успешно установлен.`}),await t().fetchInstalledPlugins(o),s}catch(s){throw await t().fetchPluginCatalog(),s}},installPluginFromPath:async(o,a)=>{try{const i=await Ne(`/api/bots/${o}/plugins/install/local`,{method:"POST",body:JSON.stringify({path:a})});return Gt({title:"Успех!",description:`Плагин "${i.name}" успешно установлен.`}),i}catch(i){throw i}finally{await t().fetchInstalledPlugins(o),await t().fetchPluginCatalog()}},checkForUpdates:async(o,a=!1)=>{try{const i=Date.now(),s=`plugin_update_check_${o}`,l=localStorage.getItem(s),d=l?parseInt(l,10):null,h=10*60*1e3;if(!a&&d&&i-d<h)return;const p=await Ne(`/api/plugins/check-updates/${o}`,{method:"POST"}),m=p.reduce((v,x)=>({...v,[x.sourceUri]:x}),{});localStorage.setItem(s,i.toString()),e(v=>{v.pluginUpdates[o]=m,v.lastUpdateCheck[o]=i}),Gt({title:"Проверка завершена",description:`Найдено обновлений: ${p.length}`})}catch(i){console.error("Ошибка проверки обновлений:",i)}},updatePlugin:async(o,a)=>{await Ne(`/api/plugins/update/${o}`,{method:"POST"},"Плагин обновлен. Перезапустите бота."),await t().fetchInstalledPlugins(a),await t().checkForUpdates(a)},createIdePlugin:async(o,{name:a,template:i})=>wY(t,o,`/api/bots/${o}/plugins/ide/create`,{method:"POST",body:JSON.stringify({name:a,template:i})},`Плагин "${a}" успешно создан.`),updatePluginManifest:async(o,a,i)=>{e(KJ(s=>{const l=s.installedPlugins.find(d=>d.name===a&&d.botId===o);l&&(l.name=i.name,l.version=i.version,l.description=i.description)}))},forkPlugin:async(o,a)=>wY(t,o,`/api/bots/${o}/plugins/ide/${a}/fork`,{method:"POST"},`Копия плагина "${a}" успешно создана.`)}),P0e=(e,t)=>({tasks:[],fetchTasks:async()=>{try{const n=await Ne("/api/tasks");e({tasks:n||[]})}catch(n){console.error("Не удалось загрузить задачи:",n.message),e({tasks:[]})}},createTask:async n=>{const o=await Ne("/api/tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},"Задача успешно создана.");return o&&e(a=>{a.tasks.unshift(o)}),o},updateTask:async(n,o)=>{const a=await Ne(`/api/tasks/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},"Задача успешно обновлена.");return a&&e(i=>{const s=i.tasks.findIndex(l=>l.id===n);s!==-1&&(i.tasks[s]={...i.tasks[s],...a})}),a},deleteTask:async n=>{await Ne(`/api/tasks/${n}`,{method:"DELETE"},"Задача успешно удалена."),e(o=>{o.tasks=o.tasks.filter(a=>a.id!==n)})}}),$0e=(e,t)=>({token:localStorage.getItem("authToken")||null,user:null,isAuthenticated:!1,needsSetup:!1,authInitialized:!1,hasPermission:n=>{var a;if(!n)return!0;const o=((a=t().user)==null?void 0:a.permissions)||[];return o.includes("*")||o.includes(n)},initializeAuth:async()=>{try{if((await Ne("/api/auth/status")).needsSetup){e({needsSetup:!0,isAuthenticated:!1,token:null,user:null});return}if(e({needsSetup:!1}),t().token){const a=await Ne("/api/auth/me");e({user:a,isAuthenticated:!0})}else e({isAuthenticated:!1,user:null,token:null})}catch(n){console.error("Auth initialization failed:",n.message),(n.message.includes("Невалидный токен")||n.message.includes("Нет токена"))&&localStorage.removeItem("authToken"),e({isAuthenticated:!1,token:null,user:null})}finally{e({authInitialized:!0})}},login:async(n,o)=>{try{const a=await Ne("/api/auth/login",{method:"POST",body:JSON.stringify({username:n,password:o})});localStorage.setItem("authToken",a.token),e({token:a.token,user:a.user,isAuthenticated:!0})}catch(a){throw console.error("Login failed:",a),a}},setupAdmin:async(n,o)=>{const a=await Ne("/api/auth/setup",{method:"POST",body:JSON.stringify({username:n,password:o})});localStorage.setItem("authToken",a.token),e({token:a.token,user:a.user,isAuthenticated:!0,needsSetup:!1})},logout:()=>{const n=t().socket;n&&n.disconnect(),localStorage.removeItem("authToken"),e({token:null,user:null,isAuthenticated:!1,socket:null})}}),D0e=e=>({theme:localStorage.getItem("blockmine-theme")||"system",setTheme:t=>{const n=window.document.documentElement;n.classList.remove("light","dark");let o="light";t==="system"?(o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",n.classList.add(o)):n.classList.add(t),localStorage.setItem("blockmine-theme",t),e({theme:t})}}),je=FJ(QJ((...e)=>({...I0e(...e),...T0e(...e),...R0e(...e),...P0e(...e),...$0e(...e),...D0e(...e)})));function Me(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function bY(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ui(...e){return t=>{let n=!1;const o=e.map(a=>{const i=bY(a,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a<o.length;a++){const i=o[a];typeof i=="function"?i():bY(e[a],null)}}}}function ot(...e){return k.useCallback(ui(...e),e)}function z0e(e,t){const n=k.createContext(t),o=i=>{const{children:s,...l}=i,d=k.useMemo(()=>l,Object.values(l));return u.jsx(n.Provider,{value:d,children:s})};o.displayName=e+"Provider";function a(i){const s=k.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[o,a]}function zn(e,t=[]){let n=[];function o(i,s){const l=k.createContext(s),d=n.length;n=[...n,s];const h=m=>{var _;const{scope:v,children:x,...M}=m,b=((_=v==null?void 0:v[e])==null?void 0:_[d])||l,C=k.useMemo(()=>M,Object.values(M));return u.jsx(b.Provider,{value:C,children:x})};h.displayName=i+"Provider";function p(m,v){var b;const x=((b=v==null?void 0:v[e])==null?void 0:b[d])||l,M=k.useContext(x);if(M)return M;if(s!==void 0)return s;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,p]}const a=()=>{const i=n.map(s=>k.createContext(s));return function(l){const d=(l==null?void 0:l[e])||i;return k.useMemo(()=>({[`__scope${e}`]:{...l,[e]:d}}),[l,d])}};return a.scopeName=e,[o,O0e(a,...t)]}function O0e(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const s=o.reduce((l,{useScope:d,scopeName:h})=>{const m=d(i)[`__scope${h}`];return{...l,...m}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Cs(e){const t=H0e(e),n=k.forwardRef((o,a)=>{const{children:i,...s}=o,l=k.Children.toArray(i),d=l.find(V0e);if(d){const h=d.props.children,p=l.map(m=>m===d?k.Children.count(h)>1?k.Children.only(null):k.isValidElement(h)?h.props.children:null:m);return u.jsx(t,{...s,ref:a,children:k.isValidElement(h)?k.cloneElement(h,void 0,p):null})}return u.jsx(t,{...s,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}var q0e=Cs("Slot");function H0e(e){const t=k.forwardRef((n,o)=>{const{children:a,...i}=n;if(k.isValidElement(a)){const s=F0e(a),l=B0e(i,a.props);return a.type!==k.Fragment&&(l.ref=o?ui(o,s):s),k.cloneElement(a,l)}return k.Children.count(a)>1?k.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hee=Symbol("radix.slottable");function fee(e){const t=({children:n})=>u.jsx(u.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=hee,t}function V0e(e){return k.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hee}function B0e(e,t){const n={...t};for(const o in t){const a=e[o],i=t[o];/^on[A-Z]/.test(o)?a&&i?n[o]=(...l)=>{const d=i(...l);return a(...l),d}:a&&(n[o]=a):o==="style"?n[o]={...a,...i}:o==="className"&&(n[o]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function F0e(e){var o,a;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function dp(e){const t=e+"CollectionProvider",[n,o]=zn(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=b=>{const{scope:C,children:_}=b,N=le.useRef(null),A=le.useRef(new Map).current;return u.jsx(a,{scope:C,itemMap:A,collectionRef:N,children:_})};s.displayName=t;const l=e+"CollectionSlot",d=Cs(l),h=le.forwardRef((b,C)=>{const{scope:_,children:N}=b,A=i(l,_),I=ot(C,A.collectionRef);return u.jsx(d,{ref:I,children:N})});h.displayName=l;const p=e+"CollectionItemSlot",m="data-radix-collection-item",v=Cs(p),x=le.forwardRef((b,C)=>{const{scope:_,children:N,...A}=b,I=le.useRef(null),R=ot(C,I),j=i(p,_);return le.useEffect(()=>(j.itemMap.set(I,{ref:I,...A}),()=>void j.itemMap.delete(I))),u.jsx(v,{[m]:"",ref:R,children:N})});x.displayName=p;function M(b){const C=i(e+"CollectionConsumer",b);return le.useCallback(()=>{const N=C.collectionRef.current;if(!N)return[];const A=Array.from(N.querySelectorAll(`[${m}]`));return Array.from(C.itemMap.values()).sort((j,D)=>A.indexOf(j.ref.current)-A.indexOf(D.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:s,Slot:h,ItemSlot:x},M,o]}var U0e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ae=U0e.reduce((e,t)=>{const n=Cs(`Primitive.${t}`),o=k.forwardRef((a,i)=>{const{asChild:s,...l}=a,d=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(d,{...l,ref:i})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function IV(e,t){e&&f1.flushSync(()=>e.dispatchEvent(t))}function gn(e){const t=k.useRef(e);return k.useEffect(()=>{t.current=e}),k.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function G0e(e,t=globalThis==null?void 0:globalThis.document){const n=gn(e);k.useEffect(()=>{const o=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var X0e="DismissableLayer",Gq="dismissableLayer.update",Z0e="dismissableLayer.pointerDownOutside",Y0e="dismissableLayer.focusOutside",MY,pee=k.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),p1=k.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...d}=e,h=k.useContext(pee),[p,m]=k.useState(null),v=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=k.useState({}),M=ot(t,D=>m(D)),b=Array.from(h.layers),[C]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),_=b.indexOf(C),N=p?b.indexOf(p):-1,A=h.layersWithOutsidePointerEventsDisabled.size>0,I=N>=_,R=K0e(D=>{const H=D.target,U=[...h.branches].some(z=>z.contains(H));!I||U||(a==null||a(D),s==null||s(D),D.defaultPrevented||l==null||l())},v),j=Q0e(D=>{const H=D.target;[...h.branches].some(z=>z.contains(H))||(i==null||i(D),s==null||s(D),D.defaultPrevented||l==null||l())},v);return G0e(D=>{N===h.layers.size-1&&(o==null||o(D),!D.defaultPrevented&&l&&(D.preventDefault(),l()))},v),k.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(MY=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),_Y(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=MY)}},[p,v,n,h]),k.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),_Y())},[p,h]),k.useEffect(()=>{const D=()=>x({});return document.addEventListener(Gq,D),()=>document.removeEventListener(Gq,D)},[]),u.jsx(Ae.div,{...d,ref:M,style:{pointerEvents:A?I?"auto":"none":void 0,...e.style},onFocusCapture:Me(e.onFocusCapture,j.onFocusCapture),onBlurCapture:Me(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:Me(e.onPointerDownCapture,R.onPointerDownCapture)})});p1.displayName=X0e;var W0e="DismissableLayerBranch",yee=k.forwardRef((e,t)=>{const n=k.useContext(pee),o=k.useRef(null),a=ot(t,o);return k.useEffect(()=>{const i=o.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),u.jsx(Ae.div,{...e,ref:a})});yee.displayName=W0e;function K0e(e,t=globalThis==null?void 0:globalThis.document){const n=gn(e),o=k.useRef(!1),a=k.useRef(()=>{});return k.useEffect(()=>{const i=l=>{if(l.target&&!o.current){let d=function(){mee(Z0e,n,h,{discrete:!0})};const h={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=d,t.addEventListener("click",a.current,{once:!0})):d()}else t.removeEventListener("click",a.current);o.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function Q0e(e,t=globalThis==null?void 0:globalThis.document){const n=gn(e),o=k.useRef(!1);return k.useEffect(()=>{const a=i=>{i.target&&!o.current&&mee(Y0e,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function _Y(){const e=new CustomEvent(Gq);document.dispatchEvent(e)}function mee(e,t,n,{discrete:o}){const a=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),o?IV(a,i):a.dispatchEvent(i)}var J0e=p1,epe=yee,Gn=globalThis!=null&&globalThis.document?k.useLayoutEffect:()=>{},tpe="Portal",y1=k.forwardRef((e,t)=>{var l;const{container:n,...o}=e,[a,i]=k.useState(!1);Gn(()=>i(!0),[]);const s=n||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?kfe.createPortal(u.jsx(Ae.div,{...o,ref:t}),s):null});y1.displayName=tpe;function npe(e,t){return k.useReducer((n,o)=>t[n][o]??n,e)}var jn=e=>{const{present:t,children:n}=e,o=ope(t),a=typeof n=="function"?n({present:o.isPresent}):k.Children.only(n),i=ot(o.ref,ape(a));return typeof n=="function"||o.isPresent?k.cloneElement(a,{ref:i}):null};jn.displayName="Presence";function ope(e){const[t,n]=k.useState(),o=k.useRef(null),a=k.useRef(e),i=k.useRef("none"),s=e?"mounted":"unmounted",[l,d]=npe(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{const h=Qy(o.current);i.current=l==="mounted"?h:"none"},[l]),Gn(()=>{const h=o.current,p=a.current;if(p!==e){const v=i.current,x=Qy(h);e?d("MOUNT"):x==="none"||(h==null?void 0:h.display)==="none"?d("UNMOUNT"):d(p&&v!==x?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,d]),Gn(()=>{if(t){let h;const p=t.ownerDocument.defaultView??window,m=x=>{const b=Qy(o.current).includes(x.animationName);if(x.target===t&&b&&(d("ANIMATION_END"),!a.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",h=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},v=x=>{x.target===t&&(i.current=Qy(o.current))};return t.addEventListener("animationstart",v),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{p.clearTimeout(h),t.removeEventListener("animationstart",v),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:k.useCallback(h=>{o.current=h?getComputedStyle(h):null,n(h)},[])}}function Qy(e){return(e==null?void 0:e.animationName)||"none"}function ape(e){var o,a;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var rpe=yV[" useInsertionEffect ".trim().toString()]||Gn;function go({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[a,i,s]=ipe({defaultProp:t,onChange:n}),l=e!==void 0,d=l?e:a;{const p=k.useRef(e!==void 0);k.useEffect(()=>{const m=p.current;m!==l&&console.warn(`${o} is changing from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=l},[l,o])}const h=k.useCallback(p=>{var m;if(l){const v=spe(p)?p(e):p;v!==e&&((m=s.current)==null||m.call(s,v))}else i(p)},[l,e,i,s]);return[d,h]}function ipe({defaultProp:e,onChange:t}){const[n,o]=k.useState(e),a=k.useRef(n),i=k.useRef(t);return rpe(()=>{i.current=t},[t]),k.useEffect(()=>{var s;a.current!==n&&((s=i.current)==null||s.call(i,n),a.current=n)},[n,a]),[n,o,i]}function spe(e){return typeof e=="function"}var gee=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),cpe="VisuallyHidden",IP=k.forwardRef((e,t)=>u.jsx(Ae.span,{...e,ref:t,style:{...gee,...e.style}}));IP.displayName=cpe;var lpe=IP,TV="ToastProvider",[RV,upe,dpe]=dp("Toast"),[vee,Pqt]=zn("Toast",[dpe]),[hpe,TP]=vee(TV),kee=e=>{const{__scopeToast:t,label:n="Notification",duration:o=5e3,swipeDirection:a="right",swipeThreshold:i=50,children:s}=e,[l,d]=k.useState(null),[h,p]=k.useState(0),m=k.useRef(!1),v=k.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${TV}\`. Expected non-empty \`string\`.`),u.jsx(RV.Provider,{scope:t,children:u.jsx(hpe,{scope:t,label:n,duration:o,swipeDirection:a,swipeThreshold:i,toastCount:h,viewport:l,onViewportChange:d,onToastAdd:k.useCallback(()=>p(x=>x+1),[]),onToastRemove:k.useCallback(()=>p(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:v,children:s})})};kee.displayName=TV;var xee="ToastViewport",fpe=["F8"],Xq="toast.viewportPause",Zq="toast.viewportResume",wee=k.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:o=fpe,label:a="Notifications ({hotkey})",...i}=e,s=TP(xee,n),l=upe(n),d=k.useRef(null),h=k.useRef(null),p=k.useRef(null),m=k.useRef(null),v=ot(t,m,s.onViewportChange),x=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=s.toastCount>0;k.useEffect(()=>{const C=_=>{var A;o.length!==0&&o.every(I=>_[I]||_.code===I)&&((A=m.current)==null||A.focus())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[o]),k.useEffect(()=>{const C=d.current,_=m.current;if(M&&C&&_){const N=()=>{if(!s.isClosePausedRef.current){const j=new CustomEvent(Xq);_.dispatchEvent(j),s.isClosePausedRef.current=!0}},A=()=>{if(s.isClosePausedRef.current){const j=new CustomEvent(Zq);_.dispatchEvent(j),s.isClosePausedRef.current=!1}},I=j=>{!C.contains(j.relatedTarget)&&A()},R=()=>{C.contains(document.activeElement)||A()};return C.addEventListener("focusin",N),C.addEventListener("focusout",I),C.addEventListener("pointermove",N),C.addEventListener("pointerleave",R),window.addEventListener("blur",N),window.addEventListener("focus",A),()=>{C.removeEventListener("focusin",N),C.removeEventListener("focusout",I),C.removeEventListener("pointermove",N),C.removeEventListener("pointerleave",R),window.removeEventListener("blur",N),window.removeEventListener("focus",A)}}},[M,s.isClosePausedRef]);const b=k.useCallback(({tabbingDirection:C})=>{const N=l().map(A=>{const I=A.ref.current,R=[I,...Cpe(I)];return C==="forwards"?R:R.reverse()});return(C==="forwards"?N.reverse():N).flat()},[l]);return k.useEffect(()=>{const C=m.current;if(C){const _=N=>{var R,j,D;const A=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!A){const H=document.activeElement,U=N.shiftKey;if(N.target===C&&U){(R=h.current)==null||R.focus();return}const q=b({tabbingDirection:U?"backwards":"forwards"}),G=q.findIndex(E=>E===H);hO(q.slice(G+1))?N.preventDefault():U?(j=h.current)==null||j.focus():(D=p.current)==null||D.focus()}};return C.addEventListener("keydown",_),()=>C.removeEventListener("keydown",_)}},[l,b]),u.jsxs(epe,{ref:d,role:"region","aria-label":a.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:M?void 0:"none"},children:[M&&u.jsx(Yq,{ref:h,onFocusFromOutsideViewport:()=>{const C=b({tabbingDirection:"forwards"});hO(C)}}),u.jsx(RV.Slot,{scope:n,children:u.jsx(Ae.ol,{tabIndex:-1,...i,ref:v})}),M&&u.jsx(Yq,{ref:p,onFocusFromOutsideViewport:()=>{const C=b({tabbingDirection:"backwards"});hO(C)}})]})});wee.displayName=xee;var bee="ToastFocusProxy",Yq=k.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:o,...a}=e,i=TP(bee,n);return u.jsx(IP,{"aria-hidden":!0,tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:s=>{var h;const l=s.relatedTarget;!((h=i.viewport)!=null&&h.contains(l))&&o()}})});Yq.displayName=bee;var hp="Toast",ppe="toast.swipeStart",ype="toast.swipeMove",mpe="toast.swipeCancel",gpe="toast.swipeEnd",Mee=k.forwardRef((e,t)=>{const{forceMount:n,open:o,defaultOpen:a,onOpenChange:i,...s}=e,[l,d]=go({prop:o,defaultProp:a??!0,onChange:i,caller:hp});return u.jsx(jn,{present:n||l,children:u.jsx(xpe,{open:l,...s,ref:t,onClose:()=>d(!1),onPause:gn(e.onPause),onResume:gn(e.onResume),onSwipeStart:Me(e.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Me(e.onSwipeMove,h=>{const{x:p,y:m}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${p}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:Me(e.onSwipeCancel,h=>{h.currentTarget.setAttribute("data-swipe","cancel"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Me(e.onSwipeEnd,h=>{const{x:p,y:m}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","end"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${p}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),d(!1)})})})});Mee.displayName=hp;var[vpe,kpe]=vee(hp,{onClose(){}}),xpe=k.forwardRef((e,t)=>{const{__scopeToast:n,type:o="foreground",duration:a,open:i,onClose:s,onEscapeKeyDown:l,onPause:d,onResume:h,onSwipeStart:p,onSwipeMove:m,onSwipeCancel:v,onSwipeEnd:x,...M}=e,b=TP(hp,n),[C,_]=k.useState(null),N=ot(t,E=>_(E)),A=k.useRef(null),I=k.useRef(null),R=a||b.duration,j=k.useRef(0),D=k.useRef(R),H=k.useRef(0),{onToastAdd:U,onToastRemove:z}=b,Z=gn(()=>{var O;(C==null?void 0:C.contains(document.activeElement))&&((O=b.viewport)==null||O.focus()),s()}),q=k.useCallback(E=>{!E||E===1/0||(window.clearTimeout(H.current),j.current=new Date().getTime(),H.current=window.setTimeout(Z,E))},[Z]);k.useEffect(()=>{const E=b.viewport;if(E){const O=()=>{q(D.current),h==null||h()},P=()=>{const X=new Date().getTime()-j.current;D.current=D.current-X,window.clearTimeout(H.current),d==null||d()};return E.addEventListener(Xq,P),E.addEventListener(Zq,O),()=>{E.removeEventListener(Xq,P),E.removeEventListener(Zq,O)}}},[b.viewport,R,d,h,q]),k.useEffect(()=>{i&&!b.isClosePausedRef.current&&q(R)},[i,R,b.isClosePausedRef,q]),k.useEffect(()=>(U(),()=>z()),[U,z]);const G=k.useMemo(()=>C?Aee(C):null,[C]);return b.viewport?u.jsxs(u.Fragment,{children:[G&&u.jsx(wpe,{__scopeToast:n,role:"status","aria-live":o==="foreground"?"assertive":"polite","aria-atomic":!0,children:G}),u.jsx(vpe,{scope:n,onClose:Z,children:f1.createPortal(u.jsx(RV.ItemSlot,{scope:n,children:u.jsx(J0e,{asChild:!0,onEscapeKeyDown:Me(l,()=>{b.isFocusedToastEscapeKeyDownRef.current||Z(),b.isFocusedToastEscapeKeyDownRef.current=!1}),children:u.jsx(Ae.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":b.swipeDirection,...M,ref:N,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Me(e.onKeyDown,E=>{E.key==="Escape"&&(l==null||l(E.nativeEvent),E.nativeEvent.defaultPrevented||(b.isFocusedToastEscapeKeyDownRef.current=!0,Z()))}),onPointerDown:Me(e.onPointerDown,E=>{E.button===0&&(A.current={x:E.clientX,y:E.clientY})}),onPointerMove:Me(e.onPointerMove,E=>{if(!A.current)return;const O=E.clientX-A.current.x,P=E.clientY-A.current.y,X=!!I.current,W=["left","right"].includes(b.swipeDirection),V=["left","up"].includes(b.swipeDirection)?Math.min:Math.max,L=W?V(0,O):0,Y=W?0:V(0,P),F=E.pointerType==="touch"?10:2,T={x:L,y:Y},K={originalEvent:E,delta:T};X?(I.current=T,Jy(ype,m,K,{discrete:!1})):SY(T,b.swipeDirection,F)?(I.current=T,Jy(ppe,p,K,{discrete:!1}),E.target.setPointerCapture(E.pointerId)):(Math.abs(O)>F||Math.abs(P)>F)&&(A.current=null)}),onPointerUp:Me(e.onPointerUp,E=>{const O=I.current,P=E.target;if(P.hasPointerCapture(E.pointerId)&&P.releasePointerCapture(E.pointerId),I.current=null,A.current=null,O){const X=E.currentTarget,W={originalEvent:E,delta:O};SY(O,b.swipeDirection,b.swipeThreshold)?Jy(gpe,x,W,{discrete:!0}):Jy(mpe,v,W,{discrete:!0}),X.addEventListener("click",V=>V.preventDefault(),{once:!0})}})})})}),b.viewport)})]}):null}),wpe=e=>{const{__scopeToast:t,children:n,...o}=e,a=TP(hp,t),[i,s]=k.useState(!1),[l,d]=k.useState(!1);return _pe(()=>s(!0)),k.useEffect(()=>{const h=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(h)},[]),l?null:u.jsx(y1,{asChild:!0,children:u.jsx(IP,{...o,children:i&&u.jsxs(u.Fragment,{children:[a.label," ",n]})})})},bpe="ToastTitle",_ee=k.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return u.jsx(Ae.div,{...o,ref:t})});_ee.displayName=bpe;var Mpe="ToastDescription",See=k.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return u.jsx(Ae.div,{...o,ref:t})});See.displayName=Mpe;var Cee="ToastAction",Nee=k.forwardRef((e,t)=>{const{altText:n,...o}=e;return n.trim()?u.jsx(jee,{altText:n,asChild:!0,children:u.jsx(PV,{...o,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Cee}\`. Expected non-empty \`string\`.`),null)});Nee.displayName=Cee;var Lee="ToastClose",PV=k.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e,a=kpe(Lee,n);return u.jsx(jee,{asChild:!0,children:u.jsx(Ae.button,{type:"button",...o,ref:t,onClick:Me(e.onClick,a.onClose)})})});PV.displayName=Lee;var jee=k.forwardRef((e,t)=>{const{__scopeToast:n,altText:o,...a}=e;return u.jsx(Ae.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0,...a,ref:t})});function Aee(e){const t=[];return Array.from(e.childNodes).forEach(o=>{if(o.nodeType===o.TEXT_NODE&&o.textContent&&t.push(o.textContent),Spe(o)){const a=o.ariaHidden||o.hidden||o.style.display==="none",i=o.dataset.radixToastAnnounceExclude==="";if(!a)if(i){const s=o.dataset.radixToastAnnounceAlt;s&&t.push(s)}else t.push(...Aee(o))}}),t}function Jy(e,t,n,{discrete:o}){const a=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),o?IV(a,i):a.dispatchEvent(i)}var SY=(e,t,n=0)=>{const o=Math.abs(e.x),a=Math.abs(e.y),i=o>a;return t==="left"||t==="right"?i&&o>n:!i&&a>n};function _pe(e=()=>{}){const t=gn(e);Gn(()=>{let n=0,o=0;return n=window.requestAnimationFrame(()=>o=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(o)}},[t])}function Spe(e){return e.nodeType===e.ELEMENT_NODE}function Cpe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const a=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||a?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function hO(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var Npe=kee,Eee=wee,Iee=Mee,Tee=_ee,Ree=See,Pee=Nee,$ee=PV;function Dee(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=Dee(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function zee(){for(var e,t,n=0,o="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=Dee(e))&&(o&&(o+=" "),o+=t);return o}const CY=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,NY=zee,r2=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return NY(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=t,s=Object.keys(a).map(h=>{const p=n==null?void 0:n[h],m=i==null?void 0:i[h];if(p===null)return null;const v=CY(p)||CY(m);return a[h][v]}),l=n&&Object.entries(n).reduce((h,p)=>{let[m,v]=p;return v===void 0||(h[m]=v),h},{}),d=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((h,p)=>{let{class:m,className:v,...x}=p;return Object.entries(x).every(M=>{let[b,C]=M;return Array.isArray(C)?C.includes({...i,...l}[b]):{...i,...l}[b]===C})?[...h,m,v]:h},[]);return NY(e,s,d,n==null?void 0:n.class,n==null?void 0:n.className)};/**
70
+ */function xfe(e){return k.createElement(P2e,{flushSync:f1.flushSync,...e})}const cY=e=>{let t;const n=new Set,o=(h,p)=>{const m=typeof h=="function"?h(t):h;if(!Object.is(m,t)){const v=t;t=p??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(x=>x(t,v))}},a=()=>t,l={setState:o,getState:a,getInitialState:()=>d,subscribe:h=>(n.add(h),()=>n.delete(h))},d=t=e(o,a,l);return l},wfe=e=>e?cY(e):cY,bfe=e=>e;function Mfe(e,t=bfe){const n=le.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return le.useDebugValue(n),n}const lY=e=>{const t=wfe(e),n=o=>Mfe(t,o);return Object.assign(n,t),n},FJ=e=>e?lY(e):lY;var UJ=Symbol.for("immer-nothing"),uY=Symbol.for("immer-draftable"),ea=Symbol.for("immer-state");function qa(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Fh=Object.getPrototypeOf;function Uh(e){return!!e&&!!e[ea]}function t1(e){var t;return e?GJ(e)||Array.isArray(e)||!!e[uY]||!!((t=e.constructor)!=null&&t[uY])||NP(e)||LP(e):!1}var _fe=Object.prototype.constructor.toString();function GJ(e){if(!e||typeof e!="object")return!1;const t=Fh(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===_fe}function BR(e,t){CP(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,o)=>t(o,n,e))}function CP(e){const t=e[ea];return t?t.type_:Array.isArray(e)?1:NP(e)?2:LP(e)?3:0}function Rq(e,t){return CP(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function XJ(e,t,n){const o=CP(e);o===2?e.set(t,n):o===3?e.add(n):e[t]=n}function Sfe(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function NP(e){return e instanceof Map}function LP(e){return e instanceof Set}function cc(e){return e.copy_||e.base_}function Pq(e,t){if(NP(e))return new Map(e);if(LP(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=GJ(e);if(t===!0||t==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(e);delete o[ea];let a=Reflect.ownKeys(o);for(let i=0;i<a.length;i++){const s=a[i],l=o[s];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(o[s]={configurable:!0,writable:!0,enumerable:l.enumerable,value:e[s]})}return Object.create(Fh(e),o)}else{const o=Fh(e);if(o!==null&&n)return{...e};const a=Object.create(o);return Object.assign(a,e)}}function SV(e,t=!1){return jP(e)||Uh(e)||!t1(e)||(CP(e)>1&&(e.set=e.add=e.clear=e.delete=Cfe),Object.freeze(e),t&&Object.entries(e).forEach(([n,o])=>SV(o,!0))),e}function Cfe(){qa(2)}function jP(e){return Object.isFrozen(e)}var Nfe={};function n1(e){const t=Nfe[e];return t||qa(0,e),t}var P0;function ZJ(){return P0}function Lfe(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function dY(e,t){t&&(n1("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function $q(e){Dq(e),e.drafts_.forEach(jfe),e.drafts_=null}function Dq(e){e===P0&&(P0=e.parent_)}function hY(e){return P0=Lfe(P0,e)}function jfe(e){const t=e[ea];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function fY(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[ea].modified_&&($q(t),qa(4)),t1(e)&&(e=FR(t,e),t.parent_||UR(t,e)),t.patches_&&n1("Patches").generateReplacementPatches_(n[ea].base_,e,t.patches_,t.inversePatches_)):e=FR(t,n,[]),$q(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==UJ?e:void 0}function FR(e,t,n){if(jP(t))return t;const o=t[ea];if(!o)return BR(t,(a,i)=>pY(e,o,t,a,i,n)),t;if(o.scope_!==e)return t;if(!o.modified_)return UR(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const a=o.copy_;let i=a,s=!1;o.type_===3&&(i=new Set(a),a.clear(),s=!0),BR(i,(l,d)=>pY(e,o,a,l,d,n,s)),UR(e,a,!1),n&&e.patches_&&n1("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function pY(e,t,n,o,a,i,s){if(Uh(a)){const l=i&&t&&t.type_!==3&&!Rq(t.assigned_,o)?i.concat(o):void 0,d=FR(e,a,l);if(XJ(n,o,d),Uh(d))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(t1(a)&&!jP(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;FR(e,a),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,o)&&UR(e,a)}}function UR(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&SV(t,n)}function Afe(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:ZJ(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=o,i=CV;n&&(a=[o],i=$0);const{revoke:s,proxy:l}=Proxy.revocable(a,i);return o.draft_=l,o.revoke_=s,l}var CV={get(e,t){if(t===ea)return e;const n=cc(e);if(!Rq(n,t))return Efe(e,n,t);const o=n[t];return e.finalized_||!t1(o)?o:o===rO(e.base_,t)?(iO(e),e.copy_[t]=Oq(o,e)):o},has(e,t){return t in cc(e)},ownKeys(e){return Reflect.ownKeys(cc(e))},set(e,t,n){const o=YJ(cc(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const a=rO(cc(e),t),i=a==null?void 0:a[ea];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Sfe(n,a)&&(n!==void 0||Rq(e.base_,t)))return!0;iO(e),zq(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return rO(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,iO(e),zq(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=cc(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:o.enumerable,value:n[t]}},defineProperty(){qa(11)},getPrototypeOf(e){return Fh(e.base_)},setPrototypeOf(){qa(12)}},$0={};BR(CV,(e,t)=>{$0[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});$0.deleteProperty=function(e,t){return $0.set.call(this,e,t,void 0)};$0.set=function(e,t,n){return CV.set.call(this,e[0],t,n,e[0])};function rO(e,t){const n=e[ea];return(n?cc(n):e)[t]}function Efe(e,t,n){var a;const o=YJ(t,n);return o?"value"in o?o.value:(a=o.get)==null?void 0:a.call(e.draft_):void 0}function YJ(e,t){if(!(t in e))return;let n=Fh(e);for(;n;){const o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Fh(n)}}function zq(e){e.modified_||(e.modified_=!0,e.parent_&&zq(e.parent_))}function iO(e){e.copy_||(e.copy_=Pq(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Ife=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,o)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(d=i,...h){return s.produce(d,p=>n.call(this,p,...h))}}typeof n!="function"&&qa(6),o!==void 0&&typeof o!="function"&&qa(7);let a;if(t1(t)){const i=hY(this),s=Oq(t,void 0);let l=!0;try{a=n(s),l=!1}finally{l?$q(i):Dq(i)}return dY(i,o),fY(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===UJ&&(a=void 0),this.autoFreeze_&&SV(a,!0),o){const i=[],s=[];n1("Patches").generateReplacementPatches_(t,a,i,s),o(i,s)}return a}else qa(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...l)=>this.produceWithPatches(s,d=>t(d,...l));let o,a;return[this.produce(t,n,(s,l)=>{o=s,a=l}),o,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){t1(e)||qa(8),Uh(e)&&(e=Tfe(e));const t=hY(this),n=Oq(e,void 0);return n[ea].isManual_=!0,Dq(t),n}finishDraft(e,t){const n=e&&e[ea];(!n||!n.isManual_)&&qa(9);const{scope_:o}=n;return dY(o,t),fY(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const a=t[n];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}n>-1&&(t=t.slice(n+1));const o=n1("Patches").applyPatches_;return Uh(e)?o(e,t):this.produce(e,a=>o(a,t))}};function Oq(e,t){const n=NP(e)?n1("MapSet").proxyMap_(e,t):LP(e)?n1("MapSet").proxySet_(e,t):Afe(e,t);return(t?t.scope_:ZJ()).drafts_.push(n),n}function Tfe(e){return Uh(e)||qa(10,e),WJ(e)}function WJ(e){if(!t1(e)||jP(e))return e;const t=e[ea];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Pq(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Pq(e,!0);return BR(n,(o,a)=>{XJ(n,o,WJ(a))}),t&&(t.finalized_=!1),n}var ta=new Ife,KJ=ta.produce;ta.produceWithPatches.bind(ta);ta.setAutoFreeze.bind(ta);ta.setUseStrictShallowCopy.bind(ta);ta.applyPatches.bind(ta);ta.createDraft.bind(ta);ta.finishDraft.bind(ta);const Rfe=e=>(t,n,o)=>(o.setState=(a,i,...s)=>{const l=typeof a=="function"?KJ(a):a;return t(l,i,...s)},e(o.setState,n,o)),QJ=Rfe,Lr=Object.create(null);Lr.open="0";Lr.close="1";Lr.ping="2";Lr.pong="3";Lr.message="4";Lr.upgrade="5";Lr.noop="6";const Em=Object.create(null);Object.keys(Lr).forEach(e=>{Em[Lr[e]]=e});const qq={type:"error",data:"parser error"},JJ=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",eee=typeof ArrayBuffer=="function",tee=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,NV=({type:e,data:t},n,o)=>JJ&&t instanceof Blob?n?o(t):yY(t,o):eee&&(t instanceof ArrayBuffer||tee(t))?n?o(t):yY(new Blob([t]),o):o(Lr[e]+(t||"")),yY=(e,t)=>{const n=new FileReader;return n.onload=function(){const o=n.result.split(",")[1];t("b"+(o||""))},n.readAsDataURL(e)};function mY(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let sO;function Pfe(e,t){if(JJ&&e.data instanceof Blob)return e.data.arrayBuffer().then(mY).then(t);if(eee&&(e.data instanceof ArrayBuffer||tee(e.data)))return t(mY(e.data));NV(e,!1,n=>{sO||(sO=new TextEncoder),t(sO.encode(n))})}const gY="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$f=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<gY.length;e++)$f[gY.charCodeAt(e)]=e;const $fe=e=>{let t=e.length*.75,n=e.length,o,a=0,i,s,l,d;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const h=new ArrayBuffer(t),p=new Uint8Array(h);for(o=0;o<n;o+=4)i=$f[e.charCodeAt(o)],s=$f[e.charCodeAt(o+1)],l=$f[e.charCodeAt(o+2)],d=$f[e.charCodeAt(o+3)],p[a++]=i<<2|s>>4,p[a++]=(s&15)<<4|l>>2,p[a++]=(l&3)<<6|d&63;return h},Dfe=typeof ArrayBuffer=="function",LV=(e,t)=>{if(typeof e!="string")return{type:"message",data:nee(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:zfe(e.substring(1),t)}:Em[n]?e.length>1?{type:Em[n],data:e.substring(1)}:{type:Em[n]}:qq},zfe=(e,t)=>{if(Dfe){const n=$fe(e);return nee(n,t)}else return{base64:!0,data:e}},nee=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},oee="",Ofe=(e,t)=>{const n=e.length,o=new Array(n);let a=0;e.forEach((i,s)=>{NV(i,!1,l=>{o[s]=l,++a===n&&t(o.join(oee))})})},qfe=(e,t)=>{const n=e.split(oee),o=[];for(let a=0;a<n.length;a++){const i=LV(n[a],t);if(o.push(i),i.type==="error")break}return o};function Hfe(){return new TransformStream({transform(e,t){Pfe(e,n=>{const o=n.length;let a;if(o<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,o);else if(o<65536){a=new Uint8Array(3);const i=new DataView(a.buffer);i.setUint8(0,126),i.setUint16(1,o)}else{a=new Uint8Array(9);const i=new DataView(a.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(o))}e.data&&typeof e.data!="string"&&(a[0]|=128),t.enqueue(a),t.enqueue(n)})}})}let cO;function Wy(e){return e.reduce((t,n)=>t+n.length,0)}function Ky(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let o=0;for(let a=0;a<t;a++)n[a]=e[0][o++],o===e[0].length&&(e.shift(),o=0);return e.length&&o<e[0].length&&(e[0]=e[0].slice(o)),n}function Vfe(e,t){cO||(cO=new TextDecoder);const n=[];let o=0,a=-1,i=!1;return new TransformStream({transform(s,l){for(n.push(s);;){if(o===0){if(Wy(n)<1)break;const d=Ky(n,1);i=(d[0]&128)===128,a=d[0]&127,a<126?o=3:a===126?o=1:o=2}else if(o===1){if(Wy(n)<2)break;const d=Ky(n,2);a=new DataView(d.buffer,d.byteOffset,d.length).getUint16(0),o=3}else if(o===2){if(Wy(n)<8)break;const d=Ky(n,8),h=new DataView(d.buffer,d.byteOffset,d.length),p=h.getUint32(0);if(p>Math.pow(2,21)-1){l.enqueue(qq);break}a=p*Math.pow(2,32)+h.getUint32(4),o=3}else{if(Wy(n)<a)break;const d=Ky(n,a);l.enqueue(LV(i?d:cO.decode(d),t)),o=0}if(a===0||a>e){l.enqueue(qq);break}}}})}const aee=4;function $n(e){if(e)return Bfe(e)}function Bfe(e){for(var t in $n.prototype)e[t]=$n.prototype[t];return e}$n.prototype.on=$n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};$n.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};$n.prototype.off=$n.prototype.removeListener=$n.prototype.removeAllListeners=$n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var o,a=0;a<n.length;a++)if(o=n[a],o===t||o.fn===t){n.splice(a,1);break}return n.length===0&&delete this._callbacks["$"+e],this};$n.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],o=1;o<arguments.length;o++)t[o-1]=arguments[o];if(n){n=n.slice(0);for(var o=0,a=n.length;o<a;++o)n[o].apply(this,t)}return this};$n.prototype.emitReserved=$n.prototype.emit;$n.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};$n.prototype.hasListeners=function(e){return!!this.listeners(e).length};const AP=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),ga=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ffe="arraybuffer";function ree(e,...t){return t.reduce((n,o)=>(e.hasOwnProperty(o)&&(n[o]=e[o]),n),{})}const Ufe=ga.setTimeout,Gfe=ga.clearTimeout;function EP(e,t){t.useNativeTimers?(e.setTimeoutFn=Ufe.bind(ga),e.clearTimeoutFn=Gfe.bind(ga)):(e.setTimeoutFn=ga.setTimeout.bind(ga),e.clearTimeoutFn=ga.clearTimeout.bind(ga))}const Xfe=1.33;function Zfe(e){return typeof e=="string"?Yfe(e):Math.ceil((e.byteLength||e.size)*Xfe)}function Yfe(e){let t=0,n=0;for(let o=0,a=e.length;o<a;o++)t=e.charCodeAt(o),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(o++,n+=4);return n}function iee(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Wfe(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Kfe(e){let t={},n=e.split("&");for(let o=0,a=n.length;o<a;o++){let i=n[o].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}class Qfe extends Error{constructor(t,n,o){super(t),this.description=n,this.context=o,this.type="TransportError"}}class jV extends $n{constructor(t){super(),this.writable=!1,EP(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,o){return super.emitReserved("error",new Qfe(t,n,o)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=LV(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=Wfe(t);return n.length?"?"+n:""}}class Jfe extends jV{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let o=0;this._polling&&(o++,this.once("pollComplete",function(){--o||n()})),this.writable||(o++,this.once("drain",function(){--o||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=o=>{if(this.readyState==="opening"&&o.type==="open"&&this.onOpen(),o.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(o)};qfe(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Ofe(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=iee()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let see=!1;try{see=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const e0e=see;function t0e(){}class n0e extends Jfe{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let o=location.port;o||(o=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||o!==t.port}}doWrite(t,n){const o=this.request({method:"POST",data:t});o.on("success",n),o.on("error",(a,i)=>{this.onError("xhr post error",a,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,o)=>{this.onError("xhr poll error",n,o)}),this.pollXhr=t}}let _h=class Im extends $n{constructor(t,n,o){super(),this.createRequest=t,EP(this,o),this._opts=o,this._method=o.method||"GET",this._uri=n,this._data=o.data!==void 0?o.data:null,this._create()}_create(){var t;const n=ree(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const o=this._xhr=this.createRequest(n);try{o.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){o.setDisableHeaderCheck&&o.setDisableHeaderCheck(!0);for(let a in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&o.setRequestHeader(a,this._opts.extraHeaders[a])}}catch{}if(this._method==="POST")try{o.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{o.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(o),"withCredentials"in o&&(o.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(o.timeout=this._opts.requestTimeout),o.onreadystatechange=()=>{var a;o.readyState===3&&((a=this._opts.cookieJar)===null||a===void 0||a.parseCookies(o.getResponseHeader("set-cookie"))),o.readyState===4&&(o.status===200||o.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof o.status=="number"?o.status:0)},0))},o.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}typeof document<"u"&&(this._index=Im.requestsCount++,Im.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=t0e,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Im.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};_h.requestsCount=0;_h.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",vY);else if(typeof addEventListener=="function"){const e="onpagehide"in ga?"pagehide":"unload";addEventListener(e,vY,!1)}}function vY(){for(let e in _h.requests)_h.requests.hasOwnProperty(e)&&_h.requests[e].abort()}const o0e=function(){const e=cee({xdomain:!1});return e&&e.responseType!==null}();class a0e extends n0e{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=o0e&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new _h(cee,this.uri(),t)}}function cee(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||e0e))return new XMLHttpRequest}catch{}if(!t)try{return new ga[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const lee=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class r0e extends jV{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,o=lee?{}:ree(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(o.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,o)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const o=t[n],a=n===t.length-1;NV(o,this.supportsBinary,i=>{try{this.doWrite(o,i)}catch{}a&&AP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=iee()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const lO=ga.WebSocket||ga.MozWebSocket;class i0e extends r0e{createSocket(t,n,o){return lee?new lO(t,n,o):n?new lO(t,n):new lO(t)}doWrite(t,n){this.ws.send(n)}}class s0e extends jV{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=Vfe(Number.MAX_SAFE_INTEGER,this.socket.binaryType),o=t.readable.pipeThrough(n).getReader(),a=Hfe();a.readable.pipeTo(t.writable),this._writer=a.writable.getWriter();const i=()=>{o.read().then(({done:l,value:d})=>{l||(this.onPacket(d),i())}).catch(l=>{})};i();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const o=t[n],a=n===t.length-1;this._writer.write(o).then(()=>{a&&AP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const c0e={websocket:i0e,webtransport:s0e,polling:a0e},l0e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,u0e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Hq(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),o=e.indexOf("]");n!=-1&&o!=-1&&(e=e.substring(0,n)+e.substring(n,o).replace(/:/g,";")+e.substring(o,e.length));let a=l0e.exec(e||""),i={},s=14;for(;s--;)i[u0e[s]]=a[s]||"";return n!=-1&&o!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=d0e(i,i.path),i.queryKey=h0e(i,i.query),i}function d0e(e,t){const n=/\/{2,9}/g,o=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&o.splice(0,1),t.slice(-1)=="/"&&o.splice(o.length-1,1),o}function h0e(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(o,a,i){a&&(n[a]=i)}),n}const Vq=typeof addEventListener=="function"&&typeof removeEventListener=="function",Tm=[];Vq&&addEventListener("offline",()=>{Tm.forEach(e=>e())},!1);class fs extends $n{constructor(t,n){if(super(),this.binaryType=Ffe,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const o=Hq(t);n.hostname=o.host,n.secure=o.protocol==="https"||o.protocol==="wss",n.port=o.port,o.query&&(n.query=o.query)}else n.host&&(n.hostname=Hq(n.host).host);EP(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(o=>{const a=o.prototype.name;this.transports.push(a),this._transportsByName[a]=o}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Kfe(this.opts.query)),Vq&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Tm.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=aee,n.transport=t,this.id&&(n.sid=this.id);const o=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](o)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&fs.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",fs.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let o=0;o<this.writeBuffer.length;o++){const a=this.writeBuffer[o].data;if(a&&(n+=Zfe(a)),o>0&&n>this._maxPayload)return this.writeBuffer.slice(0,o);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,AP(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,o){return this._sendPacket("message",t,n,o),this}send(t,n,o){return this._sendPacket("message",t,n,o),this}_sendPacket(t,n,o,a){if(typeof n=="function"&&(a=n,n=void 0),typeof o=="function"&&(a=o,o=null),this.readyState==="closing"||this.readyState==="closed")return;o=o||{},o.compress=o.compress!==!1;const i={type:t,data:n,options:o};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),a&&this.once("flush",a),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},o=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?o():t()}):this.upgrading?o():t()),this}_onError(t){if(fs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Vq&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const o=Tm.indexOf(this._offlineEventListener);o!==-1&&Tm.splice(o,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}fs.protocol=aee;class f0e extends fs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),o=!1;fs.priorWebsocketSuccess=!1;const a=()=>{o||(n.send([{type:"ping",data:"probe"}]),n.once("packet",m=>{if(!o)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;fs.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{o||this.readyState!=="closed"&&(p(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=n.name,this.emitReserved("upgradeError",v)}}))};function i(){o||(o=!0,p(),n.close(),n=null)}const s=m=>{const v=new Error("probe error: "+m);v.transport=n.name,i(),this.emitReserved("upgradeError",v)};function l(){s("transport closed")}function d(){s("socket closed")}function h(m){n&&m.name!==n.name&&i()}const p=()=>{n.removeListener("open",a),n.removeListener("error",s),n.removeListener("close",l),this.off("close",d),this.off("upgrading",h)};n.once("open",a),n.once("error",s),n.once("close",l),this.once("close",d),this.once("upgrading",h),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{o||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let o=0;o<t.length;o++)~this.transports.indexOf(t[o])&&n.push(t[o]);return n}}let p0e=class extends f0e{constructor(t,n={}){const o=typeof t=="object"?t:n;(!o.transports||o.transports&&typeof o.transports[0]=="string")&&(o.transports=(o.transports||["polling","websocket","webtransport"]).map(a=>c0e[a]).filter(a=>!!a)),super(t,o)}};function y0e(e,t="",n){let o=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),o=Hq(e)),o.port||(/^(http|ws)$/.test(o.protocol)?o.port="80":/^(http|ws)s$/.test(o.protocol)&&(o.port="443")),o.path=o.path||"/";const i=o.host.indexOf(":")!==-1?"["+o.host+"]":o.host;return o.id=o.protocol+"://"+i+":"+o.port+t,o.href=o.protocol+"://"+i+(n&&n.port===o.port?"":":"+o.port),o}const m0e=typeof ArrayBuffer=="function",g0e=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,uee=Object.prototype.toString,v0e=typeof Blob=="function"||typeof Blob<"u"&&uee.call(Blob)==="[object BlobConstructor]",k0e=typeof File=="function"||typeof File<"u"&&uee.call(File)==="[object FileConstructor]";function AV(e){return m0e&&(e instanceof ArrayBuffer||g0e(e))||v0e&&e instanceof Blob||k0e&&e instanceof File}function Rm(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,o=e.length;n<o;n++)if(Rm(e[n]))return!0;return!1}if(AV(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Rm(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Rm(e[n]))return!0;return!1}function x0e(e){const t=[],n=e.data,o=e;return o.data=Bq(n,t),o.attachments=t.length,{packet:o,buffers:t}}function Bq(e,t){if(!e)return e;if(AV(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let o=0;o<e.length;o++)n[o]=Bq(e[o],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=Bq(e[o],t));return n}return e}function w0e(e,t){return e.data=Fq(e.data,t),delete e.attachments,e}function Fq(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Fq(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Fq(e[n],t));return e}const b0e=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],M0e=5;var _t;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(_t||(_t={}));class _0e{constructor(t){this.replacer=t}encode(t){return(t.type===_t.EVENT||t.type===_t.ACK)&&Rm(t)?this.encodeAsBinary({type:t.type===_t.EVENT?_t.BINARY_EVENT:_t.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===_t.BINARY_EVENT||t.type===_t.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=x0e(t),o=this.encodeAsString(n.packet),a=n.buffers;return a.unshift(o),a}}function kY(e){return Object.prototype.toString.call(e)==="[object Object]"}class EV extends $n{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const o=n.type===_t.BINARY_EVENT;o||n.type===_t.BINARY_ACK?(n.type=o?_t.EVENT:_t.ACK,this.reconstructor=new S0e(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(AV(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const o={type:Number(t.charAt(0))};if(_t[o.type]===void 0)throw new Error("unknown packet type "+o.type);if(o.type===_t.BINARY_EVENT||o.type===_t.BINARY_ACK){const i=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const s=t.substring(i,n);if(s!=Number(s)||t.charAt(n)!=="-")throw new Error("Illegal attachments");o.attachments=Number(s)}if(t.charAt(n+1)==="/"){const i=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););o.nsp=t.substring(i,n)}else o.nsp="/";const a=t.charAt(n+1);if(a!==""&&Number(a)==a){const i=n+1;for(;++n;){const s=t.charAt(n);if(s==null||Number(s)!=s){--n;break}if(n===t.length)break}o.id=Number(t.substring(i,n+1))}if(t.charAt(++n)){const i=this.tryParse(t.substr(n));if(EV.isPayloadValid(o.type,i))o.data=i;else throw new Error("invalid payload")}return o}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case _t.CONNECT:return kY(n);case _t.DISCONNECT:return n===void 0;case _t.CONNECT_ERROR:return typeof n=="string"||kY(n);case _t.EVENT:case _t.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&b0e.indexOf(n[0])===-1);case _t.ACK:case _t.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class S0e{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=w0e(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const C0e=Object.freeze(Object.defineProperty({__proto__:null,Decoder:EV,Encoder:_0e,get PacketType(){return _t},protocol:M0e},Symbol.toStringTag,{value:"Module"}));function Da(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const N0e=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class dee extends $n{constructor(t,n,o){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,o&&o.auth&&(this.auth=o.auth),this._opts=Object.assign({},o),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Da(t,"open",this.onopen.bind(this)),Da(t,"packet",this.onpacket.bind(this)),Da(t,"error",this.onerror.bind(this)),Da(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var o,a,i;if(N0e.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const s={type:_t.EVENT,data:n};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const p=this.ids++,m=n.pop();this._registerAckCallback(p,m),s.id=p}const l=(a=(o=this.io.engine)===null||o===void 0?void 0:o.transport)===null||a===void 0?void 0:a.writable,d=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!l||(d?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(t,n){var o;const a=(o=this.flags.timeout)!==null&&o!==void 0?o:this._opts.ackTimeout;if(a===void 0){this.acks[t]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===t&&this.sendBuffer.splice(l,1);n.call(this,new Error("operation has timed out"))},a),s=(...l)=>{this.io.clearTimeoutFn(i),n.apply(this,l)};s.withError=!0,this.acks[t]=s}emitWithAck(t,...n){return new Promise((o,a)=>{const i=(s,l)=>s?a(s):o(l);i.withError=!0,n.push(i),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const o={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((a,...i)=>o!==this._queue[0]?void 0:(a!==null?o.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...i)),o.pending=!1,this._drainQueue())),this._queue.push(o),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:_t.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(o=>String(o.id)===t)){const o=this.acks[t];delete this.acks[t],o.withError&&o.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case _t.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case _t.EVENT:case _t.BINARY_EVENT:this.onevent(t);break;case _t.ACK:case _t.BINARY_ACK:this.onack(t);break;case _t.DISCONNECT:this.ondisconnect();break;case _t.CONNECT_ERROR:this.destroy();const o=new Error(t.data.message);o.data=t.data.data,this.emitReserved("connect_error",o);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const o of n)o.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let o=!1;return function(...a){o||(o=!0,n.packet({type:_t.ACK,id:t,data:a}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:_t.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let o=0;o<n.length;o++)if(t===n[o])return n.splice(o,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let o=0;o<n.length;o++)if(t===n[o])return n.splice(o,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const o of n)o.apply(this,t.data)}}}function a2(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}a2.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};a2.prototype.reset=function(){this.attempts=0};a2.prototype.setMin=function(e){this.ms=e};a2.prototype.setMax=function(e){this.max=e};a2.prototype.setJitter=function(e){this.jitter=e};class Uq extends $n{constructor(t,n){var o;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,EP(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((o=n.randomizationFactor)!==null&&o!==void 0?o:.5),this.backoff=new a2({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const a=n.parser||C0e;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new p0e(this.uri,this.opts);const n=this.engine,o=this;this._readyState="opening",this.skipReconnect=!1;const a=Da(n,"open",function(){o.onopen(),t&&t()}),i=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},s=Da(n,"error",i);if(this._timeout!==!1){const l=this._timeout,d=this.setTimeoutFn(()=>{a(),i(new Error("timeout")),n.close()},l);this.opts.autoUnref&&d.unref(),this.subs.push(()=>{this.clearTimeoutFn(d)})}return this.subs.push(a),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Da(t,"ping",this.onping.bind(this)),Da(t,"data",this.ondata.bind(this)),Da(t,"error",this.onerror.bind(this)),Da(t,"close",this.onclose.bind(this)),Da(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){AP(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let o=this.nsps[t];return o?this._autoConnect&&!o.active&&o.connect():(o=new dee(this,t,n),this.nsps[t]=o),o}_destroy(t){const n=Object.keys(this.nsps);for(const o of n)if(this.nsps[o].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let o=0;o<n.length;o++)this.engine.write(n[o],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var o;this.cleanup(),(o=this.engine)===null||o===void 0||o.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const o=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(a=>{a?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",a)):t.onreconnect()}))},n);this.opts.autoUnref&&o.unref(),this.subs.push(()=>{this.clearTimeoutFn(o)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const wf={};function Pm(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=y0e(e,t.path||"/socket.io"),o=n.source,a=n.id,i=n.path,s=wf[a]&&i in wf[a].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let d;return l?d=new Uq(o,t):(wf[a]||(wf[a]=new Uq(o,t)),d=wf[a]),n.query&&!t.query&&(t.query=n.queryKey),d.socket(n.path,t)}Object.assign(Pm,{Manager:Uq,Socket:dee,io:Pm,connect:Pm});const L0e=1,j0e=1e6;let uO=0;function A0e(){return uO=(uO+1)%Number.MAX_SAFE_INTEGER,uO.toString()}const dO=new Map,xY=e=>{if(dO.has(e))return;const t=setTimeout(()=>{dO.delete(e),Gf({type:"REMOVE_TOAST",toastId:e})},j0e);dO.set(e,t)},E0e=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,L0e)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?xY(n):e.toasts.forEach(o=>{xY(o.id)}),{...e,toasts:e.toasts.map(o=>o.id===n||n===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},$m=[];let Dm={toasts:[]};function Gf(e){Dm=E0e(Dm,e),$m.forEach(t=>{t(Dm)})}function Vt({...e}){const t=A0e(),n=a=>Gf({type:"UPDATE_TOAST",toast:{...a,id:t}}),o=()=>Gf({type:"DISMISS_TOAST",toastId:t});return Gf({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||o()}}}),{id:t,dismiss:o,update:n}}function Yt(){const[e,t]=k.useState(Dm);return k.useEffect(()=>($m.push(t),()=>{const n=$m.indexOf(t);n>-1&&$m.splice(n,1)}),[e]),{...e,toast:Vt,dismiss:n=>Gf({type:"DISMISS_TOAST",toastId:n})}}const Ne=async(e,t={},n)=>{const o=je.getState().token,a={"Content-Type":"application/json",...t.headers};o&&(a.Authorization=`Bearer ${o}`);const i={...t,headers:a};i.body&&typeof i.body=="object"&&(i.body=JSON.stringify(i.body));try{const s=await fetch(e,i);if(s.status===204||s.headers.get("content-length")==="0")return n&&Vt({title:"Успех!",description:n}),!0;const l=await s.json();if(!s.ok){if(s.status===401){if(!e.endsWith("/api/auth/login")){const{logout:d}=je.getState();d()}throw new Error(l.error||"Ошибка авторизации")}throw new Error(l.error||"Произошла неизвестная ошибка на сервере")}return n&&Vt({title:"Успех!",description:n}),l}catch(s){if(s.message.includes("NetworkError")||s.message.includes("Failed to fetch"))Vt({variant:"destructive",title:"Ошибка сети",description:"Не удается подключиться к серверу"});else if(s.message.includes("Невалидный токен")){const{logout:l}=je.getState();return l(),null}else Vt({variant:"destructive",title:"Ошибка",description:s.message});throw s}},I0e=(e,t)=>({socket:null,bots:[],servers:[],botStatuses:{},botLogs:{},resourceUsage:{},appVersion:"",connectSocket:()=>{const n=t().socket;if(n&&(n.connected||n.connecting)){console.log("[Socket] Соединение уже установлено или в процессе.");return}const o=t().token;if(!o){console.log("[Socket] Подключение отложено, нет токена.");return}const a=window.location.origin,i=Pm(a,{path:"/socket.io/",auth:{token:o},reconnectionAttempts:5,reconnectionDelay:2e3,transports:["websocket","polling"]});i.on("connect",()=>console.log("Socket.IO подключен:",i.id)),i.on("disconnect",s=>console.log("Socket.IO отключен:",s)),i.on("connect_error",s=>console.warn(`[Socket] Ошибка подключения: ${s.message}`)),i.on("bot:status",({botId:s,status:l,message:d})=>{e(h=>({botStatuses:{...h.botStatuses,[s]:l}})),d&&t().appendLog(s,`[SYSTEM] ${d}`)}),i.on("bot:log",({botId:s,log:l})=>t().appendLog(s,l)),i.on("bots:usage",s=>{const l=s.reduce((d,h)=>({...d,[h.botId]:h}),{});e({resourceUsage:l})}),e({socket:i})},disconnectSocket:()=>{const n=t().socket;n&&(n.disconnect(),e({socket:null}))},fetchInitialData:async()=>{try{const[n,o,a,i]=await Promise.all([Ne("/api/bots"),Ne("/api/servers"),Ne("/api/bots/state"),Ne("/api/version")]);e(s=>{s.bots=n||[],s.servers=o||[],s.botStatuses=a.statuses||{},s.appVersion=i.version||"";const l=a.logs||{};for(const d in l){const p=[...s.botLogs[d]||[],...l[d]],m=Array.from(new Map(p.map(v=>[v.id,v])).values());s.botLogs[d]=m.slice(-500)}})}catch(n){console.error("Не удалось загрузить начальные данные:",n.message),e(o=>{o.bots=[],o.servers=[]})}},appendLog:(n,o)=>{e(a=>{const i=a.botLogs[n]||[],s=typeof o=="object"&&o!==null&&o.id?o:{id:Date.now()+Math.random(),content:typeof o=="object"&&o!==null?JSON.stringify(o):o},l=[...i,s],d=Array.from(new Map(l.map(h=>[h.id,h])).values());a.botLogs[n]=d.slice(-500)})}}),T0e=(e,t)=>({createBot:async n=>{const o=await Ne("/api/bots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},"Новый бот успешно создан.");return o&&await t().fetchInitialData(),o},startBot:async n=>{await Ne(`/api/bots/${n}/start`,{method:"POST"})},stopBot:async n=>{await Ne(`/api/bots/${n}/stop`,{method:"POST"})},deleteBot:async n=>{await Ne(`/api/bots/${n}`,{method:"DELETE"},"Бот успешно удален."),await t().fetchInitialData()},startAllBots:async()=>{await Ne("/api/bots/start-all",{method:"POST"},"Команда на запуск всех ботов отправлена.")},stopAllBots:async()=>{await Ne("/api/bots/stop-all",{method:"POST"},"Команда на остановку всех ботов отправлена.")}}),wY=async(e,t,n,o,a)=>{try{const i=await Ne(n,o,a);return await e().fetchInstalledPlugins(t),i}catch(i){throw console.error(`[PluginOperation] Failed: ${n}`,{botId:t,endpoint:n,params:o.body?JSON.parse(o.body):{},error:i.message,stack:i.stack}),i}},R0e=(e,t)=>({installedPlugins:{},pluginUpdates:{},pluginCatalog:[],isCatalogLoading:!0,lastUpdateCheck:(()=>{const o={};for(let a=0;a<localStorage.length;a++){const i=localStorage.key(a);if(i&&i.startsWith("plugin_update_check_")){const s=i.replace("plugin_update_check_",""),l=localStorage.getItem(i);l&&(o[s]=parseInt(l,10))}}return o})(),optimisticallyIncrementDownloadCount:o=>{e(a=>{const i=a.pluginCatalog.find(s=>s.name===o);i&&(i.downloads=(i.downloads||0)+1)})},fetchPluginCatalog:async()=>{if(t().pluginCatalog.length>0){e({isCatalogLoading:!1});return}e({isCatalogLoading:!0});try{const o=await Ne("/api/plugins/catalog");let a=new Map;try{const s=await fetch("http://185.65.200.184:3000/api/stats");if(s.ok){const l=await s.json();a=new Map(((l==null?void 0:l.plugins)||[]).map(d=>[d.pluginName,d.downloadCount]))}}catch(s){console.warn("Не удалось загрузить статистику скачиваний плагинов:",s.message)}const i=(o||[]).map(s=>({...s,downloads:a.get(s.name)||0}));e({pluginCatalog:i,isCatalogLoading:!1})}catch(o){console.error("Не удалось загрузить каталог плагинов:",o.message),e({pluginCatalog:[],isCatalogLoading:!1})}},fetchInstalledPlugins:async o=>{try{const i=(await Ne(`/api/bots/${o}/plugins`)).map(s=>{let l;try{l=s.manifest?JSON.parse(s.manifest):{}}catch{console.error(`Ошибка парсинга манифеста для плагина ${s.name}`),l={}}const d=t().pluginCatalog.find(h=>h.name===s.name);return{...s,manifest:l,author:(d==null?void 0:d.author)||l.author||"Неизвестный автор",description:s.description||l.description||"Нет описания"}});e(s=>{s.installedPlugins[o]=i})}catch(a){console.error("Не удалось загрузить плагины для бота",o,a),e(i=>{i.installedPlugins[o]=[]})}},togglePlugin:async(o,a,i)=>{await Ne(`/api/bots/${o}/plugins/${a}`,{method:"PUT",body:JSON.stringify({isEnabled:i})},"Статус плагина обновлен."),await t().fetchInstalledPlugins(o)},deletePlugin:async(o,a,i)=>{await Ne(`/api/bots/${o}/plugins/${a}`,{method:"DELETE"},`Плагин "${i}" удален.`),await t().fetchInstalledPlugins(o)},installPluginFromRepo:async(o,a,i)=>{i&&t().optimisticallyIncrementDownloadCount(i);try{const s=await Ne(`/api/bots/${o}/plugins/install/github`,{method:"POST",body:JSON.stringify({repoUrl:a})});return Vt({title:"Успех!",description:`Плагин "${s.name}" успешно установлен.`}),await t().fetchInstalledPlugins(o),s}catch(s){throw await t().fetchPluginCatalog(),s}},installPluginFromPath:async(o,a)=>{try{const i=await Ne(`/api/bots/${o}/plugins/install/local`,{method:"POST",body:JSON.stringify({path:a})});return Vt({title:"Успех!",description:`Плагин "${i.name}" успешно установлен.`}),i}catch(i){throw i}finally{await t().fetchInstalledPlugins(o),await t().fetchPluginCatalog()}},checkForUpdates:async(o,a=!1)=>{try{const i=Date.now(),s=`plugin_update_check_${o}`,l=localStorage.getItem(s),d=l?parseInt(l,10):null,h=10*60*1e3;if(!a&&d&&i-d<h)return;const p=await Ne(`/api/plugins/check-updates/${o}`,{method:"POST"}),m=p.reduce((v,x)=>({...v,[x.sourceUri]:x}),{});localStorage.setItem(s,i.toString()),e(v=>{v.pluginUpdates[o]=m,v.lastUpdateCheck[o]=i}),Vt({title:"Проверка завершена",description:`Найдено обновлений: ${p.length}`})}catch(i){console.error("Ошибка проверки обновлений:",i)}},updatePlugin:async(o,a)=>{await Ne(`/api/plugins/update/${o}`,{method:"POST"},"Плагин обновлен. Перезапустите бота."),await t().fetchInstalledPlugins(a),await t().checkForUpdates(a)},createIdePlugin:async(o,{name:a,template:i})=>wY(t,o,`/api/bots/${o}/plugins/ide/create`,{method:"POST",body:JSON.stringify({name:a,template:i})},`Плагин "${a}" успешно создан.`),updatePluginManifest:async(o,a,i)=>{e(KJ(s=>{const l=s.installedPlugins.find(d=>d.name===a&&d.botId===o);l&&(l.name=i.name,l.version=i.version,l.description=i.description)}))},forkPlugin:async(o,a)=>wY(t,o,`/api/bots/${o}/plugins/ide/${a}/fork`,{method:"POST"},`Копия плагина "${a}" успешно создана.`)}),P0e=(e,t)=>({tasks:[],fetchTasks:async()=>{try{const n=await Ne("/api/tasks");e({tasks:n||[]})}catch(n){console.error("Не удалось загрузить задачи:",n.message),e({tasks:[]})}},createTask:async n=>{const o=await Ne("/api/tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},"Задача успешно создана.");return o&&e(a=>{a.tasks.unshift(o)}),o},updateTask:async(n,o)=>{const a=await Ne(`/api/tasks/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},"Задача успешно обновлена.");return a&&e(i=>{const s=i.tasks.findIndex(l=>l.id===n);s!==-1&&(i.tasks[s]={...i.tasks[s],...a})}),a},deleteTask:async n=>{await Ne(`/api/tasks/${n}`,{method:"DELETE"},"Задача успешно удалена."),e(o=>{o.tasks=o.tasks.filter(a=>a.id!==n)})}}),$0e=(e,t)=>({token:localStorage.getItem("authToken")||null,user:null,isAuthenticated:!1,needsSetup:!1,authInitialized:!1,hasPermission:n=>{var a;if(!n)return!0;const o=((a=t().user)==null?void 0:a.permissions)||[];return o.includes("*")||o.includes(n)},initializeAuth:async()=>{try{if((await Ne("/api/auth/status")).needsSetup){e({needsSetup:!0,isAuthenticated:!1,token:null,user:null});return}if(e({needsSetup:!1}),t().token){const a=await Ne("/api/auth/me");e({user:a,isAuthenticated:!0})}else e({isAuthenticated:!1,user:null,token:null})}catch(n){console.error("Auth initialization failed:",n.message),(n.message.includes("Невалидный токен")||n.message.includes("Нет токена"))&&localStorage.removeItem("authToken"),e({isAuthenticated:!1,token:null,user:null})}finally{e({authInitialized:!0})}},login:async(n,o)=>{try{const a=await Ne("/api/auth/login",{method:"POST",body:JSON.stringify({username:n,password:o})});localStorage.setItem("authToken",a.token),e({token:a.token,user:a.user,isAuthenticated:!0})}catch(a){throw console.error("Login failed:",a),a}},setupAdmin:async(n,o)=>{const a=await Ne("/api/auth/setup",{method:"POST",body:JSON.stringify({username:n,password:o})});localStorage.setItem("authToken",a.token),e({token:a.token,user:a.user,isAuthenticated:!0,needsSetup:!1})},logout:()=>{const n=t().socket;n&&n.disconnect(),localStorage.removeItem("authToken"),e({token:null,user:null,isAuthenticated:!1,socket:null})}}),D0e=e=>({theme:localStorage.getItem("blockmine-theme")||"system",setTheme:t=>{const n=window.document.documentElement;n.classList.remove("light","dark");let o="light";t==="system"?(o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",n.classList.add(o)):n.classList.add(t),localStorage.setItem("blockmine-theme",t),e({theme:t})}}),je=FJ(QJ((...e)=>({...I0e(...e),...T0e(...e),...R0e(...e),...P0e(...e),...$0e(...e),...D0e(...e)})));function Me(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function bY(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ui(...e){return t=>{let n=!1;const o=e.map(a=>{const i=bY(a,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a<o.length;a++){const i=o[a];typeof i=="function"?i():bY(e[a],null)}}}}function ot(...e){return k.useCallback(ui(...e),e)}function z0e(e,t){const n=k.createContext(t),o=i=>{const{children:s,...l}=i,d=k.useMemo(()=>l,Object.values(l));return u.jsx(n.Provider,{value:d,children:s})};o.displayName=e+"Provider";function a(i){const s=k.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[o,a]}function zn(e,t=[]){let n=[];function o(i,s){const l=k.createContext(s),d=n.length;n=[...n,s];const h=m=>{var _;const{scope:v,children:x,...M}=m,b=((_=v==null?void 0:v[e])==null?void 0:_[d])||l,C=k.useMemo(()=>M,Object.values(M));return u.jsx(b.Provider,{value:C,children:x})};h.displayName=i+"Provider";function p(m,v){var b;const x=((b=v==null?void 0:v[e])==null?void 0:b[d])||l,M=k.useContext(x);if(M)return M;if(s!==void 0)return s;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,p]}const a=()=>{const i=n.map(s=>k.createContext(s));return function(l){const d=(l==null?void 0:l[e])||i;return k.useMemo(()=>({[`__scope${e}`]:{...l,[e]:d}}),[l,d])}};return a.scopeName=e,[o,O0e(a,...t)]}function O0e(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const s=o.reduce((l,{useScope:d,scopeName:h})=>{const m=d(i)[`__scope${h}`];return{...l,...m}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Cs(e){const t=H0e(e),n=k.forwardRef((o,a)=>{const{children:i,...s}=o,l=k.Children.toArray(i),d=l.find(V0e);if(d){const h=d.props.children,p=l.map(m=>m===d?k.Children.count(h)>1?k.Children.only(null):k.isValidElement(h)?h.props.children:null:m);return u.jsx(t,{...s,ref:a,children:k.isValidElement(h)?k.cloneElement(h,void 0,p):null})}return u.jsx(t,{...s,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}var q0e=Cs("Slot");function H0e(e){const t=k.forwardRef((n,o)=>{const{children:a,...i}=n;if(k.isValidElement(a)){const s=F0e(a),l=B0e(i,a.props);return a.type!==k.Fragment&&(l.ref=o?ui(o,s):s),k.cloneElement(a,l)}return k.Children.count(a)>1?k.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hee=Symbol("radix.slottable");function fee(e){const t=({children:n})=>u.jsx(u.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=hee,t}function V0e(e){return k.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hee}function B0e(e,t){const n={...t};for(const o in t){const a=e[o],i=t[o];/^on[A-Z]/.test(o)?a&&i?n[o]=(...l)=>{const d=i(...l);return a(...l),d}:a&&(n[o]=a):o==="style"?n[o]={...a,...i}:o==="className"&&(n[o]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function F0e(e){var o,a;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function dp(e){const t=e+"CollectionProvider",[n,o]=zn(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=b=>{const{scope:C,children:_}=b,N=le.useRef(null),A=le.useRef(new Map).current;return u.jsx(a,{scope:C,itemMap:A,collectionRef:N,children:_})};s.displayName=t;const l=e+"CollectionSlot",d=Cs(l),h=le.forwardRef((b,C)=>{const{scope:_,children:N}=b,A=i(l,_),I=ot(C,A.collectionRef);return u.jsx(d,{ref:I,children:N})});h.displayName=l;const p=e+"CollectionItemSlot",m="data-radix-collection-item",v=Cs(p),x=le.forwardRef((b,C)=>{const{scope:_,children:N,...A}=b,I=le.useRef(null),R=ot(C,I),j=i(p,_);return le.useEffect(()=>(j.itemMap.set(I,{ref:I,...A}),()=>void j.itemMap.delete(I))),u.jsx(v,{[m]:"",ref:R,children:N})});x.displayName=p;function M(b){const C=i(e+"CollectionConsumer",b);return le.useCallback(()=>{const N=C.collectionRef.current;if(!N)return[];const A=Array.from(N.querySelectorAll(`[${m}]`));return Array.from(C.itemMap.values()).sort((j,D)=>A.indexOf(j.ref.current)-A.indexOf(D.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:s,Slot:h,ItemSlot:x},M,o]}var U0e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ae=U0e.reduce((e,t)=>{const n=Cs(`Primitive.${t}`),o=k.forwardRef((a,i)=>{const{asChild:s,...l}=a,d=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(d,{...l,ref:i})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function IV(e,t){e&&f1.flushSync(()=>e.dispatchEvent(t))}function gn(e){const t=k.useRef(e);return k.useEffect(()=>{t.current=e}),k.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function G0e(e,t=globalThis==null?void 0:globalThis.document){const n=gn(e);k.useEffect(()=>{const o=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var X0e="DismissableLayer",Gq="dismissableLayer.update",Z0e="dismissableLayer.pointerDownOutside",Y0e="dismissableLayer.focusOutside",MY,pee=k.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),p1=k.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...d}=e,h=k.useContext(pee),[p,m]=k.useState(null),v=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=k.useState({}),M=ot(t,D=>m(D)),b=Array.from(h.layers),[C]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),_=b.indexOf(C),N=p?b.indexOf(p):-1,A=h.layersWithOutsidePointerEventsDisabled.size>0,I=N>=_,R=K0e(D=>{const H=D.target,U=[...h.branches].some(z=>z.contains(H));!I||U||(a==null||a(D),s==null||s(D),D.defaultPrevented||l==null||l())},v),j=Q0e(D=>{const H=D.target;[...h.branches].some(z=>z.contains(H))||(i==null||i(D),s==null||s(D),D.defaultPrevented||l==null||l())},v);return G0e(D=>{N===h.layers.size-1&&(o==null||o(D),!D.defaultPrevented&&l&&(D.preventDefault(),l()))},v),k.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(MY=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),_Y(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=MY)}},[p,v,n,h]),k.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),_Y())},[p,h]),k.useEffect(()=>{const D=()=>x({});return document.addEventListener(Gq,D),()=>document.removeEventListener(Gq,D)},[]),u.jsx(Ae.div,{...d,ref:M,style:{pointerEvents:A?I?"auto":"none":void 0,...e.style},onFocusCapture:Me(e.onFocusCapture,j.onFocusCapture),onBlurCapture:Me(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:Me(e.onPointerDownCapture,R.onPointerDownCapture)})});p1.displayName=X0e;var W0e="DismissableLayerBranch",yee=k.forwardRef((e,t)=>{const n=k.useContext(pee),o=k.useRef(null),a=ot(t,o);return k.useEffect(()=>{const i=o.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),u.jsx(Ae.div,{...e,ref:a})});yee.displayName=W0e;function K0e(e,t=globalThis==null?void 0:globalThis.document){const n=gn(e),o=k.useRef(!1),a=k.useRef(()=>{});return k.useEffect(()=>{const i=l=>{if(l.target&&!o.current){let d=function(){mee(Z0e,n,h,{discrete:!0})};const h={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=d,t.addEventListener("click",a.current,{once:!0})):d()}else t.removeEventListener("click",a.current);o.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function Q0e(e,t=globalThis==null?void 0:globalThis.document){const n=gn(e),o=k.useRef(!1);return k.useEffect(()=>{const a=i=>{i.target&&!o.current&&mee(Y0e,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function _Y(){const e=new CustomEvent(Gq);document.dispatchEvent(e)}function mee(e,t,n,{discrete:o}){const a=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),o?IV(a,i):a.dispatchEvent(i)}var J0e=p1,epe=yee,Gn=globalThis!=null&&globalThis.document?k.useLayoutEffect:()=>{},tpe="Portal",y1=k.forwardRef((e,t)=>{var l;const{container:n,...o}=e,[a,i]=k.useState(!1);Gn(()=>i(!0),[]);const s=n||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?kfe.createPortal(u.jsx(Ae.div,{...o,ref:t}),s):null});y1.displayName=tpe;function npe(e,t){return k.useReducer((n,o)=>t[n][o]??n,e)}var jn=e=>{const{present:t,children:n}=e,o=ope(t),a=typeof n=="function"?n({present:o.isPresent}):k.Children.only(n),i=ot(o.ref,ape(a));return typeof n=="function"||o.isPresent?k.cloneElement(a,{ref:i}):null};jn.displayName="Presence";function ope(e){const[t,n]=k.useState(),o=k.useRef(null),a=k.useRef(e),i=k.useRef("none"),s=e?"mounted":"unmounted",[l,d]=npe(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{const h=Qy(o.current);i.current=l==="mounted"?h:"none"},[l]),Gn(()=>{const h=o.current,p=a.current;if(p!==e){const v=i.current,x=Qy(h);e?d("MOUNT"):x==="none"||(h==null?void 0:h.display)==="none"?d("UNMOUNT"):d(p&&v!==x?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,d]),Gn(()=>{if(t){let h;const p=t.ownerDocument.defaultView??window,m=x=>{const b=Qy(o.current).includes(x.animationName);if(x.target===t&&b&&(d("ANIMATION_END"),!a.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",h=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},v=x=>{x.target===t&&(i.current=Qy(o.current))};return t.addEventListener("animationstart",v),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{p.clearTimeout(h),t.removeEventListener("animationstart",v),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:k.useCallback(h=>{o.current=h?getComputedStyle(h):null,n(h)},[])}}function Qy(e){return(e==null?void 0:e.animationName)||"none"}function ape(e){var o,a;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var rpe=yV[" useInsertionEffect ".trim().toString()]||Gn;function go({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[a,i,s]=ipe({defaultProp:t,onChange:n}),l=e!==void 0,d=l?e:a;{const p=k.useRef(e!==void 0);k.useEffect(()=>{const m=p.current;m!==l&&console.warn(`${o} is changing from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=l},[l,o])}const h=k.useCallback(p=>{var m;if(l){const v=spe(p)?p(e):p;v!==e&&((m=s.current)==null||m.call(s,v))}else i(p)},[l,e,i,s]);return[d,h]}function ipe({defaultProp:e,onChange:t}){const[n,o]=k.useState(e),a=k.useRef(n),i=k.useRef(t);return rpe(()=>{i.current=t},[t]),k.useEffect(()=>{var s;a.current!==n&&((s=i.current)==null||s.call(i,n),a.current=n)},[n,a]),[n,o,i]}function spe(e){return typeof e=="function"}var gee=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),cpe="VisuallyHidden",IP=k.forwardRef((e,t)=>u.jsx(Ae.span,{...e,ref:t,style:{...gee,...e.style}}));IP.displayName=cpe;var lpe=IP,TV="ToastProvider",[RV,upe,dpe]=dp("Toast"),[vee,Pqt]=zn("Toast",[dpe]),[hpe,TP]=vee(TV),kee=e=>{const{__scopeToast:t,label:n="Notification",duration:o=5e3,swipeDirection:a="right",swipeThreshold:i=50,children:s}=e,[l,d]=k.useState(null),[h,p]=k.useState(0),m=k.useRef(!1),v=k.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${TV}\`. Expected non-empty \`string\`.`),u.jsx(RV.Provider,{scope:t,children:u.jsx(hpe,{scope:t,label:n,duration:o,swipeDirection:a,swipeThreshold:i,toastCount:h,viewport:l,onViewportChange:d,onToastAdd:k.useCallback(()=>p(x=>x+1),[]),onToastRemove:k.useCallback(()=>p(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:v,children:s})})};kee.displayName=TV;var xee="ToastViewport",fpe=["F8"],Xq="toast.viewportPause",Zq="toast.viewportResume",wee=k.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:o=fpe,label:a="Notifications ({hotkey})",...i}=e,s=TP(xee,n),l=upe(n),d=k.useRef(null),h=k.useRef(null),p=k.useRef(null),m=k.useRef(null),v=ot(t,m,s.onViewportChange),x=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=s.toastCount>0;k.useEffect(()=>{const C=_=>{var A;o.length!==0&&o.every(I=>_[I]||_.code===I)&&((A=m.current)==null||A.focus())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[o]),k.useEffect(()=>{const C=d.current,_=m.current;if(M&&C&&_){const N=()=>{if(!s.isClosePausedRef.current){const j=new CustomEvent(Xq);_.dispatchEvent(j),s.isClosePausedRef.current=!0}},A=()=>{if(s.isClosePausedRef.current){const j=new CustomEvent(Zq);_.dispatchEvent(j),s.isClosePausedRef.current=!1}},I=j=>{!C.contains(j.relatedTarget)&&A()},R=()=>{C.contains(document.activeElement)||A()};return C.addEventListener("focusin",N),C.addEventListener("focusout",I),C.addEventListener("pointermove",N),C.addEventListener("pointerleave",R),window.addEventListener("blur",N),window.addEventListener("focus",A),()=>{C.removeEventListener("focusin",N),C.removeEventListener("focusout",I),C.removeEventListener("pointermove",N),C.removeEventListener("pointerleave",R),window.removeEventListener("blur",N),window.removeEventListener("focus",A)}}},[M,s.isClosePausedRef]);const b=k.useCallback(({tabbingDirection:C})=>{const N=l().map(A=>{const I=A.ref.current,R=[I,...Cpe(I)];return C==="forwards"?R:R.reverse()});return(C==="forwards"?N.reverse():N).flat()},[l]);return k.useEffect(()=>{const C=m.current;if(C){const _=N=>{var R,j,D;const A=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!A){const H=document.activeElement,U=N.shiftKey;if(N.target===C&&U){(R=h.current)==null||R.focus();return}const q=b({tabbingDirection:U?"backwards":"forwards"}),G=q.findIndex(E=>E===H);hO(q.slice(G+1))?N.preventDefault():U?(j=h.current)==null||j.focus():(D=p.current)==null||D.focus()}};return C.addEventListener("keydown",_),()=>C.removeEventListener("keydown",_)}},[l,b]),u.jsxs(epe,{ref:d,role:"region","aria-label":a.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:M?void 0:"none"},children:[M&&u.jsx(Yq,{ref:h,onFocusFromOutsideViewport:()=>{const C=b({tabbingDirection:"forwards"});hO(C)}}),u.jsx(RV.Slot,{scope:n,children:u.jsx(Ae.ol,{tabIndex:-1,...i,ref:v})}),M&&u.jsx(Yq,{ref:p,onFocusFromOutsideViewport:()=>{const C=b({tabbingDirection:"backwards"});hO(C)}})]})});wee.displayName=xee;var bee="ToastFocusProxy",Yq=k.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:o,...a}=e,i=TP(bee,n);return u.jsx(IP,{"aria-hidden":!0,tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:s=>{var h;const l=s.relatedTarget;!((h=i.viewport)!=null&&h.contains(l))&&o()}})});Yq.displayName=bee;var hp="Toast",ppe="toast.swipeStart",ype="toast.swipeMove",mpe="toast.swipeCancel",gpe="toast.swipeEnd",Mee=k.forwardRef((e,t)=>{const{forceMount:n,open:o,defaultOpen:a,onOpenChange:i,...s}=e,[l,d]=go({prop:o,defaultProp:a??!0,onChange:i,caller:hp});return u.jsx(jn,{present:n||l,children:u.jsx(xpe,{open:l,...s,ref:t,onClose:()=>d(!1),onPause:gn(e.onPause),onResume:gn(e.onResume),onSwipeStart:Me(e.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Me(e.onSwipeMove,h=>{const{x:p,y:m}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${p}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:Me(e.onSwipeCancel,h=>{h.currentTarget.setAttribute("data-swipe","cancel"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Me(e.onSwipeEnd,h=>{const{x:p,y:m}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","end"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${p}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),d(!1)})})})});Mee.displayName=hp;var[vpe,kpe]=vee(hp,{onClose(){}}),xpe=k.forwardRef((e,t)=>{const{__scopeToast:n,type:o="foreground",duration:a,open:i,onClose:s,onEscapeKeyDown:l,onPause:d,onResume:h,onSwipeStart:p,onSwipeMove:m,onSwipeCancel:v,onSwipeEnd:x,...M}=e,b=TP(hp,n),[C,_]=k.useState(null),N=ot(t,E=>_(E)),A=k.useRef(null),I=k.useRef(null),R=a||b.duration,j=k.useRef(0),D=k.useRef(R),H=k.useRef(0),{onToastAdd:U,onToastRemove:z}=b,Z=gn(()=>{var O;(C==null?void 0:C.contains(document.activeElement))&&((O=b.viewport)==null||O.focus()),s()}),q=k.useCallback(E=>{!E||E===1/0||(window.clearTimeout(H.current),j.current=new Date().getTime(),H.current=window.setTimeout(Z,E))},[Z]);k.useEffect(()=>{const E=b.viewport;if(E){const O=()=>{q(D.current),h==null||h()},P=()=>{const X=new Date().getTime()-j.current;D.current=D.current-X,window.clearTimeout(H.current),d==null||d()};return E.addEventListener(Xq,P),E.addEventListener(Zq,O),()=>{E.removeEventListener(Xq,P),E.removeEventListener(Zq,O)}}},[b.viewport,R,d,h,q]),k.useEffect(()=>{i&&!b.isClosePausedRef.current&&q(R)},[i,R,b.isClosePausedRef,q]),k.useEffect(()=>(U(),()=>z()),[U,z]);const G=k.useMemo(()=>C?Aee(C):null,[C]);return b.viewport?u.jsxs(u.Fragment,{children:[G&&u.jsx(wpe,{__scopeToast:n,role:"status","aria-live":o==="foreground"?"assertive":"polite","aria-atomic":!0,children:G}),u.jsx(vpe,{scope:n,onClose:Z,children:f1.createPortal(u.jsx(RV.ItemSlot,{scope:n,children:u.jsx(J0e,{asChild:!0,onEscapeKeyDown:Me(l,()=>{b.isFocusedToastEscapeKeyDownRef.current||Z(),b.isFocusedToastEscapeKeyDownRef.current=!1}),children:u.jsx(Ae.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":b.swipeDirection,...M,ref:N,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Me(e.onKeyDown,E=>{E.key==="Escape"&&(l==null||l(E.nativeEvent),E.nativeEvent.defaultPrevented||(b.isFocusedToastEscapeKeyDownRef.current=!0,Z()))}),onPointerDown:Me(e.onPointerDown,E=>{E.button===0&&(A.current={x:E.clientX,y:E.clientY})}),onPointerMove:Me(e.onPointerMove,E=>{if(!A.current)return;const O=E.clientX-A.current.x,P=E.clientY-A.current.y,X=!!I.current,W=["left","right"].includes(b.swipeDirection),V=["left","up"].includes(b.swipeDirection)?Math.min:Math.max,L=W?V(0,O):0,Y=W?0:V(0,P),F=E.pointerType==="touch"?10:2,T={x:L,y:Y},K={originalEvent:E,delta:T};X?(I.current=T,Jy(ype,m,K,{discrete:!1})):SY(T,b.swipeDirection,F)?(I.current=T,Jy(ppe,p,K,{discrete:!1}),E.target.setPointerCapture(E.pointerId)):(Math.abs(O)>F||Math.abs(P)>F)&&(A.current=null)}),onPointerUp:Me(e.onPointerUp,E=>{const O=I.current,P=E.target;if(P.hasPointerCapture(E.pointerId)&&P.releasePointerCapture(E.pointerId),I.current=null,A.current=null,O){const X=E.currentTarget,W={originalEvent:E,delta:O};SY(O,b.swipeDirection,b.swipeThreshold)?Jy(gpe,x,W,{discrete:!0}):Jy(mpe,v,W,{discrete:!0}),X.addEventListener("click",V=>V.preventDefault(),{once:!0})}})})})}),b.viewport)})]}):null}),wpe=e=>{const{__scopeToast:t,children:n,...o}=e,a=TP(hp,t),[i,s]=k.useState(!1),[l,d]=k.useState(!1);return _pe(()=>s(!0)),k.useEffect(()=>{const h=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(h)},[]),l?null:u.jsx(y1,{asChild:!0,children:u.jsx(IP,{...o,children:i&&u.jsxs(u.Fragment,{children:[a.label," ",n]})})})},bpe="ToastTitle",_ee=k.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return u.jsx(Ae.div,{...o,ref:t})});_ee.displayName=bpe;var Mpe="ToastDescription",See=k.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return u.jsx(Ae.div,{...o,ref:t})});See.displayName=Mpe;var Cee="ToastAction",Nee=k.forwardRef((e,t)=>{const{altText:n,...o}=e;return n.trim()?u.jsx(jee,{altText:n,asChild:!0,children:u.jsx(PV,{...o,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Cee}\`. Expected non-empty \`string\`.`),null)});Nee.displayName=Cee;var Lee="ToastClose",PV=k.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e,a=kpe(Lee,n);return u.jsx(jee,{asChild:!0,children:u.jsx(Ae.button,{type:"button",...o,ref:t,onClick:Me(e.onClick,a.onClose)})})});PV.displayName=Lee;var jee=k.forwardRef((e,t)=>{const{__scopeToast:n,altText:o,...a}=e;return u.jsx(Ae.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0,...a,ref:t})});function Aee(e){const t=[];return Array.from(e.childNodes).forEach(o=>{if(o.nodeType===o.TEXT_NODE&&o.textContent&&t.push(o.textContent),Spe(o)){const a=o.ariaHidden||o.hidden||o.style.display==="none",i=o.dataset.radixToastAnnounceExclude==="";if(!a)if(i){const s=o.dataset.radixToastAnnounceAlt;s&&t.push(s)}else t.push(...Aee(o))}}),t}function Jy(e,t,n,{discrete:o}){const a=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),o?IV(a,i):a.dispatchEvent(i)}var SY=(e,t,n=0)=>{const o=Math.abs(e.x),a=Math.abs(e.y),i=o>a;return t==="left"||t==="right"?i&&o>n:!i&&a>n};function _pe(e=()=>{}){const t=gn(e);Gn(()=>{let n=0,o=0;return n=window.requestAnimationFrame(()=>o=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(o)}},[t])}function Spe(e){return e.nodeType===e.ELEMENT_NODE}function Cpe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const a=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||a?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function hO(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var Npe=kee,Eee=wee,Iee=Mee,Tee=_ee,Ree=See,Pee=Nee,$ee=PV;function Dee(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=Dee(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function zee(){for(var e,t,n=0,o="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=Dee(e))&&(o&&(o+=" "),o+=t);return o}const CY=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,NY=zee,r2=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return NY(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=t,s=Object.keys(a).map(h=>{const p=n==null?void 0:n[h],m=i==null?void 0:i[h];if(p===null)return null;const v=CY(p)||CY(m);return a[h][v]}),l=n&&Object.entries(n).reduce((h,p)=>{let[m,v]=p;return v===void 0||(h[m]=v),h},{}),d=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((h,p)=>{let{class:m,className:v,...x}=p;return Object.entries(x).every(M=>{let[b,C]=M;return Array.isArray(C)?C.includes({...i,...l}[b]):{...i,...l}[b]===C})?[...h,m,v]:h},[]);return NY(e,s,d,n==null?void 0:n.class,n==null?void 0:n.className)};/**
71
71
  * @license lucide-react v0.514.0 - ISC
72
72
  *
73
73
  * This source code is licensed under the ISC license.
@@ -8141,7 +8141,7 @@ Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}
8141
8141
 
8142
8142
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
8143
8143
 
8144
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return k.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},eOe="DialogDescriptionWarning",tOe=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Cte(eOe).contentName}}.`;return k.useEffect(()=>{var i;const a=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},OP=DV,HV=pte,qP=mte,c2=gte,l2=vte,yp=xte,mp=bte,HP=_te;const Jt=OP,Ua=HV,nOe=qP,Nte=k.forwardRef(({className:e,...t},n)=>u.jsx(c2,{ref:n,className:ge("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Nte.displayName=c2.displayName;const Wt=k.forwardRef(({className:e,children:t,...n},o)=>u.jsxs(nOe,{children:[u.jsx(Nte,{}),u.jsxs(l2,{ref:o,className:ge("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,u.jsxs(HP,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[u.jsx(xs,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Wt.displayName=l2.displayName;const on=({className:e,...t})=>u.jsx("div",{className:ge("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});on.displayName="DialogHeader";const an=({className:e,...t})=>u.jsx("div",{className:ge("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});an.displayName="DialogFooter";const en=k.forwardRef(({className:e,...t},n)=>u.jsx(yp,{ref:n,className:ge("text-lg font-semibold leading-none tracking-tight",e),...t}));en.displayName=yp.displayName;const dn=k.forwardRef(({className:e,...t},n)=>u.jsx(mp,{ref:n,className:ge("text-sm text-muted-foreground",e),...t}));dn.displayName=mp.displayName;const oOe=OP,aOe=HV,rOe=qP,Lte=k.forwardRef(({className:e,...t},n)=>u.jsx(c2,{className:ge("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));Lte.displayName=c2.displayName;const iOe=r2("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),jte=k.forwardRef(({side:e="left",className:t,children:n,...o},a)=>u.jsxs(rOe,{children:[u.jsx(Lte,{}),u.jsxs(l2,{ref:a,className:ge(iOe({side:e}),t),...o,children:[n,u.jsxs(HP,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[u.jsx(xs,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Close"})]}),u.jsx(Ate,{className:"sr-only",children:"Title"}),u.jsx(Ete,{className:"sr-only",children:"Description"})]})]}));jte.displayName=l2.displayName;const Ate=k.forwardRef(({className:e,...t},n)=>u.jsx(yp,{ref:n,className:ge("text-lg font-semibold text-foreground",e),...t}));Ate.displayName=yp.displayName;const Ete=k.forwardRef(({className:e,...t},n)=>u.jsx(mp,{ref:n,className:ge("text-sm text-muted-foreground",e),...t}));Ete.displayName=mp.displayName;var sOe="Separator",BY="horizontal",cOe=["horizontal","vertical"],Ite=k.forwardRef((e,t)=>{const{decorative:n,orientation:o=BY,...a}=e,i=lOe(o)?o:BY,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return u.jsx(Ae.div,{"data-orientation":i,...l,...a,ref:t})});Ite.displayName=sOe;function lOe(e){return cOe.includes(e)}var Tte=Ite;const Gh=k.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...o},a)=>u.jsx(Tte,{ref:a,decorative:n,orientation:t,className:ge("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...o}));Gh.displayName=Tte.displayName;const Ze=k.forwardRef(({className:e,type:t,...n},o)=>u.jsx("input",{type:t,className:ge("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:o,...n}));Ze.displayName="Input";var uOe="Label",Rte=k.forwardRef((e,t)=>u.jsx(Ae.label,{...e,ref:t,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Rte.displayName=uOe;var Pte=Rte;const dOe=r2("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),_e=k.forwardRef(({className:e,...t},n)=>u.jsx(Pte,{ref:n,className:ge(dOe(),e),...t}));_e.displayName=Pte.displayName;function $te({onImportSuccess:e,onCancel:t}){const[n,o]=k.useState(null),[a,i]=k.useState(!1),{toast:s}=Yt(),l=h=>{h.target.files&&h.target.files.length>0&&o(h.target.files[0])},d=async()=>{if(!n){s({variant:"destructive",title:"Ошибка",description:"Пожалуйста, выберите файл для импорта."});return}i(!0);const h=new FormData;h.append("file",n);try{const p=await Ne("/api/bots/import",{method:"POST",body:h,headers:{"Content-Type":void 0}},"Бот успешно импортирован.");e(p)}catch{}finally{i(!1)}};return u.jsxs(Wt,{children:[u.jsxs(on,{children:[u.jsx(en,{children:"Импорт бота из архива"}),u.jsx(dn,{children:"Выберите ZIP-архив, ранее экспортированный из панели. Будет создан новый бот со всеми плагинами и настройками. Пароли не переносятся."})]}),u.jsx("div",{className:"py-4 space-y-4",children:u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"botFile",children:"Файл экспорта (.zip)"}),u.jsx(Ze,{id:"botFile",type:"file",accept:".zip",onChange:l})]})}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:t,children:"Отмена"}),u.jsxs(pe,{onClick:d,disabled:a||!n,children:[a&&u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}),u.jsx(wr,{className:"mr-2 h-4 w-4"}),"Импортировать"]})]})]})}function eH(e,[t,n]){return Math.min(n,Math.max(t,e))}var hOe=k.createContext(void 0);function m1(e){const t=k.useContext(hOe);return e||t||"ltr"}const fOe=["top","right","bottom","left"],Ns=Math.min,Ko=Math.max,XR=Math.round,im=Math.floor,br=e=>({x:e,y:e}),pOe={left:"right",right:"left",bottom:"top",top:"bottom"},yOe={start:"end",end:"start"};function tH(e,t,n){return Ko(e,Ns(t,n))}function di(e,t){return typeof e=="function"?e(t):e}function hi(e){return e.split("-")[0]}function u2(e){return e.split("-")[1]}function VV(e){return e==="x"?"y":"x"}function BV(e){return e==="y"?"height":"width"}function vr(e){return["top","bottom"].includes(hi(e))?"y":"x"}function FV(e){return VV(vr(e))}function mOe(e,t,n){n===void 0&&(n=!1);const o=u2(e),a=FV(e),i=BV(a);let s=a==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=ZR(s)),[s,ZR(s)]}function gOe(e){const t=ZR(e);return[nH(e),t,nH(t)]}function nH(e){return e.replace(/start|end/g,t=>yOe[t])}function vOe(e,t,n){const o=["left","right"],a=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?a:o:t?o:a;case"left":case"right":return t?i:s;default:return[]}}function kOe(e,t,n,o){const a=u2(e);let i=vOe(hi(e),n==="start",o);return a&&(i=i.map(s=>s+"-"+a),t&&(i=i.concat(i.map(nH)))),i}function ZR(e){return e.replace(/left|right|bottom|top/g,t=>pOe[t])}function xOe(e){return{top:0,right:0,bottom:0,left:0,...e}}function Dte(e){return typeof e!="number"?xOe(e):{top:e,right:e,bottom:e,left:e}}function YR(e){const{x:t,y:n,width:o,height:a}=e;return{width:o,height:a,top:n,left:t,right:t+o,bottom:n+a,x:t,y:n}}function FY(e,t,n){let{reference:o,floating:a}=e;const i=vr(t),s=FV(t),l=BV(s),d=hi(t),h=i==="y",p=o.x+o.width/2-a.width/2,m=o.y+o.height/2-a.height/2,v=o[l]/2-a[l]/2;let x;switch(d){case"top":x={x:p,y:o.y-a.height};break;case"bottom":x={x:p,y:o.y+o.height};break;case"right":x={x:o.x+o.width,y:m};break;case"left":x={x:o.x-a.width,y:m};break;default:x={x:o.x,y:o.y}}switch(u2(t)){case"start":x[s]-=v*(n&&h?-1:1);break;case"end":x[s]+=v*(n&&h?-1:1);break}return x}const wOe=async(e,t,n)=>{const{placement:o="bottom",strategy:a="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),d=await(s.isRTL==null?void 0:s.isRTL(t));let h=await s.getElementRects({reference:e,floating:t,strategy:a}),{x:p,y:m}=FY(h,o,d),v=o,x={},M=0;for(let b=0;b<l.length;b++){const{name:C,fn:_}=l[b],{x:N,y:A,data:I,reset:R}=await _({x:p,y:m,initialPlacement:o,placement:v,strategy:a,middlewareData:x,rects:h,platform:s,elements:{reference:e,floating:t}});p=N??p,m=A??m,x={...x,[C]:{...x[C],...I}},R&&M<=50&&(M++,typeof R=="object"&&(R.placement&&(v=R.placement),R.rects&&(h=R.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:a}):R.rects),{x:p,y:m}=FY(h,v,d)),b=-1)}return{x:p,y:m,placement:v,strategy:a,middlewareData:x}};async function D0(e,t){var n;t===void 0&&(t={});const{x:o,y:a,platform:i,rects:s,elements:l,strategy:d}=e,{boundary:h="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:v=!1,padding:x=0}=di(t,e),M=Dte(x),C=l[v?m==="floating"?"reference":"floating":m],_=YR(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(C)))==null||n?C:C.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:h,rootBoundary:p,strategy:d})),N=m==="floating"?{x:o,y:a,width:s.floating.width,height:s.floating.height}:s.reference,A=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),I=await(i.isElement==null?void 0:i.isElement(A))?await(i.getScale==null?void 0:i.getScale(A))||{x:1,y:1}:{x:1,y:1},R=YR(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:N,offsetParent:A,strategy:d}):N);return{top:(_.top-R.top+M.top)/I.y,bottom:(R.bottom-_.bottom+M.bottom)/I.y,left:(_.left-R.left+M.left)/I.x,right:(R.right-_.right+M.right)/I.x}}const bOe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:a,rects:i,platform:s,elements:l,middlewareData:d}=t,{element:h,padding:p=0}=di(e,t)||{};if(h==null)return{};const m=Dte(p),v={x:n,y:o},x=FV(a),M=BV(x),b=await s.getDimensions(h),C=x==="y",_=C?"top":"left",N=C?"bottom":"right",A=C?"clientHeight":"clientWidth",I=i.reference[M]+i.reference[x]-v[x]-i.floating[M],R=v[x]-i.reference[x],j=await(s.getOffsetParent==null?void 0:s.getOffsetParent(h));let D=j?j[A]:0;(!D||!await(s.isElement==null?void 0:s.isElement(j)))&&(D=l.floating[A]||i.floating[M]);const H=I/2-R/2,U=D/2-b[M]/2-1,z=Ns(m[_],U),Z=Ns(m[N],U),q=z,G=D-b[M]-Z,E=D/2-b[M]/2+H,O=tH(q,E,G),P=!d.arrow&&u2(a)!=null&&E!==O&&i.reference[M]/2-(E<q?z:Z)-b[M]/2<0,X=P?E<q?E-q:E-G:0;return{[x]:v[x]+X,data:{[x]:O,centerOffset:E-O-X,...P&&{alignmentOffset:X}},reset:P}}}),MOe=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:a,middlewareData:i,rects:s,initialPlacement:l,platform:d,elements:h}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:v,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:M="none",flipAlignment:b=!0,...C}=di(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const _=hi(a),N=vr(l),A=hi(l)===l,I=await(d.isRTL==null?void 0:d.isRTL(h.floating)),R=v||(A||!b?[ZR(l)]:gOe(l)),j=M!=="none";!v&&j&&R.push(...kOe(l,b,M,I));const D=[l,...R],H=await D0(t,C),U=[];let z=((o=i.flip)==null?void 0:o.overflows)||[];if(p&&U.push(H[_]),m){const E=mOe(a,s,I);U.push(H[E[0]],H[E[1]])}if(z=[...z,{placement:a,overflows:U}],!U.every(E=>E<=0)){var Z,q;const E=(((Z=i.flip)==null?void 0:Z.index)||0)+1,O=D[E];if(O&&(!(m==="alignment"?N!==vr(O):!1)||z.every(W=>W.overflows[0]>0&&vr(W.placement)===N)))return{data:{index:E,overflows:z},reset:{placement:O}};let P=(q=z.filter(X=>X.overflows[0]<=0).sort((X,W)=>X.overflows[1]-W.overflows[1])[0])==null?void 0:q.placement;if(!P)switch(x){case"bestFit":{var G;const X=(G=z.filter(W=>{if(j){const V=vr(W.placement);return V===N||V==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(V=>V>0).reduce((V,L)=>V+L,0)]).sort((W,V)=>W[1]-V[1])[0])==null?void 0:G[0];X&&(P=X);break}case"initialPlacement":P=l;break}if(a!==P)return{reset:{placement:P}}}return{}}}};function UY(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function GY(e){return fOe.some(t=>e[t]>=0)}const _Oe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:o="referenceHidden",...a}=di(e,t);switch(o){case"referenceHidden":{const i=await D0(t,{...a,elementContext:"reference"}),s=UY(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:GY(s)}}}case"escaped":{const i=await D0(t,{...a,altBoundary:!0}),s=UY(i,n.floating);return{data:{escapedOffsets:s,escaped:GY(s)}}}default:return{}}}}};async function SOe(e,t){const{placement:n,platform:o,elements:a}=e,i=await(o.isRTL==null?void 0:o.isRTL(a.floating)),s=hi(n),l=u2(n),d=vr(n)==="y",h=["left","top"].includes(s)?-1:1,p=i&&d?-1:1,m=di(t,e);let{mainAxis:v,crossAxis:x,alignmentAxis:M}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return l&&typeof M=="number"&&(x=l==="end"?M*-1:M),d?{x:x*p,y:v*h}:{x:v*h,y:x*p}}const COe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:a,y:i,placement:s,middlewareData:l}=t,d=await SOe(t,e);return s===((n=l.offset)==null?void 0:n.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:a+d.x,y:i+d.y,data:{...d,placement:s}}}}},NOe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:a}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:C=>{let{x:_,y:N}=C;return{x:_,y:N}}},...d}=di(e,t),h={x:n,y:o},p=await D0(t,d),m=vr(hi(a)),v=VV(m);let x=h[v],M=h[m];if(i){const C=v==="y"?"top":"left",_=v==="y"?"bottom":"right",N=x+p[C],A=x-p[_];x=tH(N,x,A)}if(s){const C=m==="y"?"top":"left",_=m==="y"?"bottom":"right",N=M+p[C],A=M-p[_];M=tH(N,M,A)}const b=l.fn({...t,[v]:x,[m]:M});return{...b,data:{x:b.x-n,y:b.y-o,enabled:{[v]:i,[m]:s}}}}}},LOe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:a,rects:i,middlewareData:s}=t,{offset:l=0,mainAxis:d=!0,crossAxis:h=!0}=di(e,t),p={x:n,y:o},m=vr(a),v=VV(m);let x=p[v],M=p[m];const b=di(l,t),C=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(d){const A=v==="y"?"height":"width",I=i.reference[v]-i.floating[A]+C.mainAxis,R=i.reference[v]+i.reference[A]-C.mainAxis;x<I?x=I:x>R&&(x=R)}if(h){var _,N;const A=v==="y"?"width":"height",I=["top","left"].includes(hi(a)),R=i.reference[m]-i.floating[A]+(I&&((_=s.offset)==null?void 0:_[m])||0)+(I?0:C.crossAxis),j=i.reference[m]+i.reference[A]+(I?0:((N=s.offset)==null?void 0:N[m])||0)-(I?C.crossAxis:0);M<R?M=R:M>j&&(M=j)}return{[v]:x,[m]:M}}}},jOe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:a,rects:i,platform:s,elements:l}=t,{apply:d=()=>{},...h}=di(e,t),p=await D0(t,h),m=hi(a),v=u2(a),x=vr(a)==="y",{width:M,height:b}=i.floating;let C,_;m==="top"||m==="bottom"?(C=m,_=v===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(_=m,C=v==="end"?"top":"bottom");const N=b-p.top-p.bottom,A=M-p.left-p.right,I=Ns(b-p[C],N),R=Ns(M-p[_],A),j=!t.middlewareData.shift;let D=I,H=R;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(H=A),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(D=N),j&&!v){const z=Ko(p.left,0),Z=Ko(p.right,0),q=Ko(p.top,0),G=Ko(p.bottom,0);x?H=M-2*(z!==0||Z!==0?z+Z:Ko(p.left,p.right)):D=b-2*(q!==0||G!==0?q+G:Ko(p.top,p.bottom))}await d({...t,availableWidth:H,availableHeight:D});const U=await s.getDimensions(l.floating);return M!==U.width||b!==U.height?{reset:{rects:!0}}:{}}}};function VP(){return typeof window<"u"}function d2(e){return zte(e)?(e.nodeName||"").toLowerCase():"#document"}function Jo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ir(e){var t;return(t=(zte(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zte(e){return VP()?e instanceof Node||e instanceof Jo(e).Node:!1}function Ga(e){return VP()?e instanceof Element||e instanceof Jo(e).Element:!1}function jr(e){return VP()?e instanceof HTMLElement||e instanceof Jo(e).HTMLElement:!1}function XY(e){return!VP()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Jo(e).ShadowRoot}function gp(e){const{overflow:t,overflowX:n,overflowY:o,display:a}=Xa(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(a)}function AOe(e){return["table","td","th"].includes(d2(e))}function BP(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function UV(e){const t=GV(),n=Ga(e)?Xa(e):e;return["transform","translate","scale","rotate","perspective"].some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function EOe(e){let t=Ls(e);for(;jr(t)&&!Xh(t);){if(UV(t))return t;if(BP(t))return null;t=Ls(t)}return null}function GV(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Xh(e){return["html","body","#document"].includes(d2(e))}function Xa(e){return Jo(e).getComputedStyle(e)}function FP(e){return Ga(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ls(e){if(d2(e)==="html")return e;const t=e.assignedSlot||e.parentNode||XY(e)&&e.host||Ir(e);return XY(t)?t.host:t}function Ote(e){const t=Ls(e);return Xh(t)?e.ownerDocument?e.ownerDocument.body:e.body:jr(t)&&gp(t)?t:Ote(t)}function z0(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=Ote(e),i=a===((o=e.ownerDocument)==null?void 0:o.body),s=Jo(a);if(i){const l=oH(s);return t.concat(s,s.visualViewport||[],gp(a)?a:[],l&&n?z0(l):[])}return t.concat(a,z0(a,[],n))}function oH(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function qte(e){const t=Xa(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const a=jr(e),i=a?e.offsetWidth:n,s=a?e.offsetHeight:o,l=XR(n)!==i||XR(o)!==s;return l&&(n=i,o=s),{width:n,height:o,$:l}}function XV(e){return Ga(e)?e:e.contextElement}function Ph(e){const t=XV(e);if(!jr(t))return br(1);const n=t.getBoundingClientRect(),{width:o,height:a,$:i}=qte(t);let s=(i?XR(n.width):n.width)/o,l=(i?XR(n.height):n.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const IOe=br(0);function Hte(e){const t=Jo(e);return!GV()||!t.visualViewport?IOe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function TOe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Jo(e)?!1:t}function a1(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=XV(e);let s=br(1);t&&(o?Ga(o)&&(s=Ph(o)):s=Ph(e));const l=TOe(i,n,o)?Hte(i):br(0);let d=(a.left+l.x)/s.x,h=(a.top+l.y)/s.y,p=a.width/s.x,m=a.height/s.y;if(i){const v=Jo(i),x=o&&Ga(o)?Jo(o):o;let M=v,b=oH(M);for(;b&&o&&x!==M;){const C=Ph(b),_=b.getBoundingClientRect(),N=Xa(b),A=_.left+(b.clientLeft+parseFloat(N.paddingLeft))*C.x,I=_.top+(b.clientTop+parseFloat(N.paddingTop))*C.y;d*=C.x,h*=C.y,p*=C.x,m*=C.y,d+=A,h+=I,M=Jo(b),b=oH(M)}}return YR({width:p,height:m,x:d,y:h})}function ZV(e,t){const n=FP(e).scrollLeft;return t?t.left+n:a1(Ir(e)).left+n}function Vte(e,t,n){n===void 0&&(n=!1);const o=e.getBoundingClientRect(),a=o.left+t.scrollLeft-(n?0:ZV(e,o)),i=o.top+t.scrollTop;return{x:a,y:i}}function ROe(e){let{elements:t,rect:n,offsetParent:o,strategy:a}=e;const i=a==="fixed",s=Ir(o),l=t?BP(t.floating):!1;if(o===s||l&&i)return n;let d={scrollLeft:0,scrollTop:0},h=br(1);const p=br(0),m=jr(o);if((m||!m&&!i)&&((d2(o)!=="body"||gp(s))&&(d=FP(o)),jr(o))){const x=a1(o);h=Ph(o),p.x=x.x+o.clientLeft,p.y=x.y+o.clientTop}const v=s&&!m&&!i?Vte(s,d,!0):br(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-d.scrollLeft*h.x+p.x+v.x,y:n.y*h.y-d.scrollTop*h.y+p.y+v.y}}function POe(e){return Array.from(e.getClientRects())}function $Oe(e){const t=Ir(e),n=FP(e),o=e.ownerDocument.body,a=Ko(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=Ko(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+ZV(e);const l=-n.scrollTop;return Xa(o).direction==="rtl"&&(s+=Ko(t.clientWidth,o.clientWidth)-a),{width:a,height:i,x:s,y:l}}function DOe(e,t){const n=Jo(e),o=Ir(e),a=n.visualViewport;let i=o.clientWidth,s=o.clientHeight,l=0,d=0;if(a){i=a.width,s=a.height;const h=GV();(!h||h&&t==="fixed")&&(l=a.offsetLeft,d=a.offsetTop)}return{width:i,height:s,x:l,y:d}}function zOe(e,t){const n=a1(e,!0,t==="fixed"),o=n.top+e.clientTop,a=n.left+e.clientLeft,i=jr(e)?Ph(e):br(1),s=e.clientWidth*i.x,l=e.clientHeight*i.y,d=a*i.x,h=o*i.y;return{width:s,height:l,x:d,y:h}}function ZY(e,t,n){let o;if(t==="viewport")o=DOe(e,n);else if(t==="document")o=$Oe(Ir(e));else if(Ga(t))o=zOe(t,n);else{const a=Hte(e);o={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return YR(o)}function Bte(e,t){const n=Ls(e);return n===t||!Ga(n)||Xh(n)?!1:Xa(n).position==="fixed"||Bte(n,t)}function OOe(e,t){const n=t.get(e);if(n)return n;let o=z0(e,[],!1).filter(l=>Ga(l)&&d2(l)!=="body"),a=null;const i=Xa(e).position==="fixed";let s=i?Ls(e):e;for(;Ga(s)&&!Xh(s);){const l=Xa(s),d=UV(s);!d&&l.position==="fixed"&&(a=null),(i?!d&&!a:!d&&l.position==="static"&&!!a&&["absolute","fixed"].includes(a.position)||gp(s)&&!d&&Bte(e,s))?o=o.filter(p=>p!==s):a=l,s=Ls(s)}return t.set(e,o),o}function qOe(e){let{element:t,boundary:n,rootBoundary:o,strategy:a}=e;const s=[...n==="clippingAncestors"?BP(t)?[]:OOe(t,this._c):[].concat(n),o],l=s[0],d=s.reduce((h,p)=>{const m=ZY(t,p,a);return h.top=Ko(m.top,h.top),h.right=Ns(m.right,h.right),h.bottom=Ns(m.bottom,h.bottom),h.left=Ko(m.left,h.left),h},ZY(t,l,a));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function HOe(e){const{width:t,height:n}=qte(e);return{width:t,height:n}}function VOe(e,t,n){const o=jr(t),a=Ir(t),i=n==="fixed",s=a1(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const d=br(0);function h(){d.x=ZV(a)}if(o||!o&&!i)if((d2(t)!=="body"||gp(a))&&(l=FP(t)),o){const x=a1(t,!0,i,t);d.x=x.x+t.clientLeft,d.y=x.y+t.clientTop}else a&&h();i&&!o&&a&&h();const p=a&&!o&&!i?Vte(a,l):br(0),m=s.left+l.scrollLeft-d.x-p.x,v=s.top+l.scrollTop-d.y-p.y;return{x:m,y:v,width:s.width,height:s.height}}function bO(e){return Xa(e).position==="static"}function YY(e,t){if(!jr(e)||Xa(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ir(e)===n&&(n=n.ownerDocument.body),n}function Fte(e,t){const n=Jo(e);if(BP(e))return n;if(!jr(e)){let a=Ls(e);for(;a&&!Xh(a);){if(Ga(a)&&!bO(a))return a;a=Ls(a)}return n}let o=YY(e,t);for(;o&&AOe(o)&&bO(o);)o=YY(o,t);return o&&Xh(o)&&bO(o)&&!UV(o)?n:o||EOe(e)||n}const BOe=async function(e){const t=this.getOffsetParent||Fte,n=this.getDimensions,o=await n(e.floating);return{reference:VOe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function FOe(e){return Xa(e).direction==="rtl"}const UOe={convertOffsetParentRelativeRectToViewportRelativeRect:ROe,getDocumentElement:Ir,getClippingRect:qOe,getOffsetParent:Fte,getElementRects:BOe,getClientRects:POe,getDimensions:HOe,getScale:Ph,isElement:Ga,isRTL:FOe};function Ute(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function GOe(e,t){let n=null,o;const a=Ir(e);function i(){var l;clearTimeout(o),(l=n)==null||l.disconnect(),n=null}function s(l,d){l===void 0&&(l=!1),d===void 0&&(d=1),i();const h=e.getBoundingClientRect(),{left:p,top:m,width:v,height:x}=h;if(l||t(),!v||!x)return;const M=im(m),b=im(a.clientWidth-(p+v)),C=im(a.clientHeight-(m+x)),_=im(p),A={rootMargin:-M+"px "+-b+"px "+-C+"px "+-_+"px",threshold:Ko(0,Ns(1,d))||1};let I=!0;function R(j){const D=j[0].intersectionRatio;if(D!==d){if(!I)return s();D?s(!1,D):o=setTimeout(()=>{s(!1,1e-7)},1e3)}D===1&&!Ute(h,e.getBoundingClientRect())&&s(),I=!1}try{n=new IntersectionObserver(R,{...A,root:a.ownerDocument})}catch{n=new IntersectionObserver(R,A)}n.observe(e)}return s(!0),i}function XOe(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:d=!1}=o,h=XV(e),p=a||i?[...h?z0(h):[],...z0(t)]:[];p.forEach(_=>{a&&_.addEventListener("scroll",n,{passive:!0}),i&&_.addEventListener("resize",n)});const m=h&&l?GOe(h,n):null;let v=-1,x=null;s&&(x=new ResizeObserver(_=>{let[N]=_;N&&N.target===h&&x&&(x.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var A;(A=x)==null||A.observe(t)})),n()}),h&&!d&&x.observe(h),x.observe(t));let M,b=d?a1(e):null;d&&C();function C(){const _=a1(e);b&&!Ute(b,_)&&n(),b=_,M=requestAnimationFrame(C)}return n(),()=>{var _;p.forEach(N=>{a&&N.removeEventListener("scroll",n),i&&N.removeEventListener("resize",n)}),m==null||m(),(_=x)==null||_.disconnect(),x=null,d&&cancelAnimationFrame(M)}}const ZOe=COe,YOe=NOe,WOe=MOe,KOe=jOe,QOe=_Oe,WY=bOe,JOe=LOe,eqe=(e,t,n)=>{const o=new Map,a={platform:UOe,...n},i={...a.platform,_c:o};return wOe(e,t,{...a,platform:i})};var tqe=typeof document<"u",nqe=function(){},CR=tqe?k.useLayoutEffect:nqe;function WR(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!WR(e[o],t[o]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,a[o]))return!1;for(o=n;o--!==0;){const i=a[o];if(!(i==="_owner"&&e.$$typeof)&&!WR(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Gte(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function KY(e,t){const n=Gte(e);return Math.round(t*n)/n}function MO(e){const t=k.useRef(e);return CR(()=>{t.current=e}),t}function oqe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:a,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:d,open:h}=e,[p,m]=k.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,x]=k.useState(o);WR(v,o)||x(o);const[M,b]=k.useState(null),[C,_]=k.useState(null),N=k.useCallback(W=>{W!==j.current&&(j.current=W,b(W))},[]),A=k.useCallback(W=>{W!==D.current&&(D.current=W,_(W))},[]),I=i||M,R=s||C,j=k.useRef(null),D=k.useRef(null),H=k.useRef(p),U=d!=null,z=MO(d),Z=MO(a),q=MO(h),G=k.useCallback(()=>{if(!j.current||!D.current)return;const W={placement:t,strategy:n,middleware:v};Z.current&&(W.platform=Z.current),eqe(j.current,D.current,W).then(V=>{const L={...V,isPositioned:q.current!==!1};E.current&&!WR(H.current,L)&&(H.current=L,f1.flushSync(()=>{m(L)}))})},[v,t,n,Z,q]);CR(()=>{h===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,m(W=>({...W,isPositioned:!1})))},[h]);const E=k.useRef(!1);CR(()=>(E.current=!0,()=>{E.current=!1}),[]),CR(()=>{if(I&&(j.current=I),R&&(D.current=R),I&&R){if(z.current)return z.current(I,R,G);G()}},[I,R,G,z,U]);const O=k.useMemo(()=>({reference:j,floating:D,setReference:N,setFloating:A}),[N,A]),P=k.useMemo(()=>({reference:I,floating:R}),[I,R]),X=k.useMemo(()=>{const W={position:n,left:0,top:0};if(!P.floating)return W;const V=KY(P.floating,p.x),L=KY(P.floating,p.y);return l?{...W,transform:"translate("+V+"px, "+L+"px)",...Gte(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:L}},[n,l,P.floating,p.x,p.y]);return k.useMemo(()=>({...p,update:G,refs:O,elements:P,floatingStyles:X}),[p,G,O,P,X])}const aqe=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:a}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?WY({element:o.current,padding:a}).fn(n):{}:o?WY({element:o,padding:a}).fn(n):{}}}},rqe=(e,t)=>({...ZOe(e),options:[e,t]}),iqe=(e,t)=>({...YOe(e),options:[e,t]}),sqe=(e,t)=>({...JOe(e),options:[e,t]}),cqe=(e,t)=>({...WOe(e),options:[e,t]}),lqe=(e,t)=>({...KOe(e),options:[e,t]}),uqe=(e,t)=>({...QOe(e),options:[e,t]}),dqe=(e,t)=>({...aqe(e),options:[e,t]});var hqe="Arrow",Xte=k.forwardRef((e,t)=>{const{children:n,width:o=10,height:a=5,...i}=e;return u.jsx(Ae.svg,{...i,ref:t,width:o,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});Xte.displayName=hqe;var fqe=Xte;function UP(e){const[t,n]=k.useState(void 0);return Gn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let s,l;if("borderBoxSize"in i){const d=i.borderBoxSize,h=Array.isArray(d)?d[0]:d;s=h.inlineSize,l=h.blockSize}else s=e.offsetWidth,l=e.offsetHeight;n({width:s,height:l})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var YV="Popper",[Zte,Ts]=zn(YV),[pqe,Yte]=Zte(YV),Wte=e=>{const{__scopePopper:t,children:n}=e,[o,a]=k.useState(null);return u.jsx(pqe,{scope:t,anchor:o,onAnchorChange:a,children:n})};Wte.displayName=YV;var Kte="PopperAnchor",Qte=k.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...a}=e,i=Yte(Kte,n),s=k.useRef(null),l=ot(t,s);return k.useEffect(()=>{i.onAnchorChange((o==null?void 0:o.current)||s.current)}),o?null:u.jsx(Ae.div,{...a,ref:l})});Qte.displayName=Kte;var WV="PopperContent",[yqe,mqe]=Zte(WV),Jte=k.forwardRef((e,t)=>{var te,ce,me,ke,Ee,Ie;const{__scopePopper:n,side:o="bottom",sideOffset:a=0,align:i="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:d=!0,collisionBoundary:h=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:v=!1,updatePositionStrategy:x="optimized",onPlaced:M,...b}=e,C=Yte(WV,n),[_,N]=k.useState(null),A=ot(t,Te=>N(Te)),[I,R]=k.useState(null),j=UP(I),D=(j==null?void 0:j.width)??0,H=(j==null?void 0:j.height)??0,U=o+(i!=="center"?"-"+i:""),z=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},Z=Array.isArray(h)?h:[h],q=Z.length>0,G={padding:z,boundary:Z.filter(vqe),altBoundary:q},{refs:E,floatingStyles:O,placement:P,isPositioned:X,middlewareData:W}=oqe({strategy:"fixed",placement:U,whileElementsMounted:(...Te)=>XOe(...Te,{animationFrame:x==="always"}),elements:{reference:C.anchor},middleware:[rqe({mainAxis:a+H,alignmentAxis:s}),d&&iqe({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?sqe():void 0,...G}),d&&cqe({...G}),lqe({...G,apply:({elements:Te,rects:qe,availableWidth:ct,availableHeight:jt})=>{const{width:We,height:Le}=qe.reference,Rt=Te.floating.style;Rt.setProperty("--radix-popper-available-width",`${ct}px`),Rt.setProperty("--radix-popper-available-height",`${jt}px`),Rt.setProperty("--radix-popper-anchor-width",`${We}px`),Rt.setProperty("--radix-popper-anchor-height",`${Le}px`)}}),I&&dqe({element:I,padding:l}),kqe({arrowWidth:D,arrowHeight:H}),v&&uqe({strategy:"referenceHidden",...G})]}),[V,L]=nne(P),Y=gn(M);Gn(()=>{X&&(Y==null||Y())},[X,Y]);const F=(te=W.arrow)==null?void 0:te.x,T=(ce=W.arrow)==null?void 0:ce.y,K=((me=W.arrow)==null?void 0:me.centerOffset)!==0,[Q,ne]=k.useState();return Gn(()=>{_&&ne(window.getComputedStyle(_).zIndex)},[_]),u.jsx("div",{ref:E.setFloating,"data-radix-popper-content-wrapper":"",style:{...O,transform:X?O.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Q,"--radix-popper-transform-origin":[(ke=W.transformOrigin)==null?void 0:ke.x,(Ee=W.transformOrigin)==null?void 0:Ee.y].join(" "),...((Ie=W.hide)==null?void 0:Ie.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(yqe,{scope:n,placedSide:V,onArrowChange:R,arrowX:F,arrowY:T,shouldHideArrow:K,children:u.jsx(Ae.div,{"data-side":V,"data-align":L,...b,ref:A,style:{...b.style,animation:X?void 0:"none"}})})})});Jte.displayName=WV;var ene="PopperArrow",gqe={top:"bottom",right:"left",bottom:"top",left:"right"},tne=k.forwardRef(function(t,n){const{__scopePopper:o,...a}=t,i=mqe(ene,o),s=gqe[i.placedSide];return u.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:u.jsx(fqe,{...a,ref:n,style:{...a.style,display:"block"}})})});tne.displayName=ene;function vqe(e){return e!==null}var kqe=e=>({name:"transformOrigin",options:e,fn(t){var C,_,N;const{placement:n,rects:o,middlewareData:a}=t,s=((C=a.arrow)==null?void 0:C.centerOffset)!==0,l=s?0:e.arrowWidth,d=s?0:e.arrowHeight,[h,p]=nne(n),m={start:"0%",center:"50%",end:"100%"}[p],v=(((_=a.arrow)==null?void 0:_.x)??0)+l/2,x=(((N=a.arrow)==null?void 0:N.y)??0)+d/2;let M="",b="";return h==="bottom"?(M=s?m:`${v}px`,b=`${-d}px`):h==="top"?(M=s?m:`${v}px`,b=`${o.floating.height+d}px`):h==="right"?(M=`${-d}px`,b=s?m:`${x}px`):h==="left"&&(M=`${o.floating.width+d}px`,b=s?m:`${x}px`),{data:{x:M,y:b}}}});function nne(e){const[t,n="center"]=e.split("-");return[t,n]}var GP=Wte,vp=Qte,XP=Jte,ZP=tne;function YP(e){const t=k.useRef({value:e,previous:e});return k.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var xqe=[" ","Enter","ArrowUp","ArrowDown"],wqe=[" ","Enter"],r1="Select",[WP,KP,bqe]=dp(r1),[h2,$qt]=zn(r1,[bqe,Ts]),QP=Ts(),[Mqe,Rs]=h2(r1),[_qe,Sqe]=h2(r1),one=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:a,onOpenChange:i,value:s,defaultValue:l,onValueChange:d,dir:h,name:p,autoComplete:m,disabled:v,required:x,form:M}=e,b=QP(t),[C,_]=k.useState(null),[N,A]=k.useState(null),[I,R]=k.useState(!1),j=m1(h),[D,H]=go({prop:o,defaultProp:a??!1,onChange:i,caller:r1}),[U,z]=go({prop:s,defaultProp:l,onChange:d,caller:r1}),Z=k.useRef(null),q=C?M||!!C.closest("form"):!0,[G,E]=k.useState(new Set),O=Array.from(G).map(P=>P.props.value).join(";");return u.jsx(GP,{...b,children:u.jsxs(Mqe,{required:x,scope:t,trigger:C,onTriggerChange:_,valueNode:N,onValueNodeChange:A,valueNodeHasChildren:I,onValueNodeHasChildrenChange:R,contentId:Dn(),value:U,onValueChange:z,open:D,onOpenChange:H,dir:j,triggerPointerDownPosRef:Z,disabled:v,children:[u.jsx(WP.Provider,{scope:t,children:u.jsx(_qe,{scope:e.__scopeSelect,onNativeOptionAdd:k.useCallback(P=>{E(X=>new Set(X).add(P))},[]),onNativeOptionRemove:k.useCallback(P=>{E(X=>{const W=new Set(X);return W.delete(P),W})},[]),children:n})}),q?u.jsxs(Nne,{"aria-hidden":!0,required:x,tabIndex:-1,name:p,autoComplete:m,value:U,onChange:P=>z(P.target.value),disabled:v,form:M,children:[U===void 0?u.jsx("option",{value:""}):null,Array.from(G)]},O):null]})})};one.displayName=r1;var ane="SelectTrigger",rne=k.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...a}=e,i=QP(n),s=Rs(ane,n),l=s.disabled||o,d=ot(t,s.onTriggerChange),h=KP(n),p=k.useRef("touch"),[m,v,x]=jne(b=>{const C=h().filter(A=>!A.disabled),_=C.find(A=>A.value===s.value),N=Ane(C,b,_);N!==void 0&&s.onValueChange(N.value)}),M=b=>{l||(s.onOpenChange(!0),x()),b&&(s.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return u.jsx(vp,{asChild:!0,...i,children:u.jsx(Ae.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Lne(s.value)?"":void 0,...a,ref:d,onClick:Me(a.onClick,b=>{b.currentTarget.focus(),p.current!=="mouse"&&M(b)}),onPointerDown:Me(a.onPointerDown,b=>{p.current=b.pointerType;const C=b.target;C.hasPointerCapture(b.pointerId)&&C.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(M(b),b.preventDefault())}),onKeyDown:Me(a.onKeyDown,b=>{const C=m.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&v(b.key),!(C&&b.key===" ")&&xqe.includes(b.key)&&(M(),b.preventDefault())})})})});rne.displayName=ane;var ine="SelectValue",sne=k.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:a,children:i,placeholder:s="",...l}=e,d=Rs(ine,n),{onValueNodeHasChildrenChange:h}=d,p=i!==void 0,m=ot(t,d.onValueNodeChange);return Gn(()=>{h(p)},[h,p]),u.jsx(Ae.span,{...l,ref:m,style:{pointerEvents:"none"},children:Lne(d.value)?u.jsx(u.Fragment,{children:s}):i})});sne.displayName=ine;var Cqe="SelectIcon",cne=k.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...a}=e;return u.jsx(Ae.span,{"aria-hidden":!0,...a,ref:t,children:o||"▼"})});cne.displayName=Cqe;var Nqe="SelectPortal",lne=e=>u.jsx(y1,{asChild:!0,...e});lne.displayName=Nqe;var i1="SelectContent",une=k.forwardRef((e,t)=>{const n=Rs(i1,e.__scopeSelect),[o,a]=k.useState();if(Gn(()=>{a(new DocumentFragment)},[]),!n.open){const i=o;return i?f1.createPortal(u.jsx(dne,{scope:e.__scopeSelect,children:u.jsx(WP.Slot,{scope:e.__scopeSelect,children:u.jsx("div",{children:e.children})})}),i):null}return u.jsx(hne,{...e,ref:t})});une.displayName=i1;var Pa=10,[dne,Ps]=h2(i1),Lqe="SelectContentImpl",jqe=Cs("SelectContent.RemoveScroll"),hne=k.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:s,side:l,sideOffset:d,align:h,alignOffset:p,arrowPadding:m,collisionBoundary:v,collisionPadding:x,sticky:M,hideWhenDetached:b,avoidCollisions:C,..._}=e,N=Rs(i1,n),[A,I]=k.useState(null),[R,j]=k.useState(null),D=ot(t,te=>I(te)),[H,U]=k.useState(null),[z,Z]=k.useState(null),q=KP(n),[G,E]=k.useState(!1),O=k.useRef(!1);k.useEffect(()=>{if(A)return DP(A)},[A]),PP();const P=k.useCallback(te=>{const[ce,...me]=q().map(Ie=>Ie.ref.current),[ke]=me.slice(-1),Ee=document.activeElement;for(const Ie of te)if(Ie===Ee||(Ie==null||Ie.scrollIntoView({block:"nearest"}),Ie===ce&&R&&(R.scrollTop=0),Ie===ke&&R&&(R.scrollTop=R.scrollHeight),Ie==null||Ie.focus(),document.activeElement!==Ee))return},[q,R]),X=k.useCallback(()=>P([H,A]),[P,H,A]);k.useEffect(()=>{G&&X()},[G,X]);const{onOpenChange:W,triggerPointerDownPosRef:V}=N;k.useEffect(()=>{if(A){let te={x:0,y:0};const ce=ke=>{var Ee,Ie;te={x:Math.abs(Math.round(ke.pageX)-(((Ee=V.current)==null?void 0:Ee.x)??0)),y:Math.abs(Math.round(ke.pageY)-(((Ie=V.current)==null?void 0:Ie.y)??0))}},me=ke=>{te.x<=10&&te.y<=10?ke.preventDefault():A.contains(ke.target)||W(!1),document.removeEventListener("pointermove",ce),V.current=null};return V.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",me,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",me,{capture:!0})}}},[A,W,V]),k.useEffect(()=>{const te=()=>W(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[W]);const[L,Y]=jne(te=>{const ce=q().filter(Ee=>!Ee.disabled),me=ce.find(Ee=>Ee.ref.current===document.activeElement),ke=Ane(ce,te,me);ke&&setTimeout(()=>ke.ref.current.focus())}),F=k.useCallback((te,ce,me)=>{const ke=!O.current&&!me;(N.value!==void 0&&N.value===ce||ke)&&(U(te),ke&&(O.current=!0))},[N.value]),T=k.useCallback(()=>A==null?void 0:A.focus(),[A]),K=k.useCallback((te,ce,me)=>{const ke=!O.current&&!me;(N.value!==void 0&&N.value===ce||ke)&&Z(te)},[N.value]),Q=o==="popper"?aH:fne,ne=Q===aH?{side:l,sideOffset:d,align:h,alignOffset:p,arrowPadding:m,collisionBoundary:v,collisionPadding:x,sticky:M,hideWhenDetached:b,avoidCollisions:C}:{};return u.jsx(dne,{scope:n,content:A,viewport:R,onViewportChange:j,itemRefCallback:F,selectedItem:H,onItemLeave:T,itemTextRefCallback:K,focusSelectedItem:X,selectedItemText:z,position:o,isPositioned:G,searchRef:L,children:u.jsx(pp,{as:jqe,allowPinchZoom:!0,children:u.jsx(fp,{asChild:!0,trapped:N.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:Me(a,te=>{var ce;(ce=N.trigger)==null||ce.focus({preventScroll:!0}),te.preventDefault()}),children:u.jsx(p1,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:u.jsx(Q,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:te=>te.preventDefault(),..._,...ne,onPlaced:()=>E(!0),ref:D,style:{display:"flex",flexDirection:"column",outline:"none",..._.style},onKeyDown:Me(_.onKeyDown,te=>{const ce=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!ce&&te.key.length===1&&Y(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let ke=q().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);if(["ArrowUp","End"].includes(te.key)&&(ke=ke.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const Ee=te.target,Ie=ke.indexOf(Ee);ke=ke.slice(Ie+1)}setTimeout(()=>P(ke)),te.preventDefault()}})})})})})})});hne.displayName=Lqe;var Aqe="SelectItemAlignedPosition",fne=k.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...a}=e,i=Rs(i1,n),s=Ps(i1,n),[l,d]=k.useState(null),[h,p]=k.useState(null),m=ot(t,D=>p(D)),v=KP(n),x=k.useRef(!1),M=k.useRef(!0),{viewport:b,selectedItem:C,selectedItemText:_,focusSelectedItem:N}=s,A=k.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&h&&b&&C&&_){const D=i.trigger.getBoundingClientRect(),H=h.getBoundingClientRect(),U=i.valueNode.getBoundingClientRect(),z=_.getBoundingClientRect();if(i.dir!=="rtl"){const Ee=z.left-H.left,Ie=U.left-Ee,Te=D.left-Ie,qe=D.width+Te,ct=Math.max(qe,H.width),jt=window.innerWidth-Pa,We=eH(Ie,[Pa,Math.max(Pa,jt-ct)]);l.style.minWidth=qe+"px",l.style.left=We+"px"}else{const Ee=H.right-z.right,Ie=window.innerWidth-U.right-Ee,Te=window.innerWidth-D.right-Ie,qe=D.width+Te,ct=Math.max(qe,H.width),jt=window.innerWidth-Pa,We=eH(Ie,[Pa,Math.max(Pa,jt-ct)]);l.style.minWidth=qe+"px",l.style.right=We+"px"}const Z=v(),q=window.innerHeight-Pa*2,G=b.scrollHeight,E=window.getComputedStyle(h),O=parseInt(E.borderTopWidth,10),P=parseInt(E.paddingTop,10),X=parseInt(E.borderBottomWidth,10),W=parseInt(E.paddingBottom,10),V=O+P+G+W+X,L=Math.min(C.offsetHeight*5,V),Y=window.getComputedStyle(b),F=parseInt(Y.paddingTop,10),T=parseInt(Y.paddingBottom,10),K=D.top+D.height/2-Pa,Q=q-K,ne=C.offsetHeight/2,te=C.offsetTop+ne,ce=O+P+te,me=V-ce;if(ce<=K){const Ee=Z.length>0&&C===Z[Z.length-1].ref.current;l.style.bottom="0px";const Ie=h.clientHeight-b.offsetTop-b.offsetHeight,Te=Math.max(Q,ne+(Ee?T:0)+Ie+X),qe=ce+Te;l.style.height=qe+"px"}else{const Ee=Z.length>0&&C===Z[0].ref.current;l.style.top="0px";const Te=Math.max(K,O+b.offsetTop+(Ee?F:0)+ne)+me;l.style.height=Te+"px",b.scrollTop=ce-K+b.offsetTop}l.style.margin=`${Pa}px 0`,l.style.minHeight=L+"px",l.style.maxHeight=q+"px",o==null||o(),requestAnimationFrame(()=>x.current=!0)}},[v,i.trigger,i.valueNode,l,h,b,C,_,i.dir,o]);Gn(()=>A(),[A]);const[I,R]=k.useState();Gn(()=>{h&&R(window.getComputedStyle(h).zIndex)},[h]);const j=k.useCallback(D=>{D&&M.current===!0&&(A(),N==null||N(),M.current=!1)},[A,N]);return u.jsx(Iqe,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:x,onScrollButtonChange:j,children:u.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:I},children:u.jsx(Ae.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});fne.displayName=Aqe;var Eqe="SelectPopperPosition",aH=k.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:a=Pa,...i}=e,s=QP(n);return u.jsx(XP,{...s,...i,ref:t,align:o,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});aH.displayName=Eqe;var[Iqe,KV]=h2(i1,{}),rH="SelectViewport",pne=k.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...a}=e,i=Ps(rH,n),s=KV(rH,n),l=ot(t,i.onViewportChange),d=k.useRef(0);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),u.jsx(WP.Slot,{scope:n,children:u.jsx(Ae.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Me(a.onScroll,h=>{const p=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:v}=s;if(v!=null&&v.current&&m){const x=Math.abs(d.current-p.scrollTop);if(x>0){const M=window.innerHeight-Pa*2,b=parseFloat(m.style.minHeight),C=parseFloat(m.style.height),_=Math.max(b,C);if(_<M){const N=_+x,A=Math.min(M,N),I=N-A;m.style.height=A+"px",m.style.bottom==="0px"&&(p.scrollTop=I>0?I:0,m.style.justifyContent="flex-end")}}}d.current=p.scrollTop})})})]})});pne.displayName=rH;var yne="SelectGroup",[Tqe,Rqe]=h2(yne),Pqe=k.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,a=Dn();return u.jsx(Tqe,{scope:n,id:a,children:u.jsx(Ae.div,{role:"group","aria-labelledby":a,...o,ref:t})})});Pqe.displayName=yne;var mne="SelectLabel",gne=k.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,a=Rqe(mne,n);return u.jsx(Ae.div,{id:a.id,...o,ref:t})});gne.displayName=mne;var KR="SelectItem",[$qe,vne]=h2(KR),kne=k.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:a=!1,textValue:i,...s}=e,l=Rs(KR,n),d=Ps(KR,n),h=l.value===o,[p,m]=k.useState(i??""),[v,x]=k.useState(!1),M=ot(t,N=>{var A;return(A=d.itemRefCallback)==null?void 0:A.call(d,N,o,a)}),b=Dn(),C=k.useRef("touch"),_=()=>{a||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return u.jsx($qe,{scope:n,value:o,disabled:a,textId:b,isSelected:h,onItemTextChange:k.useCallback(N=>{m(A=>A||((N==null?void 0:N.textContent)??"").trim())},[]),children:u.jsx(WP.ItemSlot,{scope:n,value:o,disabled:a,textValue:p,children:u.jsx(Ae.div,{role:"option","aria-labelledby":b,"data-highlighted":v?"":void 0,"aria-selected":h&&v,"data-state":h?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...s,ref:M,onFocus:Me(s.onFocus,()=>x(!0)),onBlur:Me(s.onBlur,()=>x(!1)),onClick:Me(s.onClick,()=>{C.current!=="mouse"&&_()}),onPointerUp:Me(s.onPointerUp,()=>{C.current==="mouse"&&_()}),onPointerDown:Me(s.onPointerDown,N=>{C.current=N.pointerType}),onPointerMove:Me(s.onPointerMove,N=>{var A;C.current=N.pointerType,a?(A=d.onItemLeave)==null||A.call(d):C.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Me(s.onPointerLeave,N=>{var A;N.currentTarget===document.activeElement&&((A=d.onItemLeave)==null||A.call(d))}),onKeyDown:Me(s.onKeyDown,N=>{var I;((I=d.searchRef)==null?void 0:I.current)!==""&&N.key===" "||(wqe.includes(N.key)&&_(),N.key===" "&&N.preventDefault())})})})})});kne.displayName=KR;var Df="SelectItemText",xne=k.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:a,...i}=e,s=Rs(Df,n),l=Ps(Df,n),d=vne(Df,n),h=Sqe(Df,n),[p,m]=k.useState(null),v=ot(t,_=>m(_),d.onItemTextChange,_=>{var N;return(N=l.itemTextRefCallback)==null?void 0:N.call(l,_,d.value,d.disabled)}),x=p==null?void 0:p.textContent,M=k.useMemo(()=>u.jsx("option",{value:d.value,disabled:d.disabled,children:x},d.value),[d.disabled,d.value,x]),{onNativeOptionAdd:b,onNativeOptionRemove:C}=h;return Gn(()=>(b(M),()=>C(M)),[b,C,M]),u.jsxs(u.Fragment,{children:[u.jsx(Ae.span,{id:d.textId,...i,ref:v}),d.isSelected&&s.valueNode&&!s.valueNodeHasChildren?f1.createPortal(i.children,s.valueNode):null]})});xne.displayName=Df;var wne="SelectItemIndicator",bne=k.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return vne(wne,n).isSelected?u.jsx(Ae.span,{"aria-hidden":!0,...o,ref:t}):null});bne.displayName=wne;var iH="SelectScrollUpButton",Mne=k.forwardRef((e,t)=>{const n=Ps(iH,e.__scopeSelect),o=KV(iH,e.__scopeSelect),[a,i]=k.useState(!1),s=ot(t,o.onScrollButtonChange);return Gn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const h=d.scrollTop>0;i(h)};const d=n.viewport;return l(),d.addEventListener("scroll",l),()=>d.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),a?u.jsx(Sne,{...e,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:d}=n;l&&d&&(l.scrollTop=l.scrollTop-d.offsetHeight)}}):null});Mne.displayName=iH;var sH="SelectScrollDownButton",_ne=k.forwardRef((e,t)=>{const n=Ps(sH,e.__scopeSelect),o=KV(sH,e.__scopeSelect),[a,i]=k.useState(!1),s=ot(t,o.onScrollButtonChange);return Gn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const h=d.scrollHeight-d.clientHeight,p=Math.ceil(d.scrollTop)<h;i(p)};const d=n.viewport;return l(),d.addEventListener("scroll",l),()=>d.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),a?u.jsx(Sne,{...e,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:d}=n;l&&d&&(l.scrollTop=l.scrollTop+d.offsetHeight)}}):null});_ne.displayName=sH;var Sne=k.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...a}=e,i=Ps("SelectScrollButton",n),s=k.useRef(null),l=KP(n),d=k.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return k.useEffect(()=>()=>d(),[d]),Gn(()=>{var p;const h=l().find(m=>m.ref.current===document.activeElement);(p=h==null?void 0:h.ref.current)==null||p.scrollIntoView({block:"nearest"})},[l]),u.jsx(Ae.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Me(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:Me(a.onPointerMove,()=>{var h;(h=i.onItemLeave)==null||h.call(i),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:Me(a.onPointerLeave,()=>{d()})})}),Dqe="SelectSeparator",Cne=k.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return u.jsx(Ae.div,{"aria-hidden":!0,...o,ref:t})});Cne.displayName=Dqe;var cH="SelectArrow",zqe=k.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,a=QP(n),i=Rs(cH,n),s=Ps(cH,n);return i.open&&s.position==="popper"?u.jsx(ZP,{...a,...o,ref:t}):null});zqe.displayName=cH;var Oqe="SelectBubbleInput",Nne=k.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const a=k.useRef(null),i=ot(o,a),s=YP(t);return k.useEffect(()=>{const l=a.current;if(!l)return;const d=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(d,"value").set;if(s!==t&&p){const m=new Event("change",{bubbles:!0});p.call(l,t),l.dispatchEvent(m)}},[s,t]),u.jsx(Ae.select,{...n,style:{...gee,...n.style},ref:i,defaultValue:t})});Nne.displayName=Oqe;function Lne(e){return e===""||e===void 0}function jne(e){const t=gn(e),n=k.useRef(""),o=k.useRef(0),a=k.useCallback(s=>{const l=n.current+s;t(l),function d(h){n.current=h,window.clearTimeout(o.current),h!==""&&(o.current=window.setTimeout(()=>d(""),1e3))}(l)},[t]),i=k.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return k.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,a,i]}function Ane(e,t,n){const a=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=qqe(e,Math.max(i,0));a.length===1&&(s=s.filter(h=>h!==n));const d=s.find(h=>h.textValue.toLowerCase().startsWith(a.toLowerCase()));return d!==n?d:void 0}function qqe(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Hqe=one,Ene=rne,Vqe=sne,Bqe=cne,Fqe=lne,Ine=une,Uqe=pne,Tne=gne,Rne=kne,Gqe=xne,Xqe=bne,Pne=Mne,$ne=_ne,Dne=Cne;const Wn=Hqe,Kn=Vqe,Fn=k.forwardRef(({className:e,children:t,...n},o)=>u.jsxs(Ene,{ref:o,className:ge("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,u.jsx(Bqe,{asChild:!0,children:u.jsx(Vd,{className:"h-4 w-4 opacity-50"})})]}));Fn.displayName=Ene.displayName;const zne=k.forwardRef(({className:e,...t},n)=>u.jsx(Pne,{ref:n,className:ge("flex cursor-default items-center justify-center py-1",e),...t,children:u.jsx(Wf,{className:"h-4 w-4"})}));zne.displayName=Pne.displayName;const One=k.forwardRef(({className:e,...t},n)=>u.jsx($ne,{ref:n,className:ge("flex cursor-default items-center justify-center py-1",e),...t,children:u.jsx(Vd,{className:"h-4 w-4"})}));One.displayName=$ne.displayName;const Un=k.forwardRef(({className:e,children:t,position:n="popper",...o},a)=>u.jsx(Fqe,{children:u.jsxs(Ine,{ref:a,className:ge("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...o,children:[u.jsx(zne,{}),u.jsx(Uqe,{className:ge("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),u.jsx(One,{})]})}));Un.displayName=Ine.displayName;const Zqe=k.forwardRef(({className:e,...t},n)=>u.jsx(Tne,{ref:n,className:ge("px-2 py-1.5 text-sm font-semibold",e),...t}));Zqe.displayName=Tne.displayName;const et=k.forwardRef(({className:e,children:t,...n},o)=>u.jsxs(Rne,{ref:o,className:ge("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[u.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:u.jsx(Xqe,{children:u.jsx(ri,{className:"h-4 w-4"})})}),u.jsx(Gqe,{children:t})]}));et.displayName=Rne.displayName;const Yqe=k.forwardRef(({className:e,...t},n)=>u.jsx(Dne,{ref:n,className:ge("-mx-1 my-1 h-px bg-muted",e),...t}));Yqe.displayName=Dne.displayName;const Nn=k.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ge("rounded-xl border bg-card text-card-foreground shadow",e),...t}));Nn.displayName="Card";const kn=k.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ge("flex flex-col space-y-1.5 p-6",e),...t}));kn.displayName="CardHeader";const xn=k.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ge("font-semibold leading-none tracking-tight",e),...t}));xn.displayName="CardTitle";const Qn=k.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ge("text-sm text-muted-foreground",e),...t}));Qn.displayName="CardDescription";const Ln=k.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ge("p-6 pt-0",e),...t}));Ln.displayName="CardContent";const JP=k.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ge("flex items-center p-6 pt-0",e),...t}));JP.displayName="CardFooter";function Wqe(e,t){return k.useReducer((n,o)=>t[n][o]??n,e)}var QV="ScrollArea",[qne,Dqt]=zn(QV),[Kqe,Sa]=qne(QV),Hne=k.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:o="hover",dir:a,scrollHideDelay:i=600,...s}=e,[l,d]=k.useState(null),[h,p]=k.useState(null),[m,v]=k.useState(null),[x,M]=k.useState(null),[b,C]=k.useState(null),[_,N]=k.useState(0),[A,I]=k.useState(0),[R,j]=k.useState(!1),[D,H]=k.useState(!1),U=ot(t,Z=>d(Z)),z=m1(a);return u.jsx(Kqe,{scope:n,type:o,dir:z,scrollHideDelay:i,scrollArea:l,viewport:h,onViewportChange:p,content:m,onContentChange:v,scrollbarX:x,onScrollbarXChange:M,scrollbarXEnabled:R,onScrollbarXEnabledChange:j,scrollbarY:b,onScrollbarYChange:C,scrollbarYEnabled:D,onScrollbarYEnabledChange:H,onCornerWidthChange:N,onCornerHeightChange:I,children:u.jsx(Ae.div,{dir:z,...s,ref:U,style:{position:"relative","--radix-scroll-area-corner-width":_+"px","--radix-scroll-area-corner-height":A+"px",...e.style}})})});Hne.displayName=QV;var Vne="ScrollAreaViewport",Bne=k.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:o,nonce:a,...i}=e,s=Sa(Vne,n),l=k.useRef(null),d=ot(t,l,s.onViewportChange);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),u.jsx(Ae.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:u.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});Bne.displayName=Vne;var Tr="ScrollAreaScrollbar",JV=k.forwardRef((e,t)=>{const{forceMount:n,...o}=e,a=Sa(Tr,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=a,l=e.orientation==="horizontal";return k.useEffect(()=>(l?i(!0):s(!0),()=>{l?i(!1):s(!1)}),[l,i,s]),a.type==="hover"?u.jsx(Qqe,{...o,ref:t,forceMount:n}):a.type==="scroll"?u.jsx(Jqe,{...o,ref:t,forceMount:n}):a.type==="auto"?u.jsx(Fne,{...o,ref:t,forceMount:n}):a.type==="always"?u.jsx(eB,{...o,ref:t}):null});JV.displayName=Tr;var Qqe=k.forwardRef((e,t)=>{const{forceMount:n,...o}=e,a=Sa(Tr,e.__scopeScrollArea),[i,s]=k.useState(!1);return k.useEffect(()=>{const l=a.scrollArea;let d=0;if(l){const h=()=>{window.clearTimeout(d),s(!0)},p=()=>{d=window.setTimeout(()=>s(!1),a.scrollHideDelay)};return l.addEventListener("pointerenter",h),l.addEventListener("pointerleave",p),()=>{window.clearTimeout(d),l.removeEventListener("pointerenter",h),l.removeEventListener("pointerleave",p)}}},[a.scrollArea,a.scrollHideDelay]),u.jsx(jn,{present:n||i,children:u.jsx(Fne,{"data-state":i?"visible":"hidden",...o,ref:t})})}),Jqe=k.forwardRef((e,t)=>{const{forceMount:n,...o}=e,a=Sa(Tr,e.__scopeScrollArea),i=e.orientation==="horizontal",s=t$(()=>d("SCROLL_END"),100),[l,d]=Wqe("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return k.useEffect(()=>{if(l==="idle"){const h=window.setTimeout(()=>d("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(h)}},[l,a.scrollHideDelay,d]),k.useEffect(()=>{const h=a.viewport,p=i?"scrollLeft":"scrollTop";if(h){let m=h[p];const v=()=>{const x=h[p];m!==x&&(d("SCROLL"),s()),m=x};return h.addEventListener("scroll",v),()=>h.removeEventListener("scroll",v)}},[a.viewport,i,d,s]),u.jsx(jn,{present:n||l!=="hidden",children:u.jsx(eB,{"data-state":l==="hidden"?"hidden":"visible",...o,ref:t,onPointerEnter:Me(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Me(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),Fne=k.forwardRef((e,t)=>{const n=Sa(Tr,e.__scopeScrollArea),{forceMount:o,...a}=e,[i,s]=k.useState(!1),l=e.orientation==="horizontal",d=t$(()=>{if(n.viewport){const h=n.viewport.offsetWidth<n.viewport.scrollWidth,p=n.viewport.offsetHeight<n.viewport.scrollHeight;s(l?h:p)}},10);return Zh(n.viewport,d),Zh(n.content,d),u.jsx(jn,{present:o||i,children:u.jsx(eB,{"data-state":i?"visible":"hidden",...a,ref:t})})}),eB=k.forwardRef((e,t)=>{const{orientation:n="vertical",...o}=e,a=Sa(Tr,e.__scopeScrollArea),i=k.useRef(null),s=k.useRef(0),[l,d]=k.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=Yne(l.viewport,l.content),p={...o,sizes:l,onSizesChange:d,hasThumb:h>0&&h<1,onThumbChange:v=>i.current=v,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:v=>s.current=v};function m(v,x){return rHe(v,s.current,l,x)}return n==="horizontal"?u.jsx(eHe,{...p,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const v=a.viewport.scrollLeft,x=QY(v,l,a.dir);i.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:v=>{a.viewport&&(a.viewport.scrollLeft=v)},onDragScroll:v=>{a.viewport&&(a.viewport.scrollLeft=m(v,a.dir))}}):n==="vertical"?u.jsx(tHe,{...p,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const v=a.viewport.scrollTop,x=QY(v,l);i.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:v=>{a.viewport&&(a.viewport.scrollTop=v)},onDragScroll:v=>{a.viewport&&(a.viewport.scrollTop=m(v))}}):null}),eHe=k.forwardRef((e,t)=>{const{sizes:n,onSizesChange:o,...a}=e,i=Sa(Tr,e.__scopeScrollArea),[s,l]=k.useState(),d=k.useRef(null),h=ot(t,d,i.onScrollbarXChange);return k.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),u.jsx(Gne,{"data-orientation":"horizontal",...a,ref:h,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":e$(n)+"px",...e.style},onThumbPointerDown:p=>e.onThumbPointerDown(p.x),onDragScroll:p=>e.onDragScroll(p.x),onWheelScroll:(p,m)=>{if(i.viewport){const v=i.viewport.scrollLeft+p.deltaX;e.onWheelScroll(v),Kne(v,m)&&p.preventDefault()}},onResize:()=>{d.current&&i.viewport&&s&&o({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:JR(s.paddingLeft),paddingEnd:JR(s.paddingRight)}})}})}),tHe=k.forwardRef((e,t)=>{const{sizes:n,onSizesChange:o,...a}=e,i=Sa(Tr,e.__scopeScrollArea),[s,l]=k.useState(),d=k.useRef(null),h=ot(t,d,i.onScrollbarYChange);return k.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),u.jsx(Gne,{"data-orientation":"vertical",...a,ref:h,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":e$(n)+"px",...e.style},onThumbPointerDown:p=>e.onThumbPointerDown(p.y),onDragScroll:p=>e.onDragScroll(p.y),onWheelScroll:(p,m)=>{if(i.viewport){const v=i.viewport.scrollTop+p.deltaY;e.onWheelScroll(v),Kne(v,m)&&p.preventDefault()}},onResize:()=>{d.current&&i.viewport&&s&&o({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:JR(s.paddingTop),paddingEnd:JR(s.paddingBottom)}})}})}),[nHe,Une]=qne(Tr),Gne=k.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:o,hasThumb:a,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:l,onThumbPositionChange:d,onDragScroll:h,onWheelScroll:p,onResize:m,...v}=e,x=Sa(Tr,n),[M,b]=k.useState(null),C=ot(t,U=>b(U)),_=k.useRef(null),N=k.useRef(""),A=x.viewport,I=o.content-o.viewport,R=gn(p),j=gn(d),D=t$(m,10);function H(U){if(_.current){const z=U.clientX-_.current.left,Z=U.clientY-_.current.top;h({x:z,y:Z})}}return k.useEffect(()=>{const U=z=>{const Z=z.target;(M==null?void 0:M.contains(Z))&&R(z,I)};return document.addEventListener("wheel",U,{passive:!1}),()=>document.removeEventListener("wheel",U,{passive:!1})},[A,M,I,R]),k.useEffect(j,[o,j]),Zh(M,D),Zh(x.content,D),u.jsx(nHe,{scope:n,scrollbar:M,hasThumb:a,onThumbChange:gn(i),onThumbPointerUp:gn(s),onThumbPositionChange:j,onThumbPointerDown:gn(l),children:u.jsx(Ae.div,{...v,ref:C,style:{position:"absolute",...v.style},onPointerDown:Me(e.onPointerDown,U=>{U.button===0&&(U.target.setPointerCapture(U.pointerId),_.current=M.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),H(U))}),onPointerMove:Me(e.onPointerMove,H),onPointerUp:Me(e.onPointerUp,U=>{const z=U.target;z.hasPointerCapture(U.pointerId)&&z.releasePointerCapture(U.pointerId),document.body.style.webkitUserSelect=N.current,x.viewport&&(x.viewport.style.scrollBehavior=""),_.current=null})})})}),QR="ScrollAreaThumb",Xne=k.forwardRef((e,t)=>{const{forceMount:n,...o}=e,a=Une(QR,e.__scopeScrollArea);return u.jsx(jn,{present:n||a.hasThumb,children:u.jsx(oHe,{ref:t,...o})})}),oHe=k.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:o,...a}=e,i=Sa(QR,n),s=Une(QR,n),{onThumbPositionChange:l}=s,d=ot(t,m=>s.onThumbChange(m)),h=k.useRef(void 0),p=t$(()=>{h.current&&(h.current(),h.current=void 0)},100);return k.useEffect(()=>{const m=i.viewport;if(m){const v=()=>{if(p(),!h.current){const x=iHe(m,l);h.current=x,l()}};return l(),m.addEventListener("scroll",v),()=>m.removeEventListener("scroll",v)}},[i.viewport,p,l]),u.jsx(Ae.div,{"data-state":s.hasThumb?"visible":"hidden",...a,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Me(e.onPointerDownCapture,m=>{const x=m.target.getBoundingClientRect(),M=m.clientX-x.left,b=m.clientY-x.top;s.onThumbPointerDown({x:M,y:b})}),onPointerUp:Me(e.onPointerUp,s.onThumbPointerUp)})});Xne.displayName=QR;var tB="ScrollAreaCorner",Zne=k.forwardRef((e,t)=>{const n=Sa(tB,e.__scopeScrollArea),o=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&o?u.jsx(aHe,{...e,ref:t}):null});Zne.displayName=tB;var aHe=k.forwardRef((e,t)=>{const{__scopeScrollArea:n,...o}=e,a=Sa(tB,n),[i,s]=k.useState(0),[l,d]=k.useState(0),h=!!(i&&l);return Zh(a.scrollbarX,()=>{var m;const p=((m=a.scrollbarX)==null?void 0:m.offsetHeight)||0;a.onCornerHeightChange(p),d(p)}),Zh(a.scrollbarY,()=>{var m;const p=((m=a.scrollbarY)==null?void 0:m.offsetWidth)||0;a.onCornerWidthChange(p),s(p)}),h?u.jsx(Ae.div,{...o,ref:t,style:{width:i,height:l,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function JR(e){return e?parseInt(e,10):0}function Yne(e,t){const n=e/t;return isNaN(n)?0:n}function e$(e){const t=Yne(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=(e.scrollbar.size-n)*t;return Math.max(o,18)}function rHe(e,t,n,o="ltr"){const a=e$(n),i=a/2,s=t||i,l=a-s,d=n.scrollbar.paddingStart+s,h=n.scrollbar.size-n.scrollbar.paddingEnd-l,p=n.content-n.viewport,m=o==="ltr"?[0,p]:[p*-1,0];return Wne([d,h],m)(e)}function QY(e,t,n="ltr"){const o=e$(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-a,s=t.content-t.viewport,l=i-o,d=n==="ltr"?[0,s]:[s*-1,0],h=eH(e,d);return Wne([0,s],[0,l])(h)}function Wne(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const o=(t[1]-t[0])/(e[1]-e[0]);return t[0]+o*(n-e[0])}}function Kne(e,t){return e>0&&e<t}var iHe=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},o=0;return function a(){const i={left:e.scrollLeft,top:e.scrollTop},s=n.left!==i.left,l=n.top!==i.top;(s||l)&&t(),n=i,o=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(o)};function t$(e,t){const n=gn(e),o=k.useRef(0);return k.useEffect(()=>()=>window.clearTimeout(o.current),[]),k.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(n,t)},[n,t])}function Zh(e,t){const n=gn(t);Gn(()=>{let o=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(n)});return a.observe(e),()=>{window.cancelAnimationFrame(o),a.unobserve(e)}}},[e,n])}var Qne=Hne,sHe=Bne,cHe=Zne;const f2=k.forwardRef(({className:e,children:t,...n},o)=>u.jsxs(Qne,{ref:o,className:ge("relative overflow-hidden",e),...n,children:[u.jsx(sHe,{className:"h-full w-full rounded-[inherit]",children:t}),u.jsx(Jne,{}),u.jsx(cHe,{})]}));f2.displayName=Qne.displayName;const Jne=k.forwardRef(({className:e,orientation:t="vertical",...n},o)=>u.jsx(JV,{ref:o,orientation:t,className:ge("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:u.jsx(Xne,{className:"relative flex-1 rounded-full bg-border"})}));Jne.displayName=JV.displayName;function lH({value:e=[],onChange:t,placeholder:n="Добавить элемент..."}){const o=(s,l)=>{const d=[...e];d[s]=l,t(d)},a=()=>{t([...e,""])},i=s=>{const l=[...e];l.splice(s,1),t(l)};return u.jsxs("div",{className:"space-y-2",children:[e.map((s,l)=>u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Ze,{value:s,onChange:d=>o(l,d.target.value),placeholder:n}),u.jsx(pe,{type:"button",variant:"ghost",size:"icon",onClick:()=>i(l),className:"text-muted-foreground hover:text-destructive shrink-0",children:u.jsx(xs,{className:"h-4 w-4"})})]},l)),u.jsxs(pe,{type:"button",variant:"outline",size:"sm",className:"w-full mt-2",onClick:a,children:[u.jsx(za,{className:"mr-2 h-4 w-4"}),"Добавить"]})]})}function eoe({bot:e,servers:t,onFormChange:n,onFormSubmit:o,isCreation:a=!1,isSaving:i=!1}){const[s,l]=k.useState({username:"",password:"",prefix:"@",note:"",serverId:"",owners:[],proxyHost:"",proxyPort:"",proxyUsername:"",proxyPassword:""}),d=le.useRef(!1);k.useEffect(()=>{var M;e&&(d.current=!1,l({username:e.username||"",password:"",prefix:e.prefix||"@",note:e.note||"",serverId:((M=e.serverId)==null?void 0:M.toString())||"",owners:e.owners?e.owners.split(",").map(b=>b.trim()).filter(Boolean):[],proxyHost:e.proxyHost||"",proxyPort:e.proxyPort||"",proxyUsername:e.proxyUsername||"",proxyPassword:""}))},[e]),k.useEffect(()=>{n&&(d.current?n(s):d.current=!0)},[s,n]);const h=M=>{const{name:b,value:C}=M.target;l(_=>({..._,[b]:C}))},p=M=>{l(b=>({...b,serverId:M}))},m=M=>{l(b=>({...b,owners:M}))},v=M=>{if(M.preventDefault(),o){const b={...s};Array.isArray(b.owners)&&(b.owners=b.owners.join(",")),b.password||delete b.password,b.proxyPassword||delete b.proxyPassword,o(b)}},x=!!o;return u.jsxs("form",{onSubmit:v,className:"flex flex-col h-full",children:[u.jsxs(kn,{children:[u.jsx(xn,{children:a?"Создание нового бота":"Основные настройки"}),u.jsx(Qn,{children:a?"Заполните информацию ниже, чтобы добавить нового бота в панель.":"Здесь вы можете изменить основные параметры бота."})]}),u.jsx(f2,{className:"flex-grow",children:u.jsxs(Ln,{className:"space-y-4 px-6 pb-6",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"username",children:"Имя бота"}),u.jsx(Ze,{id:"username",name:"username",value:s.username,onChange:h,required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"note",children:"Короткая заметка"}),u.jsx(Ze,{id:"note",name:"note",value:s.note,onChange:h,placeholder:"Например, Масед 1"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"password",children:"Пароль (введите для изменения)"}),u.jsx(Ze,{id:"password",name:"password",type:"password",value:s.password,onChange:h,placeholder:"••••••••"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"prefix",children:"Префикс команд"}),u.jsx(Ze,{id:"prefix",name:"prefix",value:s.prefix,onChange:h,required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"serverId",children:"Сервер"}),u.jsxs(Wn,{name:"serverId",value:s.serverId,onValueChange:p,required:!0,children:[u.jsx(Fn,{children:u.jsx(Kn,{placeholder:"Выберите сервер"})}),u.jsx(Un,{children:t.map(M=>u.jsxs(et,{value:M.id.toString(),children:[M.name," (",M.host,":",M.port,")"]},M.id))})]})]}),u.jsx(Gh,{className:"my-6"}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{children:"Владельцы бота (Owners)"}),u.jsx(lH,{value:s.owners,onChange:m,placeholder:"Никнейм владельца"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Владельцы имеют полный доступ ко всем командам этого бота, игнорируя любые ограничения."})]}),u.jsx(Gh,{className:"my-6"}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("h3",{className:"text-lg font-semibold",children:"Настройки прокси (SOCKS5)"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Оставьте поля пустыми, если прокси не требуется."}),u.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{htmlFor:"proxyHost",children:"Хост"}),u.jsx(Ze,{id:"proxyHost",name:"proxyHost",value:s.proxyHost||"",onChange:h,placeholder:"123.45.67.89"})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{htmlFor:"proxyPort",children:"Порт"}),u.jsx(Ze,{id:"proxyPort",name:"proxyPort",type:"number",value:s.proxyPort||"",onChange:h,placeholder:"1080"})]})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{htmlFor:"proxyUsername",children:"Логин"}),u.jsx(Ze,{id:"proxyUsername",name:"proxyUsername",value:s.proxyUsername||"",onChange:h})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{htmlFor:"proxyPassword",children:"Пароль прокси (введите для изменения)"}),u.jsx(Ze,{id:"proxyPassword",name:"proxyPassword",type:"password",value:s.proxyPassword,onChange:h,placeholder:"••••••••"})]})]})]})]})}),x&&u.jsx(JP,{className:"pt-6 border-t",children:u.jsx(pe,{type:"submit",disabled:i,className:"w-full",children:i?"Сохранение...":a?"Создать бота":"Сохранить изменения"})})]})}function lHe(e,t){if(e==null)return{};var n={},o=Object.keys(e),a,i;for(i=0;i<o.length;i++)a=o[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}var uHe=["color"],dHe=k.forwardRef(function(e,t){var n=e.color,o=n===void 0?"currentColor":n,a=lHe(e,uHe);return k.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),k.createElement("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))}),JY=1,hHe=.9,fHe=.8,pHe=.17,_O=.1,SO=.999,yHe=.9999,mHe=.99,gHe=/[\\\/_+.#"@\[\(\{&]/,vHe=/[\\\/_+.#"@\[\(\{&]/g,kHe=/[\s-]/,toe=/[\s-]/g;function uH(e,t,n,o,a,i,s){if(i===t.length)return a===e.length?JY:mHe;var l=`${a},${i}`;if(s[l]!==void 0)return s[l];for(var d=o.charAt(i),h=n.indexOf(d,a),p=0,m,v,x,M;h>=0;)m=uH(e,t,n,o,h+1,i+1,s),m>p&&(h===a?m*=JY:gHe.test(e.charAt(h-1))?(m*=fHe,x=e.slice(a,h-1).match(vHe),x&&a>0&&(m*=Math.pow(SO,x.length))):kHe.test(e.charAt(h-1))?(m*=hHe,M=e.slice(a,h-1).match(toe),M&&a>0&&(m*=Math.pow(SO,M.length))):(m*=pHe,a>0&&(m*=Math.pow(SO,h-a))),e.charAt(h)!==t.charAt(i)&&(m*=yHe)),(m<_O&&n.charAt(h-1)===o.charAt(i+1)||o.charAt(i+1)===o.charAt(i)&&n.charAt(h-1)!==o.charAt(i))&&(v=uH(e,t,n,o,h+1,i+2,s),v*_O>m&&(m=v*_O)),m>p&&(p=m),h=n.indexOf(d,h+1);return s[l]=p,p}function eW(e){return e.toLowerCase().replace(toe," ")}function xHe(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,uH(e,t,eW(e),eW(t),0,0,{})}var Mf='[cmdk-group=""]',CO='[cmdk-group-items=""]',wHe='[cmdk-group-heading=""]',noe='[cmdk-item=""]',tW=`${noe}:not([aria-disabled="true"])`,dH="cmdk-item-select",hh="data-value",bHe=(e,t,n)=>xHe(e,t,n),ooe=k.createContext(void 0),kp=()=>k.useContext(ooe),aoe=k.createContext(void 0),nB=()=>k.useContext(aoe),roe=k.createContext(void 0),ioe=k.forwardRef((e,t)=>{let n=fh(()=>{var F,T;return{search:"",value:(T=(F=e.value)!=null?F:e.defaultValue)!=null?T:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=fh(()=>new Set),a=fh(()=>new Map),i=fh(()=>new Map),s=fh(()=>new Set),l=soe(e),{label:d,children:h,value:p,onValueChange:m,filter:v,shouldFilter:x,loop:M,disablePointerSelection:b=!1,vimBindings:C=!0,..._}=e,N=Dn(),A=Dn(),I=Dn(),R=k.useRef(null),j=THe();s1(()=>{if(p!==void 0){let F=p.trim();n.current.value=F,D.emit()}},[p]),s1(()=>{j(6,G)},[]);let D=k.useMemo(()=>({subscribe:F=>(s.current.add(F),()=>s.current.delete(F)),snapshot:()=>n.current,setState:(F,T,K)=>{var Q,ne,te,ce;if(!Object.is(n.current[F],T)){if(n.current[F]=T,F==="search")q(),z(),j(1,Z);else if(F==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let me=document.getElementById(I);me?me.focus():(Q=document.getElementById(N))==null||Q.focus()}if(j(7,()=>{var me;n.current.selectedItemId=(me=E())==null?void 0:me.id,D.emit()}),K||j(5,G),((ne=l.current)==null?void 0:ne.value)!==void 0){let me=T??"";(ce=(te=l.current).onValueChange)==null||ce.call(te,me);return}}D.emit()}},emit:()=>{s.current.forEach(F=>F())}}),[]),H=k.useMemo(()=>({value:(F,T,K)=>{var Q;T!==((Q=i.current.get(F))==null?void 0:Q.value)&&(i.current.set(F,{value:T,keywords:K}),n.current.filtered.items.set(F,U(T,K)),j(2,()=>{z(),D.emit()}))},item:(F,T)=>(o.current.add(F),T&&(a.current.has(T)?a.current.get(T).add(F):a.current.set(T,new Set([F]))),j(3,()=>{q(),z(),n.current.value||Z(),D.emit()}),()=>{i.current.delete(F),o.current.delete(F),n.current.filtered.items.delete(F);let K=E();j(4,()=>{q(),(K==null?void 0:K.getAttribute("id"))===F&&Z(),D.emit()})}),group:F=>(a.current.has(F)||a.current.set(F,new Set),()=>{i.current.delete(F),a.current.delete(F)}),filter:()=>l.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:N,inputId:I,labelId:A,listInnerRef:R}),[]);function U(F,T){var K,Q;let ne=(Q=(K=l.current)==null?void 0:K.filter)!=null?Q:bHe;return F?ne(F,n.current.search,T):0}function z(){if(!n.current.search||l.current.shouldFilter===!1)return;let F=n.current.filtered.items,T=[];n.current.filtered.groups.forEach(Q=>{let ne=a.current.get(Q),te=0;ne.forEach(ce=>{let me=F.get(ce);te=Math.max(me,te)}),T.push([Q,te])});let K=R.current;O().sort((Q,ne)=>{var te,ce;let me=Q.getAttribute("id"),ke=ne.getAttribute("id");return((te=F.get(ke))!=null?te:0)-((ce=F.get(me))!=null?ce:0)}).forEach(Q=>{let ne=Q.closest(CO);ne?ne.appendChild(Q.parentElement===ne?Q:Q.closest(`${CO} > *`)):K.appendChild(Q.parentElement===K?Q:Q.closest(`${CO} > *`))}),T.sort((Q,ne)=>ne[1]-Q[1]).forEach(Q=>{var ne;let te=(ne=R.current)==null?void 0:ne.querySelector(`${Mf}[${hh}="${encodeURIComponent(Q[0])}"]`);te==null||te.parentElement.appendChild(te)})}function Z(){let F=O().find(K=>K.getAttribute("aria-disabled")!=="true"),T=F==null?void 0:F.getAttribute(hh);D.setState("value",T||void 0)}function q(){var F,T,K,Q;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=o.current.size;return}n.current.filtered.groups=new Set;let ne=0;for(let te of o.current){let ce=(T=(F=i.current.get(te))==null?void 0:F.value)!=null?T:"",me=(Q=(K=i.current.get(te))==null?void 0:K.keywords)!=null?Q:[],ke=U(ce,me);n.current.filtered.items.set(te,ke),ke>0&&ne++}for(let[te,ce]of a.current)for(let me of ce)if(n.current.filtered.items.get(me)>0){n.current.filtered.groups.add(te);break}n.current.filtered.count=ne}function G(){var F,T,K;let Q=E();Q&&(((F=Q.parentElement)==null?void 0:F.firstChild)===Q&&((K=(T=Q.closest(Mf))==null?void 0:T.querySelector(wHe))==null||K.scrollIntoView({block:"nearest"})),Q.scrollIntoView({block:"nearest"}))}function E(){var F;return(F=R.current)==null?void 0:F.querySelector(`${noe}[aria-selected="true"]`)}function O(){var F;return Array.from(((F=R.current)==null?void 0:F.querySelectorAll(tW))||[])}function P(F){let T=O()[F];T&&D.setState("value",T.getAttribute(hh))}function X(F){var T;let K=E(),Q=O(),ne=Q.findIndex(ce=>ce===K),te=Q[ne+F];(T=l.current)!=null&&T.loop&&(te=ne+F<0?Q[Q.length-1]:ne+F===Q.length?Q[0]:Q[ne+F]),te&&D.setState("value",te.getAttribute(hh))}function W(F){let T=E(),K=T==null?void 0:T.closest(Mf),Q;for(;K&&!Q;)K=F>0?EHe(K,Mf):IHe(K,Mf),Q=K==null?void 0:K.querySelector(tW);Q?D.setState("value",Q.getAttribute(hh)):X(F)}let V=()=>P(O().length-1),L=F=>{F.preventDefault(),F.metaKey?V():F.altKey?W(1):X(1)},Y=F=>{F.preventDefault(),F.metaKey?P(0):F.altKey?W(-1):X(-1)};return k.createElement(Ae.div,{ref:t,tabIndex:-1,..._,"cmdk-root":"",onKeyDown:F=>{var T;(T=_.onKeyDown)==null||T.call(_,F);let K=F.nativeEvent.isComposing||F.keyCode===229;if(!(F.defaultPrevented||K))switch(F.key){case"n":case"j":{C&&F.ctrlKey&&L(F);break}case"ArrowDown":{L(F);break}case"p":case"k":{C&&F.ctrlKey&&Y(F);break}case"ArrowUp":{Y(F);break}case"Home":{F.preventDefault(),P(0);break}case"End":{F.preventDefault(),V();break}case"Enter":{F.preventDefault();let Q=E();if(Q){let ne=new Event(dH);Q.dispatchEvent(ne)}}}}},k.createElement("label",{"cmdk-label":"",htmlFor:H.inputId,id:H.labelId,style:PHe},d),n$(e,F=>k.createElement(aoe.Provider,{value:D},k.createElement(ooe.Provider,{value:H},F))))}),MHe=k.forwardRef((e,t)=>{var n,o;let a=Dn(),i=k.useRef(null),s=k.useContext(roe),l=kp(),d=soe(e),h=(o=(n=d.current)==null?void 0:n.forceMount)!=null?o:s==null?void 0:s.forceMount;s1(()=>{if(!h)return l.item(a,s==null?void 0:s.id)},[h]);let p=coe(a,i,[e.value,e.children,i],e.keywords),m=nB(),v=js(j=>j.value&&j.value===p.current),x=js(j=>h||l.filter()===!1?!0:j.search?j.filtered.items.get(a)>0:!0);k.useEffect(()=>{let j=i.current;if(!(!j||e.disabled))return j.addEventListener(dH,M),()=>j.removeEventListener(dH,M)},[x,e.onSelect,e.disabled]);function M(){var j,D;b(),(D=(j=d.current).onSelect)==null||D.call(j,p.current)}function b(){m.setState("value",p.current,!0)}if(!x)return null;let{disabled:C,value:_,onSelect:N,forceMount:A,keywords:I,...R}=e;return k.createElement(Ae.div,{ref:ui(i,t),...R,id:a,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!v,"data-disabled":!!C,"data-selected":!!v,onPointerMove:C||l.getDisablePointerSelection()?void 0:b,onClick:C?void 0:M},e.children)}),_He=k.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:a,...i}=e,s=Dn(),l=k.useRef(null),d=k.useRef(null),h=Dn(),p=kp(),m=js(x=>a||p.filter()===!1?!0:x.search?x.filtered.groups.has(s):!0);s1(()=>p.group(s),[]),coe(s,l,[e.value,e.heading,d]);let v=k.useMemo(()=>({id:s,forceMount:a}),[a]);return k.createElement(Ae.div,{ref:ui(l,t),...i,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},n&&k.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),n$(e,x=>k.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},k.createElement(roe.Provider,{value:v},x))))}),SHe=k.forwardRef((e,t)=>{let{alwaysRender:n,...o}=e,a=k.useRef(null),i=js(s=>!s.search);return!n&&!i?null:k.createElement(Ae.div,{ref:ui(a,t),...o,"cmdk-separator":"",role:"separator"})}),CHe=k.forwardRef((e,t)=>{let{onValueChange:n,...o}=e,a=e.value!=null,i=nB(),s=js(h=>h.search),l=js(h=>h.selectedItemId),d=kp();return k.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),k.createElement(Ae.input,{ref:t,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":l,id:d.inputId,type:"text",value:a?e.value:s,onChange:h=>{a||i.setState("search",h.target.value),n==null||n(h.target.value)}})}),NHe=k.forwardRef((e,t)=>{let{children:n,label:o="Suggestions",...a}=e,i=k.useRef(null),s=k.useRef(null),l=js(h=>h.selectedItemId),d=kp();return k.useEffect(()=>{if(s.current&&i.current){let h=s.current,p=i.current,m,v=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let x=h.offsetHeight;p.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return v.observe(h),()=>{cancelAnimationFrame(m),v.unobserve(h)}}},[]),k.createElement(Ae.div,{ref:ui(i,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":o,id:d.listId},n$(e,h=>k.createElement("div",{ref:ui(s,d.listInnerRef),"cmdk-list-sizer":""},h)))}),LHe=k.forwardRef((e,t)=>{let{open:n,onOpenChange:o,overlayClassName:a,contentClassName:i,container:s,...l}=e;return k.createElement(OP,{open:n,onOpenChange:o},k.createElement(qP,{container:s},k.createElement(c2,{"cmdk-overlay":"",className:a}),k.createElement(l2,{"aria-label":e.label,"cmdk-dialog":"",className:i},k.createElement(ioe,{ref:t,...l}))))}),jHe=k.forwardRef((e,t)=>js(n=>n.filtered.count===0)?k.createElement(Ae.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),AHe=k.forwardRef((e,t)=>{let{progress:n,children:o,label:a="Loading...",...i}=e;return k.createElement(Ae.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},n$(e,s=>k.createElement("div",{"aria-hidden":!0},s)))}),Po=Object.assign(ioe,{List:NHe,Item:MHe,Input:CHe,Group:_He,Separator:SHe,Dialog:LHe,Empty:jHe,Loading:AHe});function EHe(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function IHe(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function soe(e){let t=k.useRef(e);return s1(()=>{t.current=e}),t}var s1=typeof window>"u"?k.useEffect:k.useLayoutEffect;function fh(e){let t=k.useRef();return t.current===void 0&&(t.current=e()),t}function js(e){let t=nB(),n=()=>e(t.snapshot());return k.useSyncExternalStore(t.subscribe,n,n)}function coe(e,t,n,o=[]){let a=k.useRef(),i=kp();return s1(()=>{var s;let l=(()=>{var h;for(let p of n){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(h=p.current.textContent)==null?void 0:h.trim():a.current}})(),d=o.map(h=>h.trim());i.value(e,l,d),(s=t.current)==null||s.setAttribute(hh,l),a.current=l}),a}var THe=()=>{let[e,t]=k.useState(),n=fh(()=>new Map);return s1(()=>{n.current.forEach(o=>o()),n.current=new Map},[e]),(o,a)=>{n.current.set(o,a),t({})}};function RHe(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function n$({asChild:e,children:t},n){return e&&k.isValidElement(t)?k.cloneElement(RHe(t),{ref:t.ref},n(t.props.children)):n(t)}var PHe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const xp=k.forwardRef(({className:e,...t},n)=>u.jsx(Po,{ref:n,className:ge("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));xp.displayName=Po.displayName;const $He=({children:e,...t})=>u.jsx(DV,{...t,children:u.jsx(Wt,{className:"overflow-hidden p-0",children:u.jsx(xp,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),wp=k.forwardRef(({className:e,...t},n)=>u.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[u.jsx(dHe,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),u.jsx(Po.Input,{ref:n,className:ge("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));wp.displayName=Po.Input.displayName;const bp=k.forwardRef(({className:e,...t},n)=>u.jsx(Po.List,{ref:n,className:ge("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));bp.displayName=Po.List.displayName;const Mp=k.forwardRef((e,t)=>u.jsx(Po.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));Mp.displayName=Po.Empty.displayName;const hs=k.forwardRef(({className:e,...t},n)=>u.jsx(Po.Group,{ref:n,className:ge("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));hs.displayName=Po.Group.displayName;const DHe=k.forwardRef(({className:e,...t},n)=>u.jsx(Po.Separator,{ref:n,className:ge("-mx-1 h-px bg-border",e),...t}));DHe.displayName=Po.Separator.displayName;const yr=k.forwardRef(({className:e,...t},n)=>u.jsx(Po.Item,{ref:n,className:ge("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground",e),...t}));yr.displayName=Po.Item.displayName;const zHe=()=>{const[e,t]=k.useState(!1),[n,o]=k.useState(""),[a,i]=k.useState({bots:[],users:[],plugins:[]}),[s,l]=k.useState(!1),d=je(M=>M.bots),h=je(M=>M.hasPermission),p=aa();k.useEffect(()=>{const M=b=>{b.key===" "&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),t(C=>!C))};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[]),k.useEffect(()=>{if(e)if(n){l(!0);const M=setTimeout(async()=>{try{const b=await Ne(`/api/search?query=${encodeURIComponent(n)}`);i(b)}catch(b){console.error("Search failed:",b),i({bots:[],users:[],plugins:[]})}finally{l(!1)}},300);return()=>clearTimeout(M)}else l(!1),i({bots:d,users:[],plugins:[]})},[n,e,d]);const m=k.useCallback(M=>{t(!1),M()},[]),v=M=>{var _;const b=((_=a[M])==null?void 0:_.length)||0;return b===0?null:`${{bots:"Боты",users:"Пользователи",plugins:"Плагины"}[M]} (${b})`},x=Object.values(a).some(M=>M.length>0);return u.jsxs($He,{open:e,onOpenChange:t,shouldFilter:!1,children:[u.jsx(en,{className:"sr-only",children:"Глобальный поиск"}),u.jsx(dn,{className:"sr-only",children:"Используйте эту палитру для быстрого поиска по ботам, пользователям и плагинам, а также для навигации по приложению."}),u.jsx(wp,{placeholder:"Искать или перейти к...",value:n,onValueChange:o}),u.jsx(bp,{children:s?u.jsx("div",{className:"p-6 text-center text-sm",children:"Загрузка..."}):u.jsxs(u.Fragment,{children:[!x&&n?u.jsx(Mp,{children:"Ничего не найдено."}):null,!n&&u.jsxs(hs,{heading:"Навигация",children:[u.jsxs(yr,{onSelect:()=>m(()=>p("/")),children:[u.jsx(Ah,{className:"mr-2 h-4 w-4"}),u.jsx("span",{children:"Дашборд"})]}),h("task:list")&&u.jsxs(yr,{onSelect:()=>m(()=>p("/tasks")),children:[u.jsx(Ch,{className:"mr-2 h-4 w-4"}),u.jsx("span",{children:"Планировщик"})]}),h("server:list")&&u.jsxs(yr,{onSelect:()=>m(()=>p("/servers")),children:[u.jsx(Ud,{className:"mr-2 h-4 w-4"}),u.jsx("span",{children:"Серверы"})]})]}),x&&!n&&u.jsx("div",{className:"border-b my-1"}),a.bots.length>0&&u.jsx(hs,{heading:v("bots"),children:a.bots.map(M=>u.jsxs(yr,{value:`bot-${M.username}`,onSelect:()=>m(()=>p(`/bots/${M.id}`)),children:[u.jsx(Hd,{className:"mr-2 h-4 w-4"}),u.jsx("span",{children:M.username}),M.note&&u.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:M.note})]},`bot-${M.id}`))}),a.users.length>0&&u.jsx(hs,{heading:v("users"),children:a.users.map(M=>u.jsxs(yr,{value:`user-${M.username}`,onSelect:()=>m(()=>p(`/bots/${M.botId}/management`)),children:[u.jsx(Wd,{className:"mr-2 h-4 w-4"}),u.jsxs("span",{children:[M.username," (для бота ID: ",M.botId,")"]})]},`user-${M.id}`))}),a.plugins.length>0&&u.jsx(hs,{heading:v("plugins"),children:a.plugins.map(M=>u.jsxs(yr,{value:`plugin-${M.name}`,onSelect:()=>m(()=>p(`/bots/${M.botId}/plugins`)),children:[u.jsx(vs,{className:"mr-2 h-4 w-4"}),u.jsxs("span",{children:[M.name," (установлен у бота ID: ",M.botId,")"]})]},`plugin-${M.id}`))})]})},n)]})};var NO="rovingFocusGroup.onEntryFocus",OHe={bubbles:!1,cancelable:!0},_p="RovingFocusGroup",[hH,loe,qHe]=dp(_p),[HHe,p2]=zn(_p,[qHe]),[VHe,BHe]=HHe(_p),uoe=k.forwardRef((e,t)=>u.jsx(hH.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(hH.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(FHe,{...e,ref:t})})}));uoe.displayName=_p;var FHe=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:a=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:h,preventScrollOnEntryFocus:p=!1,...m}=e,v=k.useRef(null),x=ot(t,v),M=m1(i),[b,C]=go({prop:s,defaultProp:l??null,onChange:d,caller:_p}),[_,N]=k.useState(!1),A=gn(h),I=loe(n),R=k.useRef(!1),[j,D]=k.useState(0);return k.useEffect(()=>{const H=v.current;if(H)return H.addEventListener(NO,A),()=>H.removeEventListener(NO,A)},[A]),u.jsx(VHe,{scope:n,orientation:o,dir:M,loop:a,currentTabStopId:b,onItemFocus:k.useCallback(H=>C(H),[C]),onItemShiftTab:k.useCallback(()=>N(!0),[]),onFocusableItemAdd:k.useCallback(()=>D(H=>H+1),[]),onFocusableItemRemove:k.useCallback(()=>D(H=>H-1),[]),children:u.jsx(Ae.div,{tabIndex:_||j===0?-1:0,"data-orientation":o,...m,ref:x,style:{outline:"none",...e.style},onMouseDown:Me(e.onMouseDown,()=>{R.current=!0}),onFocus:Me(e.onFocus,H=>{const U=!R.current;if(H.target===H.currentTarget&&U&&!_){const z=new CustomEvent(NO,OHe);if(H.currentTarget.dispatchEvent(z),!z.defaultPrevented){const Z=I().filter(P=>P.focusable),q=Z.find(P=>P.active),G=Z.find(P=>P.id===b),O=[q,G,...Z].filter(Boolean).map(P=>P.ref.current);foe(O,p)}}R.current=!1}),onBlur:Me(e.onBlur,()=>N(!1))})})}),doe="RovingFocusGroupItem",hoe=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:a=!1,tabStopId:i,children:s,...l}=e,d=Dn(),h=i||d,p=BHe(doe,n),m=p.currentTabStopId===h,v=loe(n),{onFocusableItemAdd:x,onFocusableItemRemove:M,currentTabStopId:b}=p;return k.useEffect(()=>{if(o)return x(),()=>M()},[o,x,M]),u.jsx(hH.ItemSlot,{scope:n,id:h,focusable:o,active:a,children:u.jsx(Ae.span,{tabIndex:m?0:-1,"data-orientation":p.orientation,...l,ref:t,onMouseDown:Me(e.onMouseDown,C=>{o?p.onItemFocus(h):C.preventDefault()}),onFocus:Me(e.onFocus,()=>p.onItemFocus(h)),onKeyDown:Me(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){p.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const _=XHe(C,p.orientation,p.dir);if(_!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let A=v().filter(I=>I.focusable).map(I=>I.ref.current);if(_==="last")A.reverse();else if(_==="prev"||_==="next"){_==="prev"&&A.reverse();const I=A.indexOf(C.currentTarget);A=p.loop?ZHe(A,I+1):A.slice(I+1)}setTimeout(()=>foe(A))}}),children:typeof s=="function"?s({isCurrentTabStop:m,hasTabStop:b!=null}):s})})});hoe.displayName=doe;var UHe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function GHe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function XHe(e,t,n){const o=GHe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return UHe[o]}function foe(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function ZHe(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var oB=uoe,aB=hoe,fH=["Enter"," "],YHe=["ArrowDown","PageUp","Home"],poe=["ArrowUp","PageDown","End"],WHe=[...YHe,...poe],KHe={ltr:[...fH,"ArrowRight"],rtl:[...fH,"ArrowLeft"]},QHe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Sp="Menu",[O0,JHe,eVe]=dp(Sp),[g1,o$]=zn(Sp,[eVe,Ts,p2]),a$=Ts(),yoe=p2(),[tVe,v1]=g1(Sp),[nVe,Cp]=g1(Sp),moe=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:a,onOpenChange:i,modal:s=!0}=e,l=a$(t),[d,h]=k.useState(null),p=k.useRef(!1),m=gn(i),v=m1(a);return k.useEffect(()=>{const x=()=>{p.current=!0,document.addEventListener("pointerdown",M,{capture:!0,once:!0}),document.addEventListener("pointermove",M,{capture:!0,once:!0})},M=()=>p.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",M,{capture:!0}),document.removeEventListener("pointermove",M,{capture:!0})}},[]),u.jsx(GP,{...l,children:u.jsx(tVe,{scope:t,open:n,onOpenChange:m,content:d,onContentChange:h,children:u.jsx(nVe,{scope:t,onClose:k.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:p,dir:v,modal:s,children:o})})})};moe.displayName=Sp;var oVe="MenuAnchor",rB=k.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,a=a$(n);return u.jsx(vp,{...a,...o,ref:t})});rB.displayName=oVe;var iB="MenuPortal",[aVe,goe]=g1(iB,{forceMount:void 0}),voe=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:a}=e,i=v1(iB,t);return u.jsx(aVe,{scope:t,forceMount:n,children:u.jsx(jn,{present:n||i.open,children:u.jsx(y1,{asChild:!0,container:a,children:o})})})};voe.displayName=iB;var wa="MenuContent",[rVe,sB]=g1(wa),koe=k.forwardRef((e,t)=>{const n=goe(wa,e.__scopeMenu),{forceMount:o=n.forceMount,...a}=e,i=v1(wa,e.__scopeMenu),s=Cp(wa,e.__scopeMenu);return u.jsx(O0.Provider,{scope:e.__scopeMenu,children:u.jsx(jn,{present:o||i.open,children:u.jsx(O0.Slot,{scope:e.__scopeMenu,children:s.modal?u.jsx(iVe,{...a,ref:t}):u.jsx(sVe,{...a,ref:t})})})})}),iVe=k.forwardRef((e,t)=>{const n=v1(wa,e.__scopeMenu),o=k.useRef(null),a=ot(t,o);return k.useEffect(()=>{const i=o.current;if(i)return DP(i)},[]),u.jsx(cB,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Me(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),sVe=k.forwardRef((e,t)=>{const n=v1(wa,e.__scopeMenu);return u.jsx(cB,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),cVe=Cs("MenuContent.ScrollLock"),cB=k.forwardRef((e,t)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEntryFocus:d,onEscapeKeyDown:h,onPointerDownOutside:p,onFocusOutside:m,onInteractOutside:v,onDismiss:x,disableOutsideScroll:M,...b}=e,C=v1(wa,n),_=Cp(wa,n),N=a$(n),A=yoe(n),I=JHe(n),[R,j]=k.useState(null),D=k.useRef(null),H=ot(t,D,C.onContentChange),U=k.useRef(0),z=k.useRef(""),Z=k.useRef(0),q=k.useRef(null),G=k.useRef("right"),E=k.useRef(0),O=M?pp:k.Fragment,P=M?{as:cVe,allowPinchZoom:!0}:void 0,X=V=>{var te,ce;const L=z.current+V,Y=I().filter(me=>!me.disabled),F=document.activeElement,T=(te=Y.find(me=>me.ref.current===F))==null?void 0:te.textValue,K=Y.map(me=>me.textValue),Q=xVe(K,L,T),ne=(ce=Y.find(me=>me.textValue===Q))==null?void 0:ce.ref.current;(function me(ke){z.current=ke,window.clearTimeout(U.current),ke!==""&&(U.current=window.setTimeout(()=>me(""),1e3))})(L),ne&&setTimeout(()=>ne.focus())};k.useEffect(()=>()=>window.clearTimeout(U.current),[]),PP();const W=k.useCallback(V=>{var Y,F;return G.current===((Y=q.current)==null?void 0:Y.side)&&bVe(V,(F=q.current)==null?void 0:F.area)},[]);return u.jsx(rVe,{scope:n,searchRef:z,onItemEnter:k.useCallback(V=>{W(V)&&V.preventDefault()},[W]),onItemLeave:k.useCallback(V=>{var L;W(V)||((L=D.current)==null||L.focus(),j(null))},[W]),onTriggerLeave:k.useCallback(V=>{W(V)&&V.preventDefault()},[W]),pointerGraceTimerRef:Z,onPointerGraceIntentChange:k.useCallback(V=>{q.current=V},[]),children:u.jsx(O,{...P,children:u.jsx(fp,{asChild:!0,trapped:a,onMountAutoFocus:Me(i,V=>{var L;V.preventDefault(),(L=D.current)==null||L.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:u.jsx(p1,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:h,onPointerDownOutside:p,onFocusOutside:m,onInteractOutside:v,onDismiss:x,children:u.jsx(oB,{asChild:!0,...A,dir:_.dir,orientation:"vertical",loop:o,currentTabStopId:R,onCurrentTabStopIdChange:j,onEntryFocus:Me(d,V=>{_.isUsingKeyboardRef.current||V.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(XP,{role:"menu","aria-orientation":"vertical","data-state":Poe(C.open),"data-radix-menu-content":"",dir:_.dir,...N,...b,ref:H,style:{outline:"none",...b.style},onKeyDown:Me(b.onKeyDown,V=>{const Y=V.target.closest("[data-radix-menu-content]")===V.currentTarget,F=V.ctrlKey||V.altKey||V.metaKey,T=V.key.length===1;Y&&(V.key==="Tab"&&V.preventDefault(),!F&&T&&X(V.key));const K=D.current;if(V.target!==K||!WHe.includes(V.key))return;V.preventDefault();const ne=I().filter(te=>!te.disabled).map(te=>te.ref.current);poe.includes(V.key)&&ne.reverse(),vVe(ne)}),onBlur:Me(e.onBlur,V=>{V.currentTarget.contains(V.target)||(window.clearTimeout(U.current),z.current="")}),onPointerMove:Me(e.onPointerMove,q0(V=>{const L=V.target,Y=E.current!==V.clientX;if(V.currentTarget.contains(L)&&Y){const F=V.clientX>E.current?"right":"left";G.current=F,E.current=V.clientX}}))})})})})})})});koe.displayName=wa;var lVe="MenuGroup",lB=k.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(Ae.div,{role:"group",...o,ref:t})});lB.displayName=lVe;var uVe="MenuLabel",xoe=k.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(Ae.div,{...o,ref:t})});xoe.displayName=uVe;var eP="MenuItem",nW="menu.itemSelect",r$=k.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:o,...a}=e,i=k.useRef(null),s=Cp(eP,e.__scopeMenu),l=sB(eP,e.__scopeMenu),d=ot(t,i),h=k.useRef(!1),p=()=>{const m=i.current;if(!n&&m){const v=new CustomEvent(nW,{bubbles:!0,cancelable:!0});m.addEventListener(nW,x=>o==null?void 0:o(x),{once:!0}),IV(m,v),v.defaultPrevented?h.current=!1:s.onClose()}};return u.jsx(woe,{...a,ref:d,disabled:n,onClick:Me(e.onClick,p),onPointerDown:m=>{var v;(v=e.onPointerDown)==null||v.call(e,m),h.current=!0},onPointerUp:Me(e.onPointerUp,m=>{var v;h.current||(v=m.currentTarget)==null||v.click()}),onKeyDown:Me(e.onKeyDown,m=>{const v=l.searchRef.current!=="";n||v&&m.key===" "||fH.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});r$.displayName=eP;var woe=k.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:a,...i}=e,s=sB(eP,n),l=yoe(n),d=k.useRef(null),h=ot(t,d),[p,m]=k.useState(!1),[v,x]=k.useState("");return k.useEffect(()=>{const M=d.current;M&&x((M.textContent??"").trim())},[i.children]),u.jsx(O0.ItemSlot,{scope:n,disabled:o,textValue:a??v,children:u.jsx(aB,{asChild:!0,...l,focusable:!o,children:u.jsx(Ae.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...i,ref:h,onPointerMove:Me(e.onPointerMove,q0(M=>{o?s.onItemLeave(M):(s.onItemEnter(M),M.defaultPrevented||M.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Me(e.onPointerLeave,q0(M=>s.onItemLeave(M))),onFocus:Me(e.onFocus,()=>m(!0)),onBlur:Me(e.onBlur,()=>m(!1))})})})}),dVe="MenuCheckboxItem",boe=k.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:o,...a}=e;return u.jsx(Noe,{scope:e.__scopeMenu,checked:n,children:u.jsx(r$,{role:"menuitemcheckbox","aria-checked":tP(n)?"mixed":n,...a,ref:t,"data-state":dB(n),onSelect:Me(a.onSelect,()=>o==null?void 0:o(tP(n)?!0:!n),{checkForDefaultPrevented:!1})})})});boe.displayName=dVe;var Moe="MenuRadioGroup",[hVe,fVe]=g1(Moe,{value:void 0,onValueChange:()=>{}}),_oe=k.forwardRef((e,t)=>{const{value:n,onValueChange:o,...a}=e,i=gn(o);return u.jsx(hVe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:u.jsx(lB,{...a,ref:t})})});_oe.displayName=Moe;var Soe="MenuRadioItem",Coe=k.forwardRef((e,t)=>{const{value:n,...o}=e,a=fVe(Soe,e.__scopeMenu),i=n===a.value;return u.jsx(Noe,{scope:e.__scopeMenu,checked:i,children:u.jsx(r$,{role:"menuitemradio","aria-checked":i,...o,ref:t,"data-state":dB(i),onSelect:Me(o.onSelect,()=>{var s;return(s=a.onValueChange)==null?void 0:s.call(a,n)},{checkForDefaultPrevented:!1})})})});Coe.displayName=Soe;var uB="MenuItemIndicator",[Noe,pVe]=g1(uB,{checked:!1}),Loe=k.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:o,...a}=e,i=pVe(uB,n);return u.jsx(jn,{present:o||tP(i.checked)||i.checked===!0,children:u.jsx(Ae.span,{...a,ref:t,"data-state":dB(i.checked)})})});Loe.displayName=uB;var yVe="MenuSeparator",joe=k.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(Ae.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});joe.displayName=yVe;var mVe="MenuArrow",Aoe=k.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,a=a$(n);return u.jsx(ZP,{...a,...o,ref:t})});Aoe.displayName=mVe;var gVe="MenuSub",[zqt,Eoe]=g1(gVe),zf="MenuSubTrigger",Ioe=k.forwardRef((e,t)=>{const n=v1(zf,e.__scopeMenu),o=Cp(zf,e.__scopeMenu),a=Eoe(zf,e.__scopeMenu),i=sB(zf,e.__scopeMenu),s=k.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:d}=i,h={__scopeMenu:e.__scopeMenu},p=k.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return k.useEffect(()=>p,[p]),k.useEffect(()=>{const m=l.current;return()=>{window.clearTimeout(m),d(null)}},[l,d]),u.jsx(rB,{asChild:!0,...h,children:u.jsx(woe,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":Poe(n.open),...e,ref:ui(t,a.onTriggerChange),onClick:m=>{var v;(v=e.onClick)==null||v.call(e,m),!(e.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Me(e.onPointerMove,q0(m=>{i.onItemEnter(m),!m.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),p()},100))})),onPointerLeave:Me(e.onPointerLeave,q0(m=>{var x,M;p();const v=(x=n.content)==null?void 0:x.getBoundingClientRect();if(v){const b=(M=n.content)==null?void 0:M.dataset.side,C=b==="right",_=C?-5:5,N=v[C?"left":"right"],A=v[C?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+_,y:m.clientY},{x:N,y:v.top},{x:A,y:v.top},{x:A,y:v.bottom},{x:N,y:v.bottom}],side:b}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Me(e.onKeyDown,m=>{var x;const v=i.searchRef.current!=="";e.disabled||v&&m.key===" "||KHe[o.dir].includes(m.key)&&(n.onOpenChange(!0),(x=n.content)==null||x.focus(),m.preventDefault())})})})});Ioe.displayName=zf;var Toe="MenuSubContent",Roe=k.forwardRef((e,t)=>{const n=goe(wa,e.__scopeMenu),{forceMount:o=n.forceMount,...a}=e,i=v1(wa,e.__scopeMenu),s=Cp(wa,e.__scopeMenu),l=Eoe(Toe,e.__scopeMenu),d=k.useRef(null),h=ot(t,d);return u.jsx(O0.Provider,{scope:e.__scopeMenu,children:u.jsx(jn,{present:o||i.open,children:u.jsx(O0.Slot,{scope:e.__scopeMenu,children:u.jsx(cB,{id:l.contentId,"aria-labelledby":l.triggerId,...a,ref:h,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{var m;s.isUsingKeyboardRef.current&&((m=d.current)==null||m.focus()),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:Me(e.onFocusOutside,p=>{p.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Me(e.onEscapeKeyDown,p=>{s.onClose(),p.preventDefault()}),onKeyDown:Me(e.onKeyDown,p=>{var x;const m=p.currentTarget.contains(p.target),v=QHe[s.dir].includes(p.key);m&&v&&(i.onOpenChange(!1),(x=l.trigger)==null||x.focus(),p.preventDefault())})})})})})});Roe.displayName=Toe;function Poe(e){return e?"open":"closed"}function tP(e){return e==="indeterminate"}function dB(e){return tP(e)?"indeterminate":e?"checked":"unchecked"}function vVe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function kVe(e,t){return e.map((n,o)=>e[(t+o)%e.length])}function xVe(e,t,n){const a=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=kVe(e,Math.max(i,0));a.length===1&&(s=s.filter(h=>h!==n));const d=s.find(h=>h.toLowerCase().startsWith(a.toLowerCase()));return d!==n?d:void 0}function wVe(e,t){const{x:n,y:o}=e;let a=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const l=t[i],d=t[s],h=l.x,p=l.y,m=d.x,v=d.y;p>o!=v>o&&n<(m-h)*(o-p)/(v-p)+h&&(a=!a)}return a}function bVe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return wVe(n,t)}function q0(e){return t=>t.pointerType==="mouse"?e(t):void 0}var $oe=moe,Doe=rB,zoe=voe,Ooe=koe,qoe=lB,Hoe=xoe,Voe=r$,Boe=boe,Foe=_oe,Uoe=Coe,Goe=Loe,Xoe=joe,Zoe=Aoe,Yoe=Ioe,Woe=Roe,i$="DropdownMenu",[MVe,Oqt]=zn(i$,[o$]),vo=o$(),[_Ve,Koe]=MVe(i$),Qoe=e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:a,defaultOpen:i,onOpenChange:s,modal:l=!0}=e,d=vo(t),h=k.useRef(null),[p,m]=go({prop:a,defaultProp:i??!1,onChange:s,caller:i$});return u.jsx(_Ve,{scope:t,triggerId:Dn(),triggerRef:h,contentId:Dn(),open:p,onOpenChange:m,onOpenToggle:k.useCallback(()=>m(v=>!v),[m]),modal:l,children:u.jsx($oe,{...d,open:p,onOpenChange:m,dir:o,modal:l,children:n})})};Qoe.displayName=i$;var Joe="DropdownMenuTrigger",eae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...a}=e,i=Koe(Joe,n),s=vo(n);return u.jsx(Doe,{asChild:!0,...s,children:u.jsx(Ae.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...a,ref:ui(t,i.triggerRef),onPointerDown:Me(e.onPointerDown,l=>{!o&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:Me(e.onKeyDown,l=>{o||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});eae.displayName=Joe;var SVe="DropdownMenuPortal",tae=e=>{const{__scopeDropdownMenu:t,...n}=e,o=vo(t);return u.jsx(zoe,{...o,...n})};tae.displayName=SVe;var nae="DropdownMenuContent",oae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=Koe(nae,n),i=vo(n),s=k.useRef(!1);return u.jsx(Ooe,{id:a.contentId,"aria-labelledby":a.triggerId,...i,...o,ref:t,onCloseAutoFocus:Me(e.onCloseAutoFocus,l=>{var d;s.current||(d=a.triggerRef.current)==null||d.focus(),s.current=!1,l.preventDefault()}),onInteractOutside:Me(e.onInteractOutside,l=>{const d=l.detail.originalEvent,h=d.button===0&&d.ctrlKey===!0,p=d.button===2||h;(!a.modal||p)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});oae.displayName=nae;var CVe="DropdownMenuGroup",NVe=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(qoe,{...a,...o,ref:t})});NVe.displayName=CVe;var LVe="DropdownMenuLabel",aae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Hoe,{...a,...o,ref:t})});aae.displayName=LVe;var jVe="DropdownMenuItem",rae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Voe,{...a,...o,ref:t})});rae.displayName=jVe;var AVe="DropdownMenuCheckboxItem",iae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Boe,{...a,...o,ref:t})});iae.displayName=AVe;var EVe="DropdownMenuRadioGroup",IVe=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Foe,{...a,...o,ref:t})});IVe.displayName=EVe;var TVe="DropdownMenuRadioItem",sae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Uoe,{...a,...o,ref:t})});sae.displayName=TVe;var RVe="DropdownMenuItemIndicator",cae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Goe,{...a,...o,ref:t})});cae.displayName=RVe;var PVe="DropdownMenuSeparator",lae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Xoe,{...a,...o,ref:t})});lae.displayName=PVe;var $Ve="DropdownMenuArrow",DVe=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Zoe,{...a,...o,ref:t})});DVe.displayName=$Ve;var zVe="DropdownMenuSubTrigger",uae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Yoe,{...a,...o,ref:t})});uae.displayName=zVe;var OVe="DropdownMenuSubContent",dae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Woe,{...a,...o,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});dae.displayName=OVe;var qVe=Qoe,HVe=eae,VVe=tae,hae=oae,fae=aae,pae=rae,yae=iae,mae=sae,gae=cae,vae=lae,kae=uae,xae=dae;const hB=qVe,fB=HVe,BVe=k.forwardRef(({className:e,inset:t,children:n,...o},a)=>u.jsxs(kae,{ref:a,className:ge("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...o,children:[n,u.jsx(Sh,{className:"ml-auto"})]}));BVe.displayName=kae.displayName;const FVe=k.forwardRef(({className:e,...t},n)=>u.jsx(xae,{ref:n,className:ge("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t}));FVe.displayName=xae.displayName;const s$=k.forwardRef(({className:e,sideOffset:t=4,...n},o)=>u.jsx(VVe,{children:u.jsx(hae,{ref:o,sideOffset:t,className:ge("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n})}));s$.displayName=hae.displayName;const ka=k.forwardRef(({className:e,inset:t,...n},o)=>u.jsx(pae,{ref:o,className:ge("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...n}));ka.displayName=pae.displayName;const UVe=k.forwardRef(({className:e,children:t,checked:n,...o},a)=>u.jsxs(yae,{ref:a,className:ge("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...o,children:[u.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:u.jsx(gae,{children:u.jsx(ri,{className:"h-4 w-4"})})}),t]}));UVe.displayName=yae.displayName;const GVe=k.forwardRef(({className:e,children:t,...n},o)=>u.jsxs(mae,{ref:o,className:ge("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[u.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:u.jsx(gae,{children:u.jsx(Bd,{className:"h-2 w-2 fill-current"})})}),t]}));GVe.displayName=mae.displayName;const XVe=k.forwardRef(({className:e,inset:t,...n},o)=>u.jsx(fae,{ref:o,className:ge("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));XVe.displayName=fae.displayName;const ZVe=k.forwardRef(({className:e,...t},n)=>u.jsx(vae,{ref:n,className:ge("-mx-1 my-1 h-px bg-muted",e),...t}));ZVe.displayName=vae.displayName;function YVe({isCollapsed:e}){const t=je(n=>n.setTheme);return u.jsxs(hB,{children:[u.jsx(fB,{asChild:!0,children:u.jsxs(pe,{variant:"ghost",size:e?"icon":"default",className:"w-full justify-start",children:[u.jsx(x0,{className:"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),u.jsx(h0,{className:"absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),u.jsx("span",{className:ge("ml-2",e&&"hidden"),children:"Тема"})]})}),u.jsxs(s$,{align:"end",children:[u.jsx(ka,{onClick:()=>t("light"),children:"Светлая"}),u.jsx(ka,{onClick:()=>t("dark"),children:"Тёмная"}),u.jsx(ka,{onClick:()=>t("system"),children:"Системная"})]})]})}const WVe=({onLinkClick:e,isCollapsed:t})=>{const n=je(l=>l.bots),o=je(l=>l.botStatuses),a=je(l=>l.hasPermission),i=({isActive:l})=>ge("flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium hover:bg-accent transition-colors",l?"bg-accent":"transparent",t&&"justify-center"),s=(l,d)=>u.jsxs(u.Fragment,{children:[l,u.jsx("span",{className:ge("truncate",t&&"hidden"),children:d})]});return u.jsxs("nav",{className:"flex-grow flex flex-col gap-1 overflow-y-auto pr-2",children:[u.jsx(Oa,{to:"/",end:!0,onClick:e,className:i,children:s(u.jsx(Ah,{className:"h-4 w-4 flex-shrink-0"}),"Дашборд")}),a("task:list")&&u.jsx(Oa,{to:"/tasks",onClick:e,className:i,children:s(u.jsx(Ch,{className:"h-4 w-4 flex-shrink-0"}),"Планировщик")}),u.jsx(Gh,{className:"my-2"}),!t&&u.jsx("p",{className:"px-3 py-1 text-xs font-semibold text-muted-foreground",children:"БОТЫ"}),n.map(l=>u.jsxs(Oa,{to:`/bots/${l.id}`,onClick:e,className:({isActive:d})=>ge("flex items-center gap-3 rounded-md px-3 py-2 text-sm hover:bg-accent",d?"bg-accent":"transparent",t&&"justify-center"),children:[u.jsx("span",{className:ge("w-2 h-2 rounded-full flex-shrink-0",o[l.id]==="running"?"bg-green-500 animate-pulse":"bg-gray-600")}),u.jsxs("div",{className:ge("flex flex-col overflow-hidden",t&&"hidden"),children:[u.jsx("span",{className:"font-medium truncate",children:l.username}),u.jsx("span",{className:"text-xs text-muted-foreground truncate",children:l.note||`${l.server.host}:${l.server.port}`})]})]},l.id))]})};function KVe(){const e=aa(),t=Er(),{toast:n}=Yt(),o=je(z=>z.user),a=je(z=>z.appVersion),i=je(z=>z.servers),s=je(z=>z.logout),l=je(z=>z.createBot),d=je(z=>z.fetchInitialData),h=je(z=>z.hasPermission),p=je(z=>z.theme),m=je(z=>z.setTheme),[v,x]=k.useState(!1),[M,b]=k.useState(!1),[C,_]=k.useState(!1),[N,A]=k.useState(!1),[I,R]=k.useState(()=>JSON.parse(localStorage.getItem("sidebar-collapsed"))||!1);k.useEffect(()=>{m(p)},[p,m]),k.useEffect(()=>{var z,Z;(z=t.state)!=null&&z.openCreateBotModal&&(x(!0),e(t.pathname,{replace:!0,state:{}})),(Z=t.state)!=null&&Z.openImportBotModal&&(b(!0),e(t.pathname,{replace:!0,state:{}}))},[t.state,e]),k.useEffect(()=>{localStorage.setItem("sidebar-collapsed",JSON.stringify(I))},[I]);const j=async z=>{A(!0);try{const Z=await l(z);Z&&(x(!1),_(!1),e(`/bots/${Z.id}`))}catch(Z){console.error("Не удалось создать бота:",Z)}finally{A(!1)}},D=z=>{b(!1),_(!1),d(),n({title:"Успех!",description:`Бот "${z.username}" успешно импортирован.`}),e(`/bots/${z.id}`)},H=()=>{_(!1),s()},U=z=>u.jsxs("div",{className:"flex flex-col h-full p-2",children:[u.jsxs("div",{className:ge("p-2 mb-2 flex items-center",z?"justify-center":"justify-between"),children:[u.jsxs("div",{className:ge(z&&"hidden"),children:[u.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:"BlockMine"}),u.jsxs("p",{className:"text-sm text-muted-foreground",children:["Пользователь: ",o==null?void 0:o.username]})]}),u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>R(!I),className:"hidden md:flex",children:I?u.jsx(Qf,{className:"h-5 w-5"}):u.jsx(Kf,{className:"h-5 w-5"})})]}),u.jsx(WVe,{onLinkClick:()=>_(!1),isCollapsed:z}),u.jsxs("div",{className:"mt-auto pt-2 border-t",children:[h("panel:user:list")&&u.jsxs(Oa,{to:"/admin",onClick:()=>_(!1),className:({isActive:Z})=>ge("flex items-center gap-2 rounded-md px-3 py-2 text-sm font-medium hover:bg-accent",Z?"bg-accent":"transparent",z&&"justify-center"),children:[u.jsx(Zd,{className:"h-4 w-4 flex-shrink-0"}),u.jsx("span",{className:ge(z&&"hidden"),children:"Администрирование"})]}),h("server:list")&&u.jsxs(Oa,{to:"/servers",onClick:()=>_(!1),className:({isActive:Z})=>ge("flex items-center gap-2 rounded-md px-3 py-2 text-sm font-medium hover:bg-accent",Z?"bg-accent":"transparent",z&&"justify-center"),children:[u.jsx(Ud,{className:"h-4 w-4 flex-shrink-0"}),u.jsx("span",{className:ge(z&&"hidden"),children:"Серверы"})]}),u.jsxs("div",{className:ge("flex flex-col gap-2 mt-2",z?"px-1":"px-3"),children:[h("bot:create")&&u.jsxs(Jt,{open:v,onOpenChange:x,children:[u.jsx(Ua,{asChild:!0,children:u.jsxs(pe,{variant:"outline",className:"w-full",size:z?"icon":"default",children:[u.jsx(za,{className:ge(!z&&"mr-2","h-4 w-4")}),!z&&"Создать бота"]})}),u.jsx(Wt,{className:"h-[90vh] flex flex-col",children:u.jsx(eoe,{servers:i,onFormSubmit:j,isSaving:N,isCreation:!0})})]}),h("bot:import")&&u.jsxs(Jt,{open:M,onOpenChange:b,children:[u.jsx(Ua,{asChild:!0,children:u.jsxs(pe,{variant:"outline",className:"w-full",size:z?"icon":"default",children:[u.jsx(wr,{className:ge(!z&&"mr-2","h-4 w-4")}),!z&&"Импорт бота"]})}),u.jsx($te,{onImportSuccess:D,onCancel:()=>b(!1)})]})]}),u.jsx(Gh,{className:"my-2"}),u.jsx(YVe,{isCollapsed:z}),u.jsxs(pe,{variant:"ghost",className:ge("w-full justify-start px-3",z&&"justify-center"),onClick:H,children:[u.jsx(c0,{className:ge(!z&&"mr-2","h-4 w-4")}),!z&&"Выйти"]}),u.jsx("div",{className:ge("mt-2 pt-2 border-t text-center text-xs text-muted-foreground",z&&"hidden"),children:u.jsxs("a",{href:"https://github.com/blockmineJS/blockmine",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 hover:text-foreground transition-colors",children:[u.jsx(ms,{className:"h-4 w-4"}),u.jsxs("span",{children:["BlockMine v",a]})]})})]})]});return u.jsxs("div",{className:ge("grid h-screen transition-[grid-template-columns] duration-300 ease-in-out",I?"md:grid-cols-[80px_1fr]":"md:grid-cols-[280px_1fr]"),children:[u.jsx(zHe,{}),u.jsxs("header",{className:"md:hidden flex items-center justify-between p-2 border-b",children:[u.jsx("h2",{className:"text-lg font-semibold tracking-tight ml-2",children:"BlockMine"}),u.jsxs(oOe,{open:C,onOpenChange:_,children:[u.jsx(aOe,{asChild:!0,children:u.jsx(pe,{variant:"ghost",size:"icon",children:u.jsx(l0,{className:"h-6 w-6"})})}),u.jsx(jte,{side:"left",className:"p-0 w-full max-w-xs flex",children:U(!1)})]})]}),u.jsx("aside",{className:"hidden md:block border-r",children:U(I)}),u.jsx("main",{className:"overflow-y-auto",children:u.jsx(bV,{})})]})}function QVe(){const e=je(v=>v.login),t=je(v=>v.isAuthenticated),n=aa(),[o,a]=k.useState(""),[i,s]=k.useState(""),[l,d]=k.useState(!1),[h,p]=k.useState("");k.useEffect(()=>{t&&n("/",{replace:!0})},[t,n]);const m=async v=>{v.preventDefault(),d(!0),p("");try{await e(o,i)}catch(x){p(x.message||"Не удалось войти.")}finally{d(!1)}};return u.jsx("div",{className:"flex items-center justify-center min-h-screen bg-background",children:u.jsxs(Nn,{className:"w-full max-w-sm",children:[u.jsxs(kn,{children:[u.jsx(xn,{className:"text-2xl",children:"Вход в BlockMine"}),u.jsx(Qn,{children:"Введите ваши учетные данные для доступа к панели."})]}),u.jsxs("form",{onSubmit:m,children:[u.jsxs(Ln,{className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"username",children:"Имя пользователя"}),u.jsx(Ze,{id:"username",value:o,onChange:v=>a(v.target.value),required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"password",children:"Пароль"}),u.jsx(Ze,{id:"password",type:"password",value:i,onChange:v=>s(v.target.value),required:!0,autoComplete:"current-password"})]}),h&&u.jsx("p",{className:"text-sm text-destructive",children:h})]}),u.jsx(JP,{children:u.jsxs(pe,{type:"submit",className:"w-full",disabled:l,children:[l&&u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}),"Войти"]})})]})]})})}function JVe(){const e=je(M=>M.setupAdmin),t=je(M=>M.isAuthenticated),n=aa(),[o,a]=k.useState(""),[i,s]=k.useState(""),[l,d]=k.useState(""),[h,p]=k.useState(!1),[m,v]=k.useState("");k.useEffect(()=>{t&&n("/",{replace:!0})},[t,n]);const x=async M=>{if(M.preventDefault(),i.length<4){v("Пароль должен содержать не менее 4 символов.");return}if(i!==l){v("Пароли не совпадают.");return}p(!0),v("");try{await e(o,i),Gt({title:"Добро пожаловать!",description:"Вы успешно вошли в систему."})}catch(b){v(b.message||"Не удалось создать аккаунт.")}finally{p(!1)}};return u.jsx("div",{className:"flex items-center justify-center min-h-screen bg-background",children:u.jsxs(Nn,{className:"w-full max-w-sm",children:[u.jsxs(kn,{children:[u.jsx(xn,{className:"text-2xl",children:"Первоначальная настройка"}),u.jsx(Qn,{children:"Создайте аккаунт администратора для панели BlockMine."})]}),u.jsxs("form",{onSubmit:x,children:[u.jsxs(Ln,{className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"username",children:"Имя администратора"}),u.jsx(Ze,{id:"username",value:o,onChange:M=>a(M.target.value),required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"password",children:"Пароль (мин. 4 символа)"}),u.jsx(Ze,{id:"password",type:"password",value:i,onChange:M=>s(M.target.value),required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"confirmPassword",children:"Подтвердите пароль"}),u.jsx(Ze,{id:"confirmPassword",type:"password",value:l,onChange:M=>d(M.target.value),required:!0})]}),m&&u.jsx("p",{className:"text-sm text-destructive",children:m})]}),u.jsx(JP,{children:u.jsxs(pe,{type:"submit",className:"w-full",disabled:h,children:[h&&u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}),"Создать"]})})]})]})})}function LO({title:e,value:t,icon:n,description:o,className:a}){return u.jsxs(Nn,{className:ge("hover:border-primary/50 transition-colors",a),children:[u.jsxs(kn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[u.jsx(xn,{className:"text-sm font-medium",children:e}),n&&u.jsx(n,{className:"h-4 w-4 text-muted-foreground"})]}),u.jsxs(Ln,{children:[u.jsx("div",{className:"text-2xl font-bold",children:t}),o&&u.jsx("p",{className:"text-xs text-muted-foreground",children:o})]})]})}const Ca=k.forwardRef(({className:e,...t},n)=>u.jsx("div",{className:"relative w-full overflow-auto",children:u.jsx("table",{ref:n,className:ge("w-full caption-bottom text-sm",e),...t})}));Ca.displayName="Table";const Na=k.forwardRef(({className:e,...t},n)=>u.jsx("thead",{ref:n,className:ge("[&_tr]:border-b",e),...t}));Na.displayName="TableHeader";const La=k.forwardRef(({className:e,...t},n)=>u.jsx("tbody",{ref:n,className:ge("[&_tr:last-child]:border-0",e),...t}));La.displayName="TableBody";const eBe=k.forwardRef(({className:e,...t},n)=>u.jsx("tfoot",{ref:n,className:ge("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));eBe.displayName="TableFooter";const Nt=k.forwardRef(({className:e,...t},n)=>u.jsx("tr",{ref:n,className:ge("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Nt.displayName="TableRow";const st=k.forwardRef(({className:e,...t},n)=>u.jsx("th",{ref:n,className:ge("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));st.displayName="TableHead";const Xe=k.forwardRef(({className:e,...t},n)=>u.jsx("td",{ref:n,className:ge("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Xe.displayName="TableCell";const tBe=k.forwardRef(({className:e,...t},n)=>u.jsx("caption",{ref:n,className:ge("mt-4 text-sm text-muted-foreground",e),...t}));tBe.displayName="TableCaption";function nBe({bots:e,botStatuses:t}){const{toast:n}=Yt(),o=aa(),a=async(i,s)=>{if(s==="restart"){try{await Ne(`/api/bots/${i.id}/stop`,{method:"POST"}),setTimeout(async()=>{await Ne(`/api/bots/${i.id}/start`,{method:"POST"}),n({title:"Команда отправлена",description:`Бот ${i.username} перезапускается.`})},2e3)}catch{}return}try{await Ne(`/api/bots/${i.id}/${s}`,{method:"POST"},`Команда ${s} отправлена боту.`)}catch{}};return u.jsxs(Nn,{className:"h-full flex flex-col",children:[u.jsxs(kn,{children:[u.jsx(xn,{children:"Все боты"}),u.jsx(Qn,{children:"Быстрое управление состоянием всех ботов в системе."})]}),u.jsx(Ln,{className:"flex-grow overflow-hidden",children:u.jsx("div",{className:"border rounded-lg h-full overflow-y-auto",children:u.jsxs(Ca,{children:[u.jsx(Na,{children:u.jsxs(Nt,{children:[u.jsx(st,{children:"Бот"}),u.jsx(st,{children:"Статус"}),u.jsx(st,{className:"text-right",children:"Действия"})]})}),u.jsx(La,{children:e.map(i=>{const s=t[i.id]||"stopped",l=s==="running";return u.jsxs(Nt,{children:[u.jsx(Xe,{className:"font-medium",children:i.username}),u.jsx(Xe,{children:u.jsx("span",{className:`px-2 py-1 text-xs rounded-md ${l?"bg-green-900 text-green-400":"bg-red-900 text-red-400"}`,children:s})}),u.jsx(Xe,{className:"text-right",children:u.jsxs(hB,{children:[u.jsx(fB,{asChild:!0,children:u.jsx(pe,{variant:"ghost",size:"icon",children:u.jsx(Qi,{className:"h-4 w-4"})})}),u.jsxs(s$,{align:"end",children:[u.jsxs(ka,{disabled:l,onClick:()=>a(i,"start"),children:[u.jsx(gs,{className:"mr-2"}),"Запустить"]}),u.jsxs(ka,{disabled:!l,onClick:()=>a(i,"stop"),className:"text-destructive",children:[u.jsx(ks,{className:"mr-2"}),"Остановить"]}),u.jsxs(ka,{disabled:!l,onClick:()=>a(i,"restart"),children:[u.jsx(Ih,{className:"mr-2"}),"Перезапустить"]}),u.jsxs(ka,{onClick:()=>o(`/bots/${i.id}/console`),children:[u.jsx(Yd,{className:"mr-2"}),"Консоль"]}),u.jsxs(ka,{onClick:()=>o(`/bots/${i.id}/settings`),children:[u.jsx(Gd,{className:"mr-2"}),"Настройки"]})]})]})})]},i.id)})})]})})})]})}const oBe=r2("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Xt({className:e,variant:t,...n}){return u.jsx("div",{className:ge(oBe({variant:t}),e),...n})}const oW=({value:e,max:t,colorClass:n})=>{const o=Math.min(100,e/t*100);return u.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:u.jsx("div",{className:`${n} h-2 rounded-full`,style:{width:`${o}%`}})})};function aBe({bots:e,resourceUsage:t}){const n=e.filter(o=>t[o.id]);return u.jsxs(Nn,{className:"h-full flex flex-col",children:[u.jsxs(kn,{children:[u.jsx(xn,{children:"Использование ресурсов"}),u.jsx(Qn,{children:"Нагрузка на CPU и использование RAM запущенными ботами."})]}),u.jsx(Ln,{className:"flex-grow overflow-y-auto",children:u.jsx("div",{className:"space-y-6",children:n.length>0?n.map(o=>{const a=t[o.id];return u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-2",children:[u.jsx("h4",{className:"font-semibold",children:o.username}),u.jsxs(Xt,{variant:"secondary",children:["ID: ",o.id]})]}),u.jsxs("div",{className:"space-y-3",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(e0,{className:"h-4 w-4 text-muted-foreground"}),u.jsx("div",{className:"flex-grow",children:u.jsx(oW,{value:a.cpu,max:100,colorClass:"bg-blue-500"})}),u.jsxs("span",{className:"text-sm font-mono w-16 text-right",children:[a.cpu.toFixed(1),"%"]})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(u0,{className:"h-4 w-4 text-muted-foreground"}),u.jsx("div",{className:"flex-grow",children:u.jsx(oW,{value:a.memory,max:500,colorClass:"bg-green-500"})}),u.jsxs("span",{className:"text-sm font-mono w-16 text-right",children:[a.memory.toFixed(1)," MB"]})]})]})]},o.id)}):u.jsx("p",{className:"text-sm text-muted-foreground text-center pt-8",children:"Нет запущенных ботов для мониторинга."})})})]})}function rBe(){const e=je(M=>M.bots),t=je(M=>M.botStatuses),n=je(M=>M.resourceUsage),o=je(M=>M.fetchInitialData),a=je(M=>M.startAllBots),i=je(M=>M.stopAllBots),s=je(M=>M.hasPermission),{toast:l}=Yt(),d=aa(),[h,p]=k.useState(!1),m=k.useMemo(()=>{const M=e.filter(b=>t[b.id]==="running").length;return{totalBots:e.length,runningBots:M,stoppedBots:e.length-M}},[e,t]),v=async M=>{const b=M==="start"?"запустить":"остановить";window.confirm(`Вы уверены, что хотите ${b} ВСЕХ ботов?`)&&(M==="start"?await a():await i())},x=M=>{p(!1),o(),l({title:"Успех!",description:`Бот "${M.username}" успешно импортирован.`}),d(`/bots/${M.id}`)};return u.jsxs("div",{className:"flex flex-col h-full w-full p-4 gap-4 overflow-y-auto",children:[u.jsxs("header",{className:"flex flex-col md:flex-row items-start md:items-center justify-between shrink-0 gap-4",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-3xl font-bold",children:"Дашборд"}),u.jsx("p",{className:"text-muted-foreground",children:"Общая сводка по вашей системе."})]}),u.jsxs("div",{className:"flex gap-2",children:[s("bot:import")&&u.jsxs(Jt,{open:h,onOpenChange:p,children:[u.jsx(Ua,{asChild:!0,children:u.jsxs(pe,{variant:"outline",children:[u.jsx(wr,{className:"mr-2"}),"Импорт"]})}),u.jsx($te,{onImportSuccess:x,onCancel:()=>p(!1)})]}),s("bot:start_stop")&&u.jsxs(u.Fragment,{children:[u.jsxs(pe,{onClick:()=>v("start"),children:[u.jsx(gs,{className:"mr-2"}),"Запустить всех"]}),u.jsxs(pe,{variant:"destructive",onClick:()=>v("stop"),children:[u.jsx(ks,{className:"mr-2"}),"Остановить всех"]})]})]})]}),u.jsxs("main",{className:"grid gap-4 lg:grid-cols-3 flex-grow",children:[u.jsxs("div",{className:"lg:col-span-1 space-y-4",children:[u.jsx(LO,{title:"Всего ботов",value:m.totalBots,icon:Hd}),u.jsx(LO,{title:"Запущено",value:m.runningBots,icon:gs,className:"hover:border-green-500"}),u.jsx(LO,{title:"Остановлено",value:m.stoppedBots,icon:ks,className:"hover:border-red-500"})]}),u.jsx("div",{className:"lg:col-span-1 min-h-[400px]",children:u.jsx(nBe,{bots:e,botStatuses:t})}),u.jsx("div",{className:"lg:col-span-1 min-h-[400px]",children:u.jsx(aBe,{bots:e,resourceUsage:n})})]})]})}var c$="Checkbox",[iBe,qqt]=zn(c$),[sBe,pB]=iBe(c$);function cBe(e){const{__scopeCheckbox:t,checked:n,children:o,defaultChecked:a,disabled:i,form:s,name:l,onCheckedChange:d,required:h,value:p="on",internal_do_not_use_render:m}=e,[v,x]=go({prop:n,defaultProp:a??!1,onChange:d,caller:c$}),[M,b]=k.useState(null),[C,_]=k.useState(null),N=k.useRef(!1),A=M?!!s||!!M.closest("form"):!0,I={checked:v,disabled:i,setChecked:x,control:M,setControl:b,name:l,form:s,value:p,hasConsumerStoppedPropagationRef:N,required:h,defaultChecked:ws(a)?!1:a,isFormControl:A,bubbleInput:C,setBubbleInput:_};return u.jsx(sBe,{scope:t,...I,children:lBe(m)?m(I):o})}var wae="CheckboxTrigger",bae=k.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...o},a)=>{const{control:i,value:s,disabled:l,checked:d,required:h,setControl:p,setChecked:m,hasConsumerStoppedPropagationRef:v,isFormControl:x,bubbleInput:M}=pB(wae,e),b=ot(a,p),C=k.useRef(d);return k.useEffect(()=>{const _=i==null?void 0:i.form;if(_){const N=()=>m(C.current);return _.addEventListener("reset",N),()=>_.removeEventListener("reset",N)}},[i,m]),u.jsx(Ae.button,{type:"button",role:"checkbox","aria-checked":ws(d)?"mixed":d,"aria-required":h,"data-state":Nae(d),"data-disabled":l?"":void 0,disabled:l,value:s,...o,ref:b,onKeyDown:Me(t,_=>{_.key==="Enter"&&_.preventDefault()}),onClick:Me(n,_=>{m(N=>ws(N)?!0:!N),M&&x&&(v.current=_.isPropagationStopped(),v.current||_.stopPropagation())})})});bae.displayName=wae;var yB=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:o,checked:a,defaultChecked:i,required:s,disabled:l,value:d,onCheckedChange:h,form:p,...m}=e;return u.jsx(cBe,{__scopeCheckbox:n,checked:a,defaultChecked:i,disabled:l,required:s,onCheckedChange:h,name:o,form:p,value:d,internal_do_not_use_render:({isFormControl:v})=>u.jsxs(u.Fragment,{children:[u.jsx(bae,{...m,ref:t,__scopeCheckbox:n}),v&&u.jsx(Cae,{__scopeCheckbox:n})]})})});yB.displayName=c$;var Mae="CheckboxIndicator",_ae=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:o,...a}=e,i=pB(Mae,n);return u.jsx(jn,{present:o||ws(i.checked)||i.checked===!0,children:u.jsx(Ae.span,{"data-state":Nae(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});_ae.displayName=Mae;var Sae="CheckboxBubbleInput",Cae=k.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:o,hasConsumerStoppedPropagationRef:a,checked:i,defaultChecked:s,required:l,disabled:d,name:h,value:p,form:m,bubbleInput:v,setBubbleInput:x}=pB(Sae,e),M=ot(n,x),b=YP(i),C=UP(o);k.useEffect(()=>{const N=v;if(!N)return;const A=window.HTMLInputElement.prototype,R=Object.getOwnPropertyDescriptor(A,"checked").set,j=!a.current;if(b!==i&&R){const D=new Event("click",{bubbles:j});N.indeterminate=ws(i),R.call(N,ws(i)?!1:i),N.dispatchEvent(D)}},[v,b,i,a]);const _=k.useRef(ws(i)?!1:i);return u.jsx(Ae.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??_.current,required:l,disabled:d,name:h,value:p,form:m,...t,tabIndex:-1,ref:M,style:{...t.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Cae.displayName=Sae;function lBe(e){return typeof e=="function"}function ws(e){return e==="indeterminate"}function Nae(e){return ws(e)?"indeterminate":e?"checked":"unchecked"}const ci=k.forwardRef(({className:e,...t},n)=>u.jsx(yB,{ref:n,className:ge("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:u.jsx(_ae,{className:ge("flex items-center justify-center text-current"),children:u.jsx(ri,{className:"h-4 w-4"})})}));ci.displayName=yB.displayName;function uBe({bot:e,onCancel:t}){const[n,o]=k.useState({includeCommands:!0,includePermissions:!0,includePluginFiles:!0}),a=(s,l)=>{o(d=>({...d,[s]:l}))},i=()=>{const s=new URLSearchParams(n).toString(),l=`/api/bots/${e.id}/export?${s}`;window.location.href=l,t()};return u.jsxs(Wt,{children:[u.jsxs(on,{children:[u.jsxs(en,{children:["Экспорт конфигурации: ",e.username]}),u.jsx(dn,{children:"Выберите данные, которые вы хотите включить в ZIP-архив."})]}),u.jsxs("div",{className:"py-4 space-y-4",children:[u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ci,{id:"includeCommands",checked:n.includeCommands,onCheckedChange:s=>a("includeCommands",s)}),u.jsx(_e,{htmlFor:"includeCommands",children:"Настройки команд (алиасы, кулдауны и т.д.)"})]}),u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ci,{id:"includePermissions",checked:n.includePermissions,onCheckedChange:s=>a("includePermissions",s)}),u.jsx(_e,{htmlFor:"includePermissions",children:"Пользователи и права доступа"})]}),u.jsxs("div",{className:"flex items-start space-x-2",children:[u.jsx(ci,{id:"includePluginFiles",checked:n.includePluginFiles,onCheckedChange:s=>a("includePluginFiles",s)}),u.jsxs("div",{className:"grid gap-1.5 leading-none",children:[u.jsx(_e,{htmlFor:"includePluginFiles",children:"Включить файлы плагинов"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Сохраняет не только список плагинов, но и их файлы, включая конфиги (например, `config.json`). Рекомендуется для полного бэкапа."})]})]})]}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:t,children:"Отмена"}),u.jsxs(pe,{onClick:i,children:[u.jsx(ii,{className:"mr-2 h-4 w-4"}),"Скачать архив"]})]})]})}var Lae="AlertDialog",[dBe,Hqt]=zn(Lae,[hte]),vi=hte(),jae=e=>{const{__scopeAlertDialog:t,...n}=e,o=vi(t);return u.jsx(OP,{...o,...n,modal:!0})};jae.displayName=Lae;var hBe="AlertDialogTrigger",Aae=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...o}=e,a=vi(n);return u.jsx(HV,{...a,...o,ref:t})});Aae.displayName=hBe;var fBe="AlertDialogPortal",Eae=e=>{const{__scopeAlertDialog:t,...n}=e,o=vi(t);return u.jsx(qP,{...o,...n})};Eae.displayName=fBe;var pBe="AlertDialogOverlay",Iae=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...o}=e,a=vi(n);return u.jsx(c2,{...a,...o,ref:t})});Iae.displayName=pBe;var $h="AlertDialogContent",[yBe,mBe]=dBe($h),gBe=fee("AlertDialogContent"),Tae=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:o,...a}=e,i=vi(n),s=k.useRef(null),l=ot(t,s),d=k.useRef(null);return u.jsx(Qze,{contentName:$h,titleName:Rae,docsSlug:"alert-dialog",children:u.jsx(yBe,{scope:n,cancelRef:d,children:u.jsxs(l2,{role:"alertdialog",...i,...a,ref:l,onOpenAutoFocus:Me(a.onOpenAutoFocus,h=>{var p;h.preventDefault(),(p=d.current)==null||p.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[u.jsx(gBe,{children:o}),u.jsx(kBe,{contentRef:s})]})})})});Tae.displayName=$h;var Rae="AlertDialogTitle",Pae=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...o}=e,a=vi(n);return u.jsx(yp,{...a,...o,ref:t})});Pae.displayName=Rae;var $ae="AlertDialogDescription",Dae=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...o}=e,a=vi(n);return u.jsx(mp,{...a,...o,ref:t})});Dae.displayName=$ae;var vBe="AlertDialogAction",zae=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...o}=e,a=vi(n);return u.jsx(HP,{...a,...o,ref:t})});zae.displayName=vBe;var Oae="AlertDialogCancel",qae=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...o}=e,{cancelRef:a}=mBe(Oae,n),i=vi(n),s=ot(t,a);return u.jsx(HP,{...i,...o,ref:s})});qae.displayName=Oae;var kBe=({contentRef:e})=>{const t=`\`${$h}\` requires a description for the component to be accessible for screen reader users.
8144
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return k.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},eOe="DialogDescriptionWarning",tOe=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Cte(eOe).contentName}}.`;return k.useEffect(()=>{var i;const a=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},OP=DV,HV=pte,qP=mte,c2=gte,l2=vte,yp=xte,mp=bte,HP=_te;const Jt=OP,Ua=HV,nOe=qP,Nte=k.forwardRef(({className:e,...t},n)=>u.jsx(c2,{ref:n,className:ge("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Nte.displayName=c2.displayName;const Wt=k.forwardRef(({className:e,children:t,...n},o)=>u.jsxs(nOe,{children:[u.jsx(Nte,{}),u.jsxs(l2,{ref:o,className:ge("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,u.jsxs(HP,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[u.jsx(xs,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Wt.displayName=l2.displayName;const on=({className:e,...t})=>u.jsx("div",{className:ge("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});on.displayName="DialogHeader";const an=({className:e,...t})=>u.jsx("div",{className:ge("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});an.displayName="DialogFooter";const en=k.forwardRef(({className:e,...t},n)=>u.jsx(yp,{ref:n,className:ge("text-lg font-semibold leading-none tracking-tight",e),...t}));en.displayName=yp.displayName;const dn=k.forwardRef(({className:e,...t},n)=>u.jsx(mp,{ref:n,className:ge("text-sm text-muted-foreground",e),...t}));dn.displayName=mp.displayName;const oOe=OP,aOe=HV,rOe=qP,Lte=k.forwardRef(({className:e,...t},n)=>u.jsx(c2,{className:ge("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));Lte.displayName=c2.displayName;const iOe=r2("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),jte=k.forwardRef(({side:e="left",className:t,children:n,...o},a)=>u.jsxs(rOe,{children:[u.jsx(Lte,{}),u.jsxs(l2,{ref:a,className:ge(iOe({side:e}),t),...o,children:[n,u.jsxs(HP,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[u.jsx(xs,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Close"})]}),u.jsx(Ate,{className:"sr-only",children:"Title"}),u.jsx(Ete,{className:"sr-only",children:"Description"})]})]}));jte.displayName=l2.displayName;const Ate=k.forwardRef(({className:e,...t},n)=>u.jsx(yp,{ref:n,className:ge("text-lg font-semibold text-foreground",e),...t}));Ate.displayName=yp.displayName;const Ete=k.forwardRef(({className:e,...t},n)=>u.jsx(mp,{ref:n,className:ge("text-sm text-muted-foreground",e),...t}));Ete.displayName=mp.displayName;var sOe="Separator",BY="horizontal",cOe=["horizontal","vertical"],Ite=k.forwardRef((e,t)=>{const{decorative:n,orientation:o=BY,...a}=e,i=lOe(o)?o:BY,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return u.jsx(Ae.div,{"data-orientation":i,...l,...a,ref:t})});Ite.displayName=sOe;function lOe(e){return cOe.includes(e)}var Tte=Ite;const Gh=k.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...o},a)=>u.jsx(Tte,{ref:a,decorative:n,orientation:t,className:ge("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...o}));Gh.displayName=Tte.displayName;const Ze=k.forwardRef(({className:e,type:t,...n},o)=>u.jsx("input",{type:t,className:ge("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:o,...n}));Ze.displayName="Input";var uOe="Label",Rte=k.forwardRef((e,t)=>u.jsx(Ae.label,{...e,ref:t,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Rte.displayName=uOe;var Pte=Rte;const dOe=r2("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),_e=k.forwardRef(({className:e,...t},n)=>u.jsx(Pte,{ref:n,className:ge(dOe(),e),...t}));_e.displayName=Pte.displayName;function $te({onImportSuccess:e,onCancel:t}){const[n,o]=k.useState(null),[a,i]=k.useState(!1),{toast:s}=Yt(),l=h=>{h.target.files&&h.target.files.length>0&&o(h.target.files[0])},d=async()=>{if(!n){s({variant:"destructive",title:"Ошибка",description:"Пожалуйста, выберите файл для импорта."});return}i(!0);const h=new FormData;h.append("file",n);try{const p=await Ne("/api/bots/import",{method:"POST",body:h,headers:{"Content-Type":void 0}},"Бот успешно импортирован.");e(p)}catch{}finally{i(!1)}};return u.jsxs(Wt,{children:[u.jsxs(on,{children:[u.jsx(en,{children:"Импорт бота из архива"}),u.jsx(dn,{children:"Выберите ZIP-архив, ранее экспортированный из панели. Будет создан новый бот со всеми плагинами и настройками. Пароли не переносятся."})]}),u.jsx("div",{className:"py-4 space-y-4",children:u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"botFile",children:"Файл экспорта (.zip)"}),u.jsx(Ze,{id:"botFile",type:"file",accept:".zip",onChange:l})]})}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:t,children:"Отмена"}),u.jsxs(pe,{onClick:d,disabled:a||!n,children:[a&&u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}),u.jsx(wr,{className:"mr-2 h-4 w-4"}),"Импортировать"]})]})]})}function eH(e,[t,n]){return Math.min(n,Math.max(t,e))}var hOe=k.createContext(void 0);function m1(e){const t=k.useContext(hOe);return e||t||"ltr"}const fOe=["top","right","bottom","left"],Ns=Math.min,Ko=Math.max,XR=Math.round,im=Math.floor,br=e=>({x:e,y:e}),pOe={left:"right",right:"left",bottom:"top",top:"bottom"},yOe={start:"end",end:"start"};function tH(e,t,n){return Ko(e,Ns(t,n))}function di(e,t){return typeof e=="function"?e(t):e}function hi(e){return e.split("-")[0]}function u2(e){return e.split("-")[1]}function VV(e){return e==="x"?"y":"x"}function BV(e){return e==="y"?"height":"width"}function vr(e){return["top","bottom"].includes(hi(e))?"y":"x"}function FV(e){return VV(vr(e))}function mOe(e,t,n){n===void 0&&(n=!1);const o=u2(e),a=FV(e),i=BV(a);let s=a==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=ZR(s)),[s,ZR(s)]}function gOe(e){const t=ZR(e);return[nH(e),t,nH(t)]}function nH(e){return e.replace(/start|end/g,t=>yOe[t])}function vOe(e,t,n){const o=["left","right"],a=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?a:o:t?o:a;case"left":case"right":return t?i:s;default:return[]}}function kOe(e,t,n,o){const a=u2(e);let i=vOe(hi(e),n==="start",o);return a&&(i=i.map(s=>s+"-"+a),t&&(i=i.concat(i.map(nH)))),i}function ZR(e){return e.replace(/left|right|bottom|top/g,t=>pOe[t])}function xOe(e){return{top:0,right:0,bottom:0,left:0,...e}}function Dte(e){return typeof e!="number"?xOe(e):{top:e,right:e,bottom:e,left:e}}function YR(e){const{x:t,y:n,width:o,height:a}=e;return{width:o,height:a,top:n,left:t,right:t+o,bottom:n+a,x:t,y:n}}function FY(e,t,n){let{reference:o,floating:a}=e;const i=vr(t),s=FV(t),l=BV(s),d=hi(t),h=i==="y",p=o.x+o.width/2-a.width/2,m=o.y+o.height/2-a.height/2,v=o[l]/2-a[l]/2;let x;switch(d){case"top":x={x:p,y:o.y-a.height};break;case"bottom":x={x:p,y:o.y+o.height};break;case"right":x={x:o.x+o.width,y:m};break;case"left":x={x:o.x-a.width,y:m};break;default:x={x:o.x,y:o.y}}switch(u2(t)){case"start":x[s]-=v*(n&&h?-1:1);break;case"end":x[s]+=v*(n&&h?-1:1);break}return x}const wOe=async(e,t,n)=>{const{placement:o="bottom",strategy:a="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),d=await(s.isRTL==null?void 0:s.isRTL(t));let h=await s.getElementRects({reference:e,floating:t,strategy:a}),{x:p,y:m}=FY(h,o,d),v=o,x={},M=0;for(let b=0;b<l.length;b++){const{name:C,fn:_}=l[b],{x:N,y:A,data:I,reset:R}=await _({x:p,y:m,initialPlacement:o,placement:v,strategy:a,middlewareData:x,rects:h,platform:s,elements:{reference:e,floating:t}});p=N??p,m=A??m,x={...x,[C]:{...x[C],...I}},R&&M<=50&&(M++,typeof R=="object"&&(R.placement&&(v=R.placement),R.rects&&(h=R.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:a}):R.rects),{x:p,y:m}=FY(h,v,d)),b=-1)}return{x:p,y:m,placement:v,strategy:a,middlewareData:x}};async function D0(e,t){var n;t===void 0&&(t={});const{x:o,y:a,platform:i,rects:s,elements:l,strategy:d}=e,{boundary:h="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:v=!1,padding:x=0}=di(t,e),M=Dte(x),C=l[v?m==="floating"?"reference":"floating":m],_=YR(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(C)))==null||n?C:C.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:h,rootBoundary:p,strategy:d})),N=m==="floating"?{x:o,y:a,width:s.floating.width,height:s.floating.height}:s.reference,A=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),I=await(i.isElement==null?void 0:i.isElement(A))?await(i.getScale==null?void 0:i.getScale(A))||{x:1,y:1}:{x:1,y:1},R=YR(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:N,offsetParent:A,strategy:d}):N);return{top:(_.top-R.top+M.top)/I.y,bottom:(R.bottom-_.bottom+M.bottom)/I.y,left:(_.left-R.left+M.left)/I.x,right:(R.right-_.right+M.right)/I.x}}const bOe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:a,rects:i,platform:s,elements:l,middlewareData:d}=t,{element:h,padding:p=0}=di(e,t)||{};if(h==null)return{};const m=Dte(p),v={x:n,y:o},x=FV(a),M=BV(x),b=await s.getDimensions(h),C=x==="y",_=C?"top":"left",N=C?"bottom":"right",A=C?"clientHeight":"clientWidth",I=i.reference[M]+i.reference[x]-v[x]-i.floating[M],R=v[x]-i.reference[x],j=await(s.getOffsetParent==null?void 0:s.getOffsetParent(h));let D=j?j[A]:0;(!D||!await(s.isElement==null?void 0:s.isElement(j)))&&(D=l.floating[A]||i.floating[M]);const H=I/2-R/2,U=D/2-b[M]/2-1,z=Ns(m[_],U),Z=Ns(m[N],U),q=z,G=D-b[M]-Z,E=D/2-b[M]/2+H,O=tH(q,E,G),P=!d.arrow&&u2(a)!=null&&E!==O&&i.reference[M]/2-(E<q?z:Z)-b[M]/2<0,X=P?E<q?E-q:E-G:0;return{[x]:v[x]+X,data:{[x]:O,centerOffset:E-O-X,...P&&{alignmentOffset:X}},reset:P}}}),MOe=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:a,middlewareData:i,rects:s,initialPlacement:l,platform:d,elements:h}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:v,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:M="none",flipAlignment:b=!0,...C}=di(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const _=hi(a),N=vr(l),A=hi(l)===l,I=await(d.isRTL==null?void 0:d.isRTL(h.floating)),R=v||(A||!b?[ZR(l)]:gOe(l)),j=M!=="none";!v&&j&&R.push(...kOe(l,b,M,I));const D=[l,...R],H=await D0(t,C),U=[];let z=((o=i.flip)==null?void 0:o.overflows)||[];if(p&&U.push(H[_]),m){const E=mOe(a,s,I);U.push(H[E[0]],H[E[1]])}if(z=[...z,{placement:a,overflows:U}],!U.every(E=>E<=0)){var Z,q;const E=(((Z=i.flip)==null?void 0:Z.index)||0)+1,O=D[E];if(O&&(!(m==="alignment"?N!==vr(O):!1)||z.every(W=>W.overflows[0]>0&&vr(W.placement)===N)))return{data:{index:E,overflows:z},reset:{placement:O}};let P=(q=z.filter(X=>X.overflows[0]<=0).sort((X,W)=>X.overflows[1]-W.overflows[1])[0])==null?void 0:q.placement;if(!P)switch(x){case"bestFit":{var G;const X=(G=z.filter(W=>{if(j){const V=vr(W.placement);return V===N||V==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(V=>V>0).reduce((V,L)=>V+L,0)]).sort((W,V)=>W[1]-V[1])[0])==null?void 0:G[0];X&&(P=X);break}case"initialPlacement":P=l;break}if(a!==P)return{reset:{placement:P}}}return{}}}};function UY(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function GY(e){return fOe.some(t=>e[t]>=0)}const _Oe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:o="referenceHidden",...a}=di(e,t);switch(o){case"referenceHidden":{const i=await D0(t,{...a,elementContext:"reference"}),s=UY(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:GY(s)}}}case"escaped":{const i=await D0(t,{...a,altBoundary:!0}),s=UY(i,n.floating);return{data:{escapedOffsets:s,escaped:GY(s)}}}default:return{}}}}};async function SOe(e,t){const{placement:n,platform:o,elements:a}=e,i=await(o.isRTL==null?void 0:o.isRTL(a.floating)),s=hi(n),l=u2(n),d=vr(n)==="y",h=["left","top"].includes(s)?-1:1,p=i&&d?-1:1,m=di(t,e);let{mainAxis:v,crossAxis:x,alignmentAxis:M}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return l&&typeof M=="number"&&(x=l==="end"?M*-1:M),d?{x:x*p,y:v*h}:{x:v*h,y:x*p}}const COe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:a,y:i,placement:s,middlewareData:l}=t,d=await SOe(t,e);return s===((n=l.offset)==null?void 0:n.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:a+d.x,y:i+d.y,data:{...d,placement:s}}}}},NOe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:a}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:C=>{let{x:_,y:N}=C;return{x:_,y:N}}},...d}=di(e,t),h={x:n,y:o},p=await D0(t,d),m=vr(hi(a)),v=VV(m);let x=h[v],M=h[m];if(i){const C=v==="y"?"top":"left",_=v==="y"?"bottom":"right",N=x+p[C],A=x-p[_];x=tH(N,x,A)}if(s){const C=m==="y"?"top":"left",_=m==="y"?"bottom":"right",N=M+p[C],A=M-p[_];M=tH(N,M,A)}const b=l.fn({...t,[v]:x,[m]:M});return{...b,data:{x:b.x-n,y:b.y-o,enabled:{[v]:i,[m]:s}}}}}},LOe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:a,rects:i,middlewareData:s}=t,{offset:l=0,mainAxis:d=!0,crossAxis:h=!0}=di(e,t),p={x:n,y:o},m=vr(a),v=VV(m);let x=p[v],M=p[m];const b=di(l,t),C=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(d){const A=v==="y"?"height":"width",I=i.reference[v]-i.floating[A]+C.mainAxis,R=i.reference[v]+i.reference[A]-C.mainAxis;x<I?x=I:x>R&&(x=R)}if(h){var _,N;const A=v==="y"?"width":"height",I=["top","left"].includes(hi(a)),R=i.reference[m]-i.floating[A]+(I&&((_=s.offset)==null?void 0:_[m])||0)+(I?0:C.crossAxis),j=i.reference[m]+i.reference[A]+(I?0:((N=s.offset)==null?void 0:N[m])||0)-(I?C.crossAxis:0);M<R?M=R:M>j&&(M=j)}return{[v]:x,[m]:M}}}},jOe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:a,rects:i,platform:s,elements:l}=t,{apply:d=()=>{},...h}=di(e,t),p=await D0(t,h),m=hi(a),v=u2(a),x=vr(a)==="y",{width:M,height:b}=i.floating;let C,_;m==="top"||m==="bottom"?(C=m,_=v===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(_=m,C=v==="end"?"top":"bottom");const N=b-p.top-p.bottom,A=M-p.left-p.right,I=Ns(b-p[C],N),R=Ns(M-p[_],A),j=!t.middlewareData.shift;let D=I,H=R;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(H=A),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(D=N),j&&!v){const z=Ko(p.left,0),Z=Ko(p.right,0),q=Ko(p.top,0),G=Ko(p.bottom,0);x?H=M-2*(z!==0||Z!==0?z+Z:Ko(p.left,p.right)):D=b-2*(q!==0||G!==0?q+G:Ko(p.top,p.bottom))}await d({...t,availableWidth:H,availableHeight:D});const U=await s.getDimensions(l.floating);return M!==U.width||b!==U.height?{reset:{rects:!0}}:{}}}};function VP(){return typeof window<"u"}function d2(e){return zte(e)?(e.nodeName||"").toLowerCase():"#document"}function Jo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ir(e){var t;return(t=(zte(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zte(e){return VP()?e instanceof Node||e instanceof Jo(e).Node:!1}function Ga(e){return VP()?e instanceof Element||e instanceof Jo(e).Element:!1}function jr(e){return VP()?e instanceof HTMLElement||e instanceof Jo(e).HTMLElement:!1}function XY(e){return!VP()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Jo(e).ShadowRoot}function gp(e){const{overflow:t,overflowX:n,overflowY:o,display:a}=Xa(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(a)}function AOe(e){return["table","td","th"].includes(d2(e))}function BP(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function UV(e){const t=GV(),n=Ga(e)?Xa(e):e;return["transform","translate","scale","rotate","perspective"].some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function EOe(e){let t=Ls(e);for(;jr(t)&&!Xh(t);){if(UV(t))return t;if(BP(t))return null;t=Ls(t)}return null}function GV(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Xh(e){return["html","body","#document"].includes(d2(e))}function Xa(e){return Jo(e).getComputedStyle(e)}function FP(e){return Ga(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ls(e){if(d2(e)==="html")return e;const t=e.assignedSlot||e.parentNode||XY(e)&&e.host||Ir(e);return XY(t)?t.host:t}function Ote(e){const t=Ls(e);return Xh(t)?e.ownerDocument?e.ownerDocument.body:e.body:jr(t)&&gp(t)?t:Ote(t)}function z0(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=Ote(e),i=a===((o=e.ownerDocument)==null?void 0:o.body),s=Jo(a);if(i){const l=oH(s);return t.concat(s,s.visualViewport||[],gp(a)?a:[],l&&n?z0(l):[])}return t.concat(a,z0(a,[],n))}function oH(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function qte(e){const t=Xa(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const a=jr(e),i=a?e.offsetWidth:n,s=a?e.offsetHeight:o,l=XR(n)!==i||XR(o)!==s;return l&&(n=i,o=s),{width:n,height:o,$:l}}function XV(e){return Ga(e)?e:e.contextElement}function Ph(e){const t=XV(e);if(!jr(t))return br(1);const n=t.getBoundingClientRect(),{width:o,height:a,$:i}=qte(t);let s=(i?XR(n.width):n.width)/o,l=(i?XR(n.height):n.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const IOe=br(0);function Hte(e){const t=Jo(e);return!GV()||!t.visualViewport?IOe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function TOe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Jo(e)?!1:t}function a1(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=XV(e);let s=br(1);t&&(o?Ga(o)&&(s=Ph(o)):s=Ph(e));const l=TOe(i,n,o)?Hte(i):br(0);let d=(a.left+l.x)/s.x,h=(a.top+l.y)/s.y,p=a.width/s.x,m=a.height/s.y;if(i){const v=Jo(i),x=o&&Ga(o)?Jo(o):o;let M=v,b=oH(M);for(;b&&o&&x!==M;){const C=Ph(b),_=b.getBoundingClientRect(),N=Xa(b),A=_.left+(b.clientLeft+parseFloat(N.paddingLeft))*C.x,I=_.top+(b.clientTop+parseFloat(N.paddingTop))*C.y;d*=C.x,h*=C.y,p*=C.x,m*=C.y,d+=A,h+=I,M=Jo(b),b=oH(M)}}return YR({width:p,height:m,x:d,y:h})}function ZV(e,t){const n=FP(e).scrollLeft;return t?t.left+n:a1(Ir(e)).left+n}function Vte(e,t,n){n===void 0&&(n=!1);const o=e.getBoundingClientRect(),a=o.left+t.scrollLeft-(n?0:ZV(e,o)),i=o.top+t.scrollTop;return{x:a,y:i}}function ROe(e){let{elements:t,rect:n,offsetParent:o,strategy:a}=e;const i=a==="fixed",s=Ir(o),l=t?BP(t.floating):!1;if(o===s||l&&i)return n;let d={scrollLeft:0,scrollTop:0},h=br(1);const p=br(0),m=jr(o);if((m||!m&&!i)&&((d2(o)!=="body"||gp(s))&&(d=FP(o)),jr(o))){const x=a1(o);h=Ph(o),p.x=x.x+o.clientLeft,p.y=x.y+o.clientTop}const v=s&&!m&&!i?Vte(s,d,!0):br(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-d.scrollLeft*h.x+p.x+v.x,y:n.y*h.y-d.scrollTop*h.y+p.y+v.y}}function POe(e){return Array.from(e.getClientRects())}function $Oe(e){const t=Ir(e),n=FP(e),o=e.ownerDocument.body,a=Ko(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=Ko(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+ZV(e);const l=-n.scrollTop;return Xa(o).direction==="rtl"&&(s+=Ko(t.clientWidth,o.clientWidth)-a),{width:a,height:i,x:s,y:l}}function DOe(e,t){const n=Jo(e),o=Ir(e),a=n.visualViewport;let i=o.clientWidth,s=o.clientHeight,l=0,d=0;if(a){i=a.width,s=a.height;const h=GV();(!h||h&&t==="fixed")&&(l=a.offsetLeft,d=a.offsetTop)}return{width:i,height:s,x:l,y:d}}function zOe(e,t){const n=a1(e,!0,t==="fixed"),o=n.top+e.clientTop,a=n.left+e.clientLeft,i=jr(e)?Ph(e):br(1),s=e.clientWidth*i.x,l=e.clientHeight*i.y,d=a*i.x,h=o*i.y;return{width:s,height:l,x:d,y:h}}function ZY(e,t,n){let o;if(t==="viewport")o=DOe(e,n);else if(t==="document")o=$Oe(Ir(e));else if(Ga(t))o=zOe(t,n);else{const a=Hte(e);o={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return YR(o)}function Bte(e,t){const n=Ls(e);return n===t||!Ga(n)||Xh(n)?!1:Xa(n).position==="fixed"||Bte(n,t)}function OOe(e,t){const n=t.get(e);if(n)return n;let o=z0(e,[],!1).filter(l=>Ga(l)&&d2(l)!=="body"),a=null;const i=Xa(e).position==="fixed";let s=i?Ls(e):e;for(;Ga(s)&&!Xh(s);){const l=Xa(s),d=UV(s);!d&&l.position==="fixed"&&(a=null),(i?!d&&!a:!d&&l.position==="static"&&!!a&&["absolute","fixed"].includes(a.position)||gp(s)&&!d&&Bte(e,s))?o=o.filter(p=>p!==s):a=l,s=Ls(s)}return t.set(e,o),o}function qOe(e){let{element:t,boundary:n,rootBoundary:o,strategy:a}=e;const s=[...n==="clippingAncestors"?BP(t)?[]:OOe(t,this._c):[].concat(n),o],l=s[0],d=s.reduce((h,p)=>{const m=ZY(t,p,a);return h.top=Ko(m.top,h.top),h.right=Ns(m.right,h.right),h.bottom=Ns(m.bottom,h.bottom),h.left=Ko(m.left,h.left),h},ZY(t,l,a));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function HOe(e){const{width:t,height:n}=qte(e);return{width:t,height:n}}function VOe(e,t,n){const o=jr(t),a=Ir(t),i=n==="fixed",s=a1(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const d=br(0);function h(){d.x=ZV(a)}if(o||!o&&!i)if((d2(t)!=="body"||gp(a))&&(l=FP(t)),o){const x=a1(t,!0,i,t);d.x=x.x+t.clientLeft,d.y=x.y+t.clientTop}else a&&h();i&&!o&&a&&h();const p=a&&!o&&!i?Vte(a,l):br(0),m=s.left+l.scrollLeft-d.x-p.x,v=s.top+l.scrollTop-d.y-p.y;return{x:m,y:v,width:s.width,height:s.height}}function bO(e){return Xa(e).position==="static"}function YY(e,t){if(!jr(e)||Xa(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ir(e)===n&&(n=n.ownerDocument.body),n}function Fte(e,t){const n=Jo(e);if(BP(e))return n;if(!jr(e)){let a=Ls(e);for(;a&&!Xh(a);){if(Ga(a)&&!bO(a))return a;a=Ls(a)}return n}let o=YY(e,t);for(;o&&AOe(o)&&bO(o);)o=YY(o,t);return o&&Xh(o)&&bO(o)&&!UV(o)?n:o||EOe(e)||n}const BOe=async function(e){const t=this.getOffsetParent||Fte,n=this.getDimensions,o=await n(e.floating);return{reference:VOe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function FOe(e){return Xa(e).direction==="rtl"}const UOe={convertOffsetParentRelativeRectToViewportRelativeRect:ROe,getDocumentElement:Ir,getClippingRect:qOe,getOffsetParent:Fte,getElementRects:BOe,getClientRects:POe,getDimensions:HOe,getScale:Ph,isElement:Ga,isRTL:FOe};function Ute(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function GOe(e,t){let n=null,o;const a=Ir(e);function i(){var l;clearTimeout(o),(l=n)==null||l.disconnect(),n=null}function s(l,d){l===void 0&&(l=!1),d===void 0&&(d=1),i();const h=e.getBoundingClientRect(),{left:p,top:m,width:v,height:x}=h;if(l||t(),!v||!x)return;const M=im(m),b=im(a.clientWidth-(p+v)),C=im(a.clientHeight-(m+x)),_=im(p),A={rootMargin:-M+"px "+-b+"px "+-C+"px "+-_+"px",threshold:Ko(0,Ns(1,d))||1};let I=!0;function R(j){const D=j[0].intersectionRatio;if(D!==d){if(!I)return s();D?s(!1,D):o=setTimeout(()=>{s(!1,1e-7)},1e3)}D===1&&!Ute(h,e.getBoundingClientRect())&&s(),I=!1}try{n=new IntersectionObserver(R,{...A,root:a.ownerDocument})}catch{n=new IntersectionObserver(R,A)}n.observe(e)}return s(!0),i}function XOe(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:d=!1}=o,h=XV(e),p=a||i?[...h?z0(h):[],...z0(t)]:[];p.forEach(_=>{a&&_.addEventListener("scroll",n,{passive:!0}),i&&_.addEventListener("resize",n)});const m=h&&l?GOe(h,n):null;let v=-1,x=null;s&&(x=new ResizeObserver(_=>{let[N]=_;N&&N.target===h&&x&&(x.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var A;(A=x)==null||A.observe(t)})),n()}),h&&!d&&x.observe(h),x.observe(t));let M,b=d?a1(e):null;d&&C();function C(){const _=a1(e);b&&!Ute(b,_)&&n(),b=_,M=requestAnimationFrame(C)}return n(),()=>{var _;p.forEach(N=>{a&&N.removeEventListener("scroll",n),i&&N.removeEventListener("resize",n)}),m==null||m(),(_=x)==null||_.disconnect(),x=null,d&&cancelAnimationFrame(M)}}const ZOe=COe,YOe=NOe,WOe=MOe,KOe=jOe,QOe=_Oe,WY=bOe,JOe=LOe,eqe=(e,t,n)=>{const o=new Map,a={platform:UOe,...n},i={...a.platform,_c:o};return wOe(e,t,{...a,platform:i})};var tqe=typeof document<"u",nqe=function(){},CR=tqe?k.useLayoutEffect:nqe;function WR(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!WR(e[o],t[o]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,a[o]))return!1;for(o=n;o--!==0;){const i=a[o];if(!(i==="_owner"&&e.$$typeof)&&!WR(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Gte(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function KY(e,t){const n=Gte(e);return Math.round(t*n)/n}function MO(e){const t=k.useRef(e);return CR(()=>{t.current=e}),t}function oqe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:a,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:d,open:h}=e,[p,m]=k.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,x]=k.useState(o);WR(v,o)||x(o);const[M,b]=k.useState(null),[C,_]=k.useState(null),N=k.useCallback(W=>{W!==j.current&&(j.current=W,b(W))},[]),A=k.useCallback(W=>{W!==D.current&&(D.current=W,_(W))},[]),I=i||M,R=s||C,j=k.useRef(null),D=k.useRef(null),H=k.useRef(p),U=d!=null,z=MO(d),Z=MO(a),q=MO(h),G=k.useCallback(()=>{if(!j.current||!D.current)return;const W={placement:t,strategy:n,middleware:v};Z.current&&(W.platform=Z.current),eqe(j.current,D.current,W).then(V=>{const L={...V,isPositioned:q.current!==!1};E.current&&!WR(H.current,L)&&(H.current=L,f1.flushSync(()=>{m(L)}))})},[v,t,n,Z,q]);CR(()=>{h===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,m(W=>({...W,isPositioned:!1})))},[h]);const E=k.useRef(!1);CR(()=>(E.current=!0,()=>{E.current=!1}),[]),CR(()=>{if(I&&(j.current=I),R&&(D.current=R),I&&R){if(z.current)return z.current(I,R,G);G()}},[I,R,G,z,U]);const O=k.useMemo(()=>({reference:j,floating:D,setReference:N,setFloating:A}),[N,A]),P=k.useMemo(()=>({reference:I,floating:R}),[I,R]),X=k.useMemo(()=>{const W={position:n,left:0,top:0};if(!P.floating)return W;const V=KY(P.floating,p.x),L=KY(P.floating,p.y);return l?{...W,transform:"translate("+V+"px, "+L+"px)",...Gte(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:L}},[n,l,P.floating,p.x,p.y]);return k.useMemo(()=>({...p,update:G,refs:O,elements:P,floatingStyles:X}),[p,G,O,P,X])}const aqe=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:a}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?WY({element:o.current,padding:a}).fn(n):{}:o?WY({element:o,padding:a}).fn(n):{}}}},rqe=(e,t)=>({...ZOe(e),options:[e,t]}),iqe=(e,t)=>({...YOe(e),options:[e,t]}),sqe=(e,t)=>({...JOe(e),options:[e,t]}),cqe=(e,t)=>({...WOe(e),options:[e,t]}),lqe=(e,t)=>({...KOe(e),options:[e,t]}),uqe=(e,t)=>({...QOe(e),options:[e,t]}),dqe=(e,t)=>({...aqe(e),options:[e,t]});var hqe="Arrow",Xte=k.forwardRef((e,t)=>{const{children:n,width:o=10,height:a=5,...i}=e;return u.jsx(Ae.svg,{...i,ref:t,width:o,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});Xte.displayName=hqe;var fqe=Xte;function UP(e){const[t,n]=k.useState(void 0);return Gn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let s,l;if("borderBoxSize"in i){const d=i.borderBoxSize,h=Array.isArray(d)?d[0]:d;s=h.inlineSize,l=h.blockSize}else s=e.offsetWidth,l=e.offsetHeight;n({width:s,height:l})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var YV="Popper",[Zte,Ts]=zn(YV),[pqe,Yte]=Zte(YV),Wte=e=>{const{__scopePopper:t,children:n}=e,[o,a]=k.useState(null);return u.jsx(pqe,{scope:t,anchor:o,onAnchorChange:a,children:n})};Wte.displayName=YV;var Kte="PopperAnchor",Qte=k.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...a}=e,i=Yte(Kte,n),s=k.useRef(null),l=ot(t,s);return k.useEffect(()=>{i.onAnchorChange((o==null?void 0:o.current)||s.current)}),o?null:u.jsx(Ae.div,{...a,ref:l})});Qte.displayName=Kte;var WV="PopperContent",[yqe,mqe]=Zte(WV),Jte=k.forwardRef((e,t)=>{var te,ce,me,ke,Ee,Ie;const{__scopePopper:n,side:o="bottom",sideOffset:a=0,align:i="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:d=!0,collisionBoundary:h=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:v=!1,updatePositionStrategy:x="optimized",onPlaced:M,...b}=e,C=Yte(WV,n),[_,N]=k.useState(null),A=ot(t,Te=>N(Te)),[I,R]=k.useState(null),j=UP(I),D=(j==null?void 0:j.width)??0,H=(j==null?void 0:j.height)??0,U=o+(i!=="center"?"-"+i:""),z=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},Z=Array.isArray(h)?h:[h],q=Z.length>0,G={padding:z,boundary:Z.filter(vqe),altBoundary:q},{refs:E,floatingStyles:O,placement:P,isPositioned:X,middlewareData:W}=oqe({strategy:"fixed",placement:U,whileElementsMounted:(...Te)=>XOe(...Te,{animationFrame:x==="always"}),elements:{reference:C.anchor},middleware:[rqe({mainAxis:a+H,alignmentAxis:s}),d&&iqe({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?sqe():void 0,...G}),d&&cqe({...G}),lqe({...G,apply:({elements:Te,rects:qe,availableWidth:ct,availableHeight:jt})=>{const{width:We,height:Le}=qe.reference,Rt=Te.floating.style;Rt.setProperty("--radix-popper-available-width",`${ct}px`),Rt.setProperty("--radix-popper-available-height",`${jt}px`),Rt.setProperty("--radix-popper-anchor-width",`${We}px`),Rt.setProperty("--radix-popper-anchor-height",`${Le}px`)}}),I&&dqe({element:I,padding:l}),kqe({arrowWidth:D,arrowHeight:H}),v&&uqe({strategy:"referenceHidden",...G})]}),[V,L]=nne(P),Y=gn(M);Gn(()=>{X&&(Y==null||Y())},[X,Y]);const F=(te=W.arrow)==null?void 0:te.x,T=(ce=W.arrow)==null?void 0:ce.y,K=((me=W.arrow)==null?void 0:me.centerOffset)!==0,[Q,ne]=k.useState();return Gn(()=>{_&&ne(window.getComputedStyle(_).zIndex)},[_]),u.jsx("div",{ref:E.setFloating,"data-radix-popper-content-wrapper":"",style:{...O,transform:X?O.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Q,"--radix-popper-transform-origin":[(ke=W.transformOrigin)==null?void 0:ke.x,(Ee=W.transformOrigin)==null?void 0:Ee.y].join(" "),...((Ie=W.hide)==null?void 0:Ie.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(yqe,{scope:n,placedSide:V,onArrowChange:R,arrowX:F,arrowY:T,shouldHideArrow:K,children:u.jsx(Ae.div,{"data-side":V,"data-align":L,...b,ref:A,style:{...b.style,animation:X?void 0:"none"}})})})});Jte.displayName=WV;var ene="PopperArrow",gqe={top:"bottom",right:"left",bottom:"top",left:"right"},tne=k.forwardRef(function(t,n){const{__scopePopper:o,...a}=t,i=mqe(ene,o),s=gqe[i.placedSide];return u.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:u.jsx(fqe,{...a,ref:n,style:{...a.style,display:"block"}})})});tne.displayName=ene;function vqe(e){return e!==null}var kqe=e=>({name:"transformOrigin",options:e,fn(t){var C,_,N;const{placement:n,rects:o,middlewareData:a}=t,s=((C=a.arrow)==null?void 0:C.centerOffset)!==0,l=s?0:e.arrowWidth,d=s?0:e.arrowHeight,[h,p]=nne(n),m={start:"0%",center:"50%",end:"100%"}[p],v=(((_=a.arrow)==null?void 0:_.x)??0)+l/2,x=(((N=a.arrow)==null?void 0:N.y)??0)+d/2;let M="",b="";return h==="bottom"?(M=s?m:`${v}px`,b=`${-d}px`):h==="top"?(M=s?m:`${v}px`,b=`${o.floating.height+d}px`):h==="right"?(M=`${-d}px`,b=s?m:`${x}px`):h==="left"&&(M=`${o.floating.width+d}px`,b=s?m:`${x}px`),{data:{x:M,y:b}}}});function nne(e){const[t,n="center"]=e.split("-");return[t,n]}var GP=Wte,vp=Qte,XP=Jte,ZP=tne;function YP(e){const t=k.useRef({value:e,previous:e});return k.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var xqe=[" ","Enter","ArrowUp","ArrowDown"],wqe=[" ","Enter"],r1="Select",[WP,KP,bqe]=dp(r1),[h2,$qt]=zn(r1,[bqe,Ts]),QP=Ts(),[Mqe,Rs]=h2(r1),[_qe,Sqe]=h2(r1),one=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:a,onOpenChange:i,value:s,defaultValue:l,onValueChange:d,dir:h,name:p,autoComplete:m,disabled:v,required:x,form:M}=e,b=QP(t),[C,_]=k.useState(null),[N,A]=k.useState(null),[I,R]=k.useState(!1),j=m1(h),[D,H]=go({prop:o,defaultProp:a??!1,onChange:i,caller:r1}),[U,z]=go({prop:s,defaultProp:l,onChange:d,caller:r1}),Z=k.useRef(null),q=C?M||!!C.closest("form"):!0,[G,E]=k.useState(new Set),O=Array.from(G).map(P=>P.props.value).join(";");return u.jsx(GP,{...b,children:u.jsxs(Mqe,{required:x,scope:t,trigger:C,onTriggerChange:_,valueNode:N,onValueNodeChange:A,valueNodeHasChildren:I,onValueNodeHasChildrenChange:R,contentId:Dn(),value:U,onValueChange:z,open:D,onOpenChange:H,dir:j,triggerPointerDownPosRef:Z,disabled:v,children:[u.jsx(WP.Provider,{scope:t,children:u.jsx(_qe,{scope:e.__scopeSelect,onNativeOptionAdd:k.useCallback(P=>{E(X=>new Set(X).add(P))},[]),onNativeOptionRemove:k.useCallback(P=>{E(X=>{const W=new Set(X);return W.delete(P),W})},[]),children:n})}),q?u.jsxs(Nne,{"aria-hidden":!0,required:x,tabIndex:-1,name:p,autoComplete:m,value:U,onChange:P=>z(P.target.value),disabled:v,form:M,children:[U===void 0?u.jsx("option",{value:""}):null,Array.from(G)]},O):null]})})};one.displayName=r1;var ane="SelectTrigger",rne=k.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...a}=e,i=QP(n),s=Rs(ane,n),l=s.disabled||o,d=ot(t,s.onTriggerChange),h=KP(n),p=k.useRef("touch"),[m,v,x]=jne(b=>{const C=h().filter(A=>!A.disabled),_=C.find(A=>A.value===s.value),N=Ane(C,b,_);N!==void 0&&s.onValueChange(N.value)}),M=b=>{l||(s.onOpenChange(!0),x()),b&&(s.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return u.jsx(vp,{asChild:!0,...i,children:u.jsx(Ae.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Lne(s.value)?"":void 0,...a,ref:d,onClick:Me(a.onClick,b=>{b.currentTarget.focus(),p.current!=="mouse"&&M(b)}),onPointerDown:Me(a.onPointerDown,b=>{p.current=b.pointerType;const C=b.target;C.hasPointerCapture(b.pointerId)&&C.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(M(b),b.preventDefault())}),onKeyDown:Me(a.onKeyDown,b=>{const C=m.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&v(b.key),!(C&&b.key===" ")&&xqe.includes(b.key)&&(M(),b.preventDefault())})})})});rne.displayName=ane;var ine="SelectValue",sne=k.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:a,children:i,placeholder:s="",...l}=e,d=Rs(ine,n),{onValueNodeHasChildrenChange:h}=d,p=i!==void 0,m=ot(t,d.onValueNodeChange);return Gn(()=>{h(p)},[h,p]),u.jsx(Ae.span,{...l,ref:m,style:{pointerEvents:"none"},children:Lne(d.value)?u.jsx(u.Fragment,{children:s}):i})});sne.displayName=ine;var Cqe="SelectIcon",cne=k.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...a}=e;return u.jsx(Ae.span,{"aria-hidden":!0,...a,ref:t,children:o||"▼"})});cne.displayName=Cqe;var Nqe="SelectPortal",lne=e=>u.jsx(y1,{asChild:!0,...e});lne.displayName=Nqe;var i1="SelectContent",une=k.forwardRef((e,t)=>{const n=Rs(i1,e.__scopeSelect),[o,a]=k.useState();if(Gn(()=>{a(new DocumentFragment)},[]),!n.open){const i=o;return i?f1.createPortal(u.jsx(dne,{scope:e.__scopeSelect,children:u.jsx(WP.Slot,{scope:e.__scopeSelect,children:u.jsx("div",{children:e.children})})}),i):null}return u.jsx(hne,{...e,ref:t})});une.displayName=i1;var Pa=10,[dne,Ps]=h2(i1),Lqe="SelectContentImpl",jqe=Cs("SelectContent.RemoveScroll"),hne=k.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:s,side:l,sideOffset:d,align:h,alignOffset:p,arrowPadding:m,collisionBoundary:v,collisionPadding:x,sticky:M,hideWhenDetached:b,avoidCollisions:C,..._}=e,N=Rs(i1,n),[A,I]=k.useState(null),[R,j]=k.useState(null),D=ot(t,te=>I(te)),[H,U]=k.useState(null),[z,Z]=k.useState(null),q=KP(n),[G,E]=k.useState(!1),O=k.useRef(!1);k.useEffect(()=>{if(A)return DP(A)},[A]),PP();const P=k.useCallback(te=>{const[ce,...me]=q().map(Ie=>Ie.ref.current),[ke]=me.slice(-1),Ee=document.activeElement;for(const Ie of te)if(Ie===Ee||(Ie==null||Ie.scrollIntoView({block:"nearest"}),Ie===ce&&R&&(R.scrollTop=0),Ie===ke&&R&&(R.scrollTop=R.scrollHeight),Ie==null||Ie.focus(),document.activeElement!==Ee))return},[q,R]),X=k.useCallback(()=>P([H,A]),[P,H,A]);k.useEffect(()=>{G&&X()},[G,X]);const{onOpenChange:W,triggerPointerDownPosRef:V}=N;k.useEffect(()=>{if(A){let te={x:0,y:0};const ce=ke=>{var Ee,Ie;te={x:Math.abs(Math.round(ke.pageX)-(((Ee=V.current)==null?void 0:Ee.x)??0)),y:Math.abs(Math.round(ke.pageY)-(((Ie=V.current)==null?void 0:Ie.y)??0))}},me=ke=>{te.x<=10&&te.y<=10?ke.preventDefault():A.contains(ke.target)||W(!1),document.removeEventListener("pointermove",ce),V.current=null};return V.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",me,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",me,{capture:!0})}}},[A,W,V]),k.useEffect(()=>{const te=()=>W(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[W]);const[L,Y]=jne(te=>{const ce=q().filter(Ee=>!Ee.disabled),me=ce.find(Ee=>Ee.ref.current===document.activeElement),ke=Ane(ce,te,me);ke&&setTimeout(()=>ke.ref.current.focus())}),F=k.useCallback((te,ce,me)=>{const ke=!O.current&&!me;(N.value!==void 0&&N.value===ce||ke)&&(U(te),ke&&(O.current=!0))},[N.value]),T=k.useCallback(()=>A==null?void 0:A.focus(),[A]),K=k.useCallback((te,ce,me)=>{const ke=!O.current&&!me;(N.value!==void 0&&N.value===ce||ke)&&Z(te)},[N.value]),Q=o==="popper"?aH:fne,ne=Q===aH?{side:l,sideOffset:d,align:h,alignOffset:p,arrowPadding:m,collisionBoundary:v,collisionPadding:x,sticky:M,hideWhenDetached:b,avoidCollisions:C}:{};return u.jsx(dne,{scope:n,content:A,viewport:R,onViewportChange:j,itemRefCallback:F,selectedItem:H,onItemLeave:T,itemTextRefCallback:K,focusSelectedItem:X,selectedItemText:z,position:o,isPositioned:G,searchRef:L,children:u.jsx(pp,{as:jqe,allowPinchZoom:!0,children:u.jsx(fp,{asChild:!0,trapped:N.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:Me(a,te=>{var ce;(ce=N.trigger)==null||ce.focus({preventScroll:!0}),te.preventDefault()}),children:u.jsx(p1,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:u.jsx(Q,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:te=>te.preventDefault(),..._,...ne,onPlaced:()=>E(!0),ref:D,style:{display:"flex",flexDirection:"column",outline:"none",..._.style},onKeyDown:Me(_.onKeyDown,te=>{const ce=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!ce&&te.key.length===1&&Y(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let ke=q().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);if(["ArrowUp","End"].includes(te.key)&&(ke=ke.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const Ee=te.target,Ie=ke.indexOf(Ee);ke=ke.slice(Ie+1)}setTimeout(()=>P(ke)),te.preventDefault()}})})})})})})});hne.displayName=Lqe;var Aqe="SelectItemAlignedPosition",fne=k.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...a}=e,i=Rs(i1,n),s=Ps(i1,n),[l,d]=k.useState(null),[h,p]=k.useState(null),m=ot(t,D=>p(D)),v=KP(n),x=k.useRef(!1),M=k.useRef(!0),{viewport:b,selectedItem:C,selectedItemText:_,focusSelectedItem:N}=s,A=k.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&h&&b&&C&&_){const D=i.trigger.getBoundingClientRect(),H=h.getBoundingClientRect(),U=i.valueNode.getBoundingClientRect(),z=_.getBoundingClientRect();if(i.dir!=="rtl"){const Ee=z.left-H.left,Ie=U.left-Ee,Te=D.left-Ie,qe=D.width+Te,ct=Math.max(qe,H.width),jt=window.innerWidth-Pa,We=eH(Ie,[Pa,Math.max(Pa,jt-ct)]);l.style.minWidth=qe+"px",l.style.left=We+"px"}else{const Ee=H.right-z.right,Ie=window.innerWidth-U.right-Ee,Te=window.innerWidth-D.right-Ie,qe=D.width+Te,ct=Math.max(qe,H.width),jt=window.innerWidth-Pa,We=eH(Ie,[Pa,Math.max(Pa,jt-ct)]);l.style.minWidth=qe+"px",l.style.right=We+"px"}const Z=v(),q=window.innerHeight-Pa*2,G=b.scrollHeight,E=window.getComputedStyle(h),O=parseInt(E.borderTopWidth,10),P=parseInt(E.paddingTop,10),X=parseInt(E.borderBottomWidth,10),W=parseInt(E.paddingBottom,10),V=O+P+G+W+X,L=Math.min(C.offsetHeight*5,V),Y=window.getComputedStyle(b),F=parseInt(Y.paddingTop,10),T=parseInt(Y.paddingBottom,10),K=D.top+D.height/2-Pa,Q=q-K,ne=C.offsetHeight/2,te=C.offsetTop+ne,ce=O+P+te,me=V-ce;if(ce<=K){const Ee=Z.length>0&&C===Z[Z.length-1].ref.current;l.style.bottom="0px";const Ie=h.clientHeight-b.offsetTop-b.offsetHeight,Te=Math.max(Q,ne+(Ee?T:0)+Ie+X),qe=ce+Te;l.style.height=qe+"px"}else{const Ee=Z.length>0&&C===Z[0].ref.current;l.style.top="0px";const Te=Math.max(K,O+b.offsetTop+(Ee?F:0)+ne)+me;l.style.height=Te+"px",b.scrollTop=ce-K+b.offsetTop}l.style.margin=`${Pa}px 0`,l.style.minHeight=L+"px",l.style.maxHeight=q+"px",o==null||o(),requestAnimationFrame(()=>x.current=!0)}},[v,i.trigger,i.valueNode,l,h,b,C,_,i.dir,o]);Gn(()=>A(),[A]);const[I,R]=k.useState();Gn(()=>{h&&R(window.getComputedStyle(h).zIndex)},[h]);const j=k.useCallback(D=>{D&&M.current===!0&&(A(),N==null||N(),M.current=!1)},[A,N]);return u.jsx(Iqe,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:x,onScrollButtonChange:j,children:u.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:I},children:u.jsx(Ae.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});fne.displayName=Aqe;var Eqe="SelectPopperPosition",aH=k.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:a=Pa,...i}=e,s=QP(n);return u.jsx(XP,{...s,...i,ref:t,align:o,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});aH.displayName=Eqe;var[Iqe,KV]=h2(i1,{}),rH="SelectViewport",pne=k.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...a}=e,i=Ps(rH,n),s=KV(rH,n),l=ot(t,i.onViewportChange),d=k.useRef(0);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),u.jsx(WP.Slot,{scope:n,children:u.jsx(Ae.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Me(a.onScroll,h=>{const p=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:v}=s;if(v!=null&&v.current&&m){const x=Math.abs(d.current-p.scrollTop);if(x>0){const M=window.innerHeight-Pa*2,b=parseFloat(m.style.minHeight),C=parseFloat(m.style.height),_=Math.max(b,C);if(_<M){const N=_+x,A=Math.min(M,N),I=N-A;m.style.height=A+"px",m.style.bottom==="0px"&&(p.scrollTop=I>0?I:0,m.style.justifyContent="flex-end")}}}d.current=p.scrollTop})})})]})});pne.displayName=rH;var yne="SelectGroup",[Tqe,Rqe]=h2(yne),Pqe=k.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,a=Dn();return u.jsx(Tqe,{scope:n,id:a,children:u.jsx(Ae.div,{role:"group","aria-labelledby":a,...o,ref:t})})});Pqe.displayName=yne;var mne="SelectLabel",gne=k.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,a=Rqe(mne,n);return u.jsx(Ae.div,{id:a.id,...o,ref:t})});gne.displayName=mne;var KR="SelectItem",[$qe,vne]=h2(KR),kne=k.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:a=!1,textValue:i,...s}=e,l=Rs(KR,n),d=Ps(KR,n),h=l.value===o,[p,m]=k.useState(i??""),[v,x]=k.useState(!1),M=ot(t,N=>{var A;return(A=d.itemRefCallback)==null?void 0:A.call(d,N,o,a)}),b=Dn(),C=k.useRef("touch"),_=()=>{a||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return u.jsx($qe,{scope:n,value:o,disabled:a,textId:b,isSelected:h,onItemTextChange:k.useCallback(N=>{m(A=>A||((N==null?void 0:N.textContent)??"").trim())},[]),children:u.jsx(WP.ItemSlot,{scope:n,value:o,disabled:a,textValue:p,children:u.jsx(Ae.div,{role:"option","aria-labelledby":b,"data-highlighted":v?"":void 0,"aria-selected":h&&v,"data-state":h?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...s,ref:M,onFocus:Me(s.onFocus,()=>x(!0)),onBlur:Me(s.onBlur,()=>x(!1)),onClick:Me(s.onClick,()=>{C.current!=="mouse"&&_()}),onPointerUp:Me(s.onPointerUp,()=>{C.current==="mouse"&&_()}),onPointerDown:Me(s.onPointerDown,N=>{C.current=N.pointerType}),onPointerMove:Me(s.onPointerMove,N=>{var A;C.current=N.pointerType,a?(A=d.onItemLeave)==null||A.call(d):C.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Me(s.onPointerLeave,N=>{var A;N.currentTarget===document.activeElement&&((A=d.onItemLeave)==null||A.call(d))}),onKeyDown:Me(s.onKeyDown,N=>{var I;((I=d.searchRef)==null?void 0:I.current)!==""&&N.key===" "||(wqe.includes(N.key)&&_(),N.key===" "&&N.preventDefault())})})})})});kne.displayName=KR;var Df="SelectItemText",xne=k.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:a,...i}=e,s=Rs(Df,n),l=Ps(Df,n),d=vne(Df,n),h=Sqe(Df,n),[p,m]=k.useState(null),v=ot(t,_=>m(_),d.onItemTextChange,_=>{var N;return(N=l.itemTextRefCallback)==null?void 0:N.call(l,_,d.value,d.disabled)}),x=p==null?void 0:p.textContent,M=k.useMemo(()=>u.jsx("option",{value:d.value,disabled:d.disabled,children:x},d.value),[d.disabled,d.value,x]),{onNativeOptionAdd:b,onNativeOptionRemove:C}=h;return Gn(()=>(b(M),()=>C(M)),[b,C,M]),u.jsxs(u.Fragment,{children:[u.jsx(Ae.span,{id:d.textId,...i,ref:v}),d.isSelected&&s.valueNode&&!s.valueNodeHasChildren?f1.createPortal(i.children,s.valueNode):null]})});xne.displayName=Df;var wne="SelectItemIndicator",bne=k.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return vne(wne,n).isSelected?u.jsx(Ae.span,{"aria-hidden":!0,...o,ref:t}):null});bne.displayName=wne;var iH="SelectScrollUpButton",Mne=k.forwardRef((e,t)=>{const n=Ps(iH,e.__scopeSelect),o=KV(iH,e.__scopeSelect),[a,i]=k.useState(!1),s=ot(t,o.onScrollButtonChange);return Gn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const h=d.scrollTop>0;i(h)};const d=n.viewport;return l(),d.addEventListener("scroll",l),()=>d.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),a?u.jsx(Sne,{...e,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:d}=n;l&&d&&(l.scrollTop=l.scrollTop-d.offsetHeight)}}):null});Mne.displayName=iH;var sH="SelectScrollDownButton",_ne=k.forwardRef((e,t)=>{const n=Ps(sH,e.__scopeSelect),o=KV(sH,e.__scopeSelect),[a,i]=k.useState(!1),s=ot(t,o.onScrollButtonChange);return Gn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const h=d.scrollHeight-d.clientHeight,p=Math.ceil(d.scrollTop)<h;i(p)};const d=n.viewport;return l(),d.addEventListener("scroll",l),()=>d.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),a?u.jsx(Sne,{...e,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:d}=n;l&&d&&(l.scrollTop=l.scrollTop+d.offsetHeight)}}):null});_ne.displayName=sH;var Sne=k.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...a}=e,i=Ps("SelectScrollButton",n),s=k.useRef(null),l=KP(n),d=k.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return k.useEffect(()=>()=>d(),[d]),Gn(()=>{var p;const h=l().find(m=>m.ref.current===document.activeElement);(p=h==null?void 0:h.ref.current)==null||p.scrollIntoView({block:"nearest"})},[l]),u.jsx(Ae.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Me(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:Me(a.onPointerMove,()=>{var h;(h=i.onItemLeave)==null||h.call(i),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:Me(a.onPointerLeave,()=>{d()})})}),Dqe="SelectSeparator",Cne=k.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return u.jsx(Ae.div,{"aria-hidden":!0,...o,ref:t})});Cne.displayName=Dqe;var cH="SelectArrow",zqe=k.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,a=QP(n),i=Rs(cH,n),s=Ps(cH,n);return i.open&&s.position==="popper"?u.jsx(ZP,{...a,...o,ref:t}):null});zqe.displayName=cH;var Oqe="SelectBubbleInput",Nne=k.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const a=k.useRef(null),i=ot(o,a),s=YP(t);return k.useEffect(()=>{const l=a.current;if(!l)return;const d=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(d,"value").set;if(s!==t&&p){const m=new Event("change",{bubbles:!0});p.call(l,t),l.dispatchEvent(m)}},[s,t]),u.jsx(Ae.select,{...n,style:{...gee,...n.style},ref:i,defaultValue:t})});Nne.displayName=Oqe;function Lne(e){return e===""||e===void 0}function jne(e){const t=gn(e),n=k.useRef(""),o=k.useRef(0),a=k.useCallback(s=>{const l=n.current+s;t(l),function d(h){n.current=h,window.clearTimeout(o.current),h!==""&&(o.current=window.setTimeout(()=>d(""),1e3))}(l)},[t]),i=k.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return k.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,a,i]}function Ane(e,t,n){const a=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=qqe(e,Math.max(i,0));a.length===1&&(s=s.filter(h=>h!==n));const d=s.find(h=>h.textValue.toLowerCase().startsWith(a.toLowerCase()));return d!==n?d:void 0}function qqe(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Hqe=one,Ene=rne,Vqe=sne,Bqe=cne,Fqe=lne,Ine=une,Uqe=pne,Tne=gne,Rne=kne,Gqe=xne,Xqe=bne,Pne=Mne,$ne=_ne,Dne=Cne;const Wn=Hqe,Kn=Vqe,Fn=k.forwardRef(({className:e,children:t,...n},o)=>u.jsxs(Ene,{ref:o,className:ge("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,u.jsx(Bqe,{asChild:!0,children:u.jsx(Vd,{className:"h-4 w-4 opacity-50"})})]}));Fn.displayName=Ene.displayName;const zne=k.forwardRef(({className:e,...t},n)=>u.jsx(Pne,{ref:n,className:ge("flex cursor-default items-center justify-center py-1",e),...t,children:u.jsx(Wf,{className:"h-4 w-4"})}));zne.displayName=Pne.displayName;const One=k.forwardRef(({className:e,...t},n)=>u.jsx($ne,{ref:n,className:ge("flex cursor-default items-center justify-center py-1",e),...t,children:u.jsx(Vd,{className:"h-4 w-4"})}));One.displayName=$ne.displayName;const Un=k.forwardRef(({className:e,children:t,position:n="popper",...o},a)=>u.jsx(Fqe,{children:u.jsxs(Ine,{ref:a,className:ge("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...o,children:[u.jsx(zne,{}),u.jsx(Uqe,{className:ge("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),u.jsx(One,{})]})}));Un.displayName=Ine.displayName;const Zqe=k.forwardRef(({className:e,...t},n)=>u.jsx(Tne,{ref:n,className:ge("px-2 py-1.5 text-sm font-semibold",e),...t}));Zqe.displayName=Tne.displayName;const et=k.forwardRef(({className:e,children:t,...n},o)=>u.jsxs(Rne,{ref:o,className:ge("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[u.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:u.jsx(Xqe,{children:u.jsx(ri,{className:"h-4 w-4"})})}),u.jsx(Gqe,{children:t})]}));et.displayName=Rne.displayName;const Yqe=k.forwardRef(({className:e,...t},n)=>u.jsx(Dne,{ref:n,className:ge("-mx-1 my-1 h-px bg-muted",e),...t}));Yqe.displayName=Dne.displayName;const Nn=k.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ge("rounded-xl border bg-card text-card-foreground shadow",e),...t}));Nn.displayName="Card";const kn=k.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ge("flex flex-col space-y-1.5 p-6",e),...t}));kn.displayName="CardHeader";const xn=k.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ge("font-semibold leading-none tracking-tight",e),...t}));xn.displayName="CardTitle";const Qn=k.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ge("text-sm text-muted-foreground",e),...t}));Qn.displayName="CardDescription";const Ln=k.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ge("p-6 pt-0",e),...t}));Ln.displayName="CardContent";const JP=k.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ge("flex items-center p-6 pt-0",e),...t}));JP.displayName="CardFooter";function Wqe(e,t){return k.useReducer((n,o)=>t[n][o]??n,e)}var QV="ScrollArea",[qne,Dqt]=zn(QV),[Kqe,Sa]=qne(QV),Hne=k.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:o="hover",dir:a,scrollHideDelay:i=600,...s}=e,[l,d]=k.useState(null),[h,p]=k.useState(null),[m,v]=k.useState(null),[x,M]=k.useState(null),[b,C]=k.useState(null),[_,N]=k.useState(0),[A,I]=k.useState(0),[R,j]=k.useState(!1),[D,H]=k.useState(!1),U=ot(t,Z=>d(Z)),z=m1(a);return u.jsx(Kqe,{scope:n,type:o,dir:z,scrollHideDelay:i,scrollArea:l,viewport:h,onViewportChange:p,content:m,onContentChange:v,scrollbarX:x,onScrollbarXChange:M,scrollbarXEnabled:R,onScrollbarXEnabledChange:j,scrollbarY:b,onScrollbarYChange:C,scrollbarYEnabled:D,onScrollbarYEnabledChange:H,onCornerWidthChange:N,onCornerHeightChange:I,children:u.jsx(Ae.div,{dir:z,...s,ref:U,style:{position:"relative","--radix-scroll-area-corner-width":_+"px","--radix-scroll-area-corner-height":A+"px",...e.style}})})});Hne.displayName=QV;var Vne="ScrollAreaViewport",Bne=k.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:o,nonce:a,...i}=e,s=Sa(Vne,n),l=k.useRef(null),d=ot(t,l,s.onViewportChange);return u.jsxs(u.Fragment,{children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),u.jsx(Ae.div,{"data-radix-scroll-area-viewport":"",...i,ref:d,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:u.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});Bne.displayName=Vne;var Tr="ScrollAreaScrollbar",JV=k.forwardRef((e,t)=>{const{forceMount:n,...o}=e,a=Sa(Tr,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=a,l=e.orientation==="horizontal";return k.useEffect(()=>(l?i(!0):s(!0),()=>{l?i(!1):s(!1)}),[l,i,s]),a.type==="hover"?u.jsx(Qqe,{...o,ref:t,forceMount:n}):a.type==="scroll"?u.jsx(Jqe,{...o,ref:t,forceMount:n}):a.type==="auto"?u.jsx(Fne,{...o,ref:t,forceMount:n}):a.type==="always"?u.jsx(eB,{...o,ref:t}):null});JV.displayName=Tr;var Qqe=k.forwardRef((e,t)=>{const{forceMount:n,...o}=e,a=Sa(Tr,e.__scopeScrollArea),[i,s]=k.useState(!1);return k.useEffect(()=>{const l=a.scrollArea;let d=0;if(l){const h=()=>{window.clearTimeout(d),s(!0)},p=()=>{d=window.setTimeout(()=>s(!1),a.scrollHideDelay)};return l.addEventListener("pointerenter",h),l.addEventListener("pointerleave",p),()=>{window.clearTimeout(d),l.removeEventListener("pointerenter",h),l.removeEventListener("pointerleave",p)}}},[a.scrollArea,a.scrollHideDelay]),u.jsx(jn,{present:n||i,children:u.jsx(Fne,{"data-state":i?"visible":"hidden",...o,ref:t})})}),Jqe=k.forwardRef((e,t)=>{const{forceMount:n,...o}=e,a=Sa(Tr,e.__scopeScrollArea),i=e.orientation==="horizontal",s=t$(()=>d("SCROLL_END"),100),[l,d]=Wqe("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return k.useEffect(()=>{if(l==="idle"){const h=window.setTimeout(()=>d("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(h)}},[l,a.scrollHideDelay,d]),k.useEffect(()=>{const h=a.viewport,p=i?"scrollLeft":"scrollTop";if(h){let m=h[p];const v=()=>{const x=h[p];m!==x&&(d("SCROLL"),s()),m=x};return h.addEventListener("scroll",v),()=>h.removeEventListener("scroll",v)}},[a.viewport,i,d,s]),u.jsx(jn,{present:n||l!=="hidden",children:u.jsx(eB,{"data-state":l==="hidden"?"hidden":"visible",...o,ref:t,onPointerEnter:Me(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Me(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),Fne=k.forwardRef((e,t)=>{const n=Sa(Tr,e.__scopeScrollArea),{forceMount:o,...a}=e,[i,s]=k.useState(!1),l=e.orientation==="horizontal",d=t$(()=>{if(n.viewport){const h=n.viewport.offsetWidth<n.viewport.scrollWidth,p=n.viewport.offsetHeight<n.viewport.scrollHeight;s(l?h:p)}},10);return Zh(n.viewport,d),Zh(n.content,d),u.jsx(jn,{present:o||i,children:u.jsx(eB,{"data-state":i?"visible":"hidden",...a,ref:t})})}),eB=k.forwardRef((e,t)=>{const{orientation:n="vertical",...o}=e,a=Sa(Tr,e.__scopeScrollArea),i=k.useRef(null),s=k.useRef(0),[l,d]=k.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=Yne(l.viewport,l.content),p={...o,sizes:l,onSizesChange:d,hasThumb:h>0&&h<1,onThumbChange:v=>i.current=v,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:v=>s.current=v};function m(v,x){return rHe(v,s.current,l,x)}return n==="horizontal"?u.jsx(eHe,{...p,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const v=a.viewport.scrollLeft,x=QY(v,l,a.dir);i.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:v=>{a.viewport&&(a.viewport.scrollLeft=v)},onDragScroll:v=>{a.viewport&&(a.viewport.scrollLeft=m(v,a.dir))}}):n==="vertical"?u.jsx(tHe,{...p,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const v=a.viewport.scrollTop,x=QY(v,l);i.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:v=>{a.viewport&&(a.viewport.scrollTop=v)},onDragScroll:v=>{a.viewport&&(a.viewport.scrollTop=m(v))}}):null}),eHe=k.forwardRef((e,t)=>{const{sizes:n,onSizesChange:o,...a}=e,i=Sa(Tr,e.__scopeScrollArea),[s,l]=k.useState(),d=k.useRef(null),h=ot(t,d,i.onScrollbarXChange);return k.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),u.jsx(Gne,{"data-orientation":"horizontal",...a,ref:h,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":e$(n)+"px",...e.style},onThumbPointerDown:p=>e.onThumbPointerDown(p.x),onDragScroll:p=>e.onDragScroll(p.x),onWheelScroll:(p,m)=>{if(i.viewport){const v=i.viewport.scrollLeft+p.deltaX;e.onWheelScroll(v),Kne(v,m)&&p.preventDefault()}},onResize:()=>{d.current&&i.viewport&&s&&o({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:JR(s.paddingLeft),paddingEnd:JR(s.paddingRight)}})}})}),tHe=k.forwardRef((e,t)=>{const{sizes:n,onSizesChange:o,...a}=e,i=Sa(Tr,e.__scopeScrollArea),[s,l]=k.useState(),d=k.useRef(null),h=ot(t,d,i.onScrollbarYChange);return k.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),u.jsx(Gne,{"data-orientation":"vertical",...a,ref:h,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":e$(n)+"px",...e.style},onThumbPointerDown:p=>e.onThumbPointerDown(p.y),onDragScroll:p=>e.onDragScroll(p.y),onWheelScroll:(p,m)=>{if(i.viewport){const v=i.viewport.scrollTop+p.deltaY;e.onWheelScroll(v),Kne(v,m)&&p.preventDefault()}},onResize:()=>{d.current&&i.viewport&&s&&o({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:JR(s.paddingTop),paddingEnd:JR(s.paddingBottom)}})}})}),[nHe,Une]=qne(Tr),Gne=k.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:o,hasThumb:a,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:l,onThumbPositionChange:d,onDragScroll:h,onWheelScroll:p,onResize:m,...v}=e,x=Sa(Tr,n),[M,b]=k.useState(null),C=ot(t,U=>b(U)),_=k.useRef(null),N=k.useRef(""),A=x.viewport,I=o.content-o.viewport,R=gn(p),j=gn(d),D=t$(m,10);function H(U){if(_.current){const z=U.clientX-_.current.left,Z=U.clientY-_.current.top;h({x:z,y:Z})}}return k.useEffect(()=>{const U=z=>{const Z=z.target;(M==null?void 0:M.contains(Z))&&R(z,I)};return document.addEventListener("wheel",U,{passive:!1}),()=>document.removeEventListener("wheel",U,{passive:!1})},[A,M,I,R]),k.useEffect(j,[o,j]),Zh(M,D),Zh(x.content,D),u.jsx(nHe,{scope:n,scrollbar:M,hasThumb:a,onThumbChange:gn(i),onThumbPointerUp:gn(s),onThumbPositionChange:j,onThumbPointerDown:gn(l),children:u.jsx(Ae.div,{...v,ref:C,style:{position:"absolute",...v.style},onPointerDown:Me(e.onPointerDown,U=>{U.button===0&&(U.target.setPointerCapture(U.pointerId),_.current=M.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),H(U))}),onPointerMove:Me(e.onPointerMove,H),onPointerUp:Me(e.onPointerUp,U=>{const z=U.target;z.hasPointerCapture(U.pointerId)&&z.releasePointerCapture(U.pointerId),document.body.style.webkitUserSelect=N.current,x.viewport&&(x.viewport.style.scrollBehavior=""),_.current=null})})})}),QR="ScrollAreaThumb",Xne=k.forwardRef((e,t)=>{const{forceMount:n,...o}=e,a=Une(QR,e.__scopeScrollArea);return u.jsx(jn,{present:n||a.hasThumb,children:u.jsx(oHe,{ref:t,...o})})}),oHe=k.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:o,...a}=e,i=Sa(QR,n),s=Une(QR,n),{onThumbPositionChange:l}=s,d=ot(t,m=>s.onThumbChange(m)),h=k.useRef(void 0),p=t$(()=>{h.current&&(h.current(),h.current=void 0)},100);return k.useEffect(()=>{const m=i.viewport;if(m){const v=()=>{if(p(),!h.current){const x=iHe(m,l);h.current=x,l()}};return l(),m.addEventListener("scroll",v),()=>m.removeEventListener("scroll",v)}},[i.viewport,p,l]),u.jsx(Ae.div,{"data-state":s.hasThumb?"visible":"hidden",...a,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Me(e.onPointerDownCapture,m=>{const x=m.target.getBoundingClientRect(),M=m.clientX-x.left,b=m.clientY-x.top;s.onThumbPointerDown({x:M,y:b})}),onPointerUp:Me(e.onPointerUp,s.onThumbPointerUp)})});Xne.displayName=QR;var tB="ScrollAreaCorner",Zne=k.forwardRef((e,t)=>{const n=Sa(tB,e.__scopeScrollArea),o=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&o?u.jsx(aHe,{...e,ref:t}):null});Zne.displayName=tB;var aHe=k.forwardRef((e,t)=>{const{__scopeScrollArea:n,...o}=e,a=Sa(tB,n),[i,s]=k.useState(0),[l,d]=k.useState(0),h=!!(i&&l);return Zh(a.scrollbarX,()=>{var m;const p=((m=a.scrollbarX)==null?void 0:m.offsetHeight)||0;a.onCornerHeightChange(p),d(p)}),Zh(a.scrollbarY,()=>{var m;const p=((m=a.scrollbarY)==null?void 0:m.offsetWidth)||0;a.onCornerWidthChange(p),s(p)}),h?u.jsx(Ae.div,{...o,ref:t,style:{width:i,height:l,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function JR(e){return e?parseInt(e,10):0}function Yne(e,t){const n=e/t;return isNaN(n)?0:n}function e$(e){const t=Yne(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=(e.scrollbar.size-n)*t;return Math.max(o,18)}function rHe(e,t,n,o="ltr"){const a=e$(n),i=a/2,s=t||i,l=a-s,d=n.scrollbar.paddingStart+s,h=n.scrollbar.size-n.scrollbar.paddingEnd-l,p=n.content-n.viewport,m=o==="ltr"?[0,p]:[p*-1,0];return Wne([d,h],m)(e)}function QY(e,t,n="ltr"){const o=e$(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-a,s=t.content-t.viewport,l=i-o,d=n==="ltr"?[0,s]:[s*-1,0],h=eH(e,d);return Wne([0,s],[0,l])(h)}function Wne(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const o=(t[1]-t[0])/(e[1]-e[0]);return t[0]+o*(n-e[0])}}function Kne(e,t){return e>0&&e<t}var iHe=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},o=0;return function a(){const i={left:e.scrollLeft,top:e.scrollTop},s=n.left!==i.left,l=n.top!==i.top;(s||l)&&t(),n=i,o=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(o)};function t$(e,t){const n=gn(e),o=k.useRef(0);return k.useEffect(()=>()=>window.clearTimeout(o.current),[]),k.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(n,t)},[n,t])}function Zh(e,t){const n=gn(t);Gn(()=>{let o=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(n)});return a.observe(e),()=>{window.cancelAnimationFrame(o),a.unobserve(e)}}},[e,n])}var Qne=Hne,sHe=Bne,cHe=Zne;const f2=k.forwardRef(({className:e,children:t,...n},o)=>u.jsxs(Qne,{ref:o,className:ge("relative overflow-hidden",e),...n,children:[u.jsx(sHe,{className:"h-full w-full rounded-[inherit]",children:t}),u.jsx(Jne,{}),u.jsx(cHe,{})]}));f2.displayName=Qne.displayName;const Jne=k.forwardRef(({className:e,orientation:t="vertical",...n},o)=>u.jsx(JV,{ref:o,orientation:t,className:ge("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:u.jsx(Xne,{className:"relative flex-1 rounded-full bg-border"})}));Jne.displayName=JV.displayName;function lH({value:e=[],onChange:t,placeholder:n="Добавить элемент..."}){const o=(s,l)=>{const d=[...e];d[s]=l,t(d)},a=()=>{t([...e,""])},i=s=>{const l=[...e];l.splice(s,1),t(l)};return u.jsxs("div",{className:"space-y-2",children:[e.map((s,l)=>u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Ze,{value:s,onChange:d=>o(l,d.target.value),placeholder:n}),u.jsx(pe,{type:"button",variant:"ghost",size:"icon",onClick:()=>i(l),className:"text-muted-foreground hover:text-destructive shrink-0",children:u.jsx(xs,{className:"h-4 w-4"})})]},l)),u.jsxs(pe,{type:"button",variant:"outline",size:"sm",className:"w-full mt-2",onClick:a,children:[u.jsx(za,{className:"mr-2 h-4 w-4"}),"Добавить"]})]})}function eoe({bot:e,servers:t,onFormChange:n,onFormSubmit:o,isCreation:a=!1,isSaving:i=!1}){const[s,l]=k.useState({username:"",password:"",prefix:"@",note:"",serverId:"",owners:[],proxyHost:"",proxyPort:"",proxyUsername:"",proxyPassword:""}),d=le.useRef(!1);k.useEffect(()=>{var M;e&&(d.current=!1,l({username:e.username||"",password:"",prefix:e.prefix||"@",note:e.note||"",serverId:((M=e.serverId)==null?void 0:M.toString())||"",owners:e.owners?e.owners.split(",").map(b=>b.trim()).filter(Boolean):[],proxyHost:e.proxyHost||"",proxyPort:e.proxyPort||"",proxyUsername:e.proxyUsername||"",proxyPassword:""}))},[e]),k.useEffect(()=>{n&&(d.current?n(s):d.current=!0)},[s,n]);const h=M=>{const{name:b,value:C}=M.target;l(_=>({..._,[b]:C}))},p=M=>{l(b=>({...b,serverId:M}))},m=M=>{l(b=>({...b,owners:M}))},v=M=>{if(M.preventDefault(),o){const b={...s};Array.isArray(b.owners)&&(b.owners=b.owners.join(",")),b.password||delete b.password,b.proxyPassword||delete b.proxyPassword,o(b)}},x=!!o;return u.jsxs("form",{onSubmit:v,className:"flex flex-col h-full",children:[u.jsxs(kn,{children:[u.jsx(xn,{children:a?"Создание нового бота":"Основные настройки"}),u.jsx(Qn,{children:a?"Заполните информацию ниже, чтобы добавить нового бота в панель.":"Здесь вы можете изменить основные параметры бота."})]}),u.jsx(f2,{className:"flex-grow",children:u.jsxs(Ln,{className:"space-y-4 px-6 pb-6",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"username",children:"Имя бота"}),u.jsx(Ze,{id:"username",name:"username",value:s.username,onChange:h,required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"note",children:"Короткая заметка"}),u.jsx(Ze,{id:"note",name:"note",value:s.note,onChange:h,placeholder:"Например, Масед 1"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"password",children:"Пароль (введите для изменения)"}),u.jsx(Ze,{id:"password",name:"password",type:"password",value:s.password,onChange:h,placeholder:"••••••••"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"prefix",children:"Префикс команд"}),u.jsx(Ze,{id:"prefix",name:"prefix",value:s.prefix,onChange:h,required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"serverId",children:"Сервер"}),u.jsxs(Wn,{name:"serverId",value:s.serverId,onValueChange:p,required:!0,children:[u.jsx(Fn,{children:u.jsx(Kn,{placeholder:"Выберите сервер"})}),u.jsx(Un,{children:t.map(M=>u.jsxs(et,{value:M.id.toString(),children:[M.name," (",M.host,":",M.port,")"]},M.id))})]})]}),u.jsx(Gh,{className:"my-6"}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{children:"Владельцы бота (Owners)"}),u.jsx(lH,{value:s.owners,onChange:m,placeholder:"Никнейм владельца"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Владельцы имеют полный доступ ко всем командам этого бота, игнорируя любые ограничения."})]}),u.jsx(Gh,{className:"my-6"}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("h3",{className:"text-lg font-semibold",children:"Настройки прокси (SOCKS5)"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Оставьте поля пустыми, если прокси не требуется."}),u.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{htmlFor:"proxyHost",children:"Хост"}),u.jsx(Ze,{id:"proxyHost",name:"proxyHost",value:s.proxyHost||"",onChange:h,placeholder:"123.45.67.89"})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{htmlFor:"proxyPort",children:"Порт"}),u.jsx(Ze,{id:"proxyPort",name:"proxyPort",type:"number",value:s.proxyPort||"",onChange:h,placeholder:"1080"})]})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{htmlFor:"proxyUsername",children:"Логин"}),u.jsx(Ze,{id:"proxyUsername",name:"proxyUsername",value:s.proxyUsername||"",onChange:h})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{htmlFor:"proxyPassword",children:"Пароль прокси (введите для изменения)"}),u.jsx(Ze,{id:"proxyPassword",name:"proxyPassword",type:"password",value:s.proxyPassword,onChange:h,placeholder:"••••••••"})]})]})]})]})}),x&&u.jsx(JP,{className:"pt-6 border-t",children:u.jsx(pe,{type:"submit",disabled:i,className:"w-full",children:i?"Сохранение...":a?"Создать бота":"Сохранить изменения"})})]})}function lHe(e,t){if(e==null)return{};var n={},o=Object.keys(e),a,i;for(i=0;i<o.length;i++)a=o[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}var uHe=["color"],dHe=k.forwardRef(function(e,t){var n=e.color,o=n===void 0?"currentColor":n,a=lHe(e,uHe);return k.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),k.createElement("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))}),JY=1,hHe=.9,fHe=.8,pHe=.17,_O=.1,SO=.999,yHe=.9999,mHe=.99,gHe=/[\\\/_+.#"@\[\(\{&]/,vHe=/[\\\/_+.#"@\[\(\{&]/g,kHe=/[\s-]/,toe=/[\s-]/g;function uH(e,t,n,o,a,i,s){if(i===t.length)return a===e.length?JY:mHe;var l=`${a},${i}`;if(s[l]!==void 0)return s[l];for(var d=o.charAt(i),h=n.indexOf(d,a),p=0,m,v,x,M;h>=0;)m=uH(e,t,n,o,h+1,i+1,s),m>p&&(h===a?m*=JY:gHe.test(e.charAt(h-1))?(m*=fHe,x=e.slice(a,h-1).match(vHe),x&&a>0&&(m*=Math.pow(SO,x.length))):kHe.test(e.charAt(h-1))?(m*=hHe,M=e.slice(a,h-1).match(toe),M&&a>0&&(m*=Math.pow(SO,M.length))):(m*=pHe,a>0&&(m*=Math.pow(SO,h-a))),e.charAt(h)!==t.charAt(i)&&(m*=yHe)),(m<_O&&n.charAt(h-1)===o.charAt(i+1)||o.charAt(i+1)===o.charAt(i)&&n.charAt(h-1)!==o.charAt(i))&&(v=uH(e,t,n,o,h+1,i+2,s),v*_O>m&&(m=v*_O)),m>p&&(p=m),h=n.indexOf(d,h+1);return s[l]=p,p}function eW(e){return e.toLowerCase().replace(toe," ")}function xHe(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,uH(e,t,eW(e),eW(t),0,0,{})}var Mf='[cmdk-group=""]',CO='[cmdk-group-items=""]',wHe='[cmdk-group-heading=""]',noe='[cmdk-item=""]',tW=`${noe}:not([aria-disabled="true"])`,dH="cmdk-item-select",hh="data-value",bHe=(e,t,n)=>xHe(e,t,n),ooe=k.createContext(void 0),kp=()=>k.useContext(ooe),aoe=k.createContext(void 0),nB=()=>k.useContext(aoe),roe=k.createContext(void 0),ioe=k.forwardRef((e,t)=>{let n=fh(()=>{var F,T;return{search:"",value:(T=(F=e.value)!=null?F:e.defaultValue)!=null?T:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=fh(()=>new Set),a=fh(()=>new Map),i=fh(()=>new Map),s=fh(()=>new Set),l=soe(e),{label:d,children:h,value:p,onValueChange:m,filter:v,shouldFilter:x,loop:M,disablePointerSelection:b=!1,vimBindings:C=!0,..._}=e,N=Dn(),A=Dn(),I=Dn(),R=k.useRef(null),j=THe();s1(()=>{if(p!==void 0){let F=p.trim();n.current.value=F,D.emit()}},[p]),s1(()=>{j(6,G)},[]);let D=k.useMemo(()=>({subscribe:F=>(s.current.add(F),()=>s.current.delete(F)),snapshot:()=>n.current,setState:(F,T,K)=>{var Q,ne,te,ce;if(!Object.is(n.current[F],T)){if(n.current[F]=T,F==="search")q(),z(),j(1,Z);else if(F==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let me=document.getElementById(I);me?me.focus():(Q=document.getElementById(N))==null||Q.focus()}if(j(7,()=>{var me;n.current.selectedItemId=(me=E())==null?void 0:me.id,D.emit()}),K||j(5,G),((ne=l.current)==null?void 0:ne.value)!==void 0){let me=T??"";(ce=(te=l.current).onValueChange)==null||ce.call(te,me);return}}D.emit()}},emit:()=>{s.current.forEach(F=>F())}}),[]),H=k.useMemo(()=>({value:(F,T,K)=>{var Q;T!==((Q=i.current.get(F))==null?void 0:Q.value)&&(i.current.set(F,{value:T,keywords:K}),n.current.filtered.items.set(F,U(T,K)),j(2,()=>{z(),D.emit()}))},item:(F,T)=>(o.current.add(F),T&&(a.current.has(T)?a.current.get(T).add(F):a.current.set(T,new Set([F]))),j(3,()=>{q(),z(),n.current.value||Z(),D.emit()}),()=>{i.current.delete(F),o.current.delete(F),n.current.filtered.items.delete(F);let K=E();j(4,()=>{q(),(K==null?void 0:K.getAttribute("id"))===F&&Z(),D.emit()})}),group:F=>(a.current.has(F)||a.current.set(F,new Set),()=>{i.current.delete(F),a.current.delete(F)}),filter:()=>l.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:N,inputId:I,labelId:A,listInnerRef:R}),[]);function U(F,T){var K,Q;let ne=(Q=(K=l.current)==null?void 0:K.filter)!=null?Q:bHe;return F?ne(F,n.current.search,T):0}function z(){if(!n.current.search||l.current.shouldFilter===!1)return;let F=n.current.filtered.items,T=[];n.current.filtered.groups.forEach(Q=>{let ne=a.current.get(Q),te=0;ne.forEach(ce=>{let me=F.get(ce);te=Math.max(me,te)}),T.push([Q,te])});let K=R.current;O().sort((Q,ne)=>{var te,ce;let me=Q.getAttribute("id"),ke=ne.getAttribute("id");return((te=F.get(ke))!=null?te:0)-((ce=F.get(me))!=null?ce:0)}).forEach(Q=>{let ne=Q.closest(CO);ne?ne.appendChild(Q.parentElement===ne?Q:Q.closest(`${CO} > *`)):K.appendChild(Q.parentElement===K?Q:Q.closest(`${CO} > *`))}),T.sort((Q,ne)=>ne[1]-Q[1]).forEach(Q=>{var ne;let te=(ne=R.current)==null?void 0:ne.querySelector(`${Mf}[${hh}="${encodeURIComponent(Q[0])}"]`);te==null||te.parentElement.appendChild(te)})}function Z(){let F=O().find(K=>K.getAttribute("aria-disabled")!=="true"),T=F==null?void 0:F.getAttribute(hh);D.setState("value",T||void 0)}function q(){var F,T,K,Q;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=o.current.size;return}n.current.filtered.groups=new Set;let ne=0;for(let te of o.current){let ce=(T=(F=i.current.get(te))==null?void 0:F.value)!=null?T:"",me=(Q=(K=i.current.get(te))==null?void 0:K.keywords)!=null?Q:[],ke=U(ce,me);n.current.filtered.items.set(te,ke),ke>0&&ne++}for(let[te,ce]of a.current)for(let me of ce)if(n.current.filtered.items.get(me)>0){n.current.filtered.groups.add(te);break}n.current.filtered.count=ne}function G(){var F,T,K;let Q=E();Q&&(((F=Q.parentElement)==null?void 0:F.firstChild)===Q&&((K=(T=Q.closest(Mf))==null?void 0:T.querySelector(wHe))==null||K.scrollIntoView({block:"nearest"})),Q.scrollIntoView({block:"nearest"}))}function E(){var F;return(F=R.current)==null?void 0:F.querySelector(`${noe}[aria-selected="true"]`)}function O(){var F;return Array.from(((F=R.current)==null?void 0:F.querySelectorAll(tW))||[])}function P(F){let T=O()[F];T&&D.setState("value",T.getAttribute(hh))}function X(F){var T;let K=E(),Q=O(),ne=Q.findIndex(ce=>ce===K),te=Q[ne+F];(T=l.current)!=null&&T.loop&&(te=ne+F<0?Q[Q.length-1]:ne+F===Q.length?Q[0]:Q[ne+F]),te&&D.setState("value",te.getAttribute(hh))}function W(F){let T=E(),K=T==null?void 0:T.closest(Mf),Q;for(;K&&!Q;)K=F>0?EHe(K,Mf):IHe(K,Mf),Q=K==null?void 0:K.querySelector(tW);Q?D.setState("value",Q.getAttribute(hh)):X(F)}let V=()=>P(O().length-1),L=F=>{F.preventDefault(),F.metaKey?V():F.altKey?W(1):X(1)},Y=F=>{F.preventDefault(),F.metaKey?P(0):F.altKey?W(-1):X(-1)};return k.createElement(Ae.div,{ref:t,tabIndex:-1,..._,"cmdk-root":"",onKeyDown:F=>{var T;(T=_.onKeyDown)==null||T.call(_,F);let K=F.nativeEvent.isComposing||F.keyCode===229;if(!(F.defaultPrevented||K))switch(F.key){case"n":case"j":{C&&F.ctrlKey&&L(F);break}case"ArrowDown":{L(F);break}case"p":case"k":{C&&F.ctrlKey&&Y(F);break}case"ArrowUp":{Y(F);break}case"Home":{F.preventDefault(),P(0);break}case"End":{F.preventDefault(),V();break}case"Enter":{F.preventDefault();let Q=E();if(Q){let ne=new Event(dH);Q.dispatchEvent(ne)}}}}},k.createElement("label",{"cmdk-label":"",htmlFor:H.inputId,id:H.labelId,style:PHe},d),n$(e,F=>k.createElement(aoe.Provider,{value:D},k.createElement(ooe.Provider,{value:H},F))))}),MHe=k.forwardRef((e,t)=>{var n,o;let a=Dn(),i=k.useRef(null),s=k.useContext(roe),l=kp(),d=soe(e),h=(o=(n=d.current)==null?void 0:n.forceMount)!=null?o:s==null?void 0:s.forceMount;s1(()=>{if(!h)return l.item(a,s==null?void 0:s.id)},[h]);let p=coe(a,i,[e.value,e.children,i],e.keywords),m=nB(),v=js(j=>j.value&&j.value===p.current),x=js(j=>h||l.filter()===!1?!0:j.search?j.filtered.items.get(a)>0:!0);k.useEffect(()=>{let j=i.current;if(!(!j||e.disabled))return j.addEventListener(dH,M),()=>j.removeEventListener(dH,M)},[x,e.onSelect,e.disabled]);function M(){var j,D;b(),(D=(j=d.current).onSelect)==null||D.call(j,p.current)}function b(){m.setState("value",p.current,!0)}if(!x)return null;let{disabled:C,value:_,onSelect:N,forceMount:A,keywords:I,...R}=e;return k.createElement(Ae.div,{ref:ui(i,t),...R,id:a,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!v,"data-disabled":!!C,"data-selected":!!v,onPointerMove:C||l.getDisablePointerSelection()?void 0:b,onClick:C?void 0:M},e.children)}),_He=k.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:a,...i}=e,s=Dn(),l=k.useRef(null),d=k.useRef(null),h=Dn(),p=kp(),m=js(x=>a||p.filter()===!1?!0:x.search?x.filtered.groups.has(s):!0);s1(()=>p.group(s),[]),coe(s,l,[e.value,e.heading,d]);let v=k.useMemo(()=>({id:s,forceMount:a}),[a]);return k.createElement(Ae.div,{ref:ui(l,t),...i,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},n&&k.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),n$(e,x=>k.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},k.createElement(roe.Provider,{value:v},x))))}),SHe=k.forwardRef((e,t)=>{let{alwaysRender:n,...o}=e,a=k.useRef(null),i=js(s=>!s.search);return!n&&!i?null:k.createElement(Ae.div,{ref:ui(a,t),...o,"cmdk-separator":"",role:"separator"})}),CHe=k.forwardRef((e,t)=>{let{onValueChange:n,...o}=e,a=e.value!=null,i=nB(),s=js(h=>h.search),l=js(h=>h.selectedItemId),d=kp();return k.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),k.createElement(Ae.input,{ref:t,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":l,id:d.inputId,type:"text",value:a?e.value:s,onChange:h=>{a||i.setState("search",h.target.value),n==null||n(h.target.value)}})}),NHe=k.forwardRef((e,t)=>{let{children:n,label:o="Suggestions",...a}=e,i=k.useRef(null),s=k.useRef(null),l=js(h=>h.selectedItemId),d=kp();return k.useEffect(()=>{if(s.current&&i.current){let h=s.current,p=i.current,m,v=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let x=h.offsetHeight;p.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return v.observe(h),()=>{cancelAnimationFrame(m),v.unobserve(h)}}},[]),k.createElement(Ae.div,{ref:ui(i,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":o,id:d.listId},n$(e,h=>k.createElement("div",{ref:ui(s,d.listInnerRef),"cmdk-list-sizer":""},h)))}),LHe=k.forwardRef((e,t)=>{let{open:n,onOpenChange:o,overlayClassName:a,contentClassName:i,container:s,...l}=e;return k.createElement(OP,{open:n,onOpenChange:o},k.createElement(qP,{container:s},k.createElement(c2,{"cmdk-overlay":"",className:a}),k.createElement(l2,{"aria-label":e.label,"cmdk-dialog":"",className:i},k.createElement(ioe,{ref:t,...l}))))}),jHe=k.forwardRef((e,t)=>js(n=>n.filtered.count===0)?k.createElement(Ae.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),AHe=k.forwardRef((e,t)=>{let{progress:n,children:o,label:a="Loading...",...i}=e;return k.createElement(Ae.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},n$(e,s=>k.createElement("div",{"aria-hidden":!0},s)))}),Po=Object.assign(ioe,{List:NHe,Item:MHe,Input:CHe,Group:_He,Separator:SHe,Dialog:LHe,Empty:jHe,Loading:AHe});function EHe(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function IHe(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function soe(e){let t=k.useRef(e);return s1(()=>{t.current=e}),t}var s1=typeof window>"u"?k.useEffect:k.useLayoutEffect;function fh(e){let t=k.useRef();return t.current===void 0&&(t.current=e()),t}function js(e){let t=nB(),n=()=>e(t.snapshot());return k.useSyncExternalStore(t.subscribe,n,n)}function coe(e,t,n,o=[]){let a=k.useRef(),i=kp();return s1(()=>{var s;let l=(()=>{var h;for(let p of n){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(h=p.current.textContent)==null?void 0:h.trim():a.current}})(),d=o.map(h=>h.trim());i.value(e,l,d),(s=t.current)==null||s.setAttribute(hh,l),a.current=l}),a}var THe=()=>{let[e,t]=k.useState(),n=fh(()=>new Map);return s1(()=>{n.current.forEach(o=>o()),n.current=new Map},[e]),(o,a)=>{n.current.set(o,a),t({})}};function RHe(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function n$({asChild:e,children:t},n){return e&&k.isValidElement(t)?k.cloneElement(RHe(t),{ref:t.ref},n(t.props.children)):n(t)}var PHe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const xp=k.forwardRef(({className:e,...t},n)=>u.jsx(Po,{ref:n,className:ge("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));xp.displayName=Po.displayName;const $He=({children:e,...t})=>u.jsx(DV,{...t,children:u.jsx(Wt,{className:"overflow-hidden p-0",children:u.jsx(xp,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),wp=k.forwardRef(({className:e,...t},n)=>u.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[u.jsx(dHe,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),u.jsx(Po.Input,{ref:n,className:ge("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));wp.displayName=Po.Input.displayName;const bp=k.forwardRef(({className:e,...t},n)=>u.jsx(Po.List,{ref:n,className:ge("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));bp.displayName=Po.List.displayName;const Mp=k.forwardRef((e,t)=>u.jsx(Po.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));Mp.displayName=Po.Empty.displayName;const hs=k.forwardRef(({className:e,...t},n)=>u.jsx(Po.Group,{ref:n,className:ge("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));hs.displayName=Po.Group.displayName;const DHe=k.forwardRef(({className:e,...t},n)=>u.jsx(Po.Separator,{ref:n,className:ge("-mx-1 h-px bg-border",e),...t}));DHe.displayName=Po.Separator.displayName;const yr=k.forwardRef(({className:e,...t},n)=>u.jsx(Po.Item,{ref:n,className:ge("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground",e),...t}));yr.displayName=Po.Item.displayName;const zHe=()=>{const[e,t]=k.useState(!1),[n,o]=k.useState(""),[a,i]=k.useState({bots:[],users:[],plugins:[]}),[s,l]=k.useState(!1),d=je(M=>M.bots),h=je(M=>M.hasPermission),p=aa();k.useEffect(()=>{const M=b=>{b.key===" "&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),t(C=>!C))};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[]),k.useEffect(()=>{if(e)if(n){l(!0);const M=setTimeout(async()=>{try{const b=await Ne(`/api/search?query=${encodeURIComponent(n)}`);i(b)}catch(b){console.error("Search failed:",b),i({bots:[],users:[],plugins:[]})}finally{l(!1)}},300);return()=>clearTimeout(M)}else l(!1),i({bots:d,users:[],plugins:[]})},[n,e,d]);const m=k.useCallback(M=>{t(!1),M()},[]),v=M=>{var _;const b=((_=a[M])==null?void 0:_.length)||0;return b===0?null:`${{bots:"Боты",users:"Пользователи",plugins:"Плагины"}[M]} (${b})`},x=Object.values(a).some(M=>M.length>0);return u.jsxs($He,{open:e,onOpenChange:t,shouldFilter:!1,children:[u.jsx(en,{className:"sr-only",children:"Глобальный поиск"}),u.jsx(dn,{className:"sr-only",children:"Используйте эту палитру для быстрого поиска по ботам, пользователям и плагинам, а также для навигации по приложению."}),u.jsx(wp,{placeholder:"Искать или перейти к...",value:n,onValueChange:o}),u.jsx(bp,{children:s?u.jsx("div",{className:"p-6 text-center text-sm",children:"Загрузка..."}):u.jsxs(u.Fragment,{children:[!x&&n?u.jsx(Mp,{children:"Ничего не найдено."}):null,!n&&u.jsxs(hs,{heading:"Навигация",children:[u.jsxs(yr,{onSelect:()=>m(()=>p("/")),children:[u.jsx(Ah,{className:"mr-2 h-4 w-4"}),u.jsx("span",{children:"Дашборд"})]}),h("task:list")&&u.jsxs(yr,{onSelect:()=>m(()=>p("/tasks")),children:[u.jsx(Ch,{className:"mr-2 h-4 w-4"}),u.jsx("span",{children:"Планировщик"})]}),h("server:list")&&u.jsxs(yr,{onSelect:()=>m(()=>p("/servers")),children:[u.jsx(Ud,{className:"mr-2 h-4 w-4"}),u.jsx("span",{children:"Серверы"})]})]}),x&&!n&&u.jsx("div",{className:"border-b my-1"}),a.bots.length>0&&u.jsx(hs,{heading:v("bots"),children:a.bots.map(M=>u.jsxs(yr,{value:`bot-${M.username}`,onSelect:()=>m(()=>p(`/bots/${M.id}`)),children:[u.jsx(Hd,{className:"mr-2 h-4 w-4"}),u.jsx("span",{children:M.username}),M.note&&u.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:M.note})]},`bot-${M.id}`))}),a.users.length>0&&u.jsx(hs,{heading:v("users"),children:a.users.map(M=>u.jsxs(yr,{value:`user-${M.username}`,onSelect:()=>m(()=>p(`/bots/${M.botId}/management`)),children:[u.jsx(Wd,{className:"mr-2 h-4 w-4"}),u.jsxs("span",{children:[M.username," (для бота ID: ",M.botId,")"]})]},`user-${M.id}`))}),a.plugins.length>0&&u.jsx(hs,{heading:v("plugins"),children:a.plugins.map(M=>u.jsxs(yr,{value:`plugin-${M.name}`,onSelect:()=>m(()=>p(`/bots/${M.botId}/plugins`)),children:[u.jsx(vs,{className:"mr-2 h-4 w-4"}),u.jsxs("span",{children:[M.name," (установлен у бота ID: ",M.botId,")"]})]},`plugin-${M.id}`))})]})},n)]})};var NO="rovingFocusGroup.onEntryFocus",OHe={bubbles:!1,cancelable:!0},_p="RovingFocusGroup",[hH,loe,qHe]=dp(_p),[HHe,p2]=zn(_p,[qHe]),[VHe,BHe]=HHe(_p),uoe=k.forwardRef((e,t)=>u.jsx(hH.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(hH.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(FHe,{...e,ref:t})})}));uoe.displayName=_p;var FHe=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:a=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:h,preventScrollOnEntryFocus:p=!1,...m}=e,v=k.useRef(null),x=ot(t,v),M=m1(i),[b,C]=go({prop:s,defaultProp:l??null,onChange:d,caller:_p}),[_,N]=k.useState(!1),A=gn(h),I=loe(n),R=k.useRef(!1),[j,D]=k.useState(0);return k.useEffect(()=>{const H=v.current;if(H)return H.addEventListener(NO,A),()=>H.removeEventListener(NO,A)},[A]),u.jsx(VHe,{scope:n,orientation:o,dir:M,loop:a,currentTabStopId:b,onItemFocus:k.useCallback(H=>C(H),[C]),onItemShiftTab:k.useCallback(()=>N(!0),[]),onFocusableItemAdd:k.useCallback(()=>D(H=>H+1),[]),onFocusableItemRemove:k.useCallback(()=>D(H=>H-1),[]),children:u.jsx(Ae.div,{tabIndex:_||j===0?-1:0,"data-orientation":o,...m,ref:x,style:{outline:"none",...e.style},onMouseDown:Me(e.onMouseDown,()=>{R.current=!0}),onFocus:Me(e.onFocus,H=>{const U=!R.current;if(H.target===H.currentTarget&&U&&!_){const z=new CustomEvent(NO,OHe);if(H.currentTarget.dispatchEvent(z),!z.defaultPrevented){const Z=I().filter(P=>P.focusable),q=Z.find(P=>P.active),G=Z.find(P=>P.id===b),O=[q,G,...Z].filter(Boolean).map(P=>P.ref.current);foe(O,p)}}R.current=!1}),onBlur:Me(e.onBlur,()=>N(!1))})})}),doe="RovingFocusGroupItem",hoe=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:a=!1,tabStopId:i,children:s,...l}=e,d=Dn(),h=i||d,p=BHe(doe,n),m=p.currentTabStopId===h,v=loe(n),{onFocusableItemAdd:x,onFocusableItemRemove:M,currentTabStopId:b}=p;return k.useEffect(()=>{if(o)return x(),()=>M()},[o,x,M]),u.jsx(hH.ItemSlot,{scope:n,id:h,focusable:o,active:a,children:u.jsx(Ae.span,{tabIndex:m?0:-1,"data-orientation":p.orientation,...l,ref:t,onMouseDown:Me(e.onMouseDown,C=>{o?p.onItemFocus(h):C.preventDefault()}),onFocus:Me(e.onFocus,()=>p.onItemFocus(h)),onKeyDown:Me(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){p.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const _=XHe(C,p.orientation,p.dir);if(_!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let A=v().filter(I=>I.focusable).map(I=>I.ref.current);if(_==="last")A.reverse();else if(_==="prev"||_==="next"){_==="prev"&&A.reverse();const I=A.indexOf(C.currentTarget);A=p.loop?ZHe(A,I+1):A.slice(I+1)}setTimeout(()=>foe(A))}}),children:typeof s=="function"?s({isCurrentTabStop:m,hasTabStop:b!=null}):s})})});hoe.displayName=doe;var UHe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function GHe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function XHe(e,t,n){const o=GHe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return UHe[o]}function foe(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function ZHe(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var oB=uoe,aB=hoe,fH=["Enter"," "],YHe=["ArrowDown","PageUp","Home"],poe=["ArrowUp","PageDown","End"],WHe=[...YHe,...poe],KHe={ltr:[...fH,"ArrowRight"],rtl:[...fH,"ArrowLeft"]},QHe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Sp="Menu",[O0,JHe,eVe]=dp(Sp),[g1,o$]=zn(Sp,[eVe,Ts,p2]),a$=Ts(),yoe=p2(),[tVe,v1]=g1(Sp),[nVe,Cp]=g1(Sp),moe=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:a,onOpenChange:i,modal:s=!0}=e,l=a$(t),[d,h]=k.useState(null),p=k.useRef(!1),m=gn(i),v=m1(a);return k.useEffect(()=>{const x=()=>{p.current=!0,document.addEventListener("pointerdown",M,{capture:!0,once:!0}),document.addEventListener("pointermove",M,{capture:!0,once:!0})},M=()=>p.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",M,{capture:!0}),document.removeEventListener("pointermove",M,{capture:!0})}},[]),u.jsx(GP,{...l,children:u.jsx(tVe,{scope:t,open:n,onOpenChange:m,content:d,onContentChange:h,children:u.jsx(nVe,{scope:t,onClose:k.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:p,dir:v,modal:s,children:o})})})};moe.displayName=Sp;var oVe="MenuAnchor",rB=k.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,a=a$(n);return u.jsx(vp,{...a,...o,ref:t})});rB.displayName=oVe;var iB="MenuPortal",[aVe,goe]=g1(iB,{forceMount:void 0}),voe=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:a}=e,i=v1(iB,t);return u.jsx(aVe,{scope:t,forceMount:n,children:u.jsx(jn,{present:n||i.open,children:u.jsx(y1,{asChild:!0,container:a,children:o})})})};voe.displayName=iB;var wa="MenuContent",[rVe,sB]=g1(wa),koe=k.forwardRef((e,t)=>{const n=goe(wa,e.__scopeMenu),{forceMount:o=n.forceMount,...a}=e,i=v1(wa,e.__scopeMenu),s=Cp(wa,e.__scopeMenu);return u.jsx(O0.Provider,{scope:e.__scopeMenu,children:u.jsx(jn,{present:o||i.open,children:u.jsx(O0.Slot,{scope:e.__scopeMenu,children:s.modal?u.jsx(iVe,{...a,ref:t}):u.jsx(sVe,{...a,ref:t})})})})}),iVe=k.forwardRef((e,t)=>{const n=v1(wa,e.__scopeMenu),o=k.useRef(null),a=ot(t,o);return k.useEffect(()=>{const i=o.current;if(i)return DP(i)},[]),u.jsx(cB,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Me(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),sVe=k.forwardRef((e,t)=>{const n=v1(wa,e.__scopeMenu);return u.jsx(cB,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),cVe=Cs("MenuContent.ScrollLock"),cB=k.forwardRef((e,t)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEntryFocus:d,onEscapeKeyDown:h,onPointerDownOutside:p,onFocusOutside:m,onInteractOutside:v,onDismiss:x,disableOutsideScroll:M,...b}=e,C=v1(wa,n),_=Cp(wa,n),N=a$(n),A=yoe(n),I=JHe(n),[R,j]=k.useState(null),D=k.useRef(null),H=ot(t,D,C.onContentChange),U=k.useRef(0),z=k.useRef(""),Z=k.useRef(0),q=k.useRef(null),G=k.useRef("right"),E=k.useRef(0),O=M?pp:k.Fragment,P=M?{as:cVe,allowPinchZoom:!0}:void 0,X=V=>{var te,ce;const L=z.current+V,Y=I().filter(me=>!me.disabled),F=document.activeElement,T=(te=Y.find(me=>me.ref.current===F))==null?void 0:te.textValue,K=Y.map(me=>me.textValue),Q=xVe(K,L,T),ne=(ce=Y.find(me=>me.textValue===Q))==null?void 0:ce.ref.current;(function me(ke){z.current=ke,window.clearTimeout(U.current),ke!==""&&(U.current=window.setTimeout(()=>me(""),1e3))})(L),ne&&setTimeout(()=>ne.focus())};k.useEffect(()=>()=>window.clearTimeout(U.current),[]),PP();const W=k.useCallback(V=>{var Y,F;return G.current===((Y=q.current)==null?void 0:Y.side)&&bVe(V,(F=q.current)==null?void 0:F.area)},[]);return u.jsx(rVe,{scope:n,searchRef:z,onItemEnter:k.useCallback(V=>{W(V)&&V.preventDefault()},[W]),onItemLeave:k.useCallback(V=>{var L;W(V)||((L=D.current)==null||L.focus(),j(null))},[W]),onTriggerLeave:k.useCallback(V=>{W(V)&&V.preventDefault()},[W]),pointerGraceTimerRef:Z,onPointerGraceIntentChange:k.useCallback(V=>{q.current=V},[]),children:u.jsx(O,{...P,children:u.jsx(fp,{asChild:!0,trapped:a,onMountAutoFocus:Me(i,V=>{var L;V.preventDefault(),(L=D.current)==null||L.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:u.jsx(p1,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:h,onPointerDownOutside:p,onFocusOutside:m,onInteractOutside:v,onDismiss:x,children:u.jsx(oB,{asChild:!0,...A,dir:_.dir,orientation:"vertical",loop:o,currentTabStopId:R,onCurrentTabStopIdChange:j,onEntryFocus:Me(d,V=>{_.isUsingKeyboardRef.current||V.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(XP,{role:"menu","aria-orientation":"vertical","data-state":Poe(C.open),"data-radix-menu-content":"",dir:_.dir,...N,...b,ref:H,style:{outline:"none",...b.style},onKeyDown:Me(b.onKeyDown,V=>{const Y=V.target.closest("[data-radix-menu-content]")===V.currentTarget,F=V.ctrlKey||V.altKey||V.metaKey,T=V.key.length===1;Y&&(V.key==="Tab"&&V.preventDefault(),!F&&T&&X(V.key));const K=D.current;if(V.target!==K||!WHe.includes(V.key))return;V.preventDefault();const ne=I().filter(te=>!te.disabled).map(te=>te.ref.current);poe.includes(V.key)&&ne.reverse(),vVe(ne)}),onBlur:Me(e.onBlur,V=>{V.currentTarget.contains(V.target)||(window.clearTimeout(U.current),z.current="")}),onPointerMove:Me(e.onPointerMove,q0(V=>{const L=V.target,Y=E.current!==V.clientX;if(V.currentTarget.contains(L)&&Y){const F=V.clientX>E.current?"right":"left";G.current=F,E.current=V.clientX}}))})})})})})})});koe.displayName=wa;var lVe="MenuGroup",lB=k.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(Ae.div,{role:"group",...o,ref:t})});lB.displayName=lVe;var uVe="MenuLabel",xoe=k.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(Ae.div,{...o,ref:t})});xoe.displayName=uVe;var eP="MenuItem",nW="menu.itemSelect",r$=k.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:o,...a}=e,i=k.useRef(null),s=Cp(eP,e.__scopeMenu),l=sB(eP,e.__scopeMenu),d=ot(t,i),h=k.useRef(!1),p=()=>{const m=i.current;if(!n&&m){const v=new CustomEvent(nW,{bubbles:!0,cancelable:!0});m.addEventListener(nW,x=>o==null?void 0:o(x),{once:!0}),IV(m,v),v.defaultPrevented?h.current=!1:s.onClose()}};return u.jsx(woe,{...a,ref:d,disabled:n,onClick:Me(e.onClick,p),onPointerDown:m=>{var v;(v=e.onPointerDown)==null||v.call(e,m),h.current=!0},onPointerUp:Me(e.onPointerUp,m=>{var v;h.current||(v=m.currentTarget)==null||v.click()}),onKeyDown:Me(e.onKeyDown,m=>{const v=l.searchRef.current!=="";n||v&&m.key===" "||fH.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});r$.displayName=eP;var woe=k.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:a,...i}=e,s=sB(eP,n),l=yoe(n),d=k.useRef(null),h=ot(t,d),[p,m]=k.useState(!1),[v,x]=k.useState("");return k.useEffect(()=>{const M=d.current;M&&x((M.textContent??"").trim())},[i.children]),u.jsx(O0.ItemSlot,{scope:n,disabled:o,textValue:a??v,children:u.jsx(aB,{asChild:!0,...l,focusable:!o,children:u.jsx(Ae.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...i,ref:h,onPointerMove:Me(e.onPointerMove,q0(M=>{o?s.onItemLeave(M):(s.onItemEnter(M),M.defaultPrevented||M.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Me(e.onPointerLeave,q0(M=>s.onItemLeave(M))),onFocus:Me(e.onFocus,()=>m(!0)),onBlur:Me(e.onBlur,()=>m(!1))})})})}),dVe="MenuCheckboxItem",boe=k.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:o,...a}=e;return u.jsx(Noe,{scope:e.__scopeMenu,checked:n,children:u.jsx(r$,{role:"menuitemcheckbox","aria-checked":tP(n)?"mixed":n,...a,ref:t,"data-state":dB(n),onSelect:Me(a.onSelect,()=>o==null?void 0:o(tP(n)?!0:!n),{checkForDefaultPrevented:!1})})})});boe.displayName=dVe;var Moe="MenuRadioGroup",[hVe,fVe]=g1(Moe,{value:void 0,onValueChange:()=>{}}),_oe=k.forwardRef((e,t)=>{const{value:n,onValueChange:o,...a}=e,i=gn(o);return u.jsx(hVe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:u.jsx(lB,{...a,ref:t})})});_oe.displayName=Moe;var Soe="MenuRadioItem",Coe=k.forwardRef((e,t)=>{const{value:n,...o}=e,a=fVe(Soe,e.__scopeMenu),i=n===a.value;return u.jsx(Noe,{scope:e.__scopeMenu,checked:i,children:u.jsx(r$,{role:"menuitemradio","aria-checked":i,...o,ref:t,"data-state":dB(i),onSelect:Me(o.onSelect,()=>{var s;return(s=a.onValueChange)==null?void 0:s.call(a,n)},{checkForDefaultPrevented:!1})})})});Coe.displayName=Soe;var uB="MenuItemIndicator",[Noe,pVe]=g1(uB,{checked:!1}),Loe=k.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:o,...a}=e,i=pVe(uB,n);return u.jsx(jn,{present:o||tP(i.checked)||i.checked===!0,children:u.jsx(Ae.span,{...a,ref:t,"data-state":dB(i.checked)})})});Loe.displayName=uB;var yVe="MenuSeparator",joe=k.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(Ae.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});joe.displayName=yVe;var mVe="MenuArrow",Aoe=k.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,a=a$(n);return u.jsx(ZP,{...a,...o,ref:t})});Aoe.displayName=mVe;var gVe="MenuSub",[zqt,Eoe]=g1(gVe),zf="MenuSubTrigger",Ioe=k.forwardRef((e,t)=>{const n=v1(zf,e.__scopeMenu),o=Cp(zf,e.__scopeMenu),a=Eoe(zf,e.__scopeMenu),i=sB(zf,e.__scopeMenu),s=k.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:d}=i,h={__scopeMenu:e.__scopeMenu},p=k.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return k.useEffect(()=>p,[p]),k.useEffect(()=>{const m=l.current;return()=>{window.clearTimeout(m),d(null)}},[l,d]),u.jsx(rB,{asChild:!0,...h,children:u.jsx(woe,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":Poe(n.open),...e,ref:ui(t,a.onTriggerChange),onClick:m=>{var v;(v=e.onClick)==null||v.call(e,m),!(e.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Me(e.onPointerMove,q0(m=>{i.onItemEnter(m),!m.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),p()},100))})),onPointerLeave:Me(e.onPointerLeave,q0(m=>{var x,M;p();const v=(x=n.content)==null?void 0:x.getBoundingClientRect();if(v){const b=(M=n.content)==null?void 0:M.dataset.side,C=b==="right",_=C?-5:5,N=v[C?"left":"right"],A=v[C?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+_,y:m.clientY},{x:N,y:v.top},{x:A,y:v.top},{x:A,y:v.bottom},{x:N,y:v.bottom}],side:b}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Me(e.onKeyDown,m=>{var x;const v=i.searchRef.current!=="";e.disabled||v&&m.key===" "||KHe[o.dir].includes(m.key)&&(n.onOpenChange(!0),(x=n.content)==null||x.focus(),m.preventDefault())})})})});Ioe.displayName=zf;var Toe="MenuSubContent",Roe=k.forwardRef((e,t)=>{const n=goe(wa,e.__scopeMenu),{forceMount:o=n.forceMount,...a}=e,i=v1(wa,e.__scopeMenu),s=Cp(wa,e.__scopeMenu),l=Eoe(Toe,e.__scopeMenu),d=k.useRef(null),h=ot(t,d);return u.jsx(O0.Provider,{scope:e.__scopeMenu,children:u.jsx(jn,{present:o||i.open,children:u.jsx(O0.Slot,{scope:e.__scopeMenu,children:u.jsx(cB,{id:l.contentId,"aria-labelledby":l.triggerId,...a,ref:h,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{var m;s.isUsingKeyboardRef.current&&((m=d.current)==null||m.focus()),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:Me(e.onFocusOutside,p=>{p.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Me(e.onEscapeKeyDown,p=>{s.onClose(),p.preventDefault()}),onKeyDown:Me(e.onKeyDown,p=>{var x;const m=p.currentTarget.contains(p.target),v=QHe[s.dir].includes(p.key);m&&v&&(i.onOpenChange(!1),(x=l.trigger)==null||x.focus(),p.preventDefault())})})})})})});Roe.displayName=Toe;function Poe(e){return e?"open":"closed"}function tP(e){return e==="indeterminate"}function dB(e){return tP(e)?"indeterminate":e?"checked":"unchecked"}function vVe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function kVe(e,t){return e.map((n,o)=>e[(t+o)%e.length])}function xVe(e,t,n){const a=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=kVe(e,Math.max(i,0));a.length===1&&(s=s.filter(h=>h!==n));const d=s.find(h=>h.toLowerCase().startsWith(a.toLowerCase()));return d!==n?d:void 0}function wVe(e,t){const{x:n,y:o}=e;let a=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const l=t[i],d=t[s],h=l.x,p=l.y,m=d.x,v=d.y;p>o!=v>o&&n<(m-h)*(o-p)/(v-p)+h&&(a=!a)}return a}function bVe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return wVe(n,t)}function q0(e){return t=>t.pointerType==="mouse"?e(t):void 0}var $oe=moe,Doe=rB,zoe=voe,Ooe=koe,qoe=lB,Hoe=xoe,Voe=r$,Boe=boe,Foe=_oe,Uoe=Coe,Goe=Loe,Xoe=joe,Zoe=Aoe,Yoe=Ioe,Woe=Roe,i$="DropdownMenu",[MVe,Oqt]=zn(i$,[o$]),vo=o$(),[_Ve,Koe]=MVe(i$),Qoe=e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:a,defaultOpen:i,onOpenChange:s,modal:l=!0}=e,d=vo(t),h=k.useRef(null),[p,m]=go({prop:a,defaultProp:i??!1,onChange:s,caller:i$});return u.jsx(_Ve,{scope:t,triggerId:Dn(),triggerRef:h,contentId:Dn(),open:p,onOpenChange:m,onOpenToggle:k.useCallback(()=>m(v=>!v),[m]),modal:l,children:u.jsx($oe,{...d,open:p,onOpenChange:m,dir:o,modal:l,children:n})})};Qoe.displayName=i$;var Joe="DropdownMenuTrigger",eae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...a}=e,i=Koe(Joe,n),s=vo(n);return u.jsx(Doe,{asChild:!0,...s,children:u.jsx(Ae.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...a,ref:ui(t,i.triggerRef),onPointerDown:Me(e.onPointerDown,l=>{!o&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:Me(e.onKeyDown,l=>{o||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});eae.displayName=Joe;var SVe="DropdownMenuPortal",tae=e=>{const{__scopeDropdownMenu:t,...n}=e,o=vo(t);return u.jsx(zoe,{...o,...n})};tae.displayName=SVe;var nae="DropdownMenuContent",oae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=Koe(nae,n),i=vo(n),s=k.useRef(!1);return u.jsx(Ooe,{id:a.contentId,"aria-labelledby":a.triggerId,...i,...o,ref:t,onCloseAutoFocus:Me(e.onCloseAutoFocus,l=>{var d;s.current||(d=a.triggerRef.current)==null||d.focus(),s.current=!1,l.preventDefault()}),onInteractOutside:Me(e.onInteractOutside,l=>{const d=l.detail.originalEvent,h=d.button===0&&d.ctrlKey===!0,p=d.button===2||h;(!a.modal||p)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});oae.displayName=nae;var CVe="DropdownMenuGroup",NVe=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(qoe,{...a,...o,ref:t})});NVe.displayName=CVe;var LVe="DropdownMenuLabel",aae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Hoe,{...a,...o,ref:t})});aae.displayName=LVe;var jVe="DropdownMenuItem",rae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Voe,{...a,...o,ref:t})});rae.displayName=jVe;var AVe="DropdownMenuCheckboxItem",iae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Boe,{...a,...o,ref:t})});iae.displayName=AVe;var EVe="DropdownMenuRadioGroup",IVe=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Foe,{...a,...o,ref:t})});IVe.displayName=EVe;var TVe="DropdownMenuRadioItem",sae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Uoe,{...a,...o,ref:t})});sae.displayName=TVe;var RVe="DropdownMenuItemIndicator",cae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Goe,{...a,...o,ref:t})});cae.displayName=RVe;var PVe="DropdownMenuSeparator",lae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Xoe,{...a,...o,ref:t})});lae.displayName=PVe;var $Ve="DropdownMenuArrow",DVe=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Zoe,{...a,...o,ref:t})});DVe.displayName=$Ve;var zVe="DropdownMenuSubTrigger",uae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Yoe,{...a,...o,ref:t})});uae.displayName=zVe;var OVe="DropdownMenuSubContent",dae=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,a=vo(n);return u.jsx(Woe,{...a,...o,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});dae.displayName=OVe;var qVe=Qoe,HVe=eae,VVe=tae,hae=oae,fae=aae,pae=rae,yae=iae,mae=sae,gae=cae,vae=lae,kae=uae,xae=dae;const hB=qVe,fB=HVe,BVe=k.forwardRef(({className:e,inset:t,children:n,...o},a)=>u.jsxs(kae,{ref:a,className:ge("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...o,children:[n,u.jsx(Sh,{className:"ml-auto"})]}));BVe.displayName=kae.displayName;const FVe=k.forwardRef(({className:e,...t},n)=>u.jsx(xae,{ref:n,className:ge("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t}));FVe.displayName=xae.displayName;const s$=k.forwardRef(({className:e,sideOffset:t=4,...n},o)=>u.jsx(VVe,{children:u.jsx(hae,{ref:o,sideOffset:t,className:ge("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n})}));s$.displayName=hae.displayName;const ka=k.forwardRef(({className:e,inset:t,...n},o)=>u.jsx(pae,{ref:o,className:ge("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...n}));ka.displayName=pae.displayName;const UVe=k.forwardRef(({className:e,children:t,checked:n,...o},a)=>u.jsxs(yae,{ref:a,className:ge("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...o,children:[u.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:u.jsx(gae,{children:u.jsx(ri,{className:"h-4 w-4"})})}),t]}));UVe.displayName=yae.displayName;const GVe=k.forwardRef(({className:e,children:t,...n},o)=>u.jsxs(mae,{ref:o,className:ge("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[u.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:u.jsx(gae,{children:u.jsx(Bd,{className:"h-2 w-2 fill-current"})})}),t]}));GVe.displayName=mae.displayName;const XVe=k.forwardRef(({className:e,inset:t,...n},o)=>u.jsx(fae,{ref:o,className:ge("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));XVe.displayName=fae.displayName;const ZVe=k.forwardRef(({className:e,...t},n)=>u.jsx(vae,{ref:n,className:ge("-mx-1 my-1 h-px bg-muted",e),...t}));ZVe.displayName=vae.displayName;function YVe({isCollapsed:e}){const t=je(n=>n.setTheme);return u.jsxs(hB,{children:[u.jsx(fB,{asChild:!0,children:u.jsxs(pe,{variant:"ghost",size:e?"icon":"default",className:"w-full justify-start",children:[u.jsx(x0,{className:"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),u.jsx(h0,{className:"absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),u.jsx("span",{className:ge("ml-2",e&&"hidden"),children:"Тема"})]})}),u.jsxs(s$,{align:"end",children:[u.jsx(ka,{onClick:()=>t("light"),children:"Светлая"}),u.jsx(ka,{onClick:()=>t("dark"),children:"Тёмная"}),u.jsx(ka,{onClick:()=>t("system"),children:"Системная"})]})]})}const WVe=({onLinkClick:e,isCollapsed:t})=>{const n=je(l=>l.bots),o=je(l=>l.botStatuses),a=je(l=>l.hasPermission),i=({isActive:l})=>ge("flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium hover:bg-accent transition-colors",l?"bg-accent":"transparent",t&&"justify-center"),s=(l,d)=>u.jsxs(u.Fragment,{children:[l,u.jsx("span",{className:ge("truncate",t&&"hidden"),children:d})]});return u.jsxs("nav",{className:"flex-grow flex flex-col gap-1 overflow-y-auto pr-2",children:[u.jsx(Oa,{to:"/",end:!0,onClick:e,className:i,children:s(u.jsx(Ah,{className:"h-4 w-4 flex-shrink-0"}),"Дашборд")}),a("task:list")&&u.jsx(Oa,{to:"/tasks",onClick:e,className:i,children:s(u.jsx(Ch,{className:"h-4 w-4 flex-shrink-0"}),"Планировщик")}),u.jsx(Gh,{className:"my-2"}),!t&&u.jsx("p",{className:"px-3 py-1 text-xs font-semibold text-muted-foreground",children:"БОТЫ"}),n.map(l=>u.jsxs(Oa,{to:`/bots/${l.id}`,onClick:e,className:({isActive:d})=>ge("flex items-center gap-3 rounded-md px-3 py-2 text-sm hover:bg-accent",d?"bg-accent":"transparent",t&&"justify-center"),children:[u.jsx("span",{className:ge("w-2 h-2 rounded-full flex-shrink-0",o[l.id]==="running"?"bg-green-500 animate-pulse":"bg-gray-600")}),u.jsxs("div",{className:ge("flex flex-col overflow-hidden",t&&"hidden"),children:[u.jsx("span",{className:"font-medium truncate",children:l.username}),u.jsx("span",{className:"text-xs text-muted-foreground truncate",children:l.note||`${l.server.host}:${l.server.port}`})]})]},l.id))]})};function KVe(){const e=aa(),t=Er(),{toast:n}=Yt(),o=je(z=>z.user),a=je(z=>z.appVersion),i=je(z=>z.servers),s=je(z=>z.logout),l=je(z=>z.createBot),d=je(z=>z.fetchInitialData),h=je(z=>z.hasPermission),p=je(z=>z.theme),m=je(z=>z.setTheme),[v,x]=k.useState(!1),[M,b]=k.useState(!1),[C,_]=k.useState(!1),[N,A]=k.useState(!1),[I,R]=k.useState(()=>JSON.parse(localStorage.getItem("sidebar-collapsed"))||!1);k.useEffect(()=>{m(p)},[p,m]),k.useEffect(()=>{var z,Z;(z=t.state)!=null&&z.openCreateBotModal&&(x(!0),e(t.pathname,{replace:!0,state:{}})),(Z=t.state)!=null&&Z.openImportBotModal&&(b(!0),e(t.pathname,{replace:!0,state:{}}))},[t.state,e]),k.useEffect(()=>{localStorage.setItem("sidebar-collapsed",JSON.stringify(I))},[I]);const j=async z=>{A(!0);try{const Z=await l(z);Z&&(x(!1),_(!1),e(`/bots/${Z.id}`))}catch(Z){console.error("Не удалось создать бота:",Z)}finally{A(!1)}},D=z=>{b(!1),_(!1),d(),n({title:"Успех!",description:`Бот "${z.username}" успешно импортирован.`}),e(`/bots/${z.id}`)},H=()=>{_(!1),s()},U=z=>u.jsxs("div",{className:"flex flex-col h-full p-2",children:[u.jsxs("div",{className:ge("p-2 mb-2 flex items-center",z?"justify-center":"justify-between"),children:[u.jsxs("div",{className:ge(z&&"hidden"),children:[u.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:"BlockMine"}),u.jsxs("p",{className:"text-sm text-muted-foreground",children:["Пользователь: ",o==null?void 0:o.username]})]}),u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>R(!I),className:"hidden md:flex",children:I?u.jsx(Qf,{className:"h-5 w-5"}):u.jsx(Kf,{className:"h-5 w-5"})})]}),u.jsx(WVe,{onLinkClick:()=>_(!1),isCollapsed:z}),u.jsxs("div",{className:"mt-auto pt-2 border-t",children:[h("panel:user:list")&&u.jsxs(Oa,{to:"/admin",onClick:()=>_(!1),className:({isActive:Z})=>ge("flex items-center gap-2 rounded-md px-3 py-2 text-sm font-medium hover:bg-accent",Z?"bg-accent":"transparent",z&&"justify-center"),children:[u.jsx(Zd,{className:"h-4 w-4 flex-shrink-0"}),u.jsx("span",{className:ge(z&&"hidden"),children:"Администрирование"})]}),h("server:list")&&u.jsxs(Oa,{to:"/servers",onClick:()=>_(!1),className:({isActive:Z})=>ge("flex items-center gap-2 rounded-md px-3 py-2 text-sm font-medium hover:bg-accent",Z?"bg-accent":"transparent",z&&"justify-center"),children:[u.jsx(Ud,{className:"h-4 w-4 flex-shrink-0"}),u.jsx("span",{className:ge(z&&"hidden"),children:"Серверы"})]}),u.jsxs("div",{className:ge("flex flex-col gap-2 mt-2",z?"px-1":"px-3"),children:[h("bot:create")&&u.jsxs(Jt,{open:v,onOpenChange:x,children:[u.jsx(Ua,{asChild:!0,children:u.jsxs(pe,{variant:"outline",className:"w-full",size:z?"icon":"default",children:[u.jsx(za,{className:ge(!z&&"mr-2","h-4 w-4")}),!z&&"Создать бота"]})}),u.jsx(Wt,{className:"h-[90vh] flex flex-col",children:u.jsx(eoe,{servers:i,onFormSubmit:j,isSaving:N,isCreation:!0})})]}),h("bot:import")&&u.jsxs(Jt,{open:M,onOpenChange:b,children:[u.jsx(Ua,{asChild:!0,children:u.jsxs(pe,{variant:"outline",className:"w-full",size:z?"icon":"default",children:[u.jsx(wr,{className:ge(!z&&"mr-2","h-4 w-4")}),!z&&"Импорт бота"]})}),u.jsx($te,{onImportSuccess:D,onCancel:()=>b(!1)})]})]}),u.jsx(Gh,{className:"my-2"}),u.jsx(YVe,{isCollapsed:z}),u.jsxs(pe,{variant:"ghost",className:ge("w-full justify-start px-3",z&&"justify-center"),onClick:H,children:[u.jsx(c0,{className:ge(!z&&"mr-2","h-4 w-4")}),!z&&"Выйти"]}),u.jsx("div",{className:ge("mt-2 pt-2 border-t text-center text-xs text-muted-foreground",z&&"hidden"),children:u.jsxs("a",{href:"https://github.com/blockmineJS/blockmine",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 hover:text-foreground transition-colors",children:[u.jsx(ms,{className:"h-4 w-4"}),u.jsxs("span",{children:["BlockMine v",a]})]})})]})]});return u.jsxs("div",{className:ge("grid h-screen transition-[grid-template-columns] duration-300 ease-in-out",I?"md:grid-cols-[80px_1fr]":"md:grid-cols-[280px_1fr]"),children:[u.jsx(zHe,{}),u.jsxs("header",{className:"md:hidden flex items-center justify-between p-2 border-b",children:[u.jsx("h2",{className:"text-lg font-semibold tracking-tight ml-2",children:"BlockMine"}),u.jsxs(oOe,{open:C,onOpenChange:_,children:[u.jsx(aOe,{asChild:!0,children:u.jsx(pe,{variant:"ghost",size:"icon",children:u.jsx(l0,{className:"h-6 w-6"})})}),u.jsx(jte,{side:"left",className:"p-0 w-full max-w-xs flex",children:U(!1)})]})]}),u.jsx("aside",{className:"hidden md:block border-r",children:U(I)}),u.jsx("main",{className:"overflow-y-auto",children:u.jsx(bV,{})})]})}function QVe(){const e=je(v=>v.login),t=je(v=>v.isAuthenticated),n=aa(),[o,a]=k.useState(""),[i,s]=k.useState(""),[l,d]=k.useState(!1),[h,p]=k.useState("");k.useEffect(()=>{t&&n("/",{replace:!0})},[t,n]);const m=async v=>{v.preventDefault(),d(!0),p("");try{await e(o,i)}catch(x){p(x.message||"Не удалось войти.")}finally{d(!1)}};return u.jsx("div",{className:"flex items-center justify-center min-h-screen bg-background",children:u.jsxs(Nn,{className:"w-full max-w-sm",children:[u.jsxs(kn,{children:[u.jsx(xn,{className:"text-2xl",children:"Вход в BlockMine"}),u.jsx(Qn,{children:"Введите ваши учетные данные для доступа к панели."})]}),u.jsxs("form",{onSubmit:m,children:[u.jsxs(Ln,{className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"username",children:"Имя пользователя"}),u.jsx(Ze,{id:"username",value:o,onChange:v=>a(v.target.value),required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"password",children:"Пароль"}),u.jsx(Ze,{id:"password",type:"password",value:i,onChange:v=>s(v.target.value),required:!0,autoComplete:"current-password"})]}),h&&u.jsx("p",{className:"text-sm text-destructive",children:h})]}),u.jsx(JP,{children:u.jsxs(pe,{type:"submit",className:"w-full",disabled:l,children:[l&&u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}),"Войти"]})})]})]})})}function JVe(){const e=je(M=>M.setupAdmin),t=je(M=>M.isAuthenticated),n=aa(),[o,a]=k.useState(""),[i,s]=k.useState(""),[l,d]=k.useState(""),[h,p]=k.useState(!1),[m,v]=k.useState("");k.useEffect(()=>{t&&n("/",{replace:!0})},[t,n]);const x=async M=>{if(M.preventDefault(),i.length<4){v("Пароль должен содержать не менее 4 символов.");return}if(i!==l){v("Пароли не совпадают.");return}p(!0),v("");try{await e(o,i),Vt({title:"Добро пожаловать!",description:"Вы успешно вошли в систему."})}catch(b){v(b.message||"Не удалось создать аккаунт.")}finally{p(!1)}};return u.jsx("div",{className:"flex items-center justify-center min-h-screen bg-background",children:u.jsxs(Nn,{className:"w-full max-w-sm",children:[u.jsxs(kn,{children:[u.jsx(xn,{className:"text-2xl",children:"Первоначальная настройка"}),u.jsx(Qn,{children:"Создайте аккаунт администратора для панели BlockMine."})]}),u.jsxs("form",{onSubmit:x,children:[u.jsxs(Ln,{className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"username",children:"Имя администратора"}),u.jsx(Ze,{id:"username",value:o,onChange:M=>a(M.target.value),required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"password",children:"Пароль (мин. 4 символа)"}),u.jsx(Ze,{id:"password",type:"password",value:i,onChange:M=>s(M.target.value),required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"confirmPassword",children:"Подтвердите пароль"}),u.jsx(Ze,{id:"confirmPassword",type:"password",value:l,onChange:M=>d(M.target.value),required:!0})]}),m&&u.jsx("p",{className:"text-sm text-destructive",children:m})]}),u.jsx(JP,{children:u.jsxs(pe,{type:"submit",className:"w-full",disabled:h,children:[h&&u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}),"Создать"]})})]})]})})}function LO({title:e,value:t,icon:n,description:o,className:a}){return u.jsxs(Nn,{className:ge("hover:border-primary/50 transition-colors",a),children:[u.jsxs(kn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[u.jsx(xn,{className:"text-sm font-medium",children:e}),n&&u.jsx(n,{className:"h-4 w-4 text-muted-foreground"})]}),u.jsxs(Ln,{children:[u.jsx("div",{className:"text-2xl font-bold",children:t}),o&&u.jsx("p",{className:"text-xs text-muted-foreground",children:o})]})]})}const Ca=k.forwardRef(({className:e,...t},n)=>u.jsx("div",{className:"relative w-full overflow-auto",children:u.jsx("table",{ref:n,className:ge("w-full caption-bottom text-sm",e),...t})}));Ca.displayName="Table";const Na=k.forwardRef(({className:e,...t},n)=>u.jsx("thead",{ref:n,className:ge("[&_tr]:border-b",e),...t}));Na.displayName="TableHeader";const La=k.forwardRef(({className:e,...t},n)=>u.jsx("tbody",{ref:n,className:ge("[&_tr:last-child]:border-0",e),...t}));La.displayName="TableBody";const eBe=k.forwardRef(({className:e,...t},n)=>u.jsx("tfoot",{ref:n,className:ge("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));eBe.displayName="TableFooter";const Nt=k.forwardRef(({className:e,...t},n)=>u.jsx("tr",{ref:n,className:ge("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Nt.displayName="TableRow";const st=k.forwardRef(({className:e,...t},n)=>u.jsx("th",{ref:n,className:ge("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));st.displayName="TableHead";const Xe=k.forwardRef(({className:e,...t},n)=>u.jsx("td",{ref:n,className:ge("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Xe.displayName="TableCell";const tBe=k.forwardRef(({className:e,...t},n)=>u.jsx("caption",{ref:n,className:ge("mt-4 text-sm text-muted-foreground",e),...t}));tBe.displayName="TableCaption";function nBe({bots:e,botStatuses:t}){const{toast:n}=Yt(),o=aa(),a=async(i,s)=>{if(s==="restart"){try{await Ne(`/api/bots/${i.id}/stop`,{method:"POST"}),setTimeout(async()=>{await Ne(`/api/bots/${i.id}/start`,{method:"POST"}),n({title:"Команда отправлена",description:`Бот ${i.username} перезапускается.`})},2e3)}catch{}return}try{await Ne(`/api/bots/${i.id}/${s}`,{method:"POST"},`Команда ${s} отправлена боту.`)}catch{}};return u.jsxs(Nn,{className:"h-full flex flex-col",children:[u.jsxs(kn,{children:[u.jsx(xn,{children:"Все боты"}),u.jsx(Qn,{children:"Быстрое управление состоянием всех ботов в системе."})]}),u.jsx(Ln,{className:"flex-grow overflow-hidden",children:u.jsx("div",{className:"border rounded-lg h-full overflow-y-auto",children:u.jsxs(Ca,{children:[u.jsx(Na,{children:u.jsxs(Nt,{children:[u.jsx(st,{children:"Бот"}),u.jsx(st,{children:"Статус"}),u.jsx(st,{className:"text-right",children:"Действия"})]})}),u.jsx(La,{children:e.map(i=>{const s=t[i.id]||"stopped",l=s==="running";return u.jsxs(Nt,{children:[u.jsx(Xe,{className:"font-medium",children:i.username}),u.jsx(Xe,{children:u.jsx("span",{className:`px-2 py-1 text-xs rounded-md ${l?"bg-green-900 text-green-400":"bg-red-900 text-red-400"}`,children:s})}),u.jsx(Xe,{className:"text-right",children:u.jsxs(hB,{children:[u.jsx(fB,{asChild:!0,children:u.jsx(pe,{variant:"ghost",size:"icon",children:u.jsx(Qi,{className:"h-4 w-4"})})}),u.jsxs(s$,{align:"end",children:[u.jsxs(ka,{disabled:l,onClick:()=>a(i,"start"),children:[u.jsx(gs,{className:"mr-2"}),"Запустить"]}),u.jsxs(ka,{disabled:!l,onClick:()=>a(i,"stop"),className:"text-destructive",children:[u.jsx(ks,{className:"mr-2"}),"Остановить"]}),u.jsxs(ka,{disabled:!l,onClick:()=>a(i,"restart"),children:[u.jsx(Ih,{className:"mr-2"}),"Перезапустить"]}),u.jsxs(ka,{onClick:()=>o(`/bots/${i.id}/console`),children:[u.jsx(Yd,{className:"mr-2"}),"Консоль"]}),u.jsxs(ka,{onClick:()=>o(`/bots/${i.id}/settings`),children:[u.jsx(Gd,{className:"mr-2"}),"Настройки"]})]})]})})]},i.id)})})]})})})]})}const oBe=r2("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Xt({className:e,variant:t,...n}){return u.jsx("div",{className:ge(oBe({variant:t}),e),...n})}const oW=({value:e,max:t,colorClass:n})=>{const o=Math.min(100,e/t*100);return u.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:u.jsx("div",{className:`${n} h-2 rounded-full`,style:{width:`${o}%`}})})};function aBe({bots:e,resourceUsage:t}){const n=e.filter(o=>t[o.id]);return u.jsxs(Nn,{className:"h-full flex flex-col",children:[u.jsxs(kn,{children:[u.jsx(xn,{children:"Использование ресурсов"}),u.jsx(Qn,{children:"Нагрузка на CPU и использование RAM запущенными ботами."})]}),u.jsx(Ln,{className:"flex-grow overflow-y-auto",children:u.jsx("div",{className:"space-y-6",children:n.length>0?n.map(o=>{const a=t[o.id];return u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-2",children:[u.jsx("h4",{className:"font-semibold",children:o.username}),u.jsxs(Xt,{variant:"secondary",children:["ID: ",o.id]})]}),u.jsxs("div",{className:"space-y-3",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(e0,{className:"h-4 w-4 text-muted-foreground"}),u.jsx("div",{className:"flex-grow",children:u.jsx(oW,{value:a.cpu,max:100,colorClass:"bg-blue-500"})}),u.jsxs("span",{className:"text-sm font-mono w-16 text-right",children:[a.cpu.toFixed(1),"%"]})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(u0,{className:"h-4 w-4 text-muted-foreground"}),u.jsx("div",{className:"flex-grow",children:u.jsx(oW,{value:a.memory,max:500,colorClass:"bg-green-500"})}),u.jsxs("span",{className:"text-sm font-mono w-16 text-right",children:[a.memory.toFixed(1)," MB"]})]})]})]},o.id)}):u.jsx("p",{className:"text-sm text-muted-foreground text-center pt-8",children:"Нет запущенных ботов для мониторинга."})})})]})}function rBe(){const e=je(M=>M.bots),t=je(M=>M.botStatuses),n=je(M=>M.resourceUsage),o=je(M=>M.fetchInitialData),a=je(M=>M.startAllBots),i=je(M=>M.stopAllBots),s=je(M=>M.hasPermission),{toast:l}=Yt(),d=aa(),[h,p]=k.useState(!1),m=k.useMemo(()=>{const M=e.filter(b=>t[b.id]==="running").length;return{totalBots:e.length,runningBots:M,stoppedBots:e.length-M}},[e,t]),v=async M=>{const b=M==="start"?"запустить":"остановить";window.confirm(`Вы уверены, что хотите ${b} ВСЕХ ботов?`)&&(M==="start"?await a():await i())},x=M=>{p(!1),o(),l({title:"Успех!",description:`Бот "${M.username}" успешно импортирован.`}),d(`/bots/${M.id}`)};return u.jsxs("div",{className:"flex flex-col h-full w-full p-4 gap-4 overflow-y-auto",children:[u.jsxs("header",{className:"flex flex-col md:flex-row items-start md:items-center justify-between shrink-0 gap-4",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-3xl font-bold",children:"Дашборд"}),u.jsx("p",{className:"text-muted-foreground",children:"Общая сводка по вашей системе."})]}),u.jsxs("div",{className:"flex gap-2",children:[s("bot:import")&&u.jsxs(Jt,{open:h,onOpenChange:p,children:[u.jsx(Ua,{asChild:!0,children:u.jsxs(pe,{variant:"outline",children:[u.jsx(wr,{className:"mr-2"}),"Импорт"]})}),u.jsx($te,{onImportSuccess:x,onCancel:()=>p(!1)})]}),s("bot:start_stop")&&u.jsxs(u.Fragment,{children:[u.jsxs(pe,{onClick:()=>v("start"),children:[u.jsx(gs,{className:"mr-2"}),"Запустить всех"]}),u.jsxs(pe,{variant:"destructive",onClick:()=>v("stop"),children:[u.jsx(ks,{className:"mr-2"}),"Остановить всех"]})]})]})]}),u.jsxs("main",{className:"grid gap-4 lg:grid-cols-3 flex-grow",children:[u.jsxs("div",{className:"lg:col-span-1 space-y-4",children:[u.jsx(LO,{title:"Всего ботов",value:m.totalBots,icon:Hd}),u.jsx(LO,{title:"Запущено",value:m.runningBots,icon:gs,className:"hover:border-green-500"}),u.jsx(LO,{title:"Остановлено",value:m.stoppedBots,icon:ks,className:"hover:border-red-500"})]}),u.jsx("div",{className:"lg:col-span-1 min-h-[400px]",children:u.jsx(nBe,{bots:e,botStatuses:t})}),u.jsx("div",{className:"lg:col-span-1 min-h-[400px]",children:u.jsx(aBe,{bots:e,resourceUsage:n})})]})]})}var c$="Checkbox",[iBe,qqt]=zn(c$),[sBe,pB]=iBe(c$);function cBe(e){const{__scopeCheckbox:t,checked:n,children:o,defaultChecked:a,disabled:i,form:s,name:l,onCheckedChange:d,required:h,value:p="on",internal_do_not_use_render:m}=e,[v,x]=go({prop:n,defaultProp:a??!1,onChange:d,caller:c$}),[M,b]=k.useState(null),[C,_]=k.useState(null),N=k.useRef(!1),A=M?!!s||!!M.closest("form"):!0,I={checked:v,disabled:i,setChecked:x,control:M,setControl:b,name:l,form:s,value:p,hasConsumerStoppedPropagationRef:N,required:h,defaultChecked:ws(a)?!1:a,isFormControl:A,bubbleInput:C,setBubbleInput:_};return u.jsx(sBe,{scope:t,...I,children:lBe(m)?m(I):o})}var wae="CheckboxTrigger",bae=k.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...o},a)=>{const{control:i,value:s,disabled:l,checked:d,required:h,setControl:p,setChecked:m,hasConsumerStoppedPropagationRef:v,isFormControl:x,bubbleInput:M}=pB(wae,e),b=ot(a,p),C=k.useRef(d);return k.useEffect(()=>{const _=i==null?void 0:i.form;if(_){const N=()=>m(C.current);return _.addEventListener("reset",N),()=>_.removeEventListener("reset",N)}},[i,m]),u.jsx(Ae.button,{type:"button",role:"checkbox","aria-checked":ws(d)?"mixed":d,"aria-required":h,"data-state":Nae(d),"data-disabled":l?"":void 0,disabled:l,value:s,...o,ref:b,onKeyDown:Me(t,_=>{_.key==="Enter"&&_.preventDefault()}),onClick:Me(n,_=>{m(N=>ws(N)?!0:!N),M&&x&&(v.current=_.isPropagationStopped(),v.current||_.stopPropagation())})})});bae.displayName=wae;var yB=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:o,checked:a,defaultChecked:i,required:s,disabled:l,value:d,onCheckedChange:h,form:p,...m}=e;return u.jsx(cBe,{__scopeCheckbox:n,checked:a,defaultChecked:i,disabled:l,required:s,onCheckedChange:h,name:o,form:p,value:d,internal_do_not_use_render:({isFormControl:v})=>u.jsxs(u.Fragment,{children:[u.jsx(bae,{...m,ref:t,__scopeCheckbox:n}),v&&u.jsx(Cae,{__scopeCheckbox:n})]})})});yB.displayName=c$;var Mae="CheckboxIndicator",_ae=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:o,...a}=e,i=pB(Mae,n);return u.jsx(jn,{present:o||ws(i.checked)||i.checked===!0,children:u.jsx(Ae.span,{"data-state":Nae(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});_ae.displayName=Mae;var Sae="CheckboxBubbleInput",Cae=k.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:o,hasConsumerStoppedPropagationRef:a,checked:i,defaultChecked:s,required:l,disabled:d,name:h,value:p,form:m,bubbleInput:v,setBubbleInput:x}=pB(Sae,e),M=ot(n,x),b=YP(i),C=UP(o);k.useEffect(()=>{const N=v;if(!N)return;const A=window.HTMLInputElement.prototype,R=Object.getOwnPropertyDescriptor(A,"checked").set,j=!a.current;if(b!==i&&R){const D=new Event("click",{bubbles:j});N.indeterminate=ws(i),R.call(N,ws(i)?!1:i),N.dispatchEvent(D)}},[v,b,i,a]);const _=k.useRef(ws(i)?!1:i);return u.jsx(Ae.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??_.current,required:l,disabled:d,name:h,value:p,form:m,...t,tabIndex:-1,ref:M,style:{...t.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Cae.displayName=Sae;function lBe(e){return typeof e=="function"}function ws(e){return e==="indeterminate"}function Nae(e){return ws(e)?"indeterminate":e?"checked":"unchecked"}const ci=k.forwardRef(({className:e,...t},n)=>u.jsx(yB,{ref:n,className:ge("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:u.jsx(_ae,{className:ge("flex items-center justify-center text-current"),children:u.jsx(ri,{className:"h-4 w-4"})})}));ci.displayName=yB.displayName;function uBe({bot:e,onCancel:t}){const[n,o]=k.useState({includeCommands:!0,includePermissions:!0,includePluginFiles:!0}),a=(s,l)=>{o(d=>({...d,[s]:l}))},i=()=>{const s=new URLSearchParams(n).toString(),l=`/api/bots/${e.id}/export?${s}`;window.location.href=l,t()};return u.jsxs(Wt,{children:[u.jsxs(on,{children:[u.jsxs(en,{children:["Экспорт конфигурации: ",e.username]}),u.jsx(dn,{children:"Выберите данные, которые вы хотите включить в ZIP-архив."})]}),u.jsxs("div",{className:"py-4 space-y-4",children:[u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ci,{id:"includeCommands",checked:n.includeCommands,onCheckedChange:s=>a("includeCommands",s)}),u.jsx(_e,{htmlFor:"includeCommands",children:"Настройки команд (алиасы, кулдауны и т.д.)"})]}),u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ci,{id:"includePermissions",checked:n.includePermissions,onCheckedChange:s=>a("includePermissions",s)}),u.jsx(_e,{htmlFor:"includePermissions",children:"Пользователи и права доступа"})]}),u.jsxs("div",{className:"flex items-start space-x-2",children:[u.jsx(ci,{id:"includePluginFiles",checked:n.includePluginFiles,onCheckedChange:s=>a("includePluginFiles",s)}),u.jsxs("div",{className:"grid gap-1.5 leading-none",children:[u.jsx(_e,{htmlFor:"includePluginFiles",children:"Включить файлы плагинов"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Сохраняет не только список плагинов, но и их файлы, включая конфиги (например, `config.json`). Рекомендуется для полного бэкапа."})]})]})]}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:t,children:"Отмена"}),u.jsxs(pe,{onClick:i,children:[u.jsx(ii,{className:"mr-2 h-4 w-4"}),"Скачать архив"]})]})]})}var Lae="AlertDialog",[dBe,Hqt]=zn(Lae,[hte]),vi=hte(),jae=e=>{const{__scopeAlertDialog:t,...n}=e,o=vi(t);return u.jsx(OP,{...o,...n,modal:!0})};jae.displayName=Lae;var hBe="AlertDialogTrigger",Aae=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...o}=e,a=vi(n);return u.jsx(HV,{...a,...o,ref:t})});Aae.displayName=hBe;var fBe="AlertDialogPortal",Eae=e=>{const{__scopeAlertDialog:t,...n}=e,o=vi(t);return u.jsx(qP,{...o,...n})};Eae.displayName=fBe;var pBe="AlertDialogOverlay",Iae=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...o}=e,a=vi(n);return u.jsx(c2,{...a,...o,ref:t})});Iae.displayName=pBe;var $h="AlertDialogContent",[yBe,mBe]=dBe($h),gBe=fee("AlertDialogContent"),Tae=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:o,...a}=e,i=vi(n),s=k.useRef(null),l=ot(t,s),d=k.useRef(null);return u.jsx(Qze,{contentName:$h,titleName:Rae,docsSlug:"alert-dialog",children:u.jsx(yBe,{scope:n,cancelRef:d,children:u.jsxs(l2,{role:"alertdialog",...i,...a,ref:l,onOpenAutoFocus:Me(a.onOpenAutoFocus,h=>{var p;h.preventDefault(),(p=d.current)==null||p.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[u.jsx(gBe,{children:o}),u.jsx(kBe,{contentRef:s})]})})})});Tae.displayName=$h;var Rae="AlertDialogTitle",Pae=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...o}=e,a=vi(n);return u.jsx(yp,{...a,...o,ref:t})});Pae.displayName=Rae;var $ae="AlertDialogDescription",Dae=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...o}=e,a=vi(n);return u.jsx(mp,{...a,...o,ref:t})});Dae.displayName=$ae;var vBe="AlertDialogAction",zae=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...o}=e,a=vi(n);return u.jsx(HP,{...a,...o,ref:t})});zae.displayName=vBe;var Oae="AlertDialogCancel",qae=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...o}=e,{cancelRef:a}=mBe(Oae,n),i=vi(n),s=ot(t,a);return u.jsx(HP,{...i,...o,ref:s})});qae.displayName=Oae;var kBe=({contentRef:e})=>{const t=`\`${$h}\` requires a description for the component to be accessible for screen reader users.
8145
8145
 
8146
8146
  You can add a description to the \`${$h}\` by passing a \`${$ae}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
8147
8147
 
@@ -8161,7 +8161,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
8161
8161
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
8162
8162
  `},mW=t7t(r7t)(_re),i7t={config:o7t},s7t=function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return function(a){return n.reduceRight(function(i,s){return s(i)},a)}};function Sre(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],Sre(e[n],t[n]))}),hW(hW({},e),t)}var c7t={type:"cancelation",msg:"operation is manually canceled"};function EO(e){var t=!1,n=new Promise(function(o,a){e.then(function(i){return t?a(c7t):o(i)}),e.catch(a)});return n.cancel=function(){return t=!0},n}var l7t=JMt.create({config:e7t,isInitialized:!1,resolve:null,reject:null,monaco:null}),Cre=RMt(l7t,2),jp=Cre[0],x$=Cre[1];function u7t(e){var t=i7t.config(e),n=t.monaco,o=TMt(t,["monaco"]);x$(function(a){return{config:Sre(a.config,o),monaco:n}})}function d7t(){var e=jp(function(t){var n=t.monaco,o=t.isInitialized,a=t.resolve;return{monaco:n,isInitialized:o,resolve:a}});if(!e.isInitialized){if(x$({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),EO(IO);if(window.monaco&&window.monaco.editor)return Nre(window.monaco),e.resolve(window.monaco),EO(IO);s7t(h7t,p7t)(y7t)}return EO(IO)}function h7t(e){return document.body.appendChild(e)}function f7t(e){var t=document.createElement("script");return e&&(t.src=e),t}function p7t(e){var t=jp(function(o){var a=o.config,i=o.reject;return{config:a,reject:i}}),n=f7t("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function y7t(){var e=jp(function(n){var o=n.config,a=n.resolve,i=n.reject;return{config:o,resolve:a,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){Nre(n),e.resolve(n)},function(n){e.reject(n)})}function Nre(e){jp().monaco||x$({monaco:e})}function m7t(){return jp(function(e){var t=e.monaco;return t})}var IO=new Promise(function(e,t){return x$({resolve:e,reject:t})}),Lre={config:u7t,init:d7t,__getMonacoInstance:m7t},g7t={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},TO=g7t,v7t={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},k7t=v7t;function x7t({children:e}){return le.createElement("div",{style:k7t.container},e)}var w7t=x7t,b7t=w7t;function M7t({width:e,height:t,isEditorReady:n,loading:o,_ref:a,className:i,wrapperProps:s}){return le.createElement("section",{style:{...TO.wrapper,width:e,height:t},...s},!n&&le.createElement(b7t,null,o),le.createElement("div",{ref:a,style:{...TO.fullWidth,...!n&&TO.hide},className:i}))}var _7t=M7t,jre=k.memo(_7t);function S7t(e){k.useEffect(e,[])}var Are=S7t;function C7t(e,t,n=!0){let o=k.useRef(!0);k.useEffect(o.current||!n?()=>{o.current=!1}:e,t)}var Wo=C7t;function _0(){}function yh(e,t,n,o){return N7t(e,o)||L7t(e,t,n,o)}function N7t(e,t){return e.editor.getModel(Ere(e,t))}function L7t(e,t,n,o){return e.editor.createModel(t,n,o?Ere(e,o):void 0)}function Ere(e,t){return e.Uri.parse(t)}function j7t({original:e,modified:t,language:n,originalLanguage:o,modifiedLanguage:a,originalModelPath:i,modifiedModelPath:s,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:d=!1,theme:h="light",loading:p="Loading...",options:m={},height:v="100%",width:x="100%",className:M,wrapperProps:b={},beforeMount:C=_0,onMount:_=_0}){let[N,A]=k.useState(!1),[I,R]=k.useState(!0),j=k.useRef(null),D=k.useRef(null),H=k.useRef(null),U=k.useRef(_),z=k.useRef(C),Z=k.useRef(!1);Are(()=>{let O=Lre.init();return O.then(P=>(D.current=P)&&R(!1)).catch(P=>(P==null?void 0:P.type)!=="cancelation"&&console.error("Monaco initialization: error:",P)),()=>j.current?E():O.cancel()}),Wo(()=>{if(j.current&&D.current){let O=j.current.getOriginalEditor(),P=yh(D.current,e||"",o||n||"text",i||"");P!==O.getModel()&&O.setModel(P)}},[i],N),Wo(()=>{if(j.current&&D.current){let O=j.current.getModifiedEditor(),P=yh(D.current,t||"",a||n||"text",s||"");P!==O.getModel()&&O.setModel(P)}},[s],N),Wo(()=>{let O=j.current.getModifiedEditor();O.getOption(D.current.editor.EditorOption.readOnly)?O.setValue(t||""):t!==O.getValue()&&(O.executeEdits("",[{range:O.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),O.pushUndoStop())},[t],N),Wo(()=>{var O,P;(P=(O=j.current)==null?void 0:O.getModel())==null||P.original.setValue(e||"")},[e],N),Wo(()=>{let{original:O,modified:P}=j.current.getModel();D.current.editor.setModelLanguage(O,o||n||"text"),D.current.editor.setModelLanguage(P,a||n||"text")},[n,o,a],N),Wo(()=>{var O;(O=D.current)==null||O.editor.setTheme(h)},[h],N),Wo(()=>{var O;(O=j.current)==null||O.updateOptions(m)},[m],N);let q=k.useCallback(()=>{var X;if(!D.current)return;z.current(D.current);let O=yh(D.current,e||"",o||n||"text",i||""),P=yh(D.current,t||"",a||n||"text",s||"");(X=j.current)==null||X.setModel({original:O,modified:P})},[n,t,a,e,o,i,s]),G=k.useCallback(()=>{var O;!Z.current&&H.current&&(j.current=D.current.editor.createDiffEditor(H.current,{automaticLayout:!0,...m}),q(),(O=D.current)==null||O.editor.setTheme(h),A(!0),Z.current=!0)},[m,h,q]);k.useEffect(()=>{N&&U.current(j.current,D.current)},[N]),k.useEffect(()=>{!I&&!N&&G()},[I,N,G]);function E(){var P,X,W,V;let O=(P=j.current)==null?void 0:P.getModel();l||((X=O==null?void 0:O.original)==null||X.dispose()),d||((W=O==null?void 0:O.modified)==null||W.dispose()),(V=j.current)==null||V.dispose()}return le.createElement(jre,{width:x,height:v,isEditorReady:N,loading:p,_ref:H,className:M,wrapperProps:b})}var A7t=j7t;k.memo(A7t);function E7t(e){let t=k.useRef();return k.useEffect(()=>{t.current=e},[e]),t.current}var I7t=E7t,cm=new Map;function T7t({defaultValue:e,defaultLanguage:t,defaultPath:n,value:o,language:a,path:i,theme:s="light",line:l,loading:d="Loading...",options:h={},overrideServices:p={},saveViewState:m=!0,keepCurrentModel:v=!1,width:x="100%",height:M="100%",className:b,wrapperProps:C={},beforeMount:_=_0,onMount:N=_0,onChange:A,onValidate:I=_0}){let[R,j]=k.useState(!1),[D,H]=k.useState(!0),U=k.useRef(null),z=k.useRef(null),Z=k.useRef(null),q=k.useRef(N),G=k.useRef(_),E=k.useRef(),O=k.useRef(o),P=I7t(i),X=k.useRef(!1),W=k.useRef(!1);Are(()=>{let Y=Lre.init();return Y.then(F=>(U.current=F)&&H(!1)).catch(F=>(F==null?void 0:F.type)!=="cancelation"&&console.error("Monaco initialization: error:",F)),()=>z.current?L():Y.cancel()}),Wo(()=>{var F,T,K,Q;let Y=yh(U.current,e||o||"",t||a||"",i||n||"");Y!==((F=z.current)==null?void 0:F.getModel())&&(m&&cm.set(P,(T=z.current)==null?void 0:T.saveViewState()),(K=z.current)==null||K.setModel(Y),m&&((Q=z.current)==null||Q.restoreViewState(cm.get(i))))},[i],R),Wo(()=>{var Y;(Y=z.current)==null||Y.updateOptions(h)},[h],R),Wo(()=>{!z.current||o===void 0||(z.current.getOption(U.current.editor.EditorOption.readOnly)?z.current.setValue(o):o!==z.current.getValue()&&(W.current=!0,z.current.executeEdits("",[{range:z.current.getModel().getFullModelRange(),text:o,forceMoveMarkers:!0}]),z.current.pushUndoStop(),W.current=!1))},[o],R),Wo(()=>{var F,T;let Y=(F=z.current)==null?void 0:F.getModel();Y&&a&&((T=U.current)==null||T.editor.setModelLanguage(Y,a))},[a],R),Wo(()=>{var Y;l!==void 0&&((Y=z.current)==null||Y.revealLine(l))},[l],R),Wo(()=>{var Y;(Y=U.current)==null||Y.editor.setTheme(s)},[s],R);let V=k.useCallback(()=>{var Y;if(!(!Z.current||!U.current)&&!X.current){G.current(U.current);let F=i||n,T=yh(U.current,o||e||"",t||a||"",F||"");z.current=(Y=U.current)==null?void 0:Y.editor.create(Z.current,{model:T,automaticLayout:!0,...h},p),m&&z.current.restoreViewState(cm.get(F)),U.current.editor.setTheme(s),l!==void 0&&z.current.revealLine(l),j(!0),X.current=!0}},[e,t,n,o,a,i,h,p,m,s,l]);k.useEffect(()=>{R&&q.current(z.current,U.current)},[R]),k.useEffect(()=>{!D&&!R&&V()},[D,R,V]),O.current=o,k.useEffect(()=>{var Y,F;R&&A&&((Y=E.current)==null||Y.dispose(),E.current=(F=z.current)==null?void 0:F.onDidChangeModelContent(T=>{W.current||A(z.current.getValue(),T)}))},[R,A]),k.useEffect(()=>{if(R){let Y=U.current.editor.onDidChangeMarkers(F=>{var K;let T=(K=z.current.getModel())==null?void 0:K.uri;if(T&&F.find(Q=>Q.path===T.path)){let Q=U.current.editor.getModelMarkers({resource:T});I==null||I(Q)}});return()=>{Y==null||Y.dispose()}}return()=>{}},[R,I]);function L(){var Y,F;(Y=E.current)==null||Y.dispose(),v?m&&cm.set(i,z.current.saveViewState()):(F=z.current.getModel())==null||F.dispose(),z.current.dispose()}return le.createElement(jre,{width:x,height:M,isEditorReady:R,loading:d,_ref:Z,className:b,wrapperProps:C})}var R7t=T7t,P7t=k.memo(R7t),wB=P7t;function $7t({initialValue:e,onSave:t,onCancel:n}){const[o,a]=k.useState("");k.useEffect(()=>{try{const l=JSON.stringify(e,null,2);a(l)}catch{a(Array.isArray(e)?"[]":"{}")}},[e]);const i=()=>{try{const l=JSON.parse(o);t(l)}catch{alert("Ошибка: Невалидный JSON. Проверьте синтаксис.")}},s=()=>{try{const l=JSON.parse(o),d=JSON.stringify(l,null,2);a(d)}catch{}};return u.jsxs(Wt,{className:"max-w-3xl",children:[u.jsxs(on,{children:[u.jsx(en,{children:"Редактор конфигурации JSON"}),u.jsx(dn,{children:"Внесите изменения и сохраните. Редактор подсветит синтаксические ошибки."})]}),u.jsx("div",{className:"py-4 relative",children:u.jsx(wB,{height:"60vh",language:"json",value:o,onChange:l=>a(l||""),theme:"vs-dark",options:{minimap:{enabled:!1},fontSize:14,wordWrap:"on",automaticLayout:!0}})}),u.jsxs(an,{className:"justify-between sm:justify-between",children:[u.jsxs(pe,{variant:"outline",onClick:s,children:[u.jsx(Nh,{className:"mr-2"}),"Форматировать"]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx(pe,{variant:"ghost",onClick:n,children:"Отмена"}),u.jsxs(pe,{onClick:i,children:[u.jsx(si,{className:"mr-2"}),"Применить и сохранить"]})]})]})]})}function D7t({settingKey:e,config:t,value:n,onChange:o}){const a=`${e}-input`,[i,s]=k.useState(!1);switch(t.type){case"string":return u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:a,children:t.label}),u.jsx(Ze,{id:a,value:n||"",onChange:l=>o(e,l.target.value)}),u.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]});case"string[]":return u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:a,children:t.label}),u.jsx(ki,{id:a,value:Array.isArray(n)?n.join(`
8163
8163
  `):"",onChange:l=>o(e,l.target.value.split(`
8164
- `))}),u.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]});case"boolean":return u.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3 shadow-sm",children:[u.jsxs("div",{className:"space-y-0.5",children:[u.jsx(_e,{htmlFor:a,className:"cursor-pointer",children:t.label}),u.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]}),u.jsx(na,{id:a,checked:!!n,onCheckedChange:l=>o(e,l)})]});case"number":return u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:a,children:t.label}),u.jsx(Ze,{id:a,type:"number",value:n??"",onChange:l=>o(e,l.target.value===""?null:l.target.valueAsNumber)}),u.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]});case"json":case"json_file":return u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{children:t.label}),u.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[u.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),u.jsxs(Jt,{open:i,onOpenChange:s,children:[u.jsx(Ua,{asChild:!0,children:u.jsxs(pe,{variant:"outline",children:[u.jsx(pn,{className:"mr-2 h-4 w-4"})," Редактировать"]})}),u.jsx($7t,{initialValue:n,onSave:l=>{o(e,l),s(!1)},onCancel:()=>s(!1)})]})]})]});default:return u.jsxs("p",{className:"text-destructive",children:["Неизвестный тип настройки: ",t.type]})}}function z7t({bot:e,plugin:t,onOpenChange:n,onSaveSuccess:o}){var p;const[a,i]=k.useState(null),{toast:s}=Yt(),l=((p=t.manifest)==null?void 0:p.settings)||{};k.useEffect(()=>{(async()=>{i(null);try{const v=await Ne(`/api/bots/${e.id}/plugins/${t.id}/settings`);i(v)}catch(v){s({variant:"destructive",title:"Ошибка",description:v.message}),i({})}})()},[e.id,t.id,s]);const d=(m,v)=>{i(x=>({...x,[m]:v}))},h=async()=>{try{await Ne(`/api/bots/${e.id}/plugins/${t.id}`,{method:"PUT",body:JSON.stringify({settings:a})},"Настройки плагина сохранены."),o(),n(!1)}catch{}};return u.jsxs(Wt,{className:"max-w-2xl",children:[u.jsxs(on,{children:[u.jsxs(en,{children:["Настройки плагина: ",t.name]}),u.jsx(dn,{children:"Изменения вступят в силу после перезапуска бота."})]}),u.jsx("div",{className:"py-4 space-y-4 max-h-[60vh] overflow-y-auto pr-2",children:a===null?u.jsx("p",{children:"Загрузка настроек..."}):Object.keys(l).length>0?Object.entries(l).map(([m,v])=>u.jsx(D7t,{settingKey:m,config:v,value:a[m],onChange:d},m)):u.jsx("p",{children:"У этого плагина нет настраиваемых параметров."})}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:()=>n(!1),children:"Отмена"}),u.jsx(pe,{onClick:h,children:"Сохранить"})]})]})}function O7t({plugin:e,botId:t,updateInfo:n,onToggle:o,onDelete:a,onUpdate:i,onOpenSettings:s,onFork:l}){var M,b,C;const d=aa(),h=((M=e.manifest)==null?void 0:M.settings)&&Object.keys(e.manifest.settings).length>0,p=i.isUpdating===e.id,m=e.sourceType==="LOCAL"||e.sourceType==="LOCAL_IDE",v=e.sourceType==="GITHUB",x=k.useMemo(()=>{if(!e.createdAt)return!1;const _=new Date(e.createdAt),N=new Date,A=24*60*60*1e3;return N-_<A},[e.createdAt]);return u.jsxs("div",{className:"flex items-start gap-4 p-4 border-b transition-colors hover:bg-muted/50 last:border-b-0",children:[u.jsxs("div",{className:"flex-grow",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("h3",{className:"font-semibold text-lg",children:e.name}),x&&u.jsxs(is,{children:[u.jsx(ss,{children:u.jsxs(Xt,{variant:"success",className:"bg-green-600/80 hover:bg-green-600",children:[u.jsx(ts,{className:"h-3 w-3 mr-1"}),"Новое"]})}),u.jsx(ni,{children:"Установлен менее 24 часов назад"})]})]}),u.jsxs("p",{className:"text-sm text-muted-foreground",children:["от ",u.jsx("span",{className:"font-medium text-primary/90",children:e.author||"Неизвестный автор"})]}),u.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:e.description||"Нет описания."}),u.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-3",children:[u.jsxs(Xt,{variant:"outline",children:["v",e.version]}),u.jsx(Xt,{variant:e.sourceType==="LOCAL"?"secondary":"default",children:e.sourceType}),(C=(b=e.manifest)==null?void 0:b.categories)==null?void 0:C.map(_=>u.jsx(Xt,{variant:"secondary",children:_},_)),n&&u.jsxs(pe,{size:"sm",variant:"ghost",className:"h-auto px-2 py-1 text-green-400 hover:bg-green-900/50 hover:text-green-300",onClick:()=>i.handle(e.id),disabled:p,children:[p?u.jsx(It,{className:"h-4 w-4 mr-1 animate-spin"}):u.jsx(ti,{className:"h-4 w-4 mr-1"}),"Обновить до v",n.recommendedVersion]})]})]}),u.jsxs("div",{className:"flex items-center gap-2 shrink-0 ml-4",children:[m&&u.jsxs(is,{children:[u.jsx(ss,{asChild:!0,children:u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>d(`/bots/${t}/plugins/edit/${e.name}`),children:u.jsx(Nh,{className:"h-4 w-4"})})}),u.jsx(ni,{children:u.jsx("p",{children:"Редактировать код"})})]}),v&&u.jsxs(is,{children:[u.jsx(ss,{asChild:!0,children:u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>l(e),children:u.jsx(ps,{className:"h-4 w-4"})})}),u.jsx(ni,{children:u.jsx("p",{children:"Создать локальную копию для редактирования"})})]}),h&&u.jsxs(is,{children:[u.jsx(ss,{asChild:!0,children:u.jsx(pe,{variant:"ghost",size:"icon",disabled:!e.isEnabled,onClick:()=>s(e),children:u.jsx(Gd,{className:"h-4 w-4"})})}),u.jsx(ni,{children:u.jsx("p",{children:"Настройки плагина"})})]}),u.jsxs(is,{children:[u.jsx(ss,{asChild:!0,children:u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>a(e),disabled:e.isEnabled,children:u.jsx(mo,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"})})}),u.jsx(ni,{children:u.jsx("p",{children:"Удалить (только выключенный плагин)"})})]}),u.jsx(na,{checked:e.isEnabled,onCheckedChange:_=>o(e,_),"aria-label":e.isEnabled?"Выключить плагин":"Включить плагин"})]})]})}function q7t({bot:e,installedPlugins:t=[],updates:n={},isUpdating:o,onTogglePlugin:a,onDeletePlugin:i,onUpdatePlugin:s,onSaveSettings:l,onForkPlugin:d}){const[h,p]=k.useState(null),[m,v]=k.useState("all"),[x,M]=k.useState(null),b=k.useMemo(()=>{const _=t.filter(N=>N.isEnabled).length;return{total:t.length,enabled:_,disabled:t.length-_,updates:Object.keys(n).length}},[t,n]),C=k.useMemo(()=>{const _=[...t].sort((N,A)=>new Date(A.createdAt)-new Date(N.createdAt));switch(m){case"enabled":return _.filter(N=>N.isEnabled);case"disabled":return _.filter(N=>!N.isEnabled);case"updates":return _.filter(N=>n[N.sourceUri]);default:return _}},[t,m,n]);return u.jsxs(xB,{delayDuration:100,children:[u.jsxs("div",{className:"p-4 flex flex-col h-full",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-4 shrink-0",children:[u.jsxs(pe,{variant:m==="all"?"secondary":"ghost",size:"sm",onClick:()=>v("all"),children:["Все (",b.total,")"]}),u.jsxs(pe,{variant:m==="enabled"?"secondary":"ghost",size:"sm",onClick:()=>v("enabled"),children:[u.jsx(m0,{className:"mr-1 h-4 w-4"}),"Включенные (",b.enabled,")"]}),u.jsxs(pe,{variant:m==="disabled"?"secondary":"ghost",size:"sm",onClick:()=>v("disabled"),children:[u.jsx(y0,{className:"mr-1 h-4 w-4"}),"Выключенные (",b.disabled,")"]}),b.updates>0&&u.jsxs(pe,{variant:m==="updates"?"secondary":"ghost",size:"sm",onClick:()=>v("updates"),className:"text-green-400",children:[u.jsx(ti,{className:"mr-1 h-4 w-4"}),"С обновлениями (",b.updates,")"]})]}),u.jsx("div",{className:"flex-grow overflow-y-auto border rounded-lg",children:C.length>0?C.map(_=>u.jsx(O7t,{plugin:_,botId:e.id,updateInfo:n[_.sourceUri],onToggle:a,onDelete:()=>M(_),onUpdate:{handle:s,isUpdating:o},onOpenSettings:p,onFork:d},_.id)):u.jsx("div",{className:"flex items-center justify-center h-full text-center p-10 text-muted-foreground",children:"Нет плагинов, соответствующих фильтру."})})]}),u.jsx(Jt,{open:!!h,onOpenChange:_=>!_&&p(null),children:h&&u.jsx(z7t,{bot:e,plugin:h,onOpenChange:_=>!_&&p(null),onSaveSuccess:l})}),x&&u.jsx($s,{open:!!x,onOpenChange:()=>M(null),title:`Удалить плагин "${x.name}"?`,description:"Это действие необратимо. Все файлы и настройки плагина будут удалены для этого бота.",onConfirm:()=>i(x),confirmText:"Да, удалить плагин"})]})}const gW=({plugin:e,isInstalled:t})=>u.jsx(Nn,{className:`p-3 transition-colors ${t?"bg-muted/50 border-dashed":""}`,children:u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("p",{className:"font-semibold",children:e.name}),u.jsx("p",{className:`text-xs ${t?"text-muted-foreground/80":"text-muted-foreground"}`,children:e.description})]}),t?u.jsx(f0,{className:"h-6 w-6 text-green-500 shrink-0"}):u.jsx(ii,{className:"h-5 w-5 text-muted-foreground shrink-0"})]})});function H7t({mainPlugin:e,dependencies:t,onConfirm:n,onCancel:o,isInstalling:a}){const i=t.filter(l=>!l.isInstalled),s=t.filter(l=>l.isInstalled);return u.jsxs(Wt,{className:"sm:max-w-[525px]",children:[u.jsxs(on,{children:[u.jsx(en,{children:"Проверка зависимостей"}),u.jsxs(dn,{children:["Для установки ",u.jsx("span",{className:"font-semibold text-primary",children:e.name})," требуется несколько компонентов."]})]}),u.jsxs("div",{className:"py-2 space-y-4 max-h-[60vh] overflow-y-auto pr-2",children:[i.length>0&&u.jsxs("div",{className:"space-y-2",children:[u.jsx("h4",{className:"text-sm font-medium text-amber-400",children:"Необходимо установить:"}),u.jsx("div",{className:"space-y-2",children:i.map(l=>u.jsx(gW,{plugin:l,isInstalled:!1},l.id))})]}),s.length>0&&u.jsxs("div",{className:"space-y-2",children:[u.jsx("h4",{className:"text-sm font-medium text-green-400",children:"Уже установлено:"}),u.jsx("div",{className:"space-y-2",children:s.map(l=>u.jsx(gW,{plugin:l,isInstalled:!0},l.id))})]})]}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:o,children:"Отмена"}),u.jsx(pe,{onClick:n,disabled:a,children:a?"Установка...":`Установить недостающие (${i.length})`})]})]})}const V7t=({name:e,...t})=>{if(!e)return u.jsx(vs,{...t});if(e.startsWith("/")||e.startsWith("http"))return u.jsx("img",{src:e,alt:"plugin icon",...t});const n=e.split("-").map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),o=fDe[n]||vs;return u.jsx(o,{...t})};function B7t({plugin:e,isInstalled:t,isInstalling:n,onInstall:o,botId:a}){const i=e.dependencies&&e.dependencies.length>0,s=e.supportedHosts&&e.supportedHosts.length>0,[l,d]=k.useState(!1),h=k.useRef(e.downloads);return k.useEffect(()=>{if(e.downloads>h.current){d(!0);const p=setTimeout(()=>d(!1),400);return h.current=e.downloads,()=>clearTimeout(p)}else e.downloads!==h.current&&(h.current=e.downloads)},[e.downloads]),u.jsx(xB,{delayDuration:100,children:u.jsxs("div",{className:"flex items-start gap-4 p-4 border-b transition-colors hover:bg-muted/50",children:[u.jsx(V7t,{name:e.icon,className:"h-10 w-10 text-primary shrink-0 mt-1"}),u.jsxs("div",{className:"flex-grow",children:[u.jsxs("div",{className:"flex justify-between items-start",children:[u.jsxs("div",{children:[u.jsx(up,{to:`/bots/${a}/plugins/view/${e.name}`,className:"group",children:u.jsx("h3",{className:"font-semibold text-lg group-hover:underline",children:e.name})}),u.jsxs("p",{className:"text-sm text-muted-foreground",children:["от ",u.jsx("span",{className:"font-medium text-primary/90",children:e.author})]})]}),u.jsx("a",{href:e.repoUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground",children:u.jsx(ms,{className:"h-5 w-5"})})]}),u.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:e.description}),u.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-3",children:[e.categories&&e.categories.map(p=>u.jsx(Xt,{variant:"secondary",children:p},p)),u.jsx("div",{className:ge(l&&"animate-pop-in"),children:u.jsxs(Xt,{variant:"outline",className:"flex items-center gap-1.5 px-2.5 py-1 text-sm",children:[u.jsx(Xf,{className:"h-4 w-4"}),u.jsx("span",{className:"font-semibold",children:e.downloads||0})]})}),i&&u.jsxs(is,{children:[u.jsx(ss,{asChild:!0,children:u.jsxs(Xt,{variant:"destructive",className:"cursor-help",children:[u.jsx(n0,{className:"h-3 w-3 mr-1"}),e.dependencies.length," ",e.dependencies.length>1?"зависимости":"зависимость"]})}),u.jsxs(ni,{children:[u.jsx("p",{children:"Требуются плагины:"}),u.jsx("ul",{className:"list-disc list-inside",children:e.dependencies.map(p=>u.jsx("li",{children:p},p))})]})]}),s?e.supportedHosts.length<=5?e.supportedHosts.map(p=>u.jsx(Xt,{variant:"outline",className:"font-mono text-xs",children:p},p)):u.jsxs(is,{children:[u.jsx(ss,{asChild:!0,children:u.jsxs(Xt,{variant:"outline",className:"cursor-help flex items-center",children:[u.jsx(Ud,{className:"h-3 w-3 mr-1"}),e.supportedHosts.length," серверов"]})}),u.jsxs(ni,{children:[u.jsx("p",{children:"Протестировано на:"}),u.jsx("ul",{className:"list-disc list-inside",children:e.supportedHosts.map(p=>u.jsx("li",{children:p},p))})]})]}):u.jsxs(Xt,{variant:"outline",className:"flex items-center",children:[u.jsx(o0,{className:"h-3 w-3 mr-1"}),"Любой сервер"]})]})]}),u.jsxs("div",{className:"flex flex-col items-end gap-2 shrink-0 ml-4 w-[120px]",children:[u.jsxs(pe,{size:"sm",className:"w-full",disabled:t||n,onClick:()=>o(e),children:[n?u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}):t?u.jsx(ei,{className:"mr-2 h-4 w-4"}):u.jsx(ii,{className:"mr-2 h-4 w-4"}),n?"Установка":t?"Установлен":"Установить"]}),u.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",e.latestTag.replace("v","")]})]})]})})}const F7t={"Все плагины":i0,Ядро:Zd,Клан:Wd,Чат:d0,Автоматизация:Hd,Безопасность:k0,Команды:ns,Утилиты:b0,Права:r0};function U7t({botId:e,installedPlugins:t,onInstallSuccess:n}){const o=je(I=>I.pluginCatalog),a=je(I=>I.isCatalogLoading),i=je(I=>I.fetchPluginCatalog),s=je(I=>I.installPluginFromRepo),[l,d]=k.useState(new Set),[h,p]=k.useState(""),[m,v]=k.useState("Все плагины"),[x,M]=k.useState({isOpen:!1,mainPlugin:null,dependencies:[]});k.useEffect(()=>{i()},[i]);const b=async I=>{if(I){d(R=>new Set(R).add(I.id));try{await s(e,I.repoUrl,I.name),n()}catch{}finally{d(R=>{const j=new Set(R);return j.delete(I.id),j})}}},C=async I=>{const R=I.dependencies||[];if(R.length===0){await b(I);return}const j=new Set(t.map(z=>z.name)),D=new Map(o.map(z=>[z.name,z])),H=R.map(z=>{const Z=D.get(z);return Z?{...Z,isInstalled:j.has(z)}:null}).filter(Boolean);if(H.filter(z=>!z.isInstalled).length>0){M({isOpen:!0,mainPlugin:I,dependencies:H});return}await b(I)},_=async()=>{const{mainPlugin:I,dependencies:R}=x,j=R.filter(D=>!D.isInstalled);if(I){M({isOpen:!1,mainPlugin:null,dependencies:[]});for(const D of j)await b(D);await b(I)}},N=k.useMemo(()=>new Set(t.map(I=>I.sourceUri)),[t]),A=k.useMemo(()=>o.filter(I=>{const R=h.toLowerCase(),j=m==="Все плагины"||I.categories&&I.categories.includes(m),D=!h||I.name.toLowerCase().includes(R)||I.description.toLowerCase().includes(R);return j&&D}),[o,h,m]);return u.jsxs("div",{className:"flex h-full",children:[u.jsxs("aside",{className:"w-64 border-r p-4 flex flex-col gap-4 shrink-0",children:[u.jsx(Ze,{placeholder:"Поиск плагинов...",value:h,onChange:I=>p(I.target.value)}),u.jsx("nav",{className:"flex flex-col gap-1",children:Object.entries(F7t).map(([I,R])=>u.jsxs(pe,{variant:m===I?"secondary":"ghost",className:"justify-start",onClick:()=>v(I),children:[u.jsx(R,{className:"mr-2 h-4 w-4"}),I]},I))})]}),u.jsxs("main",{className:"flex-1 flex flex-col",children:[u.jsxs("div",{className:"p-6 shrink-0",children:[u.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:m}),u.jsxs("p",{className:"text-muted-foreground",children:["Найдено: ",A.length]})]}),u.jsx("div",{className:"flex-grow border-t overflow-y-auto",children:a?u.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"Загрузка каталога..."}):A.length>0?A.map(I=>u.jsx(B7t,{plugin:I,botId:e,isInstalled:N.has(I.repoUrl),isInstalling:l.has(I.id),onInstall:C},I.id)):u.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center text-muted-foreground p-4",children:[u.jsx(p0,{className:"h-16 w-16 mb-4 opacity-50"}),u.jsx("h3",{className:"text-lg font-semibold",children:"Плагины не найдены"}),u.jsxs("p",{className:"text-sm",children:['В категории "',m,'" нет плагинов, соответствующих вашему запросу.']})]})})]}),u.jsx(Jt,{open:x.isOpen,onOpenChange:I=>!I&&M({isOpen:!1,mainPlugin:null,dependencies:[]}),children:x.mainPlugin&&u.jsx(H7t,{mainPlugin:x.mainPlugin,dependencies:x.dependencies,onConfirm:_,onCancel:()=>M({isOpen:!1,mainPlugin:null,dependencies:[]}),isInstalling:l.size>0})})]})}function G7t({onInstall:e,onCancel:t,isInstalling:n}){const[o,a]=k.useState(""),i=s=>{s.preventDefault(),o.trim()&&e(o.trim())};return u.jsxs(Wt,{children:[u.jsxs(on,{children:[u.jsx(en,{children:"Установить плагин локально"}),u.jsx(dn,{children:"Укажите полный путь к папке с плагином на сервере, где запущена панель. Папка должна содержать валидный `package.json`."})]}),u.jsx("form",{id:"local-install-form",onSubmit:i,className:"py-4",children:u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"path",children:"Путь к папке плагина"}),u.jsx(Ze,{id:"path",value:o,onChange:s=>a(s.target.value),placeholder:"Например, /home/user/my-bot-plugins/super-plugin",required:!0})]})}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:t,children:"Отмена"}),u.jsxs(pe,{type:"submit",form:"local-install-form",disabled:n||!o.trim(),children:[n&&u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}),n?"Установка...":"Установить"]})]})]})}var bB="Radio",[X7t,Ire]=zn(bB),[Z7t,Y7t]=X7t(bB),Tre=k.forwardRef((e,t)=>{const{__scopeRadio:n,name:o,checked:a=!1,required:i,disabled:s,value:l="on",onCheck:d,form:h,...p}=e,[m,v]=k.useState(null),x=ot(t,C=>v(C)),M=k.useRef(!1),b=m?h||!!m.closest("form"):!0;return u.jsxs(Z7t,{scope:n,checked:a,disabled:s,children:[u.jsx(Ae.button,{type:"button",role:"radio","aria-checked":a,"data-state":Dre(a),"data-disabled":s?"":void 0,disabled:s,value:l,...p,ref:x,onClick:Me(e.onClick,C=>{a||d==null||d(),b&&(M.current=C.isPropagationStopped(),M.current||C.stopPropagation())})}),b&&u.jsx($re,{control:m,bubbles:!M.current,name:o,value:l,checked:a,required:i,disabled:s,form:h,style:{transform:"translateX(-100%)"}})]})});Tre.displayName=bB;var Rre="RadioIndicator",Pre=k.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:o,...a}=e,i=Y7t(Rre,n);return u.jsx(jn,{present:o||i.checked,children:u.jsx(Ae.span,{"data-state":Dre(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t})})});Pre.displayName=Rre;var W7t="RadioBubbleInput",$re=k.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:o=!0,...a},i)=>{const s=k.useRef(null),l=ot(s,i),d=YP(n),h=UP(t);return k.useEffect(()=>{const p=s.current;if(!p)return;const m=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(m,"checked").set;if(d!==n&&x){const M=new Event("click",{bubbles:o});x.call(p,n),p.dispatchEvent(M)}},[d,n,o]),u.jsx(Ae.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:l,style:{...a.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});$re.displayName=W7t;function Dre(e){return e?"checked":"unchecked"}var K7t=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],w$="RadioGroup",[Q7t,Uqt]=zn(w$,[p2,Ire]),zre=p2(),Ore=Ire(),[J7t,e_t]=Q7t(w$),qre=k.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:o,defaultValue:a,value:i,required:s=!1,disabled:l=!1,orientation:d,dir:h,loop:p=!0,onValueChange:m,...v}=e,x=zre(n),M=m1(h),[b,C]=go({prop:i,defaultProp:a??null,onChange:m,caller:w$});return u.jsx(J7t,{scope:n,name:o,required:s,disabled:l,value:b,onValueChange:C,children:u.jsx(oB,{asChild:!0,...x,orientation:d,dir:M,loop:p,children:u.jsx(Ae.div,{role:"radiogroup","aria-required":s,"aria-orientation":d,"data-disabled":l?"":void 0,dir:M,...v,ref:t})})})});qre.displayName=w$;var Hre="RadioGroupItem",Vre=k.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:o,...a}=e,i=e_t(Hre,n),s=i.disabled||o,l=zre(n),d=Ore(n),h=k.useRef(null),p=ot(t,h),m=i.value===a.value,v=k.useRef(!1);return k.useEffect(()=>{const x=b=>{K7t.includes(b.key)&&(v.current=!0)},M=()=>v.current=!1;return document.addEventListener("keydown",x),document.addEventListener("keyup",M),()=>{document.removeEventListener("keydown",x),document.removeEventListener("keyup",M)}},[]),u.jsx(aB,{asChild:!0,...l,focusable:!s,active:m,children:u.jsx(Tre,{disabled:s,required:i.required,checked:m,...d,...a,name:i.name,ref:p,onCheck:()=>i.onValueChange(a.value),onKeyDown:Me(x=>{x.key==="Enter"&&x.preventDefault()}),onFocus:Me(a.onFocus,()=>{var x;v.current&&((x=h.current)==null||x.click())})})})});Vre.displayName=Hre;var t_t="RadioGroupIndicator",Bre=k.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...o}=e,a=Ore(n);return u.jsx(Pre,{...a,...o,ref:t})});Bre.displayName=t_t;var Fre=qre,Ure=Vre,n_t=Bre;const o_t="aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",Gre=le.forwardRef(({className:e,...t},n)=>u.jsx(Fre,{className:ge("grid gap-2",e),...t,ref:n}));Gre.displayName=Fre.displayName;const mH=le.forwardRef(({className:e,error:t,...n},o)=>u.jsx(Ure,{ref:o,className:ge(o_t,t&&"border-destructive text-destructive",e),...n,children:u.jsx(n_t,{className:"flex items-center justify-center",children:u.jsx(Bd,{className:ge("h-2.5 w-2.5 fill-current",t&&"fill-destructive")})})}));mH.displayName=Ure.displayName;const a_t=/[^a-zA-Z0-9-]/g,RO=e=>/^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$/.test(e);function r_t({open:e,onOpenChange:t,onCreate:n}){const[o,a]=k.useState(""),[i,s]=k.useState("empty"),[l,d]=k.useState(""),h=v=>{const x=v.target.value.replace(a_t,"");a(x),x&&!RO(x)?d("Неверный формат имени. Имя должно состоять из букв, цифр и дефисов, но не может начинаться или заканчиваться дефисом."):d("")},p=()=>{if(!RO(o)){Gt({variant:"destructive",title:"Ошибка валидации",description:"Пожалуйста, введите корректное имя плагина."});return}n({name:o,template:i}),t(!1),a(""),s("empty")},m=!o||!RO(o);return u.jsx(Jt,{open:e,onOpenChange:t,children:u.jsxs(Wt,{children:[u.jsxs(on,{children:[u.jsx(en,{children:"Создать новый плагин"}),u.jsx(dn,{children:"Введите имя для вашего нового плагина. Имя должно быть уникальным."})]}),u.jsxs("div",{className:"space-y-4 py-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"name",children:"Имя плагина (например, my-awesome-plugin)"}),u.jsx(Ze,{id:"name",value:o,onChange:h}),l&&u.jsx("p",{className:"text-sm text-destructive",children:l})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{children:"Шаблон"}),u.jsxs(Gre,{value:i,onValueChange:s,children:[u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(mH,{value:"empty",id:"r1"}),u.jsx(_e,{htmlFor:"r1",children:"Пустой плагин"})]}),u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(mH,{value:"command",id:"r2"}),u.jsx(_e,{htmlFor:"r2",children:"Плагин с командой-примером"})]})]})]})]}),u.jsxs(an,{children:[u.jsx(pe,{variant:"outline",onClick:()=>t(!1),children:"Отмена"}),u.jsx(pe,{onClick:p,disabled:m,children:"Создать и открыть"})]})]})})}function i_t(){const{botId:e}=gi(),t=parseInt(e,10),n=je(Q=>Q.bots),o=je(Q=>Q.installedPlugins),a=je(Q=>Q.pluginUpdates),i=k.useMemo(()=>n.find(Q=>Q.id===t),[n,t]),s=k.useMemo(()=>o[t]||[],[o,t]),l=k.useMemo(()=>a[t]||{},[a,t]),d=je(Q=>Q.fetchInstalledPlugins),h=je(Q=>Q.checkForUpdates),p=je(Q=>Q.togglePlugin),m=je(Q=>Q.deletePlugin),v=je(Q=>Q.updatePlugin),x=je(Q=>Q.installPluginFromPath),M=je(Q=>Q.fetchPluginCatalog),b=je(Q=>Q.forkPlugin),C=je(Q=>Q.createIdePlugin),[_,N]=k.useState(!0),[A,I]=k.useState(!1),[R,j]=k.useState(null),[D,H]=k.useState(!1),[U,z]=k.useState(!1),[Z,q]=k.useState(!1),[G,E]=k.useState(!1),[O,P]=k.useState("installed"),X=aa();k.useEffect(()=>{i&&(async()=>{N(!0),await M(),await d(t),N(!1)})()},[i,t,d,M]),k.useEffect(()=>{O==="installed"&&i&&s.length>0&&!_&&h(t,!1)},[s.length,_,O,i,t,h]);const W=async()=>{I(!0),await h(t,!0),I(!1)},V=Q=>{P(Q)},L=async({name:Q,template:ne})=>{try{const te=await C(t,{name:Q,template:ne});te&&X(`/bots/${t}/plugins/edit/${te.name}`)}catch{}},Y=async Q=>{E(!0);try{const ne=await b(t,Q.name);ne&&X(`/bots/${t}/plugins/edit/${ne.name}`)}finally{E(!1)}},F=async Q=>{j(Q),await v(Q,t),j(null)},T=async Q=>{z(!0);try{await x(t,Q),H(!1)}finally{z(!1)}},K=()=>{d(t)};return i?u.jsxs(Np,{value:O,onValueChange:V,className:"h-full flex flex-col",children:[u.jsxs(kn,{className:"shrink-0",children:[u.jsx(xn,{children:"Управление плагинами"}),u.jsx(Qn,{children:"Управляйте установленными плагинами или просматривайте каталог для установки новых."}),u.jsxs(y2,{className:"mt-2",children:[u.jsxs(Ao,{value:"installed",children:["Установленные (",s.length,")"]}),u.jsx(Ao,{value:"browser",children:"Обзор"})]})]}),u.jsxs(Mr,{value:"installed",className:"flex-grow flex flex-col min-h-0 data-[state=inactive]:hidden",children:[u.jsxs("div",{className:"p-4 border-b flex items-center gap-2 shrink-0",children:[u.jsxs(pe,{onClick:W,disabled:A,children:[u.jsx(Ih,{className:`mr-2 h-4 w-4 ${A?"animate-spin":""}`}),"Проверить обновления"]}),u.jsxs(Jt,{open:D,onOpenChange:H,children:[u.jsx(Ua,{asChild:!0,children:u.jsxs(pe,{variant:"outline",children:[u.jsx(ys,{className:"mr-2 h-4 w-4"}),"Установить локально"]})}),u.jsx(G7t,{onInstall:T,onCancel:()=>H(!1),isInstalling:U})]}),u.jsxs(pe,{variant:"outline",onClick:()=>q(!0),children:[u.jsx(Wi,{className:"mr-2 h-4 w-4"}),"Создать плагин"]})]}),u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(q7t,{bot:i,installedPlugins:s,isLoading:_,updates:l,isUpdating:R,onTogglePlugin:(Q,ne)=>p(t,Q.id,ne),onDeletePlugin:Q=>m(t,Q.id,Q.name),onUpdatePlugin:F,onSaveSettings:K,onForkPlugin:Y})})]}),u.jsx(Mr,{value:"browser",className:"flex-grow flex flex-col min-h-0 data-[state=inactive]:hidden",children:u.jsx(U7t,{botId:t,installedPlugins:s,onInstallSuccess:K})}),u.jsx(r_t,{open:Z,onOpenChange:q,onCreate:L})]}):null}var b$="Collapsible",[s_t,Xre]=zn(b$),[c_t,MB]=s_t(b$),Zre=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:o,defaultOpen:a,disabled:i,onOpenChange:s,...l}=e,[d,h]=go({prop:o,defaultProp:a??!1,onChange:s,caller:b$});return u.jsx(c_t,{scope:n,disabled:i,contentId:Dn(),open:d,onOpenToggle:k.useCallback(()=>h(p=>!p),[h]),children:u.jsx(Ae.div,{"data-state":SB(d),"data-disabled":i?"":void 0,...l,ref:t})})});Zre.displayName=b$;var Yre="CollapsibleTrigger",Wre=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,...o}=e,a=MB(Yre,n);return u.jsx(Ae.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":SB(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...o,ref:t,onClick:Me(e.onClick,a.onOpenToggle)})});Wre.displayName=Yre;var _B="CollapsibleContent",Kre=k.forwardRef((e,t)=>{const{forceMount:n,...o}=e,a=MB(_B,e.__scopeCollapsible);return u.jsx(jn,{present:n||a.open,children:({present:i})=>u.jsx(l_t,{...o,ref:t,present:i})})});Kre.displayName=_B;var l_t=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:o,children:a,...i}=e,s=MB(_B,n),[l,d]=k.useState(o),h=k.useRef(null),p=ot(t,h),m=k.useRef(0),v=m.current,x=k.useRef(0),M=x.current,b=s.open||l,C=k.useRef(b),_=k.useRef(void 0);return k.useEffect(()=>{const N=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(N)},[]),Gn(()=>{const N=h.current;if(N){_.current=_.current||{transitionDuration:N.style.transitionDuration,animationName:N.style.animationName},N.style.transitionDuration="0s",N.style.animationName="none";const A=N.getBoundingClientRect();m.current=A.height,x.current=A.width,C.current||(N.style.transitionDuration=_.current.transitionDuration,N.style.animationName=_.current.animationName),d(o)}},[s.open,o]),u.jsx(Ae.div,{"data-state":SB(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!b,...i,ref:p,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":M?`${M}px`:void 0,...e.style},children:b&&a})});function SB(e){return e?"open":"closed"}var u_t=Zre,d_t=Wre,h_t=Kre,Wa="Accordion",f_t=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[CB,p_t,y_t]=dp(Wa),[M$,Gqt]=zn(Wa,[y_t,Xre]),NB=Xre(),Qre=le.forwardRef((e,t)=>{const{type:n,...o}=e,a=o,i=o;return u.jsx(CB.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?u.jsx(k_t,{...i,ref:t}):u.jsx(v_t,{...a,ref:t})})});Qre.displayName=Wa;var[Jre,m_t]=M$(Wa),[eie,g_t]=M$(Wa,{collapsible:!1}),v_t=le.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:a=()=>{},collapsible:i=!1,...s}=e,[l,d]=go({prop:n,defaultProp:o??"",onChange:a,caller:Wa});return u.jsx(Jre,{scope:e.__scopeAccordion,value:le.useMemo(()=>l?[l]:[],[l]),onItemOpen:d,onItemClose:le.useCallback(()=>i&&d(""),[i,d]),children:u.jsx(eie,{scope:e.__scopeAccordion,collapsible:i,children:u.jsx(tie,{...s,ref:t})})})}),k_t=le.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:a=()=>{},...i}=e,[s,l]=go({prop:n,defaultProp:o??[],onChange:a,caller:Wa}),d=le.useCallback(p=>l((m=[])=>[...m,p]),[l]),h=le.useCallback(p=>l((m=[])=>m.filter(v=>v!==p)),[l]);return u.jsx(Jre,{scope:e.__scopeAccordion,value:s,onItemOpen:d,onItemClose:h,children:u.jsx(eie,{scope:e.__scopeAccordion,collapsible:!0,children:u.jsx(tie,{...i,ref:t})})})}),[x_t,_$]=M$(Wa),tie=le.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:o,dir:a,orientation:i="vertical",...s}=e,l=le.useRef(null),d=ot(l,t),h=p_t(n),m=m1(a)==="ltr",v=Me(e.onKeyDown,x=>{var H;if(!f_t.includes(x.key))return;const M=x.target,b=h().filter(U=>{var z;return!((z=U.ref.current)!=null&&z.disabled)}),C=b.findIndex(U=>U.ref.current===M),_=b.length;if(C===-1)return;x.preventDefault();let N=C;const A=0,I=_-1,R=()=>{N=C+1,N>I&&(N=A)},j=()=>{N=C-1,N<A&&(N=I)};switch(x.key){case"Home":N=A;break;case"End":N=I;break;case"ArrowRight":i==="horizontal"&&(m?R():j());break;case"ArrowDown":i==="vertical"&&R();break;case"ArrowLeft":i==="horizontal"&&(m?j():R());break;case"ArrowUp":i==="vertical"&&j();break}const D=N%_;(H=b[D].ref.current)==null||H.focus()});return u.jsx(x_t,{scope:n,disabled:o,direction:a,orientation:i,children:u.jsx(CB.Slot,{scope:n,children:u.jsx(Ae.div,{...s,"data-orientation":i,ref:d,onKeyDown:o?void 0:v})})})}),oP="AccordionItem",[w_t,LB]=M$(oP),nie=le.forwardRef((e,t)=>{const{__scopeAccordion:n,value:o,...a}=e,i=_$(oP,n),s=m_t(oP,n),l=NB(n),d=Dn(),h=o&&s.value.includes(o)||!1,p=i.disabled||e.disabled;return u.jsx(w_t,{scope:n,open:h,disabled:p,triggerId:d,children:u.jsx(u_t,{"data-orientation":i.orientation,"data-state":cie(h),...l,...a,ref:t,disabled:p,open:h,onOpenChange:m=>{m?s.onItemOpen(o):s.onItemClose(o)}})})});nie.displayName=oP;var oie="AccordionHeader",aie=le.forwardRef((e,t)=>{const{__scopeAccordion:n,...o}=e,a=_$(Wa,n),i=LB(oie,n);return u.jsx(Ae.h3,{"data-orientation":a.orientation,"data-state":cie(i.open),"data-disabled":i.disabled?"":void 0,...o,ref:t})});aie.displayName=oie;var gH="AccordionTrigger",rie=le.forwardRef((e,t)=>{const{__scopeAccordion:n,...o}=e,a=_$(Wa,n),i=LB(gH,n),s=g_t(gH,n),l=NB(n);return u.jsx(CB.ItemSlot,{scope:n,children:u.jsx(d_t,{"aria-disabled":i.open&&!s.collapsible||void 0,"data-orientation":a.orientation,id:i.triggerId,...l,...o,ref:t})})});rie.displayName=gH;var iie="AccordionContent",sie=le.forwardRef((e,t)=>{const{__scopeAccordion:n,...o}=e,a=_$(Wa,n),i=LB(iie,n),s=NB(n);return u.jsx(h_t,{role:"region","aria-labelledby":i.triggerId,"data-orientation":a.orientation,...s,...o,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});sie.displayName=iie;function cie(e){return e?"open":"closed"}var b_t=Qre,M_t=nie,__t=aie,lie=rie,uie=sie;const die=b_t,jB=k.forwardRef(({className:e,...t},n)=>u.jsx(M_t,{ref:n,className:ge("border-b",e),...t}));jB.displayName="AccordionItem";const AB=k.forwardRef(({className:e,children:t,...n},o)=>u.jsx(__t,{className:"flex",children:u.jsxs(lie,{ref:o,className:ge("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,u.jsx(Vd,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));AB.displayName=lie.displayName;const EB=k.forwardRef(({className:e,children:t,...n},o)=>u.jsx(uie,{ref:o,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:u.jsx("div",{className:ge("pb-4 pt-0",e),children:t})}));EB.displayName=uie.displayName;function S_t({initialValue:e,onSave:t,onCancel:n}){const[o,a]=k.useState("");k.useEffect(()=>{try{const s=JSON.stringify(e,null,2);a(s)}catch{a(Array.isArray(e)?"[]":"{}")}},[e]);const i=()=>{try{const s=JSON.parse(o);t(s)}catch{alert("Ошибка: Невалидный JSON. Проверьте синтаксис.")}};return u.jsxs(Wt,{className:"max-w-3xl",children:[u.jsxs(on,{children:[u.jsx(en,{children:"Редактор конфигурации JSON"}),u.jsx(dn,{children:"Внесите изменения и сохраните. Редактор подсветит синтаксические ошибки."})]}),u.jsx("div",{className:"py-4 relative",children:u.jsx(wB,{height:"60vh",language:"json",value:o,onChange:s=>a(s||""),theme:"vs-dark",options:{minimap:{enabled:!1},fontSize:14,wordWrap:"on",automaticLayout:!0}})}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:n,children:"Отмена"}),u.jsx(pe,{onClick:i,children:"Применить и сохранить"})]})]})}function C_t({settingKey:e,config:t,value:n,onChange:o}){const a=`${e}-${Math.random()}`,[i,s]=k.useState(!1);switch(t.type){case"string":return u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:a,children:t.label}),u.jsx(Ze,{id:a,value:n||"",onChange:l=>o(e,l.target.value)}),t.description&&u.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]});case"string[]":return u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:a,children:t.label}),u.jsx(ki,{id:a,value:Array.isArray(n)?n.join(`
8164
+ `))}),u.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]});case"boolean":return u.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3 shadow-sm",children:[u.jsxs("div",{className:"space-y-0.5",children:[u.jsx(_e,{htmlFor:a,className:"cursor-pointer",children:t.label}),u.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]}),u.jsx(na,{id:a,checked:!!n,onCheckedChange:l=>o(e,l)})]});case"number":return u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:a,children:t.label}),u.jsx(Ze,{id:a,type:"number",value:n??"",onChange:l=>o(e,l.target.value===""?null:l.target.valueAsNumber)}),u.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]});case"json":case"json_file":return u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{children:t.label}),u.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[u.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),u.jsxs(Jt,{open:i,onOpenChange:s,children:[u.jsx(Ua,{asChild:!0,children:u.jsxs(pe,{variant:"outline",children:[u.jsx(pn,{className:"mr-2 h-4 w-4"})," Редактировать"]})}),u.jsx($7t,{initialValue:n,onSave:l=>{o(e,l),s(!1)},onCancel:()=>s(!1)})]})]})]});default:return u.jsxs("p",{className:"text-destructive",children:["Неизвестный тип настройки: ",t.type]})}}function z7t({bot:e,plugin:t,onOpenChange:n,onSaveSuccess:o}){var p;const[a,i]=k.useState(null),{toast:s}=Yt(),l=((p=t.manifest)==null?void 0:p.settings)||{};k.useEffect(()=>{(async()=>{i(null);try{const v=await Ne(`/api/bots/${e.id}/plugins/${t.id}/settings`);i(v)}catch(v){s({variant:"destructive",title:"Ошибка",description:v.message}),i({})}})()},[e.id,t.id,s]);const d=(m,v)=>{i(x=>({...x,[m]:v}))},h=async()=>{try{await Ne(`/api/bots/${e.id}/plugins/${t.id}`,{method:"PUT",body:JSON.stringify({settings:a})},"Настройки плагина сохранены."),o(),n(!1)}catch{}};return u.jsxs(Wt,{className:"max-w-2xl",children:[u.jsxs(on,{children:[u.jsxs(en,{children:["Настройки плагина: ",t.name]}),u.jsx(dn,{children:"Изменения вступят в силу после перезапуска бота."})]}),u.jsx("div",{className:"py-4 space-y-4 max-h-[60vh] overflow-y-auto pr-2",children:a===null?u.jsx("p",{children:"Загрузка настроек..."}):Object.keys(l).length>0?Object.entries(l).map(([m,v])=>u.jsx(D7t,{settingKey:m,config:v,value:a[m],onChange:d},m)):u.jsx("p",{children:"У этого плагина нет настраиваемых параметров."})}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:()=>n(!1),children:"Отмена"}),u.jsx(pe,{onClick:h,children:"Сохранить"})]})]})}function O7t({plugin:e,botId:t,updateInfo:n,onToggle:o,onDelete:a,onUpdate:i,onOpenSettings:s,onFork:l}){var M,b,C;const d=aa(),h=((M=e.manifest)==null?void 0:M.settings)&&Object.keys(e.manifest.settings).length>0,p=i.isUpdating===e.id,m=e.sourceType==="LOCAL"||e.sourceType==="LOCAL_IDE",v=e.sourceType==="GITHUB",x=k.useMemo(()=>{if(!e.createdAt)return!1;const _=new Date(e.createdAt),N=new Date,A=24*60*60*1e3;return N-_<A},[e.createdAt]);return u.jsxs("div",{className:"flex items-start gap-4 p-4 border-b transition-colors hover:bg-muted/50 last:border-b-0",children:[u.jsxs("div",{className:"flex-grow",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("h3",{className:"font-semibold text-lg",children:e.name}),x&&u.jsxs(is,{children:[u.jsx(ss,{children:u.jsxs(Xt,{variant:"success",className:"bg-green-600/80 hover:bg-green-600",children:[u.jsx(ts,{className:"h-3 w-3 mr-1"}),"Новое"]})}),u.jsx(ni,{children:"Установлен менее 24 часов назад"})]})]}),u.jsxs("p",{className:"text-sm text-muted-foreground",children:["от ",u.jsx("span",{className:"font-medium text-primary/90",children:e.author||"Неизвестный автор"})]}),u.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:e.description||"Нет описания."}),u.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-3",children:[u.jsxs(Xt,{variant:"outline",children:["v",e.version]}),u.jsx(Xt,{variant:e.sourceType==="LOCAL"?"secondary":"default",children:e.sourceType}),(C=(b=e.manifest)==null?void 0:b.categories)==null?void 0:C.map(_=>u.jsx(Xt,{variant:"secondary",children:_},_)),n&&u.jsxs(pe,{size:"sm",variant:"ghost",className:"h-auto px-2 py-1 text-green-400 hover:bg-green-900/50 hover:text-green-300",onClick:()=>i.handle(e.id),disabled:p,children:[p?u.jsx(It,{className:"h-4 w-4 mr-1 animate-spin"}):u.jsx(ti,{className:"h-4 w-4 mr-1"}),"Обновить до v",n.recommendedVersion]})]})]}),u.jsxs("div",{className:"flex items-center gap-2 shrink-0 ml-4",children:[m&&u.jsxs(is,{children:[u.jsx(ss,{asChild:!0,children:u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>d(`/bots/${t}/plugins/edit/${e.name}`),children:u.jsx(Nh,{className:"h-4 w-4"})})}),u.jsx(ni,{children:u.jsx("p",{children:"Редактировать код"})})]}),v&&u.jsxs(is,{children:[u.jsx(ss,{asChild:!0,children:u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>l(e),children:u.jsx(ps,{className:"h-4 w-4"})})}),u.jsx(ni,{children:u.jsx("p",{children:"Создать локальную копию для редактирования"})})]}),h&&u.jsxs(is,{children:[u.jsx(ss,{asChild:!0,children:u.jsx(pe,{variant:"ghost",size:"icon",disabled:!e.isEnabled,onClick:()=>s(e),children:u.jsx(Gd,{className:"h-4 w-4"})})}),u.jsx(ni,{children:u.jsx("p",{children:"Настройки плагина"})})]}),u.jsxs(is,{children:[u.jsx(ss,{asChild:!0,children:u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>a(e),disabled:e.isEnabled,children:u.jsx(mo,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"})})}),u.jsx(ni,{children:u.jsx("p",{children:"Удалить (только выключенный плагин)"})})]}),u.jsx(na,{checked:e.isEnabled,onCheckedChange:_=>o(e,_),"aria-label":e.isEnabled?"Выключить плагин":"Включить плагин"})]})]})}function q7t({bot:e,installedPlugins:t=[],updates:n={},isUpdating:o,onTogglePlugin:a,onDeletePlugin:i,onUpdatePlugin:s,onSaveSettings:l,onForkPlugin:d}){const[h,p]=k.useState(null),[m,v]=k.useState("all"),[x,M]=k.useState(null),b=k.useMemo(()=>{const _=t.filter(N=>N.isEnabled).length;return{total:t.length,enabled:_,disabled:t.length-_,updates:Object.keys(n).length}},[t,n]),C=k.useMemo(()=>{const _=[...t].sort((N,A)=>new Date(A.createdAt)-new Date(N.createdAt));switch(m){case"enabled":return _.filter(N=>N.isEnabled);case"disabled":return _.filter(N=>!N.isEnabled);case"updates":return _.filter(N=>n[N.sourceUri]);default:return _}},[t,m,n]);return u.jsxs(xB,{delayDuration:100,children:[u.jsxs("div",{className:"p-4 flex flex-col h-full",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-4 shrink-0",children:[u.jsxs(pe,{variant:m==="all"?"secondary":"ghost",size:"sm",onClick:()=>v("all"),children:["Все (",b.total,")"]}),u.jsxs(pe,{variant:m==="enabled"?"secondary":"ghost",size:"sm",onClick:()=>v("enabled"),children:[u.jsx(m0,{className:"mr-1 h-4 w-4"}),"Включенные (",b.enabled,")"]}),u.jsxs(pe,{variant:m==="disabled"?"secondary":"ghost",size:"sm",onClick:()=>v("disabled"),children:[u.jsx(y0,{className:"mr-1 h-4 w-4"}),"Выключенные (",b.disabled,")"]}),b.updates>0&&u.jsxs(pe,{variant:m==="updates"?"secondary":"ghost",size:"sm",onClick:()=>v("updates"),className:"text-green-400",children:[u.jsx(ti,{className:"mr-1 h-4 w-4"}),"С обновлениями (",b.updates,")"]})]}),u.jsx("div",{className:"flex-grow overflow-y-auto border rounded-lg",children:C.length>0?C.map(_=>u.jsx(O7t,{plugin:_,botId:e.id,updateInfo:n[_.sourceUri],onToggle:a,onDelete:()=>M(_),onUpdate:{handle:s,isUpdating:o},onOpenSettings:p,onFork:d},_.id)):u.jsx("div",{className:"flex items-center justify-center h-full text-center p-10 text-muted-foreground",children:"Нет плагинов, соответствующих фильтру."})})]}),u.jsx(Jt,{open:!!h,onOpenChange:_=>!_&&p(null),children:h&&u.jsx(z7t,{bot:e,plugin:h,onOpenChange:_=>!_&&p(null),onSaveSuccess:l})}),x&&u.jsx($s,{open:!!x,onOpenChange:()=>M(null),title:`Удалить плагин "${x.name}"?`,description:"Это действие необратимо. Все файлы и настройки плагина будут удалены для этого бота.",onConfirm:()=>i(x),confirmText:"Да, удалить плагин"})]})}const gW=({plugin:e,isInstalled:t})=>u.jsx(Nn,{className:`p-3 transition-colors ${t?"bg-muted/50 border-dashed":""}`,children:u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("p",{className:"font-semibold",children:e.name}),u.jsx("p",{className:`text-xs ${t?"text-muted-foreground/80":"text-muted-foreground"}`,children:e.description})]}),t?u.jsx(f0,{className:"h-6 w-6 text-green-500 shrink-0"}):u.jsx(ii,{className:"h-5 w-5 text-muted-foreground shrink-0"})]})});function H7t({mainPlugin:e,dependencies:t,onConfirm:n,onCancel:o,isInstalling:a}){const i=t.filter(l=>!l.isInstalled),s=t.filter(l=>l.isInstalled);return u.jsxs(Wt,{className:"sm:max-w-[525px]",children:[u.jsxs(on,{children:[u.jsx(en,{children:"Проверка зависимостей"}),u.jsxs(dn,{children:["Для установки ",u.jsx("span",{className:"font-semibold text-primary",children:e.name})," требуется несколько компонентов."]})]}),u.jsxs("div",{className:"py-2 space-y-4 max-h-[60vh] overflow-y-auto pr-2",children:[i.length>0&&u.jsxs("div",{className:"space-y-2",children:[u.jsx("h4",{className:"text-sm font-medium text-amber-400",children:"Необходимо установить:"}),u.jsx("div",{className:"space-y-2",children:i.map(l=>u.jsx(gW,{plugin:l,isInstalled:!1},l.id))})]}),s.length>0&&u.jsxs("div",{className:"space-y-2",children:[u.jsx("h4",{className:"text-sm font-medium text-green-400",children:"Уже установлено:"}),u.jsx("div",{className:"space-y-2",children:s.map(l=>u.jsx(gW,{plugin:l,isInstalled:!0},l.id))})]})]}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:o,children:"Отмена"}),u.jsx(pe,{onClick:n,disabled:a,children:a?"Установка...":`Установить недостающие (${i.length})`})]})]})}const V7t=({name:e,...t})=>{if(!e)return u.jsx(vs,{...t});if(e.startsWith("/")||e.startsWith("http"))return u.jsx("img",{src:e,alt:"plugin icon",...t});const n=e.split("-").map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),o=fDe[n]||vs;return u.jsx(o,{...t})};function B7t({plugin:e,isInstalled:t,isInstalling:n,onInstall:o,botId:a}){const i=e.dependencies&&e.dependencies.length>0,s=e.supportedHosts&&e.supportedHosts.length>0,[l,d]=k.useState(!1),h=k.useRef(e.downloads);return k.useEffect(()=>{if(e.downloads>h.current){d(!0);const p=setTimeout(()=>d(!1),400);return h.current=e.downloads,()=>clearTimeout(p)}else e.downloads!==h.current&&(h.current=e.downloads)},[e.downloads]),u.jsx(xB,{delayDuration:100,children:u.jsxs("div",{className:"flex items-start gap-4 p-4 border-b transition-colors hover:bg-muted/50",children:[u.jsx(V7t,{name:e.icon,className:"h-10 w-10 text-primary shrink-0 mt-1"}),u.jsxs("div",{className:"flex-grow",children:[u.jsxs("div",{className:"flex justify-between items-start",children:[u.jsxs("div",{children:[u.jsx(up,{to:`/bots/${a}/plugins/view/${e.name}`,className:"group",children:u.jsx("h3",{className:"font-semibold text-lg group-hover:underline",children:e.name})}),u.jsxs("p",{className:"text-sm text-muted-foreground",children:["от ",u.jsx("span",{className:"font-medium text-primary/90",children:e.author})]})]}),u.jsx("a",{href:e.repoUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground",children:u.jsx(ms,{className:"h-5 w-5"})})]}),u.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:e.description}),u.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-3",children:[e.categories&&e.categories.map(p=>u.jsx(Xt,{variant:"secondary",children:p},p)),u.jsx("div",{className:ge(l&&"animate-pop-in"),children:u.jsxs(Xt,{variant:"outline",className:"flex items-center gap-1.5 px-2.5 py-1 text-sm",children:[u.jsx(Xf,{className:"h-4 w-4"}),u.jsx("span",{className:"font-semibold",children:e.downloads||0})]})}),i&&u.jsxs(is,{children:[u.jsx(ss,{asChild:!0,children:u.jsxs(Xt,{variant:"destructive",className:"cursor-help",children:[u.jsx(n0,{className:"h-3 w-3 mr-1"}),e.dependencies.length," ",e.dependencies.length>1?"зависимости":"зависимость"]})}),u.jsxs(ni,{children:[u.jsx("p",{children:"Требуются плагины:"}),u.jsx("ul",{className:"list-disc list-inside",children:e.dependencies.map(p=>u.jsx("li",{children:p},p))})]})]}),s?e.supportedHosts.length<=5?e.supportedHosts.map(p=>u.jsx(Xt,{variant:"outline",className:"font-mono text-xs",children:p},p)):u.jsxs(is,{children:[u.jsx(ss,{asChild:!0,children:u.jsxs(Xt,{variant:"outline",className:"cursor-help flex items-center",children:[u.jsx(Ud,{className:"h-3 w-3 mr-1"}),e.supportedHosts.length," серверов"]})}),u.jsxs(ni,{children:[u.jsx("p",{children:"Протестировано на:"}),u.jsx("ul",{className:"list-disc list-inside",children:e.supportedHosts.map(p=>u.jsx("li",{children:p},p))})]})]}):u.jsxs(Xt,{variant:"outline",className:"flex items-center",children:[u.jsx(o0,{className:"h-3 w-3 mr-1"}),"Любой сервер"]})]})]}),u.jsxs("div",{className:"flex flex-col items-end gap-2 shrink-0 ml-4 w-[120px]",children:[u.jsxs(pe,{size:"sm",className:"w-full",disabled:t||n,onClick:()=>o(e),children:[n?u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}):t?u.jsx(ei,{className:"mr-2 h-4 w-4"}):u.jsx(ii,{className:"mr-2 h-4 w-4"}),n?"Установка":t?"Установлен":"Установить"]}),u.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",e.latestTag.replace("v","")]})]})]})})}const F7t={"Все плагины":i0,Ядро:Zd,Клан:Wd,Чат:d0,Автоматизация:Hd,Безопасность:k0,Команды:ns,Утилиты:b0,Права:r0};function U7t({botId:e,installedPlugins:t,onInstallSuccess:n}){const o=je(I=>I.pluginCatalog),a=je(I=>I.isCatalogLoading),i=je(I=>I.fetchPluginCatalog),s=je(I=>I.installPluginFromRepo),[l,d]=k.useState(new Set),[h,p]=k.useState(""),[m,v]=k.useState("Все плагины"),[x,M]=k.useState({isOpen:!1,mainPlugin:null,dependencies:[]});k.useEffect(()=>{i()},[i]);const b=async I=>{if(I){d(R=>new Set(R).add(I.id));try{await s(e,I.repoUrl,I.name),n()}catch{}finally{d(R=>{const j=new Set(R);return j.delete(I.id),j})}}},C=async I=>{const R=I.dependencies||[];if(R.length===0){await b(I);return}const j=new Set(t.map(z=>z.name)),D=new Map(o.map(z=>[z.name,z])),H=R.map(z=>{const Z=D.get(z);return Z?{...Z,isInstalled:j.has(z)}:null}).filter(Boolean);if(H.filter(z=>!z.isInstalled).length>0){M({isOpen:!0,mainPlugin:I,dependencies:H});return}await b(I)},_=async()=>{const{mainPlugin:I,dependencies:R}=x,j=R.filter(D=>!D.isInstalled);if(I){M({isOpen:!1,mainPlugin:null,dependencies:[]});for(const D of j)await b(D);await b(I)}},N=k.useMemo(()=>new Set(t.map(I=>I.sourceUri)),[t]),A=k.useMemo(()=>o.filter(I=>{const R=h.toLowerCase(),j=m==="Все плагины"||I.categories&&I.categories.includes(m),D=!h||I.name.toLowerCase().includes(R)||I.description.toLowerCase().includes(R);return j&&D}),[o,h,m]);return u.jsxs("div",{className:"flex h-full",children:[u.jsxs("aside",{className:"w-64 border-r p-4 flex flex-col gap-4 shrink-0",children:[u.jsx(Ze,{placeholder:"Поиск плагинов...",value:h,onChange:I=>p(I.target.value)}),u.jsx("nav",{className:"flex flex-col gap-1",children:Object.entries(F7t).map(([I,R])=>u.jsxs(pe,{variant:m===I?"secondary":"ghost",className:"justify-start",onClick:()=>v(I),children:[u.jsx(R,{className:"mr-2 h-4 w-4"}),I]},I))})]}),u.jsxs("main",{className:"flex-1 flex flex-col",children:[u.jsxs("div",{className:"p-6 shrink-0",children:[u.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:m}),u.jsxs("p",{className:"text-muted-foreground",children:["Найдено: ",A.length]})]}),u.jsx("div",{className:"flex-grow border-t overflow-y-auto",children:a?u.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"Загрузка каталога..."}):A.length>0?A.map(I=>u.jsx(B7t,{plugin:I,botId:e,isInstalled:N.has(I.repoUrl),isInstalling:l.has(I.id),onInstall:C},I.id)):u.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center text-muted-foreground p-4",children:[u.jsx(p0,{className:"h-16 w-16 mb-4 opacity-50"}),u.jsx("h3",{className:"text-lg font-semibold",children:"Плагины не найдены"}),u.jsxs("p",{className:"text-sm",children:['В категории "',m,'" нет плагинов, соответствующих вашему запросу.']})]})})]}),u.jsx(Jt,{open:x.isOpen,onOpenChange:I=>!I&&M({isOpen:!1,mainPlugin:null,dependencies:[]}),children:x.mainPlugin&&u.jsx(H7t,{mainPlugin:x.mainPlugin,dependencies:x.dependencies,onConfirm:_,onCancel:()=>M({isOpen:!1,mainPlugin:null,dependencies:[]}),isInstalling:l.size>0})})]})}function G7t({onInstall:e,onCancel:t,isInstalling:n}){const[o,a]=k.useState(""),i=s=>{s.preventDefault(),o.trim()&&e(o.trim())};return u.jsxs(Wt,{children:[u.jsxs(on,{children:[u.jsx(en,{children:"Установить плагин локально"}),u.jsx(dn,{children:"Укажите полный путь к папке с плагином на сервере, где запущена панель. Папка должна содержать валидный `package.json`."})]}),u.jsx("form",{id:"local-install-form",onSubmit:i,className:"py-4",children:u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"path",children:"Путь к папке плагина"}),u.jsx(Ze,{id:"path",value:o,onChange:s=>a(s.target.value),placeholder:"Например, /home/user/my-bot-plugins/super-plugin",required:!0})]})}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:t,children:"Отмена"}),u.jsxs(pe,{type:"submit",form:"local-install-form",disabled:n||!o.trim(),children:[n&&u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}),n?"Установка...":"Установить"]})]})]})}var bB="Radio",[X7t,Ire]=zn(bB),[Z7t,Y7t]=X7t(bB),Tre=k.forwardRef((e,t)=>{const{__scopeRadio:n,name:o,checked:a=!1,required:i,disabled:s,value:l="on",onCheck:d,form:h,...p}=e,[m,v]=k.useState(null),x=ot(t,C=>v(C)),M=k.useRef(!1),b=m?h||!!m.closest("form"):!0;return u.jsxs(Z7t,{scope:n,checked:a,disabled:s,children:[u.jsx(Ae.button,{type:"button",role:"radio","aria-checked":a,"data-state":Dre(a),"data-disabled":s?"":void 0,disabled:s,value:l,...p,ref:x,onClick:Me(e.onClick,C=>{a||d==null||d(),b&&(M.current=C.isPropagationStopped(),M.current||C.stopPropagation())})}),b&&u.jsx($re,{control:m,bubbles:!M.current,name:o,value:l,checked:a,required:i,disabled:s,form:h,style:{transform:"translateX(-100%)"}})]})});Tre.displayName=bB;var Rre="RadioIndicator",Pre=k.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:o,...a}=e,i=Y7t(Rre,n);return u.jsx(jn,{present:o||i.checked,children:u.jsx(Ae.span,{"data-state":Dre(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t})})});Pre.displayName=Rre;var W7t="RadioBubbleInput",$re=k.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:o=!0,...a},i)=>{const s=k.useRef(null),l=ot(s,i),d=YP(n),h=UP(t);return k.useEffect(()=>{const p=s.current;if(!p)return;const m=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(m,"checked").set;if(d!==n&&x){const M=new Event("click",{bubbles:o});x.call(p,n),p.dispatchEvent(M)}},[d,n,o]),u.jsx(Ae.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:l,style:{...a.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});$re.displayName=W7t;function Dre(e){return e?"checked":"unchecked"}var K7t=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],w$="RadioGroup",[Q7t,Uqt]=zn(w$,[p2,Ire]),zre=p2(),Ore=Ire(),[J7t,e_t]=Q7t(w$),qre=k.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:o,defaultValue:a,value:i,required:s=!1,disabled:l=!1,orientation:d,dir:h,loop:p=!0,onValueChange:m,...v}=e,x=zre(n),M=m1(h),[b,C]=go({prop:i,defaultProp:a??null,onChange:m,caller:w$});return u.jsx(J7t,{scope:n,name:o,required:s,disabled:l,value:b,onValueChange:C,children:u.jsx(oB,{asChild:!0,...x,orientation:d,dir:M,loop:p,children:u.jsx(Ae.div,{role:"radiogroup","aria-required":s,"aria-orientation":d,"data-disabled":l?"":void 0,dir:M,...v,ref:t})})})});qre.displayName=w$;var Hre="RadioGroupItem",Vre=k.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:o,...a}=e,i=e_t(Hre,n),s=i.disabled||o,l=zre(n),d=Ore(n),h=k.useRef(null),p=ot(t,h),m=i.value===a.value,v=k.useRef(!1);return k.useEffect(()=>{const x=b=>{K7t.includes(b.key)&&(v.current=!0)},M=()=>v.current=!1;return document.addEventListener("keydown",x),document.addEventListener("keyup",M),()=>{document.removeEventListener("keydown",x),document.removeEventListener("keyup",M)}},[]),u.jsx(aB,{asChild:!0,...l,focusable:!s,active:m,children:u.jsx(Tre,{disabled:s,required:i.required,checked:m,...d,...a,name:i.name,ref:p,onCheck:()=>i.onValueChange(a.value),onKeyDown:Me(x=>{x.key==="Enter"&&x.preventDefault()}),onFocus:Me(a.onFocus,()=>{var x;v.current&&((x=h.current)==null||x.click())})})})});Vre.displayName=Hre;var t_t="RadioGroupIndicator",Bre=k.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...o}=e,a=Ore(n);return u.jsx(Pre,{...a,...o,ref:t})});Bre.displayName=t_t;var Fre=qre,Ure=Vre,n_t=Bre;const o_t="aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",Gre=le.forwardRef(({className:e,...t},n)=>u.jsx(Fre,{className:ge("grid gap-2",e),...t,ref:n}));Gre.displayName=Fre.displayName;const mH=le.forwardRef(({className:e,error:t,...n},o)=>u.jsx(Ure,{ref:o,className:ge(o_t,t&&"border-destructive text-destructive",e),...n,children:u.jsx(n_t,{className:"flex items-center justify-center",children:u.jsx(Bd,{className:ge("h-2.5 w-2.5 fill-current",t&&"fill-destructive")})})}));mH.displayName=Ure.displayName;const a_t=/[^a-zA-Z0-9-]/g,RO=e=>/^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$/.test(e);function r_t({open:e,onOpenChange:t,onCreate:n}){const[o,a]=k.useState(""),[i,s]=k.useState("empty"),[l,d]=k.useState(""),h=v=>{const x=v.target.value.replace(a_t,"");a(x),x&&!RO(x)?d("Неверный формат имени. Имя должно состоять из букв, цифр и дефисов, но не может начинаться или заканчиваться дефисом."):d("")},p=()=>{if(!RO(o)){Vt({variant:"destructive",title:"Ошибка валидации",description:"Пожалуйста, введите корректное имя плагина."});return}n({name:o,template:i}),t(!1),a(""),s("empty")},m=!o||!RO(o);return u.jsx(Jt,{open:e,onOpenChange:t,children:u.jsxs(Wt,{children:[u.jsxs(on,{children:[u.jsx(en,{children:"Создать новый плагин"}),u.jsx(dn,{children:"Введите имя для вашего нового плагина. Имя должно быть уникальным."})]}),u.jsxs("div",{className:"space-y-4 py-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"name",children:"Имя плагина (например, my-awesome-plugin)"}),u.jsx(Ze,{id:"name",value:o,onChange:h}),l&&u.jsx("p",{className:"text-sm text-destructive",children:l})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{children:"Шаблон"}),u.jsxs(Gre,{value:i,onValueChange:s,children:[u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(mH,{value:"empty",id:"r1"}),u.jsx(_e,{htmlFor:"r1",children:"Пустой плагин"})]}),u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(mH,{value:"command",id:"r2"}),u.jsx(_e,{htmlFor:"r2",children:"Плагин с командой-примером"})]})]})]})]}),u.jsxs(an,{children:[u.jsx(pe,{variant:"outline",onClick:()=>t(!1),children:"Отмена"}),u.jsx(pe,{onClick:p,disabled:m,children:"Создать и открыть"})]})]})})}function i_t(){const{botId:e}=gi(),t=parseInt(e,10),n=je(Q=>Q.bots),o=je(Q=>Q.installedPlugins),a=je(Q=>Q.pluginUpdates),i=k.useMemo(()=>n.find(Q=>Q.id===t),[n,t]),s=k.useMemo(()=>o[t]||[],[o,t]),l=k.useMemo(()=>a[t]||{},[a,t]),d=je(Q=>Q.fetchInstalledPlugins),h=je(Q=>Q.checkForUpdates),p=je(Q=>Q.togglePlugin),m=je(Q=>Q.deletePlugin),v=je(Q=>Q.updatePlugin),x=je(Q=>Q.installPluginFromPath),M=je(Q=>Q.fetchPluginCatalog),b=je(Q=>Q.forkPlugin),C=je(Q=>Q.createIdePlugin),[_,N]=k.useState(!0),[A,I]=k.useState(!1),[R,j]=k.useState(null),[D,H]=k.useState(!1),[U,z]=k.useState(!1),[Z,q]=k.useState(!1),[G,E]=k.useState(!1),[O,P]=k.useState("installed"),X=aa();k.useEffect(()=>{i&&(async()=>{N(!0),await M(),await d(t),N(!1)})()},[i,t,d,M]),k.useEffect(()=>{O==="installed"&&i&&s.length>0&&!_&&h(t,!1)},[s.length,_,O,i,t,h]);const W=async()=>{I(!0),await h(t,!0),I(!1)},V=Q=>{P(Q)},L=async({name:Q,template:ne})=>{try{const te=await C(t,{name:Q,template:ne});te&&X(`/bots/${t}/plugins/edit/${te.name}`)}catch{}},Y=async Q=>{E(!0);try{const ne=await b(t,Q.name);ne&&X(`/bots/${t}/plugins/edit/${ne.name}`)}finally{E(!1)}},F=async Q=>{j(Q),await v(Q,t),j(null)},T=async Q=>{z(!0);try{await x(t,Q),H(!1)}finally{z(!1)}},K=()=>{d(t)};return i?u.jsxs(Np,{value:O,onValueChange:V,className:"h-full flex flex-col",children:[u.jsxs(kn,{className:"shrink-0",children:[u.jsx(xn,{children:"Управление плагинами"}),u.jsx(Qn,{children:"Управляйте установленными плагинами или просматривайте каталог для установки новых."}),u.jsxs(y2,{className:"mt-2",children:[u.jsxs(Ao,{value:"installed",children:["Установленные (",s.length,")"]}),u.jsx(Ao,{value:"browser",children:"Обзор"})]})]}),u.jsxs(Mr,{value:"installed",className:"flex-grow flex flex-col min-h-0 data-[state=inactive]:hidden",children:[u.jsxs("div",{className:"p-4 border-b flex items-center gap-2 shrink-0",children:[u.jsxs(pe,{onClick:W,disabled:A,children:[u.jsx(Ih,{className:`mr-2 h-4 w-4 ${A?"animate-spin":""}`}),"Проверить обновления"]}),u.jsxs(Jt,{open:D,onOpenChange:H,children:[u.jsx(Ua,{asChild:!0,children:u.jsxs(pe,{variant:"outline",children:[u.jsx(ys,{className:"mr-2 h-4 w-4"}),"Установить локально"]})}),u.jsx(G7t,{onInstall:T,onCancel:()=>H(!1),isInstalling:U})]}),u.jsxs(pe,{variant:"outline",onClick:()=>q(!0),children:[u.jsx(Wi,{className:"mr-2 h-4 w-4"}),"Создать плагин"]})]}),u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(q7t,{bot:i,installedPlugins:s,isLoading:_,updates:l,isUpdating:R,onTogglePlugin:(Q,ne)=>p(t,Q.id,ne),onDeletePlugin:Q=>m(t,Q.id,Q.name),onUpdatePlugin:F,onSaveSettings:K,onForkPlugin:Y})})]}),u.jsx(Mr,{value:"browser",className:"flex-grow flex flex-col min-h-0 data-[state=inactive]:hidden",children:u.jsx(U7t,{botId:t,installedPlugins:s,onInstallSuccess:K})}),u.jsx(r_t,{open:Z,onOpenChange:q,onCreate:L})]}):null}var b$="Collapsible",[s_t,Xre]=zn(b$),[c_t,MB]=s_t(b$),Zre=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:o,defaultOpen:a,disabled:i,onOpenChange:s,...l}=e,[d,h]=go({prop:o,defaultProp:a??!1,onChange:s,caller:b$});return u.jsx(c_t,{scope:n,disabled:i,contentId:Dn(),open:d,onOpenToggle:k.useCallback(()=>h(p=>!p),[h]),children:u.jsx(Ae.div,{"data-state":SB(d),"data-disabled":i?"":void 0,...l,ref:t})})});Zre.displayName=b$;var Yre="CollapsibleTrigger",Wre=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,...o}=e,a=MB(Yre,n);return u.jsx(Ae.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":SB(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...o,ref:t,onClick:Me(e.onClick,a.onOpenToggle)})});Wre.displayName=Yre;var _B="CollapsibleContent",Kre=k.forwardRef((e,t)=>{const{forceMount:n,...o}=e,a=MB(_B,e.__scopeCollapsible);return u.jsx(jn,{present:n||a.open,children:({present:i})=>u.jsx(l_t,{...o,ref:t,present:i})})});Kre.displayName=_B;var l_t=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:o,children:a,...i}=e,s=MB(_B,n),[l,d]=k.useState(o),h=k.useRef(null),p=ot(t,h),m=k.useRef(0),v=m.current,x=k.useRef(0),M=x.current,b=s.open||l,C=k.useRef(b),_=k.useRef(void 0);return k.useEffect(()=>{const N=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(N)},[]),Gn(()=>{const N=h.current;if(N){_.current=_.current||{transitionDuration:N.style.transitionDuration,animationName:N.style.animationName},N.style.transitionDuration="0s",N.style.animationName="none";const A=N.getBoundingClientRect();m.current=A.height,x.current=A.width,C.current||(N.style.transitionDuration=_.current.transitionDuration,N.style.animationName=_.current.animationName),d(o)}},[s.open,o]),u.jsx(Ae.div,{"data-state":SB(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!b,...i,ref:p,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":M?`${M}px`:void 0,...e.style},children:b&&a})});function SB(e){return e?"open":"closed"}var u_t=Zre,d_t=Wre,h_t=Kre,Wa="Accordion",f_t=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[CB,p_t,y_t]=dp(Wa),[M$,Gqt]=zn(Wa,[y_t,Xre]),NB=Xre(),Qre=le.forwardRef((e,t)=>{const{type:n,...o}=e,a=o,i=o;return u.jsx(CB.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?u.jsx(k_t,{...i,ref:t}):u.jsx(v_t,{...a,ref:t})})});Qre.displayName=Wa;var[Jre,m_t]=M$(Wa),[eie,g_t]=M$(Wa,{collapsible:!1}),v_t=le.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:a=()=>{},collapsible:i=!1,...s}=e,[l,d]=go({prop:n,defaultProp:o??"",onChange:a,caller:Wa});return u.jsx(Jre,{scope:e.__scopeAccordion,value:le.useMemo(()=>l?[l]:[],[l]),onItemOpen:d,onItemClose:le.useCallback(()=>i&&d(""),[i,d]),children:u.jsx(eie,{scope:e.__scopeAccordion,collapsible:i,children:u.jsx(tie,{...s,ref:t})})})}),k_t=le.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:a=()=>{},...i}=e,[s,l]=go({prop:n,defaultProp:o??[],onChange:a,caller:Wa}),d=le.useCallback(p=>l((m=[])=>[...m,p]),[l]),h=le.useCallback(p=>l((m=[])=>m.filter(v=>v!==p)),[l]);return u.jsx(Jre,{scope:e.__scopeAccordion,value:s,onItemOpen:d,onItemClose:h,children:u.jsx(eie,{scope:e.__scopeAccordion,collapsible:!0,children:u.jsx(tie,{...i,ref:t})})})}),[x_t,_$]=M$(Wa),tie=le.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:o,dir:a,orientation:i="vertical",...s}=e,l=le.useRef(null),d=ot(l,t),h=p_t(n),m=m1(a)==="ltr",v=Me(e.onKeyDown,x=>{var H;if(!f_t.includes(x.key))return;const M=x.target,b=h().filter(U=>{var z;return!((z=U.ref.current)!=null&&z.disabled)}),C=b.findIndex(U=>U.ref.current===M),_=b.length;if(C===-1)return;x.preventDefault();let N=C;const A=0,I=_-1,R=()=>{N=C+1,N>I&&(N=A)},j=()=>{N=C-1,N<A&&(N=I)};switch(x.key){case"Home":N=A;break;case"End":N=I;break;case"ArrowRight":i==="horizontal"&&(m?R():j());break;case"ArrowDown":i==="vertical"&&R();break;case"ArrowLeft":i==="horizontal"&&(m?j():R());break;case"ArrowUp":i==="vertical"&&j();break}const D=N%_;(H=b[D].ref.current)==null||H.focus()});return u.jsx(x_t,{scope:n,disabled:o,direction:a,orientation:i,children:u.jsx(CB.Slot,{scope:n,children:u.jsx(Ae.div,{...s,"data-orientation":i,ref:d,onKeyDown:o?void 0:v})})})}),oP="AccordionItem",[w_t,LB]=M$(oP),nie=le.forwardRef((e,t)=>{const{__scopeAccordion:n,value:o,...a}=e,i=_$(oP,n),s=m_t(oP,n),l=NB(n),d=Dn(),h=o&&s.value.includes(o)||!1,p=i.disabled||e.disabled;return u.jsx(w_t,{scope:n,open:h,disabled:p,triggerId:d,children:u.jsx(u_t,{"data-orientation":i.orientation,"data-state":cie(h),...l,...a,ref:t,disabled:p,open:h,onOpenChange:m=>{m?s.onItemOpen(o):s.onItemClose(o)}})})});nie.displayName=oP;var oie="AccordionHeader",aie=le.forwardRef((e,t)=>{const{__scopeAccordion:n,...o}=e,a=_$(Wa,n),i=LB(oie,n);return u.jsx(Ae.h3,{"data-orientation":a.orientation,"data-state":cie(i.open),"data-disabled":i.disabled?"":void 0,...o,ref:t})});aie.displayName=oie;var gH="AccordionTrigger",rie=le.forwardRef((e,t)=>{const{__scopeAccordion:n,...o}=e,a=_$(Wa,n),i=LB(gH,n),s=g_t(gH,n),l=NB(n);return u.jsx(CB.ItemSlot,{scope:n,children:u.jsx(d_t,{"aria-disabled":i.open&&!s.collapsible||void 0,"data-orientation":a.orientation,id:i.triggerId,...l,...o,ref:t})})});rie.displayName=gH;var iie="AccordionContent",sie=le.forwardRef((e,t)=>{const{__scopeAccordion:n,...o}=e,a=_$(Wa,n),i=LB(iie,n),s=NB(n);return u.jsx(h_t,{role:"region","aria-labelledby":i.triggerId,"data-orientation":a.orientation,...s,...o,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});sie.displayName=iie;function cie(e){return e?"open":"closed"}var b_t=Qre,M_t=nie,__t=aie,lie=rie,uie=sie;const die=b_t,jB=k.forwardRef(({className:e,...t},n)=>u.jsx(M_t,{ref:n,className:ge("border-b",e),...t}));jB.displayName="AccordionItem";const AB=k.forwardRef(({className:e,children:t,...n},o)=>u.jsx(__t,{className:"flex",children:u.jsxs(lie,{ref:o,className:ge("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,u.jsx(Vd,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));AB.displayName=lie.displayName;const EB=k.forwardRef(({className:e,children:t,...n},o)=>u.jsx(uie,{ref:o,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:u.jsx("div",{className:ge("pb-4 pt-0",e),children:t})}));EB.displayName=uie.displayName;function S_t({initialValue:e,onSave:t,onCancel:n}){const[o,a]=k.useState("");k.useEffect(()=>{try{const s=JSON.stringify(e,null,2);a(s)}catch{a(Array.isArray(e)?"[]":"{}")}},[e]);const i=()=>{try{const s=JSON.parse(o);t(s)}catch{alert("Ошибка: Невалидный JSON. Проверьте синтаксис.")}};return u.jsxs(Wt,{className:"max-w-3xl",children:[u.jsxs(on,{children:[u.jsx(en,{children:"Редактор конфигурации JSON"}),u.jsx(dn,{children:"Внесите изменения и сохраните. Редактор подсветит синтаксические ошибки."})]}),u.jsx("div",{className:"py-4 relative",children:u.jsx(wB,{height:"60vh",language:"json",value:o,onChange:s=>a(s||""),theme:"vs-dark",options:{minimap:{enabled:!1},fontSize:14,wordWrap:"on",automaticLayout:!0}})}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:n,children:"Отмена"}),u.jsx(pe,{onClick:i,children:"Применить и сохранить"})]})]})}function C_t({settingKey:e,config:t,value:n,onChange:o}){const a=`${e}-${Math.random()}`,[i,s]=k.useState(!1);switch(t.type){case"string":return u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:a,children:t.label}),u.jsx(Ze,{id:a,value:n||"",onChange:l=>o(e,l.target.value)}),t.description&&u.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]});case"string[]":return u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:a,children:t.label}),u.jsx(ki,{id:a,value:Array.isArray(n)?n.join(`
8165
8165
  `):"",onChange:l=>o(e,l.target.value.split(`
8166
8166
  `)),rows:3}),t.description&&u.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]});case"boolean":return u.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[u.jsxs("div",{className:"space-y-0.5",children:[u.jsx(_e,{htmlFor:a,className:"cursor-pointer",children:t.label}),t.description&&u.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]}),u.jsx(na,{id:a,checked:!!n,onCheckedChange:l=>o(e,l)})]});case"number":return u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:a,children:t.label}),u.jsx(Ze,{id:a,type:"number",value:n??"",onChange:l=>o(e,l.target.value===""?null:l.target.valueAsNumber)}),t.description&&u.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]});case"json":case"json_file":return u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{children:t.label}),u.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[u.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),u.jsxs(Jt,{open:i,onOpenChange:s,children:[u.jsx(Ua,{asChild:!0,children:u.jsxs(pe,{variant:"outline",children:[u.jsx(pn,{className:"mr-2 h-4 w-4"})," Редактировать"]})}),u.jsx(S_t,{initialValue:n,onSave:l=>{o(e,l),s(!1)},onCancel:()=>s(!1)})]})]})]});default:return u.jsxs("p",{className:"text-destructive",children:["Неизвестный тип настройки: ",t.type]})}}function N_t({plugin:e,onSettingsChange:t}){const n=(o,a)=>{const i={...e.settings,[o]:a};t(e.id,i)};return u.jsx("div",{className:"space-y-6",children:Object.entries(e.manifest.settings).map(([o,a])=>u.jsx(C_t,{settingKey:o,config:a,value:e.settings[o],onChange:n},o))})}function L_t(){const{botId:e}=gi(),t=je(_=>_.servers),n=je(_=>_.fetchInitialData),[o,a]=k.useState(null),[i,s]=k.useState(!0),[l,d]=k.useState(!1),[h,p]=k.useState({}),{toast:m}=Yt(),v=k.useCallback(async()=>{s(!0);try{const _=await Ne(`/api/bots/${e}/settings/all`);a(_),p({})}catch(_){m({variant:"destructive",title:"Ошибка",description:_.message})}s(!1)},[e,m]);k.useEffect(()=>{v()},[v]);const x=k.useCallback(_=>{p(N=>({...N,bot:_}))},[]),M=k.useCallback((_,N)=>{a(A=>({...A,plugins:A.plugins.map(I=>I.id===_?{...I,settings:N}:I)})),p(A=>({...A,plugins:{...A.plugins||{},[_]:N}}))},[]),b=async()=>{d(!0);let _=null;try{if(h.bot){const N={...h.bot};Array.isArray(N.owners)&&(N.owners=N.owners.join(",")),N.password||delete N.password,N.proxyPassword||delete N.proxyPassword,_=await Ne(`/api/bots/${e}`,{method:"PUT",body:JSON.stringify(N)})}h.plugins&&await Promise.all(Object.entries(h.plugins).map(([N,A])=>Ne(`/api/bots/${e}/plugins/${N}`,{method:"PUT",body:JSON.stringify({settings:A})}))),m({title:"Успех!",description:"Все изменения сохранены."}),p({}),_?a(N=>({...N,bot:_})):await v(),await n()}catch(N){m({variant:"destructive",title:"Ошибка сохранения",description:N.message})}d(!1)};if(i)return u.jsx("div",{className:"text-center p-10",children:"Загрузка конфигурации..."});if(!o)return u.jsx("div",{className:"text-center p-10 text-destructive",children:"Не удалось загрузить данные."});const C=Object.keys(h).length>0;return u.jsxs("div",{className:"h-full flex flex-col",children:[u.jsxs("header",{className:"p-4 border-b flex justify-between items-center shrink-0",children:[u.jsxs("div",{children:[u.jsx("h2",{className:"text-xl font-bold",children:"Конфигурация бота"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:'Все настройки в одном месте. Нажмите "Сохранить всё", чтобы применить изменения.'})]}),u.jsxs(pe,{onClick:b,disabled:!C||l,children:[l?u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}):u.jsx(si,{className:"mr-2 h-4 w-4"}),"Сохранить изменения"]})]}),u.jsxs(Np,{defaultValue:"general",className:"flex-grow flex flex-col overflow-hidden",children:[u.jsxs(y2,{className:"m-4 shrink-0 self-start",children:[u.jsx(Ao,{value:"general",children:"Общие настройки"}),u.jsx(Ao,{value:"plugins",children:"Настройки плагинов"})]}),u.jsx(Mr,{value:"general",className:"flex-grow overflow-y-auto px-4 pb-4",children:u.jsx(eoe,{bot:o.bot,servers:t,onFormChange:x,showFooter:!1})}),u.jsx(Mr,{value:"plugins",className:"flex-grow overflow-y-auto px-4 pb-4",children:o.plugins.length>0?u.jsx(die,{type:"multiple",className:"w-full space-y-4",children:o.plugins.map(_=>u.jsxs(jB,{value:`plugin-${_.id}`,className:"border rounded-lg",children:[u.jsx(AB,{className:"px-6 py-4 text-lg font-semibold hover:no-underline",children:u.jsxs("div",{className:"text-left",children:[_.name,u.jsx("p",{className:"text-sm font-normal text-muted-foreground",children:_.description||"Нет описания."})]})}),u.jsx(EB,{className:"px-6 pb-6 border-t pt-6",children:u.jsx(N_t,{plugin:_,onSettingsChange:M})})]},_.id))}):u.jsx("div",{className:"text-center p-10 text-muted-foreground rounded-lg border-2 border-dashed",children:"У установленных плагинов нет настраиваемых параметров."})})]})]})}const IB=k.createContext({});function TB(e){const t=k.useRef(null);return t.current===null&&(t.current=e()),t.current}const RB=typeof window<"u",hie=RB?k.useLayoutEffect:k.useEffect,S$=k.createContext(null);function PB(e,t){e.indexOf(t)===-1&&e.push(t)}function $B(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const fi=(e,t,n)=>n>t?t:n<e?e:n;let DB=()=>{};const pi={},fie=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function pie(e){return typeof e=="object"&&e!==null}const yie=e=>/^0[^.\s]+$/u.test(e);function zB(e){let t;return()=>(t===void 0&&(t=e()),t)}const ba=e=>e,j_t=(e,t)=>n=>t(e(n)),Ap=(...e)=>e.reduce(j_t),B0=(e,t,n)=>{const o=t-e;return o===0?1:(n-e)/o};class OB{constructor(){this.subscriptions=[]}add(t){return PB(this.subscriptions,t),()=>$B(this.subscriptions,t)}notify(t,n,o){const a=this.subscriptions.length;if(a)if(a===1)this.subscriptions[0](t,n,o);else for(let i=0;i<a;i++){const s=this.subscriptions[i];s&&s(t,n,o)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const _r=e=>e*1e3,Sr=e=>e/1e3;function mie(e,t){return t?e*(1e3/t):0}const gie=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,A_t=1e-7,E_t=12;function I_t(e,t,n,o,a){let i,s,l=0;do s=t+(n-t)/2,i=gie(s,o,a)-e,i>0?n=s:t=s;while(Math.abs(i)>A_t&&++l<E_t);return s}function Ep(e,t,n,o){if(e===t&&n===o)return ba;const a=i=>I_t(i,0,1,e,n);return i=>i===0||i===1?i:gie(a(i),t,o)}const vie=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,kie=e=>t=>1-e(1-t),xie=Ep(.33,1.53,.69,.99),qB=kie(xie),wie=vie(qB),bie=e=>(e*=2)<1?.5*qB(e):.5*(2-Math.pow(2,-10*(e-1))),HB=e=>1-Math.sin(Math.acos(e)),Mie=kie(HB),_ie=vie(HB),T_t=Ep(.42,0,1,1),R_t=Ep(0,0,.58,1),Sie=Ep(.42,0,.58,1),P_t=e=>Array.isArray(e)&&typeof e[0]!="number",Cie=e=>Array.isArray(e)&&typeof e[0]=="number",$_t={linear:ba,easeIn:T_t,easeInOut:Sie,easeOut:R_t,circIn:HB,circInOut:_ie,circOut:Mie,backIn:qB,backInOut:wie,backOut:xie,anticipate:bie},D_t=e=>typeof e=="string",vW=e=>{if(Cie(e)){DB(e.length===4);const[t,n,o,a]=e;return Ep(t,n,o,a)}else if(D_t(e))return $_t[e];return e},lm=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],kW={value:null};function z_t(e,t){let n=new Set,o=new Set,a=!1,i=!1;const s=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1},d=0;function h(m){s.has(m)&&(p.schedule(m),e()),d++,m(l)}const p={schedule:(m,v=!1,x=!1)=>{const b=x&&a?n:o;return v&&s.add(m),b.has(m)||b.add(m),m},cancel:m=>{o.delete(m),s.delete(m)},process:m=>{if(l=m,a){i=!0;return}a=!0,[n,o]=[o,n],n.forEach(h),t&&kW.value&&kW.value.frameloop[t].push(d),d=0,n.clear(),a=!1,i&&(i=!1,p.process(m))}};return p}const O_t=40;function Nie(e,t){let n=!1,o=!0;const a={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,s=lm.reduce((A,I)=>(A[I]=z_t(i,t?I:void 0),A),{}),{setup:l,read:d,resolveKeyframes:h,preUpdate:p,update:m,preRender:v,render:x,postRender:M}=s,b=()=>{const A=pi.useManualTiming?a.timestamp:performance.now();n=!1,pi.useManualTiming||(a.delta=o?1e3/60:Math.max(Math.min(A-a.timestamp,O_t),1)),a.timestamp=A,a.isProcessing=!0,l.process(a),d.process(a),h.process(a),p.process(a),m.process(a),v.process(a),x.process(a),M.process(a),a.isProcessing=!1,n&&t&&(o=!1,e(b))},C=()=>{n=!0,o=!0,a.isProcessing||e(b)};return{schedule:lm.reduce((A,I)=>{const R=s[I];return A[I]=(j,D=!1,H=!1)=>(n||C(),R.schedule(j,D,H)),A},{}),cancel:A=>{for(let I=0;I<lm.length;I++)s[lm[I]].cancel(A)},state:a,steps:s}}const{schedule:ln,cancel:As,state:io,steps:PO}=Nie(typeof requestAnimationFrame<"u"?requestAnimationFrame:ba,!0);let NR;function q_t(){NR=void 0}const Eo={now:()=>(NR===void 0&&Eo.set(io.isProcessing||pi.useManualTiming?io.timestamp:performance.now()),NR),set:e=>{NR=e,queueMicrotask(q_t)}},Lie=e=>t=>typeof t=="string"&&t.startsWith(e),VB=Lie("--"),H_t=Lie("var(--"),BB=e=>H_t(e)?V_t.test(e.split("/*")[0].trim()):!1,V_t=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,m2={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},F0={...m2,transform:e=>fi(0,1,e)},um={...m2,default:1},S0=e=>Math.round(e*1e5)/1e5,FB=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function B_t(e){return e==null}const F_t=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,UB=(e,t)=>n=>!!(typeof n=="string"&&F_t.test(n)&&n.startsWith(e)||t&&!B_t(n)&&Object.prototype.hasOwnProperty.call(n,t)),jie=(e,t,n)=>o=>{if(typeof o!="string")return o;const[a,i,s,l]=o.match(FB);return{[e]:parseFloat(a),[t]:parseFloat(i),[n]:parseFloat(s),alpha:l!==void 0?parseFloat(l):1}},U_t=e=>fi(0,255,e),$O={...m2,transform:e=>Math.round(U_t(e))},$d={test:UB("rgb","red"),parse:jie("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:o=1})=>"rgba("+$O.transform(e)+", "+$O.transform(t)+", "+$O.transform(n)+", "+S0(F0.transform(o))+")"};function G_t(e){let t="",n="",o="",a="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),o=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),o=e.substring(3,4),a=e.substring(4,5),t+=t,n+=n,o+=o,a+=a),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(o,16),alpha:a?parseInt(a,16)/255:1}}const vH={test:UB("#"),parse:G_t,transform:$d.transform},Ip=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Yi=Ip("deg"),Cr=Ip("%"),rt=Ip("px"),X_t=Ip("vh"),Z_t=Ip("vw"),xW={...Cr,parse:e=>Cr.parse(e)/100,transform:e=>Cr.transform(e*100)},mh={test:UB("hsl","hue"),parse:jie("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:o=1})=>"hsla("+Math.round(e)+", "+Cr.transform(S0(t))+", "+Cr.transform(S0(n))+", "+S0(F0.transform(o))+")"},Pn={test:e=>$d.test(e)||vH.test(e)||mh.test(e),parse:e=>$d.test(e)?$d.parse(e):mh.test(e)?mh.parse(e):vH.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?$d.transform(e):mh.transform(e),getAnimatableNone:e=>{const t=Pn.parse(e);return t.alpha=0,Pn.transform(t)}},Y_t=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function W_t(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(FB))==null?void 0:t.length)||0)+(((n=e.match(Y_t))==null?void 0:n.length)||0)>0}const Aie="number",Eie="color",K_t="var",Q_t="var(",wW="${}",J_t=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function U0(e){const t=e.toString(),n=[],o={color:[],number:[],var:[]},a=[];let i=0;const l=t.replace(J_t,d=>(Pn.test(d)?(o.color.push(i),a.push(Eie),n.push(Pn.parse(d))):d.startsWith(Q_t)?(o.var.push(i),a.push(K_t),n.push(d)):(o.number.push(i),a.push(Aie),n.push(parseFloat(d))),++i,wW)).split(wW);return{values:n,split:l,indexes:o,types:a}}function Iie(e){return U0(e).values}function Tie(e){const{split:t,types:n}=U0(e),o=t.length;return a=>{let i="";for(let s=0;s<o;s++)if(i+=t[s],a[s]!==void 0){const l=n[s];l===Aie?i+=S0(a[s]):l===Eie?i+=Pn.transform(a[s]):i+=a[s]}return i}}const e9t=e=>typeof e=="number"?0:Pn.test(e)?Pn.getAnimatableNone(e):e;function t9t(e){const t=Iie(e);return Tie(e)(t.map(e9t))}const Es={test:W_t,parse:Iie,createTransformer:Tie,getAnimatableNone:t9t};function DO(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function n9t({hue:e,saturation:t,lightness:n,alpha:o}){e/=360,t/=100,n/=100;let a=0,i=0,s=0;if(!t)a=i=s=n;else{const l=n<.5?n*(1+t):n+t-n*t,d=2*n-l;a=DO(d,l,e+1/3),i=DO(d,l,e),s=DO(d,l,e-1/3)}return{red:Math.round(a*255),green:Math.round(i*255),blue:Math.round(s*255),alpha:o}}function aP(e,t){return n=>n>0?t:e}const cn=(e,t,n)=>e+(t-e)*n,zO=(e,t,n)=>{const o=e*e,a=n*(t*t-o)+o;return a<0?0:Math.sqrt(a)},o9t=[vH,$d,mh],a9t=e=>o9t.find(t=>t.test(e));function bW(e){const t=a9t(e);if(!t)return!1;let n=t.parse(e);return t===mh&&(n=n9t(n)),n}const MW=(e,t)=>{const n=bW(e),o=bW(t);if(!n||!o)return aP(e,t);const a={...n};return i=>(a.red=zO(n.red,o.red,i),a.green=zO(n.green,o.green,i),a.blue=zO(n.blue,o.blue,i),a.alpha=cn(n.alpha,o.alpha,i),$d.transform(a))},kH=new Set(["none","hidden"]);function r9t(e,t){return kH.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function i9t(e,t){return n=>cn(e,t,n)}function GB(e){return typeof e=="number"?i9t:typeof e=="string"?BB(e)?aP:Pn.test(e)?MW:l9t:Array.isArray(e)?Rie:typeof e=="object"?Pn.test(e)?MW:s9t:aP}function Rie(e,t){const n=[...e],o=n.length,a=e.map((i,s)=>GB(i)(i,t[s]));return i=>{for(let s=0;s<o;s++)n[s]=a[s](i);return n}}function s9t(e,t){const n={...e,...t},o={};for(const a in n)e[a]!==void 0&&t[a]!==void 0&&(o[a]=GB(e[a])(e[a],t[a]));return a=>{for(const i in o)n[i]=o[i](a);return n}}function c9t(e,t){const n=[],o={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){const i=t.types[a],s=e.indexes[i][o[i]],l=e.values[s]??0;n[a]=l,o[i]++}return n}const l9t=(e,t)=>{const n=Es.createTransformer(t),o=U0(e),a=U0(t);return o.indexes.var.length===a.indexes.var.length&&o.indexes.color.length===a.indexes.color.length&&o.indexes.number.length>=a.indexes.number.length?kH.has(e)&&!a.values.length||kH.has(t)&&!o.values.length?r9t(e,t):Ap(Rie(c9t(o,a),a.values),n):aP(e,t)};function Pie(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?cn(e,t,n):GB(e)(e,t)}const u9t=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>ln.update(t,n),stop:()=>As(t),now:()=>io.isProcessing?io.timestamp:Eo.now()}},$ie=(e,t,n=10)=>{let o="";const a=Math.max(Math.round(t/n),2);for(let i=0;i<a;i++)o+=Math.round(e(i/(a-1))*1e4)/1e4+", ";return`linear(${o.substring(0,o.length-2)})`},rP=2e4;function XB(e){let t=0;const n=50;let o=e.next(t);for(;!o.done&&t<rP;)t+=n,o=e.next(t);return t>=rP?1/0:t}function d9t(e,t=100,n){const o=n({...e,keyframes:[0,t]}),a=Math.min(XB(o),rP);return{type:"keyframes",ease:i=>o.next(a*i).value/t,duration:Sr(a)}}const h9t=5;function Die(e,t,n){const o=Math.max(t-h9t,0);return mie(n-e(o),t-o)}const yn={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},OO=.001;function f9t({duration:e=yn.duration,bounce:t=yn.bounce,velocity:n=yn.velocity,mass:o=yn.mass}){let a,i,s=1-t;s=fi(yn.minDamping,yn.maxDamping,s),e=fi(yn.minDuration,yn.maxDuration,Sr(e)),s<1?(a=h=>{const p=h*s,m=p*e,v=p-n,x=xH(h,s),M=Math.exp(-m);return OO-v/x*M},i=h=>{const m=h*s*e,v=m*n+n,x=Math.pow(s,2)*Math.pow(h,2)*e,M=Math.exp(-m),b=xH(Math.pow(h,2),s);return(-a(h)+OO>0?-1:1)*((v-x)*M)/b}):(a=h=>{const p=Math.exp(-h*e),m=(h-n)*e+1;return-OO+p*m},i=h=>{const p=Math.exp(-h*e),m=(n-h)*(e*e);return p*m});const l=5/e,d=y9t(a,i,l);if(e=_r(e),isNaN(d))return{stiffness:yn.stiffness,damping:yn.damping,duration:e};{const h=Math.pow(d,2)*o;return{stiffness:h,damping:s*2*Math.sqrt(o*h),duration:e}}}const p9t=12;function y9t(e,t,n){let o=n;for(let a=1;a<p9t;a++)o=o-e(o)/t(o);return o}function xH(e,t){return e*Math.sqrt(1-t*t)}const m9t=["duration","bounce"],g9t=["stiffness","damping","mass"];function _W(e,t){return t.some(n=>e[n]!==void 0)}function v9t(e){let t={velocity:yn.velocity,stiffness:yn.stiffness,damping:yn.damping,mass:yn.mass,isResolvedFromDuration:!1,...e};if(!_W(e,g9t)&&_W(e,m9t))if(e.visualDuration){const n=e.visualDuration,o=2*Math.PI/(n*1.2),a=o*o,i=2*fi(.05,1,1-(e.bounce||0))*Math.sqrt(a);t={...t,mass:yn.mass,stiffness:a,damping:i}}else{const n=f9t(e);t={...t,...n,mass:yn.mass},t.isResolvedFromDuration=!0}return t}function iP(e=yn.visualDuration,t=yn.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:o,restDelta:a}=n;const i=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],l={done:!1,value:i},{stiffness:d,damping:h,mass:p,duration:m,velocity:v,isResolvedFromDuration:x}=v9t({...n,velocity:-Sr(n.velocity||0)}),M=v||0,b=h/(2*Math.sqrt(d*p)),C=s-i,_=Sr(Math.sqrt(d/p)),N=Math.abs(C)<5;o||(o=N?yn.restSpeed.granular:yn.restSpeed.default),a||(a=N?yn.restDelta.granular:yn.restDelta.default);let A;if(b<1){const R=xH(_,b);A=j=>{const D=Math.exp(-b*_*j);return s-D*((M+b*_*C)/R*Math.sin(R*j)+C*Math.cos(R*j))}}else if(b===1)A=R=>s-Math.exp(-_*R)*(C+(M+_*C)*R);else{const R=_*Math.sqrt(b*b-1);A=j=>{const D=Math.exp(-b*_*j),H=Math.min(R*j,300);return s-D*((M+b*_*C)*Math.sinh(H)+R*C*Math.cosh(H))/R}}const I={calculatedDuration:x&&m||null,next:R=>{const j=A(R);if(x)l.done=R>=m;else{let D=R===0?M:0;b<1&&(D=R===0?_r(M):Die(A,R,j));const H=Math.abs(D)<=o,U=Math.abs(s-j)<=a;l.done=H&&U}return l.value=l.done?s:j,l},toString:()=>{const R=Math.min(XB(I),rP),j=$ie(D=>I.next(R*D).value,R,30);return R+"ms "+j},toTransition:()=>{}};return I}iP.applyToOptions=e=>{const t=d9t(e,100,iP);return e.ease=t.ease,e.duration=_r(t.duration),e.type="keyframes",e};function wH({keyframes:e,velocity:t=0,power:n=.8,timeConstant:o=325,bounceDamping:a=10,bounceStiffness:i=500,modifyTarget:s,min:l,max:d,restDelta:h=.5,restSpeed:p}){const m=e[0],v={done:!1,value:m},x=H=>l!==void 0&&H<l||d!==void 0&&H>d,M=H=>l===void 0?d:d===void 0||Math.abs(l-H)<Math.abs(d-H)?l:d;let b=n*t;const C=m+b,_=s===void 0?C:s(C);_!==C&&(b=_-m);const N=H=>-b*Math.exp(-H/o),A=H=>_+N(H),I=H=>{const U=N(H),z=A(H);v.done=Math.abs(U)<=h,v.value=v.done?_:z};let R,j;const D=H=>{x(v.value)&&(R=H,j=iP({keyframes:[v.value,M(v.value)],velocity:Die(A,H,v.value),damping:a,stiffness:i,restDelta:h,restSpeed:p}))};return D(0),{calculatedDuration:null,next:H=>{let U=!1;return!j&&R===void 0&&(U=!0,I(H),D(H)),R!==void 0&&H>=R?j.next(H-R):(!U&&I(H),v)}}}function k9t(e,t,n){const o=[],a=n||pi.mix||Pie,i=e.length-1;for(let s=0;s<i;s++){let l=a(e[s],e[s+1]);if(t){const d=Array.isArray(t)?t[s]||ba:t;l=Ap(d,l)}o.push(l)}return o}function x9t(e,t,{clamp:n=!0,ease:o,mixer:a}={}){const i=e.length;if(DB(i===t.length),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const s=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=k9t(t,o,a),d=l.length,h=p=>{if(s&&p<e[0])return t[0];let m=0;if(d>1)for(;m<e.length-2&&!(p<e[m+1]);m++);const v=B0(e[m],e[m+1],p);return l[m](v)};return n?p=>h(fi(e[0],e[i-1],p)):h}function w9t(e,t){const n=e[e.length-1];for(let o=1;o<=t;o++){const a=B0(0,t,o);e.push(cn(n,1,a))}}function b9t(e){const t=[0];return w9t(t,e.length-1),t}function M9t(e,t){return e.map(n=>n*t)}function _9t(e,t){return e.map(()=>t||Sie).splice(0,e.length-1)}function C0({duration:e=300,keyframes:t,times:n,ease:o="easeInOut"}){const a=P_t(o)?o.map(vW):vW(o),i={done:!1,value:t[0]},s=M9t(n&&n.length===t.length?n:b9t(t),e),l=x9t(s,t,{ease:Array.isArray(a)?a:_9t(t,a)});return{calculatedDuration:e,next:d=>(i.value=l(d),i.done=d>=e,i)}}const S9t=e=>e!==null;function ZB(e,{repeat:t,repeatType:n="loop"},o,a=1){const i=e.filter(S9t),l=a<0||t&&n!=="loop"&&t%2===1?0:i.length-1;return!l||o===void 0?i[l]:o}const C9t={decay:wH,inertia:wH,tween:C0,keyframes:C0,spring:iP};function zie(e){typeof e.type=="string"&&(e.type=C9t[e.type])}class YB{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const N9t=e=>e/100;class WB extends YB{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var o,a;const{motionValue:n}=this.options;n&&n.updatedAt!==Eo.now()&&this.tick(Eo.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(a=(o=this.options).onStop)==null||a.call(o))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;zie(t);const{type:n=C0,repeat:o=0,repeatDelay:a=0,repeatType:i,velocity:s=0}=t;let{keyframes:l}=t;const d=n||C0;d!==C0&&typeof l[0]!="number"&&(this.mixKeyframes=Ap(N9t,Pie(l[0],l[1])),l=[0,100]);const h=d({...t,keyframes:l});i==="mirror"&&(this.mirroredGenerator=d({...t,keyframes:[...l].reverse(),velocity:-s})),h.calculatedDuration===null&&(h.calculatedDuration=XB(h));const{calculatedDuration:p}=h;this.calculatedDuration=p,this.resolvedDuration=p+a,this.totalDuration=this.resolvedDuration*(o+1)-a,this.generator=h}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:o,totalDuration:a,mixKeyframes:i,mirroredGenerator:s,resolvedDuration:l,calculatedDuration:d}=this;if(this.startTime===null)return o.next(0);const{delay:h=0,keyframes:p,repeat:m,repeatType:v,repeatDelay:x,type:M,onUpdate:b,finalKeyframe:C}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-a/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const _=this.currentTime-h*(this.playbackSpeed>=0?1:-1),N=this.playbackSpeed>=0?_<0:_>a;this.currentTime=Math.max(_,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=a);let A=this.currentTime,I=o;if(m){const H=Math.min(this.currentTime,a)/l;let U=Math.floor(H),z=H%1;!z&&H>=1&&(z=1),z===1&&U--,U=Math.min(U,m+1),!!(U%2)&&(v==="reverse"?(z=1-z,x&&(z-=x/l)):v==="mirror"&&(I=s)),A=fi(0,1,z)*l}const R=N?{done:!1,value:p[0]}:I.next(A);i&&(R.value=i(R.value));let{done:j}=R;!N&&d!==null&&(j=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const D=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&j);return D&&M!==wH&&(R.value=ZB(p,this.options,C,this.speed)),b&&b(R.value),D&&this.finish(),R}then(t,n){return this.finished.then(t,n)}get duration(){return Sr(this.calculatedDuration)}get time(){return Sr(this.currentTime)}set time(t){var n;t=_r(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(Eo.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Sr(this.currentTime))}play(){var a,i;if(this.isStopped)return;const{driver:t=u9t,startTime:n}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),(i=(a=this.options).onPlay)==null||i.call(a);const o=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=o):this.holdTime!==null?this.startTime=o-this.holdTime:this.startTime||(this.startTime=n??o),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Eo.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function L9t(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Dd=e=>e*180/Math.PI,bH=e=>{const t=Dd(Math.atan2(e[1],e[0]));return MH(t)},j9t={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:bH,rotateZ:bH,skewX:e=>Dd(Math.atan(e[1])),skewY:e=>Dd(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},MH=e=>(e=e%360,e<0&&(e+=360),e),SW=bH,CW=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),NW=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),A9t={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:CW,scaleY:NW,scale:e=>(CW(e)+NW(e))/2,rotateX:e=>MH(Dd(Math.atan2(e[6],e[5]))),rotateY:e=>MH(Dd(Math.atan2(-e[2],e[0]))),rotateZ:SW,rotate:SW,skewX:e=>Dd(Math.atan(e[4])),skewY:e=>Dd(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function _H(e){return e.includes("scale")?1:0}function SH(e,t){if(!e||e==="none")return _H(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let o,a;if(n)o=A9t,a=n;else{const l=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);o=j9t,a=l}if(!a)return _H(t);const i=o[t],s=a[1].split(",").map(I9t);return typeof i=="function"?i(s):s[i]}const E9t=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return SH(n,t)};function I9t(e){return parseFloat(e.trim())}const g2=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],v2=new Set(g2),LW=e=>e===m2||e===rt,T9t=new Set(["x","y","z"]),R9t=g2.filter(e=>!T9t.has(e));function P9t(e){const t=[];return R9t.forEach(n=>{const o=e.getValue(n);o!==void 0&&(t.push([n,o.get()]),o.set(n.startsWith("scale")?1:0))}),t}const Kd={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>SH(t,"x"),y:(e,{transform:t})=>SH(t,"y")};Kd.translateX=Kd.x;Kd.translateY=Kd.y;const Qd=new Set;let CH=!1,NH=!1,LH=!1;function Oie(){if(NH){const e=Array.from(Qd).filter(o=>o.needsMeasurement),t=new Set(e.map(o=>o.element)),n=new Map;t.forEach(o=>{const a=P9t(o);a.length&&(n.set(o,a),o.render())}),e.forEach(o=>o.measureInitialState()),t.forEach(o=>{o.render();const a=n.get(o);a&&a.forEach(([i,s])=>{var l;(l=o.getValue(i))==null||l.set(s)})}),e.forEach(o=>o.measureEndState()),e.forEach(o=>{o.suspendedScrollY!==void 0&&window.scrollTo(0,o.suspendedScrollY)})}NH=!1,CH=!1,Qd.forEach(e=>e.complete(LH)),Qd.clear()}function qie(){Qd.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(NH=!0)})}function $9t(){LH=!0,qie(),Oie(),LH=!1}class KB{constructor(t,n,o,a,i,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=o,this.motionValue=a,this.element=i,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(Qd.add(this),CH||(CH=!0,ln.read(qie),ln.resolveKeyframes(Oie))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:o,motionValue:a}=this;if(t[0]===null){const i=a==null?void 0:a.get(),s=t[t.length-1];if(i!==void 0)t[0]=i;else if(o&&n){const l=o.readValue(n,s);l!=null&&(t[0]=l)}t[0]===void 0&&(t[0]=s),a&&i===void 0&&a.set(t[0])}L9t(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Qd.delete(this)}cancel(){this.state==="scheduled"&&(Qd.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const D9t=e=>e.startsWith("--");function z9t(e,t,n){D9t(t)?e.style.setProperty(t,n):e.style[t]=n}const O9t=zB(()=>window.ScrollTimeline!==void 0),q9t={};function H9t(e,t){const n=zB(e);return()=>q9t[t]??n()}const Hie=H9t(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),qf=([e,t,n,o])=>`cubic-bezier(${e}, ${t}, ${n}, ${o})`,jW={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:qf([0,.65,.55,1]),circOut:qf([.55,0,1,.45]),backIn:qf([.31,.01,.66,-.59]),backOut:qf([.33,1.53,.69,.99])};function Vie(e,t){if(e)return typeof e=="function"?Hie()?$ie(e,t):"ease-out":Cie(e)?qf(e):Array.isArray(e)?e.map(n=>Vie(n,t)||jW.easeOut):jW[e]}function V9t(e,t,n,{delay:o=0,duration:a=300,repeat:i=0,repeatType:s="loop",ease:l="easeOut",times:d}={},h=void 0){const p={[t]:n};d&&(p.offset=d);const m=Vie(l,a);Array.isArray(m)&&(p.easing=m);const v={delay:o,duration:a,easing:Array.isArray(m)?"linear":m,fill:"both",iterations:i+1,direction:s==="reverse"?"alternate":"normal"};return h&&(v.pseudoElement=h),e.animate(p,v)}function Bie(e){return typeof e=="function"&&"applyToOptions"in e}function B9t({type:e,...t}){return Bie(e)&&Hie()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class F9t extends YB{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:o,keyframes:a,pseudoElement:i,allowFlatten:s=!1,finalKeyframe:l,onComplete:d}=t;this.isPseudoElement=!!i,this.allowFlatten=s,this.options=t,DB(typeof t.type!="string");const h=B9t(t);this.animation=V9t(n,o,a,h,i),h.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const p=ZB(a,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(p):z9t(n,o,p),this.animation.cancel()}d==null||d(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,n;this.isPseudoElement||(n=(t=this.animation).commitStyles)==null||n.call(t)}get duration(){var n,o;const t=((o=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:o.call(n).duration)||0;return Sr(Number(t))}get time(){return Sr(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=_r(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){var o;return this.allowFlatten&&((o=this.animation.effect)==null||o.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&O9t()?(this.animation.timeline=t,ba):n(this)}}const Fie={anticipate:bie,backInOut:wie,circInOut:_ie};function U9t(e){return e in Fie}function G9t(e){typeof e.ease=="string"&&U9t(e.ease)&&(e.ease=Fie[e.ease])}const AW=10;class X9t extends F9t{constructor(t){G9t(t),zie(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:o,onComplete:a,element:i,...s}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const l=new WB({...s,autoplay:!1}),d=_r(this.finishedTime??this.time);n.setWithVelocity(l.sample(d-AW).value,l.sample(d).value,AW),l.stop()}}const EW=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Es.test(e)||e==="0")&&!e.startsWith("url("));function Z9t(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function Y9t(e,t,n,o){const a=e[0];if(a===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],s=EW(a,t),l=EW(i,t);return!s||!l?!1:Z9t(e)||(n==="spring"||Bie(n))&&o}function QB(e){return pie(e)&&"offsetHeight"in e}const W9t=new Set(["opacity","clipPath","filter","transform"]),K9t=zB(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Q9t(e){var h;const{motionValue:t,name:n,repeatDelay:o,repeatType:a,damping:i,type:s}=e;if(!QB((h=t==null?void 0:t.owner)==null?void 0:h.current))return!1;const{onUpdate:l,transformTemplate:d}=t.owner.getProps();return K9t()&&n&&W9t.has(n)&&(n!=="transform"||!d)&&!l&&!o&&a!=="mirror"&&i!==0&&s!=="inertia"}const J9t=40;class eSt extends YB{constructor({autoplay:t=!0,delay:n=0,type:o="keyframes",repeat:a=0,repeatDelay:i=0,repeatType:s="loop",keyframes:l,name:d,motionValue:h,element:p,...m}){var M;super(),this.stop=()=>{var b,C;this._animation&&(this._animation.stop(),(b=this.stopTimeline)==null||b.call(this)),(C=this.keyframeResolver)==null||C.cancel()},this.createdAt=Eo.now();const v={autoplay:t,delay:n,type:o,repeat:a,repeatDelay:i,repeatType:s,name:d,motionValue:h,element:p,...m},x=(p==null?void 0:p.KeyframeResolver)||KB;this.keyframeResolver=new x(l,(b,C,_)=>this.onKeyframesResolved(b,C,v,!_),d,h,p),(M=this.keyframeResolver)==null||M.scheduleResolve()}onKeyframesResolved(t,n,o,a){this.keyframeResolver=void 0;const{name:i,type:s,velocity:l,delay:d,isHandoff:h,onUpdate:p}=o;this.resolvedAt=Eo.now(),Y9t(t,i,s,l)||((pi.instantAnimations||!d)&&(p==null||p(ZB(t,o,n))),t[0]=t[t.length-1],o.duration=0,o.repeat=0);const v={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>J9t?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...o,keyframes:t},x=!h&&Q9t(v)?new X9t({...v,element:v.motionValue.owner.current}):new WB(v);x.finished.then(()=>this.notifyFinished()).catch(ba),this.pendingTimeline&&(this.stopTimeline=x.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=x}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),$9t()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}const tSt=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function nSt(e){const t=tSt.exec(e);if(!t)return[,];const[,n,o,a]=t;return[`--${n??o}`,a]}function Uie(e,t,n=1){const[o,a]=nSt(e);if(!o)return;const i=window.getComputedStyle(t).getPropertyValue(o);if(i){const s=i.trim();return fie(s)?parseFloat(s):s}return BB(a)?Uie(a,t,n+1):a}function JB(e,t){return(e==null?void 0:e[t])??(e==null?void 0:e.default)??e}const Gie=new Set(["width","height","top","left","right","bottom",...g2]),oSt={test:e=>e==="auto",parse:e=>e},Xie=e=>t=>t.test(e),Zie=[m2,rt,Cr,Yi,Z_t,X_t,oSt],IW=e=>Zie.find(Xie(e));function aSt(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||yie(e):!0}const rSt=new Set(["brightness","contrast","saturate","opacity"]);function iSt(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[o]=n.match(FB)||[];if(!o)return e;const a=n.replace(o,"");let i=rSt.has(t)?1:0;return o!==n&&(i*=100),t+"("+i+a+")"}const sSt=/\b([a-z-]*)\(.*?\)/gu,jH={...Es,getAnimatableNone:e=>{const t=e.match(sSt);return t?t.map(iSt).join(" "):e}},TW={...m2,transform:Math.round},cSt={rotate:Yi,rotateX:Yi,rotateY:Yi,rotateZ:Yi,scale:um,scaleX:um,scaleY:um,scaleZ:um,skew:Yi,skewX:Yi,skewY:Yi,distance:rt,translateX:rt,translateY:rt,translateZ:rt,x:rt,y:rt,z:rt,perspective:rt,transformPerspective:rt,opacity:F0,originX:xW,originY:xW,originZ:rt},eF={borderWidth:rt,borderTopWidth:rt,borderRightWidth:rt,borderBottomWidth:rt,borderLeftWidth:rt,borderRadius:rt,radius:rt,borderTopLeftRadius:rt,borderTopRightRadius:rt,borderBottomRightRadius:rt,borderBottomLeftRadius:rt,width:rt,maxWidth:rt,height:rt,maxHeight:rt,top:rt,right:rt,bottom:rt,left:rt,padding:rt,paddingTop:rt,paddingRight:rt,paddingBottom:rt,paddingLeft:rt,margin:rt,marginTop:rt,marginRight:rt,marginBottom:rt,marginLeft:rt,backgroundPositionX:rt,backgroundPositionY:rt,...cSt,zIndex:TW,fillOpacity:F0,strokeOpacity:F0,numOctaves:TW},lSt={...eF,color:Pn,backgroundColor:Pn,outlineColor:Pn,fill:Pn,stroke:Pn,borderColor:Pn,borderTopColor:Pn,borderRightColor:Pn,borderBottomColor:Pn,borderLeftColor:Pn,filter:jH,WebkitFilter:jH},Yie=e=>lSt[e];function Wie(e,t){let n=Yie(e);return n!==jH&&(n=Es),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const uSt=new Set(["auto","none","0"]);function dSt(e,t,n){let o=0,a;for(;o<e.length&&!a;){const i=e[o];typeof i=="string"&&!uSt.has(i)&&U0(i).values.length&&(a=e[o]),o++}if(a&&n)for(const i of t)e[i]=Wie(n,a)}class hSt extends KB{constructor(t,n,o,a,i){super(t,n,o,a,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:o}=this;if(!n||!n.current)return;super.readKeyframes();for(let d=0;d<t.length;d++){let h=t[d];if(typeof h=="string"&&(h=h.trim(),BB(h))){const p=Uie(h,n.current);p!==void 0&&(t[d]=p),d===t.length-1&&(this.finalKeyframe=h)}}if(this.resolveNoneKeyframes(),!Gie.has(o)||t.length!==2)return;const[a,i]=t,s=IW(a),l=IW(i);if(s!==l)if(LW(s)&&LW(l))for(let d=0;d<t.length;d++){const h=t[d];typeof h=="string"&&(t[d]=parseFloat(h))}else Kd[o]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,o=[];for(let a=0;a<t.length;a++)(t[a]===null||aSt(t[a]))&&o.push(a);o.length&&dSt(t,o,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:o}=this;if(!t||!t.current)return;o==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Kd[o](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const a=n[n.length-1];a!==void 0&&t.getValue(o,a).jump(a,!1)}measureEndState(){var l;const{element:t,name:n,unresolvedKeyframes:o}=this;if(!t||!t.current)return;const a=t.getValue(n);a&&a.jump(this.measuredOrigin,!1);const i=o.length-1,s=o[i];o[i]=Kd[n](t.measureViewportBox(),window.getComputedStyle(t.current)),s!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=s),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([d,h])=>{t.getValue(d).set(h)}),this.resolveNoneKeyframes()}}function fSt(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let o=document;const a=(n==null?void 0:n[e])??o.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e)}const Kie=(e,t)=>t&&typeof e=="number"?t.transform(e):e,RW=30,pSt=e=>!isNaN(parseFloat(e));class ySt{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(o,a=!0)=>{var s,l;const i=Eo.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(o),this.current!==this.prev&&((s=this.events.change)==null||s.notify(this.current),this.dependents))for(const d of this.dependents)d.dirty();a&&((l=this.events.renderRequest)==null||l.notify(this.current))},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Eo.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=pSt(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new OB);const o=this.events[t].add(n);return t==="change"?()=>{o(),ln.read(()=>{this.events.change.getSize()||this.stop()})}:o}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,o){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-o}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Eo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>RW)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,RW);return mie(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Wh(e,t){return new ySt(e,t)}const{schedule:tF}=Nie(queueMicrotask,!1),$a={x:!1,y:!1};function Qie(){return $a.x||$a.y}function mSt(e){return e==="x"||e==="y"?$a[e]?null:($a[e]=!0,()=>{$a[e]=!1}):$a.x||$a.y?null:($a.x=$a.y=!0,()=>{$a.x=$a.y=!1})}function Jie(e,t){const n=fSt(e),o=new AbortController,a={passive:!0,...t,signal:o.signal};return[n,a,()=>o.abort()]}function PW(e){return!(e.pointerType==="touch"||Qie())}function gSt(e,t,n={}){const[o,a,i]=Jie(e,n),s=l=>{if(!PW(l))return;const{target:d}=l,h=t(d,l);if(typeof h!="function"||!d)return;const p=m=>{PW(m)&&(h(m),d.removeEventListener("pointerleave",p))};d.addEventListener("pointerleave",p,a)};return o.forEach(l=>{l.addEventListener("pointerenter",s,a)}),i}const ese=(e,t)=>t?e===t?!0:ese(e,t.parentElement):!1,nF=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,vSt=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function kSt(e){return vSt.has(e.tagName)||e.tabIndex!==-1}const LR=new WeakSet;function $W(e){return t=>{t.key==="Enter"&&e(t)}}function qO(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const xSt=(e,t)=>{const n=e.currentTarget;if(!n)return;const o=$W(()=>{if(LR.has(n))return;qO(n,"down");const a=$W(()=>{qO(n,"up")}),i=()=>qO(n,"cancel");n.addEventListener("keyup",a,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",o,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",o),t)};function DW(e){return nF(e)&&!Qie()}function wSt(e,t,n={}){const[o,a,i]=Jie(e,n),s=l=>{const d=l.currentTarget;if(!DW(l))return;LR.add(d);const h=t(d,l),p=(x,M)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",v),LR.has(d)&&LR.delete(d),DW(x)&&typeof h=="function"&&h(x,{success:M})},m=x=>{p(x,d===window||d===document||n.useGlobalTarget||ese(d,x.target))},v=x=>{p(x,!1)};window.addEventListener("pointerup",m,a),window.addEventListener("pointercancel",v,a)};return o.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",s,a),QB(l)&&(l.addEventListener("focus",h=>xSt(h,a)),!kSt(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),i}function tse(e){return pie(e)&&"ownerSVGElement"in e}function bSt(e){return tse(e)&&e.tagName==="svg"}const uo=e=>!!(e&&e.getVelocity),MSt=[...Zie,Pn,Es],_St=e=>MSt.find(Xie(e)),oF=k.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class SSt extends k.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const o=n.offsetParent,a=QB(o)&&o.offsetWidth||0,i=this.props.sizeRef.current;i.height=n.offsetHeight||0,i.width=n.offsetWidth||0,i.top=n.offsetTop,i.left=n.offsetLeft,i.right=a-i.width-i.left}return null}componentDidUpdate(){}render(){return this.props.children}}function CSt({children:e,isPresent:t,anchorX:n}){const o=k.useId(),a=k.useRef(null),i=k.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:s}=k.useContext(oF);return k.useInsertionEffect(()=>{const{width:l,height:d,top:h,left:p,right:m}=i.current;if(t||!a.current||!l||!d)return;const v=n==="left"?`left: ${p}`:`right: ${m}`;a.current.dataset.motionPopId=o;const x=document.createElement("style");return s&&(x.nonce=s),document.head.appendChild(x),x.sheet&&x.sheet.insertRule(`
8167
8167
  [data-motion-pop-id="${o}"] {
@@ -8187,7 +8187,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
8187
8187
  *
8188
8188
  * This source code is licensed under the MIT license found in the
8189
8189
  * LICENSE file in the root directory of this source tree.
8190
- */var TK;function ELt(){if(TK)return YO;TK=1;var e=sp(),t=ALt();function n(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var o=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,l=e.useMemo,d=e.useDebugValue;return YO.useSyncExternalStoreWithSelector=function(h,p,m,v,x){var M=i(null);if(M.current===null){var b={hasValue:!1,value:null};M.current=b}else b=M.current;M=l(function(){function _(j){if(!N){if(N=!0,A=j,j=v(j),x!==void 0&&b.hasValue){var D=b.value;if(x(D,j))return I=D}return I=j}if(D=I,o(A,j))return D;var H=v(j);return x!==void 0&&x(D,H)?(A=j,D):(A=j,I=H)}var N=!1,A,I,R=m===void 0?null:m;return[function(){return _(p())},R===null?void 0:function(){return _(R())}]},[p,m,v,x]);var C=a(h,M[0],M[1]);return s(function(){b.hasValue=!0,b.value=C},[C]),d(C),C},YO}var RK;function ILt(){return RK||(RK=1,ZO.exports=ELt()),ZO.exports}var TLt=ILt();const RLt=d1(TLt),PLt={},PK=e=>{let t;const n=new Set,o=(p,m)=>{const v=typeof p=="function"?p(t):p;if(!Object.is(v,t)){const x=t;t=m??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(M=>M(t,x))}},a=()=>t,d={setState:o,getState:a,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(PLt?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},h=t=e(o,a,d);return d},$Lt=e=>e?PK(e):PK,{useDebugValue:DLt}=le,{useSyncExternalStoreWithSelector:zLt}=RLt,OLt=e=>e;function Bse(e,t=OLt,n){const o=zLt(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return DLt(o),o}const $K=(e,t)=>{const n=$Lt(e),o=(a,i=t)=>Bse(n,a,i);return Object.assign(o,n),o},qLt=(e,t)=>e?$K(e,t):$K;function Ro(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,a]of e)if(!Object.is(a,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}var HLt={value:()=>{}};function j$(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new ER(n)}function ER(e){this._=e}function VLt(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",a=n.indexOf(".");if(a>=0&&(o=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}ER.prototype=j$.prototype={constructor:ER,on:function(e,t){var n=this._,o=VLt(e+"",n),a,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((a=(e=o[i]).type)&&(a=BLt(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(a=(e=o[i]).type)n[a]=DK(n[a],e.name,t);else if(t==null)for(a in n)n[a]=DK(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ER(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),o=0,a,i;o<a;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,a=i.length;o<a;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],a=0,i=o.length;a<i;++a)o[a].value.apply(t,n)}};function BLt(e,t){for(var n=0,o=e.length,a;n<o;++n)if((a=e[n]).name===t)return a.value}function DK(e,t,n){for(var o=0,a=e.length;o<a;++o)if(e[o].name===t){e[o]=HLt,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var zH="http://www.w3.org/1999/xhtml";const zK={svg:"http://www.w3.org/2000/svg",xhtml:zH,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function A$(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),zK.hasOwnProperty(t)?{space:zK[t],local:e}:e}function FLt(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===zH&&t.documentElement.namespaceURI===zH?t.createElement(e):t.createElementNS(n,e)}}function ULt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Fse(e){var t=A$(e);return(t.local?ULt:FLt)(t)}function GLt(){}function fF(e){return e==null?GLt:function(){return this.querySelector(e)}}function XLt(e){typeof e!="function"&&(e=fF(e));for(var t=this._groups,n=t.length,o=new Array(n),a=0;a<n;++a)for(var i=t[a],s=i.length,l=o[a]=new Array(s),d,h,p=0;p<s;++p)(d=i[p])&&(h=e.call(d,d.__data__,p,i))&&("__data__"in d&&(h.__data__=d.__data__),l[p]=h);return new oa(o,this._parents)}function ZLt(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function YLt(){return[]}function Use(e){return e==null?YLt:function(){return this.querySelectorAll(e)}}function WLt(e){return function(){return ZLt(e.apply(this,arguments))}}function KLt(e){typeof e=="function"?e=WLt(e):e=Use(e);for(var t=this._groups,n=t.length,o=[],a=[],i=0;i<n;++i)for(var s=t[i],l=s.length,d,h=0;h<l;++h)(d=s[h])&&(o.push(e.call(d,d.__data__,h,s)),a.push(d));return new oa(o,a)}function Gse(e){return function(){return this.matches(e)}}function Xse(e){return function(t){return t.matches(e)}}var QLt=Array.prototype.find;function JLt(e){return function(){return QLt.call(this.children,e)}}function ejt(){return this.firstElementChild}function tjt(e){return this.select(e==null?ejt:JLt(typeof e=="function"?e:Xse(e)))}var njt=Array.prototype.filter;function ojt(){return Array.from(this.children)}function ajt(e){return function(){return njt.call(this.children,e)}}function rjt(e){return this.selectAll(e==null?ojt:ajt(typeof e=="function"?e:Xse(e)))}function ijt(e){typeof e!="function"&&(e=Gse(e));for(var t=this._groups,n=t.length,o=new Array(n),a=0;a<n;++a)for(var i=t[a],s=i.length,l=o[a]=[],d,h=0;h<s;++h)(d=i[h])&&e.call(d,d.__data__,h,i)&&l.push(d);return new oa(o,this._parents)}function Zse(e){return new Array(e.length)}function sjt(){return new oa(this._enter||this._groups.map(Zse),this._parents)}function lP(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}lP.prototype={constructor:lP,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function cjt(e){return function(){return e}}function ljt(e,t,n,o,a,i){for(var s=0,l,d=t.length,h=i.length;s<h;++s)(l=t[s])?(l.__data__=i[s],o[s]=l):n[s]=new lP(e,i[s]);for(;s<d;++s)(l=t[s])&&(a[s]=l)}function ujt(e,t,n,o,a,i,s){var l,d,h=new Map,p=t.length,m=i.length,v=new Array(p),x;for(l=0;l<p;++l)(d=t[l])&&(v[l]=x=s.call(d,d.__data__,l,t)+"",h.has(x)?a[l]=d:h.set(x,d));for(l=0;l<m;++l)x=s.call(e,i[l],l,i)+"",(d=h.get(x))?(o[l]=d,d.__data__=i[l],h.delete(x)):n[l]=new lP(e,i[l]);for(l=0;l<p;++l)(d=t[l])&&h.get(v[l])===d&&(a[l]=d)}function djt(e){return e.__data__}function hjt(e,t){if(!arguments.length)return Array.from(this,djt);var n=t?ujt:ljt,o=this._parents,a=this._groups;typeof e!="function"&&(e=cjt(e));for(var i=a.length,s=new Array(i),l=new Array(i),d=new Array(i),h=0;h<i;++h){var p=o[h],m=a[h],v=m.length,x=fjt(e.call(p,p&&p.__data__,h,o)),M=x.length,b=l[h]=new Array(M),C=s[h]=new Array(M),_=d[h]=new Array(v);n(p,m,b,C,_,x,t);for(var N=0,A=0,I,R;N<M;++N)if(I=b[N]){for(N>=A&&(A=N+1);!(R=C[A])&&++A<M;);I._next=R||null}}return s=new oa(s,o),s._enter=l,s._exit=d,s}function fjt(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function pjt(){return new oa(this._exit||this._groups.map(Zse),this._parents)}function yjt(e,t,n){var o=this.enter(),a=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?i.remove():n(i),o&&a?o.merge(a).order():a}function mjt(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,a=n.length,i=o.length,s=Math.min(a,i),l=new Array(a),d=0;d<s;++d)for(var h=n[d],p=o[d],m=h.length,v=l[d]=new Array(m),x,M=0;M<m;++M)(x=h[M]||p[M])&&(v[M]=x);for(;d<a;++d)l[d]=n[d];return new oa(l,this._parents)}function gjt(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],a=o.length-1,i=o[a],s;--a>=0;)(s=o[a])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function vjt(e){e||(e=kjt);function t(m,v){return m&&v?e(m.__data__,v.__data__):!m-!v}for(var n=this._groups,o=n.length,a=new Array(o),i=0;i<o;++i){for(var s=n[i],l=s.length,d=a[i]=new Array(l),h,p=0;p<l;++p)(h=s[p])&&(d[p]=h);d.sort(t)}return new oa(a,this._parents).order()}function kjt(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function xjt(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function wjt(){return Array.from(this)}function bjt(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],a=0,i=o.length;a<i;++a){var s=o[a];if(s)return s}return null}function Mjt(){let e=0;for(const t of this)++e;return e}function _jt(){return!this.node()}function Sjt(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var a=t[n],i=0,s=a.length,l;i<s;++i)(l=a[i])&&e.call(l,l.__data__,i,a);return this}function Cjt(e){return function(){this.removeAttribute(e)}}function Njt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ljt(e,t){return function(){this.setAttribute(e,t)}}function jjt(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ajt(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ejt(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Ijt(e,t){var n=A$(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Njt:Cjt:typeof t=="function"?n.local?Ejt:Ajt:n.local?jjt:Ljt)(n,t))}function Yse(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Tjt(e){return function(){this.style.removeProperty(e)}}function Rjt(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Pjt(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function $jt(e,t,n){return arguments.length>1?this.each((t==null?Tjt:typeof t=="function"?Pjt:Rjt)(e,t,n??"")):Qh(this.node(),e)}function Qh(e,t){return e.style.getPropertyValue(t)||Yse(e).getComputedStyle(e,null).getPropertyValue(t)}function Djt(e){return function(){delete this[e]}}function zjt(e,t){return function(){this[e]=t}}function Ojt(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function qjt(e,t){return arguments.length>1?this.each((t==null?Djt:typeof t=="function"?Ojt:zjt)(e,t)):this.node()[e]}function Wse(e){return e.trim().split(/^|\s+/)}function pF(e){return e.classList||new Kse(e)}function Kse(e){this._node=e,this._names=Wse(e.getAttribute("class")||"")}Kse.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Qse(e,t){for(var n=pF(e),o=-1,a=t.length;++o<a;)n.add(t[o])}function Jse(e,t){for(var n=pF(e),o=-1,a=t.length;++o<a;)n.remove(t[o])}function Hjt(e){return function(){Qse(this,e)}}function Vjt(e){return function(){Jse(this,e)}}function Bjt(e,t){return function(){(t.apply(this,arguments)?Qse:Jse)(this,e)}}function Fjt(e,t){var n=Wse(e+"");if(arguments.length<2){for(var o=pF(this.node()),a=-1,i=n.length;++a<i;)if(!o.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?Bjt:t?Hjt:Vjt)(n,t))}function Ujt(){this.textContent=""}function Gjt(e){return function(){this.textContent=e}}function Xjt(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Zjt(e){return arguments.length?this.each(e==null?Ujt:(typeof e=="function"?Xjt:Gjt)(e)):this.node().textContent}function Yjt(){this.innerHTML=""}function Wjt(e){return function(){this.innerHTML=e}}function Kjt(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Qjt(e){return arguments.length?this.each(e==null?Yjt:(typeof e=="function"?Kjt:Wjt)(e)):this.node().innerHTML}function Jjt(){this.nextSibling&&this.parentNode.appendChild(this)}function eAt(){return this.each(Jjt)}function tAt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function nAt(){return this.each(tAt)}function oAt(e){var t=typeof e=="function"?e:Fse(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function aAt(){return null}function rAt(e,t){var n=typeof e=="function"?e:Fse(e),o=t==null?aAt:typeof t=="function"?t:fF(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function iAt(){var e=this.parentNode;e&&e.removeChild(this)}function sAt(){return this.each(iAt)}function cAt(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function lAt(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function uAt(e){return this.select(e?lAt:cAt)}function dAt(e){return arguments.length?this.property("__data__",e):this.node().__data__}function hAt(e){return function(t){e.call(this,t,this.__data__)}}function fAt(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function pAt(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,a=t.length,i;n<a;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function yAt(e,t,n){return function(){var o=this.__on,a,i=hAt(t);if(o){for(var s=0,l=o.length;s<l;++s)if((a=o[s]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=i,a.options=n),a.value=t;return}}this.addEventListener(e.type,i,n),a={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(a):this.__on=[a]}}function mAt(e,t,n){var o=fAt(e+""),a,i=o.length,s;if(arguments.length<2){var l=this.node().__on;if(l){for(var d=0,h=l.length,p;d<h;++d)for(a=0,p=l[d];a<i;++a)if((s=o[a]).type===p.type&&s.name===p.name)return p.value}return}for(l=t?yAt:pAt,a=0;a<i;++a)this.each(l(o[a],t,n));return this}function ece(e,t,n){var o=Yse(e),a=o.CustomEvent;typeof a=="function"?a=new a(t,n):(a=o.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function gAt(e,t){return function(){return ece(this,e,t)}}function vAt(e,t){return function(){return ece(this,e,t.apply(this,arguments))}}function kAt(e,t){return this.each((typeof t=="function"?vAt:gAt)(e,t))}function*xAt(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],a=0,i=o.length,s;a<i;++a)(s=o[a])&&(yield s)}var tce=[null];function oa(e,t){this._groups=e,this._parents=t}function Rp(){return new oa([[document.documentElement]],tce)}function wAt(){return this}oa.prototype=Rp.prototype={constructor:oa,select:XLt,selectAll:KLt,selectChild:tjt,selectChildren:rjt,filter:ijt,data:hjt,enter:sjt,exit:pjt,join:yjt,merge:mjt,selection:wAt,order:gjt,sort:vjt,call:xjt,nodes:wjt,node:bjt,size:Mjt,empty:_jt,each:Sjt,attr:Ijt,style:$jt,property:qjt,classed:Fjt,text:Zjt,html:Qjt,raise:eAt,lower:nAt,append:oAt,insert:rAt,remove:sAt,clone:uAt,datum:dAt,on:mAt,dispatch:kAt,[Symbol.iterator]:xAt};function Ha(e){return typeof e=="string"?new oa([[document.querySelector(e)]],[document.documentElement]):new oa([[e]],tce)}function bAt(e){let t;for(;t=e.sourceEvent;)e=t;return e}function pr(e,t){if(e=bAt(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const MAt={passive:!1},W0={capture:!0,passive:!1};function QO(e){e.stopImmediatePropagation()}function Dh(e){e.preventDefault(),e.stopImmediatePropagation()}function nce(e){var t=e.document.documentElement,n=Ha(e).on("dragstart.drag",Dh,W0);"onselectstart"in t?n.on("selectstart.drag",Dh,W0):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function oce(e,t){var n=e.document.documentElement,o=Ha(e).on("dragstart.drag",null);t&&(o.on("click.drag",Dh,W0),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const fm=e=>()=>e;function OH(e,{sourceEvent:t,subject:n,target:o,identifier:a,active:i,x:s,y:l,dx:d,dy:h,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:p}})}OH.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function _At(e){return!e.ctrlKey&&!e.button}function SAt(){return this.parentNode}function CAt(e,t){return t??{x:e.x,y:e.y}}function NAt(){return navigator.maxTouchPoints||"ontouchstart"in this}function LAt(){var e=_At,t=SAt,n=CAt,o=NAt,a={},i=j$("start","drag","end"),s=0,l,d,h,p,m=0;function v(I){I.on("mousedown.drag",x).filter(o).on("touchstart.drag",C).on("touchmove.drag",_,MAt).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(I,R){if(!(p||!e.call(this,I,R))){var j=A(this,t.call(this,I,R),I,R,"mouse");j&&(Ha(I.view).on("mousemove.drag",M,W0).on("mouseup.drag",b,W0),nce(I.view),QO(I),h=!1,l=I.clientX,d=I.clientY,j("start",I))}}function M(I){if(Dh(I),!h){var R=I.clientX-l,j=I.clientY-d;h=R*R+j*j>m}a.mouse("drag",I)}function b(I){Ha(I.view).on("mousemove.drag mouseup.drag",null),oce(I.view,h),Dh(I),a.mouse("end",I)}function C(I,R){if(e.call(this,I,R)){var j=I.changedTouches,D=t.call(this,I,R),H=j.length,U,z;for(U=0;U<H;++U)(z=A(this,D,I,R,j[U].identifier,j[U]))&&(QO(I),z("start",I,j[U]))}}function _(I){var R=I.changedTouches,j=R.length,D,H;for(D=0;D<j;++D)(H=a[R[D].identifier])&&(Dh(I),H("drag",I,R[D]))}function N(I){var R=I.changedTouches,j=R.length,D,H;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),D=0;D<j;++D)(H=a[R[D].identifier])&&(QO(I),H("end",I,R[D]))}function A(I,R,j,D,H,U){var z=i.copy(),Z=pr(U||j,R),q,G,E;if((E=n.call(I,new OH("beforestart",{sourceEvent:j,target:v,identifier:H,active:s,x:Z[0],y:Z[1],dx:0,dy:0,dispatch:z}),D))!=null)return q=E.x-Z[0]||0,G=E.y-Z[1]||0,function O(P,X,W){var V=Z,L;switch(P){case"start":a[H]=O,L=s++;break;case"end":delete a[H],--s;case"drag":Z=pr(W||X,R),L=s;break}z.call(P,I,new OH(P,{sourceEvent:X,subject:E,target:v,identifier:H,active:L,x:Z[0]+q,y:Z[1]+G,dx:Z[0]-V[0],dy:Z[1]-V[1],dispatch:z}),D)}}return v.filter=function(I){return arguments.length?(e=typeof I=="function"?I:fm(!!I),v):e},v.container=function(I){return arguments.length?(t=typeof I=="function"?I:fm(I),v):t},v.subject=function(I){return arguments.length?(n=typeof I=="function"?I:fm(I),v):n},v.touchable=function(I){return arguments.length?(o=typeof I=="function"?I:fm(!!I),v):o},v.on=function(){var I=i.on.apply(i,arguments);return I===i?v:I},v.clickDistance=function(I){return arguments.length?(m=(I=+I)*I,v):Math.sqrt(m)},v}function yF(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ace(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Pp(){}var K0=.7,uP=1/K0,zh="\\s*([+-]?\\d+)\\s*",Q0="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Nr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",jAt=/^#([0-9a-f]{3,8})$/,AAt=new RegExp(`^rgb\\(${zh},${zh},${zh}\\)$`),EAt=new RegExp(`^rgb\\(${Nr},${Nr},${Nr}\\)$`),IAt=new RegExp(`^rgba\\(${zh},${zh},${zh},${Q0}\\)$`),TAt=new RegExp(`^rgba\\(${Nr},${Nr},${Nr},${Q0}\\)$`),RAt=new RegExp(`^hsl\\(${Q0},${Nr},${Nr}\\)$`),PAt=new RegExp(`^hsla\\(${Q0},${Nr},${Nr},${Q0}\\)$`),OK={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};yF(Pp,J0,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:qK,formatHex:qK,formatHex8:$At,formatHsl:DAt,formatRgb:HK,toString:HK});function qK(){return this.rgb().formatHex()}function $At(){return this.rgb().formatHex8()}function DAt(){return rce(this).formatHsl()}function HK(){return this.rgb().formatRgb()}function J0(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=jAt.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?VK(t):n===3?new Io(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?pm(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?pm(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=AAt.exec(e))?new Io(t[1],t[2],t[3],1):(t=EAt.exec(e))?new Io(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=IAt.exec(e))?pm(t[1],t[2],t[3],t[4]):(t=TAt.exec(e))?pm(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=RAt.exec(e))?UK(t[1],t[2]/100,t[3]/100,1):(t=PAt.exec(e))?UK(t[1],t[2]/100,t[3]/100,t[4]):OK.hasOwnProperty(e)?VK(OK[e]):e==="transparent"?new Io(NaN,NaN,NaN,0):null}function VK(e){return new Io(e>>16&255,e>>8&255,e&255,1)}function pm(e,t,n,o){return o<=0&&(e=t=n=NaN),new Io(e,t,n,o)}function zAt(e){return e instanceof Pp||(e=J0(e)),e?(e=e.rgb(),new Io(e.r,e.g,e.b,e.opacity)):new Io}function qH(e,t,n,o){return arguments.length===1?zAt(e):new Io(e,t,n,o??1)}function Io(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}yF(Io,qH,ace(Pp,{brighter(e){return e=e==null?uP:Math.pow(uP,e),new Io(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?K0:Math.pow(K0,e),new Io(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Io(Jd(this.r),Jd(this.g),Jd(this.b),dP(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:BK,formatHex:BK,formatHex8:OAt,formatRgb:FK,toString:FK}));function BK(){return`#${zd(this.r)}${zd(this.g)}${zd(this.b)}`}function OAt(){return`#${zd(this.r)}${zd(this.g)}${zd(this.b)}${zd((isNaN(this.opacity)?1:this.opacity)*255)}`}function FK(){const e=dP(this.opacity);return`${e===1?"rgb(":"rgba("}${Jd(this.r)}, ${Jd(this.g)}, ${Jd(this.b)}${e===1?")":`, ${e})`}`}function dP(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Jd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function zd(e){return e=Jd(e),(e<16?"0":"")+e.toString(16)}function UK(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Va(e,t,n,o)}function rce(e){if(e instanceof Va)return new Va(e.h,e.s,e.l,e.opacity);if(e instanceof Pp||(e=J0(e)),!e)return new Va;if(e instanceof Va)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,a=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,l=i-a,d=(i+a)/2;return l?(t===i?s=(n-o)/l+(n<o)*6:n===i?s=(o-t)/l+2:s=(t-n)/l+4,l/=d<.5?i+a:2-i-a,s*=60):l=d>0&&d<1?0:s,new Va(s,l,d,e.opacity)}function qAt(e,t,n,o){return arguments.length===1?rce(e):new Va(e,t,n,o??1)}function Va(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}yF(Va,qAt,ace(Pp,{brighter(e){return e=e==null?uP:Math.pow(uP,e),new Va(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?K0:Math.pow(K0,e),new Va(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,a=2*n-o;return new Io(JO(e>=240?e-240:e+120,a,o),JO(e,a,o),JO(e<120?e+240:e-120,a,o),this.opacity)},clamp(){return new Va(GK(this.h),ym(this.s),ym(this.l),dP(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=dP(this.opacity);return`${e===1?"hsl(":"hsla("}${GK(this.h)}, ${ym(this.s)*100}%, ${ym(this.l)*100}%${e===1?")":`, ${e})`}`}}));function GK(e){return e=(e||0)%360,e<0?e+360:e}function ym(e){return Math.max(0,Math.min(1,e||0))}function JO(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const ice=e=>()=>e;function HAt(e,t){return function(n){return e+n*t}}function VAt(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function BAt(e){return(e=+e)==1?sce:function(t,n){return n-t?VAt(t,n,e):ice(isNaN(t)?n:t)}}function sce(e,t){var n=t-e;return n?HAt(e,n):ice(isNaN(e)?t:e)}const XK=function e(t){var n=BAt(t);function o(a,i){var s=n((a=qH(a)).r,(i=qH(i)).r),l=n(a.g,i.g),d=n(a.b,i.b),h=sce(a.opacity,i.opacity);return function(p){return a.r=s(p),a.g=l(p),a.b=d(p),a.opacity=h(p),a+""}}return o.gamma=e,o}(1);function os(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var HH=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,eq=new RegExp(HH.source,"g");function FAt(e){return function(){return e}}function UAt(e){return function(t){return e(t)+""}}function GAt(e,t){var n=HH.lastIndex=eq.lastIndex=0,o,a,i,s=-1,l=[],d=[];for(e=e+"",t=t+"";(o=HH.exec(e))&&(a=eq.exec(t));)(i=a.index)>n&&(i=t.slice(n,i),l[s]?l[s]+=i:l[++s]=i),(o=o[0])===(a=a[0])?l[s]?l[s]+=a:l[++s]=a:(l[++s]=null,d.push({i:s,x:os(o,a)})),n=eq.lastIndex;return n<t.length&&(i=t.slice(n),l[s]?l[s]+=i:l[++s]=i),l.length<2?d[0]?UAt(d[0].x):FAt(t):(t=d.length,function(h){for(var p=0,m;p<t;++p)l[(m=d[p]).i]=m.x(h);return l.join("")})}var ZK=180/Math.PI,VH={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function cce(e,t,n,o,a,i){var s,l,d;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(d=e*n+t*o)&&(n-=e*d,o-=t*d),(l=Math.sqrt(n*n+o*o))&&(n/=l,o/=l,d/=l),e*o<t*n&&(e=-e,t=-t,d=-d,s=-s),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*ZK,skewX:Math.atan(d)*ZK,scaleX:s,scaleY:l}}var mm;function XAt(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?VH:cce(t.a,t.b,t.c,t.d,t.e,t.f)}function ZAt(e){return e==null||(mm||(mm=document.createElementNS("http://www.w3.org/2000/svg","g")),mm.setAttribute("transform",e),!(e=mm.transform.baseVal.consolidate()))?VH:(e=e.matrix,cce(e.a,e.b,e.c,e.d,e.e,e.f))}function lce(e,t,n,o){function a(h){return h.length?h.pop()+" ":""}function i(h,p,m,v,x,M){if(h!==m||p!==v){var b=x.push("translate(",null,t,null,n);M.push({i:b-4,x:os(h,m)},{i:b-2,x:os(p,v)})}else(m||v)&&x.push("translate("+m+t+v+n)}function s(h,p,m,v){h!==p?(h-p>180?p+=360:p-h>180&&(h+=360),v.push({i:m.push(a(m)+"rotate(",null,o)-2,x:os(h,p)})):p&&m.push(a(m)+"rotate("+p+o)}function l(h,p,m,v){h!==p?v.push({i:m.push(a(m)+"skewX(",null,o)-2,x:os(h,p)}):p&&m.push(a(m)+"skewX("+p+o)}function d(h,p,m,v,x,M){if(h!==m||p!==v){var b=x.push(a(x)+"scale(",null,",",null,")");M.push({i:b-4,x:os(h,m)},{i:b-2,x:os(p,v)})}else(m!==1||v!==1)&&x.push(a(x)+"scale("+m+","+v+")")}return function(h,p){var m=[],v=[];return h=e(h),p=e(p),i(h.translateX,h.translateY,p.translateX,p.translateY,m,v),s(h.rotate,p.rotate,m,v),l(h.skewX,p.skewX,m,v),d(h.scaleX,h.scaleY,p.scaleX,p.scaleY,m,v),h=p=null,function(x){for(var M=-1,b=v.length,C;++M<b;)m[(C=v[M]).i]=C.x(x);return m.join("")}}}var YAt=lce(XAt,"px, ","px)","deg)"),WAt=lce(ZAt,", ",")",")"),KAt=1e-12;function YK(e){return((e=Math.exp(e))+1/e)/2}function QAt(e){return((e=Math.exp(e))-1/e)/2}function JAt(e){return((e=Math.exp(2*e))-1)/(e+1)}const eEt=function e(t,n,o){function a(i,s){var l=i[0],d=i[1],h=i[2],p=s[0],m=s[1],v=s[2],x=p-l,M=m-d,b=x*x+M*M,C,_;if(b<KAt)_=Math.log(v/h)/t,C=function(D){return[l+D*x,d+D*M,h*Math.exp(t*D*_)]};else{var N=Math.sqrt(b),A=(v*v-h*h+o*b)/(2*h*n*N),I=(v*v-h*h-o*b)/(2*v*n*N),R=Math.log(Math.sqrt(A*A+1)-A),j=Math.log(Math.sqrt(I*I+1)-I);_=(j-R)/t,C=function(D){var H=D*_,U=YK(R),z=h/(n*N)*(U*JAt(t*H+R)-QAt(R));return[l+z*x,d+z*M,h*U/YK(t*H+R)]}}return C.duration=_*1e3*t/Math.SQRT2,C}return a.rho=function(i){var s=Math.max(.001,+i),l=s*s,d=l*l;return e(s,l,d)},a}(Math.SQRT2,2,4);var Jh=0,Hf=0,Sf=0,uce=1e3,hP,Vf,fP=0,c1=0,E$=0,ep=typeof performance=="object"&&performance.now?performance:Date,dce=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function mF(){return c1||(dce(tEt),c1=ep.now()+E$)}function tEt(){c1=0}function pP(){this._call=this._time=this._next=null}pP.prototype=hce.prototype={constructor:pP,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?mF():+n)+(t==null?0:+t),!this._next&&Vf!==this&&(Vf?Vf._next=this:hP=this,Vf=this),this._call=e,this._time=n,BH()},stop:function(){this._call&&(this._call=null,this._time=1/0,BH())}};function hce(e,t,n){var o=new pP;return o.restart(e,t,n),o}function nEt(){mF(),++Jh;for(var e=hP,t;e;)(t=c1-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Jh}function WK(){c1=(fP=ep.now())+E$,Jh=Hf=0;try{nEt()}finally{Jh=0,aEt(),c1=0}}function oEt(){var e=ep.now(),t=e-fP;t>uce&&(E$-=t,fP=e)}function aEt(){for(var e,t=hP,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:hP=n);Vf=e,BH(o)}function BH(e){if(!Jh){Hf&&(Hf=clearTimeout(Hf));var t=e-c1;t>24?(e<1/0&&(Hf=setTimeout(WK,e-ep.now()-E$)),Sf&&(Sf=clearInterval(Sf))):(Sf||(fP=ep.now(),Sf=setInterval(oEt,uce)),Jh=1,dce(WK))}}function KK(e,t,n){var o=new pP;return t=t==null?0:+t,o.restart(a=>{o.stop(),e(a+t)},t,n),o}var rEt=j$("start","end","cancel","interrupt"),iEt=[],fce=0,QK=1,FH=2,IR=3,JK=4,UH=5,TR=6;function I$(e,t,n,o,a,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;sEt(e,n,{name:t,index:o,group:a,on:rEt,tween:iEt,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:fce})}function gF(e,t){var n=Ka(e,t);if(n.state>fce)throw new Error("too late; already scheduled");return n}function Rr(e,t){var n=Ka(e,t);if(n.state>IR)throw new Error("too late; already running");return n}function Ka(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function sEt(e,t,n){var o=e.__transition,a;o[t]=n,n.timer=hce(i,0,n.time);function i(h){n.state=QK,n.timer.restart(s,n.delay,n.time),n.delay<=h&&s(h-n.delay)}function s(h){var p,m,v,x;if(n.state!==QK)return d();for(p in o)if(x=o[p],x.name===n.name){if(x.state===IR)return KK(s);x.state===JK?(x.state=TR,x.timer.stop(),x.on.call("interrupt",e,e.__data__,x.index,x.group),delete o[p]):+p<t&&(x.state=TR,x.timer.stop(),x.on.call("cancel",e,e.__data__,x.index,x.group),delete o[p])}if(KK(function(){n.state===IR&&(n.state=JK,n.timer.restart(l,n.delay,n.time),l(h))}),n.state=FH,n.on.call("start",e,e.__data__,n.index,n.group),n.state===FH){for(n.state=IR,a=new Array(v=n.tween.length),p=0,m=-1;p<v;++p)(x=n.tween[p].value.call(e,e.__data__,n.index,n.group))&&(a[++m]=x);a.length=m+1}}function l(h){for(var p=h<n.duration?n.ease.call(null,h/n.duration):(n.timer.restart(d),n.state=UH,1),m=-1,v=a.length;++m<v;)a[m].call(e,p);n.state===UH&&(n.on.call("end",e,e.__data__,n.index,n.group),d())}function d(){n.state=TR,n.timer.stop(),delete o[t];for(var h in o)return;delete e.__transition}}function RR(e,t){var n=e.__transition,o,a,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}a=o.state>FH&&o.state<UH,o.state=TR,o.timer.stop(),o.on.call(a?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function cEt(e){return this.each(function(){RR(this,e)})}function lEt(e,t){var n,o;return function(){var a=Rr(this,e),i=a.tween;if(i!==n){o=n=i;for(var s=0,l=o.length;s<l;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}a.tween=o}}function uEt(e,t,n){var o,a;if(typeof n!="function")throw new Error;return function(){var i=Rr(this,e),s=i.tween;if(s!==o){a=(o=s).slice();for(var l={name:t,value:n},d=0,h=a.length;d<h;++d)if(a[d].name===t){a[d]=l;break}d===h&&a.push(l)}i.tween=a}}function dEt(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=Ka(this.node(),n).tween,a=0,i=o.length,s;a<i;++a)if((s=o[a]).name===e)return s.value;return null}return this.each((t==null?lEt:uEt)(n,e,t))}function vF(e,t,n){var o=e._id;return e.each(function(){var a=Rr(this,o);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return Ka(a,o).value[t]}}function pce(e,t){var n;return(typeof t=="number"?os:t instanceof J0?XK:(n=J0(t))?(t=n,XK):GAt)(e,t)}function hEt(e){return function(){this.removeAttribute(e)}}function fEt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function pEt(e,t,n){var o,a=n+"",i;return function(){var s=this.getAttribute(e);return s===a?null:s===o?i:i=t(o=s,n)}}function yEt(e,t,n){var o,a=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===a?null:s===o?i:i=t(o=s,n)}}function mEt(e,t,n){var o,a,i;return function(){var s,l=n(this),d;return l==null?void this.removeAttribute(e):(s=this.getAttribute(e),d=l+"",s===d?null:s===o&&d===a?i:(a=d,i=t(o=s,l)))}}function gEt(e,t,n){var o,a,i;return function(){var s,l=n(this),d;return l==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),d=l+"",s===d?null:s===o&&d===a?i:(a=d,i=t(o=s,l)))}}function vEt(e,t){var n=A$(e),o=n==="transform"?WAt:pce;return this.attrTween(e,typeof t=="function"?(n.local?gEt:mEt)(n,o,vF(this,"attr."+e,t)):t==null?(n.local?fEt:hEt)(n):(n.local?yEt:pEt)(n,o,t))}function kEt(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function xEt(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function wEt(e,t){var n,o;function a(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&xEt(e,i)),n}return a._value=t,a}function bEt(e,t){var n,o;function a(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&kEt(e,i)),n}return a._value=t,a}function MEt(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=A$(e);return this.tween(n,(o.local?wEt:bEt)(o,t))}function _Et(e,t){return function(){gF(this,e).delay=+t.apply(this,arguments)}}function SEt(e,t){return t=+t,function(){gF(this,e).delay=t}}function CEt(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_Et:SEt)(t,e)):Ka(this.node(),t).delay}function NEt(e,t){return function(){Rr(this,e).duration=+t.apply(this,arguments)}}function LEt(e,t){return t=+t,function(){Rr(this,e).duration=t}}function jEt(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?NEt:LEt)(t,e)):Ka(this.node(),t).duration}function AEt(e,t){if(typeof t!="function")throw new Error;return function(){Rr(this,e).ease=t}}function EEt(e){var t=this._id;return arguments.length?this.each(AEt(t,e)):Ka(this.node(),t).ease}function IEt(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Rr(this,e).ease=n}}function TEt(e){if(typeof e!="function")throw new Error;return this.each(IEt(this._id,e))}function REt(e){typeof e!="function"&&(e=Gse(e));for(var t=this._groups,n=t.length,o=new Array(n),a=0;a<n;++a)for(var i=t[a],s=i.length,l=o[a]=[],d,h=0;h<s;++h)(d=i[h])&&e.call(d,d.__data__,h,i)&&l.push(d);return new yi(o,this._parents,this._name,this._id)}function PEt(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,a=n.length,i=Math.min(o,a),s=new Array(o),l=0;l<i;++l)for(var d=t[l],h=n[l],p=d.length,m=s[l]=new Array(p),v,x=0;x<p;++x)(v=d[x]||h[x])&&(m[x]=v);for(;l<o;++l)s[l]=t[l];return new yi(s,this._parents,this._name,this._id)}function $Et(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function DEt(e,t,n){var o,a,i=$Et(t)?gF:Rr;return function(){var s=i(this,e),l=s.on;l!==o&&(a=(o=l).copy()).on(t,n),s.on=a}}function zEt(e,t){var n=this._id;return arguments.length<2?Ka(this.node(),n).on.on(e):this.each(DEt(n,e,t))}function OEt(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function qEt(){return this.on("end.remove",OEt(this._id))}function HEt(e){var t=this._name,n=this._id;typeof e!="function"&&(e=fF(e));for(var o=this._groups,a=o.length,i=new Array(a),s=0;s<a;++s)for(var l=o[s],d=l.length,h=i[s]=new Array(d),p,m,v=0;v<d;++v)(p=l[v])&&(m=e.call(p,p.__data__,v,l))&&("__data__"in p&&(m.__data__=p.__data__),h[v]=m,I$(h[v],t,n,v,h,Ka(p,n)));return new yi(i,this._parents,t,n)}function VEt(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Use(e));for(var o=this._groups,a=o.length,i=[],s=[],l=0;l<a;++l)for(var d=o[l],h=d.length,p,m=0;m<h;++m)if(p=d[m]){for(var v=e.call(p,p.__data__,m,d),x,M=Ka(p,n),b=0,C=v.length;b<C;++b)(x=v[b])&&I$(x,t,n,b,v,M);i.push(v),s.push(p)}return new yi(i,s,t,n)}var BEt=Rp.prototype.constructor;function FEt(){return new BEt(this._groups,this._parents)}function UEt(e,t){var n,o,a;return function(){var i=Qh(this,e),s=(this.style.removeProperty(e),Qh(this,e));return i===s?null:i===n&&s===o?a:a=t(n=i,o=s)}}function yce(e){return function(){this.style.removeProperty(e)}}function GEt(e,t,n){var o,a=n+"",i;return function(){var s=Qh(this,e);return s===a?null:s===o?i:i=t(o=s,n)}}function XEt(e,t,n){var o,a,i;return function(){var s=Qh(this,e),l=n(this),d=l+"";return l==null&&(d=l=(this.style.removeProperty(e),Qh(this,e))),s===d?null:s===o&&d===a?i:(a=d,i=t(o=s,l))}}function ZEt(e,t){var n,o,a,i="style."+t,s="end."+i,l;return function(){var d=Rr(this,e),h=d.on,p=d.value[i]==null?l||(l=yce(t)):void 0;(h!==n||a!==p)&&(o=(n=h).copy()).on(s,a=p),d.on=o}}function YEt(e,t,n){var o=(e+="")=="transform"?YAt:pce;return t==null?this.styleTween(e,UEt(e,o)).on("end.style."+e,yce(e)):typeof t=="function"?this.styleTween(e,XEt(e,o,vF(this,"style."+e,t))).each(ZEt(this._id,e)):this.styleTween(e,GEt(e,o,t),n).on("end.style."+e,null)}function WEt(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function KEt(e,t,n){var o,a;function i(){var s=t.apply(this,arguments);return s!==a&&(o=(a=s)&&WEt(e,s,n)),o}return i._value=t,i}function QEt(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,KEt(e,t,n??""))}function JEt(e){return function(){this.textContent=e}}function eIt(e){return function(){var t=e(this);this.textContent=t??""}}function tIt(e){return this.tween("text",typeof e=="function"?eIt(vF(this,"text",e)):JEt(e==null?"":e+""))}function nIt(e){return function(t){this.textContent=e.call(this,t)}}function oIt(e){var t,n;function o(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&nIt(a)),t}return o._value=e,o}function aIt(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,oIt(e))}function rIt(){for(var e=this._name,t=this._id,n=mce(),o=this._groups,a=o.length,i=0;i<a;++i)for(var s=o[i],l=s.length,d,h=0;h<l;++h)if(d=s[h]){var p=Ka(d,t);I$(d,e,n,h,s,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new yi(o,this._parents,e,n)}function iIt(){var e,t,n=this,o=n._id,a=n.size();return new Promise(function(i,s){var l={value:s},d={value:function(){--a===0&&i()}};n.each(function(){var h=Rr(this,o),p=h.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(d)),h.on=t}),a===0&&i()})}var sIt=0;function yi(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function mce(){return++sIt}var Jr=Rp.prototype;yi.prototype={constructor:yi,select:HEt,selectAll:VEt,selectChild:Jr.selectChild,selectChildren:Jr.selectChildren,filter:REt,merge:PEt,selection:FEt,transition:rIt,call:Jr.call,nodes:Jr.nodes,node:Jr.node,size:Jr.size,empty:Jr.empty,each:Jr.each,on:zEt,attr:vEt,attrTween:MEt,style:YEt,styleTween:QEt,text:tIt,textTween:aIt,remove:qEt,tween:dEt,delay:CEt,duration:jEt,ease:EEt,easeVarying:TEt,end:iIt,[Symbol.iterator]:Jr[Symbol.iterator]};function cIt(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var lIt={time:null,delay:0,duration:250,ease:cIt};function uIt(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function dIt(e){var t,n;e instanceof yi?(t=e._id,e=e._name):(t=mce(),(n=lIt).time=mF(),e=e==null?null:e+"");for(var o=this._groups,a=o.length,i=0;i<a;++i)for(var s=o[i],l=s.length,d,h=0;h<l;++h)(d=s[h])&&I$(d,e,t,h,s,n||uIt(d,t));return new yi(o,this._parents,e,t)}Rp.prototype.interrupt=cEt;Rp.prototype.transition=dIt;const gm=e=>()=>e;function hIt(e,{sourceEvent:t,target:n,transform:o,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:a}})}function ai(e,t,n){this.k=e,this.x=t,this.y=n}ai.prototype={constructor:ai,scale:function(e){return e===1?this:new ai(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ai(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ms=new ai(1,0,0);ai.prototype;function tq(e){e.stopImmediatePropagation()}function Cf(e){e.preventDefault(),e.stopImmediatePropagation()}function fIt(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function pIt(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function eQ(){return this.__zoom||Ms}function yIt(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function mIt(){return navigator.maxTouchPoints||"ontouchstart"in this}function gIt(e,t,n){var o=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function vIt(){var e=fIt,t=pIt,n=gIt,o=yIt,a=mIt,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],l=250,d=eEt,h=j$("start","zoom","end"),p,m,v,x=500,M=150,b=0,C=10;function _(E){E.property("__zoom",eQ).on("wheel.zoom",H,{passive:!1}).on("mousedown.zoom",U).on("dblclick.zoom",z).filter(a).on("touchstart.zoom",Z).on("touchmove.zoom",q).on("touchend.zoom touchcancel.zoom",G).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(E,O,P,X){var W=E.selection?E.selection():E;W.property("__zoom",eQ),E!==W?R(E,O,P,X):W.interrupt().each(function(){j(this,arguments).event(X).start().zoom(null,typeof O=="function"?O.apply(this,arguments):O).end()})},_.scaleBy=function(E,O,P,X){_.scaleTo(E,function(){var W=this.__zoom.k,V=typeof O=="function"?O.apply(this,arguments):O;return W*V},P,X)},_.scaleTo=function(E,O,P,X){_.transform(E,function(){var W=t.apply(this,arguments),V=this.__zoom,L=P==null?I(W):typeof P=="function"?P.apply(this,arguments):P,Y=V.invert(L),F=typeof O=="function"?O.apply(this,arguments):O;return n(A(N(V,F),L,Y),W,s)},P,X)},_.translateBy=function(E,O,P,X){_.transform(E,function(){return n(this.__zoom.translate(typeof O=="function"?O.apply(this,arguments):O,typeof P=="function"?P.apply(this,arguments):P),t.apply(this,arguments),s)},null,X)},_.translateTo=function(E,O,P,X,W){_.transform(E,function(){var V=t.apply(this,arguments),L=this.__zoom,Y=X==null?I(V):typeof X=="function"?X.apply(this,arguments):X;return n(Ms.translate(Y[0],Y[1]).scale(L.k).translate(typeof O=="function"?-O.apply(this,arguments):-O,typeof P=="function"?-P.apply(this,arguments):-P),V,s)},X,W)};function N(E,O){return O=Math.max(i[0],Math.min(i[1],O)),O===E.k?E:new ai(O,E.x,E.y)}function A(E,O,P){var X=O[0]-P[0]*E.k,W=O[1]-P[1]*E.k;return X===E.x&&W===E.y?E:new ai(E.k,X,W)}function I(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function R(E,O,P,X){E.on("start.zoom",function(){j(this,arguments).event(X).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event(X).end()}).tween("zoom",function(){var W=this,V=arguments,L=j(W,V).event(X),Y=t.apply(W,V),F=P==null?I(Y):typeof P=="function"?P.apply(W,V):P,T=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),K=W.__zoom,Q=typeof O=="function"?O.apply(W,V):O,ne=d(K.invert(F).concat(T/K.k),Q.invert(F).concat(T/Q.k));return function(te){if(te===1)te=Q;else{var ce=ne(te),me=T/ce[2];te=new ai(me,F[0]-ce[0]*me,F[1]-ce[1]*me)}L.zoom(null,te)}})}function j(E,O,P){return!P&&E.__zooming||new D(E,O)}function D(E,O){this.that=E,this.args=O,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,O),this.taps=0}D.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,O){return this.mouse&&E!=="mouse"&&(this.mouse[1]=O.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=O.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=O.invert(this.touch1[0])),this.that.__zoom=O,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var O=Ha(this.that).datum();h.call(E,this.that,new hIt(E,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:h}),O)}};function H(E,...O){if(!e.apply(this,arguments))return;var P=j(this,O).event(E),X=this.__zoom,W=Math.max(i[0],Math.min(i[1],X.k*Math.pow(2,o.apply(this,arguments)))),V=pr(E);if(P.wheel)(P.mouse[0][0]!==V[0]||P.mouse[0][1]!==V[1])&&(P.mouse[1]=X.invert(P.mouse[0]=V)),clearTimeout(P.wheel);else{if(X.k===W)return;P.mouse=[V,X.invert(V)],RR(this),P.start()}Cf(E),P.wheel=setTimeout(L,M),P.zoom("mouse",n(A(N(X,W),P.mouse[0],P.mouse[1]),P.extent,s));function L(){P.wheel=null,P.end()}}function U(E,...O){if(v||!e.apply(this,arguments))return;var P=E.currentTarget,X=j(this,O,!0).event(E),W=Ha(E.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",T,!0),V=pr(E,P),L=E.clientX,Y=E.clientY;nce(E.view),tq(E),X.mouse=[V,this.__zoom.invert(V)],RR(this),X.start();function F(K){if(Cf(K),!X.moved){var Q=K.clientX-L,ne=K.clientY-Y;X.moved=Q*Q+ne*ne>b}X.event(K).zoom("mouse",n(A(X.that.__zoom,X.mouse[0]=pr(K,P),X.mouse[1]),X.extent,s))}function T(K){W.on("mousemove.zoom mouseup.zoom",null),oce(K.view,X.moved),Cf(K),X.event(K).end()}}function z(E,...O){if(e.apply(this,arguments)){var P=this.__zoom,X=pr(E.changedTouches?E.changedTouches[0]:E,this),W=P.invert(X),V=P.k*(E.shiftKey?.5:2),L=n(A(N(P,V),X,W),t.apply(this,O),s);Cf(E),l>0?Ha(this).transition().duration(l).call(R,L,X,E):Ha(this).call(_.transform,L,X,E)}}function Z(E,...O){if(e.apply(this,arguments)){var P=E.touches,X=P.length,W=j(this,O,E.changedTouches.length===X).event(E),V,L,Y,F;for(tq(E),L=0;L<X;++L)Y=P[L],F=pr(Y,this),F=[F,this.__zoom.invert(F),Y.identifier],W.touch0?!W.touch1&&W.touch0[2]!==F[2]&&(W.touch1=F,W.taps=0):(W.touch0=F,V=!0,W.taps=1+!!p);p&&(p=clearTimeout(p)),V&&(W.taps<2&&(m=F[0],p=setTimeout(function(){p=null},x)),RR(this),W.start())}}function q(E,...O){if(this.__zooming){var P=j(this,O).event(E),X=E.changedTouches,W=X.length,V,L,Y,F;for(Cf(E),V=0;V<W;++V)L=X[V],Y=pr(L,this),P.touch0&&P.touch0[2]===L.identifier?P.touch0[0]=Y:P.touch1&&P.touch1[2]===L.identifier&&(P.touch1[0]=Y);if(L=P.that.__zoom,P.touch1){var T=P.touch0[0],K=P.touch0[1],Q=P.touch1[0],ne=P.touch1[1],te=(te=Q[0]-T[0])*te+(te=Q[1]-T[1])*te,ce=(ce=ne[0]-K[0])*ce+(ce=ne[1]-K[1])*ce;L=N(L,Math.sqrt(te/ce)),Y=[(T[0]+Q[0])/2,(T[1]+Q[1])/2],F=[(K[0]+ne[0])/2,(K[1]+ne[1])/2]}else if(P.touch0)Y=P.touch0[0],F=P.touch0[1];else return;P.zoom("touch",n(A(L,Y,F),P.extent,s))}}function G(E,...O){if(this.__zooming){var P=j(this,O).event(E),X=E.changedTouches,W=X.length,V,L;for(tq(E),v&&clearTimeout(v),v=setTimeout(function(){v=null},x),V=0;V<W;++V)L=X[V],P.touch0&&P.touch0[2]===L.identifier?delete P.touch0:P.touch1&&P.touch1[2]===L.identifier&&delete P.touch1;if(P.touch1&&!P.touch0&&(P.touch0=P.touch1,delete P.touch1),P.touch0)P.touch0[1]=this.__zoom.invert(P.touch0[0]);else if(P.end(),P.taps===2&&(L=pr(L,this),Math.hypot(m[0]-L[0],m[1]-L[1])<C)){var Y=Ha(this).on("dblclick.zoom");Y&&Y.apply(this,arguments)}}}return _.wheelDelta=function(E){return arguments.length?(o=typeof E=="function"?E:gm(+E),_):o},_.filter=function(E){return arguments.length?(e=typeof E=="function"?E:gm(!!E),_):e},_.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:gm(!!E),_):a},_.extent=function(E){return arguments.length?(t=typeof E=="function"?E:gm([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),_):t},_.scaleExtent=function(E){return arguments.length?(i[0]=+E[0],i[1]=+E[1],_):[i[0],i[1]]},_.translateExtent=function(E){return arguments.length?(s[0][0]=+E[0][0],s[1][0]=+E[1][0],s[0][1]=+E[0][1],s[1][1]=+E[1][1],_):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},_.constrain=function(E){return arguments.length?(n=E,_):n},_.duration=function(E){return arguments.length?(l=+E,_):l},_.interpolate=function(E){return arguments.length?(d=E,_):d},_.on=function(){var E=h.on.apply(h,arguments);return E===h?_:E},_.clickDistance=function(E){return arguments.length?(b=(E=+E)*E,_):Math.sqrt(b)},_.tapDistance=function(E){return arguments.length?(C=+E,_):C},_}const T$=k.createContext(null),kIt=T$.Provider,mi={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},gce=mi.error001();function un(e,t){const n=k.useContext(T$);if(n===null)throw new Error(gce);return Bse(n,e,t)}const Jn=()=>{const e=k.useContext(T$);if(e===null)throw new Error(gce);return k.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},xIt=e=>e.userSelectionActive?"none":"all";function vce({position:e,children:t,className:n,style:o,...a}){const i=un(xIt),s=`${e}`.split("-");return le.createElement("div",{className:ko(["react-flow__panel",n,...s]),style:{...o,pointerEvents:i},...a},t)}function wIt({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:le.createElement(vce,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},le.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const bIt=({x:e,y:t,label:n,labelStyle:o={},labelShowBg:a=!0,labelBgStyle:i={},labelBgPadding:s=[2,4],labelBgBorderRadius:l=2,children:d,className:h,...p})=>{const m=k.useRef(null),[v,x]=k.useState({x:0,y:0,width:0,height:0}),M=ko(["react-flow__edge-textwrapper",h]);return k.useEffect(()=>{if(m.current){const b=m.current.getBBox();x({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),typeof n>"u"||!n?null:le.createElement("g",{transform:`translate(${e-v.width/2} ${t-v.height/2})`,className:M,visibility:v.width?"visible":"hidden",...p},a&&le.createElement("rect",{width:v.width+2*s[0],x:-s[0],y:-s[1],height:v.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),le.createElement("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:m,style:o},n),d)};var MIt=k.memo(bIt);const kF=e=>({width:e.offsetWidth,height:e.offsetHeight}),e2=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),xF=(e={x:0,y:0},t)=>({x:e2(e.x,t[0][0],t[1][0]),y:e2(e.y,t[0][1],t[1][1])}),tQ=(e,t,n)=>e<t?e2(Math.abs(e-t),1,50)/50:e>n?-e2(Math.abs(e-n),1,50)/50:0,kce=(e,t)=>{const n=tQ(e.x,35,t.width-35)*20,o=tQ(e.y,35,t.height-35)*20;return[n,o]},xce=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},_It=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),wF=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),SIt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),nQ=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),GH=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},CIt=e=>xa(e.width)&&xa(e.height)&&xa(e.x)&&xa(e.y),xa=e=>!isNaN(e)&&isFinite(e),vn=Symbol.for("internals"),wce=["Enter"," ","Escape"],NIt=(e,t)=>{},LIt=e=>"nativeEvent"in e;function XH(e){var a,i;const t=LIt(e)?e.nativeEvent:e,n=((i=(a=t.composedPath)==null?void 0:a.call(t))==null?void 0:i[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const bce=e=>"clientX"in e,_s=(e,t)=>{var i,s;const n=bce(e),o=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,a=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:o-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},yP=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},$p=({id:e,path:t,labelX:n,labelY:o,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:m,markerStart:v,interactionWidth:x=20})=>le.createElement(le.Fragment,null,le.createElement("path",{id:e,style:p,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:v}),x&&le.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:x,className:"react-flow__edge-interaction"}),a&&xa(n)&&xa(o)?le.createElement(MIt,{x:n,y:o,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h}):null);$p.displayName="BaseEdge";function Nf(e,t,n){return n===void 0?n:o=>{const a=t().edges.find(i=>i.id===e);a&&n(o,{...a})}}function Mce({sourceX:e,sourceY:t,targetX:n,targetY:o}){const a=Math.abs(n-e)/2,i=n<e?n+a:n-a,s=Math.abs(o-t)/2,l=o<t?o+s:o-s;return[i,l,a,s]}function _ce({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:a,sourceControlY:i,targetControlX:s,targetControlY:l}){const d=e*.125+a*.375+s*.375+n*.125,h=t*.125+i*.375+l*.375+o*.125,p=Math.abs(d-e),m=Math.abs(h-t);return[d,h,p,m]}var l1;(function(e){e.Strict="strict",e.Loose="loose"})(l1||(l1={}));var Od;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Od||(Od={}));var tp;(function(e){e.Partial="partial",e.Full="full"})(tp||(tp={}));var cs;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(cs||(cs={}));var mP;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(mP||(mP={}));var Ye;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ye||(Ye={}));function oQ({pos:e,x1:t,y1:n,x2:o,y2:a}){return e===Ye.Left||e===Ye.Right?[.5*(t+o),n]:[t,.5*(n+a)]}function Sce({sourceX:e,sourceY:t,sourcePosition:n=Ye.Bottom,targetX:o,targetY:a,targetPosition:i=Ye.Top}){const[s,l]=oQ({pos:n,x1:e,y1:t,x2:o,y2:a}),[d,h]=oQ({pos:i,x1:o,y1:a,x2:e,y2:t}),[p,m,v,x]=_ce({sourceX:e,sourceY:t,targetX:o,targetY:a,sourceControlX:s,sourceControlY:l,targetControlX:d,targetControlY:h});return[`M${e},${t} C${s},${l} ${d},${h} ${o},${a}`,p,m,v,x]}const bF=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:o,sourcePosition:a=Ye.Bottom,targetPosition:i=Ye.Top,label:s,labelStyle:l,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:v,markerEnd:x,markerStart:M,interactionWidth:b})=>{const[C,_,N]=Sce({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:o,targetPosition:i});return le.createElement($p,{path:C,labelX:_,labelY:N,label:s,labelStyle:l,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:v,markerEnd:x,markerStart:M,interactionWidth:b})});bF.displayName="SimpleBezierEdge";const aQ={[Ye.Left]:{x:-1,y:0},[Ye.Right]:{x:1,y:0},[Ye.Top]:{x:0,y:-1},[Ye.Bottom]:{x:0,y:1}},jIt=({source:e,sourcePosition:t=Ye.Bottom,target:n})=>t===Ye.Left||t===Ye.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},rQ=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function AIt({source:e,sourcePosition:t=Ye.Bottom,target:n,targetPosition:o=Ye.Top,center:a,offset:i}){const s=aQ[t],l=aQ[o],d={x:e.x+s.x*i,y:e.y+s.y*i},h={x:n.x+l.x*i,y:n.y+l.y*i},p=jIt({source:d,sourcePosition:t,target:h}),m=p.x!==0?"x":"y",v=p[m];let x=[],M,b;const C={x:0,y:0},_={x:0,y:0},[N,A,I,R]=Mce({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[m]*l[m]===-1){M=a.x??N,b=a.y??A;const D=[{x:M,y:d.y},{x:M,y:h.y}],H=[{x:d.x,y:b},{x:h.x,y:b}];s[m]===v?x=m==="x"?D:H:x=m==="x"?H:D}else{const D=[{x:d.x,y:h.y}],H=[{x:h.x,y:d.y}];if(m==="x"?x=s.x===v?H:D:x=s.y===v?D:H,t===o){const G=Math.abs(e[m]-n[m]);if(G<=i){const E=Math.min(i-1,i-G);s[m]===v?C[m]=(d[m]>e[m]?-1:1)*E:_[m]=(h[m]>n[m]?-1:1)*E}}if(t!==o){const G=m==="x"?"y":"x",E=s[m]===l[G],O=d[G]>h[G],P=d[G]<h[G];(s[m]===1&&(!E&&O||E&&P)||s[m]!==1&&(!E&&P||E&&O))&&(x=m==="x"?D:H)}const U={x:d.x+C.x,y:d.y+C.y},z={x:h.x+_.x,y:h.y+_.y},Z=Math.max(Math.abs(U.x-x[0].x),Math.abs(z.x-x[0].x)),q=Math.max(Math.abs(U.y-x[0].y),Math.abs(z.y-x[0].y));Z>=q?(M=(U.x+z.x)/2,b=x[0].y):(M=x[0].x,b=(U.y+z.y)/2)}return[[e,{x:d.x+C.x,y:d.y+C.y},...x,{x:h.x+_.x,y:h.y+_.y},n],M,b,I,R]}function EIt(e,t,n,o){const a=Math.min(rQ(e,t)/2,rQ(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const h=e.x<n.x?-1:1,p=e.y<n.y?1:-1;return`L ${i+a*h},${s}Q ${i},${s} ${i},${s+a*p}`}const l=e.x<n.x?1:-1,d=e.y<n.y?-1:1;return`L ${i},${s+a*d}Q ${i},${s} ${i+a*l},${s}`}function ZH({sourceX:e,sourceY:t,sourcePosition:n=Ye.Bottom,targetX:o,targetY:a,targetPosition:i=Ye.Top,borderRadius:s=5,centerX:l,centerY:d,offset:h=20}){const[p,m,v,x,M]=AIt({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:a},targetPosition:i,center:{x:l,y:d},offset:h});return[p.reduce((C,_,N)=>{let A="";return N>0&&N<p.length-1?A=EIt(p[N-1],_,p[N+1],s):A=`${N===0?"M":"L"}${_.x} ${_.y}`,C+=A,C},""),m,v,x,M]}const R$=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:o,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:p,sourcePosition:m=Ye.Bottom,targetPosition:v=Ye.Top,markerEnd:x,markerStart:M,pathOptions:b,interactionWidth:C})=>{const[_,N,A]=ZH({sourceX:e,sourceY:t,sourcePosition:m,targetX:n,targetY:o,targetPosition:v,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset});return le.createElement($p,{path:_,labelX:N,labelY:A,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:x,markerStart:M,interactionWidth:C})});R$.displayName="SmoothStepEdge";const MF=k.memo(e=>{var t;return le.createElement(R$,{...e,pathOptions:k.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});MF.displayName="StepEdge";function IIt({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[a,i,s,l]=Mce({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,a,i,s,l]}const _F=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:o,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:m,markerStart:v,interactionWidth:x})=>{const[M,b,C]=IIt({sourceX:e,sourceY:t,targetX:n,targetY:o});return le.createElement($p,{path:M,labelX:b,labelY:C,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:m,markerStart:v,interactionWidth:x})});_F.displayName="StraightEdge";function vm(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function iQ({pos:e,x1:t,y1:n,x2:o,y2:a,c:i}){switch(e){case Ye.Left:return[t-vm(t-o,i),n];case Ye.Right:return[t+vm(o-t,i),n];case Ye.Top:return[t,n-vm(n-a,i)];case Ye.Bottom:return[t,n+vm(a-n,i)]}}function Cce({sourceX:e,sourceY:t,sourcePosition:n=Ye.Bottom,targetX:o,targetY:a,targetPosition:i=Ye.Top,curvature:s=.25}){const[l,d]=iQ({pos:n,x1:e,y1:t,x2:o,y2:a,c:s}),[h,p]=iQ({pos:i,x1:o,y1:a,x2:e,y2:t,c:s}),[m,v,x,M]=_ce({sourceX:e,sourceY:t,targetX:o,targetY:a,sourceControlX:l,sourceControlY:d,targetControlX:h,targetControlY:p});return[`M${e},${t} C${l},${d} ${h},${p} ${o},${a}`,m,v,x,M]}const gP=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:o,sourcePosition:a=Ye.Bottom,targetPosition:i=Ye.Top,label:s,labelStyle:l,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:v,markerEnd:x,markerStart:M,pathOptions:b,interactionWidth:C})=>{const[_,N,A]=Cce({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:o,targetPosition:i,curvature:b==null?void 0:b.curvature});return le.createElement($p,{path:_,labelX:N,labelY:A,label:s,labelStyle:l,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:v,markerEnd:x,markerStart:M,interactionWidth:C})});gP.displayName="BezierEdge";const SF=k.createContext(null),TIt=SF.Provider;SF.Consumer;const RIt=()=>k.useContext(SF),PIt=e=>"id"in e&&"source"in e&&"target"in e,$It=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`reactflow__edge-${e}${t||""}-${n}${o||""}`,YH=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`,DIt=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),WH=(e,t)=>{if(!e.source||!e.target)return t;let n;return PIt(e)?n={...e}:n={...e,id:$It(e)},DIt(n,t)?t:t.concat(n)},KH=({x:e,y:t},[n,o,a],i,[s,l])=>{const d={x:(e-n)/a,y:(t-o)/a};return i?{x:s*Math.round(d.x/s),y:l*Math.round(d.y/l)}:d},Nce=({x:e,y:t},[n,o,a])=>({x:e*a+n,y:t*a+o}),Oh=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],o=(e.height??0)*t[1],a={x:e.position.x-n,y:e.position.y-o};return{...a,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-o}:a}},CF=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,a)=>{const{x:i,y:s}=Oh(a,t).positionAbsolute;return _It(o,wF({x:i,y:s,width:a.width||0,height:a.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return SIt(n)},Lce=(e,t,[n,o,a]=[0,0,1],i=!1,s=!1,l=[0,0])=>{const d={x:(t.x-n)/a,y:(t.y-o)/a,width:t.width/a,height:t.height/a},h=[];return e.forEach(p=>{const{width:m,height:v,selectable:x=!0,hidden:M=!1}=p;if(s&&!x||M)return!1;const{positionAbsolute:b}=Oh(p,l),C={x:b.x,y:b.y,width:m||0,height:v||0},_=GH(d,C),N=typeof m>"u"||typeof v>"u"||m===null||v===null,A=i&&_>0,I=(m||0)*(v||0);(N||A||_>=I||p.dragging)&&h.push(p)}),h},jce=(e,t)=>{const n=e.map(o=>o.id);return t.filter(o=>n.includes(o.source)||n.includes(o.target))},Ace=(e,t,n,o,a,i=.1)=>{const s=t/(e.width*(1+i)),l=n/(e.height*(1+i)),d=Math.min(s,l),h=e2(d,o,a),p=e.x+e.width/2,m=e.y+e.height/2,v=t/2-p*h,x=n/2-m*h;return{x:v,y:x,zoom:h}},Td=(e,t=0)=>e.transition().duration(t);function sQ(e,t,n,o){return(t[n]||[]).reduce((a,i)=>{var s,l;return`${e.id}-${i.id}-${n}`!==o&&a.push({id:i.id||null,type:n,nodeId:e.id,x:(((s=e.positionAbsolute)==null?void 0:s.x)??0)+i.x+i.width/2,y:(((l=e.positionAbsolute)==null?void 0:l.y)??0)+i.y+i.height/2}),a},[])}function zIt(e,t,n,o,a,i){const{x:s,y:l}=_s(e),h=t.elementsFromPoint(s,l).find(M=>M.classList.contains("react-flow__handle"));if(h){const M=h.getAttribute("data-nodeid");if(M){const b=NF(void 0,h),C=h.getAttribute("data-handleid"),_=i({nodeId:M,id:C,type:b});if(_){const N=a.find(A=>A.nodeId===M&&A.type===b&&A.id===C);return{handle:{id:C,type:b,nodeId:M,x:(N==null?void 0:N.x)||n.x,y:(N==null?void 0:N.y)||n.y},validHandleResult:_}}}}let p=[],m=1/0;if(a.forEach(M=>{const b=Math.sqrt((M.x-n.x)**2+(M.y-n.y)**2);if(b<=o){const C=i(M);b<=m&&(b<m?p=[{handle:M,validHandleResult:C}]:b===m&&p.push({handle:M,validHandleResult:C}),m=b)}}),!p.length)return{handle:null,validHandleResult:Ece()};if(p.length===1)return p[0];const v=p.some(({validHandleResult:M})=>M.isValid),x=p.some(({handle:M})=>M.type==="target");return p.find(({handle:M,validHandleResult:b})=>x?M.type==="target":v?b.isValid:!0)||p[0]}const OIt={source:null,target:null,sourceHandle:null,targetHandle:null},Ece=()=>({handleDomNode:null,isValid:!1,connection:OIt,endHandle:null});function Ice(e,t,n,o,a,i,s){const l=a==="target",d=s.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),h={...Ece(),handleDomNode:d};if(d){const p=NF(void 0,d),m=d.getAttribute("data-nodeid"),v=d.getAttribute("data-handleid"),x=d.classList.contains("connectable"),M=d.classList.contains("connectableend"),b={source:l?m:n,sourceHandle:l?v:o,target:l?n:m,targetHandle:l?o:v};h.connection=b,x&&M&&(t===l1.Strict?l&&p==="source"||!l&&p==="target":m!==n||v!==o)&&(h.endHandle={nodeId:m,handleId:v,type:p},h.isValid=i(b))}return h}function qIt({nodes:e,nodeId:t,handleId:n,handleType:o}){return e.reduce((a,i)=>{if(i[vn]){const{handleBounds:s}=i[vn];let l=[],d=[];s&&(l=sQ(i,s,"source",`${t}-${n}-${o}`),d=sQ(i,s,"target",`${t}-${n}-${o}`)),a.push(...l,...d)}return a},[])}function NF(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function nq(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function HIt(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function Tce({event:e,handleId:t,nodeId:n,onConnect:o,isTarget:a,getState:i,setState:s,isValidConnection:l,edgeUpdaterType:d,onReconnectEnd:h}){const p=xce(e.target),{connectionMode:m,domNode:v,autoPanOnConnect:x,connectionRadius:M,onConnectStart:b,panBy:C,getNodes:_,cancelConnection:N}=i();let A=0,I;const{x:R,y:j}=_s(e),D=p==null?void 0:p.elementFromPoint(R,j),H=NF(d,D),U=v==null?void 0:v.getBoundingClientRect();if(!U||!H)return;let z,Z=_s(e,U),q=!1,G=null,E=!1,O=null;const P=qIt({nodes:_(),nodeId:n,handleId:t,handleType:H}),X=()=>{if(!x)return;const[L,Y]=kce(Z,U);C({x:L,y:Y}),A=requestAnimationFrame(X)};s({connectionPosition:Z,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:H,connectionStartHandle:{nodeId:n,handleId:t,type:H},connectionEndHandle:null}),b==null||b(e,{nodeId:n,handleId:t,handleType:H});function W(L){const{transform:Y}=i();Z=_s(L,U);const{handle:F,validHandleResult:T}=zIt(L,p,KH(Z,Y,!1,[1,1]),M,P,K=>Ice(K,m,n,t,a?"target":"source",l,p));if(I=F,q||(X(),q=!0),O=T.handleDomNode,G=T.connection,E=T.isValid,s({connectionPosition:I&&E?Nce({x:I.x,y:I.y},Y):Z,connectionStatus:HIt(!!I,E),connectionEndHandle:T.endHandle}),!I&&!E&&!O)return nq(z);G.source!==G.target&&O&&(nq(z),z=O,O.classList.add("connecting","react-flow__handle-connecting"),O.classList.toggle("valid",E),O.classList.toggle("react-flow__handle-valid",E))}function V(L){var Y,F;(I||O)&&G&&E&&(o==null||o(G)),(F=(Y=i()).onConnectEnd)==null||F.call(Y,L),d&&(h==null||h(L)),nq(z),N(),cancelAnimationFrame(A),q=!1,E=!1,G=null,O=null,p.removeEventListener("mousemove",W),p.removeEventListener("mouseup",V),p.removeEventListener("touchmove",W),p.removeEventListener("touchend",V)}p.addEventListener("mousemove",W),p.addEventListener("mouseup",V),p.addEventListener("touchmove",W),p.addEventListener("touchend",V)}const cQ=()=>!0,VIt=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),BIt=(e,t,n)=>o=>{const{connectionStartHandle:a,connectionEndHandle:i,connectionClickStartHandle:s}=o;return{connecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n||(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===t&&(s==null?void 0:s.type)===n}},Rce=k.forwardRef(({type:e="source",position:t=Ye.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:a=!0,isConnectableEnd:i=!0,id:s,onConnect:l,children:d,className:h,onMouseDown:p,onTouchStart:m,...v},x)=>{var U,z;const M=s||null,b=e==="target",C=Jn(),_=RIt(),{connectOnClick:N,noPanClassName:A}=un(VIt,Ro),{connecting:I,clickConnecting:R}=un(BIt(_,M,e),Ro);_||(z=(U=C.getState()).onError)==null||z.call(U,"010",mi.error010());const j=Z=>{const{defaultEdgeOptions:q,onConnect:G,hasDefaultEdges:E}=C.getState(),O={...q,...Z};if(E){const{edges:P,setEdges:X}=C.getState();X(WH(O,P))}G==null||G(O),l==null||l(O)},D=Z=>{if(!_)return;const q=bce(Z);a&&(q&&Z.button===0||!q)&&Tce({event:Z,handleId:M,nodeId:_,onConnect:j,isTarget:b,getState:C.getState,setState:C.setState,isValidConnection:n||C.getState().isValidConnection||cQ}),q?p==null||p(Z):m==null||m(Z)},H=Z=>{const{onClickConnectStart:q,onClickConnectEnd:G,connectionClickStartHandle:E,connectionMode:O,isValidConnection:P}=C.getState();if(!_||!E&&!a)return;if(!E){q==null||q(Z,{nodeId:_,handleId:M,handleType:e}),C.setState({connectionClickStartHandle:{nodeId:_,type:e,handleId:M}});return}const X=xce(Z.target),W=n||P||cQ,{connection:V,isValid:L}=Ice({nodeId:_,id:M,type:e},O,E.nodeId,E.handleId||null,E.type,W,X);L&&j(V),G==null||G(Z),C.setState({connectionClickStartHandle:null})};return le.createElement("div",{"data-handleid":M,"data-nodeid":_,"data-handlepos":t,"data-id":`${_}-${M}-${e}`,className:ko(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",A,h,{source:!b,target:b,connectable:o,connectablestart:a,connectableend:i,connecting:R,connectionindicator:o&&(a&&!I||i&&I)}]),onMouseDown:D,onTouchStart:D,onClick:N?H:void 0,ref:x,...v},d)});Rce.displayName="Handle";var np=k.memo(Rce);const Pce=({data:e,isConnectable:t,targetPosition:n=Ye.Top,sourcePosition:o=Ye.Bottom})=>le.createElement(le.Fragment,null,le.createElement(np,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,le.createElement(np,{type:"source",position:o,isConnectable:t}));Pce.displayName="DefaultNode";var QH=k.memo(Pce);const $ce=({data:e,isConnectable:t,sourcePosition:n=Ye.Bottom})=>le.createElement(le.Fragment,null,e==null?void 0:e.label,le.createElement(np,{type:"source",position:n,isConnectable:t}));$ce.displayName="InputNode";var Dce=k.memo($ce);const zce=({data:e,isConnectable:t,targetPosition:n=Ye.Top})=>le.createElement(le.Fragment,null,le.createElement(np,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);zce.displayName="OutputNode";var Oce=k.memo(zce);const LF=()=>null;LF.displayName="GroupNode";const FIt=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),km=e=>e.id;function UIt(e,t){return Ro(e.selectedNodes.map(km),t.selectedNodes.map(km))&&Ro(e.selectedEdges.map(km),t.selectedEdges.map(km))}const qce=k.memo(({onSelectionChange:e})=>{const t=Jn(),{selectedNodes:n,selectedEdges:o}=un(FIt,UIt);return k.useEffect(()=>{const a={nodes:n,edges:o};e==null||e(a),t.getState().onSelectionChange.forEach(i=>i(a))},[n,o,e]),null});qce.displayName="SelectionListener";const GIt=e=>!!e.onSelectionChange;function XIt({onSelectionChange:e}){const t=un(GIt);return e||t?le.createElement(qce,{onSelectionChange:e}):null}const ZIt=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function ah(e,t){k.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function gt(e,t,n){k.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const YIt=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:a,onConnectStart:i,onConnectEnd:s,onClickConnectStart:l,onClickConnectEnd:d,nodesDraggable:h,nodesConnectable:p,nodesFocusable:m,edgesFocusable:v,edgesUpdatable:x,elevateNodesOnSelect:M,minZoom:b,maxZoom:C,nodeExtent:_,onNodesChange:N,onEdgesChange:A,elementsSelectable:I,connectionMode:R,snapGrid:j,snapToGrid:D,translateExtent:H,connectOnClick:U,defaultEdgeOptions:z,fitView:Z,fitViewOptions:q,onNodesDelete:G,onEdgesDelete:E,onNodeDrag:O,onNodeDragStart:P,onNodeDragStop:X,onSelectionDrag:W,onSelectionDragStart:V,onSelectionDragStop:L,noPanClassName:Y,nodeOrigin:F,rfId:T,autoPanOnConnect:K,autoPanOnNodeDrag:Q,onError:ne,connectionRadius:te,isValidConnection:ce,nodeDragThreshold:me})=>{const{setNodes:ke,setEdges:Ee,setDefaultNodesAndEdges:Ie,setMinZoom:Te,setMaxZoom:qe,setTranslateExtent:ct,setNodeExtent:jt,reset:We}=un(ZIt,Ro),Le=Jn();return k.useEffect(()=>{const Rt=o==null?void 0:o.map(eo=>({...eo,...z}));return Ie(n,Rt),()=>{We()}},[]),gt("defaultEdgeOptions",z,Le.setState),gt("connectionMode",R,Le.setState),gt("onConnect",a,Le.setState),gt("onConnectStart",i,Le.setState),gt("onConnectEnd",s,Le.setState),gt("onClickConnectStart",l,Le.setState),gt("onClickConnectEnd",d,Le.setState),gt("nodesDraggable",h,Le.setState),gt("nodesConnectable",p,Le.setState),gt("nodesFocusable",m,Le.setState),gt("edgesFocusable",v,Le.setState),gt("edgesUpdatable",x,Le.setState),gt("elementsSelectable",I,Le.setState),gt("elevateNodesOnSelect",M,Le.setState),gt("snapToGrid",D,Le.setState),gt("snapGrid",j,Le.setState),gt("onNodesChange",N,Le.setState),gt("onEdgesChange",A,Le.setState),gt("connectOnClick",U,Le.setState),gt("fitViewOnInit",Z,Le.setState),gt("fitViewOnInitOptions",q,Le.setState),gt("onNodesDelete",G,Le.setState),gt("onEdgesDelete",E,Le.setState),gt("onNodeDrag",O,Le.setState),gt("onNodeDragStart",P,Le.setState),gt("onNodeDragStop",X,Le.setState),gt("onSelectionDrag",W,Le.setState),gt("onSelectionDragStart",V,Le.setState),gt("onSelectionDragStop",L,Le.setState),gt("noPanClassName",Y,Le.setState),gt("nodeOrigin",F,Le.setState),gt("rfId",T,Le.setState),gt("autoPanOnConnect",K,Le.setState),gt("autoPanOnNodeDrag",Q,Le.setState),gt("onError",ne,Le.setState),gt("connectionRadius",te,Le.setState),gt("isValidConnection",ce,Le.setState),gt("nodeDragThreshold",me,Le.setState),ah(e,ke),ah(t,Ee),ah(b,Te),ah(C,qe),ah(H,ct),ah(_,jt),null},lQ={display:"none"},WIt={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Hce="react-flow__node-desc",Vce="react-flow__edge-desc",KIt="react-flow__aria-live",QIt=e=>e.ariaLiveMessage;function JIt({rfId:e}){const t=un(QIt);return le.createElement("div",{id:`${KIt}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:WIt},t)}function eTt({rfId:e,disableKeyboardA11y:t}){return le.createElement(le.Fragment,null,le.createElement("div",{id:`${Hce}-${e}`,style:lQ},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),le.createElement("div",{id:`${Vce}-${e}`,style:lQ},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&le.createElement(JIt,{rfId:e}))}var op=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,o]=k.useState(!1),a=k.useRef(!1),i=k.useRef(new Set([])),[s,l]=k.useMemo(()=>{if(e!==null){const h=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),p=h.reduce((m,v)=>m.concat(...v),[]);return[h,p]}return[[],[]]},[e]);return k.useEffect(()=>{const d=typeof document<"u"?document:null,h=(t==null?void 0:t.target)||d;if(e!==null){const p=x=>{if(a.current=x.ctrlKey||x.metaKey||x.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&XH(x))return!1;const b=dQ(x.code,l);i.current.add(x[b]),uQ(s,i.current,!1)&&(x.preventDefault(),o(!0))},m=x=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&XH(x))return!1;const b=dQ(x.code,l);uQ(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(x[b]),x.key==="Meta"&&i.current.clear(),a.current=!1},v=()=>{i.current.clear(),o(!1)};return h==null||h.addEventListener("keydown",p),h==null||h.addEventListener("keyup",m),window.addEventListener("blur",v),()=>{h==null||h.removeEventListener("keydown",p),h==null||h.removeEventListener("keyup",m),window.removeEventListener("blur",v)}}},[e,o]),n};function uQ(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(a=>t.has(a)))}function dQ(e,t){return t.includes(e)?"code":"key"}function Bce(e,t,n,o){var l,d;const a=e.parentNode||e.parentId;if(!a)return n;const i=t.get(a),s=Oh(i,o);return Bce(i,t,{x:(n.x??0)+s.x,y:(n.y??0)+s.y,z:(((l=i[vn])==null?void 0:l.z)??0)>(n.z??0)?((d=i[vn])==null?void 0:d.z)??0:n.z??0},o)}function Fce(e,t,n){e.forEach(o=>{var i;const a=o.parentNode||o.parentId;if(a&&!e.has(a))throw new Error(`Parent node ${a} not found`);if(a||n!=null&&n[o.id]){const{x:s,y:l,z:d}=Bce(o,e,{...o.position,z:((i=o[vn])==null?void 0:i.z)??0},t);o.positionAbsolute={x:s,y:l},o[vn].z=d,n!=null&&n[o.id]&&(o[vn].isParent=!0)}})}function oq(e,t,n,o){const a=new Map,i={},s=o?1e3:0;return e.forEach(l=>{var x;const d=(xa(l.zIndex)?l.zIndex:0)+(l.selected?s:0),h=t.get(l.id),p={...l,positionAbsolute:{x:l.position.x,y:l.position.y}},m=l.parentNode||l.parentId;m&&(i[m]=!0);const v=(h==null?void 0:h.type)&&(h==null?void 0:h.type)!==l.type;Object.defineProperty(p,vn,{enumerable:!1,value:{handleBounds:v||(x=h==null?void 0:h[vn])==null?void 0:x.handleBounds,z:d}}),a.set(l.id,p)}),Fce(a,n,i),a}function Uce(e,t={}){const{getNodes:n,width:o,height:a,minZoom:i,maxZoom:s,d3Zoom:l,d3Selection:d,fitViewOnInitDone:h,fitViewOnInit:p,nodeOrigin:m}=e(),v=t.initial&&!h&&p;if(l&&d&&(v||!t.initial)){const M=n().filter(C=>{var N;const _=t.includeHiddenNodes?C.width&&C.height:!C.hidden;return(N=t.nodes)!=null&&N.length?_&&t.nodes.some(A=>A.id===C.id):_}),b=M.every(C=>C.width&&C.height);if(M.length>0&&b){const C=CF(M,m),{x:_,y:N,zoom:A}=Ace(C,o,a,t.minZoom??i,t.maxZoom??s,t.padding??.1),I=Ms.translate(_,N).scale(A);return typeof t.duration=="number"&&t.duration>0?l.transform(Td(d,t.duration),I):l.transform(d,I),!0}}return!1}function tTt(e,t){return e.forEach(n=>{const o=t.get(n.id);o&&t.set(o.id,{...o,[vn]:o[vn],selected:n.selected})}),new Map(t)}function nTt(e,t){return t.map(n=>{const o=e.find(a=>a.id===n.id);return o&&(n.selected=o.selected),n})}function xm({changedNodes:e,changedEdges:t,get:n,set:o}){const{nodeInternals:a,edges:i,onNodesChange:s,onEdgesChange:l,hasDefaultNodes:d,hasDefaultEdges:h}=n();e!=null&&e.length&&(d&&o({nodeInternals:tTt(e,a)}),s==null||s(e)),t!=null&&t.length&&(h&&o({edges:nTt(t,i)}),l==null||l(t))}const rh=()=>{},oTt={zoomIn:rh,zoomOut:rh,zoomTo:rh,getZoom:()=>1,setViewport:rh,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:rh,fitBounds:rh,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},aTt=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),rTt=()=>{const e=Jn(),{d3Zoom:t,d3Selection:n}=un(aTt,Ro);return k.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(Td(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(Td(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,i)=>t.scaleTo(Td(n,i==null?void 0:i.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,i)=>{const[s,l,d]=e.getState().transform,h=Ms.translate(a.x??s,a.y??l).scale(a.zoom??d);t.transform(Td(n,i==null?void 0:i.duration),h)},getViewport:()=>{const[a,i,s]=e.getState().transform;return{x:a,y:i,zoom:s}},fitView:a=>Uce(e.getState,a),setCenter:(a,i,s)=>{const{width:l,height:d,maxZoom:h}=e.getState(),p=typeof(s==null?void 0:s.zoom)<"u"?s.zoom:h,m=l/2-a*p,v=d/2-i*p,x=Ms.translate(m,v).scale(p);t.transform(Td(n,s==null?void 0:s.duration),x)},fitBounds:(a,i)=>{const{width:s,height:l,minZoom:d,maxZoom:h}=e.getState(),{x:p,y:m,zoom:v}=Ace(a,s,l,d,h,(i==null?void 0:i.padding)??.1),x=Ms.translate(p,m).scale(v);t.transform(Td(n,i==null?void 0:i.duration),x)},project:a=>{const{transform:i,snapToGrid:s,snapGrid:l}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),KH(a,i,s,l)},screenToFlowPosition:a=>{const{transform:i,snapToGrid:s,snapGrid:l,domNode:d}=e.getState();if(!d)return a;const{x:h,y:p}=d.getBoundingClientRect(),m={x:a.x-h,y:a.y-p};return KH(m,i,s,l)},flowToScreenPosition:a=>{const{transform:i,domNode:s}=e.getState();if(!s)return a;const{x:l,y:d}=s.getBoundingClientRect(),h=Nce(a,i);return{x:h.x+l,y:h.y+d}},viewportInitialized:!0}:oTt,[t,n])};function P$(){const e=rTt(),t=Jn(),n=k.useCallback(()=>t.getState().getNodes().map(b=>({...b})),[]),o=k.useCallback(b=>t.getState().nodeInternals.get(b),[]),a=k.useCallback(()=>{const{edges:b=[]}=t.getState();return b.map(C=>({...C}))},[]),i=k.useCallback(b=>{const{edges:C=[]}=t.getState();return C.find(_=>_.id===b)},[]),s=k.useCallback(b=>{const{getNodes:C,setNodes:_,hasDefaultNodes:N,onNodesChange:A}=t.getState(),I=C(),R=typeof b=="function"?b(I):b;if(N)_(R);else if(A){const j=R.length===0?I.map(D=>({type:"remove",id:D.id})):R.map(D=>({item:D,type:"reset"}));A(j)}},[]),l=k.useCallback(b=>{const{edges:C=[],setEdges:_,hasDefaultEdges:N,onEdgesChange:A}=t.getState(),I=typeof b=="function"?b(C):b;if(N)_(I);else if(A){const R=I.length===0?C.map(j=>({type:"remove",id:j.id})):I.map(j=>({item:j,type:"reset"}));A(R)}},[]),d=k.useCallback(b=>{const C=Array.isArray(b)?b:[b],{getNodes:_,setNodes:N,hasDefaultNodes:A,onNodesChange:I}=t.getState();if(A){const j=[..._(),...C];N(j)}else if(I){const R=C.map(j=>({item:j,type:"add"}));I(R)}},[]),h=k.useCallback(b=>{const C=Array.isArray(b)?b:[b],{edges:_=[],setEdges:N,hasDefaultEdges:A,onEdgesChange:I}=t.getState();if(A)N([..._,...C]);else if(I){const R=C.map(j=>({item:j,type:"add"}));I(R)}},[]),p=k.useCallback(()=>{const{getNodes:b,edges:C=[],transform:_}=t.getState(),[N,A,I]=_;return{nodes:b().map(R=>({...R})),edges:C.map(R=>({...R})),viewport:{x:N,y:A,zoom:I}}},[]),m=k.useCallback(({nodes:b,edges:C})=>{const{nodeInternals:_,getNodes:N,edges:A,hasDefaultNodes:I,hasDefaultEdges:R,onNodesDelete:j,onEdgesDelete:D,onNodesChange:H,onEdgesChange:U}=t.getState(),z=(b||[]).map(O=>O.id),Z=(C||[]).map(O=>O.id),q=N().reduce((O,P)=>{const X=P.parentNode||P.parentId,W=!z.includes(P.id)&&X&&O.find(L=>L.id===X);return(typeof P.deletable=="boolean"?P.deletable:!0)&&(z.includes(P.id)||W)&&O.push(P),O},[]),G=A.filter(O=>typeof O.deletable=="boolean"?O.deletable:!0),E=G.filter(O=>Z.includes(O.id));if(q||E){const O=jce(q,G),P=[...E,...O],X=P.reduce((W,V)=>(W.includes(V.id)||W.push(V.id),W),[]);if((R||I)&&(R&&t.setState({edges:A.filter(W=>!X.includes(W.id))}),I&&(q.forEach(W=>{_.delete(W.id)}),t.setState({nodeInternals:new Map(_)}))),X.length>0&&(D==null||D(P),U&&U(X.map(W=>({id:W,type:"remove"})))),q.length>0&&(j==null||j(q),H)){const W=q.map(V=>({id:V.id,type:"remove"}));H(W)}}},[]),v=k.useCallback(b=>{const C=CIt(b),_=C?null:t.getState().nodeInternals.get(b.id);return!C&&!_?[null,null,C]:[C?b:nQ(_),_,C]},[]),x=k.useCallback((b,C=!0,_)=>{const[N,A,I]=v(b);return N?(_||t.getState().getNodes()).filter(R=>{if(!I&&(R.id===A.id||!R.positionAbsolute))return!1;const j=nQ(R),D=GH(j,N);return C&&D>0||D>=N.width*N.height}):[]},[]),M=k.useCallback((b,C,_=!0)=>{const[N]=v(b);if(!N)return!1;const A=GH(N,C);return _&&A>0||A>=N.width*N.height},[]);return k.useMemo(()=>({...e,getNodes:n,getNode:o,getEdges:a,getEdge:i,setNodes:s,setEdges:l,addNodes:d,addEdges:h,toObject:p,deleteElements:m,getIntersectingNodes:x,isNodeIntersecting:M}),[e,n,o,a,i,s,l,d,h,p,m,x,M])}const iTt={actInsideInputWithModifier:!1};var sTt=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Jn(),{deleteElements:o}=P$(),a=op(e,iTt),i=op(t);k.useEffect(()=>{if(a){const{edges:s,getNodes:l}=n.getState(),d=l().filter(p=>p.selected),h=s.filter(p=>p.selected);o({nodes:d,edges:h}),n.setState({nodesSelectionActive:!1})}},[a]),k.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function cTt(e){const t=Jn();k.useEffect(()=>{let n;const o=()=>{var i,s;if(!e.current)return;const a=kF(e.current);(a.height===0||a.width===0)&&((s=(i=t.getState()).onError)==null||s.call(i,"004",mi.error004())),t.setState({width:a.width||500,height:a.height||500})};return o(),window.addEventListener("resize",o),e.current&&(n=new ResizeObserver(()=>o()),n.observe(e.current)),()=>{window.removeEventListener("resize",o),n&&e.current&&n.unobserve(e.current)}},[])}const jF={position:"absolute",width:"100%",height:"100%",top:0,left:0},lTt=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,wm=e=>({x:e.x,y:e.y,zoom:e.k}),ih=(e,t)=>e.target.closest(`.${t}`),hQ=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),fQ=e=>{const t=e.ctrlKey&&yP()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},uTt=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),dTt=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:a=!0,zoomOnPinch:i=!0,panOnScroll:s=!1,panOnScrollSpeed:l=.5,panOnScrollMode:d=Od.Free,zoomOnDoubleClick:h=!0,elementsSelectable:p,panOnDrag:m=!0,defaultViewport:v,translateExtent:x,minZoom:M,maxZoom:b,zoomActivationKeyCode:C,preventScrolling:_=!0,children:N,noWheelClassName:A,noPanClassName:I})=>{const R=k.useRef(),j=Jn(),D=k.useRef(!1),H=k.useRef(!1),U=k.useRef(null),z=k.useRef({x:0,y:0,zoom:0}),{d3Zoom:Z,d3Selection:q,d3ZoomHandler:G,userSelectionActive:E}=un(uTt,Ro),O=op(C),P=k.useRef(0),X=k.useRef(!1),W=k.useRef();return cTt(U),k.useEffect(()=>{if(U.current){const V=U.current.getBoundingClientRect(),L=vIt().scaleExtent([M,b]).translateExtent(x),Y=Ha(U.current).call(L),F=Ms.translate(v.x,v.y).scale(e2(v.zoom,M,b)),T=[[0,0],[V.width,V.height]],K=L.constrain()(F,T,x);L.transform(Y,K),L.wheelDelta(fQ),j.setState({d3Zoom:L,d3Selection:Y,d3ZoomHandler:Y.on("wheel.zoom"),transform:[K.x,K.y,K.k],domNode:U.current.closest(".react-flow")})}},[]),k.useEffect(()=>{q&&Z&&(s&&!O&&!E?q.on("wheel.zoom",V=>{if(ih(V,A))return!1;V.preventDefault(),V.stopImmediatePropagation();const L=q.property("__zoom").k||1;if(V.ctrlKey&&i){const ce=pr(V),me=fQ(V),ke=L*Math.pow(2,me);Z.scaleTo(q,ke,ce,V);return}const Y=V.deltaMode===1?20:1;let F=d===Od.Vertical?0:V.deltaX*Y,T=d===Od.Horizontal?0:V.deltaY*Y;!yP()&&V.shiftKey&&d!==Od.Vertical&&(F=V.deltaY*Y,T=0),Z.translateBy(q,-(F/L)*l,-(T/L)*l,{internal:!0});const K=wm(q.property("__zoom")),{onViewportChangeStart:Q,onViewportChange:ne,onViewportChangeEnd:te}=j.getState();clearTimeout(W.current),X.current||(X.current=!0,t==null||t(V,K),Q==null||Q(K)),X.current&&(e==null||e(V,K),ne==null||ne(K),W.current=setTimeout(()=>{n==null||n(V,K),te==null||te(K),X.current=!1},150))},{passive:!1}):typeof G<"u"&&q.on("wheel.zoom",function(V,L){if(!_&&V.type==="wheel"&&!V.ctrlKey||ih(V,A))return null;V.preventDefault(),G.call(this,V,L)},{passive:!1}))},[E,s,d,q,Z,G,O,i,_,A,t,e,n]),k.useEffect(()=>{Z&&Z.on("start",V=>{var F,T;if(!V.sourceEvent||V.sourceEvent.internal)return null;P.current=(F=V.sourceEvent)==null?void 0:F.button;const{onViewportChangeStart:L}=j.getState(),Y=wm(V.transform);D.current=!0,z.current=Y,((T=V.sourceEvent)==null?void 0:T.type)==="mousedown"&&j.setState({paneDragging:!0}),L==null||L(Y),t==null||t(V.sourceEvent,Y)})},[Z,t]),k.useEffect(()=>{Z&&(E&&!D.current?Z.on("zoom",null):E||Z.on("zoom",V=>{var Y;const{onViewportChange:L}=j.getState();if(j.setState({transform:[V.transform.x,V.transform.y,V.transform.k]}),H.current=!!(o&&hQ(m,P.current??0)),(e||L)&&!((Y=V.sourceEvent)!=null&&Y.internal)){const F=wm(V.transform);L==null||L(F),e==null||e(V.sourceEvent,F)}}))},[E,Z,e,m,o]),k.useEffect(()=>{Z&&Z.on("end",V=>{if(!V.sourceEvent||V.sourceEvent.internal)return null;const{onViewportChangeEnd:L}=j.getState();if(D.current=!1,j.setState({paneDragging:!1}),o&&hQ(m,P.current??0)&&!H.current&&o(V.sourceEvent),H.current=!1,(n||L)&&lTt(z.current,V.transform)){const Y=wm(V.transform);z.current=Y,clearTimeout(R.current),R.current=setTimeout(()=>{L==null||L(Y),n==null||n(V.sourceEvent,Y)},s?150:0)}})},[Z,s,m,n,o]),k.useEffect(()=>{Z&&Z.filter(V=>{const L=O||a,Y=i&&V.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&V.button===1&&V.type==="mousedown"&&(ih(V,"react-flow__node")||ih(V,"react-flow__edge")))return!0;if(!m&&!L&&!s&&!h&&!i||E||!h&&V.type==="dblclick"||ih(V,A)&&V.type==="wheel"||ih(V,I)&&(V.type!=="wheel"||s&&V.type==="wheel"&&!O)||!i&&V.ctrlKey&&V.type==="wheel"||!L&&!s&&!Y&&V.type==="wheel"||!m&&(V.type==="mousedown"||V.type==="touchstart")||Array.isArray(m)&&!m.includes(V.button)&&V.type==="mousedown")return!1;const F=Array.isArray(m)&&m.includes(V.button)||!V.button||V.button<=1;return(!V.ctrlKey||V.type==="wheel")&&F})},[E,Z,a,i,s,h,m,p,O]),le.createElement("div",{className:"react-flow__renderer",ref:U,style:jF},N)},hTt=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function fTt(){const{userSelectionActive:e,userSelectionRect:t}=un(hTt,Ro);return e&&t?le.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function pQ(e,t){const n=t.parentNode||t.parentId,o=e.find(a=>a.id===n);if(o){const a=t.position.x+t.width-o.width,i=t.position.y+t.height-o.height;if(a>0||i>0||t.position.x<0||t.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,a>0&&(o.style.width+=a),i>0&&(o.style.height+=i),t.position.x<0){const s=Math.abs(t.position.x);o.position.x=o.position.x-s,o.style.width+=s,t.position.x=0}if(t.position.y<0){const s=Math.abs(t.position.y);o.position.y=o.position.y-s,o.style.height+=s,t.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function Gce(e,t){if(e.some(o=>o.type==="reset"))return e.filter(o=>o.type==="reset").map(o=>o.item);const n=e.filter(o=>o.type==="add").map(o=>o.item);return t.reduce((o,a)=>{const i=e.filter(l=>l.id===a.id);if(i.length===0)return o.push(a),o;const s={...a};for(const l of i)if(l)switch(l.type){case"select":{s.selected=l.selected;break}case"position":{typeof l.position<"u"&&(s.position=l.position),typeof l.positionAbsolute<"u"&&(s.positionAbsolute=l.positionAbsolute),typeof l.dragging<"u"&&(s.dragging=l.dragging),s.expandParent&&pQ(o,s);break}case"dimensions":{typeof l.dimensions<"u"&&(s.width=l.dimensions.width,s.height=l.dimensions.height),typeof l.updateStyle<"u"&&(s.style={...s.style||{},...l.dimensions}),typeof l.resizing=="boolean"&&(s.resizing=l.resizing),s.expandParent&&pQ(o,s);break}case"remove":return o}return o.push(s),o},n)}function Xce(e,t){return Gce(e,t)}function pTt(e,t){return Gce(e,t)}const as=(e,t)=>({id:e,type:"select",selected:t});function wh(e,t){return e.reduce((n,o)=>{const a=t.includes(o.id);return!o.selected&&a?(o.selected=!0,n.push(as(o.id,!0))):o.selected&&!a&&(o.selected=!1,n.push(as(o.id,!1))),n},[])}const aq=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},yTt=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),Zce=k.memo(({isSelecting:e,selectionMode:t=tp.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:a,onPaneClick:i,onPaneContextMenu:s,onPaneScroll:l,onPaneMouseEnter:d,onPaneMouseMove:h,onPaneMouseLeave:p,children:m})=>{const v=k.useRef(null),x=Jn(),M=k.useRef(0),b=k.useRef(0),C=k.useRef(),{userSelectionActive:_,elementsSelectable:N,dragging:A}=un(yTt,Ro),I=()=>{x.setState({userSelectionActive:!1,userSelectionRect:null}),M.current=0,b.current=0},R=G=>{i==null||i(G),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},j=G=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){G.preventDefault();return}s==null||s(G)},D=l?G=>l(G):void 0,H=G=>{const{resetSelectedElements:E,domNode:O}=x.getState();if(C.current=O==null?void 0:O.getBoundingClientRect(),!N||!e||G.button!==0||G.target!==v.current||!C.current)return;const{x:P,y:X}=_s(G,C.current);E(),x.setState({userSelectionRect:{width:0,height:0,startX:P,startY:X,x:P,y:X}}),o==null||o(G)},U=G=>{const{userSelectionRect:E,nodeInternals:O,edges:P,transform:X,onNodesChange:W,onEdgesChange:V,nodeOrigin:L,getNodes:Y}=x.getState();if(!e||!C.current||!E)return;x.setState({userSelectionActive:!0,nodesSelectionActive:!1});const F=_s(G,C.current),T=E.startX??0,K=E.startY??0,Q={...E,x:F.x<T?F.x:T,y:F.y<K?F.y:K,width:Math.abs(F.x-T),height:Math.abs(F.y-K)},ne=Y(),te=Lce(O,Q,X,t===tp.Partial,!0,L),ce=jce(te,P).map(ke=>ke.id),me=te.map(ke=>ke.id);if(M.current!==me.length){M.current=me.length;const ke=wh(ne,me);ke.length&&(W==null||W(ke))}if(b.current!==ce.length){b.current=ce.length;const ke=wh(P,ce);ke.length&&(V==null||V(ke))}x.setState({userSelectionRect:Q})},z=G=>{if(G.button!==0)return;const{userSelectionRect:E}=x.getState();!_&&E&&G.target===v.current&&(R==null||R(G)),x.setState({nodesSelectionActive:M.current>0}),I(),a==null||a(G)},Z=G=>{_&&(x.setState({nodesSelectionActive:M.current>0}),a==null||a(G)),I()},q=N&&(e||_);return le.createElement("div",{className:ko(["react-flow__pane",{dragging:A,selection:e}]),onClick:q?void 0:aq(R,v),onContextMenu:aq(j,v),onWheel:aq(D,v),onMouseEnter:q?void 0:d,onMouseDown:q?H:void 0,onMouseMove:q?U:h,onMouseUp:q?z:void 0,onMouseLeave:q?Z:p,ref:v,style:jF},m,le.createElement(fTt,null))});Zce.displayName="Pane";function Yce(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const o=t.get(n);return o?o.selected?!0:Yce(o,t):!1}function yQ(e,t,n){let o=e;do{if(o!=null&&o.matches(t))return!0;if(o===n.current)return!1;o=o.parentElement}while(o);return!1}function mTt(e,t,n,o){return Array.from(e.values()).filter(a=>(a.selected||a.id===o)&&(!a.parentNode||a.parentId||!Yce(a,e))&&(a.draggable||t&&typeof a.draggable>"u")).map(a=>{var i,s;return{id:a.id,position:a.position||{x:0,y:0},positionAbsolute:a.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=a.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((s=a.positionAbsolute)==null?void 0:s.y)??0)},delta:{x:0,y:0},extent:a.extent,parentNode:a.parentNode||a.parentId,parentId:a.parentNode||a.parentId,width:a.width,height:a.height,expandParent:a.expandParent}})}function gTt(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function Wce(e,t,n,o,a=[0,0],i){const s=gTt(e,e.extent||o);let l=s;const d=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(d&&e.width&&e.height){const m=n.get(d),{x:v,y:x}=Oh(m,a).positionAbsolute;l=m&&xa(v)&&xa(x)&&xa(m.width)&&xa(m.height)?[[v+e.width*a[0],x+e.height*a[1]],[v+m.width-e.width+e.width*a[0],x+m.height-e.height+e.height*a[1]]]:l}else i==null||i("005",mi.error005()),l=s;else if(e.extent&&d&&e.extent!=="parent"){const m=n.get(d),{x:v,y:x}=Oh(m,a).positionAbsolute;l=[[e.extent[0][0]+v,e.extent[0][1]+x],[e.extent[1][0]+v,e.extent[1][1]+x]]}let h={x:0,y:0};if(d){const m=n.get(d);h=Oh(m,a).positionAbsolute}const p=l&&l!=="parent"?xF(t,l):t;return{position:{x:p.x-h.x,y:p.y-h.y},positionAbsolute:p}}function rq({nodeId:e,dragItems:t,nodeInternals:n}){const o=t.map(a=>({...n.get(a.id),position:a.position,positionAbsolute:a.positionAbsolute}));return[e?o.find(a=>a.id===e):o[0],o]}const mQ=(e,t,n,o)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const i=Array.from(a),s=t.getBoundingClientRect(),l={x:s.width*o[0],y:s.height*o[1]};return i.map(d=>{const h=d.getBoundingClientRect();return{id:d.getAttribute("data-handleid"),position:d.getAttribute("data-handlepos"),x:(h.left-s.left-l.x)/n,y:(h.top-s.top-l.y)/n,...kF(d)}})};function Lf(e,t,n){return n===void 0?n:o=>{const a=t().nodeInternals.get(e);a&&n(o,{...a})}}function JH({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:a,unselectNodesAndEdges:i,multiSelectionActive:s,nodeInternals:l,onError:d}=t.getState(),h=l.get(e);if(!h){d==null||d("012",mi.error012(e));return}t.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&s)&&(i({nodes:[h],edges:[]}),requestAnimationFrame(()=>{var p;return(p=o==null?void 0:o.current)==null?void 0:p.blur()})):a([e])}function vTt(){const e=Jn();return k.useCallback(({sourceEvent:n})=>{const{transform:o,snapGrid:a,snapToGrid:i}=e.getState(),s=n.touches?n.touches[0].clientX:n.clientX,l=n.touches?n.touches[0].clientY:n.clientY,d={x:(s-o[0])/o[2],y:(l-o[1])/o[2]};return{xSnapped:i?a[0]*Math.round(d.x/a[0]):d.x,ySnapped:i?a[1]*Math.round(d.y/a[1]):d.y,...d}},[])}function iq(e){return(t,n,o)=>e==null?void 0:e(t,o)}function Kce({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:a,isSelectable:i,selectNodesOnDrag:s}){const l=Jn(),[d,h]=k.useState(!1),p=k.useRef([]),m=k.useRef({x:null,y:null}),v=k.useRef(0),x=k.useRef(null),M=k.useRef({x:0,y:0}),b=k.useRef(null),C=k.useRef(!1),_=k.useRef(!1),N=k.useRef(!1),A=vTt();return k.useEffect(()=>{if(e!=null&&e.current){const I=Ha(e.current),R=({x:H,y:U})=>{const{nodeInternals:z,onNodeDrag:Z,onSelectionDrag:q,updateNodePositions:G,nodeExtent:E,snapGrid:O,snapToGrid:P,nodeOrigin:X,onError:W}=l.getState();m.current={x:H,y:U};let V=!1,L={x:0,y:0,x2:0,y2:0};if(p.current.length>1&&E){const F=CF(p.current,X);L=wF(F)}if(p.current=p.current.map(F=>{const T={x:H-F.distance.x,y:U-F.distance.y};P&&(T.x=O[0]*Math.round(T.x/O[0]),T.y=O[1]*Math.round(T.y/O[1]));const K=[[E[0][0],E[0][1]],[E[1][0],E[1][1]]];p.current.length>1&&E&&!F.extent&&(K[0][0]=F.positionAbsolute.x-L.x+E[0][0],K[1][0]=F.positionAbsolute.x+(F.width??0)-L.x2+E[1][0],K[0][1]=F.positionAbsolute.y-L.y+E[0][1],K[1][1]=F.positionAbsolute.y+(F.height??0)-L.y2+E[1][1]);const Q=Wce(F,T,z,K,X,W);return V=V||F.position.x!==Q.position.x||F.position.y!==Q.position.y,F.position=Q.position,F.positionAbsolute=Q.positionAbsolute,F}),!V)return;G(p.current,!0,!0),h(!0);const Y=a?Z:iq(q);if(Y&&b.current){const[F,T]=rq({nodeId:a,dragItems:p.current,nodeInternals:z});Y(b.current,F,T)}},j=()=>{if(!x.current)return;const[H,U]=kce(M.current,x.current);if(H!==0||U!==0){const{transform:z,panBy:Z}=l.getState();m.current.x=(m.current.x??0)-H/z[2],m.current.y=(m.current.y??0)-U/z[2],Z({x:H,y:U})&&R(m.current)}v.current=requestAnimationFrame(j)},D=H=>{var X;const{nodeInternals:U,multiSelectionActive:z,nodesDraggable:Z,unselectNodesAndEdges:q,onNodeDragStart:G,onSelectionDragStart:E}=l.getState();_.current=!0;const O=a?G:iq(E);(!s||!i)&&!z&&a&&((X=U.get(a))!=null&&X.selected||q()),a&&i&&s&&JH({id:a,store:l,nodeRef:e});const P=A(H);if(m.current=P,p.current=mTt(U,Z,P,a),O&&p.current){const[W,V]=rq({nodeId:a,dragItems:p.current,nodeInternals:U});O(H.sourceEvent,W,V)}};if(t)I.on(".drag",null);else{const H=LAt().on("start",U=>{const{domNode:z,nodeDragThreshold:Z}=l.getState();Z===0&&D(U),N.current=!1;const q=A(U);m.current=q,x.current=(z==null?void 0:z.getBoundingClientRect())||null,M.current=_s(U.sourceEvent,x.current)}).on("drag",U=>{var G,E;const z=A(U),{autoPanOnNodeDrag:Z,nodeDragThreshold:q}=l.getState();if(U.sourceEvent.type==="touchmove"&&U.sourceEvent.touches.length>1&&(N.current=!0),!N.current){if(!C.current&&_.current&&Z&&(C.current=!0,j()),!_.current){const O=z.xSnapped-(((G=m==null?void 0:m.current)==null?void 0:G.x)??0),P=z.ySnapped-(((E=m==null?void 0:m.current)==null?void 0:E.y)??0);Math.sqrt(O*O+P*P)>q&&D(U)}(m.current.x!==z.xSnapped||m.current.y!==z.ySnapped)&&p.current&&_.current&&(b.current=U.sourceEvent,M.current=_s(U.sourceEvent,x.current),R(z))}}).on("end",U=>{if(!(!_.current||N.current)&&(h(!1),C.current=!1,_.current=!1,cancelAnimationFrame(v.current),p.current)){const{updateNodePositions:z,nodeInternals:Z,onNodeDragStop:q,onSelectionDragStop:G}=l.getState(),E=a?q:iq(G);if(z(p.current,!1,!1),E){const[O,P]=rq({nodeId:a,dragItems:p.current,nodeInternals:Z});E(U.sourceEvent,O,P)}}}).filter(U=>{const z=U.target;return!U.button&&(!n||!yQ(z,`.${n}`,e))&&(!o||yQ(z,o,e))});return I.call(H),()=>{I.on(".drag",null)}}}},[e,t,n,o,i,l,a,s,A]),d}function Qce(){const e=Jn();return k.useCallback(n=>{const{nodeInternals:o,nodeExtent:a,updateNodePositions:i,getNodes:s,snapToGrid:l,snapGrid:d,onError:h,nodesDraggable:p}=e.getState(),m=s().filter(N=>N.selected&&(N.draggable||p&&typeof N.draggable>"u")),v=l?d[0]:5,x=l?d[1]:5,M=n.isShiftPressed?4:1,b=n.x*v*M,C=n.y*x*M,_=m.map(N=>{if(N.positionAbsolute){const A={x:N.positionAbsolute.x+b,y:N.positionAbsolute.y+C};l&&(A.x=d[0]*Math.round(A.x/d[0]),A.y=d[1]*Math.round(A.y/d[1]));const{positionAbsolute:I,position:R}=Wce(N,A,o,a,void 0,h);N.position=R,N.positionAbsolute=I}return N});i(_,!0,!1)},[])}const qh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var jf=e=>{const t=({id:n,type:o,data:a,xPos:i,yPos:s,xPosOrigin:l,yPosOrigin:d,selected:h,onClick:p,onMouseEnter:m,onMouseMove:v,onMouseLeave:x,onContextMenu:M,onDoubleClick:b,style:C,className:_,isDraggable:N,isSelectable:A,isConnectable:I,isFocusable:R,selectNodesOnDrag:j,sourcePosition:D,targetPosition:H,hidden:U,resizeObserver:z,dragHandle:Z,zIndex:q,isParent:G,noDragClassName:E,noPanClassName:O,initialized:P,disableKeyboardA11y:X,ariaLabel:W,rfId:V,hasHandleBounds:L})=>{const Y=Jn(),F=k.useRef(null),T=k.useRef(null),K=k.useRef(D),Q=k.useRef(H),ne=k.useRef(o),te=A||N||p||m||v||x,ce=Qce(),me=Lf(n,Y.getState,m),ke=Lf(n,Y.getState,v),Ee=Lf(n,Y.getState,x),Ie=Lf(n,Y.getState,M),Te=Lf(n,Y.getState,b),qe=We=>{const{nodeDragThreshold:Le}=Y.getState();if(A&&(!j||!N||Le>0)&&JH({id:n,store:Y,nodeRef:F}),p){const Rt=Y.getState().nodeInternals.get(n);Rt&&p(We,{...Rt})}},ct=We=>{if(!XH(We)&&!X)if(wce.includes(We.key)&&A){const Le=We.key==="Escape";JH({id:n,store:Y,unselect:Le,nodeRef:F})}else N&&h&&Object.prototype.hasOwnProperty.call(qh,We.key)&&(Y.setState({ariaLiveMessage:`Moved selected node ${We.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~s}`}),ce({x:qh[We.key].x,y:qh[We.key].y,isShiftPressed:We.shiftKey}))};k.useEffect(()=>()=>{T.current&&(z==null||z.unobserve(T.current),T.current=null)},[]),k.useEffect(()=>{if(F.current&&!U){const We=F.current;(!P||!L||T.current!==We)&&(T.current&&(z==null||z.unobserve(T.current)),z==null||z.observe(We),T.current=We)}},[U,P,L]),k.useEffect(()=>{const We=ne.current!==o,Le=K.current!==D,Rt=Q.current!==H;F.current&&(We||Le||Rt)&&(We&&(ne.current=o),Le&&(K.current=D),Rt&&(Q.current=H),Y.getState().updateNodeDimensions([{id:n,nodeElement:F.current,forceUpdate:!0}]))},[n,o,D,H]);const jt=Kce({nodeRef:F,disabled:U||!N,noDragClassName:E,handleSelector:Z,nodeId:n,isSelectable:A,selectNodesOnDrag:j});return U?null:le.createElement("div",{className:ko(["react-flow__node",`react-flow__node-${o}`,{[O]:N},_,{selected:h,selectable:A,parent:G,dragging:jt}]),ref:F,style:{zIndex:q,transform:`translate(${l}px,${d}px)`,pointerEvents:te?"all":"none",visibility:P?"visible":"hidden",...C},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:me,onMouseMove:ke,onMouseLeave:Ee,onContextMenu:Ie,onClick:qe,onDoubleClick:Te,onKeyDown:R?ct:void 0,tabIndex:R?0:void 0,role:R?"button":void 0,"aria-describedby":X?void 0:`${Hce}-${V}`,"aria-label":W},le.createElement(TIt,{value:n},le.createElement(e,{id:n,data:a,type:o,xPos:i,yPos:s,selected:h,isConnectable:I,sourcePosition:D,targetPosition:H,dragging:jt,dragHandle:Z,zIndex:q})))};return t.displayName="NodeWrapper",k.memo(t)};const kTt=e=>{const t=e.getNodes().filter(n=>n.selected);return{...CF(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function xTt({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=Jn(),{width:a,height:i,x:s,y:l,transformString:d,userSelectionActive:h}=un(kTt,Ro),p=Qce(),m=k.useRef(null);if(k.useEffect(()=>{var M;n||(M=m.current)==null||M.focus({preventScroll:!0})},[n]),Kce({nodeRef:m}),h||!a||!i)return null;const v=e?M=>{const b=o.getState().getNodes().filter(C=>C.selected);e(M,b)}:void 0,x=M=>{Object.prototype.hasOwnProperty.call(qh,M.key)&&p({x:qh[M.key].x,y:qh[M.key].y,isShiftPressed:M.shiftKey})};return le.createElement("div",{className:ko(["react-flow__nodesselection","react-flow__container",t]),style:{transform:d}},le.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:v,tabIndex:n?void 0:-1,onKeyDown:n?void 0:x,style:{width:a,height:i,top:l,left:s}}))}var wTt=k.memo(xTt);const bTt=e=>e.nodesSelectionActive,Jce=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:s,deleteKeyCode:l,onMove:d,onMoveStart:h,onMoveEnd:p,selectionKeyCode:m,selectionOnDrag:v,selectionMode:x,onSelectionStart:M,onSelectionEnd:b,multiSelectionKeyCode:C,panActivationKeyCode:_,zoomActivationKeyCode:N,elementsSelectable:A,zoomOnScroll:I,zoomOnPinch:R,panOnScroll:j,panOnScrollSpeed:D,panOnScrollMode:H,zoomOnDoubleClick:U,panOnDrag:z,defaultViewport:Z,translateExtent:q,minZoom:G,maxZoom:E,preventScrolling:O,onSelectionContextMenu:P,noWheelClassName:X,noPanClassName:W,disableKeyboardA11y:V})=>{const L=un(bTt),Y=op(m),F=op(_),T=F||z,K=F||j,Q=Y||v&&T!==!0;return sTt({deleteKeyCode:l,multiSelectionKeyCode:C}),le.createElement(dTt,{onMove:d,onMoveStart:h,onMoveEnd:p,onPaneContextMenu:i,elementsSelectable:A,zoomOnScroll:I,zoomOnPinch:R,panOnScroll:K,panOnScrollSpeed:D,panOnScrollMode:H,zoomOnDoubleClick:U,panOnDrag:!Y&&T,defaultViewport:Z,translateExtent:q,minZoom:G,maxZoom:E,zoomActivationKeyCode:N,preventScrolling:O,noWheelClassName:X,noPanClassName:W},le.createElement(Zce,{onSelectionStart:M,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:T,isSelecting:!!Q,selectionMode:x},e,L&&le.createElement(wTt,{onSelectionContextMenu:P,noPanClassName:W,disableKeyboardA11y:V})))};Jce.displayName="FlowRenderer";var MTt=k.memo(Jce);function _Tt(e){return un(k.useCallback(n=>e?Lce(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function STt(e){const t={input:jf(e.input||Dce),default:jf(e.default||QH),output:jf(e.output||Oce),group:jf(e.group||LF)},n={},o=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,i)=>(a[i]=jf(e[i]||QH),a),n);return{...t,...o}}const CTt=({x:e,y:t,width:n,height:o,origin:a})=>!n||!o?{x:e,y:t}:a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:e,y:t}:{x:e-n*a[0],y:t-o*a[1]},NTt=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),ele=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:a,updateNodeDimensions:i,onError:s}=un(NTt,Ro),l=_Tt(e.onlyRenderVisibleElements),d=k.useRef(),h=k.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const p=new ResizeObserver(m=>{const v=m.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));i(v)});return d.current=p,p},[]);return k.useEffect(()=>()=>{var p;(p=d==null?void 0:d.current)==null||p.disconnect()},[]),le.createElement("div",{className:"react-flow__nodes",style:jF},l.map(p=>{var R,j,D;let m=p.type||"default";e.nodeTypes[m]||(s==null||s("003",mi.error003(m)),m="default");const v=e.nodeTypes[m]||e.nodeTypes.default,x=!!(p.draggable||t&&typeof p.draggable>"u"),M=!!(p.selectable||a&&typeof p.selectable>"u"),b=!!(p.connectable||n&&typeof p.connectable>"u"),C=!!(p.focusable||o&&typeof p.focusable>"u"),_=e.nodeExtent?xF(p.positionAbsolute,e.nodeExtent):p.positionAbsolute,N=(_==null?void 0:_.x)??0,A=(_==null?void 0:_.y)??0,I=CTt({x:N,y:A,width:p.width??0,height:p.height??0,origin:e.nodeOrigin});return le.createElement(v,{key:p.id,id:p.id,className:p.className,style:p.style,type:m,data:p.data,sourcePosition:p.sourcePosition||Ye.Bottom,targetPosition:p.targetPosition||Ye.Top,hidden:p.hidden,xPos:N,yPos:A,xPosOrigin:I.x,yPosOrigin:I.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!p.selected,isDraggable:x,isSelectable:M,isConnectable:b,isFocusable:C,resizeObserver:h,dragHandle:p.dragHandle,zIndex:((R=p[vn])==null?void 0:R.z)??0,isParent:!!((j=p[vn])!=null&&j.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!p.width&&!!p.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:p.ariaLabel,hasHandleBounds:!!((D=p[vn])!=null&&D.handleBounds)})}))};ele.displayName="NodeRenderer";var LTt=k.memo(ele);const jTt=(e,t,n)=>n===Ye.Left?e-t:n===Ye.Right?e+t:e,ATt=(e,t,n)=>n===Ye.Top?e-t:n===Ye.Bottom?e+t:e,gQ="react-flow__edgeupdater",vQ=({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:a,onMouseEnter:i,onMouseOut:s,type:l})=>le.createElement("circle",{onMouseDown:a,onMouseEnter:i,onMouseOut:s,className:ko([gQ,`${gQ}-${l}`]),cx:jTt(t,o,e),cy:ATt(n,o,e),r:o,stroke:"transparent",fill:"transparent"}),ETt=()=>!0;var sh=e=>{const t=({id:n,className:o,type:a,data:i,onClick:s,onEdgeDoubleClick:l,selected:d,animated:h,label:p,labelStyle:m,labelShowBg:v,labelBgStyle:x,labelBgPadding:M,labelBgBorderRadius:b,style:C,source:_,target:N,sourceX:A,sourceY:I,targetX:R,targetY:j,sourcePosition:D,targetPosition:H,elementsSelectable:U,hidden:z,sourceHandleId:Z,targetHandleId:q,onContextMenu:G,onMouseEnter:E,onMouseMove:O,onMouseLeave:P,reconnectRadius:X,onReconnect:W,onReconnectStart:V,onReconnectEnd:L,markerEnd:Y,markerStart:F,rfId:T,ariaLabel:K,isFocusable:Q,isReconnectable:ne,pathOptions:te,interactionWidth:ce,disableKeyboardA11y:me})=>{const ke=k.useRef(null),[Ee,Ie]=k.useState(!1),[Te,qe]=k.useState(!1),ct=Jn(),jt=k.useMemo(()=>`url('#${YH(F,T)}')`,[F,T]),We=k.useMemo(()=>`url('#${YH(Y,T)}')`,[Y,T]);if(z)return null;const Le=ft=>{var Dt;const{edges:tn,addSelectedEdges:Kt,unselectNodesAndEdges:bn,multiSelectionActive:rn}=ct.getState(),At=tn.find(En=>En.id===n);At&&(U&&(ct.setState({nodesSelectionActive:!1}),At.selected&&rn?(bn({nodes:[],edges:[At]}),(Dt=ke.current)==null||Dt.blur()):Kt([n])),s&&s(ft,At))},Rt=Nf(n,ct.getState,l),eo=Nf(n,ct.getState,G),An=Nf(n,ct.getState,E),wn=Nf(n,ct.getState,O),On=Nf(n,ct.getState,P),so=(ft,tn)=>{if(ft.button!==0)return;const{edges:Kt,isValidConnection:bn}=ct.getState(),rn=tn?N:_,At=(tn?q:Z)||null,Dt=tn?"target":"source",En=bn||ETt,Qa=tn,Ja=Kt.find(ra=>ra.id===n);qe(!0),V==null||V(ft,Ja,Dt);const er=ra=>{qe(!1),L==null||L(ra,Ja,Dt)};Tce({event:ft,handleId:At,nodeId:rn,onConnect:ra=>W==null?void 0:W(Ja,ra),isTarget:Qa,getState:ct.getState,setState:ct.setState,isValidConnection:En,edgeUpdaterType:Dt,onReconnectEnd:er})},wo=ft=>so(ft,!0),fe=ft=>so(ft,!1),be=()=>Ie(!0),Oe=()=>Ie(!1),He=!U&&!s,kt=ft=>{var tn;if(!me&&wce.includes(ft.key)&&U){const{unselectNodesAndEdges:Kt,addSelectedEdges:bn,edges:rn}=ct.getState();ft.key==="Escape"?((tn=ke.current)==null||tn.blur(),Kt({edges:[rn.find(Dt=>Dt.id===n)]})):bn([n])}};return le.createElement("g",{className:ko(["react-flow__edge",`react-flow__edge-${a}`,o,{selected:d,animated:h,inactive:He,updating:Ee}]),onClick:Le,onDoubleClick:Rt,onContextMenu:eo,onMouseEnter:An,onMouseMove:wn,onMouseLeave:On,onKeyDown:Q?kt:void 0,tabIndex:Q?0:void 0,role:Q?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":K===null?void 0:K||`Edge from ${_} to ${N}`,"aria-describedby":Q?`${Vce}-${T}`:void 0,ref:ke},!Te&&le.createElement(e,{id:n,source:_,target:N,selected:d,animated:h,label:p,labelStyle:m,labelShowBg:v,labelBgStyle:x,labelBgPadding:M,labelBgBorderRadius:b,data:i,style:C,sourceX:A,sourceY:I,targetX:R,targetY:j,sourcePosition:D,targetPosition:H,sourceHandleId:Z,targetHandleId:q,markerStart:jt,markerEnd:We,pathOptions:te,interactionWidth:ce}),ne&&le.createElement(le.Fragment,null,(ne==="source"||ne===!0)&&le.createElement(vQ,{position:D,centerX:A,centerY:I,radius:X,onMouseDown:wo,onMouseEnter:be,onMouseOut:Oe,type:"source"}),(ne==="target"||ne===!0)&&le.createElement(vQ,{position:H,centerX:R,centerY:j,radius:X,onMouseDown:fe,onMouseEnter:be,onMouseOut:Oe,type:"target"})))};return t.displayName="EdgeWrapper",k.memo(t)};function ITt(e){const t={default:sh(e.default||gP),straight:sh(e.bezier||_F),step:sh(e.step||MF),smoothstep:sh(e.step||R$),simplebezier:sh(e.simplebezier||bF)},n={},o=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,i)=>(a[i]=sh(e[i]||gP),a),n);return{...t,...o}}function kQ(e,t,n=null){const o=((n==null?void 0:n.x)||0)+t.x,a=((n==null?void 0:n.y)||0)+t.y,i=(n==null?void 0:n.width)||t.width,s=(n==null?void 0:n.height)||t.height;switch(e){case Ye.Top:return{x:o+i/2,y:a};case Ye.Right:return{x:o+i,y:a+s/2};case Ye.Bottom:return{x:o+i/2,y:a+s};case Ye.Left:return{x:o,y:a+s/2}}}function xQ(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const TTt=(e,t,n,o,a,i)=>{const s=kQ(n,e,t),l=kQ(i,o,a);return{sourceX:s.x,sourceY:s.y,targetX:l.x,targetY:l.y}};function RTt({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:a,targetHeight:i,width:s,height:l,transform:d}){const h={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+a),y2:Math.max(e.y+o,t.y+i)};h.x===h.x2&&(h.x2+=1),h.y===h.y2&&(h.y2+=1);const p=wF({x:(0-d[0])/d[2],y:(0-d[1])/d[2],width:s/d[2],height:l/d[2]}),m=Math.max(0,Math.min(p.x2,h.x2)-Math.max(p.x,h.x)),v=Math.max(0,Math.min(p.y2,h.y2)-Math.max(p.y,h.y));return Math.ceil(m*v)>0}function wQ(e){var o,a,i,s,l;const t=((o=e==null?void 0:e[vn])==null?void 0:o.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)<"u"&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.y)<"u";return[{x:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.x)||0,y:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const PTt=[{level:0,isMaxLevel:!0,edges:[]}];function $Tt(e,t,n=!1){let o=-1;const a=e.reduce((s,l)=>{var p,m;const d=xa(l.zIndex);let h=d?l.zIndex:0;if(n){const v=t.get(l.target),x=t.get(l.source),M=l.selected||(v==null?void 0:v.selected)||(x==null?void 0:x.selected),b=Math.max(((p=x==null?void 0:x[vn])==null?void 0:p.z)||0,((m=v==null?void 0:v[vn])==null?void 0:m.z)||0,1e3);h=(d?l.zIndex:0)+(M?b:0)}return s[h]?s[h].push(l):s[h]=[l],o=h>o?h:o,s},{}),i=Object.entries(a).map(([s,l])=>{const d=+s;return{edges:l,level:d,isMaxLevel:d===o}});return i.length===0?PTt:i}function DTt(e,t,n){const o=un(k.useCallback(a=>e?a.edges.filter(i=>{const s=t.get(i.source),l=t.get(i.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&RTt({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:l.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:l.width,targetHeight:l.height,width:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return $Tt(o,t,n)}const zTt=({color:e="none",strokeWidth:t=1})=>le.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),OTt=({color:e="none",strokeWidth:t=1})=>le.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),bQ={[mP.Arrow]:zTt,[mP.ArrowClosed]:OTt};function qTt(e){const t=Jn();return k.useMemo(()=>{var a,i;return Object.prototype.hasOwnProperty.call(bQ,e)?bQ[e]:((i=(a=t.getState()).onError)==null||i.call(a,"009",mi.error009(e)),null)},[e])}const HTt=({id:e,type:t,color:n,width:o=12.5,height:a=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:l="auto-start-reverse"})=>{const d=qTt(t);return d?le.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0"},le.createElement(d,{color:n,strokeWidth:s})):null},VTt=({defaultColor:e,rfId:t})=>n=>{const o=[];return n.edges.reduce((a,i)=>([i.markerStart,i.markerEnd].forEach(s=>{if(s&&typeof s=="object"){const l=YH(s,t);o.includes(l)||(a.push({id:l,color:s.color||e,...s}),o.push(l))}}),a),[]).sort((a,i)=>a.id.localeCompare(i.id))},tle=({defaultColor:e,rfId:t})=>{const n=un(k.useCallback(VTt({defaultColor:e,rfId:t}),[e,t]),(o,a)=>!(o.length!==a.length||o.some((i,s)=>i.id!==a[s].id)));return le.createElement("defs",null,n.map(o=>le.createElement(HTt,{id:o.id,key:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient})))};tle.displayName="MarkerDefinitions";var BTt=k.memo(tle);const FTt=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),nle=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:o,edgeTypes:a,noPanClassName:i,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:d,onEdgeMouseLeave:h,onEdgeClick:p,onEdgeDoubleClick:m,onReconnect:v,onReconnectStart:x,onReconnectEnd:M,reconnectRadius:b,children:C,disableKeyboardA11y:_})=>{const{edgesFocusable:N,edgesUpdatable:A,elementsSelectable:I,width:R,height:j,connectionMode:D,nodeInternals:H,onError:U}=un(FTt,Ro),z=DTt(t,H,n);return R?le.createElement(le.Fragment,null,z.map(({level:Z,edges:q,isMaxLevel:G})=>le.createElement("svg",{key:Z,style:{zIndex:Z},width:R,height:j,className:"react-flow__edges react-flow__container"},G&&le.createElement(BTt,{defaultColor:e,rfId:o}),le.createElement("g",null,q.map(E=>{const[O,P,X]=wQ(H.get(E.source)),[W,V,L]=wQ(H.get(E.target));if(!X||!L)return null;let Y=E.type||"default";a[Y]||(U==null||U("011",mi.error011(Y)),Y="default");const F=a[Y]||a.default,T=D===l1.Strict?V.target:(V.target??[]).concat(V.source??[]),K=xQ(P.source,E.sourceHandle),Q=xQ(T,E.targetHandle),ne=(K==null?void 0:K.position)||Ye.Bottom,te=(Q==null?void 0:Q.position)||Ye.Top,ce=!!(E.focusable||N&&typeof E.focusable>"u"),me=E.reconnectable||E.updatable,ke=typeof v<"u"&&(me||A&&typeof me>"u");if(!K||!Q)return U==null||U("008",mi.error008(K,E)),null;const{sourceX:Ee,sourceY:Ie,targetX:Te,targetY:qe}=TTt(O,K,ne,W,Q,te);return le.createElement(F,{key:E.id,id:E.id,className:ko([E.className,i]),type:Y,data:E.data,selected:!!E.selected,animated:!!E.animated,hidden:!!E.hidden,label:E.label,labelStyle:E.labelStyle,labelShowBg:E.labelShowBg,labelBgStyle:E.labelBgStyle,labelBgPadding:E.labelBgPadding,labelBgBorderRadius:E.labelBgBorderRadius,style:E.style,source:E.source,target:E.target,sourceHandleId:E.sourceHandle,targetHandleId:E.targetHandle,markerEnd:E.markerEnd,markerStart:E.markerStart,sourceX:Ee,sourceY:Ie,targetX:Te,targetY:qe,sourcePosition:ne,targetPosition:te,elementsSelectable:I,onContextMenu:s,onMouseEnter:l,onMouseMove:d,onMouseLeave:h,onClick:p,onEdgeDoubleClick:m,onReconnect:v,onReconnectStart:x,onReconnectEnd:M,reconnectRadius:b,rfId:o,ariaLabel:E.ariaLabel,isFocusable:ce,isReconnectable:ke,pathOptions:"pathOptions"in E?E.pathOptions:void 0,interactionWidth:E.interactionWidth,disableKeyboardA11y:_})})))),C):null};nle.displayName="EdgeRenderer";var UTt=k.memo(nle);const GTt=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function XTt({children:e}){const t=un(GTt);return le.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function ZTt(e){const t=P$(),n=k.useRef(!1);k.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const YTt={[Ye.Left]:Ye.Right,[Ye.Right]:Ye.Left,[Ye.Top]:Ye.Bottom,[Ye.Bottom]:Ye.Top},ole=({nodeId:e,handleType:t,style:n,type:o=cs.Bezier,CustomComponent:a,connectionStatus:i})=>{var j,D,H;const{fromNode:s,handleId:l,toX:d,toY:h,connectionMode:p}=un(k.useCallback(U=>({fromNode:U.nodeInternals.get(e),handleId:U.connectionHandleId,toX:(U.connectionPosition.x-U.transform[0])/U.transform[2],toY:(U.connectionPosition.y-U.transform[1])/U.transform[2],connectionMode:U.connectionMode}),[e]),Ro),m=(j=s==null?void 0:s[vn])==null?void 0:j.handleBounds;let v=m==null?void 0:m[t];if(p===l1.Loose&&(v=v||(m==null?void 0:m[t==="source"?"target":"source"])),!s||!v)return null;const x=l?v.find(U=>U.id===l):v[0],M=x?x.x+x.width/2:(s.width??0)/2,b=x?x.y+x.height/2:s.height??0,C=(((D=s.positionAbsolute)==null?void 0:D.x)??0)+M,_=(((H=s.positionAbsolute)==null?void 0:H.y)??0)+b,N=x==null?void 0:x.position,A=N?YTt[N]:null;if(!N||!A)return null;if(a)return le.createElement(a,{connectionLineType:o,connectionLineStyle:n,fromNode:s,fromHandle:x,fromX:C,fromY:_,toX:d,toY:h,fromPosition:N,toPosition:A,connectionStatus:i});let I="";const R={sourceX:C,sourceY:_,sourcePosition:N,targetX:d,targetY:h,targetPosition:A};return o===cs.Bezier?[I]=Cce(R):o===cs.Step?[I]=ZH({...R,borderRadius:0}):o===cs.SmoothStep?[I]=ZH(R):o===cs.SimpleBezier?[I]=Sce(R):I=`M${C},${_} ${d},${h}`,le.createElement("path",{d:I,fill:"none",className:"react-flow__connection-path",style:n})};ole.displayName="ConnectionLine";const WTt=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function KTt({containerStyle:e,style:t,type:n,component:o}){const{nodeId:a,handleType:i,nodesConnectable:s,width:l,height:d,connectionStatus:h}=un(WTt,Ro);return!(a&&i&&l&&s)?null:le.createElement("svg",{style:e,width:l,height:d,className:"react-flow__edges react-flow__connectionline react-flow__container"},le.createElement("g",{className:ko(["react-flow__connection",h])},le.createElement(ole,{nodeId:a,handleType:i,style:t,type:n,CustomComponent:o,connectionStatus:h})))}function MQ(e,t){return k.useRef(null),Jn(),k.useMemo(()=>t(e),[e])}const ale=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:o,onMoveEnd:a,onInit:i,onNodeClick:s,onEdgeClick:l,onNodeDoubleClick:d,onEdgeDoubleClick:h,onNodeMouseEnter:p,onNodeMouseMove:m,onNodeMouseLeave:v,onNodeContextMenu:x,onSelectionContextMenu:M,onSelectionStart:b,onSelectionEnd:C,connectionLineType:_,connectionLineStyle:N,connectionLineComponent:A,connectionLineContainerStyle:I,selectionKeyCode:R,selectionOnDrag:j,selectionMode:D,multiSelectionKeyCode:H,panActivationKeyCode:U,zoomActivationKeyCode:z,deleteKeyCode:Z,onlyRenderVisibleElements:q,elementsSelectable:G,selectNodesOnDrag:E,defaultViewport:O,translateExtent:P,minZoom:X,maxZoom:W,preventScrolling:V,defaultMarkerColor:L,zoomOnScroll:Y,zoomOnPinch:F,panOnScroll:T,panOnScrollSpeed:K,panOnScrollMode:Q,zoomOnDoubleClick:ne,panOnDrag:te,onPaneClick:ce,onPaneMouseEnter:me,onPaneMouseMove:ke,onPaneMouseLeave:Ee,onPaneScroll:Ie,onPaneContextMenu:Te,onEdgeContextMenu:qe,onEdgeMouseEnter:ct,onEdgeMouseMove:jt,onEdgeMouseLeave:We,onReconnect:Le,onReconnectStart:Rt,onReconnectEnd:eo,reconnectRadius:An,noDragClassName:wn,noWheelClassName:On,noPanClassName:so,elevateEdgesOnSelect:wo,disableKeyboardA11y:fe,nodeOrigin:be,nodeExtent:Oe,rfId:He})=>{const kt=MQ(e,STt),ft=MQ(t,ITt);return ZTt(i),le.createElement(MTt,{onPaneClick:ce,onPaneMouseEnter:me,onPaneMouseMove:ke,onPaneMouseLeave:Ee,onPaneContextMenu:Te,onPaneScroll:Ie,deleteKeyCode:Z,selectionKeyCode:R,selectionOnDrag:j,selectionMode:D,onSelectionStart:b,onSelectionEnd:C,multiSelectionKeyCode:H,panActivationKeyCode:U,zoomActivationKeyCode:z,elementsSelectable:G,onMove:n,onMoveStart:o,onMoveEnd:a,zoomOnScroll:Y,zoomOnPinch:F,zoomOnDoubleClick:ne,panOnScroll:T,panOnScrollSpeed:K,panOnScrollMode:Q,panOnDrag:te,defaultViewport:O,translateExtent:P,minZoom:X,maxZoom:W,onSelectionContextMenu:M,preventScrolling:V,noDragClassName:wn,noWheelClassName:On,noPanClassName:so,disableKeyboardA11y:fe},le.createElement(XTt,null,le.createElement(UTt,{edgeTypes:ft,onEdgeClick:l,onEdgeDoubleClick:h,onlyRenderVisibleElements:q,onEdgeContextMenu:qe,onEdgeMouseEnter:ct,onEdgeMouseMove:jt,onEdgeMouseLeave:We,onReconnect:Le,onReconnectStart:Rt,onReconnectEnd:eo,reconnectRadius:An,defaultMarkerColor:L,noPanClassName:so,elevateEdgesOnSelect:!!wo,disableKeyboardA11y:fe,rfId:He},le.createElement(KTt,{style:N,type:_,component:A,containerStyle:I})),le.createElement("div",{className:"react-flow__edgelabel-renderer"}),le.createElement(LTt,{nodeTypes:kt,onNodeClick:s,onNodeDoubleClick:d,onNodeMouseEnter:p,onNodeMouseMove:m,onNodeMouseLeave:v,onNodeContextMenu:x,selectNodesOnDrag:E,onlyRenderVisibleElements:q,noPanClassName:so,noDragClassName:wn,disableKeyboardA11y:fe,nodeOrigin:be,nodeExtent:Oe,rfId:He})))};ale.displayName="GraphView";var QTt=k.memo(ale);const eV=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Fi={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:eV,nodeExtent:eV,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:l1.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:NIt,isValidConnection:void 0},JTt=()=>qLt((e,t)=>({...Fi,setNodes:n=>{const{nodeInternals:o,nodeOrigin:a,elevateNodesOnSelect:i}=t();e({nodeInternals:oq(n,o,a,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=t();e({edges:n.map(a=>({...o,...a}))})},setDefaultNodesAndEdges:(n,o)=>{const a=typeof n<"u",i=typeof o<"u",s=a?oq(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:s,edges:i?o:[],hasDefaultNodes:a,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:a,fitViewOnInit:i,fitViewOnInitDone:s,fitViewOnInitOptions:l,domNode:d,nodeOrigin:h}=t(),p=d==null?void 0:d.querySelector(".react-flow__viewport");if(!p)return;const m=window.getComputedStyle(p),{m22:v}=new window.DOMMatrixReadOnly(m.transform),x=n.reduce((b,C)=>{const _=a.get(C.id);if(_!=null&&_.hidden)a.set(_.id,{..._,[vn]:{..._[vn],handleBounds:void 0}});else if(_){const N=kF(C.nodeElement);!!(N.width&&N.height&&(_.width!==N.width||_.height!==N.height||C.forceUpdate))&&(a.set(_.id,{..._,[vn]:{..._[vn],handleBounds:{source:mQ(".source",C.nodeElement,v,h),target:mQ(".target",C.nodeElement,v,h)}},...N}),b.push({id:_.id,type:"dimensions",dimensions:N}))}return b},[]);Fce(a,h);const M=s||i&&!s&&Uce(t,{initial:!0,...l});e({nodeInternals:new Map(a),fitViewOnInitDone:M}),(x==null?void 0:x.length)>0&&(o==null||o(x))},updateNodePositions:(n,o=!0,a=!1)=>{const{triggerNodeChanges:i}=t(),s=n.map(l=>{const d={id:l.id,type:"position",dragging:a};return o&&(d.positionAbsolute=l.positionAbsolute,d.position=l.position),d});i(s)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:a,hasDefaultNodes:i,nodeOrigin:s,getNodes:l,elevateNodesOnSelect:d}=t();if(n!=null&&n.length){if(i){const h=Xce(n,l()),p=oq(h,a,s,d);e({nodeInternals:p})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:a,getNodes:i}=t();let s,l=null;o?s=n.map(d=>as(d,!0)):(s=wh(i(),n),l=wh(a,[])),xm({changedNodes:s,changedEdges:l,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:a,getNodes:i}=t();let s,l=null;o?s=n.map(d=>as(d,!0)):(s=wh(a,n),l=wh(i(),[])),xm({changedNodes:l,changedEdges:s,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:a,getNodes:i}=t(),s=n||i(),l=o||a,d=s.map(p=>(p.selected=!1,as(p.id,!1))),h=l.map(p=>as(p.id,!1));xm({changedNodes:d,changedEdges:h,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:o,maxZoom:a}=t();o==null||o.scaleExtent([n,a]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:o,minZoom:a}=t();o==null||o.scaleExtent([a,n]),e({maxZoom:n})},setTranslateExtent:n=>{var o;(o=t().d3Zoom)==null||o.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:o}=t(),i=o().filter(l=>l.selected).map(l=>as(l.id,!1)),s=n.filter(l=>l.selected).map(l=>as(l.id,!1));xm({changedNodes:i,changedEdges:s,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:o}=t();o.forEach(a=>{a.positionAbsolute=xF(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:a,height:i,d3Zoom:s,d3Selection:l,translateExtent:d}=t();if(!s||!l||!n.x&&!n.y)return!1;const h=Ms.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),p=[[0,0],[a,i]],m=s==null?void 0:s.constrain()(h,p,d);return s.transform(l,m),o[0]!==m.x||o[1]!==m.y||o[2]!==m.k},cancelConnection:()=>e({connectionNodeId:Fi.connectionNodeId,connectionHandleId:Fi.connectionHandleId,connectionHandleType:Fi.connectionHandleType,connectionStatus:Fi.connectionStatus,connectionStartHandle:Fi.connectionStartHandle,connectionEndHandle:Fi.connectionEndHandle}),reset:()=>e({...Fi})}),Object.is),$$=({children:e})=>{const t=k.useRef(null);return t.current||(t.current=JTt()),le.createElement(kIt,{value:t.current},e)};$$.displayName="ReactFlowProvider";const rle=({children:e})=>k.useContext(T$)?le.createElement(le.Fragment,null,e):le.createElement($$,null,e);rle.displayName="ReactFlowWrapper";const eRt={input:Dce,default:QH,output:Oce,group:LF},tRt={default:gP,straight:_F,step:MF,smoothstep:R$,simplebezier:bF},nRt=[0,0],oRt=[15,15],aRt={x:0,y:0,zoom:1},rRt={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},AF=k.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:a,nodeTypes:i=eRt,edgeTypes:s=tRt,onNodeClick:l,onEdgeClick:d,onInit:h,onMove:p,onMoveStart:m,onMoveEnd:v,onConnect:x,onConnectStart:M,onConnectEnd:b,onClickConnectStart:C,onClickConnectEnd:_,onNodeMouseEnter:N,onNodeMouseMove:A,onNodeMouseLeave:I,onNodeContextMenu:R,onNodeDoubleClick:j,onNodeDragStart:D,onNodeDrag:H,onNodeDragStop:U,onNodesDelete:z,onEdgesDelete:Z,onSelectionChange:q,onSelectionDragStart:G,onSelectionDrag:E,onSelectionDragStop:O,onSelectionContextMenu:P,onSelectionStart:X,onSelectionEnd:W,connectionMode:V=l1.Strict,connectionLineType:L=cs.Bezier,connectionLineStyle:Y,connectionLineComponent:F,connectionLineContainerStyle:T,deleteKeyCode:K="Backspace",selectionKeyCode:Q="Shift",selectionOnDrag:ne=!1,selectionMode:te=tp.Full,panActivationKeyCode:ce="Space",multiSelectionKeyCode:me=yP()?"Meta":"Control",zoomActivationKeyCode:ke=yP()?"Meta":"Control",snapToGrid:Ee=!1,snapGrid:Ie=oRt,onlyRenderVisibleElements:Te=!1,selectNodesOnDrag:qe=!0,nodesDraggable:ct,nodesConnectable:jt,nodesFocusable:We,nodeOrigin:Le=nRt,edgesFocusable:Rt,edgesUpdatable:eo,elementsSelectable:An,defaultViewport:wn=aRt,minZoom:On=.5,maxZoom:so=2,translateExtent:wo=eV,preventScrolling:fe=!0,nodeExtent:be,defaultMarkerColor:Oe="#b1b1b7",zoomOnScroll:He=!0,zoomOnPinch:kt=!0,panOnScroll:ft=!1,panOnScrollSpeed:tn=.5,panOnScrollMode:Kt=Od.Free,zoomOnDoubleClick:bn=!0,panOnDrag:rn=!0,onPaneClick:At,onPaneMouseEnter:Dt,onPaneMouseMove:En,onPaneMouseLeave:Qa,onPaneScroll:Ja,onPaneContextMenu:er,children:tr,onEdgeContextMenu:ra,onEdgeDoubleClick:Pr,onEdgeMouseEnter:$r,onEdgeMouseMove:qs,onEdgeMouseLeave:Hs,onEdgeUpdate:ee,onEdgeUpdateStart:re,onEdgeUpdateEnd:de,onReconnect:xe,onReconnectStart:Ce,onReconnectEnd:Pe,reconnectRadius:Ke=10,edgeUpdaterRadius:Re=10,onNodesChange:Fe,onEdgesChange:Ue,noDragClassName:Qe="nodrag",noWheelClassName:Ve="nowheel",noPanClassName:tt="nopan",fitView:Mt=!1,fitViewOptions:Vt,connectOnClick:Qt=!0,attributionPosition:St,proOptions:xt,defaultEdgeOptions:nr,elevateNodesOnSelect:to=!0,elevateEdgesOnSelect:bo=!1,disableKeyboardA11y:no=!1,autoPanOnConnect:or=!0,autoPanOnNodeDrag:ar=!0,connectionRadius:Vs=20,isValidConnection:Mo,onError:ja,style:dt,id:qn,nodeDragThreshold:Do,...zo},Dr)=>{const zt=qn||"1";return le.createElement("div",{...zo,style:{...dt,...rRt},ref:Dr,className:ko(["react-flow",a]),"data-testid":"rf__wrapper",id:qn},le.createElement(rle,null,le.createElement(QTt,{onInit:h,onMove:p,onMoveStart:m,onMoveEnd:v,onNodeClick:l,onEdgeClick:d,onNodeMouseEnter:N,onNodeMouseMove:A,onNodeMouseLeave:I,onNodeContextMenu:R,onNodeDoubleClick:j,nodeTypes:i,edgeTypes:s,connectionLineType:L,connectionLineStyle:Y,connectionLineComponent:F,connectionLineContainerStyle:T,selectionKeyCode:Q,selectionOnDrag:ne,selectionMode:te,deleteKeyCode:K,multiSelectionKeyCode:me,panActivationKeyCode:ce,zoomActivationKeyCode:ke,onlyRenderVisibleElements:Te,selectNodesOnDrag:qe,defaultViewport:wn,translateExtent:wo,minZoom:On,maxZoom:so,preventScrolling:fe,zoomOnScroll:He,zoomOnPinch:kt,zoomOnDoubleClick:bn,panOnScroll:ft,panOnScrollSpeed:tn,panOnScrollMode:Kt,panOnDrag:rn,onPaneClick:At,onPaneMouseEnter:Dt,onPaneMouseMove:En,onPaneMouseLeave:Qa,onPaneScroll:Ja,onPaneContextMenu:er,onSelectionContextMenu:P,onSelectionStart:X,onSelectionEnd:W,onEdgeContextMenu:ra,onEdgeDoubleClick:Pr,onEdgeMouseEnter:$r,onEdgeMouseMove:qs,onEdgeMouseLeave:Hs,onReconnect:xe??ee,onReconnectStart:Ce??re,onReconnectEnd:Pe??de,reconnectRadius:Ke??Re,defaultMarkerColor:Oe,noDragClassName:Qe,noWheelClassName:Ve,noPanClassName:tt,elevateEdgesOnSelect:bo,rfId:zt,disableKeyboardA11y:no,nodeOrigin:Le,nodeExtent:be}),le.createElement(YIt,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:x,onConnectStart:M,onConnectEnd:b,onClickConnectStart:C,onClickConnectEnd:_,nodesDraggable:ct,nodesConnectable:jt,nodesFocusable:We,edgesFocusable:Rt,edgesUpdatable:eo,elementsSelectable:An,elevateNodesOnSelect:to,minZoom:On,maxZoom:so,nodeExtent:be,onNodesChange:Fe,onEdgesChange:Ue,snapToGrid:Ee,snapGrid:Ie,connectionMode:V,translateExtent:wo,connectOnClick:Qt,defaultEdgeOptions:nr,fitView:Mt,fitViewOptions:Vt,onNodesDelete:z,onEdgesDelete:Z,onNodeDragStart:D,onNodeDrag:H,onNodeDragStop:U,onSelectionDrag:E,onSelectionDragStart:G,onSelectionDragStop:O,noPanClassName:tt,nodeOrigin:Le,rfId:zt,autoPanOnConnect:or,autoPanOnNodeDrag:ar,onError:ja,connectionRadius:Vs,isValidConnection:Mo,nodeDragThreshold:Do}),le.createElement(XIt,{onSelectionChange:q}),tr,le.createElement(wIt,{proOptions:xt,position:St}),le.createElement(eTt,{rfId:zt,disableKeyboardA11y:no})))});AF.displayName="ReactFlow";function iRt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,a]of e)if(!Object.is(a,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}function sRt(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},le.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function cRt(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},le.createElement("path",{d:"M0 0h32v4.2H0z"}))}function lRt(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},le.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function uRt(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},le.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function dRt(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},le.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const Bf=({children:e,className:t,...n})=>le.createElement("button",{type:"button",className:ko(["react-flow__controls-button",t]),...n},e);Bf.displayName="ControlButton";const hRt=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),ile=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:a,onZoomIn:i,onZoomOut:s,onFitView:l,onInteractiveChange:d,className:h,children:p,position:m="bottom-left"})=>{const v=Jn(),[x,M]=k.useState(!1),{isInteractive:b,minZoomReached:C,maxZoomReached:_}=un(hRt,iRt),{zoomIn:N,zoomOut:A,fitView:I}=P$();if(k.useEffect(()=>{M(!0)},[]),!x)return null;const R=()=>{N(),i==null||i()},j=()=>{A(),s==null||s()},D=()=>{I(a),l==null||l()},H=()=>{v.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),d==null||d(!b)};return le.createElement(vce,{className:ko(["react-flow__controls",h]),position:m,style:e,"data-testid":"rf__controls"},t&&le.createElement(le.Fragment,null,le.createElement(Bf,{onClick:R,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:_},le.createElement(sRt,null)),le.createElement(Bf,{onClick:j,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:C},le.createElement(cRt,null))),n&&le.createElement(Bf,{className:"react-flow__controls-fitview",onClick:D,title:"fit view","aria-label":"fit view"},le.createElement(lRt,null)),o&&le.createElement(Bf,{className:"react-flow__controls-interactive",onClick:H,title:"toggle interactivity","aria-label":"toggle interactivity"},b?le.createElement(dRt,null):le.createElement(uRt,null)),p)};ile.displayName="Controls";var sle=k.memo(ile);function fRt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,a]of e)if(!Object.is(a,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}var Ba;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ba||(Ba={}));function pRt({color:e,dimensions:t,lineWidth:n}){return le.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function yRt({color:e,radius:t}){return le.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const mRt={[Ba.Dots]:"#91919a",[Ba.Lines]:"#eee",[Ba.Cross]:"#e2e2e2"},gRt={[Ba.Dots]:1,[Ba.Lines]:1,[Ba.Cross]:6},vRt=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function cle({id:e,variant:t=Ba.Dots,gap:n=20,size:o,lineWidth:a=1,offset:i=2,color:s,style:l,className:d}){const h=k.useRef(null),{transform:p,patternId:m}=un(vRt,fRt),v=s||mRt[t],x=o||gRt[t],M=t===Ba.Dots,b=t===Ba.Cross,C=Array.isArray(n)?n:[n,n],_=[C[0]*p[2]||1,C[1]*p[2]||1],N=x*p[2],A=b?[N,N]:_,I=M?[N/i,N/i]:[A[0]/i,A[1]/i];return le.createElement("svg",{className:ko(["react-flow__background",d]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:h,"data-testid":"rf__background"},le.createElement("pattern",{id:m+e,x:p[0]%_[0],y:p[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${I[0]},-${I[1]})`},M?le.createElement(yRt,{color:v,radius:N/i}):le.createElement(pRt,{dimensions:A,color:v,lineWidth:a})),le.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}cle.displayName="Background";var lle=k.memo(cle);function bm(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}const Be=FJ(QJ((e,t)=>({nodes:[],edges:[],command:null,isLoading:!0,isSaving:!1,editorType:"command",availableNodes:{},permissions:[],chatTypes:[],isMenuOpen:!1,menuPosition:{top:0,left:0,flowPosition:{x:0,y:0}},connectingPin:null,variables:[],commandArguments:[],init:async(n,o,a)=>{e({isLoading:!0,editorType:a,variables:[],commandArguments:[]});try{const[i,s]=await Promise.all([t().fetchAvailableNodes(n,a),t().fetchPermissions(n)]);let l,d,h;if(o==="new")if(a==="command"){const C=await t().fetchManagementData(n);l={name:"Новая команда",description:"Описание новой команды",graphJson:JSON.stringify({nodes:[],edges:[],variables:[]}),argumentsJson:"[]",isEnabled:!0,cooldown:0,allowedChatTypes:'["chat", "private"]'},e({chatTypes:C.chatTypes})}else l={name:"Новый граф",graphJson:JSON.stringify({nodes:[],edges:[],variables:[]}),variables:"[]",triggers:"[]",isEnabled:!0};else if(a==="command"){const C=await t().fetchManagementData(n);l=C.commands.find(_=>_.id===parseInt(o)),e({chatTypes:C.chatTypes})}else l=await Ne(`/api/bots/${n}/event-graphs/${o}`);if(!l)throw new Error(a==="command"?"Команда не найдена.":"Граф события не найден.");let p;try{p=l.graphJson?JSON.parse(l.graphJson):null}catch(C){console.error("Ошибка парсинга graphJson:",C),p=null}p||(p={nodes:[],edges:[],variables:[]}),p.variables=p.variables||[];const m=l.argumentsJson&&JSON.parse(l.argumentsJson)||[],v=l.triggers&&(typeof l.triggers=="string"?JSON.parse(l.triggers):l.triggers)||[],x=p.variables;h={...l,variables:x,triggers:v,arguments:m},d=p,e({command:h,availableNodes:i,permissions:s,variables:x,commandArguments:m});const M=(d.connections||[]).map(C=>({id:C.id,source:C.sourceNodeId,target:C.targetNodeId,sourceHandle:C.sourcePinId,targetHandle:C.targetPinId}));let b=(d.nodes||[]).map(C=>a==="event"?{...C,deletable:!0}:C.type==="event:command"?{...C,deletable:!1}:{...C,deletable:!0});a==="command"&&b.every(C=>C.type!=="event:command")&&b.unshift({id:"start",type:"event:command",position:{x:100,y:100},deletable:!1}),e({nodes:b,edges:M,isLoading:!1})}catch(i){console.error("Ошибка инициализации редактора:",i),Gt({variant:"destructive",title:"Ошибка загрузки",description:i.message}),e({isLoading:!1})}},fetchCommand:async(n,o)=>{const a=await Ne(`/api/bots/${n}/management-data`),i=a.commands.find(s=>s.id===parseInt(o));if(!i)throw new Error("Команда не найдена");return e({chatTypes:a.chatTypes}),i},fetchAvailableNodes:async(n,o)=>await Ne(`/api/bots/${n}/visual-editor/nodes?graphType=${o}`),fetchPermissions:async n=>await Ne(`/api/bots/${n}/visual-editor/permissions`),fetchManagementData:async n=>await Ne(`/api/bots/${n}/management-data`),onNodesChange:n=>{e(o=>{const a=n.filter(i=>{if(i.type==="remove"){const s=o.nodes.find(l=>l.id===i.id);return(s==null?void 0:s.deletable)!==!1}return!0});o.nodes=Xce(a,o.nodes)})},onEdgesChange:n=>{e(o=>{o.edges=pTt(n,o.edges)})},onConnect:n=>{e(o=>{o.edges=WH(n,o.edges),o.connectingPin=null})},addNode:(n,o,a=!0)=>{const i={};(n==="string:concat"||n==="logic:operation"||n==="flow:sequence")&&(i.pinCount=2),(n==="data:array_literal"||n==="data:make_object")&&(i.pinCount=0);const s={id:`${n}-${bm()}`,type:n,position:o,data:i};return a&&e(l=>{l.nodes.push(s)}),s},duplicateNode:n=>{const o=t().nodes.find(i=>i.id===n);if(!o||o.type==="event:command")return;const a={...o,id:`${o.type}-${bm()}`,position:{x:o.position.x+30,y:o.position.y+30},data:{...o.data},selected:!0};e(i=>{i.nodes.forEach(s=>s.selected=!1),i.nodes.push(a)})},appendNode:n=>{e(o=>{o.nodes.push(n)})},updateCommand:n=>{e(o=>{o.command={...o.command,...n}})},addArgument:()=>{e(n=>{const o=JSON.parse(n.command.argumentsJson||"[]"),a={id:bm(),name:"newArg",type:"string",required:!0},i=[...o,a];n.command.argumentsJson=JSON.stringify(i),n.commandArguments=i})},updateArgument:(n,o)=>{e(a=>{const s=JSON.parse(a.command.argumentsJson||"[]").map(l=>l.id===n?{...l,...o}:l);a.command.argumentsJson=JSON.stringify(s),a.commandArguments=s})},removeArgument:n=>{e(o=>{const i=JSON.parse(o.command.argumentsJson||"[]").filter(s=>s.id!==n);o.command.argumentsJson=JSON.stringify(i),o.commandArguments=i})},addVariable:()=>{e(n=>{const o=n.command.variables||[],a={id:bm(),name:"newVar",type:"string",value:""},i=[...o,a];n.command.variables=i,n.variables=i})},updateVariable:(n,o)=>{e(a=>{const s=(a.command.variables||[]).map(l=>{if(l.id===n){const d={...l,...o};if(o.type&&o.type!==l.type)switch(o.type){case"string":d.value="";break;case"number":d.value="0";break;case"boolean":d.value="false";break;case"array":d.value="[]";break;default:d.value=""}return d}return l});a.command.variables=s,a.variables=s})},removeVariable:n=>{e(o=>{const i=(o.command.variables||[]).filter(s=>s.id!==n);o.command.variables=i,o.variables=i})},updateNodeData:(n,o)=>{e(a=>{const i=a.nodes.find(s=>s.id===n);i&&(i.data={...i.data,...o})})},openMenu:(n,o,a)=>e({isMenuOpen:!0,menuPosition:{top:n,left:o,flowPosition:a}}),closeMenu:()=>e({isMenuOpen:!1}),onConnectStart:(n,{handleType:o,nodeId:a,handleId:i})=>{const s=t().nodes.find(l=>l.id===a);e({connectingPin:{type:o,nodeId:a,pinId:i,nodeType:s==null?void 0:s.type}})},setConnectingPin:n=>e({connectingPin:n}),connectAndAddNode:async(n,o)=>{const{connectingPin:a,addNode:i,onConnect:s,command:l}=t();if(!a)return;const d=l.botId;try{const h=await Ne(`/api/bots/${d}/visual-editor/node-config?types[]=${a.nodeType}&types[]=${n}`),p=h.find(b=>b.type===a.nodeType),m=h.find(b=>b.type===n);if(!p||!m)throw new Error("Не удалось получить конфигурацию узлов.");const v=p.outputs.find(b=>b.id===a.pinId),x=m.inputs.find(b=>b.type===v.type||b.type==="Wildcard"||v.type==="Wildcard"),M=i(n,o,!1);if(v&&x){const b={source:a.nodeId,sourceHandle:a.pinId,target:M.id,targetHandle:x.id};e(C=>{C.nodes.push(M),C.edges=WH(b,C.edges)})}else e(b=>{b.nodes.push(M)})}catch(h){console.error("Ошибка при добавлении и подключении узла:",h),Gt({variant:"destructive",title:"Ошибка",description:"Ошибка добавления узла."})}finally{e({connectingPin:null})}},saveGraph:async()=>{e({isSaving:!0});try{const{command:n,nodes:o,edges:a,editorType:i,variables:s}=t(),{id:l,botId:d,name:h,description:p,isEnabled:m,permissionId:v,allowedChatTypes:x,cooldown:M,aliases:b,argumentsJson:C}=n,_={nodes:o.map(({id:I,type:R,position:j,data:D})=>({id:I,type:R,position:j,data:D})),connections:a.map(({id:I,source:R,target:j,sourceHandle:D,targetHandle:H})=>({id:I,sourceNodeId:R,targetNodeId:j,sourcePinId:D,targetPinId:H})),variables:s||[]},N={name:h,description:p,isEnabled:m,graphJson:JSON.stringify(_)};i==="event"?N.eventType=n.eventType:(N.aliases=b,N.cooldown=M,N.permissionId=v,N.allowedChatTypes=x,N.argumentsJson=C);const A=i==="command"?`/api/bots/${d}/commands/${l}`:`/api/bots/${d}/event-graphs/${l}`;await Ne(A,{method:"PUT",body:N}),Gt({title:"Успешно",description:"Граф сохранен."})}catch(n){console.error("Ошибка сохранения графа:",n),Gt({variant:"destructive",title:"Ошибка",description:`Ошибка сохранения графа: ${n.message}`})}finally{e({isSaving:!1})}},addDynamicPin:n=>{e(o=>{var d;const a=o.nodes.find(h=>h.id===n);if(!a)return;const i=((d=a.data)==null?void 0:d.pinCount)||0;let l={pinCount:i+1};a.type==="data:make_object"&&(l[`key_${i}`]=`key${i}`,l[`value_${i}`]=null),a.data={...a.data,...l}})},removeDynamicPin:(n,o)=>{e(a=>{const i=a.nodes.find(m=>m.id===n);if(!i)return;const s=parseInt(o.match(/_(\d+)$/)[1]),l={...i.data},d=l.pinCount||0;for(let m=s;m<d-1;m++)i.type==="data:make_object"?(l[`key_${m}`]=l[`key_${m+1}`],l[`value_${m}`]=l[`value_${m+1}`]):l[`pin_${m}`]=l[`pin_${m+1}`];d>0&&(i.type==="data:make_object"?(delete l[`key_${d-1}`],delete l[`value_${d-1}`]):delete l[`pin_${d-1}`]),l.pinCount=Math.max(0,d-1),i.data=l;const h=i.type==="data:make_object"?[`key_${s}`,`value_${s}`]:[`pin_${s}`],p=a.edges.filter(m=>m.target===n&&h.includes(m.targetHandle)).map(m=>m.id);a.edges=a.edges.filter(m=>!p.includes(m.id))})},updateMakeObjectKey:(n,o,a)=>{e(i=>{const s=i.nodes.find(l=>l.id===n);s&&s.type==="data:make_object"&&(s.data[`key_${o}`]=a)})},setInitialState:(n,o,a)=>{t().init(n,o,a)}}))),ule=()=>{const{availableNodes:e}=Be(),t=(n,o)=>{n.dataTransfer.setData("application/reactflow",o),n.dataTransfer.effectAllowed="move"};return u.jsxs("div",{className:"p-2 h-full overflow-y-auto",children:[u.jsx("h3",{className:"text-lg font-bold mb-2 text-center",children:"Добавить ноду"}),u.jsx(die,{type:"multiple",className:"w-full",defaultValue:Object.keys(e),children:Object.entries(e).map(([n,o])=>u.jsxs(jB,{value:n,children:[u.jsx(AB,{children:n}),u.jsx(EB,{children:u.jsx("div",{className:"space-y-2",children:o.map(a=>u.jsx("div",{onDragStart:i=>t(i,a.type),draggable:!0,className:"p-2 border rounded-md cursor-grab bg-slate-700 hover:bg-slate-600 transition-colors",children:a.label},a.type))})})]},n))})]})},kRt=()=>{const e=Be(i=>i.command),t=Be(i=>i.addVariable),n=Be(i=>i.updateVariable),o=Be(i=>i.removeVariable);Be(i=>i.editorType);const a=(e==null?void 0:e.variables)||[];return u.jsxs("div",{className:"space-y-2 p-2 border-t",children:[u.jsx("h4",{className:"font-bold",children:"Переменные"}),u.jsx("div",{className:"space-y-2",children:a.map(i=>u.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md",children:[u.jsx(Ze,{placeholder:"Имя",value:i.name,onChange:s=>n(i.id,{name:s.target.value}),className:"flex-grow"}),u.jsxs(Wn,{value:i.type,onValueChange:s=>n(i.id,{type:s}),children:[u.jsx(Fn,{className:"w-[120px]",children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"string",children:"String"}),u.jsx(et,{value:"number",children:"Number"}),u.jsx(et,{value:"boolean",children:"Boolean"}),u.jsx(et,{value:"array",children:"Array"})]})]}),u.jsx(Ze,{placeholder:"Значение по умолч.",value:i.value,onChange:s=>n(i.id,{value:s.target.value}),className:"flex-grow"}),u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>o(i.id),children:u.jsx(mo,{className:"h-4 w-4"})})]},i.id))}),u.jsx(pe,{variant:"outline",size:"sm",onClick:t,children:"Добавить переменную"})]})},dle=()=>{const e=Be(N=>N.command),t=Be(N=>N.updateCommand),n=Be(N=>N.addArgument),o=Be(N=>N.updateArgument),a=Be(N=>N.removeArgument),i=Be(N=>N.permissions),l=Be(N=>N.editorType)==="event",d=(N,A=[])=>{try{return N?Array.isArray(N)?N:JSON.parse(N):A}catch{return console.warn("Failed to parse JSON, using default value:",N),A}},h=l?[]:d(e==null?void 0:e.aliases),p=l?[]:d(e==null?void 0:e.allowedChatTypes,["chat","private"]),[m,v]=k.useState(h.join(", ")),[x,M]=k.useState(p.join(", "));if(k.useEffect(()=>{e&&(v(d(e.aliases).join(", ")),M(d(e.allowedChatTypes,["chat","private"]).join(", ")))},[e]),!e)return u.jsx("div",{className:"p-4",children:"Загрузка настроек..."});const b=l?[]:d(e.argumentsJson),C=()=>{const N=m.split(",").map(A=>A.trim()).filter(Boolean);t({aliases:JSON.stringify(N)})},_=()=>{const N=x.split(",").map(A=>A.trim()).filter(Boolean);t({allowedChatTypes:JSON.stringify(N)})};return u.jsxs("div",{className:"p-4 space-y-4",children:[u.jsx("h3",{className:"text-lg font-bold",children:l?"Настройки графа событий":"Настройки команды"}),u.jsxs("div",{children:[u.jsx(_e,{htmlFor:"command-name",children:l?"Имя графа":"Имя команды"}),u.jsx(Ze,{id:"command-name",value:e.name||"",onChange:N=>t({name:N.target.value})})]}),u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ci,{id:"is-enabled",checked:e.isEnabled,onCheckedChange:N=>t({isEnabled:N})}),u.jsx(_e,{htmlFor:"is-enabled",children:"Включено"})]}),!l&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{children:[u.jsx(_e,{htmlFor:"command-description",children:"Описание"}),u.jsx(ki,{id:"command-description",value:e.description||"",onChange:N=>t({description:N.target.value})})]}),u.jsxs("div",{children:[u.jsx(_e,{htmlFor:"command-aliases",children:"Алиасы (через запятую)"}),u.jsx(Ze,{id:"command-aliases",value:m,onChange:N=>v(N.target.value),onBlur:C})]}),u.jsxs("div",{children:[u.jsx(_e,{htmlFor:"command-permission",children:"Права доступа"}),u.jsxs(Wn,{value:e.permissionId?e.permissionId.toString():"none",onValueChange:N=>t({permissionId:N==="none"?null:parseInt(N)}),children:[u.jsx(Fn,{id:"command-permission",children:u.jsx(Kn,{placeholder:"Выберите право..."})}),u.jsxs(Un,{children:[u.jsx(et,{value:"none",children:"Нет"}),i.map(N=>u.jsx(et,{value:N.id.toString(),children:N.name},N.id))]})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{children:"Типы чатов (через запятую)"}),u.jsx(Ze,{id:"command-chat-types",value:x,onChange:N=>M(N.target.value),onBlur:_})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("h4",{className:"font-bold",children:"Аргументы команды"}),u.jsx("div",{className:"space-y-2",children:b.map((N,A)=>u.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md",children:[u.jsx(Ze,{placeholder:"Имя",value:N.name,onChange:I=>o(N.id,{name:I.target.value}),className:"flex-grow"}),u.jsxs(Wn,{value:N.type,onValueChange:I=>o(N.id,{type:I}),children:[u.jsx(Fn,{className:"w-[120px]",children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"string",children:"String"}),u.jsx(et,{value:"number",children:"Number"}),u.jsx(et,{value:"boolean",children:"Boolean"})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(ci,{id:`required-${N.id}`,checked:N.required,onCheckedChange:I=>o(N.id,{required:I})}),u.jsx(_e,{htmlFor:`required-${N.id}`,children:"Обяз."})]}),u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>a(N.id),children:u.jsx(mo,{className:"h-4 w-4"})})]},N.id||A))}),u.jsx(pe,{variant:"outline",size:"sm",onClick:n,children:"Добавить аргумент"})]})]}),u.jsx(kRt,{})]})},tV=le.forwardRef(({className:e,value:t,onChange:n,...o},a)=>{const[i,s]=k.useState(0),l=k.useRef(null);return k.useLayoutEffect(()=>{l.current&&s(l.current.offsetWidth)},[t]),u.jsxs("div",{className:"relative inline-block",children:[u.jsx("input",{ref:a,type:"text",value:t,onChange:n,className:ge("h-8 transition-all duration-200 ease-in-out",e),style:{width:i+16},...o}),u.jsx("span",{ref:l,className:"absolute invisible whitespace-pre text-sm px-3 py-1",children:t})]})});tV.displayName="AutosizeInput";const xRt={Exec:"#ffffff",Boolean:"#dc2626",String:"#db2777",Number:"#2563eb",User:"#f59e0b",Array:"#3b82f6",Wildcard:"#6b7280",Object:"#9333ea"};function wRt({data:e,type:t,id:n}){const o=Be(v=>v.availableNodes),a=Be(v=>v.updateNodeData),i=Be(v=>v.edges),s=Be(v=>v.variables),l=Be(v=>v.commandArguments);Be(v=>v.editorType);const d=k.useMemo(()=>Object.values(o).flat().find(v=>v.type===t),[o,t]),h=k.useMemo(()=>{var x;let v=(x=d==null?void 0:d.pins)!=null&&x.inputs?[...d.pins.inputs]:[];if(t==="data:array_literal")for(let M=0;M<(e.pinCount||0);M++)v.push({id:`item_${M}`,name:`[${M}]`,type:"Wildcard"});else if(t==="data:make_object")for(let M=0;M<(e.pinCount||0);M++)v.push({id:`key_${M}`,name:`Ключ ${M}`,type:"String"}),v.push({id:`value_${M}`,name:`Значение ${M}`,type:"Wildcard"});else if(t==="object:create"&&!e.advanced)for(let M=0;M<(e.pinCount||0);M++)v.push({id:`key_${M}`,name:`Ключ ${M}`,type:"String"}),v.push({id:`value_${M}`,name:`Значение ${M}`,type:"Wildcard"});else if(t==="string:concat"){v=[];const M=e.pinCount||2;for(let b=0;b<M;b++)v.push({id:`pin_${b}`,name:`Строка ${b}`,type:"String"})}else if(t==="logic:operation"&&e.operation!=="NOT"){v=[];const M=e.pinCount||2;for(let b=0;b<M;b++)v.push({id:`pin_${b}`,name:String.fromCharCode(65+b),type:"Boolean"})}else if(t==="logic:operation"&&e.operation==="NOT")v=v.filter(M=>M.id==="a");else if(t==="flow:branch"&&e.advanced){const M=v.findIndex(b=>b.id==="condition");M!==-1&&v.splice(M,1);for(let b=0;b<(e.pinCount||0);b++)v.push({id:`pin_${b}`,name:String.fromCharCode(65+b),type:"Boolean"})}else if(t==="flow:branch"&&!e.advanced)return v.find(M=>M.id==="condition")||v.push({id:"condition",name:"Condition",type:"Boolean",required:!0}),v.filter(M=>M.id==="condition"||M.type==="Exec");return v},[d,e,t]),p=k.useMemo(()=>{var v;if(t==="flow:sequence"){const x=e.pinCount||2,M=[];for(let b=0;b<x;b++)M.push({id:`exec_${b}`,name:`${b}`,type:"Exec"});return M}return((v=d==null?void 0:d.pins)==null?void 0:v.outputs)||[]},[d,e,t]);if(!d)return u.jsxs("div",{children:["Неизвестный тип ноды: ",t]});const m=(v,x)=>{const M=x?Ye.Left:Ye.Right,b={background:xRt[v.type]||"#333"};return u.jsxs("div",{className:"relative p-2 flex items-center",children:[u.jsx(np,{type:x?"target":"source",position:M,id:v.id,style:{...b,width:"16px",height:"16px"},className:"w-4 h-4"}),u.jsx("span",{className:x?"pl-4":"pr-4",children:v.name})]},v.id)};return u.jsxs(Nn,{className:"min-w-64 bg-slate-800 border-slate-600 text-white",children:[u.jsxs(kn,{className:"bg-slate-700 p-2 rounded-t-lg",children:[u.jsx(xn,{className:"text-sm text-center",children:d.name||d.label}),d.description&&u.jsx("p",{className:"text-xs text-slate-300 text-center mt-1 leading-tight",children:d.description})]}),u.jsxs(Ln,{className:"p-2 flex flex-col",children:[t==="data:cast"&&u.jsxs("div",{className:"p-2 border-t border-slate-700",children:[u.jsx(_e,{children:"Целевой тип:"}),u.jsxs(Wn,{value:e.targetType||"String",onValueChange:v=>a(n,{targetType:v}),children:[u.jsx(Fn,{children:u.jsx(Kn,{placeholder:"Выберите тип..."})}),u.jsxs(Un,{children:[u.jsx(et,{value:"String",children:"String (Текст)"}),u.jsx(et,{value:"Number",children:"Number (Число)"}),u.jsx(et,{value:"Boolean",children:"Boolean (Да/Нет)"})]})]})]}),t==="data:get_argument"&&u.jsxs("div",{className:"p-2",children:[u.jsx(_e,{children:"Имя аргумента:"}),u.jsxs(Wn,{value:e.argumentName||"",onValueChange:v=>a(n,{argumentName:v}),children:[u.jsx(Fn,{children:u.jsx(Kn,{placeholder:"Выберите аргумент..."})}),u.jsx(Un,{children:(l||[]).map(v=>u.jsxs(et,{value:v.name,children:[v.name," (",v.type,")"]},v.id))})]})]}),t==="data:get_variable"&&u.jsxs("div",{className:"p-2",children:[u.jsx(_e,{children:"Имя переменной:"}),u.jsxs(Wn,{value:e.variableName||"",onValueChange:v=>a(n,{variableName:v}),children:[u.jsx(Fn,{children:u.jsx(Kn,{placeholder:"Выберите переменную..."})}),u.jsx(Un,{children:s.filter(v=>v.name).map(v=>u.jsxs(et,{value:v.name,children:[v.name," (",v.type,")"]},v.id))})]})]}),!1,u.jsxs("div",{className:"flex justify-between w-full",children:[u.jsxs("div",{className:"inputs flex flex-col items-start",children:[h.map(v=>{const x=i.some(M=>M.target===n&&M.targetHandle===v.id);return v.type==="Exec"?m(v,!0):u.jsxs("div",{className:"relative p-2 flex items-center w-full",children:[m(v,!0),!x&&v.type!=="Boolean"&&v.id!=="persist"&&u.jsx(tV,{className:"nodrag bg-slate-900 border-slate-500 rounded-md py-1 px-2 text-sm resize-none overflow-hidden",value:e[v.id]||"",onChange:M=>a(n,{[v.id]:M.target.value})}),!x&&v.type==="Boolean"&&u.jsxs(Wn,{value:String(e[v.id]===void 0?!1:e[v.id]),onValueChange:M=>a(n,{[v.id]:M==="true"}),children:[u.jsx(Fn,{className:"w-[100px] bg-slate-900 border-slate-500",children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"true",children:"True"}),u.jsx(et,{value:"false",children:"False"})]})]})]},v.id)}),t==="data:string_literal"&&u.jsx("div",{className:"p-2 w-full",children:u.jsx(tV,{className:"nodrag bg-slate-900 border-slate-500 rounded-md py-1 px-2 text-sm resize-none overflow-hidden w-full",value:e.value||"",onChange:v=>a(n,{value:v.target.value})})})]}),u.jsx("div",{className:"outputs flex flex-col items-end",children:p.map(v=>m(v,!1))})]}),t==="object:create"&&u.jsxs("div",{className:"p-2 border-t border-slate-700",children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsx(_e,{children:"Режим:"}),u.jsxs(Wn,{value:e.advanced?"advanced":"simple",onValueChange:v=>a(n,{advanced:v==="advanced"}),children:[u.jsx(Fn,{className:"w-[120px]",children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"simple",children:"Простой"}),u.jsx(et,{value:"advanced",children:"Продвинутый"})]})]})]}),e.advanced?u.jsxs("div",{children:[u.jsx(_e,{children:"JSON объект:"}),u.jsx("textarea",{className:"nodrag w-full h-32 bg-slate-900 border-slate-500 rounded-md p-2 text-sm font-mono resize-none",value:e.jsonValue||"{}",onChange:v=>a(n,{jsonValue:v.target.value}),placeholder:'{"key": "value", "nested": {"inner": 123}}'})]}):u.jsxs("div",{className:"flex items-center justify-center gap-2",children:[u.jsx(pe,{onClick:()=>a(n,{pinCount:(e.pinCount||0)+1}),className:"h-8 rounded-md px-3 text-xs",children:"Добавить"}),(e.pinCount||0)>0&&u.jsx(pe,{onClick:()=>a(n,{pinCount:(e.pinCount||0)-1}),variant:"destructive",className:"h-8 rounded-md px-3 text-xs",children:"Удалить"})]})]}),(t==="data:array_literal"||t==="data:make_object"||t==="string:concat")&&u.jsxs("div",{className:"p-2 border-t border-slate-700 flex items-center justify-center gap-2",children:[u.jsx(pe,{onClick:()=>{const v=e.pinCount||(t==="string:concat"?2:0);a(n,{pinCount:v+1})},className:"h-8 rounded-md px-3 text-xs",children:"Добавить"}),e.pinCount>(t==="string:concat"?2:0)&&u.jsx(pe,{onClick:()=>a(n,{pinCount:(e.pinCount||0)-1}),variant:"destructive",className:"h-8 rounded-md px-3 text-xs",children:"Удалить"})]}),t==="flow:sequence"&&u.jsxs("div",{className:"p-2 border-t border-slate-700 flex items-center justify-center gap-2",children:[u.jsx(pe,{onClick:()=>{const v=e.pinCount||2;a(n,{pinCount:v+1})},className:"h-8 rounded-md px-3 text-xs",children:"Добавить"}),u.jsx(pe,{onClick:()=>{const v=e.pinCount||2;v>1&&a(n,{pinCount:v-1})},variant:"destructive",className:"h-8 rounded-md px-3 text-xs",children:"Удалить"})]})]}),t==="flow:branch"&&u.jsxs("div",{className:"p-2 border-t border-slate-700 flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(_e,{children:"Режим:"}),u.jsxs(Wn,{value:e.advanced?"advanced":"simple",onValueChange:v=>a(n,{advanced:v==="advanced"}),children:[u.jsx(Fn,{className:"w-[120px]",children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"simple",children:"Простой"}),u.jsx(et,{value:"advanced",children:"Расширенный"})]})]})]}),e.advanced&&u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(_e,{children:"Оператор:"}),u.jsxs(Wn,{value:e.operator||"AND",onValueChange:v=>a(n,{operator:v,pinCount:v==="NOT"?1:e.pinCount||2}),children:[u.jsx(Fn,{className:"w-[100px]",children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"AND",children:"AND"}),u.jsx(et,{value:"OR",children:"OR"}),u.jsx(et,{value:"NOT",children:"NOT"})]})]}),e.operator!=="NOT"&&u.jsx(pe,{size:"sm",variant:"ghost",onClick:()=>a(n,{pinCount:(e.pinCount||2)+1}),children:"Добавить пин"})]})]}),t==="math:operation"&&u.jsxs("div",{className:"p-2 border-t border-slate-700",children:[u.jsx(_e,{children:"Операция:"}),u.jsxs(Wn,{value:e.operation||"+",onValueChange:v=>a(n,{operation:v}),children:[u.jsx(Fn,{children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"+",children:"Сложение (+)"}),u.jsx(et,{value:"-",children:"Вычитание (-)"}),u.jsx(et,{value:"*",children:"Умножение (*)"}),u.jsx(et,{value:"/",children:"Деление (/)"}),u.jsx(et,{value:">",children:"Больше (>)"}),u.jsx(et,{value:"<",children:"Меньше (<)"}),u.jsx(et,{value:"==",children:"Равно (==)"}),u.jsx(et,{value:">=",children:"Больше или равно (>=)"}),u.jsx(et,{value:"<=",children:"Меньше или равно (<=)"}),u.jsx(et,{value:"!=",children:"Не равно (!=)"})]})]})]}),t==="logic:operation"&&u.jsxs("div",{className:"p-2 border-t border-slate-700",children:[u.jsx(_e,{children:"Операция:"}),u.jsxs(Wn,{value:e.operation||"AND",onValueChange:v=>{const x=v==="NOT"?1:e.pinCount||2;a(n,{operation:v,pinCount:x})},children:[u.jsx(Fn,{children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"AND",children:"И (AND)"}),u.jsx(et,{value:"OR",children:"ИЛИ (OR)"}),u.jsx(et,{value:"NOT",children:"НЕ (NOT)"})]})]}),e.operation!=="NOT"&&u.jsxs("div",{className:"flex items-center justify-center gap-2 mt-2",children:[u.jsx(pe,{size:"sm",variant:"ghost",onClick:()=>a(n,{pinCount:(e.pinCount||2)+1}),children:"Добавить"}),(e.pinCount||0)>2&&u.jsx(pe,{size:"sm",variant:"destructive",onClick:()=>a(n,{pinCount:Math.max(2,(e.pinCount||2)-1)}),children:"Удалить"})]})]}),t==="logic:compare"&&u.jsxs("div",{className:"p-2 border-t border-slate-700",children:[u.jsx(_e,{children:"Операция:"}),u.jsxs(Wn,{value:e.operation||"==",onValueChange:v=>a(n,{operation:v}),children:[u.jsx(Fn,{children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"==",children:"Равно (==)"}),u.jsx(et,{value:"!=",children:"Не равно (!=)"}),u.jsx(et,{value:">",children:"Больше (>)"}),u.jsx(et,{value:"<",children:"Меньше (<)"}),u.jsx(et,{value:">=",children:"Больше или равно (>=)"}),u.jsx(et,{value:"<=",children:"Меньше или равно (<=)"})]})]})]})]})}const nV=le.memo(wRt),D$=k.createContext(null);D$.displayName="PanelGroupContext";const mn={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},EF=10,e1=k.useLayoutEffect,_Q=yV.useId,bRt=typeof _Q=="function"?_Q:()=>null;let MRt=0;function IF(e=null){const t=bRt(),n=k.useRef(e||t||null);return n.current===null&&(n.current=""+MRt++),e??n.current}function hle({children:e,className:t="",collapsedSize:n,collapsible:o,defaultSize:a,forwardedRef:i,id:s,maxSize:l,minSize:d,onCollapse:h,onExpand:p,onResize:m,order:v,style:x,tagName:M="div",...b}){const C=k.useContext(D$);if(C===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:_,expandPanel:N,getPanelSize:A,getPanelStyle:I,groupId:R,isPanelCollapsed:j,reevaluatePanelConstraints:D,registerPanel:H,resizePanel:U,unregisterPanel:z}=C,Z=IF(s),q=k.useRef({callbacks:{onCollapse:h,onExpand:p,onResize:m},constraints:{collapsedSize:n,collapsible:o,defaultSize:a,maxSize:l,minSize:d},id:Z,idIsFromProps:s!==void 0,order:v});k.useRef({didLogMissingDefaultSizeWarning:!1}),e1(()=>{const{callbacks:E,constraints:O}=q.current,P={...O};q.current.id=Z,q.current.idIsFromProps=s!==void 0,q.current.order=v,E.onCollapse=h,E.onExpand=p,E.onResize=m,O.collapsedSize=n,O.collapsible=o,O.defaultSize=a,O.maxSize=l,O.minSize=d,(P.collapsedSize!==O.collapsedSize||P.collapsible!==O.collapsible||P.maxSize!==O.maxSize||P.minSize!==O.minSize)&&D(q.current,P)}),e1(()=>{const E=q.current;return H(E),()=>{z(E)}},[v,Z,H,z]),k.useImperativeHandle(i,()=>({collapse:()=>{_(q.current)},expand:E=>{N(q.current,E)},getId(){return Z},getSize(){return A(q.current)},isCollapsed(){return j(q.current)},isExpanded(){return!j(q.current)},resize:E=>{U(q.current,E)}}),[_,N,A,j,Z,U]);const G=I(q.current,a);return k.createElement(M,{...b,children:e,className:t,id:Z,style:{...G,...x},[mn.groupId]:R,[mn.panel]:"",[mn.panelCollapsible]:o||void 0,[mn.panelId]:Z,[mn.panelSize]:parseFloat(""+G.flexGrow).toFixed(1)})}const fle=k.forwardRef((e,t)=>k.createElement(hle,{...e,forwardedRef:t}));hle.displayName="Panel";fle.displayName="forwardRef(Panel)";let oV=null,PR=-1,ls=null;function _Rt(e,t){if(t){const n=(t&vle)!==0,o=(t&kle)!==0,a=(t&xle)!==0,i=(t&wle)!==0;if(n)return a?"se-resize":i?"ne-resize":"e-resize";if(o)return a?"sw-resize":i?"nw-resize":"w-resize";if(a)return"s-resize";if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function SRt(){ls!==null&&(document.head.removeChild(ls),oV=null,ls=null,PR=-1)}function sq(e,t){var n,o;const a=_Rt(e,t);if(oV!==a){if(oV=a,ls===null&&(ls=document.createElement("style"),document.head.appendChild(ls)),PR>=0){var i;(i=ls.sheet)===null||i===void 0||i.removeRule(PR)}PR=(n=(o=ls.sheet)===null||o===void 0?void 0:o.insertRule(`*{cursor: ${a} !important;}`))!==null&&n!==void 0?n:-1}}function ple(e){return e.type==="keydown"}function yle(e){return e.type.startsWith("pointer")}function mle(e){return e.type.startsWith("mouse")}function z$(e){if(yle(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(mle(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function CRt(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function NRt(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function LRt(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:NQ(e),b:NQ(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),o=e;ht(o,"Stacking order can only be calculated for elements with a common ancestor");const a={a:CQ(SQ(n.a)),b:CQ(SQ(n.b))};if(a.a===a.b){const i=o.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let l=i.length;for(;l--;){const d=i[l];if(d===s.a)return 1;if(d===s.b)return-1}}return Math.sign(a.a-a.b)}const jRt=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ARt(e){var t;const n=getComputedStyle((t=gle(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function ERt(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||ARt(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||jRt.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function SQ(e){let t=e.length;for(;t--;){const n=e[t];if(ht(n,"Missing node"),ERt(n))return n}return null}function CQ(e){return e&&Number(getComputedStyle(e).zIndex)||0}function NQ(e){const t=[];for(;e;)t.push(e),e=gle(e);return t}function gle(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const vle=1,kle=2,xle=4,wle=8,IRt=CRt()==="coarse";let Fa=[],Hh=!1,us=new Map,O$=new Map;const ap=new Set;function TRt(e,t,n,o,a){var i;const{ownerDocument:s}=t,l={direction:n,element:t,hitAreaMargins:o,setResizeHandlerState:a},d=(i=us.get(s))!==null&&i!==void 0?i:0;return us.set(s,d+1),ap.add(l),vP(),function(){var p;O$.delete(e),ap.delete(l);const m=(p=us.get(s))!==null&&p!==void 0?p:1;if(us.set(s,m-1),vP(),m===1&&us.delete(s),Fa.includes(l)){const v=Fa.indexOf(l);v>=0&&Fa.splice(v,1),RF(),a("up",!0,null)}}}function RRt(e){const{target:t}=e,{x:n,y:o}=z$(e);Hh=!0,TF({target:t,x:n,y:o}),vP(),Fa.length>0&&(kP("down",e),e.preventDefault(),ble(t)||e.stopImmediatePropagation())}function cq(e){const{x:t,y:n}=z$(e);if(Hh&&e.buttons===0&&(Hh=!1,kP("up",e)),!Hh){const{target:o}=e;TF({target:o,x:t,y:n})}kP("move",e),RF(),Fa.length>0&&e.preventDefault()}function lq(e){const{target:t}=e,{x:n,y:o}=z$(e);O$.clear(),Hh=!1,Fa.length>0&&(e.preventDefault(),ble(t)||e.stopImmediatePropagation()),kP("up",e),TF({target:t,x:n,y:o}),RF(),vP()}function ble(e){let t=e;for(;t;){if(t.hasAttribute(mn.resizeHandle))return!0;t=t.parentElement}return!1}function TF({target:e,x:t,y:n}){Fa.splice(0);let o=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(o=e),ap.forEach(a=>{const{element:i,hitAreaMargins:s}=a,l=i.getBoundingClientRect(),{bottom:d,left:h,right:p,top:m}=l,v=IRt?s.coarse:s.fine;if(t>=h-v&&t<=p+v&&n>=m-v&&n<=d+v){if(o!==null&&document.contains(o)&&i!==o&&!i.contains(o)&&!o.contains(i)&&LRt(o,i)>0){let M=o,b=!1;for(;M&&!M.contains(i);){if(NRt(M.getBoundingClientRect(),l)){b=!0;break}M=M.parentElement}if(b)return}Fa.push(a)}})}function uq(e,t){O$.set(e,t)}function RF(){let e=!1,t=!1;Fa.forEach(o=>{const{direction:a}=o;a==="horizontal"?e=!0:t=!0});let n=0;O$.forEach(o=>{n|=o}),e&&t?sq("intersection",n):e?sq("horizontal",n):t?sq("vertical",n):SRt()}let dq;function vP(){var e;(e=dq)===null||e===void 0||e.abort(),dq=new AbortController;const t={capture:!0,signal:dq.signal};ap.size&&(Hh?(Fa.length>0&&us.forEach((n,o)=>{const{body:a}=o;n>0&&(a.addEventListener("contextmenu",lq,t),a.addEventListener("pointerleave",cq,t),a.addEventListener("pointermove",cq,t))}),us.forEach((n,o)=>{const{body:a}=o;a.addEventListener("pointerup",lq,t),a.addEventListener("pointercancel",lq,t)})):us.forEach((n,o)=>{const{body:a}=o;n>0&&(a.addEventListener("pointerdown",RRt,t),a.addEventListener("pointermove",cq,t))}))}function kP(e,t){ap.forEach(n=>{const{setResizeHandlerState:o}=n,a=Fa.includes(n);o(e,a,t)})}function PRt(){const[e,t]=k.useState(0);return k.useCallback(()=>t(n=>n+1),[])}function ht(e,t){if(!e)throw console.error(t),Error(t)}function u1(e,t,n=EF){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function oi(e,t,n=EF){return u1(e,t,n)===0}function Xo(e,t,n){return u1(e,t,n)===0}function $Rt(e,t,n){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++){const a=e[o],i=t[o];if(!Xo(a,i,n))return!1}return!0}function bh({panelConstraints:e,panelIndex:t,size:n}){const o=e[t];ht(o!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:a=0,collapsible:i,maxSize:s=100,minSize:l=0}=o;if(u1(n,l)<0)if(i){const d=(a+l)/2;u1(n,d)<0?n=a:n=l}else n=l;return n=Math.min(s,n),n=parseFloat(n.toFixed(EF)),n}function Ff({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:a,trigger:i}){if(Xo(e,0))return t;const s=[...t],[l,d]=o;ht(l!=null,"Invalid first pivot index"),ht(d!=null,"Invalid second pivot index");let h=0;if(i==="keyboard"){{const m=e<0?d:l,v=n[m];ht(v,`Panel constraints not found for index ${m}`);const{collapsedSize:x=0,collapsible:M,minSize:b=0}=v;if(M){const C=t[m];if(ht(C!=null,`Previous layout not found for panel index ${m}`),Xo(C,x)){const _=b-C;u1(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}{const m=e<0?l:d,v=n[m];ht(v,`No panel constraints found for index ${m}`);const{collapsedSize:x=0,collapsible:M,minSize:b=0}=v;if(M){const C=t[m];if(ht(C!=null,`Previous layout not found for panel index ${m}`),Xo(C,b)){const _=C-x;u1(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}}{const m=e<0?1:-1;let v=e<0?d:l,x=0;for(;;){const b=t[v];ht(b!=null,`Previous layout not found for panel index ${v}`);const _=bh({panelConstraints:n,panelIndex:v,size:100})-b;if(x+=_,v+=m,v<0||v>=n.length)break}const M=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-M:M}{let v=e<0?l:d;for(;v>=0&&v<n.length;){const x=Math.abs(e)-Math.abs(h),M=t[v];ht(M!=null,`Previous layout not found for panel index ${v}`);const b=M-x,C=bh({panelConstraints:n,panelIndex:v,size:b});if(!Xo(M,C)&&(h+=M-C,s[v]=C,h.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?v--:v++}}if($Rt(a,s))return a;{const m=e<0?d:l,v=t[m];ht(v!=null,`Previous layout not found for panel index ${m}`);const x=v+h,M=bh({panelConstraints:n,panelIndex:m,size:x});if(s[m]=M,!Xo(M,x)){let b=x-M,_=e<0?d:l;for(;_>=0&&_<n.length;){const N=s[_];ht(N!=null,`Previous layout not found for panel index ${_}`);const A=N+b,I=bh({panelConstraints:n,panelIndex:_,size:A});if(Xo(N,I)||(b-=I-N,s[_]=I),Xo(b,0))break;e>0?_--:_++}}}const p=s.reduce((m,v)=>v+m,0);return Xo(p,100)?s:a}function DRt({layout:e,panelsArray:t,pivotIndices:n}){let o=0,a=100,i=0,s=0;const l=n[0];ht(l!=null,"No pivot index found"),t.forEach((m,v)=>{const{constraints:x}=m,{maxSize:M=100,minSize:b=0}=x;v===l?(o=b,a=M):(i+=b,s+=M)});const d=Math.min(a,100-i),h=Math.max(o,100-s),p=e[l];return{valueMax:d,valueMin:h,valueNow:p}}function rp(e,t=document){return Array.from(t.querySelectorAll(`[${mn.resizeHandleId}][data-panel-group-id="${e}"]`))}function Mle(e,t,n=document){const a=rp(e,n).findIndex(i=>i.getAttribute(mn.resizeHandleId)===t);return a??null}function _le(e,t,n){const o=Mle(e,t,n);return o!=null?[o,o+1]:[-1,-1]}function zRt(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function Sle(e,t=document){if(zRt(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function q$(e,t=document){const n=t.querySelector(`[${mn.resizeHandleId}="${e}"]`);return n||null}function ORt(e,t,n,o=document){var a,i,s,l;const d=q$(t,o),h=rp(e,o),p=d?h.indexOf(d):-1,m=(a=(i=n[p])===null||i===void 0?void 0:i.id)!==null&&a!==void 0?a:null,v=(s=(l=n[p+1])===null||l===void 0?void 0:l.id)!==null&&s!==void 0?s:null;return[m,v]}function qRt({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:o,panelDataArray:a,panelGroupElement:i,setLayout:s}){k.useRef({didWarnAboutMissingResizeHandle:!1}),e1(()=>{if(!i)return;const l=rp(n,i);for(let d=0;d<a.length-1;d++){const{valueMax:h,valueMin:p,valueNow:m}=DRt({layout:o,panelsArray:a,pivotIndices:[d,d+1]}),v=l[d];if(v!=null){const x=a[d];ht(x,`No panel data found for index "${d}"`),v.setAttribute("aria-controls",x.id),v.setAttribute("aria-valuemax",""+Math.round(h)),v.setAttribute("aria-valuemin",""+Math.round(p)),v.setAttribute("aria-valuenow",m!=null?""+Math.round(m):"")}}return()=>{l.forEach((d,h)=>{d.removeAttribute("aria-controls"),d.removeAttribute("aria-valuemax"),d.removeAttribute("aria-valuemin"),d.removeAttribute("aria-valuenow")})}},[n,o,a,i]),k.useEffect(()=>{if(!i)return;const l=t.current;ht(l,"Eager values not found");const{panelDataArray:d}=l,h=Sle(n,i);ht(h!=null,`No group found for id "${n}"`);const p=rp(n,i);ht(p,`No resize handles found for group id "${n}"`);const m=p.map(v=>{const x=v.getAttribute(mn.resizeHandleId);ht(x,"Resize handle element has no handle id attribute");const[M,b]=ORt(n,x,d,i);if(M==null||b==null)return()=>{};const C=_=>{if(!_.defaultPrevented)switch(_.key){case"Enter":{_.preventDefault();const N=d.findIndex(A=>A.id===M);if(N>=0){const A=d[N];ht(A,`No panel data found for index ${N}`);const I=o[N],{collapsedSize:R=0,collapsible:j,minSize:D=0}=A.constraints;if(I!=null&&j){const H=Ff({delta:Xo(I,R)?D-R:R-I,initialLayout:o,panelConstraints:d.map(U=>U.constraints),pivotIndices:_le(n,x,i),prevLayout:o,trigger:"keyboard"});o!==H&&s(H)}}break}}};return v.addEventListener("keydown",C),()=>{v.removeEventListener("keydown",C)}});return()=>{m.forEach(v=>v())}},[i,e,t,n,o,a,s])}function LQ(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Cle(e,t){const n=e==="horizontal",{x:o,y:a}=z$(t);return n?o:a}function HRt(e,t,n,o,a){const i=n==="horizontal",s=q$(t,a);ht(s,`No resize handle element found for id "${t}"`);const l=s.getAttribute(mn.groupId);ht(l,"Resize handle element has no group id attribute");let{initialCursorPosition:d}=o;const h=Cle(n,e),p=Sle(l,a);ht(p,`No group element found for id "${l}"`);const m=p.getBoundingClientRect(),v=i?m.width:m.height;return(h-d)/v*100}function VRt(e,t,n,o,a,i){if(ple(e)){const s=n==="horizontal";let l=0;e.shiftKey?l=100:a!=null?l=a:l=10;let d=0;switch(e.key){case"ArrowDown":d=s?0:l;break;case"ArrowLeft":d=s?-l:0;break;case"ArrowRight":d=s?l:0;break;case"ArrowUp":d=s?0:-l;break;case"End":d=100;break;case"Home":d=-100;break}return d}else return o==null?0:HRt(e,t,n,o,i)}function BRt({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let o=0,a=100;for(let i=0;i<e.length;i++){const s=n[i];ht(s,`Panel constraints not found for index ${i}`);const{defaultSize:l}=s;l!=null&&(o++,t[i]=l,a-=l)}for(let i=0;i<e.length;i++){const s=n[i];ht(s,`Panel constraints not found for index ${i}`);const{defaultSize:l}=s;if(l!=null)continue;const d=e.length-o,h=a/d;o++,t[i]=h,a-=h}return t}function ch(e,t,n){t.forEach((o,a)=>{const i=e[a];ht(i,`Panel data not found for index ${a}`);const{callbacks:s,constraints:l,id:d}=i,{collapsedSize:h=0,collapsible:p}=l,m=n[d];if(m==null||o!==m){n[d]=o;const{onCollapse:v,onExpand:x,onResize:M}=s;M&&M(o,m),p&&(v||x)&&(x&&(m==null||oi(m,h))&&!oi(o,h)&&x(),v&&(m==null||!oi(m,h))&&oi(o,h)&&v())}})}function Mm(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function FRt({defaultSize:e,dragState:t,layout:n,panelData:o,panelIndex:a,precision:i=3}){const s=n[a];let l;return s==null?l=e!=null?e.toPrecision(i):"1":o.length===1?l="1":l=s.toPrecision(i),{flexBasis:0,flexGrow:l,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function URt(e,t=10){let n=null;return(...a)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...a)},t)}}function jQ(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function Nle(e){return`react-resizable-panels:${e}`}function Lle(e){return e.map(t=>{const{constraints:n,id:o,idIsFromProps:a,order:i}=t;return a?o:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function jle(e,t){try{const n=Nle(e),o=t.getItem(n);if(o){const a=JSON.parse(o);if(typeof a=="object"&&a!=null)return a}}catch{}return null}function GRt(e,t,n){var o,a;const i=(o=jle(e,n))!==null&&o!==void 0?o:{},s=Lle(t);return(a=i[s])!==null&&a!==void 0?a:null}function XRt(e,t,n,o,a){var i;const s=Nle(e),l=Lle(t),d=(i=jle(e,a))!==null&&i!==void 0?i:{};d[l]={expandToSizes:Object.fromEntries(n.entries()),layout:o};try{a.setItem(s,JSON.stringify(d))}catch(h){console.error(h)}}function AQ({layout:e,panelConstraints:t}){const n=[...e],o=n.reduce((i,s)=>i+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!Xo(o,100)&&n.length>0)for(let i=0;i<t.length;i++){const s=n[i];ht(s!=null,`No layout data found for index ${i}`);const l=100/o*s;n[i]=l}let a=0;for(let i=0;i<t.length;i++){const s=n[i];ht(s!=null,`No layout data found for index ${i}`);const l=bh({panelConstraints:t,panelIndex:i,size:s});s!=l&&(a+=s-l,n[i]=l)}if(!Xo(a,0))for(let i=0;i<t.length;i++){const s=n[i];ht(s!=null,`No layout data found for index ${i}`);const l=s+a,d=bh({panelConstraints:t,panelIndex:i,size:l});if(s!==d&&(a-=d-s,n[i]=d,Xo(a,0)))break}return n}const ZRt=100,Uf={getItem:e=>(jQ(Uf),Uf.getItem(e)),setItem:(e,t)=>{jQ(Uf),Uf.setItem(e,t)}},EQ={};function Ale({autoSaveId:e=null,children:t,className:n="",direction:o,forwardedRef:a,id:i=null,onLayout:s=null,keyboardResizeBy:l=null,storage:d=Uf,style:h,tagName:p="div",...m}){const v=IF(i),x=k.useRef(null),[M,b]=k.useState(null),[C,_]=k.useState([]),N=PRt(),A=k.useRef({}),I=k.useRef(new Map),R=k.useRef(0),j=k.useRef({autoSaveId:e,direction:o,dragState:M,id:v,keyboardResizeBy:l,onLayout:s,storage:d}),D=k.useRef({layout:C,panelDataArray:[],panelDataArrayChanged:!1});k.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),k.useImperativeHandle(a,()=>({getId:()=>j.current.id,getLayout:()=>{const{layout:T}=D.current;return T},setLayout:T=>{const{onLayout:K}=j.current,{layout:Q,panelDataArray:ne}=D.current,te=AQ({layout:T,panelConstraints:ne.map(ce=>ce.constraints)});LQ(Q,te)||(_(te),D.current.layout=te,K&&K(te),ch(ne,te,A.current))}}),[]),e1(()=>{j.current.autoSaveId=e,j.current.direction=o,j.current.dragState=M,j.current.id=v,j.current.onLayout=s,j.current.storage=d}),qRt({committedValuesRef:j,eagerValuesRef:D,groupId:v,layout:C,panelDataArray:D.current.panelDataArray,setLayout:_,panelGroupElement:x.current}),k.useEffect(()=>{const{panelDataArray:T}=D.current;if(e){if(C.length===0||C.length!==T.length)return;let K=EQ[e];K==null&&(K=URt(XRt,ZRt),EQ[e]=K);const Q=[...T],ne=new Map(I.current);K(e,Q,ne,C,d)}},[e,C,d]),k.useEffect(()=>{});const H=k.useCallback(T=>{const{onLayout:K}=j.current,{layout:Q,panelDataArray:ne}=D.current;if(T.constraints.collapsible){const te=ne.map(Ee=>Ee.constraints),{collapsedSize:ce=0,panelSize:me,pivotIndices:ke}=sc(ne,T,Q);if(ht(me!=null,`Panel size not found for panel "${T.id}"`),!oi(me,ce)){I.current.set(T.id,me);const Ie=ph(ne,T)===ne.length-1?me-ce:ce-me,Te=Ff({delta:Ie,initialLayout:Q,panelConstraints:te,pivotIndices:ke,prevLayout:Q,trigger:"imperative-api"});Mm(Q,Te)||(_(Te),D.current.layout=Te,K&&K(Te),ch(ne,Te,A.current))}}},[]),U=k.useCallback((T,K)=>{const{onLayout:Q}=j.current,{layout:ne,panelDataArray:te}=D.current;if(T.constraints.collapsible){const ce=te.map(qe=>qe.constraints),{collapsedSize:me=0,panelSize:ke=0,minSize:Ee=0,pivotIndices:Ie}=sc(te,T,ne),Te=K??Ee;if(oi(ke,me)){const qe=I.current.get(T.id),ct=qe!=null&&qe>=Te?qe:Te,We=ph(te,T)===te.length-1?ke-ct:ct-ke,Le=Ff({delta:We,initialLayout:ne,panelConstraints:ce,pivotIndices:Ie,prevLayout:ne,trigger:"imperative-api"});Mm(ne,Le)||(_(Le),D.current.layout=Le,Q&&Q(Le),ch(te,Le,A.current))}}},[]),z=k.useCallback(T=>{const{layout:K,panelDataArray:Q}=D.current,{panelSize:ne}=sc(Q,T,K);return ht(ne!=null,`Panel size not found for panel "${T.id}"`),ne},[]),Z=k.useCallback((T,K)=>{const{panelDataArray:Q}=D.current,ne=ph(Q,T);return FRt({defaultSize:K,dragState:M,layout:C,panelData:Q,panelIndex:ne})},[M,C]),q=k.useCallback(T=>{const{layout:K,panelDataArray:Q}=D.current,{collapsedSize:ne=0,collapsible:te,panelSize:ce}=sc(Q,T,K);return ht(ce!=null,`Panel size not found for panel "${T.id}"`),te===!0&&oi(ce,ne)},[]),G=k.useCallback(T=>{const{layout:K,panelDataArray:Q}=D.current,{collapsedSize:ne=0,collapsible:te,panelSize:ce}=sc(Q,T,K);return ht(ce!=null,`Panel size not found for panel "${T.id}"`),!te||u1(ce,ne)>0},[]),E=k.useCallback(T=>{const{panelDataArray:K}=D.current;K.push(T),K.sort((Q,ne)=>{const te=Q.order,ce=ne.order;return te==null&&ce==null?0:te==null?-1:ce==null?1:te-ce}),D.current.panelDataArrayChanged=!0,N()},[N]);e1(()=>{if(D.current.panelDataArrayChanged){D.current.panelDataArrayChanged=!1;const{autoSaveId:T,onLayout:K,storage:Q}=j.current,{layout:ne,panelDataArray:te}=D.current;let ce=null;if(T){const ke=GRt(T,te,Q);ke&&(I.current=new Map(Object.entries(ke.expandToSizes)),ce=ke.layout)}ce==null&&(ce=BRt({panelDataArray:te}));const me=AQ({layout:ce,panelConstraints:te.map(ke=>ke.constraints)});LQ(ne,me)||(_(me),D.current.layout=me,K&&K(me),ch(te,me,A.current))}}),e1(()=>{const T=D.current;return()=>{T.layout=[]}},[]);const O=k.useCallback(T=>{let K=!1;const Q=x.current;return Q&&window.getComputedStyle(Q,null).getPropertyValue("direction")==="rtl"&&(K=!0),function(te){te.preventDefault();const ce=x.current;if(!ce)return()=>null;const{direction:me,dragState:ke,id:Ee,keyboardResizeBy:Ie,onLayout:Te}=j.current,{layout:qe,panelDataArray:ct}=D.current,{initialLayout:jt}=ke??{},We=_le(Ee,T,ce);let Le=VRt(te,T,me,ke,Ie,ce);const Rt=me==="horizontal";Rt&&K&&(Le=-Le);const eo=ct.map(On=>On.constraints),An=Ff({delta:Le,initialLayout:jt??qe,panelConstraints:eo,pivotIndices:We,prevLayout:qe,trigger:ple(te)?"keyboard":"mouse-or-touch"}),wn=!Mm(qe,An);(yle(te)||mle(te))&&R.current!=Le&&(R.current=Le,!wn&&Le!==0?Rt?uq(T,Le<0?vle:kle):uq(T,Le<0?xle:wle):uq(T,0)),wn&&(_(An),D.current.layout=An,Te&&Te(An),ch(ct,An,A.current))}},[]),P=k.useCallback((T,K)=>{const{onLayout:Q}=j.current,{layout:ne,panelDataArray:te}=D.current,ce=te.map(qe=>qe.constraints),{panelSize:me,pivotIndices:ke}=sc(te,T,ne);ht(me!=null,`Panel size not found for panel "${T.id}"`);const Ie=ph(te,T)===te.length-1?me-K:K-me,Te=Ff({delta:Ie,initialLayout:ne,panelConstraints:ce,pivotIndices:ke,prevLayout:ne,trigger:"imperative-api"});Mm(ne,Te)||(_(Te),D.current.layout=Te,Q&&Q(Te),ch(te,Te,A.current))},[]),X=k.useCallback((T,K)=>{const{layout:Q,panelDataArray:ne}=D.current,{collapsedSize:te=0,collapsible:ce}=K,{collapsedSize:me=0,collapsible:ke,maxSize:Ee=100,minSize:Ie=0}=T.constraints,{panelSize:Te}=sc(ne,T,Q);Te!=null&&(ce&&ke&&oi(Te,te)?oi(te,me)||P(T,me):Te<Ie?P(T,Ie):Te>Ee&&P(T,Ee))},[P]),W=k.useCallback((T,K)=>{const{direction:Q}=j.current,{layout:ne}=D.current;if(!x.current)return;const te=q$(T,x.current);ht(te,`Drag handle element not found for id "${T}"`);const ce=Cle(Q,K);b({dragHandleId:T,dragHandleRect:te.getBoundingClientRect(),initialCursorPosition:ce,initialLayout:ne})},[]),V=k.useCallback(()=>{b(null)},[]),L=k.useCallback(T=>{const{panelDataArray:K}=D.current,Q=ph(K,T);Q>=0&&(K.splice(Q,1),delete A.current[T.id],D.current.panelDataArrayChanged=!0,N())},[N]),Y=k.useMemo(()=>({collapsePanel:H,direction:o,dragState:M,expandPanel:U,getPanelSize:z,getPanelStyle:Z,groupId:v,isPanelCollapsed:q,isPanelExpanded:G,reevaluatePanelConstraints:X,registerPanel:E,registerResizeHandle:O,resizePanel:P,startDragging:W,stopDragging:V,unregisterPanel:L,panelGroupElement:x.current}),[H,M,o,U,z,Z,v,q,G,X,E,O,P,W,V,L]),F={display:"flex",flexDirection:o==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return k.createElement(D$.Provider,{value:Y},k.createElement(p,{...m,children:t,className:n,id:i,ref:x,style:{...F,...h},[mn.group]:"",[mn.groupDirection]:o,[mn.groupId]:v}))}const Ele=k.forwardRef((e,t)=>k.createElement(Ale,{...e,forwardedRef:t}));Ale.displayName="PanelGroup";Ele.displayName="forwardRef(PanelGroup)";function ph(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function sc(e,t,n){const o=ph(e,t),i=o===e.length-1?[o-1,o]:[o,o+1],s=n[o];return{...t.constraints,panelSize:s,pivotIndices:i}}function YRt({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:o}){k.useEffect(()=>{if(e||n==null||o==null)return;const a=q$(t,o);if(a==null)return;const i=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const l=a.getAttribute(mn.groupId);ht(l,`No group element found for id "${l}"`);const d=rp(l,o),h=Mle(l,t,o);ht(h!==null,`No resize element found for id "${t}"`);const p=s.shiftKey?h>0?h-1:d.length-1:h+1<d.length?h+1:0;d[p].focus();break}}};return a.addEventListener("keydown",i),()=>{a.removeEventListener("keydown",i)}},[o,e,t,n])}function Ile({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:o,id:a,onBlur:i,onClick:s,onDragging:l,onFocus:d,onPointerDown:h,onPointerUp:p,style:m={},tabIndex:v=0,tagName:x="div",...M}){var b,C;const _=k.useRef(null),N=k.useRef({onClick:s,onDragging:l,onPointerDown:h,onPointerUp:p});k.useEffect(()=>{N.current.onClick=s,N.current.onDragging=l,N.current.onPointerDown=h,N.current.onPointerUp=p});const A=k.useContext(D$);if(A===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:I,groupId:R,registerResizeHandle:j,startDragging:D,stopDragging:H,panelGroupElement:U}=A,z=IF(a),[Z,q]=k.useState("inactive"),[G,E]=k.useState(!1),[O,P]=k.useState(null),X=k.useRef({state:Z});e1(()=>{X.current.state=Z}),k.useEffect(()=>{if(n)P(null);else{const Y=j(z);P(()=>Y)}},[n,z,j]);const W=(b=o==null?void 0:o.coarse)!==null&&b!==void 0?b:15,V=(C=o==null?void 0:o.fine)!==null&&C!==void 0?C:5;k.useEffect(()=>{if(n||O==null)return;const Y=_.current;ht(Y,"Element ref not attached");let F=!1;return TRt(z,Y,I,{coarse:W,fine:V},(K,Q,ne)=>{if(!Q){q("inactive");return}switch(K){case"down":{q("drag"),F=!1,ht(ne,'Expected event to be defined for "down" action'),D(z,ne);const{onDragging:te,onPointerDown:ce}=N.current;te==null||te(!0),ce==null||ce();break}case"move":{const{state:te}=X.current;F=!0,te!=="drag"&&q("hover"),ht(ne,'Expected event to be defined for "move" action'),O(ne);break}case"up":{q("hover"),H();const{onClick:te,onDragging:ce,onPointerUp:me}=N.current;ce==null||ce(!1),me==null||me(),F||te==null||te();break}}})},[W,I,n,V,j,z,O,D,H]),YRt({disabled:n,handleId:z,resizeHandler:O,panelGroupElement:U});const L={touchAction:"none",userSelect:"none"};return k.createElement(x,{...M,children:e,className:t,id:a,onBlur:()=>{E(!1),i==null||i()},onFocus:()=>{E(!0),d==null||d()},ref:_,role:"separator",style:{...L,...m},tabIndex:v,[mn.groupDirection]:I,[mn.groupId]:R,[mn.resizeHandle]:"",[mn.resizeHandleActive]:Z==="drag"?"pointer":G?"keyboard":void 0,[mn.resizeHandleEnabled]:!n,[mn.resizeHandleId]:z,[mn.resizeHandleState]:Z})}Ile.displayName="PanelResizeHandle";const PF=({className:e,...t})=>u.jsx(Ele,{className:ge("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),li=fle,t2=({withHandle:e,className:t,...n})=>u.jsx(Ile,{className:ge("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&u.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:u.jsx(a0,{className:"h-2.5 w-2.5"})})});function WRt({items:e,onClose:t,position:n,onSelect:o}){const a=k.useRef(null),i=k.useRef(null);return k.useEffect(()=>{i.current&&i.current.focus()},[]),u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"fixed inset-0 z-40 bg-transparent",onClick:t,onContextMenu:s=>{s.preventDefault(),t()}}),u.jsx("div",{ref:a,className:"fixed z-50",style:{top:n.top,left:n.left},children:u.jsxs(xp,{className:"rounded-lg border shadow-md w-64",children:[u.jsx(wp,{ref:i,placeholder:"Search..."}),u.jsxs(bp,{children:[u.jsx(Mp,{children:"No results found."}),e.map(s=>u.jsx(hs,{heading:s.label,children:s.children.map(l=>u.jsx(yr,{onSelect:()=>o(l),children:l.label},l.label))},s.label))]})]})})]})}function IQ(){const{botId:e,commandId:t,eventId:n}=gi(),o=Er(),a=Be(L=>L.init),i=Be(L=>L.isLoading),s=Be(L=>L.isSaving),l=Be(L=>L.command),d=Be(L=>L.availableNodes),h=Be(L=>L.saveGraph),p=Be(L=>L.nodes),m=Be(L=>L.edges),v=Be(L=>L.onNodesChange),x=Be(L=>L.onEdgesChange),M=Be(L=>L.onConnect),b=Be(L=>L.addNode),C=Be(L=>L.openMenu),_=Be(L=>L.closeMenu),N=Be(L=>L.isMenuOpen),A=Be(L=>L.menuPosition),I=Be(L=>L.setConnectingPin),R=Be(L=>L.onConnectStart),j=Be(L=>L.connectingPin),[D,H]=k.useState(null),U=k.useRef(null),z=o.pathname.includes("/commands/")?"command":"event",Z=z==="command"?t:n;k.useEffect(()=>{e&&Z&&a(e,Z,z)},[e,Z,z,a]);const q=k.useMemo(()=>!d||Object.keys(d).length===0?{custom:nV}:{...Object.values(d).flat().reduce((F,T)=>(F[T.type]=nV,F),{})},[d]),G=k.useMemo(()=>d?Object.entries(d).map(([L,Y])=>({label:L,children:Y.map(F=>({label:F.label,type:F.type}))})):[],[d]),E=L=>{const{menuPosition:Y,addNode:F,closeMenu:T}=Be.getState();F(L.type,Y.flowPosition),T()},O=()=>{h(e)},P=(L,Y)=>{if(!D)return;const F=U.current.getBoundingClientRect(),T=D.project({x:L.clientX-F.left,y:L.clientY-F.top});Y(L.clientY,L.clientX,T)},X=L=>{if(!j)return;L.target.classList.contains("react-flow__pane")&&P(L,C),I(null)},W=L=>{L.preventDefault(),L.dataTransfer.dropEffect="move"},V=L=>{if(L.preventDefault(),!D)return;const Y=U.current.getBoundingClientRect(),F=L.dataTransfer.getData("application/reactflow"),T=D.project({x:L.clientX-Y.left,y:L.clientY-Y.top});b(F,T)};return i||Object.keys(d).length===0?u.jsx("div",{className:"flex items-center justify-center h-full",children:"Загрузка редактора..."}):u.jsx($$,{children:u.jsxs("div",{className:"h-full w-full flex flex-col",children:[u.jsxs("header",{className:"p-2 border-b flex justify-between items-center",children:[u.jsxs("h1",{className:"text-lg font-bold",children:["Редактор: ",l==null?void 0:l.name]}),u.jsx(pe,{onClick:O,disabled:s,children:s?"Сохранение...":"Сохранить"})]}),u.jsxs(PF,{direction:"horizontal",className:"flex-grow",children:[u.jsx(li,{defaultSize:15,children:u.jsx(ule,{})}),u.jsx(t2,{withHandle:!0}),u.jsx(li,{defaultSize:65,children:u.jsx("div",{className:"h-full",ref:U,children:u.jsxs(AF,{nodes:p,edges:m,onNodesChange:v,onEdgesChange:x,onConnect:M,onConnectStart:R,onConnectEnd:X,nodeTypes:q,onInit:H,onDrop:V,onDragOver:W,fitView:!0,deleteKeyCode:["Backspace","Delete"],onPaneContextMenu:L=>{L.preventDefault(),P(L,C)},children:[u.jsx(sle,{}),u.jsx(lle,{})]})})}),u.jsx(t2,{withHandle:!0}),u.jsx(li,{defaultSize:20,children:u.jsx(dle,{})})]}),N&&u.jsx(WRt,{position:A,onClose:_,items:G,onSelect:E})]})})}const KRt=()=>{const e=k.useRef(null),t=k.useRef(null),{screenToFlowPosition:n}=P$(),o=Be(z=>z.nodes),a=Be(z=>z.edges),i=Be(z=>z.onNodesChange),s=Be(z=>z.onEdgesChange),l=Be(z=>z.onConnect),d=Be(z=>z.onDelete),h=Be(z=>z.availableNodes),p=Be(z=>z.isMenuOpen),m=Be(z=>z.menuPosition),v=Be(z=>z.openMenu),x=Be(z=>z.closeMenu),M=Be(z=>z.setConnectingPin),b=Be(z=>z.connectAndAddNode),C=Be(z=>z.addNode),_=Be(z=>z.connectingPin),N=k.useMemo(()=>{const z={};return Object.values(h).flat().forEach(Z=>{z[Z.type]=nV}),z},[h]),A=k.useCallback(z=>{z.preventDefault(),z.dataTransfer.dropEffect="move"},[]),I=k.useCallback(z=>{z.preventDefault();const Z=z.dataTransfer.getData("application/reactflow");if(typeof Z>"u"||!Z)return;const q=n({x:z.clientX,y:z.clientY});C(Z,q)},[n,C]),R=k.useCallback(z=>{z.preventDefault();const Z=n({x:z.clientX,y:z.clientY});v(z.clientY,z.clientX,Z)},[n]),j=z=>{_?b(z,m.flowPosition):m&&m.flowPosition&&C(z,m.flowPosition),x()},D=k.useCallback(z=>{if(!Be.getState().connectingPin)return;z.target.classList.contains("react-flow__pane")?setTimeout(()=>{const G=n({x:z.clientX,y:z.clientY});v(z.clientY,z.clientX,G)},50):M(null)},[n,v,M]),H=k.useCallback((z,{nodeId:Z,handleId:q,handleType:G})=>{const E=o.find(O=>O.id===Z);E&&M({nodeId:Z,handleId:q,handleType:G,nodeType:E.type})},[o,M]),U=k.useMemo(()=>{if(!_)return h;const Z=Object.values(h).flat().find(E=>E.type===_.nodeType);if(!Z)return h;const q=Z.outputs.find(E=>E.id===_.handleId);if(!q)return h;const G={};return Object.entries(h).forEach(([E,O])=>{const P=O.filter(X=>X.inputs.some(W=>W.type===q.type||W.type==="Wildcard"||q.type==="Wildcard"));P.length>0&&(G[E]=P)}),G},[JSON.stringify(h)]);return k.useEffect(()=>{const z=Z=>{t.current&&!t.current.contains(Z.target)&&x()};return p?document.addEventListener("mousedown",z,!0):document.removeEventListener("mousedown",z,!0),()=>{document.removeEventListener("mousedown",z,!0)}},[p,x]),u.jsxs("div",{style:{height:"100%",width:"100%"},ref:e,children:[u.jsxs(AF,{nodes:o,edges:a,onNodesChange:i,onEdgesChange:s,onConnect:l,nodeTypes:N,onPaneContextMenu:R,onDragOver:A,onDrop:I,onConnectStart:H,onConnectEnd:D,onNodesDelete:z=>d(z,[]),onEdgesDelete:z=>d([],z),deleteKeyCode:["Delete","Backspace"],fitView:!0,children:[u.jsx(lle,{}),u.jsx(sle,{})]}),p&&u.jsx("div",{ref:t,style:{top:m.top,left:m.left,position:"absolute",zIndex:10},children:u.jsxs(xp,{children:[u.jsx(wp,{placeholder:"Type a command or search..."}),u.jsxs(bp,{children:[u.jsx(Mp,{children:"No results found."}),Object.entries(U).map(([z,Z])=>u.jsx(hs,{heading:z,children:Z.map(q=>u.jsx(yr,{value:q.label,onSelect:()=>j(q.type),disabled:!1,children:q.label},q.type))},z))]})]})})]})};function QRt({botId:e,open:t,onOpenChange:n,onCreated:o}){const[a,i]=k.useState(""),[s,l]=k.useState(!1);k.useEffect(()=>{t&&i("")},[t]);const d=async()=>{if(a){l(!0);try{await Ne(`/api/bots/${e}/event-graphs`,{method:"POST",body:JSON.stringify({name:a})}),o(),n(!1)}catch(h){console.error("Не удалось создать граф событий:",h)}finally{l(!1)}}};return u.jsx(Jt,{open:t,onOpenChange:n,children:u.jsxs(Wt,{children:[u.jsx(on,{children:u.jsx(en,{children:"Создать новый граф событий"})}),u.jsx("div",{className:"py-4",children:u.jsx(Ze,{placeholder:"Название графа",value:a,onChange:h=>i(h.target.value)})}),u.jsxs(an,{children:[u.jsx(pe,{variant:"outline",onClick:()=>n(!1),children:"Отмена"}),u.jsx(pe,{onClick:d,disabled:!a||s,children:s?"Создание...":"Создать"})]})]})})}function JRt({botId:e,graphId:t,onCancel:n}){const[o,a]=k.useState(null),[i,s]=k.useState(!0),{toast:l}=Yt();k.useEffect(()=>{t&&(async()=>{if(!(!e||!t)){s(!0);try{const p=await Ne(`/api/bots/${e}/event-graphs/${t}/export`);a(JSON.stringify(p,null,2))}catch(p){console.error("Не удалось получить данные графа:",p),l({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить данные для экспорта."}),n()}finally{s(!1)}}})()},[e,t,n,l]);const d=()=>{o&&(navigator.clipboard.writeText(o),l({title:"Скопировано!",description:"Код для импорта скопирован в буфер обмена."}))};return u.jsx(Jt,{open:!!t,onOpenChange:h=>!h&&n(),children:u.jsxs(Wt,{children:[u.jsxs(on,{children:[u.jsx(en,{children:"Поделиться графом события"}),u.jsx(dn,{children:"Скопируйте этот код, чтобы импортировать граф события на другом боте или поделиться им."})]}),u.jsxs("div",{className:"py-4 space-y-2",children:[u.jsx(_e,{htmlFor:"graph-json",children:"Код для импорта"}),i?u.jsx("div",{className:"flex items-center justify-center h-24",children:u.jsx(It,{className:"h-8 w-8 animate-spin"})}):u.jsx(ki,{id:"graph-json",readOnly:!0,value:o||"",className:"h-64 font-mono text-xs"})]}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:n,children:"Закрыть"}),u.jsxs(pe,{onClick:d,disabled:i||!o,children:[u.jsx(ps,{className:"mr-2 h-4 w-4"}),"Скопировать код"]})]})]})})}function ePt({botId:e,open:t,onOpenChange:n,onImportSuccess:o}){const[a,i]=k.useState(""),[s,l]=k.useState(!1),{toast:d}=Yt(),h=async()=>{let p;try{p=JSON.parse(a)}catch{d({variant:"destructive",title:"Ошибка",description:"Неверный формат JSON."});return}l(!0);try{await Ne(`/api/bots/${e}/event-graphs/import`,{method:"POST",body:JSON.stringify(p)},"Граф события успешно импортирован."),o()}catch{}finally{l(!1)}};return u.jsx(Jt,{open:t,onOpenChange:n,children:u.jsxs(Wt,{children:[u.jsxs(on,{children:[u.jsx(en,{children:"Импорт графа события"}),u.jsx(dn,{children:"Вставьте ранее скопированный код для импорта графа. Будет создан новый граф события."})]}),u.jsxs("div",{className:"py-4 space-y-2",children:[u.jsx(_e,{htmlFor:"graph-json-input",children:"Код для импорта"}),u.jsx(ki,{id:"graph-json-input",value:a,onChange:p=>i(p.target.value),placeholder:"Вставьте сюда JSON...",className:"h-64 font-mono text-xs"})]}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:()=>n(!1),children:"Отмена"}),u.jsxs(pe,{onClick:h,disabled:s||!a,children:[s&&u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}),u.jsx(wr,{className:"mr-2 h-4 w-4"}),"Импортировать"]})]})]})})}function tPt(){const{botId:e,eventId:t}=gi();return t?u.jsx(aPt,{botId:e,eventId:t}):u.jsx(oPt,{botId:e})}function nPt({onActionClick:e}){return u.jsxs("div",{className:"text-center p-12 border-2 border-dashed rounded-lg",children:[u.jsx(w0,{className:"mx-auto h-12 w-12 text-gray-400"}),u.jsx("h3",{className:"mt-4 text-lg font-medium",children:"Графов событий пока нет"}),u.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Начните с создания своего первого графа для автоматизации действий бота."}),u.jsx("div",{className:"mt-6",children:u.jsxs(pe,{onClick:e,children:[u.jsx(za,{className:"mr-2 h-4 w-4"}),"Создать первый граф"]})})]})}function oPt({botId:e}){const[t,n]=k.useState([]),[o,a]=k.useState(!0),[i,s]=k.useState(!1),[l,d]=k.useState(!1),[h,p]=k.useState(null),[m,v]=k.useTransition(),{toast:x}=Yt(),M=async()=>{a(!0);try{const N=await Ne(`/api/bots/${e}/event-graphs`);n(N)}catch{x({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить графы событий."})}a(!1)},b=async N=>{v(async()=>{try{const A=await Ne(`/api/bots/${e}/event-graphs/${N.id}`,{method:"PUT",body:{isEnabled:!N.isEnabled}});n(I=>I.map(R=>R.id===N.id?{...R,isEnabled:A.isEnabled}:R)),x({title:"Успешно",description:`Граф "${N.name}" был ${A.isEnabled?"включен":"выключен"}.`})}catch{x({variant:"destructive",title:"Ошибка",description:"Не удалось изменить статус графа."})}})},C=async N=>{try{await Ne(`/api/bots/${e}/event-graphs/${N}/duplicate`,{method:"POST"}),x({title:"Успешно",description:"Граф был скопирован."}),M()}catch{x({variant:"destructive",title:"Ошибка",description:"Не удалось скопировать граф."})}},_=async N=>{try{await Ne(`/api/bots/${e}/event-graphs/${N}`,{method:"DELETE"}),M()}catch(A){console.error("Не удалось удалить граф событий:",A)}};return k.useEffect(()=>{M()},[e]),o?u.jsx("div",{children:"Загрузка графов событий..."}):u.jsxs("div",{className:"p-4 sm:p-6",children:[u.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-6 gap-4",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-2xl font-bold",children:"Графы событий"}),u.jsx("p",{className:"text-muted-foreground",children:"Управляйте сценариями поведения вашего бота."})]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsxs(pe,{variant:"outline",onClick:()=>d(!0),children:[u.jsx(Xd,{className:"mr-2 h-4 w-4"}),"Импорт"]}),u.jsxs(pe,{onClick:()=>s(!0),children:[u.jsx(za,{className:"mr-2 h-4 w-4"}),"Создать"]})]})]}),u.jsx(QRt,{botId:e,open:i,onOpenChange:s,onCreated:M}),u.jsx(ePt,{botId:e,open:l,onOpenChange:d,onImportSuccess:()=>{d(!1),M()}}),u.jsx(JRt,{botId:e,graphId:h,onCancel:()=>p(null)}),t.length===0?u.jsx(nPt,{onActionClick:()=>s(!0)}):u.jsx("div",{className:"border rounded-lg",children:u.jsxs(Ca,{children:[u.jsx(Na,{children:u.jsxs(Nt,{children:[u.jsx(st,{className:"w-[80px]",children:"Статус"}),u.jsx(st,{children:"Название"}),u.jsx(st,{children:"Триггеры"}),u.jsx(st,{children:"Статистика"}),u.jsx(st,{className:"text-right",children:"Действия"})]})}),u.jsx(La,{children:t.map(N=>u.jsxs(Nt,{children:[u.jsx(Xe,{children:u.jsx(na,{checked:N.isEnabled,onCheckedChange:()=>b(N),disabled:m})}),u.jsx(Xe,{className:"font-medium",children:N.name}),u.jsx(Xe,{children:u.jsx("div",{className:"flex flex-wrap gap-1",children:(N.triggers||[]).map(A=>u.jsx(Xt,{variant:"secondary",children:A.eventType},A.id))})}),u.jsx(Xe,{children:u.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(es,{className:"h-4 w-4"})," ",N.nodeCount]}),u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(s0,{className:"h-4 w-4"})," ",N.edgeCount]})]})}),u.jsxs(Xe,{className:"text-right",children:[u.jsx(xB,{children:u.jsxs(is,{children:[u.jsx(ss,{asChild:!0,children:u.jsx(up,{to:`/bots/${e}/events/visual/${N.id}`,children:u.jsx(pe,{variant:"ghost",size:"icon",children:u.jsx(pn,{className:"h-4 w-4"})})})}),u.jsx(ni,{children:"Редактировать"})]})}),u.jsxs(hB,{children:[u.jsx(fB,{asChild:!0,children:u.jsx(pe,{variant:"ghost",size:"icon",children:u.jsx(Ki,{className:"h-4 w-4"})})}),u.jsxs(s$,{align:"end",children:[u.jsxs(ka,{onClick:()=>C(N.id),children:[u.jsx(ps,{className:"mr-2 h-4 w-4"}),u.jsx("span",{children:"Дублировать"})]}),u.jsxs(ka,{onClick:()=>p(N.id),children:[u.jsx(Xd,{className:"mr-2 h-4 w-4"}),u.jsx("span",{children:"Поделиться"})]}),u.jsxs(mB,{children:[u.jsx(MBe,{asChild:!0,children:u.jsxs(ka,{onSelect:A=>A.preventDefault(),className:"text-red-500 focus:text-red-500",children:[u.jsx(mo,{className:"mr-2 h-4 w-4"}),u.jsx("span",{children:"Удалить"})]})}),u.jsxs(l$,{children:[u.jsxs(u$,{children:[u.jsx(h$,{children:"Вы уверены?"}),u.jsxs(f$,{children:['Это действие необратимо. Граф "',N.name,'" будет удален навсегда.']})]}),u.jsxs(d$,{children:[u.jsx(y$,{children:"Отмена"}),u.jsx(p$,{onClick:()=>_(N.id),className:"bg-destructive hover:bg-destructive/90",children:"Удалить"})]})]})]})]})]})]})]},N.id))})]})})]})}function aPt({botId:e,eventId:t}){const{init:n,isLoading:o,command:a,saveGraph:i,isSaving:s}=Be(),[l,d]=k.useState(null);return k.useEffect(()=>(Be.setState({nodes:[],edges:[],command:null,isLoading:!0}),e&&t&&(async()=>{try{await n(e,t,"event")}catch(p){d(p.message),console.error("Не удалось инициализировать редактор графов событий:",p)}})(),()=>Be.setState({nodes:[],edges:[],command:null})),[e,t]),o?u.jsx("div",{children:"Загрузка графа события..."}):l?u.jsxs("div",{children:["Ошибка: ",l]}):u.jsx("div",{className:"flex flex-col h-full w-full bg-slate-900 text-white",children:u.jsxs($$,{children:[u.jsxs("header",{className:"p-2 border-b flex justify-between items-center",children:[u.jsxs("h1",{className:"text-lg font-bold",children:["Редактор графа: ",a==null?void 0:a.name]}),u.jsx(pe,{onClick:()=>i(e,"event"),disabled:s,children:s?"Сохранение...":"Сохранить"})]}),u.jsxs(PF,{direction:"horizontal",className:"flex-grow",children:[u.jsx(li,{defaultSize:20,children:u.jsx(ule,{})}),u.jsx(t2,{withHandle:!0}),u.jsx(li,{defaultSize:60,children:u.jsx(KRt,{})}),u.jsx(t2,{withHandle:!0}),u.jsx(li,{defaultSize:20,children:u.jsx(dle,{})})]})]})})}function rPt(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const iPt=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sPt=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,cPt={};function TQ(e,t){return(cPt.jsx?sPt:iPt).test(e)}const lPt=/[ \t\n\f\r]/g;function uPt(e){return typeof e=="object"?e.type==="text"?RQ(e.value):!1:RQ(e)}function RQ(e){return e.replace(lPt,"")===""}class Dp{constructor(t,n,o){this.normal=n,this.property=t,o&&(this.space=o)}}Dp.prototype.normal={};Dp.prototype.property={};Dp.prototype.space=void 0;function Tle(e,t){const n={},o={};for(const a of e)Object.assign(n,a.property),Object.assign(o,a.normal);return new Dp(n,o,t)}function aV(e){return e.toLowerCase()}class $o{constructor(t,n){this.attribute=n,this.property=t}}$o.prototype.attribute="";$o.prototype.booleanish=!1;$o.prototype.boolean=!1;$o.prototype.commaOrSpaceSeparated=!1;$o.prototype.commaSeparated=!1;$o.prototype.defined=!1;$o.prototype.mustUseProperty=!1;$o.prototype.number=!1;$o.prototype.overloadedBoolean=!1;$o.prototype.property="";$o.prototype.spaceSeparated=!1;$o.prototype.space=void 0;let dPt=0;const ut=k1(),Rn=k1(),rV=k1(),Se=k1(),Ut=k1(),Vh=k1(),Go=k1();function k1(){return 2**++dPt}const iV=Object.freeze(Object.defineProperty({__proto__:null,boolean:ut,booleanish:Rn,commaOrSpaceSeparated:Go,commaSeparated:Vh,number:Se,overloadedBoolean:rV,spaceSeparated:Ut},Symbol.toStringTag,{value:"Module"})),hq=Object.keys(iV);class $F extends $o{constructor(t,n,o,a){let i=-1;if(super(t,n),PQ(this,"space",a),typeof o=="number")for(;++i<hq.length;){const s=hq[i];PQ(this,hq[i],(o&iV[s])===iV[s])}}}$F.prototype.defined=!0;function PQ(e,t,n){n&&(e[t]=n)}function k2(e){const t={},n={};for(const[o,a]of Object.entries(e.properties)){const i=new $F(o,e.transform(e.attributes||{},o),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(o)&&(i.mustUseProperty=!0),t[o]=i,n[aV(o)]=o,n[aV(i.attribute)]=o}return new Dp(t,n,e.space)}const Rle=k2({properties:{ariaActiveDescendant:null,ariaAtomic:Rn,ariaAutoComplete:null,ariaBusy:Rn,ariaChecked:Rn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Ut,ariaCurrent:null,ariaDescribedBy:Ut,ariaDetails:null,ariaDisabled:Rn,ariaDropEffect:Ut,ariaErrorMessage:null,ariaExpanded:Rn,ariaFlowTo:Ut,ariaGrabbed:Rn,ariaHasPopup:null,ariaHidden:Rn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ut,ariaLevel:Se,ariaLive:null,ariaModal:Rn,ariaMultiLine:Rn,ariaMultiSelectable:Rn,ariaOrientation:null,ariaOwns:Ut,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:Rn,ariaReadOnly:Rn,ariaRelevant:null,ariaRequired:Rn,ariaRoleDescription:Ut,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:Rn,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Ple(e,t){return t in e?e[t]:t}function $le(e,t){return Ple(e,t.toLowerCase())}const hPt=k2({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Vh,acceptCharset:Ut,accessKey:Ut,action:null,allow:null,allowFullScreen:ut,allowPaymentRequest:ut,allowUserMedia:ut,alt:null,as:null,async:ut,autoCapitalize:null,autoComplete:Ut,autoFocus:ut,autoPlay:ut,blocking:Ut,capture:null,charSet:null,checked:ut,cite:null,className:Ut,cols:Se,colSpan:null,content:null,contentEditable:Rn,controls:ut,controlsList:Ut,coords:Se|Vh,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ut,defer:ut,dir:null,dirName:null,disabled:ut,download:rV,draggable:Rn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ut,formTarget:null,headers:Ut,height:Se,hidden:rV,high:Se,href:null,hrefLang:null,htmlFor:Ut,httpEquiv:Ut,id:null,imageSizes:null,imageSrcSet:null,inert:ut,inputMode:null,integrity:null,is:null,isMap:ut,itemId:null,itemProp:Ut,itemRef:Ut,itemScope:ut,itemType:Ut,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ut,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:ut,muted:ut,name:null,nonce:null,noModule:ut,noValidate:ut,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ut,optimum:Se,pattern:null,ping:Ut,placeholder:null,playsInline:ut,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ut,referrerPolicy:null,rel:Ut,required:ut,reversed:ut,rows:Se,rowSpan:Se,sandbox:Ut,scope:null,scoped:ut,seamless:ut,selected:ut,shadowRootClonable:ut,shadowRootDelegatesFocus:ut,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:Rn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:ut,useMap:null,value:Rn,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ut,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ut,declare:ut,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:ut,noHref:ut,noShade:ut,noWrap:ut,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:Rn,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ut,disableRemotePlayback:ut,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:$le}),fPt=k2({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Go,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:Ut,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:ut,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Vh,g2:Vh,glyphName:Vh,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:Go,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Se,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ut,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Go,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Go,rev:Go,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Go,requiredFeatures:Go,requiredFonts:Go,requiredFormats:Go,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:Go,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Go,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Go,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ple}),Dle=k2({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),zle=k2({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:$le}),Ole=k2({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),pPt={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},yPt=/[A-Z]/g,$Q=/-[a-z]/g,mPt=/^data[-\w.:]+$/i;function gPt(e,t){const n=aV(t);let o=t,a=$o;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&mPt.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace($Q,kPt);o="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!$Q.test(i)){let s=i.replace(yPt,vPt);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}a=$F}return new a(o,t)}function vPt(e){return"-"+e.toLowerCase()}function kPt(e){return e.charAt(1).toUpperCase()}const xPt=Tle([Rle,hPt,Dle,zle,Ole],"html"),DF=Tle([Rle,fPt,Dle,zle,Ole],"svg");function wPt(e){return e.join(" ").trim()}var lh={},fq,DQ;function bPt(){if(DQ)return fq;DQ=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,l=/^\s+|\s+$/g,d=`
8190
+ */var TK;function ELt(){if(TK)return YO;TK=1;var e=sp(),t=ALt();function n(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var o=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,l=e.useMemo,d=e.useDebugValue;return YO.useSyncExternalStoreWithSelector=function(h,p,m,v,x){var M=i(null);if(M.current===null){var b={hasValue:!1,value:null};M.current=b}else b=M.current;M=l(function(){function _(j){if(!N){if(N=!0,A=j,j=v(j),x!==void 0&&b.hasValue){var D=b.value;if(x(D,j))return I=D}return I=j}if(D=I,o(A,j))return D;var H=v(j);return x!==void 0&&x(D,H)?(A=j,D):(A=j,I=H)}var N=!1,A,I,R=m===void 0?null:m;return[function(){return _(p())},R===null?void 0:function(){return _(R())}]},[p,m,v,x]);var C=a(h,M[0],M[1]);return s(function(){b.hasValue=!0,b.value=C},[C]),d(C),C},YO}var RK;function ILt(){return RK||(RK=1,ZO.exports=ELt()),ZO.exports}var TLt=ILt();const RLt=d1(TLt),PLt={},PK=e=>{let t;const n=new Set,o=(p,m)=>{const v=typeof p=="function"?p(t):p;if(!Object.is(v,t)){const x=t;t=m??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(M=>M(t,x))}},a=()=>t,d={setState:o,getState:a,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(PLt?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},h=t=e(o,a,d);return d},$Lt=e=>e?PK(e):PK,{useDebugValue:DLt}=le,{useSyncExternalStoreWithSelector:zLt}=RLt,OLt=e=>e;function Bse(e,t=OLt,n){const o=zLt(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return DLt(o),o}const $K=(e,t)=>{const n=$Lt(e),o=(a,i=t)=>Bse(n,a,i);return Object.assign(o,n),o},qLt=(e,t)=>e?$K(e,t):$K;function Ro(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,a]of e)if(!Object.is(a,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}var HLt={value:()=>{}};function j$(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new ER(n)}function ER(e){this._=e}function VLt(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",a=n.indexOf(".");if(a>=0&&(o=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}ER.prototype=j$.prototype={constructor:ER,on:function(e,t){var n=this._,o=VLt(e+"",n),a,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((a=(e=o[i]).type)&&(a=BLt(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(a=(e=o[i]).type)n[a]=DK(n[a],e.name,t);else if(t==null)for(a in n)n[a]=DK(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ER(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),o=0,a,i;o<a;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,a=i.length;o<a;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],a=0,i=o.length;a<i;++a)o[a].value.apply(t,n)}};function BLt(e,t){for(var n=0,o=e.length,a;n<o;++n)if((a=e[n]).name===t)return a.value}function DK(e,t,n){for(var o=0,a=e.length;o<a;++o)if(e[o].name===t){e[o]=HLt,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var zH="http://www.w3.org/1999/xhtml";const zK={svg:"http://www.w3.org/2000/svg",xhtml:zH,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function A$(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),zK.hasOwnProperty(t)?{space:zK[t],local:e}:e}function FLt(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===zH&&t.documentElement.namespaceURI===zH?t.createElement(e):t.createElementNS(n,e)}}function ULt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Fse(e){var t=A$(e);return(t.local?ULt:FLt)(t)}function GLt(){}function fF(e){return e==null?GLt:function(){return this.querySelector(e)}}function XLt(e){typeof e!="function"&&(e=fF(e));for(var t=this._groups,n=t.length,o=new Array(n),a=0;a<n;++a)for(var i=t[a],s=i.length,l=o[a]=new Array(s),d,h,p=0;p<s;++p)(d=i[p])&&(h=e.call(d,d.__data__,p,i))&&("__data__"in d&&(h.__data__=d.__data__),l[p]=h);return new oa(o,this._parents)}function ZLt(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function YLt(){return[]}function Use(e){return e==null?YLt:function(){return this.querySelectorAll(e)}}function WLt(e){return function(){return ZLt(e.apply(this,arguments))}}function KLt(e){typeof e=="function"?e=WLt(e):e=Use(e);for(var t=this._groups,n=t.length,o=[],a=[],i=0;i<n;++i)for(var s=t[i],l=s.length,d,h=0;h<l;++h)(d=s[h])&&(o.push(e.call(d,d.__data__,h,s)),a.push(d));return new oa(o,a)}function Gse(e){return function(){return this.matches(e)}}function Xse(e){return function(t){return t.matches(e)}}var QLt=Array.prototype.find;function JLt(e){return function(){return QLt.call(this.children,e)}}function ejt(){return this.firstElementChild}function tjt(e){return this.select(e==null?ejt:JLt(typeof e=="function"?e:Xse(e)))}var njt=Array.prototype.filter;function ojt(){return Array.from(this.children)}function ajt(e){return function(){return njt.call(this.children,e)}}function rjt(e){return this.selectAll(e==null?ojt:ajt(typeof e=="function"?e:Xse(e)))}function ijt(e){typeof e!="function"&&(e=Gse(e));for(var t=this._groups,n=t.length,o=new Array(n),a=0;a<n;++a)for(var i=t[a],s=i.length,l=o[a]=[],d,h=0;h<s;++h)(d=i[h])&&e.call(d,d.__data__,h,i)&&l.push(d);return new oa(o,this._parents)}function Zse(e){return new Array(e.length)}function sjt(){return new oa(this._enter||this._groups.map(Zse),this._parents)}function lP(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}lP.prototype={constructor:lP,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function cjt(e){return function(){return e}}function ljt(e,t,n,o,a,i){for(var s=0,l,d=t.length,h=i.length;s<h;++s)(l=t[s])?(l.__data__=i[s],o[s]=l):n[s]=new lP(e,i[s]);for(;s<d;++s)(l=t[s])&&(a[s]=l)}function ujt(e,t,n,o,a,i,s){var l,d,h=new Map,p=t.length,m=i.length,v=new Array(p),x;for(l=0;l<p;++l)(d=t[l])&&(v[l]=x=s.call(d,d.__data__,l,t)+"",h.has(x)?a[l]=d:h.set(x,d));for(l=0;l<m;++l)x=s.call(e,i[l],l,i)+"",(d=h.get(x))?(o[l]=d,d.__data__=i[l],h.delete(x)):n[l]=new lP(e,i[l]);for(l=0;l<p;++l)(d=t[l])&&h.get(v[l])===d&&(a[l]=d)}function djt(e){return e.__data__}function hjt(e,t){if(!arguments.length)return Array.from(this,djt);var n=t?ujt:ljt,o=this._parents,a=this._groups;typeof e!="function"&&(e=cjt(e));for(var i=a.length,s=new Array(i),l=new Array(i),d=new Array(i),h=0;h<i;++h){var p=o[h],m=a[h],v=m.length,x=fjt(e.call(p,p&&p.__data__,h,o)),M=x.length,b=l[h]=new Array(M),C=s[h]=new Array(M),_=d[h]=new Array(v);n(p,m,b,C,_,x,t);for(var N=0,A=0,I,R;N<M;++N)if(I=b[N]){for(N>=A&&(A=N+1);!(R=C[A])&&++A<M;);I._next=R||null}}return s=new oa(s,o),s._enter=l,s._exit=d,s}function fjt(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function pjt(){return new oa(this._exit||this._groups.map(Zse),this._parents)}function yjt(e,t,n){var o=this.enter(),a=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?i.remove():n(i),o&&a?o.merge(a).order():a}function mjt(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,a=n.length,i=o.length,s=Math.min(a,i),l=new Array(a),d=0;d<s;++d)for(var h=n[d],p=o[d],m=h.length,v=l[d]=new Array(m),x,M=0;M<m;++M)(x=h[M]||p[M])&&(v[M]=x);for(;d<a;++d)l[d]=n[d];return new oa(l,this._parents)}function gjt(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],a=o.length-1,i=o[a],s;--a>=0;)(s=o[a])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function vjt(e){e||(e=kjt);function t(m,v){return m&&v?e(m.__data__,v.__data__):!m-!v}for(var n=this._groups,o=n.length,a=new Array(o),i=0;i<o;++i){for(var s=n[i],l=s.length,d=a[i]=new Array(l),h,p=0;p<l;++p)(h=s[p])&&(d[p]=h);d.sort(t)}return new oa(a,this._parents).order()}function kjt(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function xjt(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function wjt(){return Array.from(this)}function bjt(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],a=0,i=o.length;a<i;++a){var s=o[a];if(s)return s}return null}function Mjt(){let e=0;for(const t of this)++e;return e}function _jt(){return!this.node()}function Sjt(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var a=t[n],i=0,s=a.length,l;i<s;++i)(l=a[i])&&e.call(l,l.__data__,i,a);return this}function Cjt(e){return function(){this.removeAttribute(e)}}function Njt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ljt(e,t){return function(){this.setAttribute(e,t)}}function jjt(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ajt(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ejt(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Ijt(e,t){var n=A$(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Njt:Cjt:typeof t=="function"?n.local?Ejt:Ajt:n.local?jjt:Ljt)(n,t))}function Yse(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Tjt(e){return function(){this.style.removeProperty(e)}}function Rjt(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Pjt(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function $jt(e,t,n){return arguments.length>1?this.each((t==null?Tjt:typeof t=="function"?Pjt:Rjt)(e,t,n??"")):Qh(this.node(),e)}function Qh(e,t){return e.style.getPropertyValue(t)||Yse(e).getComputedStyle(e,null).getPropertyValue(t)}function Djt(e){return function(){delete this[e]}}function zjt(e,t){return function(){this[e]=t}}function Ojt(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function qjt(e,t){return arguments.length>1?this.each((t==null?Djt:typeof t=="function"?Ojt:zjt)(e,t)):this.node()[e]}function Wse(e){return e.trim().split(/^|\s+/)}function pF(e){return e.classList||new Kse(e)}function Kse(e){this._node=e,this._names=Wse(e.getAttribute("class")||"")}Kse.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Qse(e,t){for(var n=pF(e),o=-1,a=t.length;++o<a;)n.add(t[o])}function Jse(e,t){for(var n=pF(e),o=-1,a=t.length;++o<a;)n.remove(t[o])}function Hjt(e){return function(){Qse(this,e)}}function Vjt(e){return function(){Jse(this,e)}}function Bjt(e,t){return function(){(t.apply(this,arguments)?Qse:Jse)(this,e)}}function Fjt(e,t){var n=Wse(e+"");if(arguments.length<2){for(var o=pF(this.node()),a=-1,i=n.length;++a<i;)if(!o.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?Bjt:t?Hjt:Vjt)(n,t))}function Ujt(){this.textContent=""}function Gjt(e){return function(){this.textContent=e}}function Xjt(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Zjt(e){return arguments.length?this.each(e==null?Ujt:(typeof e=="function"?Xjt:Gjt)(e)):this.node().textContent}function Yjt(){this.innerHTML=""}function Wjt(e){return function(){this.innerHTML=e}}function Kjt(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Qjt(e){return arguments.length?this.each(e==null?Yjt:(typeof e=="function"?Kjt:Wjt)(e)):this.node().innerHTML}function Jjt(){this.nextSibling&&this.parentNode.appendChild(this)}function eAt(){return this.each(Jjt)}function tAt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function nAt(){return this.each(tAt)}function oAt(e){var t=typeof e=="function"?e:Fse(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function aAt(){return null}function rAt(e,t){var n=typeof e=="function"?e:Fse(e),o=t==null?aAt:typeof t=="function"?t:fF(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function iAt(){var e=this.parentNode;e&&e.removeChild(this)}function sAt(){return this.each(iAt)}function cAt(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function lAt(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function uAt(e){return this.select(e?lAt:cAt)}function dAt(e){return arguments.length?this.property("__data__",e):this.node().__data__}function hAt(e){return function(t){e.call(this,t,this.__data__)}}function fAt(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function pAt(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,a=t.length,i;n<a;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function yAt(e,t,n){return function(){var o=this.__on,a,i=hAt(t);if(o){for(var s=0,l=o.length;s<l;++s)if((a=o[s]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=i,a.options=n),a.value=t;return}}this.addEventListener(e.type,i,n),a={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(a):this.__on=[a]}}function mAt(e,t,n){var o=fAt(e+""),a,i=o.length,s;if(arguments.length<2){var l=this.node().__on;if(l){for(var d=0,h=l.length,p;d<h;++d)for(a=0,p=l[d];a<i;++a)if((s=o[a]).type===p.type&&s.name===p.name)return p.value}return}for(l=t?yAt:pAt,a=0;a<i;++a)this.each(l(o[a],t,n));return this}function ece(e,t,n){var o=Yse(e),a=o.CustomEvent;typeof a=="function"?a=new a(t,n):(a=o.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function gAt(e,t){return function(){return ece(this,e,t)}}function vAt(e,t){return function(){return ece(this,e,t.apply(this,arguments))}}function kAt(e,t){return this.each((typeof t=="function"?vAt:gAt)(e,t))}function*xAt(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],a=0,i=o.length,s;a<i;++a)(s=o[a])&&(yield s)}var tce=[null];function oa(e,t){this._groups=e,this._parents=t}function Rp(){return new oa([[document.documentElement]],tce)}function wAt(){return this}oa.prototype=Rp.prototype={constructor:oa,select:XLt,selectAll:KLt,selectChild:tjt,selectChildren:rjt,filter:ijt,data:hjt,enter:sjt,exit:pjt,join:yjt,merge:mjt,selection:wAt,order:gjt,sort:vjt,call:xjt,nodes:wjt,node:bjt,size:Mjt,empty:_jt,each:Sjt,attr:Ijt,style:$jt,property:qjt,classed:Fjt,text:Zjt,html:Qjt,raise:eAt,lower:nAt,append:oAt,insert:rAt,remove:sAt,clone:uAt,datum:dAt,on:mAt,dispatch:kAt,[Symbol.iterator]:xAt};function Ha(e){return typeof e=="string"?new oa([[document.querySelector(e)]],[document.documentElement]):new oa([[e]],tce)}function bAt(e){let t;for(;t=e.sourceEvent;)e=t;return e}function pr(e,t){if(e=bAt(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const MAt={passive:!1},W0={capture:!0,passive:!1};function QO(e){e.stopImmediatePropagation()}function Dh(e){e.preventDefault(),e.stopImmediatePropagation()}function nce(e){var t=e.document.documentElement,n=Ha(e).on("dragstart.drag",Dh,W0);"onselectstart"in t?n.on("selectstart.drag",Dh,W0):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function oce(e,t){var n=e.document.documentElement,o=Ha(e).on("dragstart.drag",null);t&&(o.on("click.drag",Dh,W0),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const fm=e=>()=>e;function OH(e,{sourceEvent:t,subject:n,target:o,identifier:a,active:i,x:s,y:l,dx:d,dy:h,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:p}})}OH.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function _At(e){return!e.ctrlKey&&!e.button}function SAt(){return this.parentNode}function CAt(e,t){return t??{x:e.x,y:e.y}}function NAt(){return navigator.maxTouchPoints||"ontouchstart"in this}function LAt(){var e=_At,t=SAt,n=CAt,o=NAt,a={},i=j$("start","drag","end"),s=0,l,d,h,p,m=0;function v(I){I.on("mousedown.drag",x).filter(o).on("touchstart.drag",C).on("touchmove.drag",_,MAt).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(I,R){if(!(p||!e.call(this,I,R))){var j=A(this,t.call(this,I,R),I,R,"mouse");j&&(Ha(I.view).on("mousemove.drag",M,W0).on("mouseup.drag",b,W0),nce(I.view),QO(I),h=!1,l=I.clientX,d=I.clientY,j("start",I))}}function M(I){if(Dh(I),!h){var R=I.clientX-l,j=I.clientY-d;h=R*R+j*j>m}a.mouse("drag",I)}function b(I){Ha(I.view).on("mousemove.drag mouseup.drag",null),oce(I.view,h),Dh(I),a.mouse("end",I)}function C(I,R){if(e.call(this,I,R)){var j=I.changedTouches,D=t.call(this,I,R),H=j.length,U,z;for(U=0;U<H;++U)(z=A(this,D,I,R,j[U].identifier,j[U]))&&(QO(I),z("start",I,j[U]))}}function _(I){var R=I.changedTouches,j=R.length,D,H;for(D=0;D<j;++D)(H=a[R[D].identifier])&&(Dh(I),H("drag",I,R[D]))}function N(I){var R=I.changedTouches,j=R.length,D,H;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),D=0;D<j;++D)(H=a[R[D].identifier])&&(QO(I),H("end",I,R[D]))}function A(I,R,j,D,H,U){var z=i.copy(),Z=pr(U||j,R),q,G,E;if((E=n.call(I,new OH("beforestart",{sourceEvent:j,target:v,identifier:H,active:s,x:Z[0],y:Z[1],dx:0,dy:0,dispatch:z}),D))!=null)return q=E.x-Z[0]||0,G=E.y-Z[1]||0,function O(P,X,W){var V=Z,L;switch(P){case"start":a[H]=O,L=s++;break;case"end":delete a[H],--s;case"drag":Z=pr(W||X,R),L=s;break}z.call(P,I,new OH(P,{sourceEvent:X,subject:E,target:v,identifier:H,active:L,x:Z[0]+q,y:Z[1]+G,dx:Z[0]-V[0],dy:Z[1]-V[1],dispatch:z}),D)}}return v.filter=function(I){return arguments.length?(e=typeof I=="function"?I:fm(!!I),v):e},v.container=function(I){return arguments.length?(t=typeof I=="function"?I:fm(I),v):t},v.subject=function(I){return arguments.length?(n=typeof I=="function"?I:fm(I),v):n},v.touchable=function(I){return arguments.length?(o=typeof I=="function"?I:fm(!!I),v):o},v.on=function(){var I=i.on.apply(i,arguments);return I===i?v:I},v.clickDistance=function(I){return arguments.length?(m=(I=+I)*I,v):Math.sqrt(m)},v}function yF(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ace(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Pp(){}var K0=.7,uP=1/K0,zh="\\s*([+-]?\\d+)\\s*",Q0="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Nr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",jAt=/^#([0-9a-f]{3,8})$/,AAt=new RegExp(`^rgb\\(${zh},${zh},${zh}\\)$`),EAt=new RegExp(`^rgb\\(${Nr},${Nr},${Nr}\\)$`),IAt=new RegExp(`^rgba\\(${zh},${zh},${zh},${Q0}\\)$`),TAt=new RegExp(`^rgba\\(${Nr},${Nr},${Nr},${Q0}\\)$`),RAt=new RegExp(`^hsl\\(${Q0},${Nr},${Nr}\\)$`),PAt=new RegExp(`^hsla\\(${Q0},${Nr},${Nr},${Q0}\\)$`),OK={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};yF(Pp,J0,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:qK,formatHex:qK,formatHex8:$At,formatHsl:DAt,formatRgb:HK,toString:HK});function qK(){return this.rgb().formatHex()}function $At(){return this.rgb().formatHex8()}function DAt(){return rce(this).formatHsl()}function HK(){return this.rgb().formatRgb()}function J0(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=jAt.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?VK(t):n===3?new Io(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?pm(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?pm(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=AAt.exec(e))?new Io(t[1],t[2],t[3],1):(t=EAt.exec(e))?new Io(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=IAt.exec(e))?pm(t[1],t[2],t[3],t[4]):(t=TAt.exec(e))?pm(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=RAt.exec(e))?UK(t[1],t[2]/100,t[3]/100,1):(t=PAt.exec(e))?UK(t[1],t[2]/100,t[3]/100,t[4]):OK.hasOwnProperty(e)?VK(OK[e]):e==="transparent"?new Io(NaN,NaN,NaN,0):null}function VK(e){return new Io(e>>16&255,e>>8&255,e&255,1)}function pm(e,t,n,o){return o<=0&&(e=t=n=NaN),new Io(e,t,n,o)}function zAt(e){return e instanceof Pp||(e=J0(e)),e?(e=e.rgb(),new Io(e.r,e.g,e.b,e.opacity)):new Io}function qH(e,t,n,o){return arguments.length===1?zAt(e):new Io(e,t,n,o??1)}function Io(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}yF(Io,qH,ace(Pp,{brighter(e){return e=e==null?uP:Math.pow(uP,e),new Io(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?K0:Math.pow(K0,e),new Io(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Io(Jd(this.r),Jd(this.g),Jd(this.b),dP(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:BK,formatHex:BK,formatHex8:OAt,formatRgb:FK,toString:FK}));function BK(){return`#${zd(this.r)}${zd(this.g)}${zd(this.b)}`}function OAt(){return`#${zd(this.r)}${zd(this.g)}${zd(this.b)}${zd((isNaN(this.opacity)?1:this.opacity)*255)}`}function FK(){const e=dP(this.opacity);return`${e===1?"rgb(":"rgba("}${Jd(this.r)}, ${Jd(this.g)}, ${Jd(this.b)}${e===1?")":`, ${e})`}`}function dP(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Jd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function zd(e){return e=Jd(e),(e<16?"0":"")+e.toString(16)}function UK(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Va(e,t,n,o)}function rce(e){if(e instanceof Va)return new Va(e.h,e.s,e.l,e.opacity);if(e instanceof Pp||(e=J0(e)),!e)return new Va;if(e instanceof Va)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,a=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,l=i-a,d=(i+a)/2;return l?(t===i?s=(n-o)/l+(n<o)*6:n===i?s=(o-t)/l+2:s=(t-n)/l+4,l/=d<.5?i+a:2-i-a,s*=60):l=d>0&&d<1?0:s,new Va(s,l,d,e.opacity)}function qAt(e,t,n,o){return arguments.length===1?rce(e):new Va(e,t,n,o??1)}function Va(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}yF(Va,qAt,ace(Pp,{brighter(e){return e=e==null?uP:Math.pow(uP,e),new Va(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?K0:Math.pow(K0,e),new Va(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,a=2*n-o;return new Io(JO(e>=240?e-240:e+120,a,o),JO(e,a,o),JO(e<120?e+240:e-120,a,o),this.opacity)},clamp(){return new Va(GK(this.h),ym(this.s),ym(this.l),dP(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=dP(this.opacity);return`${e===1?"hsl(":"hsla("}${GK(this.h)}, ${ym(this.s)*100}%, ${ym(this.l)*100}%${e===1?")":`, ${e})`}`}}));function GK(e){return e=(e||0)%360,e<0?e+360:e}function ym(e){return Math.max(0,Math.min(1,e||0))}function JO(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const ice=e=>()=>e;function HAt(e,t){return function(n){return e+n*t}}function VAt(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function BAt(e){return(e=+e)==1?sce:function(t,n){return n-t?VAt(t,n,e):ice(isNaN(t)?n:t)}}function sce(e,t){var n=t-e;return n?HAt(e,n):ice(isNaN(e)?t:e)}const XK=function e(t){var n=BAt(t);function o(a,i){var s=n((a=qH(a)).r,(i=qH(i)).r),l=n(a.g,i.g),d=n(a.b,i.b),h=sce(a.opacity,i.opacity);return function(p){return a.r=s(p),a.g=l(p),a.b=d(p),a.opacity=h(p),a+""}}return o.gamma=e,o}(1);function os(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var HH=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,eq=new RegExp(HH.source,"g");function FAt(e){return function(){return e}}function UAt(e){return function(t){return e(t)+""}}function GAt(e,t){var n=HH.lastIndex=eq.lastIndex=0,o,a,i,s=-1,l=[],d=[];for(e=e+"",t=t+"";(o=HH.exec(e))&&(a=eq.exec(t));)(i=a.index)>n&&(i=t.slice(n,i),l[s]?l[s]+=i:l[++s]=i),(o=o[0])===(a=a[0])?l[s]?l[s]+=a:l[++s]=a:(l[++s]=null,d.push({i:s,x:os(o,a)})),n=eq.lastIndex;return n<t.length&&(i=t.slice(n),l[s]?l[s]+=i:l[++s]=i),l.length<2?d[0]?UAt(d[0].x):FAt(t):(t=d.length,function(h){for(var p=0,m;p<t;++p)l[(m=d[p]).i]=m.x(h);return l.join("")})}var ZK=180/Math.PI,VH={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function cce(e,t,n,o,a,i){var s,l,d;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(d=e*n+t*o)&&(n-=e*d,o-=t*d),(l=Math.sqrt(n*n+o*o))&&(n/=l,o/=l,d/=l),e*o<t*n&&(e=-e,t=-t,d=-d,s=-s),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*ZK,skewX:Math.atan(d)*ZK,scaleX:s,scaleY:l}}var mm;function XAt(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?VH:cce(t.a,t.b,t.c,t.d,t.e,t.f)}function ZAt(e){return e==null||(mm||(mm=document.createElementNS("http://www.w3.org/2000/svg","g")),mm.setAttribute("transform",e),!(e=mm.transform.baseVal.consolidate()))?VH:(e=e.matrix,cce(e.a,e.b,e.c,e.d,e.e,e.f))}function lce(e,t,n,o){function a(h){return h.length?h.pop()+" ":""}function i(h,p,m,v,x,M){if(h!==m||p!==v){var b=x.push("translate(",null,t,null,n);M.push({i:b-4,x:os(h,m)},{i:b-2,x:os(p,v)})}else(m||v)&&x.push("translate("+m+t+v+n)}function s(h,p,m,v){h!==p?(h-p>180?p+=360:p-h>180&&(h+=360),v.push({i:m.push(a(m)+"rotate(",null,o)-2,x:os(h,p)})):p&&m.push(a(m)+"rotate("+p+o)}function l(h,p,m,v){h!==p?v.push({i:m.push(a(m)+"skewX(",null,o)-2,x:os(h,p)}):p&&m.push(a(m)+"skewX("+p+o)}function d(h,p,m,v,x,M){if(h!==m||p!==v){var b=x.push(a(x)+"scale(",null,",",null,")");M.push({i:b-4,x:os(h,m)},{i:b-2,x:os(p,v)})}else(m!==1||v!==1)&&x.push(a(x)+"scale("+m+","+v+")")}return function(h,p){var m=[],v=[];return h=e(h),p=e(p),i(h.translateX,h.translateY,p.translateX,p.translateY,m,v),s(h.rotate,p.rotate,m,v),l(h.skewX,p.skewX,m,v),d(h.scaleX,h.scaleY,p.scaleX,p.scaleY,m,v),h=p=null,function(x){for(var M=-1,b=v.length,C;++M<b;)m[(C=v[M]).i]=C.x(x);return m.join("")}}}var YAt=lce(XAt,"px, ","px)","deg)"),WAt=lce(ZAt,", ",")",")"),KAt=1e-12;function YK(e){return((e=Math.exp(e))+1/e)/2}function QAt(e){return((e=Math.exp(e))-1/e)/2}function JAt(e){return((e=Math.exp(2*e))-1)/(e+1)}const eEt=function e(t,n,o){function a(i,s){var l=i[0],d=i[1],h=i[2],p=s[0],m=s[1],v=s[2],x=p-l,M=m-d,b=x*x+M*M,C,_;if(b<KAt)_=Math.log(v/h)/t,C=function(D){return[l+D*x,d+D*M,h*Math.exp(t*D*_)]};else{var N=Math.sqrt(b),A=(v*v-h*h+o*b)/(2*h*n*N),I=(v*v-h*h-o*b)/(2*v*n*N),R=Math.log(Math.sqrt(A*A+1)-A),j=Math.log(Math.sqrt(I*I+1)-I);_=(j-R)/t,C=function(D){var H=D*_,U=YK(R),z=h/(n*N)*(U*JAt(t*H+R)-QAt(R));return[l+z*x,d+z*M,h*U/YK(t*H+R)]}}return C.duration=_*1e3*t/Math.SQRT2,C}return a.rho=function(i){var s=Math.max(.001,+i),l=s*s,d=l*l;return e(s,l,d)},a}(Math.SQRT2,2,4);var Jh=0,Hf=0,Sf=0,uce=1e3,hP,Vf,fP=0,c1=0,E$=0,ep=typeof performance=="object"&&performance.now?performance:Date,dce=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function mF(){return c1||(dce(tEt),c1=ep.now()+E$)}function tEt(){c1=0}function pP(){this._call=this._time=this._next=null}pP.prototype=hce.prototype={constructor:pP,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?mF():+n)+(t==null?0:+t),!this._next&&Vf!==this&&(Vf?Vf._next=this:hP=this,Vf=this),this._call=e,this._time=n,BH()},stop:function(){this._call&&(this._call=null,this._time=1/0,BH())}};function hce(e,t,n){var o=new pP;return o.restart(e,t,n),o}function nEt(){mF(),++Jh;for(var e=hP,t;e;)(t=c1-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Jh}function WK(){c1=(fP=ep.now())+E$,Jh=Hf=0;try{nEt()}finally{Jh=0,aEt(),c1=0}}function oEt(){var e=ep.now(),t=e-fP;t>uce&&(E$-=t,fP=e)}function aEt(){for(var e,t=hP,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:hP=n);Vf=e,BH(o)}function BH(e){if(!Jh){Hf&&(Hf=clearTimeout(Hf));var t=e-c1;t>24?(e<1/0&&(Hf=setTimeout(WK,e-ep.now()-E$)),Sf&&(Sf=clearInterval(Sf))):(Sf||(fP=ep.now(),Sf=setInterval(oEt,uce)),Jh=1,dce(WK))}}function KK(e,t,n){var o=new pP;return t=t==null?0:+t,o.restart(a=>{o.stop(),e(a+t)},t,n),o}var rEt=j$("start","end","cancel","interrupt"),iEt=[],fce=0,QK=1,FH=2,IR=3,JK=4,UH=5,TR=6;function I$(e,t,n,o,a,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;sEt(e,n,{name:t,index:o,group:a,on:rEt,tween:iEt,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:fce})}function gF(e,t){var n=Ka(e,t);if(n.state>fce)throw new Error("too late; already scheduled");return n}function Rr(e,t){var n=Ka(e,t);if(n.state>IR)throw new Error("too late; already running");return n}function Ka(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function sEt(e,t,n){var o=e.__transition,a;o[t]=n,n.timer=hce(i,0,n.time);function i(h){n.state=QK,n.timer.restart(s,n.delay,n.time),n.delay<=h&&s(h-n.delay)}function s(h){var p,m,v,x;if(n.state!==QK)return d();for(p in o)if(x=o[p],x.name===n.name){if(x.state===IR)return KK(s);x.state===JK?(x.state=TR,x.timer.stop(),x.on.call("interrupt",e,e.__data__,x.index,x.group),delete o[p]):+p<t&&(x.state=TR,x.timer.stop(),x.on.call("cancel",e,e.__data__,x.index,x.group),delete o[p])}if(KK(function(){n.state===IR&&(n.state=JK,n.timer.restart(l,n.delay,n.time),l(h))}),n.state=FH,n.on.call("start",e,e.__data__,n.index,n.group),n.state===FH){for(n.state=IR,a=new Array(v=n.tween.length),p=0,m=-1;p<v;++p)(x=n.tween[p].value.call(e,e.__data__,n.index,n.group))&&(a[++m]=x);a.length=m+1}}function l(h){for(var p=h<n.duration?n.ease.call(null,h/n.duration):(n.timer.restart(d),n.state=UH,1),m=-1,v=a.length;++m<v;)a[m].call(e,p);n.state===UH&&(n.on.call("end",e,e.__data__,n.index,n.group),d())}function d(){n.state=TR,n.timer.stop(),delete o[t];for(var h in o)return;delete e.__transition}}function RR(e,t){var n=e.__transition,o,a,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}a=o.state>FH&&o.state<UH,o.state=TR,o.timer.stop(),o.on.call(a?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function cEt(e){return this.each(function(){RR(this,e)})}function lEt(e,t){var n,o;return function(){var a=Rr(this,e),i=a.tween;if(i!==n){o=n=i;for(var s=0,l=o.length;s<l;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}a.tween=o}}function uEt(e,t,n){var o,a;if(typeof n!="function")throw new Error;return function(){var i=Rr(this,e),s=i.tween;if(s!==o){a=(o=s).slice();for(var l={name:t,value:n},d=0,h=a.length;d<h;++d)if(a[d].name===t){a[d]=l;break}d===h&&a.push(l)}i.tween=a}}function dEt(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=Ka(this.node(),n).tween,a=0,i=o.length,s;a<i;++a)if((s=o[a]).name===e)return s.value;return null}return this.each((t==null?lEt:uEt)(n,e,t))}function vF(e,t,n){var o=e._id;return e.each(function(){var a=Rr(this,o);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return Ka(a,o).value[t]}}function pce(e,t){var n;return(typeof t=="number"?os:t instanceof J0?XK:(n=J0(t))?(t=n,XK):GAt)(e,t)}function hEt(e){return function(){this.removeAttribute(e)}}function fEt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function pEt(e,t,n){var o,a=n+"",i;return function(){var s=this.getAttribute(e);return s===a?null:s===o?i:i=t(o=s,n)}}function yEt(e,t,n){var o,a=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===a?null:s===o?i:i=t(o=s,n)}}function mEt(e,t,n){var o,a,i;return function(){var s,l=n(this),d;return l==null?void this.removeAttribute(e):(s=this.getAttribute(e),d=l+"",s===d?null:s===o&&d===a?i:(a=d,i=t(o=s,l)))}}function gEt(e,t,n){var o,a,i;return function(){var s,l=n(this),d;return l==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),d=l+"",s===d?null:s===o&&d===a?i:(a=d,i=t(o=s,l)))}}function vEt(e,t){var n=A$(e),o=n==="transform"?WAt:pce;return this.attrTween(e,typeof t=="function"?(n.local?gEt:mEt)(n,o,vF(this,"attr."+e,t)):t==null?(n.local?fEt:hEt)(n):(n.local?yEt:pEt)(n,o,t))}function kEt(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function xEt(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function wEt(e,t){var n,o;function a(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&xEt(e,i)),n}return a._value=t,a}function bEt(e,t){var n,o;function a(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&kEt(e,i)),n}return a._value=t,a}function MEt(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=A$(e);return this.tween(n,(o.local?wEt:bEt)(o,t))}function _Et(e,t){return function(){gF(this,e).delay=+t.apply(this,arguments)}}function SEt(e,t){return t=+t,function(){gF(this,e).delay=t}}function CEt(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_Et:SEt)(t,e)):Ka(this.node(),t).delay}function NEt(e,t){return function(){Rr(this,e).duration=+t.apply(this,arguments)}}function LEt(e,t){return t=+t,function(){Rr(this,e).duration=t}}function jEt(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?NEt:LEt)(t,e)):Ka(this.node(),t).duration}function AEt(e,t){if(typeof t!="function")throw new Error;return function(){Rr(this,e).ease=t}}function EEt(e){var t=this._id;return arguments.length?this.each(AEt(t,e)):Ka(this.node(),t).ease}function IEt(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Rr(this,e).ease=n}}function TEt(e){if(typeof e!="function")throw new Error;return this.each(IEt(this._id,e))}function REt(e){typeof e!="function"&&(e=Gse(e));for(var t=this._groups,n=t.length,o=new Array(n),a=0;a<n;++a)for(var i=t[a],s=i.length,l=o[a]=[],d,h=0;h<s;++h)(d=i[h])&&e.call(d,d.__data__,h,i)&&l.push(d);return new yi(o,this._parents,this._name,this._id)}function PEt(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,a=n.length,i=Math.min(o,a),s=new Array(o),l=0;l<i;++l)for(var d=t[l],h=n[l],p=d.length,m=s[l]=new Array(p),v,x=0;x<p;++x)(v=d[x]||h[x])&&(m[x]=v);for(;l<o;++l)s[l]=t[l];return new yi(s,this._parents,this._name,this._id)}function $Et(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function DEt(e,t,n){var o,a,i=$Et(t)?gF:Rr;return function(){var s=i(this,e),l=s.on;l!==o&&(a=(o=l).copy()).on(t,n),s.on=a}}function zEt(e,t){var n=this._id;return arguments.length<2?Ka(this.node(),n).on.on(e):this.each(DEt(n,e,t))}function OEt(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function qEt(){return this.on("end.remove",OEt(this._id))}function HEt(e){var t=this._name,n=this._id;typeof e!="function"&&(e=fF(e));for(var o=this._groups,a=o.length,i=new Array(a),s=0;s<a;++s)for(var l=o[s],d=l.length,h=i[s]=new Array(d),p,m,v=0;v<d;++v)(p=l[v])&&(m=e.call(p,p.__data__,v,l))&&("__data__"in p&&(m.__data__=p.__data__),h[v]=m,I$(h[v],t,n,v,h,Ka(p,n)));return new yi(i,this._parents,t,n)}function VEt(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Use(e));for(var o=this._groups,a=o.length,i=[],s=[],l=0;l<a;++l)for(var d=o[l],h=d.length,p,m=0;m<h;++m)if(p=d[m]){for(var v=e.call(p,p.__data__,m,d),x,M=Ka(p,n),b=0,C=v.length;b<C;++b)(x=v[b])&&I$(x,t,n,b,v,M);i.push(v),s.push(p)}return new yi(i,s,t,n)}var BEt=Rp.prototype.constructor;function FEt(){return new BEt(this._groups,this._parents)}function UEt(e,t){var n,o,a;return function(){var i=Qh(this,e),s=(this.style.removeProperty(e),Qh(this,e));return i===s?null:i===n&&s===o?a:a=t(n=i,o=s)}}function yce(e){return function(){this.style.removeProperty(e)}}function GEt(e,t,n){var o,a=n+"",i;return function(){var s=Qh(this,e);return s===a?null:s===o?i:i=t(o=s,n)}}function XEt(e,t,n){var o,a,i;return function(){var s=Qh(this,e),l=n(this),d=l+"";return l==null&&(d=l=(this.style.removeProperty(e),Qh(this,e))),s===d?null:s===o&&d===a?i:(a=d,i=t(o=s,l))}}function ZEt(e,t){var n,o,a,i="style."+t,s="end."+i,l;return function(){var d=Rr(this,e),h=d.on,p=d.value[i]==null?l||(l=yce(t)):void 0;(h!==n||a!==p)&&(o=(n=h).copy()).on(s,a=p),d.on=o}}function YEt(e,t,n){var o=(e+="")=="transform"?YAt:pce;return t==null?this.styleTween(e,UEt(e,o)).on("end.style."+e,yce(e)):typeof t=="function"?this.styleTween(e,XEt(e,o,vF(this,"style."+e,t))).each(ZEt(this._id,e)):this.styleTween(e,GEt(e,o,t),n).on("end.style."+e,null)}function WEt(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function KEt(e,t,n){var o,a;function i(){var s=t.apply(this,arguments);return s!==a&&(o=(a=s)&&WEt(e,s,n)),o}return i._value=t,i}function QEt(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,KEt(e,t,n??""))}function JEt(e){return function(){this.textContent=e}}function eIt(e){return function(){var t=e(this);this.textContent=t??""}}function tIt(e){return this.tween("text",typeof e=="function"?eIt(vF(this,"text",e)):JEt(e==null?"":e+""))}function nIt(e){return function(t){this.textContent=e.call(this,t)}}function oIt(e){var t,n;function o(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&nIt(a)),t}return o._value=e,o}function aIt(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,oIt(e))}function rIt(){for(var e=this._name,t=this._id,n=mce(),o=this._groups,a=o.length,i=0;i<a;++i)for(var s=o[i],l=s.length,d,h=0;h<l;++h)if(d=s[h]){var p=Ka(d,t);I$(d,e,n,h,s,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new yi(o,this._parents,e,n)}function iIt(){var e,t,n=this,o=n._id,a=n.size();return new Promise(function(i,s){var l={value:s},d={value:function(){--a===0&&i()}};n.each(function(){var h=Rr(this,o),p=h.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(d)),h.on=t}),a===0&&i()})}var sIt=0;function yi(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function mce(){return++sIt}var Jr=Rp.prototype;yi.prototype={constructor:yi,select:HEt,selectAll:VEt,selectChild:Jr.selectChild,selectChildren:Jr.selectChildren,filter:REt,merge:PEt,selection:FEt,transition:rIt,call:Jr.call,nodes:Jr.nodes,node:Jr.node,size:Jr.size,empty:Jr.empty,each:Jr.each,on:zEt,attr:vEt,attrTween:MEt,style:YEt,styleTween:QEt,text:tIt,textTween:aIt,remove:qEt,tween:dEt,delay:CEt,duration:jEt,ease:EEt,easeVarying:TEt,end:iIt,[Symbol.iterator]:Jr[Symbol.iterator]};function cIt(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var lIt={time:null,delay:0,duration:250,ease:cIt};function uIt(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function dIt(e){var t,n;e instanceof yi?(t=e._id,e=e._name):(t=mce(),(n=lIt).time=mF(),e=e==null?null:e+"");for(var o=this._groups,a=o.length,i=0;i<a;++i)for(var s=o[i],l=s.length,d,h=0;h<l;++h)(d=s[h])&&I$(d,e,t,h,s,n||uIt(d,t));return new yi(o,this._parents,e,t)}Rp.prototype.interrupt=cEt;Rp.prototype.transition=dIt;const gm=e=>()=>e;function hIt(e,{sourceEvent:t,target:n,transform:o,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:a}})}function ai(e,t,n){this.k=e,this.x=t,this.y=n}ai.prototype={constructor:ai,scale:function(e){return e===1?this:new ai(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ai(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ms=new ai(1,0,0);ai.prototype;function tq(e){e.stopImmediatePropagation()}function Cf(e){e.preventDefault(),e.stopImmediatePropagation()}function fIt(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function pIt(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function eQ(){return this.__zoom||Ms}function yIt(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function mIt(){return navigator.maxTouchPoints||"ontouchstart"in this}function gIt(e,t,n){var o=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function vIt(){var e=fIt,t=pIt,n=gIt,o=yIt,a=mIt,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],l=250,d=eEt,h=j$("start","zoom","end"),p,m,v,x=500,M=150,b=0,C=10;function _(E){E.property("__zoom",eQ).on("wheel.zoom",H,{passive:!1}).on("mousedown.zoom",U).on("dblclick.zoom",z).filter(a).on("touchstart.zoom",Z).on("touchmove.zoom",q).on("touchend.zoom touchcancel.zoom",G).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(E,O,P,X){var W=E.selection?E.selection():E;W.property("__zoom",eQ),E!==W?R(E,O,P,X):W.interrupt().each(function(){j(this,arguments).event(X).start().zoom(null,typeof O=="function"?O.apply(this,arguments):O).end()})},_.scaleBy=function(E,O,P,X){_.scaleTo(E,function(){var W=this.__zoom.k,V=typeof O=="function"?O.apply(this,arguments):O;return W*V},P,X)},_.scaleTo=function(E,O,P,X){_.transform(E,function(){var W=t.apply(this,arguments),V=this.__zoom,L=P==null?I(W):typeof P=="function"?P.apply(this,arguments):P,Y=V.invert(L),F=typeof O=="function"?O.apply(this,arguments):O;return n(A(N(V,F),L,Y),W,s)},P,X)},_.translateBy=function(E,O,P,X){_.transform(E,function(){return n(this.__zoom.translate(typeof O=="function"?O.apply(this,arguments):O,typeof P=="function"?P.apply(this,arguments):P),t.apply(this,arguments),s)},null,X)},_.translateTo=function(E,O,P,X,W){_.transform(E,function(){var V=t.apply(this,arguments),L=this.__zoom,Y=X==null?I(V):typeof X=="function"?X.apply(this,arguments):X;return n(Ms.translate(Y[0],Y[1]).scale(L.k).translate(typeof O=="function"?-O.apply(this,arguments):-O,typeof P=="function"?-P.apply(this,arguments):-P),V,s)},X,W)};function N(E,O){return O=Math.max(i[0],Math.min(i[1],O)),O===E.k?E:new ai(O,E.x,E.y)}function A(E,O,P){var X=O[0]-P[0]*E.k,W=O[1]-P[1]*E.k;return X===E.x&&W===E.y?E:new ai(E.k,X,W)}function I(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function R(E,O,P,X){E.on("start.zoom",function(){j(this,arguments).event(X).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event(X).end()}).tween("zoom",function(){var W=this,V=arguments,L=j(W,V).event(X),Y=t.apply(W,V),F=P==null?I(Y):typeof P=="function"?P.apply(W,V):P,T=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),K=W.__zoom,Q=typeof O=="function"?O.apply(W,V):O,ne=d(K.invert(F).concat(T/K.k),Q.invert(F).concat(T/Q.k));return function(te){if(te===1)te=Q;else{var ce=ne(te),me=T/ce[2];te=new ai(me,F[0]-ce[0]*me,F[1]-ce[1]*me)}L.zoom(null,te)}})}function j(E,O,P){return!P&&E.__zooming||new D(E,O)}function D(E,O){this.that=E,this.args=O,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,O),this.taps=0}D.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,O){return this.mouse&&E!=="mouse"&&(this.mouse[1]=O.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=O.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=O.invert(this.touch1[0])),this.that.__zoom=O,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var O=Ha(this.that).datum();h.call(E,this.that,new hIt(E,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:h}),O)}};function H(E,...O){if(!e.apply(this,arguments))return;var P=j(this,O).event(E),X=this.__zoom,W=Math.max(i[0],Math.min(i[1],X.k*Math.pow(2,o.apply(this,arguments)))),V=pr(E);if(P.wheel)(P.mouse[0][0]!==V[0]||P.mouse[0][1]!==V[1])&&(P.mouse[1]=X.invert(P.mouse[0]=V)),clearTimeout(P.wheel);else{if(X.k===W)return;P.mouse=[V,X.invert(V)],RR(this),P.start()}Cf(E),P.wheel=setTimeout(L,M),P.zoom("mouse",n(A(N(X,W),P.mouse[0],P.mouse[1]),P.extent,s));function L(){P.wheel=null,P.end()}}function U(E,...O){if(v||!e.apply(this,arguments))return;var P=E.currentTarget,X=j(this,O,!0).event(E),W=Ha(E.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",T,!0),V=pr(E,P),L=E.clientX,Y=E.clientY;nce(E.view),tq(E),X.mouse=[V,this.__zoom.invert(V)],RR(this),X.start();function F(K){if(Cf(K),!X.moved){var Q=K.clientX-L,ne=K.clientY-Y;X.moved=Q*Q+ne*ne>b}X.event(K).zoom("mouse",n(A(X.that.__zoom,X.mouse[0]=pr(K,P),X.mouse[1]),X.extent,s))}function T(K){W.on("mousemove.zoom mouseup.zoom",null),oce(K.view,X.moved),Cf(K),X.event(K).end()}}function z(E,...O){if(e.apply(this,arguments)){var P=this.__zoom,X=pr(E.changedTouches?E.changedTouches[0]:E,this),W=P.invert(X),V=P.k*(E.shiftKey?.5:2),L=n(A(N(P,V),X,W),t.apply(this,O),s);Cf(E),l>0?Ha(this).transition().duration(l).call(R,L,X,E):Ha(this).call(_.transform,L,X,E)}}function Z(E,...O){if(e.apply(this,arguments)){var P=E.touches,X=P.length,W=j(this,O,E.changedTouches.length===X).event(E),V,L,Y,F;for(tq(E),L=0;L<X;++L)Y=P[L],F=pr(Y,this),F=[F,this.__zoom.invert(F),Y.identifier],W.touch0?!W.touch1&&W.touch0[2]!==F[2]&&(W.touch1=F,W.taps=0):(W.touch0=F,V=!0,W.taps=1+!!p);p&&(p=clearTimeout(p)),V&&(W.taps<2&&(m=F[0],p=setTimeout(function(){p=null},x)),RR(this),W.start())}}function q(E,...O){if(this.__zooming){var P=j(this,O).event(E),X=E.changedTouches,W=X.length,V,L,Y,F;for(Cf(E),V=0;V<W;++V)L=X[V],Y=pr(L,this),P.touch0&&P.touch0[2]===L.identifier?P.touch0[0]=Y:P.touch1&&P.touch1[2]===L.identifier&&(P.touch1[0]=Y);if(L=P.that.__zoom,P.touch1){var T=P.touch0[0],K=P.touch0[1],Q=P.touch1[0],ne=P.touch1[1],te=(te=Q[0]-T[0])*te+(te=Q[1]-T[1])*te,ce=(ce=ne[0]-K[0])*ce+(ce=ne[1]-K[1])*ce;L=N(L,Math.sqrt(te/ce)),Y=[(T[0]+Q[0])/2,(T[1]+Q[1])/2],F=[(K[0]+ne[0])/2,(K[1]+ne[1])/2]}else if(P.touch0)Y=P.touch0[0],F=P.touch0[1];else return;P.zoom("touch",n(A(L,Y,F),P.extent,s))}}function G(E,...O){if(this.__zooming){var P=j(this,O).event(E),X=E.changedTouches,W=X.length,V,L;for(tq(E),v&&clearTimeout(v),v=setTimeout(function(){v=null},x),V=0;V<W;++V)L=X[V],P.touch0&&P.touch0[2]===L.identifier?delete P.touch0:P.touch1&&P.touch1[2]===L.identifier&&delete P.touch1;if(P.touch1&&!P.touch0&&(P.touch0=P.touch1,delete P.touch1),P.touch0)P.touch0[1]=this.__zoom.invert(P.touch0[0]);else if(P.end(),P.taps===2&&(L=pr(L,this),Math.hypot(m[0]-L[0],m[1]-L[1])<C)){var Y=Ha(this).on("dblclick.zoom");Y&&Y.apply(this,arguments)}}}return _.wheelDelta=function(E){return arguments.length?(o=typeof E=="function"?E:gm(+E),_):o},_.filter=function(E){return arguments.length?(e=typeof E=="function"?E:gm(!!E),_):e},_.touchable=function(E){return arguments.length?(a=typeof E=="function"?E:gm(!!E),_):a},_.extent=function(E){return arguments.length?(t=typeof E=="function"?E:gm([[+E[0][0],+E[0][1]],[+E[1][0],+E[1][1]]]),_):t},_.scaleExtent=function(E){return arguments.length?(i[0]=+E[0],i[1]=+E[1],_):[i[0],i[1]]},_.translateExtent=function(E){return arguments.length?(s[0][0]=+E[0][0],s[1][0]=+E[1][0],s[0][1]=+E[0][1],s[1][1]=+E[1][1],_):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},_.constrain=function(E){return arguments.length?(n=E,_):n},_.duration=function(E){return arguments.length?(l=+E,_):l},_.interpolate=function(E){return arguments.length?(d=E,_):d},_.on=function(){var E=h.on.apply(h,arguments);return E===h?_:E},_.clickDistance=function(E){return arguments.length?(b=(E=+E)*E,_):Math.sqrt(b)},_.tapDistance=function(E){return arguments.length?(C=+E,_):C},_}const T$=k.createContext(null),kIt=T$.Provider,mi={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},gce=mi.error001();function un(e,t){const n=k.useContext(T$);if(n===null)throw new Error(gce);return Bse(n,e,t)}const Jn=()=>{const e=k.useContext(T$);if(e===null)throw new Error(gce);return k.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},xIt=e=>e.userSelectionActive?"none":"all";function vce({position:e,children:t,className:n,style:o,...a}){const i=un(xIt),s=`${e}`.split("-");return le.createElement("div",{className:ko(["react-flow__panel",n,...s]),style:{...o,pointerEvents:i},...a},t)}function wIt({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:le.createElement(vce,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},le.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const bIt=({x:e,y:t,label:n,labelStyle:o={},labelShowBg:a=!0,labelBgStyle:i={},labelBgPadding:s=[2,4],labelBgBorderRadius:l=2,children:d,className:h,...p})=>{const m=k.useRef(null),[v,x]=k.useState({x:0,y:0,width:0,height:0}),M=ko(["react-flow__edge-textwrapper",h]);return k.useEffect(()=>{if(m.current){const b=m.current.getBBox();x({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),typeof n>"u"||!n?null:le.createElement("g",{transform:`translate(${e-v.width/2} ${t-v.height/2})`,className:M,visibility:v.width?"visible":"hidden",...p},a&&le.createElement("rect",{width:v.width+2*s[0],x:-s[0],y:-s[1],height:v.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),le.createElement("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:m,style:o},n),d)};var MIt=k.memo(bIt);const kF=e=>({width:e.offsetWidth,height:e.offsetHeight}),e2=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),xF=(e={x:0,y:0},t)=>({x:e2(e.x,t[0][0],t[1][0]),y:e2(e.y,t[0][1],t[1][1])}),tQ=(e,t,n)=>e<t?e2(Math.abs(e-t),1,50)/50:e>n?-e2(Math.abs(e-n),1,50)/50:0,kce=(e,t)=>{const n=tQ(e.x,35,t.width-35)*20,o=tQ(e.y,35,t.height-35)*20;return[n,o]},xce=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},_It=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),wF=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),SIt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),nQ=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),GH=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},CIt=e=>xa(e.width)&&xa(e.height)&&xa(e.x)&&xa(e.y),xa=e=>!isNaN(e)&&isFinite(e),vn=Symbol.for("internals"),wce=["Enter"," ","Escape"],NIt=(e,t)=>{},LIt=e=>"nativeEvent"in e;function XH(e){var a,i;const t=LIt(e)?e.nativeEvent:e,n=((i=(a=t.composedPath)==null?void 0:a.call(t))==null?void 0:i[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const bce=e=>"clientX"in e,_s=(e,t)=>{var i,s;const n=bce(e),o=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,a=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:o-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},yP=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},$p=({id:e,path:t,labelX:n,labelY:o,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:m,markerStart:v,interactionWidth:x=20})=>le.createElement(le.Fragment,null,le.createElement("path",{id:e,style:p,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:v}),x&&le.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:x,className:"react-flow__edge-interaction"}),a&&xa(n)&&xa(o)?le.createElement(MIt,{x:n,y:o,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h}):null);$p.displayName="BaseEdge";function Nf(e,t,n){return n===void 0?n:o=>{const a=t().edges.find(i=>i.id===e);a&&n(o,{...a})}}function Mce({sourceX:e,sourceY:t,targetX:n,targetY:o}){const a=Math.abs(n-e)/2,i=n<e?n+a:n-a,s=Math.abs(o-t)/2,l=o<t?o+s:o-s;return[i,l,a,s]}function _ce({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:a,sourceControlY:i,targetControlX:s,targetControlY:l}){const d=e*.125+a*.375+s*.375+n*.125,h=t*.125+i*.375+l*.375+o*.125,p=Math.abs(d-e),m=Math.abs(h-t);return[d,h,p,m]}var l1;(function(e){e.Strict="strict",e.Loose="loose"})(l1||(l1={}));var Od;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Od||(Od={}));var tp;(function(e){e.Partial="partial",e.Full="full"})(tp||(tp={}));var cs;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(cs||(cs={}));var mP;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(mP||(mP={}));var Ye;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ye||(Ye={}));function oQ({pos:e,x1:t,y1:n,x2:o,y2:a}){return e===Ye.Left||e===Ye.Right?[.5*(t+o),n]:[t,.5*(n+a)]}function Sce({sourceX:e,sourceY:t,sourcePosition:n=Ye.Bottom,targetX:o,targetY:a,targetPosition:i=Ye.Top}){const[s,l]=oQ({pos:n,x1:e,y1:t,x2:o,y2:a}),[d,h]=oQ({pos:i,x1:o,y1:a,x2:e,y2:t}),[p,m,v,x]=_ce({sourceX:e,sourceY:t,targetX:o,targetY:a,sourceControlX:s,sourceControlY:l,targetControlX:d,targetControlY:h});return[`M${e},${t} C${s},${l} ${d},${h} ${o},${a}`,p,m,v,x]}const bF=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:o,sourcePosition:a=Ye.Bottom,targetPosition:i=Ye.Top,label:s,labelStyle:l,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:v,markerEnd:x,markerStart:M,interactionWidth:b})=>{const[C,_,N]=Sce({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:o,targetPosition:i});return le.createElement($p,{path:C,labelX:_,labelY:N,label:s,labelStyle:l,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:v,markerEnd:x,markerStart:M,interactionWidth:b})});bF.displayName="SimpleBezierEdge";const aQ={[Ye.Left]:{x:-1,y:0},[Ye.Right]:{x:1,y:0},[Ye.Top]:{x:0,y:-1},[Ye.Bottom]:{x:0,y:1}},jIt=({source:e,sourcePosition:t=Ye.Bottom,target:n})=>t===Ye.Left||t===Ye.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},rQ=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function AIt({source:e,sourcePosition:t=Ye.Bottom,target:n,targetPosition:o=Ye.Top,center:a,offset:i}){const s=aQ[t],l=aQ[o],d={x:e.x+s.x*i,y:e.y+s.y*i},h={x:n.x+l.x*i,y:n.y+l.y*i},p=jIt({source:d,sourcePosition:t,target:h}),m=p.x!==0?"x":"y",v=p[m];let x=[],M,b;const C={x:0,y:0},_={x:0,y:0},[N,A,I,R]=Mce({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[m]*l[m]===-1){M=a.x??N,b=a.y??A;const D=[{x:M,y:d.y},{x:M,y:h.y}],H=[{x:d.x,y:b},{x:h.x,y:b}];s[m]===v?x=m==="x"?D:H:x=m==="x"?H:D}else{const D=[{x:d.x,y:h.y}],H=[{x:h.x,y:d.y}];if(m==="x"?x=s.x===v?H:D:x=s.y===v?D:H,t===o){const G=Math.abs(e[m]-n[m]);if(G<=i){const E=Math.min(i-1,i-G);s[m]===v?C[m]=(d[m]>e[m]?-1:1)*E:_[m]=(h[m]>n[m]?-1:1)*E}}if(t!==o){const G=m==="x"?"y":"x",E=s[m]===l[G],O=d[G]>h[G],P=d[G]<h[G];(s[m]===1&&(!E&&O||E&&P)||s[m]!==1&&(!E&&P||E&&O))&&(x=m==="x"?D:H)}const U={x:d.x+C.x,y:d.y+C.y},z={x:h.x+_.x,y:h.y+_.y},Z=Math.max(Math.abs(U.x-x[0].x),Math.abs(z.x-x[0].x)),q=Math.max(Math.abs(U.y-x[0].y),Math.abs(z.y-x[0].y));Z>=q?(M=(U.x+z.x)/2,b=x[0].y):(M=x[0].x,b=(U.y+z.y)/2)}return[[e,{x:d.x+C.x,y:d.y+C.y},...x,{x:h.x+_.x,y:h.y+_.y},n],M,b,I,R]}function EIt(e,t,n,o){const a=Math.min(rQ(e,t)/2,rQ(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const h=e.x<n.x?-1:1,p=e.y<n.y?1:-1;return`L ${i+a*h},${s}Q ${i},${s} ${i},${s+a*p}`}const l=e.x<n.x?1:-1,d=e.y<n.y?-1:1;return`L ${i},${s+a*d}Q ${i},${s} ${i+a*l},${s}`}function ZH({sourceX:e,sourceY:t,sourcePosition:n=Ye.Bottom,targetX:o,targetY:a,targetPosition:i=Ye.Top,borderRadius:s=5,centerX:l,centerY:d,offset:h=20}){const[p,m,v,x,M]=AIt({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:a},targetPosition:i,center:{x:l,y:d},offset:h});return[p.reduce((C,_,N)=>{let A="";return N>0&&N<p.length-1?A=EIt(p[N-1],_,p[N+1],s):A=`${N===0?"M":"L"}${_.x} ${_.y}`,C+=A,C},""),m,v,x,M]}const R$=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:o,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:p,sourcePosition:m=Ye.Bottom,targetPosition:v=Ye.Top,markerEnd:x,markerStart:M,pathOptions:b,interactionWidth:C})=>{const[_,N,A]=ZH({sourceX:e,sourceY:t,sourcePosition:m,targetX:n,targetY:o,targetPosition:v,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset});return le.createElement($p,{path:_,labelX:N,labelY:A,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:x,markerStart:M,interactionWidth:C})});R$.displayName="SmoothStepEdge";const MF=k.memo(e=>{var t;return le.createElement(R$,{...e,pathOptions:k.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});MF.displayName="StepEdge";function IIt({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[a,i,s,l]=Mce({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,a,i,s,l]}const _F=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:o,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:m,markerStart:v,interactionWidth:x})=>{const[M,b,C]=IIt({sourceX:e,sourceY:t,targetX:n,targetY:o});return le.createElement($p,{path:M,labelX:b,labelY:C,label:a,labelStyle:i,labelShowBg:s,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:m,markerStart:v,interactionWidth:x})});_F.displayName="StraightEdge";function vm(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function iQ({pos:e,x1:t,y1:n,x2:o,y2:a,c:i}){switch(e){case Ye.Left:return[t-vm(t-o,i),n];case Ye.Right:return[t+vm(o-t,i),n];case Ye.Top:return[t,n-vm(n-a,i)];case Ye.Bottom:return[t,n+vm(a-n,i)]}}function Cce({sourceX:e,sourceY:t,sourcePosition:n=Ye.Bottom,targetX:o,targetY:a,targetPosition:i=Ye.Top,curvature:s=.25}){const[l,d]=iQ({pos:n,x1:e,y1:t,x2:o,y2:a,c:s}),[h,p]=iQ({pos:i,x1:o,y1:a,x2:e,y2:t,c:s}),[m,v,x,M]=_ce({sourceX:e,sourceY:t,targetX:o,targetY:a,sourceControlX:l,sourceControlY:d,targetControlX:h,targetControlY:p});return[`M${e},${t} C${l},${d} ${h},${p} ${o},${a}`,m,v,x,M]}const gP=k.memo(({sourceX:e,sourceY:t,targetX:n,targetY:o,sourcePosition:a=Ye.Bottom,targetPosition:i=Ye.Top,label:s,labelStyle:l,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:v,markerEnd:x,markerStart:M,pathOptions:b,interactionWidth:C})=>{const[_,N,A]=Cce({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:o,targetPosition:i,curvature:b==null?void 0:b.curvature});return le.createElement($p,{path:_,labelX:N,labelY:A,label:s,labelStyle:l,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:v,markerEnd:x,markerStart:M,interactionWidth:C})});gP.displayName="BezierEdge";const SF=k.createContext(null),TIt=SF.Provider;SF.Consumer;const RIt=()=>k.useContext(SF),PIt=e=>"id"in e&&"source"in e&&"target"in e,$It=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`reactflow__edge-${e}${t||""}-${n}${o||""}`,YH=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`,DIt=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),WH=(e,t)=>{if(!e.source||!e.target)return t;let n;return PIt(e)?n={...e}:n={...e,id:$It(e)},DIt(n,t)?t:t.concat(n)},KH=({x:e,y:t},[n,o,a],i,[s,l])=>{const d={x:(e-n)/a,y:(t-o)/a};return i?{x:s*Math.round(d.x/s),y:l*Math.round(d.y/l)}:d},Nce=({x:e,y:t},[n,o,a])=>({x:e*a+n,y:t*a+o}),Oh=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],o=(e.height??0)*t[1],a={x:e.position.x-n,y:e.position.y-o};return{...a,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-o}:a}},CF=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,a)=>{const{x:i,y:s}=Oh(a,t).positionAbsolute;return _It(o,wF({x:i,y:s,width:a.width||0,height:a.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return SIt(n)},Lce=(e,t,[n,o,a]=[0,0,1],i=!1,s=!1,l=[0,0])=>{const d={x:(t.x-n)/a,y:(t.y-o)/a,width:t.width/a,height:t.height/a},h=[];return e.forEach(p=>{const{width:m,height:v,selectable:x=!0,hidden:M=!1}=p;if(s&&!x||M)return!1;const{positionAbsolute:b}=Oh(p,l),C={x:b.x,y:b.y,width:m||0,height:v||0},_=GH(d,C),N=typeof m>"u"||typeof v>"u"||m===null||v===null,A=i&&_>0,I=(m||0)*(v||0);(N||A||_>=I||p.dragging)&&h.push(p)}),h},jce=(e,t)=>{const n=e.map(o=>o.id);return t.filter(o=>n.includes(o.source)||n.includes(o.target))},Ace=(e,t,n,o,a,i=.1)=>{const s=t/(e.width*(1+i)),l=n/(e.height*(1+i)),d=Math.min(s,l),h=e2(d,o,a),p=e.x+e.width/2,m=e.y+e.height/2,v=t/2-p*h,x=n/2-m*h;return{x:v,y:x,zoom:h}},Td=(e,t=0)=>e.transition().duration(t);function sQ(e,t,n,o){return(t[n]||[]).reduce((a,i)=>{var s,l;return`${e.id}-${i.id}-${n}`!==o&&a.push({id:i.id||null,type:n,nodeId:e.id,x:(((s=e.positionAbsolute)==null?void 0:s.x)??0)+i.x+i.width/2,y:(((l=e.positionAbsolute)==null?void 0:l.y)??0)+i.y+i.height/2}),a},[])}function zIt(e,t,n,o,a,i){const{x:s,y:l}=_s(e),h=t.elementsFromPoint(s,l).find(M=>M.classList.contains("react-flow__handle"));if(h){const M=h.getAttribute("data-nodeid");if(M){const b=NF(void 0,h),C=h.getAttribute("data-handleid"),_=i({nodeId:M,id:C,type:b});if(_){const N=a.find(A=>A.nodeId===M&&A.type===b&&A.id===C);return{handle:{id:C,type:b,nodeId:M,x:(N==null?void 0:N.x)||n.x,y:(N==null?void 0:N.y)||n.y},validHandleResult:_}}}}let p=[],m=1/0;if(a.forEach(M=>{const b=Math.sqrt((M.x-n.x)**2+(M.y-n.y)**2);if(b<=o){const C=i(M);b<=m&&(b<m?p=[{handle:M,validHandleResult:C}]:b===m&&p.push({handle:M,validHandleResult:C}),m=b)}}),!p.length)return{handle:null,validHandleResult:Ece()};if(p.length===1)return p[0];const v=p.some(({validHandleResult:M})=>M.isValid),x=p.some(({handle:M})=>M.type==="target");return p.find(({handle:M,validHandleResult:b})=>x?M.type==="target":v?b.isValid:!0)||p[0]}const OIt={source:null,target:null,sourceHandle:null,targetHandle:null},Ece=()=>({handleDomNode:null,isValid:!1,connection:OIt,endHandle:null});function Ice(e,t,n,o,a,i,s){const l=a==="target",d=s.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),h={...Ece(),handleDomNode:d};if(d){const p=NF(void 0,d),m=d.getAttribute("data-nodeid"),v=d.getAttribute("data-handleid"),x=d.classList.contains("connectable"),M=d.classList.contains("connectableend"),b={source:l?m:n,sourceHandle:l?v:o,target:l?n:m,targetHandle:l?o:v};h.connection=b,x&&M&&(t===l1.Strict?l&&p==="source"||!l&&p==="target":m!==n||v!==o)&&(h.endHandle={nodeId:m,handleId:v,type:p},h.isValid=i(b))}return h}function qIt({nodes:e,nodeId:t,handleId:n,handleType:o}){return e.reduce((a,i)=>{if(i[vn]){const{handleBounds:s}=i[vn];let l=[],d=[];s&&(l=sQ(i,s,"source",`${t}-${n}-${o}`),d=sQ(i,s,"target",`${t}-${n}-${o}`)),a.push(...l,...d)}return a},[])}function NF(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function nq(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function HIt(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function Tce({event:e,handleId:t,nodeId:n,onConnect:o,isTarget:a,getState:i,setState:s,isValidConnection:l,edgeUpdaterType:d,onReconnectEnd:h}){const p=xce(e.target),{connectionMode:m,domNode:v,autoPanOnConnect:x,connectionRadius:M,onConnectStart:b,panBy:C,getNodes:_,cancelConnection:N}=i();let A=0,I;const{x:R,y:j}=_s(e),D=p==null?void 0:p.elementFromPoint(R,j),H=NF(d,D),U=v==null?void 0:v.getBoundingClientRect();if(!U||!H)return;let z,Z=_s(e,U),q=!1,G=null,E=!1,O=null;const P=qIt({nodes:_(),nodeId:n,handleId:t,handleType:H}),X=()=>{if(!x)return;const[L,Y]=kce(Z,U);C({x:L,y:Y}),A=requestAnimationFrame(X)};s({connectionPosition:Z,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:H,connectionStartHandle:{nodeId:n,handleId:t,type:H},connectionEndHandle:null}),b==null||b(e,{nodeId:n,handleId:t,handleType:H});function W(L){const{transform:Y}=i();Z=_s(L,U);const{handle:F,validHandleResult:T}=zIt(L,p,KH(Z,Y,!1,[1,1]),M,P,K=>Ice(K,m,n,t,a?"target":"source",l,p));if(I=F,q||(X(),q=!0),O=T.handleDomNode,G=T.connection,E=T.isValid,s({connectionPosition:I&&E?Nce({x:I.x,y:I.y},Y):Z,connectionStatus:HIt(!!I,E),connectionEndHandle:T.endHandle}),!I&&!E&&!O)return nq(z);G.source!==G.target&&O&&(nq(z),z=O,O.classList.add("connecting","react-flow__handle-connecting"),O.classList.toggle("valid",E),O.classList.toggle("react-flow__handle-valid",E))}function V(L){var Y,F;(I||O)&&G&&E&&(o==null||o(G)),(F=(Y=i()).onConnectEnd)==null||F.call(Y,L),d&&(h==null||h(L)),nq(z),N(),cancelAnimationFrame(A),q=!1,E=!1,G=null,O=null,p.removeEventListener("mousemove",W),p.removeEventListener("mouseup",V),p.removeEventListener("touchmove",W),p.removeEventListener("touchend",V)}p.addEventListener("mousemove",W),p.addEventListener("mouseup",V),p.addEventListener("touchmove",W),p.addEventListener("touchend",V)}const cQ=()=>!0,VIt=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),BIt=(e,t,n)=>o=>{const{connectionStartHandle:a,connectionEndHandle:i,connectionClickStartHandle:s}=o;return{connecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n||(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===t&&(s==null?void 0:s.type)===n}},Rce=k.forwardRef(({type:e="source",position:t=Ye.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:a=!0,isConnectableEnd:i=!0,id:s,onConnect:l,children:d,className:h,onMouseDown:p,onTouchStart:m,...v},x)=>{var U,z;const M=s||null,b=e==="target",C=Jn(),_=RIt(),{connectOnClick:N,noPanClassName:A}=un(VIt,Ro),{connecting:I,clickConnecting:R}=un(BIt(_,M,e),Ro);_||(z=(U=C.getState()).onError)==null||z.call(U,"010",mi.error010());const j=Z=>{const{defaultEdgeOptions:q,onConnect:G,hasDefaultEdges:E}=C.getState(),O={...q,...Z};if(E){const{edges:P,setEdges:X}=C.getState();X(WH(O,P))}G==null||G(O),l==null||l(O)},D=Z=>{if(!_)return;const q=bce(Z);a&&(q&&Z.button===0||!q)&&Tce({event:Z,handleId:M,nodeId:_,onConnect:j,isTarget:b,getState:C.getState,setState:C.setState,isValidConnection:n||C.getState().isValidConnection||cQ}),q?p==null||p(Z):m==null||m(Z)},H=Z=>{const{onClickConnectStart:q,onClickConnectEnd:G,connectionClickStartHandle:E,connectionMode:O,isValidConnection:P}=C.getState();if(!_||!E&&!a)return;if(!E){q==null||q(Z,{nodeId:_,handleId:M,handleType:e}),C.setState({connectionClickStartHandle:{nodeId:_,type:e,handleId:M}});return}const X=xce(Z.target),W=n||P||cQ,{connection:V,isValid:L}=Ice({nodeId:_,id:M,type:e},O,E.nodeId,E.handleId||null,E.type,W,X);L&&j(V),G==null||G(Z),C.setState({connectionClickStartHandle:null})};return le.createElement("div",{"data-handleid":M,"data-nodeid":_,"data-handlepos":t,"data-id":`${_}-${M}-${e}`,className:ko(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",A,h,{source:!b,target:b,connectable:o,connectablestart:a,connectableend:i,connecting:R,connectionindicator:o&&(a&&!I||i&&I)}]),onMouseDown:D,onTouchStart:D,onClick:N?H:void 0,ref:x,...v},d)});Rce.displayName="Handle";var np=k.memo(Rce);const Pce=({data:e,isConnectable:t,targetPosition:n=Ye.Top,sourcePosition:o=Ye.Bottom})=>le.createElement(le.Fragment,null,le.createElement(np,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,le.createElement(np,{type:"source",position:o,isConnectable:t}));Pce.displayName="DefaultNode";var QH=k.memo(Pce);const $ce=({data:e,isConnectable:t,sourcePosition:n=Ye.Bottom})=>le.createElement(le.Fragment,null,e==null?void 0:e.label,le.createElement(np,{type:"source",position:n,isConnectable:t}));$ce.displayName="InputNode";var Dce=k.memo($ce);const zce=({data:e,isConnectable:t,targetPosition:n=Ye.Top})=>le.createElement(le.Fragment,null,le.createElement(np,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);zce.displayName="OutputNode";var Oce=k.memo(zce);const LF=()=>null;LF.displayName="GroupNode";const FIt=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),km=e=>e.id;function UIt(e,t){return Ro(e.selectedNodes.map(km),t.selectedNodes.map(km))&&Ro(e.selectedEdges.map(km),t.selectedEdges.map(km))}const qce=k.memo(({onSelectionChange:e})=>{const t=Jn(),{selectedNodes:n,selectedEdges:o}=un(FIt,UIt);return k.useEffect(()=>{const a={nodes:n,edges:o};e==null||e(a),t.getState().onSelectionChange.forEach(i=>i(a))},[n,o,e]),null});qce.displayName="SelectionListener";const GIt=e=>!!e.onSelectionChange;function XIt({onSelectionChange:e}){const t=un(GIt);return e||t?le.createElement(qce,{onSelectionChange:e}):null}const ZIt=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function ah(e,t){k.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function gt(e,t,n){k.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const YIt=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:a,onConnectStart:i,onConnectEnd:s,onClickConnectStart:l,onClickConnectEnd:d,nodesDraggable:h,nodesConnectable:p,nodesFocusable:m,edgesFocusable:v,edgesUpdatable:x,elevateNodesOnSelect:M,minZoom:b,maxZoom:C,nodeExtent:_,onNodesChange:N,onEdgesChange:A,elementsSelectable:I,connectionMode:R,snapGrid:j,snapToGrid:D,translateExtent:H,connectOnClick:U,defaultEdgeOptions:z,fitView:Z,fitViewOptions:q,onNodesDelete:G,onEdgesDelete:E,onNodeDrag:O,onNodeDragStart:P,onNodeDragStop:X,onSelectionDrag:W,onSelectionDragStart:V,onSelectionDragStop:L,noPanClassName:Y,nodeOrigin:F,rfId:T,autoPanOnConnect:K,autoPanOnNodeDrag:Q,onError:ne,connectionRadius:te,isValidConnection:ce,nodeDragThreshold:me})=>{const{setNodes:ke,setEdges:Ee,setDefaultNodesAndEdges:Ie,setMinZoom:Te,setMaxZoom:qe,setTranslateExtent:ct,setNodeExtent:jt,reset:We}=un(ZIt,Ro),Le=Jn();return k.useEffect(()=>{const Rt=o==null?void 0:o.map(eo=>({...eo,...z}));return Ie(n,Rt),()=>{We()}},[]),gt("defaultEdgeOptions",z,Le.setState),gt("connectionMode",R,Le.setState),gt("onConnect",a,Le.setState),gt("onConnectStart",i,Le.setState),gt("onConnectEnd",s,Le.setState),gt("onClickConnectStart",l,Le.setState),gt("onClickConnectEnd",d,Le.setState),gt("nodesDraggable",h,Le.setState),gt("nodesConnectable",p,Le.setState),gt("nodesFocusable",m,Le.setState),gt("edgesFocusable",v,Le.setState),gt("edgesUpdatable",x,Le.setState),gt("elementsSelectable",I,Le.setState),gt("elevateNodesOnSelect",M,Le.setState),gt("snapToGrid",D,Le.setState),gt("snapGrid",j,Le.setState),gt("onNodesChange",N,Le.setState),gt("onEdgesChange",A,Le.setState),gt("connectOnClick",U,Le.setState),gt("fitViewOnInit",Z,Le.setState),gt("fitViewOnInitOptions",q,Le.setState),gt("onNodesDelete",G,Le.setState),gt("onEdgesDelete",E,Le.setState),gt("onNodeDrag",O,Le.setState),gt("onNodeDragStart",P,Le.setState),gt("onNodeDragStop",X,Le.setState),gt("onSelectionDrag",W,Le.setState),gt("onSelectionDragStart",V,Le.setState),gt("onSelectionDragStop",L,Le.setState),gt("noPanClassName",Y,Le.setState),gt("nodeOrigin",F,Le.setState),gt("rfId",T,Le.setState),gt("autoPanOnConnect",K,Le.setState),gt("autoPanOnNodeDrag",Q,Le.setState),gt("onError",ne,Le.setState),gt("connectionRadius",te,Le.setState),gt("isValidConnection",ce,Le.setState),gt("nodeDragThreshold",me,Le.setState),ah(e,ke),ah(t,Ee),ah(b,Te),ah(C,qe),ah(H,ct),ah(_,jt),null},lQ={display:"none"},WIt={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Hce="react-flow__node-desc",Vce="react-flow__edge-desc",KIt="react-flow__aria-live",QIt=e=>e.ariaLiveMessage;function JIt({rfId:e}){const t=un(QIt);return le.createElement("div",{id:`${KIt}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:WIt},t)}function eTt({rfId:e,disableKeyboardA11y:t}){return le.createElement(le.Fragment,null,le.createElement("div",{id:`${Hce}-${e}`,style:lQ},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),le.createElement("div",{id:`${Vce}-${e}`,style:lQ},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&le.createElement(JIt,{rfId:e}))}var op=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,o]=k.useState(!1),a=k.useRef(!1),i=k.useRef(new Set([])),[s,l]=k.useMemo(()=>{if(e!==null){const h=(Array.isArray(e)?e:[e]).filter(m=>typeof m=="string").map(m=>m.split("+")),p=h.reduce((m,v)=>m.concat(...v),[]);return[h,p]}return[[],[]]},[e]);return k.useEffect(()=>{const d=typeof document<"u"?document:null,h=(t==null?void 0:t.target)||d;if(e!==null){const p=x=>{if(a.current=x.ctrlKey||x.metaKey||x.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&XH(x))return!1;const b=dQ(x.code,l);i.current.add(x[b]),uQ(s,i.current,!1)&&(x.preventDefault(),o(!0))},m=x=>{if((!a.current||a.current&&!t.actInsideInputWithModifier)&&XH(x))return!1;const b=dQ(x.code,l);uQ(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(x[b]),x.key==="Meta"&&i.current.clear(),a.current=!1},v=()=>{i.current.clear(),o(!1)};return h==null||h.addEventListener("keydown",p),h==null||h.addEventListener("keyup",m),window.addEventListener("blur",v),()=>{h==null||h.removeEventListener("keydown",p),h==null||h.removeEventListener("keyup",m),window.removeEventListener("blur",v)}}},[e,o]),n};function uQ(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(a=>t.has(a)))}function dQ(e,t){return t.includes(e)?"code":"key"}function Bce(e,t,n,o){var l,d;const a=e.parentNode||e.parentId;if(!a)return n;const i=t.get(a),s=Oh(i,o);return Bce(i,t,{x:(n.x??0)+s.x,y:(n.y??0)+s.y,z:(((l=i[vn])==null?void 0:l.z)??0)>(n.z??0)?((d=i[vn])==null?void 0:d.z)??0:n.z??0},o)}function Fce(e,t,n){e.forEach(o=>{var i;const a=o.parentNode||o.parentId;if(a&&!e.has(a))throw new Error(`Parent node ${a} not found`);if(a||n!=null&&n[o.id]){const{x:s,y:l,z:d}=Bce(o,e,{...o.position,z:((i=o[vn])==null?void 0:i.z)??0},t);o.positionAbsolute={x:s,y:l},o[vn].z=d,n!=null&&n[o.id]&&(o[vn].isParent=!0)}})}function oq(e,t,n,o){const a=new Map,i={},s=o?1e3:0;return e.forEach(l=>{var x;const d=(xa(l.zIndex)?l.zIndex:0)+(l.selected?s:0),h=t.get(l.id),p={...l,positionAbsolute:{x:l.position.x,y:l.position.y}},m=l.parentNode||l.parentId;m&&(i[m]=!0);const v=(h==null?void 0:h.type)&&(h==null?void 0:h.type)!==l.type;Object.defineProperty(p,vn,{enumerable:!1,value:{handleBounds:v||(x=h==null?void 0:h[vn])==null?void 0:x.handleBounds,z:d}}),a.set(l.id,p)}),Fce(a,n,i),a}function Uce(e,t={}){const{getNodes:n,width:o,height:a,minZoom:i,maxZoom:s,d3Zoom:l,d3Selection:d,fitViewOnInitDone:h,fitViewOnInit:p,nodeOrigin:m}=e(),v=t.initial&&!h&&p;if(l&&d&&(v||!t.initial)){const M=n().filter(C=>{var N;const _=t.includeHiddenNodes?C.width&&C.height:!C.hidden;return(N=t.nodes)!=null&&N.length?_&&t.nodes.some(A=>A.id===C.id):_}),b=M.every(C=>C.width&&C.height);if(M.length>0&&b){const C=CF(M,m),{x:_,y:N,zoom:A}=Ace(C,o,a,t.minZoom??i,t.maxZoom??s,t.padding??.1),I=Ms.translate(_,N).scale(A);return typeof t.duration=="number"&&t.duration>0?l.transform(Td(d,t.duration),I):l.transform(d,I),!0}}return!1}function tTt(e,t){return e.forEach(n=>{const o=t.get(n.id);o&&t.set(o.id,{...o,[vn]:o[vn],selected:n.selected})}),new Map(t)}function nTt(e,t){return t.map(n=>{const o=e.find(a=>a.id===n.id);return o&&(n.selected=o.selected),n})}function xm({changedNodes:e,changedEdges:t,get:n,set:o}){const{nodeInternals:a,edges:i,onNodesChange:s,onEdgesChange:l,hasDefaultNodes:d,hasDefaultEdges:h}=n();e!=null&&e.length&&(d&&o({nodeInternals:tTt(e,a)}),s==null||s(e)),t!=null&&t.length&&(h&&o({edges:nTt(t,i)}),l==null||l(t))}const rh=()=>{},oTt={zoomIn:rh,zoomOut:rh,zoomTo:rh,getZoom:()=>1,setViewport:rh,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:rh,fitBounds:rh,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},aTt=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),rTt=()=>{const e=Jn(),{d3Zoom:t,d3Selection:n}=un(aTt,Ro);return k.useMemo(()=>n&&t?{zoomIn:a=>t.scaleBy(Td(n,a==null?void 0:a.duration),1.2),zoomOut:a=>t.scaleBy(Td(n,a==null?void 0:a.duration),1/1.2),zoomTo:(a,i)=>t.scaleTo(Td(n,i==null?void 0:i.duration),a),getZoom:()=>e.getState().transform[2],setViewport:(a,i)=>{const[s,l,d]=e.getState().transform,h=Ms.translate(a.x??s,a.y??l).scale(a.zoom??d);t.transform(Td(n,i==null?void 0:i.duration),h)},getViewport:()=>{const[a,i,s]=e.getState().transform;return{x:a,y:i,zoom:s}},fitView:a=>Uce(e.getState,a),setCenter:(a,i,s)=>{const{width:l,height:d,maxZoom:h}=e.getState(),p=typeof(s==null?void 0:s.zoom)<"u"?s.zoom:h,m=l/2-a*p,v=d/2-i*p,x=Ms.translate(m,v).scale(p);t.transform(Td(n,s==null?void 0:s.duration),x)},fitBounds:(a,i)=>{const{width:s,height:l,minZoom:d,maxZoom:h}=e.getState(),{x:p,y:m,zoom:v}=Ace(a,s,l,d,h,(i==null?void 0:i.padding)??.1),x=Ms.translate(p,m).scale(v);t.transform(Td(n,i==null?void 0:i.duration),x)},project:a=>{const{transform:i,snapToGrid:s,snapGrid:l}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),KH(a,i,s,l)},screenToFlowPosition:a=>{const{transform:i,snapToGrid:s,snapGrid:l,domNode:d}=e.getState();if(!d)return a;const{x:h,y:p}=d.getBoundingClientRect(),m={x:a.x-h,y:a.y-p};return KH(m,i,s,l)},flowToScreenPosition:a=>{const{transform:i,domNode:s}=e.getState();if(!s)return a;const{x:l,y:d}=s.getBoundingClientRect(),h=Nce(a,i);return{x:h.x+l,y:h.y+d}},viewportInitialized:!0}:oTt,[t,n])};function P$(){const e=rTt(),t=Jn(),n=k.useCallback(()=>t.getState().getNodes().map(b=>({...b})),[]),o=k.useCallback(b=>t.getState().nodeInternals.get(b),[]),a=k.useCallback(()=>{const{edges:b=[]}=t.getState();return b.map(C=>({...C}))},[]),i=k.useCallback(b=>{const{edges:C=[]}=t.getState();return C.find(_=>_.id===b)},[]),s=k.useCallback(b=>{const{getNodes:C,setNodes:_,hasDefaultNodes:N,onNodesChange:A}=t.getState(),I=C(),R=typeof b=="function"?b(I):b;if(N)_(R);else if(A){const j=R.length===0?I.map(D=>({type:"remove",id:D.id})):R.map(D=>({item:D,type:"reset"}));A(j)}},[]),l=k.useCallback(b=>{const{edges:C=[],setEdges:_,hasDefaultEdges:N,onEdgesChange:A}=t.getState(),I=typeof b=="function"?b(C):b;if(N)_(I);else if(A){const R=I.length===0?C.map(j=>({type:"remove",id:j.id})):I.map(j=>({item:j,type:"reset"}));A(R)}},[]),d=k.useCallback(b=>{const C=Array.isArray(b)?b:[b],{getNodes:_,setNodes:N,hasDefaultNodes:A,onNodesChange:I}=t.getState();if(A){const j=[..._(),...C];N(j)}else if(I){const R=C.map(j=>({item:j,type:"add"}));I(R)}},[]),h=k.useCallback(b=>{const C=Array.isArray(b)?b:[b],{edges:_=[],setEdges:N,hasDefaultEdges:A,onEdgesChange:I}=t.getState();if(A)N([..._,...C]);else if(I){const R=C.map(j=>({item:j,type:"add"}));I(R)}},[]),p=k.useCallback(()=>{const{getNodes:b,edges:C=[],transform:_}=t.getState(),[N,A,I]=_;return{nodes:b().map(R=>({...R})),edges:C.map(R=>({...R})),viewport:{x:N,y:A,zoom:I}}},[]),m=k.useCallback(({nodes:b,edges:C})=>{const{nodeInternals:_,getNodes:N,edges:A,hasDefaultNodes:I,hasDefaultEdges:R,onNodesDelete:j,onEdgesDelete:D,onNodesChange:H,onEdgesChange:U}=t.getState(),z=(b||[]).map(O=>O.id),Z=(C||[]).map(O=>O.id),q=N().reduce((O,P)=>{const X=P.parentNode||P.parentId,W=!z.includes(P.id)&&X&&O.find(L=>L.id===X);return(typeof P.deletable=="boolean"?P.deletable:!0)&&(z.includes(P.id)||W)&&O.push(P),O},[]),G=A.filter(O=>typeof O.deletable=="boolean"?O.deletable:!0),E=G.filter(O=>Z.includes(O.id));if(q||E){const O=jce(q,G),P=[...E,...O],X=P.reduce((W,V)=>(W.includes(V.id)||W.push(V.id),W),[]);if((R||I)&&(R&&t.setState({edges:A.filter(W=>!X.includes(W.id))}),I&&(q.forEach(W=>{_.delete(W.id)}),t.setState({nodeInternals:new Map(_)}))),X.length>0&&(D==null||D(P),U&&U(X.map(W=>({id:W,type:"remove"})))),q.length>0&&(j==null||j(q),H)){const W=q.map(V=>({id:V.id,type:"remove"}));H(W)}}},[]),v=k.useCallback(b=>{const C=CIt(b),_=C?null:t.getState().nodeInternals.get(b.id);return!C&&!_?[null,null,C]:[C?b:nQ(_),_,C]},[]),x=k.useCallback((b,C=!0,_)=>{const[N,A,I]=v(b);return N?(_||t.getState().getNodes()).filter(R=>{if(!I&&(R.id===A.id||!R.positionAbsolute))return!1;const j=nQ(R),D=GH(j,N);return C&&D>0||D>=N.width*N.height}):[]},[]),M=k.useCallback((b,C,_=!0)=>{const[N]=v(b);if(!N)return!1;const A=GH(N,C);return _&&A>0||A>=N.width*N.height},[]);return k.useMemo(()=>({...e,getNodes:n,getNode:o,getEdges:a,getEdge:i,setNodes:s,setEdges:l,addNodes:d,addEdges:h,toObject:p,deleteElements:m,getIntersectingNodes:x,isNodeIntersecting:M}),[e,n,o,a,i,s,l,d,h,p,m,x,M])}const iTt={actInsideInputWithModifier:!1};var sTt=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Jn(),{deleteElements:o}=P$(),a=op(e,iTt),i=op(t);k.useEffect(()=>{if(a){const{edges:s,getNodes:l}=n.getState(),d=l().filter(p=>p.selected),h=s.filter(p=>p.selected);o({nodes:d,edges:h}),n.setState({nodesSelectionActive:!1})}},[a]),k.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function cTt(e){const t=Jn();k.useEffect(()=>{let n;const o=()=>{var i,s;if(!e.current)return;const a=kF(e.current);(a.height===0||a.width===0)&&((s=(i=t.getState()).onError)==null||s.call(i,"004",mi.error004())),t.setState({width:a.width||500,height:a.height||500})};return o(),window.addEventListener("resize",o),e.current&&(n=new ResizeObserver(()=>o()),n.observe(e.current)),()=>{window.removeEventListener("resize",o),n&&e.current&&n.unobserve(e.current)}},[])}const jF={position:"absolute",width:"100%",height:"100%",top:0,left:0},lTt=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,wm=e=>({x:e.x,y:e.y,zoom:e.k}),ih=(e,t)=>e.target.closest(`.${t}`),hQ=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),fQ=e=>{const t=e.ctrlKey&&yP()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},uTt=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),dTt=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:a=!0,zoomOnPinch:i=!0,panOnScroll:s=!1,panOnScrollSpeed:l=.5,panOnScrollMode:d=Od.Free,zoomOnDoubleClick:h=!0,elementsSelectable:p,panOnDrag:m=!0,defaultViewport:v,translateExtent:x,minZoom:M,maxZoom:b,zoomActivationKeyCode:C,preventScrolling:_=!0,children:N,noWheelClassName:A,noPanClassName:I})=>{const R=k.useRef(),j=Jn(),D=k.useRef(!1),H=k.useRef(!1),U=k.useRef(null),z=k.useRef({x:0,y:0,zoom:0}),{d3Zoom:Z,d3Selection:q,d3ZoomHandler:G,userSelectionActive:E}=un(uTt,Ro),O=op(C),P=k.useRef(0),X=k.useRef(!1),W=k.useRef();return cTt(U),k.useEffect(()=>{if(U.current){const V=U.current.getBoundingClientRect(),L=vIt().scaleExtent([M,b]).translateExtent(x),Y=Ha(U.current).call(L),F=Ms.translate(v.x,v.y).scale(e2(v.zoom,M,b)),T=[[0,0],[V.width,V.height]],K=L.constrain()(F,T,x);L.transform(Y,K),L.wheelDelta(fQ),j.setState({d3Zoom:L,d3Selection:Y,d3ZoomHandler:Y.on("wheel.zoom"),transform:[K.x,K.y,K.k],domNode:U.current.closest(".react-flow")})}},[]),k.useEffect(()=>{q&&Z&&(s&&!O&&!E?q.on("wheel.zoom",V=>{if(ih(V,A))return!1;V.preventDefault(),V.stopImmediatePropagation();const L=q.property("__zoom").k||1;if(V.ctrlKey&&i){const ce=pr(V),me=fQ(V),ke=L*Math.pow(2,me);Z.scaleTo(q,ke,ce,V);return}const Y=V.deltaMode===1?20:1;let F=d===Od.Vertical?0:V.deltaX*Y,T=d===Od.Horizontal?0:V.deltaY*Y;!yP()&&V.shiftKey&&d!==Od.Vertical&&(F=V.deltaY*Y,T=0),Z.translateBy(q,-(F/L)*l,-(T/L)*l,{internal:!0});const K=wm(q.property("__zoom")),{onViewportChangeStart:Q,onViewportChange:ne,onViewportChangeEnd:te}=j.getState();clearTimeout(W.current),X.current||(X.current=!0,t==null||t(V,K),Q==null||Q(K)),X.current&&(e==null||e(V,K),ne==null||ne(K),W.current=setTimeout(()=>{n==null||n(V,K),te==null||te(K),X.current=!1},150))},{passive:!1}):typeof G<"u"&&q.on("wheel.zoom",function(V,L){if(!_&&V.type==="wheel"&&!V.ctrlKey||ih(V,A))return null;V.preventDefault(),G.call(this,V,L)},{passive:!1}))},[E,s,d,q,Z,G,O,i,_,A,t,e,n]),k.useEffect(()=>{Z&&Z.on("start",V=>{var F,T;if(!V.sourceEvent||V.sourceEvent.internal)return null;P.current=(F=V.sourceEvent)==null?void 0:F.button;const{onViewportChangeStart:L}=j.getState(),Y=wm(V.transform);D.current=!0,z.current=Y,((T=V.sourceEvent)==null?void 0:T.type)==="mousedown"&&j.setState({paneDragging:!0}),L==null||L(Y),t==null||t(V.sourceEvent,Y)})},[Z,t]),k.useEffect(()=>{Z&&(E&&!D.current?Z.on("zoom",null):E||Z.on("zoom",V=>{var Y;const{onViewportChange:L}=j.getState();if(j.setState({transform:[V.transform.x,V.transform.y,V.transform.k]}),H.current=!!(o&&hQ(m,P.current??0)),(e||L)&&!((Y=V.sourceEvent)!=null&&Y.internal)){const F=wm(V.transform);L==null||L(F),e==null||e(V.sourceEvent,F)}}))},[E,Z,e,m,o]),k.useEffect(()=>{Z&&Z.on("end",V=>{if(!V.sourceEvent||V.sourceEvent.internal)return null;const{onViewportChangeEnd:L}=j.getState();if(D.current=!1,j.setState({paneDragging:!1}),o&&hQ(m,P.current??0)&&!H.current&&o(V.sourceEvent),H.current=!1,(n||L)&&lTt(z.current,V.transform)){const Y=wm(V.transform);z.current=Y,clearTimeout(R.current),R.current=setTimeout(()=>{L==null||L(Y),n==null||n(V.sourceEvent,Y)},s?150:0)}})},[Z,s,m,n,o]),k.useEffect(()=>{Z&&Z.filter(V=>{const L=O||a,Y=i&&V.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&V.button===1&&V.type==="mousedown"&&(ih(V,"react-flow__node")||ih(V,"react-flow__edge")))return!0;if(!m&&!L&&!s&&!h&&!i||E||!h&&V.type==="dblclick"||ih(V,A)&&V.type==="wheel"||ih(V,I)&&(V.type!=="wheel"||s&&V.type==="wheel"&&!O)||!i&&V.ctrlKey&&V.type==="wheel"||!L&&!s&&!Y&&V.type==="wheel"||!m&&(V.type==="mousedown"||V.type==="touchstart")||Array.isArray(m)&&!m.includes(V.button)&&V.type==="mousedown")return!1;const F=Array.isArray(m)&&m.includes(V.button)||!V.button||V.button<=1;return(!V.ctrlKey||V.type==="wheel")&&F})},[E,Z,a,i,s,h,m,p,O]),le.createElement("div",{className:"react-flow__renderer",ref:U,style:jF},N)},hTt=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function fTt(){const{userSelectionActive:e,userSelectionRect:t}=un(hTt,Ro);return e&&t?le.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function pQ(e,t){const n=t.parentNode||t.parentId,o=e.find(a=>a.id===n);if(o){const a=t.position.x+t.width-o.width,i=t.position.y+t.height-o.height;if(a>0||i>0||t.position.x<0||t.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,a>0&&(o.style.width+=a),i>0&&(o.style.height+=i),t.position.x<0){const s=Math.abs(t.position.x);o.position.x=o.position.x-s,o.style.width+=s,t.position.x=0}if(t.position.y<0){const s=Math.abs(t.position.y);o.position.y=o.position.y-s,o.style.height+=s,t.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function Gce(e,t){if(e.some(o=>o.type==="reset"))return e.filter(o=>o.type==="reset").map(o=>o.item);const n=e.filter(o=>o.type==="add").map(o=>o.item);return t.reduce((o,a)=>{const i=e.filter(l=>l.id===a.id);if(i.length===0)return o.push(a),o;const s={...a};for(const l of i)if(l)switch(l.type){case"select":{s.selected=l.selected;break}case"position":{typeof l.position<"u"&&(s.position=l.position),typeof l.positionAbsolute<"u"&&(s.positionAbsolute=l.positionAbsolute),typeof l.dragging<"u"&&(s.dragging=l.dragging),s.expandParent&&pQ(o,s);break}case"dimensions":{typeof l.dimensions<"u"&&(s.width=l.dimensions.width,s.height=l.dimensions.height),typeof l.updateStyle<"u"&&(s.style={...s.style||{},...l.dimensions}),typeof l.resizing=="boolean"&&(s.resizing=l.resizing),s.expandParent&&pQ(o,s);break}case"remove":return o}return o.push(s),o},n)}function Xce(e,t){return Gce(e,t)}function pTt(e,t){return Gce(e,t)}const as=(e,t)=>({id:e,type:"select",selected:t});function wh(e,t){return e.reduce((n,o)=>{const a=t.includes(o.id);return!o.selected&&a?(o.selected=!0,n.push(as(o.id,!0))):o.selected&&!a&&(o.selected=!1,n.push(as(o.id,!1))),n},[])}const aq=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},yTt=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),Zce=k.memo(({isSelecting:e,selectionMode:t=tp.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:a,onPaneClick:i,onPaneContextMenu:s,onPaneScroll:l,onPaneMouseEnter:d,onPaneMouseMove:h,onPaneMouseLeave:p,children:m})=>{const v=k.useRef(null),x=Jn(),M=k.useRef(0),b=k.useRef(0),C=k.useRef(),{userSelectionActive:_,elementsSelectable:N,dragging:A}=un(yTt,Ro),I=()=>{x.setState({userSelectionActive:!1,userSelectionRect:null}),M.current=0,b.current=0},R=G=>{i==null||i(G),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},j=G=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){G.preventDefault();return}s==null||s(G)},D=l?G=>l(G):void 0,H=G=>{const{resetSelectedElements:E,domNode:O}=x.getState();if(C.current=O==null?void 0:O.getBoundingClientRect(),!N||!e||G.button!==0||G.target!==v.current||!C.current)return;const{x:P,y:X}=_s(G,C.current);E(),x.setState({userSelectionRect:{width:0,height:0,startX:P,startY:X,x:P,y:X}}),o==null||o(G)},U=G=>{const{userSelectionRect:E,nodeInternals:O,edges:P,transform:X,onNodesChange:W,onEdgesChange:V,nodeOrigin:L,getNodes:Y}=x.getState();if(!e||!C.current||!E)return;x.setState({userSelectionActive:!0,nodesSelectionActive:!1});const F=_s(G,C.current),T=E.startX??0,K=E.startY??0,Q={...E,x:F.x<T?F.x:T,y:F.y<K?F.y:K,width:Math.abs(F.x-T),height:Math.abs(F.y-K)},ne=Y(),te=Lce(O,Q,X,t===tp.Partial,!0,L),ce=jce(te,P).map(ke=>ke.id),me=te.map(ke=>ke.id);if(M.current!==me.length){M.current=me.length;const ke=wh(ne,me);ke.length&&(W==null||W(ke))}if(b.current!==ce.length){b.current=ce.length;const ke=wh(P,ce);ke.length&&(V==null||V(ke))}x.setState({userSelectionRect:Q})},z=G=>{if(G.button!==0)return;const{userSelectionRect:E}=x.getState();!_&&E&&G.target===v.current&&(R==null||R(G)),x.setState({nodesSelectionActive:M.current>0}),I(),a==null||a(G)},Z=G=>{_&&(x.setState({nodesSelectionActive:M.current>0}),a==null||a(G)),I()},q=N&&(e||_);return le.createElement("div",{className:ko(["react-flow__pane",{dragging:A,selection:e}]),onClick:q?void 0:aq(R,v),onContextMenu:aq(j,v),onWheel:aq(D,v),onMouseEnter:q?void 0:d,onMouseDown:q?H:void 0,onMouseMove:q?U:h,onMouseUp:q?z:void 0,onMouseLeave:q?Z:p,ref:v,style:jF},m,le.createElement(fTt,null))});Zce.displayName="Pane";function Yce(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const o=t.get(n);return o?o.selected?!0:Yce(o,t):!1}function yQ(e,t,n){let o=e;do{if(o!=null&&o.matches(t))return!0;if(o===n.current)return!1;o=o.parentElement}while(o);return!1}function mTt(e,t,n,o){return Array.from(e.values()).filter(a=>(a.selected||a.id===o)&&(!a.parentNode||a.parentId||!Yce(a,e))&&(a.draggable||t&&typeof a.draggable>"u")).map(a=>{var i,s;return{id:a.id,position:a.position||{x:0,y:0},positionAbsolute:a.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((i=a.positionAbsolute)==null?void 0:i.x)??0),y:n.y-(((s=a.positionAbsolute)==null?void 0:s.y)??0)},delta:{x:0,y:0},extent:a.extent,parentNode:a.parentNode||a.parentId,parentId:a.parentNode||a.parentId,width:a.width,height:a.height,expandParent:a.expandParent}})}function gTt(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function Wce(e,t,n,o,a=[0,0],i){const s=gTt(e,e.extent||o);let l=s;const d=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(d&&e.width&&e.height){const m=n.get(d),{x:v,y:x}=Oh(m,a).positionAbsolute;l=m&&xa(v)&&xa(x)&&xa(m.width)&&xa(m.height)?[[v+e.width*a[0],x+e.height*a[1]],[v+m.width-e.width+e.width*a[0],x+m.height-e.height+e.height*a[1]]]:l}else i==null||i("005",mi.error005()),l=s;else if(e.extent&&d&&e.extent!=="parent"){const m=n.get(d),{x:v,y:x}=Oh(m,a).positionAbsolute;l=[[e.extent[0][0]+v,e.extent[0][1]+x],[e.extent[1][0]+v,e.extent[1][1]+x]]}let h={x:0,y:0};if(d){const m=n.get(d);h=Oh(m,a).positionAbsolute}const p=l&&l!=="parent"?xF(t,l):t;return{position:{x:p.x-h.x,y:p.y-h.y},positionAbsolute:p}}function rq({nodeId:e,dragItems:t,nodeInternals:n}){const o=t.map(a=>({...n.get(a.id),position:a.position,positionAbsolute:a.positionAbsolute}));return[e?o.find(a=>a.id===e):o[0],o]}const mQ=(e,t,n,o)=>{const a=t.querySelectorAll(e);if(!a||!a.length)return null;const i=Array.from(a),s=t.getBoundingClientRect(),l={x:s.width*o[0],y:s.height*o[1]};return i.map(d=>{const h=d.getBoundingClientRect();return{id:d.getAttribute("data-handleid"),position:d.getAttribute("data-handlepos"),x:(h.left-s.left-l.x)/n,y:(h.top-s.top-l.y)/n,...kF(d)}})};function Lf(e,t,n){return n===void 0?n:o=>{const a=t().nodeInternals.get(e);a&&n(o,{...a})}}function JH({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:a,unselectNodesAndEdges:i,multiSelectionActive:s,nodeInternals:l,onError:d}=t.getState(),h=l.get(e);if(!h){d==null||d("012",mi.error012(e));return}t.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&s)&&(i({nodes:[h],edges:[]}),requestAnimationFrame(()=>{var p;return(p=o==null?void 0:o.current)==null?void 0:p.blur()})):a([e])}function vTt(){const e=Jn();return k.useCallback(({sourceEvent:n})=>{const{transform:o,snapGrid:a,snapToGrid:i}=e.getState(),s=n.touches?n.touches[0].clientX:n.clientX,l=n.touches?n.touches[0].clientY:n.clientY,d={x:(s-o[0])/o[2],y:(l-o[1])/o[2]};return{xSnapped:i?a[0]*Math.round(d.x/a[0]):d.x,ySnapped:i?a[1]*Math.round(d.y/a[1]):d.y,...d}},[])}function iq(e){return(t,n,o)=>e==null?void 0:e(t,o)}function Kce({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:a,isSelectable:i,selectNodesOnDrag:s}){const l=Jn(),[d,h]=k.useState(!1),p=k.useRef([]),m=k.useRef({x:null,y:null}),v=k.useRef(0),x=k.useRef(null),M=k.useRef({x:0,y:0}),b=k.useRef(null),C=k.useRef(!1),_=k.useRef(!1),N=k.useRef(!1),A=vTt();return k.useEffect(()=>{if(e!=null&&e.current){const I=Ha(e.current),R=({x:H,y:U})=>{const{nodeInternals:z,onNodeDrag:Z,onSelectionDrag:q,updateNodePositions:G,nodeExtent:E,snapGrid:O,snapToGrid:P,nodeOrigin:X,onError:W}=l.getState();m.current={x:H,y:U};let V=!1,L={x:0,y:0,x2:0,y2:0};if(p.current.length>1&&E){const F=CF(p.current,X);L=wF(F)}if(p.current=p.current.map(F=>{const T={x:H-F.distance.x,y:U-F.distance.y};P&&(T.x=O[0]*Math.round(T.x/O[0]),T.y=O[1]*Math.round(T.y/O[1]));const K=[[E[0][0],E[0][1]],[E[1][0],E[1][1]]];p.current.length>1&&E&&!F.extent&&(K[0][0]=F.positionAbsolute.x-L.x+E[0][0],K[1][0]=F.positionAbsolute.x+(F.width??0)-L.x2+E[1][0],K[0][1]=F.positionAbsolute.y-L.y+E[0][1],K[1][1]=F.positionAbsolute.y+(F.height??0)-L.y2+E[1][1]);const Q=Wce(F,T,z,K,X,W);return V=V||F.position.x!==Q.position.x||F.position.y!==Q.position.y,F.position=Q.position,F.positionAbsolute=Q.positionAbsolute,F}),!V)return;G(p.current,!0,!0),h(!0);const Y=a?Z:iq(q);if(Y&&b.current){const[F,T]=rq({nodeId:a,dragItems:p.current,nodeInternals:z});Y(b.current,F,T)}},j=()=>{if(!x.current)return;const[H,U]=kce(M.current,x.current);if(H!==0||U!==0){const{transform:z,panBy:Z}=l.getState();m.current.x=(m.current.x??0)-H/z[2],m.current.y=(m.current.y??0)-U/z[2],Z({x:H,y:U})&&R(m.current)}v.current=requestAnimationFrame(j)},D=H=>{var X;const{nodeInternals:U,multiSelectionActive:z,nodesDraggable:Z,unselectNodesAndEdges:q,onNodeDragStart:G,onSelectionDragStart:E}=l.getState();_.current=!0;const O=a?G:iq(E);(!s||!i)&&!z&&a&&((X=U.get(a))!=null&&X.selected||q()),a&&i&&s&&JH({id:a,store:l,nodeRef:e});const P=A(H);if(m.current=P,p.current=mTt(U,Z,P,a),O&&p.current){const[W,V]=rq({nodeId:a,dragItems:p.current,nodeInternals:U});O(H.sourceEvent,W,V)}};if(t)I.on(".drag",null);else{const H=LAt().on("start",U=>{const{domNode:z,nodeDragThreshold:Z}=l.getState();Z===0&&D(U),N.current=!1;const q=A(U);m.current=q,x.current=(z==null?void 0:z.getBoundingClientRect())||null,M.current=_s(U.sourceEvent,x.current)}).on("drag",U=>{var G,E;const z=A(U),{autoPanOnNodeDrag:Z,nodeDragThreshold:q}=l.getState();if(U.sourceEvent.type==="touchmove"&&U.sourceEvent.touches.length>1&&(N.current=!0),!N.current){if(!C.current&&_.current&&Z&&(C.current=!0,j()),!_.current){const O=z.xSnapped-(((G=m==null?void 0:m.current)==null?void 0:G.x)??0),P=z.ySnapped-(((E=m==null?void 0:m.current)==null?void 0:E.y)??0);Math.sqrt(O*O+P*P)>q&&D(U)}(m.current.x!==z.xSnapped||m.current.y!==z.ySnapped)&&p.current&&_.current&&(b.current=U.sourceEvent,M.current=_s(U.sourceEvent,x.current),R(z))}}).on("end",U=>{if(!(!_.current||N.current)&&(h(!1),C.current=!1,_.current=!1,cancelAnimationFrame(v.current),p.current)){const{updateNodePositions:z,nodeInternals:Z,onNodeDragStop:q,onSelectionDragStop:G}=l.getState(),E=a?q:iq(G);if(z(p.current,!1,!1),E){const[O,P]=rq({nodeId:a,dragItems:p.current,nodeInternals:Z});E(U.sourceEvent,O,P)}}}).filter(U=>{const z=U.target;return!U.button&&(!n||!yQ(z,`.${n}`,e))&&(!o||yQ(z,o,e))});return I.call(H),()=>{I.on(".drag",null)}}}},[e,t,n,o,i,l,a,s,A]),d}function Qce(){const e=Jn();return k.useCallback(n=>{const{nodeInternals:o,nodeExtent:a,updateNodePositions:i,getNodes:s,snapToGrid:l,snapGrid:d,onError:h,nodesDraggable:p}=e.getState(),m=s().filter(N=>N.selected&&(N.draggable||p&&typeof N.draggable>"u")),v=l?d[0]:5,x=l?d[1]:5,M=n.isShiftPressed?4:1,b=n.x*v*M,C=n.y*x*M,_=m.map(N=>{if(N.positionAbsolute){const A={x:N.positionAbsolute.x+b,y:N.positionAbsolute.y+C};l&&(A.x=d[0]*Math.round(A.x/d[0]),A.y=d[1]*Math.round(A.y/d[1]));const{positionAbsolute:I,position:R}=Wce(N,A,o,a,void 0,h);N.position=R,N.positionAbsolute=I}return N});i(_,!0,!1)},[])}const qh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var jf=e=>{const t=({id:n,type:o,data:a,xPos:i,yPos:s,xPosOrigin:l,yPosOrigin:d,selected:h,onClick:p,onMouseEnter:m,onMouseMove:v,onMouseLeave:x,onContextMenu:M,onDoubleClick:b,style:C,className:_,isDraggable:N,isSelectable:A,isConnectable:I,isFocusable:R,selectNodesOnDrag:j,sourcePosition:D,targetPosition:H,hidden:U,resizeObserver:z,dragHandle:Z,zIndex:q,isParent:G,noDragClassName:E,noPanClassName:O,initialized:P,disableKeyboardA11y:X,ariaLabel:W,rfId:V,hasHandleBounds:L})=>{const Y=Jn(),F=k.useRef(null),T=k.useRef(null),K=k.useRef(D),Q=k.useRef(H),ne=k.useRef(o),te=A||N||p||m||v||x,ce=Qce(),me=Lf(n,Y.getState,m),ke=Lf(n,Y.getState,v),Ee=Lf(n,Y.getState,x),Ie=Lf(n,Y.getState,M),Te=Lf(n,Y.getState,b),qe=We=>{const{nodeDragThreshold:Le}=Y.getState();if(A&&(!j||!N||Le>0)&&JH({id:n,store:Y,nodeRef:F}),p){const Rt=Y.getState().nodeInternals.get(n);Rt&&p(We,{...Rt})}},ct=We=>{if(!XH(We)&&!X)if(wce.includes(We.key)&&A){const Le=We.key==="Escape";JH({id:n,store:Y,unselect:Le,nodeRef:F})}else N&&h&&Object.prototype.hasOwnProperty.call(qh,We.key)&&(Y.setState({ariaLiveMessage:`Moved selected node ${We.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~s}`}),ce({x:qh[We.key].x,y:qh[We.key].y,isShiftPressed:We.shiftKey}))};k.useEffect(()=>()=>{T.current&&(z==null||z.unobserve(T.current),T.current=null)},[]),k.useEffect(()=>{if(F.current&&!U){const We=F.current;(!P||!L||T.current!==We)&&(T.current&&(z==null||z.unobserve(T.current)),z==null||z.observe(We),T.current=We)}},[U,P,L]),k.useEffect(()=>{const We=ne.current!==o,Le=K.current!==D,Rt=Q.current!==H;F.current&&(We||Le||Rt)&&(We&&(ne.current=o),Le&&(K.current=D),Rt&&(Q.current=H),Y.getState().updateNodeDimensions([{id:n,nodeElement:F.current,forceUpdate:!0}]))},[n,o,D,H]);const jt=Kce({nodeRef:F,disabled:U||!N,noDragClassName:E,handleSelector:Z,nodeId:n,isSelectable:A,selectNodesOnDrag:j});return U?null:le.createElement("div",{className:ko(["react-flow__node",`react-flow__node-${o}`,{[O]:N},_,{selected:h,selectable:A,parent:G,dragging:jt}]),ref:F,style:{zIndex:q,transform:`translate(${l}px,${d}px)`,pointerEvents:te?"all":"none",visibility:P?"visible":"hidden",...C},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:me,onMouseMove:ke,onMouseLeave:Ee,onContextMenu:Ie,onClick:qe,onDoubleClick:Te,onKeyDown:R?ct:void 0,tabIndex:R?0:void 0,role:R?"button":void 0,"aria-describedby":X?void 0:`${Hce}-${V}`,"aria-label":W},le.createElement(TIt,{value:n},le.createElement(e,{id:n,data:a,type:o,xPos:i,yPos:s,selected:h,isConnectable:I,sourcePosition:D,targetPosition:H,dragging:jt,dragHandle:Z,zIndex:q})))};return t.displayName="NodeWrapper",k.memo(t)};const kTt=e=>{const t=e.getNodes().filter(n=>n.selected);return{...CF(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function xTt({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=Jn(),{width:a,height:i,x:s,y:l,transformString:d,userSelectionActive:h}=un(kTt,Ro),p=Qce(),m=k.useRef(null);if(k.useEffect(()=>{var M;n||(M=m.current)==null||M.focus({preventScroll:!0})},[n]),Kce({nodeRef:m}),h||!a||!i)return null;const v=e?M=>{const b=o.getState().getNodes().filter(C=>C.selected);e(M,b)}:void 0,x=M=>{Object.prototype.hasOwnProperty.call(qh,M.key)&&p({x:qh[M.key].x,y:qh[M.key].y,isShiftPressed:M.shiftKey})};return le.createElement("div",{className:ko(["react-flow__nodesselection","react-flow__container",t]),style:{transform:d}},le.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:v,tabIndex:n?void 0:-1,onKeyDown:n?void 0:x,style:{width:a,height:i,top:l,left:s}}))}var wTt=k.memo(xTt);const bTt=e=>e.nodesSelectionActive,Jce=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:s,deleteKeyCode:l,onMove:d,onMoveStart:h,onMoveEnd:p,selectionKeyCode:m,selectionOnDrag:v,selectionMode:x,onSelectionStart:M,onSelectionEnd:b,multiSelectionKeyCode:C,panActivationKeyCode:_,zoomActivationKeyCode:N,elementsSelectable:A,zoomOnScroll:I,zoomOnPinch:R,panOnScroll:j,panOnScrollSpeed:D,panOnScrollMode:H,zoomOnDoubleClick:U,panOnDrag:z,defaultViewport:Z,translateExtent:q,minZoom:G,maxZoom:E,preventScrolling:O,onSelectionContextMenu:P,noWheelClassName:X,noPanClassName:W,disableKeyboardA11y:V})=>{const L=un(bTt),Y=op(m),F=op(_),T=F||z,K=F||j,Q=Y||v&&T!==!0;return sTt({deleteKeyCode:l,multiSelectionKeyCode:C}),le.createElement(dTt,{onMove:d,onMoveStart:h,onMoveEnd:p,onPaneContextMenu:i,elementsSelectable:A,zoomOnScroll:I,zoomOnPinch:R,panOnScroll:K,panOnScrollSpeed:D,panOnScrollMode:H,zoomOnDoubleClick:U,panOnDrag:!Y&&T,defaultViewport:Z,translateExtent:q,minZoom:G,maxZoom:E,zoomActivationKeyCode:N,preventScrolling:O,noWheelClassName:X,noPanClassName:W},le.createElement(Zce,{onSelectionStart:M,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:a,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:T,isSelecting:!!Q,selectionMode:x},e,L&&le.createElement(wTt,{onSelectionContextMenu:P,noPanClassName:W,disableKeyboardA11y:V})))};Jce.displayName="FlowRenderer";var MTt=k.memo(Jce);function _Tt(e){return un(k.useCallback(n=>e?Lce(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function STt(e){const t={input:jf(e.input||Dce),default:jf(e.default||QH),output:jf(e.output||Oce),group:jf(e.group||LF)},n={},o=Object.keys(e).filter(a=>!["input","default","output","group"].includes(a)).reduce((a,i)=>(a[i]=jf(e[i]||QH),a),n);return{...t,...o}}const CTt=({x:e,y:t,width:n,height:o,origin:a})=>!n||!o?{x:e,y:t}:a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:e,y:t}:{x:e-n*a[0],y:t-o*a[1]},NTt=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),ele=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:a,updateNodeDimensions:i,onError:s}=un(NTt,Ro),l=_Tt(e.onlyRenderVisibleElements),d=k.useRef(),h=k.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const p=new ResizeObserver(m=>{const v=m.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));i(v)});return d.current=p,p},[]);return k.useEffect(()=>()=>{var p;(p=d==null?void 0:d.current)==null||p.disconnect()},[]),le.createElement("div",{className:"react-flow__nodes",style:jF},l.map(p=>{var R,j,D;let m=p.type||"default";e.nodeTypes[m]||(s==null||s("003",mi.error003(m)),m="default");const v=e.nodeTypes[m]||e.nodeTypes.default,x=!!(p.draggable||t&&typeof p.draggable>"u"),M=!!(p.selectable||a&&typeof p.selectable>"u"),b=!!(p.connectable||n&&typeof p.connectable>"u"),C=!!(p.focusable||o&&typeof p.focusable>"u"),_=e.nodeExtent?xF(p.positionAbsolute,e.nodeExtent):p.positionAbsolute,N=(_==null?void 0:_.x)??0,A=(_==null?void 0:_.y)??0,I=CTt({x:N,y:A,width:p.width??0,height:p.height??0,origin:e.nodeOrigin});return le.createElement(v,{key:p.id,id:p.id,className:p.className,style:p.style,type:m,data:p.data,sourcePosition:p.sourcePosition||Ye.Bottom,targetPosition:p.targetPosition||Ye.Top,hidden:p.hidden,xPos:N,yPos:A,xPosOrigin:I.x,yPosOrigin:I.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!p.selected,isDraggable:x,isSelectable:M,isConnectable:b,isFocusable:C,resizeObserver:h,dragHandle:p.dragHandle,zIndex:((R=p[vn])==null?void 0:R.z)??0,isParent:!!((j=p[vn])!=null&&j.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!p.width&&!!p.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:p.ariaLabel,hasHandleBounds:!!((D=p[vn])!=null&&D.handleBounds)})}))};ele.displayName="NodeRenderer";var LTt=k.memo(ele);const jTt=(e,t,n)=>n===Ye.Left?e-t:n===Ye.Right?e+t:e,ATt=(e,t,n)=>n===Ye.Top?e-t:n===Ye.Bottom?e+t:e,gQ="react-flow__edgeupdater",vQ=({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:a,onMouseEnter:i,onMouseOut:s,type:l})=>le.createElement("circle",{onMouseDown:a,onMouseEnter:i,onMouseOut:s,className:ko([gQ,`${gQ}-${l}`]),cx:jTt(t,o,e),cy:ATt(n,o,e),r:o,stroke:"transparent",fill:"transparent"}),ETt=()=>!0;var sh=e=>{const t=({id:n,className:o,type:a,data:i,onClick:s,onEdgeDoubleClick:l,selected:d,animated:h,label:p,labelStyle:m,labelShowBg:v,labelBgStyle:x,labelBgPadding:M,labelBgBorderRadius:b,style:C,source:_,target:N,sourceX:A,sourceY:I,targetX:R,targetY:j,sourcePosition:D,targetPosition:H,elementsSelectable:U,hidden:z,sourceHandleId:Z,targetHandleId:q,onContextMenu:G,onMouseEnter:E,onMouseMove:O,onMouseLeave:P,reconnectRadius:X,onReconnect:W,onReconnectStart:V,onReconnectEnd:L,markerEnd:Y,markerStart:F,rfId:T,ariaLabel:K,isFocusable:Q,isReconnectable:ne,pathOptions:te,interactionWidth:ce,disableKeyboardA11y:me})=>{const ke=k.useRef(null),[Ee,Ie]=k.useState(!1),[Te,qe]=k.useState(!1),ct=Jn(),jt=k.useMemo(()=>`url('#${YH(F,T)}')`,[F,T]),We=k.useMemo(()=>`url('#${YH(Y,T)}')`,[Y,T]);if(z)return null;const Le=ft=>{var Dt;const{edges:tn,addSelectedEdges:Kt,unselectNodesAndEdges:bn,multiSelectionActive:rn}=ct.getState(),At=tn.find(En=>En.id===n);At&&(U&&(ct.setState({nodesSelectionActive:!1}),At.selected&&rn?(bn({nodes:[],edges:[At]}),(Dt=ke.current)==null||Dt.blur()):Kt([n])),s&&s(ft,At))},Rt=Nf(n,ct.getState,l),eo=Nf(n,ct.getState,G),An=Nf(n,ct.getState,E),wn=Nf(n,ct.getState,O),On=Nf(n,ct.getState,P),so=(ft,tn)=>{if(ft.button!==0)return;const{edges:Kt,isValidConnection:bn}=ct.getState(),rn=tn?N:_,At=(tn?q:Z)||null,Dt=tn?"target":"source",En=bn||ETt,Qa=tn,Ja=Kt.find(ra=>ra.id===n);qe(!0),V==null||V(ft,Ja,Dt);const er=ra=>{qe(!1),L==null||L(ra,Ja,Dt)};Tce({event:ft,handleId:At,nodeId:rn,onConnect:ra=>W==null?void 0:W(Ja,ra),isTarget:Qa,getState:ct.getState,setState:ct.setState,isValidConnection:En,edgeUpdaterType:Dt,onReconnectEnd:er})},wo=ft=>so(ft,!0),fe=ft=>so(ft,!1),be=()=>Ie(!0),Oe=()=>Ie(!1),He=!U&&!s,kt=ft=>{var tn;if(!me&&wce.includes(ft.key)&&U){const{unselectNodesAndEdges:Kt,addSelectedEdges:bn,edges:rn}=ct.getState();ft.key==="Escape"?((tn=ke.current)==null||tn.blur(),Kt({edges:[rn.find(Dt=>Dt.id===n)]})):bn([n])}};return le.createElement("g",{className:ko(["react-flow__edge",`react-flow__edge-${a}`,o,{selected:d,animated:h,inactive:He,updating:Ee}]),onClick:Le,onDoubleClick:Rt,onContextMenu:eo,onMouseEnter:An,onMouseMove:wn,onMouseLeave:On,onKeyDown:Q?kt:void 0,tabIndex:Q?0:void 0,role:Q?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":K===null?void 0:K||`Edge from ${_} to ${N}`,"aria-describedby":Q?`${Vce}-${T}`:void 0,ref:ke},!Te&&le.createElement(e,{id:n,source:_,target:N,selected:d,animated:h,label:p,labelStyle:m,labelShowBg:v,labelBgStyle:x,labelBgPadding:M,labelBgBorderRadius:b,data:i,style:C,sourceX:A,sourceY:I,targetX:R,targetY:j,sourcePosition:D,targetPosition:H,sourceHandleId:Z,targetHandleId:q,markerStart:jt,markerEnd:We,pathOptions:te,interactionWidth:ce}),ne&&le.createElement(le.Fragment,null,(ne==="source"||ne===!0)&&le.createElement(vQ,{position:D,centerX:A,centerY:I,radius:X,onMouseDown:wo,onMouseEnter:be,onMouseOut:Oe,type:"source"}),(ne==="target"||ne===!0)&&le.createElement(vQ,{position:H,centerX:R,centerY:j,radius:X,onMouseDown:fe,onMouseEnter:be,onMouseOut:Oe,type:"target"})))};return t.displayName="EdgeWrapper",k.memo(t)};function ITt(e){const t={default:sh(e.default||gP),straight:sh(e.bezier||_F),step:sh(e.step||MF),smoothstep:sh(e.step||R$),simplebezier:sh(e.simplebezier||bF)},n={},o=Object.keys(e).filter(a=>!["default","bezier"].includes(a)).reduce((a,i)=>(a[i]=sh(e[i]||gP),a),n);return{...t,...o}}function kQ(e,t,n=null){const o=((n==null?void 0:n.x)||0)+t.x,a=((n==null?void 0:n.y)||0)+t.y,i=(n==null?void 0:n.width)||t.width,s=(n==null?void 0:n.height)||t.height;switch(e){case Ye.Top:return{x:o+i/2,y:a};case Ye.Right:return{x:o+i,y:a+s/2};case Ye.Bottom:return{x:o+i/2,y:a+s};case Ye.Left:return{x:o,y:a+s/2}}}function xQ(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const TTt=(e,t,n,o,a,i)=>{const s=kQ(n,e,t),l=kQ(i,o,a);return{sourceX:s.x,sourceY:s.y,targetX:l.x,targetY:l.y}};function RTt({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:a,targetHeight:i,width:s,height:l,transform:d}){const h={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+a),y2:Math.max(e.y+o,t.y+i)};h.x===h.x2&&(h.x2+=1),h.y===h.y2&&(h.y2+=1);const p=wF({x:(0-d[0])/d[2],y:(0-d[1])/d[2],width:s/d[2],height:l/d[2]}),m=Math.max(0,Math.min(p.x2,h.x2)-Math.max(p.x,h.x)),v=Math.max(0,Math.min(p.y2,h.y2)-Math.max(p.y,h.y));return Math.ceil(m*v)>0}function wQ(e){var o,a,i,s,l;const t=((o=e==null?void 0:e[vn])==null?void 0:o.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)<"u"&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.y)<"u";return[{x:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.x)||0,y:((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const PTt=[{level:0,isMaxLevel:!0,edges:[]}];function $Tt(e,t,n=!1){let o=-1;const a=e.reduce((s,l)=>{var p,m;const d=xa(l.zIndex);let h=d?l.zIndex:0;if(n){const v=t.get(l.target),x=t.get(l.source),M=l.selected||(v==null?void 0:v.selected)||(x==null?void 0:x.selected),b=Math.max(((p=x==null?void 0:x[vn])==null?void 0:p.z)||0,((m=v==null?void 0:v[vn])==null?void 0:m.z)||0,1e3);h=(d?l.zIndex:0)+(M?b:0)}return s[h]?s[h].push(l):s[h]=[l],o=h>o?h:o,s},{}),i=Object.entries(a).map(([s,l])=>{const d=+s;return{edges:l,level:d,isMaxLevel:d===o}});return i.length===0?PTt:i}function DTt(e,t,n){const o=un(k.useCallback(a=>e?a.edges.filter(i=>{const s=t.get(i.source),l=t.get(i.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(l==null?void 0:l.width)&&(l==null?void 0:l.height)&&RTt({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:l.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:l.width,targetHeight:l.height,width:a.width,height:a.height,transform:a.transform})}):a.edges,[e,t]));return $Tt(o,t,n)}const zTt=({color:e="none",strokeWidth:t=1})=>le.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),OTt=({color:e="none",strokeWidth:t=1})=>le.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),bQ={[mP.Arrow]:zTt,[mP.ArrowClosed]:OTt};function qTt(e){const t=Jn();return k.useMemo(()=>{var a,i;return Object.prototype.hasOwnProperty.call(bQ,e)?bQ[e]:((i=(a=t.getState()).onError)==null||i.call(a,"009",mi.error009(e)),null)},[e])}const HTt=({id:e,type:t,color:n,width:o=12.5,height:a=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:l="auto-start-reverse"})=>{const d=qTt(t);return d?le.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0"},le.createElement(d,{color:n,strokeWidth:s})):null},VTt=({defaultColor:e,rfId:t})=>n=>{const o=[];return n.edges.reduce((a,i)=>([i.markerStart,i.markerEnd].forEach(s=>{if(s&&typeof s=="object"){const l=YH(s,t);o.includes(l)||(a.push({id:l,color:s.color||e,...s}),o.push(l))}}),a),[]).sort((a,i)=>a.id.localeCompare(i.id))},tle=({defaultColor:e,rfId:t})=>{const n=un(k.useCallback(VTt({defaultColor:e,rfId:t}),[e,t]),(o,a)=>!(o.length!==a.length||o.some((i,s)=>i.id!==a[s].id)));return le.createElement("defs",null,n.map(o=>le.createElement(HTt,{id:o.id,key:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient})))};tle.displayName="MarkerDefinitions";var BTt=k.memo(tle);const FTt=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),nle=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:o,edgeTypes:a,noPanClassName:i,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:d,onEdgeMouseLeave:h,onEdgeClick:p,onEdgeDoubleClick:m,onReconnect:v,onReconnectStart:x,onReconnectEnd:M,reconnectRadius:b,children:C,disableKeyboardA11y:_})=>{const{edgesFocusable:N,edgesUpdatable:A,elementsSelectable:I,width:R,height:j,connectionMode:D,nodeInternals:H,onError:U}=un(FTt,Ro),z=DTt(t,H,n);return R?le.createElement(le.Fragment,null,z.map(({level:Z,edges:q,isMaxLevel:G})=>le.createElement("svg",{key:Z,style:{zIndex:Z},width:R,height:j,className:"react-flow__edges react-flow__container"},G&&le.createElement(BTt,{defaultColor:e,rfId:o}),le.createElement("g",null,q.map(E=>{const[O,P,X]=wQ(H.get(E.source)),[W,V,L]=wQ(H.get(E.target));if(!X||!L)return null;let Y=E.type||"default";a[Y]||(U==null||U("011",mi.error011(Y)),Y="default");const F=a[Y]||a.default,T=D===l1.Strict?V.target:(V.target??[]).concat(V.source??[]),K=xQ(P.source,E.sourceHandle),Q=xQ(T,E.targetHandle),ne=(K==null?void 0:K.position)||Ye.Bottom,te=(Q==null?void 0:Q.position)||Ye.Top,ce=!!(E.focusable||N&&typeof E.focusable>"u"),me=E.reconnectable||E.updatable,ke=typeof v<"u"&&(me||A&&typeof me>"u");if(!K||!Q)return U==null||U("008",mi.error008(K,E)),null;const{sourceX:Ee,sourceY:Ie,targetX:Te,targetY:qe}=TTt(O,K,ne,W,Q,te);return le.createElement(F,{key:E.id,id:E.id,className:ko([E.className,i]),type:Y,data:E.data,selected:!!E.selected,animated:!!E.animated,hidden:!!E.hidden,label:E.label,labelStyle:E.labelStyle,labelShowBg:E.labelShowBg,labelBgStyle:E.labelBgStyle,labelBgPadding:E.labelBgPadding,labelBgBorderRadius:E.labelBgBorderRadius,style:E.style,source:E.source,target:E.target,sourceHandleId:E.sourceHandle,targetHandleId:E.targetHandle,markerEnd:E.markerEnd,markerStart:E.markerStart,sourceX:Ee,sourceY:Ie,targetX:Te,targetY:qe,sourcePosition:ne,targetPosition:te,elementsSelectable:I,onContextMenu:s,onMouseEnter:l,onMouseMove:d,onMouseLeave:h,onClick:p,onEdgeDoubleClick:m,onReconnect:v,onReconnectStart:x,onReconnectEnd:M,reconnectRadius:b,rfId:o,ariaLabel:E.ariaLabel,isFocusable:ce,isReconnectable:ke,pathOptions:"pathOptions"in E?E.pathOptions:void 0,interactionWidth:E.interactionWidth,disableKeyboardA11y:_})})))),C):null};nle.displayName="EdgeRenderer";var UTt=k.memo(nle);const GTt=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function XTt({children:e}){const t=un(GTt);return le.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function ZTt(e){const t=P$(),n=k.useRef(!1);k.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const YTt={[Ye.Left]:Ye.Right,[Ye.Right]:Ye.Left,[Ye.Top]:Ye.Bottom,[Ye.Bottom]:Ye.Top},ole=({nodeId:e,handleType:t,style:n,type:o=cs.Bezier,CustomComponent:a,connectionStatus:i})=>{var j,D,H;const{fromNode:s,handleId:l,toX:d,toY:h,connectionMode:p}=un(k.useCallback(U=>({fromNode:U.nodeInternals.get(e),handleId:U.connectionHandleId,toX:(U.connectionPosition.x-U.transform[0])/U.transform[2],toY:(U.connectionPosition.y-U.transform[1])/U.transform[2],connectionMode:U.connectionMode}),[e]),Ro),m=(j=s==null?void 0:s[vn])==null?void 0:j.handleBounds;let v=m==null?void 0:m[t];if(p===l1.Loose&&(v=v||(m==null?void 0:m[t==="source"?"target":"source"])),!s||!v)return null;const x=l?v.find(U=>U.id===l):v[0],M=x?x.x+x.width/2:(s.width??0)/2,b=x?x.y+x.height/2:s.height??0,C=(((D=s.positionAbsolute)==null?void 0:D.x)??0)+M,_=(((H=s.positionAbsolute)==null?void 0:H.y)??0)+b,N=x==null?void 0:x.position,A=N?YTt[N]:null;if(!N||!A)return null;if(a)return le.createElement(a,{connectionLineType:o,connectionLineStyle:n,fromNode:s,fromHandle:x,fromX:C,fromY:_,toX:d,toY:h,fromPosition:N,toPosition:A,connectionStatus:i});let I="";const R={sourceX:C,sourceY:_,sourcePosition:N,targetX:d,targetY:h,targetPosition:A};return o===cs.Bezier?[I]=Cce(R):o===cs.Step?[I]=ZH({...R,borderRadius:0}):o===cs.SmoothStep?[I]=ZH(R):o===cs.SimpleBezier?[I]=Sce(R):I=`M${C},${_} ${d},${h}`,le.createElement("path",{d:I,fill:"none",className:"react-flow__connection-path",style:n})};ole.displayName="ConnectionLine";const WTt=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function KTt({containerStyle:e,style:t,type:n,component:o}){const{nodeId:a,handleType:i,nodesConnectable:s,width:l,height:d,connectionStatus:h}=un(WTt,Ro);return!(a&&i&&l&&s)?null:le.createElement("svg",{style:e,width:l,height:d,className:"react-flow__edges react-flow__connectionline react-flow__container"},le.createElement("g",{className:ko(["react-flow__connection",h])},le.createElement(ole,{nodeId:a,handleType:i,style:t,type:n,CustomComponent:o,connectionStatus:h})))}function MQ(e,t){return k.useRef(null),Jn(),k.useMemo(()=>t(e),[e])}const ale=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:o,onMoveEnd:a,onInit:i,onNodeClick:s,onEdgeClick:l,onNodeDoubleClick:d,onEdgeDoubleClick:h,onNodeMouseEnter:p,onNodeMouseMove:m,onNodeMouseLeave:v,onNodeContextMenu:x,onSelectionContextMenu:M,onSelectionStart:b,onSelectionEnd:C,connectionLineType:_,connectionLineStyle:N,connectionLineComponent:A,connectionLineContainerStyle:I,selectionKeyCode:R,selectionOnDrag:j,selectionMode:D,multiSelectionKeyCode:H,panActivationKeyCode:U,zoomActivationKeyCode:z,deleteKeyCode:Z,onlyRenderVisibleElements:q,elementsSelectable:G,selectNodesOnDrag:E,defaultViewport:O,translateExtent:P,minZoom:X,maxZoom:W,preventScrolling:V,defaultMarkerColor:L,zoomOnScroll:Y,zoomOnPinch:F,panOnScroll:T,panOnScrollSpeed:K,panOnScrollMode:Q,zoomOnDoubleClick:ne,panOnDrag:te,onPaneClick:ce,onPaneMouseEnter:me,onPaneMouseMove:ke,onPaneMouseLeave:Ee,onPaneScroll:Ie,onPaneContextMenu:Te,onEdgeContextMenu:qe,onEdgeMouseEnter:ct,onEdgeMouseMove:jt,onEdgeMouseLeave:We,onReconnect:Le,onReconnectStart:Rt,onReconnectEnd:eo,reconnectRadius:An,noDragClassName:wn,noWheelClassName:On,noPanClassName:so,elevateEdgesOnSelect:wo,disableKeyboardA11y:fe,nodeOrigin:be,nodeExtent:Oe,rfId:He})=>{const kt=MQ(e,STt),ft=MQ(t,ITt);return ZTt(i),le.createElement(MTt,{onPaneClick:ce,onPaneMouseEnter:me,onPaneMouseMove:ke,onPaneMouseLeave:Ee,onPaneContextMenu:Te,onPaneScroll:Ie,deleteKeyCode:Z,selectionKeyCode:R,selectionOnDrag:j,selectionMode:D,onSelectionStart:b,onSelectionEnd:C,multiSelectionKeyCode:H,panActivationKeyCode:U,zoomActivationKeyCode:z,elementsSelectable:G,onMove:n,onMoveStart:o,onMoveEnd:a,zoomOnScroll:Y,zoomOnPinch:F,zoomOnDoubleClick:ne,panOnScroll:T,panOnScrollSpeed:K,panOnScrollMode:Q,panOnDrag:te,defaultViewport:O,translateExtent:P,minZoom:X,maxZoom:W,onSelectionContextMenu:M,preventScrolling:V,noDragClassName:wn,noWheelClassName:On,noPanClassName:so,disableKeyboardA11y:fe},le.createElement(XTt,null,le.createElement(UTt,{edgeTypes:ft,onEdgeClick:l,onEdgeDoubleClick:h,onlyRenderVisibleElements:q,onEdgeContextMenu:qe,onEdgeMouseEnter:ct,onEdgeMouseMove:jt,onEdgeMouseLeave:We,onReconnect:Le,onReconnectStart:Rt,onReconnectEnd:eo,reconnectRadius:An,defaultMarkerColor:L,noPanClassName:so,elevateEdgesOnSelect:!!wo,disableKeyboardA11y:fe,rfId:He},le.createElement(KTt,{style:N,type:_,component:A,containerStyle:I})),le.createElement("div",{className:"react-flow__edgelabel-renderer"}),le.createElement(LTt,{nodeTypes:kt,onNodeClick:s,onNodeDoubleClick:d,onNodeMouseEnter:p,onNodeMouseMove:m,onNodeMouseLeave:v,onNodeContextMenu:x,selectNodesOnDrag:E,onlyRenderVisibleElements:q,noPanClassName:so,noDragClassName:wn,disableKeyboardA11y:fe,nodeOrigin:be,nodeExtent:Oe,rfId:He})))};ale.displayName="GraphView";var QTt=k.memo(ale);const eV=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Fi={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:eV,nodeExtent:eV,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:l1.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:NIt,isValidConnection:void 0},JTt=()=>qLt((e,t)=>({...Fi,setNodes:n=>{const{nodeInternals:o,nodeOrigin:a,elevateNodesOnSelect:i}=t();e({nodeInternals:oq(n,o,a,i)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=t();e({edges:n.map(a=>({...o,...a}))})},setDefaultNodesAndEdges:(n,o)=>{const a=typeof n<"u",i=typeof o<"u",s=a?oq(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:s,edges:i?o:[],hasDefaultNodes:a,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:a,fitViewOnInit:i,fitViewOnInitDone:s,fitViewOnInitOptions:l,domNode:d,nodeOrigin:h}=t(),p=d==null?void 0:d.querySelector(".react-flow__viewport");if(!p)return;const m=window.getComputedStyle(p),{m22:v}=new window.DOMMatrixReadOnly(m.transform),x=n.reduce((b,C)=>{const _=a.get(C.id);if(_!=null&&_.hidden)a.set(_.id,{..._,[vn]:{..._[vn],handleBounds:void 0}});else if(_){const N=kF(C.nodeElement);!!(N.width&&N.height&&(_.width!==N.width||_.height!==N.height||C.forceUpdate))&&(a.set(_.id,{..._,[vn]:{..._[vn],handleBounds:{source:mQ(".source",C.nodeElement,v,h),target:mQ(".target",C.nodeElement,v,h)}},...N}),b.push({id:_.id,type:"dimensions",dimensions:N}))}return b},[]);Fce(a,h);const M=s||i&&!s&&Uce(t,{initial:!0,...l});e({nodeInternals:new Map(a),fitViewOnInitDone:M}),(x==null?void 0:x.length)>0&&(o==null||o(x))},updateNodePositions:(n,o=!0,a=!1)=>{const{triggerNodeChanges:i}=t(),s=n.map(l=>{const d={id:l.id,type:"position",dragging:a};return o&&(d.positionAbsolute=l.positionAbsolute,d.position=l.position),d});i(s)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:a,hasDefaultNodes:i,nodeOrigin:s,getNodes:l,elevateNodesOnSelect:d}=t();if(n!=null&&n.length){if(i){const h=Xce(n,l()),p=oq(h,a,s,d);e({nodeInternals:p})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:a,getNodes:i}=t();let s,l=null;o?s=n.map(d=>as(d,!0)):(s=wh(i(),n),l=wh(a,[])),xm({changedNodes:s,changedEdges:l,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:a,getNodes:i}=t();let s,l=null;o?s=n.map(d=>as(d,!0)):(s=wh(a,n),l=wh(i(),[])),xm({changedNodes:l,changedEdges:s,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:a,getNodes:i}=t(),s=n||i(),l=o||a,d=s.map(p=>(p.selected=!1,as(p.id,!1))),h=l.map(p=>as(p.id,!1));xm({changedNodes:d,changedEdges:h,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:o,maxZoom:a}=t();o==null||o.scaleExtent([n,a]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:o,minZoom:a}=t();o==null||o.scaleExtent([a,n]),e({maxZoom:n})},setTranslateExtent:n=>{var o;(o=t().d3Zoom)==null||o.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:o}=t(),i=o().filter(l=>l.selected).map(l=>as(l.id,!1)),s=n.filter(l=>l.selected).map(l=>as(l.id,!1));xm({changedNodes:i,changedEdges:s,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:o}=t();o.forEach(a=>{a.positionAbsolute=xF(a.position,n)}),e({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:a,height:i,d3Zoom:s,d3Selection:l,translateExtent:d}=t();if(!s||!l||!n.x&&!n.y)return!1;const h=Ms.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),p=[[0,0],[a,i]],m=s==null?void 0:s.constrain()(h,p,d);return s.transform(l,m),o[0]!==m.x||o[1]!==m.y||o[2]!==m.k},cancelConnection:()=>e({connectionNodeId:Fi.connectionNodeId,connectionHandleId:Fi.connectionHandleId,connectionHandleType:Fi.connectionHandleType,connectionStatus:Fi.connectionStatus,connectionStartHandle:Fi.connectionStartHandle,connectionEndHandle:Fi.connectionEndHandle}),reset:()=>e({...Fi})}),Object.is),$$=({children:e})=>{const t=k.useRef(null);return t.current||(t.current=JTt()),le.createElement(kIt,{value:t.current},e)};$$.displayName="ReactFlowProvider";const rle=({children:e})=>k.useContext(T$)?le.createElement(le.Fragment,null,e):le.createElement($$,null,e);rle.displayName="ReactFlowWrapper";const eRt={input:Dce,default:QH,output:Oce,group:LF},tRt={default:gP,straight:_F,step:MF,smoothstep:R$,simplebezier:bF},nRt=[0,0],oRt=[15,15],aRt={x:0,y:0,zoom:1},rRt={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},AF=k.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:a,nodeTypes:i=eRt,edgeTypes:s=tRt,onNodeClick:l,onEdgeClick:d,onInit:h,onMove:p,onMoveStart:m,onMoveEnd:v,onConnect:x,onConnectStart:M,onConnectEnd:b,onClickConnectStart:C,onClickConnectEnd:_,onNodeMouseEnter:N,onNodeMouseMove:A,onNodeMouseLeave:I,onNodeContextMenu:R,onNodeDoubleClick:j,onNodeDragStart:D,onNodeDrag:H,onNodeDragStop:U,onNodesDelete:z,onEdgesDelete:Z,onSelectionChange:q,onSelectionDragStart:G,onSelectionDrag:E,onSelectionDragStop:O,onSelectionContextMenu:P,onSelectionStart:X,onSelectionEnd:W,connectionMode:V=l1.Strict,connectionLineType:L=cs.Bezier,connectionLineStyle:Y,connectionLineComponent:F,connectionLineContainerStyle:T,deleteKeyCode:K="Backspace",selectionKeyCode:Q="Shift",selectionOnDrag:ne=!1,selectionMode:te=tp.Full,panActivationKeyCode:ce="Space",multiSelectionKeyCode:me=yP()?"Meta":"Control",zoomActivationKeyCode:ke=yP()?"Meta":"Control",snapToGrid:Ee=!1,snapGrid:Ie=oRt,onlyRenderVisibleElements:Te=!1,selectNodesOnDrag:qe=!0,nodesDraggable:ct,nodesConnectable:jt,nodesFocusable:We,nodeOrigin:Le=nRt,edgesFocusable:Rt,edgesUpdatable:eo,elementsSelectable:An,defaultViewport:wn=aRt,minZoom:On=.5,maxZoom:so=2,translateExtent:wo=eV,preventScrolling:fe=!0,nodeExtent:be,defaultMarkerColor:Oe="#b1b1b7",zoomOnScroll:He=!0,zoomOnPinch:kt=!0,panOnScroll:ft=!1,panOnScrollSpeed:tn=.5,panOnScrollMode:Kt=Od.Free,zoomOnDoubleClick:bn=!0,panOnDrag:rn=!0,onPaneClick:At,onPaneMouseEnter:Dt,onPaneMouseMove:En,onPaneMouseLeave:Qa,onPaneScroll:Ja,onPaneContextMenu:er,children:tr,onEdgeContextMenu:ra,onEdgeDoubleClick:Pr,onEdgeMouseEnter:$r,onEdgeMouseMove:qs,onEdgeMouseLeave:Hs,onEdgeUpdate:ee,onEdgeUpdateStart:re,onEdgeUpdateEnd:de,onReconnect:xe,onReconnectStart:Ce,onReconnectEnd:Pe,reconnectRadius:Ke=10,edgeUpdaterRadius:Re=10,onNodesChange:Fe,onEdgesChange:Ue,noDragClassName:Qe="nodrag",noWheelClassName:Ve="nowheel",noPanClassName:tt="nopan",fitView:Mt=!1,fitViewOptions:Bt,connectOnClick:Qt=!0,attributionPosition:St,proOptions:xt,defaultEdgeOptions:nr,elevateNodesOnSelect:to=!0,elevateEdgesOnSelect:bo=!1,disableKeyboardA11y:no=!1,autoPanOnConnect:or=!0,autoPanOnNodeDrag:ar=!0,connectionRadius:Vs=20,isValidConnection:Mo,onError:ja,style:dt,id:qn,nodeDragThreshold:Do,...zo},Dr)=>{const zt=qn||"1";return le.createElement("div",{...zo,style:{...dt,...rRt},ref:Dr,className:ko(["react-flow",a]),"data-testid":"rf__wrapper",id:qn},le.createElement(rle,null,le.createElement(QTt,{onInit:h,onMove:p,onMoveStart:m,onMoveEnd:v,onNodeClick:l,onEdgeClick:d,onNodeMouseEnter:N,onNodeMouseMove:A,onNodeMouseLeave:I,onNodeContextMenu:R,onNodeDoubleClick:j,nodeTypes:i,edgeTypes:s,connectionLineType:L,connectionLineStyle:Y,connectionLineComponent:F,connectionLineContainerStyle:T,selectionKeyCode:Q,selectionOnDrag:ne,selectionMode:te,deleteKeyCode:K,multiSelectionKeyCode:me,panActivationKeyCode:ce,zoomActivationKeyCode:ke,onlyRenderVisibleElements:Te,selectNodesOnDrag:qe,defaultViewport:wn,translateExtent:wo,minZoom:On,maxZoom:so,preventScrolling:fe,zoomOnScroll:He,zoomOnPinch:kt,zoomOnDoubleClick:bn,panOnScroll:ft,panOnScrollSpeed:tn,panOnScrollMode:Kt,panOnDrag:rn,onPaneClick:At,onPaneMouseEnter:Dt,onPaneMouseMove:En,onPaneMouseLeave:Qa,onPaneScroll:Ja,onPaneContextMenu:er,onSelectionContextMenu:P,onSelectionStart:X,onSelectionEnd:W,onEdgeContextMenu:ra,onEdgeDoubleClick:Pr,onEdgeMouseEnter:$r,onEdgeMouseMove:qs,onEdgeMouseLeave:Hs,onReconnect:xe??ee,onReconnectStart:Ce??re,onReconnectEnd:Pe??de,reconnectRadius:Ke??Re,defaultMarkerColor:Oe,noDragClassName:Qe,noWheelClassName:Ve,noPanClassName:tt,elevateEdgesOnSelect:bo,rfId:zt,disableKeyboardA11y:no,nodeOrigin:Le,nodeExtent:be}),le.createElement(YIt,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:x,onConnectStart:M,onConnectEnd:b,onClickConnectStart:C,onClickConnectEnd:_,nodesDraggable:ct,nodesConnectable:jt,nodesFocusable:We,edgesFocusable:Rt,edgesUpdatable:eo,elementsSelectable:An,elevateNodesOnSelect:to,minZoom:On,maxZoom:so,nodeExtent:be,onNodesChange:Fe,onEdgesChange:Ue,snapToGrid:Ee,snapGrid:Ie,connectionMode:V,translateExtent:wo,connectOnClick:Qt,defaultEdgeOptions:nr,fitView:Mt,fitViewOptions:Bt,onNodesDelete:z,onEdgesDelete:Z,onNodeDragStart:D,onNodeDrag:H,onNodeDragStop:U,onSelectionDrag:E,onSelectionDragStart:G,onSelectionDragStop:O,noPanClassName:tt,nodeOrigin:Le,rfId:zt,autoPanOnConnect:or,autoPanOnNodeDrag:ar,onError:ja,connectionRadius:Vs,isValidConnection:Mo,nodeDragThreshold:Do}),le.createElement(XIt,{onSelectionChange:q}),tr,le.createElement(wIt,{proOptions:xt,position:St}),le.createElement(eTt,{rfId:zt,disableKeyboardA11y:no})))});AF.displayName="ReactFlow";function iRt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,a]of e)if(!Object.is(a,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}function sRt(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},le.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function cRt(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},le.createElement("path",{d:"M0 0h32v4.2H0z"}))}function lRt(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},le.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function uRt(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},le.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function dRt(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},le.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const Bf=({children:e,className:t,...n})=>le.createElement("button",{type:"button",className:ko(["react-flow__controls-button",t]),...n},e);Bf.displayName="ControlButton";const hRt=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),ile=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:a,onZoomIn:i,onZoomOut:s,onFitView:l,onInteractiveChange:d,className:h,children:p,position:m="bottom-left"})=>{const v=Jn(),[x,M]=k.useState(!1),{isInteractive:b,minZoomReached:C,maxZoomReached:_}=un(hRt,iRt),{zoomIn:N,zoomOut:A,fitView:I}=P$();if(k.useEffect(()=>{M(!0)},[]),!x)return null;const R=()=>{N(),i==null||i()},j=()=>{A(),s==null||s()},D=()=>{I(a),l==null||l()},H=()=>{v.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),d==null||d(!b)};return le.createElement(vce,{className:ko(["react-flow__controls",h]),position:m,style:e,"data-testid":"rf__controls"},t&&le.createElement(le.Fragment,null,le.createElement(Bf,{onClick:R,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:_},le.createElement(sRt,null)),le.createElement(Bf,{onClick:j,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:C},le.createElement(cRt,null))),n&&le.createElement(Bf,{className:"react-flow__controls-fitview",onClick:D,title:"fit view","aria-label":"fit view"},le.createElement(lRt,null)),o&&le.createElement(Bf,{className:"react-flow__controls-interactive",onClick:H,title:"toggle interactivity","aria-label":"toggle interactivity"},b?le.createElement(dRt,null):le.createElement(uRt,null)),p)};ile.displayName="Controls";var sle=k.memo(ile);function fRt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,a]of e)if(!Object.is(a,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}var Ba;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ba||(Ba={}));function pRt({color:e,dimensions:t,lineWidth:n}){return le.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function yRt({color:e,radius:t}){return le.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const mRt={[Ba.Dots]:"#91919a",[Ba.Lines]:"#eee",[Ba.Cross]:"#e2e2e2"},gRt={[Ba.Dots]:1,[Ba.Lines]:1,[Ba.Cross]:6},vRt=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function cle({id:e,variant:t=Ba.Dots,gap:n=20,size:o,lineWidth:a=1,offset:i=2,color:s,style:l,className:d}){const h=k.useRef(null),{transform:p,patternId:m}=un(vRt,fRt),v=s||mRt[t],x=o||gRt[t],M=t===Ba.Dots,b=t===Ba.Cross,C=Array.isArray(n)?n:[n,n],_=[C[0]*p[2]||1,C[1]*p[2]||1],N=x*p[2],A=b?[N,N]:_,I=M?[N/i,N/i]:[A[0]/i,A[1]/i];return le.createElement("svg",{className:ko(["react-flow__background",d]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:h,"data-testid":"rf__background"},le.createElement("pattern",{id:m+e,x:p[0]%_[0],y:p[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${I[0]},-${I[1]})`},M?le.createElement(yRt,{color:v,radius:N/i}):le.createElement(pRt,{dimensions:A,color:v,lineWidth:a})),le.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+e})`}))}cle.displayName="Background";var lle=k.memo(cle);function bm(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}const Be=FJ(QJ((e,t)=>({nodes:[],edges:[],command:null,isLoading:!0,isSaving:!1,editorType:"command",availableNodes:{},permissions:[],chatTypes:[],isMenuOpen:!1,menuPosition:{top:0,left:0,flowPosition:{x:0,y:0}},connectingPin:null,variables:[],commandArguments:[],init:async(n,o,a)=>{e({isLoading:!0,editorType:a,variables:[],commandArguments:[]});try{const[i,s]=await Promise.all([t().fetchAvailableNodes(n,a),t().fetchPermissions(n)]);let l,d,h;if(o==="new")if(a==="command"){const C=await t().fetchManagementData(n);l={name:"Новая команда",description:"Описание новой команды",graphJson:JSON.stringify({nodes:[],edges:[],variables:[]}),argumentsJson:"[]",isEnabled:!0,cooldown:0,allowedChatTypes:'["chat", "private"]'},e({chatTypes:C.chatTypes})}else l={name:"Новый граф",graphJson:JSON.stringify({nodes:[],edges:[],variables:[]}),variables:"[]",triggers:"[]",isEnabled:!0};else if(a==="command"){const C=await t().fetchManagementData(n);l=C.commands.find(_=>_.id===parseInt(o)),e({chatTypes:C.chatTypes})}else l=await Ne(`/api/bots/${n}/event-graphs/${o}`);if(!l)throw new Error(a==="command"?"Команда не найдена.":"Граф события не найден.");let p;try{p=l.graphJson?JSON.parse(l.graphJson):null}catch(C){console.error("Ошибка парсинга graphJson:",C),p=null}p||(p={nodes:[],edges:[],variables:[]}),p.variables=p.variables||[];const m=l.argumentsJson&&JSON.parse(l.argumentsJson)||[],v=l.triggers&&(typeof l.triggers=="string"?JSON.parse(l.triggers):l.triggers)||[],x=p.variables;h={...l,variables:x,triggers:v,arguments:m},d=p,e({command:h,availableNodes:i,permissions:s,variables:x,commandArguments:m});const M=(d.connections||[]).map(C=>({id:C.id,source:C.sourceNodeId,target:C.targetNodeId,sourceHandle:C.sourcePinId,targetHandle:C.targetPinId}));let b=(d.nodes||[]).map(C=>a==="event"?{...C,deletable:!0}:C.type==="event:command"?{...C,deletable:!1}:{...C,deletable:!0});a==="command"&&b.every(C=>C.type!=="event:command")&&b.unshift({id:"start",type:"event:command",position:{x:100,y:100},deletable:!1}),e({nodes:b,edges:M,isLoading:!1})}catch(i){console.error("Ошибка инициализации редактора:",i),Vt({variant:"destructive",title:"Ошибка загрузки",description:i.message}),e({isLoading:!1})}},fetchCommand:async(n,o)=>{const a=await Ne(`/api/bots/${n}/management-data`),i=a.commands.find(s=>s.id===parseInt(o));if(!i)throw new Error("Команда не найдена");return e({chatTypes:a.chatTypes}),i},fetchAvailableNodes:async(n,o)=>await Ne(`/api/bots/${n}/visual-editor/nodes?graphType=${o}`),fetchPermissions:async n=>await Ne(`/api/bots/${n}/visual-editor/permissions`),fetchManagementData:async n=>await Ne(`/api/bots/${n}/management-data`),onNodesChange:n=>{e(o=>{const a=n.filter(i=>{if(i.type==="remove"){const s=o.nodes.find(l=>l.id===i.id);return(s==null?void 0:s.deletable)!==!1}return!0});o.nodes=Xce(a,o.nodes)})},onEdgesChange:n=>{e(o=>{o.edges=pTt(n,o.edges)})},onConnect:n=>{e(o=>{o.edges=WH(n,o.edges),o.connectingPin=null})},addNode:(n,o,a=!0)=>{const i={};(n==="string:concat"||n==="logic:operation"||n==="flow:sequence")&&(i.pinCount=2),(n==="data:array_literal"||n==="data:make_object")&&(i.pinCount=0);const s={id:`${n}-${bm()}`,type:n,position:o,data:i};return a&&e(l=>{l.nodes.push(s)}),s},duplicateNode:n=>{const o=t().nodes.find(i=>i.id===n);if(!o||o.type==="event:command")return;const a={...o,id:`${o.type}-${bm()}`,position:{x:o.position.x+30,y:o.position.y+30},data:{...o.data},selected:!0};e(i=>{i.nodes.forEach(s=>s.selected=!1),i.nodes.push(a)})},appendNode:n=>{e(o=>{o.nodes.push(n)})},updateCommand:n=>{e(o=>{o.command={...o.command,...n}})},addArgument:()=>{e(n=>{const o=JSON.parse(n.command.argumentsJson||"[]"),a={id:bm(),name:"newArg",type:"string",required:!0},i=[...o,a];n.command.argumentsJson=JSON.stringify(i),n.commandArguments=i})},updateArgument:(n,o)=>{e(a=>{const s=JSON.parse(a.command.argumentsJson||"[]").map(l=>l.id===n?{...l,...o}:l);a.command.argumentsJson=JSON.stringify(s),a.commandArguments=s})},removeArgument:n=>{e(o=>{const i=JSON.parse(o.command.argumentsJson||"[]").filter(s=>s.id!==n);o.command.argumentsJson=JSON.stringify(i),o.commandArguments=i})},addVariable:()=>{e(n=>{const o=n.command.variables||[],a={id:bm(),name:"newVar",type:"string",value:""},i=[...o,a];n.command.variables=i,n.variables=i})},updateVariable:(n,o)=>{e(a=>{const s=(a.command.variables||[]).map(l=>{if(l.id===n){const d={...l,...o};if(o.type&&o.type!==l.type)switch(o.type){case"string":d.value="";break;case"number":d.value="0";break;case"boolean":d.value="false";break;case"array":d.value="[]";break;default:d.value=""}return d}return l});a.command.variables=s,a.variables=s})},removeVariable:n=>{e(o=>{const i=(o.command.variables||[]).filter(s=>s.id!==n);o.command.variables=i,o.variables=i})},updateNodeData:(n,o)=>{e(a=>{const i=a.nodes.find(s=>s.id===n);i&&(i.data={...i.data,...o})})},openMenu:(n,o,a)=>e({isMenuOpen:!0,menuPosition:{top:n,left:o,flowPosition:a}}),closeMenu:()=>e({isMenuOpen:!1}),onConnectStart:(n,{handleType:o,nodeId:a,handleId:i})=>{const s=t().nodes.find(l=>l.id===a);e({connectingPin:{type:o,nodeId:a,pinId:i,nodeType:s==null?void 0:s.type}})},setConnectingPin:n=>e({connectingPin:n}),connectAndAddNode:async(n,o)=>{const{connectingPin:a,addNode:i,onConnect:s,command:l}=t();if(!a)return;const d=l.botId;try{const h=await Ne(`/api/bots/${d}/visual-editor/node-config?types[]=${a.nodeType}&types[]=${n}`),p=h.find(b=>b.type===a.nodeType),m=h.find(b=>b.type===n);if(!p||!m)throw new Error("Не удалось получить конфигурацию узлов.");const v=p.outputs.find(b=>b.id===a.pinId),x=m.inputs.find(b=>b.type===v.type||b.type==="Wildcard"||v.type==="Wildcard"),M=i(n,o,!1);if(v&&x){const b={source:a.nodeId,sourceHandle:a.pinId,target:M.id,targetHandle:x.id};e(C=>{C.nodes.push(M),C.edges=WH(b,C.edges)})}else e(b=>{b.nodes.push(M)})}catch(h){console.error("Ошибка при добавлении и подключении узла:",h),Vt({variant:"destructive",title:"Ошибка",description:"Ошибка добавления узла."})}finally{e({connectingPin:null})}},saveGraph:async()=>{e({isSaving:!0});try{const{command:n,nodes:o,edges:a,editorType:i,variables:s}=t(),{id:l,botId:d,name:h,description:p,isEnabled:m,permissionId:v,allowedChatTypes:x,cooldown:M,aliases:b,argumentsJson:C}=n,_={nodes:o.map(({id:I,type:R,position:j,data:D})=>({id:I,type:R,position:j,data:D})),connections:a.map(({id:I,source:R,target:j,sourceHandle:D,targetHandle:H})=>({id:I,sourceNodeId:R,targetNodeId:j,sourcePinId:D,targetPinId:H})),variables:s||[]},N={name:h,description:p,isEnabled:m,graphJson:JSON.stringify(_)};i==="event"?N.eventType=n.eventType:(N.aliases=b,N.cooldown=M,N.permissionId=v,N.allowedChatTypes=x,N.argumentsJson=C);const A=i==="command"?`/api/bots/${d}/commands/${l}`:`/api/bots/${d}/event-graphs/${l}`;await Ne(A,{method:"PUT",body:N}),Vt({title:"Успешно",description:"Граф сохранен."})}catch(n){console.error("Ошибка сохранения графа:",n),Vt({variant:"destructive",title:"Ошибка",description:`Ошибка сохранения графа: ${n.message}`})}finally{e({isSaving:!1})}},addDynamicPin:n=>{e(o=>{var d;const a=o.nodes.find(h=>h.id===n);if(!a)return;const i=((d=a.data)==null?void 0:d.pinCount)||0;let l={pinCount:i+1};a.type==="data:make_object"&&(l[`key_${i}`]=`key${i}`,l[`value_${i}`]=null),a.data={...a.data,...l}})},removeDynamicPin:(n,o)=>{e(a=>{const i=a.nodes.find(m=>m.id===n);if(!i)return;const s=parseInt(o.match(/_(\d+)$/)[1]),l={...i.data},d=l.pinCount||0;for(let m=s;m<d-1;m++)i.type==="data:make_object"?(l[`key_${m}`]=l[`key_${m+1}`],l[`value_${m}`]=l[`value_${m+1}`]):l[`pin_${m}`]=l[`pin_${m+1}`];d>0&&(i.type==="data:make_object"?(delete l[`key_${d-1}`],delete l[`value_${d-1}`]):delete l[`pin_${d-1}`]),l.pinCount=Math.max(0,d-1),i.data=l;const h=i.type==="data:make_object"?[`key_${s}`,`value_${s}`]:[`pin_${s}`],p=a.edges.filter(m=>m.target===n&&h.includes(m.targetHandle)).map(m=>m.id);a.edges=a.edges.filter(m=>!p.includes(m.id))})},updateMakeObjectKey:(n,o,a)=>{e(i=>{const s=i.nodes.find(l=>l.id===n);s&&s.type==="data:make_object"&&(s.data[`key_${o}`]=a)})},setInitialState:(n,o,a)=>{t().init(n,o,a)}}))),ule=()=>{const{availableNodes:e}=Be(),t=(n,o)=>{n.dataTransfer.setData("application/reactflow",o),n.dataTransfer.effectAllowed="move"};return u.jsxs("div",{className:"p-2 h-full overflow-y-auto",children:[u.jsx("h3",{className:"text-lg font-bold mb-2 text-center",children:"Добавить ноду"}),u.jsx(die,{type:"multiple",className:"w-full",defaultValue:Object.keys(e),children:Object.entries(e).map(([n,o])=>u.jsxs(jB,{value:n,children:[u.jsx(AB,{children:n}),u.jsx(EB,{children:u.jsx("div",{className:"space-y-2",children:o.map(a=>u.jsx("div",{onDragStart:i=>t(i,a.type),draggable:!0,className:"p-2 border rounded-md cursor-grab bg-slate-700 hover:bg-slate-600 transition-colors",children:a.label},a.type))})})]},n))})]})},kRt=()=>{const e=Be(i=>i.command),t=Be(i=>i.addVariable),n=Be(i=>i.updateVariable),o=Be(i=>i.removeVariable);Be(i=>i.editorType);const a=(e==null?void 0:e.variables)||[];return u.jsxs("div",{className:"space-y-2 p-2 border-t",children:[u.jsx("h4",{className:"font-bold",children:"Переменные"}),u.jsx("div",{className:"space-y-2",children:a.map(i=>u.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md",children:[u.jsx(Ze,{placeholder:"Имя",value:i.name,onChange:s=>n(i.id,{name:s.target.value}),className:"flex-grow"}),u.jsxs(Wn,{value:i.type,onValueChange:s=>n(i.id,{type:s}),children:[u.jsx(Fn,{className:"w-[120px]",children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"string",children:"String"}),u.jsx(et,{value:"number",children:"Number"}),u.jsx(et,{value:"boolean",children:"Boolean"}),u.jsx(et,{value:"array",children:"Array"})]})]}),u.jsx(Ze,{placeholder:"Значение по умолч.",value:i.value,onChange:s=>n(i.id,{value:s.target.value}),className:"flex-grow"}),u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>o(i.id),children:u.jsx(mo,{className:"h-4 w-4"})})]},i.id))}),u.jsx(pe,{variant:"outline",size:"sm",onClick:t,children:"Добавить переменную"})]})},dle=()=>{const e=Be(N=>N.command),t=Be(N=>N.updateCommand),n=Be(N=>N.addArgument),o=Be(N=>N.updateArgument),a=Be(N=>N.removeArgument),i=Be(N=>N.permissions),l=Be(N=>N.editorType)==="event",d=(N,A=[])=>{try{return N?Array.isArray(N)?N:JSON.parse(N):A}catch{return console.warn("Failed to parse JSON, using default value:",N),A}},h=l?[]:d(e==null?void 0:e.aliases),p=l?[]:d(e==null?void 0:e.allowedChatTypes,["chat","private"]),[m,v]=k.useState(h.join(", ")),[x,M]=k.useState(p.join(", "));if(k.useEffect(()=>{e&&(v(d(e.aliases).join(", ")),M(d(e.allowedChatTypes,["chat","private"]).join(", ")))},[e]),!e)return u.jsx("div",{className:"p-4",children:"Загрузка настроек..."});const b=l?[]:d(e.argumentsJson),C=()=>{const N=m.split(",").map(A=>A.trim()).filter(Boolean);t({aliases:JSON.stringify(N)})},_=()=>{const N=x.split(",").map(A=>A.trim()).filter(Boolean);t({allowedChatTypes:JSON.stringify(N)})};return u.jsxs("div",{className:"p-4 space-y-4",children:[u.jsx("h3",{className:"text-lg font-bold",children:l?"Настройки графа событий":"Настройки команды"}),u.jsxs("div",{children:[u.jsx(_e,{htmlFor:"command-name",children:l?"Имя графа":"Имя команды"}),u.jsx(Ze,{id:"command-name",value:e.name||"",onChange:N=>t({name:N.target.value})})]}),u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ci,{id:"is-enabled",checked:e.isEnabled,onCheckedChange:N=>t({isEnabled:N})}),u.jsx(_e,{htmlFor:"is-enabled",children:"Включено"})]}),!l&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{children:[u.jsx(_e,{htmlFor:"command-description",children:"Описание"}),u.jsx(ki,{id:"command-description",value:e.description||"",onChange:N=>t({description:N.target.value})})]}),u.jsxs("div",{children:[u.jsx(_e,{htmlFor:"command-aliases",children:"Алиасы (через запятую)"}),u.jsx(Ze,{id:"command-aliases",value:m,onChange:N=>v(N.target.value),onBlur:C})]}),u.jsxs("div",{children:[u.jsx(_e,{htmlFor:"command-permission",children:"Права доступа"}),u.jsxs(Wn,{value:e.permissionId?e.permissionId.toString():"none",onValueChange:N=>t({permissionId:N==="none"?null:parseInt(N)}),children:[u.jsx(Fn,{id:"command-permission",children:u.jsx(Kn,{placeholder:"Выберите право..."})}),u.jsxs(Un,{children:[u.jsx(et,{value:"none",children:"Нет"}),i.map(N=>u.jsx(et,{value:N.id.toString(),children:N.name},N.id))]})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{children:"Типы чатов (через запятую)"}),u.jsx(Ze,{id:"command-chat-types",value:x,onChange:N=>M(N.target.value),onBlur:_})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("h4",{className:"font-bold",children:"Аргументы команды"}),u.jsx("div",{className:"space-y-2",children:b.map((N,A)=>u.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md",children:[u.jsx(Ze,{placeholder:"Имя",value:N.name,onChange:I=>o(N.id,{name:I.target.value}),className:"flex-grow"}),u.jsxs(Wn,{value:N.type,onValueChange:I=>o(N.id,{type:I}),children:[u.jsx(Fn,{className:"w-[120px]",children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"string",children:"String"}),u.jsx(et,{value:"number",children:"Number"}),u.jsx(et,{value:"boolean",children:"Boolean"})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(ci,{id:`required-${N.id}`,checked:N.required,onCheckedChange:I=>o(N.id,{required:I})}),u.jsx(_e,{htmlFor:`required-${N.id}`,children:"Обяз."})]}),u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>a(N.id),children:u.jsx(mo,{className:"h-4 w-4"})})]},N.id||A))}),u.jsx(pe,{variant:"outline",size:"sm",onClick:n,children:"Добавить аргумент"})]})]}),u.jsx(kRt,{})]})},tV=le.forwardRef(({className:e,value:t,onChange:n,...o},a)=>{const[i,s]=k.useState(0),l=k.useRef(null);return k.useLayoutEffect(()=>{l.current&&s(l.current.offsetWidth)},[t]),u.jsxs("div",{className:"relative inline-block",children:[u.jsx("input",{ref:a,type:"text",value:t,onChange:n,className:ge("h-8 transition-all duration-200 ease-in-out",e),style:{width:i+16},...o}),u.jsx("span",{ref:l,className:"absolute invisible whitespace-pre text-sm px-3 py-1",children:t})]})});tV.displayName="AutosizeInput";const xRt={Exec:"#ffffff",Boolean:"#dc2626",String:"#db2777",Number:"#2563eb",User:"#f59e0b",Array:"#3b82f6",Wildcard:"#6b7280",Object:"#9333ea"};function wRt({data:e,type:t,id:n}){const o=Be(v=>v.availableNodes),a=Be(v=>v.updateNodeData),i=Be(v=>v.edges),s=Be(v=>v.variables),l=Be(v=>v.commandArguments);Be(v=>v.editorType);const d=k.useMemo(()=>Object.values(o).flat().find(v=>v.type===t),[o,t]),h=k.useMemo(()=>{var x;let v=(x=d==null?void 0:d.pins)!=null&&x.inputs?[...d.pins.inputs]:[];if(t==="data:array_literal")for(let M=0;M<(e.pinCount||0);M++)v.push({id:`item_${M}`,name:`[${M}]`,type:"Wildcard"});else if(t==="data:make_object")for(let M=0;M<(e.pinCount||0);M++)v.push({id:`key_${M}`,name:`Ключ ${M}`,type:"String"}),v.push({id:`value_${M}`,name:`Значение ${M}`,type:"Wildcard"});else if(t==="object:create"&&!e.advanced)for(let M=0;M<(e.pinCount||0);M++)v.push({id:`key_${M}`,name:`Ключ ${M}`,type:"String"}),v.push({id:`value_${M}`,name:`Значение ${M}`,type:"Wildcard"});else if(t==="string:concat"){v=[];const M=e.pinCount||2;for(let b=0;b<M;b++)v.push({id:`pin_${b}`,name:`Строка ${b}`,type:"String"})}else if(t==="logic:operation"&&e.operation!=="NOT"){v=[];const M=e.pinCount||2;for(let b=0;b<M;b++)v.push({id:`pin_${b}`,name:String.fromCharCode(65+b),type:"Boolean"})}else if(t==="logic:operation"&&e.operation==="NOT")v=v.filter(M=>M.id==="a");else if(t==="flow:branch"&&e.advanced){const M=v.findIndex(b=>b.id==="condition");M!==-1&&v.splice(M,1);for(let b=0;b<(e.pinCount||0);b++)v.push({id:`pin_${b}`,name:String.fromCharCode(65+b),type:"Boolean"})}else if(t==="flow:branch"&&!e.advanced)return v.find(M=>M.id==="condition")||v.push({id:"condition",name:"Condition",type:"Boolean",required:!0}),v.filter(M=>M.id==="condition"||M.type==="Exec");return v},[d,e,t]),p=k.useMemo(()=>{var v;if(t==="flow:sequence"){const x=e.pinCount||2,M=[];for(let b=0;b<x;b++)M.push({id:`exec_${b}`,name:`${b}`,type:"Exec"});return M}return((v=d==null?void 0:d.pins)==null?void 0:v.outputs)||[]},[d,e,t]);if(!d)return u.jsxs("div",{children:["Неизвестный тип ноды: ",t]});const m=(v,x)=>{const M=x?Ye.Left:Ye.Right,b={background:xRt[v.type]||"#333"};return u.jsxs("div",{className:"relative p-2 flex items-center",children:[u.jsx(np,{type:x?"target":"source",position:M,id:v.id,style:{...b,width:"16px",height:"16px"},className:"w-4 h-4"}),u.jsx("span",{className:x?"pl-4":"pr-4",children:v.name})]},v.id)};return u.jsxs(Nn,{className:"min-w-64 bg-slate-800 border-slate-600 text-white",children:[u.jsxs(kn,{className:"bg-slate-700 p-2 rounded-t-lg",children:[u.jsx(xn,{className:"text-sm text-center",children:d.name||d.label}),d.description&&u.jsx("p",{className:"text-xs text-slate-300 text-center mt-1 leading-tight",children:d.description})]}),u.jsxs(Ln,{className:"p-2 flex flex-col",children:[t==="data:cast"&&u.jsxs("div",{className:"p-2 border-t border-slate-700",children:[u.jsx(_e,{children:"Целевой тип:"}),u.jsxs(Wn,{value:e.targetType||"String",onValueChange:v=>a(n,{targetType:v}),children:[u.jsx(Fn,{children:u.jsx(Kn,{placeholder:"Выберите тип..."})}),u.jsxs(Un,{children:[u.jsx(et,{value:"String",children:"String (Текст)"}),u.jsx(et,{value:"Number",children:"Number (Число)"}),u.jsx(et,{value:"Boolean",children:"Boolean (Да/Нет)"})]})]})]}),t==="data:get_argument"&&u.jsxs("div",{className:"p-2",children:[u.jsx(_e,{children:"Имя аргумента:"}),u.jsxs(Wn,{value:e.argumentName||"",onValueChange:v=>a(n,{argumentName:v}),children:[u.jsx(Fn,{children:u.jsx(Kn,{placeholder:"Выберите аргумент..."})}),u.jsx(Un,{children:(l||[]).map(v=>u.jsxs(et,{value:v.name,children:[v.name," (",v.type,")"]},v.id))})]})]}),t==="data:get_variable"&&u.jsxs("div",{className:"p-2",children:[u.jsx(_e,{children:"Имя переменной:"}),u.jsxs(Wn,{value:e.variableName||"",onValueChange:v=>a(n,{variableName:v}),children:[u.jsx(Fn,{children:u.jsx(Kn,{placeholder:"Выберите переменную..."})}),u.jsx(Un,{children:s.filter(v=>v.name).map(v=>u.jsxs(et,{value:v.name,children:[v.name," (",v.type,")"]},v.id))})]})]}),!1,u.jsxs("div",{className:"flex justify-between w-full",children:[u.jsxs("div",{className:"inputs flex flex-col items-start",children:[h.map(v=>{const x=i.some(M=>M.target===n&&M.targetHandle===v.id);return v.type==="Exec"?m(v,!0):u.jsxs("div",{className:"relative p-2 flex items-center w-full",children:[m(v,!0),!x&&v.type!=="Boolean"&&v.id!=="persist"&&u.jsx(tV,{className:"nodrag bg-slate-900 border-slate-500 rounded-md py-1 px-2 text-sm resize-none overflow-hidden",value:e[v.id]||"",onChange:M=>a(n,{[v.id]:M.target.value})}),!x&&v.type==="Boolean"&&u.jsxs(Wn,{value:String(e[v.id]===void 0?!1:e[v.id]),onValueChange:M=>a(n,{[v.id]:M==="true"}),children:[u.jsx(Fn,{className:"w-[100px] bg-slate-900 border-slate-500",children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"true",children:"True"}),u.jsx(et,{value:"false",children:"False"})]})]})]},v.id)}),t==="data:string_literal"&&u.jsx("div",{className:"p-2 w-full",children:u.jsx(tV,{className:"nodrag bg-slate-900 border-slate-500 rounded-md py-1 px-2 text-sm resize-none overflow-hidden w-full",value:e.value||"",onChange:v=>a(n,{value:v.target.value})})})]}),u.jsx("div",{className:"outputs flex flex-col items-end",children:p.map(v=>m(v,!1))})]}),t==="object:create"&&u.jsxs("div",{className:"p-2 border-t border-slate-700",children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsx(_e,{children:"Режим:"}),u.jsxs(Wn,{value:e.advanced?"advanced":"simple",onValueChange:v=>a(n,{advanced:v==="advanced"}),children:[u.jsx(Fn,{className:"w-[120px]",children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"simple",children:"Простой"}),u.jsx(et,{value:"advanced",children:"Продвинутый"})]})]})]}),e.advanced?u.jsxs("div",{children:[u.jsx(_e,{children:"JSON объект:"}),u.jsx("textarea",{className:"nodrag w-full h-32 bg-slate-900 border-slate-500 rounded-md p-2 text-sm font-mono resize-none",value:e.jsonValue||"{}",onChange:v=>a(n,{jsonValue:v.target.value}),placeholder:'{"key": "value", "nested": {"inner": 123}}'})]}):u.jsxs("div",{className:"flex items-center justify-center gap-2",children:[u.jsx(pe,{onClick:()=>a(n,{pinCount:(e.pinCount||0)+1}),className:"h-8 rounded-md px-3 text-xs",children:"Добавить"}),(e.pinCount||0)>0&&u.jsx(pe,{onClick:()=>a(n,{pinCount:(e.pinCount||0)-1}),variant:"destructive",className:"h-8 rounded-md px-3 text-xs",children:"Удалить"})]})]}),(t==="data:array_literal"||t==="data:make_object"||t==="string:concat")&&u.jsxs("div",{className:"p-2 border-t border-slate-700 flex items-center justify-center gap-2",children:[u.jsx(pe,{onClick:()=>{const v=e.pinCount||(t==="string:concat"?2:0);a(n,{pinCount:v+1})},className:"h-8 rounded-md px-3 text-xs",children:"Добавить"}),e.pinCount>(t==="string:concat"?2:0)&&u.jsx(pe,{onClick:()=>a(n,{pinCount:(e.pinCount||0)-1}),variant:"destructive",className:"h-8 rounded-md px-3 text-xs",children:"Удалить"})]}),t==="flow:sequence"&&u.jsxs("div",{className:"p-2 border-t border-slate-700 flex items-center justify-center gap-2",children:[u.jsx(pe,{onClick:()=>{const v=e.pinCount||2;a(n,{pinCount:v+1})},className:"h-8 rounded-md px-3 text-xs",children:"Добавить"}),u.jsx(pe,{onClick:()=>{const v=e.pinCount||2;v>1&&a(n,{pinCount:v-1})},variant:"destructive",className:"h-8 rounded-md px-3 text-xs",children:"Удалить"})]})]}),t==="flow:branch"&&u.jsxs("div",{className:"p-2 border-t border-slate-700 flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(_e,{children:"Режим:"}),u.jsxs(Wn,{value:e.advanced?"advanced":"simple",onValueChange:v=>a(n,{advanced:v==="advanced"}),children:[u.jsx(Fn,{className:"w-[120px]",children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"simple",children:"Простой"}),u.jsx(et,{value:"advanced",children:"Расширенный"})]})]})]}),e.advanced&&u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(_e,{children:"Оператор:"}),u.jsxs(Wn,{value:e.operator||"AND",onValueChange:v=>a(n,{operator:v,pinCount:v==="NOT"?1:e.pinCount||2}),children:[u.jsx(Fn,{className:"w-[100px]",children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"AND",children:"AND"}),u.jsx(et,{value:"OR",children:"OR"}),u.jsx(et,{value:"NOT",children:"NOT"})]})]}),e.operator!=="NOT"&&u.jsx(pe,{size:"sm",variant:"ghost",onClick:()=>a(n,{pinCount:(e.pinCount||2)+1}),children:"Добавить пин"})]})]}),t==="math:operation"&&u.jsxs("div",{className:"p-2 border-t border-slate-700",children:[u.jsx(_e,{children:"Операция:"}),u.jsxs(Wn,{value:e.operation||"+",onValueChange:v=>a(n,{operation:v}),children:[u.jsx(Fn,{children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"+",children:"Сложение (+)"}),u.jsx(et,{value:"-",children:"Вычитание (-)"}),u.jsx(et,{value:"*",children:"Умножение (*)"}),u.jsx(et,{value:"/",children:"Деление (/)"}),u.jsx(et,{value:">",children:"Больше (>)"}),u.jsx(et,{value:"<",children:"Меньше (<)"}),u.jsx(et,{value:"==",children:"Равно (==)"}),u.jsx(et,{value:">=",children:"Больше или равно (>=)"}),u.jsx(et,{value:"<=",children:"Меньше или равно (<=)"}),u.jsx(et,{value:"!=",children:"Не равно (!=)"})]})]})]}),t==="logic:operation"&&u.jsxs("div",{className:"p-2 border-t border-slate-700",children:[u.jsx(_e,{children:"Операция:"}),u.jsxs(Wn,{value:e.operation||"AND",onValueChange:v=>{const x=v==="NOT"?1:e.pinCount||2;a(n,{operation:v,pinCount:x})},children:[u.jsx(Fn,{children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"AND",children:"И (AND)"}),u.jsx(et,{value:"OR",children:"ИЛИ (OR)"}),u.jsx(et,{value:"NOT",children:"НЕ (NOT)"})]})]}),e.operation!=="NOT"&&u.jsxs("div",{className:"flex items-center justify-center gap-2 mt-2",children:[u.jsx(pe,{size:"sm",variant:"ghost",onClick:()=>a(n,{pinCount:(e.pinCount||2)+1}),children:"Добавить"}),(e.pinCount||0)>2&&u.jsx(pe,{size:"sm",variant:"destructive",onClick:()=>a(n,{pinCount:Math.max(2,(e.pinCount||2)-1)}),children:"Удалить"})]})]}),t==="logic:compare"&&u.jsxs("div",{className:"p-2 border-t border-slate-700",children:[u.jsx(_e,{children:"Операция:"}),u.jsxs(Wn,{value:e.operation||"==",onValueChange:v=>a(n,{operation:v}),children:[u.jsx(Fn,{children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"==",children:"Равно (==)"}),u.jsx(et,{value:"!=",children:"Не равно (!=)"}),u.jsx(et,{value:">",children:"Больше (>)"}),u.jsx(et,{value:"<",children:"Меньше (<)"}),u.jsx(et,{value:">=",children:"Больше или равно (>=)"}),u.jsx(et,{value:"<=",children:"Меньше или равно (<=)"})]})]})]})]})}const nV=le.memo(wRt),D$=k.createContext(null);D$.displayName="PanelGroupContext";const mn={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},EF=10,e1=k.useLayoutEffect,_Q=yV.useId,bRt=typeof _Q=="function"?_Q:()=>null;let MRt=0;function IF(e=null){const t=bRt(),n=k.useRef(e||t||null);return n.current===null&&(n.current=""+MRt++),e??n.current}function hle({children:e,className:t="",collapsedSize:n,collapsible:o,defaultSize:a,forwardedRef:i,id:s,maxSize:l,minSize:d,onCollapse:h,onExpand:p,onResize:m,order:v,style:x,tagName:M="div",...b}){const C=k.useContext(D$);if(C===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:_,expandPanel:N,getPanelSize:A,getPanelStyle:I,groupId:R,isPanelCollapsed:j,reevaluatePanelConstraints:D,registerPanel:H,resizePanel:U,unregisterPanel:z}=C,Z=IF(s),q=k.useRef({callbacks:{onCollapse:h,onExpand:p,onResize:m},constraints:{collapsedSize:n,collapsible:o,defaultSize:a,maxSize:l,minSize:d},id:Z,idIsFromProps:s!==void 0,order:v});k.useRef({didLogMissingDefaultSizeWarning:!1}),e1(()=>{const{callbacks:E,constraints:O}=q.current,P={...O};q.current.id=Z,q.current.idIsFromProps=s!==void 0,q.current.order=v,E.onCollapse=h,E.onExpand=p,E.onResize=m,O.collapsedSize=n,O.collapsible=o,O.defaultSize=a,O.maxSize=l,O.minSize=d,(P.collapsedSize!==O.collapsedSize||P.collapsible!==O.collapsible||P.maxSize!==O.maxSize||P.minSize!==O.minSize)&&D(q.current,P)}),e1(()=>{const E=q.current;return H(E),()=>{z(E)}},[v,Z,H,z]),k.useImperativeHandle(i,()=>({collapse:()=>{_(q.current)},expand:E=>{N(q.current,E)},getId(){return Z},getSize(){return A(q.current)},isCollapsed(){return j(q.current)},isExpanded(){return!j(q.current)},resize:E=>{U(q.current,E)}}),[_,N,A,j,Z,U]);const G=I(q.current,a);return k.createElement(M,{...b,children:e,className:t,id:Z,style:{...G,...x},[mn.groupId]:R,[mn.panel]:"",[mn.panelCollapsible]:o||void 0,[mn.panelId]:Z,[mn.panelSize]:parseFloat(""+G.flexGrow).toFixed(1)})}const fle=k.forwardRef((e,t)=>k.createElement(hle,{...e,forwardedRef:t}));hle.displayName="Panel";fle.displayName="forwardRef(Panel)";let oV=null,PR=-1,ls=null;function _Rt(e,t){if(t){const n=(t&vle)!==0,o=(t&kle)!==0,a=(t&xle)!==0,i=(t&wle)!==0;if(n)return a?"se-resize":i?"ne-resize":"e-resize";if(o)return a?"sw-resize":i?"nw-resize":"w-resize";if(a)return"s-resize";if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function SRt(){ls!==null&&(document.head.removeChild(ls),oV=null,ls=null,PR=-1)}function sq(e,t){var n,o;const a=_Rt(e,t);if(oV!==a){if(oV=a,ls===null&&(ls=document.createElement("style"),document.head.appendChild(ls)),PR>=0){var i;(i=ls.sheet)===null||i===void 0||i.removeRule(PR)}PR=(n=(o=ls.sheet)===null||o===void 0?void 0:o.insertRule(`*{cursor: ${a} !important;}`))!==null&&n!==void 0?n:-1}}function ple(e){return e.type==="keydown"}function yle(e){return e.type.startsWith("pointer")}function mle(e){return e.type.startsWith("mouse")}function z$(e){if(yle(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(mle(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function CRt(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function NRt(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function LRt(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:NQ(e),b:NQ(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),o=e;ht(o,"Stacking order can only be calculated for elements with a common ancestor");const a={a:CQ(SQ(n.a)),b:CQ(SQ(n.b))};if(a.a===a.b){const i=o.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let l=i.length;for(;l--;){const d=i[l];if(d===s.a)return 1;if(d===s.b)return-1}}return Math.sign(a.a-a.b)}const jRt=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ARt(e){var t;const n=getComputedStyle((t=gle(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function ERt(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||ARt(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||jRt.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function SQ(e){let t=e.length;for(;t--;){const n=e[t];if(ht(n,"Missing node"),ERt(n))return n}return null}function CQ(e){return e&&Number(getComputedStyle(e).zIndex)||0}function NQ(e){const t=[];for(;e;)t.push(e),e=gle(e);return t}function gle(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const vle=1,kle=2,xle=4,wle=8,IRt=CRt()==="coarse";let Fa=[],Hh=!1,us=new Map,O$=new Map;const ap=new Set;function TRt(e,t,n,o,a){var i;const{ownerDocument:s}=t,l={direction:n,element:t,hitAreaMargins:o,setResizeHandlerState:a},d=(i=us.get(s))!==null&&i!==void 0?i:0;return us.set(s,d+1),ap.add(l),vP(),function(){var p;O$.delete(e),ap.delete(l);const m=(p=us.get(s))!==null&&p!==void 0?p:1;if(us.set(s,m-1),vP(),m===1&&us.delete(s),Fa.includes(l)){const v=Fa.indexOf(l);v>=0&&Fa.splice(v,1),RF(),a("up",!0,null)}}}function RRt(e){const{target:t}=e,{x:n,y:o}=z$(e);Hh=!0,TF({target:t,x:n,y:o}),vP(),Fa.length>0&&(kP("down",e),e.preventDefault(),ble(t)||e.stopImmediatePropagation())}function cq(e){const{x:t,y:n}=z$(e);if(Hh&&e.buttons===0&&(Hh=!1,kP("up",e)),!Hh){const{target:o}=e;TF({target:o,x:t,y:n})}kP("move",e),RF(),Fa.length>0&&e.preventDefault()}function lq(e){const{target:t}=e,{x:n,y:o}=z$(e);O$.clear(),Hh=!1,Fa.length>0&&(e.preventDefault(),ble(t)||e.stopImmediatePropagation()),kP("up",e),TF({target:t,x:n,y:o}),RF(),vP()}function ble(e){let t=e;for(;t;){if(t.hasAttribute(mn.resizeHandle))return!0;t=t.parentElement}return!1}function TF({target:e,x:t,y:n}){Fa.splice(0);let o=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(o=e),ap.forEach(a=>{const{element:i,hitAreaMargins:s}=a,l=i.getBoundingClientRect(),{bottom:d,left:h,right:p,top:m}=l,v=IRt?s.coarse:s.fine;if(t>=h-v&&t<=p+v&&n>=m-v&&n<=d+v){if(o!==null&&document.contains(o)&&i!==o&&!i.contains(o)&&!o.contains(i)&&LRt(o,i)>0){let M=o,b=!1;for(;M&&!M.contains(i);){if(NRt(M.getBoundingClientRect(),l)){b=!0;break}M=M.parentElement}if(b)return}Fa.push(a)}})}function uq(e,t){O$.set(e,t)}function RF(){let e=!1,t=!1;Fa.forEach(o=>{const{direction:a}=o;a==="horizontal"?e=!0:t=!0});let n=0;O$.forEach(o=>{n|=o}),e&&t?sq("intersection",n):e?sq("horizontal",n):t?sq("vertical",n):SRt()}let dq;function vP(){var e;(e=dq)===null||e===void 0||e.abort(),dq=new AbortController;const t={capture:!0,signal:dq.signal};ap.size&&(Hh?(Fa.length>0&&us.forEach((n,o)=>{const{body:a}=o;n>0&&(a.addEventListener("contextmenu",lq,t),a.addEventListener("pointerleave",cq,t),a.addEventListener("pointermove",cq,t))}),us.forEach((n,o)=>{const{body:a}=o;a.addEventListener("pointerup",lq,t),a.addEventListener("pointercancel",lq,t)})):us.forEach((n,o)=>{const{body:a}=o;n>0&&(a.addEventListener("pointerdown",RRt,t),a.addEventListener("pointermove",cq,t))}))}function kP(e,t){ap.forEach(n=>{const{setResizeHandlerState:o}=n,a=Fa.includes(n);o(e,a,t)})}function PRt(){const[e,t]=k.useState(0);return k.useCallback(()=>t(n=>n+1),[])}function ht(e,t){if(!e)throw console.error(t),Error(t)}function u1(e,t,n=EF){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function oi(e,t,n=EF){return u1(e,t,n)===0}function Xo(e,t,n){return u1(e,t,n)===0}function $Rt(e,t,n){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++){const a=e[o],i=t[o];if(!Xo(a,i,n))return!1}return!0}function bh({panelConstraints:e,panelIndex:t,size:n}){const o=e[t];ht(o!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:a=0,collapsible:i,maxSize:s=100,minSize:l=0}=o;if(u1(n,l)<0)if(i){const d=(a+l)/2;u1(n,d)<0?n=a:n=l}else n=l;return n=Math.min(s,n),n=parseFloat(n.toFixed(EF)),n}function Ff({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:a,trigger:i}){if(Xo(e,0))return t;const s=[...t],[l,d]=o;ht(l!=null,"Invalid first pivot index"),ht(d!=null,"Invalid second pivot index");let h=0;if(i==="keyboard"){{const m=e<0?d:l,v=n[m];ht(v,`Panel constraints not found for index ${m}`);const{collapsedSize:x=0,collapsible:M,minSize:b=0}=v;if(M){const C=t[m];if(ht(C!=null,`Previous layout not found for panel index ${m}`),Xo(C,x)){const _=b-C;u1(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}{const m=e<0?l:d,v=n[m];ht(v,`No panel constraints found for index ${m}`);const{collapsedSize:x=0,collapsible:M,minSize:b=0}=v;if(M){const C=t[m];if(ht(C!=null,`Previous layout not found for panel index ${m}`),Xo(C,b)){const _=C-x;u1(_,Math.abs(e))>0&&(e=e<0?0-_:_)}}}}{const m=e<0?1:-1;let v=e<0?d:l,x=0;for(;;){const b=t[v];ht(b!=null,`Previous layout not found for panel index ${v}`);const _=bh({panelConstraints:n,panelIndex:v,size:100})-b;if(x+=_,v+=m,v<0||v>=n.length)break}const M=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-M:M}{let v=e<0?l:d;for(;v>=0&&v<n.length;){const x=Math.abs(e)-Math.abs(h),M=t[v];ht(M!=null,`Previous layout not found for panel index ${v}`);const b=M-x,C=bh({panelConstraints:n,panelIndex:v,size:b});if(!Xo(M,C)&&(h+=M-C,s[v]=C,h.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?v--:v++}}if($Rt(a,s))return a;{const m=e<0?d:l,v=t[m];ht(v!=null,`Previous layout not found for panel index ${m}`);const x=v+h,M=bh({panelConstraints:n,panelIndex:m,size:x});if(s[m]=M,!Xo(M,x)){let b=x-M,_=e<0?d:l;for(;_>=0&&_<n.length;){const N=s[_];ht(N!=null,`Previous layout not found for panel index ${_}`);const A=N+b,I=bh({panelConstraints:n,panelIndex:_,size:A});if(Xo(N,I)||(b-=I-N,s[_]=I),Xo(b,0))break;e>0?_--:_++}}}const p=s.reduce((m,v)=>v+m,0);return Xo(p,100)?s:a}function DRt({layout:e,panelsArray:t,pivotIndices:n}){let o=0,a=100,i=0,s=0;const l=n[0];ht(l!=null,"No pivot index found"),t.forEach((m,v)=>{const{constraints:x}=m,{maxSize:M=100,minSize:b=0}=x;v===l?(o=b,a=M):(i+=b,s+=M)});const d=Math.min(a,100-i),h=Math.max(o,100-s),p=e[l];return{valueMax:d,valueMin:h,valueNow:p}}function rp(e,t=document){return Array.from(t.querySelectorAll(`[${mn.resizeHandleId}][data-panel-group-id="${e}"]`))}function Mle(e,t,n=document){const a=rp(e,n).findIndex(i=>i.getAttribute(mn.resizeHandleId)===t);return a??null}function _le(e,t,n){const o=Mle(e,t,n);return o!=null?[o,o+1]:[-1,-1]}function zRt(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function Sle(e,t=document){if(zRt(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function q$(e,t=document){const n=t.querySelector(`[${mn.resizeHandleId}="${e}"]`);return n||null}function ORt(e,t,n,o=document){var a,i,s,l;const d=q$(t,o),h=rp(e,o),p=d?h.indexOf(d):-1,m=(a=(i=n[p])===null||i===void 0?void 0:i.id)!==null&&a!==void 0?a:null,v=(s=(l=n[p+1])===null||l===void 0?void 0:l.id)!==null&&s!==void 0?s:null;return[m,v]}function qRt({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:o,panelDataArray:a,panelGroupElement:i,setLayout:s}){k.useRef({didWarnAboutMissingResizeHandle:!1}),e1(()=>{if(!i)return;const l=rp(n,i);for(let d=0;d<a.length-1;d++){const{valueMax:h,valueMin:p,valueNow:m}=DRt({layout:o,panelsArray:a,pivotIndices:[d,d+1]}),v=l[d];if(v!=null){const x=a[d];ht(x,`No panel data found for index "${d}"`),v.setAttribute("aria-controls",x.id),v.setAttribute("aria-valuemax",""+Math.round(h)),v.setAttribute("aria-valuemin",""+Math.round(p)),v.setAttribute("aria-valuenow",m!=null?""+Math.round(m):"")}}return()=>{l.forEach((d,h)=>{d.removeAttribute("aria-controls"),d.removeAttribute("aria-valuemax"),d.removeAttribute("aria-valuemin"),d.removeAttribute("aria-valuenow")})}},[n,o,a,i]),k.useEffect(()=>{if(!i)return;const l=t.current;ht(l,"Eager values not found");const{panelDataArray:d}=l,h=Sle(n,i);ht(h!=null,`No group found for id "${n}"`);const p=rp(n,i);ht(p,`No resize handles found for group id "${n}"`);const m=p.map(v=>{const x=v.getAttribute(mn.resizeHandleId);ht(x,"Resize handle element has no handle id attribute");const[M,b]=ORt(n,x,d,i);if(M==null||b==null)return()=>{};const C=_=>{if(!_.defaultPrevented)switch(_.key){case"Enter":{_.preventDefault();const N=d.findIndex(A=>A.id===M);if(N>=0){const A=d[N];ht(A,`No panel data found for index ${N}`);const I=o[N],{collapsedSize:R=0,collapsible:j,minSize:D=0}=A.constraints;if(I!=null&&j){const H=Ff({delta:Xo(I,R)?D-R:R-I,initialLayout:o,panelConstraints:d.map(U=>U.constraints),pivotIndices:_le(n,x,i),prevLayout:o,trigger:"keyboard"});o!==H&&s(H)}}break}}};return v.addEventListener("keydown",C),()=>{v.removeEventListener("keydown",C)}});return()=>{m.forEach(v=>v())}},[i,e,t,n,o,a,s])}function LQ(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Cle(e,t){const n=e==="horizontal",{x:o,y:a}=z$(t);return n?o:a}function HRt(e,t,n,o,a){const i=n==="horizontal",s=q$(t,a);ht(s,`No resize handle element found for id "${t}"`);const l=s.getAttribute(mn.groupId);ht(l,"Resize handle element has no group id attribute");let{initialCursorPosition:d}=o;const h=Cle(n,e),p=Sle(l,a);ht(p,`No group element found for id "${l}"`);const m=p.getBoundingClientRect(),v=i?m.width:m.height;return(h-d)/v*100}function VRt(e,t,n,o,a,i){if(ple(e)){const s=n==="horizontal";let l=0;e.shiftKey?l=100:a!=null?l=a:l=10;let d=0;switch(e.key){case"ArrowDown":d=s?0:l;break;case"ArrowLeft":d=s?-l:0;break;case"ArrowRight":d=s?l:0;break;case"ArrowUp":d=s?0:-l;break;case"End":d=100;break;case"Home":d=-100;break}return d}else return o==null?0:HRt(e,t,n,o,i)}function BRt({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let o=0,a=100;for(let i=0;i<e.length;i++){const s=n[i];ht(s,`Panel constraints not found for index ${i}`);const{defaultSize:l}=s;l!=null&&(o++,t[i]=l,a-=l)}for(let i=0;i<e.length;i++){const s=n[i];ht(s,`Panel constraints not found for index ${i}`);const{defaultSize:l}=s;if(l!=null)continue;const d=e.length-o,h=a/d;o++,t[i]=h,a-=h}return t}function ch(e,t,n){t.forEach((o,a)=>{const i=e[a];ht(i,`Panel data not found for index ${a}`);const{callbacks:s,constraints:l,id:d}=i,{collapsedSize:h=0,collapsible:p}=l,m=n[d];if(m==null||o!==m){n[d]=o;const{onCollapse:v,onExpand:x,onResize:M}=s;M&&M(o,m),p&&(v||x)&&(x&&(m==null||oi(m,h))&&!oi(o,h)&&x(),v&&(m==null||!oi(m,h))&&oi(o,h)&&v())}})}function Mm(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function FRt({defaultSize:e,dragState:t,layout:n,panelData:o,panelIndex:a,precision:i=3}){const s=n[a];let l;return s==null?l=e!=null?e.toPrecision(i):"1":o.length===1?l="1":l=s.toPrecision(i),{flexBasis:0,flexGrow:l,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function URt(e,t=10){let n=null;return(...a)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...a)},t)}}function jQ(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function Nle(e){return`react-resizable-panels:${e}`}function Lle(e){return e.map(t=>{const{constraints:n,id:o,idIsFromProps:a,order:i}=t;return a?o:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function jle(e,t){try{const n=Nle(e),o=t.getItem(n);if(o){const a=JSON.parse(o);if(typeof a=="object"&&a!=null)return a}}catch{}return null}function GRt(e,t,n){var o,a;const i=(o=jle(e,n))!==null&&o!==void 0?o:{},s=Lle(t);return(a=i[s])!==null&&a!==void 0?a:null}function XRt(e,t,n,o,a){var i;const s=Nle(e),l=Lle(t),d=(i=jle(e,a))!==null&&i!==void 0?i:{};d[l]={expandToSizes:Object.fromEntries(n.entries()),layout:o};try{a.setItem(s,JSON.stringify(d))}catch(h){console.error(h)}}function AQ({layout:e,panelConstraints:t}){const n=[...e],o=n.reduce((i,s)=>i+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!Xo(o,100)&&n.length>0)for(let i=0;i<t.length;i++){const s=n[i];ht(s!=null,`No layout data found for index ${i}`);const l=100/o*s;n[i]=l}let a=0;for(let i=0;i<t.length;i++){const s=n[i];ht(s!=null,`No layout data found for index ${i}`);const l=bh({panelConstraints:t,panelIndex:i,size:s});s!=l&&(a+=s-l,n[i]=l)}if(!Xo(a,0))for(let i=0;i<t.length;i++){const s=n[i];ht(s!=null,`No layout data found for index ${i}`);const l=s+a,d=bh({panelConstraints:t,panelIndex:i,size:l});if(s!==d&&(a-=d-s,n[i]=d,Xo(a,0)))break}return n}const ZRt=100,Uf={getItem:e=>(jQ(Uf),Uf.getItem(e)),setItem:(e,t)=>{jQ(Uf),Uf.setItem(e,t)}},EQ={};function Ale({autoSaveId:e=null,children:t,className:n="",direction:o,forwardedRef:a,id:i=null,onLayout:s=null,keyboardResizeBy:l=null,storage:d=Uf,style:h,tagName:p="div",...m}){const v=IF(i),x=k.useRef(null),[M,b]=k.useState(null),[C,_]=k.useState([]),N=PRt(),A=k.useRef({}),I=k.useRef(new Map),R=k.useRef(0),j=k.useRef({autoSaveId:e,direction:o,dragState:M,id:v,keyboardResizeBy:l,onLayout:s,storage:d}),D=k.useRef({layout:C,panelDataArray:[],panelDataArrayChanged:!1});k.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),k.useImperativeHandle(a,()=>({getId:()=>j.current.id,getLayout:()=>{const{layout:T}=D.current;return T},setLayout:T=>{const{onLayout:K}=j.current,{layout:Q,panelDataArray:ne}=D.current,te=AQ({layout:T,panelConstraints:ne.map(ce=>ce.constraints)});LQ(Q,te)||(_(te),D.current.layout=te,K&&K(te),ch(ne,te,A.current))}}),[]),e1(()=>{j.current.autoSaveId=e,j.current.direction=o,j.current.dragState=M,j.current.id=v,j.current.onLayout=s,j.current.storage=d}),qRt({committedValuesRef:j,eagerValuesRef:D,groupId:v,layout:C,panelDataArray:D.current.panelDataArray,setLayout:_,panelGroupElement:x.current}),k.useEffect(()=>{const{panelDataArray:T}=D.current;if(e){if(C.length===0||C.length!==T.length)return;let K=EQ[e];K==null&&(K=URt(XRt,ZRt),EQ[e]=K);const Q=[...T],ne=new Map(I.current);K(e,Q,ne,C,d)}},[e,C,d]),k.useEffect(()=>{});const H=k.useCallback(T=>{const{onLayout:K}=j.current,{layout:Q,panelDataArray:ne}=D.current;if(T.constraints.collapsible){const te=ne.map(Ee=>Ee.constraints),{collapsedSize:ce=0,panelSize:me,pivotIndices:ke}=sc(ne,T,Q);if(ht(me!=null,`Panel size not found for panel "${T.id}"`),!oi(me,ce)){I.current.set(T.id,me);const Ie=ph(ne,T)===ne.length-1?me-ce:ce-me,Te=Ff({delta:Ie,initialLayout:Q,panelConstraints:te,pivotIndices:ke,prevLayout:Q,trigger:"imperative-api"});Mm(Q,Te)||(_(Te),D.current.layout=Te,K&&K(Te),ch(ne,Te,A.current))}}},[]),U=k.useCallback((T,K)=>{const{onLayout:Q}=j.current,{layout:ne,panelDataArray:te}=D.current;if(T.constraints.collapsible){const ce=te.map(qe=>qe.constraints),{collapsedSize:me=0,panelSize:ke=0,minSize:Ee=0,pivotIndices:Ie}=sc(te,T,ne),Te=K??Ee;if(oi(ke,me)){const qe=I.current.get(T.id),ct=qe!=null&&qe>=Te?qe:Te,We=ph(te,T)===te.length-1?ke-ct:ct-ke,Le=Ff({delta:We,initialLayout:ne,panelConstraints:ce,pivotIndices:Ie,prevLayout:ne,trigger:"imperative-api"});Mm(ne,Le)||(_(Le),D.current.layout=Le,Q&&Q(Le),ch(te,Le,A.current))}}},[]),z=k.useCallback(T=>{const{layout:K,panelDataArray:Q}=D.current,{panelSize:ne}=sc(Q,T,K);return ht(ne!=null,`Panel size not found for panel "${T.id}"`),ne},[]),Z=k.useCallback((T,K)=>{const{panelDataArray:Q}=D.current,ne=ph(Q,T);return FRt({defaultSize:K,dragState:M,layout:C,panelData:Q,panelIndex:ne})},[M,C]),q=k.useCallback(T=>{const{layout:K,panelDataArray:Q}=D.current,{collapsedSize:ne=0,collapsible:te,panelSize:ce}=sc(Q,T,K);return ht(ce!=null,`Panel size not found for panel "${T.id}"`),te===!0&&oi(ce,ne)},[]),G=k.useCallback(T=>{const{layout:K,panelDataArray:Q}=D.current,{collapsedSize:ne=0,collapsible:te,panelSize:ce}=sc(Q,T,K);return ht(ce!=null,`Panel size not found for panel "${T.id}"`),!te||u1(ce,ne)>0},[]),E=k.useCallback(T=>{const{panelDataArray:K}=D.current;K.push(T),K.sort((Q,ne)=>{const te=Q.order,ce=ne.order;return te==null&&ce==null?0:te==null?-1:ce==null?1:te-ce}),D.current.panelDataArrayChanged=!0,N()},[N]);e1(()=>{if(D.current.panelDataArrayChanged){D.current.panelDataArrayChanged=!1;const{autoSaveId:T,onLayout:K,storage:Q}=j.current,{layout:ne,panelDataArray:te}=D.current;let ce=null;if(T){const ke=GRt(T,te,Q);ke&&(I.current=new Map(Object.entries(ke.expandToSizes)),ce=ke.layout)}ce==null&&(ce=BRt({panelDataArray:te}));const me=AQ({layout:ce,panelConstraints:te.map(ke=>ke.constraints)});LQ(ne,me)||(_(me),D.current.layout=me,K&&K(me),ch(te,me,A.current))}}),e1(()=>{const T=D.current;return()=>{T.layout=[]}},[]);const O=k.useCallback(T=>{let K=!1;const Q=x.current;return Q&&window.getComputedStyle(Q,null).getPropertyValue("direction")==="rtl"&&(K=!0),function(te){te.preventDefault();const ce=x.current;if(!ce)return()=>null;const{direction:me,dragState:ke,id:Ee,keyboardResizeBy:Ie,onLayout:Te}=j.current,{layout:qe,panelDataArray:ct}=D.current,{initialLayout:jt}=ke??{},We=_le(Ee,T,ce);let Le=VRt(te,T,me,ke,Ie,ce);const Rt=me==="horizontal";Rt&&K&&(Le=-Le);const eo=ct.map(On=>On.constraints),An=Ff({delta:Le,initialLayout:jt??qe,panelConstraints:eo,pivotIndices:We,prevLayout:qe,trigger:ple(te)?"keyboard":"mouse-or-touch"}),wn=!Mm(qe,An);(yle(te)||mle(te))&&R.current!=Le&&(R.current=Le,!wn&&Le!==0?Rt?uq(T,Le<0?vle:kle):uq(T,Le<0?xle:wle):uq(T,0)),wn&&(_(An),D.current.layout=An,Te&&Te(An),ch(ct,An,A.current))}},[]),P=k.useCallback((T,K)=>{const{onLayout:Q}=j.current,{layout:ne,panelDataArray:te}=D.current,ce=te.map(qe=>qe.constraints),{panelSize:me,pivotIndices:ke}=sc(te,T,ne);ht(me!=null,`Panel size not found for panel "${T.id}"`);const Ie=ph(te,T)===te.length-1?me-K:K-me,Te=Ff({delta:Ie,initialLayout:ne,panelConstraints:ce,pivotIndices:ke,prevLayout:ne,trigger:"imperative-api"});Mm(ne,Te)||(_(Te),D.current.layout=Te,Q&&Q(Te),ch(te,Te,A.current))},[]),X=k.useCallback((T,K)=>{const{layout:Q,panelDataArray:ne}=D.current,{collapsedSize:te=0,collapsible:ce}=K,{collapsedSize:me=0,collapsible:ke,maxSize:Ee=100,minSize:Ie=0}=T.constraints,{panelSize:Te}=sc(ne,T,Q);Te!=null&&(ce&&ke&&oi(Te,te)?oi(te,me)||P(T,me):Te<Ie?P(T,Ie):Te>Ee&&P(T,Ee))},[P]),W=k.useCallback((T,K)=>{const{direction:Q}=j.current,{layout:ne}=D.current;if(!x.current)return;const te=q$(T,x.current);ht(te,`Drag handle element not found for id "${T}"`);const ce=Cle(Q,K);b({dragHandleId:T,dragHandleRect:te.getBoundingClientRect(),initialCursorPosition:ce,initialLayout:ne})},[]),V=k.useCallback(()=>{b(null)},[]),L=k.useCallback(T=>{const{panelDataArray:K}=D.current,Q=ph(K,T);Q>=0&&(K.splice(Q,1),delete A.current[T.id],D.current.panelDataArrayChanged=!0,N())},[N]),Y=k.useMemo(()=>({collapsePanel:H,direction:o,dragState:M,expandPanel:U,getPanelSize:z,getPanelStyle:Z,groupId:v,isPanelCollapsed:q,isPanelExpanded:G,reevaluatePanelConstraints:X,registerPanel:E,registerResizeHandle:O,resizePanel:P,startDragging:W,stopDragging:V,unregisterPanel:L,panelGroupElement:x.current}),[H,M,o,U,z,Z,v,q,G,X,E,O,P,W,V,L]),F={display:"flex",flexDirection:o==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return k.createElement(D$.Provider,{value:Y},k.createElement(p,{...m,children:t,className:n,id:i,ref:x,style:{...F,...h},[mn.group]:"",[mn.groupDirection]:o,[mn.groupId]:v}))}const Ele=k.forwardRef((e,t)=>k.createElement(Ale,{...e,forwardedRef:t}));Ale.displayName="PanelGroup";Ele.displayName="forwardRef(PanelGroup)";function ph(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function sc(e,t,n){const o=ph(e,t),i=o===e.length-1?[o-1,o]:[o,o+1],s=n[o];return{...t.constraints,panelSize:s,pivotIndices:i}}function YRt({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:o}){k.useEffect(()=>{if(e||n==null||o==null)return;const a=q$(t,o);if(a==null)return;const i=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const l=a.getAttribute(mn.groupId);ht(l,`No group element found for id "${l}"`);const d=rp(l,o),h=Mle(l,t,o);ht(h!==null,`No resize element found for id "${t}"`);const p=s.shiftKey?h>0?h-1:d.length-1:h+1<d.length?h+1:0;d[p].focus();break}}};return a.addEventListener("keydown",i),()=>{a.removeEventListener("keydown",i)}},[o,e,t,n])}function Ile({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:o,id:a,onBlur:i,onClick:s,onDragging:l,onFocus:d,onPointerDown:h,onPointerUp:p,style:m={},tabIndex:v=0,tagName:x="div",...M}){var b,C;const _=k.useRef(null),N=k.useRef({onClick:s,onDragging:l,onPointerDown:h,onPointerUp:p});k.useEffect(()=>{N.current.onClick=s,N.current.onDragging=l,N.current.onPointerDown=h,N.current.onPointerUp=p});const A=k.useContext(D$);if(A===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:I,groupId:R,registerResizeHandle:j,startDragging:D,stopDragging:H,panelGroupElement:U}=A,z=IF(a),[Z,q]=k.useState("inactive"),[G,E]=k.useState(!1),[O,P]=k.useState(null),X=k.useRef({state:Z});e1(()=>{X.current.state=Z}),k.useEffect(()=>{if(n)P(null);else{const Y=j(z);P(()=>Y)}},[n,z,j]);const W=(b=o==null?void 0:o.coarse)!==null&&b!==void 0?b:15,V=(C=o==null?void 0:o.fine)!==null&&C!==void 0?C:5;k.useEffect(()=>{if(n||O==null)return;const Y=_.current;ht(Y,"Element ref not attached");let F=!1;return TRt(z,Y,I,{coarse:W,fine:V},(K,Q,ne)=>{if(!Q){q("inactive");return}switch(K){case"down":{q("drag"),F=!1,ht(ne,'Expected event to be defined for "down" action'),D(z,ne);const{onDragging:te,onPointerDown:ce}=N.current;te==null||te(!0),ce==null||ce();break}case"move":{const{state:te}=X.current;F=!0,te!=="drag"&&q("hover"),ht(ne,'Expected event to be defined for "move" action'),O(ne);break}case"up":{q("hover"),H();const{onClick:te,onDragging:ce,onPointerUp:me}=N.current;ce==null||ce(!1),me==null||me(),F||te==null||te();break}}})},[W,I,n,V,j,z,O,D,H]),YRt({disabled:n,handleId:z,resizeHandler:O,panelGroupElement:U});const L={touchAction:"none",userSelect:"none"};return k.createElement(x,{...M,children:e,className:t,id:a,onBlur:()=>{E(!1),i==null||i()},onFocus:()=>{E(!0),d==null||d()},ref:_,role:"separator",style:{...L,...m},tabIndex:v,[mn.groupDirection]:I,[mn.groupId]:R,[mn.resizeHandle]:"",[mn.resizeHandleActive]:Z==="drag"?"pointer":G?"keyboard":void 0,[mn.resizeHandleEnabled]:!n,[mn.resizeHandleId]:z,[mn.resizeHandleState]:Z})}Ile.displayName="PanelResizeHandle";const PF=({className:e,...t})=>u.jsx(Ele,{className:ge("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),li=fle,t2=({withHandle:e,className:t,...n})=>u.jsx(Ile,{className:ge("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&u.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:u.jsx(a0,{className:"h-2.5 w-2.5"})})});function WRt({items:e,onClose:t,position:n,onSelect:o}){const a=k.useRef(null),i=k.useRef(null);return k.useEffect(()=>{i.current&&i.current.focus()},[]),u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"fixed inset-0 z-40 bg-transparent",onClick:t,onContextMenu:s=>{s.preventDefault(),t()}}),u.jsx("div",{ref:a,className:"fixed z-50",style:{top:n.top,left:n.left},children:u.jsxs(xp,{className:"rounded-lg border shadow-md w-64",children:[u.jsx(wp,{ref:i,placeholder:"Search..."}),u.jsxs(bp,{children:[u.jsx(Mp,{children:"No results found."}),e.map(s=>u.jsx(hs,{heading:s.label,children:s.children.map(l=>u.jsx(yr,{onSelect:()=>o(l),children:l.label},l.label))},s.label))]})]})})]})}function IQ(){const{botId:e,commandId:t,eventId:n}=gi(),o=Er(),a=Be(L=>L.init),i=Be(L=>L.isLoading),s=Be(L=>L.isSaving),l=Be(L=>L.command),d=Be(L=>L.availableNodes),h=Be(L=>L.saveGraph),p=Be(L=>L.nodes),m=Be(L=>L.edges),v=Be(L=>L.onNodesChange),x=Be(L=>L.onEdgesChange),M=Be(L=>L.onConnect),b=Be(L=>L.addNode),C=Be(L=>L.openMenu),_=Be(L=>L.closeMenu),N=Be(L=>L.isMenuOpen),A=Be(L=>L.menuPosition),I=Be(L=>L.setConnectingPin),R=Be(L=>L.onConnectStart),j=Be(L=>L.connectingPin),[D,H]=k.useState(null),U=k.useRef(null),z=o.pathname.includes("/commands/")?"command":"event",Z=z==="command"?t:n;k.useEffect(()=>{e&&Z&&a(e,Z,z)},[e,Z,z,a]);const q=k.useMemo(()=>!d||Object.keys(d).length===0?{custom:nV}:{...Object.values(d).flat().reduce((F,T)=>(F[T.type]=nV,F),{})},[d]),G=k.useMemo(()=>d?Object.entries(d).map(([L,Y])=>({label:L,children:Y.map(F=>({label:F.label,type:F.type}))})):[],[d]),E=L=>{const{menuPosition:Y,addNode:F,closeMenu:T}=Be.getState();F(L.type,Y.flowPosition),T()},O=()=>{h(e)},P=(L,Y)=>{if(!D)return;const F=U.current.getBoundingClientRect(),T=D.project({x:L.clientX-F.left,y:L.clientY-F.top});Y(L.clientY,L.clientX,T)},X=L=>{if(!j)return;L.target.classList.contains("react-flow__pane")&&P(L,C),I(null)},W=L=>{L.preventDefault(),L.dataTransfer.dropEffect="move"},V=L=>{if(L.preventDefault(),!D)return;const Y=U.current.getBoundingClientRect(),F=L.dataTransfer.getData("application/reactflow"),T=D.project({x:L.clientX-Y.left,y:L.clientY-Y.top});b(F,T)};return i||Object.keys(d).length===0?u.jsx("div",{className:"flex items-center justify-center h-full",children:"Загрузка редактора..."}):u.jsx($$,{children:u.jsxs("div",{className:"h-full w-full flex flex-col",children:[u.jsxs("header",{className:"p-2 border-b flex justify-between items-center",children:[u.jsxs("h1",{className:"text-lg font-bold",children:["Редактор: ",l==null?void 0:l.name]}),u.jsx(pe,{onClick:O,disabled:s,children:s?"Сохранение...":"Сохранить"})]}),u.jsxs(PF,{direction:"horizontal",className:"flex-grow",children:[u.jsx(li,{defaultSize:15,children:u.jsx(ule,{})}),u.jsx(t2,{withHandle:!0}),u.jsx(li,{defaultSize:65,children:u.jsx("div",{className:"h-full",ref:U,children:u.jsxs(AF,{nodes:p,edges:m,onNodesChange:v,onEdgesChange:x,onConnect:M,onConnectStart:R,onConnectEnd:X,nodeTypes:q,onInit:H,onDrop:V,onDragOver:W,fitView:!0,deleteKeyCode:["Backspace","Delete"],onPaneContextMenu:L=>{L.preventDefault(),P(L,C)},children:[u.jsx(sle,{}),u.jsx(lle,{})]})})}),u.jsx(t2,{withHandle:!0}),u.jsx(li,{defaultSize:20,children:u.jsx(dle,{})})]}),N&&u.jsx(WRt,{position:A,onClose:_,items:G,onSelect:E})]})})}const KRt=()=>{const e=k.useRef(null),t=k.useRef(null),{screenToFlowPosition:n}=P$(),o=Be(z=>z.nodes),a=Be(z=>z.edges),i=Be(z=>z.onNodesChange),s=Be(z=>z.onEdgesChange),l=Be(z=>z.onConnect),d=Be(z=>z.onDelete),h=Be(z=>z.availableNodes),p=Be(z=>z.isMenuOpen),m=Be(z=>z.menuPosition),v=Be(z=>z.openMenu),x=Be(z=>z.closeMenu),M=Be(z=>z.setConnectingPin),b=Be(z=>z.connectAndAddNode),C=Be(z=>z.addNode),_=Be(z=>z.connectingPin),N=k.useMemo(()=>{const z={};return Object.values(h).flat().forEach(Z=>{z[Z.type]=nV}),z},[h]),A=k.useCallback(z=>{z.preventDefault(),z.dataTransfer.dropEffect="move"},[]),I=k.useCallback(z=>{z.preventDefault();const Z=z.dataTransfer.getData("application/reactflow");if(typeof Z>"u"||!Z)return;const q=n({x:z.clientX,y:z.clientY});C(Z,q)},[n,C]),R=k.useCallback(z=>{z.preventDefault();const Z=n({x:z.clientX,y:z.clientY});v(z.clientY,z.clientX,Z)},[n]),j=z=>{_?b(z,m.flowPosition):m&&m.flowPosition&&C(z,m.flowPosition),x()},D=k.useCallback(z=>{if(!Be.getState().connectingPin)return;z.target.classList.contains("react-flow__pane")?setTimeout(()=>{const G=n({x:z.clientX,y:z.clientY});v(z.clientY,z.clientX,G)},50):M(null)},[n,v,M]),H=k.useCallback((z,{nodeId:Z,handleId:q,handleType:G})=>{const E=o.find(O=>O.id===Z);E&&M({nodeId:Z,handleId:q,handleType:G,nodeType:E.type})},[o,M]),U=k.useMemo(()=>{if(!_)return h;const Z=Object.values(h).flat().find(E=>E.type===_.nodeType);if(!Z)return h;const q=Z.outputs.find(E=>E.id===_.handleId);if(!q)return h;const G={};return Object.entries(h).forEach(([E,O])=>{const P=O.filter(X=>X.inputs.some(W=>W.type===q.type||W.type==="Wildcard"||q.type==="Wildcard"));P.length>0&&(G[E]=P)}),G},[JSON.stringify(h)]);return k.useEffect(()=>{const z=Z=>{t.current&&!t.current.contains(Z.target)&&x()};return p?document.addEventListener("mousedown",z,!0):document.removeEventListener("mousedown",z,!0),()=>{document.removeEventListener("mousedown",z,!0)}},[p,x]),u.jsxs("div",{style:{height:"100%",width:"100%"},ref:e,children:[u.jsxs(AF,{nodes:o,edges:a,onNodesChange:i,onEdgesChange:s,onConnect:l,nodeTypes:N,onPaneContextMenu:R,onDragOver:A,onDrop:I,onConnectStart:H,onConnectEnd:D,onNodesDelete:z=>d(z,[]),onEdgesDelete:z=>d([],z),deleteKeyCode:["Delete","Backspace"],fitView:!0,children:[u.jsx(lle,{}),u.jsx(sle,{})]}),p&&u.jsx("div",{ref:t,style:{top:m.top,left:m.left,position:"absolute",zIndex:10},children:u.jsxs(xp,{children:[u.jsx(wp,{placeholder:"Type a command or search..."}),u.jsxs(bp,{children:[u.jsx(Mp,{children:"No results found."}),Object.entries(U).map(([z,Z])=>u.jsx(hs,{heading:z,children:Z.map(q=>u.jsx(yr,{value:q.label,onSelect:()=>j(q.type),disabled:!1,children:q.label},q.type))},z))]})]})})]})};function QRt({botId:e,open:t,onOpenChange:n,onCreated:o}){const[a,i]=k.useState(""),[s,l]=k.useState(!1);k.useEffect(()=>{t&&i("")},[t]);const d=async()=>{if(a){l(!0);try{await Ne(`/api/bots/${e}/event-graphs`,{method:"POST",body:JSON.stringify({name:a})}),o(),n(!1)}catch(h){console.error("Не удалось создать граф событий:",h)}finally{l(!1)}}};return u.jsx(Jt,{open:t,onOpenChange:n,children:u.jsxs(Wt,{children:[u.jsx(on,{children:u.jsx(en,{children:"Создать новый граф событий"})}),u.jsx("div",{className:"py-4",children:u.jsx(Ze,{placeholder:"Название графа",value:a,onChange:h=>i(h.target.value)})}),u.jsxs(an,{children:[u.jsx(pe,{variant:"outline",onClick:()=>n(!1),children:"Отмена"}),u.jsx(pe,{onClick:d,disabled:!a||s,children:s?"Создание...":"Создать"})]})]})})}function JRt({botId:e,graphId:t,onCancel:n}){const[o,a]=k.useState(null),[i,s]=k.useState(!0),{toast:l}=Yt();k.useEffect(()=>{t&&(async()=>{if(!(!e||!t)){s(!0);try{const p=await Ne(`/api/bots/${e}/event-graphs/${t}/export`);a(JSON.stringify(p,null,2))}catch(p){console.error("Не удалось получить данные графа:",p),l({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить данные для экспорта."}),n()}finally{s(!1)}}})()},[e,t,n,l]);const d=()=>{o&&(navigator.clipboard.writeText(o),l({title:"Скопировано!",description:"Код для импорта скопирован в буфер обмена."}))};return u.jsx(Jt,{open:!!t,onOpenChange:h=>!h&&n(),children:u.jsxs(Wt,{children:[u.jsxs(on,{children:[u.jsx(en,{children:"Поделиться графом события"}),u.jsx(dn,{children:"Скопируйте этот код, чтобы импортировать граф события на другом боте или поделиться им."})]}),u.jsxs("div",{className:"py-4 space-y-2",children:[u.jsx(_e,{htmlFor:"graph-json",children:"Код для импорта"}),i?u.jsx("div",{className:"flex items-center justify-center h-24",children:u.jsx(It,{className:"h-8 w-8 animate-spin"})}):u.jsx(ki,{id:"graph-json",readOnly:!0,value:o||"",className:"h-64 font-mono text-xs"})]}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:n,children:"Закрыть"}),u.jsxs(pe,{onClick:d,disabled:i||!o,children:[u.jsx(ps,{className:"mr-2 h-4 w-4"}),"Скопировать код"]})]})]})})}function ePt({botId:e,open:t,onOpenChange:n,onImportSuccess:o}){const[a,i]=k.useState(""),[s,l]=k.useState(!1),{toast:d}=Yt(),h=async()=>{let p;try{p=JSON.parse(a)}catch{d({variant:"destructive",title:"Ошибка",description:"Неверный формат JSON."});return}l(!0);try{await Ne(`/api/bots/${e}/event-graphs/import`,{method:"POST",body:JSON.stringify(p)},"Граф события успешно импортирован."),o()}catch{}finally{l(!1)}};return u.jsx(Jt,{open:t,onOpenChange:n,children:u.jsxs(Wt,{children:[u.jsxs(on,{children:[u.jsx(en,{children:"Импорт графа события"}),u.jsx(dn,{children:"Вставьте ранее скопированный код для импорта графа. Будет создан новый граф события."})]}),u.jsxs("div",{className:"py-4 space-y-2",children:[u.jsx(_e,{htmlFor:"graph-json-input",children:"Код для импорта"}),u.jsx(ki,{id:"graph-json-input",value:a,onChange:p=>i(p.target.value),placeholder:"Вставьте сюда JSON...",className:"h-64 font-mono text-xs"})]}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:()=>n(!1),children:"Отмена"}),u.jsxs(pe,{onClick:h,disabled:s||!a,children:[s&&u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}),u.jsx(wr,{className:"mr-2 h-4 w-4"}),"Импортировать"]})]})]})})}function tPt(){const{botId:e,eventId:t}=gi();return t?u.jsx(aPt,{botId:e,eventId:t}):u.jsx(oPt,{botId:e})}function nPt({onActionClick:e}){return u.jsxs("div",{className:"text-center p-12 border-2 border-dashed rounded-lg",children:[u.jsx(w0,{className:"mx-auto h-12 w-12 text-gray-400"}),u.jsx("h3",{className:"mt-4 text-lg font-medium",children:"Графов событий пока нет"}),u.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Начните с создания своего первого графа для автоматизации действий бота."}),u.jsx("div",{className:"mt-6",children:u.jsxs(pe,{onClick:e,children:[u.jsx(za,{className:"mr-2 h-4 w-4"}),"Создать первый граф"]})})]})}function oPt({botId:e}){const[t,n]=k.useState([]),[o,a]=k.useState(!0),[i,s]=k.useState(!1),[l,d]=k.useState(!1),[h,p]=k.useState(null),[m,v]=k.useTransition(),{toast:x}=Yt(),M=async()=>{a(!0);try{const N=await Ne(`/api/bots/${e}/event-graphs`);n(N)}catch{x({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить графы событий."})}a(!1)},b=async N=>{v(async()=>{try{const A=await Ne(`/api/bots/${e}/event-graphs/${N.id}`,{method:"PUT",body:{isEnabled:!N.isEnabled}});n(I=>I.map(R=>R.id===N.id?{...R,isEnabled:A.isEnabled}:R)),x({title:"Успешно",description:`Граф "${N.name}" был ${A.isEnabled?"включен":"выключен"}.`})}catch{x({variant:"destructive",title:"Ошибка",description:"Не удалось изменить статус графа."})}})},C=async N=>{try{await Ne(`/api/bots/${e}/event-graphs/${N}/duplicate`,{method:"POST"}),x({title:"Успешно",description:"Граф был скопирован."}),M()}catch{x({variant:"destructive",title:"Ошибка",description:"Не удалось скопировать граф."})}},_=async N=>{try{await Ne(`/api/bots/${e}/event-graphs/${N}`,{method:"DELETE"}),M()}catch(A){console.error("Не удалось удалить граф событий:",A)}};return k.useEffect(()=>{M()},[e]),o?u.jsx("div",{children:"Загрузка графов событий..."}):u.jsxs("div",{className:"p-4 sm:p-6",children:[u.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-6 gap-4",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-2xl font-bold",children:"Графы событий"}),u.jsx("p",{className:"text-muted-foreground",children:"Управляйте сценариями поведения вашего бота."})]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsxs(pe,{variant:"outline",onClick:()=>d(!0),children:[u.jsx(Xd,{className:"mr-2 h-4 w-4"}),"Импорт"]}),u.jsxs(pe,{onClick:()=>s(!0),children:[u.jsx(za,{className:"mr-2 h-4 w-4"}),"Создать"]})]})]}),u.jsx(QRt,{botId:e,open:i,onOpenChange:s,onCreated:M}),u.jsx(ePt,{botId:e,open:l,onOpenChange:d,onImportSuccess:()=>{d(!1),M()}}),u.jsx(JRt,{botId:e,graphId:h,onCancel:()=>p(null)}),t.length===0?u.jsx(nPt,{onActionClick:()=>s(!0)}):u.jsx("div",{className:"border rounded-lg",children:u.jsxs(Ca,{children:[u.jsx(Na,{children:u.jsxs(Nt,{children:[u.jsx(st,{className:"w-[80px]",children:"Статус"}),u.jsx(st,{children:"Название"}),u.jsx(st,{children:"Триггеры"}),u.jsx(st,{children:"Статистика"}),u.jsx(st,{className:"text-right",children:"Действия"})]})}),u.jsx(La,{children:t.map(N=>u.jsxs(Nt,{children:[u.jsx(Xe,{children:u.jsx(na,{checked:N.isEnabled,onCheckedChange:()=>b(N),disabled:m})}),u.jsx(Xe,{className:"font-medium",children:N.name}),u.jsx(Xe,{children:u.jsx("div",{className:"flex flex-wrap gap-1",children:(N.triggers||[]).map(A=>u.jsx(Xt,{variant:"secondary",children:A.eventType},A.id))})}),u.jsx(Xe,{children:u.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(es,{className:"h-4 w-4"})," ",N.nodeCount]}),u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(s0,{className:"h-4 w-4"})," ",N.edgeCount]})]})}),u.jsxs(Xe,{className:"text-right",children:[u.jsx(xB,{children:u.jsxs(is,{children:[u.jsx(ss,{asChild:!0,children:u.jsx(up,{to:`/bots/${e}/events/visual/${N.id}`,children:u.jsx(pe,{variant:"ghost",size:"icon",children:u.jsx(pn,{className:"h-4 w-4"})})})}),u.jsx(ni,{children:"Редактировать"})]})}),u.jsxs(hB,{children:[u.jsx(fB,{asChild:!0,children:u.jsx(pe,{variant:"ghost",size:"icon",children:u.jsx(Ki,{className:"h-4 w-4"})})}),u.jsxs(s$,{align:"end",children:[u.jsxs(ka,{onClick:()=>C(N.id),children:[u.jsx(ps,{className:"mr-2 h-4 w-4"}),u.jsx("span",{children:"Дублировать"})]}),u.jsxs(ka,{onClick:()=>p(N.id),children:[u.jsx(Xd,{className:"mr-2 h-4 w-4"}),u.jsx("span",{children:"Поделиться"})]}),u.jsxs(mB,{children:[u.jsx(MBe,{asChild:!0,children:u.jsxs(ka,{onSelect:A=>A.preventDefault(),className:"text-red-500 focus:text-red-500",children:[u.jsx(mo,{className:"mr-2 h-4 w-4"}),u.jsx("span",{children:"Удалить"})]})}),u.jsxs(l$,{children:[u.jsxs(u$,{children:[u.jsx(h$,{children:"Вы уверены?"}),u.jsxs(f$,{children:['Это действие необратимо. Граф "',N.name,'" будет удален навсегда.']})]}),u.jsxs(d$,{children:[u.jsx(y$,{children:"Отмена"}),u.jsx(p$,{onClick:()=>_(N.id),className:"bg-destructive hover:bg-destructive/90",children:"Удалить"})]})]})]})]})]})]})]},N.id))})]})})]})}function aPt({botId:e,eventId:t}){const{init:n,isLoading:o,command:a,saveGraph:i,isSaving:s}=Be(),[l,d]=k.useState(null);return k.useEffect(()=>(Be.setState({nodes:[],edges:[],command:null,isLoading:!0}),e&&t&&(async()=>{try{await n(e,t,"event")}catch(p){d(p.message),console.error("Не удалось инициализировать редактор графов событий:",p)}})(),()=>Be.setState({nodes:[],edges:[],command:null})),[e,t]),o?u.jsx("div",{children:"Загрузка графа события..."}):l?u.jsxs("div",{children:["Ошибка: ",l]}):u.jsx("div",{className:"flex flex-col h-full w-full bg-slate-900 text-white",children:u.jsxs($$,{children:[u.jsxs("header",{className:"p-2 border-b flex justify-between items-center",children:[u.jsxs("h1",{className:"text-lg font-bold",children:["Редактор графа: ",a==null?void 0:a.name]}),u.jsx(pe,{onClick:()=>i(e,"event"),disabled:s,children:s?"Сохранение...":"Сохранить"})]}),u.jsxs(PF,{direction:"horizontal",className:"flex-grow",children:[u.jsx(li,{defaultSize:20,children:u.jsx(ule,{})}),u.jsx(t2,{withHandle:!0}),u.jsx(li,{defaultSize:60,children:u.jsx(KRt,{})}),u.jsx(t2,{withHandle:!0}),u.jsx(li,{defaultSize:20,children:u.jsx(dle,{})})]})]})})}function rPt(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const iPt=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sPt=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,cPt={};function TQ(e,t){return(cPt.jsx?sPt:iPt).test(e)}const lPt=/[ \t\n\f\r]/g;function uPt(e){return typeof e=="object"?e.type==="text"?RQ(e.value):!1:RQ(e)}function RQ(e){return e.replace(lPt,"")===""}class Dp{constructor(t,n,o){this.normal=n,this.property=t,o&&(this.space=o)}}Dp.prototype.normal={};Dp.prototype.property={};Dp.prototype.space=void 0;function Tle(e,t){const n={},o={};for(const a of e)Object.assign(n,a.property),Object.assign(o,a.normal);return new Dp(n,o,t)}function aV(e){return e.toLowerCase()}class $o{constructor(t,n){this.attribute=n,this.property=t}}$o.prototype.attribute="";$o.prototype.booleanish=!1;$o.prototype.boolean=!1;$o.prototype.commaOrSpaceSeparated=!1;$o.prototype.commaSeparated=!1;$o.prototype.defined=!1;$o.prototype.mustUseProperty=!1;$o.prototype.number=!1;$o.prototype.overloadedBoolean=!1;$o.prototype.property="";$o.prototype.spaceSeparated=!1;$o.prototype.space=void 0;let dPt=0;const ut=k1(),Rn=k1(),rV=k1(),Se=k1(),Gt=k1(),Vh=k1(),Go=k1();function k1(){return 2**++dPt}const iV=Object.freeze(Object.defineProperty({__proto__:null,boolean:ut,booleanish:Rn,commaOrSpaceSeparated:Go,commaSeparated:Vh,number:Se,overloadedBoolean:rV,spaceSeparated:Gt},Symbol.toStringTag,{value:"Module"})),hq=Object.keys(iV);class $F extends $o{constructor(t,n,o,a){let i=-1;if(super(t,n),PQ(this,"space",a),typeof o=="number")for(;++i<hq.length;){const s=hq[i];PQ(this,hq[i],(o&iV[s])===iV[s])}}}$F.prototype.defined=!0;function PQ(e,t,n){n&&(e[t]=n)}function k2(e){const t={},n={};for(const[o,a]of Object.entries(e.properties)){const i=new $F(o,e.transform(e.attributes||{},o),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(o)&&(i.mustUseProperty=!0),t[o]=i,n[aV(o)]=o,n[aV(i.attribute)]=o}return new Dp(t,n,e.space)}const Rle=k2({properties:{ariaActiveDescendant:null,ariaAtomic:Rn,ariaAutoComplete:null,ariaBusy:Rn,ariaChecked:Rn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Gt,ariaCurrent:null,ariaDescribedBy:Gt,ariaDetails:null,ariaDisabled:Rn,ariaDropEffect:Gt,ariaErrorMessage:null,ariaExpanded:Rn,ariaFlowTo:Gt,ariaGrabbed:Rn,ariaHasPopup:null,ariaHidden:Rn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Gt,ariaLevel:Se,ariaLive:null,ariaModal:Rn,ariaMultiLine:Rn,ariaMultiSelectable:Rn,ariaOrientation:null,ariaOwns:Gt,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:Rn,ariaReadOnly:Rn,ariaRelevant:null,ariaRequired:Rn,ariaRoleDescription:Gt,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:Rn,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Ple(e,t){return t in e?e[t]:t}function $le(e,t){return Ple(e,t.toLowerCase())}const hPt=k2({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Vh,acceptCharset:Gt,accessKey:Gt,action:null,allow:null,allowFullScreen:ut,allowPaymentRequest:ut,allowUserMedia:ut,alt:null,as:null,async:ut,autoCapitalize:null,autoComplete:Gt,autoFocus:ut,autoPlay:ut,blocking:Gt,capture:null,charSet:null,checked:ut,cite:null,className:Gt,cols:Se,colSpan:null,content:null,contentEditable:Rn,controls:ut,controlsList:Gt,coords:Se|Vh,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ut,defer:ut,dir:null,dirName:null,disabled:ut,download:rV,draggable:Rn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ut,formTarget:null,headers:Gt,height:Se,hidden:rV,high:Se,href:null,hrefLang:null,htmlFor:Gt,httpEquiv:Gt,id:null,imageSizes:null,imageSrcSet:null,inert:ut,inputMode:null,integrity:null,is:null,isMap:ut,itemId:null,itemProp:Gt,itemRef:Gt,itemScope:ut,itemType:Gt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ut,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:ut,muted:ut,name:null,nonce:null,noModule:ut,noValidate:ut,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ut,optimum:Se,pattern:null,ping:Gt,placeholder:null,playsInline:ut,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ut,referrerPolicy:null,rel:Gt,required:ut,reversed:ut,rows:Se,rowSpan:Se,sandbox:Gt,scope:null,scoped:ut,seamless:ut,selected:ut,shadowRootClonable:ut,shadowRootDelegatesFocus:ut,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:Rn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:ut,useMap:null,value:Rn,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Gt,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ut,declare:ut,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:ut,noHref:ut,noShade:ut,noWrap:ut,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:Rn,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ut,disableRemotePlayback:ut,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:$le}),fPt=k2({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Go,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:Gt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:ut,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Vh,g2:Vh,glyphName:Vh,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:Go,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Se,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Gt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Go,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Go,rev:Go,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Go,requiredFeatures:Go,requiredFonts:Go,requiredFormats:Go,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:Go,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Go,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Go,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ple}),Dle=k2({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),zle=k2({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:$le}),Ole=k2({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),pPt={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},yPt=/[A-Z]/g,$Q=/-[a-z]/g,mPt=/^data[-\w.:]+$/i;function gPt(e,t){const n=aV(t);let o=t,a=$o;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&mPt.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace($Q,kPt);o="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!$Q.test(i)){let s=i.replace(yPt,vPt);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}a=$F}return new a(o,t)}function vPt(e){return"-"+e.toLowerCase()}function kPt(e){return e.charAt(1).toUpperCase()}const xPt=Tle([Rle,hPt,Dle,zle,Ole],"html"),DF=Tle([Rle,fPt,Dle,zle,Ole],"svg");function wPt(e){return e.join(" ").trim()}var lh={},fq,DQ;function bPt(){if(DQ)return fq;DQ=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,l=/^\s+|\s+$/g,d=`
8191
8191
  `,h="/",p="*",m="",v="comment",x="declaration";fq=function(b,C){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];C=C||{};var _=1,N=1;function A(G){var E=G.match(t);E&&(_+=E.length);var O=G.lastIndexOf(d);N=~O?G.length-O:N+G.length}function I(){var G={line:_,column:N};return function(E){return E.position=new R(G),H(),E}}function R(G){this.start=G,this.end={line:_,column:N},this.source=C.source}R.prototype.content=b;function j(G){var E=new Error(C.source+":"+_+":"+N+": "+G);if(E.reason=G,E.filename=C.source,E.line=_,E.column=N,E.source=b,!C.silent)throw E}function D(G){var E=G.exec(b);if(E){var O=E[0];return A(O),b=b.slice(O.length),E}}function H(){D(n)}function U(G){var E;for(G=G||[];E=z();)E!==!1&&G.push(E);return G}function z(){var G=I();if(!(h!=b.charAt(0)||p!=b.charAt(1))){for(var E=2;m!=b.charAt(E)&&(p!=b.charAt(E)||h!=b.charAt(E+1));)++E;if(E+=2,m===b.charAt(E-1))return j("End of comment missing");var O=b.slice(2,E-2);return N+=2,A(O),b=b.slice(E),N+=2,G({type:v,comment:O})}}function Z(){var G=I(),E=D(o);if(E){if(z(),!D(a))return j("property missing ':'");var O=D(i),P=G({type:x,property:M(E[0].replace(e,m)),value:O?M(O[0].replace(e,m)):m});return D(s),P}}function q(){var G=[];U(G);for(var E;E=Z();)E!==!1&&(G.push(E),U(G));return G}return H(),q()};function M(b){return b?b.replace(l,m):m}return fq}var zQ;function MPt(){if(zQ)return lh;zQ=1;var e=lh&&lh.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(lh,"__esModule",{value:!0}),lh.default=n;var t=e(bPt());function n(o,a){var i=null;if(!o||typeof o!="string")return i;var s=(0,t.default)(o),l=typeof a=="function";return s.forEach(function(d){if(d.type==="declaration"){var h=d.property,p=d.value;l?a(h,p,d):p&&(i=i||{},i[h]=p)}}),i}return lh}var Af={},OQ;function _Pt(){if(OQ)return Af;OQ=1,Object.defineProperty(Af,"__esModule",{value:!0}),Af.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,i=function(h){return!h||n.test(h)||e.test(h)},s=function(h,p){return p.toUpperCase()},l=function(h,p){return"".concat(p,"-")},d=function(h,p){return p===void 0&&(p={}),i(h)?h:(h=h.toLowerCase(),p.reactCompat?h=h.replace(a,l):h=h.replace(o,l),h.replace(t,s))};return Af.camelCase=d,Af}var Ef,qQ;function SPt(){if(qQ)return Ef;qQ=1;var e=Ef&&Ef.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(MPt()),n=_Pt();function o(a,i){var s={};return!a||typeof a!="string"||(0,t.default)(a,function(l,d){l&&d&&(s[(0,n.camelCase)(l,i)]=d)}),s}return o.default=o,Ef=o,Ef}var CPt=SPt();const NPt=d1(CPt),qle=Hle("end"),zF=Hle("start");function Hle(e){return t;function t(n){const o=n&&n.position&&n.position[e]||{};if(typeof o.line=="number"&&o.line>0&&typeof o.column=="number"&&o.column>0)return{line:o.line,column:o.column,offset:typeof o.offset=="number"&&o.offset>-1?o.offset:void 0}}}function LPt(e){const t=zF(e),n=qle(e);if(t&&n)return{start:t,end:n}}function A0(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?HQ(e.position):"start"in e||"end"in e?HQ(e):"line"in e||"column"in e?sV(e):""}function sV(e){return VQ(e&&e.line)+":"+VQ(e&&e.column)}function HQ(e){return sV(e&&e.start)+"-"+sV(e&&e.end)}function VQ(e){return e&&typeof e=="number"?e:1}class ho extends Error{constructor(t,n,o){super(),typeof n=="string"&&(o=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof o=="string"){const d=o.indexOf(":");d===-1?i.ruleId=o:(i.source=o.slice(0,d),i.ruleId=o.slice(d+1))}if(!i.place&&i.ancestors&&i.ancestors){const d=i.ancestors[i.ancestors.length-1];d&&(i.place=d.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=l?l.line:void 0,this.name=A0(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}ho.prototype.file="";ho.prototype.name="";ho.prototype.reason="";ho.prototype.message="";ho.prototype.stack="";ho.prototype.column=void 0;ho.prototype.line=void 0;ho.prototype.ancestors=void 0;ho.prototype.cause=void 0;ho.prototype.fatal=void 0;ho.prototype.place=void 0;ho.prototype.ruleId=void 0;ho.prototype.source=void 0;const OF={}.hasOwnProperty,jPt=new Map,APt=/[A-Z]/g,EPt=new Set(["table","tbody","thead","tfoot","tr"]),IPt=new Set(["td","th"]),Vle="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function TPt(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let o;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");o=HPt(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");o=qPt(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?DF:xPt,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Ble(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function Ble(e,t,n){if(t.type==="element")return RPt(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return PPt(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return DPt(e,t,n);if(t.type==="mdxjsEsm")return $Pt(e,t);if(t.type==="root")return zPt(e,t,n);if(t.type==="text")return OPt(e,t)}function RPt(e,t,n){const o=e.schema;let a=o;t.tagName.toLowerCase()==="svg"&&o.space==="html"&&(a=DF,e.schema=a),e.ancestors.push(t);const i=Ule(e,t.tagName,!1),s=VPt(e,t);let l=HF(e,t);return EPt.has(t.tagName)&&(l=l.filter(function(d){return typeof d=="string"?!uPt(d):!0})),Fle(e,s,i,t),qF(s,l),e.ancestors.pop(),e.schema=o,e.create(t,i,s,n)}function PPt(e,t){if(t.data&&t.data.estree&&e.evaluater){const o=t.data.estree.body[0];return o.type,e.evaluater.evaluateExpression(o.expression)}ip(e,t.position)}function $Pt(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ip(e,t.position)}function DPt(e,t,n){const o=e.schema;let a=o;t.name==="svg"&&o.space==="html"&&(a=DF,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:Ule(e,t.name,!0),s=BPt(e,t),l=HF(e,t);return Fle(e,s,i,t),qF(s,l),e.ancestors.pop(),e.schema=o,e.create(t,i,s,n)}function zPt(e,t,n){const o={};return qF(o,HF(e,t)),e.create(t,e.Fragment,o,n)}function OPt(e,t){return t.value}function Fle(e,t,n,o){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=o)}function qF(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function qPt(e,t,n){return o;function o(a,i,s,l){const h=Array.isArray(s.children)?n:t;return l?h(i,s,l):h(i,s)}}function HPt(e,t){return n;function n(o,a,i,s){const l=Array.isArray(i.children),d=zF(o);return t(a,i,s,l,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function VPt(e,t){const n={};let o,a;for(a in t.properties)if(a!=="children"&&OF.call(t.properties,a)){const i=FPt(e,a,t.properties[a]);if(i){const[s,l]=i;e.tableCellAlignToStyle&&s==="align"&&typeof l=="string"&&IPt.has(t.tagName)?o=l:n[s]=l}}if(o){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=o}return n}function BPt(e,t){const n={};for(const o of t.attributes)if(o.type==="mdxJsxExpressionAttribute")if(o.data&&o.data.estree&&e.evaluater){const i=o.data.estree.body[0];i.type;const s=i.expression;s.type;const l=s.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else ip(e,t.position);else{const a=o.name;let i;if(o.value&&typeof o.value=="object")if(o.value.data&&o.value.data.estree&&e.evaluater){const l=o.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else ip(e,t.position);else i=o.value===null?!0:o.value;n[a]=i}return n}function HF(e,t){const n=[];let o=-1;const a=e.passKeys?new Map:jPt;for(;++o<t.children.length;){const i=t.children[o];let s;if(e.passKeys){const d=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(d){const h=a.get(d)||0;s=d+"-"+h,a.set(d,h+1)}}const l=Ble(e,i,s);l!==void 0&&n.push(l)}return n}function FPt(e,t,n){const o=gPt(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=o.commaSeparated?rPt(n):wPt(n)),o.property==="style"){let a=typeof n=="object"?n:UPt(e,String(n));return e.stylePropertyNameCase==="css"&&(a=GPt(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&o.space?pPt[o.property]||o.property:o.attribute,n]}}function UPt(e,t){try{return NPt(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const o=n,a=new ho("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:o,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=Vle+"#cannot-parse-style-attribute",a}}function Ule(e,t,n){let o;if(!n)o={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let i=-1,s;for(;++i<a.length;){const l=TQ(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};s=s?{type:"MemberExpression",object:s,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}o=s}else o=TQ(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(o.type==="Literal"){const a=o.value;return OF.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(o);ip(e)}function ip(e,t){const n=new ho("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Vle+"#cannot-handle-mdx-estrees-without-createevaluater",n}function GPt(e){const t={};let n;for(n in e)OF.call(e,n)&&(t[XPt(n)]=e[n]);return t}function XPt(e){let t=e.replace(APt,ZPt);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function ZPt(e){return"-"+e.toLowerCase()}const pq={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},YPt={};function WPt(e,t){const n=YPt,o=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Gle(e,o,a)}function Gle(e,t,n){if(KPt(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return BQ(e.children,t,n)}return Array.isArray(e)?BQ(e,t,n):""}function BQ(e,t,n){const o=[];let a=-1;for(;++a<e.length;)o[a]=Gle(e[a],t,n);return o.join("")}function KPt(e){return!!(e&&typeof e=="object")}const FQ=document.createElement("i");function VF(e){const t="&"+e+";";FQ.innerHTML=t;const n=FQ.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ar(e,t,n,o){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,o.length<1e4)s=Array.from(o),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<o.length;)s=o.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function va(e,t){return e.length>0?(Ar(e,e.length,0,t),e):t}const UQ={}.hasOwnProperty;function QPt(e){const t={};let n=-1;for(;++n<e.length;)JPt(t,e[n]);return t}function JPt(e,t){let n;for(n in t){const a=(UQ.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){UQ.call(a,s)||(a[s]=[]);const l=i[s];e$t(a[s],Array.isArray(l)?l:l?[l]:[])}}}function e$t(e,t){let n=-1;const o=[];for(;++n<t.length;)(t[n].add==="after"?e:o).push(t[n]);Ar(e,0,0,o)}function Xle(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Bh(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const gr=zs(/[A-Za-z]/),Qo=zs(/[\dA-Za-z]/),t$t=zs(/[#-'*+\--9=?A-Z^-~]/);function cV(e){return e!==null&&(e<32||e===127)}const lV=zs(/\d/),n$t=zs(/[\dA-Fa-f]/),o$t=zs(/[!-/:-@[-`{-~]/);function it(e){return e!==null&&e<-2}function To(e){return e!==null&&(e<0||e===32)}function Tt(e){return e===-2||e===-1||e===32}const a$t=zs(new RegExp("\\p{P}|\\p{S}","u")),r$t=zs(/\s/);function zs(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function x2(e){const t=[];let n=-1,o=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let s="";if(i===37&&Qo(e.charCodeAt(n+1))&&Qo(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(s=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(s=String.fromCharCode(i,l),a=1):s="�"}else s=String.fromCharCode(i);s&&(t.push(e.slice(o,n),encodeURIComponent(s)),o=n+a+1,s=""),a&&(n+=a,a=0)}return t.join("")+e.slice(o)}function Zt(e,t,n,o){const a=o?o-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(d){return Tt(d)?(e.enter(n),l(d)):t(d)}function l(d){return Tt(d)&&i++<a?(e.consume(d),l):(e.exit(n),t(d))}}const i$t={tokenize:s$t};function s$t(e){const t=e.attempt(this.parser.constructs.contentInitial,o,a);let n;return t;function o(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Zt(e,t,"linePrefix")}function a(l){return e.enter("paragraph"),i(l)}function i(l){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,s(l)}function s(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return it(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),s)}}const c$t={tokenize:l$t},GQ={tokenize:u$t};function l$t(e){const t=this,n=[];let o=0,a,i,s;return l;function l(A){if(o<n.length){const I=n[o];return t.containerState=I[1],e.attempt(I[0].continuation,d,h)(A)}return h(A)}function d(A){if(o++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&N();const I=t.events.length;let R=I,j;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){j=t.events[R][1].end;break}_(o);let D=I;for(;D<t.events.length;)t.events[D][1].end={...j},D++;return Ar(t.events,R+1,0,t.events.slice(I)),t.events.length=D,h(A)}return l(A)}function h(A){if(o===n.length){if(!a)return v(A);if(a.currentConstruct&&a.currentConstruct.concrete)return M(A);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(GQ,p,m)(A)}function p(A){return a&&N(),_(o),v(A)}function m(A){return t.parser.lazy[t.now().line]=o!==n.length,s=t.now().offset,M(A)}function v(A){return t.containerState={},e.attempt(GQ,x,M)(A)}function x(A){return o++,n.push([t.currentConstruct,t.containerState]),v(A)}function M(A){if(A===null){a&&N(),_(0),e.consume(A);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),b(A)}function b(A){if(A===null){C(e.exit("chunkFlow"),!0),_(0),e.consume(A);return}return it(A)?(e.consume(A),C(e.exit("chunkFlow")),o=0,t.interrupt=void 0,l):(e.consume(A),b)}function C(A,I){const R=t.sliceStream(A);if(I&&R.push(null),A.previous=i,i&&(i.next=A),i=A,a.defineSkip(A.start),a.write(R),t.parser.lazy[A.start.line]){let j=a.events.length;for(;j--;)if(a.events[j][1].start.offset<s&&(!a.events[j][1].end||a.events[j][1].end.offset>s))return;const D=t.events.length;let H=D,U,z;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){if(U){z=t.events[H][1].end;break}U=!0}for(_(o),j=D;j<t.events.length;)t.events[j][1].end={...z},j++;Ar(t.events,H+1,0,t.events.slice(D)),t.events.length=j}}function _(A){let I=n.length;for(;I-- >A;){const R=n[I];t.containerState=R[1],R[0].exit.call(t,e)}n.length=A}function N(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function u$t(e,t,n){return Zt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function XQ(e){if(e===null||To(e)||r$t(e))return 1;if(a$t(e))return 2}function BF(e,t,n){const o=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!o.includes(i)&&(t=i(t,n),o.push(i))}return t}const uV={name:"attention",resolveAll:d$t,tokenize:h$t};function d$t(e,t){let n=-1,o,a,i,s,l,d,h,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(o=n;o--;)if(e[o][0]==="exit"&&e[o][1].type==="attentionSequence"&&e[o][1]._open&&t.sliceSerialize(e[o][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[o][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[o][1].end.offset-e[o][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;d=e[o][1].end.offset-e[o][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[o][1].end},v={...e[n][1].start};ZQ(m,-d),ZQ(v,d),s={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...e[o][1].end}},l={type:d>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:v},i={type:d>1?"strongText":"emphasisText",start:{...e[o][1].end},end:{...e[n][1].start}},a={type:d>1?"strong":"emphasis",start:{...s.start},end:{...l.end}},e[o][1].end={...s.start},e[n][1].start={...l.end},h=[],e[o][1].end.offset-e[o][1].start.offset&&(h=va(h,[["enter",e[o][1],t],["exit",e[o][1],t]])),h=va(h,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),h=va(h,BF(t.parser.constructs.insideSpan.null,e.slice(o+1,n),t)),h=va(h,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,h=va(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Ar(e,o-1,n-o+3,h),n=o+h.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function h$t(e,t){const n=this.parser.constructs.attentionMarkers.null,o=this.previous,a=XQ(o);let i;return s;function s(d){return i=d,e.enter("attentionSequence"),l(d)}function l(d){if(d===i)return e.consume(d),l;const h=e.exit("attentionSequence"),p=XQ(d),m=!p||p===2&&a||n.includes(d),v=!a||a===2&&p||n.includes(o);return h._open=!!(i===42?m:m&&(a||!v)),h._close=!!(i===42?v:v&&(p||!m)),t(d)}}function ZQ(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const f$t={name:"autolink",tokenize:p$t};function p$t(e,t,n){let o=0;return a;function a(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(x){return gr(x)?(e.consume(x),s):x===64?n(x):h(x)}function s(x){return x===43||x===45||x===46||Qo(x)?(o=1,l(x)):h(x)}function l(x){return x===58?(e.consume(x),o=0,d):(x===43||x===45||x===46||Qo(x))&&o++<32?(e.consume(x),l):(o=0,h(x))}function d(x){return x===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):x===null||x===32||x===60||cV(x)?n(x):(e.consume(x),d)}function h(x){return x===64?(e.consume(x),p):t$t(x)?(e.consume(x),h):n(x)}function p(x){return Qo(x)?m(x):n(x)}function m(x){return x===46?(e.consume(x),o=0,p):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):v(x)}function v(x){if((x===45||Qo(x))&&o++<63){const M=x===45?v:m;return e.consume(x),M}return n(x)}}const H$={partial:!0,tokenize:y$t};function y$t(e,t,n){return o;function o(i){return Tt(i)?Zt(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||it(i)?t(i):n(i)}}const Zle={continuation:{tokenize:g$t},exit:v$t,name:"blockQuote",tokenize:m$t};function m$t(e,t,n){const o=this;return a;function a(s){if(s===62){const l=o.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return Tt(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function g$t(e,t,n){const o=this;return a;function a(s){return Tt(s)?Zt(e,i,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Zle,t,n)(s)}}function v$t(e){e.exit("blockQuote")}const Yle={name:"characterEscape",tokenize:k$t};function k$t(e,t,n){return o;function o(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return o$t(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Wle={name:"characterReference",tokenize:x$t};function x$t(e,t,n){const o=this;let a=0,i,s;return l;function l(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),d}function d(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),i=31,s=Qo,p(m))}function h(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=n$t,p):(e.enter("characterReferenceValue"),i=7,s=lV,p(m))}function p(m){if(m===59&&a){const v=e.exit("characterReferenceValue");return s===Qo&&!VF(o.sliceSerialize(v))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(m)&&a++<i?(e.consume(m),p):n(m)}}const YQ={partial:!0,tokenize:b$t},WQ={concrete:!0,name:"codeFenced",tokenize:w$t};function w$t(e,t,n){const o=this,a={partial:!0,tokenize:R};let i=0,s=0,l;return d;function d(j){return h(j)}function h(j){const D=o.events[o.events.length-1];return i=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,l=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(j)}function p(j){return j===l?(s++,e.consume(j),p):s<3?n(j):(e.exit("codeFencedFenceSequence"),Tt(j)?Zt(e,m,"whitespace")(j):m(j))}function m(j){return j===null||it(j)?(e.exit("codeFencedFence"),o.interrupt?t(j):e.check(YQ,b,I)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(j))}function v(j){return j===null||it(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(j)):Tt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Zt(e,x,"whitespace")(j)):j===96&&j===l?n(j):(e.consume(j),v)}function x(j){return j===null||it(j)?m(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),M(j))}function M(j){return j===null||it(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(j)):j===96&&j===l?n(j):(e.consume(j),M)}function b(j){return e.attempt(a,I,C)(j)}function C(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),_}function _(j){return i>0&&Tt(j)?Zt(e,N,"linePrefix",i+1)(j):N(j)}function N(j){return j===null||it(j)?e.check(YQ,b,I)(j):(e.enter("codeFlowValue"),A(j))}function A(j){return j===null||it(j)?(e.exit("codeFlowValue"),N(j)):(e.consume(j),A)}function I(j){return e.exit("codeFenced"),t(j)}function R(j,D,H){let U=0;return z;function z(O){return j.enter("lineEnding"),j.consume(O),j.exit("lineEnding"),Z}function Z(O){return j.enter("codeFencedFence"),Tt(O)?Zt(j,q,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):q(O)}function q(O){return O===l?(j.enter("codeFencedFenceSequence"),G(O)):H(O)}function G(O){return O===l?(U++,j.consume(O),G):U>=s?(j.exit("codeFencedFenceSequence"),Tt(O)?Zt(j,E,"whitespace")(O):E(O)):H(O)}function E(O){return O===null||it(O)?(j.exit("codeFencedFence"),D(O)):H(O)}}}function b$t(e,t,n){const o=this;return a;function a(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return o.parser.lazy[o.now().line]?n(s):t(s)}}const yq={name:"codeIndented",tokenize:_$t},M$t={partial:!0,tokenize:S$t};function _$t(e,t,n){const o=this;return a;function a(h){return e.enter("codeIndented"),Zt(e,i,"linePrefix",5)(h)}function i(h){const p=o.events[o.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?s(h):n(h)}function s(h){return h===null?d(h):it(h)?e.attempt(M$t,s,d)(h):(e.enter("codeFlowValue"),l(h))}function l(h){return h===null||it(h)?(e.exit("codeFlowValue"),s(h)):(e.consume(h),l)}function d(h){return e.exit("codeIndented"),t(h)}}function S$t(e,t,n){const o=this;return a;function a(s){return o.parser.lazy[o.now().line]?n(s):it(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Zt(e,i,"linePrefix",5)(s)}function i(s){const l=o.events[o.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(s):it(s)?a(s):n(s)}}const C$t={name:"codeText",previous:L$t,resolve:N$t,tokenize:j$t};function N$t(e){let t=e.length-4,n=3,o,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(o=n;++o<t;)if(e[o][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(o=n-1,t++;++o<=t;)a===void 0?o!==t&&e[o][1].type!=="lineEnding"&&(a=o):(o===t||e[o][1].type==="lineEnding")&&(e[a][1].type="codeTextData",o!==a+2&&(e[a][1].end=e[o-1][1].end,e.splice(a+2,o-a-2),t-=o-a-2,o=a+2),a=void 0);return e}function L$t(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function j$t(e,t,n){let o=0,a,i;return s;function s(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),o++,l):(e.exit("codeTextSequence"),d(m))}function d(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),d):m===96?(i=e.enter("codeTextSequence"),a=0,p(m)):it(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("codeTextData"),h(m))}function h(m){return m===null||m===32||m===96||it(m)?(e.exit("codeTextData"),d(m)):(e.consume(m),h)}function p(m){return m===96?(e.consume(m),a++,p):a===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(i.type="codeTextData",h(m))}}class A$t{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const o=n??Number.POSITIVE_INFINITY;return o<this.left.length?this.left.slice(t,o):t>this.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(t,n,o){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return o&&If(this.left,o),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),If(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),If(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);If(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);If(this.left,n.reverse())}}}function If(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Kle(e){const t={};let n=-1,o,a,i,s,l,d,h;const p=new A$t(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(o=p.get(n),n&&o[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(d=o[1]._tokenizer.events,i=0,i<d.length&&d[i][1].type==="lineEndingBlank"&&(i+=2),i<d.length&&d[i][1].type==="content"))for(;++i<d.length&&d[i][1].type!=="content";)d[i][1].type==="chunkText"&&(d[i][1]._isInFirstContentOfListItem=!0,i++);if(o[0]==="enter")o[1].contentType&&(Object.assign(t,E$t(p,n)),n=t[n],h=!0);else if(o[1]._container){for(i=n,a=void 0;i--;)if(s=p.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(a&&(p.get(a)[1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;a&&(o[1].end={...p.get(a)[1].start},l=p.slice(a,n),l.unshift(o),p.splice(a,n-a+1,l))}}return Ar(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!h}function E$t(e,t){const n=e.get(t)[1],o=e.get(t)[2];let a=t-1;const i=[];let s=n._tokenizer;s||(s=o.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const l=s.events,d=[],h={};let p,m,v=-1,x=n,M=0,b=0;const C=[b];for(;x;){for(;e.get(++a)[1]!==x;);i.push(a),x._tokenizer||(p=o.sliceStream(x),x.next||p.push(null),m&&s.defineSkip(x.start),x._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(p),x._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),m=x,x=x.next}for(x=n;++v<l.length;)l[v][0]==="exit"&&l[v-1][0]==="enter"&&l[v][1].type===l[v-1][1].type&&l[v][1].start.line!==l[v][1].end.line&&(b=v+1,C.push(b),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(s.events=[],x?(x._tokenizer=void 0,x.previous=void 0):C.pop(),v=C.length;v--;){const _=l.slice(C[v],C[v+1]),N=i.pop();d.push([N,N+_.length-1]),e.splice(N,2,_)}for(d.reverse(),v=-1;++v<d.length;)h[M+d[v][0]]=M+d[v][1],M+=d[v][1]-d[v][0]-1;return h}const I$t={resolve:R$t,tokenize:P$t},T$t={partial:!0,tokenize:$$t};function R$t(e){return Kle(e),e}function P$t(e,t){let n;return o;function o(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(l)}function a(l){return l===null?i(l):it(l)?e.check(T$t,s,i)(l):(e.consume(l),a)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function s(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function $$t(e,t,n){const o=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Zt(e,i,"linePrefix")}function i(s){if(s===null||it(s))return n(s);const l=o.events[o.events.length-1];return!o.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(s):e.interrupt(o.parser.constructs.flow,n,t)(s)}}function Qle(e,t,n,o,a,i,s,l,d){const h=d||Number.POSITIVE_INFINITY;let p=0;return m;function m(_){return _===60?(e.enter(o),e.enter(a),e.enter(i),e.consume(_),e.exit(i),v):_===null||_===32||_===41||cV(_)?n(_):(e.enter(o),e.enter(s),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(_))}function v(_){return _===62?(e.enter(i),e.consume(_),e.exit(i),e.exit(a),e.exit(o),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),x(_))}function x(_){return _===62?(e.exit("chunkString"),e.exit(l),v(_)):_===null||_===60||it(_)?n(_):(e.consume(_),_===92?M:x)}function M(_){return _===60||_===62||_===92?(e.consume(_),x):x(_)}function b(_){return!p&&(_===null||_===41||To(_))?(e.exit("chunkString"),e.exit(l),e.exit(s),e.exit(o),t(_)):p<h&&_===40?(e.consume(_),p++,b):_===41?(e.consume(_),p--,b):_===null||_===32||_===40||cV(_)?n(_):(e.consume(_),_===92?C:b)}function C(_){return _===40||_===41||_===92?(e.consume(_),b):b(_)}}function Jle(e,t,n,o,a,i){const s=this;let l=0,d;return h;function h(x){return e.enter(o),e.enter(a),e.consume(x),e.exit(a),e.enter(i),p}function p(x){return l>999||x===null||x===91||x===93&&!d||x===94&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?n(x):x===93?(e.exit(i),e.enter(a),e.consume(x),e.exit(a),e.exit(o),t):it(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===null||x===91||x===93||it(x)||l++>999?(e.exit("chunkString"),p(x)):(e.consume(x),d||(d=!Tt(x)),x===92?v:m)}function v(x){return x===91||x===92||x===93?(e.consume(x),l++,m):m(x)}}function eue(e,t,n,o,a,i){let s;return l;function l(v){return v===34||v===39||v===40?(e.enter(o),e.enter(a),e.consume(v),e.exit(a),s=v===40?41:v,d):n(v)}function d(v){return v===s?(e.enter(a),e.consume(v),e.exit(a),e.exit(o),t):(e.enter(i),h(v))}function h(v){return v===s?(e.exit(i),d(s)):v===null?n(v):it(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),Zt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===s||v===null||it(v)?(e.exit("chunkString"),h(v)):(e.consume(v),v===92?m:p)}function m(v){return v===s||v===92?(e.consume(v),p):p(v)}}function E0(e,t){let n;return o;function o(a){return it(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,o):Tt(a)?Zt(e,o,n?"linePrefix":"lineSuffix")(a):t(a)}}const D$t={name:"definition",tokenize:O$t},z$t={partial:!0,tokenize:q$t};function O$t(e,t,n){const o=this;let a;return i;function i(x){return e.enter("definition"),s(x)}function s(x){return Jle.call(o,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function l(x){return a=Bh(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),d):n(x)}function d(x){return To(x)?E0(e,h)(x):h(x)}function h(x){return Qle(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function p(x){return e.attempt(z$t,m,m)(x)}function m(x){return Tt(x)?Zt(e,v,"whitespace")(x):v(x)}function v(x){return x===null||it(x)?(e.exit("definition"),o.parser.defined.push(a),t(x)):n(x)}}function q$t(e,t,n){return o;function o(l){return To(l)?E0(e,a)(l):n(l)}function a(l){return eue(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Tt(l)?Zt(e,s,"whitespace")(l):s(l)}function s(l){return l===null||it(l)?t(l):n(l)}}const H$t={name:"hardBreakEscape",tokenize:V$t};function V$t(e,t,n){return o;function o(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return it(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const B$t={name:"headingAtx",resolve:F$t,tokenize:U$t};function F$t(e,t){let n=e.length-2,o=3,a,i;return e[o][1].type==="whitespace"&&(o+=2),n-2>o&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(o===n-1||n-4>o&&e[n-2][1].type==="whitespace")&&(n-=o+1===n?2:4),n>o&&(a={type:"atxHeadingText",start:e[o][1].start,end:e[n][1].end},i={type:"chunkText",start:e[o][1].start,end:e[n][1].end,contentType:"text"},Ar(e,o,n-o+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function U$t(e,t,n){let o=0;return a;function a(p){return e.enter("atxHeading"),i(p)}function i(p){return e.enter("atxHeadingSequence"),s(p)}function s(p){return p===35&&o++<6?(e.consume(p),s):p===null||To(p)?(e.exit("atxHeadingSequence"),l(p)):n(p)}function l(p){return p===35?(e.enter("atxHeadingSequence"),d(p)):p===null||it(p)?(e.exit("atxHeading"),t(p)):Tt(p)?Zt(e,l,"whitespace")(p):(e.enter("atxHeadingText"),h(p))}function d(p){return p===35?(e.consume(p),d):(e.exit("atxHeadingSequence"),l(p))}function h(p){return p===null||p===35||To(p)?(e.exit("atxHeadingText"),l(p)):(e.consume(p),h)}}const G$t=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],KQ=["pre","script","style","textarea"],X$t={concrete:!0,name:"htmlFlow",resolveTo:W$t,tokenize:K$t},Z$t={partial:!0,tokenize:J$t},Y$t={partial:!0,tokenize:Q$t};function W$t(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function K$t(e,t,n){const o=this;let a,i,s,l,d;return h;function h(T){return p(T)}function p(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),m}function m(T){return T===33?(e.consume(T),v):T===47?(e.consume(T),i=!0,b):T===63?(e.consume(T),a=3,o.interrupt?t:L):gr(T)?(e.consume(T),s=String.fromCharCode(T),C):n(T)}function v(T){return T===45?(e.consume(T),a=2,x):T===91?(e.consume(T),a=5,l=0,M):gr(T)?(e.consume(T),a=4,o.interrupt?t:L):n(T)}function x(T){return T===45?(e.consume(T),o.interrupt?t:L):n(T)}function M(T){const K="CDATA[";return T===K.charCodeAt(l++)?(e.consume(T),l===K.length?o.interrupt?t:q:M):n(T)}function b(T){return gr(T)?(e.consume(T),s=String.fromCharCode(T),C):n(T)}function C(T){if(T===null||T===47||T===62||To(T)){const K=T===47,Q=s.toLowerCase();return!K&&!i&&KQ.includes(Q)?(a=1,o.interrupt?t(T):q(T)):G$t.includes(s.toLowerCase())?(a=6,K?(e.consume(T),_):o.interrupt?t(T):q(T)):(a=7,o.interrupt&&!o.parser.lazy[o.now().line]?n(T):i?N(T):A(T))}return T===45||Qo(T)?(e.consume(T),s+=String.fromCharCode(T),C):n(T)}function _(T){return T===62?(e.consume(T),o.interrupt?t:q):n(T)}function N(T){return Tt(T)?(e.consume(T),N):z(T)}function A(T){return T===47?(e.consume(T),z):T===58||T===95||gr(T)?(e.consume(T),I):Tt(T)?(e.consume(T),A):z(T)}function I(T){return T===45||T===46||T===58||T===95||Qo(T)?(e.consume(T),I):R(T)}function R(T){return T===61?(e.consume(T),j):Tt(T)?(e.consume(T),R):A(T)}function j(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),d=T,D):Tt(T)?(e.consume(T),j):H(T)}function D(T){return T===d?(e.consume(T),d=null,U):T===null||it(T)?n(T):(e.consume(T),D)}function H(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||To(T)?R(T):(e.consume(T),H)}function U(T){return T===47||T===62||Tt(T)?A(T):n(T)}function z(T){return T===62?(e.consume(T),Z):n(T)}function Z(T){return T===null||it(T)?q(T):Tt(T)?(e.consume(T),Z):n(T)}function q(T){return T===45&&a===2?(e.consume(T),P):T===60&&a===1?(e.consume(T),X):T===62&&a===4?(e.consume(T),Y):T===63&&a===3?(e.consume(T),L):T===93&&a===5?(e.consume(T),V):it(T)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(Z$t,F,G)(T)):T===null||it(T)?(e.exit("htmlFlowData"),G(T)):(e.consume(T),q)}function G(T){return e.check(Y$t,E,F)(T)}function E(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),O}function O(T){return T===null||it(T)?G(T):(e.enter("htmlFlowData"),q(T))}function P(T){return T===45?(e.consume(T),L):q(T)}function X(T){return T===47?(e.consume(T),s="",W):q(T)}function W(T){if(T===62){const K=s.toLowerCase();return KQ.includes(K)?(e.consume(T),Y):q(T)}return gr(T)&&s.length<8?(e.consume(T),s+=String.fromCharCode(T),W):q(T)}function V(T){return T===93?(e.consume(T),L):q(T)}function L(T){return T===62?(e.consume(T),Y):T===45&&a===2?(e.consume(T),L):q(T)}function Y(T){return T===null||it(T)?(e.exit("htmlFlowData"),F(T)):(e.consume(T),Y)}function F(T){return e.exit("htmlFlow"),t(T)}}function Q$t(e,t,n){const o=this;return a;function a(s){return it(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return o.parser.lazy[o.now().line]?n(s):t(s)}}function J$t(e,t,n){return o;function o(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(H$,t,n)}}const eDt={name:"htmlText",tokenize:tDt};function tDt(e,t,n){const o=this;let a,i,s;return l;function l(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),d}function d(L){return L===33?(e.consume(L),h):L===47?(e.consume(L),R):L===63?(e.consume(L),A):gr(L)?(e.consume(L),H):n(L)}function h(L){return L===45?(e.consume(L),p):L===91?(e.consume(L),i=0,M):gr(L)?(e.consume(L),N):n(L)}function p(L){return L===45?(e.consume(L),x):n(L)}function m(L){return L===null?n(L):L===45?(e.consume(L),v):it(L)?(s=m,X(L)):(e.consume(L),m)}function v(L){return L===45?(e.consume(L),x):m(L)}function x(L){return L===62?P(L):L===45?v(L):m(L)}function M(L){const Y="CDATA[";return L===Y.charCodeAt(i++)?(e.consume(L),i===Y.length?b:M):n(L)}function b(L){return L===null?n(L):L===93?(e.consume(L),C):it(L)?(s=b,X(L)):(e.consume(L),b)}function C(L){return L===93?(e.consume(L),_):b(L)}function _(L){return L===62?P(L):L===93?(e.consume(L),_):b(L)}function N(L){return L===null||L===62?P(L):it(L)?(s=N,X(L)):(e.consume(L),N)}function A(L){return L===null?n(L):L===63?(e.consume(L),I):it(L)?(s=A,X(L)):(e.consume(L),A)}function I(L){return L===62?P(L):A(L)}function R(L){return gr(L)?(e.consume(L),j):n(L)}function j(L){return L===45||Qo(L)?(e.consume(L),j):D(L)}function D(L){return it(L)?(s=D,X(L)):Tt(L)?(e.consume(L),D):P(L)}function H(L){return L===45||Qo(L)?(e.consume(L),H):L===47||L===62||To(L)?U(L):n(L)}function U(L){return L===47?(e.consume(L),P):L===58||L===95||gr(L)?(e.consume(L),z):it(L)?(s=U,X(L)):Tt(L)?(e.consume(L),U):P(L)}function z(L){return L===45||L===46||L===58||L===95||Qo(L)?(e.consume(L),z):Z(L)}function Z(L){return L===61?(e.consume(L),q):it(L)?(s=Z,X(L)):Tt(L)?(e.consume(L),Z):U(L)}function q(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),a=L,G):it(L)?(s=q,X(L)):Tt(L)?(e.consume(L),q):(e.consume(L),E)}function G(L){return L===a?(e.consume(L),a=void 0,O):L===null?n(L):it(L)?(s=G,X(L)):(e.consume(L),G)}function E(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||To(L)?U(L):(e.consume(L),E)}function O(L){return L===47||L===62||To(L)?U(L):n(L)}function P(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function X(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),W}function W(L){return Tt(L)?Zt(e,V,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):V(L)}function V(L){return e.enter("htmlTextData"),s(L)}}const FF={name:"labelEnd",resolveAll:rDt,resolveTo:iDt,tokenize:sDt},nDt={tokenize:cDt},oDt={tokenize:lDt},aDt={tokenize:uDt};function rDt(e){let t=-1;const n=[];for(;++t<e.length;){const o=e[t][1];if(n.push(e[t]),o.type==="labelImage"||o.type==="labelLink"||o.type==="labelEnd"){const a=o.type==="labelImage"?4:2;o.type="data",t+=a}}return e.length!==n.length&&Ar(e,0,e.length,n),e}function iDt(e,t){let n=e.length,o=0,a,i,s,l;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){o=2;break}}else a.type==="labelEnd"&&(s=n);const d={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[i][1].start},end:{...e[s][1].end}},p={type:"labelText",start:{...e[i+o+2][1].end},end:{...e[s-2][1].start}};return l=[["enter",d,t],["enter",h,t]],l=va(l,e.slice(i+1,i+o+3)),l=va(l,[["enter",p,t]]),l=va(l,BF(t.parser.constructs.insideSpan.null,e.slice(i+o+4,s-3),t)),l=va(l,[["exit",p,t],e[s-2],e[s-1],["exit",h,t]]),l=va(l,e.slice(s+1)),l=va(l,[["exit",d,t]]),Ar(e,i,e.length,l),e}function sDt(e,t,n){const o=this;let a=o.events.length,i,s;for(;a--;)if((o.events[a][1].type==="labelImage"||o.events[a][1].type==="labelLink")&&!o.events[a][1]._balanced){i=o.events[a][1];break}return l;function l(v){return i?i._inactive?m(v):(s=o.parser.defined.includes(Bh(o.sliceSerialize({start:i.end,end:o.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),d):n(v)}function d(v){return v===40?e.attempt(nDt,p,s?p:m)(v):v===91?e.attempt(oDt,p,s?h:m)(v):s?p(v):m(v)}function h(v){return e.attempt(aDt,p,m)(v)}function p(v){return t(v)}function m(v){return i._balanced=!0,n(v)}}function cDt(e,t,n){return o;function o(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return To(m)?E0(e,i)(m):i(m)}function i(m){return m===41?p(m):Qle(e,s,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function s(m){return To(m)?E0(e,d)(m):p(m)}function l(m){return n(m)}function d(m){return m===34||m===39||m===40?eue(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):p(m)}function h(m){return To(m)?E0(e,p)(m):p(m)}function p(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function lDt(e,t,n){const o=this;return a;function a(l){return Jle.call(o,e,i,s,"reference","referenceMarker","referenceString")(l)}function i(l){return o.parser.defined.includes(Bh(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function s(l){return n(l)}}function uDt(e,t,n){return o;function o(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const dDt={name:"labelStartImage",resolveAll:FF.resolveAll,tokenize:hDt};function hDt(e,t,n){const o=this;return a;function a(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),s):n(l)}function s(l){return l===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(l):t(l)}}const fDt={name:"labelStartLink",resolveAll:FF.resolveAll,tokenize:pDt};function pDt(e,t,n){const o=this;return a;function a(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in o.parser.constructs?n(s):t(s)}}const mq={name:"lineEnding",tokenize:yDt};function yDt(e,t){return n;function n(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Zt(e,t,"linePrefix")}}const $R={name:"thematicBreak",tokenize:mDt};function mDt(e,t,n){let o=0,a;return i;function i(h){return e.enter("thematicBreak"),s(h)}function s(h){return a=h,l(h)}function l(h){return h===a?(e.enter("thematicBreakSequence"),d(h)):o>=3&&(h===null||it(h))?(e.exit("thematicBreak"),t(h)):n(h)}function d(h){return h===a?(e.consume(h),o++,d):(e.exit("thematicBreakSequence"),Tt(h)?Zt(e,l,"whitespace")(h):l(h))}}const jo={continuation:{tokenize:xDt},exit:bDt,name:"list",tokenize:kDt},gDt={partial:!0,tokenize:MDt},vDt={partial:!0,tokenize:wDt};function kDt(e,t,n){const o=this,a=o.events[o.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return l;function l(x){const M=o.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(M==="listUnordered"?!o.containerState.marker||x===o.containerState.marker:lV(x)){if(o.containerState.type||(o.containerState.type=M,e.enter(M,{_container:!0})),M==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check($R,n,h)(x):h(x);if(!o.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(x)}return n(x)}function d(x){return lV(x)&&++s<10?(e.consume(x),d):(!o.interrupt||s<2)&&(o.containerState.marker?x===o.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),h(x)):n(x)}function h(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||x,e.check(H$,o.interrupt?n:p,e.attempt(gDt,v,m))}function p(x){return o.containerState.initialBlankLine=!0,i++,v(x)}function m(x){return Tt(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),v):n(x)}function v(x){return o.containerState.size=i+o.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(x)}}function xDt(e,t,n){const o=this;return o.containerState._closeFlow=void 0,e.check(H$,a,i);function a(l){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,Zt(e,t,"listItemIndent",o.containerState.size+1)(l)}function i(l){return o.containerState.furtherBlankLines||!Tt(l)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,s(l)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,e.attempt(vDt,t,s)(l))}function s(l){return o.containerState._closeFlow=!0,o.interrupt=void 0,Zt(e,e.attempt(jo,t,n),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function wDt(e,t,n){const o=this;return Zt(e,a,"listItemIndent",o.containerState.size+1);function a(i){const s=o.events[o.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===o.containerState.size?t(i):n(i)}}function bDt(e){e.exit(this.containerState.type)}function MDt(e,t,n){const o=this;return Zt(e,a,"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const s=o.events[o.events.length-1];return!Tt(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const QQ={name:"setextUnderline",resolveTo:_Dt,tokenize:SDt};function _Dt(e,t){let n=e.length,o,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){o=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const s={type:"setextHeading",start:{...e[o][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",s,t]),e.splice(i+1,0,["exit",e[o][1],t]),e[o][1].end={...e[i][1].end}):e[o][1]=s,e.push(["exit",s,t]),e}function SDt(e,t,n){const o=this;let a;return i;function i(h){let p=o.events.length,m;for(;p--;)if(o.events[p][1].type!=="lineEnding"&&o.events[p][1].type!=="linePrefix"&&o.events[p][1].type!=="content"){m=o.events[p][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||m)?(e.enter("setextHeadingLine"),a=h,s(h)):n(h)}function s(h){return e.enter("setextHeadingLineSequence"),l(h)}function l(h){return h===a?(e.consume(h),l):(e.exit("setextHeadingLineSequence"),Tt(h)?Zt(e,d,"lineSuffix")(h):d(h))}function d(h){return h===null||it(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const CDt={tokenize:NDt};function NDt(e){const t=this,n=e.attempt(H$,o,e.attempt(this.parser.constructs.flowInitial,a,Zt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(I$t,a)),"linePrefix")));return n;function o(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const LDt={resolveAll:nue()},jDt=tue("string"),ADt=tue("text");function tue(e){return{resolveAll:nue(e==="text"?EDt:void 0),tokenize:t};function t(n){const o=this,a=this.parser.constructs[e],i=n.attempt(a,s,l);return s;function s(p){return h(p)?i(p):l(p)}function l(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),d}function d(p){return h(p)?(n.exit("data"),i(p)):(n.consume(p),d)}function h(p){if(p===null)return!0;const m=a[p];let v=-1;if(m)for(;++v<m.length;){const x=m[v];if(!x.previous||x.previous.call(o,o.previous))return!0}return!1}}}function nue(e){return t;function t(n,o){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,o):n}}function EDt(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const o=e[n-1][1],a=t.sliceStream(o);let i=a.length,s=-1,l=0,d;for(;i--;){const h=a[i];if(typeof h=="string"){for(s=h.length;h.charCodeAt(s-1)===32;)l++,s--;if(s)break;s=-1}else if(h===-2)d=!0,l++;else if(h!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const h={type:n===e.length||d||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?s:o.start._bufferIndex+s,_index:o.start._index+i,line:o.end.line,column:o.end.column-l,offset:o.end.offset-l},end:{...o.end}};o.end={...h.start},o.start.offset===o.end.offset?Object.assign(o,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const IDt={42:jo,43:jo,45:jo,48:jo,49:jo,50:jo,51:jo,52:jo,53:jo,54:jo,55:jo,56:jo,57:jo,62:Zle},TDt={91:D$t},RDt={[-2]:yq,[-1]:yq,32:yq},PDt={35:B$t,42:$R,45:[QQ,$R],60:X$t,61:QQ,95:$R,96:WQ,126:WQ},$Dt={38:Wle,92:Yle},DDt={[-5]:mq,[-4]:mq,[-3]:mq,33:dDt,38:Wle,42:uV,60:[f$t,eDt],91:fDt,92:[H$t,Yle],93:FF,95:uV,96:C$t},zDt={null:[uV,LDt]},ODt={null:[42,95]},qDt={null:[]},HDt=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ODt,contentInitial:TDt,disable:qDt,document:IDt,flow:PDt,flowInitial:RDt,insideSpan:zDt,string:$Dt,text:DDt},Symbol.toStringTag,{value:"Module"}));function VDt(e,t,n){let o={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let s=[],l=[];const d={attempt:D(R),check:D(j),consume:N,enter:A,exit:I,interrupt:D(j,{interrupt:!0})},h={code:null,containerState:{},defineSkip:b,events:[],now:M,parser:e,previous:null,sliceSerialize:v,sliceStream:x,write:m};let p=t.tokenize.call(h,d);return t.resolveAll&&i.push(t),h;function m(Z){return s=va(s,Z),C(),s[s.length-1]!==null?[]:(H(t,0),h.events=BF(i,h.events,h),h.events)}function v(Z,q){return FDt(x(Z),q)}function x(Z){return BDt(s,Z)}function M(){const{_bufferIndex:Z,_index:q,line:G,column:E,offset:O}=o;return{_bufferIndex:Z,_index:q,line:G,column:E,offset:O}}function b(Z){a[Z.line]=Z.column,z()}function C(){let Z;for(;o._index<s.length;){const q=s[o._index];if(typeof q=="string")for(Z=o._index,o._bufferIndex<0&&(o._bufferIndex=0);o._index===Z&&o._bufferIndex<q.length;)_(q.charCodeAt(o._bufferIndex));else _(q)}}function _(Z){p=p(Z)}function N(Z){it(Z)?(o.line++,o.column=1,o.offset+=Z===-3?2:1,z()):Z!==-1&&(o.column++,o.offset++),o._bufferIndex<0?o._index++:(o._bufferIndex++,o._bufferIndex===s[o._index].length&&(o._bufferIndex=-1,o._index++)),h.previous=Z}function A(Z,q){const G=q||{};return G.type=Z,G.start=M(),h.events.push(["enter",G,h]),l.push(G),G}function I(Z){const q=l.pop();return q.end=M(),h.events.push(["exit",q,h]),q}function R(Z,q){H(Z,q.from)}function j(Z,q){q.restore()}function D(Z,q){return G;function G(E,O,P){let X,W,V,L;return Array.isArray(E)?F(E):"tokenize"in E?F([E]):Y(E);function Y(ne){return te;function te(ce){const me=ce!==null&&ne[ce],ke=ce!==null&&ne.null,Ee=[...Array.isArray(me)?me:me?[me]:[],...Array.isArray(ke)?ke:ke?[ke]:[]];return F(Ee)(ce)}}function F(ne){return X=ne,W=0,ne.length===0?P:T(ne[W])}function T(ne){return te;function te(ce){return L=U(),V=ne,ne.partial||(h.currentConstruct=ne),ne.name&&h.parser.constructs.disable.null.includes(ne.name)?Q():ne.tokenize.call(q?Object.assign(Object.create(h),q):h,d,K,Q)(ce)}}function K(ne){return Z(V,L),O}function Q(ne){return L.restore(),++W<X.length?T(X[W]):P}}}function H(Z,q){Z.resolveAll&&!i.includes(Z)&&i.push(Z),Z.resolve&&Ar(h.events,q,h.events.length-q,Z.resolve(h.events.slice(q),h)),Z.resolveTo&&(h.events=Z.resolveTo(h.events,h))}function U(){const Z=M(),q=h.previous,G=h.currentConstruct,E=h.events.length,O=Array.from(l);return{from:E,restore:P};function P(){o=Z,h.previous=q,h.currentConstruct=G,h.events.length=E,l=O,z()}}function z(){o.line in a&&o.column<2&&(o.column=a[o.line],o.offset+=a[o.line]-1)}}function BDt(e,t){const n=t.start._index,o=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let s;if(n===a)s=[e[n].slice(o,i)];else{if(s=e.slice(n,a),o>-1){const l=s[0];typeof l=="string"?s[0]=l.slice(o):s.shift()}i>0&&s.push(e[a].slice(0,i))}return s}function FDt(e,t){let n=-1;const o=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
8192
8192
  `;break}case-3:{s=`\r
8193
8193
  `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,o.push(s)}return o.join("")}function UDt(e){const o={constructs:QPt([HDt,...(e||{}).extensions||[]]),content:a(i$t),defined:[],document:a(c$t),flow:a(CDt),lazy:{},string:a(jDt),text:a(ADt)};return o;function a(i){return s;function s(l){return VDt(o,i,l)}}}function GDt(e){for(;!Kle(e););return e}const JQ=/[\0\t\n\r]/g;function XDt(){let e=1,t="",n=!0,o;return a;function a(i,s,l){const d=[];let h,p,m,v,x;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),m=0,t="",n&&(i.charCodeAt(0)===65279&&m++,n=void 0);m<i.length;){if(JQ.lastIndex=m,h=JQ.exec(i),v=h&&h.index!==void 0?h.index:i.length,x=i.charCodeAt(v),!h){t=i.slice(m);break}if(x===10&&m===v&&o)d.push(-3),o=void 0;else switch(o&&(d.push(-5),o=void 0),m<v&&(d.push(i.slice(m,v)),e+=v-m),x){case 0:{d.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,d.push(-2);e++<p;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:o=!0,e=1}m=v+1}return l&&(o&&d.push(-5),t&&d.push(t),d.push(null)),d}}const ZDt=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function YDt(e){return e.replace(ZDt,WDt)}function WDt(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Xle(n.slice(i?2:1),i?16:10)}return VF(n)||e}const oue={}.hasOwnProperty;function KDt(e,t,n){return typeof t!="string"&&(n=t,t=void 0),QDt(n)(GDt(UDt(n).document().write(XDt()(e,t,!0))))}function QDt(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Rt),autolinkProtocol:U,autolinkEmail:U,atxHeading:i(ct),blockQuote:i(ke),characterEscape:U,characterReference:U,codeFenced:i(Ee),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(Ee,s),codeText:i(Ie,s),codeTextData:U,data:U,codeFlowValue:U,definition:i(Te),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(qe),hardBreakEscape:i(jt),hardBreakTrailing:i(jt),htmlFlow:i(We,s),htmlFlowData:U,htmlText:i(We,s),htmlTextData:U,image:i(Le),label:s,link:i(Rt),listItem:i(An),listItemValue:v,listOrdered:i(eo,m),listUnordered:i(eo),paragraph:i(wn),reference:T,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(ct),strong:i(On),thematicBreak:i(wo)},exit:{atxHeading:d(),atxHeadingSequence:R,autolink:d(),autolinkEmail:me,autolinkProtocol:ce,blockQuote:d(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:Q,characterReferenceMarkerNumeric:Q,characterReferenceValue:ne,characterReference:te,codeFenced:d(C),codeFencedFence:b,codeFencedFenceInfo:x,codeFencedFenceMeta:M,codeFlowValue:z,codeIndented:d(_),codeText:d(O),codeTextData:z,data:z,definition:d(),definitionDestinationString:I,definitionLabelString:N,definitionTitleString:A,emphasis:d(),hardBreakEscape:d(q),hardBreakTrailing:d(q),htmlFlow:d(G),htmlFlowData:z,htmlText:d(E),htmlTextData:z,image:d(X),label:V,labelText:W,lineEnding:Z,link:d(P),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:K,resourceDestinationString:L,resourceTitleString:Y,resource:F,setextHeading:d(H),setextHeadingLineSequence:D,setextHeadingText:j,strong:d(),thematicBreak:d()}};aue(t,(e||{}).mdastExtensions||[]);const n={};return o;function o(fe){let be={type:"root",children:[]};const Oe={stack:[be],tokenStack:[],config:t,enter:l,exit:h,buffer:s,resume:p,data:n},He=[];let kt=-1;for(;++kt<fe.length;)if(fe[kt][1].type==="listOrdered"||fe[kt][1].type==="listUnordered")if(fe[kt][0]==="enter")He.push(kt);else{const ft=He.pop();kt=a(fe,ft,kt)}for(kt=-1;++kt<fe.length;){const ft=t[fe[kt][0]];oue.call(ft,fe[kt][1].type)&&ft[fe[kt][1].type].call(Object.assign({sliceSerialize:fe[kt][2].sliceSerialize},Oe),fe[kt][1])}if(Oe.tokenStack.length>0){const ft=Oe.tokenStack[Oe.tokenStack.length-1];(ft[1]||eJ).call(Oe,void 0,ft[0])}for(be.position={start:Ui(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:Ui(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},kt=-1;++kt<t.transforms.length;)be=t.transforms[kt](be)||be;return be}function a(fe,be,Oe){let He=be-1,kt=-1,ft=!1,tn,Kt,bn,rn;for(;++He<=Oe;){const At=fe[He];switch(At[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{At[0]==="enter"?kt++:kt--,rn=void 0;break}case"lineEndingBlank":{At[0]==="enter"&&(tn&&!rn&&!kt&&!bn&&(bn=He),rn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:rn=void 0}if(!kt&&At[0]==="enter"&&At[1].type==="listItemPrefix"||kt===-1&&At[0]==="exit"&&(At[1].type==="listUnordered"||At[1].type==="listOrdered")){if(tn){let Dt=He;for(Kt=void 0;Dt--;){const En=fe[Dt];if(En[1].type==="lineEnding"||En[1].type==="lineEndingBlank"){if(En[0]==="exit")continue;Kt&&(fe[Kt][1].type="lineEndingBlank",ft=!0),En[1].type="lineEnding",Kt=Dt}else if(!(En[1].type==="linePrefix"||En[1].type==="blockQuotePrefix"||En[1].type==="blockQuotePrefixWhitespace"||En[1].type==="blockQuoteMarker"||En[1].type==="listItemIndent"))break}bn&&(!Kt||bn<Kt)&&(tn._spread=!0),tn.end=Object.assign({},Kt?fe[Kt][1].start:At[1].end),fe.splice(Kt||He,0,["exit",tn,At[2]]),He++,Oe++}if(At[1].type==="listItemPrefix"){const Dt={type:"listItem",_spread:!1,start:Object.assign({},At[1].start),end:void 0};tn=Dt,fe.splice(He,0,["enter",Dt,At[2]]),He++,Oe++,bn=void 0,rn=!0}}}return fe[be][1]._spread=ft,Oe}function i(fe,be){return Oe;function Oe(He){l.call(this,fe(He),He),be&&be.call(this,He)}}function s(){this.stack.push({type:"fragment",children:[]})}function l(fe,be,Oe){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([be,Oe||void 0]),fe.position={start:Ui(be.start),end:void 0}}function d(fe){return be;function be(Oe){fe&&fe.call(this,Oe),h.call(this,Oe)}}function h(fe,be){const Oe=this.stack.pop(),He=this.tokenStack.pop();if(He)He[0].type!==fe.type&&(be?be.call(this,fe,He[0]):(He[1]||eJ).call(this,fe,He[0]));else throw new Error("Cannot close `"+fe.type+"` ("+A0({start:fe.start,end:fe.end})+"): it’s not open");Oe.position.end=Ui(fe.end)}function p(){return WPt(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function v(fe){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function x(){const fe=this.resume(),be=this.stack[this.stack.length-1];be.lang=fe}function M(){const fe=this.resume(),be=this.stack[this.stack.length-1];be.meta=fe}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const fe=this.resume(),be=this.stack[this.stack.length-1];be.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const fe=this.resume(),be=this.stack[this.stack.length-1];be.value=fe.replace(/(\r?\n|\r)$/g,"")}function N(fe){const be=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=be,Oe.identifier=Bh(this.sliceSerialize(fe)).toLowerCase()}function A(){const fe=this.resume(),be=this.stack[this.stack.length-1];be.title=fe}function I(){const fe=this.resume(),be=this.stack[this.stack.length-1];be.url=fe}function R(fe){const be=this.stack[this.stack.length-1];if(!be.depth){const Oe=this.sliceSerialize(fe).length;be.depth=Oe}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function D(fe){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function H(){this.data.setextHeadingSlurpLineEnding=void 0}function U(fe){const Oe=this.stack[this.stack.length-1].children;let He=Oe[Oe.length-1];(!He||He.type!=="text")&&(He=so(),He.position={start:Ui(fe.start),end:void 0},Oe.push(He)),this.stack.push(He)}function z(fe){const be=this.stack.pop();be.value+=this.sliceSerialize(fe),be.position.end=Ui(fe.end)}function Z(fe){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Oe=be.children[be.children.length-1];Oe.position.end=Ui(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(be.type)&&(U.call(this,fe),z.call(this,fe))}function q(){this.data.atHardBreak=!0}function G(){const fe=this.resume(),be=this.stack[this.stack.length-1];be.value=fe}function E(){const fe=this.resume(),be=this.stack[this.stack.length-1];be.value=fe}function O(){const fe=this.resume(),be=this.stack[this.stack.length-1];be.value=fe}function P(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=be,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function X(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=be,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function W(fe){const be=this.sliceSerialize(fe),Oe=this.stack[this.stack.length-2];Oe.label=YDt(be),Oe.identifier=Bh(be).toLowerCase()}function V(){const fe=this.stack[this.stack.length-1],be=this.resume(),Oe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Oe.type==="link"){const He=fe.children;Oe.children=He}else Oe.alt=be}function L(){const fe=this.resume(),be=this.stack[this.stack.length-1];be.url=fe}function Y(){const fe=this.resume(),be=this.stack[this.stack.length-1];be.title=fe}function F(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function K(fe){const be=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=be,Oe.identifier=Bh(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function Q(fe){this.data.characterReferenceType=fe.type}function ne(fe){const be=this.sliceSerialize(fe),Oe=this.data.characterReferenceType;let He;Oe?(He=Xle(be,Oe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):He=VF(be);const kt=this.stack[this.stack.length-1];kt.value+=He}function te(fe){const be=this.stack.pop();be.position.end=Ui(fe.end)}function ce(fe){z.call(this,fe);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(fe)}function me(fe){z.call(this,fe);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(fe)}function ke(){return{type:"blockquote",children:[]}}function Ee(){return{type:"code",lang:null,meta:null,value:""}}function Ie(){return{type:"inlineCode",value:""}}function Te(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function qe(){return{type:"emphasis",children:[]}}function ct(){return{type:"heading",depth:0,children:[]}}function jt(){return{type:"break"}}function We(){return{type:"html",value:""}}function Le(){return{type:"image",title:null,url:"",alt:null}}function Rt(){return{type:"link",title:null,url:"",children:[]}}function eo(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function An(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function wn(){return{type:"paragraph",children:[]}}function On(){return{type:"strong",children:[]}}function so(){return{type:"text",value:""}}function wo(){return{type:"thematicBreak"}}}function Ui(e){return{line:e.line,column:e.column,offset:e.offset}}function aue(e,t){let n=-1;for(;++n<t.length;){const o=t[n];Array.isArray(o)?aue(e,o):JDt(e,o)}}function JDt(e,t){let n;for(n in t)if(oue.call(t,n))switch(n){case"canContainEols":{const o=t[n];o&&e[n].push(...o);break}case"transforms":{const o=t[n];o&&e[n].push(...o);break}case"enter":case"exit":{const o=t[n];o&&Object.assign(e[n],o);break}}}function eJ(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+A0({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+A0({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+A0({start:t.start,end:t.end})+") is still open")}function ezt(e){const t=this;t.parser=n;function n(o){return KDt(o,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function tzt(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function nzt(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
@@ -8200,4 +8200,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
8200
8200
  `});++o<e.length;)o&&n.push({type:"text",value:`
8201
8201
  `}),n.push(e[o]);return t&&e.length>0&&n.push({type:"text",value:`
8202
8202
  `}),n}function cJ(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function lJ(e,t){const n=Fzt(e,t),o=n.one(e,void 0),a=Tzt(n),i=Array.isArray(o)?{type:"root",children:o}:o||{type:"root",children:[]};return a&&i.children.push({type:"text",value:`
8203
- `},a),i}function Yzt(e,t){return e&&"run"in e?async function(n,o){const a=lJ(n,{file:o,...t});await e.run(a,o)}:function(n,o){return lJ(n,{file:o,...e||t})}}function uJ(e){if(e)throw e}var gq,dJ;function Wzt(){if(dJ)return gq;dJ=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},i=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var p=e.call(h,"constructor"),m=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!p&&!m)return!1;var v;for(v in h);return typeof v>"u"||e.call(h,v)},s=function(h,p){n&&p.name==="__proto__"?n(h,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):h[p.name]=p.newValue},l=function(h,p){if(p==="__proto__")if(e.call(h,p)){if(o)return o(h,p).value}else return;return h[p]};return gq=function d(){var h,p,m,v,x,M,b=arguments[0],C=1,_=arguments.length,N=!1;for(typeof b=="boolean"&&(N=b,b=arguments[1]||{},C=2),(b==null||typeof b!="object"&&typeof b!="function")&&(b={});C<_;++C)if(h=arguments[C],h!=null)for(p in h)m=l(b,p),v=l(h,p),b!==v&&(N&&v&&(i(v)||(x=a(v)))?(x?(x=!1,M=m&&a(m)?m:[]):M=m&&i(m)?m:{},s(b,{name:p,newValue:d(N,M,v)})):typeof v<"u"&&s(b,{name:p,newValue:v}));return b},gq}var Kzt=Wzt();const vq=d1(Kzt);function hV(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Qzt(){const e=[],t={run:n,use:o};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);l(null,...a);function l(d,...h){const p=e[++i];let m=-1;if(d){s(d);return}for(;++m<a.length;)(h[m]===null||h[m]===void 0)&&(h[m]=a[m]);a=h,p?Jzt(p,l)(...h):s(null,...h)}}function o(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function Jzt(e,t){let n;return o;function o(...s){const l=e.length>s.length;let d;l&&s.push(a);try{d=e.apply(this,s)}catch(h){const p=h;if(l&&n)throw p;return a(p)}l||(d&&d.then&&typeof d.then=="function"?d.then(i,a):d instanceof Error?a(d):i(d))}function a(s,...l){n||(n=!0,t(s,...l))}function i(s){a(null,s)}}const fr={basename:eOt,dirname:tOt,extname:nOt,join:oOt,sep:"/"};function eOt(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');zp(e);let n=0,o=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else o<0&&(i=!0,o=a+1);return o<0?"":e.slice(n,o)}if(t===e)return"";let s=-1,l=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1),l>-1&&(e.codePointAt(a)===t.codePointAt(l--)?l<0&&(o=a):(l=-1,o=s));return n===o?o=s:o<0&&(o=e.length),e.slice(n,o)}function tOt(e){if(zp(e),e.length===0)return".";let t=-1,n=e.length,o;for(;--n;)if(e.codePointAt(n)===47){if(o){t=n;break}}else o||(o=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function nOt(e){zp(e);let t=e.length,n=-1,o=0,a=-1,i=0,s;for(;t--;){const l=e.codePointAt(t);if(l===47){if(s){o=t+1;break}continue}n<0&&(s=!0,n=t+1),l===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===o+1?"":e.slice(a,n)}function oOt(...e){let t=-1,n;for(;++t<e.length;)zp(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":aOt(n)}function aOt(e){zp(e);const t=e.codePointAt(0)===47;let n=rOt(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function rOt(e,t){let n="",o=0,a=-1,i=0,s=-1,l,d;for(;++s<=e.length;){if(s<e.length)l=e.codePointAt(s);else{if(l===47)break;l=47}if(l===47){if(!(a===s-1||i===1))if(a!==s-1&&i===2){if(n.length<2||o!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",o=0):(n=n.slice(0,d),o=n.length-1-n.lastIndexOf("/")),a=s,i=0;continue}}else if(n.length>0){n="",o=0,a=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",o=2)}else n.length>0?n+="/"+e.slice(a+1,s):n=e.slice(a+1,s),o=s-a-1;a=s,i=0}else l===46&&i>-1?i++:i=-1}return n}function zp(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const iOt={cwd:sOt};function sOt(){return"/"}function fV(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function cOt(e){if(typeof e=="string")e=new URL(e);else if(!fV(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return lOt(e)}function lOt(e){if(e.hostname!==""){const o=new TypeError('File URL host must be "localhost" or empty on darwin');throw o.code="ERR_INVALID_FILE_URL_HOST",o}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const o=t.codePointAt(n+2);if(o===70||o===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const kq=["history","path","basename","stem","extname","dirname"];class fue{constructor(t){let n;t?fV(t)?n={path:t}:typeof t=="string"||uOt(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":iOt.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let o=-1;for(;++o<kq.length;){const i=kq[o];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)kq.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?fr.basename(this.path):void 0}set basename(t){wq(t,"basename"),xq(t,"basename"),this.path=fr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?fr.dirname(this.path):void 0}set dirname(t){hJ(this.basename,"dirname"),this.path=fr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?fr.extname(this.path):void 0}set extname(t){if(xq(t,"extname"),hJ(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=fr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){fV(t)&&(t=cOt(t)),wq(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?fr.basename(this.path,this.extname):void 0}set stem(t){wq(t,"stem"),xq(t,"stem"),this.path=fr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,o){const a=this.message(t,n,o);throw a.fatal=!0,a}info(t,n,o){const a=this.message(t,n,o);return a.fatal=void 0,a}message(t,n,o){const a=new ho(t,n,o);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function xq(e,t){if(e&&e.includes(fr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+fr.sep+"`")}function wq(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function hJ(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function uOt(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const dOt=function(e){const o=this.constructor.prototype,a=o[e],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,o),i},hOt={}.hasOwnProperty;class YF extends dOt{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Qzt()}copy(){const t=new YF;let n=-1;for(;++n<this.attachers.length;){const o=this.attachers[n];t.use(...o)}return t.data(vq(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(_q("data",this.frozen),this.namespace[t]=n,this):hOt.call(this.namespace,t)&&this.namespace[t]||void 0:t?(_q("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...o]=this.attachers[this.freezeIndex];if(o[0]===!1)continue;o[0]===!0&&(o[0]=void 0);const a=n.call(t,...o);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Cm(t),o=this.parser||this.Parser;return bq("parse",o),o(String(n),n)}process(t,n){const o=this;return this.freeze(),bq("process",this.parser||this.Parser),Mq("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const l=Cm(t),d=o.parse(l);o.run(d,l,function(p,m,v){if(p||!m||!v)return h(p);const x=m,M=o.stringify(x,v);yOt(M)?v.value=M:v.result=M,h(p,v)});function h(p,m){p||!m?s(p):i?i(m):n(void 0,m)}}}processSync(t){let n=!1,o;return this.freeze(),bq("processSync",this.parser||this.Parser),Mq("processSync",this.compiler||this.Compiler),this.process(t,a),pJ("processSync","process",n),o;function a(i,s){n=!0,uJ(i),o=s}}run(t,n,o){fJ(t),this.freeze();const a=this.transformers;return!o&&typeof n=="function"&&(o=n,n=void 0),o?i(void 0,o):new Promise(i);function i(s,l){const d=Cm(n);a.run(t,d,h);function h(p,m,v){const x=m||t;p?l(p):s?s(x):o(void 0,x,v)}}}runSync(t,n){let o=!1,a;return this.run(t,n,i),pJ("runSync","run",o),a;function i(s,l){uJ(s),a=l,o=!0}}stringify(t,n){this.freeze();const o=Cm(n),a=this.compiler||this.Compiler;return Mq("stringify",a),fJ(t),a(t,o)}use(t,...n){const o=this.attachers,a=this.namespace;if(_q("use",this.frozen),t!=null)if(typeof t=="function")d(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(h){if(typeof h=="function")d(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[p,...m]=h;d(p,m)}else s(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function s(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(h.plugins),h.settings&&(a.settings=vq(!0,a.settings,h.settings))}function l(h){let p=-1;if(h!=null)if(Array.isArray(h))for(;++p<h.length;){const m=h[p];i(m)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function d(h,p){let m=-1,v=-1;for(;++m<o.length;)if(o[m][0]===h){v=m;break}if(v===-1)o.push([h,...p]);else if(p.length>0){let[x,...M]=p;const b=o[v][1];hV(b)&&hV(x)&&(x=vq(!0,b,x)),o[v]=[h,x,...M]}}}}const fOt=new YF().freeze();function bq(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Mq(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function _q(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function fJ(e){if(!hV(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function pJ(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Cm(e){return pOt(e)?e:new fue(e)}function pOt(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function yOt(e){return typeof e=="string"||mOt(e)}function mOt(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const gOt="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",yJ=[],mJ={allowDangerousHtml:!0},vOt=/^(https?|ircs?|mailto|xmpp)$/i,kOt=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function xOt(e){const t=wOt(e),n=bOt(e);return MOt(t.runSync(t.parse(n),n),e)}function wOt(e){const t=e.rehypePlugins||yJ,n=e.remarkPlugins||yJ,o=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...mJ}:mJ;return fOt().use(ezt).use(n).use(Yzt,o).use(t)}function bOt(e){const t=e.children||"",n=new fue;return typeof t=="string"&&(n.value=t),n}function MOt(e,t){const n=t.allowedElements,o=t.allowElement,a=t.components,i=t.disallowedElements,s=t.skipHtml,l=t.unwrapDisallowed,d=t.urlTransform||_Ot;for(const p of kOt)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+gOt+p.id,void 0);return hue(e,h),TPt(e,{Fragment:u.Fragment,components:a,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function h(p,m,v){if(p.type==="raw"&&v&&typeof m=="number")return s?v.children.splice(m,1):v.children[m]={type:"text",value:p.value},m;if(p.type==="element"){let x;for(x in pq)if(Object.hasOwn(pq,x)&&Object.hasOwn(p.properties,x)){const M=p.properties[x],b=pq[x];(b===null||b.includes(p.tagName))&&(p.properties[x]=d(String(M||""),x,p))}}if(p.type==="element"){let x=n?!n.includes(p.tagName):i?i.includes(p.tagName):!1;if(!x&&o&&typeof m=="number"&&(x=!o(p,m,v)),x&&v&&typeof m=="number")return l&&p.children?v.children.splice(m,1,...p.children):v.children.splice(m,1),m}}}function _Ot(e){const t=e.indexOf(":"),n=e.indexOf("?"),o=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||o!==-1&&t>o||vOt.test(e.slice(0,t))?e:""}function SOt(){const{pluginName:e,botId:t}=gi(),n=parseInt(t,10),o=je(C=>C.installedPlugins),a=je(C=>C.installPluginFromRepo),i=je(C=>C.fetchInstalledPlugins),s=k.useMemo(()=>o[n]||[],[o,n]),[l,d]=k.useState(null),[h,p]=k.useState(!0),[m,v]=k.useState(!1),{toast:x}=Yt();k.useEffect(()=>{(async()=>{p(!0);try{const _=await fetch(`/api/plugins/catalog/${e}`);if(!_.ok)throw new Error("Плагин не найден");const N=await _.json();d(N)}catch(_){x({variant:"destructive",title:"Ошибка",description:_.message})}finally{p(!1)}})()},[e,x]),k.useEffect(()=>{t&&i(n)},[t,i,n]);const M=k.useMemo(()=>l?s.some(C=>C.sourceUri===l.repoUrl):!1,[s,l]),b=async()=>{if(l){v(!0);try{await a(n,l.repoUrl,l.name)}catch{}finally{v(!1)}}};return h?u.jsx("div",{className:"p-8 text-center",children:"Загрузка информации о плагине..."}):l?u.jsxs("div",{className:"p-4 md:p-8 max-w-6xl mx-auto overflow-y-auto h-full",children:[u.jsxs(up,{to:`/bots/${t}/plugins`,className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-4",children:[u.jsx(Yf,{className:"h-4 w-4"}),"Назад в магазин"]}),u.jsxs("header",{className:"flex flex-col md:flex-row gap-4 justify-between items-start mb-6",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-4xl font-bold",children:l.name}),u.jsxs("p",{className:"text-lg text-muted-foreground",children:["Автор: ",l.author]}),u.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:(l.categories||[]).map(C=>u.jsx(Xt,{children:C},C))})]}),u.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[u.jsx("a",{href:l.repoUrl,target:"_blank",rel:"noopener noreferrer",children:u.jsxs(pe,{variant:"outline",children:[u.jsx(ms,{className:"mr-2"}),"GitHub"]})}),u.jsxs(pe,{disabled:m||M,onClick:b,children:[m?u.jsx(It,{className:"mr-2 animate-spin"}):M?u.jsx(ei,{className:"mr-2"}):u.jsx(ii,{className:"mr-2"}),m?"Установка...":M?"Установлен":"Установить"]})]})]}),u.jsx(Gh,{}),u.jsxs("main",{className:"mt-6",children:[u.jsx(Nn,{children:u.jsx(Ln,{className:"p-6",children:u.jsx("div",{className:"prose prose-invert max-w-none",children:u.jsx(xOt,{children:l.fullDescription||l.description||"Описание отсутствует."})})})}),l.dependencies&&l.dependencies.length>0&&u.jsxs("div",{className:"mt-6",children:[u.jsx("h3",{className:"text-xl font-semibold mb-3",children:"Зависимости"}),u.jsx(Nn,{children:u.jsx(Ln,{className:"p-4",children:u.jsx("ul",{className:"list-disc list-inside text-sm",children:l.dependencies.map(C=>u.jsx("li",{children:C},C))})})})]})]})]}):u.jsx("div",{className:"p-8 text-center text-destructive",children:"Не удалось загрузить информацию о плагине."})}var WF="ContextMenu",[COt,Zqt]=zn(WF,[o$]),xo=o$(),[NOt,pue]=COt(WF),yue=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:o,dir:a,modal:i=!0}=e,[s,l]=k.useState(!1),d=xo(t),h=gn(o),p=k.useCallback(m=>{l(m),h(m)},[h]);return u.jsx(NOt,{scope:t,open:s,onOpenChange:p,modal:i,children:u.jsx($oe,{...d,dir:a,open:s,onOpenChange:p,modal:i,children:n})})};yue.displayName=WF;var mue="ContextMenuTrigger",gue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:o=!1,...a}=e,i=pue(mue,n),s=xo(n),l=k.useRef({x:0,y:0}),d=k.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),h=k.useRef(0),p=k.useCallback(()=>window.clearTimeout(h.current),[]),m=v=>{l.current={x:v.clientX,y:v.clientY},i.onOpenChange(!0)};return k.useEffect(()=>p,[p]),k.useEffect(()=>void(o&&p()),[o,p]),u.jsxs(u.Fragment,{children:[u.jsx(Doe,{...s,virtualRef:d}),u.jsx(Ae.span,{"data-state":i.open?"open":"closed","data-disabled":o?"":void 0,...a,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:o?e.onContextMenu:Me(e.onContextMenu,v=>{p(),m(v),v.preventDefault()}),onPointerDown:o?e.onPointerDown:Me(e.onPointerDown,Nm(v=>{p(),h.current=window.setTimeout(()=>m(v),700)})),onPointerMove:o?e.onPointerMove:Me(e.onPointerMove,Nm(p)),onPointerCancel:o?e.onPointerCancel:Me(e.onPointerCancel,Nm(p)),onPointerUp:o?e.onPointerUp:Me(e.onPointerUp,Nm(p))})]})});gue.displayName=mue;var LOt="ContextMenuPortal",vue=e=>{const{__scopeContextMenu:t,...n}=e,o=xo(t);return u.jsx(zoe,{...o,...n})};vue.displayName=LOt;var kue="ContextMenuContent",xue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=pue(kue,n),i=xo(n),s=k.useRef(!1);return u.jsx(Ooe,{...i,...o,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{var d;(d=e.onCloseAutoFocus)==null||d.call(e,l),!l.defaultPrevented&&s.current&&l.preventDefault(),s.current=!1},onInteractOutside:l=>{var d;(d=e.onInteractOutside)==null||d.call(e,l),!l.defaultPrevented&&!a.modal&&(s.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});xue.displayName=kue;var jOt="ContextMenuGroup",AOt=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(qoe,{...a,...o,ref:t})});AOt.displayName=jOt;var EOt="ContextMenuLabel",wue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Hoe,{...a,...o,ref:t})});wue.displayName=EOt;var IOt="ContextMenuItem",bue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Voe,{...a,...o,ref:t})});bue.displayName=IOt;var TOt="ContextMenuCheckboxItem",Mue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Boe,{...a,...o,ref:t})});Mue.displayName=TOt;var ROt="ContextMenuRadioGroup",POt=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Foe,{...a,...o,ref:t})});POt.displayName=ROt;var $Ot="ContextMenuRadioItem",_ue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Uoe,{...a,...o,ref:t})});_ue.displayName=$Ot;var DOt="ContextMenuItemIndicator",Sue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Goe,{...a,...o,ref:t})});Sue.displayName=DOt;var zOt="ContextMenuSeparator",Cue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Xoe,{...a,...o,ref:t})});Cue.displayName=zOt;var OOt="ContextMenuArrow",qOt=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Zoe,{...a,...o,ref:t})});qOt.displayName=OOt;var HOt="ContextMenuSubTrigger",Nue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Yoe,{...a,...o,ref:t})});Nue.displayName=HOt;var VOt="ContextMenuSubContent",Lue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Woe,{...a,...o,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Lue.displayName=VOt;function Nm(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var BOt=yue,FOt=gue,UOt=vue,jue=xue,Aue=wue,Eue=bue,Iue=Mue,Tue=_ue,Rue=Sue,Pue=Cue,$ue=Nue,Due=Lue;const Sq=BOt,Cq=FOt,GOt=k.forwardRef(({className:e,inset:t,children:n,...o},a)=>u.jsxs($ue,{ref:a,className:ge("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...o,children:[n,u.jsx(Sh,{className:"ml-auto h-4 w-4"})]}));GOt.displayName=$ue.displayName;const XOt=k.forwardRef(({className:e,...t},n)=>u.jsx(Due,{ref:n,className:ge("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",e),...t}));XOt.displayName=Due.displayName;const DR=k.forwardRef(({className:e,...t},n)=>u.jsx(UOt,{children:u.jsx(jue,{ref:n,className:ge("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",e),...t})}));DR.displayName=jue.displayName;const Ra=k.forwardRef(({className:e,inset:t,...n},o)=>u.jsx(Eue,{ref:o,className:ge("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Ra.displayName=Eue.displayName;const ZOt=k.forwardRef(({className:e,children:t,checked:n,...o},a)=>u.jsxs(Iue,{ref:a,className:ge("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...o,children:[u.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:u.jsx(Rue,{children:u.jsx(ri,{className:"h-4 w-4"})})}),t]}));ZOt.displayName=Iue.displayName;const YOt=k.forwardRef(({className:e,children:t,...n},o)=>u.jsxs(Tue,{ref:o,className:ge("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[u.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:u.jsx(Rue,{children:u.jsx(Bd,{className:"h-4 w-4 fill-current"})})}),t]}));YOt.displayName=Tue.displayName;const WOt=k.forwardRef(({className:e,inset:t,...n},o)=>u.jsx(Aue,{ref:o,className:ge("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...n}));WOt.displayName=Aue.displayName;const pV=k.forwardRef(({className:e,...t},n)=>u.jsx(Pue,{ref:n,className:ge("-mx-1 my-1 h-px bg-border",e),...t}));pV.displayName=Pue.displayName;var Nq,gJ;function KOt(){if(gJ)return Nq;gJ=1;function e(a){if(typeof a!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(a))}function t(a,i){for(var s="",l=0,d=-1,h=0,p,m=0;m<=a.length;++m){if(m<a.length)p=a.charCodeAt(m);else{if(p===47)break;p=47}if(p===47){if(!(d===m-1||h===1))if(d!==m-1&&h===2){if(s.length<2||l!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){var v=s.lastIndexOf("/");if(v!==s.length-1){v===-1?(s="",l=0):(s=s.slice(0,v),l=s.length-1-s.lastIndexOf("/")),d=m,h=0;continue}}else if(s.length===2||s.length===1){s="",l=0,d=m,h=0;continue}}i&&(s.length>0?s+="/..":s="..",l=2)}else s.length>0?s+="/"+a.slice(d+1,m):s=a.slice(d+1,m),l=m-d-1;d=m,h=0}else p===46&&h!==-1?++h:h=-1}return s}function n(a,i){var s=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return s?s===i.root?s+l:s+a+l:l}var o={resolve:function(){for(var i="",s=!1,l,d=arguments.length-1;d>=-1&&!s;d--){var h;d>=0?h=arguments[d]:(l===void 0&&(l=process.cwd()),h=l),e(h),h.length!==0&&(i=h+"/"+i,s=h.charCodeAt(0)===47)}return i=t(i,!s),s?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var s=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=t(i,!s),i.length===0&&!s&&(i="."),i.length>0&&l&&(i+="/"),s?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,s=0;s<arguments.length;++s){var l=arguments[s];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,s){if(e(i),e(s),i===s||(i=o.resolve(i),s=o.resolve(s),i===s))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var d=i.length,h=d-l,p=1;p<s.length&&s.charCodeAt(p)===47;++p);for(var m=s.length,v=m-p,x=h<v?h:v,M=-1,b=0;b<=x;++b){if(b===x){if(v>x){if(s.charCodeAt(p+b)===47)return s.slice(p+b+1);if(b===0)return s.slice(p+b)}else h>x&&(i.charCodeAt(l+b)===47?M=b:b===0&&(M=0));break}var C=i.charCodeAt(l+b),_=s.charCodeAt(p+b);if(C!==_)break;C===47&&(M=b)}var N="";for(b=l+M+1;b<=d;++b)(b===d||i.charCodeAt(b)===47)&&(N.length===0?N+="..":N+="/..");return N.length>0?N+s.slice(p+M):(p+=M,s.charCodeAt(p)===47&&++p,s.slice(p))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var s=i.charCodeAt(0),l=s===47,d=-1,h=!0,p=i.length-1;p>=1;--p)if(s=i.charCodeAt(p),s===47){if(!h){d=p;break}}else h=!1;return d===-1?l?"/":".":l&&d===1?"//":i.slice(0,d)},basename:function(i,s){if(s!==void 0&&typeof s!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,d=-1,h=!0,p;if(s!==void 0&&s.length>0&&s.length<=i.length){if(s.length===i.length&&s===i)return"";var m=s.length-1,v=-1;for(p=i.length-1;p>=0;--p){var x=i.charCodeAt(p);if(x===47){if(!h){l=p+1;break}}else v===-1&&(h=!1,v=p+1),m>=0&&(x===s.charCodeAt(m)?--m===-1&&(d=p):(m=-1,d=v))}return l===d?d=v:d===-1&&(d=i.length),i.slice(l,d)}else{for(p=i.length-1;p>=0;--p)if(i.charCodeAt(p)===47){if(!h){l=p+1;break}}else d===-1&&(h=!1,d=p+1);return d===-1?"":i.slice(l,d)}},extname:function(i){e(i);for(var s=-1,l=0,d=-1,h=!0,p=0,m=i.length-1;m>=0;--m){var v=i.charCodeAt(m);if(v===47){if(!h){l=m+1;break}continue}d===-1&&(h=!1,d=m+1),v===46?s===-1?s=m:p!==1&&(p=1):s!==-1&&(p=-1)}return s===-1||d===-1||p===0||p===1&&s===d-1&&s===l+1?"":i.slice(s,d)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return n("/",i)},parse:function(i){e(i);var s={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return s;var l=i.charCodeAt(0),d=l===47,h;d?(s.root="/",h=1):h=0;for(var p=-1,m=0,v=-1,x=!0,M=i.length-1,b=0;M>=h;--M){if(l=i.charCodeAt(M),l===47){if(!x){m=M+1;break}continue}v===-1&&(x=!1,v=M+1),l===46?p===-1?p=M:b!==1&&(b=1):p!==-1&&(b=-1)}return p===-1||v===-1||b===0||b===1&&p===v-1&&p===m+1?v!==-1&&(m===0&&d?s.base=s.name=i.slice(1,v):s.base=s.name=i.slice(m,v)):(m===0&&d?(s.name=i.slice(1,p),s.base=i.slice(1,v)):(s.name=i.slice(m,p),s.base=i.slice(m,v)),s.ext=i.slice(p,v)),m>0?s.dir=i.slice(0,m-1):d&&(s.dir="/"),s},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,Nq=o,Nq}var QOt=KOt();const ds=d1(QOt),Lq=({defaultValue:e="",onCommit:t,onCancel:n,type:o="file"})=>{const[a,i]=k.useState(e),s=k.useRef(null);k.useEffect(()=>{var h,p;(h=s.current)==null||h.focus(),(p=s.current)==null||p.select()},[]);const l=h=>{h.key==="Enter"?(h.preventDefault(),h.stopPropagation(),t(a)):h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),n())},d=()=>{t(a)};return u.jsxs("div",{className:"flex items-center p-1 w-full",children:[o==="folder"?u.jsx(jh,{className:"h-4 w-4 mr-2 flex-shrink-0"}):u.jsx(Lh,{className:"h-4 w-4 mr-2 ml-1 flex-shrink-0"}),u.jsx("input",{ref:s,type:"text",value:a,onChange:h=>i(h.target.value),onKeyDown:l,onBlur:d,className:"bg-background text-foreground border border-primary rounded p-0 px-1 w-full text-sm h-6"})]})},JOt=({structure:e,onSelectFile:t,selectedFile:n,onDelete:o,onRename:a,onCreateFile:i,onCreateFolder:s,inlineAction:l,onCommit:d,onCancel:h})=>{const[p,m]=k.useState({});k.useEffect(()=>{if(l!=null&&l.mode.startsWith("create")&&l.node){const C=l.node.type==="folder"?l.node.path:ds.dirname(l.node.path);C&&!p[C]&&m(_=>({..._,[C]:!0}))}},[l]);const v=C=>{m(_=>({..._,[C]:!_[C]}))},x=C=>{const _=n&&n.path===C.path,N=p[C.path];if((l==null?void 0:l.mode)==="rename"&&l.node.path===C.path)return u.jsx("div",{className:"w-full",children:u.jsx(Lq,{defaultValue:C.name,onCommit:d,onCancel:h,type:C.type})},`${C.path}-editing`);const A=u.jsxs("div",{className:`flex items-center cursor-pointer p-1 rounded hover:bg-muted ${_?"bg-primary/20":""}`,onClick:()=>C.type==="file"?t(C):v(C.path),children:[C.type==="folder"?N?u.jsx(jh,{className:"h-4 w-4 mr-2"}):u.jsx(t0,{className:"h-4 w-4 mr-2"}):u.jsx(Lh,{className:"h-4 w-4 mr-2 ml-1"}),u.jsx("span",{children:C.name})]});if(C.type==="folder"){const I=l!=null&&l.node?l.node.type==="folder"?l.node.path:ds.dirname(l.node.path):null,R=(l==null?void 0:l.mode.startsWith("create"))&&I===C.path;return u.jsxs("div",{children:[u.jsxs(Sq,{children:[u.jsx(Cq,{children:A}),u.jsxs(DR,{children:[u.jsxs(Ra,{onClick:()=>i(C),children:[u.jsx(Fd,{className:"h-4 w-4 mr-2"}),"Создать файл"]}),u.jsxs(Ra,{onClick:()=>s(C),children:[u.jsx(ys,{className:"h-4 w-4 mr-2"}),"Создать папку"]}),u.jsx(pV,{}),u.jsxs(Ra,{onClick:()=>a(C),children:[u.jsx(Eh,{className:"h-4 w-4 mr-2"}),"Переименовать"]}),u.jsxs(Ra,{className:"text-destructive",onClick:()=>o(C),children:[u.jsx(Th,{className:"h-4 w-4 mr-2"}),"Удалить"]})]})]}),N&&u.jsxs("div",{className:"pl-4 border-l border-muted-foreground/20 ml-2",children:[C.children&&C.children.length>0&&C.children.map(x),R&&u.jsx(Lq,{onCommit:d,onCancel:h,type:l.mode==="createFile"?"file":"folder"}),!R&&C.children&&C.children.length===0&&u.jsx("p",{className:"text-xs text-muted-foreground italic p-1",children:"Папка пуста"})]})]},C.path)}return u.jsxs(Sq,{children:[u.jsx(Cq,{children:A}),u.jsxs(DR,{children:[u.jsxs(Ra,{onClick:()=>i(C),children:[u.jsx(Fd,{className:"h-4 w-4 mr-2"}),"Создать файл"]}),u.jsxs(Ra,{onClick:()=>s(C),children:[u.jsx(ys,{className:"h-4 w-4 mr-2"}),"Создать папку"]}),u.jsx(pV,{}),u.jsxs(Ra,{onClick:()=>a(C),children:[u.jsx(Eh,{className:"h-4 w-4 mr-2"}),"Переименовать"]}),u.jsxs(Ra,{className:"text-destructive",onClick:()=>o(C),children:[u.jsx(Th,{className:"h-4 w-4 mr-2"}),"Удалить"]})]})]},C.path)},M=l!=null&&l.node?l.node.type==="folder"?l.node.path:ds.dirname(l.node.path):null,b=(l==null?void 0:l.mode.startsWith("create"))&&(M==="."||M==="");return u.jsxs(Sq,{children:[u.jsx(Cq,{children:u.jsxs("div",{className:"p-2 select-none h-full",children:[e.map(x),b&&u.jsx("div",{className:"pl-4 border-l-transparent ml-2",children:u.jsx(Lq,{onCommit:d,onCancel:h,type:l.mode==="createFile"?"file":"folder"})}),!l&&e.length===0&&u.jsxs("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground p-4 text-center",children:["Правый клик, ",u.jsx("br",{})," чтобы создать файл или папку."]})]})}),u.jsxs(DR,{children:[u.jsxs(Ra,{onClick:()=>i({path:"",type:"folder",name:"root"}),children:[u.jsx(Fd,{className:"h-4 w-4 mr-2"}),"Создать файл в корне"]}),u.jsxs(Ra,{onClick:()=>s({path:"",type:"folder",name:"root"}),children:[u.jsx(ys,{className:"h-4 w-4 mr-2"}),"Создать папку в корне"]})]})]})};function eqt({botId:e,pluginName:t}){var m;const[n,o]=k.useState(null),[a,i]=k.useState(!0),[s,l]=k.useState(!1);k.useEffect(()=>{(async()=>{i(!0);try{const x=await Ne(`/api/bots/${e}/plugins/ide/${t}/manifest`);o(x)}catch{Gt({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить manifest."})}finally{i(!1)}})()},[e,t]);const d=async()=>{var v;l(!0);try{await Ne(`/api/bots/${e}/plugins/ide/${t}/manifest`,{method:"POST",body:JSON.stringify({name:n.name,version:n.version,description:n.description,author:n.author,repositoryUrl:n.repositoryUrl||((v=n.repository)==null?void 0:v.url)||""})}),Gt({title:"Успех!",description:"package.json успешно обновлен."})}catch{Gt({variant:"destructive",title:"Ошибка",description:"Не удалось сохранить manifest."})}finally{l(!1)}};if(a)return u.jsx("div",{className:"p-4 flex justify-center items-center",children:u.jsx(It,{className:"animate-spin"})});if(!n)return u.jsx("div",{className:"p-4 text-center text-muted-foreground",children:"Не удалось загрузить package.json"});const h=v=>{const{id:x,value:M}=v.target;o(b=>({...b,[x]:M}))},p=v=>{const x=v.target.value;o(M=>({...M,repositoryUrl:x}))};return u.jsxs("div",{className:"p-4 space-y-4",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{htmlFor:"version",children:"Версия"}),u.jsx(Ze,{id:"version",value:n.version||"",onChange:h})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{htmlFor:"description",children:"Описание"}),u.jsx(ki,{id:"description",value:n.description||"",onChange:h})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{htmlFor:"author",children:"Автор"}),u.jsx(Ze,{id:"author",value:n.author||"",onChange:h})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{htmlFor:"repositoryUrl",children:"URL репозитория"}),u.jsx(Ze,{id:"repositoryUrl",placeholder:"https://github.com/user/repo.git",value:((m=n.repository)==null?void 0:m.url)||n.repositoryUrl||"",onChange:p}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Нужен для создания Pull Request'ов в оригинальный репозиторий"})]}),u.jsxs(pe,{onClick:d,disabled:s,children:[s&&u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}),"Сохранить package.json"]})]})}function tqt(){const{botId:e,pluginName:t}=gi(),[n,o]=k.useState([]),[a,i]=k.useState(null),[s,l]=k.useState(""),[d,h]=k.useState(!1),[p,m]=k.useState(!0),[v,x]=k.useState(null),[M,b]=k.useState(null),[C,_]=k.useState(!1),[N,A]=k.useState({branch:`feature/local-changes-${new Date().toISOString().slice(0,16).replace(/[:-]/g,"-")}`,commitMessage:"Changes from local edit",originalRepo:""}),[I,R]=k.useState(!1),j=k.useCallback(async()=>{m(!0);try{const V=await Ne(`/api/bots/${e}/plugins/ide/${t}/structure`);o(V)}catch{Gt({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить структуру плагина."})}finally{m(!1)}},[e,t]);k.useEffect(()=>{j()},[j]);const D=async V=>{if(!(d&&!window.confirm("У вас есть несохраненные изменения. Вы уверены, что хотите продолжить?")))try{const L=await fetch(`/api/bots/${e}/plugins/ide/${t}/file?path=${encodeURIComponent(V.path)}`,{headers:{Authorization:`Bearer ${je.getState().token}`}});if(!L.ok)throw new Error(`HTTP error! status: ${L.status}`);const Y=await L.text();i(V),l(Y),h(!1)}catch(L){console.error("Failed to load file content:",L),Gt({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить файл."})}},H=async(V,L,Y="")=>{try{return await Ne(`/api/bots/${e}/plugins/ide/${t}/fs`,{method:"POST",body:JSON.stringify({operation:V,path:L,newPath:Y})}),await j(),Gt({title:"Успех!",description:`Операция "${V}" для "${L}" выполнена.`}),!0}catch(F){return Gt({variant:"destructive",title:"Ошибка",description:`Не удалось выполнить операцию: ${F.message}`}),!1}},U=async()=>{v&&(await H("delete",v.path),a&&a.path.startsWith(v.path)&&(i(null),l("")),x(null))},z=(V,L)=>{b({mode:V,node:L})},Z=()=>{b(null)},q=async V=>{if(!M||!V){b(null);return}const{mode:L,node:Y}=M;let F=!1;if(L==="rename"){if(V===Y.name){b(null);return}const T=ds.join(ds.dirname(Y.path),V);if(F=await H("rename",Y.path,T),F&&a&&a.path.startsWith(Y.path)){const K=a.path.replace(Y.path,T);i(Q=>({...Q,path:K,name:ds.basename(K)}))}}else if(L==="createFile"||L==="createFolder"){const T=Y.type==="folder"?Y.path:ds.dirname(Y.path),K=ds.join(T,V);F=await H(L==="createFile"?"createFile":"createFolder",K)}b(null),F&&await j()},G=async()=>{if(!(!a||!d))try{await Ne(`/api/bots/${e}/plugins/ide/${t}/file`,{method:"POST",body:JSON.stringify({path:a.path,content:s})}),h(!1),Gt({title:"Успех",description:`Файл ${a.name} сохранен.`})}catch{Gt({variant:"destructive",title:"Ошибка",description:"Не удалось сохранить файл."})}},E=V=>{switch(V.split(".").pop()){case"js":return"javascript";case"json":return"json";case"md":return"markdown";default:return"plaintext"}},O=k.useCallback(async()=>{try{return await Ne(`/api/bots/${e}/plugins/ide/${t}/manifest`)}catch{return Gt({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить manifest."}),null}},[e,t]),P=async()=>{var Y;const V=await O(),L=((Y=V==null?void 0:V.repository)==null?void 0:Y.url)||"";A(F=>({...F,originalRepo:L})),_(!0)},X=V=>{A(L=>({...L,[V.target.name]:V.target.value}))},W=async()=>{R(!0);try{const V=await Ne(`/api/bots/${e}/plugins/ide/${t}/create-pr`,{method:"POST",body:JSON.stringify({branch:N.branch,commitMessage:N.commitMessage,repositoryUrl:N.originalRepo})});V.success&&(window.open(V.prUrl,"_blank"),Gt({title:"Успех",description:"PR успешно создан и открыт."}),_(!1))}catch(V){Gt({variant:"destructive",title:"Ошибка",description:V.message})}finally{R(!1)}};return u.jsxs("div",{className:"h-full w-full flex flex-col p-4 gap-4",children:[u.jsxs("header",{className:"flex justify-between items-center",children:[u.jsxs("div",{children:[u.jsxs("h1",{className:"text-2xl font-bold",children:["Редактор плагина: ",t]}),u.jsxs("p",{className:"text-muted-foreground",children:["Редактирование для бота #",e]})]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsxs(pe,{onClick:P,children:[u.jsx(ms,{className:"h-4 w-4 mr-2"}),"Создать PR"]}),u.jsxs(pe,{onClick:G,disabled:!d||!a,children:[u.jsx(si,{className:"h-4 w-4 mr-2"}),"Сохранить"]})]})]}),u.jsxs(PF,{direction:"horizontal",className:"flex-grow rounded-lg border",children:[u.jsx(li,{defaultSize:20,minSize:15,children:u.jsxs(Nn,{className:"h-full m-1 rounded-lg flex flex-col",children:[u.jsx(kn,{className:"p-2 border-b",children:u.jsx(xn,{className:"text-base p-2",children:"Файлы"})}),u.jsx(Ln,{className:"p-0 flex-grow",children:p?u.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:"Загрузка..."}):u.jsx(JOt,{structure:n,onSelectFile:D,selectedFile:a,onDelete:x,onRename:V=>z("rename",V),onCreateFile:V=>z("createFile",V),onCreateFolder:V=>z("createFolder",V),inlineAction:M,onCommit:q,onCancel:Z})})]})}),u.jsx(t2,{withHandle:!0}),u.jsx(li,{defaultSize:55,minSize:30,children:u.jsx(wB,{height:"calc(100vh - 120px)",language:a?E(a.name):"plaintext",value:s||"",onChange:V=>{l(V),h(!0)},theme:"vs-dark",options:{minimap:{enabled:!1}}})}),u.jsx(t2,{withHandle:!0}),u.jsx(li,{defaultSize:25,minSize:20,children:u.jsxs(Nn,{className:"h-full m-1 rounded-lg",children:[u.jsx(kn,{className:"p-2 border-b",children:u.jsx(xn,{className:"text-base p-2",children:"package.json"})}),u.jsx(Ln,{className:"overflow-y-auto",children:u.jsx(eqt,{botId:e,pluginName:t})})]})})]}),v&&u.jsx($s,{open:!!v,onOpenChange:()=>x(null),title:`Удалить ${v.type==="folder"?"папку":"файл"} "${v.name}"?`,description:"Это действие необратимо. Все содержимое будет удалено.",onConfirm:U,confirmText:"Да, удалить"}),u.jsx(Jt,{open:C,onOpenChange:_,children:u.jsxs(Wt,{children:[u.jsx(on,{children:u.jsx(en,{children:"Создать Pull Request"})}),u.jsxs("div",{className:"space-y-4 py-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"originalRepo",children:"URL репозитория"}),u.jsx(Ze,{id:"originalRepo",name:"originalRepo",value:N.originalRepo,onChange:X,placeholder:"https://github.com/user/repo.git"}),N.originalRepo&&u.jsx("div",{className:"text-sm text-muted-foreground",children:"Изменения будут отправлены в новую ветку этого репозитория"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"branch",children:"Название ветки"}),u.jsx(Ze,{id:"branch",name:"branch",value:N.branch,onChange:X})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"commitMessage",children:"Сообщение коммита"}),u.jsx(Ze,{id:"commitMessage",name:"commitMessage",value:N.commitMessage,onChange:X})]})]}),u.jsx(an,{children:u.jsx(pe,{onClick:W,disabled:I||!N.branch||!N.originalRepo,children:I?"Создание...":"Создать и открыть PR"})})]})})]})}function nqt({server:e,onSubmit:t,onCancel:n,isSaving:o}){const[a,i]=k.useState({name:"",host:"",port:"25565",version:""});k.useEffect(()=>{var h;e&&i({name:e.name||"",host:e.host||"",port:((h=e.port)==null?void 0:h.toString())||"25565",version:e.version||""})},[e]);const s=h=>{const{name:p,value:m}=h.target;i(v=>({...v,[p]:m}))},l=h=>{h.preventDefault(),t(a)},d=!!e;return u.jsxs(Wt,{children:[u.jsxs(on,{children:[u.jsx(en,{children:d?"Редактировать сервер":"Добавить новый сервер"}),u.jsx(dn,{children:"Заполните информацию о сервере. Эти данные будут доступны при создании ботов."})]}),u.jsxs("form",{id:"server-form",onSubmit:l,className:"space-y-4 py-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"name",children:"Название сервера"}),u.jsx(Ze,{id:"name",name:"name",value:a.name,onChange:s,placeholder:"Например, mineblaze",required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"host",children:"Адрес (хост)"}),u.jsx(Ze,{id:"host",name:"host",value:a.host,onChange:s,placeholder:"mc.mineblaze.net",required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"port",children:"Порт"}),u.jsx(Ze,{id:"port",name:"port",type:"number",value:a.port,onChange:s,placeholder:"25565"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"version",children:"Версия Minecraft"}),u.jsx(Ze,{id:"version",name:"version",value:a.version,onChange:s,placeholder:"1.20.1 самая стабильная",required:!0})]})]}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:n,children:"Отмена"}),u.jsx(pe,{type:"submit",form:"server-form",disabled:o,children:o?"Сохранение...":d?"Сохранить":"Создать"})]})]})}function oqt(){const e=je(C=>C.servers),t=je(C=>C.fetchInitialData),[n,o]=k.useState(!0),[a,i]=k.useState(!1),[s,l]=k.useState(null),[d,h]=k.useState(null),[p,m]=k.useState(!1);Yt(),k.useEffect(()=>{if(e&&e.length>0)o(!1);else{const _=setTimeout(()=>{const N=je.getState().servers;(!N||N.length===0)&&o(!1)},2e3);return()=>clearTimeout(_)}},[e]);const v=(C=null)=>{l(C),i(!0)},x=()=>{i(!1),l(null)},M=async C=>{m(!0);const _=!!s,N=_?`/api/servers/${s.id}`:"/api/servers",A=_?"PUT":"POST";try{await Ne(N,{method:A,body:JSON.stringify(C)},`Сервер успешно ${_?"обновлен":"создан"}.`),x(),await t()}catch{}m(!1)},b=async()=>{if(d)try{await Ne(`/api/servers/${d.id}`,{method:"DELETE"},"Сервер удален."),await t()}catch{}};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"p-4 h-full",children:u.jsxs(Nn,{className:"h-full flex flex-col",children:[u.jsxs(kn,{className:"flex flex-row items-center justify-between",children:[u.jsxs("div",{children:[u.jsx(xn,{children:"Управление серверами"}),u.jsx(Qn,{children:"Добавляйте и редактируйте серверы, к которым будут подключаться боты."})]}),u.jsxs(Jt,{open:a,onOpenChange:i,children:[u.jsx(Ua,{asChild:!0,children:u.jsxs(pe,{onClick:()=>v(),children:[u.jsx(xr,{className:"mr-2 h-4 w-4"}),"Добавить сервер"]})}),u.jsx(nqt,{server:s,onSubmit:M,onCancel:x,isSaving:p})]})]}),u.jsx(Ln,{className:"flex-grow overflow-y-auto",children:u.jsxs(Ca,{children:[u.jsx(Na,{children:u.jsxs(Nt,{children:[u.jsx(st,{children:"Название"}),u.jsx(st,{children:"Адрес"}),u.jsx(st,{children:"Версия"}),u.jsx(st,{className:"text-right",children:"Действия"})]})}),u.jsx(La,{children:n?u.jsx(Nt,{children:u.jsx(Xe,{colSpan:4,className:"text-center h-24",children:u.jsxs("div",{className:"flex justify-center items-center",children:[u.jsx(It,{className:"mr-2 h-6 w-6 animate-spin"}),"Загрузка серверов..."]})})}):e.length>0?e.map(C=>u.jsxs(Nt,{children:[u.jsx(Xe,{className:"font-medium",children:C.name}),u.jsxs(Xe,{children:[C.host,":",C.port]}),u.jsx(Xe,{children:C.version}),u.jsxs(Xe,{className:"text-right",children:[u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>v(C),children:u.jsx(pn,{className:"h-4 w-4"})}),u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>h(C),children:u.jsx(mo,{className:"h-4 w-4 text-destructive"})})]})]},C.id)):u.jsx(Nt,{children:u.jsx(Xe,{colSpan:4,className:"text-center h-24 text-muted-foreground",children:"Серверы не найдены. Добавьте свой первый сервер."})})})]})})]})}),d&&u.jsx($s,{open:!!d,onOpenChange:()=>h(null),title:`Удалить сервер "${d.name}"?`,description:"Это действие необратимо. Если к этому серверу привязаны боты, вы не сможете его удалить.",onConfirm:b,confirmText:"Да, удалить"})]})}var F$="Popover",[zue,Yqt]=zn(F$,[Ts]),Op=Ts(),[aqt,Os]=zue(F$),Oue=e=>{const{__scopePopover:t,children:n,open:o,defaultOpen:a,onOpenChange:i,modal:s=!1}=e,l=Op(t),d=k.useRef(null),[h,p]=k.useState(!1),[m,v]=go({prop:o,defaultProp:a??!1,onChange:i,caller:F$});return u.jsx(GP,{...l,children:u.jsx(aqt,{scope:t,contentId:Dn(),triggerRef:d,open:m,onOpenChange:v,onOpenToggle:k.useCallback(()=>v(x=>!x),[v]),hasCustomAnchor:h,onCustomAnchorAdd:k.useCallback(()=>p(!0),[]),onCustomAnchorRemove:k.useCallback(()=>p(!1),[]),modal:s,children:n})})};Oue.displayName=F$;var que="PopoverAnchor",rqt=k.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,a=Os(que,n),i=Op(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:l}=a;return k.useEffect(()=>(s(),()=>l()),[s,l]),u.jsx(vp,{...i,...o,ref:t})});rqt.displayName=que;var Hue="PopoverTrigger",Vue=k.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,a=Os(Hue,n),i=Op(n),s=ot(t,a.triggerRef),l=u.jsx(Ae.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Xue(a.open),...o,ref:s,onClick:Me(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?l:u.jsx(vp,{asChild:!0,...i,children:l})});Vue.displayName=Hue;var KF="PopoverPortal",[iqt,sqt]=zue(KF,{forceMount:void 0}),Bue=e=>{const{__scopePopover:t,forceMount:n,children:o,container:a}=e,i=Os(KF,t);return u.jsx(iqt,{scope:t,forceMount:n,children:u.jsx(jn,{present:n||i.open,children:u.jsx(y1,{asChild:!0,container:a,children:o})})})};Bue.displayName=KF;var n2="PopoverContent",Fue=k.forwardRef((e,t)=>{const n=sqt(n2,e.__scopePopover),{forceMount:o=n.forceMount,...a}=e,i=Os(n2,e.__scopePopover);return u.jsx(jn,{present:o||i.open,children:i.modal?u.jsx(lqt,{...a,ref:t}):u.jsx(uqt,{...a,ref:t})})});Fue.displayName=n2;var cqt=Cs("PopoverContent.RemoveScroll"),lqt=k.forwardRef((e,t)=>{const n=Os(n2,e.__scopePopover),o=k.useRef(null),a=ot(t,o),i=k.useRef(!1);return k.useEffect(()=>{const s=o.current;if(s)return DP(s)},[]),u.jsx(pp,{as:cqt,allowPinchZoom:!0,children:u.jsx(Uue,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Me(e.onCloseAutoFocus,s=>{var l;s.preventDefault(),i.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Me(e.onPointerDownOutside,s=>{const l=s.detail.originalEvent,d=l.button===0&&l.ctrlKey===!0,h=l.button===2||d;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:Me(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),uqt=k.forwardRef((e,t)=>{const n=Os(n2,e.__scopePopover),o=k.useRef(!1),a=k.useRef(!1);return u.jsx(Uue,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,l;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(o.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),o.current=!1,a.current=!1},onInteractOutside:i=>{var d,h;(d=e.onInteractOutside)==null||d.call(e,i),i.defaultPrevented||(o.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=i.target;((h=n.triggerRef.current)==null?void 0:h.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),Uue=k.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:o,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:p,...m}=e,v=Os(n2,n),x=Op(n);return PP(),u.jsx(fp,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:a,onUnmountAutoFocus:i,children:u.jsx(p1,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:p,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:h,onDismiss:()=>v.onOpenChange(!1),children:u.jsx(XP,{"data-state":Xue(v.open),role:"dialog",id:v.contentId,...x,...m,ref:t,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Gue="PopoverClose",dqt=k.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,a=Os(Gue,n);return u.jsx(Ae.button,{type:"button",...o,ref:t,onClick:Me(e.onClick,()=>a.onOpenChange(!1))})});dqt.displayName=Gue;var hqt="PopoverArrow",fqt=k.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,a=Op(n);return u.jsx(ZP,{...a,...o,ref:t})});fqt.displayName=hqt;function Xue(e){return e?"open":"closed"}var pqt=Oue,yqt=Vue,mqt=Bue,Zue=Fue;const gqt=pqt,vqt=yqt,Yue=k.forwardRef(({className:e,align:t="center",sideOffset:n=4,...o},a)=>u.jsx(mqt,{children:u.jsx(Zue,{ref:a,align:t,sideOffset:n,className:ge("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",e),...o})}));Yue.displayName=Zue.displayName;const kqt=[{value:"START_BOT",label:"Запустить бота"},{value:"STOP_BOT",label:"Остановить бота"},{value:"RESTART_BOT",label:"Перезапустить бота"},{value:"SEND_COMMAND",label:"Отправить команду"}],xqt=[{value:"START_BOT",label:"Запустить бота"}],vJ=e=>{const{intervalType:t,intervalValue:n,time:o}=e,[a,i]=o.split(":").map(Number);if(t==="minutes"){const s=n===1?"*":`*/${n}`;return n>0&&n<60?`${s} * * * *`:"* * * * *"}if(t==="hours"){const s=n===1?"*":`*/${n}`;return n>0&&n<24?`${i} ${s} * * *`:`${i} * * * *`}if(t==="days"){const s=n===1?"*":`*/${n}`;return n>0&&n<32?`${i} ${a} ${s} * *`:`${i} ${a} * * *`}return"* * * * *"};function wqt({task:e,onSubmit:t,onCancel:n,isSaving:o}){const a=je(Z=>Z.bots),[i,s]=k.useState(""),[l,d]=k.useState(""),[h,p]=k.useState([]),[m,v]=k.useState(""),[x,M]=k.useState(!1),[b,C]=k.useState(!1),[_,N]=k.useState(!1),[A,I]=k.useState("* * * * *"),[R,j]=k.useState({intervalType:"days",intervalValue:1,time:"12:00"});k.useEffect(()=>{_||I(vJ(R))},[R,_]),k.useEffect(()=>{b&&d("START_BOT")},[b]),k.useEffect(()=>{if(e)s(e.name),d(e.action),p(JSON.parse(e.targetBotIds||"[]")),v(JSON.parse(e.payload||"{}").command||""),I(e.cronPattern),C(e.runOnStartup||!1),N(!!e.cronPattern);else{s(""),d("SEND_COMMAND"),p([]),v(""),C(!1),N(!1);const Z={intervalType:"days",intervalValue:1,time:"12:00"};j(Z),I(vJ(Z))}},[e]);const D=(Z,q)=>{j(G=>({...G,[Z]:q}))},H=Z=>{Z.preventDefault();const q=l==="SEND_COMMAND"?{command:m}:{};t({name:i,cronPattern:b?null:A,action:l,targetBotIds:JSON.stringify(h),payload:JSON.stringify(q),runOnStartup:b})},U=[{id:"ALL",username:"Все боты"},...a],z=b?xqt:kqt;return u.jsxs(Wt,{className:"max-w-2xl",children:[u.jsxs(on,{children:[u.jsx(en,{children:e?"Редактировать задачу":"Создать новую задачу"}),u.jsx(dn,{children:b?"Эта задача будет выполнена один раз при каждом запуске панели.":"Задачи выполняются по расписанию для выбранных ботов."})]}),u.jsxs("form",{id:"task-form",onSubmit:H,className:"space-y-6 py-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"name",children:"Название задачи"}),u.jsx(Ze,{id:"name",value:i,onChange:Z=>s(Z.target.value),required:!0})]}),u.jsxs("div",{className:"flex items-center space-x-2 rounded-lg border p-3 shadow-sm",children:[u.jsx(na,{id:"runOnStartup",checked:b,onCheckedChange:C}),u.jsxs("div",{className:"grid gap-1.5 leading-none",children:[u.jsx(_e,{htmlFor:"runOnStartup",children:"Выполнять при запуске панели"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Задача будет выполнена один раз при каждом старте/перезапуске панели."})]})]}),!b&&u.jsxs("div",{className:"space-y-3 p-4 border rounded-lg",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx(_e,{children:"Расписание"}),u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(_e,{htmlFor:"advanced-mode",className:"text-sm",children:"Продвинутый режим"}),u.jsx(na,{id:"advanced-mode",checked:_,onCheckedChange:N})]})]}),_?u.jsxs("div",{children:[u.jsx(Ze,{value:A,onChange:Z=>I(Z.target.value),placeholder:"* * * * *",required:!0}),u.jsx("a",{href:"https://crontab.guru/",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:underline mt-1 inline-block",children:"Помощь по cron-паттернам"})]}):u.jsxs("div",{className:"grid grid-cols-3 gap-2 items-end",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{children:"Повторять каждые"}),u.jsx(Ze,{type:"number",min:"1",value:R.intervalValue,onChange:Z=>D("intervalValue",parseInt(Z.target.value)||1)})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{children:" "}),u.jsxs(Wn,{value:R.intervalType,onValueChange:Z=>D("intervalType",Z),children:[u.jsx(Fn,{children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"minutes",children:"Минут"}),u.jsx(et,{value:"hours",children:"Часов"}),u.jsx(et,{value:"days",children:"Дней"})]})]})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{children:"Время запуска"}),u.jsx(Ze,{type:"time",value:R.time,onChange:Z=>D("time",Z.target.value),disabled:R.intervalType==="minutes"})]})]})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{children:"Действие"}),u.jsxs(Wn,{value:l,onValueChange:d,required:!0,disabled:b,children:[u.jsx(Fn,{children:u.jsx(Kn,{placeholder:"Выберите действие"})}),u.jsx(Un,{children:z.map(Z=>u.jsx(et,{value:Z.value,children:Z.label},Z.value))})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{children:"Целевые боты"}),u.jsxs(gqt,{open:x,onOpenChange:M,children:[u.jsx(vqt,{asChild:!0,children:u.jsxs(pe,{variant:"outline",role:"combobox","aria-expanded":x,className:"w-full justify-between",children:[h.length>0?`${h.length} выбрано`:"Выберите ботов...",u.jsx(Jf,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),u.jsx(Yue,{className:"w-[300px] p-0",children:u.jsxs(xp,{children:[u.jsx(wp,{placeholder:"Поиск ботов..."}),u.jsxs(bp,{children:[u.jsx(Mp,{children:"Боты не найдены."}),u.jsx(hs,{children:U.map(Z=>u.jsxs(yr,{value:Z.username,onSelect:()=>{const q=h.includes(Z.id);if(Z.id==="ALL")p(q?[]:["ALL"]);else{let G=q?h.filter(E=>E!==Z.id):[...h,Z.id];G=G.filter(E=>E!=="ALL"),p(G)}},children:[u.jsx(ri,{className:ge("mr-2 h-4 w-4",h.includes(Z.id)?"opacity-100":"opacity-0")}),Z.username]},Z.id))})]})]})})]})]})]}),l==="SEND_COMMAND"&&u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"command",children:"Команда для отправки"}),u.jsx(Ze,{id:"command",value:m,onChange:Z=>v(Z.target.value),placeholder:"Привет, мир!",required:!0})]})]}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:n,children:"Отмена"}),u.jsx(pe,{type:"submit",form:"task-form",disabled:o,children:o?"Сохранение...":"Сохранить"})]})]})}const jq=new Map,bqt=({pattern:e,isEnabled:t,runOnStartup:n})=>{const[o,a]=k.useState({nextRun:"...",human:"..."});return k.useEffect(()=>{(async()=>{if(!t){a({nextRun:"Отключено",human:"Отключено"});return}if(n&&!e){a({nextRun:"При старте",human:"Выполняется при запуске панели"});return}if(!e){a({nextRun:"n/a",human:"Нет расписания"});return}const s=e;if(jq.has(s)){a(jq.get(s));return}try{const l=await Ne("/api/tasks/describe",{method:"POST",body:JSON.stringify({pattern:e})}),d={nextRun:l.next,human:l.human};jq.set(s,d),a(d)}catch(l){console.error(`Ошибка получения описания для "${e}":`,l),a({nextRun:u.jsx("span",{className:"text-destructive",children:"Ошибка"}),human:e})}})()},[e,t]),u.jsxs(u.Fragment,{children:[u.jsx(Xe,{children:u.jsxs("div",{className:"flex flex-col",children:[u.jsx("span",{children:o.human}),e&&u.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:e})]})}),u.jsx(Xe,{children:o.nextRun})]})};function Mqt(){const{tasks:e,fetchTasks:t,createTask:n,updateTask:o,deleteTask:a}=je(),[i,s]=k.useState(!0),[l,d]=k.useState(!1),[h,p]=k.useState(null),[m,v]=k.useState(!1),[x,M]=k.useState(null),b=j=>typeof j!="string"?"* * * * *":j.replace(/\*\/1/g,"*").trim();k.useEffect(()=>{s(!0),t().finally(()=>s(!1))},[t]);const C=(j=null)=>{p(j),d(!0)},_=()=>{d(!1),p(null)},N=async j=>{v(!0);const D={...j,cronPattern:b(j.cronPattern)};h?await o(h.id,D):await n(D),v(!1),_()},A=async()=>{x&&(await a(x.id),M(null))},I=async(j,D)=>{const H={...j,isEnabled:D};delete H.id,await o(j.id,H)},R={START_BOT:"Запустить бота",STOP_BOT:"Остановить бота",RESTART_BOT:"Перезапустить бота",SEND_COMMAND:"Отправить команду"};return u.jsxs("div",{className:"p-4 h-full",children:[u.jsxs(Nn,{className:"h-full flex flex-col",children:[u.jsxs(kn,{className:"flex flex-row items-center justify-between",children:[u.jsxs("div",{children:[u.jsx(xn,{children:"Планировщик задач"}),u.jsx(Qn,{children:"Автоматизируйте действия ботов с помощью cron-задач."})]}),u.jsxs(Jt,{open:l,onOpenChange:d,children:[u.jsx(Ua,{asChild:!0,children:u.jsxs(pe,{onClick:()=>C(),children:[u.jsx(xr,{className:"mr-2 h-4 w-4"}),"Создать задачу"]})}),u.jsx(wqt,{task:h,onSubmit:N,onCancel:_,isSaving:m})]})]}),u.jsx(Ln,{className:"flex-grow overflow-y-auto",children:u.jsxs(Ca,{children:[u.jsx(Na,{children:u.jsxs(Nt,{children:[u.jsx(st,{className:"w-[80px]",children:"Статус"}),u.jsx(st,{children:"Название"}),u.jsx(st,{children:"Расписание"}),u.jsx(st,{children:"Следующий запуск"}),u.jsx(st,{children:"Действие"}),u.jsx(st,{className:"text-right",children:"Действия"})]})}),u.jsx(La,{children:i?u.jsx(Nt,{children:u.jsx(Xe,{colSpan:6,className:"text-center h-24",children:u.jsx(It,{className:"mx-auto h-6 w-6 animate-spin"})})}):e.length>0?e.map(j=>u.jsxs(Nt,{children:[u.jsx(Xe,{children:u.jsx(na,{checked:j.isEnabled,onCheckedChange:D=>I(j,D)})}),u.jsx(Xe,{className:"font-medium",children:j.name}),u.jsx(bqt,{pattern:j.cronPattern,isEnabled:j.isEnabled,runOnStartup:j.runOnStartup}),u.jsx(Xe,{children:u.jsx(Xt,{variant:"secondary",children:R[j.action]||j.action})}),u.jsxs(Xe,{className:"text-right",children:[u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>C(j),children:u.jsx(pn,{className:"h-4 w-4"})}),u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>M(j),children:u.jsx(mo,{className:"h-4 w-4 text-destructive"})})]})]},j.id)):u.jsx(Nt,{children:u.jsx(Xe,{colSpan:6,className:"text-center h-24 text-muted-foreground",children:"Задачи не найдены."})})})]})})]}),u.jsx($s,{open:!!x,onOpenChange:()=>M(null),title:`Удалить задачу "${x==null?void 0:x.name}"?`,description:"Это действие необратимо и приведет к удалению задачи из расписания.",onConfirm:A,confirmText:"Да, удалить"})]})}function _qt({user:e,roles:t,onSubmit:n,onCancel:o,isSaving:a}){const[i,s]=k.useState(""),[l,d]=k.useState(""),[h,p]=k.useState(""),{toast:m}=Yt(),v=!!e;k.useEffect(()=>{v?(s(e.username),p(e.roleId.toString()),d("")):(s(""),d(""),p(t.length>0?t[0].id.toString():""))},[e,t,v]);const x=M=>{if(M.preventDefault(),!i||!h){m({variant:"destructive",title:"Ошибка",description:"Имя пользователя и роль обязательны."});return}if(!v&&(!l||l.length<4)){m({variant:"destructive",title:"Ошибка",description:"Пароль (мин. 4 символа) обязателен для нового пользователя."});return}if(v&&l&&l.length<4){m({variant:"destructive",title:"Ошибка",description:"Новый пароль должен содержать не менее 4 символов."});return}const b={username:i,roleId:parseInt(h,10)};l&&(b.password=l),n(b,e==null?void 0:e.id)};return u.jsxs(Wt,{children:[u.jsxs(on,{children:[u.jsx(en,{children:v?"Редактировать пользователя":"Создать нового пользователя"}),u.jsx(dn,{children:v?`Редактирование данных для ${e.username}.`:"Заполните данные для создания новой учетной записи."})]}),u.jsxs("form",{id:"user-form",onSubmit:x,className:"space-y-4 py-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"username",children:"Имя пользователя"}),u.jsx(Ze,{id:"username",value:i,onChange:M=>s(M.target.value),required:!0,disabled:v})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"password",children:v?"Новый пароль (оставьте пустым, чтобы не менять)":"Пароль"}),u.jsx(Ze,{id:"password",type:"password",value:l,onChange:M=>d(M.target.value),placeholder:"••••••••"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"roleId",children:"Роль"}),u.jsxs(Wn,{value:h,onValueChange:p,required:!0,children:[u.jsx(Fn,{children:u.jsx(Kn,{placeholder:"Выберите роль..."})}),u.jsx(Un,{children:t.map(M=>u.jsx(et,{value:M.id.toString(),children:M.name},M.id))})]})]})]}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:o,children:"Отмена"}),u.jsx(pe,{type:"submit",form:"user-form",disabled:a,children:a?"Сохранение...":"Сохранить"})]})]})}function Sqt(){const[e,t]=k.useState([]),[n,o]=k.useState([]),[a,i]=k.useState(!0),[s,l]=k.useState(!1),[d,h]=k.useState(!1),[p,m]=k.useState(null),[v,x]=k.useState(null),{toast:M}=Yt(),b=je(R=>R.user),C=k.useCallback(async()=>{i(!0);try{const[R,j]=await Promise.all([Ne("/api/auth/users"),Ne("/api/auth/roles")]);t(R),o(j)}catch(R){console.error(R),M({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить данные."})}finally{i(!1)}},[M]);k.useEffect(()=>{C()},[C]);const _=(R=null)=>{m(R),h(!0)},N=()=>{h(!1),m(null)},A=async(R,j)=>{l(!0);const D=!!j,H=D?`/api/auth/users/${j}`:"/api/auth/users",U=D?"PUT":"POST";try{await Ne(H,{method:U,body:JSON.stringify(R)},`Пользователь успешно ${D?"обновлен":"создан"}.`),N(),C()}catch{}finally{l(!1)}},I=async()=>{if(v)try{await Ne(`/api/auth/users/${v.id}`,{method:"DELETE"},"Пользователь удален."),x(null),C()}catch{}};return u.jsxs(u.Fragment,{children:[u.jsxs(Nn,{className:"h-full flex flex-col",children:[u.jsx(kn,{children:u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsxs("div",{children:[u.jsx(xn,{children:"Пользователи панели"}),u.jsx(Qn,{children:"Управление учетными записями и их ролями."})]}),u.jsxs(pe,{onClick:()=>_(),children:[u.jsx(xr,{className:"mr-2 h-4 w-4"}),"Создать пользователя"]})]})}),u.jsx(Ln,{className:"flex-grow overflow-y-auto",children:u.jsxs(Ca,{children:[u.jsx(Na,{children:u.jsxs(Nt,{children:[u.jsx(st,{children:"Имя"}),u.jsx(st,{children:"Роль"}),u.jsx(st,{children:"Дата создания"}),u.jsx(st,{className:"text-right",children:"Действия"})]})}),u.jsx(La,{children:a?u.jsx(Nt,{children:u.jsx(Xe,{colSpan:4,className:"text-center h-24",children:u.jsx(It,{className:"animate-spin mx-auto"})})}):e.map(R=>u.jsxs(Nt,{children:[u.jsx(Xe,{className:"font-medium",children:R.username}),u.jsx(Xe,{children:R.role.name}),u.jsx(Xe,{children:new Date(R.createdAt).toLocaleDateString()}),u.jsxs(Xe,{className:"text-right",children:[u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>_(R),children:u.jsx(pn,{className:"h-4 w-4"})}),u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>x(R),disabled:R.id===b.id,children:u.jsx(mo,{className:"h-4 w-4 text-destructive"})})]})]},R.id))})]})})]}),u.jsx(Jt,{open:d,onOpenChange:h,children:u.jsx(_qt,{user:p,roles:n,onSubmit:A,onCancel:N,isSaving:s})}),u.jsx($s,{open:!!v,onOpenChange:()=>x(null),title:`Удалить пользователя "${v==null?void 0:v.username}"?`,description:"Это действие необратимо.",onConfirm:I,confirmText:"Да, удалить"})]})}function Cqt({role:e,allPermissions:t,onSubmit:n,onCancel:o,isSaving:a}){const[i,s]=k.useState(""),[l,d]=k.useState(new Set),{toast:h}=Yt(),p=!!e;k.useEffect(()=>{p?(s(e.name),d(new Set(e.permissions||[]))):(s(""),d(new Set))},[e,p]);const m=x=>{d(M=>{const b=new Set(M);return b.has(x)?b.delete(x):b.add(x),b})},v=x=>{if(x.preventDefault(),!i.trim()){h({variant:"destructive",title:"Ошибка",description:"Имя роли не может быть пустым."});return}n({name:i,permissions:Array.from(l)},e==null?void 0:e.id)};return u.jsxs(Wt,{className:"max-w-2xl",children:[u.jsxs(on,{children:[u.jsx(en,{children:p?"Редактировать роль":"Создать новую роль"}),u.jsx(dn,{children:"Укажите имя роли и выберите доступные ей права."})]}),u.jsx("form",{id:"role-form",onSubmit:v,className:"py-4",children:u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"name",children:"Название роли"}),u.jsx(Ze,{id:"name",value:i,onChange:x=>s(x.target.value),required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{children:"Права доступа"}),u.jsx(f2,{className:"h-72 w-full rounded-md border p-4",children:u.jsx("div",{className:"space-y-2",children:t.map(x=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ci,{id:`perm-${x.id}`,checked:l.has(x.id),onCheckedChange:()=>m(x.id)}),u.jsxs("label",{htmlFor:`perm-${x.id}`,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:[x.label," ",u.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",x.id,")"]})]})]},x.id))})})]})]})}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:o,children:"Отмена"}),u.jsx(pe,{type:"submit",form:"role-form",disabled:a,children:a?"Сохранение...":"Сохранить"})]})]})}function Nqt(){const[e,t]=k.useState([]),[n,o]=k.useState([]),[a,i]=k.useState(!0),[s,l]=k.useState(!1),[d,h]=k.useState(!1),[p,m]=k.useState(null),[v,x]=k.useState(null),{toast:M}=Yt(),b=k.useCallback(async()=>{i(!0);try{const[I,R]=await Promise.all([Ne("/api/auth/roles"),Ne("/api/auth/permissions")]);t(I),o(R)}catch(I){console.error(I),M({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить данные."})}finally{i(!1)}},[M]);k.useEffect(()=>{b()},[b]);const C=(I=null)=>{m(I),h(!0)},_=()=>{h(!1),m(null)},N=async(I,R)=>{l(!0);const j=!!R,D=j?`/api/auth/roles/${R}`:"/api/auth/roles",H=j?"PUT":"POST";try{await Ne(D,{method:H,body:JSON.stringify(I)},`Роль успешно ${j?"обновлена":"создана"}.`),_(),b()}catch{}finally{l(!1)}},A=async()=>{if(v)try{await Ne(`/api/auth/roles/${v.id}`,{method:"DELETE"},"Роль удалена."),x(null),b()}catch{}};return u.jsxs(u.Fragment,{children:[u.jsxs(Nn,{className:"h-full flex flex-col",children:[u.jsx(kn,{children:u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsxs("div",{children:[u.jsx(xn,{children:"Роли панели"}),u.jsx(Qn,{children:"Управление ролями и наборами их прав."})]}),u.jsxs(pe,{onClick:()=>C(),children:[u.jsx(xr,{className:"mr-2 h-4 w-4"}),"Создать роль"]})]})}),u.jsx(Ln,{className:"flex-grow overflow-y-auto",children:u.jsxs(Ca,{children:[u.jsx(Na,{children:u.jsxs(Nt,{children:[u.jsx(st,{children:"Название"}),u.jsx(st,{children:"Права"}),u.jsx(st,{className:"text-right",children:"Действия"})]})}),u.jsx(La,{children:a?u.jsx(Nt,{children:u.jsx(Xe,{colSpan:3,className:"text-center h-24",children:u.jsx(It,{className:"animate-spin mx-auto"})})}):e.map(I=>u.jsxs(Nt,{children:[u.jsx(Xe,{className:"font-medium",children:I.name}),u.jsx(Xe,{className:"max-w-md",children:u.jsx("div",{className:"flex flex-wrap gap-1",children:I.permissions.includes("*")?u.jsx(Xt,{children:"Все права"}):I.permissions.map(R=>u.jsx(Xt,{variant:"secondary",children:R},R))})}),u.jsxs(Xe,{className:"text-right",children:[u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>C(I),disabled:I.name==="Admin",children:u.jsx(pn,{className:"h-4 w-4"})}),u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>x(I),disabled:I.name==="Admin",children:u.jsx(mo,{className:"h-4 w-4 text-destructive"})})]})]},I.id))})]})})]}),u.jsx(Jt,{open:d,onOpenChange:_,children:u.jsx(Cqt,{role:p,allPermissions:n,onSubmit:N,onCancel:_,isSaving:s})}),u.jsx($s,{open:!!v,onOpenChange:()=>x(null),title:`Удалить роль "${v==null?void 0:v.name}"?`,description:"Это действие необратимо. Убедитесь, что эта роль не назначена ни одному пользователю.",onConfirm:A,confirmText:"Да, удалить"})]})}const Lqt=r2("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Wue=k.forwardRef(({className:e,variant:t,...n},o)=>u.jsx("div",{ref:o,role:"alert",className:ge(Lqt({variant:t}),e),...n}));Wue.displayName="Alert";const Kue=k.forwardRef(({className:e,...t},n)=>u.jsx("h5",{ref:n,className:ge("mb-1 font-medium leading-none tracking-tight",e),...t}));Kue.displayName="AlertTitle";const Que=k.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ge("text-sm [&_p]:leading-relaxed",e),...t}));Que.displayName="AlertDescription";function jqt(){const[e,t]=k.useState(null),[n,o]=k.useState(!0),[a,i]=k.useState(!1),{toast:s}=Yt(),l=k.useCallback(async()=>{o(!0);try{const p=await Ne("/api/panel/settings");t({server:p.server||{allowExternalAccess:!1},telemetry:p.telemetry||{enabled:!0}})}catch{s({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить глобальные настройки."})}finally{o(!1)}},[s]);k.useEffect(()=>{l()},[l]);const d=(p,m)=>{const[v,x]=p.split(".");t(M=>({...M,[v]:{...M[v],[x]:m}}))},h=async()=>{i(!0);try{await Ne("/api/panel/settings",{method:"PUT",body:JSON.stringify({allowExternalAccess:e.server.allowExternalAccess,telemetryEnabled:e.telemetry.enabled})},"Настройки сохранены. Перезапустите панель для применения.")}catch{}finally{i(!1)}};return n||!e?u.jsx("div",{className:"flex justify-center items-center h-full",children:u.jsx(It,{className:"h-6 w-6 animate-spin"})}):u.jsxs(Nn,{children:[u.jsxs(kn,{children:[u.jsx(xn,{children:"Глобальные настройки"}),u.jsx(Qn,{children:"Эти настройки влияют на работу всей панели. Изменения некоторых из них требуют перезапуска."})]}),u.jsxs(Ln,{className:"space-y-6",children:[u.jsxs(Wue,{children:[u.jsx(Yd,{className:"h-4 w-4"}),u.jsx(Kue,{children:"Требуется перезапуск"}),u.jsxs(Que,{children:["После сохранения настроек необходимо перезапустить панель, например, командой ",u.jsx("code",{children:"npx blockmine"})," в терминале."]})]}),u.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[u.jsxs("div",{children:[u.jsx(_e,{htmlFor:"external-access",className:"text-base font-medium",children:"Внешний доступ"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Разрешить доступ к панели из локальной сети или интернета."})]}),u.jsx(na,{id:"external-access",checked:e.server.allowExternalAccess,onCheckedChange:p=>d("server.allowExternalAccess",p)})]}),u.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[u.jsxs("div",{children:[u.jsx(_e,{htmlFor:"telemetry",className:"text-base font-medium",children:"Анонимная телеметрия"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Отправлять анонимную статистику (кол-во ботов, плагинов) для улучшения проекта."})]}),u.jsx(na,{id:"telemetry",checked:e.telemetry.enabled,onCheckedChange:p=>d("telemetry.enabled",p)})]}),u.jsx("div",{className:"flex justify-end",children:u.jsxs(pe,{onClick:h,disabled:a,children:[a?u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}):u.jsx(si,{className:"mr-2 h-4 w-4"}),"Сохранить настройки"]})})]})]})}function Aqt(){return u.jsxs("div",{className:"h-full flex flex-col p-4",children:[u.jsx(kn,{className:"px-0",children:u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(Zd,{className:"w-8 h-8 text-primary"}),u.jsxs("div",{children:[u.jsx(xn,{children:"Администрирование"}),u.jsx(Qn,{children:"Управление пользователями, ролями и глобальными настройками панели."})]})]})}),u.jsxs(Np,{defaultValue:"users",className:"flex-grow flex flex-col",children:[u.jsxs(y2,{className:"mt-2",children:[u.jsx(Ao,{value:"users",children:"Пользователи"}),u.jsx(Ao,{value:"roles",children:"Роли"}),u.jsx(Ao,{value:"settings",children:"Глобальные настройки"})]}),u.jsx(Mr,{value:"users",className:"flex-grow min-h-0 mt-4",children:u.jsx(Sqt,{})}),u.jsx(Mr,{value:"roles",className:"flex-grow min-h-0 mt-4",children:u.jsx(Nqt,{})}),u.jsx(Mr,{value:"settings",className:"flex-grow min-h-0 mt-4",children:u.jsx(jqt,{})})]})]})}const Gi=({children:e,requiredPermission:t})=>{const n=je(s=>s.hasPermission),o=je(s=>s.authInitialized),{toast:a}=Yt(),i=n(t);return k.useEffect(()=>{o&&!i&&a({variant:"destructive",title:"Доступ запрещен",description:"У вас недостаточно прав для просмотра этой страницы."})},[i,o,a]),o?i?e:u.jsx(VR,{to:"/",replace:!0}):u.jsx("div",{className:"flex items-center justify-center h-full",children:u.jsx(It,{className:"h-6 w-6 animate-spin"})})};function Eqt(){const e=je(n=>n.authInitialized),t=je(n=>n.initializeAuth);return k.useEffect(()=>{e||t()},[e]),e?u.jsx(bV,{}):u.jsx("div",{className:"flex items-center justify-center h-screen bg-background",children:u.jsx(It,{className:"h-8 w-8 animate-spin text-primary"})})}function Iqt(){const e=je(s=>s.isAuthenticated),t=je(s=>s.needsSetup),n=je(s=>s.connectSocket),o=je(s=>s.disconnectSocket),a=je(s=>s.fetchInitialData),i=je(s=>s.fetchTasks);return k.useEffect(()=>(e&&(n(),a(),i()),()=>{o()}),[e,n,o,a,i]),t?u.jsx(VR,{to:"/setup",replace:!0}):e?u.jsx(KVe,{}):u.jsx(VR,{to:"/login",replace:!0})}const Tqt=cfe([{path:"/",element:u.jsx(Eqt,{}),children:[{path:"login",element:u.jsx(QVe,{})},{path:"setup",element:u.jsx(JVe,{})},{path:"/",element:u.jsx(Iqt,{}),children:[{index:!0,element:u.jsx(rBe,{})},{path:"bots/:botId",element:u.jsx(SBe,{}),children:[{index:!0,element:u.jsx(VR,{to:"console",replace:!0})},{path:"console",element:u.jsx(nMt,{})},{path:"plugins",element:u.jsx(i_t,{})},{path:"plugins/view/:pluginName",element:u.jsx(SOt,{})},{path:"plugins/edit/:pluginName",element:u.jsx(Gi,{requiredPermission:"plugin:develop",children:u.jsx(tqt,{})})},{path:"settings",element:u.jsx(L_t,{})},{path:"management",element:u.jsx(Gi,{requiredPermission:"management:view",children:u.jsx(LLt,{})})},{path:"commands/visual/:commandId",element:u.jsx(Gi,{requiredPermission:"management:edit",children:u.jsx(IQ,{})})},{path:"events",element:u.jsx(Gi,{requiredPermission:"management:edit",children:u.jsx(tPt,{})})},{path:"events/visual/:eventId",element:u.jsx(Gi,{requiredPermission:"management:edit",children:u.jsx(IQ,{})})}]},{path:"servers",element:u.jsx(Gi,{requiredPermission:"server:list",children:u.jsx(oqt,{})})},{path:"tasks",element:u.jsx(Gi,{requiredPermission:"task:list",children:u.jsx(Mqt,{})})},{path:"admin",element:u.jsx(Gi,{requiredPermission:"panel:user:list",children:u.jsx(Aqt,{})})}]}]}]);fhe.createRoot(document.getElementById("root")).render(u.jsx(k.StrictMode,{children:u.jsxs("div",{className:"text-foreground bg-background",children:[u.jsx(xfe,{router:Tqt}),u.jsx(KDe,{})]})}));
8203
+ `},a),i}function Yzt(e,t){return e&&"run"in e?async function(n,o){const a=lJ(n,{file:o,...t});await e.run(a,o)}:function(n,o){return lJ(n,{file:o,...e||t})}}function uJ(e){if(e)throw e}var gq,dJ;function Wzt(){if(dJ)return gq;dJ=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},i=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var p=e.call(h,"constructor"),m=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!p&&!m)return!1;var v;for(v in h);return typeof v>"u"||e.call(h,v)},s=function(h,p){n&&p.name==="__proto__"?n(h,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):h[p.name]=p.newValue},l=function(h,p){if(p==="__proto__")if(e.call(h,p)){if(o)return o(h,p).value}else return;return h[p]};return gq=function d(){var h,p,m,v,x,M,b=arguments[0],C=1,_=arguments.length,N=!1;for(typeof b=="boolean"&&(N=b,b=arguments[1]||{},C=2),(b==null||typeof b!="object"&&typeof b!="function")&&(b={});C<_;++C)if(h=arguments[C],h!=null)for(p in h)m=l(b,p),v=l(h,p),b!==v&&(N&&v&&(i(v)||(x=a(v)))?(x?(x=!1,M=m&&a(m)?m:[]):M=m&&i(m)?m:{},s(b,{name:p,newValue:d(N,M,v)})):typeof v<"u"&&s(b,{name:p,newValue:v}));return b},gq}var Kzt=Wzt();const vq=d1(Kzt);function hV(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Qzt(){const e=[],t={run:n,use:o};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);l(null,...a);function l(d,...h){const p=e[++i];let m=-1;if(d){s(d);return}for(;++m<a.length;)(h[m]===null||h[m]===void 0)&&(h[m]=a[m]);a=h,p?Jzt(p,l)(...h):s(null,...h)}}function o(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function Jzt(e,t){let n;return o;function o(...s){const l=e.length>s.length;let d;l&&s.push(a);try{d=e.apply(this,s)}catch(h){const p=h;if(l&&n)throw p;return a(p)}l||(d&&d.then&&typeof d.then=="function"?d.then(i,a):d instanceof Error?a(d):i(d))}function a(s,...l){n||(n=!0,t(s,...l))}function i(s){a(null,s)}}const fr={basename:eOt,dirname:tOt,extname:nOt,join:oOt,sep:"/"};function eOt(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');zp(e);let n=0,o=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else o<0&&(i=!0,o=a+1);return o<0?"":e.slice(n,o)}if(t===e)return"";let s=-1,l=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1),l>-1&&(e.codePointAt(a)===t.codePointAt(l--)?l<0&&(o=a):(l=-1,o=s));return n===o?o=s:o<0&&(o=e.length),e.slice(n,o)}function tOt(e){if(zp(e),e.length===0)return".";let t=-1,n=e.length,o;for(;--n;)if(e.codePointAt(n)===47){if(o){t=n;break}}else o||(o=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function nOt(e){zp(e);let t=e.length,n=-1,o=0,a=-1,i=0,s;for(;t--;){const l=e.codePointAt(t);if(l===47){if(s){o=t+1;break}continue}n<0&&(s=!0,n=t+1),l===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===o+1?"":e.slice(a,n)}function oOt(...e){let t=-1,n;for(;++t<e.length;)zp(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":aOt(n)}function aOt(e){zp(e);const t=e.codePointAt(0)===47;let n=rOt(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function rOt(e,t){let n="",o=0,a=-1,i=0,s=-1,l,d;for(;++s<=e.length;){if(s<e.length)l=e.codePointAt(s);else{if(l===47)break;l=47}if(l===47){if(!(a===s-1||i===1))if(a!==s-1&&i===2){if(n.length<2||o!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",o=0):(n=n.slice(0,d),o=n.length-1-n.lastIndexOf("/")),a=s,i=0;continue}}else if(n.length>0){n="",o=0,a=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",o=2)}else n.length>0?n+="/"+e.slice(a+1,s):n=e.slice(a+1,s),o=s-a-1;a=s,i=0}else l===46&&i>-1?i++:i=-1}return n}function zp(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const iOt={cwd:sOt};function sOt(){return"/"}function fV(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function cOt(e){if(typeof e=="string")e=new URL(e);else if(!fV(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return lOt(e)}function lOt(e){if(e.hostname!==""){const o=new TypeError('File URL host must be "localhost" or empty on darwin');throw o.code="ERR_INVALID_FILE_URL_HOST",o}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const o=t.codePointAt(n+2);if(o===70||o===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const kq=["history","path","basename","stem","extname","dirname"];class fue{constructor(t){let n;t?fV(t)?n={path:t}:typeof t=="string"||uOt(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":iOt.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let o=-1;for(;++o<kq.length;){const i=kq[o];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)kq.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?fr.basename(this.path):void 0}set basename(t){wq(t,"basename"),xq(t,"basename"),this.path=fr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?fr.dirname(this.path):void 0}set dirname(t){hJ(this.basename,"dirname"),this.path=fr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?fr.extname(this.path):void 0}set extname(t){if(xq(t,"extname"),hJ(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=fr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){fV(t)&&(t=cOt(t)),wq(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?fr.basename(this.path,this.extname):void 0}set stem(t){wq(t,"stem"),xq(t,"stem"),this.path=fr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,o){const a=this.message(t,n,o);throw a.fatal=!0,a}info(t,n,o){const a=this.message(t,n,o);return a.fatal=void 0,a}message(t,n,o){const a=new ho(t,n,o);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function xq(e,t){if(e&&e.includes(fr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+fr.sep+"`")}function wq(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function hJ(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function uOt(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const dOt=function(e){const o=this.constructor.prototype,a=o[e],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,o),i},hOt={}.hasOwnProperty;class YF extends dOt{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Qzt()}copy(){const t=new YF;let n=-1;for(;++n<this.attachers.length;){const o=this.attachers[n];t.use(...o)}return t.data(vq(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(_q("data",this.frozen),this.namespace[t]=n,this):hOt.call(this.namespace,t)&&this.namespace[t]||void 0:t?(_q("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...o]=this.attachers[this.freezeIndex];if(o[0]===!1)continue;o[0]===!0&&(o[0]=void 0);const a=n.call(t,...o);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Cm(t),o=this.parser||this.Parser;return bq("parse",o),o(String(n),n)}process(t,n){const o=this;return this.freeze(),bq("process",this.parser||this.Parser),Mq("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const l=Cm(t),d=o.parse(l);o.run(d,l,function(p,m,v){if(p||!m||!v)return h(p);const x=m,M=o.stringify(x,v);yOt(M)?v.value=M:v.result=M,h(p,v)});function h(p,m){p||!m?s(p):i?i(m):n(void 0,m)}}}processSync(t){let n=!1,o;return this.freeze(),bq("processSync",this.parser||this.Parser),Mq("processSync",this.compiler||this.Compiler),this.process(t,a),pJ("processSync","process",n),o;function a(i,s){n=!0,uJ(i),o=s}}run(t,n,o){fJ(t),this.freeze();const a=this.transformers;return!o&&typeof n=="function"&&(o=n,n=void 0),o?i(void 0,o):new Promise(i);function i(s,l){const d=Cm(n);a.run(t,d,h);function h(p,m,v){const x=m||t;p?l(p):s?s(x):o(void 0,x,v)}}}runSync(t,n){let o=!1,a;return this.run(t,n,i),pJ("runSync","run",o),a;function i(s,l){uJ(s),a=l,o=!0}}stringify(t,n){this.freeze();const o=Cm(n),a=this.compiler||this.Compiler;return Mq("stringify",a),fJ(t),a(t,o)}use(t,...n){const o=this.attachers,a=this.namespace;if(_q("use",this.frozen),t!=null)if(typeof t=="function")d(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(h){if(typeof h=="function")d(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[p,...m]=h;d(p,m)}else s(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function s(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(h.plugins),h.settings&&(a.settings=vq(!0,a.settings,h.settings))}function l(h){let p=-1;if(h!=null)if(Array.isArray(h))for(;++p<h.length;){const m=h[p];i(m)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function d(h,p){let m=-1,v=-1;for(;++m<o.length;)if(o[m][0]===h){v=m;break}if(v===-1)o.push([h,...p]);else if(p.length>0){let[x,...M]=p;const b=o[v][1];hV(b)&&hV(x)&&(x=vq(!0,b,x)),o[v]=[h,x,...M]}}}}const fOt=new YF().freeze();function bq(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Mq(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function _q(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function fJ(e){if(!hV(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function pJ(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Cm(e){return pOt(e)?e:new fue(e)}function pOt(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function yOt(e){return typeof e=="string"||mOt(e)}function mOt(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const gOt="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",yJ=[],mJ={allowDangerousHtml:!0},vOt=/^(https?|ircs?|mailto|xmpp)$/i,kOt=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function xOt(e){const t=wOt(e),n=bOt(e);return MOt(t.runSync(t.parse(n),n),e)}function wOt(e){const t=e.rehypePlugins||yJ,n=e.remarkPlugins||yJ,o=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...mJ}:mJ;return fOt().use(ezt).use(n).use(Yzt,o).use(t)}function bOt(e){const t=e.children||"",n=new fue;return typeof t=="string"&&(n.value=t),n}function MOt(e,t){const n=t.allowedElements,o=t.allowElement,a=t.components,i=t.disallowedElements,s=t.skipHtml,l=t.unwrapDisallowed,d=t.urlTransform||_Ot;for(const p of kOt)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+gOt+p.id,void 0);return hue(e,h),TPt(e,{Fragment:u.Fragment,components:a,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function h(p,m,v){if(p.type==="raw"&&v&&typeof m=="number")return s?v.children.splice(m,1):v.children[m]={type:"text",value:p.value},m;if(p.type==="element"){let x;for(x in pq)if(Object.hasOwn(pq,x)&&Object.hasOwn(p.properties,x)){const M=p.properties[x],b=pq[x];(b===null||b.includes(p.tagName))&&(p.properties[x]=d(String(M||""),x,p))}}if(p.type==="element"){let x=n?!n.includes(p.tagName):i?i.includes(p.tagName):!1;if(!x&&o&&typeof m=="number"&&(x=!o(p,m,v)),x&&v&&typeof m=="number")return l&&p.children?v.children.splice(m,1,...p.children):v.children.splice(m,1),m}}}function _Ot(e){const t=e.indexOf(":"),n=e.indexOf("?"),o=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||o!==-1&&t>o||vOt.test(e.slice(0,t))?e:""}function SOt(){const{pluginName:e,botId:t}=gi(),n=parseInt(t,10),o=je(C=>C.installedPlugins),a=je(C=>C.installPluginFromRepo),i=je(C=>C.fetchInstalledPlugins),s=k.useMemo(()=>o[n]||[],[o,n]),[l,d]=k.useState(null),[h,p]=k.useState(!0),[m,v]=k.useState(!1),{toast:x}=Yt();k.useEffect(()=>{(async()=>{p(!0);try{const _=await fetch(`/api/plugins/catalog/${e}`);if(!_.ok)throw new Error("Плагин не найден");const N=await _.json();d(N)}catch(_){x({variant:"destructive",title:"Ошибка",description:_.message})}finally{p(!1)}})()},[e,x]),k.useEffect(()=>{t&&i(n)},[t,i,n]);const M=k.useMemo(()=>l?s.some(C=>C.sourceUri===l.repoUrl):!1,[s,l]),b=async()=>{if(l){v(!0);try{await a(n,l.repoUrl,l.name)}catch{}finally{v(!1)}}};return h?u.jsx("div",{className:"p-8 text-center",children:"Загрузка информации о плагине..."}):l?u.jsxs("div",{className:"p-4 md:p-8 max-w-6xl mx-auto overflow-y-auto h-full",children:[u.jsxs(up,{to:`/bots/${t}/plugins`,className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-4",children:[u.jsx(Yf,{className:"h-4 w-4"}),"Назад в магазин"]}),u.jsxs("header",{className:"flex flex-col md:flex-row gap-4 justify-between items-start mb-6",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-4xl font-bold",children:l.name}),u.jsxs("p",{className:"text-lg text-muted-foreground",children:["Автор: ",l.author]}),u.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:(l.categories||[]).map(C=>u.jsx(Xt,{children:C},C))})]}),u.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[u.jsx("a",{href:l.repoUrl,target:"_blank",rel:"noopener noreferrer",children:u.jsxs(pe,{variant:"outline",children:[u.jsx(ms,{className:"mr-2"}),"GitHub"]})}),u.jsxs(pe,{disabled:m||M,onClick:b,children:[m?u.jsx(It,{className:"mr-2 animate-spin"}):M?u.jsx(ei,{className:"mr-2"}):u.jsx(ii,{className:"mr-2"}),m?"Установка...":M?"Установлен":"Установить"]})]})]}),u.jsx(Gh,{}),u.jsxs("main",{className:"mt-6",children:[u.jsx(Nn,{children:u.jsx(Ln,{className:"p-6",children:u.jsx("div",{className:"prose prose-invert max-w-none",children:u.jsx(xOt,{children:l.fullDescription||l.description||"Описание отсутствует."})})})}),l.dependencies&&l.dependencies.length>0&&u.jsxs("div",{className:"mt-6",children:[u.jsx("h3",{className:"text-xl font-semibold mb-3",children:"Зависимости"}),u.jsx(Nn,{children:u.jsx(Ln,{className:"p-4",children:u.jsx("ul",{className:"list-disc list-inside text-sm",children:l.dependencies.map(C=>u.jsx("li",{children:C},C))})})})]})]})]}):u.jsx("div",{className:"p-8 text-center text-destructive",children:"Не удалось загрузить информацию о плагине."})}var WF="ContextMenu",[COt,Zqt]=zn(WF,[o$]),xo=o$(),[NOt,pue]=COt(WF),yue=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:o,dir:a,modal:i=!0}=e,[s,l]=k.useState(!1),d=xo(t),h=gn(o),p=k.useCallback(m=>{l(m),h(m)},[h]);return u.jsx(NOt,{scope:t,open:s,onOpenChange:p,modal:i,children:u.jsx($oe,{...d,dir:a,open:s,onOpenChange:p,modal:i,children:n})})};yue.displayName=WF;var mue="ContextMenuTrigger",gue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:o=!1,...a}=e,i=pue(mue,n),s=xo(n),l=k.useRef({x:0,y:0}),d=k.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),h=k.useRef(0),p=k.useCallback(()=>window.clearTimeout(h.current),[]),m=v=>{l.current={x:v.clientX,y:v.clientY},i.onOpenChange(!0)};return k.useEffect(()=>p,[p]),k.useEffect(()=>void(o&&p()),[o,p]),u.jsxs(u.Fragment,{children:[u.jsx(Doe,{...s,virtualRef:d}),u.jsx(Ae.span,{"data-state":i.open?"open":"closed","data-disabled":o?"":void 0,...a,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:o?e.onContextMenu:Me(e.onContextMenu,v=>{p(),m(v),v.preventDefault()}),onPointerDown:o?e.onPointerDown:Me(e.onPointerDown,Nm(v=>{p(),h.current=window.setTimeout(()=>m(v),700)})),onPointerMove:o?e.onPointerMove:Me(e.onPointerMove,Nm(p)),onPointerCancel:o?e.onPointerCancel:Me(e.onPointerCancel,Nm(p)),onPointerUp:o?e.onPointerUp:Me(e.onPointerUp,Nm(p))})]})});gue.displayName=mue;var LOt="ContextMenuPortal",vue=e=>{const{__scopeContextMenu:t,...n}=e,o=xo(t);return u.jsx(zoe,{...o,...n})};vue.displayName=LOt;var kue="ContextMenuContent",xue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=pue(kue,n),i=xo(n),s=k.useRef(!1);return u.jsx(Ooe,{...i,...o,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{var d;(d=e.onCloseAutoFocus)==null||d.call(e,l),!l.defaultPrevented&&s.current&&l.preventDefault(),s.current=!1},onInteractOutside:l=>{var d;(d=e.onInteractOutside)==null||d.call(e,l),!l.defaultPrevented&&!a.modal&&(s.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});xue.displayName=kue;var jOt="ContextMenuGroup",AOt=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(qoe,{...a,...o,ref:t})});AOt.displayName=jOt;var EOt="ContextMenuLabel",wue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Hoe,{...a,...o,ref:t})});wue.displayName=EOt;var IOt="ContextMenuItem",bue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Voe,{...a,...o,ref:t})});bue.displayName=IOt;var TOt="ContextMenuCheckboxItem",Mue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Boe,{...a,...o,ref:t})});Mue.displayName=TOt;var ROt="ContextMenuRadioGroup",POt=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Foe,{...a,...o,ref:t})});POt.displayName=ROt;var $Ot="ContextMenuRadioItem",_ue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Uoe,{...a,...o,ref:t})});_ue.displayName=$Ot;var DOt="ContextMenuItemIndicator",Sue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Goe,{...a,...o,ref:t})});Sue.displayName=DOt;var zOt="ContextMenuSeparator",Cue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Xoe,{...a,...o,ref:t})});Cue.displayName=zOt;var OOt="ContextMenuArrow",qOt=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Zoe,{...a,...o,ref:t})});qOt.displayName=OOt;var HOt="ContextMenuSubTrigger",Nue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Yoe,{...a,...o,ref:t})});Nue.displayName=HOt;var VOt="ContextMenuSubContent",Lue=k.forwardRef((e,t)=>{const{__scopeContextMenu:n,...o}=e,a=xo(n);return u.jsx(Woe,{...a,...o,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Lue.displayName=VOt;function Nm(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var BOt=yue,FOt=gue,UOt=vue,jue=xue,Aue=wue,Eue=bue,Iue=Mue,Tue=_ue,Rue=Sue,Pue=Cue,$ue=Nue,Due=Lue;const Sq=BOt,Cq=FOt,GOt=k.forwardRef(({className:e,inset:t,children:n,...o},a)=>u.jsxs($ue,{ref:a,className:ge("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...o,children:[n,u.jsx(Sh,{className:"ml-auto h-4 w-4"})]}));GOt.displayName=$ue.displayName;const XOt=k.forwardRef(({className:e,...t},n)=>u.jsx(Due,{ref:n,className:ge("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",e),...t}));XOt.displayName=Due.displayName;const DR=k.forwardRef(({className:e,...t},n)=>u.jsx(UOt,{children:u.jsx(jue,{ref:n,className:ge("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",e),...t})}));DR.displayName=jue.displayName;const Ra=k.forwardRef(({className:e,inset:t,...n},o)=>u.jsx(Eue,{ref:o,className:ge("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Ra.displayName=Eue.displayName;const ZOt=k.forwardRef(({className:e,children:t,checked:n,...o},a)=>u.jsxs(Iue,{ref:a,className:ge("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...o,children:[u.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:u.jsx(Rue,{children:u.jsx(ri,{className:"h-4 w-4"})})}),t]}));ZOt.displayName=Iue.displayName;const YOt=k.forwardRef(({className:e,children:t,...n},o)=>u.jsxs(Tue,{ref:o,className:ge("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[u.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:u.jsx(Rue,{children:u.jsx(Bd,{className:"h-4 w-4 fill-current"})})}),t]}));YOt.displayName=Tue.displayName;const WOt=k.forwardRef(({className:e,inset:t,...n},o)=>u.jsx(Aue,{ref:o,className:ge("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...n}));WOt.displayName=Aue.displayName;const pV=k.forwardRef(({className:e,...t},n)=>u.jsx(Pue,{ref:n,className:ge("-mx-1 my-1 h-px bg-border",e),...t}));pV.displayName=Pue.displayName;var Nq,gJ;function KOt(){if(gJ)return Nq;gJ=1;function e(a){if(typeof a!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(a))}function t(a,i){for(var s="",l=0,d=-1,h=0,p,m=0;m<=a.length;++m){if(m<a.length)p=a.charCodeAt(m);else{if(p===47)break;p=47}if(p===47){if(!(d===m-1||h===1))if(d!==m-1&&h===2){if(s.length<2||l!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){var v=s.lastIndexOf("/");if(v!==s.length-1){v===-1?(s="",l=0):(s=s.slice(0,v),l=s.length-1-s.lastIndexOf("/")),d=m,h=0;continue}}else if(s.length===2||s.length===1){s="",l=0,d=m,h=0;continue}}i&&(s.length>0?s+="/..":s="..",l=2)}else s.length>0?s+="/"+a.slice(d+1,m):s=a.slice(d+1,m),l=m-d-1;d=m,h=0}else p===46&&h!==-1?++h:h=-1}return s}function n(a,i){var s=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return s?s===i.root?s+l:s+a+l:l}var o={resolve:function(){for(var i="",s=!1,l,d=arguments.length-1;d>=-1&&!s;d--){var h;d>=0?h=arguments[d]:(l===void 0&&(l=process.cwd()),h=l),e(h),h.length!==0&&(i=h+"/"+i,s=h.charCodeAt(0)===47)}return i=t(i,!s),s?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var s=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=t(i,!s),i.length===0&&!s&&(i="."),i.length>0&&l&&(i+="/"),s?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,s=0;s<arguments.length;++s){var l=arguments[s];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,s){if(e(i),e(s),i===s||(i=o.resolve(i),s=o.resolve(s),i===s))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var d=i.length,h=d-l,p=1;p<s.length&&s.charCodeAt(p)===47;++p);for(var m=s.length,v=m-p,x=h<v?h:v,M=-1,b=0;b<=x;++b){if(b===x){if(v>x){if(s.charCodeAt(p+b)===47)return s.slice(p+b+1);if(b===0)return s.slice(p+b)}else h>x&&(i.charCodeAt(l+b)===47?M=b:b===0&&(M=0));break}var C=i.charCodeAt(l+b),_=s.charCodeAt(p+b);if(C!==_)break;C===47&&(M=b)}var N="";for(b=l+M+1;b<=d;++b)(b===d||i.charCodeAt(b)===47)&&(N.length===0?N+="..":N+="/..");return N.length>0?N+s.slice(p+M):(p+=M,s.charCodeAt(p)===47&&++p,s.slice(p))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var s=i.charCodeAt(0),l=s===47,d=-1,h=!0,p=i.length-1;p>=1;--p)if(s=i.charCodeAt(p),s===47){if(!h){d=p;break}}else h=!1;return d===-1?l?"/":".":l&&d===1?"//":i.slice(0,d)},basename:function(i,s){if(s!==void 0&&typeof s!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,d=-1,h=!0,p;if(s!==void 0&&s.length>0&&s.length<=i.length){if(s.length===i.length&&s===i)return"";var m=s.length-1,v=-1;for(p=i.length-1;p>=0;--p){var x=i.charCodeAt(p);if(x===47){if(!h){l=p+1;break}}else v===-1&&(h=!1,v=p+1),m>=0&&(x===s.charCodeAt(m)?--m===-1&&(d=p):(m=-1,d=v))}return l===d?d=v:d===-1&&(d=i.length),i.slice(l,d)}else{for(p=i.length-1;p>=0;--p)if(i.charCodeAt(p)===47){if(!h){l=p+1;break}}else d===-1&&(h=!1,d=p+1);return d===-1?"":i.slice(l,d)}},extname:function(i){e(i);for(var s=-1,l=0,d=-1,h=!0,p=0,m=i.length-1;m>=0;--m){var v=i.charCodeAt(m);if(v===47){if(!h){l=m+1;break}continue}d===-1&&(h=!1,d=m+1),v===46?s===-1?s=m:p!==1&&(p=1):s!==-1&&(p=-1)}return s===-1||d===-1||p===0||p===1&&s===d-1&&s===l+1?"":i.slice(s,d)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return n("/",i)},parse:function(i){e(i);var s={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return s;var l=i.charCodeAt(0),d=l===47,h;d?(s.root="/",h=1):h=0;for(var p=-1,m=0,v=-1,x=!0,M=i.length-1,b=0;M>=h;--M){if(l=i.charCodeAt(M),l===47){if(!x){m=M+1;break}continue}v===-1&&(x=!1,v=M+1),l===46?p===-1?p=M:b!==1&&(b=1):p!==-1&&(b=-1)}return p===-1||v===-1||b===0||b===1&&p===v-1&&p===m+1?v!==-1&&(m===0&&d?s.base=s.name=i.slice(1,v):s.base=s.name=i.slice(m,v)):(m===0&&d?(s.name=i.slice(1,p),s.base=i.slice(1,v)):(s.name=i.slice(m,p),s.base=i.slice(m,v)),s.ext=i.slice(p,v)),m>0?s.dir=i.slice(0,m-1):d&&(s.dir="/"),s},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,Nq=o,Nq}var QOt=KOt();const ds=d1(QOt),Lq=({defaultValue:e="",onCommit:t,onCancel:n,type:o="file"})=>{const[a,i]=k.useState(e),s=k.useRef(null);k.useEffect(()=>{var h,p;(h=s.current)==null||h.focus(),(p=s.current)==null||p.select()},[]);const l=h=>{h.key==="Enter"?(h.preventDefault(),h.stopPropagation(),t(a)):h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),n())},d=()=>{t(a)};return u.jsxs("div",{className:"flex items-center p-1 w-full",children:[o==="folder"?u.jsx(jh,{className:"h-4 w-4 mr-2 flex-shrink-0"}):u.jsx(Lh,{className:"h-4 w-4 mr-2 ml-1 flex-shrink-0"}),u.jsx("input",{ref:s,type:"text",value:a,onChange:h=>i(h.target.value),onKeyDown:l,onBlur:d,className:"bg-background text-foreground border border-primary rounded p-0 px-1 w-full text-sm h-6"})]})},JOt=({structure:e,onSelectFile:t,selectedFile:n,onDelete:o,onRename:a,onCreateFile:i,onCreateFolder:s,inlineAction:l,onCommit:d,onCancel:h})=>{const[p,m]=k.useState({});k.useEffect(()=>{if(l!=null&&l.mode.startsWith("create")&&l.node){const C=l.node.type==="folder"?l.node.path:ds.dirname(l.node.path);C&&!p[C]&&m(_=>({..._,[C]:!0}))}},[l]);const v=C=>{m(_=>({..._,[C]:!_[C]}))},x=C=>{const _=n&&n.path===C.path,N=p[C.path];if((l==null?void 0:l.mode)==="rename"&&l.node.path===C.path)return u.jsx("div",{className:"w-full",children:u.jsx(Lq,{defaultValue:C.name,onCommit:d,onCancel:h,type:C.type})},`${C.path}-editing`);const A=u.jsxs("div",{className:`flex items-center cursor-pointer p-1 rounded hover:bg-muted ${_?"bg-primary/20":""}`,onClick:()=>C.type==="file"?t(C):v(C.path),children:[C.type==="folder"?N?u.jsx(jh,{className:"h-4 w-4 mr-2"}):u.jsx(t0,{className:"h-4 w-4 mr-2"}):u.jsx(Lh,{className:"h-4 w-4 mr-2 ml-1"}),u.jsx("span",{children:C.name})]});if(C.type==="folder"){const I=l!=null&&l.node?l.node.type==="folder"?l.node.path:ds.dirname(l.node.path):null,R=(l==null?void 0:l.mode.startsWith("create"))&&I===C.path;return u.jsxs("div",{children:[u.jsxs(Sq,{children:[u.jsx(Cq,{children:A}),u.jsxs(DR,{children:[u.jsxs(Ra,{onClick:()=>i(C),children:[u.jsx(Fd,{className:"h-4 w-4 mr-2"}),"Создать файл"]}),u.jsxs(Ra,{onClick:()=>s(C),children:[u.jsx(ys,{className:"h-4 w-4 mr-2"}),"Создать папку"]}),u.jsx(pV,{}),u.jsxs(Ra,{onClick:()=>a(C),children:[u.jsx(Eh,{className:"h-4 w-4 mr-2"}),"Переименовать"]}),u.jsxs(Ra,{className:"text-destructive",onClick:()=>o(C),children:[u.jsx(Th,{className:"h-4 w-4 mr-2"}),"Удалить"]})]})]}),N&&u.jsxs("div",{className:"pl-4 border-l border-muted-foreground/20 ml-2",children:[C.children&&C.children.length>0&&C.children.map(x),R&&u.jsx(Lq,{onCommit:d,onCancel:h,type:l.mode==="createFile"?"file":"folder"}),!R&&C.children&&C.children.length===0&&u.jsx("p",{className:"text-xs text-muted-foreground italic p-1",children:"Папка пуста"})]})]},C.path)}return u.jsxs(Sq,{children:[u.jsx(Cq,{children:A}),u.jsxs(DR,{children:[u.jsxs(Ra,{onClick:()=>i(C),children:[u.jsx(Fd,{className:"h-4 w-4 mr-2"}),"Создать файл"]}),u.jsxs(Ra,{onClick:()=>s(C),children:[u.jsx(ys,{className:"h-4 w-4 mr-2"}),"Создать папку"]}),u.jsx(pV,{}),u.jsxs(Ra,{onClick:()=>a(C),children:[u.jsx(Eh,{className:"h-4 w-4 mr-2"}),"Переименовать"]}),u.jsxs(Ra,{className:"text-destructive",onClick:()=>o(C),children:[u.jsx(Th,{className:"h-4 w-4 mr-2"}),"Удалить"]})]})]},C.path)},M=l!=null&&l.node?l.node.type==="folder"?l.node.path:ds.dirname(l.node.path):null,b=(l==null?void 0:l.mode.startsWith("create"))&&(M==="."||M==="");return u.jsxs(Sq,{children:[u.jsx(Cq,{children:u.jsxs("div",{className:"p-2 select-none h-full",children:[e.map(x),b&&u.jsx("div",{className:"pl-4 border-l-transparent ml-2",children:u.jsx(Lq,{onCommit:d,onCancel:h,type:l.mode==="createFile"?"file":"folder"})}),!l&&e.length===0&&u.jsxs("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground p-4 text-center",children:["Правый клик, ",u.jsx("br",{})," чтобы создать файл или папку."]})]})}),u.jsxs(DR,{children:[u.jsxs(Ra,{onClick:()=>i({path:"",type:"folder",name:"root"}),children:[u.jsx(Fd,{className:"h-4 w-4 mr-2"}),"Создать файл в корне"]}),u.jsxs(Ra,{onClick:()=>s({path:"",type:"folder",name:"root"}),children:[u.jsx(ys,{className:"h-4 w-4 mr-2"}),"Создать папку в корне"]})]})]})};function eqt({botId:e,pluginName:t}){var m;const[n,o]=k.useState(null),[a,i]=k.useState(!0),[s,l]=k.useState(!1);k.useEffect(()=>{(async()=>{i(!0);try{const x=await Ne(`/api/bots/${e}/plugins/ide/${t}/manifest`);o(x)}catch{Vt({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить manifest."})}finally{i(!1)}})()},[e,t]);const d=async()=>{var v;l(!0);try{await Ne(`/api/bots/${e}/plugins/ide/${t}/manifest`,{method:"POST",body:JSON.stringify({name:n.name,version:n.version,description:n.description,author:n.author,repositoryUrl:n.repositoryUrl||((v=n.repository)==null?void 0:v.url)||""})}),Vt({title:"Успех!",description:"package.json успешно обновлен."})}catch{Vt({variant:"destructive",title:"Ошибка",description:"Не удалось сохранить manifest."})}finally{l(!1)}};if(a)return u.jsx("div",{className:"p-4 flex justify-center items-center",children:u.jsx(It,{className:"animate-spin"})});if(!n)return u.jsx("div",{className:"p-4 text-center text-muted-foreground",children:"Не удалось загрузить package.json"});const h=v=>{const{id:x,value:M}=v.target;o(b=>({...b,[x]:M}))},p=v=>{const x=v.target.value;o(M=>({...M,repositoryUrl:x}))};return u.jsxs("div",{className:"p-4 space-y-4",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{htmlFor:"version",children:"Версия"}),u.jsx(Ze,{id:"version",value:n.version||"",onChange:h})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{htmlFor:"description",children:"Описание"}),u.jsx(ki,{id:"description",value:n.description||"",onChange:h})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{htmlFor:"author",children:"Автор"}),u.jsx(Ze,{id:"author",value:n.author||"",onChange:h})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{htmlFor:"repositoryUrl",children:"URL репозитория"}),u.jsx(Ze,{id:"repositoryUrl",placeholder:"https://github.com/user/repo.git",value:((m=n.repository)==null?void 0:m.url)||n.repositoryUrl||"",onChange:p}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Нужен для создания Pull Request'ов в оригинальный репозиторий"})]}),u.jsxs(pe,{onClick:d,disabled:s,children:[s&&u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}),"Сохранить package.json"]})]})}function tqt(){const{botId:e,pluginName:t}=gi(),[n,o]=k.useState([]),[a,i]=k.useState(null),[s,l]=k.useState(""),[d,h]=k.useState(!1),[p,m]=k.useState(!0),[v,x]=k.useState(null),[M,b]=k.useState(null),[C,_]=k.useState(!1),[N,A]=k.useState({branch:`feature/local-changes-${new Date().toISOString().slice(0,16).replace(/[:-]/g,"-")}`,commitMessage:"Changes from local edit",originalRepo:""}),[I,R]=k.useState(!1),j=k.useCallback(async()=>{m(!0);try{const V=await Ne(`/api/bots/${e}/plugins/ide/${t}/structure`);o(V)}catch{Vt({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить структуру плагина."})}finally{m(!1)}},[e,t]);k.useEffect(()=>{j()},[j]);const D=async V=>{if(!(d&&!window.confirm("У вас есть несохраненные изменения. Вы уверены, что хотите продолжить?")))try{const L=await fetch(`/api/bots/${e}/plugins/ide/${t}/file?path=${encodeURIComponent(V.path)}`,{headers:{Authorization:`Bearer ${je.getState().token}`}});if(!L.ok)throw new Error(`HTTP error! status: ${L.status}`);const Y=await L.text();i(V),l(Y),h(!1)}catch(L){console.error("Failed to load file content:",L),Vt({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить файл."})}},H=async(V,L,Y="")=>{try{return await Ne(`/api/bots/${e}/plugins/ide/${t}/fs`,{method:"POST",body:JSON.stringify({operation:V,path:L,newPath:Y})}),await j(),Vt({title:"Успех!",description:`Операция "${V}" для "${L}" выполнена.`}),!0}catch(F){return Vt({variant:"destructive",title:"Ошибка",description:`Не удалось выполнить операцию: ${F.message}`}),!1}},U=async()=>{v&&(await H("delete",v.path),a&&a.path.startsWith(v.path)&&(i(null),l("")),x(null))},z=(V,L)=>{b({mode:V,node:L})},Z=()=>{b(null)},q=async V=>{if(!M||!V){b(null);return}const{mode:L,node:Y}=M;let F=!1;if(L==="rename"){if(V===Y.name){b(null);return}const T=ds.join(ds.dirname(Y.path),V);if(F=await H("rename",Y.path,T),F&&a&&a.path.startsWith(Y.path)){const K=a.path.replace(Y.path,T);i(Q=>({...Q,path:K,name:ds.basename(K)}))}}else if(L==="createFile"||L==="createFolder"){const T=Y.type==="folder"?Y.path:ds.dirname(Y.path),K=ds.join(T,V);F=await H(L==="createFile"?"createFile":"createFolder",K)}b(null),F&&await j()},G=async()=>{if(!(!a||!d))try{await Ne(`/api/bots/${e}/plugins/ide/${t}/file`,{method:"POST",body:JSON.stringify({path:a.path,content:s})}),h(!1),Vt({title:"Успех",description:`Файл ${a.name} сохранен.`})}catch{Vt({variant:"destructive",title:"Ошибка",description:"Не удалось сохранить файл."})}},E=V=>{switch(V.split(".").pop()){case"js":return"javascript";case"json":return"json";case"md":return"markdown";default:return"plaintext"}},O=k.useCallback(async()=>{try{return await Ne(`/api/bots/${e}/plugins/ide/${t}/manifest`)}catch{return Vt({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить manifest."}),null}},[e,t]),P=async()=>{var Y;const V=await O(),L=((Y=V==null?void 0:V.repository)==null?void 0:Y.url)||"";A(F=>({...F,originalRepo:L})),_(!0)},X=V=>{A(L=>({...L,[V.target.name]:V.target.value}))},W=async()=>{R(!0);try{const V=await Ne(`/api/bots/${e}/plugins/ide/${t}/create-pr`,{method:"POST",body:JSON.stringify({branch:N.branch,commitMessage:N.commitMessage,repositoryUrl:N.originalRepo})});console.log("PR Response:",V),V.success?(console.log("Opening PR URL:",V.prUrl),window.open(V.prUrl,"_blank")?Vt({title:"Успех",description:V.message||"PR успешно создан и открыт."}):(console.warn("Popup blocked by browser"),Vt({title:"PR создан",description:`${V.message}. Откройте ссылку: ${V.prUrl}`,duration:1e4})),_(!1)):Vt({variant:"destructive",title:"Ошибка",description:"Неожиданный ответ от сервера"})}catch(V){console.error("PR Error:",V),Vt({variant:"destructive",title:"Ошибка",description:V.message})}finally{R(!1)}};return u.jsxs("div",{className:"h-full w-full flex flex-col p-4 gap-4",children:[u.jsxs("header",{className:"flex justify-between items-center",children:[u.jsxs("div",{children:[u.jsxs("h1",{className:"text-2xl font-bold",children:["Редактор плагина: ",t]}),u.jsxs("p",{className:"text-muted-foreground",children:["Редактирование для бота #",e]})]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsxs(pe,{onClick:P,children:[u.jsx(ms,{className:"h-4 w-4 mr-2"}),"Создать PR"]}),u.jsxs(pe,{onClick:G,disabled:!d||!a,children:[u.jsx(si,{className:"h-4 w-4 mr-2"}),"Сохранить"]})]})]}),u.jsxs(PF,{direction:"horizontal",className:"flex-grow rounded-lg border",children:[u.jsx(li,{defaultSize:20,minSize:15,children:u.jsxs(Nn,{className:"h-full m-1 rounded-lg flex flex-col",children:[u.jsx(kn,{className:"p-2 border-b",children:u.jsx(xn,{className:"text-base p-2",children:"Файлы"})}),u.jsx(Ln,{className:"p-0 flex-grow",children:p?u.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:"Загрузка..."}):u.jsx(JOt,{structure:n,onSelectFile:D,selectedFile:a,onDelete:x,onRename:V=>z("rename",V),onCreateFile:V=>z("createFile",V),onCreateFolder:V=>z("createFolder",V),inlineAction:M,onCommit:q,onCancel:Z})})]})}),u.jsx(t2,{withHandle:!0}),u.jsx(li,{defaultSize:55,minSize:30,children:u.jsx(wB,{height:"calc(100vh - 120px)",language:a?E(a.name):"plaintext",value:s||"",onChange:V=>{l(V),h(!0)},theme:"vs-dark",options:{minimap:{enabled:!1}}})}),u.jsx(t2,{withHandle:!0}),u.jsx(li,{defaultSize:25,minSize:20,children:u.jsxs(Nn,{className:"h-full m-1 rounded-lg",children:[u.jsx(kn,{className:"p-2 border-b",children:u.jsx(xn,{className:"text-base p-2",children:"package.json"})}),u.jsx(Ln,{className:"overflow-y-auto",children:u.jsx(eqt,{botId:e,pluginName:t})})]})})]}),v&&u.jsx($s,{open:!!v,onOpenChange:()=>x(null),title:`Удалить ${v.type==="folder"?"папку":"файл"} "${v.name}"?`,description:"Это действие необратимо. Все содержимое будет удалено.",onConfirm:U,confirmText:"Да, удалить"}),u.jsx(Jt,{open:C,onOpenChange:_,children:u.jsxs(Wt,{children:[u.jsx(on,{children:u.jsx(en,{children:"Создать Pull Request"})}),u.jsxs("div",{className:"space-y-4 py-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"originalRepo",children:"URL репозитория"}),u.jsx(Ze,{id:"originalRepo",name:"originalRepo",value:N.originalRepo,onChange:X,placeholder:"https://github.com/user/repo.git"}),N.originalRepo&&u.jsx("div",{className:"text-sm text-muted-foreground",children:"Изменения будут отправлены в новую ветку этого репозитория"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"branch",children:"Название ветки"}),u.jsx(Ze,{id:"branch",name:"branch",value:N.branch,onChange:X})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"commitMessage",children:"Сообщение коммита"}),u.jsx(Ze,{id:"commitMessage",name:"commitMessage",value:N.commitMessage,onChange:X})]})]}),u.jsx(an,{children:u.jsx(pe,{onClick:W,disabled:I||!N.branch||!N.originalRepo,children:I?"Создание...":"Создать и открыть PR"})})]})})]})}function nqt({server:e,onSubmit:t,onCancel:n,isSaving:o}){const[a,i]=k.useState({name:"",host:"",port:"25565",version:""});k.useEffect(()=>{var h;e&&i({name:e.name||"",host:e.host||"",port:((h=e.port)==null?void 0:h.toString())||"25565",version:e.version||""})},[e]);const s=h=>{const{name:p,value:m}=h.target;i(v=>({...v,[p]:m}))},l=h=>{h.preventDefault(),t(a)},d=!!e;return u.jsxs(Wt,{children:[u.jsxs(on,{children:[u.jsx(en,{children:d?"Редактировать сервер":"Добавить новый сервер"}),u.jsx(dn,{children:"Заполните информацию о сервере. Эти данные будут доступны при создании ботов."})]}),u.jsxs("form",{id:"server-form",onSubmit:l,className:"space-y-4 py-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"name",children:"Название сервера"}),u.jsx(Ze,{id:"name",name:"name",value:a.name,onChange:s,placeholder:"Например, mineblaze",required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"host",children:"Адрес (хост)"}),u.jsx(Ze,{id:"host",name:"host",value:a.host,onChange:s,placeholder:"mc.mineblaze.net",required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"port",children:"Порт"}),u.jsx(Ze,{id:"port",name:"port",type:"number",value:a.port,onChange:s,placeholder:"25565"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"version",children:"Версия Minecraft"}),u.jsx(Ze,{id:"version",name:"version",value:a.version,onChange:s,placeholder:"1.20.1 самая стабильная",required:!0})]})]}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:n,children:"Отмена"}),u.jsx(pe,{type:"submit",form:"server-form",disabled:o,children:o?"Сохранение...":d?"Сохранить":"Создать"})]})]})}function oqt(){const e=je(C=>C.servers),t=je(C=>C.fetchInitialData),[n,o]=k.useState(!0),[a,i]=k.useState(!1),[s,l]=k.useState(null),[d,h]=k.useState(null),[p,m]=k.useState(!1);Yt(),k.useEffect(()=>{if(e&&e.length>0)o(!1);else{const _=setTimeout(()=>{const N=je.getState().servers;(!N||N.length===0)&&o(!1)},2e3);return()=>clearTimeout(_)}},[e]);const v=(C=null)=>{l(C),i(!0)},x=()=>{i(!1),l(null)},M=async C=>{m(!0);const _=!!s,N=_?`/api/servers/${s.id}`:"/api/servers",A=_?"PUT":"POST";try{await Ne(N,{method:A,body:JSON.stringify(C)},`Сервер успешно ${_?"обновлен":"создан"}.`),x(),await t()}catch{}m(!1)},b=async()=>{if(d)try{await Ne(`/api/servers/${d.id}`,{method:"DELETE"},"Сервер удален."),await t()}catch{}};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"p-4 h-full",children:u.jsxs(Nn,{className:"h-full flex flex-col",children:[u.jsxs(kn,{className:"flex flex-row items-center justify-between",children:[u.jsxs("div",{children:[u.jsx(xn,{children:"Управление серверами"}),u.jsx(Qn,{children:"Добавляйте и редактируйте серверы, к которым будут подключаться боты."})]}),u.jsxs(Jt,{open:a,onOpenChange:i,children:[u.jsx(Ua,{asChild:!0,children:u.jsxs(pe,{onClick:()=>v(),children:[u.jsx(xr,{className:"mr-2 h-4 w-4"}),"Добавить сервер"]})}),u.jsx(nqt,{server:s,onSubmit:M,onCancel:x,isSaving:p})]})]}),u.jsx(Ln,{className:"flex-grow overflow-y-auto",children:u.jsxs(Ca,{children:[u.jsx(Na,{children:u.jsxs(Nt,{children:[u.jsx(st,{children:"Название"}),u.jsx(st,{children:"Адрес"}),u.jsx(st,{children:"Версия"}),u.jsx(st,{className:"text-right",children:"Действия"})]})}),u.jsx(La,{children:n?u.jsx(Nt,{children:u.jsx(Xe,{colSpan:4,className:"text-center h-24",children:u.jsxs("div",{className:"flex justify-center items-center",children:[u.jsx(It,{className:"mr-2 h-6 w-6 animate-spin"}),"Загрузка серверов..."]})})}):e.length>0?e.map(C=>u.jsxs(Nt,{children:[u.jsx(Xe,{className:"font-medium",children:C.name}),u.jsxs(Xe,{children:[C.host,":",C.port]}),u.jsx(Xe,{children:C.version}),u.jsxs(Xe,{className:"text-right",children:[u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>v(C),children:u.jsx(pn,{className:"h-4 w-4"})}),u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>h(C),children:u.jsx(mo,{className:"h-4 w-4 text-destructive"})})]})]},C.id)):u.jsx(Nt,{children:u.jsx(Xe,{colSpan:4,className:"text-center h-24 text-muted-foreground",children:"Серверы не найдены. Добавьте свой первый сервер."})})})]})})]})}),d&&u.jsx($s,{open:!!d,onOpenChange:()=>h(null),title:`Удалить сервер "${d.name}"?`,description:"Это действие необратимо. Если к этому серверу привязаны боты, вы не сможете его удалить.",onConfirm:b,confirmText:"Да, удалить"})]})}var F$="Popover",[zue,Yqt]=zn(F$,[Ts]),Op=Ts(),[aqt,Os]=zue(F$),Oue=e=>{const{__scopePopover:t,children:n,open:o,defaultOpen:a,onOpenChange:i,modal:s=!1}=e,l=Op(t),d=k.useRef(null),[h,p]=k.useState(!1),[m,v]=go({prop:o,defaultProp:a??!1,onChange:i,caller:F$});return u.jsx(GP,{...l,children:u.jsx(aqt,{scope:t,contentId:Dn(),triggerRef:d,open:m,onOpenChange:v,onOpenToggle:k.useCallback(()=>v(x=>!x),[v]),hasCustomAnchor:h,onCustomAnchorAdd:k.useCallback(()=>p(!0),[]),onCustomAnchorRemove:k.useCallback(()=>p(!1),[]),modal:s,children:n})})};Oue.displayName=F$;var que="PopoverAnchor",rqt=k.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,a=Os(que,n),i=Op(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:l}=a;return k.useEffect(()=>(s(),()=>l()),[s,l]),u.jsx(vp,{...i,...o,ref:t})});rqt.displayName=que;var Hue="PopoverTrigger",Vue=k.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,a=Os(Hue,n),i=Op(n),s=ot(t,a.triggerRef),l=u.jsx(Ae.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Xue(a.open),...o,ref:s,onClick:Me(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?l:u.jsx(vp,{asChild:!0,...i,children:l})});Vue.displayName=Hue;var KF="PopoverPortal",[iqt,sqt]=zue(KF,{forceMount:void 0}),Bue=e=>{const{__scopePopover:t,forceMount:n,children:o,container:a}=e,i=Os(KF,t);return u.jsx(iqt,{scope:t,forceMount:n,children:u.jsx(jn,{present:n||i.open,children:u.jsx(y1,{asChild:!0,container:a,children:o})})})};Bue.displayName=KF;var n2="PopoverContent",Fue=k.forwardRef((e,t)=>{const n=sqt(n2,e.__scopePopover),{forceMount:o=n.forceMount,...a}=e,i=Os(n2,e.__scopePopover);return u.jsx(jn,{present:o||i.open,children:i.modal?u.jsx(lqt,{...a,ref:t}):u.jsx(uqt,{...a,ref:t})})});Fue.displayName=n2;var cqt=Cs("PopoverContent.RemoveScroll"),lqt=k.forwardRef((e,t)=>{const n=Os(n2,e.__scopePopover),o=k.useRef(null),a=ot(t,o),i=k.useRef(!1);return k.useEffect(()=>{const s=o.current;if(s)return DP(s)},[]),u.jsx(pp,{as:cqt,allowPinchZoom:!0,children:u.jsx(Uue,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Me(e.onCloseAutoFocus,s=>{var l;s.preventDefault(),i.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Me(e.onPointerDownOutside,s=>{const l=s.detail.originalEvent,d=l.button===0&&l.ctrlKey===!0,h=l.button===2||d;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:Me(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),uqt=k.forwardRef((e,t)=>{const n=Os(n2,e.__scopePopover),o=k.useRef(!1),a=k.useRef(!1);return u.jsx(Uue,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,l;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(o.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),o.current=!1,a.current=!1},onInteractOutside:i=>{var d,h;(d=e.onInteractOutside)==null||d.call(e,i),i.defaultPrevented||(o.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=i.target;((h=n.triggerRef.current)==null?void 0:h.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),Uue=k.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:o,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:p,...m}=e,v=Os(n2,n),x=Op(n);return PP(),u.jsx(fp,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:a,onUnmountAutoFocus:i,children:u.jsx(p1,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:p,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:h,onDismiss:()=>v.onOpenChange(!1),children:u.jsx(XP,{"data-state":Xue(v.open),role:"dialog",id:v.contentId,...x,...m,ref:t,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Gue="PopoverClose",dqt=k.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,a=Os(Gue,n);return u.jsx(Ae.button,{type:"button",...o,ref:t,onClick:Me(e.onClick,()=>a.onOpenChange(!1))})});dqt.displayName=Gue;var hqt="PopoverArrow",fqt=k.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,a=Op(n);return u.jsx(ZP,{...a,...o,ref:t})});fqt.displayName=hqt;function Xue(e){return e?"open":"closed"}var pqt=Oue,yqt=Vue,mqt=Bue,Zue=Fue;const gqt=pqt,vqt=yqt,Yue=k.forwardRef(({className:e,align:t="center",sideOffset:n=4,...o},a)=>u.jsx(mqt,{children:u.jsx(Zue,{ref:a,align:t,sideOffset:n,className:ge("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",e),...o})}));Yue.displayName=Zue.displayName;const kqt=[{value:"START_BOT",label:"Запустить бота"},{value:"STOP_BOT",label:"Остановить бота"},{value:"RESTART_BOT",label:"Перезапустить бота"},{value:"SEND_COMMAND",label:"Отправить команду"}],xqt=[{value:"START_BOT",label:"Запустить бота"}],vJ=e=>{const{intervalType:t,intervalValue:n,time:o}=e,[a,i]=o.split(":").map(Number);if(t==="minutes"){const s=n===1?"*":`*/${n}`;return n>0&&n<60?`${s} * * * *`:"* * * * *"}if(t==="hours"){const s=n===1?"*":`*/${n}`;return n>0&&n<24?`${i} ${s} * * *`:`${i} * * * *`}if(t==="days"){const s=n===1?"*":`*/${n}`;return n>0&&n<32?`${i} ${a} ${s} * *`:`${i} ${a} * * *`}return"* * * * *"};function wqt({task:e,onSubmit:t,onCancel:n,isSaving:o}){const a=je(Z=>Z.bots),[i,s]=k.useState(""),[l,d]=k.useState(""),[h,p]=k.useState([]),[m,v]=k.useState(""),[x,M]=k.useState(!1),[b,C]=k.useState(!1),[_,N]=k.useState(!1),[A,I]=k.useState("* * * * *"),[R,j]=k.useState({intervalType:"days",intervalValue:1,time:"12:00"});k.useEffect(()=>{_||I(vJ(R))},[R,_]),k.useEffect(()=>{b&&d("START_BOT")},[b]),k.useEffect(()=>{if(e)s(e.name),d(e.action),p(JSON.parse(e.targetBotIds||"[]")),v(JSON.parse(e.payload||"{}").command||""),I(e.cronPattern),C(e.runOnStartup||!1),N(!!e.cronPattern);else{s(""),d("SEND_COMMAND"),p([]),v(""),C(!1),N(!1);const Z={intervalType:"days",intervalValue:1,time:"12:00"};j(Z),I(vJ(Z))}},[e]);const D=(Z,q)=>{j(G=>({...G,[Z]:q}))},H=Z=>{Z.preventDefault();const q=l==="SEND_COMMAND"?{command:m}:{};t({name:i,cronPattern:b?null:A,action:l,targetBotIds:JSON.stringify(h),payload:JSON.stringify(q),runOnStartup:b})},U=[{id:"ALL",username:"Все боты"},...a],z=b?xqt:kqt;return u.jsxs(Wt,{className:"max-w-2xl",children:[u.jsxs(on,{children:[u.jsx(en,{children:e?"Редактировать задачу":"Создать новую задачу"}),u.jsx(dn,{children:b?"Эта задача будет выполнена один раз при каждом запуске панели.":"Задачи выполняются по расписанию для выбранных ботов."})]}),u.jsxs("form",{id:"task-form",onSubmit:H,className:"space-y-6 py-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"name",children:"Название задачи"}),u.jsx(Ze,{id:"name",value:i,onChange:Z=>s(Z.target.value),required:!0})]}),u.jsxs("div",{className:"flex items-center space-x-2 rounded-lg border p-3 shadow-sm",children:[u.jsx(na,{id:"runOnStartup",checked:b,onCheckedChange:C}),u.jsxs("div",{className:"grid gap-1.5 leading-none",children:[u.jsx(_e,{htmlFor:"runOnStartup",children:"Выполнять при запуске панели"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Задача будет выполнена один раз при каждом старте/перезапуске панели."})]})]}),!b&&u.jsxs("div",{className:"space-y-3 p-4 border rounded-lg",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx(_e,{children:"Расписание"}),u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(_e,{htmlFor:"advanced-mode",className:"text-sm",children:"Продвинутый режим"}),u.jsx(na,{id:"advanced-mode",checked:_,onCheckedChange:N})]})]}),_?u.jsxs("div",{children:[u.jsx(Ze,{value:A,onChange:Z=>I(Z.target.value),placeholder:"* * * * *",required:!0}),u.jsx("a",{href:"https://crontab.guru/",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:underline mt-1 inline-block",children:"Помощь по cron-паттернам"})]}):u.jsxs("div",{className:"grid grid-cols-3 gap-2 items-end",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{children:"Повторять каждые"}),u.jsx(Ze,{type:"number",min:"1",value:R.intervalValue,onChange:Z=>D("intervalValue",parseInt(Z.target.value)||1)})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{children:" "}),u.jsxs(Wn,{value:R.intervalType,onValueChange:Z=>D("intervalType",Z),children:[u.jsx(Fn,{children:u.jsx(Kn,{})}),u.jsxs(Un,{children:[u.jsx(et,{value:"minutes",children:"Минут"}),u.jsx(et,{value:"hours",children:"Часов"}),u.jsx(et,{value:"days",children:"Дней"})]})]})]}),u.jsxs("div",{className:"space-y-1",children:[u.jsx(_e,{children:"Время запуска"}),u.jsx(Ze,{type:"time",value:R.time,onChange:Z=>D("time",Z.target.value),disabled:R.intervalType==="minutes"})]})]})]}),u.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{children:"Действие"}),u.jsxs(Wn,{value:l,onValueChange:d,required:!0,disabled:b,children:[u.jsx(Fn,{children:u.jsx(Kn,{placeholder:"Выберите действие"})}),u.jsx(Un,{children:z.map(Z=>u.jsx(et,{value:Z.value,children:Z.label},Z.value))})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{children:"Целевые боты"}),u.jsxs(gqt,{open:x,onOpenChange:M,children:[u.jsx(vqt,{asChild:!0,children:u.jsxs(pe,{variant:"outline",role:"combobox","aria-expanded":x,className:"w-full justify-between",children:[h.length>0?`${h.length} выбрано`:"Выберите ботов...",u.jsx(Jf,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),u.jsx(Yue,{className:"w-[300px] p-0",children:u.jsxs(xp,{children:[u.jsx(wp,{placeholder:"Поиск ботов..."}),u.jsxs(bp,{children:[u.jsx(Mp,{children:"Боты не найдены."}),u.jsx(hs,{children:U.map(Z=>u.jsxs(yr,{value:Z.username,onSelect:()=>{const q=h.includes(Z.id);if(Z.id==="ALL")p(q?[]:["ALL"]);else{let G=q?h.filter(E=>E!==Z.id):[...h,Z.id];G=G.filter(E=>E!=="ALL"),p(G)}},children:[u.jsx(ri,{className:ge("mr-2 h-4 w-4",h.includes(Z.id)?"opacity-100":"opacity-0")}),Z.username]},Z.id))})]})]})})]})]})]}),l==="SEND_COMMAND"&&u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"command",children:"Команда для отправки"}),u.jsx(Ze,{id:"command",value:m,onChange:Z=>v(Z.target.value),placeholder:"Привет, мир!",required:!0})]})]}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:n,children:"Отмена"}),u.jsx(pe,{type:"submit",form:"task-form",disabled:o,children:o?"Сохранение...":"Сохранить"})]})]})}const jq=new Map,bqt=({pattern:e,isEnabled:t,runOnStartup:n})=>{const[o,a]=k.useState({nextRun:"...",human:"..."});return k.useEffect(()=>{(async()=>{if(!t){a({nextRun:"Отключено",human:"Отключено"});return}if(n&&!e){a({nextRun:"При старте",human:"Выполняется при запуске панели"});return}if(!e){a({nextRun:"n/a",human:"Нет расписания"});return}const s=e;if(jq.has(s)){a(jq.get(s));return}try{const l=await Ne("/api/tasks/describe",{method:"POST",body:JSON.stringify({pattern:e})}),d={nextRun:l.next,human:l.human};jq.set(s,d),a(d)}catch(l){console.error(`Ошибка получения описания для "${e}":`,l),a({nextRun:u.jsx("span",{className:"text-destructive",children:"Ошибка"}),human:e})}})()},[e,t]),u.jsxs(u.Fragment,{children:[u.jsx(Xe,{children:u.jsxs("div",{className:"flex flex-col",children:[u.jsx("span",{children:o.human}),e&&u.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:e})]})}),u.jsx(Xe,{children:o.nextRun})]})};function Mqt(){const{tasks:e,fetchTasks:t,createTask:n,updateTask:o,deleteTask:a}=je(),[i,s]=k.useState(!0),[l,d]=k.useState(!1),[h,p]=k.useState(null),[m,v]=k.useState(!1),[x,M]=k.useState(null),b=j=>typeof j!="string"?"* * * * *":j.replace(/\*\/1/g,"*").trim();k.useEffect(()=>{s(!0),t().finally(()=>s(!1))},[t]);const C=(j=null)=>{p(j),d(!0)},_=()=>{d(!1),p(null)},N=async j=>{v(!0);const D={...j,cronPattern:b(j.cronPattern)};h?await o(h.id,D):await n(D),v(!1),_()},A=async()=>{x&&(await a(x.id),M(null))},I=async(j,D)=>{const H={...j,isEnabled:D};delete H.id,await o(j.id,H)},R={START_BOT:"Запустить бота",STOP_BOT:"Остановить бота",RESTART_BOT:"Перезапустить бота",SEND_COMMAND:"Отправить команду"};return u.jsxs("div",{className:"p-4 h-full",children:[u.jsxs(Nn,{className:"h-full flex flex-col",children:[u.jsxs(kn,{className:"flex flex-row items-center justify-between",children:[u.jsxs("div",{children:[u.jsx(xn,{children:"Планировщик задач"}),u.jsx(Qn,{children:"Автоматизируйте действия ботов с помощью cron-задач."})]}),u.jsxs(Jt,{open:l,onOpenChange:d,children:[u.jsx(Ua,{asChild:!0,children:u.jsxs(pe,{onClick:()=>C(),children:[u.jsx(xr,{className:"mr-2 h-4 w-4"}),"Создать задачу"]})}),u.jsx(wqt,{task:h,onSubmit:N,onCancel:_,isSaving:m})]})]}),u.jsx(Ln,{className:"flex-grow overflow-y-auto",children:u.jsxs(Ca,{children:[u.jsx(Na,{children:u.jsxs(Nt,{children:[u.jsx(st,{className:"w-[80px]",children:"Статус"}),u.jsx(st,{children:"Название"}),u.jsx(st,{children:"Расписание"}),u.jsx(st,{children:"Следующий запуск"}),u.jsx(st,{children:"Действие"}),u.jsx(st,{className:"text-right",children:"Действия"})]})}),u.jsx(La,{children:i?u.jsx(Nt,{children:u.jsx(Xe,{colSpan:6,className:"text-center h-24",children:u.jsx(It,{className:"mx-auto h-6 w-6 animate-spin"})})}):e.length>0?e.map(j=>u.jsxs(Nt,{children:[u.jsx(Xe,{children:u.jsx(na,{checked:j.isEnabled,onCheckedChange:D=>I(j,D)})}),u.jsx(Xe,{className:"font-medium",children:j.name}),u.jsx(bqt,{pattern:j.cronPattern,isEnabled:j.isEnabled,runOnStartup:j.runOnStartup}),u.jsx(Xe,{children:u.jsx(Xt,{variant:"secondary",children:R[j.action]||j.action})}),u.jsxs(Xe,{className:"text-right",children:[u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>C(j),children:u.jsx(pn,{className:"h-4 w-4"})}),u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>M(j),children:u.jsx(mo,{className:"h-4 w-4 text-destructive"})})]})]},j.id)):u.jsx(Nt,{children:u.jsx(Xe,{colSpan:6,className:"text-center h-24 text-muted-foreground",children:"Задачи не найдены."})})})]})})]}),u.jsx($s,{open:!!x,onOpenChange:()=>M(null),title:`Удалить задачу "${x==null?void 0:x.name}"?`,description:"Это действие необратимо и приведет к удалению задачи из расписания.",onConfirm:A,confirmText:"Да, удалить"})]})}function _qt({user:e,roles:t,onSubmit:n,onCancel:o,isSaving:a}){const[i,s]=k.useState(""),[l,d]=k.useState(""),[h,p]=k.useState(""),{toast:m}=Yt(),v=!!e;k.useEffect(()=>{v?(s(e.username),p(e.roleId.toString()),d("")):(s(""),d(""),p(t.length>0?t[0].id.toString():""))},[e,t,v]);const x=M=>{if(M.preventDefault(),!i||!h){m({variant:"destructive",title:"Ошибка",description:"Имя пользователя и роль обязательны."});return}if(!v&&(!l||l.length<4)){m({variant:"destructive",title:"Ошибка",description:"Пароль (мин. 4 символа) обязателен для нового пользователя."});return}if(v&&l&&l.length<4){m({variant:"destructive",title:"Ошибка",description:"Новый пароль должен содержать не менее 4 символов."});return}const b={username:i,roleId:parseInt(h,10)};l&&(b.password=l),n(b,e==null?void 0:e.id)};return u.jsxs(Wt,{children:[u.jsxs(on,{children:[u.jsx(en,{children:v?"Редактировать пользователя":"Создать нового пользователя"}),u.jsx(dn,{children:v?`Редактирование данных для ${e.username}.`:"Заполните данные для создания новой учетной записи."})]}),u.jsxs("form",{id:"user-form",onSubmit:x,className:"space-y-4 py-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"username",children:"Имя пользователя"}),u.jsx(Ze,{id:"username",value:i,onChange:M=>s(M.target.value),required:!0,disabled:v})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"password",children:v?"Новый пароль (оставьте пустым, чтобы не менять)":"Пароль"}),u.jsx(Ze,{id:"password",type:"password",value:l,onChange:M=>d(M.target.value),placeholder:"••••••••"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"roleId",children:"Роль"}),u.jsxs(Wn,{value:h,onValueChange:p,required:!0,children:[u.jsx(Fn,{children:u.jsx(Kn,{placeholder:"Выберите роль..."})}),u.jsx(Un,{children:t.map(M=>u.jsx(et,{value:M.id.toString(),children:M.name},M.id))})]})]})]}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:o,children:"Отмена"}),u.jsx(pe,{type:"submit",form:"user-form",disabled:a,children:a?"Сохранение...":"Сохранить"})]})]})}function Sqt(){const[e,t]=k.useState([]),[n,o]=k.useState([]),[a,i]=k.useState(!0),[s,l]=k.useState(!1),[d,h]=k.useState(!1),[p,m]=k.useState(null),[v,x]=k.useState(null),{toast:M}=Yt(),b=je(R=>R.user),C=k.useCallback(async()=>{i(!0);try{const[R,j]=await Promise.all([Ne("/api/auth/users"),Ne("/api/auth/roles")]);t(R),o(j)}catch(R){console.error(R),M({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить данные."})}finally{i(!1)}},[M]);k.useEffect(()=>{C()},[C]);const _=(R=null)=>{m(R),h(!0)},N=()=>{h(!1),m(null)},A=async(R,j)=>{l(!0);const D=!!j,H=D?`/api/auth/users/${j}`:"/api/auth/users",U=D?"PUT":"POST";try{await Ne(H,{method:U,body:JSON.stringify(R)},`Пользователь успешно ${D?"обновлен":"создан"}.`),N(),C()}catch{}finally{l(!1)}},I=async()=>{if(v)try{await Ne(`/api/auth/users/${v.id}`,{method:"DELETE"},"Пользователь удален."),x(null),C()}catch{}};return u.jsxs(u.Fragment,{children:[u.jsxs(Nn,{className:"h-full flex flex-col",children:[u.jsx(kn,{children:u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsxs("div",{children:[u.jsx(xn,{children:"Пользователи панели"}),u.jsx(Qn,{children:"Управление учетными записями и их ролями."})]}),u.jsxs(pe,{onClick:()=>_(),children:[u.jsx(xr,{className:"mr-2 h-4 w-4"}),"Создать пользователя"]})]})}),u.jsx(Ln,{className:"flex-grow overflow-y-auto",children:u.jsxs(Ca,{children:[u.jsx(Na,{children:u.jsxs(Nt,{children:[u.jsx(st,{children:"Имя"}),u.jsx(st,{children:"Роль"}),u.jsx(st,{children:"Дата создания"}),u.jsx(st,{className:"text-right",children:"Действия"})]})}),u.jsx(La,{children:a?u.jsx(Nt,{children:u.jsx(Xe,{colSpan:4,className:"text-center h-24",children:u.jsx(It,{className:"animate-spin mx-auto"})})}):e.map(R=>u.jsxs(Nt,{children:[u.jsx(Xe,{className:"font-medium",children:R.username}),u.jsx(Xe,{children:R.role.name}),u.jsx(Xe,{children:new Date(R.createdAt).toLocaleDateString()}),u.jsxs(Xe,{className:"text-right",children:[u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>_(R),children:u.jsx(pn,{className:"h-4 w-4"})}),u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>x(R),disabled:R.id===b.id,children:u.jsx(mo,{className:"h-4 w-4 text-destructive"})})]})]},R.id))})]})})]}),u.jsx(Jt,{open:d,onOpenChange:h,children:u.jsx(_qt,{user:p,roles:n,onSubmit:A,onCancel:N,isSaving:s})}),u.jsx($s,{open:!!v,onOpenChange:()=>x(null),title:`Удалить пользователя "${v==null?void 0:v.username}"?`,description:"Это действие необратимо.",onConfirm:I,confirmText:"Да, удалить"})]})}function Cqt({role:e,allPermissions:t,onSubmit:n,onCancel:o,isSaving:a}){const[i,s]=k.useState(""),[l,d]=k.useState(new Set),{toast:h}=Yt(),p=!!e;k.useEffect(()=>{p?(s(e.name),d(new Set(e.permissions||[]))):(s(""),d(new Set))},[e,p]);const m=x=>{d(M=>{const b=new Set(M);return b.has(x)?b.delete(x):b.add(x),b})},v=x=>{if(x.preventDefault(),!i.trim()){h({variant:"destructive",title:"Ошибка",description:"Имя роли не может быть пустым."});return}n({name:i,permissions:Array.from(l)},e==null?void 0:e.id)};return u.jsxs(Wt,{className:"max-w-2xl",children:[u.jsxs(on,{children:[u.jsx(en,{children:p?"Редактировать роль":"Создать новую роль"}),u.jsx(dn,{children:"Укажите имя роли и выберите доступные ей права."})]}),u.jsx("form",{id:"role-form",onSubmit:v,className:"py-4",children:u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{htmlFor:"name",children:"Название роли"}),u.jsx(Ze,{id:"name",value:i,onChange:x=>s(x.target.value),required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(_e,{children:"Права доступа"}),u.jsx(f2,{className:"h-72 w-full rounded-md border p-4",children:u.jsx("div",{className:"space-y-2",children:t.map(x=>u.jsxs("div",{className:"flex items-center space-x-2",children:[u.jsx(ci,{id:`perm-${x.id}`,checked:l.has(x.id),onCheckedChange:()=>m(x.id)}),u.jsxs("label",{htmlFor:`perm-${x.id}`,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:[x.label," ",u.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",x.id,")"]})]})]},x.id))})})]})]})}),u.jsxs(an,{children:[u.jsx(pe,{variant:"ghost",onClick:o,children:"Отмена"}),u.jsx(pe,{type:"submit",form:"role-form",disabled:a,children:a?"Сохранение...":"Сохранить"})]})]})}function Nqt(){const[e,t]=k.useState([]),[n,o]=k.useState([]),[a,i]=k.useState(!0),[s,l]=k.useState(!1),[d,h]=k.useState(!1),[p,m]=k.useState(null),[v,x]=k.useState(null),{toast:M}=Yt(),b=k.useCallback(async()=>{i(!0);try{const[I,R]=await Promise.all([Ne("/api/auth/roles"),Ne("/api/auth/permissions")]);t(I),o(R)}catch(I){console.error(I),M({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить данные."})}finally{i(!1)}},[M]);k.useEffect(()=>{b()},[b]);const C=(I=null)=>{m(I),h(!0)},_=()=>{h(!1),m(null)},N=async(I,R)=>{l(!0);const j=!!R,D=j?`/api/auth/roles/${R}`:"/api/auth/roles",H=j?"PUT":"POST";try{await Ne(D,{method:H,body:JSON.stringify(I)},`Роль успешно ${j?"обновлена":"создана"}.`),_(),b()}catch{}finally{l(!1)}},A=async()=>{if(v)try{await Ne(`/api/auth/roles/${v.id}`,{method:"DELETE"},"Роль удалена."),x(null),b()}catch{}};return u.jsxs(u.Fragment,{children:[u.jsxs(Nn,{className:"h-full flex flex-col",children:[u.jsx(kn,{children:u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsxs("div",{children:[u.jsx(xn,{children:"Роли панели"}),u.jsx(Qn,{children:"Управление ролями и наборами их прав."})]}),u.jsxs(pe,{onClick:()=>C(),children:[u.jsx(xr,{className:"mr-2 h-4 w-4"}),"Создать роль"]})]})}),u.jsx(Ln,{className:"flex-grow overflow-y-auto",children:u.jsxs(Ca,{children:[u.jsx(Na,{children:u.jsxs(Nt,{children:[u.jsx(st,{children:"Название"}),u.jsx(st,{children:"Права"}),u.jsx(st,{className:"text-right",children:"Действия"})]})}),u.jsx(La,{children:a?u.jsx(Nt,{children:u.jsx(Xe,{colSpan:3,className:"text-center h-24",children:u.jsx(It,{className:"animate-spin mx-auto"})})}):e.map(I=>u.jsxs(Nt,{children:[u.jsx(Xe,{className:"font-medium",children:I.name}),u.jsx(Xe,{className:"max-w-md",children:u.jsx("div",{className:"flex flex-wrap gap-1",children:I.permissions.includes("*")?u.jsx(Xt,{children:"Все права"}):I.permissions.map(R=>u.jsx(Xt,{variant:"secondary",children:R},R))})}),u.jsxs(Xe,{className:"text-right",children:[u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>C(I),disabled:I.name==="Admin",children:u.jsx(pn,{className:"h-4 w-4"})}),u.jsx(pe,{variant:"ghost",size:"icon",onClick:()=>x(I),disabled:I.name==="Admin",children:u.jsx(mo,{className:"h-4 w-4 text-destructive"})})]})]},I.id))})]})})]}),u.jsx(Jt,{open:d,onOpenChange:_,children:u.jsx(Cqt,{role:p,allPermissions:n,onSubmit:N,onCancel:_,isSaving:s})}),u.jsx($s,{open:!!v,onOpenChange:()=>x(null),title:`Удалить роль "${v==null?void 0:v.name}"?`,description:"Это действие необратимо. Убедитесь, что эта роль не назначена ни одному пользователю.",onConfirm:A,confirmText:"Да, удалить"})]})}const Lqt=r2("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Wue=k.forwardRef(({className:e,variant:t,...n},o)=>u.jsx("div",{ref:o,role:"alert",className:ge(Lqt({variant:t}),e),...n}));Wue.displayName="Alert";const Kue=k.forwardRef(({className:e,...t},n)=>u.jsx("h5",{ref:n,className:ge("mb-1 font-medium leading-none tracking-tight",e),...t}));Kue.displayName="AlertTitle";const Que=k.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:ge("text-sm [&_p]:leading-relaxed",e),...t}));Que.displayName="AlertDescription";function jqt(){const[e,t]=k.useState(null),[n,o]=k.useState(!0),[a,i]=k.useState(!1),{toast:s}=Yt(),l=k.useCallback(async()=>{o(!0);try{const p=await Ne("/api/panel/settings");t({server:p.server||{allowExternalAccess:!1},telemetry:p.telemetry||{enabled:!0}})}catch{s({variant:"destructive",title:"Ошибка",description:"Не удалось загрузить глобальные настройки."})}finally{o(!1)}},[s]);k.useEffect(()=>{l()},[l]);const d=(p,m)=>{const[v,x]=p.split(".");t(M=>({...M,[v]:{...M[v],[x]:m}}))},h=async()=>{i(!0);try{await Ne("/api/panel/settings",{method:"PUT",body:JSON.stringify({allowExternalAccess:e.server.allowExternalAccess,telemetryEnabled:e.telemetry.enabled})},"Настройки сохранены. Перезапустите панель для применения.")}catch{}finally{i(!1)}};return n||!e?u.jsx("div",{className:"flex justify-center items-center h-full",children:u.jsx(It,{className:"h-6 w-6 animate-spin"})}):u.jsxs(Nn,{children:[u.jsxs(kn,{children:[u.jsx(xn,{children:"Глобальные настройки"}),u.jsx(Qn,{children:"Эти настройки влияют на работу всей панели. Изменения некоторых из них требуют перезапуска."})]}),u.jsxs(Ln,{className:"space-y-6",children:[u.jsxs(Wue,{children:[u.jsx(Yd,{className:"h-4 w-4"}),u.jsx(Kue,{children:"Требуется перезапуск"}),u.jsxs(Que,{children:["После сохранения настроек необходимо перезапустить панель, например, командой ",u.jsx("code",{children:"npx blockmine"})," в терминале."]})]}),u.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[u.jsxs("div",{children:[u.jsx(_e,{htmlFor:"external-access",className:"text-base font-medium",children:"Внешний доступ"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Разрешить доступ к панели из локальной сети или интернета."})]}),u.jsx(na,{id:"external-access",checked:e.server.allowExternalAccess,onCheckedChange:p=>d("server.allowExternalAccess",p)})]}),u.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[u.jsxs("div",{children:[u.jsx(_e,{htmlFor:"telemetry",className:"text-base font-medium",children:"Анонимная телеметрия"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Отправлять анонимную статистику (кол-во ботов, плагинов) для улучшения проекта."})]}),u.jsx(na,{id:"telemetry",checked:e.telemetry.enabled,onCheckedChange:p=>d("telemetry.enabled",p)})]}),u.jsx("div",{className:"flex justify-end",children:u.jsxs(pe,{onClick:h,disabled:a,children:[a?u.jsx(It,{className:"mr-2 h-4 w-4 animate-spin"}):u.jsx(si,{className:"mr-2 h-4 w-4"}),"Сохранить настройки"]})})]})]})}function Aqt(){return u.jsxs("div",{className:"h-full flex flex-col p-4",children:[u.jsx(kn,{className:"px-0",children:u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(Zd,{className:"w-8 h-8 text-primary"}),u.jsxs("div",{children:[u.jsx(xn,{children:"Администрирование"}),u.jsx(Qn,{children:"Управление пользователями, ролями и глобальными настройками панели."})]})]})}),u.jsxs(Np,{defaultValue:"users",className:"flex-grow flex flex-col",children:[u.jsxs(y2,{className:"mt-2",children:[u.jsx(Ao,{value:"users",children:"Пользователи"}),u.jsx(Ao,{value:"roles",children:"Роли"}),u.jsx(Ao,{value:"settings",children:"Глобальные настройки"})]}),u.jsx(Mr,{value:"users",className:"flex-grow min-h-0 mt-4",children:u.jsx(Sqt,{})}),u.jsx(Mr,{value:"roles",className:"flex-grow min-h-0 mt-4",children:u.jsx(Nqt,{})}),u.jsx(Mr,{value:"settings",className:"flex-grow min-h-0 mt-4",children:u.jsx(jqt,{})})]})]})}const Gi=({children:e,requiredPermission:t})=>{const n=je(s=>s.hasPermission),o=je(s=>s.authInitialized),{toast:a}=Yt(),i=n(t);return k.useEffect(()=>{o&&!i&&a({variant:"destructive",title:"Доступ запрещен",description:"У вас недостаточно прав для просмотра этой страницы."})},[i,o,a]),o?i?e:u.jsx(VR,{to:"/",replace:!0}):u.jsx("div",{className:"flex items-center justify-center h-full",children:u.jsx(It,{className:"h-6 w-6 animate-spin"})})};function Eqt(){const e=je(n=>n.authInitialized),t=je(n=>n.initializeAuth);return k.useEffect(()=>{e||t()},[e]),e?u.jsx(bV,{}):u.jsx("div",{className:"flex items-center justify-center h-screen bg-background",children:u.jsx(It,{className:"h-8 w-8 animate-spin text-primary"})})}function Iqt(){const e=je(s=>s.isAuthenticated),t=je(s=>s.needsSetup),n=je(s=>s.connectSocket),o=je(s=>s.disconnectSocket),a=je(s=>s.fetchInitialData),i=je(s=>s.fetchTasks);return k.useEffect(()=>(e&&(n(),a(),i()),()=>{o()}),[e,n,o,a,i]),t?u.jsx(VR,{to:"/setup",replace:!0}):e?u.jsx(KVe,{}):u.jsx(VR,{to:"/login",replace:!0})}const Tqt=cfe([{path:"/",element:u.jsx(Eqt,{}),children:[{path:"login",element:u.jsx(QVe,{})},{path:"setup",element:u.jsx(JVe,{})},{path:"/",element:u.jsx(Iqt,{}),children:[{index:!0,element:u.jsx(rBe,{})},{path:"bots/:botId",element:u.jsx(SBe,{}),children:[{index:!0,element:u.jsx(VR,{to:"console",replace:!0})},{path:"console",element:u.jsx(nMt,{})},{path:"plugins",element:u.jsx(i_t,{})},{path:"plugins/view/:pluginName",element:u.jsx(SOt,{})},{path:"plugins/edit/:pluginName",element:u.jsx(Gi,{requiredPermission:"plugin:develop",children:u.jsx(tqt,{})})},{path:"settings",element:u.jsx(L_t,{})},{path:"management",element:u.jsx(Gi,{requiredPermission:"management:view",children:u.jsx(LLt,{})})},{path:"commands/visual/:commandId",element:u.jsx(Gi,{requiredPermission:"management:edit",children:u.jsx(IQ,{})})},{path:"events",element:u.jsx(Gi,{requiredPermission:"management:edit",children:u.jsx(tPt,{})})},{path:"events/visual/:eventId",element:u.jsx(Gi,{requiredPermission:"management:edit",children:u.jsx(IQ,{})})}]},{path:"servers",element:u.jsx(Gi,{requiredPermission:"server:list",children:u.jsx(oqt,{})})},{path:"tasks",element:u.jsx(Gi,{requiredPermission:"task:list",children:u.jsx(Mqt,{})})},{path:"admin",element:u.jsx(Gi,{requiredPermission:"panel:user:list",children:u.jsx(Aqt,{})})}]}]}]);fhe.createRoot(document.getElementById("root")).render(u.jsx(k.StrictMode,{children:u.jsxs("div",{className:"text-foreground bg-background",children:[u.jsx(xfe,{router:Tqt}),u.jsx(KDe,{})]})}));