livedesk 0.1.199 → 0.1.201

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.
@@ -1,12 +0,0 @@
1
- import{r as Ab,a as m,K as Tb,S as Og,m as wm,H as tr,U as kb,N as tv,F as nv,b as Eb,R as Au,L as Jf,c as Db,C as Rb,d as Lb,e as _b,M as tl,f as ja,g as du,T as zb,h as So,i as Mo,X as em,j as tm,k as fu,l as vo,B as nm,n as yo,D as Nf,o as Ob,p as Af,q as Bb,A as Tf,s as Hb,E as Fb,t as Bg,W as Ib,u as Hg,v as Ks,w as kf,x as Ub,y as qb,V as Fg,z as av,G as lv,P as Ig,I as $b}from"./icons-hdfC7rT4.js";import{r as iv}from"./react-CChqyjkJ.js";import{c as Gb}from"./supabase-C7qjtLN3.js";(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))r(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function s(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(c){if(c.ep)return;c.ep=!0;const d=s(c);fetch(c.href,d)}})();var Ef={exports:{}},mo={};var Ug;function Yb(){if(Ug)return mo;Ug=1;var a=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function s(r,c,d){var h=null;if(d!==void 0&&(h=""+d),c.key!==void 0&&(h=""+c.key),"key"in c){d={};for(var p in c)p!=="key"&&(d[p]=c[p])}else d=c;return c=d.ref,{$$typeof:a,type:r,key:h,ref:c!==void 0?c:null,props:d}}return mo.Fragment=l,mo.jsx=s,mo.jsxs=s,mo}var qg;function Vb(){return qg||(qg=1,Ef.exports=Yb()),Ef.exports}var o=Vb(),Df={exports:{}},ho={},Rf={exports:{}},Lf={};var $g;function Pb(){return $g||($g=1,(function(a){function l(H,X){var te=H.length;H.push(X);e:for(;0<te;){var E=te-1>>>1,P=H[E];if(0<c(P,X))H[E]=X,H[te]=P,te=E;else break e}}function s(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var X=H[0],te=H.pop();if(te!==X){H[0]=te;e:for(var E=0,P=H.length,ne=P>>>1;E<ne;){var L=2*(E+1)-1,de=H[L],ve=L+1,ge=H[ve];if(0>c(de,te))ve<P&&0>c(ge,de)?(H[E]=ge,H[ve]=te,E=ve):(H[E]=de,H[L]=te,E=L);else if(ve<P&&0>c(ge,te))H[E]=ge,H[ve]=te,E=ve;else break e}}return X}function c(H,X){var te=H.sortIndex-X.sortIndex;return te!==0?te:H.id-X.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;a.unstable_now=function(){return d.now()}}else{var h=Date,p=h.now();a.unstable_now=function(){return h.now()-p}}var g=[],x=[],b=1,v=null,S=3,M=!1,C=!1,j=!1,k=!1,T=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,z=typeof setImmediate<"u"?setImmediate:null;function G(H){for(var X=s(x);X!==null;){if(X.callback===null)r(x);else if(X.startTime<=H)r(x),X.sortIndex=X.expirationTime,l(g,X);else break;X=s(x)}}function I(H){if(j=!1,G(H),!C)if(s(g)!==null)C=!0,W||(W=!0,$());else{var X=s(x);X!==null&&ue(I,X.startTime-H)}}var W=!1,R=-1,ee=5,se=-1;function V(){return k?!0:!(a.unstable_now()-se<ee)}function fe(){if(k=!1,W){var H=a.unstable_now();se=H;var X=!0;try{e:{C=!1,j&&(j=!1,A(R),R=-1),M=!0;var te=S;try{t:{for(G(H),v=s(g);v!==null&&!(v.expirationTime>H&&V());){var E=v.callback;if(typeof E=="function"){v.callback=null,S=v.priorityLevel;var P=E(v.expirationTime<=H);if(H=a.unstable_now(),typeof P=="function"){v.callback=P,G(H),X=!0;break t}v===s(g)&&r(g),G(H)}else r(g);v=s(g)}if(v!==null)X=!0;else{var ne=s(x);ne!==null&&ue(I,ne.startTime-H),X=!1}}break e}finally{v=null,S=te,M=!1}X=void 0}}finally{X?$():W=!1}}}var $;if(typeof z=="function")$=function(){z(fe)};else if(typeof MessageChannel<"u"){var oe=new MessageChannel,le=oe.port2;oe.port1.onmessage=fe,$=function(){le.postMessage(null)}}else $=function(){T(fe,0)};function ue(H,X){R=T(function(){H(a.unstable_now())},X)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(H){H.callback=null},a.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ee=0<H?Math.floor(1e3/H):5},a.unstable_getCurrentPriorityLevel=function(){return S},a.unstable_next=function(H){switch(S){case 1:case 2:case 3:var X=3;break;default:X=S}var te=S;S=X;try{return H()}finally{S=te}},a.unstable_requestPaint=function(){k=!0},a.unstable_runWithPriority=function(H,X){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var te=S;S=H;try{return X()}finally{S=te}},a.unstable_scheduleCallback=function(H,X,te){var E=a.unstable_now();switch(typeof te=="object"&&te!==null?(te=te.delay,te=typeof te=="number"&&0<te?E+te:E):te=E,H){case 1:var P=-1;break;case 2:P=250;break;case 5:P=1073741823;break;case 4:P=1e4;break;default:P=5e3}return P=te+P,H={id:b++,callback:X,priorityLevel:H,startTime:te,expirationTime:P,sortIndex:-1},te>E?(H.sortIndex=te,l(x,H),s(g)===null&&H===s(x)&&(j?(A(R),R=-1):j=!0,ue(I,te-E))):(H.sortIndex=P,l(g,H),C||M||(C=!0,W||(W=!0,$()))),H},a.unstable_shouldYield=V,a.unstable_wrapCallback=function(H){var X=S;return function(){var te=S;S=X;try{return H.apply(this,arguments)}finally{S=te}}}})(Lf)),Lf}var Gg;function Qb(){return Gg||(Gg=1,Rf.exports=Pb()),Rf.exports}var Yg;function Kb(){if(Yg)return ho;Yg=1;var a=Qb(),l=Ab(),s=iv();function r(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(d(e)!==e)throw Error(r(188))}function x(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(r(188));return t!==e?null:e}for(var n=e,i=t;;){var u=n.return;if(u===null)break;var f=u.alternate;if(f===null){if(i=u.return,i!==null){n=i;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===n)return g(u),e;if(f===i)return g(u),t;f=f.sibling}throw Error(r(188))}if(n.return!==i.return)n=u,i=f;else{for(var y=!1,N=u.child;N;){if(N===n){y=!0,n=u,i=f;break}if(N===i){y=!0,i=u,n=f;break}N=N.sibling}if(!y){for(N=f.child;N;){if(N===n){y=!0,n=f,i=u;break}if(N===i){y=!0,i=f,n=u;break}N=N.sibling}if(!y)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,S=Symbol.for("react.element"),M=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),z=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),V=Symbol.for("react.memo_cache_sentinel"),fe=Symbol.iterator;function $(e){return e===null||typeof e!="object"?null:(e=fe&&e[fe]||e["@@iterator"],typeof e=="function"?e:null)}var oe=Symbol.for("react.client.reference");function le(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===oe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case T:return"Profiler";case k:return"StrictMode";case I:return"Suspense";case W:return"SuspenseList";case se:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case z:return e.displayName||"Context";case A:return(e._context.displayName||"Context")+".Consumer";case G:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case R:return t=e.displayName||null,t!==null?t:le(e.type)||"Memo";case ee:t=e._payload,e=e._init;try{return le(e(t))}catch{}}return null}var ue=Array.isArray,H=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te={pending:!1,data:null,method:null,action:null},E=[],P=-1;function ne(e){return{current:e}}function L(e){0>P||(e.current=E[P],E[P]=null,P--)}function de(e,t){P++,E[P]=e.current,e.current=t}var ve=ne(null),ge=ne(null),ke=ne(null),qe=ne(null);function _e(e,t){switch(de(ke,t),de(ge,e),de(ve,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ig(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ig(t),e=sg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}L(ve),de(ve,e)}function Ee(){L(ve),L(ge),L(ke)}function $e(e){e.memoizedState!==null&&de(qe,e);var t=ve.current,n=sg(t,e.type);t!==n&&(de(ge,e),de(ve,n))}function Ne(e){ge.current===e&&(L(ve),L(ge)),qe.current===e&&(L(qe),oo._currentValue=te)}var Mt,tn;function Xe(e){if(Mt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Mt=t&&t[1]||"",tn=-1<n.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+Mt+e+tn}var Kn=!1;function Xn(e,t){if(!e||Kn)return"";Kn=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(J){var Z=J}Reflect.construct(e,[],re)}else{try{re.call()}catch(J){Z=J}e.call(re.prototype)}}else{try{throw Error()}catch(J){Z=J}(re=e())&&typeof re.catch=="function"&&re.catch(function(){})}}catch(J){if(J&&Z&&typeof J.stack=="string")return[J.stack,Z.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=i.DetermineComponentFrameRoot(),y=f[0],N=f[1];if(y&&N){var _=y.split(`
4
- `),K=N.split(`
5
- `);for(u=i=0;i<_.length&&!_[i].includes("DetermineComponentFrameRoot");)i++;for(;u<K.length&&!K[u].includes("DetermineComponentFrameRoot");)u++;if(i===_.length||u===K.length)for(i=_.length-1,u=K.length-1;1<=i&&0<=u&&_[i]!==K[u];)u--;for(;1<=i&&0<=u;i--,u--)if(_[i]!==K[u]){if(i!==1||u!==1)do if(i--,u--,0>u||_[i]!==K[u]){var ae=`
6
- `+_[i].replace(" at new "," at ");return e.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",e.displayName)),ae}while(1<=i&&0<=u);break}}}finally{Kn=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Xe(n):""}function Lt(e,t){switch(e.tag){case 26:case 27:case 5:return Xe(e.type);case 16:return Xe("Lazy");case 13:return e.child!==t&&t!==null?Xe("Suspense Fallback"):Xe("Suspense");case 19:return Xe("SuspenseList");case 0:case 15:return Xn(e.type,!1);case 11:return Xn(e.type.render,!1);case 1:return Xn(e.type,!0);case 31:return Xe("Activity");default:return""}}function Vt(e){try{var t="",n=null;do t+=Lt(e,n),n=e,e=e.return;while(e);return t}catch(i){return`
7
- Error generating stack: `+i.message+`
8
- `+i.stack}}var be=Object.prototype.hasOwnProperty,gn=a.unstable_scheduleCallback,De=a.unstable_cancelCallback,pe=a.unstable_shouldYield,je=a.unstable_requestPaint,Re=a.unstable_now,It=a.unstable_getCurrentPriorityLevel,xn=a.unstable_ImmediatePriority,Ie=a.unstable_UserBlockingPriority,ca=a.unstable_NormalPriority,Ta=a.unstable_LowPriority,Nn=a.unstable_IdlePriority,cn=a.log,il=a.unstable_setDisableYieldValue,An=null,nt=null;function Pt(e){if(typeof cn=="function"&&il(e),nt&&typeof nt.setStrictMode=="function")try{nt.setStrictMode(An,e)}catch{}}var At=Math.clz32?Math.clz32:ki,ns=Math.log,Ti=Math.LN2;function ki(e){return e>>>=0,e===0?32:31-(ns(e)/Ti|0)|0}var sl=256,ka=262144,Tn=4194304;function Zn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function kn(e,t,n){var i=e.pendingLanes;if(i===0)return 0;var u=0,f=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var N=i&134217727;return N!==0?(i=N&~f,i!==0?u=Zn(i):(y&=N,y!==0?u=Zn(y):n||(n=N&~e,n!==0&&(u=Zn(n))))):(N=i&~f,N!==0?u=Zn(N):y!==0?u=Zn(y):n||(n=i&~e,n!==0&&(u=Zn(n)))),u===0?0:t!==0&&t!==u&&(t&f)===0&&(f=u&-u,n=t&-t,f>=n||f===32&&(n&4194048)!==0)?t:u}function ua(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Il(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function rl(){var e=Tn;return Tn<<=1,(Tn&62914560)===0&&(Tn=4194304),e}function Ea(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Da(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function $a(e,t,n,i,u,f){var y=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var N=e.entanglements,_=e.expirationTimes,K=e.hiddenUpdates;for(n=y&~n;0<n;){var ae=31-At(n),re=1<<ae;N[ae]=0,_[ae]=-1;var Z=K[ae];if(Z!==null)for(K[ae]=null,ae=0;ae<Z.length;ae++){var J=Z[ae];J!==null&&(J.lane&=-536870913)}n&=~re}i!==0&&ol(e,i,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(y&~t))}function ol(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-At(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|n&261930}function En(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-At(n),u=1<<i;u&t|e[i]&t&&(e[i]|=t),n&=~u}}function Ra(e,t){var n=t&-t;return n=(n&42)!==0?1:Ga(n),(n&(e.suspendedLanes|t))!==0?0:n}function Ga(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function cl(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function vn(){var e=X.p;return e!==0?e:(e=window.event,e===void 0?32:kg(e.type))}function Wn(e,t){var n=X.p;try{return X.p=e,t()}finally{X.p=n}}var Ut=Math.random().toString(36).slice(2),Y="__reactFiber$"+Ut,me="__reactProps$"+Ut,we="__reactContainer$"+Ut,Oe="__reactEvents$"+Ut,at="__reactListeners$"+Ut,mt="__reactHandles$"+Ut,Ae="__reactResources$"+Ut,Ze="__reactMarker$"+Ut;function nn(e){delete e[Y],delete e[me],delete e[Oe],delete e[at],delete e[mt]}function qt(e){var t=e[Y];if(t)return t;for(var n=e.parentNode;n;){if(t=n[we]||n[Y]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=mg(e);e!==null;){if(n=e[Y])return n;e=mg(e)}return t}e=n,n=e.parentNode}return null}function un(e){if(e=e[Y]||e[we]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function xt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function Tt(e){var t=e[Ae];return t||(t=e[Ae]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function gt(e){e[Ze]=!0}var ul=new Set,dl={};function $t(e,t){kt(e,t),kt(e+"Capture",t)}function kt(e,t){for(dl[e]=t,e=0;e<t.length;e++)ul.add(t[e])}var as=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]*$"),da={},Dn={};function ls(e){return be.call(Dn,e)?!0:be.call(da,e)?!1:as.test(e)?Dn[e]=!0:(da[e]=!0,!1)}function Ei(e,t,n){if(ls(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Di(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function yn(e,t,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+i)}}function bn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function He(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function rt(e,t,n){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var u=i.get,f=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(y){n=""+y,f.call(this,y)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(y){n=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ri(e){if(!e._valueTracker){var t=He(e)?"checked":"value";e._valueTracker=rt(e,t,""+e[t])}}function La(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),i="";return e&&(i=He(e)?e.checked?"true":"false":e.value),e=i,e!==n?(t.setValue(e),!0):!1}function Ye(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Bo=/[\n"\\]/g;function Rn(e){return e.replace(Bo,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ln(e,t,n,i,u,f,y,N){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+bn(t)):e.value!==""+bn(t)&&(e.value=""+bn(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?Li(e,y,bn(t)):n!=null?Li(e,y,bn(n)):i!=null&&e.removeAttribute("value"),u==null&&f!=null&&(e.defaultChecked=!!f),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+bn(N):e.removeAttribute("name")}function Ul(e,t,n,i,u,f,y,N){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||n!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){Ri(e);return}n=n!=null?""+bn(n):"",t=t!=null?""+bn(t):n,N||t===e.value||(e.value=t),e.defaultValue=t}i=i??u,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=N?e.checked:!!i,e.defaultChecked=!!i,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),Ri(e)}function Li(e,t,n){t==="number"&&Ye(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function _a(e,t,n,i){if(e=e.options,t){t={};for(var u=0;u<n.length;u++)t["$"+n[u]]=!0;for(n=0;n<e.length;n++)u=t.hasOwnProperty("$"+e[n].value),e[n].selected!==u&&(e[n].selected=u),u&&i&&(e[n].defaultSelected=!0)}else{for(n=""+bn(n),t=null,u=0;u<e.length;u++){if(e[u].value===n){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function fl(e,t,n){if(t!=null&&(t=""+bn(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+bn(n):""}function fa(e,t,n,i){if(t==null){if(i!=null){if(n!=null)throw Error(r(92));if(ue(i)){if(1<i.length)throw Error(r(93));i=i[0]}n=i}n==null&&(n=""),t=n}n=bn(t),e.defaultValue=n,i=e.textContent,i===n&&i!==""&&i!==null&&(e.value=i),Ri(e)}function ml(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var hl=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 rr(e,t,n){var i=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,n):typeof n!="number"||n===0||hl.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function ye(e,t,n){if(t!=null&&typeof t!="object")throw Error(r(62));if(e=e.style,n!=null){for(var i in n)!n.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var u in t)i=t[u],t.hasOwnProperty(u)&&n[u]!==i&&rr(e,u,i)}else for(var f in t)t.hasOwnProperty(f)&&rr(e,f,t[f])}function is(e){if(e.indexOf("-")===-1)return!1;switch(e){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 Ou=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"]]),ma=/^[\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 ss(e){return ma.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Jn(){}var ot=null;function rs(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var pl=null,ql=null;function yt(e){var t=un(e);if(t&&(e=t.stateNode)){var n=e[me]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ln(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Rn(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var u=i[me]||null;if(!u)throw Error(r(90));Ln(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<n.length;t++)i=n[t],i.form===e.form&&La(i)}break e;case"textarea":fl(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&_a(e,!!n.multiple,t,!1)}}}var za=!1;function Ho(e,t,n){if(za)return e(t,n);za=!0;try{var i=e(t);return i}finally{if(za=!1,(pl!==null||ql!==null)&&(Dc(),pl&&(t=pl,e=ql,ql=pl=null,yt(t),e)))for(t=0;t<e.length;t++)yt(e[t])}}function $l(e,t){var n=e.stateNode;if(n===null)return null;var i=n[me]||null;if(i===null)return null;n=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(r(231,t,typeof n));return n}var Qt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),os=!1;if(Qt)try{var Ya={};Object.defineProperty(Ya,"passive",{get:function(){os=!0}}),window.addEventListener("test",Ya,Ya),window.removeEventListener("test",Ya,Ya)}catch{os=!1}var wn=null,Kt=null,Oa=null;function Fo(){if(Oa)return Oa;var e,t=Kt,n=t.length,i,u="value"in wn?wn.value:wn.textContent,f=u.length;for(e=0;e<n&&t[e]===u[e];e++);var y=n-e;for(i=1;i<=y&&t[n-i]===u[f-i];i++);return Oa=u.slice(e,1<i?1-i:void 0)}function Xt(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function cs(){return!0}function Io(){return!1}function Gt(e){function t(n,i,u,f,y){this._reactName=n,this._targetInst=u,this.type=i,this.nativeEvent=f,this.target=y,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(n=e[N],this[N]=n?n(f):f[N]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?cs:Io,this.isPropagationStopped=Io,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=cs)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=cs)},persist:function(){},isPersistent:cs}),t}var ha={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_i=Gt(ha),pa=v({},ha,{view:0,detail:0}),Uo=Gt(pa),us,or,ga,ds=v({},pa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ps,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ga&&(ga&&e.type==="mousemove"?(us=e.screenX-ga.screenX,or=e.screenY-ga.screenY):or=us=0,ga=e),us)},movementY:function(e){return"movementY"in e?e.movementY:or}}),cr=Gt(ds),Bu=v({},ds,{dataTransfer:0}),Hu=Gt(Bu),Fu=v({},pa,{relatedTarget:0}),fs=Gt(Fu),zi=v({},ha,{animationName:0,elapsedTime:0,pseudoElement:0}),Va=Gt(zi),ms=v({},ha,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Gl=Gt(ms),gl=v({},ha,{data:0}),hs=Gt(gl),Iu={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},qo={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"},ur={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ur[e])?!!t[e]:!1}function ps(){return dr}var Uu=v({},pa,{key:function(e){if(e.key){var t=Iu[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Xt(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?qo[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ps,charCode:function(e){return e.type==="keypress"?Xt(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Xt(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),gs=Gt(Uu),xs=v({},ds,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),vs=Gt(xs),fr=v({},pa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ps}),ys=Gt(fr),bs=v({},ha,{propertyName:0,elapsedTime:0,pseudoElement:0}),Oi=Gt(bs),xa=v({},ds,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),$o=Gt(xa),Go=v({},ha,{newState:0,oldState:0}),mr=Gt(Go),ws=[9,13,27,32],hr=Qt&&"CompositionEvent"in window,va=null;Qt&&"documentMode"in document&&(va=document.documentMode);var qu=Qt&&"TextEvent"in window&&!va,xl=Qt&&(!hr||va&&8<va&&11>=va),pr=" ",gr=!1;function Yl(e,t){switch(e){case"keyup":return ws.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xr(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Pa=!1;function Yo(e,t){switch(e){case"compositionend":return xr(t);case"keypress":return t.which!==32?null:(gr=!0,pr);case"textInput":return e=t.data,e===pr&&gr?null:e;default:return null}}function $u(e,t){if(Pa)return e==="compositionend"||!hr&&Yl(e,t)?(e=Fo(),Oa=Kt=wn=null,Pa=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return xl&&t.locale!=="ko"?null:t.data;default:return null}}var vr={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 Vo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!vr[e.type]:t==="textarea"}function yr(e,t,n,i){pl?ql?ql.push(i):ql=[i]:pl=i,t=Hc(t,"onChange"),0<t.length&&(n=new _i("onChange","change",null,n,i),e.push({event:n,listeners:t}))}var Vl=null,Pl=null;function Gu(e){Jp(e,0)}function Ss(e){var t=xt(e);if(La(t))return e}function Bi(e,t){if(e==="change")return t}var Ba=!1;if(Qt){var Ql;if(Qt){var br="oninput"in document;if(!br){var Ms=document.createElement("div");Ms.setAttribute("oninput","return;"),br=typeof Ms.oninput=="function"}Ql=br}else Ql=!1;Ba=Ql&&(!document.documentMode||9<document.documentMode)}function Cs(){Vl&&(Vl.detachEvent("onpropertychange",xe),Pl=Vl=null)}function xe(e){if(e.propertyName==="value"&&Ss(Pl)){var t=[];yr(t,Pl,e,rs(e)),Ho(Gu,t)}}function js(e,t,n){e==="focusin"?(Cs(),Vl=t,Pl=n,Vl.attachEvent("onpropertychange",xe)):e==="focusout"&&Cs()}function Po(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ss(Pl)}function Yu(e,t){if(e==="click")return Ss(t)}function Um(e,t){if(e==="input"||e==="change")return Ss(t)}function wr(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Sn=typeof Object.is=="function"?Object.is:wr;function Qa(e,t){if(Sn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var u=n[i];if(!be.call(t,u)||!Sn(e[u],t[u]))return!1}return!0}function _t(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function dn(e,t){var n=_t(e);e=0;for(var i;n;){if(n.nodeType===3){if(i=e+n.textContent.length,e<=t&&i>=t)return{node:n,offset:t-e};e=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=_t(n)}}function Ge(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ge(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qo(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ye(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ye(e.document)}return t}function Sr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Vu=Qt&&"documentMode"in document&&11>=document.documentMode,Kl=null,Mr=null,Hi=null,Cr=!1;function Ko(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Cr||Kl==null||Kl!==Ye(i)||(i=Kl,"selectionStart"in i&&Sr(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Hi&&Qa(Hi,i)||(Hi=i,i=Hc(Mr,"onSelect"),0<i.length&&(t=new _i("onSelect","select",null,t,n),e.push({event:t,listeners:i}),t.target=Kl)))}function vl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Xl={animationend:vl("Animation","AnimationEnd"),animationiteration:vl("Animation","AnimationIteration"),animationstart:vl("Animation","AnimationStart"),transitionrun:vl("Transition","TransitionRun"),transitionstart:vl("Transition","TransitionStart"),transitioncancel:vl("Transition","TransitionCancel"),transitionend:vl("Transition","TransitionEnd")},jr={},Xo={};Qt&&(Xo=document.createElement("div").style,"AnimationEvent"in window||(delete Xl.animationend.animation,delete Xl.animationiteration.animation,delete Xl.animationstart.animation),"TransitionEvent"in window||delete Xl.transitionend.transition);function yl(e){if(jr[e])return jr[e];if(!Xl[e])return e;var t=Xl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Xo)return jr[e]=t[n];return e}var Zo=yl("animationend"),Wo=yl("animationiteration"),Jo=yl("animationstart"),Nr=yl("transitionrun"),Ar=yl("transitionstart"),Pu=yl("transitioncancel"),ec=yl("transitionend"),tc=new Map,Tr="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(" ");Tr.push("scrollEnd");function ea(e,t){tc.set(e,t),$t(t,[e])}var Ns=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},_n=[],Zl=0,Ka=0;function Fi(){for(var e=Zl,t=Ka=Zl=0;t<e;){var n=_n[t];_n[t++]=null;var i=_n[t];_n[t++]=null;var u=_n[t];_n[t++]=null;var f=_n[t];if(_n[t++]=null,i!==null&&u!==null){var y=i.pending;y===null?u.next=u:(u.next=y.next,y.next=u),i.pending=u}f!==0&&Er(n,u,f)}}function Wl(e,t,n,i){_n[Zl++]=e,_n[Zl++]=t,_n[Zl++]=n,_n[Zl++]=i,Ka|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function kr(e,t,n,i){return Wl(e,t,n,i),wl(e)}function bl(e,t){return Wl(e,null,null,t),wl(e)}function Er(e,t,n){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n);for(var u=!1,f=e.return;f!==null;)f.childLanes|=n,i=f.alternate,i!==null&&(i.childLanes|=n),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(u=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,u&&t!==null&&(u=31-At(n),e=f.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=n|536870912),f):null}function wl(e){if(50<to)throw to=0,Kd=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Jl={};function Qu(e,t,n,i){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function lt(e,t,n,i){return new Qu(e,t,n,i)}function ei(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ya(e,t){var n=e.alternate;return n===null?(n=lt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function nc(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Dr(e,t,n,i,u,f){var y=0;if(i=e,typeof e=="function")ei(e)&&(y=1);else if(typeof e=="string")y=pb(e,n,ve.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case se:return e=lt(31,n,t,u),e.elementType=se,e.lanes=f,e;case j:return Sl(n.children,u,f,t);case k:y=8,u|=24;break;case T:return e=lt(12,n,t,u|2),e.elementType=T,e.lanes=f,e;case I:return e=lt(13,n,t,u),e.elementType=I,e.lanes=f,e;case W:return e=lt(19,n,t,u),e.elementType=W,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case z:y=10;break e;case A:y=9;break e;case G:y=11;break e;case R:y=14;break e;case ee:y=16,i=null;break e}y=29,n=Error(r(130,e===null?"null":typeof e,"")),i=null}return t=lt(y,n,t,u),t.elementType=e,t.type=i,t.lanes=f,t}function Sl(e,t,n,i){return e=lt(7,e,i,t),e.lanes=n,e}function Rr(e,t,n){return e=lt(6,e,null,t),e.lanes=n,e}function Lr(e){var t=lt(18,null,null,0);return t.stateNode=e,t}function ti(e,t,n){return t=lt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ni=new WeakMap;function Mn(e,t){if(typeof e=="object"&&e!==null){var n=ni.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Vt(t)},ni.set(e,t),t)}return{value:e,source:t,stack:Vt(t)}}var ai=[],li=0,As=null,Ii=0,zn=[],On=0,Xa=null,wt=1,ba="";function Ha(e,t){ai[li++]=Ii,ai[li++]=As,As=e,Ii=t}function Ml(e,t,n){zn[On++]=wt,zn[On++]=ba,zn[On++]=Xa,Xa=e;var i=wt;e=ba;var u=32-At(i)-1;i&=~(1<<u),n+=1;var f=32-At(t)+u;if(30<f){var y=u-u%5;f=(i&(1<<y)-1).toString(32),i>>=y,u-=y,wt=1<<32-At(t)+u|n<<u|i,ba=f+e}else wt=1<<f|n<<u|i,ba=e}function _r(e){e.return!==null&&(Ha(e,1),Ml(e,1,0))}function zr(e){for(;e===As;)As=ai[--li],ai[li]=null,Ii=ai[--li],ai[li]=null;for(;e===Xa;)Xa=zn[--On],zn[On]=null,ba=zn[--On],zn[On]=null,wt=zn[--On],zn[On]=null}function w(e,t){zn[On++]=wt,zn[On++]=ba,zn[On++]=Xa,wt=t.id,ba=t.overflow,Xa=e}var D=null,F=null,O=!1,U=null,ce=!1,he=Error(r(519));function Se(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Cn(Mn(t,e)),he}function We(e){var t=e.stateNode,n=e.type,i=e.memoizedProps;switch(t[Y]=e,t[me]=i,n){case"dialog":Pe("cancel",t),Pe("close",t);break;case"iframe":case"object":case"embed":Pe("load",t);break;case"video":case"audio":for(n=0;n<ao.length;n++)Pe(ao[n],t);break;case"source":Pe("error",t);break;case"img":case"image":case"link":Pe("error",t),Pe("load",t);break;case"details":Pe("toggle",t);break;case"input":Pe("invalid",t),Ul(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Pe("invalid",t);break;case"textarea":Pe("invalid",t),fa(t,i.value,i.defaultValue,i.children)}n=i.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||i.suppressHydrationWarning===!0||ag(t.textContent,n)?(i.popover!=null&&(Pe("beforetoggle",t),Pe("toggle",t)),i.onScroll!=null&&Pe("scroll",t),i.onScrollEnd!=null&&Pe("scrollend",t),i.onClick!=null&&(t.onclick=Jn),t=!0):t=!1,t||Se(e,!0)}function Ue(e){for(D=e.return;D;)switch(D.tag){case 5:case 31:case 13:ce=!1;return;case 27:case 3:ce=!0;return;default:D=D.return}}function ct(e){if(e!==D)return!1;if(!O)return Ue(e),O=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||df(e.type,e.memoizedProps)),n=!n),n&&F&&Se(e),Ue(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));F=fg(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));F=fg(e)}else t===27?(t=F,xi(e.type)?(e=gf,gf=null,F=e):F=t):F=D?Ma(e.stateNode.nextSibling):null;return!0}function Ct(){F=D=null,O=!1}function wa(){var e=U;return e!==null&&(Un===null?Un=e:Un.push.apply(Un,e),U=null),e}function Cn(e){U===null?U=[e]:U.push(e)}var Cl=ne(null),ta=null,Bn=null;function Za(e,t,n){de(Cl,t._currentValue),t._currentValue=n}function jl(e){e._currentValue=Cl.current,L(Cl)}function Ku(e,t,n){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===n)break;e=e.return}}function Xu(e,t,n,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var f=u.dependencies;if(f!==null){var y=u.child;f=f.firstContext;e:for(;f!==null;){var N=f;f=u;for(var _=0;_<t.length;_++)if(N.context===t[_]){f.lanes|=n,N=f.alternate,N!==null&&(N.lanes|=n),Ku(f.return,n,e),i||(y=null);break e}f=N.next}}else if(u.tag===18){if(y=u.return,y===null)throw Error(r(341));y.lanes|=n,f=y.alternate,f!==null&&(f.lanes|=n),Ku(y,n,e),y=null}else y=u.child;if(y!==null)y.return=u;else for(y=u;y!==null;){if(y===e){y=null;break}if(u=y.sibling,u!==null){u.return=y.return,y=u;break}y=y.return}u=y}}function Ts(e,t,n,i){e=null;for(var u=t,f=!1;u!==null;){if(!f){if((u.flags&524288)!==0)f=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var y=u.alternate;if(y===null)throw Error(r(387));if(y=y.memoizedProps,y!==null){var N=u.type;Sn(u.pendingProps.value,y.value)||(e!==null?e.push(N):e=[N])}}else if(u===qe.current){if(y=u.alternate,y===null)throw Error(r(387));y.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(oo):e=[oo])}u=u.return}e!==null&&Xu(t,e,n,i),t.flags|=262144}function ac(e){for(e=e.firstContext;e!==null;){if(!Sn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ui(e){ta=e,Bn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function an(e){return qm(ta,e)}function lc(e,t){return ta===null&&Ui(e),qm(e,t)}function qm(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Bn===null){if(e===null)throw Error(r(308));Bn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Bn=Bn.next=t;return n}var dy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},fy=a.unstable_scheduleCallback,my=a.unstable_NormalPriority,zt={$$typeof:z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Zu(){return{controller:new dy,data:new Map,refCount:0}}function Or(e){e.refCount--,e.refCount===0&&fy(my,function(){e.controller.abort()})}var Br=null,Wu=0,ks=0,Es=null;function hy(e,t){if(Br===null){var n=Br=[];Wu=0,ks=tf(),Es={status:"pending",value:void 0,then:function(i){n.push(i)}}}return Wu++,t.then($m,$m),t}function $m(){if(--Wu===0&&Br!==null){Es!==null&&(Es.status="fulfilled");var e=Br;Br=null,ks=0,Es=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function py(e,t){var n=[],i={status:"pending",value:null,reason:null,then:function(u){n.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<n.length;u++)(0,n[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<n.length;u++)(0,n[u])(void 0)}),i}var Gm=H.S;H.S=function(e,t){Ap=Re(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&hy(e,t),Gm!==null&&Gm(e,t)};var qi=ne(null);function Ju(){var e=qi.current;return e!==null?e:ht.pooledCache}function ic(e,t){t===null?de(qi,qi.current):de(qi,t.pool)}function Ym(){var e=Ju();return e===null?null:{parent:zt._currentValue,pool:e}}var Ds=Error(r(460)),ed=Error(r(474)),sc=Error(r(542)),rc={then:function(){}};function Vm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Pm(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Jn,Jn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Km(e),e;default:if(typeof t.status=="string")t.then(Jn,Jn);else{if(e=ht,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=i}},function(i){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Km(e),e}throw Gi=t,Ds}}function $i(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Gi=n,Ds):n}}var Gi=null;function Qm(){if(Gi===null)throw Error(r(459));var e=Gi;return Gi=null,e}function Km(e){if(e===Ds||e===sc)throw Error(r(483))}var Rs=null,Hr=0;function oc(e){var t=Hr;return Hr+=1,Rs===null&&(Rs=[]),Pm(Rs,e,t)}function Fr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function cc(e,t){throw t.$$typeof===S?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Xm(e){function t(q,B){if(e){var Q=q.deletions;Q===null?(q.deletions=[B],q.flags|=16):Q.push(B)}}function n(q,B){if(!e)return null;for(;B!==null;)t(q,B),B=B.sibling;return null}function i(q){for(var B=new Map;q!==null;)q.key!==null?B.set(q.key,q):B.set(q.index,q),q=q.sibling;return B}function u(q,B){return q=ya(q,B),q.index=0,q.sibling=null,q}function f(q,B,Q){return q.index=Q,e?(Q=q.alternate,Q!==null?(Q=Q.index,Q<B?(q.flags|=67108866,B):Q):(q.flags|=67108866,B)):(q.flags|=1048576,B)}function y(q){return e&&q.alternate===null&&(q.flags|=67108866),q}function N(q,B,Q,ie){return B===null||B.tag!==6?(B=Rr(Q,q.mode,ie),B.return=q,B):(B=u(B,Q),B.return=q,B)}function _(q,B,Q,ie){var Te=Q.type;return Te===j?ae(q,B,Q.props.children,ie,Q.key):B!==null&&(B.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===ee&&$i(Te)===B.type)?(B=u(B,Q.props),Fr(B,Q),B.return=q,B):(B=Dr(Q.type,Q.key,Q.props,null,q.mode,ie),Fr(B,Q),B.return=q,B)}function K(q,B,Q,ie){return B===null||B.tag!==4||B.stateNode.containerInfo!==Q.containerInfo||B.stateNode.implementation!==Q.implementation?(B=ti(Q,q.mode,ie),B.return=q,B):(B=u(B,Q.children||[]),B.return=q,B)}function ae(q,B,Q,ie,Te){return B===null||B.tag!==7?(B=Sl(Q,q.mode,ie,Te),B.return=q,B):(B=u(B,Q),B.return=q,B)}function re(q,B,Q){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return B=Rr(""+B,q.mode,Q),B.return=q,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case M:return Q=Dr(B.type,B.key,B.props,null,q.mode,Q),Fr(Q,B),Q.return=q,Q;case C:return B=ti(B,q.mode,Q),B.return=q,B;case ee:return B=$i(B),re(q,B,Q)}if(ue(B)||$(B))return B=Sl(B,q.mode,Q,null),B.return=q,B;if(typeof B.then=="function")return re(q,oc(B),Q);if(B.$$typeof===z)return re(q,lc(q,B),Q);cc(q,B)}return null}function Z(q,B,Q,ie){var Te=B!==null?B.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Te!==null?null:N(q,B,""+Q,ie);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case M:return Q.key===Te?_(q,B,Q,ie):null;case C:return Q.key===Te?K(q,B,Q,ie):null;case ee:return Q=$i(Q),Z(q,B,Q,ie)}if(ue(Q)||$(Q))return Te!==null?null:ae(q,B,Q,ie,null);if(typeof Q.then=="function")return Z(q,B,oc(Q),ie);if(Q.$$typeof===z)return Z(q,B,lc(q,Q),ie);cc(q,Q)}return null}function J(q,B,Q,ie,Te){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return q=q.get(Q)||null,N(B,q,""+ie,Te);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case M:return q=q.get(ie.key===null?Q:ie.key)||null,_(B,q,ie,Te);case C:return q=q.get(ie.key===null?Q:ie.key)||null,K(B,q,ie,Te);case ee:return ie=$i(ie),J(q,B,Q,ie,Te)}if(ue(ie)||$(ie))return q=q.get(Q)||null,ae(B,q,ie,Te,null);if(typeof ie.then=="function")return J(q,B,Q,oc(ie),Te);if(ie.$$typeof===z)return J(q,B,Q,lc(B,ie),Te);cc(B,ie)}return null}function Me(q,B,Q,ie){for(var Te=null,Je=null,Ce=B,Fe=B=0,Ke=null;Ce!==null&&Fe<Q.length;Fe++){Ce.index>Fe?(Ke=Ce,Ce=null):Ke=Ce.sibling;var et=Z(q,Ce,Q[Fe],ie);if(et===null){Ce===null&&(Ce=Ke);break}e&&Ce&&et.alternate===null&&t(q,Ce),B=f(et,B,Fe),Je===null?Te=et:Je.sibling=et,Je=et,Ce=Ke}if(Fe===Q.length)return n(q,Ce),O&&Ha(q,Fe),Te;if(Ce===null){for(;Fe<Q.length;Fe++)Ce=re(q,Q[Fe],ie),Ce!==null&&(B=f(Ce,B,Fe),Je===null?Te=Ce:Je.sibling=Ce,Je=Ce);return O&&Ha(q,Fe),Te}for(Ce=i(Ce);Fe<Q.length;Fe++)Ke=J(Ce,q,Fe,Q[Fe],ie),Ke!==null&&(e&&Ke.alternate!==null&&Ce.delete(Ke.key===null?Fe:Ke.key),B=f(Ke,B,Fe),Je===null?Te=Ke:Je.sibling=Ke,Je=Ke);return e&&Ce.forEach(function(Si){return t(q,Si)}),O&&Ha(q,Fe),Te}function Le(q,B,Q,ie){if(Q==null)throw Error(r(151));for(var Te=null,Je=null,Ce=B,Fe=B=0,Ke=null,et=Q.next();Ce!==null&&!et.done;Fe++,et=Q.next()){Ce.index>Fe?(Ke=Ce,Ce=null):Ke=Ce.sibling;var Si=Z(q,Ce,et.value,ie);if(Si===null){Ce===null&&(Ce=Ke);break}e&&Ce&&Si.alternate===null&&t(q,Ce),B=f(Si,B,Fe),Je===null?Te=Si:Je.sibling=Si,Je=Si,Ce=Ke}if(et.done)return n(q,Ce),O&&Ha(q,Fe),Te;if(Ce===null){for(;!et.done;Fe++,et=Q.next())et=re(q,et.value,ie),et!==null&&(B=f(et,B,Fe),Je===null?Te=et:Je.sibling=et,Je=et);return O&&Ha(q,Fe),Te}for(Ce=i(Ce);!et.done;Fe++,et=Q.next())et=J(Ce,q,Fe,et.value,ie),et!==null&&(e&&et.alternate!==null&&Ce.delete(et.key===null?Fe:et.key),B=f(et,B,Fe),Je===null?Te=et:Je.sibling=et,Je=et);return e&&Ce.forEach(function(Nb){return t(q,Nb)}),O&&Ha(q,Fe),Te}function ft(q,B,Q,ie){if(typeof Q=="object"&&Q!==null&&Q.type===j&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case M:e:{for(var Te=Q.key;B!==null;){if(B.key===Te){if(Te=Q.type,Te===j){if(B.tag===7){n(q,B.sibling),ie=u(B,Q.props.children),ie.return=q,q=ie;break e}}else if(B.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===ee&&$i(Te)===B.type){n(q,B.sibling),ie=u(B,Q.props),Fr(ie,Q),ie.return=q,q=ie;break e}n(q,B);break}else t(q,B);B=B.sibling}Q.type===j?(ie=Sl(Q.props.children,q.mode,ie,Q.key),ie.return=q,q=ie):(ie=Dr(Q.type,Q.key,Q.props,null,q.mode,ie),Fr(ie,Q),ie.return=q,q=ie)}return y(q);case C:e:{for(Te=Q.key;B!==null;){if(B.key===Te)if(B.tag===4&&B.stateNode.containerInfo===Q.containerInfo&&B.stateNode.implementation===Q.implementation){n(q,B.sibling),ie=u(B,Q.children||[]),ie.return=q,q=ie;break e}else{n(q,B);break}else t(q,B);B=B.sibling}ie=ti(Q,q.mode,ie),ie.return=q,q=ie}return y(q);case ee:return Q=$i(Q),ft(q,B,Q,ie)}if(ue(Q))return Me(q,B,Q,ie);if($(Q)){if(Te=$(Q),typeof Te!="function")throw Error(r(150));return Q=Te.call(Q),Le(q,B,Q,ie)}if(typeof Q.then=="function")return ft(q,B,oc(Q),ie);if(Q.$$typeof===z)return ft(q,B,lc(q,Q),ie);cc(q,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,B!==null&&B.tag===6?(n(q,B.sibling),ie=u(B,Q),ie.return=q,q=ie):(n(q,B),ie=Rr(Q,q.mode,ie),ie.return=q,q=ie),y(q)):n(q,B)}return function(q,B,Q,ie){try{Hr=0;var Te=ft(q,B,Q,ie);return Rs=null,Te}catch(Ce){if(Ce===Ds||Ce===sc)throw Ce;var Je=lt(29,Ce,null,q.mode);return Je.lanes=ie,Je.return=q,Je}}}var Yi=Xm(!0),Zm=Xm(!1),ii=!1;function td(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nd(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function si(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ri(e,t,n){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(tt&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=wl(e),Er(e,null,n),t}return Wl(e,i,t,n),wl(e)}function Ir(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,En(e,n)}}function ad(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var u=null,f=null;if(n=n.firstBaseUpdate,n!==null){do{var y={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};f===null?u=f=y:f=f.next=y,n=n.next}while(n!==null);f===null?u=f=t:f=f.next=t}else u=f=t;n={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:i.shared,callbacks:i.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var ld=!1;function Ur(){if(ld){var e=Es;if(e!==null)throw e}}function qr(e,t,n,i){ld=!1;var u=e.updateQueue;ii=!1;var f=u.firstBaseUpdate,y=u.lastBaseUpdate,N=u.shared.pending;if(N!==null){u.shared.pending=null;var _=N,K=_.next;_.next=null,y===null?f=K:y.next=K,y=_;var ae=e.alternate;ae!==null&&(ae=ae.updateQueue,N=ae.lastBaseUpdate,N!==y&&(N===null?ae.firstBaseUpdate=K:N.next=K,ae.lastBaseUpdate=_))}if(f!==null){var re=u.baseState;y=0,ae=K=_=null,N=f;do{var Z=N.lane&-536870913,J=Z!==N.lane;if(J?(Qe&Z)===Z:(i&Z)===Z){Z!==0&&Z===ks&&(ld=!0),ae!==null&&(ae=ae.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Me=e,Le=N;Z=t;var ft=n;switch(Le.tag){case 1:if(Me=Le.payload,typeof Me=="function"){re=Me.call(ft,re,Z);break e}re=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=Le.payload,Z=typeof Me=="function"?Me.call(ft,re,Z):Me,Z==null)break e;re=v({},re,Z);break e;case 2:ii=!0}}Z=N.callback,Z!==null&&(e.flags|=64,J&&(e.flags|=8192),J=u.callbacks,J===null?u.callbacks=[Z]:J.push(Z))}else J={lane:Z,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ae===null?(K=ae=J,_=re):ae=ae.next=J,y|=Z;if(N=N.next,N===null){if(N=u.shared.pending,N===null)break;J=N,N=J.next,J.next=null,u.lastBaseUpdate=J,u.shared.pending=null}}while(!0);ae===null&&(_=re),u.baseState=_,u.firstBaseUpdate=K,u.lastBaseUpdate=ae,f===null&&(u.shared.lanes=0),fi|=y,e.lanes=y,e.memoizedState=re}}function Wm(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function Jm(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Wm(n[e],t)}var Ls=ne(null),uc=ne(0);function eh(e,t){e=_l,de(uc,e),de(Ls,t),_l=e|t.baseLanes}function id(){de(uc,_l),de(Ls,Ls.current)}function sd(){_l=uc.current,L(Ls),L(uc)}var na=ne(null),Sa=null;function oi(e){var t=e.alternate;de(Et,Et.current&1),de(na,e),Sa===null&&(t===null||Ls.current!==null||t.memoizedState!==null)&&(Sa=e)}function rd(e){de(Et,Et.current),de(na,e),Sa===null&&(Sa=e)}function th(e){e.tag===22?(de(Et,Et.current),de(na,e),Sa===null&&(Sa=e)):ci()}function ci(){de(Et,Et.current),de(na,na.current)}function aa(e){L(na),Sa===e&&(Sa=null),L(Et)}var Et=ne(0);function dc(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||hf(n)||pf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Nl=0,Be=null,ut=null,Ot=null,fc=!1,_s=!1,Vi=!1,mc=0,$r=0,zs=null,gy=0;function jt(){throw Error(r(321))}function od(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Sn(e[n],t[n]))return!1;return!0}function cd(e,t,n,i,u,f){return Nl=f,Be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,H.H=e===null||e.memoizedState===null?Hh:Cd,Vi=!1,f=n(i,u),Vi=!1,_s&&(f=ah(t,n,i,u)),nh(e),f}function nh(e){H.H=Vr;var t=ut!==null&&ut.next!==null;if(Nl=0,Ot=ut=Be=null,fc=!1,$r=0,zs=null,t)throw Error(r(300));e===null||Bt||(e=e.dependencies,e!==null&&ac(e)&&(Bt=!0))}function ah(e,t,n,i){Be=e;var u=0;do{if(_s&&(zs=null),$r=0,_s=!1,25<=u)throw Error(r(301));if(u+=1,Ot=ut=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}H.H=Fh,f=t(n,i)}while(_s);return f}function xy(){var e=H.H,t=e.useState()[0];return t=typeof t.then=="function"?Gr(t):t,e=e.useState()[0],(ut!==null?ut.memoizedState:null)!==e&&(Be.flags|=1024),t}function ud(){var e=mc!==0;return mc=0,e}function dd(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function fd(e){if(fc){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}fc=!1}Nl=0,Ot=ut=Be=null,_s=!1,$r=mc=0,zs=null}function jn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ot===null?Be.memoizedState=Ot=e:Ot=Ot.next=e,Ot}function Dt(){if(ut===null){var e=Be.alternate;e=e!==null?e.memoizedState:null}else e=ut.next;var t=Ot===null?Be.memoizedState:Ot.next;if(t!==null)Ot=t,ut=e;else{if(e===null)throw Be.alternate===null?Error(r(467)):Error(r(310));ut=e,e={memoizedState:ut.memoizedState,baseState:ut.baseState,baseQueue:ut.baseQueue,queue:ut.queue,next:null},Ot===null?Be.memoizedState=Ot=e:Ot=Ot.next=e}return Ot}function hc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Gr(e){var t=$r;return $r+=1,zs===null&&(zs=[]),e=Pm(zs,e,t),t=Be,(Ot===null?t.memoizedState:Ot.next)===null&&(t=t.alternate,H.H=t===null||t.memoizedState===null?Hh:Cd),e}function pc(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Gr(e);if(e.$$typeof===z)return an(e)}throw Error(r(438,String(e)))}function md(e){var t=null,n=Be.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var i=Be.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=hc(),Be.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),i=0;i<e;i++)n[i]=V;return t.index++,n}function Al(e,t){return typeof t=="function"?t(e):t}function gc(e){var t=Dt();return hd(t,ut,e)}function hd(e,t,n){var i=e.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=n;var u=e.baseQueue,f=i.pending;if(f!==null){if(u!==null){var y=u.next;u.next=f.next,f.next=y}t.baseQueue=u=f,i.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{t=u.next;var N=y=null,_=null,K=t,ae=!1;do{var re=K.lane&-536870913;if(re!==K.lane?(Qe&re)===re:(Nl&re)===re){var Z=K.revertLane;if(Z===0)_!==null&&(_=_.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),re===ks&&(ae=!0);else if((Nl&Z)===Z){K=K.next,Z===ks&&(ae=!0);continue}else re={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},_===null?(N=_=re,y=f):_=_.next=re,Be.lanes|=Z,fi|=Z;re=K.action,Vi&&n(f,re),f=K.hasEagerState?K.eagerState:n(f,re)}else Z={lane:re,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},_===null?(N=_=Z,y=f):_=_.next=Z,Be.lanes|=re,fi|=re;K=K.next}while(K!==null&&K!==t);if(_===null?y=f:_.next=N,!Sn(f,e.memoizedState)&&(Bt=!0,ae&&(n=Es,n!==null)))throw n;e.memoizedState=f,e.baseState=y,e.baseQueue=_,i.lastRenderedState=f}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function pd(e){var t=Dt(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,u=n.pending,f=t.memoizedState;if(u!==null){n.pending=null;var y=u=u.next;do f=e(f,y.action),y=y.next;while(y!==u);Sn(f,t.memoizedState)||(Bt=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),n.lastRenderedState=f}return[f,i]}function lh(e,t,n){var i=Be,u=Dt(),f=O;if(f){if(n===void 0)throw Error(r(407));n=n()}else n=t();var y=!Sn((ut||u).memoizedState,n);if(y&&(u.memoizedState=n,Bt=!0),u=u.queue,vd(rh.bind(null,i,u,e),[e]),u.getSnapshot!==t||y||Ot!==null&&Ot.memoizedState.tag&1){if(i.flags|=2048,Os(9,{destroy:void 0},sh.bind(null,i,u,n,t),null),ht===null)throw Error(r(349));f||(Nl&127)!==0||ih(i,t,n)}return n}function ih(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Be.updateQueue,t===null?(t=hc(),Be.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function sh(e,t,n,i){t.value=n,t.getSnapshot=i,oh(t)&&ch(e)}function rh(e,t,n){return n(function(){oh(t)&&ch(e)})}function oh(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Sn(e,n)}catch{return!0}}function ch(e){var t=bl(e,2);t!==null&&qn(t,e,2)}function gd(e){var t=jn();if(typeof e=="function"){var n=e;if(e=n(),Vi){Pt(!0);try{n()}finally{Pt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Al,lastRenderedState:e},t}function uh(e,t,n,i){return e.baseState=n,hd(e,ut,typeof i=="function"?i:Al)}function vy(e,t,n,i,u){if(yc(e))throw Error(r(485));if(e=t.action,e!==null){var f={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){f.listeners.push(y)}};H.T!==null?n(!0):f.isTransition=!1,i(f),n=t.pending,n===null?(f.next=t.pending=f,dh(t,f)):(f.next=n.next,t.pending=n.next=f)}}function dh(e,t){var n=t.action,i=t.payload,u=e.state;if(t.isTransition){var f=H.T,y={};H.T=y;try{var N=n(u,i),_=H.S;_!==null&&_(y,N),fh(e,t,N)}catch(K){xd(e,t,K)}finally{f!==null&&y.types!==null&&(f.types=y.types),H.T=f}}else try{f=n(u,i),fh(e,t,f)}catch(K){xd(e,t,K)}}function fh(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){mh(e,t,i)},function(i){return xd(e,t,i)}):mh(e,t,n)}function mh(e,t,n){t.status="fulfilled",t.value=n,hh(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,dh(e,n)))}function xd(e,t,n){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=n,hh(t),t=t.next;while(t!==i)}e.action=null}function hh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ph(e,t){return t}function gh(e,t){if(O){var n=ht.formState;if(n!==null){e:{var i=Be;if(O){if(F){t:{for(var u=F,f=ce;u.nodeType!==8;){if(!f){u=null;break t}if(u=Ma(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){F=Ma(u.nextSibling),i=u.data==="F!";break e}}Se(i)}i=!1}i&&(t=n[0])}}return n=jn(),n.memoizedState=n.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ph,lastRenderedState:t},n.queue=i,n=zh.bind(null,Be,i),i.dispatch=n,i=gd(!1),f=Md.bind(null,Be,!1,i.queue),i=jn(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,n=vy.bind(null,Be,u,f,n),u.dispatch=n,i.memoizedState=e,[t,n,!1]}function xh(e){var t=Dt();return vh(t,ut,e)}function vh(e,t,n){if(t=hd(e,t,ph)[0],e=gc(Al)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=Gr(t)}catch(y){throw y===Ds?sc:y}else i=t;t=Dt();var u=t.queue,f=u.dispatch;return n!==t.memoizedState&&(Be.flags|=2048,Os(9,{destroy:void 0},yy.bind(null,u,n),null)),[i,f,e]}function yy(e,t){e.action=t}function yh(e){var t=Dt(),n=ut;if(n!==null)return vh(t,n,e);Dt(),t=t.memoizedState,n=Dt();var i=n.queue.dispatch;return n.memoizedState=e,[t,i,!1]}function Os(e,t,n,i){return e={tag:e,create:n,deps:i,inst:t,next:null},t=Be.updateQueue,t===null&&(t=hc(),Be.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(i=n.next,n.next=e,e.next=i,t.lastEffect=e),e}function bh(){return Dt().memoizedState}function xc(e,t,n,i){var u=jn();Be.flags|=e,u.memoizedState=Os(1|t,{destroy:void 0},n,i===void 0?null:i)}function vc(e,t,n,i){var u=Dt();i=i===void 0?null:i;var f=u.memoizedState.inst;ut!==null&&i!==null&&od(i,ut.memoizedState.deps)?u.memoizedState=Os(t,f,n,i):(Be.flags|=e,u.memoizedState=Os(1|t,f,n,i))}function wh(e,t){xc(8390656,8,e,t)}function vd(e,t){vc(2048,8,e,t)}function by(e){Be.flags|=4;var t=Be.updateQueue;if(t===null)t=hc(),Be.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Sh(e){var t=Dt().memoizedState;return by({ref:t,nextImpl:e}),function(){if((tt&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function Mh(e,t){return vc(4,2,e,t)}function Ch(e,t){return vc(4,4,e,t)}function jh(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Nh(e,t,n){n=n!=null?n.concat([e]):null,vc(4,4,jh.bind(null,t,e),n)}function yd(){}function Ah(e,t){var n=Dt();t=t===void 0?null:t;var i=n.memoizedState;return t!==null&&od(t,i[1])?i[0]:(n.memoizedState=[e,t],e)}function Th(e,t){var n=Dt();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&od(t,i[1]))return i[0];if(i=e(),Vi){Pt(!0);try{e()}finally{Pt(!1)}}return n.memoizedState=[i,t],i}function bd(e,t,n){return n===void 0||(Nl&1073741824)!==0&&(Qe&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=kp(),Be.lanes|=e,fi|=e,n)}function kh(e,t,n,i){return Sn(n,t)?n:Ls.current!==null?(e=bd(e,n,i),Sn(e,t)||(Bt=!0),e):(Nl&42)===0||(Nl&1073741824)!==0&&(Qe&261930)===0?(Bt=!0,e.memoizedState=n):(e=kp(),Be.lanes|=e,fi|=e,t)}function Eh(e,t,n,i,u){var f=X.p;X.p=f!==0&&8>f?f:8;var y=H.T,N={};H.T=N,Md(e,!1,t,n);try{var _=u(),K=H.S;if(K!==null&&K(N,_),_!==null&&typeof _=="object"&&typeof _.then=="function"){var ae=py(_,i);Yr(e,t,ae,sa(e))}else Yr(e,t,i,sa(e))}catch(re){Yr(e,t,{then:function(){},status:"rejected",reason:re},sa())}finally{X.p=f,y!==null&&N.types!==null&&(y.types=N.types),H.T=y}}function wy(){}function wd(e,t,n,i){if(e.tag!==5)throw Error(r(476));var u=Dh(e).queue;Eh(e,u,t,te,n===null?wy:function(){return Rh(e),n(i)})}function Dh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:te,baseState:te,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Al,lastRenderedState:te},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Al,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Rh(e){var t=Dh(e);t.next===null&&(t=e.alternate.memoizedState),Yr(e,t.next.queue,{},sa())}function Sd(){return an(oo)}function Lh(){return Dt().memoizedState}function _h(){return Dt().memoizedState}function Sy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=sa();e=si(n);var i=ri(t,e,n);i!==null&&(qn(i,t,n),Ir(i,t,n)),t={cache:Zu()},e.payload=t;return}t=t.return}}function My(e,t,n){var i=sa();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},yc(e)?Oh(t,n):(n=kr(e,t,n,i),n!==null&&(qn(n,e,i),Bh(n,t,i)))}function zh(e,t,n){var i=sa();Yr(e,t,n,i)}function Yr(e,t,n,i){var u={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(yc(e))Oh(t,u);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var y=t.lastRenderedState,N=f(y,n);if(u.hasEagerState=!0,u.eagerState=N,Sn(N,y))return Wl(e,t,u,0),ht===null&&Fi(),!1}catch{}if(n=kr(e,t,u,i),n!==null)return qn(n,e,i),Bh(n,t,i),!0}return!1}function Md(e,t,n,i){if(i={lane:2,revertLane:tf(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},yc(e)){if(t)throw Error(r(479))}else t=kr(e,n,i,2),t!==null&&qn(t,e,2)}function yc(e){var t=e.alternate;return e===Be||t!==null&&t===Be}function Oh(e,t){_s=fc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Bh(e,t,n){if((n&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,En(e,n)}}var Vr={readContext:an,use:pc,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useLayoutEffect:jt,useInsertionEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useSyncExternalStore:jt,useId:jt,useHostTransitionStatus:jt,useFormState:jt,useActionState:jt,useOptimistic:jt,useMemoCache:jt,useCacheRefresh:jt};Vr.useEffectEvent=jt;var Hh={readContext:an,use:pc,useCallback:function(e,t){return jn().memoizedState=[e,t===void 0?null:t],e},useContext:an,useEffect:wh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,xc(4194308,4,jh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return xc(4194308,4,e,t)},useInsertionEffect:function(e,t){xc(4,2,e,t)},useMemo:function(e,t){var n=jn();t=t===void 0?null:t;var i=e();if(Vi){Pt(!0);try{e()}finally{Pt(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=jn();if(n!==void 0){var u=n(t);if(Vi){Pt(!0);try{n(t)}finally{Pt(!1)}}}else u=t;return i.memoizedState=i.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},i.queue=e,e=e.dispatch=My.bind(null,Be,e),[i.memoizedState,e]},useRef:function(e){var t=jn();return e={current:e},t.memoizedState=e},useState:function(e){e=gd(e);var t=e.queue,n=zh.bind(null,Be,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:yd,useDeferredValue:function(e,t){var n=jn();return bd(n,e,t)},useTransition:function(){var e=gd(!1);return e=Eh.bind(null,Be,e.queue,!0,!1),jn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=Be,u=jn();if(O){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),ht===null)throw Error(r(349));(Qe&127)!==0||ih(i,t,n)}u.memoizedState=n;var f={value:n,getSnapshot:t};return u.queue=f,wh(rh.bind(null,i,f,e),[e]),i.flags|=2048,Os(9,{destroy:void 0},sh.bind(null,i,f,n,t),null),n},useId:function(){var e=jn(),t=ht.identifierPrefix;if(O){var n=ba,i=wt;n=(i&~(1<<32-At(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=mc++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=gy++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Sd,useFormState:gh,useActionState:gh,useOptimistic:function(e){var t=jn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Md.bind(null,Be,!0,n),n.dispatch=t,[e,t]},useMemoCache:md,useCacheRefresh:function(){return jn().memoizedState=Sy.bind(null,Be)},useEffectEvent:function(e){var t=jn(),n={impl:e};return t.memoizedState=n,function(){if((tt&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},Cd={readContext:an,use:pc,useCallback:Ah,useContext:an,useEffect:vd,useImperativeHandle:Nh,useInsertionEffect:Mh,useLayoutEffect:Ch,useMemo:Th,useReducer:gc,useRef:bh,useState:function(){return gc(Al)},useDebugValue:yd,useDeferredValue:function(e,t){var n=Dt();return kh(n,ut.memoizedState,e,t)},useTransition:function(){var e=gc(Al)[0],t=Dt().memoizedState;return[typeof e=="boolean"?e:Gr(e),t]},useSyncExternalStore:lh,useId:Lh,useHostTransitionStatus:Sd,useFormState:xh,useActionState:xh,useOptimistic:function(e,t){var n=Dt();return uh(n,ut,e,t)},useMemoCache:md,useCacheRefresh:_h};Cd.useEffectEvent=Sh;var Fh={readContext:an,use:pc,useCallback:Ah,useContext:an,useEffect:vd,useImperativeHandle:Nh,useInsertionEffect:Mh,useLayoutEffect:Ch,useMemo:Th,useReducer:pd,useRef:bh,useState:function(){return pd(Al)},useDebugValue:yd,useDeferredValue:function(e,t){var n=Dt();return ut===null?bd(n,e,t):kh(n,ut.memoizedState,e,t)},useTransition:function(){var e=pd(Al)[0],t=Dt().memoizedState;return[typeof e=="boolean"?e:Gr(e),t]},useSyncExternalStore:lh,useId:Lh,useHostTransitionStatus:Sd,useFormState:yh,useActionState:yh,useOptimistic:function(e,t){var n=Dt();return ut!==null?uh(n,ut,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:md,useCacheRefresh:_h};Fh.useEffectEvent=Sh;function jd(e,t,n,i){t=e.memoizedState,n=n(i,t),n=n==null?t:v({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Nd={enqueueSetState:function(e,t,n){e=e._reactInternals;var i=sa(),u=si(i);u.payload=t,n!=null&&(u.callback=n),t=ri(e,u,i),t!==null&&(qn(t,e,i),Ir(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=sa(),u=si(i);u.tag=1,u.payload=t,n!=null&&(u.callback=n),t=ri(e,u,i),t!==null&&(qn(t,e,i),Ir(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=sa(),i=si(n);i.tag=2,t!=null&&(i.callback=t),t=ri(e,i,n),t!==null&&(qn(t,e,n),Ir(t,e,n))}};function Ih(e,t,n,i,u,f,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,f,y):t.prototype&&t.prototype.isPureReactComponent?!Qa(n,i)||!Qa(u,f):!0}function Uh(e,t,n,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,i),t.state!==e&&Nd.enqueueReplaceState(t,t.state,null)}function Pi(e,t){var n=t;if("ref"in t){n={};for(var i in t)i!=="ref"&&(n[i]=t[i])}if(e=e.defaultProps){n===t&&(n=v({},n));for(var u in e)n[u]===void 0&&(n[u]=e[u])}return n}function qh(e){Ns(e)}function $h(e){console.error(e)}function Gh(e){Ns(e)}function bc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function Yh(e,t,n){try{var i=e.onCaughtError;i(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Ad(e,t,n){return n=si(n),n.tag=3,n.payload={element:null},n.callback=function(){bc(e,t)},n}function Vh(e){return e=si(e),e.tag=3,e}function Ph(e,t,n,i){var u=n.type.getDerivedStateFromError;if(typeof u=="function"){var f=i.value;e.payload=function(){return u(f)},e.callback=function(){Yh(t,n,i)}}var y=n.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){Yh(t,n,i),typeof u!="function"&&(mi===null?mi=new Set([this]):mi.add(this));var N=i.stack;this.componentDidCatch(i.value,{componentStack:N!==null?N:""})})}function Cy(e,t,n,i,u){if(n.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=n.alternate,t!==null&&Ts(t,n,u,!0),n=na.current,n!==null){switch(n.tag){case 31:case 13:return Sa===null?Rc():n.alternate===null&&Nt===0&&(Nt=3),n.flags&=-257,n.flags|=65536,n.lanes=u,i===rc?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([i]):t.add(i),Wd(e,i,u)),!1;case 22:return n.flags|=65536,i===rc?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([i]):n.add(i)),Wd(e,i,u)),!1}throw Error(r(435,n.tag))}return Wd(e,i,u),Rc(),!1}if(O)return t=na.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==he&&(e=Error(r(422),{cause:i}),Cn(Mn(e,n)))):(i!==he&&(t=Error(r(423),{cause:i}),Cn(Mn(t,n))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=Mn(i,n),u=Ad(e.stateNode,i,u),ad(e,u),Nt!==4&&(Nt=2)),!1;var f=Error(r(520),{cause:i});if(f=Mn(f,n),eo===null?eo=[f]:eo.push(f),Nt!==4&&(Nt=2),t===null)return!0;i=Mn(i,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=u&-u,n.lanes|=e,e=Ad(n.stateNode,i,e),ad(n,e),!1;case 1:if(t=n.type,f=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(mi===null||!mi.has(f))))return n.flags|=65536,u&=-u,n.lanes|=u,u=Vh(u),Ph(u,e,n,i),ad(n,u),!1}n=n.return}while(n!==null);return!1}var Td=Error(r(461)),Bt=!1;function ln(e,t,n,i){t.child=e===null?Zm(t,null,n,i):Yi(t,e.child,n,i)}function Qh(e,t,n,i,u){n=n.render;var f=t.ref;if("ref"in i){var y={};for(var N in i)N!=="ref"&&(y[N]=i[N])}else y=i;return Ui(t),i=cd(e,t,n,y,f,u),N=ud(),e!==null&&!Bt?(dd(e,t,u),Tl(e,t,u)):(O&&N&&_r(t),t.flags|=1,ln(e,t,i,u),t.child)}function Kh(e,t,n,i,u){if(e===null){var f=n.type;return typeof f=="function"&&!ei(f)&&f.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=f,Xh(e,t,f,i,u)):(e=Dr(n.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!Od(e,u)){var y=f.memoizedProps;if(n=n.compare,n=n!==null?n:Qa,n(y,i)&&e.ref===t.ref)return Tl(e,t,u)}return t.flags|=1,e=ya(f,i),e.ref=t.ref,e.return=t,t.child=e}function Xh(e,t,n,i,u){if(e!==null){var f=e.memoizedProps;if(Qa(f,i)&&e.ref===t.ref)if(Bt=!1,t.pendingProps=i=f,Od(e,u))(e.flags&131072)!==0&&(Bt=!0);else return t.lanes=e.lanes,Tl(e,t,u)}return kd(e,t,n,i,u)}function Zh(e,t,n,i){var u=i.children,f=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(f=f!==null?f.baseLanes|n:n,e!==null){for(i=t.child=e.child,u=0;i!==null;)u=u|i.lanes|i.childLanes,i=i.sibling;i=u&~f}else i=0,t.child=null;return Wh(e,t,f,n,i)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ic(t,f!==null?f.cachePool:null),f!==null?eh(t,f):id(),th(t);else return i=t.lanes=536870912,Wh(e,t,f!==null?f.baseLanes|n:n,n,i)}else f!==null?(ic(t,f.cachePool),eh(t,f),ci(),t.memoizedState=null):(e!==null&&ic(t,null),id(),ci());return ln(e,t,u,n),t.child}function Pr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Wh(e,t,n,i,u){var f=Ju();return f=f===null?null:{parent:zt._currentValue,pool:f},t.memoizedState={baseLanes:n,cachePool:f},e!==null&&ic(t,null),id(),th(t),e!==null&&Ts(e,t,i,!0),t.childLanes=u,null}function wc(e,t){return t=Mc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Jh(e,t,n){return Yi(t,e.child,null,n),e=wc(t,t.pendingProps),e.flags|=2,aa(t),t.memoizedState=null,e}function jy(e,t,n){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(O){if(i.mode==="hidden")return e=wc(t,i),t.lanes=536870912,Pr(null,e);if(rd(t),(e=F)?(e=dg(e,ce),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Xa!==null?{id:wt,overflow:ba}:null,retryLane:536870912,hydrationErrors:null},n=Lr(e),n.return=t,t.child=n,D=t,F=null)):e=null,e===null)throw Se(t);return t.lanes=536870912,null}return wc(t,i)}var f=e.memoizedState;if(f!==null){var y=f.dehydrated;if(rd(t),u)if(t.flags&256)t.flags&=-257,t=Jh(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(Bt||Ts(e,t,n,!1),u=(n&e.childLanes)!==0,Bt||u){if(i=ht,i!==null&&(y=Ra(i,n),y!==0&&y!==f.retryLane))throw f.retryLane=y,bl(e,y),qn(i,e,y),Td;Rc(),t=Jh(e,t,n)}else e=f.treeContext,F=Ma(y.nextSibling),D=t,O=!0,U=null,ce=!1,e!==null&&w(t,e),t=wc(t,i),t.flags|=4096;return t}return e=ya(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Sc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(r(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function kd(e,t,n,i,u){return Ui(t),n=cd(e,t,n,i,void 0,u),i=ud(),e!==null&&!Bt?(dd(e,t,u),Tl(e,t,u)):(O&&i&&_r(t),t.flags|=1,ln(e,t,n,u),t.child)}function ep(e,t,n,i,u,f){return Ui(t),t.updateQueue=null,n=ah(t,i,n,u),nh(e),i=ud(),e!==null&&!Bt?(dd(e,t,f),Tl(e,t,f)):(O&&i&&_r(t),t.flags|=1,ln(e,t,n,f),t.child)}function tp(e,t,n,i,u){if(Ui(t),t.stateNode===null){var f=Jl,y=n.contextType;typeof y=="object"&&y!==null&&(f=an(y)),f=new n(i,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=Nd,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=i,f.state=t.memoizedState,f.refs={},td(t),y=n.contextType,f.context=typeof y=="object"&&y!==null?an(y):Jl,f.state=t.memoizedState,y=n.getDerivedStateFromProps,typeof y=="function"&&(jd(t,n,y,i),f.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(y=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),y!==f.state&&Nd.enqueueReplaceState(f,f.state,null),qr(t,i,f,u),Ur(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){f=t.stateNode;var N=t.memoizedProps,_=Pi(n,N);f.props=_;var K=f.context,ae=n.contextType;y=Jl,typeof ae=="object"&&ae!==null&&(y=an(ae));var re=n.getDerivedStateFromProps;ae=typeof re=="function"||typeof f.getSnapshotBeforeUpdate=="function",N=t.pendingProps!==N,ae||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(N||K!==y)&&Uh(t,f,i,y),ii=!1;var Z=t.memoizedState;f.state=Z,qr(t,i,f,u),Ur(),K=t.memoizedState,N||Z!==K||ii?(typeof re=="function"&&(jd(t,n,re,i),K=t.memoizedState),(_=ii||Ih(t,n,_,i,Z,K,y))?(ae||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(t.flags|=4194308)):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=K),f.props=i,f.state=K,f.context=y,i=_):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{f=t.stateNode,nd(e,t),y=t.memoizedProps,ae=Pi(n,y),f.props=ae,re=t.pendingProps,Z=f.context,K=n.contextType,_=Jl,typeof K=="object"&&K!==null&&(_=an(K)),N=n.getDerivedStateFromProps,(K=typeof N=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y!==re||Z!==_)&&Uh(t,f,i,_),ii=!1,Z=t.memoizedState,f.state=Z,qr(t,i,f,u),Ur();var J=t.memoizedState;y!==re||Z!==J||ii||e!==null&&e.dependencies!==null&&ac(e.dependencies)?(typeof N=="function"&&(jd(t,n,N,i),J=t.memoizedState),(ae=ii||Ih(t,n,ae,i,Z,J,_)||e!==null&&e.dependencies!==null&&ac(e.dependencies))?(K||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(i,J,_),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(i,J,_)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&Z===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&Z===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=J),f.props=i,f.state=J,f.context=_,i=ae):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&Z===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&Z===e.memoizedState||(t.flags|=1024),i=!1)}return f=i,Sc(e,t),i=(t.flags&128)!==0,f||i?(f=t.stateNode,n=i&&typeof n.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&i?(t.child=Yi(t,e.child,null,u),t.child=Yi(t,null,n,u)):ln(e,t,n,u),t.memoizedState=f.state,e=t.child):e=Tl(e,t,u),e}function np(e,t,n,i){return Ct(),t.flags|=256,ln(e,t,n,i),t.child}var Ed={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Dd(e){return{baseLanes:e,cachePool:Ym()}}function Rd(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=ia),e}function ap(e,t,n){var i=t.pendingProps,u=!1,f=(t.flags&128)!==0,y;if((y=f)||(y=e!==null&&e.memoizedState===null?!1:(Et.current&2)!==0),y&&(u=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(O){if(u?oi(t):ci(),(e=F)?(e=dg(e,ce),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Xa!==null?{id:wt,overflow:ba}:null,retryLane:536870912,hydrationErrors:null},n=Lr(e),n.return=t,t.child=n,D=t,F=null)):e=null,e===null)throw Se(t);return pf(e)?t.lanes=32:t.lanes=536870912,null}var N=i.children;return i=i.fallback,u?(ci(),u=t.mode,N=Mc({mode:"hidden",children:N},u),i=Sl(i,u,n,null),N.return=t,i.return=t,N.sibling=i,t.child=N,i=t.child,i.memoizedState=Dd(n),i.childLanes=Rd(e,y,n),t.memoizedState=Ed,Pr(null,i)):(oi(t),Ld(t,N))}var _=e.memoizedState;if(_!==null&&(N=_.dehydrated,N!==null)){if(f)t.flags&256?(oi(t),t.flags&=-257,t=_d(e,t,n)):t.memoizedState!==null?(ci(),t.child=e.child,t.flags|=128,t=null):(ci(),N=i.fallback,u=t.mode,i=Mc({mode:"visible",children:i.children},u),N=Sl(N,u,n,null),N.flags|=2,i.return=t,N.return=t,i.sibling=N,t.child=i,Yi(t,e.child,null,n),i=t.child,i.memoizedState=Dd(n),i.childLanes=Rd(e,y,n),t.memoizedState=Ed,t=Pr(null,i));else if(oi(t),pf(N)){if(y=N.nextSibling&&N.nextSibling.dataset,y)var K=y.dgst;y=K,i=Error(r(419)),i.stack="",i.digest=y,Cn({value:i,source:null,stack:null}),t=_d(e,t,n)}else if(Bt||Ts(e,t,n,!1),y=(n&e.childLanes)!==0,Bt||y){if(y=ht,y!==null&&(i=Ra(y,n),i!==0&&i!==_.retryLane))throw _.retryLane=i,bl(e,i),qn(y,e,i),Td;hf(N)||Rc(),t=_d(e,t,n)}else hf(N)?(t.flags|=192,t.child=e.child,t=null):(e=_.treeContext,F=Ma(N.nextSibling),D=t,O=!0,U=null,ce=!1,e!==null&&w(t,e),t=Ld(t,i.children),t.flags|=4096);return t}return u?(ci(),N=i.fallback,u=t.mode,_=e.child,K=_.sibling,i=ya(_,{mode:"hidden",children:i.children}),i.subtreeFlags=_.subtreeFlags&65011712,K!==null?N=ya(K,N):(N=Sl(N,u,n,null),N.flags|=2),N.return=t,i.return=t,i.sibling=N,t.child=i,Pr(null,i),i=t.child,N=e.child.memoizedState,N===null?N=Dd(n):(u=N.cachePool,u!==null?(_=zt._currentValue,u=u.parent!==_?{parent:_,pool:_}:u):u=Ym(),N={baseLanes:N.baseLanes|n,cachePool:u}),i.memoizedState=N,i.childLanes=Rd(e,y,n),t.memoizedState=Ed,Pr(e.child,i)):(oi(t),n=e.child,e=n.sibling,n=ya(n,{mode:"visible",children:i.children}),n.return=t,n.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=n,t.memoizedState=null,n)}function Ld(e,t){return t=Mc({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Mc(e,t){return e=lt(22,e,null,t),e.lanes=0,e}function _d(e,t,n){return Yi(t,e.child,null,n),e=Ld(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function lp(e,t,n){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Ku(e.return,t,n)}function zd(e,t,n,i,u,f){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:u,treeForkCount:f}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=i,y.tail=n,y.tailMode=u,y.treeForkCount=f)}function ip(e,t,n){var i=t.pendingProps,u=i.revealOrder,f=i.tail;i=i.children;var y=Et.current,N=(y&2)!==0;if(N?(y=y&1|2,t.flags|=128):y&=1,de(Et,y),ln(e,t,i,n),i=O?Ii:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&lp(e,n,t);else if(e.tag===19)lp(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(n=t.child,u=null;n!==null;)e=n.alternate,e!==null&&dc(e)===null&&(u=n),n=n.sibling;n=u,n===null?(u=t.child,t.child=null):(u=n.sibling,n.sibling=null),zd(t,!1,u,n,f,i);break;case"backwards":case"unstable_legacy-backwards":for(n=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&dc(e)===null){t.child=u;break}e=u.sibling,u.sibling=n,n=u,u=e}zd(t,!0,n,null,f,i);break;case"together":zd(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function Tl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),fi|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Ts(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=ya(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ya(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Od(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&ac(e)))}function Ny(e,t,n){switch(t.tag){case 3:_e(t,t.stateNode.containerInfo),Za(t,zt,e.memoizedState.cache),Ct();break;case 27:case 5:$e(t);break;case 4:_e(t,t.stateNode.containerInfo);break;case 10:Za(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,rd(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(oi(t),t.flags|=128,null):(n&t.child.childLanes)!==0?ap(e,t,n):(oi(t),e=Tl(e,t,n),e!==null?e.sibling:null);oi(t);break;case 19:var u=(e.flags&128)!==0;if(i=(n&t.childLanes)!==0,i||(Ts(e,t,n,!1),i=(n&t.childLanes)!==0),u){if(i)return ip(e,t,n);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),de(Et,Et.current),i)break;return null;case 22:return t.lanes=0,Zh(e,t,n,t.pendingProps);case 24:Za(t,zt,e.memoizedState.cache)}return Tl(e,t,n)}function sp(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Bt=!0;else{if(!Od(e,n)&&(t.flags&128)===0)return Bt=!1,Ny(e,t,n);Bt=(e.flags&131072)!==0}else Bt=!1,O&&(t.flags&1048576)!==0&&Ml(t,Ii,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=$i(t.elementType),t.type=e,typeof e=="function")ei(e)?(i=Pi(e,i),t.tag=1,t=tp(null,t,e,i,n)):(t.tag=0,t=kd(null,t,e,i,n));else{if(e!=null){var u=e.$$typeof;if(u===G){t.tag=11,t=Qh(null,t,e,i,n);break e}else if(u===R){t.tag=14,t=Kh(null,t,e,i,n);break e}}throw t=le(e)||e,Error(r(306,t,""))}}return t;case 0:return kd(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,u=Pi(i,t.pendingProps),tp(e,t,i,u,n);case 3:e:{if(_e(t,t.stateNode.containerInfo),e===null)throw Error(r(387));i=t.pendingProps;var f=t.memoizedState;u=f.element,nd(e,t),qr(t,i,null,n);var y=t.memoizedState;if(i=y.cache,Za(t,zt,i),i!==f.cache&&Xu(t,[zt],n,!0),Ur(),i=y.element,f.isDehydrated)if(f={element:i,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=np(e,t,i,n);break e}else if(i!==u){u=Mn(Error(r(424)),t),Cn(u),t=np(e,t,i,n);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,F=Ma(e.firstChild),D=t,O=!0,U=null,ce=!0,n=Zm(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ct(),i===u){t=Tl(e,t,n);break e}ln(e,t,i,n)}t=t.child}return t;case 26:return Sc(e,t),e===null?(n=xg(t.type,null,t.pendingProps,null))?t.memoizedState=n:O||(n=t.type,e=t.pendingProps,i=Fc(ke.current).createElement(n),i[Y]=t,i[me]=e,sn(i,n,e),gt(i),t.stateNode=i):t.memoizedState=xg(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return $e(t),e===null&&O&&(i=t.stateNode=hg(t.type,t.pendingProps,ke.current),D=t,ce=!0,u=F,xi(t.type)?(gf=u,F=Ma(i.firstChild)):F=u),ln(e,t,t.pendingProps.children,n),Sc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&O&&((u=i=F)&&(i=nb(i,t.type,t.pendingProps,ce),i!==null?(t.stateNode=i,D=t,F=Ma(i.firstChild),ce=!1,u=!0):u=!1),u||Se(t)),$e(t),u=t.type,f=t.pendingProps,y=e!==null?e.memoizedProps:null,i=f.children,df(u,f)?i=null:y!==null&&df(u,y)&&(t.flags|=32),t.memoizedState!==null&&(u=cd(e,t,xy,null,null,n),oo._currentValue=u),Sc(e,t),ln(e,t,i,n),t.child;case 6:return e===null&&O&&((e=n=F)&&(n=ab(n,t.pendingProps,ce),n!==null?(t.stateNode=n,D=t,F=null,e=!0):e=!1),e||Se(t)),null;case 13:return ap(e,t,n);case 4:return _e(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Yi(t,null,i,n):ln(e,t,i,n),t.child;case 11:return Qh(e,t,t.type,t.pendingProps,n);case 7:return ln(e,t,t.pendingProps,n),t.child;case 8:return ln(e,t,t.pendingProps.children,n),t.child;case 12:return ln(e,t,t.pendingProps.children,n),t.child;case 10:return i=t.pendingProps,Za(t,t.type,i.value),ln(e,t,i.children,n),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,Ui(t),u=an(u),i=i(u),t.flags|=1,ln(e,t,i,n),t.child;case 14:return Kh(e,t,t.type,t.pendingProps,n);case 15:return Xh(e,t,t.type,t.pendingProps,n);case 19:return ip(e,t,n);case 31:return jy(e,t,n);case 22:return Zh(e,t,n,t.pendingProps);case 24:return Ui(t),i=an(zt),e===null?(u=Ju(),u===null&&(u=ht,f=Zu(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=n),u=f),t.memoizedState={parent:i,cache:u},td(t),Za(t,zt,u)):((e.lanes&n)!==0&&(nd(e,t),qr(t,null,null,n),Ur()),u=e.memoizedState,f=t.memoizedState,u.parent!==i?(u={parent:i,cache:i},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),Za(t,zt,i)):(i=f.cache,Za(t,zt,i),i!==u.cache&&Xu(t,[zt],n,!0))),ln(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function kl(e){e.flags|=4}function Bd(e,t,n,i,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(Lp())e.flags|=8192;else throw Gi=rc,ed}else e.flags&=-16777217}function rp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Sg(t))if(Lp())e.flags|=8192;else throw Gi=rc,ed}function Cc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?rl():536870912,e.lanes|=t,Is|=t)}function Qr(e,t){if(!O)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function vt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,i=0;if(t)for(var u=e.child;u!==null;)n|=u.lanes|u.childLanes,i|=u.subtreeFlags&65011712,i|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)n|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=n,t}function Ay(e,t,n){var i=t.pendingProps;switch(zr(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vt(t),null;case 1:return vt(t),null;case 3:return n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),jl(zt),Ee(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ct(t)?kl(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,wa())),vt(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(kl(t),f!==null?(vt(t),rp(t,f)):(vt(t),Bd(t,u,null,i,n))):f?f!==e.memoizedState?(kl(t),vt(t),rp(t,f)):(vt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&kl(t),vt(t),Bd(t,u,e,i,n)),null;case 27:if(Ne(t),n=ke.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&kl(t);else{if(!i){if(t.stateNode===null)throw Error(r(166));return vt(t),null}e=ve.current,ct(t)?We(t):(e=hg(u,i,n),t.stateNode=e,kl(t))}return vt(t),null;case 5:if(Ne(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&kl(t);else{if(!i){if(t.stateNode===null)throw Error(r(166));return vt(t),null}if(f=ve.current,ct(t))We(t);else{var y=Fc(ke.current);switch(f){case 1:f=y.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:f=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":f=y.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":f=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":f=y.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof i.is=="string"?y.createElement("select",{is:i.is}):y.createElement("select"),i.multiple?f.multiple=!0:i.size&&(f.size=i.size);break;default:f=typeof i.is=="string"?y.createElement(u,{is:i.is}):y.createElement(u)}}f[Y]=t,f[me]=i;e:for(y=t.child;y!==null;){if(y.tag===5||y.tag===6)f.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===t)break e;for(;y.sibling===null;){if(y.return===null||y.return===t)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}t.stateNode=f;e:switch(sn(f,u,i),u){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&kl(t)}}return vt(t),Bd(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&kl(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(r(166));if(e=ke.current,ct(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,u=D,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[Y]=t,e=!!(e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||ag(e.nodeValue,n)),e||Se(t,!0)}else e=Fc(e).createTextNode(i),e[Y]=t,t.stateNode=e}return vt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=ct(t),n!==null){if(e===null){if(!i)throw Error(r(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[Y]=t}else Ct(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;vt(t),e=!1}else n=wa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(aa(t),t):(aa(t),null);if((t.flags&128)!==0)throw Error(r(558))}return vt(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=ct(t),i!==null&&i.dehydrated!==null){if(e===null){if(!u)throw Error(r(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));u[Y]=t}else Ct(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;vt(t),u=!1}else u=wa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(aa(t),t):(aa(t),null)}return aa(t),(t.flags&128)!==0?(t.lanes=n,t):(n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(i=t.child,u=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(u=i.alternate.memoizedState.cachePool.pool),f=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(f=i.memoizedState.cachePool.pool),f!==u&&(i.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Cc(t,t.updateQueue),vt(t),null);case 4:return Ee(),e===null&&sf(t.stateNode.containerInfo),vt(t),null;case 10:return jl(t.type),vt(t),null;case 19:if(L(Et),i=t.memoizedState,i===null)return vt(t),null;if(u=(t.flags&128)!==0,f=i.rendering,f===null)if(u)Qr(i,!1);else{if(Nt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=dc(e),f!==null){for(t.flags|=128,Qr(i,!1),e=f.updateQueue,t.updateQueue=e,Cc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)nc(n,e),n=n.sibling;return de(Et,Et.current&1|2),O&&Ha(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&Re()>kc&&(t.flags|=128,u=!0,Qr(i,!1),t.lanes=4194304)}else{if(!u)if(e=dc(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Cc(t,e),Qr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!f.alternate&&!O)return vt(t),null}else 2*Re()-i.renderingStartTime>kc&&n!==536870912&&(t.flags|=128,u=!0,Qr(i,!1),t.lanes=4194304);i.isBackwards?(f.sibling=t.child,t.child=f):(e=i.last,e!==null?e.sibling=f:t.child=f,i.last=f)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Re(),e.sibling=null,n=Et.current,de(Et,u?n&1|2:n&1),O&&Ha(t,i.treeForkCount),e):(vt(t),null);case 22:case 23:return aa(t),sd(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(n&536870912)!==0&&(t.flags&128)===0&&(vt(t),t.subtreeFlags&6&&(t.flags|=8192)):vt(t),n=t.updateQueue,n!==null&&Cc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&L(qi),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),jl(zt),vt(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Ty(e,t){switch(zr(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return jl(zt),Ee(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ne(t),null;case 31:if(t.memoizedState!==null){if(aa(t),t.alternate===null)throw Error(r(340));Ct()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(aa(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ct()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return L(Et),null;case 4:return Ee(),null;case 10:return jl(t.type),null;case 22:case 23:return aa(t),sd(),e!==null&&L(qi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return jl(zt),null;case 25:return null;default:return null}}function op(e,t){switch(zr(t),t.tag){case 3:jl(zt),Ee();break;case 26:case 27:case 5:Ne(t);break;case 4:Ee();break;case 31:t.memoizedState!==null&&aa(t);break;case 13:aa(t);break;case 19:L(Et);break;case 10:jl(t.type);break;case 22:case 23:aa(t),sd(),e!==null&&L(qi);break;case 24:jl(zt)}}function Kr(e,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var u=i.next;n=u;do{if((n.tag&e)===e){i=void 0;var f=n.create,y=n.inst;i=f(),y.destroy=i}n=n.next}while(n!==u)}}catch(N){st(t,t.return,N)}}function ui(e,t,n){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var f=u.next;i=f;do{if((i.tag&e)===e){var y=i.inst,N=y.destroy;if(N!==void 0){y.destroy=void 0,u=t;var _=n,K=N;try{K()}catch(ae){st(u,_,ae)}}}i=i.next}while(i!==f)}}catch(ae){st(t,t.return,ae)}}function cp(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Jm(t,n)}catch(i){st(e,e.return,i)}}}function up(e,t,n){n.props=Pi(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){st(e,t,i)}}function Xr(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof n=="function"?e.refCleanup=n(i):n.current=i}}catch(u){st(e,t,u)}}function Wa(e,t){var n=e.ref,i=e.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(u){st(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(u){st(e,t,u)}else n.current=null}function dp(e){var t=e.type,n=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(u){st(e,e.return,u)}}function Hd(e,t,n){try{var i=e.stateNode;Xy(i,e.type,n,t),i[me]=t}catch(u){st(e,e.return,u)}}function fp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&xi(e.type)||e.tag===4}function Fd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||fp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&xi(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Id(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Jn));else if(i!==4&&(i===27&&xi(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Id(e,t,n),e=e.sibling;e!==null;)Id(e,t,n),e=e.sibling}function jc(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(i!==4&&(i===27&&xi(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(jc(e,t,n),e=e.sibling;e!==null;)jc(e,t,n),e=e.sibling}function mp(e){var t=e.stateNode,n=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);sn(t,i,n),t[Y]=e,t[me]=n}catch(f){st(e,e.return,f)}}var El=!1,Ht=!1,Ud=!1,hp=typeof WeakSet=="function"?WeakSet:Set,Zt=null;function ky(e,t){if(e=e.containerInfo,cf=Vc,e=Qo(e),Sr(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var u=i.anchorOffset,f=i.focusNode;i=i.focusOffset;try{n.nodeType,f.nodeType}catch{n=null;break e}var y=0,N=-1,_=-1,K=0,ae=0,re=e,Z=null;t:for(;;){for(var J;re!==n||u!==0&&re.nodeType!==3||(N=y+u),re!==f||i!==0&&re.nodeType!==3||(_=y+i),re.nodeType===3&&(y+=re.nodeValue.length),(J=re.firstChild)!==null;)Z=re,re=J;for(;;){if(re===e)break t;if(Z===n&&++K===u&&(N=y),Z===f&&++ae===i&&(_=y),(J=re.nextSibling)!==null)break;re=Z,Z=re.parentNode}re=J}n=N===-1||_===-1?null:{start:N,end:_}}else n=null}n=n||{start:0,end:0}}else n=null;for(uf={focusedElem:e,selectionRange:n},Vc=!1,Zt=t;Zt!==null;)if(t=Zt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Zt=e;else for(;Zt!==null;){switch(t=Zt,f=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)u=e[n],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,n=t,u=f.memoizedProps,f=f.memoizedState,i=n.stateNode;try{var Me=Pi(n.type,u);e=i.getSnapshotBeforeUpdate(Me,f),i.__reactInternalSnapshotBeforeUpdate=e}catch(Le){st(n,n.return,Le)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)mf(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":mf(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=t.sibling,e!==null){e.return=t.return,Zt=e;break}Zt=t.return}}function pp(e,t,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:Rl(e,n),i&4&&Kr(5,n);break;case 1:if(Rl(e,n),i&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(y){st(n,n.return,y)}else{var u=Pi(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){st(n,n.return,y)}}i&64&&cp(n),i&512&&Xr(n,n.return);break;case 3:if(Rl(e,n),i&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Jm(e,t)}catch(y){st(n,n.return,y)}}break;case 27:t===null&&i&4&&mp(n);case 26:case 5:Rl(e,n),t===null&&i&4&&dp(n),i&512&&Xr(n,n.return);break;case 12:Rl(e,n);break;case 31:Rl(e,n),i&4&&vp(e,n);break;case 13:Rl(e,n),i&4&&yp(e,n),i&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Hy.bind(null,n),lb(e,n))));break;case 22:if(i=n.memoizedState!==null||El,!i){t=t!==null&&t.memoizedState!==null||Ht,u=El;var f=Ht;El=i,(Ht=t)&&!f?Ll(e,n,(n.subtreeFlags&8772)!==0):Rl(e,n),El=u,Ht=f}break;case 30:break;default:Rl(e,n)}}function gp(e){var t=e.alternate;t!==null&&(e.alternate=null,gp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&nn(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var bt=null,Hn=!1;function Dl(e,t,n){for(n=n.child;n!==null;)xp(e,t,n),n=n.sibling}function xp(e,t,n){if(nt&&typeof nt.onCommitFiberUnmount=="function")try{nt.onCommitFiberUnmount(An,n)}catch{}switch(n.tag){case 26:Ht||Wa(n,t),Dl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Ht||Wa(n,t);var i=bt,u=Hn;xi(n.type)&&(bt=n.stateNode,Hn=!1),Dl(e,t,n),io(n.stateNode),bt=i,Hn=u;break;case 5:Ht||Wa(n,t);case 6:if(i=bt,u=Hn,bt=null,Dl(e,t,n),bt=i,Hn=u,bt!==null)if(Hn)try{(bt.nodeType===9?bt.body:bt.nodeName==="HTML"?bt.ownerDocument.body:bt).removeChild(n.stateNode)}catch(f){st(n,t,f)}else try{bt.removeChild(n.stateNode)}catch(f){st(n,t,f)}break;case 18:bt!==null&&(Hn?(e=bt,cg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Qs(e)):cg(bt,n.stateNode));break;case 4:i=bt,u=Hn,bt=n.stateNode.containerInfo,Hn=!0,Dl(e,t,n),bt=i,Hn=u;break;case 0:case 11:case 14:case 15:ui(2,n,t),Ht||ui(4,n,t),Dl(e,t,n);break;case 1:Ht||(Wa(n,t),i=n.stateNode,typeof i.componentWillUnmount=="function"&&up(n,t,i)),Dl(e,t,n);break;case 21:Dl(e,t,n);break;case 22:Ht=(i=Ht)||n.memoizedState!==null,Dl(e,t,n),Ht=i;break;default:Dl(e,t,n)}}function vp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Qs(e)}catch(n){st(t,t.return,n)}}}function yp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Qs(e)}catch(n){st(t,t.return,n)}}function Ey(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new hp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new hp),t;default:throw Error(r(435,e.tag))}}function Nc(e,t){var n=Ey(e);t.forEach(function(i){if(!n.has(i)){n.add(i);var u=Fy.bind(null,e,i);i.then(u,u)}})}function Fn(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var u=n[i],f=e,y=t,N=y;e:for(;N!==null;){switch(N.tag){case 27:if(xi(N.type)){bt=N.stateNode,Hn=!1;break e}break;case 5:bt=N.stateNode,Hn=!1;break e;case 3:case 4:bt=N.stateNode.containerInfo,Hn=!0;break e}N=N.return}if(bt===null)throw Error(r(160));xp(f,y,u),bt=null,Hn=!1,f=u.alternate,f!==null&&(f.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)bp(t,e),t=t.sibling}var Fa=null;function bp(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Fn(t,e),In(e),i&4&&(ui(3,e,e.return),Kr(3,e),ui(5,e,e.return));break;case 1:Fn(t,e),In(e),i&512&&(Ht||n===null||Wa(n,n.return)),i&64&&El&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?i:n.concat(i))));break;case 26:var u=Fa;if(Fn(t,e),In(e),i&512&&(Ht||n===null||Wa(n,n.return)),i&4){var f=n!==null?n.memoizedState:null;if(i=e.memoizedState,n===null)if(i===null)if(e.stateNode===null){e:{i=e.type,n=e.memoizedProps,u=u.ownerDocument||u;t:switch(i){case"title":f=u.getElementsByTagName("title")[0],(!f||f[Ze]||f[Y]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=u.createElement(i),u.head.insertBefore(f,u.querySelector("head > title"))),sn(f,i,n),f[Y]=e,gt(f),i=f;break e;case"link":var y=bg("link","href",u).get(i+(n.href||""));if(y){for(var N=0;N<y.length;N++)if(f=y[N],f.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&f.getAttribute("rel")===(n.rel==null?null:n.rel)&&f.getAttribute("title")===(n.title==null?null:n.title)&&f.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){y.splice(N,1);break t}}f=u.createElement(i),sn(f,i,n),u.head.appendChild(f);break;case"meta":if(y=bg("meta","content",u).get(i+(n.content||""))){for(N=0;N<y.length;N++)if(f=y[N],f.getAttribute("content")===(n.content==null?null:""+n.content)&&f.getAttribute("name")===(n.name==null?null:n.name)&&f.getAttribute("property")===(n.property==null?null:n.property)&&f.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&f.getAttribute("charset")===(n.charSet==null?null:n.charSet)){y.splice(N,1);break t}}f=u.createElement(i),sn(f,i,n),u.head.appendChild(f);break;default:throw Error(r(468,i))}f[Y]=e,gt(f),i=f}e.stateNode=i}else wg(u,e.type,e.stateNode);else e.stateNode=yg(u,i,e.memoizedProps);else f!==i?(f===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):f.count--,i===null?wg(u,e.type,e.stateNode):yg(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&Hd(e,e.memoizedProps,n.memoizedProps)}break;case 27:Fn(t,e),In(e),i&512&&(Ht||n===null||Wa(n,n.return)),n!==null&&i&4&&Hd(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Fn(t,e),In(e),i&512&&(Ht||n===null||Wa(n,n.return)),e.flags&32){u=e.stateNode;try{ml(u,"")}catch(Me){st(e,e.return,Me)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,Hd(e,u,n!==null?n.memoizedProps:u)),i&1024&&(Ud=!0);break;case 6:if(Fn(t,e),In(e),i&4){if(e.stateNode===null)throw Error(r(162));i=e.memoizedProps,n=e.stateNode;try{n.nodeValue=i}catch(Me){st(e,e.return,Me)}}break;case 3:if(qc=null,u=Fa,Fa=Ic(t.containerInfo),Fn(t,e),Fa=u,In(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{Qs(t.containerInfo)}catch(Me){st(e,e.return,Me)}Ud&&(Ud=!1,wp(e));break;case 4:i=Fa,Fa=Ic(e.stateNode.containerInfo),Fn(t,e),In(e),Fa=i;break;case 12:Fn(t,e),In(e);break;case 31:Fn(t,e),In(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Nc(e,i)));break;case 13:Fn(t,e),In(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Tc=Re()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Nc(e,i)));break;case 22:u=e.memoizedState!==null;var _=n!==null&&n.memoizedState!==null,K=El,ae=Ht;if(El=K||u,Ht=ae||_,Fn(t,e),Ht=ae,El=K,In(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(n===null||_||El||Ht||Qi(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){_=n=t;try{if(f=_.stateNode,u)y=f.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{N=_.stateNode;var re=_.memoizedProps.style,Z=re!=null&&re.hasOwnProperty("display")?re.display:null;N.style.display=Z==null||typeof Z=="boolean"?"":(""+Z).trim()}}catch(Me){st(_,_.return,Me)}}}else if(t.tag===6){if(n===null){_=t;try{_.stateNode.nodeValue=u?"":_.memoizedProps}catch(Me){st(_,_.return,Me)}}}else if(t.tag===18){if(n===null){_=t;try{var J=_.stateNode;u?ug(J,!0):ug(_.stateNode,!1)}catch(Me){st(_,_.return,Me)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,Nc(e,n))));break;case 19:Fn(t,e),In(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Nc(e,i)));break;case 30:break;case 21:break;default:Fn(t,e),In(e)}}function In(e){var t=e.flags;if(t&2){try{for(var n,i=e.return;i!==null;){if(fp(i)){n=i;break}i=i.return}if(n==null)throw Error(r(160));switch(n.tag){case 27:var u=n.stateNode,f=Fd(e);jc(e,f,u);break;case 5:var y=n.stateNode;n.flags&32&&(ml(y,""),n.flags&=-33);var N=Fd(e);jc(e,N,y);break;case 3:case 4:var _=n.stateNode.containerInfo,K=Fd(e);Id(e,K,_);break;default:throw Error(r(161))}}catch(ae){st(e,e.return,ae)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function wp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;wp(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Rl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)pp(e,t.alternate,t),t=t.sibling}function Qi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ui(4,t,t.return),Qi(t);break;case 1:Wa(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&up(t,t.return,n),Qi(t);break;case 27:io(t.stateNode);case 26:case 5:Wa(t,t.return),Qi(t);break;case 22:t.memoizedState===null&&Qi(t);break;case 30:Qi(t);break;default:Qi(t)}e=e.sibling}}function Ll(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,u=e,f=t,y=f.flags;switch(f.tag){case 0:case 11:case 15:Ll(u,f,n),Kr(4,f);break;case 1:if(Ll(u,f,n),i=f,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(K){st(i,i.return,K)}if(i=f,u=i.updateQueue,u!==null){var N=i.stateNode;try{var _=u.shared.hiddenCallbacks;if(_!==null)for(u.shared.hiddenCallbacks=null,u=0;u<_.length;u++)Wm(_[u],N)}catch(K){st(i,i.return,K)}}n&&y&64&&cp(f),Xr(f,f.return);break;case 27:mp(f);case 26:case 5:Ll(u,f,n),n&&i===null&&y&4&&dp(f),Xr(f,f.return);break;case 12:Ll(u,f,n);break;case 31:Ll(u,f,n),n&&y&4&&vp(u,f);break;case 13:Ll(u,f,n),n&&y&4&&yp(u,f);break;case 22:f.memoizedState===null&&Ll(u,f,n),Xr(f,f.return);break;case 30:break;default:Ll(u,f,n)}t=t.sibling}}function qd(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Or(n))}function $d(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Or(e))}function Ia(e,t,n,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Sp(e,t,n,i),t=t.sibling}function Sp(e,t,n,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:Ia(e,t,n,i),u&2048&&Kr(9,t);break;case 1:Ia(e,t,n,i);break;case 3:Ia(e,t,n,i),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Or(e)));break;case 12:if(u&2048){Ia(e,t,n,i),e=t.stateNode;try{var f=t.memoizedProps,y=f.id,N=f.onPostCommit;typeof N=="function"&&N(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(_){st(t,t.return,_)}}else Ia(e,t,n,i);break;case 31:Ia(e,t,n,i);break;case 13:Ia(e,t,n,i);break;case 23:break;case 22:f=t.stateNode,y=t.alternate,t.memoizedState!==null?f._visibility&2?Ia(e,t,n,i):Zr(e,t):f._visibility&2?Ia(e,t,n,i):(f._visibility|=2,Bs(e,t,n,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&qd(y,t);break;case 24:Ia(e,t,n,i),u&2048&&$d(t.alternate,t);break;default:Ia(e,t,n,i)}}function Bs(e,t,n,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,y=t,N=n,_=i,K=y.flags;switch(y.tag){case 0:case 11:case 15:Bs(f,y,N,_,u),Kr(8,y);break;case 23:break;case 22:var ae=y.stateNode;y.memoizedState!==null?ae._visibility&2?Bs(f,y,N,_,u):Zr(f,y):(ae._visibility|=2,Bs(f,y,N,_,u)),u&&K&2048&&qd(y.alternate,y);break;case 24:Bs(f,y,N,_,u),u&&K&2048&&$d(y.alternate,y);break;default:Bs(f,y,N,_,u)}t=t.sibling}}function Zr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,i=t,u=i.flags;switch(i.tag){case 22:Zr(n,i),u&2048&&qd(i.alternate,i);break;case 24:Zr(n,i),u&2048&&$d(i.alternate,i);break;default:Zr(n,i)}t=t.sibling}}var Wr=8192;function Hs(e,t,n){if(e.subtreeFlags&Wr)for(e=e.child;e!==null;)Mp(e,t,n),e=e.sibling}function Mp(e,t,n){switch(e.tag){case 26:Hs(e,t,n),e.flags&Wr&&e.memoizedState!==null&&gb(n,Fa,e.memoizedState,e.memoizedProps);break;case 5:Hs(e,t,n);break;case 3:case 4:var i=Fa;Fa=Ic(e.stateNode.containerInfo),Hs(e,t,n),Fa=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=Wr,Wr=16777216,Hs(e,t,n),Wr=i):Hs(e,t,n));break;default:Hs(e,t,n)}}function Cp(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Jr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];Zt=i,Np(i,e)}Cp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)jp(e),e=e.sibling}function jp(e){switch(e.tag){case 0:case 11:case 15:Jr(e),e.flags&2048&&ui(9,e,e.return);break;case 3:Jr(e);break;case 12:Jr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ac(e)):Jr(e);break;default:Jr(e)}}function Ac(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];Zt=i,Np(i,e)}Cp(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ui(8,t,t.return),Ac(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ac(t));break;default:Ac(t)}e=e.sibling}}function Np(e,t){for(;Zt!==null;){var n=Zt;switch(n.tag){case 0:case 11:case 15:ui(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var i=n.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:Or(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,Zt=i;else e:for(n=e;Zt!==null;){i=Zt;var u=i.sibling,f=i.return;if(gp(i),i===n){Zt=null;break e}if(u!==null){u.return=f,Zt=u;break e}Zt=f}}}var Dy={getCacheForType:function(e){var t=an(zt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return an(zt).controller.signal}},Ry=typeof WeakMap=="function"?WeakMap:Map,tt=0,ht=null,Ve=null,Qe=0,it=0,la=null,di=!1,Fs=!1,Gd=!1,_l=0,Nt=0,fi=0,Ki=0,Yd=0,ia=0,Is=0,eo=null,Un=null,Vd=!1,Tc=0,Ap=0,kc=1/0,Ec=null,mi=null,Yt=0,hi=null,Us=null,zl=0,Pd=0,Qd=null,Tp=null,to=0,Kd=null;function sa(){return(tt&2)!==0&&Qe!==0?Qe&-Qe:H.T!==null?tf():vn()}function kp(){if(ia===0)if((Qe&536870912)===0||O){var e=ka;ka<<=1,(ka&3932160)===0&&(ka=262144),ia=e}else ia=536870912;return e=na.current,e!==null&&(e.flags|=32),ia}function qn(e,t,n){(e===ht&&(it===2||it===9)||e.cancelPendingCommit!==null)&&(qs(e,0),pi(e,Qe,ia,!1)),Da(e,n),((tt&2)===0||e!==ht)&&(e===ht&&((tt&2)===0&&(Ki|=n),Nt===4&&pi(e,Qe,ia,!1)),Ja(e))}function Ep(e,t,n){if((tt&6)!==0)throw Error(r(327));var i=!n&&(t&127)===0&&(t&e.expiredLanes)===0||ua(e,t),u=i?zy(e,t):Zd(e,t,!0),f=i;do{if(u===0){Fs&&!i&&pi(e,t,0,!1);break}else{if(n=e.current.alternate,f&&!Ly(n)){u=Zd(e,t,!1),f=!1;continue}if(u===2){if(f=t,e.errorRecoveryDisabledLanes&f)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var N=e;u=eo;var _=N.current.memoizedState.isDehydrated;if(_&&(qs(N,y).flags|=256),y=Zd(N,y,!1),y!==2){if(Gd&&!_){N.errorRecoveryDisabledLanes|=f,Ki|=f,u=4;break e}f=Un,Un=u,f!==null&&(Un===null?Un=f:Un.push.apply(Un,f))}u=y}if(f=!1,u!==2)continue}}if(u===1){qs(e,0),pi(e,t,0,!0);break}e:{switch(i=e,f=u,f){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:pi(i,t,ia,!di);break e;case 2:Un=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(u=Tc+300-Re(),10<u)){if(pi(i,t,ia,!di),kn(i,0,!0)!==0)break e;zl=t,i.timeoutHandle=rg(Dp.bind(null,i,n,Un,Ec,Vd,t,ia,Ki,Is,di,f,"Throttled",-0,0),u);break e}Dp(i,n,Un,Ec,Vd,t,ia,Ki,Is,di,f,null,-0,0)}}break}while(!0);Ja(e)}function Dp(e,t,n,i,u,f,y,N,_,K,ae,re,Z,J){if(e.timeoutHandle=-1,re=t.subtreeFlags,re&8192||(re&16785408)===16785408){re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Jn},Mp(t,f,re);var Me=(f&62914560)===f?Tc-Re():(f&4194048)===f?Ap-Re():0;if(Me=xb(re,Me),Me!==null){zl=f,e.cancelPendingCommit=Me(Fp.bind(null,e,t,f,n,i,u,y,N,_,ae,re,null,Z,J)),pi(e,f,y,!K);return}}Fp(e,t,f,n,i,u,y,N,_)}function Ly(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var i=0;i<n.length;i++){var u=n[i],f=u.getSnapshot;u=u.value;try{if(!Sn(f(),u))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function pi(e,t,n,i){t&=~Yd,t&=~Ki,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var f=31-At(u),y=1<<f;i[f]=-1,u&=~y}n!==0&&ol(e,n,t)}function Dc(){return(tt&6)===0?(no(0),!1):!0}function Xd(){if(Ve!==null){if(it===0)var e=Ve.return;else e=Ve,Bn=ta=null,fd(e),Rs=null,Hr=0,e=Ve;for(;e!==null;)op(e.alternate,e),e=e.return;Ve=null}}function qs(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Jy(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),zl=0,Xd(),ht=e,Ve=n=ya(e.current,null),Qe=t,it=0,la=null,di=!1,Fs=ua(e,t),Gd=!1,Is=ia=Yd=Ki=fi=Nt=0,Un=eo=null,Vd=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var u=31-At(i),f=1<<u;t|=e[u],i&=~f}return _l=t,Fi(),n}function Rp(e,t){Be=null,H.H=Vr,t===Ds||t===sc?(t=Qm(),it=3):t===ed?(t=Qm(),it=4):it=t===Td?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,la=t,Ve===null&&(Nt=1,bc(e,Mn(t,e.current)))}function Lp(){var e=na.current;return e===null?!0:(Qe&4194048)===Qe?Sa===null:(Qe&62914560)===Qe||(Qe&536870912)!==0?e===Sa:!1}function _p(){var e=H.H;return H.H=Vr,e===null?Vr:e}function zp(){var e=H.A;return H.A=Dy,e}function Rc(){Nt=4,di||(Qe&4194048)!==Qe&&na.current!==null||(Fs=!0),(fi&134217727)===0&&(Ki&134217727)===0||ht===null||pi(ht,Qe,ia,!1)}function Zd(e,t,n){var i=tt;tt|=2;var u=_p(),f=zp();(ht!==e||Qe!==t)&&(Ec=null,qs(e,t)),t=!1;var y=Nt;e:do try{if(it!==0&&Ve!==null){var N=Ve,_=la;switch(it){case 8:Xd(),y=6;break e;case 3:case 2:case 9:case 6:na.current===null&&(t=!0);var K=it;if(it=0,la=null,$s(e,N,_,K),n&&Fs){y=0;break e}break;default:K=it,it=0,la=null,$s(e,N,_,K)}}_y(),y=Nt;break}catch(ae){Rp(e,ae)}while(!0);return t&&e.shellSuspendCounter++,Bn=ta=null,tt=i,H.H=u,H.A=f,Ve===null&&(ht=null,Qe=0,Fi()),y}function _y(){for(;Ve!==null;)Op(Ve)}function zy(e,t){var n=tt;tt|=2;var i=_p(),u=zp();ht!==e||Qe!==t?(Ec=null,kc=Re()+500,qs(e,t)):Fs=ua(e,t);e:do try{if(it!==0&&Ve!==null){t=Ve;var f=la;t:switch(it){case 1:it=0,la=null,$s(e,t,f,1);break;case 2:case 9:if(Vm(f)){it=0,la=null,Bp(t);break}t=function(){it!==2&&it!==9||ht!==e||(it=7),Ja(e)},f.then(t,t);break e;case 3:it=7;break e;case 4:it=5;break e;case 7:Vm(f)?(it=0,la=null,Bp(t)):(it=0,la=null,$s(e,t,f,7));break;case 5:var y=null;switch(Ve.tag){case 26:y=Ve.memoizedState;case 5:case 27:var N=Ve;if(y?Sg(y):N.stateNode.complete){it=0,la=null;var _=N.sibling;if(_!==null)Ve=_;else{var K=N.return;K!==null?(Ve=K,Lc(K)):Ve=null}break t}}it=0,la=null,$s(e,t,f,5);break;case 6:it=0,la=null,$s(e,t,f,6);break;case 8:Xd(),Nt=6;break e;default:throw Error(r(462))}}Oy();break}catch(ae){Rp(e,ae)}while(!0);return Bn=ta=null,H.H=i,H.A=u,tt=n,Ve!==null?0:(ht=null,Qe=0,Fi(),Nt)}function Oy(){for(;Ve!==null&&!pe();)Op(Ve)}function Op(e){var t=sp(e.alternate,e,_l);e.memoizedProps=e.pendingProps,t===null?Lc(e):Ve=t}function Bp(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=ep(n,t,t.pendingProps,t.type,void 0,Qe);break;case 11:t=ep(n,t,t.pendingProps,t.type.render,t.ref,Qe);break;case 5:fd(t);default:op(n,t),t=Ve=nc(t,_l),t=sp(n,t,_l)}e.memoizedProps=e.pendingProps,t===null?Lc(e):Ve=t}function $s(e,t,n,i){Bn=ta=null,fd(t),Rs=null,Hr=0;var u=t.return;try{if(Cy(e,u,t,n,Qe)){Nt=1,bc(e,Mn(n,e.current)),Ve=null;return}}catch(f){if(u!==null)throw Ve=u,f;Nt=1,bc(e,Mn(n,e.current)),Ve=null;return}t.flags&32768?(O||i===1?e=!0:Fs||(Qe&536870912)!==0?e=!1:(di=e=!0,(i===2||i===9||i===3||i===6)&&(i=na.current,i!==null&&i.tag===13&&(i.flags|=16384))),Hp(t,e)):Lc(t)}function Lc(e){var t=e;do{if((t.flags&32768)!==0){Hp(t,di);return}e=t.return;var n=Ay(t.alternate,t,_l);if(n!==null){Ve=n;return}if(t=t.sibling,t!==null){Ve=t;return}Ve=t=e}while(t!==null);Nt===0&&(Nt=5)}function Hp(e,t){do{var n=Ty(e.alternate,e);if(n!==null){n.flags&=32767,Ve=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ve=e;return}Ve=e=n}while(e!==null);Nt=6,Ve=null}function Fp(e,t,n,i,u,f,y,N,_){e.cancelPendingCommit=null;do _c();while(Yt!==0);if((tt&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(f=t.lanes|t.childLanes,f|=Ka,$a(e,n,f,y,N,_),e===ht&&(Ve=ht=null,Qe=0),Us=t,hi=e,zl=n,Pd=f,Qd=u,Tp=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Iy(ca,function(){return Gp(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=H.T,H.T=null,u=X.p,X.p=2,y=tt,tt|=4;try{ky(e,t,n)}finally{tt=y,X.p=u,H.T=i}}Yt=1,Ip(),Up(),qp()}}function Ip(){if(Yt===1){Yt=0;var e=hi,t=Us,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=H.T,H.T=null;var i=X.p;X.p=2;var u=tt;tt|=4;try{bp(t,e);var f=uf,y=Qo(e.containerInfo),N=f.focusedElem,_=f.selectionRange;if(y!==N&&N&&N.ownerDocument&&Ge(N.ownerDocument.documentElement,N)){if(_!==null&&Sr(N)){var K=_.start,ae=_.end;if(ae===void 0&&(ae=K),"selectionStart"in N)N.selectionStart=K,N.selectionEnd=Math.min(ae,N.value.length);else{var re=N.ownerDocument||document,Z=re&&re.defaultView||window;if(Z.getSelection){var J=Z.getSelection(),Me=N.textContent.length,Le=Math.min(_.start,Me),ft=_.end===void 0?Le:Math.min(_.end,Me);!J.extend&&Le>ft&&(y=ft,ft=Le,Le=y);var q=dn(N,Le),B=dn(N,ft);if(q&&B&&(J.rangeCount!==1||J.anchorNode!==q.node||J.anchorOffset!==q.offset||J.focusNode!==B.node||J.focusOffset!==B.offset)){var Q=re.createRange();Q.setStart(q.node,q.offset),J.removeAllRanges(),Le>ft?(J.addRange(Q),J.extend(B.node,B.offset)):(Q.setEnd(B.node,B.offset),J.addRange(Q))}}}}for(re=[],J=N;J=J.parentNode;)J.nodeType===1&&re.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<re.length;N++){var ie=re[N];ie.element.scrollLeft=ie.left,ie.element.scrollTop=ie.top}}Vc=!!cf,uf=cf=null}finally{tt=u,X.p=i,H.T=n}}e.current=t,Yt=2}}function Up(){if(Yt===2){Yt=0;var e=hi,t=Us,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=H.T,H.T=null;var i=X.p;X.p=2;var u=tt;tt|=4;try{pp(e,t.alternate,t)}finally{tt=u,X.p=i,H.T=n}}Yt=3}}function qp(){if(Yt===4||Yt===3){Yt=0,je();var e=hi,t=Us,n=zl,i=Tp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Yt=5:(Yt=0,Us=hi=null,$p(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(mi=null),cl(n),t=t.stateNode,nt&&typeof nt.onCommitFiberRoot=="function")try{nt.onCommitFiberRoot(An,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=H.T,u=X.p,X.p=2,H.T=null;try{for(var f=e.onRecoverableError,y=0;y<i.length;y++){var N=i[y];f(N.value,{componentStack:N.stack})}}finally{H.T=t,X.p=u}}(zl&3)!==0&&_c(),Ja(e),u=e.pendingLanes,(n&261930)!==0&&(u&42)!==0?e===Kd?to++:(to=0,Kd=e):to=0,no(0)}}function $p(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Or(t)))}function _c(){return Ip(),Up(),qp(),Gp()}function Gp(){if(Yt!==5)return!1;var e=hi,t=Pd;Pd=0;var n=cl(zl),i=H.T,u=X.p;try{X.p=32>n?32:n,H.T=null,n=Qd,Qd=null;var f=hi,y=zl;if(Yt=0,Us=hi=null,zl=0,(tt&6)!==0)throw Error(r(331));var N=tt;if(tt|=4,jp(f.current),Sp(f,f.current,y,n),tt=N,no(0,!1),nt&&typeof nt.onPostCommitFiberRoot=="function")try{nt.onPostCommitFiberRoot(An,f)}catch{}return!0}finally{X.p=u,H.T=i,$p(e,t)}}function Yp(e,t,n){t=Mn(n,t),t=Ad(e.stateNode,t,2),e=ri(e,t,2),e!==null&&(Da(e,2),Ja(e))}function st(e,t,n){if(e.tag===3)Yp(e,e,n);else for(;t!==null;){if(t.tag===3){Yp(t,e,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(mi===null||!mi.has(i))){e=Mn(n,e),n=Vh(2),i=ri(t,n,2),i!==null&&(Ph(n,i,t,e),Da(i,2),Ja(i));break}}t=t.return}}function Wd(e,t,n){var i=e.pingCache;if(i===null){i=e.pingCache=new Ry;var u=new Set;i.set(t,u)}else u=i.get(t),u===void 0&&(u=new Set,i.set(t,u));u.has(n)||(Gd=!0,u.add(n),e=By.bind(null,e,t,n),t.then(e,e))}function By(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ht===e&&(Qe&n)===n&&(Nt===4||Nt===3&&(Qe&62914560)===Qe&&300>Re()-Tc?(tt&2)===0&&qs(e,0):Yd|=n,Is===Qe&&(Is=0)),Ja(e)}function Vp(e,t){t===0&&(t=rl()),e=bl(e,t),e!==null&&(Da(e,t),Ja(e))}function Hy(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Vp(e,n)}function Fy(e,t){var n=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(n=u.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(r(314))}i!==null&&i.delete(t),Vp(e,n)}function Iy(e,t){return gn(e,t)}var zc=null,Gs=null,Jd=!1,Oc=!1,ef=!1,gi=0;function Ja(e){e!==Gs&&e.next===null&&(Gs===null?zc=Gs=e:Gs=Gs.next=e),Oc=!0,Jd||(Jd=!0,qy())}function no(e,t){if(!ef&&Oc){ef=!0;do for(var n=!1,i=zc;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var f=0;else{var y=i.suspendedLanes,N=i.pingedLanes;f=(1<<31-At(42|e)+1)-1,f&=u&~(y&~N),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(n=!0,Xp(i,f))}else f=Qe,f=kn(i,i===ht?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(f&3)===0||ua(i,f)||(n=!0,Xp(i,f));i=i.next}while(n);ef=!1}}function Uy(){Pp()}function Pp(){Oc=Jd=!1;var e=0;gi!==0&&Wy()&&(e=gi);for(var t=Re(),n=null,i=zc;i!==null;){var u=i.next,f=Qp(i,t);f===0?(i.next=null,n===null?zc=u:n.next=u,u===null&&(Gs=n)):(n=i,(e!==0||(f&3)!==0)&&(Oc=!0)),i=u}Yt!==0&&Yt!==5||no(e),gi!==0&&(gi=0)}function Qp(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var y=31-At(f),N=1<<y,_=u[y];_===-1?((N&n)===0||(N&i)!==0)&&(u[y]=Il(N,t)):_<=t&&(e.expiredLanes|=N),f&=~N}if(t=ht,n=Qe,n=kn(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,n===0||e===t&&(it===2||it===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&De(i),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||ua(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(i!==null&&De(i),cl(n)){case 2:case 8:n=Ie;break;case 32:n=ca;break;case 268435456:n=Nn;break;default:n=ca}return i=Kp.bind(null,e),n=gn(n,i),e.callbackPriority=t,e.callbackNode=n,t}return i!==null&&i!==null&&De(i),e.callbackPriority=2,e.callbackNode=null,2}function Kp(e,t){if(Yt!==0&&Yt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(_c()&&e.callbackNode!==n)return null;var i=Qe;return i=kn(e,e===ht?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(Ep(e,i,t),Qp(e,Re()),e.callbackNode!=null&&e.callbackNode===n?Kp.bind(null,e):null)}function Xp(e,t){if(_c())return null;Ep(e,t,!0)}function qy(){eb(function(){(tt&6)!==0?gn(xn,Uy):Pp()})}function tf(){if(gi===0){var e=ks;e===0&&(e=sl,sl<<=1,(sl&261888)===0&&(sl=256)),gi=e}return gi}function Zp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ss(""+e)}function Wp(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function $y(e,t,n,i,u){if(t==="submit"&&n&&n.stateNode===u){var f=Zp((u[me]||null).action),y=i.submitter;y&&(t=(t=y[me]||null)?Zp(t.formAction):y.getAttribute("formAction"),t!==null&&(f=t,y=null));var N=new _i("action","action",null,i,u);e.push({event:N,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(gi!==0){var _=y?Wp(u,y):new FormData(u);wd(n,{pending:!0,data:_,method:u.method,action:f},null,_)}}else typeof f=="function"&&(N.preventDefault(),_=y?Wp(u,y):new FormData(u),wd(n,{pending:!0,data:_,method:u.method,action:f},f,_))},currentTarget:u}]})}}for(var nf=0;nf<Tr.length;nf++){var af=Tr[nf],Gy=af.toLowerCase(),Yy=af[0].toUpperCase()+af.slice(1);ea(Gy,"on"+Yy)}ea(Zo,"onAnimationEnd"),ea(Wo,"onAnimationIteration"),ea(Jo,"onAnimationStart"),ea("dblclick","onDoubleClick"),ea("focusin","onFocus"),ea("focusout","onBlur"),ea(Nr,"onTransitionRun"),ea(Ar,"onTransitionStart"),ea(Pu,"onTransitionCancel"),ea(ec,"onTransitionEnd"),kt("onMouseEnter",["mouseout","mouseover"]),kt("onMouseLeave",["mouseout","mouseover"]),kt("onPointerEnter",["pointerout","pointerover"]),kt("onPointerLeave",["pointerout","pointerover"]),$t("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),$t("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),$t("onBeforeInput",["compositionend","keypress","textInput","paste"]),$t("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),$t("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),$t("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ao="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(" "),Vy=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ao));function Jp(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var i=e[n],u=i.event;i=i.listeners;e:{var f=void 0;if(t)for(var y=i.length-1;0<=y;y--){var N=i[y],_=N.instance,K=N.currentTarget;if(N=N.listener,_!==f&&u.isPropagationStopped())break e;f=N,u.currentTarget=K;try{f(u)}catch(ae){Ns(ae)}u.currentTarget=null,f=_}else for(y=0;y<i.length;y++){if(N=i[y],_=N.instance,K=N.currentTarget,N=N.listener,_!==f&&u.isPropagationStopped())break e;f=N,u.currentTarget=K;try{f(u)}catch(ae){Ns(ae)}u.currentTarget=null,f=_}}}}function Pe(e,t){var n=t[Oe];n===void 0&&(n=t[Oe]=new Set);var i=e+"__bubble";n.has(i)||(eg(t,e,2,!1),n.add(i))}function lf(e,t,n){var i=0;t&&(i|=4),eg(n,e,i,t)}var Bc="_reactListening"+Math.random().toString(36).slice(2);function sf(e){if(!e[Bc]){e[Bc]=!0,ul.forEach(function(n){n!=="selectionchange"&&(Vy.has(n)||lf(n,!1,e),lf(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Bc]||(t[Bc]=!0,lf("selectionchange",!1,t))}}function eg(e,t,n,i){switch(kg(t)){case 2:var u=bb;break;case 8:u=wb;break;default:u=wf}n=u.bind(null,t,n,e),u=void 0,!os||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,n,{capture:!0,passive:u}):e.addEventListener(t,n,!0):u!==void 0?e.addEventListener(t,n,{passive:u}):e.addEventListener(t,n,!1)}function rf(e,t,n,i,u){var f=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var y=i.tag;if(y===3||y===4){var N=i.stateNode.containerInfo;if(N===u)break;if(y===4)for(y=i.return;y!==null;){var _=y.tag;if((_===3||_===4)&&y.stateNode.containerInfo===u)return;y=y.return}for(;N!==null;){if(y=qt(N),y===null)return;if(_=y.tag,_===5||_===6||_===26||_===27){i=f=y;continue e}N=N.parentNode}}i=i.return}Ho(function(){var K=f,ae=rs(n),re=[];e:{var Z=tc.get(e);if(Z!==void 0){var J=_i,Me=e;switch(e){case"keypress":if(Xt(n)===0)break e;case"keydown":case"keyup":J=gs;break;case"focusin":Me="focus",J=fs;break;case"focusout":Me="blur",J=fs;break;case"beforeblur":case"afterblur":J=fs;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":J=cr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":J=Hu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":J=ys;break;case Zo:case Wo:case Jo:J=Va;break;case ec:J=Oi;break;case"scroll":case"scrollend":J=Uo;break;case"wheel":J=$o;break;case"copy":case"cut":case"paste":J=Gl;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=vs;break;case"toggle":case"beforetoggle":J=mr}var Le=(t&4)!==0,ft=!Le&&(e==="scroll"||e==="scrollend"),q=Le?Z!==null?Z+"Capture":null:Z;Le=[];for(var B=K,Q;B!==null;){var ie=B;if(Q=ie.stateNode,ie=ie.tag,ie!==5&&ie!==26&&ie!==27||Q===null||q===null||(ie=$l(B,q),ie!=null&&Le.push(lo(B,ie,Q))),ft)break;B=B.return}0<Le.length&&(Z=new J(Z,Me,null,n,ae),re.push({event:Z,listeners:Le}))}}if((t&7)===0){e:{if(Z=e==="mouseover"||e==="pointerover",J=e==="mouseout"||e==="pointerout",Z&&n!==ot&&(Me=n.relatedTarget||n.fromElement)&&(qt(Me)||Me[we]))break e;if((J||Z)&&(Z=ae.window===ae?ae:(Z=ae.ownerDocument)?Z.defaultView||Z.parentWindow:window,J?(Me=n.relatedTarget||n.toElement,J=K,Me=Me?qt(Me):null,Me!==null&&(ft=d(Me),Le=Me.tag,Me!==ft||Le!==5&&Le!==27&&Le!==6)&&(Me=null)):(J=null,Me=K),J!==Me)){if(Le=cr,ie="onMouseLeave",q="onMouseEnter",B="mouse",(e==="pointerout"||e==="pointerover")&&(Le=vs,ie="onPointerLeave",q="onPointerEnter",B="pointer"),ft=J==null?Z:xt(J),Q=Me==null?Z:xt(Me),Z=new Le(ie,B+"leave",J,n,ae),Z.target=ft,Z.relatedTarget=Q,ie=null,qt(ae)===K&&(Le=new Le(q,B+"enter",Me,n,ae),Le.target=Q,Le.relatedTarget=ft,ie=Le),ft=ie,J&&Me)t:{for(Le=Py,q=J,B=Me,Q=0,ie=q;ie;ie=Le(ie))Q++;ie=0;for(var Te=B;Te;Te=Le(Te))ie++;for(;0<Q-ie;)q=Le(q),Q--;for(;0<ie-Q;)B=Le(B),ie--;for(;Q--;){if(q===B||B!==null&&q===B.alternate){Le=q;break t}q=Le(q),B=Le(B)}Le=null}else Le=null;J!==null&&tg(re,Z,J,Le,!1),Me!==null&&ft!==null&&tg(re,ft,Me,Le,!0)}}e:{if(Z=K?xt(K):window,J=Z.nodeName&&Z.nodeName.toLowerCase(),J==="select"||J==="input"&&Z.type==="file")var Je=Bi;else if(Vo(Z))if(Ba)Je=Um;else{Je=Po;var Ce=js}else J=Z.nodeName,!J||J.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?K&&is(K.elementType)&&(Je=Bi):Je=Yu;if(Je&&(Je=Je(e,K))){yr(re,Je,n,ae);break e}Ce&&Ce(e,Z,K),e==="focusout"&&K&&Z.type==="number"&&K.memoizedProps.value!=null&&Li(Z,"number",Z.value)}switch(Ce=K?xt(K):window,e){case"focusin":(Vo(Ce)||Ce.contentEditable==="true")&&(Kl=Ce,Mr=K,Hi=null);break;case"focusout":Hi=Mr=Kl=null;break;case"mousedown":Cr=!0;break;case"contextmenu":case"mouseup":case"dragend":Cr=!1,Ko(re,n,ae);break;case"selectionchange":if(Vu)break;case"keydown":case"keyup":Ko(re,n,ae)}var Fe;if(hr)e:{switch(e){case"compositionstart":var Ke="onCompositionStart";break e;case"compositionend":Ke="onCompositionEnd";break e;case"compositionupdate":Ke="onCompositionUpdate";break e}Ke=void 0}else Pa?Yl(e,n)&&(Ke="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Ke="onCompositionStart");Ke&&(xl&&n.locale!=="ko"&&(Pa||Ke!=="onCompositionStart"?Ke==="onCompositionEnd"&&Pa&&(Fe=Fo()):(wn=ae,Kt="value"in wn?wn.value:wn.textContent,Pa=!0)),Ce=Hc(K,Ke),0<Ce.length&&(Ke=new hs(Ke,e,null,n,ae),re.push({event:Ke,listeners:Ce}),Fe?Ke.data=Fe:(Fe=xr(n),Fe!==null&&(Ke.data=Fe)))),(Fe=qu?Yo(e,n):$u(e,n))&&(Ke=Hc(K,"onBeforeInput"),0<Ke.length&&(Ce=new hs("onBeforeInput","beforeinput",null,n,ae),re.push({event:Ce,listeners:Ke}),Ce.data=Fe)),$y(re,e,K,n,ae)}Jp(re,t)})}function lo(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Hc(e,t){for(var n=t+"Capture",i=[];e!==null;){var u=e,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=$l(e,n),u!=null&&i.unshift(lo(e,u,f)),u=$l(e,t),u!=null&&i.push(lo(e,u,f))),e.tag===3)return i;e=e.return}return[]}function Py(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function tg(e,t,n,i,u){for(var f=t._reactName,y=[];n!==null&&n!==i;){var N=n,_=N.alternate,K=N.stateNode;if(N=N.tag,_!==null&&_===i)break;N!==5&&N!==26&&N!==27||K===null||(_=K,u?(K=$l(n,f),K!=null&&y.unshift(lo(n,K,_))):u||(K=$l(n,f),K!=null&&y.push(lo(n,K,_)))),n=n.return}y.length!==0&&e.push({event:t,listeners:y})}var Qy=/\r\n?/g,Ky=/\u0000|\uFFFD/g;function ng(e){return(typeof e=="string"?e:""+e).replace(Qy,`
9
- `).replace(Ky,"")}function ag(e,t){return t=ng(t),ng(e)===t}function dt(e,t,n,i,u,f){switch(n){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||ml(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&ml(e,""+i);break;case"className":Di(e,"class",i);break;case"tabIndex":Di(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Di(e,n,i);break;case"style":ye(e,i,f);break;case"data":if(t!=="object"){Di(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=ss(""+i),e.setAttribute(n,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(n,"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 f=="function"&&(n==="formAction"?(t!=="input"&&dt(e,t,"name",u.name,u,null),dt(e,t,"formEncType",u.formEncType,u,null),dt(e,t,"formMethod",u.formMethod,u,null),dt(e,t,"formTarget",u.formTarget,u,null)):(dt(e,t,"encType",u.encType,u,null),dt(e,t,"method",u.method,u,null),dt(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=ss(""+i),e.setAttribute(n,i);break;case"onClick":i!=null&&(e.onclick=Jn);break;case"onScroll":i!=null&&Pe("scroll",e);break;case"onScrollEnd":i!=null&&Pe("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(r(61));if(n=i.__html,n!=null){if(u.children!=null)throw Error(r(60));e.innerHTML=n}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}n=ss(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(n,""+i):e.removeAttribute(n);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":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":i===!0?e.setAttribute(n,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(n,i):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(n,i):e.removeAttribute(n);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(n):e.setAttribute(n,i);break;case"popover":Pe("beforetoggle",e),Pe("toggle",e),Ei(e,"popover",i);break;case"xlinkActuate":yn(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":yn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":yn(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":yn(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":yn(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":yn(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":yn(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":yn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":yn(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":Ei(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=Ou.get(n)||n,Ei(e,n,i))}}function of(e,t,n,i,u,f){switch(n){case"style":ye(e,i,f);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(r(61));if(n=i.__html,n!=null){if(u.children!=null)throw Error(r(60));e.innerHTML=n}}break;case"children":typeof i=="string"?ml(e,i):(typeof i=="number"||typeof i=="bigint")&&ml(e,""+i);break;case"onScroll":i!=null&&Pe("scroll",e);break;case"onScrollEnd":i!=null&&Pe("scrollend",e);break;case"onClick":i!=null&&(e.onclick=Jn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!dl.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(u=n.endsWith("Capture"),t=n.slice(2,u?n.length-7:void 0),f=e[me]||null,f=f!=null?f[n]:null,typeof f=="function"&&e.removeEventListener(t,f,u),typeof i=="function")){typeof f!="function"&&f!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,i,u);break e}n in e?e[n]=i:i===!0?e.setAttribute(n,""):Ei(e,n,i)}}}function sn(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Pe("error",e),Pe("load",e);var i=!1,u=!1,f;for(f in n)if(n.hasOwnProperty(f)){var y=n[f];if(y!=null)switch(f){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:dt(e,t,f,y,n,null)}}u&&dt(e,t,"srcSet",n.srcSet,n,null),i&&dt(e,t,"src",n.src,n,null);return;case"input":Pe("invalid",e);var N=f=y=u=null,_=null,K=null;for(i in n)if(n.hasOwnProperty(i)){var ae=n[i];if(ae!=null)switch(i){case"name":u=ae;break;case"type":y=ae;break;case"checked":_=ae;break;case"defaultChecked":K=ae;break;case"value":f=ae;break;case"defaultValue":N=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(r(137,t));break;default:dt(e,t,i,ae,n,null)}}Ul(e,f,N,_,K,y,u,!1);return;case"select":Pe("invalid",e),i=y=f=null;for(u in n)if(n.hasOwnProperty(u)&&(N=n[u],N!=null))switch(u){case"value":f=N;break;case"defaultValue":y=N;break;case"multiple":i=N;default:dt(e,t,u,N,n,null)}t=f,n=y,e.multiple=!!i,t!=null?_a(e,!!i,t,!1):n!=null&&_a(e,!!i,n,!0);return;case"textarea":Pe("invalid",e),f=u=i=null;for(y in n)if(n.hasOwnProperty(y)&&(N=n[y],N!=null))switch(y){case"value":i=N;break;case"defaultValue":u=N;break;case"children":f=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(r(91));break;default:dt(e,t,y,N,n,null)}fa(e,i,u,f);return;case"option":for(_ in n)n.hasOwnProperty(_)&&(i=n[_],i!=null)&&(_==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":dt(e,t,_,i,n,null));return;case"dialog":Pe("beforetoggle",e),Pe("toggle",e),Pe("cancel",e),Pe("close",e);break;case"iframe":case"object":Pe("load",e);break;case"video":case"audio":for(i=0;i<ao.length;i++)Pe(ao[i],e);break;case"image":Pe("error",e),Pe("load",e);break;case"details":Pe("toggle",e);break;case"embed":case"source":case"link":Pe("error",e),Pe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(K in n)if(n.hasOwnProperty(K)&&(i=n[K],i!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:dt(e,t,K,i,n,null)}return;default:if(is(t)){for(ae in n)n.hasOwnProperty(ae)&&(i=n[ae],i!==void 0&&of(e,t,ae,i,n,void 0));return}}for(N in n)n.hasOwnProperty(N)&&(i=n[N],i!=null&&dt(e,t,N,i,n,null))}function Xy(e,t,n,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,f=null,y=null,N=null,_=null,K=null,ae=null;for(J in n){var re=n[J];if(n.hasOwnProperty(J)&&re!=null)switch(J){case"checked":break;case"value":break;case"defaultValue":_=re;default:i.hasOwnProperty(J)||dt(e,t,J,null,i,re)}}for(var Z in i){var J=i[Z];if(re=n[Z],i.hasOwnProperty(Z)&&(J!=null||re!=null))switch(Z){case"type":f=J;break;case"name":u=J;break;case"checked":K=J;break;case"defaultChecked":ae=J;break;case"value":y=J;break;case"defaultValue":N=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,t));break;default:J!==re&&dt(e,t,Z,J,i,re)}}Ln(e,y,N,_,K,ae,f,u);return;case"select":J=y=N=Z=null;for(f in n)if(_=n[f],n.hasOwnProperty(f)&&_!=null)switch(f){case"value":break;case"multiple":J=_;default:i.hasOwnProperty(f)||dt(e,t,f,null,i,_)}for(u in i)if(f=i[u],_=n[u],i.hasOwnProperty(u)&&(f!=null||_!=null))switch(u){case"value":Z=f;break;case"defaultValue":N=f;break;case"multiple":y=f;default:f!==_&&dt(e,t,u,f,i,_)}t=N,n=y,i=J,Z!=null?_a(e,!!n,Z,!1):!!i!=!!n&&(t!=null?_a(e,!!n,t,!0):_a(e,!!n,n?[]:"",!1));return;case"textarea":J=Z=null;for(N in n)if(u=n[N],n.hasOwnProperty(N)&&u!=null&&!i.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:dt(e,t,N,null,i,u)}for(y in i)if(u=i[y],f=n[y],i.hasOwnProperty(y)&&(u!=null||f!=null))switch(y){case"value":Z=u;break;case"defaultValue":J=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(r(91));break;default:u!==f&&dt(e,t,y,u,i,f)}fl(e,Z,J);return;case"option":for(var Me in n)Z=n[Me],n.hasOwnProperty(Me)&&Z!=null&&!i.hasOwnProperty(Me)&&(Me==="selected"?e.selected=!1:dt(e,t,Me,null,i,Z));for(_ in i)Z=i[_],J=n[_],i.hasOwnProperty(_)&&Z!==J&&(Z!=null||J!=null)&&(_==="selected"?e.selected=Z&&typeof Z!="function"&&typeof Z!="symbol":dt(e,t,_,Z,i,J));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 Le in n)Z=n[Le],n.hasOwnProperty(Le)&&Z!=null&&!i.hasOwnProperty(Le)&&dt(e,t,Le,null,i,Z);for(K in i)if(Z=i[K],J=n[K],i.hasOwnProperty(K)&&Z!==J&&(Z!=null||J!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(r(137,t));break;default:dt(e,t,K,Z,i,J)}return;default:if(is(t)){for(var ft in n)Z=n[ft],n.hasOwnProperty(ft)&&Z!==void 0&&!i.hasOwnProperty(ft)&&of(e,t,ft,void 0,i,Z);for(ae in i)Z=i[ae],J=n[ae],!i.hasOwnProperty(ae)||Z===J||Z===void 0&&J===void 0||of(e,t,ae,Z,i,J);return}}for(var q in n)Z=n[q],n.hasOwnProperty(q)&&Z!=null&&!i.hasOwnProperty(q)&&dt(e,t,q,null,i,Z);for(re in i)Z=i[re],J=n[re],!i.hasOwnProperty(re)||Z===J||Z==null&&J==null||dt(e,t,re,Z,i,J)}function lg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Zy(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),i=0;i<n.length;i++){var u=n[i],f=u.transferSize,y=u.initiatorType,N=u.duration;if(f&&N&&lg(y)){for(y=0,N=u.responseEnd,i+=1;i<n.length;i++){var _=n[i],K=_.startTime;if(K>N)break;var ae=_.transferSize,re=_.initiatorType;ae&&lg(re)&&(_=_.responseEnd,y+=ae*(_<N?1:(N-K)/(_-K)))}if(--i,t+=8*(f+y)/(u.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var cf=null,uf=null;function Fc(e){return e.nodeType===9?e:e.ownerDocument}function ig(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function sg(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function df(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var ff=null;function Wy(){var e=window.event;return e&&e.type==="popstate"?e===ff?!1:(ff=e,!0):(ff=null,!1)}var rg=typeof setTimeout=="function"?setTimeout:void 0,Jy=typeof clearTimeout=="function"?clearTimeout:void 0,og=typeof Promise=="function"?Promise:void 0,eb=typeof queueMicrotask=="function"?queueMicrotask:typeof og<"u"?function(e){return og.resolve(null).then(e).catch(tb)}:rg;function tb(e){setTimeout(function(){throw e})}function xi(e){return e==="head"}function cg(e,t){var n=t,i=0;do{var u=n.nextSibling;if(e.removeChild(n),u&&u.nodeType===8)if(n=u.data,n==="/$"||n==="/&"){if(i===0){e.removeChild(u),Qs(t);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")io(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,io(n);for(var f=n.firstChild;f;){var y=f.nextSibling,N=f.nodeName;f[Ze]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&f.rel.toLowerCase()==="stylesheet"||n.removeChild(f),f=y}}else n==="body"&&io(e.ownerDocument.body);n=u}while(n);Qs(t)}function ug(e,t){var n=e;e=0;do{var i=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=i}while(n)}function mf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":mf(n),nn(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function nb(e,t,n,i){for(;e.nodeType===1;){var u=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Ze])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var f=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=Ma(e.nextSibling),e===null)break}return null}function ab(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Ma(e.nextSibling),e===null))return null;return e}function dg(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Ma(e.nextSibling),e===null))return null;return e}function hf(e){return e.data==="$?"||e.data==="$~"}function pf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function lb(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var i=function(){t(),n.removeEventListener("DOMContentLoaded",i)};n.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function Ma(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var gf=null;function fg(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Ma(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function mg(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function hg(e,t,n){switch(t=Fc(n),e){case"html":if(e=t.documentElement,!e)throw Error(r(452));return e;case"head":if(e=t.head,!e)throw Error(r(453));return e;case"body":if(e=t.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function io(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);nn(e)}var Ca=new Map,pg=new Set;function Ic(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ol=X.d;X.d={f:ib,r:sb,D:rb,C:ob,L:cb,m:ub,X:fb,S:db,M:mb};function ib(){var e=Ol.f(),t=Dc();return e||t}function sb(e){var t=un(e);t!==null&&t.tag===5&&t.type==="form"?Rh(t):Ol.r(e)}var Ys=typeof document>"u"?null:document;function gg(e,t,n){var i=Ys;if(i&&typeof t=="string"&&t){var u=Rn(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof n=="string"&&(u+='[crossorigin="'+n+'"]'),pg.has(u)||(pg.add(u),e={rel:e,crossOrigin:n,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),sn(t,"link",e),gt(t),i.head.appendChild(t)))}}function rb(e){Ol.D(e),gg("dns-prefetch",e,null)}function ob(e,t){Ol.C(e,t),gg("preconnect",e,t)}function cb(e,t,n){Ol.L(e,t,n);var i=Ys;if(i&&e&&t){var u='link[rel="preload"][as="'+Rn(t)+'"]';t==="image"&&n&&n.imageSrcSet?(u+='[imagesrcset="'+Rn(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(u+='[imagesizes="'+Rn(n.imageSizes)+'"]')):u+='[href="'+Rn(e)+'"]';var f=u;switch(t){case"style":f=Vs(e);break;case"script":f=Ps(e)}Ca.has(f)||(e=v({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Ca.set(f,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(so(f))||t==="script"&&i.querySelector(ro(f))||(t=i.createElement("link"),sn(t,"link",e),gt(t),i.head.appendChild(t)))}}function ub(e,t){Ol.m(e,t);var n=Ys;if(n&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Rn(i)+'"][href="'+Rn(e)+'"]',f=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Ps(e)}if(!Ca.has(f)&&(e=v({rel:"modulepreload",href:e},t),Ca.set(f,e),n.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(ro(f)))return}i=n.createElement("link"),sn(i,"link",e),gt(i),n.head.appendChild(i)}}}function db(e,t,n){Ol.S(e,t,n);var i=Ys;if(i&&e){var u=Tt(i).hoistableStyles,f=Vs(e);t=t||"default";var y=u.get(f);if(!y){var N={loading:0,preload:null};if(y=i.querySelector(so(f)))N.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Ca.get(f))&&xf(e,n);var _=y=i.createElement("link");gt(_),sn(_,"link",e),_._p=new Promise(function(K,ae){_.onload=K,_.onerror=ae}),_.addEventListener("load",function(){N.loading|=1}),_.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Uc(y,t,i)}y={type:"stylesheet",instance:y,count:1,state:N},u.set(f,y)}}}function fb(e,t){Ol.X(e,t);var n=Ys;if(n&&e){var i=Tt(n).hoistableScripts,u=Ps(e),f=i.get(u);f||(f=n.querySelector(ro(u)),f||(e=v({src:e,async:!0},t),(t=Ca.get(u))&&vf(e,t),f=n.createElement("script"),gt(f),sn(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function mb(e,t){Ol.M(e,t);var n=Ys;if(n&&e){var i=Tt(n).hoistableScripts,u=Ps(e),f=i.get(u);f||(f=n.querySelector(ro(u)),f||(e=v({src:e,async:!0,type:"module"},t),(t=Ca.get(u))&&vf(e,t),f=n.createElement("script"),gt(f),sn(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function xg(e,t,n,i){var u=(u=ke.current)?Ic(u):null;if(!u)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Vs(n.href),n=Tt(u).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Vs(n.href);var f=Tt(u).hoistableStyles,y=f.get(e);if(y||(u=u.ownerDocument||u,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,y),(f=u.querySelector(so(e)))&&!f._p&&(y.instance=f,y.state.loading=5),Ca.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Ca.set(e,n),f||hb(u,e,n,y.state))),t&&i===null)throw Error(r(528,""));return y}if(t&&i!==null)throw Error(r(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ps(n),n=Tt(u).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function Vs(e){return'href="'+Rn(e)+'"'}function so(e){return'link[rel="stylesheet"]['+e+"]"}function vg(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function hb(e,t,n,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),sn(t,"link",n),gt(t),e.head.appendChild(t))}function Ps(e){return'[src="'+Rn(e)+'"]'}function ro(e){return"script[async]"+e}function yg(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Rn(n.href)+'"]');if(i)return t.instance=i,gt(i),i;var u=v({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),gt(i),sn(i,"style",u),Uc(i,n.precedence,e),t.instance=i;case"stylesheet":u=Vs(n.href);var f=e.querySelector(so(u));if(f)return t.state.loading|=4,t.instance=f,gt(f),f;i=vg(n),(u=Ca.get(u))&&xf(i,u),f=(e.ownerDocument||e).createElement("link"),gt(f);var y=f;return y._p=new Promise(function(N,_){y.onload=N,y.onerror=_}),sn(f,"link",i),t.state.loading|=4,Uc(f,n.precedence,e),t.instance=f;case"script":return f=Ps(n.src),(u=e.querySelector(ro(f)))?(t.instance=u,gt(u),u):(i=n,(u=Ca.get(f))&&(i=v({},n),vf(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),gt(u),sn(u,"link",i),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,Uc(i,n.precedence,e));return t.instance}function Uc(e,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,f=u,y=0;y<i.length;y++){var N=i[y];if(N.dataset.precedence===t)f=N;else if(f!==u)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function xf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function vf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var qc=null;function bg(e,t,n){if(qc===null){var i=new Map,u=qc=new Map;u.set(n,i)}else u=qc,i=u.get(n),i||(i=new Map,u.set(n,i));if(i.has(e))return i;for(i.set(e,null),n=n.getElementsByTagName(e),u=0;u<n.length;u++){var f=n[u];if(!(f[Ze]||f[Y]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var y=f.getAttribute(t)||"";y=e+y;var N=i.get(y);N?N.push(f):i.set(y,[f])}}return i}function wg(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function pb(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Sg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function gb(e,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var u=Vs(i.href),f=t.querySelector(so(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=$c.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=f,gt(f);return}f=t.ownerDocument||t,i=vg(i),(u=Ca.get(u))&&xf(i,u),f=f.createElement("link"),gt(f);var y=f;y._p=new Promise(function(N,_){y.onload=N,y.onerror=_}),sn(f,"link",i),n.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=$c.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var yf=0;function xb(e,t){return e.stylesheets&&e.count===0&&Yc(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var i=setTimeout(function(){if(e.stylesheets&&Yc(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&yf===0&&(yf=62500*Zy());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Yc(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>yf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function $c(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Yc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Gc=null;function Yc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Gc=new Map,t.forEach(vb,e),Gc=null,$c.call(e))}function vb(e,t){if(!(t.state.loading&4)){var n=Gc.get(e);if(n)var i=n.get(null);else{n=new Map,Gc.set(e,n);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var y=u[f];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(n.set(y.dataset.precedence,y),i=y)}i&&n.set(null,i)}u=t.instance,y=u.getAttribute("data-precedence"),f=n.get(y)||i,f===i&&n.set(null,u),n.set(y,u),this.count++,i=$c.bind(this),u.addEventListener("load",i),u.addEventListener("error",i),f?f.parentNode.insertBefore(u,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var oo={$$typeof:z,Provider:null,Consumer:null,_currentValue:te,_currentValue2:te,_threadCount:0};function yb(e,t,n,i,u,f,y,N,_){this.tag=1,this.containerInfo=e,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=Ea(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ea(0),this.hiddenUpdates=Ea(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=_,this.incompleteTransitions=new Map}function Mg(e,t,n,i,u,f,y,N,_,K,ae,re){return e=new yb(e,t,n,y,_,K,ae,re,N),t=1,f===!0&&(t|=24),f=lt(3,null,null,t),e.current=f,f.stateNode=e,t=Zu(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:i,isDehydrated:n,cache:t},td(f),e}function Cg(e){return e?(e=Jl,e):Jl}function jg(e,t,n,i,u,f){u=Cg(u),i.context===null?i.context=u:i.pendingContext=u,i=si(t),i.payload={element:n},f=f===void 0?null:f,f!==null&&(i.callback=f),n=ri(e,i,t),n!==null&&(qn(n,e,t),Ir(n,e,t))}function Ng(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function bf(e,t){Ng(e,t),(e=e.alternate)&&Ng(e,t)}function Ag(e){if(e.tag===13||e.tag===31){var t=bl(e,67108864);t!==null&&qn(t,e,67108864),bf(e,67108864)}}function Tg(e){if(e.tag===13||e.tag===31){var t=sa();t=Ga(t);var n=bl(e,t);n!==null&&qn(n,e,t),bf(e,t)}}var Vc=!0;function bb(e,t,n,i){var u=H.T;H.T=null;var f=X.p;try{X.p=2,wf(e,t,n,i)}finally{X.p=f,H.T=u}}function wb(e,t,n,i){var u=H.T;H.T=null;var f=X.p;try{X.p=8,wf(e,t,n,i)}finally{X.p=f,H.T=u}}function wf(e,t,n,i){if(Vc){var u=Sf(i);if(u===null)rf(e,t,i,Pc,n),Eg(e,i);else if(Mb(u,e,t,n,i))i.stopPropagation();else if(Eg(e,i),t&4&&-1<Sb.indexOf(e)){for(;u!==null;){var f=un(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var y=Zn(f.pendingLanes);if(y!==0){var N=f;for(N.pendingLanes|=2,N.entangledLanes|=2;y;){var _=1<<31-At(y);N.entanglements[1]|=_,y&=~_}Ja(f),(tt&6)===0&&(kc=Re()+500,no(0))}}break;case 31:case 13:N=bl(f,2),N!==null&&qn(N,f,2),Dc(),bf(f,2)}if(f=Sf(i),f===null&&rf(e,t,i,Pc,n),f===u)break;u=f}u!==null&&i.stopPropagation()}else rf(e,t,i,null,n)}}function Sf(e){return e=rs(e),Mf(e)}var Pc=null;function Mf(e){if(Pc=null,e=qt(e),e!==null){var t=d(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=h(t),e!==null)return e;e=null}else if(n===31){if(e=p(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Pc=e,null}function kg(e){switch(e){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(It()){case xn:return 2;case Ie:return 8;case ca:case Ta:return 32;case Nn:return 268435456;default:return 32}default:return 32}}var Cf=!1,vi=null,yi=null,bi=null,co=new Map,uo=new Map,wi=[],Sb="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 Eg(e,t){switch(e){case"focusin":case"focusout":vi=null;break;case"dragenter":case"dragleave":yi=null;break;case"mouseover":case"mouseout":bi=null;break;case"pointerover":case"pointerout":co.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":uo.delete(t.pointerId)}}function fo(e,t,n,i,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:n,eventSystemFlags:i,nativeEvent:f,targetContainers:[u]},t!==null&&(t=un(t),t!==null&&Ag(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Mb(e,t,n,i,u){switch(t){case"focusin":return vi=fo(vi,e,t,n,i,u),!0;case"dragenter":return yi=fo(yi,e,t,n,i,u),!0;case"mouseover":return bi=fo(bi,e,t,n,i,u),!0;case"pointerover":var f=u.pointerId;return co.set(f,fo(co.get(f)||null,e,t,n,i,u)),!0;case"gotpointercapture":return f=u.pointerId,uo.set(f,fo(uo.get(f)||null,e,t,n,i,u)),!0}return!1}function Dg(e){var t=qt(e.target);if(t!==null){var n=d(t);if(n!==null){if(t=n.tag,t===13){if(t=h(n),t!==null){e.blockedOn=t,Wn(e.priority,function(){Tg(n)});return}}else if(t===31){if(t=p(n),t!==null){e.blockedOn=t,Wn(e.priority,function(){Tg(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Qc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Sf(e.nativeEvent);if(n===null){n=e.nativeEvent;var i=new n.constructor(n.type,n);ot=i,n.target.dispatchEvent(i),ot=null}else return t=un(n),t!==null&&Ag(t),e.blockedOn=n,!1;t.shift()}return!0}function Rg(e,t,n){Qc(e)&&n.delete(t)}function Cb(){Cf=!1,vi!==null&&Qc(vi)&&(vi=null),yi!==null&&Qc(yi)&&(yi=null),bi!==null&&Qc(bi)&&(bi=null),co.forEach(Rg),uo.forEach(Rg)}function Kc(e,t){e.blockedOn===t&&(e.blockedOn=null,Cf||(Cf=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Cb)))}var Xc=null;function Lg(e){Xc!==e&&(Xc=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Xc===e&&(Xc=null);for(var t=0;t<e.length;t+=3){var n=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(Mf(i||n)===null)continue;break}var f=un(n);f!==null&&(e.splice(t,3),t-=3,wd(f,{pending:!0,data:u,method:n.method,action:i},i,u))}}))}function Qs(e){function t(_){return Kc(_,e)}vi!==null&&Kc(vi,e),yi!==null&&Kc(yi,e),bi!==null&&Kc(bi,e),co.forEach(t),uo.forEach(t);for(var n=0;n<wi.length;n++){var i=wi[n];i.blockedOn===e&&(i.blockedOn=null)}for(;0<wi.length&&(n=wi[0],n.blockedOn===null);)Dg(n),n.blockedOn===null&&wi.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(i=0;i<n.length;i+=3){var u=n[i],f=n[i+1],y=u[me]||null;if(typeof f=="function")y||Lg(n);else if(y){var N=null;if(f&&f.hasAttribute("formAction")){if(u=f,y=f[me]||null)N=y.formAction;else if(Mf(u)!==null)continue}else N=y.action;typeof N=="function"?n[i+1]=N:(n.splice(i,3),i-=3),Lg(n)}}}function _g(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(y){return u=y})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(n,20)}function n(){if(!i&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function jf(e){this._internalRoot=e}Zc.prototype.render=jf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var n=t.current,i=sa();jg(n,i,e,t,null,null)},Zc.prototype.unmount=jf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;jg(e.current,2,null,e,null,null),Dc(),t[we]=null}};function Zc(e){this._internalRoot=e}Zc.prototype.unstable_scheduleHydration=function(e){if(e){var t=vn();e={blockedOn:null,target:e,priority:t};for(var n=0;n<wi.length&&t!==0&&t<wi[n].priority;n++);wi.splice(n,0,e),n===0&&Dg(e)}};var zg=l.version;if(zg!=="19.2.7")throw Error(r(527,zg,"19.2.7"));X.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=x(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var jb={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wc.isDisabled&&Wc.supportsFiber)try{An=Wc.inject(jb),nt=Wc}catch{}}return ho.createRoot=function(e,t){if(!c(e))throw Error(r(299));var n=!1,i="",u=qh,f=$h,y=Gh;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError)),t=Mg(e,1,!1,null,null,n,i,null,u,f,y,_g),e[we]=t.current,sf(e),new jf(t)},ho.hydrateRoot=function(e,t,n){if(!c(e))throw Error(r(299));var i=!1,u="",f=qh,y=$h,N=Gh,_=null;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(u=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(y=n.onCaughtError),n.onRecoverableError!==void 0&&(N=n.onRecoverableError),n.formState!==void 0&&(_=n.formState)),t=Mg(e,1,!0,t,n??null,i,u,_,f,y,N,_g),t.context=Cg(null),n=t.current,i=sa(),i=Ga(i),u=si(i),u.callback=null,ri(n,u,i),n=i,t.current.lanes=n,Da(t,n),Ja(t),e[we]=t.current,sf(e),new Zc(t)},ho.version="19.2.7",ho}var Vg;function Xb(){if(Vg)return Df.exports;Vg=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),Df.exports=Kb(),Df.exports}var Zb=Xb();const Wb="https://otbyfkjxrkngvjziawki.supabase.co",Jb="sb_publishable_NpUs0RDJH2YnllsqTKO6TQ_1jTdSsNQ",nl=Gb(Wb,Jb,{auth:{autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"pkce",storageKey:"livedesk.mindexec.supabase.auth"}});function Ci(a,l,s){if(s<0||l<0||l+s>a.length)throw new Error("Invalid LZO1X block: input overrun.")}function _f(a,l,s){let r=0;for(;Ci(a,l.inputIndex,1),a[l.inputIndex]===0;)r+=1,l.inputIndex+=1;const c=r*255+s+a[l.inputIndex];return l.inputIndex+=1,c}function Jc(a,l,s,r){if(Ci(a,l.inputIndex,r),l.outputIndex+r>s.length)throw new Error("Invalid LZO1X block: output overrun.");s.set(a.subarray(l.inputIndex,l.inputIndex+r),l.outputIndex),l.inputIndex+=r,l.outputIndex+=r}function e0(a,l,s,r){const c=l-s;if(c<=0||r<=0)throw new Error("Invalid LZO1X block: invalid match distance.");let d=Math.min(c,r);for(a.set(a.subarray(s,s+d),l);d<r;){const h=Math.min(d,r-d);a.copyWithin(l+d,l,l+h),d+=h}return l+r}function sv(a,l){if(!(a instanceof Uint8Array)||a.length<3||l<0)throw new Error("Invalid LZO1X block.");const s=new Uint8Array(l),r={inputIndex:0,outputIndex:0};let c=0,d=0;if(a[r.inputIndex]>=22){const h=a[r.inputIndex]-17;r.inputIndex+=1,Jc(a,r,s,h),c=4}else a[r.inputIndex]>=18&&(c=a[r.inputIndex]-17,r.inputIndex+=1,Jc(a,r,s,c));for(;;){Ci(a,r.inputIndex,1);const h=a[r.inputIndex];r.inputIndex+=1;let p,g;if((h&192)!==0)Ci(a,r.inputIndex,1),g=r.outputIndex-((a[r.inputIndex]<<3)+(h>>2&7)+1),r.inputIndex+=1,d=(h>>5)+1,p=h&3;else if((h&32)!==0){d=(h&31)+2,d===2&&(d+=_f(a,r,31)),Ci(a,r.inputIndex,2);const x=a[r.inputIndex]|a[r.inputIndex+1]<<8;r.inputIndex+=2,g=r.outputIndex-((x>>2)+1),p=x&3}else if((h&16)!==0){d=(h&7)+2,d===2&&(d+=_f(a,r,7)),Ci(a,r.inputIndex,2);const x=a[r.inputIndex]|a[r.inputIndex+1]<<8;if(r.inputIndex+=2,g=r.outputIndex-(((h&8)<<11)+(x>>2)),p=x&3,g===r.outputIndex)break;g-=16384}else if(c===0){let x=h+3;x===3&&(x+=_f(a,r,15)),Jc(a,r,s,x),c=4;continue}else c!==4?(Ci(a,r.inputIndex,1),p=h&3,g=r.outputIndex-((h>>2)+(a[r.inputIndex]<<2)+1),r.inputIndex+=1,d=2):(Ci(a,r.inputIndex,1),p=h&3,g=r.outputIndex-((h>>2)+(a[r.inputIndex]<<2)+2049),r.inputIndex+=1,d=3);if(g<0||r.outputIndex+d+p>s.length)throw new Error("Invalid LZO1X block: lookbehind overrun.");r.outputIndex=e0(s,r.outputIndex,g,d),c=p,Jc(a,r,s,p)}if(d!==3||r.inputIndex!==a.length||r.outputIndex!==s.length)throw new Error("Invalid LZO1X block: incomplete output.");return s}const Pg=16,Qg=8,t0=24*1024*1024,rv=new Uint8Array(new Uint32Array([16909060]).buffer)[0]===4,am=new Uint32Array(65536);for(let a=0;a<am.length;a+=1){const l=Math.round((a>>11&31)*255/31),s=Math.round((a>>5&63)*255/63),r=Math.round((a&31)*255/31);am[a]=rv?(l|s<<8|r<<16|4278190080)>>>0:(l<<24|s<<16|r<<8|255)>>>0}function Mi(a,l){return a[l]|a[l+1]<<8}function n0(a,l){const s=Number(l);if(!Number.isSafeInteger(s)||s<Pg||s>t0)throw new Error(`Invalid Mode 5 packet length: ${l}.`);const r=sv(new Uint8Array(a),s);if(r[0]!==76||r[1]!==68||r[2]!==53||r[3]!==68)throw new Error("Invalid Mode 5 packet magic.");if(r[4]!==1)throw new Error(`Unsupported Mode 5 packet version: ${r[4]}.`);const c=(r[5]&1)!==0,d=Mi(r,6),h=Mi(r,8),p=Mi(r,10),g=Mi(r,12);if(d<=0||h<=0||d>3840||h>2160)throw new Error(`Invalid Mode 5 frame size: ${d}x${h}.`);if(p<=0||p>256||g>8192)throw new Error(`Invalid Mode 5 tile header: ${p}/${g}.`);const x=[];let b=Pg;for(let v=0;v<g;v+=1){if(b+Qg>r.length)throw new Error("Mode 5 tile header is truncated.");const S=Mi(r,b),M=Mi(r,b+2),C=Mi(r,b+4),j=Mi(r,b+6);b+=Qg;const k=C*j*2;if(C<=0||j<=0||C>p||j>p||S+C>d||M+j>h||b+k>r.length)throw new Error(`Invalid Mode 5 tile ${v}.`);x.push({x:S,y:M,width:C,height:j,pixels:r.subarray(b,b+k)}),b+=k}if(b!==r.length)throw new Error(`Mode 5 packet has ${r.length-b} trailing bytes.`);return{keyFrame:c,width:d,height:h,tileSize:p,tiles:x}}function a0(a,l,s,r){if(!(a instanceof Uint8ClampedArray)||a.length!==l*s*4||r.width!==l||r.height!==s)throw new Error("Mode 5 canvas state does not match the packet dimensions.");let c=l,d=s,h=0,p=0;const g=new Uint32Array(a.buffer,a.byteOffset,a.byteLength>>>2);for(const x of r.tiles){const b=rv&&(x.pixels.byteOffset&1)===0?new Uint16Array(x.pixels.buffer,x.pixels.byteOffset,x.pixels.byteLength>>>1):null;let v=0;for(let S=0;S<x.height;S+=1){let M=(x.y+S)*l+x.x;for(let C=0;C<x.width;C+=1){const j=v<<1,k=b?b[v]:x.pixels[j]|x.pixels[j+1]<<8;g[M]=am[k],v+=1,M+=1}}c=Math.min(c,x.x),d=Math.min(d,x.y),h=Math.max(h,x.x+x.width),p=Math.max(p,x.y+x.height)}return r.tiles.length>0?{x:c,y:d,width:h-c,height:p-d}:null}const Pn=new WeakMap,Eo=new WeakMap,lm=new WeakMap,Do=new Set,Wi=new Set,yu=new WeakMap,im=new WeakMap,sm=new WeakMap,bu=new WeakMap,Sm=32,l0=2,i0=2,s0=2,r0=18,o0=40,c0=0,u0=750,ov=80,Kg=5,d0=150,f0=24,m0=180,h0=1200,p0=18,g0=.65,x0=2e3,v0=500,cv=250;let wu=!1;function y0(){return typeof navigator>"u"?!1:/mac/i.test(`${navigator.platform||""} ${navigator.userAgent||""}`)}function b0(){const a=Math.max(1,Number(navigator.hardwareConcurrency||8));return Math.max(4,Math.min(16,Math.round(a/2)))}let Ji={h264DecodeAcceleration:"prefer-hardware",h264HardwareDecoderBudget:b0()};function w0(a){a.h264DecodeAcceleration&&(Ji={...Ji,h264DecodeAcceleration:a.h264DecodeAcceleration}),Number.isFinite(Number(a.h264HardwareDecoderBudget))&&(Ji.h264HardwareDecoderBudget=Math.max(1,Math.min(64,Math.round(Number(a.h264HardwareDecoderBudget)))))}function uv(a,l=Ji.h264DecodeAcceleration){const s=yu.get(a);return s?.requested===l?(s.actual!=="prefer-hardware"&&Wi.delete(a),s.actual):(s&&yu.delete(a),l!=="prefer-hardware"?(Wi.delete(a),l):Wi.has(a)?"prefer-hardware":Wi.size<Ji.h264HardwareDecoderBudget?(Wi.add(a),"prefer-hardware"):"prefer-software")}function Tu(a,l){return l!=="prefer-hardware"?!1:(yu.set(a,{requested:l,actual:"prefer-software"}),Wi.delete(a),!0)}function S0(a,l,s,r=64){try{let c=im.get(a);c||(c={canvas:document.createElement("canvas"),lastHash:"",initialized:!1},im.set(a,c));const d=Math.max(8,Math.min(64,Math.round(r))),h=Math.max(1,Math.round(d*Math.max(1,s)/Math.max(1,l)));(c.canvas.width!==d||c.canvas.height!==h)&&(c.canvas.width=d,c.canvas.height=h);const p=c.canvas.getContext("2d",{willReadFrequently:!0});if(!p)return{visualHash:"",visualChanged:!0};p.drawImage(a,0,0,Math.max(1,l),Math.max(1,s),0,0,d,h);const g=p.getImageData(0,0,d,h).data;let x=2166136261;for(let S=0;S<g.length;S+=4)x^=g[S],x=Math.imul(x,16777619),x^=g[S+1],x=Math.imul(x,16777619),x^=g[S+2],x=Math.imul(x,16777619);const b=(x>>>0).toString(16).padStart(8,"0"),v=!c.initialized||b!==c.lastHash;return c.initialized=!0,c.lastHash=b,{visualHash:b,visualChanged:v}}catch{return{visualHash:"",visualChanged:!0}}}function rm(a,l,s,r=cv,c=64){let d=sm.get(a);d||(d={lastHash:"",initialized:!1,lastCanvasSampleAt:0},sm.set(a,d));const h=performance.now();if(d.initialized&&r>0&&h-d.lastCanvasSampleAt<r)return{visualHash:d.lastHash,visualChanged:!1};const p=S0(a,l,s,c);return d.initialized=!0,d.lastHash=p.visualHash,d.lastCanvasSampleAt=h,p}function M0(a,l){let s=bu.get(a);s||(s={lastHash:"",initialized:!1},bu.set(a,s));const r=String(l.contentHash||""),c=!s.initialized||!r||r!==s.lastHash;return s.initialized=!0,s.lastHash=r,{visualHash:r,visualChanged:c}}function dv(a,l){const s=lm.get(a);if(s)return s;const r=a.getContext("2d",{alpha:!1,desynchronized:l==="interactive"});if(r){const c=r.getContextAttributes?.(),d={context:r,presentation:c?.desynchronized?"desync":"sync"};return lm.set(a,d),d}return null}function C0(a){const l=String(a.frameMode||a.mode||"").toLowerCase(),s=String(a.compression||"").toLowerCase(),r=String(a.mimeType||"").toLowerCase();return l==="mode2-lzo"||s==="lzo1x"||r==="application/vnd.livedesk.lzo-rgb565"||l==="mode2-lz4"||String(a.compression||"").toLowerCase()==="lz4"||r==="application/vnd.livedesk.lz4-raw"}function j0(a){return String(a.frameMode||a.mode||"").toLowerCase()==="mode3-h264-hw"||String(a.codec||"").toLowerCase()==="h264"||String(a.mimeType||"").toLowerCase()==="video/h264"}function N0(a){const l=String(a.frameMode||a.mode||"").toLowerCase(),s=String(a.mimeType||"").toLowerCase();return l==="mode5-lzo-delta"||s==="application/vnd.livedesk.lzo-rgb565-delta"}function Xg(a,l,s){let r=s,c=l;if(r===15){let d=255;for(;d===255;){if(c>=a.length)throw new Error("Invalid LZ4 block: length overrun.");d=a[c],c+=1,r+=d}}return{length:r,cursor:c}}function A0(a,l){const s=new Uint8Array(l);let r=0,c=0;for(;r<a.length;){const d=a[r];r+=1;const h=Xg(a,r,d>>4);r=h.cursor;const p=h.length;if(r+p>a.length||c+p>s.length)throw new Error("Invalid LZ4 block: literal overrun.");if(s.set(a.subarray(r,r+p),c),r+=p,c+=p,r>=a.length)break;if(r+2>a.length)throw new Error("Invalid LZ4 block: missing offset.");const g=a[r]|a[r+1]<<8;if(r+=2,g<=0||g>c)throw new Error("Invalid LZ4 block: bad match offset.");const x=Xg(a,r,d&15);r=x.cursor;const b=x.length+4;if(c+b>s.length)throw new Error("Invalid LZ4 block: match overrun.");let v=c-g;for(let S=0;S<b;S+=1)s[c]=s[v],c+=1,v+=1}if(c!==s.length)throw new Error("Invalid LZ4 block: incomplete output.");return s}function T0(a){const l=Math.max(1,Math.floor(a.width||0)),s=Math.max(1,Math.floor(a.height||0)),r=String(a.compression||"").toLowerCase(),c=String(a.pixelFormat||a.codec||"").toLowerCase();if(r==="lzo1x"||String(a.frameMode||a.mode||"").toLowerCase()==="mode2-lzo"||String(a.mimeType||"").toLowerCase()==="application/vnd.livedesk.lzo-rgb565"){const b=Math.max(1,Math.floor(a.bytesPerPixel||2)),v=l*s*2,S=Math.floor(a.uncompressedByteLength||v);if(b!==2||S!==v)throw new Error(`Invalid mode2 RGB565 frame size: ${S} for ${l}x${s}.`);if(c&&c!=="rgb565le"&&c!=="rgb565")throw new Error(`Unsupported mode2 pixel format: ${c}`);const M=sv(new Uint8Array(a.payload),v),C=new Uint8ClampedArray(l*s*4);for(let j=0,k=0;j<M.length;j+=2,k+=4){const T=M[j]|M[j+1]<<8,A=T>>11&31,z=T>>5&63,G=T&31;C[k]=A<<3|A>>2,C[k+1]=z<<2|z>>4,C[k+2]=G<<3|G>>2,C[k+3]=255}return new ImageData(C,l,s)}const h=Math.max(1,Math.floor(a.bytesPerPixel||4)),p=Math.max(l*s*h,Math.floor(a.uncompressedByteLength||0)),g=A0(new Uint8Array(a.payload),p);if(h!==4)throw new Error(`Unsupported mode2 pixel size: ${h}`);const x=new Uint8ClampedArray(l*s*4);if(c==="rgba32"||c==="rgba")x.set(g.subarray(0,x.length));else for(let b=0,v=0;v<x.length;b+=4,v+=4)x[v]=g[b+2],x[v+1]=g[b+1],x[v+2]=g[b],x[v+3]=g[b+3];return new ImageData(x,l,s)}function Zg(a,l="smooth"){const s=window.VideoDecoder;if(!s||!window.EncodedVideoChunk)throw new Error("WebCodecs H.264 decode is not supported in this browser.");const r=Pn.get(a);if(r&&r.decoder.state!=="closed"&&r.latencyMode===l)return r;r&&Ua(a);let c;return c={decoder:new s({output:h=>{if(Pn.get(a)!==c){h.close();return}const p=Number(h.timestamp||0);c.outputSerial+=1;let g=c.pendingFrames.get(p);if(g)c.pendingFrames.delete(p);else if(c.pendingFrames.size>0){const C=c.pendingFrames.entries().next().value;C&&(c.pendingFrames.delete(C[0]),g=C[1],c.timestampFallbacks+=1)}const x=h.displayWidth||h.codedWidth||a.width||960,b=h.displayHeight||h.codedHeight||a.height||540,v=Number(g?.frame.durationUs||0),S=Number(h.duration||0),M=Math.max(16,Math.min(250,(v>0?v:S||83333)/1e3));for(c.targetPaintIntervalMs=M,c.decodedFrames.push({videoFrame:h,pending:g,decodedAt:performance.now(),width:x,height:b,durationMs:M}),c.lastOutputAt=performance.now();c.decodedFrames.length>fv(c);)Su(c,c.decodedFrames.shift());mv(c),c.renderTimer!==null&&c.renderScheduledAt>0&&performance.now()-c.renderScheduledAt>v0&&(typeof document>"u"||document.visibilityState==="visible")&&(window.cancelAnimationFrame(c.renderTimer),c.renderTimer=null,c.renderScheduledAt=0),c.renderTimer!==null&&c.decodedFrames.length>=Sm&&(window.cancelAnimationFrame(c.renderTimer),c.renderTimer=null,c.renderScheduledAt=0),Mu(a,c)},error:()=>{Pn.get(a)===c&&(Tu(a,c.hardwareAcceleration),Mm(c),Do.delete(a),Pn.delete(a))}}),configured:!1,configKey:"",hardwareAcceleration:uv(a),latencyMode:l,keyFrameSeen:!1,droppedForLatency:0,pendingFrames:new Map,decodedFrames:[],renderTimer:null,renderScheduledAt:0,flushTimer:null,flushInFlight:!1,flushCount:0,timestampFallbacks:0,inputSerial:0,outputSerial:0,lastFlushInputSerial:0,lastOutputAt:0,lastPaintAt:0,lastInputAt:0,interactiveBufferPrimed:!1,interactiveBufferStartedAt:0,interactiveBufferWaitCount:0,interactiveBufferWaitMs:0,interactiveQueueDrainCount:0,lastInputFrameSeq:void 0,targetPaintIntervalMs:1e3/12,nextChunkTimestampUs:0,healthSampleStartedAt:performance.now(),healthInputSerial:0,healthOutputSerial:0},Pn.set(a,c),Do.add(a),c}function Mm(a){a.renderTimer!==null&&(window.cancelAnimationFrame(a.renderTimer),a.renderTimer=null),a.renderScheduledAt=0,a.flushTimer!==null&&(window.clearTimeout(a.flushTimer),a.flushTimer=null),a.flushInFlight=!1;for(const l of a.decodedFrames)l.videoFrame.close();a.decodedFrames=[],a.interactiveBufferPrimed=!1,a.interactiveBufferStartedAt=0}function Su(a,l){l&&(l.videoFrame.close(),a.droppedForLatency+=1)}function fv(a){return a.latencyMode==="interactive"?i0:String(a.decodedFrames[0]?.pending?.frame.frameMode||a.decodedFrames[0]?.pending?.frame.mode||"").toLowerCase()==="mode4-h264-atlas"?l0:Sm}function mv(a,l=performance.now()){const s=fv(a);for(;a.decodedFrames.length>s;)Su(a,a.decodedFrames.shift());const r=a.latencyMode==="interactive"?ov:u0;let c=a.decodedFrames[0];for(;a.decodedFrames.length>1&&c?.pending&&l-c.pending.queuedAt>r;)Su(a,a.decodedFrames.shift()),c=a.decodedFrames[0]}function hv(a,l){if(l.hardwareAcceleration!=="prefer-hardware"||l.flushTimer!==null||l.flushInFlight)return;const s=l.latencyMode==="interactive"?f0:d0,r=l.latencyMode==="interactive";l.flushTimer=window.setTimeout(async()=>{l.flushTimer=null;const c=performance.now();for(const[p,g]of l.pendingFrames.entries())c-g.queuedAt>x0&&l.pendingFrames.delete(p);if(Pn.get(a)!==l||l.decoder.state!=="configured"||l.pendingFrames.size===0||l.inputSerial<=l.lastFlushInputSerial||!r&&l.lastOutputAt>0&&c-l.lastOutputAt<s)return;const d=l.inputSerial,h=performance.now();l.flushInFlight=!0,l.flushCount+=1;try{await l.decoder.flush(),l.lastFlushInputSerial=Math.max(l.lastFlushInputSerial,d)}catch{Pn.get(a)===l&&mu(l)}finally{l.flushInFlight=!1;const p=performance.now()-h;if(r&&p>=m0&&l.hardwareAcceleration==="prefer-hardware"){wu=!0,Tu(a,l.hardwareAcceleration),Ua(a);return}Pn.get(a)===l&&l.inputSerial>d&&l.pendingFrames.size>0&&(r||performance.now()-l.lastOutputAt>=s)&&hv(a,l)}},s)}function Wg(a,l,s){const r=performance.now();try{(a.width!==s.width||a.height!==s.height)&&(a.width=s.width,a.height=s.height);const c=dv(a,l.latencyMode);if(c?.context.drawImage(s.videoFrame,0,0,s.width,s.height),s.pending){const d=performance.now(),p=l.latencyMode==="interactive"?M0(a,s.pending.frame):rm(a,s.width,s.height,cv,64);try{l.onPaint?.(s.pending.frame,{deviceId:s.pending.frame.deviceId,frameSeq:s.pending.frame.frameSeq,mode:s.pending.frame.frameMode||s.pending.frame.mode||s.pending.frame.codec||s.pending.frame.mimeType,width:s.width,height:s.height,byteLength:s.pending.frame.byteLength,queuedForMs:Math.max(0,r-s.pending.queuedAt),decodedForMs:Math.max(0,s.decodedAt-s.pending.queuedAt),scheduledForMs:Math.max(0,r-s.decodedAt),drawMs:Math.max(0,d-r),queueSize:s.pending.queueSize,renderQueueSize:l.decodedFrames.length,droppedForLatency:l.droppedForLatency,h264DecodeAcceleration:l.hardwareAcceleration,decoderLabel:l.hardwareAcceleration,decoderFlushCount:l.flushCount,decoderTimestampFallbacks:l.timestampFallbacks,decoderInputCount:l.inputSerial,decoderOutputCount:l.outputSerial,targetPaintIntervalMs:l.targetPaintIntervalMs,canvasPresentation:c?.presentation||"sync",interactiveBufferWaitCount:l.interactiveBufferWaitCount,interactiveBufferWaitMs:l.interactiveBufferWaitMs,interactiveQueueDrainCount:l.interactiveQueueDrainCount,visualHash:p.visualHash,visualChanged:p.visualChanged,paintedAt:d})}catch{}}l.lastPaintAt=performance.now()}finally{s.videoFrame.close()}}function Mu(a,l){if(l.renderTimer!==null||l.decodedFrames.length===0)return;const s=Math.max(16,Math.min(250,l.targetPaintIntervalMs||1e3/12)),r=()=>{if(l.renderTimer=null,l.renderScheduledAt=0,l.decodedFrames.length===0)return;const c=performance.now();if(mv(l,c),l.decodedFrames.length===0)return;if(l.latencyMode==="interactive"){const g=l.targetPaintIntervalMs<=o0,x=l.targetPaintIntervalMs<=20;if(x&&!l.interactiveBufferPrimed){l.interactiveBufferStartedAt<=0&&(l.interactiveBufferStartedAt=c,l.interactiveBufferWaitCount+=1);const j=l.decodedFrames.length>=s0,k=c-l.interactiveBufferStartedAt>=r0;if(!j&&!k){l.renderScheduledAt=performance.now(),l.renderTimer=window.requestAnimationFrame(r);return}l.interactiveBufferWaitMs+=Math.max(0,c-l.interactiveBufferStartedAt),l.interactiveBufferPrimed=!0}else x||(l.interactiveBufferPrimed=!0);const b=l.decodedFrames[0],v=b?.pending?Math.max(0,c-b.pending.queuedAt):0,S=l.lastPaintAt>0?l.lastPaintAt+s:c;if(!(!g||c+Kg>=S||v>=ov)){l.renderScheduledAt=performance.now(),l.renderTimer=window.requestAnimationFrame(r);return}const C=l.decodedFrames.shift();if(C)try{Wg(a,l,C)}catch{}l.decodedFrames.length===0&&(l.interactiveQueueDrainCount+=1,l.interactiveBufferPrimed=!1,l.interactiveBufferStartedAt=0),Mu(a,l);return}const d=l.lastPaintAt>0?l.lastPaintAt+s:c+c0;if(!(c+Kg>=d||l.decodedFrames.length>=Sm-1)){l.renderScheduledAt=performance.now(),l.renderTimer=window.requestAnimationFrame(r);return}const p=l.decodedFrames.shift();if(p)try{Wg(a,l,p)}catch{}Mu(a,l)};l.renderScheduledAt=performance.now(),l.renderTimer=window.requestAnimationFrame(r)}function pv(a,l){if(Pn.get(a)!==l||l.decoder.state==="closed")return!1;for(l.renderTimer!==null&&(window.cancelAnimationFrame(l.renderTimer),l.renderTimer=null),l.renderScheduledAt=0;l.decodedFrames.length>1;)Su(l,l.decodedFrames.shift());return l.lastPaintAt=0,l.interactiveBufferPrimed=!1,l.interactiveBufferStartedAt=0,Mu(a,l),!0}function zf(){if(!(typeof document>"u"||document.visibilityState!=="visible"))for(const a of Do){const l=Pn.get(a);if(!l||l.decoder.state==="closed"){Do.delete(a);continue}pv(a,l)}}typeof document<"u"&&typeof window<"u"&&(document.addEventListener("visibilitychange",zf),window.addEventListener("focus",zf),window.addEventListener("pageshow",zf));function Ua(a){Wi.delete(a),Do.delete(a),bu.delete(a);const l=Pn.get(a);if(l){Pn.delete(a);try{Mm(l),l.decoder.state!=="closed"&&l.decoder.close()}catch{}}}function Of(a){a&&(yu.delete(a),lm.delete(a),sm.delete(a),im.delete(a),bu.delete(a),Eo.delete(a),Ua(a))}function mu(a,l=1){try{a.decoder.state!=="closed"&&a.decoder.reset()}catch{}a.configured=!1,a.configKey="",a.keyFrameSeen=!1,a.pendingFrames.clear(),Mm(a),a.lastPaintAt=0,a.lastOutputAt=0,a.lastInputAt=0,a.interactiveBufferPrimed=!1,a.interactiveBufferStartedAt=0,a.lastInputFrameSeq=void 0,a.nextChunkTimestampUs=0,a.healthSampleStartedAt=performance.now(),a.healthInputSerial=a.inputSerial,a.healthOutputSerial=a.outputSerial,a.droppedForLatency+=Math.max(1,Math.min(1e4,Math.floor(l)))}function eu(a,l,s,r){a.decoder.configure(l),a.configured=!0,a.configKey=s,a.hardwareAcceleration=r,a.keyFrameSeen=!1,a.nextChunkTimestampUs=0,a.lastInputFrameSeq=void 0}function k0(a,l){if(l.latencyMode!=="interactive"||l.hardwareAcceleration!=="prefer-hardware")return!1;const s=performance.now();if(s-l.healthSampleStartedAt<h0)return!1;const r=l.inputSerial-l.healthInputSerial,c=l.outputSerial-l.healthOutputSerial;return l.healthSampleStartedAt=s,l.healthInputSerial=l.inputSerial,l.healthOutputSerial=l.outputSerial,r<p0||c/Math.max(1,r)>=g0?!1:(wu=!0,Tu(a,l.hardwareAcceleration),Ua(a),!0)}function Jg(a,l=1){if(!a)return!1;const s=Pn.get(a);return s?(s.droppedForLatency+=Math.max(1,Math.min(1e4,Math.floor(l))),Ua(a),!0):!1}function E0(a){if(!a)return!1;const l=Pn.get(a);return l?pv(a,l):!1}function D0(a,l,s,r="interactive"){Ua(a);const c=performance.now(),d=n0(l.payload,l.uncompressedByteLength||0),h=String(l.streamId||"mode5");let p=Eo.get(a);if(!p||p.streamId!==h||p.width!==d.width||p.height!==d.height){const j=new Uint8ClampedArray(d.width*d.height*4);for(let k=3;k<j.length;k+=4)j[k]=255;p={streamId:h,width:d.width,height:d.height,rgba:j,imageData:new ImageData(j,d.width,d.height),keyFrameSeen:!1,inputSerial:0,outputSerial:0},Eo.set(a,p)}if(!p)throw new Error("Mode 5 canvas state could not be initialized.");p.inputSerial+=1;const x=Number(l.streamFrameSeq||0);if(x>0&&(p.lastStreamFrameSeq=x),!d.keyFrame&&!p.keyFrameSeen)return;d.keyFrame&&(p.keyFrameSeen=!0);const b=a0(p.rgba,p.width,p.height,d),v=performance.now();(a.width!==p.width||a.height!==p.height)&&(a.width=p.width,a.height=p.height);const S=dv(a,r),M=performance.now();b&&S?.context.putImageData(p.imageData,0,0,b.x,b.y,b.width,b.height);const C=performance.now();p.outputSerial+=1,s?.(l,{deviceId:l.deviceId,frameSeq:l.frameSeq,mode:l.frameMode||l.mode||l.mimeType,width:p.width,height:p.height,byteLength:l.byteLength,queuedForMs:Math.max(0,C-c),decodedForMs:Math.max(0,v-c),scheduledForMs:0,drawMs:Math.max(0,C-M),queueSize:0,renderQueueSize:0,droppedForLatency:0,h264DecodeAcceleration:"prefer-software",decoderLabel:"lzo-rgb565-delta",decoderFlushCount:0,decoderTimestampFallbacks:0,decoderInputCount:p.inputSerial,decoderOutputCount:p.outputSerial,targetPaintIntervalMs:Math.max(1,Number(l.durationUs||0)/1e3||1e3/30),canvasPresentation:S?.presentation||"sync",interactiveBufferWaitCount:0,interactiveBufferWaitMs:0,interactiveQueueDrainCount:0,visualHash:String(l.contentHash||""),visualChanged:Number(l.deltaVisualTileCount||0)>0,paintedAt:C})}function R0(a,l,s,r,c="smooth"){Eo.delete(a);const d=String(l.h264Format||"").toLowerCase()==="avc"?"avc":"annexb",h=Math.max(1,Math.floor(l.width||960)),p=Math.max(1,Math.floor(l.height||540)),g=String(l.frameMode||l.mode||"").toLowerCase(),x=c==="interactive"&&r==="prefer-hardware"&&y0(),v=g==="mode4-h264-atlas"?"prefer-software":uv(a,c==="interactive"&&(wu||x)?"prefer-software":r),S=[l.streamId||"",l.commandId||"",h,p,d,v,c].join("|");let M=Zg(a,c);M.onPaint=s,M.configured&&M.decoder.state!=="configured"&&(M.configured=!1,M.configKey=""),M.configured&&M.configKey!==S&&(Ua(a),M=Zg(a,c),M.onPaint=s);const C={codec:"avc1.42E01E",codedWidth:h,codedHeight:p,hardwareAcceleration:v,optimizeForLatency:!0,avc:{format:d}};M.configured||eu(M,C,S,v);const j=l.isKeyFrame===!0||String(l.chunkType||"").toLowerCase()==="key";Number(l.frameSeq||0);const k=Number(l.streamFrameSeq||0);if(k>0&&M.lastInputFrameSeq!==void 0){if(k<=M.lastInputFrameSeq){if(!j||k===M.lastInputFrameSeq)return;mu(M,M.lastInputFrameSeq-k+1),eu(M,C,S,v)}if(k>M.lastInputFrameSeq+1){if(mu(M,k-M.lastInputFrameSeq-1),!j)return;eu(M,C,S,v)}}if(k>0&&(M.lastInputFrameSeq=k),!j&&!M.keyFrameSeen)return;j&&(M.keyFrameSeen=!0);const T=Number(M.decoder.decodeQueueSize||0);if(T>8){if(M.latencyMode==="interactive"&&M.hardwareAcceleration==="prefer-hardware"){wu=!0,Tu(a,M.hardwareAcceleration),Ua(a);return}if(mu(M),!j)return;eu(M,C,S,v),M.keyFrameSeen=!0}const A=Math.max(1,Math.floor(l.durationUs||1e6/12)),z=M.nextChunkTimestampUs;M.nextChunkTimestampUs+=A,M.pendingFrames.set(z,{frame:l,queuedAt:performance.now(),queueSize:T}),M.inputSerial+=1,M.lastInputAt=performance.now();const G=new EncodedVideoChunk({type:j?"key":"delta",timestamp:z,duration:A,data:l.payload});try{M.decoder.decode(G)}catch(I){throw Ua(a),I}hv(a,M),k0(a,M)}async function Bf(a,l,s,r,c,d="smooth"){if(N0(l)){s()||D0(a,l,r,d);return}if(j0(l)){s()||R0(a,l,r,c,d);return}if(Eo.delete(a),C0(l)){Ua(a);const v=T0(l);if(s())return;(a.width!==v.width||a.height!==v.height)&&(a.width=v.width,a.height=v.height);const S=a.getContext("2d"),M=performance.now();S?.putImageData(v,0,0);const C=performance.now(),j=rm(a,v.width,v.height);r?.(l,{deviceId:l.deviceId,frameSeq:l.frameSeq,mode:l.frameMode||l.mode||l.codec||l.mimeType,width:v.width,height:v.height,byteLength:l.byteLength,queuedForMs:0,decodedForMs:0,scheduledForMs:0,drawMs:Math.max(0,C-M),queueSize:0,renderQueueSize:0,droppedForLatency:0,h264DecodeAcceleration:Ji.h264DecodeAcceleration,decoderLabel:"lzo-rgb565",decoderFlushCount:0,decoderTimestampFallbacks:0,decoderInputCount:0,decoderOutputCount:0,targetPaintIntervalMs:0,canvasPresentation:"sync",interactiveBufferWaitCount:0,interactiveBufferWaitMs:0,interactiveQueueDrainCount:0,visualHash:j.visualHash,visualChanged:j.visualChanged,paintedAt:C});return}Ua(a);const h=new Blob([l.payload],{type:l.mimeType}),p=await createImageBitmap(h);if(s()){p.close();return}const g=l.width||p.width||960,x=l.height||p.height||540;(a.width!==g||a.height!==x)&&(a.width=g,a.height=x);const b=a.getContext("2d");if(b){const v=performance.now();b.clearRect(0,0,g,x),b.drawImage(p,0,0,g,x);const S=performance.now(),M=rm(a,g,x);r?.(l,{deviceId:l.deviceId,frameSeq:l.frameSeq,mode:l.frameMode||l.mode||l.codec||l.mimeType,width:g,height:x,byteLength:l.byteLength,queuedForMs:0,decodedForMs:0,scheduledForMs:0,drawMs:Math.max(0,S-v),queueSize:0,renderQueueSize:0,droppedForLatency:0,h264DecodeAcceleration:Ji.h264DecodeAcceleration,decoderLabel:"image",decoderFlushCount:0,decoderTimestampFallbacks:0,decoderInputCount:0,decoderOutputCount:0,targetPaintIntervalMs:0,canvasPresentation:"sync",interactiveBufferWaitCount:0,interactiveBufferWaitMs:0,interactiveQueueDrainCount:0,visualHash:M.visualHash,visualChanged:M.visualChanged,paintedAt:S})}p.close()}const Co=5179,on=_o(`http://127.0.0.1:${Co}`);function L0(a){const l=a.split(".").map(s=>Number(s));return l.length===4&&l.every(s=>Number.isInteger(s)&&s>=0&&s<=255)?l:[]}function _0(a){const l=a.trim().toLowerCase();return l==="localhost"||l==="127.0.0.1"||l==="::1"||l==="[::1]"}function z0(a){const l=a.trim().toLowerCase();return!l||l==="0.0.0.0"||l==="::"||l==="[::]"}function O0(a){const l=L0(a);return l.length===0?!1:l[0]===10||l[0]===172&&l[1]>=16&&l[1]<=31||l[0]===192&&l[1]===168}function B0(a){return a.includes(":")&&!a.startsWith("[")?`[${a}]`:a}function H0(a){const l=String(a||"").trim();if(!l)return null;const s=/^[a-z][a-z\d+.-]*:\/\//i.test(l)?l:`tcp://${l}`;try{const r=new URL(s),c=r.hostname.replace(/^\[|\]$/g,""),d=Number(r.port);return!c||!Number.isInteger(d)||d<1||d>65535||z0(c)?null:{host:c,port:d}}catch{return null}}function _o(a){const l=String(a||"").trim()||`http://127.0.0.1:${Co}`,s=/^[a-z][a-z\d+.-]*:\/\//i.test(l)?l:`http://${l}`;try{const r=new URL(s);return r.port||(r.port=String(Co)),r.hash="",r.search="",r.toString().replace(/\/+$/,"")}catch{return`http://127.0.0.1:${Co}`}}function F0(a){const l=H0(a);return l?_o(`http://${B0(l.host)}:${Co}`):""}function ex(a){const s=[a?.endpoint,...Array.isArray(a?.endpoint_candidates)?a.endpoint_candidates:[]].map(r=>F0(String(r||""))).filter(Boolean);return[...new Set(s)]}function jo(a=on){if(!(typeof window>"u"||window.location.protocol!=="https:"))try{const l=new URL(a);if(l.protocol!=="http:")return;if(_0(l.hostname))return"loopback";if(O0(l.hostname))return"local"}catch{return}}function ku(a,l=on){const s=new URL(a,_o(l));return s.protocol=s.protocol==="https:"?"wss:":"ws:",s.toString()}async function pt(a,l,s=on){const r=_o(s),c={...l,headers:{"Content-Type":"application/json",...l?.headers||{}},cache:"no-store"},d=jo(r);d&&(c.targetAddressSpace=d);let h;try{h=await fetch(`${r}${a}`,c)}catch(p){throw d?new Error("LiveDesk Hub is not reachable at this local network address. If Chrome shows a local network prompt, allow it; otherwise restart the Hub so port 5179 is open on the network."):p}if(!h.ok)throw new Error(`${h.status} ${h.statusText}`);return await h.json()}function om(a){if(!a)return"-";const l=Date.now()-Date.parse(a);return Number.isFinite(l)?l<1e3?"now":l<6e4?`${Math.round(l/1e3)}s`:l<36e5?`${Math.round(l/6e4)}m`:`${Math.round(l/36e5)}h`:"-"}async function Zi(a){await navigator.clipboard.writeText(a)}const tx="livedesk_remote_host_targets",I0="livedesk_entitlements";function U0(a){const s=(Array.isArray(a)?a:[a||on]).map(r=>_o(r||on));return[...new Set(s.filter(Boolean))]}function q0(){const[a,l]=m.useState(null),[s,r]=m.useState(!0);return m.useEffect(()=>{let c=!0;nl.auth.getSession().then(({data:h})=>{c&&(l(h.session??null),r(!1))});const{data:{subscription:d}}=nl.auth.onAuthStateChange((h,p)=>{l(p),r(!1)});return()=>{c=!1,d.unsubscribe()}},[]),{session:a,loading:s}}function $0(a,l=!0){const[s,r]=m.useState(null),[c,d]=m.useState([]),[h,p]=m.useState(""),[g,x]=m.useState(""),[b,v]=m.useState(0),S=m.useRef(new Map),M=Array.isArray(a)?a.join(`
10
- `):String(a||""),C=m.useMemo(()=>U0(a),[M]),j=m.useMemo(()=>C.find(A=>jo(A)==="loopback")||C[0]||on,[C]),k=m.useCallback(async()=>{if(!l){r(null),d([]),x(""),p("");return}let A=null;const z=Date.now(),G=C.filter(I=>(S.current.get(I)||0)<=z);if(G.length===0)throw new Error("No LiveDesk Hub endpoint is reachable. Retrying shortly.");for(const I of G)try{const[W,R]=await Promise.all([pt("/api/remote/status",void 0,I),pt("/api/remote/devices",void 0,I)]);if(!Array.isArray(R.devices))throw new Error("Invalid Hub devices response.");S.current.delete(I),r(W),d(R.devices),x(I),p("");return}catch(W){A=W,S.current.set(I,Date.now()+1e4)}throw x(""),A||new Error("No LiveDesk Hub endpoint is reachable.")},[l,C]),T=m.useCallback(()=>{S.current.clear(),k().catch(A=>{p(A instanceof Error?A.message:String(A))}),v(A=>A+1)},[k]);return m.useEffect(()=>{if(!l){r(null),d([]),x(""),p("");return}let A=!0;const z=async()=>{try{await k()}catch(I){A&&p(I instanceof Error?I.message:String(I))}};z();const G=window.setInterval(z,2500);return()=>{A=!1,window.clearInterval(G)}},[l,k,b]),{status:s,devices:c,error:h,refresh:T,hubBaseUrl:g||j,hubCandidates:C}}function G0(a){const[l,s]=m.useState(null),[r,c]=m.useState(""),d=a?.user?.id||"",h=m.useCallback(async()=>{if(!d){s(null);return}const{data:p,error:g}=await nl.from(tx).select("*").eq("user_id",d).maybeSingle();if(g){c(g.message);return}s(p),c("")},[d]);return m.useEffect(()=>{h()},[h]),m.useEffect(()=>{if(!d)return;const p=nl.channel(`livedesk-remote-host-targets-${d.replace(/[^a-zA-Z0-9]/g,"")}`).on("postgres_changes",{event:"*",schema:"public",table:tx,filter:`user_id=eq.${d}`},g=>s(g.new)).subscribe();return()=>{nl.removeChannel(p)}},[d]),{target:l,error:r,refresh:h}}function Y0(a){const[l,s]=m.useState(null),[r,c]=m.useState(!1),[d,h]=m.useState(""),p=a?.user?.id||"",g=m.useCallback(async()=>{if(!p){s(null),h(""),c(!1);return}c(!0);const{data:b,error:v}=await nl.from(I0).select("*").eq("user_id",p).eq("product_key","livedesk").maybeSingle();if(v){h(v.message),c(!1);return}s(b),h(""),c(!1)},[p]);m.useEffect(()=>{g()},[g]);const x=m.useMemo(()=>!l||l.status!=="active"?!1:l.expires_at?new Date(l.expires_at).getTime()>Date.now():!0,[l]);return{entitlement:l,licensed:x,loading:r,error:d,refresh:g}}const No={totalFrames:0,totalBytes:0,framesPerSecond:0,bytesPerSecond:0,sampleMs:0,lastUpdatedAt:0},V0=2500,P0=3e4,Q0=64*1024,K0=6,gv=new Map;function X0(a){return gv.get(a)}const nx={totalSent:0,totalDropped:0,sentPerSecond:0,droppedPerSecond:0,bufferedAmount:0,lastInputType:"",lastInputSeq:0,lastRoundTripMs:0,lastAgentApplyMs:0,lastUpdatedAt:0};function ax(a){const l=Date.parse(String(a||""));if(!Number.isFinite(l))return 0;const s=Date.now()-l;return s>0&&s<=P0?s:0}function lx(a,l,s=on,r={}){const[c,d]=m.useState(new Map),[h,p]=m.useState("idle"),[g,x]=m.useState(""),[b,v]=m.useState(No),S=m.useRef(new Map),M=m.useRef(new Map),C=m.useRef(0),j=m.useRef(new Set),[k,T]=m.useState(0),A=m.useRef(r.onFrame),z=m.useRef({totalFrames:0,totalBytes:0,sampleFrames:0,sampleBytes:0,sampleStartedAt:0}),G=m.useMemo(()=>[...a].sort().join(","),[a]),I=Number.isFinite(r.fps)?Number(r.fps):2,W=Number.isFinite(r.maxWidth)?Number(r.maxWidth):640,R=Number.isFinite(r.maxHeight)?Number(r.maxHeight):360,ee=Number.isFinite(r.quality)?Number(r.quality):45,se=String(r.frameMode||r.mode||"mode3-h264-hw").trim()||"mode3-h264-hw",V=r.streamPurpose==="control"?"control":"wall",fe=m.useMemo(()=>{const H=Object.entries(r.monitorSelections||{}).filter(([X])=>!!X).sort(([X],[te])=>X.localeCompare(te));return JSON.stringify(Object.fromEntries(H))},[r.monitorSelections]);m.useEffect(()=>{A.current=r.onFrame},[r.onFrame]);const $=m.useCallback((H,X="livedesk-frame-socket-release")=>{H.disposed=!0;try{H.socket.readyState===WebSocket.CONNECTING||H.socket.readyState===WebSocket.OPEN?H.socket.close(1e3,X):H.socket.close()}catch{}},[]),oe=m.useCallback(()=>{const H=[...M.current.values()].map(X=>X.socket);if(H.length===0){p("idle");return}if(H.some(X=>X.readyState===WebSocket.OPEN)){p("open");return}if(H.some(X=>X.readyState===WebSocket.CONNECTING)){p("connecting");return}p("closed")},[]),le=m.useCallback((H,X)=>{if(!H||H.byteLength<5)return;const te=Date.now(),P=new DataView(H).getUint32(0,!1);if(P<=0||P+4>H.byteLength)return;const ne=new Uint8Array(H.slice(4,4+P)),L=JSON.parse(new TextDecoder().decode(ne));if(Math.max(ax(L.receivedAt),ax(L.capturedAt))>V0)return;const ve=H.slice(4+P),ge={deviceId:String(L.deviceId||""),kind:L.kind==="thumbnail"?"thumbnail":"live",frameSeq:Number(L.frameSeq||0),streamFrameSeq:Number(L.streamFrameSeq||0)||void 0,streamId:String(L.streamId||""),commandId:L.commandId?String(L.commandId):void 0,width:Number(L.width||0),height:Number(L.height||0),sourceWidth:Number(L.sourceWidth||0)||void 0,sourceHeight:Number(L.sourceHeight||0)||void 0,mimeType:String(L.mimeType||"image/jpeg"),mode:L.mode?String(L.mode):void 0,frameMode:L.frameMode?String(L.frameMode):void 0,frameProfile:L.frameProfile?String(L.frameProfile):void 0,encoding:L.encoding?String(L.encoding):void 0,codec:L.codec?String(L.codec):void 0,compression:L.compression?String(L.compression):void 0,pixelFormat:L.pixelFormat?String(L.pixelFormat):void 0,bytesPerPixel:Number(L.bytesPerPixel||0)||0,uncompressedByteLength:Number(L.uncompressedByteLength||0)||0,h264Format:L.h264Format?String(L.h264Format):void 0,isKeyFrame:L.isKeyFrame===!0,chunkType:L.chunkType?String(L.chunkType):void 0,timestampUs:Number(L.timestampUs||0)||0,durationUs:Number(L.durationUs||0)||0,sourceGapMs:Number(L.sourceGapMs||0)||0,agentSendGapMs:Number(L.agentSendGapMs||0)||0,agentSendDurationMs:Number(L.agentSendDurationMs||0)||0,agentSendDurationFrameSeq:Number(L.agentSendDurationFrameSeq||0)||0,agentPaceMs:Number(L.agentPaceMs||0)||0,agentQueueBeforePaceMs:Number(L.agentQueueBeforePaceMs||0)||0,agentFrameAgeMs:Number(L.agentFrameAgeMs||0)||0,droppedByAgent:Number(L.droppedByAgent||0)||0,hubIngressDropped:Number(L.hubIngressDropped||0)||0,hubClientDropped:Number(L.hubClientDropped||0)||0,hardwareEncoder:L.hardwareEncoder?String(L.hardwareEncoder):void 0,platformProfile:L.platformProfile?String(L.platformProfile):void 0,monitorIndex:Number.isFinite(Number(L.monitorIndex))?Number(L.monitorIndex):void 0,monitorCount:Number.isFinite(Number(L.monitorCount))?Number(L.monitorCount):void 0,capturedAt:String(L.capturedAt||""),receivedAt:String(L.receivedAt||""),hubPacketAt:L.hubPacketAt?String(L.hubPacketAt):void 0,hubPacketEpochMs:Number.isFinite(Number(L.hubPacketEpochMs))?Number(L.hubPacketEpochMs):void 0,browserReceivedEpochMs:te,byteLength:Number(L.byteLength||ve.byteLength),contentHash:L.contentHash?String(L.contentHash):void 0,captureMs:Number(L.captureMs||0)||0,captureStageMs:Number(L.captureStageMs||0)||0,convertMs:Number(L.convertMs||0)||0,compressMs:Number(L.compressMs||0)||0,captureSourceSerial:Number(L.captureSourceSerial||0)||0,captureSourceSkipped:Number(L.captureSourceSkipped||0)||0,deltaTileSize:Number(L.deltaTileSize||0)||0,deltaTileCount:Number(L.deltaTileCount||0)||0,deltaVisualTileCount:Number(L.deltaVisualTileCount||0)||0,deltaRefreshTileCount:Number(L.deltaRefreshTileCount||0)||0,deltaTotalTiles:Number(L.deltaTotalTiles||0)||0,payload:ve};if(!ge.deviceId)return;const ke={streamId:X.lastFrameStreamId,commandId:X.lastFrameCommandId,order:X.lastFrameOrder},qe=Number(ge.streamFrameSeq||ge.frameSeq||0),_e=!!ke.commandId&&!!ge.commandId,Ee=ke.streamId===ge.streamId&&(!_e||ke.commandId===ge.commandId),$e=ke.order;if(Ee&&$e>=qe&&($e===qe||_e))return;X.lastFrameStreamId=ge.streamId,X.lastFrameCommandId=ge.commandId||"",X.lastFrameOrder=qe;const Ne=z.current;Ne.totalFrames+=1,Ne.totalBytes+=ve.byteLength,Ne.sampleFrames+=1,Ne.sampleBytes+=ve.byteLength,S.current.set(ge.deviceId,ge),A.current?.(ge)},[]);m.useEffect(()=>{const H=window.setInterval(()=>{const X=performance.now(),te=z.current,E=Math.max(1,X-te.sampleStartedAt);v({totalFrames:te.totalFrames,totalBytes:te.totalBytes,framesPerSecond:te.sampleFrames*1e3/E,bytesPerSecond:te.sampleBytes*1e3/E,sampleMs:E,lastUpdatedAt:Date.now()}),d(new Map(S.current)),te.sampleFrames=0,te.sampleBytes=0,te.sampleStartedAt=X},2e3);return()=>{window.clearInterval(H)}},[]),m.useEffect(()=>{const H=G?G.split(",").filter(Boolean):[],X=new Set(H),te=performance.now();for(const[E,P]of M.current.entries())X.has(E)||($(P,"livedesk-device-unsubscribed"),M.current.delete(E),S.current.delete(E));if(H.length===0){for(const E of M.current.values())$(E,"livedesk-no-devices");M.current.clear(),S.current=new Map,d(new Map),x(""),z.current={totalFrames:0,totalBytes:0,sampleFrames:0,sampleBytes:0,sampleStartedAt:0},v(No),oe();return}z.current.sampleStartedAt<=0&&(z.current.sampleStartedAt=te,v({...No,lastUpdatedAt:Date.now()}));for(const E of H){const P=r.monitorSelections?.[E],ne=Number.isFinite(Number(P))?{[E]:Number(P)}:{},L={type:"subscribe",deviceIds:[E],autoStartLive:l,fps:I,maxWidth:W,maxHeight:R,quality:ee,mode:se,frameMode:se,streamPurpose:V,forceRestart:V==="control",restartReason:V==="control"?"control-subscribe":"",monitorSelections:ne},de=JSON.stringify(L),ve=M.current.get(E),ge=!!ve&&ve.payloadKey!==de;if(ve){const Ee=ve.socket.readyState===WebSocket.CONNECTING||ve.socket.readyState===WebSocket.OPEN;if(ve.payloadKey===de&&Ee&&!ve.disposed)continue;$(ve,ve.payloadKey===de?"livedesk-frame-socket-refresh":"livedesk-subscription-replaced"),M.current.delete(E)}const ke=new WebSocket(ku(`/api/remote/frames/ws?devices=${encodeURIComponent(E)}`,s));ke.binaryType="arraybuffer";const qe=ge?{...L,forceRestart:!0,restartReason:"subscription-options-changed",restartToken:`${Date.now()}-${Math.random().toString(36).slice(2)}`}:L,_e={socket:ke,payload:qe,payloadKey:de,generation:C.current+1,disposed:!1,lastFrameStreamId:"",lastFrameCommandId:"",lastFrameOrder:-1};C.current=_e.generation,M.current.set(E,_e),ke.addEventListener("open",()=>{if(_e.disposed||M.current.get(E)!==_e){$(_e,"livedesk-stale-frame-socket");return}x(""),ke.send(JSON.stringify(_e.payload)),oe()}),ke.addEventListener("message",Ee=>{if(_e.disposed||M.current.get(E)!==_e)return;if(typeof Ee.data=="string"){try{const Ne=JSON.parse(Ee.data);if(Ne?.type==="RemoteFrameSubscriptionError")x(String(Ne.error||"control-stream-start-failed"));else if(Ne?.type==="RemoteFrameLiveAutoStart"){const tn=(Array.isArray(Ne.skipped)?Ne.skipped:[]).find(Xe=>Xe?.deviceId===E);tn?x(String(tn.reason||"control-stream-start-failed")):Array.isArray(Ne.started)&&Ne.started.some(Xe=>Xe?.deviceId===E)&&x("")}}catch{}return}const $e=Ee.data instanceof ArrayBuffer?Ee.data:null;$e&&(x(""),le($e,_e))}),ke.addEventListener("error",()=>{_e.disposed||M.current.get(E)!==_e||(x("frame-socket-error"),p("error"))}),ke.addEventListener("close",()=>{const Ee=!_e.disposed;_e.disposed=!0;const $e=M.current.get(E);if($e===_e&&M.current.delete(E),oe(),Ee&&$e===_e){const Ne=window.setTimeout(()=>{j.current.delete(Ne),T(Mt=>Mt+1)},750);j.current.add(Ne)}})}oe()},[l,$,G,I,se,le,s,R,W,fe,r.monitorSelections,ee,k,V,oe]),m.useEffect(()=>()=>{for(const H of M.current.values())$(H,"livedesk-hook-unmount");M.current.clear();for(const H of j.current)window.clearTimeout(H);j.current.clear()},[$]);const ue=m.useCallback((H,X="browser-stale")=>{const te=Array.isArray(H)&&H.length>0?H:G.split(",").filter(Boolean);if(te.length===0)return!1;let E=!1;for(const P of te){const ne=M.current.get(P);!ne||ne.socket.readyState!==WebSocket.OPEN||(ne.socket.send(JSON.stringify({...ne.payload,type:"restart-live",deviceIds:[P],forceRestart:!0,restartReason:X,restartToken:`${Date.now()}-${Math.random().toString(36).slice(2)}`})),E=!0)}return E},[G]);return{frames:c,state:h,error:g,stats:b,restartLive:ue}}function Z0(a,l,s=on,r={}){const[c,d]=m.useState(null),[h,p]=m.useState(null),[g,x]=m.useState("idle"),[b,v]=m.useState(No),S=m.useRef(null),M=m.useRef(r.onFrame),C=m.useRef(null),j=m.useRef(0),k=m.useRef({totalFrames:0,totalBytes:0,sampleFrames:0,sampleBytes:0,sampleStartedAt:0}),T=m.useMemo(()=>[...new Set(a.filter(Boolean))].join(","),[a]),A=m.useMemo(()=>JSON.stringify(r.monitorSelections||{}),[r.monitorSelections]),z=m.useMemo(()=>({deviceIds:T.split(",").filter(Boolean),fps:Number(r.fps||20),width:Number(r.width||1920),height:Number(r.height||1080),tileWidth:Number(r.tileWidth||320),tileHeight:Number(r.tileHeight||180),monitorSelections:r.monitorSelections||{}}),[T,A,r.fps,r.height,r.monitorSelections,r.tileHeight,r.tileWidth,r.width]),G=m.useMemo(()=>JSON.stringify(z),[z]),I=m.useRef(z);I.current=z;const W=l&&z.deviceIds.length>0,R=m.useCallback(se=>se.readyState!==WebSocket.OPEN?!1:(se.send(JSON.stringify({type:"configure",...I.current})),!0),[]);m.useEffect(()=>{M.current=r.onFrame},[r.onFrame]),m.useEffect(()=>{const se=window.setInterval(()=>{const V=k.current,fe=performance.now(),$=Math.max(1,fe-V.sampleStartedAt);v({totalFrames:V.totalFrames,totalBytes:V.totalBytes,framesPerSecond:V.sampleFrames*1e3/$,bytesPerSecond:V.sampleBytes*1e3/$,sampleMs:$,lastUpdatedAt:Date.now()});const oe=C.current;oe&&oe.frameSeq!==j.current&&(j.current=oe.frameSeq,d(oe)),V.sampleFrames=0,V.sampleBytes=0,V.sampleStartedAt=fe},1e3);return()=>window.clearInterval(se)},[]),m.useEffect(()=>{if(!W){S.current?.close(),S.current=null,d(null),C.current=null,j.current=0,p(null),x("idle"),v(No);return}let se=!1,V=0;const fe=()=>{if(se)return;const $=new WebSocket(ku("/api/remote/atlas/ws",s));$.binaryType="arraybuffer",S.current=$,x("connecting"),$.addEventListener("open",()=>{k.current.sampleStartedAt=performance.now(),x("open"),R($)}),$.addEventListener("message",oe=>{if(typeof oe.data=="string"){try{const ue=JSON.parse(oe.data);ue?.type==="Mode4AtlasLayout"&&p({layoutVersion:Number(ue.layoutVersion||0),width:Number(ue.width||1920),height:Number(ue.height||1080),columns:Number(ue.columns||1),rows:Number(ue.rows||1),tiles:Array.isArray(ue.tiles)?ue.tiles:[]})}catch{}return}const le=oe.data instanceof ArrayBuffer?oe.data:null;if(!(!le||le.byteLength<5))try{const ue=Date.now(),X=new DataView(le).getUint32(0,!1);if(X<=0||X+4>le.byteLength)return;const te=JSON.parse(new TextDecoder().decode(new Uint8Array(le,4,X))),E=le.slice(4+X),P={deviceId:String(te.deviceId||"__livedesk_mode4_atlas__"),kind:"live",frameSeq:Number(te.frameSeq||0),streamFrameSeq:Number(te.streamFrameSeq||0)||void 0,streamId:String(te.streamId||"mode4-atlas"),commandId:te.commandId?String(te.commandId):void 0,width:Number(te.width||1920),height:Number(te.height||1080),sourceWidth:Number(te.sourceWidth||te.width||1920),sourceHeight:Number(te.sourceHeight||te.height||1080),mimeType:String(te.mimeType||"video/h264"),mode:String(te.mode||"mode4-h264-atlas"),frameMode:String(te.frameMode||"mode4-h264-atlas"),frameProfile:String(te.frameProfile||"mode4-h264-atlas-v1"),encoding:String(te.encoding||"video-atlas"),codec:String(te.codec||"h264"),compression:String(te.compression||"video/h264"),h264Format:String(te.h264Format||"annexb"),isKeyFrame:te.isKeyFrame===!0,chunkType:String(te.chunkType||""),timestampUs:Number(te.timestampUs||0),durationUs:Number(te.durationUs||0),hardwareEncoder:te.hardwareEncoder?String(te.hardwareEncoder):void 0,platformProfile:te.platformProfile?String(te.platformProfile):void 0,capturedAt:String(te.capturedAt||""),receivedAt:String(te.receivedAt||""),hubPacketAt:te.hubPacketAt?String(te.hubPacketAt):void 0,hubPacketEpochMs:Number(te.hubPacketEpochMs||0)||void 0,browserReceivedEpochMs:ue,byteLength:E.byteLength,layoutVersion:Number(te.layoutVersion||0),atlasComposeMs:Number(te.atlasComposeMs||0),atlasPoolStarved:Number(te.atlasPoolStarved||0),atlasReadyTiles:Number(te.atlasReadyTiles||0),atlasTileCount:Number(te.atlasTileCount||0),payload:E},ne=k.current;ne.totalFrames+=1,ne.totalBytes+=E.byteLength,ne.sampleFrames+=1,ne.sampleBytes+=E.byteLength,C.current=P,j.current===0&&(j.current=P.frameSeq,d(P)),M.current?.(P)}catch{}}),$.addEventListener("error",()=>x("error")),$.addEventListener("close",()=>{S.current===$&&(S.current=null),!se&&(x("closed"),V=window.setTimeout(fe,1200))})};return fe(),()=>{se=!0,window.clearTimeout(V),S.current?.close(),S.current=null}},[W,s,R]),m.useEffect(()=>{if(!W)return;const se=S.current;se&&R(se)},[G,W,R]);const ee=m.useCallback(()=>{const se=S.current;return se?R(se):!1},[R]);return{frame:c,layout:h,state:g,stats:b,refreshInputs:ee}}function W0(a,l=on){const s=m.useRef(null),r=m.useRef(0),c=m.useRef(0),d=m.useRef(new Map),[h,p]=m.useState("idle"),[g,x]=m.useState(nx),b=m.useRef({totalSent:0,totalDropped:0,sampleSent:0,sampleDropped:0,sampleStartedAt:0,lastInputType:"",lastInputSeq:0,lastRoundTripMs:0,lastAgentApplyMs:0});m.useEffect(()=>{if(!a){s.current?.close(),s.current=null,c.current=0,p("idle"),x(nx);return}const S=new WebSocket(ku("/api/remote/input/ws",l));return s.current=S,b.current.sampleStartedAt=performance.now(),p("connecting"),S.addEventListener("open",()=>p("open")),S.addEventListener("message",M=>{if(typeof M.data=="string")try{const C=JSON.parse(M.data);if(C?.type!=="RemoteInputApplied")return;const j=Number(C.inputSeq||0),k=d.current.get(j);k!==void 0&&(b.current.lastRoundTripMs=Math.max(0,performance.now()-k),d.current.delete(j)),b.current.lastInputSeq=j,b.current.lastAgentApplyMs=Math.max(0,Number(C.agentApplyMs||0))}catch{}}),S.addEventListener("close",()=>p("closed")),S.addEventListener("error",()=>p("error")),()=>{S.close(),d.current.clear(),s.current===S&&(s.current=null)}},[a,l]),m.useEffect(()=>{if(!a)return;const S=window.setInterval(()=>{const M=performance.now(),C=b.current,j=Math.max(1,M-C.sampleStartedAt);x({totalSent:C.totalSent,totalDropped:C.totalDropped,sentPerSecond:C.sampleSent*1e3/j,droppedPerSecond:C.sampleDropped*1e3/j,bufferedAmount:s.current?.bufferedAmount||0,lastInputType:C.lastInputType,lastInputSeq:C.lastInputSeq,lastRoundTripMs:C.lastRoundTripMs,lastAgentApplyMs:C.lastAgentApplyMs,lastUpdatedAt:Date.now()}),C.sampleSent=0,C.sampleDropped=0,C.sampleStartedAt=M},1e3);return()=>window.clearInterval(S)},[a]);const v=m.useCallback((S,M)=>{const C=s.current;if(!C||C.readyState!==WebSocket.OPEN||!S)return!1;const j=String(M.type||"").toLowerCase(),k=j==="pointermove",T=b.current;if(k&&C.bufferedAmount>Q0)return T.totalDropped+=1,T.sampleDropped+=1,T.lastInputType="pointermove-drop",!1;const A=r.current+1;r.current=A;const z=Date.now(),G=!k||A-c.current>=K0;for(G&&(d.current.set(A,performance.now()),k&&(c.current=A)),k||gv.set(S,{inputSeq:A,inputType:j||"input",sentAt:performance.now()});d.current.size>256;){const I=d.current.keys().next().value;if(I===void 0)break;d.current.delete(I)}return C.send(JSON.stringify({type:"input",requestId:k?"":crypto.randomUUID(),fireAndForget:k,deviceId:S,input:{...M,inputSeq:A,requestAck:G,issuedAtEpochMs:z,issuedAt:new Date(z).toISOString()}})),T.totalSent+=1,T.sampleSent+=1,T.lastInputType=j||"input",!0},[]);return{state:h,sendInput:v,stats:g}}function J0(a){const l=String(a||"").toLowerCase();return l.includes("audio/pcm")||l.includes("audio/l16")||l.includes("f32le")||l.includes("s16le")}function ew(a,l,s){const r=Math.max(1,Math.min(8,Math.floor(l.channels||2))),c=Math.max(8e3,Math.min(192e3,Math.floor(l.sampleRate||48e3))),d=String(l.mimeType||"").toLowerCase(),h=d.includes("s16le")||d.includes("audio/l16"),p=h?2:4,g=Math.floor(s.byteLength/p),x=Math.floor(g/r),b=a.createBuffer(r,x,c),v=new DataView(s);for(let S=0;S<r;S+=1){const M=b.getChannelData(S);for(let C=0;C<x;C+=1){const k=(C*r+S)*p;M[C]=h?Math.max(-1,Math.min(1,v.getInt16(k,!0)/32768)):Math.max(-1,Math.min(1,v.getFloat32(k,!0)))}}return b}function tw(a,l,s=on){const r=m.useRef(null),c=m.useRef(0),[d,h]=m.useState("idle"),[p,g]=m.useState(null),[x,b]=m.useState("");return m.useEffect(()=>{if(!l||!a){h("idle"),g(null),b("");return}const v=window.AudioContext||window.webkitAudioContext;if(!v){h("unsupported"),b("Audio playback is not supported in this browser.");return}const S=new v;r.current=S,c.current=S.currentTime;const M=new WebSocket(ku(`/api/remote/audio/ws?devices=${encodeURIComponent(a)}`,s));M.binaryType="arraybuffer";let C=!1;return h("connecting"),b(""),M.addEventListener("open",()=>{C||(h("open"),M.send(JSON.stringify({type:"subscribe",deviceIds:[a]})),S.resume())}),M.addEventListener("message",j=>{if(typeof j.data=="string")return;const k=j.data instanceof ArrayBuffer?j.data:null;!k||k.byteLength<5||(async()=>{try{const A=new DataView(k).getUint32(0,!1);if(A<=0||A+4>k.byteLength)return;const z=new Uint8Array(k.slice(4,4+A)),G=JSON.parse(new TextDecoder().decode(z)),I=k.slice(4+A),W={deviceId:String(G.deviceId||""),frameSeq:Number(G.frameSeq||0),streamId:String(G.streamId||""),mimeType:String(G.mimeType||"audio/webm;codecs=opus"),sampleRate:Number(G.sampleRate||48e3),channels:Number(G.channels||2),capturedAt:String(G.capturedAt||""),receivedAt:String(G.receivedAt||""),byteLength:Number(G.byteLength||I.byteLength),payload:I};if(!W.deviceId||C)return;const R=J0(W.mimeType)?ew(S,W,I):await S.decodeAudioData(I.slice(0));if(C)return;const ee=S.createBufferSource();ee.buffer=R,ee.connect(S.destination);const se=Math.max(S.currentTime+.02,c.current);ee.start(se),c.current=se+R.duration,g(W),h("playing")}catch(T){C||(h("error"),b(T instanceof Error?T.message:String(T)))}})()}),M.addEventListener("error",()=>{C||h("error")}),M.addEventListener("close",()=>{C||h("closed")}),()=>{C=!0,M.close(),S.close().catch(()=>{}),r.current===S&&(r.current=null)}},[a,l,s]),{state:d,lastFrame:p,error:x}}const nw=[{id:"pin",label:"PIN",icon:Tb},{id:"wall",label:"Wall",icon:Og},{id:"control",label:"Control",icon:Og}];function aw({initialTab:a="pin",pin:l,wall:s,control:r}){const[c,d]=m.useState(a),h=`settings-panel-${c}`,p=c==="pin"?l:c==="wall"?s:r;return o.jsxs("section",{className:"settings-page",children:[o.jsx("div",{className:"settings-page-tabs",role:"tablist","aria-label":"LiveDesk settings",children:nw.map(({id:g,label:x,icon:b})=>o.jsxs("button",{className:c===g?"active":"",id:`settings-tab-${g}`,role:"tab","aria-selected":c===g,"aria-controls":`settings-panel-${g}`,tabIndex:c===g?0:-1,onClick:()=>d(g),type:"button",children:[o.jsx(b,{size:16}),x]},g))}),o.jsx("section",{className:"settings-page-panel",id:h,role:"tabpanel","aria-labelledby":`settings-tab-${c}`,tabIndex:0,children:p})]})}function lw({children:a}){return o.jsx("div",{className:"settings-tab-content",children:a})}function iw({children:a}){return o.jsx("div",{className:"settings-tab-content",children:a})}function sw({children:a}){return o.jsx("div",{className:"settings-tab-content",children:a})}new Date().valueOf();function al(a){const[l,s]=m.useState(a),r=m.useRef(a);return m.useEffect(()=>{if(r.current!==a){if(Array.isArray(r.current)&&Array.isArray(a)&&r.current.length===0&&a.length===0)return;r.current=a,s(a)}},[a]),[l,s]}function Cm(a,l){return typeof a=="function"?typeof l=="object"?a(l):a():a}function ir(a,l="data-id"){let s=a;for(!s.tagName&&a.target&&(s=a.target);s;){if(s.getAttribute&&s.getAttribute(l))return s;s=s.parentNode}return null}function rw(a,l="data-id"){const s=ir(a,l);return s?s.getAttribute(l):null}function Ro(a,l="data-id"){const s=ir(a,l);return s?Eu(s,l):null}function Eu(a,l="data-id"){const s=a.getAttribute(l);return s?ow(s):null}function Wt(a){return typeof a=="string"?":"+a:a}function ow(a){if(a.startsWith(":"))return a.substring(1);const l=a*1;return isNaN(l)?a:l}function cw(){return{detect:()=>!0,addEvent:function(a,l,s){return a.addEventListener(l,s),()=>a.removeEventListener(l,s)},addGlobalEvent:function(a,l){return document.addEventListener(a,l),()=>document.removeEventListener(a,l)},getTopNode:function(){return window.document.body}}}var Qn=cw();function jm(a){Object.assign(Qn,a)}function ix(a,l,s){function r(c){const d=ir(c);if(!d)return;const h=Eu(d);if(typeof l=="function")return l(h,c);let p,g=c.target;for(;g!=d;){if(p=g.dataset?g.dataset.action:null,p&&l[p]){l[p](h,c);return}g=g.parentNode}l[s]&&l[s](h,c)}Qn.addEvent(a,s,r)}function sr(a,l){ix(a,l,"click"),l.dblclick&&ix(a,l.dblclick,"dblclick")}function uw(a,l){for(let s=a.length-1;s>=0;s--)if(a[s]===l){a.splice(s,1);break}}function dw(a,l,s){for(let r=0;r<Fl.length;r++){if(r===s)continue;const c=Fl[r],d=c.props.parent?.();if(d&&a.contains(d)&&c.node.contains(l))return!0}return!1}var xv=new Date,Cu=!1,tu=[],Fl=[],sx=a=>{const l=a.target;if(Cu||!l.isConnected){Cu=!1;return}for(let s=Fl.length-1;s>=0;s--){const{node:r,date:c,props:d}=Fl[s];if(!(c>xv)&&!r.contains(l)&&r!==l&&(dw(r,l,s)||(d.callback&&d.callback(a),d.modal||a.defaultPrevented)))break}},fw=a=>{xv=new Date,Cu=!0;for(let l=Fl.length-1;l>=0;l--){const{node:s}=Fl[l];if(!s.contains(a.target)&&s!==a.target){Cu=!1;break}}};function ll(a,l){tu.length||(tu=[Qn.addGlobalEvent("click",sx,a),Qn.addGlobalEvent("contextmenu",sx,a),Qn.addGlobalEvent("mousedown",fw,a)]),typeof l!="object"&&(l={callback:l});const s={node:a,date:new Date,props:l};return Fl.push(s),{destroy(){uw(Fl,s),Fl.length||(tu.forEach(r=>r()),tu=[])}}}var nu=a=>a.indexOf("bottom")!==-1,au=a=>a.indexOf("left")!==-1,lu=a=>a.indexOf("right")!==-1,Hf=a=>a.indexOf("top")!==-1,rx=a=>a.indexOf("fit")!==-1,po=a=>a.indexOf("overlap")!==-1,mw=a=>a.split("-").every(l=>["center","fit"].indexOf(l)>-1),hw=a=>{const l=a.match(/(start|center|end)/);return l?l[0]:null};function pw(a,l){let s=0;const r=Qn.getTopNode(a);for(;a&&a!==r;){const c=getComputedStyle(a).position;if((c==="absolute"||c==="relative"||c==="fixed")&&(s=parseInt(getComputedStyle(a).zIndex)||0),a=a.parentNode,a===l)break}return s}var Ft,fn,go,rn;function vv(a,l,s="bottom",r=0,c=0){if(!a)return null;Ft=r,fn=c,go="auto";let d=0,h=0,p=s;const g=yv(a),x=po(s)?Qn.getTopNode(a):g;if(!g)return null;const b=g.getBoundingClientRect(),v=a.getBoundingClientRect(),S=x.getBoundingClientRect(),M=window.getComputedStyle(x),C={left:0,top:0,bottom:0,right:0};for(const G in C){const I=`border-${G}-width`;C[G]=parseFloat(M.getPropertyValue(I))}if(l){const G=pw(l,g);d=Math.max(G+1,20)}if(l){if(rn=l.getBoundingClientRect(),rx(s)&&(go=rn.width+"px"),s!=="point")if(mw(s))rx(s)?Ft=0:(Ft=S.width/2,h=1),fn=(S.height-v.height)/2;else{const G=po(s)?0:1;Ft=lu(s)?rn.right+G:rn.left-G,fn=nu(s)?rn.bottom+1:rn.top;const I=hw(s);I&&(lu(s)||au(s)?I==="center"?fn-=(v.height-rn.height)/2:I==="end"&&(fn-=v.height-rn.height):(nu(s)||Hf(s))&&(I==="center"?Ft-=(v.width-rn.width)/2:I==="end"&&(Ft-=v.width-rn.width),po(s)||(Ft+=1)))}}else rn={left:r,right:r,top:c,bottom:c};const j=(au(s)||lu(s))&&(nu(s)||Hf(s));au(s)&&(h=2);const k=Ft-v.width-S.left;l&&au(s)&&!j&&k<0&&(Ft=rn.right,h=0,p=p.replace("left","right"));const T=Ft+v.width*(1-h/2)-S.right;if(T>0)if(!lu(s))Ft=S.right-C.right-v.width;else{const G=rn.left-S.x-v.width;l&&!j&&G>=0?(Ft=rn.left-v.width,p=p.replace("right","left")):Ft-=T+C.right}h&&(Ft=Math.round(Ft-v.width*h/2));const A=k<0||T>0||!j;Hf(s)&&(fn=rn.top-v.height,l&&fn<S.y&&A&&(fn=rn.bottom,p=p.replace("top","bottom")));const z=fn+v.height-S.bottom;return z>0&&(l&&nu(s)&&A?(fn-=v.height+rn.height+1,p=p.replace("bottom","top")):fn-=z+C.bottom),Ft-=b.left+C.left,fn-=b.top+C.top,Ft=(po(s)?Ft:Math.max(Ft,0))+x.scrollLeft,fn=(po(s)?fn:Math.max(fn,0))+x.scrollTop,go=go||"auto",{at:p,x:Ft,y:fn,z:d,width:go}}function yv(a){const l=Qn.getTopNode(a);for(a&&(a=a.parentElement);a;){const s=getComputedStyle(a).position;if(a===l||s==="relative"||s==="absolute"||s==="fixed")return a;a=a.parentNode}return null}function gw(a){const l=[];let s=a;const r=Qn.getTopNode(a);for(;s&&s!==r&&!s.getAttribute("data-wx-portal-root");)getComputedStyle(s).position==="absolute"&&l.push(s),s=s.parentNode;return l}var ox=new Date().valueOf();function Nm(){return ox+=1,ox}function hn(a){return a<10?"0"+a:a.toString()}function xw(a){const l=hn(a);return l.length==2?"0"+l:l}function bv(a){const l=Math.floor(a/11)*11;return{start:l,end:l+11}}function Ff(a){const l=(a.getDay()+6)%7,s=new Date(a.valueOf());s.setDate(a.getDate()+(3-l)),s.setHours(0,0,0,0);const r=new Date(s.getFullYear(),0,1),c=Math.round((s.getTime()-r.getTime())/864e5);return 1+Math.floor(c/7)}var cx=["",""];function vw(a,l,s){switch(a){case"%d":return hn(l.getDate());case"%m":return hn(l.getMonth()+1);case"%j":return l.getDate();case"%n":return l.getMonth()+1;case"%y":return hn(l.getFullYear()%100);case"%Y":return l.getFullYear();case"%D":return s.dayShort[l.getDay()];case"%l":return s.dayFull[l.getDay()];case"%M":return s.monthShort[l.getMonth()];case"%F":return s.monthFull[l.getMonth()];case"%h":return hn((l.getHours()+11)%12+1);case"%g":return(l.getHours()+11)%12+1;case"%G":return l.getHours();case"%H":return hn(l.getHours());case"%i":return hn(l.getMinutes());case"%a":return((l.getHours()>11?s.pm:s.am)||cx)[0];case"%A":return((l.getHours()>11?s.pm:s.am)||cx)[1];case"%s":return hn(l.getSeconds());case"%S":return xw(l.getMilliseconds());case"%W":return hn(Ff(l));case"%w":{const r=s.weekStart??1;if(r===1)return hn(Ff(l));const c=(l.getDay()-r+7)%7,d=(1-r+7)%7,h=new Date(l.valueOf());return h.setDate(l.getDate()+(d-c)),hn(Ff(h))}case"%c":{let r=l.getFullYear()+"";return r+="-"+hn(l.getMonth()+1),r+="-"+hn(l.getDate()),r+="T",r+=hn(l.getHours()),r+=":"+hn(l.getMinutes()),r+=":"+hn(l.getSeconds()),r}case"%Q":return Math.floor(l.getMonth()/3)+1;default:return a}}var yw=/%[a-zA-Z]/g;function nr(a,l){return typeof a=="function"?a:function(s){return s?(s.getMonth||(s=new Date(s)),a.replace(yw,r=>vw(r,s,l))):""}}function ux(a){return a&&typeof a=="object"&&!Array.isArray(a)}function cm(a,l){for(const s in l){const r=l[s];ux(a[s])&&ux(r)?a[s]=cm({...a[s]},l[s]):a[s]=l[s]}return a}function zo(a){return{getGroup(l){const s=a[l];return r=>s&&s[r]||r},getRaw(){return a},extend(l,s){if(!l)return this;let r;return s?r=cm({...l},a):r=cm({...a},l),zo(r)}}}var bw=iv();const ww="en-US",Sw={monthFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],hours:"Hours",minutes:"Minutes",done:"Done",clear:"Clear",today:"Today",am:["am","AM"],pm:["pm","PM"],weekStart:0,clockFormat:24},Mw={ok:"OK",cancel:"Cancel",select:"Select","No data":"No data","Rows per page":"Rows per page","Total pages":"Total pages"},Cw={timeFormat:"%H:%i",dateFormat:"%m/%d/%Y",monthYearFormat:"%F %Y",yearFormat:"%Y"},wv={core:Mw,calendar:Sw,formats:Cw,lang:ww},Am=m.createContext(""),Sv=m.createContext({}),qa=m.createContext(null),Mv=m.createContext(null),en=Object.freeze(Object.defineProperty({__proto__:null,fieldId:Mv,helpers:Sv,i18n:qa,theme:Am},Symbol.toStringTag,{value:"Module"}));function Cv(a){const l=m.useContext(Mv),[s]=m.useState(()=>a||l||Nm());return s}function Ao({type:a="",css:l="",icon:s="",disabled:r=!1,title:c="",tooltip:d,text:h="",children:p,onClick:g}){const x=m.useMemo(()=>{let v=a?a.split(" ").filter(S=>S!=="").map(S=>"wx-"+S).join(" "):"";return l+(l?" ":"")+v},[a,l]),b=v=>{g&&g(v)};return o.jsxs("button",{title:c,className:`wx-2ZWgb4 wx-button ${x} ${s&&!p?"wx-icon":""}`,disabled:r,onClick:b,"data-tooltip-text":d,children:[s&&o.jsx("i",{className:"wx-2ZWgb4 "+s}),p||h||" "]})}function jw({id:a,label:l="",inputValue:s="",value:r=!1,onChange:c,disabled:d=!1,css:h=""}){const p=Cv(a),[g,x]=al(r),b=({target:v})=>{const S=v.checked;x(S),c&&c({value:S,inputValue:s})};return o.jsxs("div",{className:`wx-2IvefP wx-checkbox ${h}`,children:[o.jsx("input",{type:"checkbox",id:p,disabled:d,className:"wx-2IvefP wx-check",checked:g,value:s,onChange:b}),o.jsxs("label",{htmlFor:p,className:"wx-2IvefP wx-label",children:[o.jsx("span",{className:"wx-2IvefP wx-before"}),l&&o.jsx("span",{className:"wx-2IvefP wx-after",children:l})]})]})}function Tm({theme:a="",target:l,children:s}){const r=m.useRef(null),c=m.useRef(null),[d,h]=m.useState(null);r.current||(r.current=document.createElement("div"));const p=m.useContext(Am);return m.useEffect(()=>{h(l||Nw(c.current)||Qn.getTopNode(c.current))},[c.current]),o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:c,style:{display:"none"}}),c.current&&d?bw.createPortal(o.jsx("div",{className:`wx-3ZWsT0 wx-${a||p}-theme`,children:s}),d):null]})}function Nw(a){const l=Qn.getTopNode(a);for(;a&&a!==l&&!a.getAttribute("data-wx-portal-root");)a=a.parentNode;return a}function Aw({left:a=0,top:l=0,at:s="bottom",parent:r=null,width:c="auto",css:d="",onCancel:h,children:p,trackScroll:g=!1}){const[x,b]=m.useState(0),[v,S]=m.useState(0),[M,C]=m.useState("auto"),[j,k]=m.useState(!1),T=m.useRef(null),A=m.useRef(null),z=m.useRef(h);m.useEffect(()=>{z.current=h},[h]);function G(W){return r&&(c+"").indexOf("%")>-1?c.replace(/(\d+)%/,(R,ee)=>(ee=ee*r.offsetWidth/100+"px",c.replace(R,ee))):c&&c!=="auto"?c:W}const I=m.useCallback(()=>{if(!T.current)return;const W=vv(T.current,r,s,a,l);W&&(b(W.x),S(W.y),C(G(W.width)))},[T,r,s,a,l,c]);return m.useLayoutEffect(()=>{const W=ee=>{z.current&&ee.target!==A.current&&T.current&&!T.current.contains(ee.target)&&z.current(ee)};let R;return requestAnimationFrame(()=>{I(),k(!0),g&&T.current&&(A.current=yv(T.current),A.current&&A.current.addEventListener("scroll",W,!0)),r&&(R=new ResizeObserver(I),R.observe(r))}),()=>{g&&A.current&&A.current.removeEventListener("scroll",W,!0),R?.disconnect()}},[]),m.useLayoutEffect(()=>{I()},[r,s,a,l]),m.useEffect(()=>{const W=R=>{z.current&&z.current(R)};if(T.current)return ll(T.current,{callback:W,parent:()=>r}).destroy},[r]),o.jsx("div",{ref:T,className:["wx-37M6Fj","wx-popup",d].filter(Boolean).join(" "),style:{position:"absolute",visibility:j?"visible":"hidden",top:v+"px",left:x+"px",width:M},children:p})}function Tw({position:a="bottom",align:l="start",autoFit:s=!0,onCancel:r=null,width:c="100%",css:d="",children:h}){const p=m.useRef(null),[g,x]=m.useState(a),[b,v]=m.useState(l),S=m.useRef(r);return m.useEffect(()=>{S.current=r},[r]),m.useEffect(()=>{if(s){const M=p.current;if(M){const C=M.getBoundingClientRect(),j=document.body.getBoundingClientRect();C.right>=j.right&&v("end"),C.bottom>=j.bottom&&x("top")}}},[]),m.useEffect(()=>{if(p.current){const M=C=>{S.current&&S.current(C)};return ll(p.current,M).destroy}},[]),o.jsx("div",{ref:p,className:["wx-dropdown",`wx-${g}-${b}`,d||"","wx-aaaVytZW"].filter(Boolean).join(" "),style:{width:c},children:h})}function km({position:a="bottom",align:l="start",autoFit:s=!0,inline:r=!1,onCancel:c,width:d="100%",children:h,...p}){const[g,x]=m.useState(void 0),b=m.useRef(null),v=m.useMemo(()=>`${a}-${l}`,[a,l]);return m.useLayoutEffect(()=>{b.current&&x(b.current.parentNode)},[]),o.jsxs(o.Fragment,{children:[g&&(r?o.jsx(Tw,{onCancel:c,position:a,align:l,autoFit:s,width:d,...p,children:h}):o.jsx(Tm,{children:o.jsx(Aw,{parent:g,at:v,onCancel:c,width:d,...p,children:h})})),o.jsx("span",{ref:b,className:"wx-portal-node wx-32GZ52"})]})}function Du(){return zo(wv)}function kw(){let a=null,l=!1,s=!1,r,c,d,h;const p=(v,S,M,C,j)=>{r=v,c=S,d=M,h=C,s=j},g=v=>{a=v,l=a!==null,d(a)},x=(v,S)=>{if(!s&&v!==null&&r){const M=r.querySelectorAll(".wx-list > .wx-item")[v];M&&(M.scrollIntoView({block:"nearest"}),S&&S.preventDefault())}},b=(v,S)=>{const M=v===null?null:Math.max(0,Math.min(a+v,c.length-1));M!==a&&(g(M),r?x(M,S):requestAnimationFrame(()=>x(M,S)))};return{move:v=>{const S=Ro(v),M=c.findIndex(C=>C.id===S);M!==a&&g(M)},keydown:(v,S)=>{switch(v.code){case"Enter":l?h():g(0);break;case"Space":l||g(0);break;case"Escape":d(a=null);break;case"Tab":d(a=null);break;case"ArrowDown":b(l?1:S||0,v);break;case"ArrowUp":b(l?-1:S||0,v);break}},init:p,navigate:b}}const dx=10,Ew=m.memo(function({data:a,checkboxes:l,itemTemplate:s,value:r}){return o.jsxs(o.Fragment,{children:[l&&o.jsx(jw,{id:a.id,css:"wx-list-checkbox",value:r&&r.includes(a.id)}),s?Cm(s,{option:a}):a.label]})});function fx({visibleItems:a,visibleRange:l,navIndex:s,checkboxes:r,itemTemplate:c,value:d,measureRefCallback:h}){return a.map((p,g)=>{const x=l.start+g;return o.jsx("div",{ref:g===0?h:void 0,className:`wx-233fr7 wx-item ${x===s?"wx-focus":""}`,"data-id":p.id,children:o.jsx(Ew,{data:p,checkboxes:r,itemTemplate:c,value:d})},p.id)})}function Ru({items:a=[],children:l,onSelect:s,onReady:r,virtualized:c=!1,checkboxes:d,multiselect:h,value:p,...g}){const x=m.useRef(),b=m.useRef(!1),v=m.useRef(kw()),[S,M]=m.useState(null),C=m.useRef(S),[j,k]=m.useState(0),[T,A]=m.useState(24),z=m.useRef(!1),G=(m.useContext(qa)||Du()).getGroup("core"),I=m.useRef(a);m.useEffect(()=>{I.current=a},[a]);const W=m.useRef(p);m.useEffect(()=>{W.current=p},[p]);const R=m.useRef(0);m.useEffect(()=>{R.current=T},[T]);const ee=m.useCallback(L=>{L&&L.stopPropagation();const de=I.current,ve=W.current,ge=C.current;let ke;const qe=de[ge]?.id;h?ve&&ve.includes(qe)?ke=ve.filter(_e=>_e!==qe):ke=[...ve||[],qe]:ke=qe,s&&s({id:ke})},[h,s]),se=m.useRef(ee);m.useEffect(()=>{se.current=ee},[ee]);const V=m.useCallback(L=>{if(x.current){let de=L*R.current-x.current.clientHeight+R.current;k(de),x.current.scrollTop=de}},[R.current]),fe=m.useCallback(L=>{x.current=L,c&&(L&&!b.current&&C.current!==null&&requestAnimationFrame(()=>{x.current&&(V(C.current),b.current=!0)}),L||(b.current=!1))},[V]),$=m.useCallback(L=>{if(!L||z.current)return;const de=L.getBoundingClientRect().height;de&&(A(de),R.current=de,z.current=!0)},[]);m.useEffect(()=>{v.current.init(x.current,a,L=>{M(L),C.current=L},L=>se.current(L),c)},[a,x.current,c]),m.useEffect(()=>{const L=(ve,ge)=>{v.current.navigate(ve,ge),V(C.current)},de=(ve,ge)=>{const ke=C.current,qe=I.current;if(ke!==0&&ke!==qe.length-1&&(ve.key==="ArrowDown"||ve.key==="ArrowUp")&&ve.preventDefault(),v.current.keydown(ve,ge),x.current){const _e=x.current.scrollTop<=C.current*R.current,Ee=x.current.scrollTop+x.current.clientHeight>=C.current*R.current+R.current;_e?Ee||V(C.current):(x.current.scrollTop=C.current*R.current,k(x.current.scrollTop))}};r&&r({navigate:c?L:v.current.navigate,keydown:c?de:v.current.keydown,move:v.current.move})},[]);const oe=m.useRef(0),le=m.useRef(a);le.current!==a&&(le.current=a,oe.current+=1);const ue=m.useCallback(()=>{v.current.navigate(null)},[v]),H=m.useCallback(L=>{c&&k(L.target.scrollTop)},[c]),X=m.useMemo(()=>Math.ceil((x.current?.clientHeight||0)/T),[T,j]),te=m.useMemo(()=>{if(!c)return{start:0,end:a.length};if(!a.length)return{start:0,end:0};const L=Math.floor(j/T),de=L+X;return{start:Math.max(0,L-dx),end:Math.min(a.length,de+dx)}},[c,a,j,T,X]),E=m.useMemo(()=>{if(!c)return a;const{start:L,end:de}=te;return a.slice(L,de).map(ve=>({...ve}))},[c,a,te]),P=te.start*T,ne=a.length*T;return m.useEffect(()=>{c&&k(0)},[a,c]),m.useEffect(()=>{S===null&&(b.current=!1)},[S]),S===null?null:o.jsx(km,{onCancel:ue,...g,children:o.jsx("div",{className:"wx-233fr7 wx-list",ref:fe,onClick:ee,onMouseMove:v.current.move,onScroll:H,children:a.length?c?o.jsx("div",{className:"wx-233fr7 wx-list-wrapper",style:{height:`${ne}px`},children:o.jsx("div",{className:"wx-233fr7 wx-list-content",style:{transform:`translateY(${P}px)`},children:o.jsx(fx,{visibleRange:te,visibleItems:E,navIndex:S,measureRefCallback:$,checkboxes:d,itemTemplate:l,value:p})})}):o.jsx(fx,{visibleRange:te,visibleItems:E,navIndex:S,measureRefCallback:$,checkboxes:d,itemTemplate:l,value:p}):o.jsx("div",{className:"wx-233fr7 wx-no-data",children:G("No data")})})},oe.current)}function Em({value:a="",id:l,readonly:s=!1,focus:r=!1,select:c=!1,type:d="text",placeholder:h="",disabled:p=!1,error:g=!1,title:x="",tooltip:b,css:v="",icon:S="",clear:M=!1,onChange:C}){const j=Cv(l),[k,T]=al(a),A=m.useRef(null),z=m.useMemo(()=>S&&v.indexOf("wx-icon-left")===-1?"wx-icon-right "+v:v,[S,v]),G=m.useMemo(()=>S&&v.indexOf("wx-icon-left")!==-1,[S,v]);m.useEffect(()=>{const se=setTimeout(()=>{r&&A.current&&A.current.focus(),c&&A.current&&A.current.select()},1);return()=>clearTimeout(se)},[r,c]);const I=m.useCallback(se=>{const V=se.target.value;T(V),C&&C({value:V,input:!0})},[C]),W=m.useCallback(se=>C&&C({value:se.target.value}),[C]);function R(se){se.stopPropagation(),T(""),C&&C({value:""})}let ee=d;return d!=="password"&&d!=="number"&&(ee="text"),m.useEffect(()=>{const se=W,V=A.current;return V.addEventListener("change",se),()=>{V&&V.removeEventListener("change",se)}},[W]),o.jsxs("div",{className:`wx-hQ64J4 wx-text ${z} ${g?"wx-error":""} ${p?"wx-disabled":""} ${M?"wx-clear":""}`,"data-tooltip-text":b,children:[o.jsx("input",{className:"wx-hQ64J4 wx-input",ref:A,id:j,readOnly:s,disabled:p,placeholder:h,type:ee,title:x,value:k,onInput:I}),M&&!p&&k?o.jsxs(o.Fragment,{children:[o.jsx("i",{className:"wx-hQ64J4 wx-icon wxi-close",onClick:R}),G&&o.jsx("i",{className:`wx-hQ64J4 wx-icon ${S}`})]}):S?o.jsx("i",{className:`wx-hQ64J4 wx-icon ${S}`}):null]})}function Dw({date:a,type:l,part:s,onShift:r}){const{calendar:c,formats:d}=m.useContext(qa).getRaw(),h=a.getFullYear(),p=m.useMemo(()=>{switch(l){case"month":return nr(d.monthYearFormat,c)(a);case"year":return nr(d.yearFormat,c)(a);case"duodecade":{const{start:x,end:b}=bv(h),v=nr(d.yearFormat,c);return`${v(new Date(x,0,1))} - ${v(new Date(b,11,31))}`}default:return""}},[a,l,h,c,d]);function g(){r&&r({diff:0,type:l})}return o.jsxs("div",{className:"wx-8HQVQV wx-header",children:[s!=="right"?o.jsx("i",{className:"wx-8HQVQV wx-pager wxi-angle-left",onClick:()=>r&&r({diff:-1,type:l})}):o.jsx("span",{className:"wx-8HQVQV wx-spacer"}),o.jsx("span",{className:"wx-8HQVQV wx-label",onClick:g,children:p}),s!=="left"?o.jsx("i",{className:"wx-8HQVQV wx-pager wxi-angle-right",onClick:()=>r&&r({diff:1,type:l})}):o.jsx("span",{className:"wx-8HQVQV wx-spacer"})]})}function Dm({onClick:a,children:l}){return o.jsx("button",{className:"wx-3s8W4d wx-button",onClick:a,children:l})}function Rw({value:a,current:l,part:s="",markers:r=null,css:c="",onCancel:d,onChange:h}){const p=(m.useContext(qa)||Du()).getRaw().calendar,g=(p.weekStart||7)%7,x=p.dayShort.slice(g).concat(p.dayShort.slice(0,g)),b=(I,W,R)=>new Date(I.getFullYear(),I.getMonth()+(W||0),I.getDate()+(R||0));let v=s!=="normal";function S(I){const W=I.getDay();return W===0||W===6}function M(){const I=b(l,0,1-l.getDate());return I.setDate(I.getDate()-(I.getDay()-(g-7))%7),I}function C(){const I=b(l,1,-l.getDate());return I.setDate(I.getDate()+(6-I.getDay()+g)%7),I}const j=m.useRef(0);function k(I,W){W.timeStamp!==j.current&&(j.current=W.timeStamp,W.stopPropagation(),h&&h(new Date(I)),d&&d())}const T=m.useMemo(()=>s=="normal"?[a?b(a).valueOf():0]:a?[a.start?b(a.start).valueOf():0,a.end?b(a.end).valueOf():0]:[0,0],[s,a]),A=m.useMemo(()=>{const I=M(),W=C(),R=l.getMonth();let ee=[];for(let se=I;se<=W;se.setDate(se.getDate()+1)){const V={day:se.getDate(),in:se.getMonth()===R,date:se.valueOf()};let fe="";if(fe+=V.in?"":" wx-inactive",fe+=T.indexOf(V.date)>-1?" wx-selected":"",v){const $=V.date==T[0],oe=V.date==T[1];$&&!oe?fe+=" wx-left":oe&&!$&&(fe+=" wx-right"),V.date>T[0]&&V.date<T[1]&&(fe+=" wx-inrange")}if(fe+=S(se)?" wx-weekend":"",r){const $=r(se);$&&(fe+=" "+$)}ee.push({...V,css:fe})}return ee},[l,T,v,r]),z=m.useRef(null);let G=m.useRef({});return G.current.click=k,m.useEffect(()=>{sr(z.current,G.current)},[]),o.jsxs("div",{className:`wx-398RBS wx-month ${c}`,children:[o.jsx("div",{className:"wx-398RBS wx-weekdays",children:x.map(I=>o.jsx("div",{className:"wx-398RBS wx-weekday",children:I},I))}),o.jsx("div",{className:"wx-398RBS wx-days",ref:z,children:A.map(I=>o.jsx("div",{className:`wx-398RBS wx-day ${I.css} ${I.in?"":"wx-out"}`,"data-id":I.date,children:I.day},I.date))})]})}function Lw({value:a,current:l,part:s,onCancel:r,onChange:c,onShift:d}){const h=m.useRef(new Date),[p,g]=al(a||h.current),[x,b]=al(l||h.current),v=m.useContext(qa).getRaw().calendar,S=v.monthShort||[],M=m.useMemo(()=>x.getMonth(),[x]),C=m.useCallback((T,A)=>{if(T!=null){A.stopPropagation();const z=new Date(x);z.setMonth(T),b(z),d&&d({current:z})}s==="normal"&&g(new Date(x)),r&&r()},[x,s,d,r]),j=m.useCallback(()=>{const T=new Date(jv(p,s)||x);T.setMonth(x.getMonth()),T.setFullYear(x.getFullYear()),c&&c(T)},[p,x,s,c]),k=m.useCallback(T=>{const A=T.target.closest("[data-id]");if(A){const z=parseInt(A.getAttribute("data-id"),10);C(z,T)}},[C]);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-34U8T8 wx-months",onClick:k,children:S.map((T,A)=>o.jsx("div",{className:"wx-34U8T8 wx-month"+(M===A?" wx-current":""),"data-id":A,children:T},A))}),o.jsx("div",{className:"wx-34U8T8 wx-buttons",children:o.jsx(Dm,{onClick:j,children:v.done})})]})}const If="wx-1XEF33",_w=({value:a,current:l,onCancel:s,onChange:r,onShift:c,part:d})=>{const h=m.useContext(qa).getRaw().calendar,[p,g]=al(l),[x,b]=al(a),v=m.useMemo(()=>p.getFullYear(),[p]),S=m.useMemo(()=>{const{start:T,end:A}=bv(v),z=[];for(let G=T;G<=A;++G)z.push(G);return z},[v]),M={click:C};function C(T,A){if(T){A.stopPropagation();const z=new Date(p);z.setFullYear(T),g(z),c&&c({current:z})}d==="normal"&&b(new Date(p)),s&&s()}function j(){const T=new Date(jv(x,d)||p);T.setFullYear(p.getFullYear()),r&&r(T)}const k=m.useRef(null);return m.useEffect(()=>{k.current&&sr(k.current,M)},[]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:If+" wx-years",ref:k,children:S.map((T,A)=>o.jsx("div",{className:If+` wx-year ${v==T?"wx-current":""} ${A===0?"wx-prev-decade":""} ${A===11?"wx-next-decade":""}`,"data-id":T,children:T},A))}),o.jsx("div",{className:If+" wx-buttons",children:o.jsx(Dm,{onClick:j,children:h.done})})]})},mx={month:{component:Rw,next:Ow,prev:zw},year:{component:Lw,next:Hw,prev:Bw},duodecade:{component:_w,next:Iw,prev:Fw}};function zw(a){return a=new Date(a),a.setMonth(a.getMonth()-1),a}function Ow(a){return a=new Date(a),a.setMonth(a.getMonth()+1),a}function Bw(a){return a=new Date(a),a.setFullYear(a.getFullYear()-1),a}function Hw(a){return a=new Date(a),a.setFullYear(a.getFullYear()+1),a}function Fw(a){return a=new Date(a),a.setFullYear(a.getFullYear()-10),a}function Iw(a){return a=new Date(a),a.setFullYear(a.getFullYear()+10),a}function jv(a,l){let s;if(l==="normal")s=a;else{const{start:r,end:c}=a;l==="left"?s=r:l=="right"?s=c:s=r&&c}return s}const Uw=["clear","today"];function qw(a){if(a==="done")return-1;if(a==="clear")return null;if(a==="today")return new Date}function $w({value:a,current:l,onCurrentChange:s,part:r="normal",markers:c=null,buttons:d,css:h="",onShift:p,onChange:g}){const x=m.useContext(qa).getGroup("calendar"),[b,v]=m.useState("month"),S=Array.isArray(d)?d:d?Uw:[],M=(A,z)=>{A.preventDefault(),g&&g({value:z})},C=()=>{b==="duodecade"?v("year"):b==="year"&&v("month")},j=A=>{const{diff:z,current:G}=A;if(z===0){b==="month"?v("year"):b==="year"&&v("duodecade");return}if(z){const I=mx[b];s(z>0?I.next(l):I.prev(l))}else G&&s(G);p&&p()},k=A=>{v("month"),g&&g({select:!0,value:A})},T=m.useMemo(()=>mx[b].component,[b]);return o.jsx("div",{className:`wx-2Gr4AS wx-calendar ${r!=="normal"&&r!=="both"?"wx-part":""} ${h}`,children:o.jsxs("div",{className:"wx-2Gr4AS wx-wrap",children:[o.jsx(Dw,{date:l,part:r,type:b,onShift:j}),o.jsxs("div",{children:[o.jsx(T,{value:a,current:l,onCurrentChange:s,part:r,markers:c,onCancel:C,onChange:k,onShift:j}),b==="month"&&S.length>0&&o.jsx("div",{className:"wx-2Gr4AS wx-buttons",children:S.map(A=>o.jsx("div",{className:"wx-2Gr4AS wx-button-item",children:o.jsx(Dm,{onClick:z=>M(z,qw(A)),children:x(A)})},A))})]})]})})}function Rm(a){let{words:l=null,optional:s=!1,children:r}=a,c=m.useContext(qa);const d=m.useMemo(()=>{let h=c;return(!h||!h.extend)&&(h=zo(wv)),l!==null&&(h=h.extend(l,s)),h},[l,s,c]);return o.jsx(qa.Provider,{value:d,children:r})}function hx(a,l,s,r){if(!a||r){const c=l?new Date(l):new Date;c.setDate(1),s(c)}else if(a.getDate()!==1){const c=new Date(a);c.setDate(1),s(c)}}const Gw=["clear","today"];function Nv({value:a,current:l,markers:s=null,buttons:r=Gw,css:c="",onChange:d}){const[h,p]=al(a),[g,x]=al(l);m.useEffect(()=>{hx(g,h,x,!1)},[h,g]);const b=m.useCallback(S=>{const M=S.value;M?(p(new Date(M)),hx(g,new Date(M),x,!0)):p(null),d&&d({value:M?new Date(M):null})},[d,g]),v=m.useCallback(S=>{x(S)},[x]);return g?o.jsx(Rm,{children:o.jsx($w,{value:h,current:g,markers:s,buttons:r,css:c,onChange:b,onCurrentChange:v})}):null}function Yw(a){return a||(a={}),a.width||(a.width="unset"),a}const Vw=["clear","today"];function Pw({value:a,id:l,disabled:s=!1,error:r=!1,placeholder:c="",format:d="",buttons:h=Vw,css:p="",title:g="",tooltip:x,editable:b=!1,clear:v=!1,onChange:S,dropdown:M={}}){const{calendar:C,formats:j}=(m.useContext(qa)||Du()).getRaw(),k=d||j?.dateFormat;let T=typeof k=="function"?k:nr(k,C);const[A,z]=m.useState(a),[G,I]=m.useState(!1);m.useEffect(()=>{z(a)},[a]);function W(){I(!1)}function R(V){const fe=V===A||V&&A&&V.valueOf()===A.valueOf()||!V&&!A;z(V),fe||S&&S({value:V}),setTimeout(W,1)}const ee=m.useMemo(()=>A?T(A):"",[A,T]);function se({value:V,input:fe}){if(!b&&!v||fe)return;let $=typeof b=="function"?b(V):V?new Date(V):null;$=isNaN($)?A||null:$||null,R($)}return m.useEffect(()=>{const V=W;return window.addEventListener("scroll",V),()=>window.removeEventListener("scroll",V)},[]),o.jsxs("div",{className:"wx-1lKOFG wx-datepicker",onClick:()=>I(!0),children:[o.jsx(Em,{css:`wx-date-input ${p}`,title:g,tooltip:x,value:ee,id:l,readonly:!b,disabled:s,error:r,placeholder:c,onInput:W,onChange:se,icon:"wxi-calendar",clear:v}),G&&!s&&o.jsx(km,{onCancel:W,...Yw(M),children:o.jsx(Nv,{buttons:h,value:A,onChange:V=>R(V.value)})})]})}function Qw({value:a="",options:l=[],textOptions:s=null,placeholder:r="",disabled:c=!1,error:d=!1,title:h="",tooltip:p,textField:g="label",clear:x=!1,css:b="",children:v,onChange:S,dropdown:M={}}){const C=m.useRef(null),j=m.useRef(null);let[k,T]=al(a);function A(R){C.current=R.navigate,j.current=R.keydown}const z=m.useMemo(()=>k||k===0?(s||l).find(R=>R.id===k):null,[k,s,l]),G=m.useCallback(({id:R})=>{(R||R===0)&&(T(R),C.current(null),S&&S({value:R}))},[T,S]),I=m.useCallback(R=>{R.stopPropagation(),T(""),S&&S({value:""})},[T,S]),W=m.useCallback(()=>l.findIndex(R=>R.id===k),[l,k]);return o.jsxs("div",{className:`wx-2YgblL wx-richselect ${b} ${d?"wx-2YgblL wx-error":""} ${c?"wx-2YgblL wx-disabled":""} ${v?"":"wx-2YgblL wx-nowrap"}`,title:h,onClick:()=>C.current(W()),onKeyDown:R=>j.current(R,W()),tabIndex:0,"data-tooltip-text":p,children:[o.jsx("div",{className:"wx-2YgblL wx-label",children:z?v?v(z):z[g]:r?o.jsx("span",{className:"wx-2YgblL wx-placeholder",children:r}):" "}),x&&!c&&k?o.jsx("i",{className:"wx-2YgblL wx-icon wxi-close",onClick:I}):o.jsx("i",{className:"wx-2YgblL wx-icon wxi-angle-down"}),!c&&o.jsx(Ru,{items:l,onReady:A,onSelect:G,...M,children:({option:R})=>v?v(R):R[g]})]})}const Kw=({options:a=[],value:l="",css:s="",children:r,onChange:c})=>{const[d,h]=m.useState(l),p=g=>{h(g),c&&c({value:g})};return m.useEffect(()=>{h(l)},[l]),o.jsx("div",{className:`wx-0hMO7P wx-segmented ${s}`,children:a.map(g=>o.jsx("button",{className:`wx-0hMO7P wx-segment ${g.css} ${g.id===d?"wx-selected":""}`,title:g.title,onClick:()=>p(g.id),"data-tooltip-text":g.tooltip,children:r?Cm(r,{option:g}):o.jsxs(o.Fragment,{children:[g.icon&&o.jsx("i",{className:`wx-0hMO7P wx-icon ${g.icon} ${g.label?"":"wx-only"}`}),g.label&&o.jsx("span",{className:"wx-0hMO7P wx-label",children:g.label})]})},g.id))})};function Xw({notice:a={}}){function l(){a.remove&&a.remove()}return o.jsxs("div",{className:`wx-11sNg5 wx-notice wx-${a.type?a.type:""}`,role:"status","aria-live":"polite",children:[o.jsx("div",{className:"wx-11sNg5 wx-text",children:a.text}),o.jsx("div",{className:"wx-11sNg5 wx-button",children:o.jsx("i",{className:"wx-11sNg5 wxi-close",onClick:l})})]})}function Zw({data:a=[]}){return o.jsx("div",{className:"wx-3nwoO9 wx-notices",children:a.map(l=>o.jsx(Xw,{notice:l},l.id))})}function um({title:a="",buttons:l=["cancel","ok"],header:s,children:r,footer:c,css:d="",onConfirm:h,onCancel:p}){const g=(m.useContext(qa)||Du()).getGroup("core"),x=m.useRef(null);m.useEffect(()=>{x.current?.focus()},[]);function b(S){switch(S.code){case"Enter":{const M=S.target.tagName;if(M==="TEXTAREA"||M==="BUTTON")return;h&&h({event:S});break}case"Escape":p&&p({event:S});break}}function v(S,M){const C={event:S,button:M};M==="cancel"?p&&p(C):h&&h(C)}return o.jsx("div",{className:`wx-1FxkZa wx-modal ${d}`,ref:x,tabIndex:0,onKeyDown:b,children:o.jsxs("div",{className:"wx-1FxkZa wx-window",children:[s||(a?o.jsx("div",{className:"wx-1FxkZa wx-header",children:a}):null),o.jsx("div",{children:r}),c||l&&o.jsx("div",{className:"wx-1FxkZa wx-buttons",children:l.map(S=>o.jsx("div",{className:"wx-1FxkZa wx-button",children:o.jsx(Ao,{type:`block ${S==="ok"?"primary":"secondary"}`,onClick:M=>v(M,S),children:g(S)})},S))})]})})}function Ww({children:a},l){const[s,r]=m.useState(null),[c,d]=m.useState([]);return m.useImperativeHandle(l,()=>({showModal:h=>{const p={...h};return r(p),new Promise((g,x)=>{p.resolve=b=>{r(null),g(b)},p.reject=b=>{r(null),x(b)}})},showNotice:h=>{h={...h},h.id=h.id||Nm(),h.remove=()=>d(p=>p.filter(g=>g.id!==h.id)),h.expire!=-1&&setTimeout(h.remove,h.expire||5100),d(p=>[...p,h])}}),[]),o.jsxs(o.Fragment,{children:[a,s&&o.jsx(um,{title:s.title,buttons:s.buttons,onConfirm:s.resolve,onCancel:s.reject,children:s.message}),o.jsx(Zw,{data:c})]})}const Jw=m.forwardRef(Ww);function eS(a){let{children:l}=a,s=m.useRef();const r=m.useMemo(()=>({showNotice:c=>s.current.showNotice(c),showModal:c=>s.current.showModal(c)}),[]);return o.jsx(Sv.Provider,{value:r,children:o.jsx(Jw,{ref:s,children:l})})}const tS=({value:a=!1,type:l="",icon:s="",disabled:r=!1,iconActive:c="",onClick:d,title:h="",tooltip:p,css:g="",text:x="",textActive:b="",children:v,active:S,onChange:M})=>{const[C,j]=al(a),k=m.useMemo(()=>(C?"pressed":"")+(l?" "+l:""),[C,l]),T=m.useCallback(A=>{let z=!C;d&&d(A),A.defaultPrevented||(j(z),M&&M({value:z}))},[C,d,M]);return C&&S?o.jsx(Ao,{title:h,tooltip:p,text:C&&b||x,css:g,type:k,icon:C&&c||s,onClick:T,disabled:r,children:Cm(S,{value:C})}):v?o.jsx(Ao,{title:h,tooltip:p,text:C&&b||x,css:g,type:k,icon:C&&c||s,onClick:T,disabled:r,children:v}):o.jsx(Ao,{title:h,tooltip:p,text:C&&b||x,css:g,type:k,icon:C&&c||s,onClick:T,disabled:r})};function nS(){return o.jsx(o.Fragment,{})}function px(a){const{fonts:l=!0,children:s}=a;return o.jsx(Am.Provider,{value:"willow",children:o.jsxs(o.Fragment,{children:[s&&s&&o.jsx("div",{className:"wx-theme wx-willow-theme",children:s}),l&&o.jsxs(o.Fragment,{children:[o.jsx("link",{rel:"preconnect",href:"https://cdn.svar.dev",crossOrigin:"true"}),o.jsx(nS,{}),o.jsx("link",{rel:"stylesheet",href:"https://cdn.svar.dev/fonts/wxi/wx-icons.css"})]})]})})}jm(Qn);const Lm={grid:{"Add before":"Add before","Add after":"Add after",Copy:"Copy",Cut:"Cut",Paste:"Paste",Delete:"Delete","New row":"New row","Move up":"Move up","Move down":"Move down",Undo:"Undo",Redo:"Redo",selected:"selected"}};new Date().valueOf();var Av=class{constructor(a){this._nextHandler=null,this._dispatch=a,this.exec=this.exec.bind(this)}async exec(a,l){return this._dispatch(a,l),this._nextHandler&&await this._nextHandler.exec(a,l),l}setNext(a){return this._nextHandler=a}};new Date().valueOf();var aS=class{constructor(a){const l={id:0,$level:0,data:[],parent:null},s=new Map;s.set(0,l),this._pool=s,a&&a.length&&this.parse(a,0)}parse(a,l){const s=this._pool;for(let c=0;c<a.length;c++){const d=a[c];d.parent=d.parent||l,d.data=null,s.set(d.id,d)}for(let c=0;c<a.length;c++){const d=a[c],h=s.get(d.parent);h&&(h.data||(h.data=[]),h.data.push(d))}const r=s.get(l);this.setLevel(r,r.$level+1,!1)}add(a,l){const s=this._pool.get(a.parent||0);a.$level=s.$level+1,this._pool.set(a.id,a),s.data?l===-1?s.data=[...s.data,a]:gx(s,l,a):s.data=[a]}addAfter(a,l){if(!l)return this.add(a,-1);const s=this.byId(l),r=this.byId(s.parent),c=iu(r,s.id)+1;a.parent=r.id,a.$level=r.$level+1,this.add(a,c)}remove(a){const l=this._pool.get(a);this._remove(l);const s=this._pool.get(l.parent);s.data=s.data.filter(r=>r.id!=a),this._clearBranch(s)}_remove(a){a.data&&a.data.forEach(l=>this._remove(l)),this._pool.delete(a.id)}update(a,l){let s=this._pool.get(a);const r=this._pool.get(s.parent),c=iu(r,s.id);s={...s,...l},r&&c>=0&&(r.data[c]=s,r.data=[...r.data]),this._pool.set(s.id,s)}move(a,l,s){const r=this._pool.get(a),c=l==="child",d=this._pool.get(s),h=d.$level+(c?1:0);if(!r||!d)return;const p=this._pool.get(r.parent),g=c?d:this._pool.get(d.parent);g.data||(g.data=[]);const x=iu(p,r.id);lS(p,x);const b=c?g.data.length:iu(g,d.id)+(l==="after"?1:0);if(gx(g,b,r),p.id===g.id&&x===b)return null;r.parent=g.id,r.$level!==h&&(r.$level=h,this.setLevel(r,h+1,!0)),this.update(r.id,r),this._clearBranch(p)}_clearBranch(a){a.data&&!a.data.length&&(a.open&&delete a.open,this.update(a.id,{data:null}))}toArray(){const a=[],l=this._pool.get(0).data;return l&&Tv(l,a),a}byId(a){return this._pool.get(a)}getBranch(a){return this._pool.get(a).data}forEach(a){this._pool.forEach((l,s)=>{s!==0&&a(l)})}eachChild(a,l){const s=this.byId(l);!s||!s.data||s.data.forEach((r,c)=>{a(this.byId(r.id),c),this.eachChild(a,r.id)})}setLevel(a,l,s){a.data&&(a.data=a.data.map(r=>(s&&(r={...r},this._pool.set(r.id,r)),r.$level=l,r.data&&this.setLevel(r,l+1,s),r)))}};function Tv(a,l){a.forEach(s=>{l.push(s),s.open===!0&&Tv(s.data,l)})}function lS(a,l){const s=[...a.data];s.splice(l,1),a.data=s}function gx(a,l,s){const r=[...a.data];r.splice(l,0,s),a.data=r}function iu(a,l){return a?.data.findIndex(s=>s.id===l)}var kv=2,iS=class{constructor(l){l&&(this._writable=l.writable,this._async=l.async),this._values={},this._state={}}setState(l,s=0){const r={};return this._wrapProperties(l,this._state,this._values,"",r,s),r}getState(){return this._values}getReactive(){return this._state}_wrapProperties(l,s,r,c,d,h){for(const p in l){const g=s[p],x=r[p],b=l[p];if(g&&(x===b&&typeof b!="object"||b instanceof Date&&x instanceof Date&&x.getTime()===b.getTime()))continue;const v=c+(c?".":"")+p;g?(g.__parse(b,v,d,h)&&(r[p]=b),h&kv?d[v]=g.__trigger:g.__trigger()):(b&&b.__reactive?s[p]=this._wrapNested(b,b,v,d):s[p]=this._wrapWritable(b),r[p]=b),d[v]=d[v]||null}}_wrapNested(l,s,r,c){const d=this._wrapWritable(l);return this._wrapProperties(l,d,s,r,c,0),d.__parse=(h,p,g,x)=>(this._wrapProperties(h,d,s,p,g,x),!1),d}_wrapWritable(l){const s=[],r=function(){for(let c=0;c<s.length;c++)s[c](l)};return{subscribe:c=>(s.push(c),this._async?setTimeout(c,1,l):c(l),()=>{const d=s.indexOf(c);d>=0&&s.splice(d,1)}),__trigger:()=>{s.length&&(this._async?setTimeout(r,1):r())},__parse:function(c){return l=c,!0}}}};function xx(a,l){return Object.defineProperty(a,"__reactive",{value:!0,enumerable:!1,writable:!1}),a}var sS=class{constructor(l,s,r,c){typeof l=="function"?this._setter=l:this._setter=l.setState.bind(l),this._routes=s,this._parsers=r,this._prev={},this._triggers=new Map,this._sources=new Map,this._routes.forEach(d=>{d.in.forEach(h=>{const p=this._triggers.get(h)||[];p.push(d),this._triggers.set(h,p)}),d.out.forEach(h=>{const p=this._sources.get(h)||{};d.in.forEach(g=>p[g]=!0),this._sources.set(h,p)})}),this._routes.forEach(d=>{d.length=Math.max(...d.in.map(h=>Ev(h,this._sources,1)))}),this._bus=c}init(l){const s={};for(const r in l)if(this._prev[r]!==l[r]){const c=this._parsers[r];s[r]=c?c(l[r]):l[r]}this._prev=this._prev?{...this._prev,...l}:{...l},this.setState(s),this._bus&&this._bus.exec("init-state",s)}setStateAsync(l){const s=this._setter(l,kv);return this._async?Object.assign(this._async.signals,s):this._async={signals:s,timer:setTimeout(this._applyState.bind(this),1)},s}_applyState(){const l=this._async;if(l){this._async=null,this._triggerUpdates(l.signals,[]);for(const s in l.signals){const r=l.signals[s];r&&r()}}}setState(l,s=[]){const r=this._setter(l);return this._triggerUpdates(r,s),r}_triggerUpdates(l,s){const r=Object.keys(l),c=!s.length;s=s||[];for(let d=0;d<r.length;d++){const h=r[d],p=this._triggers.get(h);p&&p.forEach(g=>{s.indexOf(g)==-1&&s.push(g)})}c&&this._execNext(s)}_execNext(l){for(;l.length;){l.sort((r,c)=>r.length<c.length?1:-1);const s=l[l.length-1];l.splice(l.length-1),s.exec(l)}}};function Ev(a,l,s){const r=l.get(a);if(!r)return s;const c=Object.keys(r).map(d=>Ev(d,l,s+1));return Math.max(...c)}var rS=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=new WeakMap,this.exec=this.exec.bind(this)}on(l,s,r){let c=this._handlers[l];c?r&&r.intercept?c.unshift(s):c.push(s):c=this._handlers[l]=[s],r&&r.tag&&this._tag.set(s,r.tag)}intercept(l,s,r){this.on(l,s,{...r,intercept:!0})}detach(l){for(const s in this._handlers){const r=this._handlers[s];for(let c=r.length-1;c>=0;c--)this._tag.get(r[c])===l&&r.splice(c,1)}}async exec(l,s){const r=this._handlers[l];if(r)for(let c=0;c<r.length;c++){const d=r[c](s);if(d===!1||d&&d.then&&await d===!1)return}return this._nextHandler&&await this._nextHandler.exec(l,s),s}setNext(l){return this._nextHandler=l}};const Xs=1024;function Lo(a){return a<Xs?`${a} B`:a<Xs**2?`${(a/Xs).toFixed(1)} KB`:a<Xs**3?`${(a/Xs**2).toFixed(1)} MB`:`${(a/Xs**3).toFixed(1)} GB`}function vx(a,l){l||(l={key:"name",order:"asc"});const s=a.filter(h=>h.type==="folder"),r=a.filter(h=>h.type!=="folder"),c=s.sort(yx(l)),d=r.sort(yx(l));return[...c,...d]}function oS(a,l){return typeof a=="string"?a.localeCompare(l,void 0,{numeric:!0}):typeof a=="object"?a.getTime()-l.getTime():(a??0)-(l??0)}function cS(a,l){return typeof a=="string"?-a.localeCompare(l,void 0,{numeric:!0}):typeof l=="object"?l.getTime()-a.getTime():(l??0)-(a??0)}function yx({key:a,order:l}){const s=l==="asc"?oS:cS;return(r,c)=>s(r[a],c[a])}function _m(a,l){const s=a==="/"?1:a.split("/").length;return s>=l.length?null:l[s].id}function uS(a){return a.length>1?a[a.length-2].id:null}let dS=class extends aS{constructor(l){const s={id:"/",name:"My files",open:!0,$level:1,parent:0,ext:"",type:"folder"};super([s]),this.parse(l,"/")}parse(l,s,r){!l||!l.length||(l.forEach(c=>this.parseId(c,r?s:void 0)),super.parse(l,s))}parseId(l,s){if(l.parent===0)return;const r=l.id,c=r.lastIndexOf("/");if(l.parent=s??(c===0?"/":r.slice(0,c)),l.name=r.slice(c+1),l.type=l.type||"file",l.type!=="folder"){const d=l.name.lastIndexOf("."),h=d!==-1?l.name.slice(d+1):"";l.ext=h!=="new"?h?.toLocaleLowerCase():""}}getParents(l){const s=[];let r=this.byId(l);if(!r)return s;for(;r.id!==0;)s.push(r),r=this.byId(r.parent);return s.reverse()}findFiles(l,s="/"){const r=[],c=l.toLocaleLowerCase();return this.eachChild(d=>{d.name.toLowerCase().indexOf(c)!==-1&&r.push(d)},s),r}add(l,s){const r=this.byId(l.parent||"/"),c=l.data?[...l.data]:null;l.data=null,super.add(l,s??r.data?r.data.length:0),c&&c.forEach(d=>this.add(d))}renameFiles(l,s,r){const c=this.byId(l),d=this.normalizeFile(c,s),h=[];return d.data?.forEach(p=>h.push(this.renameFiles(p.id,d.id,r))),h.length&&(d.data=h),r[l]=d.id,d}copyFiles(l,s,r){const c={};return l.forEach(d=>{const h=this.renameFiles(d,s,c);this.add(h),r&&this.remove(d),c[d]=h.id}),c}moveFiles(l,s){if(this.byId(l[0]).parent!==s)return this.copyFiles(l,s,!0)}serialize(l="/"){const s=[],r=this.byId(l);return r?(r.data?.forEach(c=>{const{id:d,date:h,type:p,size:g,lazy:x}=c,b={id:d,date:h,type:p??"file"};x&&(b.lazy=x),g&&(b.size=g),s.push(b);const v=this.serialize(d);v.length&&s.push(...v)}),s):null}normalizeFile(l,s){const r=l.name,c=r.lastIndexOf("."),d=c!==-1?r.slice(c+1):"",h=d?`.${d}`:"";let p=c!==-1?r.slice(0,c):r,g=s+(s==="/"?"":"/")+p;for(;this.byId(g+h);){const x=".new";g+=x,p+=x}return{...l,id:g+h,name:p+h,parent:s,ext:d.toLocaleLowerCase()}}},fS=class extends iS{in;_router;constructor(l){super({writable:l,async:!1});const s=[];for(let d=0;d<2;d++)s.push({in:["data",`panels.${d}.path`],out:[`panels.${d}._crumbs`],exec:h=>{const{data:p,panels:g}=this.getState(),x=[];x[d]={_crumbs:p.getParents(g[d].path)},this.setState({panels:x},h)}}),s.push({in:["data",`panels.${d}.path`,`panels.${d}._sorts`,"search"],out:[`panels.${d}._files`],exec:h=>{const{data:p,panels:g,search:x}=this.getState();let b;x?b=p.findFiles(x,g[d].path):b=p.byId(g[d].path)?.data||[];const{path:v,_sorts:S}=g[d];b=vx(b,S[v]);const M=[];M[d]={_files:b},this.setState({panels:M},h)}}),s.push({in:["data",`panels.${d}.selected`,`panels.${d}._sorts`],out:[`panels.${d}._selected`],exec:h=>{const{data:p,panels:g}=this.getState(),x=[];g[d].selected.forEach(C=>{const j=p.byId(C);j&&x.push(j)});const{path:b,_sorts:v}=g[d],S=vx(x,v[b]),M=[];M[d]={_selected:S},this.setState({panels:M},h)}});this._router=new sS(super.setState.bind(this),s,{data:d=>new dS(d)});const r=this.in=new rS;r.on("select-file",({id:d,toggle:h,range:p,panel:g,type:x})=>{const{panels:b,activePanel:v}=this.getState();typeof g>"u"&&(g=v),d||(h=p=!1);let S=[...b[g].selected];if(h){const C=S.indexOf(d);C===-1?S.push(d):S.splice(C,1)}else if(p&&b[g]._lastSelected){const C=b[g]._files;let j=C.findIndex(A=>A.id==b[g]._lastSelected),k=C.findIndex(A=>A.id==d);k<j&&([j,k]=[k,j]);const T=C.slice(j,k+1).map(A=>A.id);S=[...new Set([...S,...T])]}else S=d?[d]:[];const M=[];M[g]={selected:S,_lastSelected:d,_selectNavigation:x==="navigation"},this.setState({panels:M})}),r.on("set-path",({id:d,panel:h,selected:p})=>{const{data:g,activePanel:x}=this.getState(),b=g.byId(d);if(b){const v=[];typeof h>"u"&&(h=x),v[h]={path:d},this.setState({panels:v}),r.exec("select-file",{panel:h}),p&&p.forEach(S=>r.exec("select-file",{id:S,panel:h,toggle:!0})),b.lazy&&r.exec("request-data",{id:d})}}),r.on("provide-data",({id:d,data:h})=>{const{mode:p,data:g}=this.getState(),x=g.byId(d);x&&(x.lazy||(x.data=[]),x.lazy=!1,g.parse(h,d,p==="search"),this.setState({data:g}))}),r.on("open-tree-folder",({id:d,mode:h})=>{const{data:p}=this.getState();p.update(d,{open:h}),this.setState({data:p})}),r.on("show-preview",({mode:d})=>{this.setState({preview:d})}),r.on("rename-file",d=>{const{id:h,name:p}=d,{data:g,panels:x}=this.getState(),b=g.byId(h);if(b.name!==p){b.name=p;const v=g.normalizeFile(b,b.parent);d.newId=v.id,v.data=null,g.add(v);let S={[h]:v.id};b.data?.forEach(C=>S={...g.moveFiles([C.id],v.id),...S});const M=x.map(C=>({selected:C.selected,_crumbs:C._crumbs,_lastSelected:C._lastSelected,_sorts:C._sorts}));g.remove(h),this._updatePanels(M,S),this.setState({data:g,panels:M})}}),r.on("create-file",d=>{const{file:h,parent:p}=d,{data:g}=this.getState(),x=g.normalizeFile(h,p);x.type=h.type||"file",d.newId=x.id,g.add(x),this.setState({data:g}),r.exec("select-file",{id:x.id})}),r.on("delete-files",({ids:d})=>{const{data:h,panels:p}=this.getState(),g=p.map(x=>({selected:x.selected,_crumbs:x._crumbs,_lastSelected:x._lastSelected,_sorts:x._sorts}));d.forEach(x=>h.remove(x)),this._updatePanels(g,{}),this.setState({data:h,panels:g})}),r.on("copy-files",d=>{const{ids:h,target:p}=d;if(this._isPlacedIntoSelf(h,p)){console.error("You cannot copy a folder into itself"),d.skipProvider=!0;return}const{data:g,panels:x,activePanel:b}=this.getState(),v=g.copyFiles(h,p);d.newIds=h.map(S=>v[S]),this.setState({data:g}),x[b].path==p&&(r.exec("select-file",{}),h.forEach(S=>{r.exec("select-file",{id:v[S],toggle:!0})}))}),r.on("move-files",d=>{const{ids:h,target:p}=d;if(this._isPlacedIntoSelf(h,p)){console.error("You cannot move a folder into itself"),d.skipProvider=!0;return}const{data:g,panels:x,activePanel:b}=this.getState(),v=g.moveFiles(h,p);if(v){d.newIds=h.map(M=>v[M]);const S=x.map(M=>({selected:M.selected,_crumbs:M._crumbs,_lastSelected:M._lastSelected,_sorts:M._sorts}));this._updatePanels(S,v,!0),this.setState({data:g,panels:S}),x[b].path==p&&(r.exec("select-file",{}),h.forEach(M=>{r.exec("select-file",{id:v[M],toggle:!0})}))}});let c=null;r.on("filter-files",({text:d})=>{if(!d){c&&this.setState({...c});return}r.exec("select-file",{});const{panels:h,mode:p}=this.getState();c||(c={panels:h,mode:p,search:""}),this.setState({mode:"search",search:d})}),r.on("set-mode",({mode:d})=>{const{activePanel:h}=this.getState(),p=[];p[h]={_selectNavigation:!1};const g={mode:d,search:"",panels:p};c=null,this.setState(g)}),r.on("set-active-panel",({panel:d})=>{this.setState({activePanel:d})}),r.on("sort-files",({key:d,order:h,panel:p,path:g})=>{const{activePanel:x,panels:b}=this.getState();p=p??x,g=g??b[p].path;const v=[];v[p]={_sorts:{...b[p]._sorts,[g]:{key:d,order:h}}},this.setState({panels:v})}),this.initOnce()}initOnce(){const l=[];for(let r=0;r<2;r++)l[r]=xx({_crumbs:[],_files:[],_selected:[],_sorts:{},path:"/",selected:[],...l[r]});const s={panels:xx(l),data:[],search:""};this._router.init(s)}init(l){const s={...l};this._router.init(s)}setState(l,s){return this._router.setState(l,s)}getFile(l){const{data:s}=this.getState();return s.byId(l)||null}serialize(l){const{data:s}=this.getState();return s.serialize(l)}_updatePanels(l,s,r){const{data:c}=this.getState();l.forEach(d=>{const h=[];d.selected.forEach(x=>{c.byId(x)?h.push(x):!r&&s[x]&&h.push(s[x])}),d.selected=h,c.byId(d._lastSelected)||(d._lastSelected=r?null:s[d._lastSelected]||null);const p={};Object.keys(d._sorts).forEach(x=>{c.byId(x)?p[x]=d._sorts[x]:s[x]&&!r&&(p[s[x]]=d._sorts[x])}),d._sorts=p;const g=d._crumbs[d._crumbs.length-1];g?.id!=="/"&&(s[g.id]?d.path=s[g.id]:c.byId(g.id)||(d.path="/"))})}_isPlacedIntoSelf(l,s){return l.some(r=>r===s||this.getState().data.getParents(s).some(c=>c.id===r))}};function mS(a){switch(a){case"body":return[{icon:"wxi-content-paste",text:"Paste",hotkey:"Ctrl+V",id:"paste"}];case"add":return[{icon:"mdi mdi-folder-plus-outline",text:"Add new file",id:"add-file"},{icon:"mdi mdi-file-plus-outline",text:"Add new folder",id:"add-folder"},{icon:"mdi mdi-file-upload-outline",text:"Upload file",id:"upload",comp:"upload"}];case"multiselect":return[{icon:"wxi-content-copy",text:"Copy",hotkey:"Ctrl+C",id:"copy"},{icon:"wxi-content-cut",text:"Cut",hotkey:"Ctrl+X",id:"move"},{comp:"separator"},{icon:"wxi-close",text:"Delete",hotkey:"Delete",id:"delete"}];default:return[a==="folder"?null:{icon:"wxi-download",text:"Download",hotkey:"Ctrl+D",id:"download"},{icon:"wxi-content-copy",text:"Copy",hotkey:"Ctrl+C",id:"copy"},{icon:"wxi-content-cut",text:"Cut",hotkey:"Ctrl+X",id:"move"},{icon:"wxi-content-paste",text:"Paste",hotkey:"Ctrl+V",id:"paste"},{comp:"separator"},{icon:"wxi-edit",text:"Rename",hotkey:"Ctrl+R",id:"rename"},{icon:"wxi-close",text:"Delete",hotkey:"Delete",id:"delete"}].filter(l=>l!==null)}}function hS(a,l="data-id"){let s=a;for(!s.tagName&&a.target&&(s=a.target);s;){if(s.getAttribute&&s.getAttribute(l))return s;s=s.parentNode}return null}function pS(a,l="data-id"){const s=hS(a,l);return s?s.getAttribute(l):null}new Date().valueOf();function gS(a,l){const{api:s}=l;function r(d,h){const p=l.getPanel(),g=p.selected,x=h.ctrlKey||h.metaKey,b=h.shiftKey;let v;const S=g?.[0]?s.getFile(g[0]):null;g?.length?g.length>1?v=l.menuOptions("multiselect"):v=l.menuOptions(S.type,S):v=l.menuOptions("body");const M=`${x?"ctrl+":""}${b?"shift+":""}${d}`,C=v?v.find(k=>k.hotkey?.toLowerCase()===M):!1,j=l.performAction;if(C)switch(M){case"ctrl+c":j("copy");break;case"ctrl+x":j("move");break;case"ctrl+v":j("paste",S);break;case"delete":j("delete");break;case"ctrl+r":h.preventDefault(),j("rename",S);break;case"ctrl+d":h.preventDefault(),j("download",S);break;default:C.handler?.({context:S})}switch(d){case"enter":{if(x||b)break;const{_crumbs:k,_selectNavigation:T}=p;if(T){const A=uS(k);if(A){const z=_m(A,k);s.exec("set-path",{id:A,selected:[z]})}}else if(g.length===1){const A=s.getFile(g[0]);A&&s.exec(A.type==="folder"?"set-path":"open-file",{id:A.id})}break}case"arrowup":case"arrowleft":{const{_files:k,_selected:T,path:A,_selectNavigation:z}=p;let G;if(T.length){const I=T.at(0).id,W=k.findIndex(R=>R.id===I);if(W!==-1){const R=W-1;k[R]?G=k[R].id:A!=="/"&&!(x||b)&&s.exec("select-file",{type:"navigation"})}}else{if(z)break;if(A!=="/"){s.exec("select-file",{type:"navigation"});break}G=k.at(0)?.id}G&&s.exec("select-file",{id:G,toggle:x,range:b});break}case"arrowdown":case"arrowright":{const{_files:k,_selected:T,path:A,_selectNavigation:z}=p;let G;if(T.length){const I=T.at(-1).id,W=k.findIndex(R=>R.id===I);if(W!==-1){const R=W+1;k[R]&&(G=k[R].id)}}else{if(A!=="/"&&!z){s.exec("select-file",{type:"navigation"});break}G=k.at(0)?.id}G&&s.exec("select-file",{id:G,toggle:x,range:b});break}}}function c(d){const h=d.code.replace("Key","").toLowerCase();r(h,d),h=="tab"&&setTimeout(()=>{const p=document.activeElement;p.className.indexOf("table")!=-1&&s.exec("set-active-panel",{panel:+pS(p,"data-panel")})})}return a.addEventListener("keydown",c),{destroy:()=>{a.removeEventListener("keydown",c)}}}function xS(a,l="data-id"){let s=a;for(!s.tagName&&a.target&&(s=a.target);s;){if(s.getAttribute&&s.getAttribute(l))return s;s=s.parentNode}return null}function vS(a,l="data-id"){const s=a.getAttribute(l);return s?yS(s):null}function yS(a){if(a.startsWith(":"))return a.substring(1);const l=a*1;return isNaN(l)?a:l}function bS(){return{detect:()=>!0,addEvent:function(a,l,s){return a.addEventListener(l,s),()=>a.removeEventListener(l,s)},addGlobalEvent:function(a,l){return document.addEventListener(a,l),()=>document.removeEventListener(a,l)},getTopNode:function(){return window.document.body}}}var wS=bS();new Date().valueOf();function Dv(a){const[l,s]=m.useState(a),r=m.useRef(a);return m.useEffect(()=>{if(r.current!==a){if(Array.isArray(r.current)&&Array.isArray(a)&&r.current.length===0&&a.length===0)return;r.current=a,s(a)}},[a]),[l,s]}function SS(a,l,s){const[r,c]=m.useState(()=>l);return a||console.warn(`Writable ${s} is not defined`),m.useEffect(()=>a?a.subscribe(h=>{c(()=>h)}):void 0,[a]),r}function ze(a,l){const s=a.getState(),r=a.getReactiveState();return SS(r[l],s[l],l)}function MS(a,l){const s=m.useRef(l);s.current=l;const[r,c]=m.useState(1);return m.useEffect(()=>a.subscribe(h=>{s.current=h,c(p=>p+1)}),[a]),[s.current,r]}function Aa(a,l){const s=a.getState(),r=a.getReactiveState();return MS(r[l],s[l])}function Rv(a){const l={};return a.split(";").forEach(s=>{const[r,c]=s.split(":");if(c){let d=r.trim();d.indexOf("-")&&(d=d.replace(/-([a-z])/g,(h,p)=>p.toUpperCase())),l[d]=c.trim()}}),l}function Lv(a){let l=a,s=[];return{subscribe:p=>{s.push(p),p(l)},unsubscribe:p=>{s=s.filter(g=>g!==p)},set:p=>{l=p,s.forEach(g=>g(l))},update:p=>{l=p(l),s.forEach(g=>g(l))}}}function bx(a,l,s){function r(c){const d=xS(c);if(!d)return;const h=vS(d);if(typeof l=="function")return l(h,c);let p,g=c.target;for(;g!=d;){if(p=g.dataset?g.dataset.action:null,p&&l[p]){l[p](h,c);return}g=g.parentNode}l[s]&&l[s](h,c)}return wS.addEvent(a,s,r)}function CS(a,l){const s=[bx(a,l,"click")];return l.dblclick&&s.push(bx(a,l.dblclick,"dblclick")),()=>{s.forEach(r=>r())}}function _v(a,l){return a.map((s,r)=>{const c=l(s,r);return s.data&&s.data.length&&(c.data=_v(s.data,l)),c}).filter(Boolean)}function zv(a,l){const s=[];return a.forEach(r=>{if(r.data){const c=zv(r.data,l);c.length&&s.push({...r,data:c})}else l(r)&&s.push(r)}),s}function jS(a){return _v(a,(l,s)=>{const r={...l,id:l.id||Nm()};return r.type&&(r.comp=r.type),r.comp==="separator"&&a[s-1]?.comp==="separator"?null:r})}const Ov={};function NS(a){return Ov[a]||a}function AS(a,l){Ov[a]=l}function TS({onClick:a,onShow:l,option:s}){const r=m.useRef(null),c=m.useCallback(()=>{l(s.data?s.id:!1,r.current)},[l,s]),d=m.useCallback(p=>{if(s.data){p.stopPropagation(),l(s.id,r.current);return}a(p)},[a,l,s]),h=m.useMemo(()=>s&&s.comp?NS(s.comp):null,[s]);return o.jsxs("div",{ref:r,className:`wx-cDCz9rZQ wx-option ${s.css||""} ${s.disabled?"wx-disabled":""}`,"data-id":Wt(s.id),onMouseEnter:c,onClick:d,children:[s.icon?o.jsx("i",{className:`wx-cDCz9rZQ wx-icon ${s.icon}`}):null,s.comp?h?o.jsx(h,{item:s,option:s}):null:o.jsxs("span",{className:"wx-cDCz9rZQ wx-value",children:[" ",s.text," "]}),s.subtext?o.jsx("span",{className:"wx-cDCz9rZQ wx-subtext",children:s.subtext}):null,s.data?o.jsx("i",{className:"wx-cDCz9rZQ wx-sub-icon wxi-angle-right"}):null]})}function zm({options:a,left:l=0,top:s=0,at:r="bottom",parent:c=null,mount:d=null,context:h=null,css:p="",onClick:g,onCancel:x}){const[b,v]=m.useState(-1e4),[S,M]=m.useState(-1e4),[C,j]=m.useState(20),[k,T]=m.useState(),A=m.useRef(null),[z,G]=m.useState(!1),[I,W]=m.useState(null),R=m.useCallback(()=>{const le=vv(A.current,c,r,l,s);le&&(v(le.x),M(le.y),T(le.width));let ue=le?.z??20;const H=c?gw(c):[];let X=0;for(const te of H){const E=parseInt(getComputedStyle(te).zIndex,10);E>X&&(X=E)}X>=ue&&(ue=X+1),j(ue)},[c,r,l,s]);m.useEffect(()=>{d&&d(R)},[]);const ee=m.useCallback(()=>{G(!1)},[]),se=m.useCallback((le,ue)=>{G(le),W(ue)},[]),V=m.useMemo(()=>jS(a),[a]);m.useEffect(()=>{R()},[c,R]);const fe=m.useRef(g),$=m.useRef(x),oe=m.useRef(c);return m.useEffect(()=>{fe.current=g},[g]),m.useEffect(()=>{$.current=x},[x]),m.useEffect(()=>{oe.current=c},[c]),m.useEffect(()=>{if(!A.current)return;function le(ue){$.current?$.current(ue):fe.current&&fe.current({action:null,option:null})}return ll(A.current,{callback:le,modal:!0,parent:()=>oe.current}).destroy},[]),o.jsx("div",{ref:A,"data-wx-menu":"true",className:`wx-XMmAGqVx wx-menu ${p}`,style:{position:"absolute",top:S+"px",left:b+"px",width:k,zIndex:C},onMouseLeave:ee,children:V.map(le=>o.jsxs(m.Fragment,{children:[le.comp==="separator"?o.jsx("div",{className:"wx-XMmAGqVx wx-separator"}):o.jsx(TS,{option:le,onShow:se,onClick:ue=>{if(!le.data&&!ue.defaultPrevented){const H={context:h,action:le,option:le,event:ue};le.handler&&le.handler(H),g&&g(H),ue.stopPropagation()}}}),le.data&&z===le.id?o.jsx(zm,{css:p,options:le.data,at:"right-overlap",parent:I,context:h,onClick:g,onCancel:x}):null]},le.id))})}const Bv=m.forwardRef(function(a,l){const{options:s,at:r="bottom",resolver:c=null,dataKey:d="contextId",filter:h=null,css:p="",children:g,onClick:x}=a,[b,v]=m.useState(null),[S,M]=m.useState(null),[C,j]=m.useState(0),[k,T]=m.useState(0),A=m.useRef(null),z=m.useMemo(()=>`data-${d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,[d]),G=m.useMemo(()=>b!==null&&h?zv(s,ee=>h(ee,b)):s,[b,h,s]);function I(ee){M(null),x&&x(ee)}function W(ee){if(A.current===ee){A.current=null;return}M(null),x&&x({action:null,option:null})}const R=m.useCallback((ee,se)=>{if(!ee){M(null);return}if(ee.defaultPrevented)return;const V=ee.target;if(V&&V.dataset&&V.dataset.menuIgnore)return;if(S&&S===V){M(null),ee.preventDefault();return}j(ee.clientX+1),T(ee.clientY+1);let fe=typeof se<"u"?se:Ro(V,z);c&&(fe=c(fe,ee),!fe)||(v(fe),M(V),A.current=ee.nativeEvent||ee,ee.preventDefault())},[S,z,c]);return m.useImperativeHandle(l,()=>({show:R}),[R]),o.jsxs(o.Fragment,{children:[g?o.jsx("span",{onClick:R,"data-menu-ignore":"true",children:typeof g=="function"?g():g}):null,S?o.jsx(Tm,{children:o.jsx(zm,{css:p,at:r,top:k,left:C,parent:S,context:b,onClick:I,onCancel:W,options:G},S)}):null]})}),kS=m.forwardRef(function(a,l){const{options:s,at:r="bottom",css:c="",children:d,onClick:h}=a,[p,g]=m.useState(null),x=m.useRef(null);function b(C){g(null),h&&h(C)}function v(C){if(x.current===C){x.current=null;return}g(null),h&&h({action:null,option:null})}const S=m.useCallback(C=>{g(C.target),x.current=C.nativeEvent||C,C.preventDefault()},[]);m.useImperativeHandle(l,()=>({show:S}),[S]);function M(C){let j=C.target;for(;!j.dataset.menuIgnore;)g(j),j=j.parentNode}return o.jsxs(o.Fragment,{children:[o.jsx("span",{onClick:M,"data-menu-ignore":"true",children:d}),p?o.jsx(Tm,{children:o.jsx(zm,{css:c,at:r,parent:p,options:s,onClick:b,onCancel:v})}):null]})}),ES=m.forwardRef(function(a,l){const{options:s,at:r="bottom",resolver:c=null,dataKey:d="contextId",filter:h=null,css:p="",children:g,onClick:x}=a,b=m.useRef(null),v=m.useCallback((S,M)=>{b.current.show(S,M)},[]);return m.useImperativeHandle(l,()=>({show:v}),[v]),o.jsxs(o.Fragment,{children:[g?o.jsx("span",{onContextMenu:v,"data-menu-ignore":"true",children:g}):null,o.jsx(Bv,{css:p,at:r,options:s,resolver:c,dataKey:d,filter:h,ref:b,onClick:x})]})}),DS={uploader:{B:"B",KB:"KB",MB:"MB",GB:"GB",TB:"TB",PB:"PB",EB:"EB","Drop files here or":"Drop files here or","select files":"select files"}};let RS=class{constructor(l,s,r,c,d){this.setFiles=l,this.setReady=s,this.setSignal=r,this.setDrag=c,d&&d.length&&this.setFiles(d)}open(l){this.setSignal(["click",l||{}])}getState(){let l="server";const s=this.files;for(let r=0;r<s.length;r++){if(s[r].status==="client")return"client";s[r].status==="error"&&(l="error")}return l}droparea(l,s){s=s||{};const r=()=>{s.dragEnter&&s.dragEnter(),this.setDrag(!0)},c=()=>{s.dragLeave&&s.dragLeave(),this.setDrag(!1)},d=p=>{p.preventDefault()},h=p=>{p.preventDefault(),this.setDrag(!1),this.setSignal(["drop",s,p]),s.dragLeave&&s.dragLeave(),s.drop&&s.drop()};return l.addEventListener("dragenter",r),l.addEventListener("dragleave",c),l.addEventListener("dragover",d,!0),l.addEventListener("drop",h,!0),()=>{l.removeEventListener("dragenter",r),l.removeEventListener("dragleave",c),l.removeEventListener("dragover",d,!0),l.removeEventListener("drop",h,!0)}}updateFile(l,s){const r=this.files.findIndex(d=>d.id===l);if(r===-1)return;const c=[...this.files];return c[r]={...c[r],...s},this.files=c,this.setFiles(this.files),this.files[r]}deleteFile(l){this.files=this.files.filter(s=>s.id!==l),this.setFiles(this.files)}addFile(l,s){s?this.files=[...this.files,l]:this.files=[l],this.setFiles(this.files)}deleteAll(){this.files=[],this.setFiles(this.files)}};function Hv(a){const[l,s]=m.useState([]),[r,c]=m.useState(Promise.resolve(null)),[d,h]=m.useState(null),[p,g]=m.useState(!1),x=m.useRef();return x.current||(x.current=new RS(s,c,h,g,a)),x.current.files=l,x.current.ready=r,x.current.signal=d,x.current.drag=p,x.current}function LS(a,l){{if(a){const s=a.getGroup(l);if(s)return s}return zo(DS).getGroup(l)}}const _S=()=>Math.random().toString(36).substr(2,9),zS=({data:a,accept:l="",multiple:s=!0,folder:r=!1,uploadURL:c="",apiOnly:d=!1,disabled:h=!1,children:p,onChange:g,onUpload:x})=>{const b=m.useRef(null),v=m.useRef(null),[S,M]=m.useState({}),C=Hv(),j=a||C,k=m.useContext(en.i18n),T=LS(k,"uploader");m.useEffect(()=>{b.current&&r&&(b.current.webkitdirectory=!0)},[r]),m.useEffect(()=>{if(!d&&v.current&&!h)return j.droparea(v.current)},[d,h,v]);const A=V=>{const fe=new FormData;return fe.append("upload",V.file),fetch(c,{method:"POST",body:fe}).then($=>$.json()).then($=>({id:V.id,...$}),()=>({id:V.id,status:"error"})).catch($=>(console.log($),{id:V.id,status:"error"}))},z=(V,fe)=>{const $=j.updateFile(V,fe),oe={...$,status:j.getState()};$&&$.uploaded&&$.uploaded(oe),x&&x(oe),$.temp&&j.deleteFile($.id)},G=V=>{if(!V)return;const fe=typeof c=="function"?c(V):A(V);j.setReady(fe.then($=>{$.status=$.status||"server",z(V.id,$)}).catch($=>{z(V.id,{status:"error",error:$})}))},I=(V,fe)=>{const $={...fe||S,id:_S(),status:"client",name:V.name,file:V};$.selected&&$.selected($),g&&g($),j.addFile($,s),G($),b.current&&(b.current.value="")},W=(V,fe,$)=>{V.isFile?V.file(oe=>{I(oe,$)}):V.isDirectory&&V.createReader().readEntries(oe=>{oe.forEach(le=>{W(le,fe+le.name+"/",$)})})},R=V=>{Array.from(V.target.files).forEach(fe=>I(fe))},ee=(V,fe)=>{Array.from(V.dataTransfer.items).forEach($=>{const oe=$.webkitGetAsEntry();oe&&W(oe,"",fe)})},se=()=>{b.current&&b.current.click()};return m.useEffect(()=>{if(j.signal){const[V,fe,$]=j.signal;M(fe),V==="click"?se():V==="drop"&&ee($,fe),j.setSignal(null)}},[j.signal]),d?o.jsxs(o.Fragment,{children:[o.jsx("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:b,onChange:R,accept:l,multiple:s,disabled:h}),p]}):o.jsxs("div",{className:`wx-at1A8tb8 wx-label ${j.drag?"wx-active":""} ${h?"wx-disabled":""}`,ref:v,children:[o.jsx("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:b,onChange:R,accept:l,multiple:s,disabled:h}),p||o.jsx("div",{className:"wx-at1A8tb8 wx-dropzone",children:o.jsxs("span",{children:[T("Drop files here or")," ",o.jsx("span",{className:"wx-at1A8tb8 wx-action",onClick:se,children:T("select files")})]})})]})};new Date().valueOf();function OS(a,l){if(Object.keys(a).length!==Object.keys(l).length)return!1;for(const s in l){const r=a[s],c=l[s];if(!Lu(r,c))return!1}return!0}function Lu(a,l){if(typeof a=="number"||typeof a=="string"||typeof a=="boolean"||a===null)return a===l;if(typeof a!=typeof l||(a===null||l===null)&&a!==l||a instanceof Date&&l instanceof Date&&a.getTime()!==l.getTime())return!1;if(typeof a=="object")if(Array.isArray(a)&&Array.isArray(l)){if(a.length!==l.length)return!1;for(let s=a.length-1;s>=0;s--)if(!Lu(a[s],l[s]))return!1;return!0}else return OS(a,l);return a===l}function dm(a){if(typeof a!="object"||a===null)return a;if(a instanceof Date)return new Date(a);if(a instanceof Array)return a.map(dm);const l={};for(const s in a)l[s]=dm(a[s]);return l}var Fv=2,BS=class{constructor(a){a&&(this._writable=a.writable,this._async=a.async),this._values={},this._state={}}setState(a,l=0){const s={};return this._wrapProperties(a,this._state,this._values,"",s,l),s}getState(){return this._values}getReactive(){return this._state}_wrapProperties(a,l,s,r,c,d){for(const h in a){const p=l[h],g=s[h],x=a[h];if(p&&(g===x&&typeof x!="object"||x instanceof Date&&g instanceof Date&&g.getTime()===x.getTime()))continue;const b=r+(r?".":"")+h;p?(p.__parse(x,b,c,d)&&(s[h]=x),d&Fv?c[b]=p.__trigger:p.__trigger()):(x&&x.__reactive?l[h]=this._wrapNested(x,x,b,c):l[h]=this._wrapWritable(x),s[h]=x),c[b]=c[b]||null}}_wrapNested(a,l,s,r){const c=this._wrapWritable(a);return this._wrapProperties(a,c,l,s,r,0),c.__parse=(d,h,p,g)=>(this._wrapProperties(d,c,l,h,p,g),!1),c}_wrapWritable(a){const l=[],s=function(){for(let r=0;r<l.length;r++)l[r](a)};return{subscribe:r=>(l.push(r),this._async?setTimeout(r,1,a):r(a),()=>{const c=l.indexOf(r);c>=0&&l.splice(c,1)}),__trigger:()=>{l.length&&(this._async?setTimeout(s,1):s())},__parse:function(r){return a=r,!0}}}},HS=class{constructor(a,l,s,r){typeof a=="function"?this._setter=a:this._setter=a.setState.bind(a),this._routes=l,this._parsers=s,this._prev={},this._triggers=new Map,this._sources=new Map,this._routes.forEach(c=>{c.in.forEach(d=>{const h=this._triggers.get(d)||[];h.push(c),this._triggers.set(d,h)}),c.out.forEach(d=>{const h=this._sources.get(d)||{};c.in.forEach(p=>h[p]=!0),this._sources.set(d,h)})}),this._routes.forEach(c=>{c.length=Math.max(...c.in.map(d=>Iv(d,this._sources,1)))}),this._bus=r}init(a){const l={};for(const s in a)if(this._prev[s]!==a[s]){const r=this._parsers[s];l[s]=r?r(a[s]):a[s]}this._prev=this._prev?{...this._prev,...a}:{...a},this.setState(l),this._bus&&this._bus.exec("init-state",l)}setStateAsync(a){const l=this._setter(a,Fv);return this._async?Object.assign(this._async.signals,l):this._async={signals:l,timer:setTimeout(this._applyState.bind(this),1)},l}_applyState(){const a=this._async;if(a){this._async=null,this._triggerUpdates(a.signals,[]);for(const l in a.signals){const s=a.signals[l];s&&s()}}}setState(a,l=[]){const s=this._setter(a);return this._triggerUpdates(s,l),s}_triggerUpdates(a,l){const s=Object.keys(a),r=!l.length;l=l||[];for(let c=0;c<s.length;c++){const d=s[c],h=this._triggers.get(d);h&&h.forEach(p=>{l.indexOf(p)==-1&&l.push(p)})}r&&this._execNext(l)}_execNext(a){for(;a.length;){a.sort((s,r)=>s.length<r.length?1:-1);const l=a[a.length-1];a.splice(a.length-1),l.exec(a)}}};function Iv(a,l,s){const r=l.get(a);if(!r)return s;const c=Object.keys(r).map(d=>Iv(d,l,s+1));return Math.max(...c)}var FS=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=new WeakMap,this.exec=this.exec.bind(this)}on(a,l,s){let r=this._handlers[a];r?s&&s.intercept?r.unshift(l):r.push(l):r=this._handlers[a]=[l],s&&s.tag&&this._tag.set(l,s.tag)}intercept(a,l,s){this.on(a,l,{...s,intercept:!0})}detach(a){for(const l in this._handlers){const s=this._handlers[l];for(let r=s.length-1;r>=0;r--)this._tag.get(s[r])===a&&s.splice(r,1)}}async exec(a,l){const s=this._handlers[a];if(s)for(let r=0;r<s.length;r++){const c=s[r](l);if(c===!1||c&&c.then&&await c===!1)return}return this._nextHandler&&await this._nextHandler.exec(a,l),l}setNext(a){return this._nextHandler=a}};function IS(a){return l=>l[a]}function US(a){return(l,s)=>l[a]=s}function Ai(a,l){return(l.getter||IS(l.id))(a)}function Uf(a,l,s){return(l.setter||US(l.id))(a,s)}function qS(a,l){const s=document.createElement("a");s.href=URL.createObjectURL(a),s.download=l,document.body.appendChild(s),s.click(),document.body.removeChild(s)}function Ni(a,l){let s=Ai(a,l)??"";return l.template?s=l.template(s,a,l):l.optionsMap&&(Array.isArray(s)?s=s.map(r=>l.optionsMap.get(r)).join(", "):s=l.optionsMap.get(s)),typeof s>"u"?"":s+""}function $S(a,l){const s=/\n|"|;|,/;let r="";const c=l.rows||`
11
- `,d=l.cols||" ",h=a._columns,p=a.flatData;l.header!==!1&&h[0].header&&(r=wx("header",h,r,d,c));for(let g=0;g<p.length;g++){const x=[];for(let b=0;b<h.length;b++){let v=Ni(p[g],h[b]);s.test(v)&&(v='"'+v.replace(/"/g,'""')+'"'),x.push(v)}r+=(r?c:"")+x.join(d)}return l.footer!==!1&&h[0].footer&&(r=wx("footer",h,r,d,c)),r}function wx(a,l,s,r,c){const d=/\n|"|;|,/;for(let h=0;h<l[0][a].length;h++){const p=[];for(let g=0;g<l.length;g++){let x=(l[g][a][h].text||"")+"";d.test(x)&&(x='"'+x.replace(/"/g,'""')+'"'),p.push(x)}s+=(s?c:"")+p.join(r)}return s}const GS="portrait",YS=100,VS="a4",PS={a3:{width:11.7,height:16.5},a4:{width:8.27,height:11.7},letter:{width:8.5,height:11}};function QS(a,l){const s=[];let r=[],c=0;const d=a.filter(p=>!p.hidden),h=KS(l);return d.forEach((p,g)=>{c+p.width<=h?(c+=p.width,r.push(p)):(r.length&&s.push(r),r=[p],c=p.width),g===d.length-1&&r.length&&s.push(r)}),s}function Sx(a,l,s){const r=[];return a.forEach((c,d)=>{const h=c[l];for(let p=0;p<s.length;p++){r[p]||(r[p]=[]);const g={...h[p]};if(r[p][d]!==null){if(!d&&!g.rowspan&&!g.colspan){let x=1,b=a[d+x][l][p],v=g.width;for(;!b.rowspan&&!b.colspan;)x++,b=a[d+x][l][p],v+=b.width;g.colspan=x,g.width=v,g.height=s[p]}if(r[p].push(g),!g.collapsed&&g.colspan>1){let x=g.colspan-1;if(g.colspan+d>a.length){const b=g.colspan-(g.colspan+d-a.length);g.colspan=b,g.width=a.slice(d,d+x+1).reduce((v,S)=>v+S.width,0),b>1&&(x=b-1)}for(let b=0;b<x;b++)r[p].push(null)}if(g.rowspan>1){const x=g.rowspan;for(let b=1;b<x;b++)r[p+b]||(r[p+b]=[]),r[p+b].push(null)}}}if(c.collapsed)for(let p=0;p<r.length;p++){const g=r[p],x=g[d];if(x&&x.collapsed){if(g[d]=null,!p)break}else{const b=x||g.findLast(v=>v?.colspan>=1);b&&(b.colspan=b.colspan-1,b.width=b.width-c.width)}}}),r.map(c=>c.filter(d=>d&&d.colspan!==0))}function KS(a){const{mode:l,ppi:s,paper:r}=a,{width:c,height:d}=PS[r];return XS(l==="portrait"?c:d,s)}function XS(a,l){return a*l}function ZS(a={}){const{mode:l,ppi:s,paper:r}=a;return{mode:l||GS,ppi:s||YS,paper:r||VS}}function Uv(a,l){return a.flexgrow?`min-width:${l}px;width:auto`:`width:${a.width}px; max-width:${a.width}px; height:${a.height}px`}function WS(a,l,s){let r=a[s.id];if(s.filter.type==="richselect"&&r){const c=s.filter.config?.options||l.find(({id:d})=>d==s.id).options;c&&(r=c.find(({id:d})=>d==r).label)}return r??""}const Mx=["resize-column","hide-column","update-cell"],JS=["delete-row","update-row","update-cell"],e1=["move-item"],t1=["resize-column","move-item"];class n1{undo=[];redo=[];progress={};in;getState;setState;_previousValues={};constructor(l,s,r){this.in=l,this.getState=s,this.setState=r,this.setHandlers(),this.resetStateHistory()}getHandlers(){return{"add-row":{handler:l=>({action:"delete-row",data:{id:l.id},source:{action:"add-row",data:l}})},"delete-row":{handler:l=>{const{id:s}=l,{data:r}=this.getPrev(),c=r.findIndex(d=>d.id===s);return{action:"add-row",data:{id:s,row:r[c],before:c<r.length-1?r[c+1].id:void 0},source:{action:"delete-row",data:l}}}},"update-cell":{handler:l=>{const{id:s,column:r}=l,c=this.getRow(s),d=this.getColumn(r),h=Ai(c,d);return Lu(h,l.value)?null:{action:"update-cell",data:{id:s,column:r,value:h},source:{action:"update-cell",data:l}}}},"update-row":{handler:l=>{const{id:s,row:r}=l,c=this.getRow(s);for(const d in r)Object.keys(c).includes(d)||(c[d]=void 0);return{action:"update-row",data:{id:s,row:c},source:{action:"update-row",data:l}}}},"copy-row":{handler:l=>{const{id:s}=l,{data:r}=this.getState(),c=r.findIndex(h=>h.id===s),d=r[c];return{action:"delete-row",data:{id:s},source:{action:"add-row",data:{id:s,row:d,before:c<r.length-1?r[c+1].id:void 0}}}}},"resize-column":{handler:l=>{const{id:s,width:r}=l,c=this.getColumn(s),{_sizes:d}=this.getState();return{action:"resize-column",data:{id:s,width:c.width??d.columnWidth},source:{action:"resize-column",data:{id:s,width:r}}}}},"hide-column":{handler:l=>{const{id:s}=l,r=this.getColumn(s);return{action:"hide-column",data:{id:s,mode:r.hidden},source:{action:"hide-column",data:l}}}},"collapse-column":{handler:l=>{const{id:s,row:r,mode:c}=l;return{action:"collapse-column",data:{id:s,row:r,mode:typeof c=="boolean"?!c:c},source:{action:"collapse-column",data:l}}}},"move-item":{handler:l=>{const{id:s,target:r,mode:c}=l,{flatData:d}=this.getPrev(),h=d.findIndex(p=>p.id===s);return{action:"move-item",data:{id:s,target:d[h+(h?-1:1)].id,mode:h?"after":"before"},source:{action:"move-item",data:{id:s,target:r,mode:c}}}}},"open-row":{handler:l=>{const{id:s,nested:r}=l;return{action:"close-row",data:{id:s,nested:r},source:{action:"open-row",data:l}}}},"close-row":{handler:l=>{const{id:s,nested:r}=l;return{action:"open-row",data:{id:s,nested:r},source:{action:"close-row",data:l}}}}}}resetHistory(){this.undo=[],this.redo=[],this.progress={},this.resetStateHistory()}getPrev(){return this._previousValues}setHandlers(){const l=this.getHandlers();for(const s in l)this.in.intercept(s,r=>{if(!(r.eventSource==="undo"||r.eventSource==="redo"||r.skipUndo)){if(t1.includes(s)){(r.inProgress&&!this.progress[s]||typeof r.inProgress!="boolean")&&(e1.includes(s)&&this.setPrev("flatData"),Mx.includes(s)&&this.setPrev("columns")),this.progress[s]=r.inProgress;return}JS.includes(s)&&this.setPrev("data"),Mx.includes(s)&&this.setPrev("columns")}}),this.in.on(s,r=>{if(r.eventSource==="undo"||r.eventSource==="redo"||r.skipUndo||r.inProgress)return;const c=l[s].handler(r);c&&this.addToHistory(c)})}setPrev(l){this._previousValues[l]=dm(this.getState()[l])}addToHistory(l){this.undo.push(l),this.redo=[],this.setStateHistory()}handleUndo(){if(!this.undo.length)return;const l=this.undo.pop();this.redo.push({...l.source,source:l}),this.in.exec(l.action,{...l.data,eventSource:"undo"}),this.setStateHistory()}handleRedo(){if(!this.redo.length)return;const l=this.redo.pop();this.undo.push({...l.source,source:l}),this.in.exec(l.action,{...l.data,eventSource:"redo"}),this.setStateHistory()}resetStateHistory(){this.setState({history:{undo:0,redo:0}})}setStateHistory(){this.setState({history:{undo:this.undo.length,redo:this.redo.length}})}getRow(l){const{data:s}=this.getPrev();return this.getState().tree?this.getTreeRow(s,l):s.find(r=>r.id===l)}getTreeRow(l,s){for(let r=0;r<l.length;r++){if(l[r].id===s)return l[r];if(l[r].data){const c=this.getTreeRow(l[r].data,s);if(c)return c}}return null}getColumn(l){const{columns:s}=this.getPrev();return s.find(r=>r.id===l)}}function qv(a,l){return typeof a>"u"||a===null?-1:typeof l>"u"||l===null?1:a===l?0:a>l?1:-1}function a1(a,l){return-qv(a,l)}function l1(a,l){if(typeof l.sort=="function")return function(r,c){const d=l.sort(r,c);return a==="asc"?d:-d};const s=a==="asc"?qv:a1;return function(r,c){return s(Ai(r,l),Ai(c,l))}}function i1(a,l){if(!a||!a.length)return;const s=a.map(r=>{const c=l.find(d=>d.id==r.key);return l1(r.order,c)});return a.length===1?s[0]:function(r,c){for(let d=0;d<s.length;d++){const h=s[d](r,c);if(h!==0)return h}return 0}}const su=28,s1=20;function r1(){if(typeof document>"u")return"willow";const a=document.querySelector('[class^="wx"][class$="theme"]');return a?a.className.substring(3,a.className.length-6):"willow"}function ju(a,l,s,r,c){const d=document.createElement("div"),h=document.createElement("div"),p=document.body;c=c?`${c}px`:"auto";let g,x;h.className=l,d.classList.add(`wx-${s}-theme`),d.style.cssText=`height:auto;position:absolute;top:0px;left:100px;overflow:hidden;width=${c};white-space:nowrap;`,d.appendChild(h),p.appendChild(d),typeof a!="object"&&(a=[a]);for(let b=0;b<a.length;b++){h.innerText=a[b]+"";const v=d.getBoundingClientRect(),S=Math.ceil(v.width)+(r&&r.length?r[b]:0),M=Math.ceil(v.height);g=Math.max(g||0,S),x=Math.max(x||0,M)}return d.remove(),{width:g,height:x}}function Cx(a,l,s,r,c){const d=[];for(let h=0;h<a.length;h++){const p=a[h][l],g=p.length;for(let x=0;x<g;x++){const{text:b,vertical:v,collapsed:S,rowspan:M,css:C}=p[x];if(!b){d[x]=Math.max(d[x]||0,r);continue}let j=0;if(v&&!S){let k=`wx-measure-cell-${l}`;if(k+=C?` ${C}`:"",j=ju(b,k,c).width,(M>1||!p[x+1])&&s>x+1){const T=M||s-x,A=d.slice(x,x+T).reduce((z,G)=>z+G,0);if(A<j){const z=Math.ceil((j-A)/T);for(let G=x;G<x+T;G++)d[G]=(d[G]||r)+z}continue}}d[x]=Math.max(d[x]||r,j)}}return d}function o1(a,l,s){const r=[],c=[];let d="wx-measure-cell-body";d+=a.css?` ${a.css}`:"";for(let h=0;h<l.length;h++){const p=l[h],g=Ni(p,a);g&&(r.push(g),a.treetoggle?c.push(l[h].$level*su+(l[h].$count?su:0)+(a.draggable?su:0)):a.draggable&&c.push(su))}return ju(r,d,s,c).width}function c1(a,l){const s="wx-measure-cell-header",r=a.sort?s1:0;let c=a.header;if(typeof c=="string")return ju(c,s,l).width+r;let d;Array.isArray(c)||(c=[c]);for(let h=0;h<c.length;h++){const p=c[h],g=typeof p=="string"?p:p.text,x=s+(typeof p=="string"?"":` ${p.css}`);let b=ju(g,x,l).width;h===c.length-1&&(b+=r),d=Math.max(d||0,b)}return d}const u1={text:(a,l)=>a?a.toString().toLowerCase().indexOf(l.toLowerCase())!==-1:!l,richselect:(a,l)=>typeof l!="number"&&!l?!0:a==l,datepicker:(a,l)=>l?a&&f1(a,l):!0,multiselect:(a,l)=>!l||l?.length===0?!0:Array.isArray(a)?a?.some(s=>l.includes(s)):a&&l.includes(a)};function $v(a){return u1[a]}function d1(a,l){const s=[];for(const r in a){const c=l.find(g=>g.id==r),{config:d,type:h}=c.header.find(g=>g.filter).filter,p=a[r];s.push(g=>{const x=Ai(g,c);return d?.handler?d.handler(x,p):$v(h)(x,p)})}return r=>{for(let c=0;c<s.length;c++)if(!s[c](r))return!1;return!0}}function f1(a,l){return a.getFullYear()===l.getFullYear()&&a.getMonth()===l.getMonth()&&a.getDate()===l.getDate()}let m1=class extends BS{in;_router;_branches;_xlsxWorker;_historyManager;constructor(l){super({writable:l,async:!1});const s={rowHeight:37,columnWidth:160,headerHeight:36,footerHeight:36};this._router=new HS(super.setState.bind(this),[{in:["columns","sizes","_skin"],out:["_columns","_sizes"],exec:c=>{const{columns:d,sizes:h,_skin:p}=this.getState(),g=this.copyColumns(d),x=g.reduce((S,M)=>Math.max(M.header.length,S),0),b=g.reduce((S,M)=>Math.max(M.footer.length,S),0);g.forEach(this.setCollapsibleColumns);const v=this.normalizeSizes(g,h,x,b,p);for(let S=0;S<g.length;S++)this.normalizeColumns(g,S,"header",x,v),this.normalizeColumns(g,S,"footer",b,v);this.setState({_columns:g,_sizes:v},c)}},{in:["data","tree","_filterIds"],out:["flatData","_rowHeightFromData"],exec:c=>{const{data:d,tree:h,dynamic:p,_filterIds:g}=this.getState(),x=g&&new Set(g),b=h?this.flattenRows(d,[],g):x?d.filter(S=>x.has(S.id)):d,v=!p&&b.some(S=>S.rowHeight);this.setState({flatData:b,_rowHeightFromData:v},c)}}],{sizes:c=>({...s,...c})});const r=this.in=new FS;r.on("close-editor",({ignore:c})=>{const{editor:d}=this.getState();d&&(c||r.exec("update-cell",d),this.setState({editor:null}))}),r.on("open-editor",({id:c,column:d})=>{let h=this.getState().editor;h&&r.exec("close-editor",{});const p=this.getRow(c),g=d?this.getColumn(d):this.getNextEditor(p);if(g?.editor){let x=g.editor;if(typeof x=="function"&&(x=x(p,g)),!x)return;h={column:g.id,id:c,value:Ai(p,g)??"",renderedValue:Ni(p,g),type:x.type||x},typeof x=="object"&&x.config&&(h.config=x.config,x.config.options&&(h.options=x.config.options)),g.options&&!h.options&&(h.options=g.options),this.setState({editor:h})}}),r.on("editor",({value:c})=>{let d=this.getState().editor;if(d){d={...d},d.value=c;const h=this.getColumn(d.column),p={...this.getRow(d.id)};Uf(p,h,c),d.renderedValue=Ni(p,h),this.setState({editor:d})}}),r.on("add-row",c=>{const d=this.getState();let{data:h}=d;const{select:p,_filterIds:g}=d,{row:x,before:b,after:v,select:S}=c;if(c.id=x.id=c.id||x.id||ru(),b||v){const C=b||v,j=h.findIndex(k=>k.id===C);h=[...h],h.splice(j+(v?1:0),0,c.row)}else h=[...h,c.row];const M={data:h};g&&(M._filterIds=[...g,c.id]),this.setState(M),!(typeof S=="boolean"&&!S)&&(S||p)&&r.exec("select-row",{id:x.id,show:!0})}),r.on("delete-row",c=>{const{data:d,selectedRows:h,focusCell:p,editor:g}=this.getState(),{id:x}=c,b={data:d.filter(v=>v.id!==x)};this.isSelected(x)&&(b.selectedRows=h.filter(v=>v!==x)),g?.id===x&&(b.editor=null),this.setState(b),p?.row===x&&this.in.exec("focus-cell",{eventSource:"delete-row"})}),r.on("update-cell",c=>{const d=this.getState();let{data:h}=d;h=[...h];const{tree:p}=d,{id:g,column:x,value:b}=c,v=this.getColumn(x);if(p){const S={...this._branches[g]};Uf(S,v,b);const M=this.updateTreeRow(S);S.$parent===0&&(h=M)}else{const S=h.findIndex(C=>C.id===g),M={...h[S]};Uf(M,v,b),h[S]=M}this.setState({data:h})}),r.on("update-row",c=>{let{data:d}=this.getState();const{id:h,row:p}=c,g=d.findIndex(x=>x.id===h);d=[...d],d[g]={...d[g],...p},this.setState({data:d})}),r.on("select-row",({id:c,toggle:d,range:h,mode:p,show:g,column:x})=>{const b=this.getState(),{focusCell:v}=b;let{selectedRows:S}=b;if(S.length||(h=d=!1),h){const{data:M}=this.getState();let C=M.findIndex(k=>k.id===S[S.length-1]),j=M.findIndex(k=>k.id===c);C>j&&([C,j]=[j,C]),M.slice(C,j+1).forEach(k=>{this.isSelected(k.id)||S.push(k.id)})}else if(d&&this.isSelected(c)){if(p===!0)return;S=S.filter(M=>M!==c)}else if(d){if(p===!1)return;S.push(c)}else S=[c];this.setState({selectedRows:[...S]}),v?.row!==c&&this.in.exec("focus-cell",{eventSource:"select-row"}),g&&this.in.exec("scroll",{row:c,column:x})}),this.in.on("focus-cell",c=>{const{row:d,column:h,eventSource:p}=c,{_columns:g,split:x}=this.getState();d&&h?(this.setState({focusCell:{row:d,column:h}}),p!=="click"&&((!x.left||g.findIndex(b=>b.id===c.column)>=x.left)&&(!x.right||g.findIndex(b=>b.id===c.column)<g.length-x.right)?this.in.exec("scroll",{row:d,column:h}):this.in.exec("scroll",{row:d}))):this.setState({focusCell:null})}),r.on("resize-column",c=>{const{id:d,auto:h,maxRows:p,inProgress:g}=c;if(g===!1)return;let x=c.width||0;const b=[...this.getState().columns],v=this.getColumn(d);if(h){if(h==="data"||h===!0){const{flatData:S,_skin:M}=this.getState();let C=S.length;p&&(C=Math.min(p,C));const j=S.slice(0,C);x=o1(v,j,M)}if(h==="header"||h===!0){const{_skin:S}=this.getState();x=Math.max(c1(v,S),x)}}v.width=Math.max(17,x),delete v.flexgrow,this.setState({columns:b})}),r.on("hide-column",c=>{const{id:d,mode:h}=c,p=[...this.getState().columns],g=this.getColumn(d),x=p.reduce((b,v)=>b+(v.hidden?0:1),0);!h||x>1?(g.hidden=!g.hidden,this.setState({columns:p})):c.skipUndo=!0}),r.on("sort-rows",c=>{const{key:d,add:h,sort:p}=c,g=this.getState(),{columns:x,data:b,tree:v}=g;if(p){const A=[...b];A.sort(p),this.setState({data:A});return}const{order:S="asc"}=c;let M=g.sortMarks;const C=Object.keys(M),j=C.length;!h||!j||j===1&&M[d]?M={[d]:{order:S}}:(j===1&&(M[C[0]]={...M[C[0]],index:0}),M={...M,[d]:{order:S,index:typeof h=="number"?h:M[d]?.index??j}});const k=Object.keys(M).sort((A,z)=>M[A].index-M[z].index).map(A=>({key:A,order:M[A].order}));this.setState({sortMarks:M});const T=i1(k,x);if(T){const A=[...b];v?this.sortTree(A,T):A.sort(T),this.setState({data:A})}}),r.on("filter-rows",c=>{const{value:d,key:h,filter:p}=c;if(!Object.keys(c).length){this.setState({filterValues:{},_filterIds:null});return}const g=this.getState(),{data:x,tree:b,_columns:v}=g;let S=g.filterValues;const M={};h&&(S={...S,[h]:d},M.filterValues=S);const C=p??d1(S,v);let j=[];b?j=this.filterTree(x,C,j):x.forEach(k=>{C(k)&&j.push(k.id)}),M._filterIds=j,this.setState(M)}),r.on("collapse-column",c=>{const{id:d,row:h,mode:p}=c,g=[...this.getState().columns],x=this.getColumn(d).header,b=Array.isArray(x)?x[h]:x;typeof b=="object"&&(b.collapsed=p??!b.collapsed,this.setState({columns:g}))}),r.on("move-item",c=>{const{id:d,inProgress:h}=c;let{target:p,mode:g="after"}=c;const{data:x,flatData:b,tree:v}=this.getState(),S=b.findIndex(j=>j.id===d);let M;if(g==="up"||g==="down"){if(g==="up"){if(S===0)return;M=S-1,g="before"}else if(g==="down"){if(S===b.length-1)return;M=S+1,g="after"}p=b[M]&&b[M].id}else M=b.findIndex(j=>j.id===p);if(S===-1||M===-1||h===!1)return;let C;v||(C=this.moveItem(d,p,x,g)),this.setState({data:v?this.normalizeTreeRows(C):C})}),r.on("copy-row",c=>{const{id:d,target:h,mode:p="after"}=c,g=this.getState(),{flatData:x,_filterIds:b}=g;let{data:v}=g;const S=this.getRow(d);if(!S)return;const M={...S,id:ru()};c.id=M.id;const C=x.findIndex(k=>k.id===h);if(C===-1)return;v.splice(C+(p==="after"?1:0),0,M),v=[...v];const j={data:v};b&&(j._filterIds=[...b,M.id]),this.setState(j)}),r.on("open-row",c=>{const{id:d,nested:h}=c;this.toggleBranch(d,!0,h)}),r.on("close-row",c=>{const{id:d,nested:h}=c;this.toggleBranch(d,!1,h)}),r.on("export-data",c=>new Promise((d,h)=>{const p=c.format||"csv",g=`${c.fileName||"data"}.${p}`;if(p==="csv"){const x=$S(this.getState(),c.csv||{});c.download!==!1?qS(new Blob(["\uFEFF"+x],{type:"text/csv"}),g):c.result=x,d(!0)}else h()})),r.on("hotkey",({key:c,event:d,isInput:h})=>{switch(c){case"arrowup":{const{flatData:p,focusCell:g,select:x}=this.getState();if(d.preventDefault(),h)return;const b=g?g.column:this._getFirstVisibleColumn()?.id,v=g?this.getPrevRow(g.row)?.id:p[p.length-1]?.id;b&&v&&(this.in.exec("focus-cell",{row:v,column:b,eventSource:"key"}),x&&this.in.exec("select-row",{id:v}));break}case"arrowdown":{const{flatData:p,focusCell:g,select:x}=this.getState();if(d.preventDefault(),h)return;const b=g?g.column:this._getFirstVisibleColumn()?.id,v=g?this.getNextRow(g.row)?.id:p[0]?.id;b&&v&&(this.in.exec("focus-cell",{row:v,column:b,eventSource:"key"}),x&&this.in.exec("select-row",{id:v}));break}case"arrowright":{const{focusCell:p}=this.getState();if(h)return;if(d.preventDefault(),p){const g=this.getNextColumn(p.column,!0)?.id;g&&this.in.exec("focus-cell",{row:p.row,column:g,eventSource:"key"})}break}case"arrowleft":{const{focusCell:p}=this.getState();if(h)return;if(d.preventDefault(),p){const g=this.getPrevColumn(p.column,!0)?.id;g&&this.in.exec("focus-cell",{row:p.row,column:g,eventSource:"key"})}break}case"tab":{const{editor:p,focusCell:g,select:x}=this.getState();if(p){d.preventDefault();const b=p.column;let v=p.id,S=this.getNextEditor(this.getRow(v),this.getColumn(b));if(!S){const M=this.getNextRow(v);M&&(v=M.id,S=this.getNextEditor(M))}S&&(this.in.exec("open-editor",{id:v,column:S.id}),this.in.exec("focus-cell",{row:v,column:S.id,eventSource:"key"}),x&&!this.isSelected(v)&&this.in.exec("select-row",{id:v}))}else g&&this.in.exec("focus-cell",{eventSource:"key"});break}case"shift+tab":{const{editor:p,focusCell:g,select:x}=this.getState();if(p){d.preventDefault();const b=p.column;let v=p.id,S=this.getPrevEditor(this.getRow(v),this.getColumn(b));if(!S){const M=this.getPrevRow(v);M&&(v=M.id,S=this.getPrevEditor(M))}S&&(this.in.exec("open-editor",{id:v,column:S.id}),this.in.exec("focus-cell",{row:v,column:S.id,eventSource:"key"}),x&&!this.isSelected(v)&&this.in.exec("select-row",{id:v}))}else g&&this.in.exec("focus-cell",{eventSource:"key"});break}case"escape":{const{editor:p}=this.getState();p&&(this.in.exec("close-editor",{ignore:p.type!="multiselect"}),this.in.exec("focus-cell",{row:p.id,column:p.column,eventSource:"key"}));break}case"f2":{const{editor:p,focusCell:g}=this.getState();!p&&g&&this.in.exec("open-editor",{id:g.row,column:g.column});break}case"enter":{const{focusCell:p,tree:g}=this.getState();if(!h&&g&&p&&this.getColumn(p.column).treetoggle){const x=this.getRow(p.row);if(!x.data)return;this.in.exec(x.open?"close-row":"open-row",{id:p.row,nested:!0})}break}case"home":{const{editor:p,focusCell:g}=this.getState();if(!p&&g){d.preventDefault();const x=this._getFirstVisibleColumn()?.id;this.in.exec("focus-cell",{row:g.row,column:x,eventSource:"key"})}break}case"ctrl+home":{const{editor:p,focusCell:g,flatData:x,select:b}=this.getState();if(!p&&g){d.preventDefault();const v=x[0]?.id,S=this._getFirstVisibleColumn()?.id;v&&S&&(this.in.exec("focus-cell",{row:v,column:S,eventSource:"key"}),b&&!this.isSelected(v)&&this.in.exec("select-row",{id:v}))}break}case"end":{const{editor:p,focusCell:g}=this.getState();if(!p&&g){d.preventDefault();const x=this._getLastVisibleColumn()?.id,b=g.row;this.in.exec("focus-cell",{row:b,column:x,eventSource:"key"})}break}case"ctrl+end":{const{editor:p,focusCell:g,flatData:x,select:b}=this.getState();if(!p&&g){d.preventDefault();const v=x.at(-1).id,S=this._getLastVisibleColumn()?.id;v&&S&&(this.in.exec("focus-cell",{row:v,column:S,eventSource:"key"}),b&&!this.isSelected(v)&&this.in.exec("select-row",{id:v}))}break}case"ctrl+z":{this.in.exec("undo",{});break}case"ctrl+y":{this.in.exec("redo",{});break}}}),r.on("scroll",c=>{const{_columns:d,split:h,_sizes:p,flatData:g,dynamic:x,_rowHeightFromData:b}=this.getState();let v=-1,S=-1,M=0,C=0;if(c.column){v=0;const j=d.findIndex(k=>k.id===c.column);M=d[j].width;for(let k=h.left??0;k<j;k++){const T=d[k];T.hidden||(v+=T.width)}}if(c.row&&!x){const j=g.findIndex(k=>k.id===c.row);j>=0&&(b?(S=g.slice(0,j).reduce((k,T)=>k+(T.rowHeight||p.rowHeight),0),C=g[j].rowHeight):S=p.rowHeight*j)}this.setState({scroll:{top:S,left:v,width:M,height:C||p.rowHeight}})}),r.on("scroll-to",c=>{const d={};c.top!==void 0&&(d.scrollTop=c.top),c.left!==void 0&&(d.scrollLeft=c.left),Object.keys(d).length&&this.setState(d)}),r.on("print",c=>{const d=ZS(c);this.setState({_print:d}),this.setStateAsync({_print:null})}),r.on("undo",()=>{this._historyManager?.handleUndo()}),r.on("redo",()=>{this._historyManager?.handleRedo()}),this.initOnce()}getXlsxWorker(l){if(!this._xlsxWorker){const s=window.URL.createObjectURL(new Blob([`importScripts('${l}');`],{type:"text/javascript"}));this._xlsxWorker=new Promise(r=>{const c=new Worker(s);c.addEventListener("message",d=>{d.data.type==="init"&&r(c)})})}return this._xlsxWorker}initOnce(){const l={sortMarks:{},_filterIds:null,data:[],filterValues:{},scroll:null,scrollLeft:0,scrollTop:0,editor:null,focusCell:null,_print:null,history:{undo:0,redo:0},search:null};this._router.init(l)}init(l){l.hasOwnProperty("_skin")&&!l._skin&&(l._skin=r1()),l.columns&&l.columns.forEach(s=>{s.options&&(s.optionsMap=new Map(s.options.map(r=>[r.id,r.label])))}),Lu(this.getState().data,l.data)||(l.tree?l.data=this.normalizeTreeRows(l.data):l.data=this.normalizeRows(l.data),this.setState({_filterIds:null,filterValues:{},sortMarks:{},search:null}),this._historyManager&&this._historyManager.resetHistory()),l.tree&&(l.undo=!1,l.reorder=!1),l.split?.right&&(l.split.right=0),l.undo&&!this._historyManager&&(this._historyManager=new n1(this.in,this.getState.bind(this),this.setState.bind(this))),this._router.init({...l})}setState(l,s){return this._router.setState(l,s)}setStateAsync(l){this._router.setStateAsync(l)}getRow(l){const{tree:s}=this.getState();return s?this._branches[l]:this.getState().data.find(r=>r.id===l)}getRowIndex(l,s){return s||(s=this.getState().flatData),s.findIndex(r=>r.id===l)}getNextRow(l){const s=this.getState().flatData,r=this.getRowIndex(l,s);return s[r+1]}getPrevRow(l){const s=this.getState().flatData,r=this.getRowIndex(l,s);return s[r-1]}getColumn(l){return this.getState().columns.find(s=>s.id===l)}getNextColumn(l,s){const r=this.getState()._columns,c=r.findIndex(d=>d.id===l);return s?this._getFirstVisibleColumn(c+1):r[c+1]}getPrevColumn(l,s){const r=this.getState()._columns,c=r.findIndex(d=>d.id===l);return s?this._getLastVisibleColumn(c-1):r[c-1]}_getFirstVisibleColumn(l){const s=this.getState()._columns;let r=l??0;for(;r<s.length&&(s[r]?.hidden||s[r]?.collapsed);)r++;return s[r]}_getLastVisibleColumn(l){const s=this.getState()._columns;let r=l??s.length-1;for(;r<s.length&&(s[r]?.hidden||s[r]?.collapsed);)r--;return s[r]}isCellEditable(l,s){const{editor:r,hidden:c}=s;return!r||c?!1:typeof r=="function"?r(l,s):!0}getNextEditor(l,s){let r=this.getState().columns;if(s){const c=r.findIndex(d=>d.id===s.id);r=r.slice(c+1)}return r.find(c=>this.isCellEditable(l,c))}getPrevEditor(l,s){let r=this.getState().columns;if(s){const c=r.findLastIndex(d=>d.id===s.id);r=r.slice(0,c)}return r.findLast(c=>this.isCellEditable(l,c))}toggleBranch(l,s,r){let c=this._branches[l],{data:d}=this.getState();if(d=[...d],l!==0){c={...c,open:s};const h=this.updateTreeRow(c);c.$parent===0&&(d=h)}r&&c.data?.length&&c.data.forEach(h=>{const p=this.toggleKids(h,s,r);l===0&&(d=p)}),this.setState({data:d})}toggleKids(l,s,r){l={...l,open:s};const c=this.updateTreeRow(l);return r&&l.data?.length&&l.data.forEach(d=>{this.toggleKids(d,s,r)}),c}updateTreeRow(l){const s=l.id;this._branches[s]=l;const r=this._branches[l.$parent],c=r.data.findIndex(d=>d.id===s);return r.data=[...r.data],r.data[c]=l,r.data}isSelected(l){return this.getState().selectedRows.indexOf(l)!==-1}findAndRemove(l,s){for(let r=0;r<l.length;r++){if(l[r].id===s)return l.splice(r,1)[0];if(l[r].data){const c=[...l[r].data],d=this.findAndRemove(c,s);if(d)return l[r]={...l[r],data:c},d}}return null}insertItem(l,s,r,c){for(let d=0;d<l.length;d++){if(l[d].id===s){const h=l[d],p=c==="before"?d:d+1;if(h.data){if(c==="before"){const g=d>0?l[d-1]:null;return g?.data&&g.open?l[d-1]={...g,data:[...g.data,r]}:l.splice(p,0,r),!0}else if(h.open)return l[d]={...h,data:[r,...h.data]},!0}return l.splice(p,0,r),!0}if(l[d].data&&(l[d]={...l[d],data:[...l[d].data]},this.insertItem(l[d].data,s,r,c)))return!0}return!1}moveItem(l,s,r,c){const d=[...r],h=this.findAndRemove(d,l);return this.insertItem(d,s,h,c),d}copyColumns(l){const s=[];for(let r=0;r<l.length;r++){const c={...l[r]};this.copyHeaderFooter(c,"header"),this.copyHeaderFooter(c,"footer"),s[r]=c}return s}copyHeaderFooter(l,s){let r=l[s];r=Array.isArray(r)?[...r]:[r],r.forEach((c,d)=>{r[d]=typeof c=="string"?{text:c}:{...c}}),l[s]=r}setCollapsibleColumns(l,s,r){let c=l.header;for(let d=0;d<c.length;d++){const h=c[d];if(h.collapsible&&h.collapsed){if(h.collapsible!=="first"){l.collapsed=!0,l.width=36,h.vertical=!0;const g=c.length-d;c=c.slice(0,d+1),c[d].rowspan=g}const p=h.colspan;if(p){const g=c[d+1];let x=1;g&&g.colspan&&!g.collapsed&&(x=g.colspan);for(let b=x;b<p;b++){const v=r[s+b];v&&(v.hidden=!0)}}}}}normalizeColumns(l,s,r,c,d){const h=l[s];h.width||(h.width=h.flexgrow?17:d.columnWidth),h._colindex=s+1;const p=h[r],g=d[`${r}RowHeights`];for(let x=0;x<c;x++){const b=p[x];b.id=h.id,x===p.length-1&&(b.rowspan=b.rowspan?Math.min(b.rowspan,c-x):c-x);for(let v=1;v<b.rowspan;v++){p.splice(x+v,0,{_hidden:!0});for(let S=1;S<b.colspan;S++)l[s+S][r].splice(x+v,0,{})}if(b.rowspan){const v=(b.rowspan===c?g:g.slice(x,b.rowspan+x)).reduce((S,M)=>S+M,0);b.height=v,x+b.rowspan!=c&&b.height--}if(b.colspan){let v=h.width,S=h.flexgrow||0;const M=b.colspan;for(let C=1;C<M;C++){const j=l[s+C];j&&(j.hidden?b.colspan-=1:j.flexgrow?S+=j.flexgrow:v+=j.width||d.columnWidth),S?b.flexgrow=S:b.width=v}}else b.width=h.width,b.flexgrow=h.flexgrow;r==="header"&&b.filter&&typeof b.filter=="string"&&(b.filter={type:b.filter})}p.length>c&&(p.length=c),h[r]=p}normalizeRows(l){for(let s=0;s<l.length;s++)l[s].id||(l[s].id=ru());return l}normalizeTreeRows(l,s,r){return!s&&!r&&(this._branches={0:{data:l}}),l.forEach(c=>{c.id||(c.id=ru()),c.$level=s||0,c.$parent=r||0,this._branches[c.id]=c,c.data&&(c.data.length?(c.$count=c.data.length,this.normalizeTreeRows(c.data,c.$level+1,c.id)):(delete c.data,delete c.$count,delete c.open))}),l}sortTree(l,s){l.sort(s),l.forEach(r=>{r.data&&this.sortTree(r.data,s)})}filterTree(l,s,r){return l.forEach(c=>{s(c)&&r.push(c.id),c.data&&this.filterTree(c.data,s,r)}),r}flattenRows(l,s,r){const c=s;return l.forEach(d=>{(!r||r.includes(d.id))&&c.push(d),d.data?.length&&d.open!==!1&&this.flattenRows(d.data,c,r)}),c}createFilter(l){const{_columns:s}=this.getState(),r=[];for(const c in l){const d=s.find(x=>x.id==c),{config:h,type:p}=d.header.find(x=>x.filter).filter,g=l[c];r.push(x=>{const b=Ai(x,d);return h?.handler?h.handler(b,g):$v(p)(b,g)})}return c=>{for(let d=0;d<r.length;d++)if(!r[d](c))return!1;return!0}}searchRows(l,s){l=l.trim().toLowerCase();const r={};if(!l)return r;const{flatData:c,columns:d}=this.getState(),h=s?d.filter(p=>s[p.id]):d;return c.forEach(p=>{const g={};h.forEach(x=>{const b=Ni(p,x);String(b).toLowerCase().includes(l)&&(g[x.id]=!0)}),Object.keys(g).length&&(r[p.id]=g)}),r}normalizeSizes(l,s,r,c,d){const h=Cx(l,"header",r,s.headerHeight,d),p=Cx(l,"footer",c,s.footerHeight,d),g=h.reduce((b,v)=>b+v,0),x=p.reduce((b,v)=>b+v,0);return{...s,headerRowHeights:h,footerRowHeights:p,headerHeight:g,footerHeight:x}}},h1=new Date().valueOf();function ru(){return"temp://"+h1++}function p1(a,l="data-id"){let s=a;for(!s.tagName&&a.target&&(s=a.target);s;){if(s.getAttribute&&s.getAttribute(l))return s;s=s.parentNode}return null}new Date().valueOf();var g1=class{constructor(){this.store=new Map}configure(a,l){this.node=l;for(const s in a)if(a[s]){const r=s.toLowerCase().replace(/[ ]/g,""),c=a[s];this.store.set(r,c)}}},ar=[],x1={subscribe:a=>{v1();const l=new g1;return ar.push(l),a(l),()=>{const s=ar.findIndex(r=>r===l);s>=0&&ar.splice(s,1)}}},jx=!1;function v1(){jx||(jx=!0,document.addEventListener("keydown",a=>{if(ar.length&&(a.ctrlKey||a.altKey||a.metaKey||a.shiftKey||a.key.length>1||a.key===" ")){const l=[];a.ctrlKey&&l.push("ctrl"),a.altKey&&l.push("alt"),a.metaKey&&l.push("meta"),a.shiftKey&&l.push("shift");let s=a.code.replace("Key","").toLocaleLowerCase();a.key===" "&&(s="space"),l.push(s);const r=l.join("+");for(let c=ar.length-1;c>=0;c--){const d=ar[c],h=d.store.get(r)||d.store.get(s);h&&d.node.contains(a.target)&&h(a,{key:r,evKey:s})}}}))}const y1={tab:!0,"shift+tab":!0,arrowup:!0,arrowdown:!0,arrowright:!0,arrowleft:!0,enter:!0,escape:!0,f2:!0,home:!0,end:!0,"ctrl+home":!0,"ctrl+end":!0,"ctrl+z":!0,"ctrl+y":!0};function b1(a,{keys:l,exec:s}){if(!l)return;function r(h){const p=h.target;return p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p1(p,"data-header-id")?.classList.contains("wx-filter")||!!p.closest(".wx-cell.wx-editor")}const c={};for(const h in l){const p=l[h];typeof p<"u"&&(typeof p=="function"?c[h]=p:p&&(c[h]=g=>{const x=r(g);s({key:h,event:g,isInput:x})}))}const d=x1.subscribe(h=>{h.configure(c,a)});return{destroy:()=>{d()}}}function w1(a,l){let s=null;l.scroll.subscribe(r=>{if(!r||r===s)return;s=r;const{left:c,top:d,height:h,width:p}=r,g=l.getHeight(),x=l.getWidth(),b=l.getScrollMargin();if(d>=0){const v=a.scrollTop;d<v?a.scrollTop=d:d+h>v+g&&(a.scrollTop=d-g+h)}if(c>=0){const v=a.scrollLeft;c<v?a.scrollLeft=c:c+p>v+x-b&&(a.scrollLeft=c-x+p+b)}}),l.scrollLeft?.subscribe?.(r=>{requestAnimationFrame(()=>{Math.abs(a.scrollLeft-r)>1&&(a.scrollLeft=r)})}),l.scrollTop?.subscribe?.(r=>{requestAnimationFrame(()=>{Math.abs(a.scrollTop-r)>1&&(a.scrollTop=r)})})}const oa=m.createContext(null);function S1(a,l){const s=new ResizeObserver(r=>{requestAnimationFrame(()=>l(r[0].contentRect))});return s.observe(a.parentNode),{destroy(){s.disconnect()}}}const Nx=5,M1=700;function hu(a){const l=a.getBoundingClientRect(),s=document.body,r=l.top+s.scrollTop-s.clientTop||0,c=l.left+s.scrollLeft-s.clientLeft||0;return{y:Math.round(r),x:Math.round(c),width:a.offsetWidth,height:a.offsetHeight}}function fm(a,l){const s=hu(l);return{x:a.clientX-s.x,y:a.clientY-s.y}}function C1(a,l){const s=l.current;let r=null,c,d,h=!1,p=!1;const g=document.createElement("DIV");g.className="wx-drag-zone",g.setAttribute("tabindex",-1);function x(){clearTimeout(c),c=null}function b(R){const ee=ir(R);ee&&(r={container:g,sourceNode:R.target,from:Eu(ee),pos:fm(R,a)},d=r.pos,v(R))}function v(R){if(!r)return;const ee=r.pos=fm(R,a);if(!h){if(!p&&!R?.target?.getAttribute("draggable-data")&&Math.abs(d.x-ee.x)<Nx&&Math.abs(d.y-ee.y)<Nx)return;if(I(R)===!1)return W()}if(p){const se=window.scrollX||document.documentElement.scrollLeft||document.body.scrollLeft,V=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop;r.targetNode=document.elementFromPoint(R.pageX-se,R.pageY-V)}else r.targetNode=R.target;s.move&&s.move(R,r),g.style.left=-(r.offset?r.offset.x:0)+"px",g.style.top=r.pos.y+(r.offset?r.offset.y:0)+"px"}function S(R){g.parentNode&&g.parentNode.removeChild(g),g.innerHTML="",h&&s.end&&s.end(R,r),r=d=null,W()}function M(R){s.getReorder&&!s.getReorder()||R.button===0&&(G(R),window.addEventListener("mousemove",C),window.addEventListener("mouseup",j),b(R))}function C(R){v(R)}function j(R){S(R)}function k(R){if(s.getReorder&&!s.getReorder())return;c=setTimeout(()=>{p=!0,b(R.touches[0])},M1),G(R);function ee(){c&&x(),R.target.removeEventListener("touchmove",T),R.target.removeEventListener("touchend",ee),S(R)}R.target.addEventListener("touchmove",T),R.target.addEventListener("touchend",ee),a.addEventListener("contextmenu",A)}function T(R){h?(R.preventDefault(),v(R.touches[0])):c&&x()}function A(R){if(h||c)return R.preventDefault(),!1}function z(R){R.preventDefault()}function G(R){if(!s.getDraggableInfo)return;const{hasDraggable:ee}=s.getDraggableInfo();(!ee||R.target.getAttribute("draggable-data"))&&(document.body.style.userSelect="none",document.body.style.webkitUserSelect="none")}function I(R){if(h=!0,s.start){if(s.start(R,r)===!1)return!1;a.appendChild(g),document.body.style.cursor="move"}}function W(R){h=p=!1,document.body.style.cursor="",document.body.style.userSelect="",document.body.style.webkitUserSelect="",window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",j),R&&(a.removeEventListener("mousedown",M),a.removeEventListener("touchstart",k),a.removeEventListener("dragstart",z))}return a.addEventListener("mousedown",M),a.addEventListener("touchstart",k),a.addEventListener("dragstart",z),{destroy(){W(!0)}}}const j1=.004;function N1(){return{dirX:0,dirY:0,scrollSpeedFactor:1}}function A1(a,l,s,r){const{node:c,left:d,top:h,bottom:p,sense:g,xScroll:x,yScroll:b}=r,v=fm(a,c);s.scrollState||(s.scrollState=N1());let S=0,M=0;v.x<d+g?S=-1:v.x>l.width-g&&(S=1),v.y<h+Math.round(g/2)?M=-1:v.y>l.height-p-Math.round(g/2)&&(M=1),(s.scrollState.dirX!==S||s.scrollState.dirY!==M)&&(Gv(s),s.scrollState.dirX=S,s.scrollState.dirY=M),(x&&s.scrollState.dirX!==0||b&&s.scrollState.dirY!==0)&&T1(s,r,{x:s.scrollState.dirX,y:s.scrollState.dirY})}function T1(a,l,s){a.autoScrollTimer||(a.autoScrollTimer=setTimeout(()=>{a.activeAutoScroll=setInterval(k1,15,a,l,s)},250))}function Gv(a){a.scrollSpeedFactor=1,a.autoScrollTimer&&(a.autoScrollTimer=clearTimeout(a.autoScrollTimer),a.activeAutoScroll=clearInterval(a.activeAutoScroll))}function k1(a,l,s){const{x:r,y:c}=s;a.scrollSpeedFactor+=j1,r!==0&&D1(a,l,r),c!==0&&E1(a,l,c)}function E1(a,l,s){const r=l.node.scrollTop;Yv(r+Math.round(l.sense/3)*a.scrollSpeedFactor*s,"scrollTop",l)}function D1(a,l,s){const r=l.node.scrollLeft;Yv(r+Math.round(l.sense/3)*a.scrollSpeedFactor*s,"scrollLeft",l)}function Yv(a,l,s){s.node[l]=a}function _u(a,l,s,r,c,d){const h={};return a&&(h.width=`${a}px`,h.minWidth=`${a}px`),l&&(h.flexGrow=l),d&&(h.height=`${d}px`),s&&(h.position="sticky",s.left&&(h.left=`${r}px`),s.right&&(h.right=`${c}px`)),h}function Vv(a,l,s){let r="";if(a.fixed)for(const c in a.fixed){let d=a.fixed[c]===-1;!d&&a.fixed.leftSize&&l.colspan&&(d=l.colspan+a._colindex-1===a.fixed.leftSize),r+=d?"wx-shadow ":"wx-fixed "}return r+=l.rowspan>1?"wx-rowspan ":"",r+=l.colspan>1?"wx-colspan ":"",r+=l.vertical?"wx-vertical ":"",r+=s?s(a)+" ":"",r}function R1(a){const{row:l,column:s,cellStyle:r=null,columnStyle:c=null,children:d,focusable:h}=a,p=m.useContext(oa),g=ze(p,"focusCell"),x=ze(p,"search"),b=ze(p,"reorder"),v=m.useMemo(()=>x?.rows[l.id]&&x.rows[l.id][s.id],[x,l.id,s.id]),S=m.useMemo(()=>_u(s.width,s.flexgrow,s.fixed,s.left,s.right),[s.width,s.flexgrow,s.fixed,s.left,s.right]);function M(I,W){let R="wx-cell";return R+=s.fixed?" "+(s.fixed===-1?"wx-shadow":"wx-fixed"):"",R+=I?" "+I(s):"",R+=W?" "+W(l,s):"",R+=s.treetoggle?" wx-tree-cell":"",R}const C=m.useMemo(()=>M(c,r),[c,r,s,l]),j=m.useMemo(()=>typeof s.draggable=="function"?s.draggable(l,s)!==!1:s.draggable,[s,l]),k=m.useRef(null);m.useEffect(()=>{k.current&&h&&g?.row===l.id&&g?.column===s.id&&k.current.focus()},[g,h,l.id,s.id]);const T=m.useCallback(()=>{h&&!g&&p.exec("focus-cell",{row:l.id,column:s.id,eventSource:"focus"})},[p,h,g,l.id,s.id]);function A(I){const W=new RegExp(`(${x.value.trim()})`,"gi");return String(I).split(W).map(R=>({text:R,highlight:W.test(R)}))}const z=m.useMemo(()=>{const I=s.fixed&&s.fixed.left===-1||s.fixed.right===-1,W=s.fixed&&s.fixed.right;return[C,I?"wx-shadow":"",W?"wx-fixed-right":""].filter(Boolean).join(" ")},[C,s]),G=s.cell;return o.jsxs("div",{className:"wx-TSCaXsGV "+z,ref:k,onFocus:T,style:S,"data-row-id":Wt(l.id),"data-col-id":Wt(s.id),tabIndex:h?"0":"-1",role:"gridcell","aria-colindex":s._colindex,"aria-readonly":s.editor?void 0:!0,children:[b&&s.draggable?j?o.jsx("i",{"draggable-data":"true",className:"wx-TSCaXsGV wx-draggable wxi-drag"}):o.jsx("i",{className:"wx-TSCaXsGV wx-draggable-stub"}):null,s.treetoggle?o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{marginLeft:`${l.$level*28}px`}}),l.$count?o.jsx("i",{"data-action":"toggle-row",className:`wx-TSCaXsGV wx-table-tree-toggle wxi-menu-${l.open!==!1?"down":"right"}`}):null]}):null,G?o.jsx(G,{api:p,row:l,column:s,onAction:({action:I,data:W})=>p.exec(I,W)}):d?d():v?o.jsx("span",{children:A(Ni(l,s)).map(({highlight:I,text:W},R)=>I?o.jsx("mark",{className:"wx-TSCaXsGV wx-search",children:W},R):o.jsx("span",{children:W},R))}):Ni(l,s)]})}function Ax(a,l){let s,r;function c(p){s=p.clientX,a.style.opacity=1,document.body.style.cursor="ew-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",d),window.addEventListener("mouseup",h),l&&l.down&&l.down(a)}function d(p){r=p.clientX-s,l&&l.move&&l.move(r)}function h(){a.style.opacity="",document.body.style.cursor="",document.body.style.userSelect="",l&&l.up&&l.up(r),window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",h)}return a.addEventListener("mousedown",c),{destroy(){a.removeEventListener("mousedown",c)}}}function L1({filter:a,column:l,action:s,filterValue:r}){function c({value:d}){s({value:d,key:l.id})}return o.jsx(Em,{...a.config??{},value:r,onChange:c})}function _1({filter:a,column:l,action:s,filterValue:r}){const c=m.useContext(oa),d=ze(c,"flatData"),h=m.useMemo(()=>a?.config?.options||l?.options||g(),[a,l,d]),p=m.useMemo(()=>a?.config?.template,[a]);function g(){const v=[];return d.forEach(S=>{const M=Ai(S,l);v.includes(M)||v.push(M)}),v.map(S=>({id:S,label:S}))}function x({value:v}){s({value:v,key:l.id})}function b(v){v.key!=="Tab"&&v.preventDefault()}return o.jsx("div",{style:{width:"100%"},onKeyDown:b,children:o.jsx(Qw,{placeholder:"",clear:!0,...a?.config??{},options:h,value:r,onChange:x,children:v=>p?p(v):v.label})})}function z1({filter:a,column:l,action:s,filterValue:r}){function c({value:d}){s({value:d,key:l.id})}return o.jsx("div",{className:"wx-aaaK5VYO",style:{width:"100%"},children:o.jsx(Pw,{placeholder:"",clear:!0,...a?.config??{},value:r,onChange:c})})}function Pv(a){const{value:l,options:s=[],placeholder:r="",clear:c=!1,text:d=null,template:h=null,cell:p=null,dropdown:g={},autoOpen:x=!1,onChange:b,onAction:v}=a,[S,M]=Dv(l||[]),C=m.useMemo(()=>(S||[]).map(V=>s.find(fe=>fe.id===V)).filter(Boolean),[S,s]),j=m.useRef(null),k=m.useRef(null),[T,A]=m.useState(null),z=()=>{const V=S||[];if(!V.length)return 0;const fe=s.find($=>V.includes($.id));return fe?s.indexOf(fe):0};function G(V){k.current=V.navigate,A(()=>V.keydown),x&&V.navigate(z())}m.useEffect(()=>{x&&(j.current?.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges())},[]);function I({id:V}){M(V),b&&b({value:V})}function W(V){V.stopPropagation(),M([]),b&&b({value:[]})}function R(){k.current?.(z())}function ee(){k.current?.(null)}function se(V){T?.(V,z())}return o.jsxs("div",{ref:j,className:"wx-multiselect wx-aadNNOwy",onClick:R,onKeyDown:se,tabIndex:0,children:[o.jsx("div",{className:"wx-label wx-aadNNOwy",children:h?h(C):p?o.jsx(p,{data:C,onAction:v}):d?o.jsx("span",{className:"wx-text wx-aadNNOwy",children:d}):C.length?o.jsx("span",{className:"wx-text wx-aadNNOwy",children:C.map(V=>V.label).join(", ")}):r?o.jsx("span",{className:"wx-placeholder wx-aadNNOwy",children:r}):" "}),c&&S?.length?o.jsx("i",{className:"wx-icon wxi-close wx-aadNNOwy",onClick:W}):o.jsx("i",{className:"wx-icon wxi-angle-down wx-aadNNOwy"}),o.jsx(Ru,{items:s,onReady:G,onSelect:I,multiselect:!0,checkboxes:!0,value:S||[],onCancel:ee,...g,children:({option:V})=>o.jsx("div",{className:"wx-option wx-aadNNOwy",children:h?h(V):p?o.jsx(p,{data:V,onAction:v}):V.label})})]})}function O1({filter:a,column:l,action:s,filterValue:r}){const c=m.useContext(en.i18n)?.getGroup("grid")||zo(Lm).getGroup("grid"),d=m.useMemo(()=>({clear:!0,...a?.config||{}}),[a]),h=m.useMemo(()=>d.options||l.options,[d,l]),p=m.useMemo(()=>{const b=r?.length;return b?b<3?r.map(v=>l.optionsMap.get(v)).join(", "):b+" "+c("selected"):""},[r,l,c]);function g({value:b}){s({value:b,key:l.id})}function x(b){b.key!=="Tab"&&b.preventDefault()}return o.jsx("div",{style:{width:"100%"},onKeyDown:x,children:o.jsx(Pv,{placeholder:"",...d,options:h,value:r||[],text:p,onChange:g})})}const B1={text:L1,richselect:_1,datepicker:z1,multiselect:O1};function H1({filter:a,column:l}){const s=m.useContext(oa),r=ze(s,"filterValues");function c(h){s.exec("filter-rows",h)}const d=m.useMemo(()=>B1[a.type],[a.type]);return o.jsx(d,{filter:a,column:l,action:c,filterValue:r[l.id]})}function F1(a){const{cell:l,column:s,row:r,lastRow:c,sortRow:d,columnStyle:h,bodyHeight:p,hasSplit:g}=a,x=m.useContext(oa),b=ze(x,"sortMarks"),v=m.useMemo(()=>b?b[s.id]:void 0,[b,s.id]),S=m.useRef(),M=m.useCallback(le=>{S.current=l.flexgrow?le.parentNode.clientWidth:l.width},[l.flexgrow,l.width]),C=m.useCallback((le,ue)=>{x.exec("resize-column",{id:l.id,width:Math.max(1,(S.current||0)+le),inProgress:ue})},[x,l.id]),j=m.useCallback(le=>C(le,!0),[C]),k=m.useCallback(le=>C(le,!1),[C]),T=m.useCallback(le=>{if(!s.sort||l.filter)return;let ue=v?.order;ue&&(ue=ue==="asc"?"desc":"asc"),x.exec("sort-rows",{key:l.id,add:le.ctrlKey||le.metaKey,order:ue})},[x,l.id,l.filter,s.sort,v?.order]),A=m.useCallback(le=>{le&&le.stopPropagation(),x.exec("collapse-column",{id:l.id,row:r})},[x,l.id,r]),z=m.useCallback(le=>{le.key==="Enter"&&A()},[A]),G=m.useCallback(le=>{le.key==="Enter"&&!l.filter&&T(le)},[T,l.filter]),I=m.useMemo(()=>l.collapsed&&s.collapsed,[l.collapsed,s.collapsed]),W=m.useMemo(()=>I&&!g&&l.collapsible!=="header",[I,g,l.collapsible]),R=m.useMemo(()=>W?{top:-p/2,position:"absolute"}:{},[W,p]),ee=m.useMemo(()=>_u(l.width,l.flexgrow,s.fixed,s.left,l.right??s.right,l.height+(I&&W?p:0)),[l.width,l.flexgrow,s.fixed,s.left,l.right,s.right,l.height,I,W,p]),se=m.useMemo(()=>Vv(s,l,h),[s,l,h]),V=m.useCallback(()=>Object.fromEntries(Object.entries(l).filter(([le])=>le!=="cell")),[l]),fe=`wx-cell ${se} ${l.css||""} wx-collapsed`,$=["wx-cell",se,l.css||"",l.filter?"wx-filter":"",s.fixed&&s.fixed.right?"wx-fixed-right":""].filter(Boolean).join(" "),oe=m.useRef(null);return m.useEffect(()=>{const le=oe.current;if(!le)return;const ue=Ax(le,{down:M,move:j,up:k});return()=>{typeof ue=="function"&&ue()}},[M,j,k,Ax]),I?o.jsx("div",{className:"wx-RsQD74qC "+fe,style:ee,role:"button","aria-label":`Expand column ${l.text||""}`,"aria-expanded":!l.collapsed,tabIndex:0,onKeyDown:z,onClick:A,"data-header-id":Wt(s.id),children:o.jsx("div",{className:"wx-RsQD74qC wx-text",style:R,children:l.text||""})}):o.jsxs("div",{className:"wx-RsQD74qC "+$,style:ee,onClick:T,"data-header-id":Wt(s.id),tabIndex:!l._hidden&&s.sort&&!l.filter?0:void 0,role:"columnheader","aria-colindex":s._colindex,"aria-colspan":l.colspan>1?l.colspan:void 0,"aria-rowspan":l.rowspan>1?l.rowspan:void 0,"aria-sort":!v?.order||l.filter?"none":v?.order==="asc"?"ascending":"descending",onKeyDown:G,children:[l.collapsible?o.jsx("div",{className:"wx-RsQD74qC wx-collapse",role:"button","aria-label":l.collapsed?"Expand column":"Collapse column","aria-expanded":!l.collapsed,tabIndex:0,onKeyDown:z,onClick:A,children:o.jsx("i",{className:`wx-RsQD74qC wxi-angle-${l.collapsed?"down":"right"}`})}):null,l.cell?(()=>{const le=l.cell;return o.jsx(le,{api:x,cell:V(),column:s,row:r,onAction:({action:ue,data:H})=>x.exec(ue,H)})})():l.filter?o.jsx(H1,{filter:l.filter,column:s}):o.jsx("div",{className:"wx-RsQD74qC wx-text",children:l.text||""}),s.resize&&c&&!l._hidden?o.jsx("div",{className:"wx-RsQD74qC wx-grip",role:"presentation","aria-label":"Resize column",ref:oe,onClick:le=>le.stopPropagation(),children:o.jsx("div",{})}):null,d?o.jsx("div",{className:"wx-RsQD74qC wx-sort",children:v?o.jsxs(o.Fragment,{children:[typeof v.index<"u"?o.jsx("div",{className:"wx-RsQD74qC wx-order",children:v.index+1}):null,o.jsx("i",{className:`wx-RsQD74qC wxi-arrow-${v.order==="asc"?"up":"down"}`})]}):null}):null]})}function I1({cell:a,column:l,row:s,columnStyle:r}){const c=m.useContext(oa),d=m.useMemo(()=>_u(a?.width,a?.flexgrow,l?.fixed,l?.left,a?.right??l?.right,a?.height),[a?.width,a?.flexgrow,l?.fixed,l?.left,a?.right,l?.right,a?.height]),h=m.useMemo(()=>Vv(l,a,r),[l,a,r]),p=m.useCallback(()=>Object.fromEntries(Object.entries(a||{}).filter(([x])=>x!=="cell")),[a]),g=`wx-6Sdi3Dfd wx-cell ${h||""} ${a?.css||""}`+(l?.fixed&&l?.fixed.right?" wx-fixed-right":"");return o.jsx("div",{className:g,style:d,children:!l?.collapsed&&!a?.collapsed?a?.cell?wm.createElement(a.cell,{api:c,cell:p(),column:l,row:s,onAction:({action:x,data:b})=>c.exec(x,b)}):o.jsx("div",{className:"wx-6Sdi3Dfd wx-text",children:a?.text||""}):null})}function Tx({deltaLeft:a,contentWidth:l,columns:s,type:r="header",columnStyle:c,bodyHeight:d}){const h=m.useContext(oa),p=ze(h,"_sizes"),g=ze(h,"split"),x=m.useMemo(()=>p?.[`${r}RowHeights`],[p,r]),b=m.useMemo(()=>{let j=[];if(s&&s.length){const k=s[0][r].length;for(let T=0;T<k;T++){let A=0;j.push([]),s.forEach((z,G)=>{const I={...z[r][T]};A||j[T].push(I),I.colspan>1?A=I.colspan-1:A&&A--})}}return j},[s,r]),v=m.useMemo(()=>g?.left||g?.right,[g]);function S(j){return s.find(k=>k.id===j)}function M(j,k){let T=k;return j.rowspan&&(T+=j.rowspan-1),T===b.length-1}function C(j,k,T){if(!T.sort)return!1;for(let A=b.length-1;A>=0;A--){const z=T.header[A];if(!z.filter&&!z._hidden)return k===A}return M(j,k)}return o.jsx("div",{className:`wx-sAsPVaUK wx-${r}`,style:{paddingLeft:`${a}px`,width:`${l}px`},role:"rowgroup",children:b.map((j,k)=>o.jsx("div",{className:r==="header"?"wx-sAsPVaUK wx-h-row":"wx-sAsPVaUK wx-f-row",style:{height:`${x?.[k]}px`,display:"flex"},role:"row",children:j.map(T=>{const A=S(T.id);return r==="header"?o.jsx(F1,{cell:T,columnStyle:c,column:A,row:k,lastRow:M(T,k),bodyHeight:d,sortRow:C(T,k,A),hasSplit:v},T.id):o.jsx(I1,{cell:T,columnStyle:c,column:S(T.id),row:k},T.id)})},k))})}function U1({overlay:a}){const l=m.useContext(oa);function s(c){return typeof c=="function"}const r=a;return o.jsx("div",{className:"wx-1ty666CQ wx-overlay",children:s(a)?o.jsx(r,{onAction:({action:c,data:d})=>l.exec(c,d)}):a})}function q1(a){const{editor:l,onSave:s,onApply:r}=a,[c,d]=m.useState(l?.value||""),{type:h="text"}=m.useMemo(()=>l?.config||{},[l]),p=m.useRef(null);m.useEffect(()=>{p.current&&p.current.focus()},[]),m.useEffect(()=>{if(!p.current)return;const b=ll(p.current,()=>s(!0));return()=>b.destroy()},[s]);function g(){p.current&&(d(p.current.value),r(p.current.value))}function x({key:b}){b==="Enter"&&s()}return o.jsx("input",{className:"wx-e7Ao5ejY wx-text",onInput:g,onKeyDown:x,ref:p,type:h,value:c})}function $1({editor:a,onAction:l,onSave:s,onApply:r,onCancel:c}){const[d,h]=m.useState(a?.value),[p,g]=m.useState(a?.renderedValue),[x,b]=m.useState(a?.options||[]),v=m.useMemo(()=>a?.config?.template,[a]),S=m.useMemo(()=>a?.config?.cell,[a]),M=m.useMemo(()=>a?.config?.dropdown||{},[a]),C=m.useMemo(()=>({trackScroll:!0,...M}),[M]),j=m.useMemo(()=>(x||[]).findIndex(R=>R.id===d),[x,d]),k=m.useRef(null),T=m.useRef(null),A=m.useCallback(R=>{k.current=R.navigate,T.current=R.keydown,k.current(j)},[j,k]),z=m.useCallback(R=>{const ee=R?.target?.value??"";g(ee);const se=ee?(a?.options||[]).filter(V=>(V.label||"").toLowerCase().includes(ee.toLowerCase())):a?.options||[];b(se),se.length?k.current(-1/0):k.current(null)},[a]),G=m.useRef(null);m.useEffect(()=>{G.current&&G.current.focus()},[]);const I=m.useRef(s);m.useEffect(()=>{I.current=s},[s]),m.useEffect(()=>{if(!G.current)return;const R=ll(G.current,()=>I.current(!0));return()=>R.destroy()},[]),m.useEffect(()=>{h(a?.value),g(a?.renderedValue),b(a?.options||[])},[a]);const W=m.useCallback(({id:R})=>{r(R),s()},[r,s]);return o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"wx-0UYfSd1x wx-input",ref:G,value:p??"",onChange:z,onKeyDown:R=>T.current?T.current(R,j):void 0}),o.jsx(Ru,{items:x,onReady:A,onSelect:W,...C,onCancel:c,children:({option:R})=>v?v(R):S?o.jsx(S,{data:R,onAction:l}):R.label})]})}function G1({editor:a,onAction:l,onSave:s,onApply:r,onCancel:c}){const[d]=m.useState(()=>a.value||new Date),{template:h,cell:p,dropdown:g={}}=a?.config||{},x=m.useMemo(()=>({trackScroll:!0,width:"auto",...g}),[g]);function b({value:C}){r(C),s()}const v=m.useRef(null),[S,M]=m.useState(null);return m.useEffect(()=>{v.current&&v.current.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges()},[]),m.useEffect(()=>{if(!S)return;const C=ll(S,()=>s(!0));return()=>C.destroy()},[S,s]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-lNWNYUb6 wx-value",ref:v,tabIndex:0,onClick:c,onKeyDown:C=>C.preventDefault(),children:h?h(d):p?o.jsx(p,{data:a.value,onAction:l}):o.jsx("span",{className:"wx-lNWNYUb6 wx-text",children:a.renderedValue})}),o.jsx(km,{...x,onCancel:c,children:o.jsx("div",{ref:M,className:"wx-lNWNYUb6",children:o.jsx(Nv,{value:d,onChange:b,buttons:a.config?.buttons})})})]})}function Y1(a){const{editor:l}=a,s=a.onAction??a.onaction,r=a.onSave??a.onsave,c=a.onApply??a.onapply,d=a.onCancel??a.oncancel,h=l.config||{},{dropdown:p={}}=h,g=m.useMemo(()=>({trackScroll:!0,...p}),[p]),[x]=m.useState(l.options.find(z=>z.id===l.value)),[b]=m.useState(l.value),[v]=m.useState(l.options),S=m.useMemo(()=>v.findIndex(z=>z.id===b),[v,b]);function M({id:z}){c(z),r()}let C;const[j,k]=m.useState();function T(z){C=z.navigate,k(()=>z.keydown),C(S)}const A=m.useRef(null);return m.useEffect(()=>{A.current&&A.current.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges()},[]),m.useEffect(()=>{if(!A.current)return;const z=ll(A.current,()=>r(!0));return()=>z.destroy()},[r]),o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:A,className:"wx-ywGRk611 wx-value",tabIndex:0,onClick:d,onKeyDown:z=>{j(z,S),z.preventDefault()},children:h.template?h.template(x):h.cell?(()=>{const z=h.cell;return o.jsx(z,{data:x,onAction:s})})():o.jsx("span",{className:"wx-ywGRk611 wx-text",children:l.renderedValue})}),o.jsx(Ru,{items:v,onReady:T,onSelect:M,...g,onCancel:d,children:({option:z})=>h.template?h.template(z):h.cell?(()=>{const G=h.cell;return o.jsx(G,{data:z,onAction:s})})():z.label})]})}function V1(a){const{editor:l,onAction:s,onSave:r,onApply:c}=a,d=l?.config||{},h=l?.options??[],p=l?.value||[],g=l?.renderedValue,x=m.useMemo(()=>({trackScroll:!0,...d.dropdown||{}}),[d]);function b({value:S}){c(S)}const v=m.useRef(null);return m.useEffect(()=>{if(!v.current)return;const S=ll(v.current,()=>r(!0));return()=>S.destroy()},[r]),o.jsx("div",{ref:v,className:"wx-value wx-aacZ4gNU",onClick:()=>r(!0),children:o.jsx(Pv,{value:p,options:h,text:g,template:d.template,cell:d.cell,clear:d.clear,dropdown:x,autoOpen:!0,onChange:b,onAction:s})})}const P1={text:q1,combo:$1,datepicker:G1,richselect:Y1,multiselect:V1};function Q1({column:a,row:l}){const s=m.useContext(oa),r=ze(s,"editor"),c=m.useCallback((C,j)=>{s.exec("close-editor",{ignore:C}),j&&s.exec("focus-cell",{...j,eventSource:"click"})},[s]),d=m.useCallback(C=>{const j=C?null:{row:r?.id,column:r?.column};c(!1,j)},[r,c]),h=m.useCallback(()=>{c(!0,{row:r?.id,column:r?.column})},[r,c]),p=m.useCallback(C=>{s.exec("editor",{value:C})},[s]),g=m.useCallback(C=>{C.key==="Enter"&&r&&(a.editor.type==="multiselect"?p(r.value):h())},[r,a.editor,h,p]),x=m.useMemo(()=>_u(a.width,a.flexgrow,a.fixed,a.left,a.right),[a.width,a.flexgrow,a.fixed,a.left,a.right]),b=m.useMemo(()=>{let C=a.editor;if(typeof C=="function"&&(C=C(l,a)),!C)return null;let j=typeof C=="string"?C:C.type;return P1[j]},[a,l]),v=m.useRef(null);m.useEffect(()=>{v.current&&typeof x=="string"&&v.current.setAttribute("style",x)},[x]);const S=typeof l.$parent<"u"?"gridcell":"cell",M=typeof l.$parent<"u"?!a.editor:void 0;return o.jsx("div",{className:"wx-8l724t2g wx-cell wx-editor",ref:v,style:typeof x=="object"&&x!==null?x:void 0,role:S,"aria-readonly":M,tabIndex:-1,onClick:C=>C.stopPropagation(),onDoubleClick:C=>C.stopPropagation(),onKeyDown:g,children:b?o.jsx(b,{editor:r,onSave:d,onApply:p,onCancel:h,onAction:({action:C,data:j})=>s.exec(C,j)}):null})}function kx(a){const{columns:l,type:s,columnStyle:r}=a,c=m.useContext(oa),{filterValues:d,_columns:h,_sizes:p}=c.getState();function g(x){return r?" "+r(x):""}return o.jsx(o.Fragment,{children:l.map((x,b)=>o.jsx("tr",{children:x.map(v=>{const S=h.find(j=>j.id===v.id),M=`wx-print-cell-${s}${g(S)}${v.filter?" wx-print-cell-filter":""}${v.vertical?" wx-vertical":""}`,C=v.cell;return o.jsx("th",{style:Rv(Uv(v,p.columnWidth)),className:"wx-Gy81xq2u "+M,rowSpan:v.rowspan,colSpan:v.colspan,children:C?o.jsx(C,{api:c,cell:Object.fromEntries(Object.entries(v).filter(([j])=>j!=="cell")),column:S,row:b}):v.filter?o.jsx("div",{className:"wx-Gy81xq2u wx-print-filter",children:WS(d,h,v)}):o.jsx("div",{className:"wx-Gy81xq2u wx-text",children:v.text??""})},v.id)})},b))})}function K1(a){const{columns:l,rowStyle:s,columnStyle:r,cellStyle:c,header:d,footer:h,reorder:p}=a,g=m.useContext(oa),{flatData:x,_sizes:b}=g.getState(),v=d&&Sx(l,"header",b.headerRowHeights),S=h&&Sx(l,"footer",b.footerRowHeights);function M(j,k){let T="";return T+=r?" "+r(k):"",T+=c?" "+c(j,k):"",T}function C(j,k){return typeof k.draggable=="function"?k.draggable(j,k)!==!1:k.draggable}return o.jsxs("table",{className:`wx-8NTMLH0z wx-print-grid ${l.some(j=>j.flexgrow)?"wx-flex-columns":""}`,children:[d?o.jsx("thead",{children:o.jsx(kx,{columns:v,type:"header",columnStyle:r})}):null,o.jsx("tbody",{children:x.map((j,k)=>o.jsx("tr",{className:"wx-8NTMLH0z wx-row"+(s?" "+s(j):""),style:{height:`${j.rowHeight||b.rowHeight}px`},children:l.map(T=>T.collapsed?null:o.jsxs("td",{className:`wx-8NTMLH0z wx-print-cell wx-cell ${M(j,T)}`,style:Rv(Uv(T,b.columnWidth)),children:[p&&T.draggable?o.jsx("span",{className:"wx-8NTMLH0z wx-print-draggable",children:C(j,T)?o.jsx("i",{className:"wx-8NTMLH0z wxi-drag"}):null}):null,T.treetoggle?o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{marginLeft:j.$level*28+"px"}}),j.$count?o.jsx("i",{className:`wx-8NTMLH0z wx-print-grid-tree-toggle wxi-menu-${j.open!==!1?"down":"right"}`}):null]}):null,T.cell?(()=>{const A=T.cell;return o.jsx(A,{api:g,row:j,column:T})})():o.jsx("span",{children:Ni(j,T)})]},T.id))},k))}),h?o.jsx("tfoot",{children:o.jsx(kx,{columns:S,type:"footer",columnStyle:r})}):null]})}function X1(a){const{config:l,...s}=a,r=m.useContext(oa),{_skin:c,_columns:d}=r.getState(),h=m.useMemo(()=>QS(d,l),[]),p=m.useRef(null);return m.useEffect(()=>{const g=document.body;g.classList.add("wx-print");const x=p.current;if(!x)return;const b=x.cloneNode(!0);g.appendChild(b);const v=`@media print { @page { size: ${l.paper} ${l.mode}; }`,S=document.createElement("style");S.setAttribute("type","text/css"),S.setAttribute("media","print"),document.getElementsByTagName("head")[0].appendChild(S),S.appendChild(document.createTextNode(v)),window.print(),S.remove(),g.classList.remove("wx-print"),b.remove()},[]),o.jsx("div",{className:`wx-4zwCKA7C wx-${c}-theme wx-print-container`,ref:p,children:h.map((g,x)=>o.jsx("div",{className:"wx-4zwCKA7C wx-print-grid-wrapper",children:o.jsx(K1,{columns:g,...s})},x))})}function Z1(a){const{header:l,footer:s,overlay:r,multiselect:c,onreorder:d,rowStyle:h,columnStyle:p,cellStyle:g,autoRowHeight:x,resize:b,clientWidth:v,clientHeight:S,responsiveLevel:M,hotkeys:C}=a,j=m.useContext(oa),k=ze(j,"dynamic"),T=ze(j,"_columns"),A=ze(j,"flatData"),z=ze(j,"split"),G=ze(j,"_sizes"),[I,W]=Aa(j,"selectedRows"),R=ze(j,"select"),ee=ze(j,"editor"),se=ze(j,"scrollLeft"),V=ze(j,"scrollTop"),fe=ze(j,"tree"),$=ze(j,"focusCell"),oe=ze(j,"_print"),le=ze(j,"undo"),ue=ze(j,"reorder"),H=ze(j,"_rowHeightFromData"),[X,te]=m.useState(0);m.useEffect(()=>{te(Ea())},[]);const[E,P]=m.useState(0),ne=m.useMemo(()=>(T||[]).some(Y=>!Y.hidden&&Y.flexgrow),[T]),L=m.useMemo(()=>G?.rowHeight||0,[G]),de=m.useRef(null),[ve,ge]=m.useState(null),[ke,qe]=m.useState(null),_e=m.useMemo(()=>{let Y=[],me=0;return z&&z.left&&(Y=(T||[]).slice(0,z.left).filter(we=>!we.hidden).map(we=>({...we})),Y.forEach(we=>{we.fixed={left:1,leftSize:z.left},we.left=me,me+=we.width}),Y.length&&(Y[Y.length-1].fixed.left=-1)),{columns:Y,width:me}},[z,T]),Ee=m.useMemo(()=>{let Y=[],me=0;if(z&&z.right){Y=(T||[]).slice(z.right*-1).filter(we=>!we.hidden).map(we=>({...we}));for(let we=Y.length-1;we>=0;we--){const Oe=Y[we];Oe.fixed={right:1},Oe.right=me,me+=Oe.width}Y.length&&(Y[0].fixed={right:-1})}return{columns:Y,width:me}},[z,T]),$e=m.useMemo(()=>{const Y=(T||[]).slice(z?.left||0,(T||[]).length-(z?.right??0)).filter(me=>!me.hidden);return Y.forEach(me=>{me.fixed=0}),Y},[T,z]),Ne=m.useMemo(()=>(T||[]).reduce((Y,me)=>(me.hidden||(Y+=me.width),Y),0),[T]),Mt=1;function tn(Y,me,we){let Oe=me,at=Y;if($e.length){let mt=$e.length;for(let Ae=Y;Ae>=0;Ae--)$e[Ae][we].forEach(Ze=>{Ze.colspan>1&&Ae>Y-Ze.colspan&&Ae<mt&&(mt=Ae)});if(mt!==$e.length&&mt<Y){for(let Ae=mt;Ae<Y;Ae++)Oe-=$e[Ae].width;at=mt}}return{index:at,delta:Oe}}const Xe=m.useMemo(()=>{let Y,me,we;const Oe=se||0,at=(se||0)+(v||0);let mt=0,Ae=0,Ze=0,nn=0;$e.forEach(($t,kt)=>{Oe>Ze&&(mt=kt,nn=Ze),Ze=Ze+$t.width,at>Ze&&(Ae=kt+Mt)});const qt={header:0,footer:0};for(let $t=Ae;$t>=mt;$t--)["header","footer"].forEach(kt=>{$e[$t]&&$e[$t][kt].forEach(as=>{const da=as.colspan;if(da&&da>1){const Dn=da-(Ae-$t+1);Dn>0&&(qt[kt]=Math.max(qt[kt],Dn))}})});const un=tn(mt,nn,"header"),xt=tn(mt,nn,"footer"),Tt=un.delta,gt=un.index,ul=xt.delta,dl=xt.index;return ne&&Ne>(v||0)?Y=me=we=[..._e.columns,...$e,...Ee.columns]:(Y=[..._e.columns,...$e.slice(mt,Ae+1),...Ee.columns],me=[..._e.columns,...$e.slice(gt,Ae+qt.header+1),...Ee.columns],we=[..._e.columns,...$e.slice(dl,Ae+qt.footer+1),...Ee.columns]),{data:Y||[],header:me||[],footer:we||[],d:nn,df:ul,dh:Tt}},[$e,_e,Ee,se,v,ne,Ne]),Kn=m.useMemo(()=>l&&G?.headerHeight||0,[l,G]),Xn=m.useMemo(()=>s&&G?.footerHeight||0,[s,G]),Lt=m.useMemo(()=>v&&S?Ne>=v:!1,[v,S,Ne]),[Vt,be]=m.useState(!1),gn=m.useMemo(()=>(S||0)-Kn-Xn-(Lt?X:0),[S,Kn,Xn,Lt,X]),De=m.useMemo(()=>Math.ceil((gn||0)/(L||1))+1,[gn,L]),pe=m.useRef([]),[je,Re]=m.useState(0),[It,xn]=m.useState(void 0),Ie=m.useMemo(()=>{let Y=0,me=0;const we=2,Oe=V||0;if(x){let Ae=Oe;for(;Ae>0;)Ae-=pe.current[Y]||L,Y++;me=Oe-Ae;for(let Ze=Math.max(0,Y-we-1);Ze<Y;Ze++)me-=pe.current[Y-Ze]||L;Y=Math.max(0,Y-we)}else{if(H){let Ae=0,Ze=0;for(let xt=0;xt<(A||[]).length;xt++){const Tt=A[xt].rowHeight||L;if(Ze+Tt>Oe){Ae=xt;break}Ze+=Tt}Y=Math.max(0,Ae-we);for(let xt=0;xt<Y;xt++)me+=A[xt].rowHeight||L;let nn=0,qt=0;for(let xt=Ae+1;xt<(A||[]).length;xt++){const Tt=A[xt].rowHeight||L;if(nn++,qt+Tt>gn)break;qt+=Tt}const un=Math.min(k?k.rowCount:(A||[]).length,Ae+nn+we);return{d:me,start:Y,end:un}}Y=Math.floor(Oe/(L||1)),Y=Math.max(0,Y-we),me=Y*(L||0)}const at=k?k.rowCount:(A||[]).length,mt=Math.min(at,Y+(De||0)+we);return{d:me,start:Y,end:mt}},[x,H,V,L,k,A,De,gn]),ca=m.useMemo(()=>{const Y=k?k.rowCount:(A||[]).length;if(x)return je+Ie.d+(Y-(It||0))*(L||0);if(!H)return Y*(L||0);let me=0;for(let we=0;we<Y;we++)me+=A[we]?.rowHeight||L;return me},[k,A,L,x,H,je,Ie.d,It]),Ta=m.useRef({});Ta.current={clientWidth:v,clientHeight:S,fullHeight:ca,headerHeight:Kn,footerHeight:Xn,fullWidth:Ne,SCROLLSIZE:X};const Nn=m.useCallback(()=>{const Y=Ta.current;be(Y.clientWidth&&Y.clientHeight?Y.fullHeight+Y.headerHeight+Y.footerHeight>=Y.clientHeight-(Y.fullWidth>=Y.clientWidth?Y.SCROLLSIZE:0):!1)},[]);m.useEffect(()=>{const Y=requestAnimationFrame(Nn);return()=>window.cancelAnimationFrame(Y)},[E,Nn]),m.useEffect(()=>{Nn()},[S,Nn]);const cn=m.useMemo(()=>ne&&Ne<=(v||0)?(v||0)-0-(Vt?X:0):Ne,[ne,Ne,v,Vt,X,Lt]),il=m.useMemo(()=>ne&&Ne<=(v||0)?v||0:cn<(v||0)?Ne+(Vt?X:0):-1,[ne,Ne,v,cn,Vt,X]),An=m.useRef({});m.useEffect(()=>{if(k&&(An.current.start!==Ie.start||An.current.end!==Ie.end)){const{start:Y,end:me}=Ie;An.current={start:Y,end:me},j&&j.exec&&j.exec("request-data",{row:{start:Y,end:me}})}},[k,Ie,j]);const nt=m.useMemo(()=>k?A||[]:(A||[]).slice(Ie.start,Ie.end),[k,A,Ie]),Pt=m.useMemo(()=>(I||[]).filter(Y=>(nt||[]).some(me=>me.id===Y)),[W,nt]),At=m.useMemo(()=>Ie.start,[Ie.start]),ns=m.useRef({top:V,left:se});ns.current={top:V,left:se};const Ti=m.useCallback(Y=>{const me=Y.target.scrollTop,we=Y.target.scrollLeft,Oe=ns.current;(me!==Oe.top||we!==Oe.left)&&j.exec("scroll-to",{top:me,left:we})},[j]),ki=m.useCallback(Y=>{Y.shiftKey&&Y.preventDefault(),de.current&&de.current.focus&&de.current.focus()},[]),sl=m.useCallback(()=>!!(T||[]).find(Y=>!!Y.draggable),[T]),ka=m.useRef(null),Tn=m.useRef(null),Zn=m.useRef({dblclick:(Y,me)=>{const we={id:Y,column:Ro(me,"data-col-id")};j.exec("open-editor",we)},click:(Y,me)=>{if(me.target.closest("input")||ka.current)return;const we=Ro(me,"data-col-id");if($?.id!==Y&&j.exec("focus-cell",{row:Y,column:we,eventSource:"click"}),R===!1)return;const Oe=c&&(me.ctrlKey||me.metaKey),at=c&&me.shiftKey;(Oe||I.length>1||!I.includes(Y))&&j.exec("select-row",{id:Y,toggle:Oe,range:at})},"toggle-row":Y=>{const me=j.getRow(Y);j.exec(me.open!==!1?"close-row":"open-row",{id:Y})},"ignore-click":()=>!1}),kn=m.useMemo(()=>({top:Kn,bottom:Xn,left:_e.width,xScroll:Lt,yScroll:Vt,sense:x&&ke?ke.offsetHeight:Math.max(G?.rowHeight||0,40),node:de.current&&de.current.firstElementChild}),[Kn,Xn,_e.width,Lt,Vt,x,ke,G]);function ua(Y,me){const{container:we,sourceNode:Oe,from:at}=me;if(sl()&&!Oe.getAttribute("draggable-data"))return!1;ge(at),fe&&j.getRow(at).open&&j.exec("close-row",{id:at,nested:!0});const mt=ir(Oe),Ae=mt.cloneNode(!0);Ae.classList.remove("wx-selected"),Ae.querySelectorAll("[tabindex]").forEach(un=>un.setAttribute("tabindex","-1")),we.appendChild(Ae),qe(Ae);const Ze=(se||0)-Xe.d,nn=Vt?X:0;we.style.width=Math.min((v||0)-nn,ne&&Ne<=(v||0)?cn:cn-nn)+Ze+"px";const qt=hu(mt);me.offset={x:Ze,y:-Math.round(qt.height/2)},Tn.current||(Tn.current=Y.clientY)}function Il(Y,me){const{from:we}=me,Oe=me.pos,at=hu(de.current);Oe.x=at.x;const mt=kn.top;if(Oe.y<mt)Oe.y=mt;else{const Ae=at.height-(Lt&&X>0?X:Math.round(kn.sense/2))-kn.bottom;Oe.y>Ae&&(Oe.y=Ae)}if(de.current.contains(me.targetNode)){const Ae=ir(me.targetNode),Ze=Ae&&Eu(Ae);if(Ze&&Ze!==we){me.to=Ze;const nn=x?ke?.offsetHeight:G?.rowHeight;if(ke&&((V||0)===0||Oe.y>mt+nn-1)){const qt=Ae.getBoundingClientRect(),un=hu(ke).y,xt=qt.y,Tt=un>xt?-1:1,gt=Tt===1?"after":"before",ul=j.getState().flatData,dl=Math.abs(ul.findIndex(kt=>kt.id===we)-ul.findIndex(kt=>kt.id===Ze)),$t=dl!==1?gt==="before"?"after":"before":gt;if(dl===1&&(Tt===-1&&Y.clientY>Tn.current||Tt===1&&Y.clientY<Tn.current))return;Tn.current=Y.clientY,j.exec("move-item",{id:we,target:Ze,mode:$t,inProgress:!0})}}d&&d({event:Y,context:me})}A1(Y,at,me,kn)}function rl(Y,me){const{from:we,to:Oe}=me;j.exec("move-item",{id:we,target:Oe,inProgress:!1}),ka.current=setTimeout(()=>{ka.current=0},1),ge(null),qe(null),Tn.current=null,Gv(me)}function Ea(){const Y=document.createElement("div");Y.style.cssText="position:absolute;left:-1000px;width:100px;padding:0px;margin:0px;min-height:100px;overflow-y:scroll;",document.body.appendChild(Y);const me=Y.offsetWidth-Y.clientWidth;return document.body.removeChild(Y),me}const Da=m.useMemo(()=>il>0?{width:`${il}px`}:void 0,[il]),$a=m.useRef(null);function ol(){Promise.resolve().then(()=>{let Y=0,me=At;const we=$a.current;we&&(Array.from(we.children).forEach((Oe,at)=>{pe.current[At+at]=Oe.offsetHeight,Y+=Oe.offsetHeight,me++}),Re(Y),xn(me))})}m.useEffect(()=>{nt&&x&&ol()},[nt,x,At]);let[En,Ra]=m.useState();m.useEffect(()=>{if($&&(!R||!Pt.length||Pt.includes($.row)))Ra({...$});else if(nt.length&&Xe.data.length){if(!En||Pt.length&&!Pt.includes(En.row)||nt.findIndex(Y=>Y.id===En.row)===-1||Xe.data.findIndex(Y=>Y.id===En.column&&!Y.collapsed)===-1){const Y=Pt[0]||nt[0].id,me=Xe.data.findIndex(we=>!we.collapsed);Ra(me!==-1?{row:Y,column:Xe.data[me].id}:null)}}else Ra(null)},[$]);const Ga=m.useRef(null);m.useEffect(()=>{const Y=de.current;if(!Y)return;const me=S1(Y,b);return()=>{typeof me=="function"&&me()}},[b]);const cl=m.useRef({});Object.assign(cl.current,{start:ua,move:Il,end:rl,getReorder:()=>ue,getDraggableInfo:()=>({hasDraggable:sl()})}),m.useEffect(()=>{const Y=de.current;return Y?C1(Y,cl).destroy:void 0},[ue,de.current]),m.useEffect(()=>{const Y=de.current;return Y?b1(Y,{keys:C!==!1&&{...y1,"ctrl+z":le,"ctrl+y":le,...C},exec:me=>j.exec("hotkey",me)}).destroy:void 0},[j,le,C]);const vn=m.useRef({scroll:j.getReactiveState().scroll,scrollLeft:j.getReactiveState().scrollLeft,scrollTop:j.getReactiveState().scrollTop});vn.current.getWidth=()=>(v||0)-(Vt?X:0),vn.current.getHeight=()=>gn,vn.current.getScrollMargin=()=>_e.width+Ee.width,m.useEffect(()=>{w1(Ga.current,vn.current)},[]);const Wn=m.useRef(null);m.useEffect(()=>{const Y=Wn.current;if(!Y)return;const me=[];me.push(ll(Y,()=>$&&j.exec("focus-cell",{eventSource:"click"})).destroy),me.push(CS(Y,Zn.current)),P(Y.clientHeight);const we=new ResizeObserver(()=>{P(Y.clientHeight)});return we.observe(Y),me.push(()=>we.disconnect()),()=>me.forEach(Oe=>Oe())},[]);const Ut=`wx-grid ${M?`wx-responsive-${M}`:""}`;return m.useEffect(()=>{$&&(nt.some(Y=>Y.id===$.row)&&Xe.data.some(Y=>Y.id===$.column&&!Y.collapsed)||j.exec("focus-cell",{eventSource:"destroy"}))},[$,nt,Xe.data,j]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-4VuBwK2D "+Ut,style:{"--header-height":`${Kn}px`,"--footer-height":`${Xn}px`,"--split-left-width":`${_e.width}px`,"--split-right-width":`${Ee.width}px`},children:o.jsx("div",{ref:de,className:"wx-4VuBwK2D wx-table-box",style:Da,role:fe?"treegrid":"grid","aria-colcount":Xe.data.length,"aria-rowcount":nt.length,"aria-multiselectable":fe&&c?!0:void 0,tabIndex:-1,children:o.jsxs("div",{ref:Ga,className:"wx-4VuBwK2D wx-scroll",style:{overflowX:Lt?"scroll":"hidden",overflowY:Vt?"scroll":"hidden"},onScroll:Ti,children:[l?o.jsx("div",{className:"wx-4VuBwK2D wx-header-wrapper",children:o.jsx(Tx,{contentWidth:cn,deltaLeft:Xe.dh,columns:Xe.header,columnStyle:p,bodyHeight:gn-+s})}):null,o.jsxs("div",{ref:Wn,className:"wx-4VuBwK2D wx-body",style:{width:`${cn}px`,height:`${ca}px`},onMouseDown:Y=>ki(Y),children:[r?o.jsx(U1,{overlay:r}):null,o.jsx("div",{ref:$a,className:"wx-4VuBwK2D wx-data",style:{paddingTop:`${Ie.d}px`,paddingLeft:`${Xe.d}px`},children:nt.map((Y,me)=>{const we=I.indexOf(Y.id)!==-1,Oe=ve===Y.id,at="wx-row"+(x?" wx-autoheight":"")+(h?" "+h(Y):"")+(we?" wx-selected":"")+(Oe?" wx-inactive":""),mt=x?{minHeight:`${Y.rowHeight||L}px`}:{height:`${Y.rowHeight||L}px`};return o.jsx("div",{className:"wx-4VuBwK2D "+at,"data-id":Wt(Y.id),"data-context-id":Wt(Y.id),style:mt,role:"row","aria-rowindex":me,"aria-expanded":Y.open,"aria-level":fe?Y.$level+1:void 0,"aria-selected":fe?we:void 0,tabIndex:-1,children:Xe.data.map(Ae=>Ae.collapsed?o.jsx("div",{className:"wx-4VuBwK2D wx-cell wx-collapsed"},Ae.id):ee?.id===Y.id&&ee.column===Ae.id?o.jsx(Q1,{row:Y,column:Ae},Ae.id):o.jsx(R1,{row:Y,column:Ae,columnStyle:p,cellStyle:g,reorder:ue,focusable:En?.row===Y.id&&En?.column===Ae.id},Ae.id))},Y.id)})})]}),s&&(A||[]).length?o.jsx(Tx,{type:"footer",contentWidth:cn,deltaLeft:Xe.df,columns:Xe.footer,columnStyle:p}):null]})})}),oe?o.jsx(X1,{config:oe,rowStyle:h,columnStyle:p,cellStyle:g,header:l,footer:s,reorder:ue}):null]})}const W1=a=>a.split("-").map(l=>l?l.charAt(0).toUpperCase()+l.slice(1):"").join(""),J1=m.forwardRef(function({data:a=[],columns:l=[],rowStyle:s=null,columnStyle:r=null,cellStyle:c=null,selectedRows:d,select:h=!0,multiselect:p=!1,header:g=!0,footer:x=!1,dynamic:b=null,overlay:v=null,reorder:S=!1,onReorder:M=null,autoRowHeight:C=!1,sizes:j,split:k,tree:T=!1,autoConfig:A=!1,init:z=null,responsive:G=null,sortMarks:I,undo:W=!1,hotkeys:R=null,filterValues:ee,...se},V){const fe=m.useRef();fe.current=se;const $=m.useMemo(()=>new m1(Lv),[]),oe=m.useMemo(()=>$.in,[$]),le=m.useRef(null);le.current===null&&(le.current=new Av((Ee,$e)=>{const Ne="on"+W1(Ee);fe.current&&fe.current[Ne]&&fe.current[Ne]($e)}),oe.setNext(le.current));const ue=m.useMemo(()=>({getState:$.getState.bind($),getReactiveState:$.getReactive.bind($),getStores:()=>({data:$}),exec:oe.exec,setNext:Ee=>(le.current=le.current.setNext(Ee),le.current),intercept:oe.intercept.bind(oe),on:oe.on.bind(oe),detach:oe.detach.bind(oe),getRow:$.getRow.bind($),getColumn:$.getColumn.bind($)}),[$,oe]),[H,X]=m.useState(0),[te,E]=m.useState(0),[P,ne]=m.useState(null),[L,de]=m.useState(null),ve=m.useMemo(()=>{if(A&&!l.length&&a.length){const Ee=a[0],$e=[];for(let Ne in Ee)if(Ne!=="id"&&Ne[0]!=="$"){let Mt={id:Ne,header:Ne[0].toUpperCase()+Ne.slice(1)};typeof A=="object"&&(Mt={...Mt,...A}),$e.push(Mt)}return $e}return(L&&L.columns)??l},[A,l,a,L]),ge=m.useMemo(()=>(L&&L.sizes)??j,[L,j]),ke=m.useCallback(Ee=>{if(X(Ee.width),E(Ee.height),G){const $e=Object.keys(G).map(Number).sort((Ne,Mt)=>Ne-Mt).find(Ne=>Ee.width<=Ne)??null;$e!==P&&(de(G[$e]),ne($e))}},[G,P]),qe=m.useContext(en.theme),_e=m.useRef(0);return m.useEffect(()=>{if(!_e.current)z&&z(ue);else{const Ee=$.getState();$.init({data:a,columns:ve,split:k||Ee.split,sizes:ge||Ee.sizes,selectedRows:d||Ee.selectedRows,dynamic:b,tree:T,sortMarks:I||Ee.sortMarks,filterValues:ee||Ee.filterValues,undo:W,reorder:S,_skin:qe,_select:h})}_e.current++},[$,a,ve,k,ge,d,b,T,I,ee,W,S,qe,h,z,ue]),_e.current===0&&$.init({data:a,columns:ve,split:k||{left:0},sizes:ge||{},selectedRows:d||[],dynamic:b,tree:T,sortMarks:I||{},filterValues:ee||{},undo:W,reorder:S,_skin:qe,select:h}),m.useImperativeHandle(V,()=>({...ue}),[ue]),o.jsx(oa.Provider,{value:ue,children:o.jsx(Rm,{words:Lm,optional:!0,children:o.jsx(Z1,{header:g,footer:x,overlay:v,rowStyle:s,columnStyle:r,cellStyle:c,onReorder:M,multiselect:p,autoRowHeight:C,clientWidth:H,clientHeight:te,responsiveLevel:P,resize:ke,hotkeys:R})})})});jm(Qn);const Jt=m.createContext(null),Om=m.createContext(null),Bm=m.createContext(null);function eM({children:a}){const l=m.useContext(en.i18n),s=m.useMemo(()=>l.getGroup("filemanager"),[l]),r=m.useContext(Jt),[c]=Aa(r,"panels"),d=ze(r,"activePanel"),h=c[d].path,[p,g]=m.useState(null),[x,b]=m.useState(null),[v,S]=m.useState(""),[M,C]=m.useState(""),[j,k]=m.useState(!1);function T(){const I=v.trim();if(!I){k(!0);return}p.add?r.exec("create-file",{file:{...p.item,name:I},parent:h}):M!==I&&r.exec("rename-file",{id:p.item.id,name:I}),A()}function A(){g(null),k(null),C(""),S("")}function z(){r.exec("delete-files",{ids:x.selected}),b(null)}const G=m.useMemo(()=>({showPrompt(I){const W=I.item.name||(I.item.type==="folder"?s("New folder"):`${s("New file")}.txt`);C(W),S(W),g({...I})},showConfirm(I){b({...I})}}),[s]);return o.jsxs(Om.Provider,{value:G,children:[o.jsx(eS,{children:a}),p?o.jsx(um,{title:s(`Enter ${p.item.type} name`),onConfirm:T,onCancel:A,children:o.jsx(Em,{error:j,select:!0,focus:!0,value:v,onChange:({value:I})=>S(I)})}):null,x?o.jsx(um,{title:s("Are you sure you want to delete these items:"),onConfirm:z,onCancel:()=>b(null),children:x.selected?o.jsx("ul",{className:"wx-gq7BMzEP wx-list",children:x.selected.map((I,W)=>o.jsx("li",{children:I},W))}):null}):null]})}let Ex={"7z":!0,rar:!0,zip:!0,css:!0,html:!0,js:!0,php:!0,md:!0,xml:!0,sql:!0,aif:!0,mid:!0,mp3:!0,waw:!0,wma:!0,doc:!0,docx:!0,txt:!0,avi:!0,mov:!0,mp4:!0,mpeg:!0,mpg:!0,pdf:!0,xls:!0,xlsx:!0,gif:!0,jpg:!0,jpeg:!0,png:!0,psd:!0,tiff:!0,svg:!0,folder:!0,file:!0,multiple:!0,search:!0,none:!0};function tM(a){const l=a.lastIndexOf("."),s=l>0&&l<a.length-1?Math.min(10,a.length-l):Math.min(5,a.length),r=a.slice(0,-s),c=a.slice(-s);return[r,c]}function nM({item:a}){const l=m.useContext(Jt),s=m.useContext(en.i18n).getGroup("filemanager"),r=m.useContext(Jt).templates,[c]=Aa(l,"panels"),d=ze(l,"activePanel"),h=ze(l,"mode"),p=c[d].selected,g=m.useMemo(()=>r.preview(a,214,163),[r,a]),x=m.useMemo(()=>r.icon(a,"big"),[r,a]),[b,v]=m.useMemo(()=>tM(a.name),[a.name]);return o.jsx(o.Fragment,{children:a.id==="/wx-filemanager-parent-link"?h!=="search"?o.jsx("div",{className:"wx-GAOa4kDV wx-back-item",children:o.jsxs("div",{className:`wx-GAOa4kDV wx-back ${a.navigation?"wx-selected":""}`,"data-id":Wt("/wx-filemanager-parent-link"),children:[o.jsx("i",{className:"wx-GAOa4kDV wxi-arrow-left"}),o.jsx("span",{children:s("Back to parent folder")})]})}):null:o.jsxs("div",{className:`wx-GAOa4kDV wx-item ${p?.length&&p.indexOf(a.id)>=0?"wx-selected":""}`,"data-id":Wt(a.id),children:[g?o.jsx("div",{className:"wx-GAOa4kDV wx-preview wx-file-preview",children:o.jsx("img",{className:"wx-GAOa4kDV wx-card-preview",alt:s("A miniature file preview"),src:g})}):x?o.jsx("div",{className:"wx-GAOa4kDV wx-preview wx-file-icon",children:o.jsx("img",{className:"wx-GAOa4kDV wx-card-preview",alt:"",src:x})}):o.jsx("div",{className:"wx-GAOa4kDV wx-preview",children:o.jsx("i",{className:`wx-GAOa4kDV wxi-${a.type}`})}),a.type==="folder"?o.jsxs("div",{className:"wx-GAOa4kDV wx-info",children:[o.jsxs("div",{className:"wx-GAOa4kDV wx-folder-name",children:[o.jsx("span",{className:"wx-GAOa4kDV wx-type",children:s("Folder")}),o.jsxs("span",{className:"wx-GAOa4kDV wx-name",children:[o.jsx("span",{children:b}),o.jsx("span",{children:v})]})]}),o.jsx("div",{"data-action-id":Wt(a.id),className:"wx-GAOa4kDV wx-more",children:o.jsx("i",{className:"wx-GAOa4kDV wxi-dots-v"})})]}):o.jsxs("div",{className:"wx-GAOa4kDV wx-info",children:[o.jsx("div",{className:"wx-GAOa4kDV wx-file-name",children:o.jsxs("span",{className:"wx-GAOa4kDV wx-name",children:[o.jsx("span",{children:b}),o.jsx("span",{children:v})]})}),o.jsx("div",{"data-action-id":Wt(a.id),className:"wx-GAOa4kDV wx-more",children:o.jsx("i",{className:"wx-GAOa4kDV wxi-dots-v"})})]})]})})}function Qv(){const a=m.useContext(Jt),l=m.useContext(en.i18n),s=m.useMemo(()=>l.getGroup("filemanager"),[l]),[r]=Aa(a,"panels"),c=ze(a,"activePanel"),d=ze(a,"mode"),h=r[c]._files,p=r[c].selected,g=r[c].path,x=r[c]._crumbs,b=r[c]._selectNavigation,v=m.useCallback((A,z)=>{const G=z&&(z.ctrlKey||z.metaKey),I=z&&z.shiftKey;if(A==="/wx-filemanager-parent-link"){if(p.length&&(G||I))return;a.exec("select-file",{type:"navigation"});return}let W=A==="body"&&z?null:A;const R=z.target.className.indexOf("wx-more")!==-1||z.target.className.indexOf("wxi-dots-v")!==-1;setTimeout(()=>{a.exec("select-file",{id:W,toggle:G&&!R,range:I&&!R,panel:c})},1)},[a,p,c]),S=m.useCallback(()=>{x.length>1&&a.exec("set-path",{id:x[x.length-2].id,panel:c,selected:[x[x.length-1].id]})},[a,x,c]),M=m.useCallback(A=>{if(A==="/wx-filemanager-parent-link")return S();d==="search"&&a.exec("filter-files",{text:""});const z=h.find(G=>G.id===A);z&&(z.type=="folder"?a.exec("set-path",{id:z.id,panel:c}):a.exec("open-file",{id:z.id}))},[a,S,d,h,c]),C=m.useCallback((A,z)=>{(!p?.length||!p.filter(G=>G?.id===A).length>0)&&v(A,z)},[p,v]),j=m.useMemo(()=>g!=="/"?[{id:"/wx-filemanager-parent-link",name:s("Back to parent folder"),navigation:b},...h]:h,[g,s,b,h]),k=m.useRef(null),T=m.useRef();return m.useEffect(()=>{k.current&&(T.current?(T.current.click=v,T.current._dblclick=M,T.current.context=C):(T.current={click:v,dblclick:A=>T.current._dblclick(A),_dblclick:M,context:C},sr(k.current,T.current)))},[v,M,C]),d=="search"&&!j.length?o.jsx("div",{className:"wx-iyjASZCY wx-not-found",children:o.jsx("div",{className:"wx-iyjASZCY wx-not-found-text",children:s("Looks like nothing is here")})}):o.jsx("div",{tabIndex:0,className:"wx-iyjASZCY "+("wx-cards"+(g!=="/"&&d!=="search"?" wx-has-back-link":"")),"data-id":Wt("body"),ref:k,children:j.map(A=>o.jsx(nM,{item:A},A.id))})}function es({name:a="",spin:l=!1,onClick:s}){return o.jsx("i",{"data-menu-ignore":"true",className:`wx-uwcvNSAG wx-icon wxi-${a} ${l?"wx-spin":""} ${s?"wx-clickable":""}`,onClick:()=>{s&&s()}})}function aM(){const a=m.useContext(en.i18n).getGroup("filemanager"),l=m.useContext(Jt),s=ze(l,"activePanel"),[r]=Aa(l,"panels"),c=m.useMemo(()=>r[s]._crumbs,[r,s]);function d(){l.exec("filter-files",{text:""})}return o.jsxs("div",{className:"wx-GDJvtROw wx-search",children:[o.jsxs("div",{className:"wx-GDJvtROw wx-toolbar",children:[o.jsx("div",{className:"wx-GDJvtROw wx-back-icon",children:o.jsx(es,{name:"angle-left",onClick:d})}),o.jsxs("div",{className:"wx-GDJvtROw wx-text",children:[a("Search results in")," ",Array.isArray(c)&&c.map((h,p)=>o.jsxs(m.Fragment,{children:[p?"/":null,h.id=="/"?a(h.name):h.name]},p))]})]}),o.jsx(Qv,{})]})}function qf({narrowMode:a,extraInfo:l}){const s=m.useContext(Jt),{preview:r,icon:c}=s.templates,d=m.useContext(en.i18n),h=m.useMemo(()=>d.getGroup("filemanager"),[d]),p=m.useMemo(()=>nr("%D, %d %F %Y, %H:%i",d.getRaw().calendar),[d]),[g,x]=Aa(s,"panels"),b=ze(s,"activePanel"),v=ze(s,"preview"),S=ze(s,"search"),M=m.useMemo(()=>{const R=g&&b!=null&&g[b]?._selected?.length||0;return S&&!R},[S,x,b]),C=m.useMemo(()=>{const R=g&&b!=null?g[b]:null;return R?M?R._files:R._selected:[]},[M,x,b]),j=m.useCallback((R,ee)=>(R?`${R} ${h(R>1?"folders":"folder")} `:"")+(ee?`${ee} ${h(ee>1?"files":"file")}`:""),[h]),k=m.useCallback(()=>{s.exec("show-preview",{mode:!v})},[s,v]),T=m.useCallback(R=>R.type==="folder"?h("Folder"):R.ext||h("Unknown file"),[h]),A=m.useMemo(()=>{let R,ee,se,V,fe,$,oe,le;if(C.length===1&&!M){ee=C[0],R=ee.name;const ue=r(ee,400,500);ue?(se=ue,V=""):(V=c(ee,"big"),se=""),fe=ee.type!=="folder"}else{if(ee=fe=null,R="",C.length){let ue=0,H=0,X=0,te=[],E;C.forEach(ne=>{typeof ne.size>"u"&&(E=!0,ue=void 0),E||(ue+=ne.size),te.push(T(ne)),ne.type==="folder"?H++:X++});const P=new Set(te);$=P.size>1?h("multiple"):[...P][0],oe=j(H,X),le=ue,M||(R=h("Multiple files"))}V=c({type:M?"search":C.length?"multiple":"none"},"big"),se=""}return{name:R,item:ee,previewSrc:se,iconSrc:V,showDownloadIcon:fe,type:$,totalCount:oe,totalSize:le}},[C,M,r,c,h,T,j]),z=m.useCallback(()=>{s.exec("download-file",{id:C[0].id})},[s,C]),G=m.useCallback(async R=>{if(!l||!R)return null;try{return await l(R)}catch(ee){return console.log(ee),null}},[l]),[I,W]=m.useState(null);return m.useEffect(()=>{let R=!1;return W(null),Promise.resolve(G(A.item)).then(ee=>{R||W(ee)}).catch(()=>{R||W(null)}),()=>{R=!0}},[G,A.item]),o.jsx("div",{className:"wx-O0BTtRrH wx-wrapper",children:C&&C.length?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"wx-O0BTtRrH wx-preview",children:[o.jsxs("div",{className:"wx-O0BTtRrH wx-toolbar",children:[o.jsx("div",{className:"wx-O0BTtRrH wx-name",children:A.name}),o.jsxs("div",{className:"wx-O0BTtRrH wx-icons",children:[A.showDownloadIcon?o.jsx(es,{name:"download",onClick:z}):null,a?o.jsx(es,{name:"close",onClick:k}):null]})]}),A.previewSrc?o.jsx("div",{className:"wx-O0BTtRrH wx-img-wrapper",children:o.jsx("img",{src:A.previewSrc,alt:h("A miniature file preview")})}):A.iconSrc?o.jsx("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:o.jsx("img",{src:A.iconSrc,alt:h("A miniature file preview")})}):o.jsx("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:A.item?o.jsx("i",{className:`wx-O0BTtRrH wx-icon wxi-${A.item.type}`}):o.jsx("i",{className:`wx-O0BTtRrH wx-icon wxi-${M?"search":"file-multiple-outline"}`})})]}),o.jsxs("div",{className:"wx-O0BTtRrH wx-info-panel",children:[o.jsx("div",{className:"wx-O0BTtRrH wx-title",children:h(M?"Found":"Information")}),o.jsxs("div",{className:"wx-O0BTtRrH wx-list",children:[A.item?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:h("Type")}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:T(A.item)}),typeof A.item.size<"u"?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:h("Size")}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:Lo(A.item.size)})]}):null,o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:h("Date")}),o.jsxs("span",{className:"wx-O0BTtRrH wx-value",children:[p(A.item.date)," "]})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:h("Count")}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:A.totalCount}),o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:h("Type")}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:A.type}),typeof A.totalSize<"u"?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:h("Size")}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:Lo(A.totalSize)})]}):null]}),I?Object.entries(I).map(([R,ee])=>o.jsxs(wm.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:R}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:ee})]},R)):null]})]})]}):o.jsxs("div",{className:"wx-O0BTtRrH wx-no-info-panel",children:[o.jsxs("div",{className:"wx-O0BTtRrH wx-toolbar",children:[o.jsx("div",{className:"wx-O0BTtRrH wx-name",children:A.name}),o.jsx("div",{className:"wx-O0BTtRrH wx-icons",children:a?o.jsx(es,{name:"close",onClick:k}):null})]}),o.jsx("div",{className:"wx-O0BTtRrH wx-no-info-wrapper",children:o.jsxs("div",{className:"wx-O0BTtRrH wx-no-info",children:[A.previewSrc?o.jsx("div",{className:"wx-O0BTtRrH wx-img-wrapper",children:o.jsx("img",{src:A.previewSrc,alt:h("A miniature file preview")})}):A.iconSrc?o.jsx("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:o.jsx("img",{src:A.iconSrc,alt:h("A miniature file preview")})}):o.jsx("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:o.jsx("i",{className:`wx-O0BTtRrH wx-icon wxi-${M?"search":"message-question-outline"}`})}),o.jsx("span",{className:"wx-O0BTtRrH wx-text",children:M?"":h("Select file or folder to view details")})]})})]})})}function Kv({panel:a}){const l=m.useContext(Jt),s=m.useContext(en.i18n),r=m.useMemo(()=>s.getGroup("filemanager"),[s]),[c,d]=Aa(l,"panels"),h=m.useMemo(()=>c[a]._files,[d,a]),p=m.useMemo(()=>c[a]._crumbs||[],[d,a]);function g(C){const j=_m(C,p);l.exec("set-path",{id:C,panel:a,...j&&{selected:[j]}})}const[x,b]=m.useState(null);m.useEffect(()=>{h&&b(null)},[h]);function v(){b(!0),l.exec("request-data",{id:p[p.length-1].id}),setTimeout(()=>{b(null)},5e3)}const S=m.useRef(null),M=m.useRef();return m.useEffect(()=>{M.current?M.current.click=g:(M.current={click:g},sr(S.current,M.current))},[g]),o.jsxs("div",{className:"wx-SNY5LTYx wx-breadcrumbs","data-menu-ignore":"true",ref:S,children:[o.jsx("div",{className:"wx-SNY5LTYx wx-refresh-icon",children:o.jsx(es,{name:"refresh",spin:!!x,onClick:v})}),p.map((C,j)=>o.jsxs(wm.Fragment,{children:[j?o.jsx(es,{name:"angle-right"}):null,o.jsx("div",{className:"wx-SNY5LTYx wx-item","data-id":Wt(C.id),"data-menu-ignore":"true",children:C.id=="/"?r(C.name):C.name})]},j))]})}function lM({row:a}){const l=m.useContext(en.i18n),[s]=m.useState(()=>l.getGroup("filemanager")),r=m.useContext(Jt).templates,[c]=m.useState(()=>r.icon(a,"small"));return o.jsx("div",{className:"wx-qgAqG6sL wx-name-cell",children:a.id==="/wx-filemanager-parent-link"?o.jsxs(o.Fragment,{children:[o.jsx("i",{className:"wx-qgAqG6sL wxi-arrow-left"}),o.jsxs("span",{className:"wx-qgAqG6sL wx-name",children:[" ",s("Back to parent folder")]})]}):o.jsxs(o.Fragment,{children:[c?o.jsx("img",{className:"wx-qgAqG6sL wx-icon",alt:"",src:c,height:"24px",width:"24px"}):o.jsx("i",{className:`wx-qgAqG6sL wxi-${a.type}`}),o.jsxs("span",{className:"wx-qgAqG6sL wx-name",children:[" ",a.name," "]})]})})}function Xv({children:a}){const l=m.useContext(Jt),s=ze(l,"activePanel"),r=m.useContext(Bm),c=m.useRef(null);let d=m.useRef({});return d.current.drop=()=>{const h=c.current,p=rw(h,"data-panel");p&&p!=s&&l.exec("set-active-panel",{panel:p*1})},d.current.dragEnter=()=>{const h=c.current;h&&h.classList.toggle("wx-active")},d.current.dragLeave=()=>{const h=c.current;h&&h.classList.toggle("wx-active")},m.useEffect(()=>{const h=c.current;return r.droparea(h,d.current)},[]),o.jsx("div",{className:"wx-LT9X7tb7 wx-upload-area",ref:c,children:a})}function mm({panel:a,active:l=!1,onClick:s,onContextMenu:r}){const c=m.useContext(Jt),d=m.useContext(en.i18n),h=m.useMemo(()=>d.getGroup("filemanager"),[d]),p=m.useMemo(()=>nr("%d %M %Y",d.getRaw().calendar),[d]),[g]=Aa(c,"panels"),x=g[a].selected,b=g[a].path,v=g[a]._crumbs,S=g[a]._sorts,M=g[a]._selectNavigation,C=g[a]._files,j=m.useMemo(()=>[{id:"name",header:h("Name"),flexgrow:3,sort:!0,resize:!0,cell:lM},{id:"size",header:h("Size"),width:100,sort:!0,resize:!0,template:$=>typeof $=="number"?Lo($):""},{id:"date",header:h("Date"),width:120,sort:!0,resize:!0,template:$=>$?p($):""}],[h,p]),k=m.useRef(null),T=m.useRef(null),A=m.useMemo(()=>M?["/wx-filemanager-parent-link"]:[...x],[M,x]);function z($,oe){if(oe&&oe.target&&oe.target.className&&oe.target.className.indexOf("wx-grip")!==-1)return;const le=oe&&(oe.ctrlKey||oe.metaKey),ue=oe&&oe.shiftKey;if($==="/wx-filemanager-parent-link"){if(x.length&&(le||ue))return;c.exec("select-file",{type:"navigation"});return}let H=$==="body"&&oe?null:$;!k.current&&!T.current?c.exec("select-file",{id:H,toggle:le,range:ue,panel:a}):(k.current=null,T.current=null)}function G(){v.length>1&&c.exec("set-path",{id:v[v.length-2].id,panel:a,selected:[v[v.length-1].id]})}function I($){if($==="/wx-filemanager-parent-link")return G();const oe=C.find(le=>le.id===$);oe&&(oe.type==="folder"?c.exec("set-path",{id:oe.id,panel:a}):c.exec("open-file",{id:oe.id}))}function W($){const oe=$.key,le=S[b];let ue=le?"asc":"desc";le&&le.key===oe&&(ue=le.order==="asc"?"desc":"asc"),c.exec("sort-files",{key:oe,order:ue,panel:a,path:b})}function R($){$.intercept("sort-rows",oe=>(k.current=!0,W(oe),!1)),$.intercept("select-row",()=>!1),$.on("resize-column",()=>T.current=!0),$.intercept("hotkey",()=>!1)}const ee=m.useMemo(()=>b!=="/"?[{id:"/wx-filemanager-parent-link",name:h("Back to parent folder")},...C]:C,[b,C,h]),se=m.useMemo(()=>{if(ee&&S&&S[b]){const{key:$,order:oe}=S[b];return{[$]:{order:oe}}}},[ee,S,b]),V=m.useRef(null),fe=m.useRef();return m.useEffect(()=>{fe.current?(fe.current.click=z,fe.current._dblclick=I):(fe.current={click:z,dblclick:$=>fe.current._dblclick($),_dblclick:I},sr(V.current,fe.current))},[z,I]),o.jsxs("div",{onClick:s,onContextMenu:r,className:"wx-SSaVhET7 wx-wrapper",children:[o.jsx(Kv,{panel:a}),o.jsx("div",{"data-id":Wt("body"),className:`wx-SSaVhET7 wx-list ${l?"wx-active":""}`,ref:V,children:o.jsx(Xv,{children:o.jsx(J1,{init:R,data:ee,columns:j,selectedRows:A,columnStyle:()=>"wx-SSaVhET7 wx-each-cell",sizes:{rowHeight:42,headerHeight:42},sortMarks:se})})})]})}function iM(){const a=m.useContext(Jt),l=ze(a,"activePanel");function s(r){a.exec("set-active-panel",{panel:r})}return o.jsxs("div",{className:"wx-L55BfJa2 wx-panels","data-id":Wt("body"),children:[o.jsx("div",{className:"wx-L55BfJa2 wx-item","data-panel":0,children:o.jsx(mm,{panel:0,active:l==0,onClick:()=>s(0),onContextMenu:()=>s(0)})}),o.jsx("div",{className:"wx-L55BfJa2 wx-item","data-panel":1,children:o.jsx(mm,{panel:1,active:l==1,onClick:()=>s(1),onContextMenu:()=>s(1)})})]})}function Zv({folderIcon:a=!1,folder:l={}}){const s=m.useContext(Jt),[r,c]=Aa(s,"panels"),d=ze(s,"activePanel"),h=m.useMemo(()=>r[d].path,[c,d]),p=m.useContext(en.i18n),g=m.useMemo(()=>p.getGroup("filemanager"),[p]),x=m.useMemo(()=>!!l.data?.find(M=>M.type==="folder"),[l]),b=m.useMemo(()=>l.id=="/"?g(l.name):l.name,[l,g]),v=m.useMemo(()=>l.$level>1?(l.$level-1)*20:0,[l]),S=l.open;return o.jsxs(o.Fragment,{children:[o.jsxs("li",{"data-id":Wt(l.id),className:`wx-NYfhvGIt wx-folder${h===l.id?" wx-selected":""}`,style:{paddingLeft:`${v}px`},children:[x?o.jsx("i",{className:`wx-NYfhvGIt wx-toggle wxi-${S?"angle-down":"angle-right"}`,"data-action":"toggle"}):o.jsx("span",{className:"wx-NYfhvGIt wx-toggle-placeholder"}),o.jsx("i",{className:"wx-NYfhvGIt "+(a||"wxi-folder")}),o.jsxs("span",{className:"wx-NYfhvGIt wx-name",children:[" ",b," "]})]}),S&&l.data&&l.data.length&&x?o.jsx(o.Fragment,{children:l.data.map(M=>M.type==="folder"?o.jsx(Zv,{folder:M},M.id):null)}):null]})}function sM(){const a=m.useContext(Jt),[l,s]=Aa(a,"data"),[r,c]=Aa(a,"panels"),d=ze(a,"activePanel"),h=m.useMemo(()=>r[d]._crumbs,[c,d]),p=m.useCallback(M=>{a.exec("open-tree-folder",{id:M,mode:!l.byId(M).open})},[a,s]),g=m.useCallback(M=>{const C=_m(M,h);a.exec("set-path",{id:M,panel:d,...C&&{selected:[C]}})},[a,h,d]),[x,b]=m.useState([]);m.useEffect(()=>{b(l.byId(0).data)},[s]);const v=m.useRef(null),S=m.useRef();return m.useEffect(()=>{S.current?(S.current.click=g,S.current.toggle=p):(S.current={click:g,toggle:p},sr(v.current,S.current))},[g,p]),o.jsx("ul",{ref:v,className:"wx-LyHJ6R6A",children:x.map(M=>M.type==="folder"?o.jsx(Zv,{folder:M},M.id):null)})}function rM(){const a=m.useContext(Jt),l=m.useContext(en.i18n),s=m.useMemo(()=>l.getGroup("filemanager"),[l]),r=ze(a,"drive"),c=r?r.used:"",d=r?r.total:"";return c&&d?o.jsxs("div",{className:"wx-DetSyKGG wx-drive",children:[o.jsx("progress",{value:c,max:d,className:"wx-DetSyKGG wx-progress"}),o.jsxs("p",{children:[Lo(c)," ",s("of")," ",Lo(d)," ",s("used")]})]}):null}function oM({option:a}){const l=m.useContext(en.i18n).getGroup("filemanager"),s=m.useContext(Bm),r=m.useCallback(()=>{s.open({})},[s]);return o.jsx("div",{className:"wx-9XiKcxq5 wx-upload-button",onClick:r,children:o.jsx("span",{children:l(a.text)})})}function cM({readonly:a,menuOptions:l}){const s=m.useContext(en.i18n).getGroup("filemanager"),{showPrompt:r}=m.useContext(Om);m.useEffect(()=>{AS("upload",oM)},[]);function c({action:h}){h&&(h.id==="add-file"?r({item:{type:"file",size:0,date:new Date},add:!0}):h.id==="add-folder"&&r({item:{type:"folder",date:new Date},add:!0}))}const d=m.useMemo(()=>l("add").map(h=>(h.text=s(h.text),h)),[l,s]);return o.jsxs("div",{className:"wx-FlucfALM wx-wrapper",children:[!a&&o.jsx("div",{className:"wx-FlucfALM wx-button",children:o.jsx(kS,{options:d,at:"bottom-fit",onClick:c,children:o.jsx(Ao,{type:"primary block",children:s("Add New")})})}),o.jsx("div",{className:"wx-FlucfALM wx-tree",children:o.jsx(sM,{})}),o.jsx(rM,{})]})}function uM({value:a="",onSearch:l}){const[s,r]=Dv(a),c=m.useContext(en.i18n).getGroup("filemanager"),d=m.useRef(null),h=m.useMemo(()=>s!==""?"wxi-close":"wxi-search",[s]);function p(x){const b=x.target.value;r(b),l&&l({value:b})}function g(){r(""),d.current&&d.current.focus(),l&&l({value:""})}return o.jsxs("div",{className:"wx-lUZMtgT1 wx-search-input",children:[o.jsx("i",{className:`wx-lUZMtgT1 wx-icon ${h}`,onClick:g}),o.jsx("input",{type:"text",className:"wx-lUZMtgT1 wx-text",ref:d,value:s,onInput:p,placeholder:c("Search")})]})}function dM({narrowMode:a=!1,onShowTree:l}){const s=m.useContext(Jt),r=m.useContext(en.i18n).getGroup("filemanager"),c=ze(s,"mode"),d=ze(s,"preview"),h=ze(s,"search"),p=[{icon:"wxi-view-sequential",id:"table"},{icon:"wxi-view-grid",id:"cards"},{icon:"wxi-view-column",id:"panels"}];function g({value:v}){s.exec("set-mode",{mode:v})}function x(v){v.preventDefault(),s.exec("show-preview",{mode:!d})}function b(v){s.exec("filter-files",{text:v.value})}return o.jsxs("div",{className:"wx-5PZQQztG wx-toolbar",children:[o.jsxs("div",{className:"wx-5PZQQztG wx-left "+(a?"wx-left-narrow":""),children:[a?c==="panels"||c==="search"?null:o.jsx("div",{className:"wx-5PZQQztG wx-sidebar-icon","data-id":Wt("toggle-tree"),children:o.jsx(es,{onClick:()=>l&&l(),name:"subtask"})}):o.jsx("div",{className:"wx-5PZQQztG wx-name",children:r("Files")}),o.jsx(uM,{onSearch:b,value:h})]}),o.jsxs("div",{className:"wx-5PZQQztG wx-right",children:[a?null:o.jsx("div",{className:"wx-5PZQQztG wx-preview-icon",children:o.jsx(tS,{onClick:x,value:d,children:o.jsx("i",{className:"wx-5PZQQztG wxi-eye"})})}),o.jsx("div",{className:"wx-5PZQQztG wx-modes",children:o.jsx(Kw,{value:c,options:p,onChange:g})})]})]})}function fM(){const a=m.useContext(Jt),l=ze(a,"activePanel");return o.jsxs("div",{className:"wx-NwohNJzN wx-wrapper",children:[o.jsx(Kv,{panel:l}),o.jsx(Xv,{children:o.jsx(Qv,{})})]})}function mM({readonly:a=!1,menuOptions:l,extraInfo:s}){const r=m.useRef(null),c=m.useRef(null),[d,h]=m.useState(void 0),[p,g]=m.useState(void 0),[x,b]=m.useState(!1),v=Hv(),S=m.useContext(Jt),{showPrompt:M,showConfirm:C}=m.useContext(Om),j=m.useContext(en.i18n),k=m.useMemo(()=>j.getGroup("filemanager"),[j]),T=ze(S,"mode"),A=ze(S,"preview"),z=ze(S,"activePanel"),[G,I]=Aa(S,"panels"),W=m.useMemo(()=>(G&&z!=null?G[z]:null)?.selected??[],[I,z]),R=m.useMemo(()=>(G&&z!=null?G[z]:null)?.path,[I,z]),[ee,se]=m.useState([]);m.useEffect(()=>{const P=r.current;if(!P)return;const ne=new ResizeObserver(L=>{const de=L[0]?.borderBoxSize?.[0]?.inlineSize;typeof de=="number"&&g(de<768)});return ne.observe(P),()=>{ne.disconnect()}},[]);const V=m.useCallback(()=>{b(P=>!P)},[]),fe=m.useCallback(P=>{p&&Ro(P)!=="toggle-tree"&&b(!1)},[p]);m.useEffect(()=>{const P=c.current;if(P)return ll(P,fe).destroy},[fe]),m.useEffect(()=>{const P=c.current;if(!P)return;const ne=new ResizeObserver(()=>{P&&h(P.clientWidth)});return ne.observe(P),P&&h(P.clientWidth),()=>{ne.disconnect()}},[]);const $=m.useMemo(()=>({icon:"wxi-eye",text:"Preview",id:"preview"}),[]),oe=m.useCallback(P=>{let ne=p?[$]:[];return P==="file"&&(ne=[...ne,...l().filter(L=>L.id==="download")]),ne},[p,$,l]),le=m.useRef(null),ue=m.useCallback((P,ne,L)=>{const de=L?[ne.id]:W;switch(P){case"download":S.exec("download-file",{id:ne.id});break;case"copy":case"move":le.current={action:P,ids:de};break;case"paste":le.current&&S.exec(le.current.action==="copy"?"copy-files":"move-files",{ids:le.current.ids,target:ne?.type==="folder"?ne.id:R});break;case"rename":M({item:ne});break;case"delete":C({selected:de});break;case"preview":S.exec("show-preview",{mode:!A});break}},[S,W,R,M,C,A]),H=m.useCallback(()=>G?.[z],[G,z]);m.useEffect(()=>{const P=r.current;if(!P)return;const ne=gS(P,{api:S,menuOptions:a?oe:l,performAction:ue,getPanel:H});return()=>{typeof ne=="function"?ne():ne&&typeof ne.destroy=="function"&&ne.destroy()}},[S,a,oe,l,ue,H]);const X=m.useCallback((P,ne)=>{const L=P?S.getFile(P):null,de=ne.target.closest(".tree-item.folder");let ve;if(a)ve=oe(L?.type);else{switch(P){case"body":ve=l(P);break;default:if(L)if(!de&&W.length>1)ve=p?[$,...l("multiselect")]:l("multiselect");else if(P==="/")ve=l("folder",L).filter(ge=>ge.id==="paste");else{const ge=l(L.type,L);ge&&(ve=p?[$,...ge]:ge)}}T==="search"&&(ve=ve?.filter(ge=>ge.id!=="paste"))}if(L?.id&&(!W.length||!W.some(ge=>ge===L.id))&&!de&&S.exec("select-file",{id:L.id}),ve?.length)return ve.forEach(ge=>{de&&(ge.hotkey=""),ge.text&&(ge.text=k(ge.text)),ge.hotkey&&(ge.subtext=ge.hotkey)}),se(ve),L||{}},[S,a,oe,l,W,p,$,T,k]),te=m.useCallback(P=>{const{action:ne,context:L}=P;ne&&ue(ne.id,L,!ne.hotkey)},[ue]);async function E(P){await Promise.resolve();const{name:ne,size:L}=P.file;S.exec("create-file",{file:{name:ne,size:L,date:new Date,file:P.file},parent:R})}return o.jsx("div",{className:"wx-RJbNonjJ wx-filemanager wx-flex",ref:r,"data-menu-ignore":"false",children:p&&A?o.jsx("div",{className:"wx-RJbNonjJ wx-info-narrow",children:o.jsx(qf,{narrowMode:p,extraInfo:s})}):o.jsxs(o.Fragment,{children:[o.jsx(dM,{narrowMode:p,onShowTree:V}),o.jsx(ES,{dataKey:"id",at:"point",options:ee,resolver:X,onClick:te,children:o.jsxs(Bv,{dataKey:"actionId",options:ee,resolver:X,onClick:te,children:[o.jsx(zS,{data:v,apiOnly:!0,uploadURL:E}),o.jsx(Bm.Provider,{value:v,children:o.jsx("div",{className:"wx-RJbNonjJ wx-content-wrapper wx-flex",children:T!=="panels"&&T!=="search"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-RJbNonjJ "+["wx-sidebar",p?"wx-sidebar-narrow":"",x?"wx-sidebar-visible":""].filter(Boolean).join(" "),ref:c,children:o.jsx(cM,{readonly:a,menuOptions:l})}),o.jsxs("div",{className:"wx-RJbNonjJ wx-content",style:{width:`calc(100% - ${d||0}px - 10px)`},children:[o.jsx("div",{className:`wx-RJbNonjJ wx-content-item${A?"":"-fit"}`,"data-id":Wt("body"),children:T==="table"?o.jsx(mm,{panel:z}):o.jsx(fM,{})}),A?o.jsx("div",{className:"wx-RJbNonjJ wx-info",children:o.jsx(qf,{extraInfo:s})}):null]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`wx-RJbNonjJ wx-content-item${A?"":"-fit"}`,children:T==="panels"?o.jsx(iM,{}):o.jsx(aM,{})}),A?o.jsx("div",{className:"wx-RJbNonjJ wx-info",children:o.jsx(qf,{extraInfo:s})}):null]})})})]})})]})})}const hM=a=>a.split("-").map(l=>l?l.charAt(0).toUpperCase()+l.slice(1):"").join("");function pM(a,l){const{type:s,ext:r}=a;if(s==="folder")return!1;let c;return s&&s!=="file"&&Ex[s]?c=s:r?c=Ex[r]?r:"file":c="unknown",`https://cdn.svar.dev/icons/filemanager/vivid/${l}/${c}.svg`}const gM=m.forwardRef(function(a,l){const{data:s=[],mode:r="cards",drive:c=null,preview:d=!1,panels:h=null,activePanel:p=0,readonly:g=!1,menuOptions:x=mS,extraInfo:b=null,init:v=null,icons:S=pM,previews:M=null,...C}=a,j=m.useRef();j.current=C;const k=m.useMemo(()=>new fS(Lv),[]),T=m.useMemo(()=>k.in,[k]),A=m.useRef(null);A.current===null&&(A.current=new Av((I,W)=>{const R="on"+hM(I);j.current&&j.current[R]&&j.current[R](W)}),T.setNext(A.current));const z=m.useMemo(()=>({getState:k.getState.bind(k),getReactiveState:k.getReactive.bind(k),getStores:()=>({data:k}),exec:T.exec,setNext:I=>(A.current=A.current.setNext(I),A.current),intercept:T.intercept.bind(T),on:T.on.bind(T),detach:T.detach.bind(T),getFile:k.getFile.bind(k),serialize:k.serialize.bind(k),templates:{preview:M||(()=>null),icon:S==="simple"?(()=>null):S}}),[k,T]),G=m.useRef(0);return m.useEffect(()=>{if(!G.current)v&&v(z);else{const I=k.getState();k.init({data:s,mode:r,drive:c,preview:d,panels:h||I.panels||[],activePanel:p})}G.current++},[k,s,r,c,d,h,p,v,z]),G.current===0&&k.init({data:s,mode:r,drive:c,preview:d,panels:h||[],activePanel:p}),m.useImperativeHandle(l,()=>({...z}),[z]),o.jsx(Jt.Provider,{value:z,children:o.jsx(Rm,{words:Lm,optional:!0,children:o.jsx(eM,{children:o.jsx(mM,{readonly:g,menuOptions:x,extraInfo:b})})})})});function xM({fonts:a=!0,children:l}){return l?o.jsx(px,{fonts:a,children:l}):o.jsx(px,{fonts:a})}jm(Qn);function Hm(a,l){if(!a||typeof a!="object"||Array.isArray(a))throw new Error(`Invalid Hub ${l} response.`);return a}function Oo(a,l,s){const r=Hm(a,s);if(!Array.isArray(r[l]))throw new Error(`Invalid Hub ${s} response: ${l} must be an array.`);return r[l]}function vM(a,l,s){const r=Hm(a,s);if(!r[l]||typeof r[l]!="object"||Array.isArray(r[l]))throw new Error(`Invalid Hub ${s} response: ${l} must be an object.`);return r[l]}async function Dx(a,l=!1){return Oo(await pt(`/api/remote/filesystem/roots${l?"?refresh=1":""}`,void 0,a),"roots","filesystem roots")}async function Rx(a,l){const s=await pt(`/api/remote/filesystem/entries?id=${encodeURIComponent(a)}`,void 0,l);return{folder:vM(s,"folder","filesystem entries"),entries:Oo(s,"entries","filesystem entries")}}async function yM(a,l){return pt("/api/remote/filesystem/selection/scan",{method:"POST",body:JSON.stringify({itemIds:a})},l)}async function bM(a,l,s,r){return pt("/api/remote/files/from-hub",{method:"POST",body:JSON.stringify({itemIds:a,deviceIds:l,remoteDirectory:s})},r)}async function wM(a,l=!1){const s=await pt(`/api/remote/files/jobs?active=${l?"1":"0"}`,void 0,a);return{jobs:Oo(s,"jobs","file transfer jobs")}}async function SM(a,l){return pt(`/api/remote/files/jobs/${encodeURIComponent(a)}`,void 0,l)}async function MM(a,l){return pt(`/api/remote/files/jobs/${encodeURIComponent(a)}/cancel`,{method:"POST"},l)}async function Lx(a){return Oo(await pt("/api/remote/filesystem/shared-folders",void 0,a),"folders","shared folders")}async function CM(a,l){return pt("/api/remote/filesystem/shared-folders",{method:"POST",body:JSON.stringify({sourceId:a})},l)}async function jM(a,l,s){return pt(`/api/remote/filesystem/shared-folders/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(l)},s)}async function NM(a,l){return pt(`/api/remote/filesystem/shared-folders/${encodeURIComponent(a)}`,{method:"DELETE"},l)}async function AM(a,l,s,r){const c=await pt(`/api/remote/filesystem/shared-folders/${encodeURIComponent(a)}/sync`,{method:"POST",body:JSON.stringify({deviceIds:l,remoteDirectory:s})},r),d=Hm(c,"shared folder sync");return{ok:d.ok===!0,jobs:Oo(c,"jobs","shared folder sync"),files:Number(d.files||0),totalBytes:Number(d.totalBytes||0)}}function TM(a){return{id:String(a.id),parentId:a.parent,name:a.name,type:a.type==="file"?"file":"folder",size:Number(a.size||0),modifiedAt:a.date?.toISOString()||null,displayPath:String(a.displayPath||a.name),hasChildren:a.lazy===!0||!!a.data?.length,locked:a.locked===!0}}function _x(a){if(!Number.isFinite(a)||a<=0)return"0 B";const l=["B","KB","MB","GB","TB"];let s=a,r=0;for(;s>=1024&&r<l.length-1;)s/=1024,r+=1;return`${s.toFixed(r===0||s>=100?0:1)} ${l[r]}`}function pu(a){return a.driveType==="network"?"network":a.driveType==="removable"?"removable":"local"}function kM(a){const l=a.filter(s=>pu(s)==="local");return l.find(s=>/\bC:/i.test(`${s.name} ${s.displayPath||""}`))||l[0]||a[0]||null}function EM({hubUrl:a,roots:l,loading:s,error:r,onRefreshRoots:c,onImportFiles:d,onImportFolder:h,onSelectionChange:p,onShareItem:g,onAddSyncFolder:x,onNotice:b}){const v=m.useRef(null),S=m.useRef("this-pc"),M=m.useRef(0),C=m.useRef(new Map),[j,k]=m.useState(null),[T,A]=m.useState([]),[z,G]=m.useState(0),[I,W]=m.useState(null),[R,ee]=m.useState(new Set),se=l.find(E=>E.id===j)||null,V=se?`/${se.name}`:null,fe=m.useMemo(()=>(C.current.clear(),!se||!V?[]:(C.current.set(V,se.id),[{id:V,parent:"/",type:"folder",name:se.name,date:se.modifiedAt?new Date(se.modifiedAt):void 0,lazy:!1},...T.map(E=>{const P=`${V}/${E.name}`;return C.current.set(P,E.id),{id:P,parent:V,name:E.name,type:E.type==="file"?"file":"folder",...E.type==="file"?{size:E.size}:{},date:E.modifiedAt?new Date(E.modifiedAt):void 0,lazy:E.type!=="file"&&E.hasChildren===!0,displayPath:E.displayPath,locked:E.locked,driveType:E.driveType,totalBytes:E.totalBytes,freeBytes:E.freeBytes}})])),[se,V,T]),$=E=>C.current.get(String(E))||String(E),oe=E=>TM({...E,id:$(String(E.id)),parent:$(String(E.parent))}),le=async E=>{const P=++M.current;k(E.id),S.current=`/${E.name}`,A([]),W(E.id),ee(ne=>{const L=new Set(ne);return L.delete(E.id),L});try{const ne=await Rx(E.id,a);if(P!==M.current)return;if(!Array.isArray(ne.entries))throw new Error("Invalid Hub filesystem entries response.");A(ne.entries),G(L=>L+1)}catch(ne){if(P!==M.current)return;console.error("[LiveDesk FS] getEntries failed",{rootId:E.id,error:ne}),ee(L=>new Set(L).add(E.id)),b(ne instanceof Error?`${E.name}: ${ne.message}`:`${E.name}: Unable to read this drive.`)}finally{P===M.current&&W(null)}};m.useEffect(()=>{const E=l.find(P=>P.id===j)||kM(l);if(ee(P=>new Set([...P].filter(ne=>l.some(L=>L.id===ne)))),!E){k(null);return}le(E)},[l]);const ue=E=>{v.current=E,E.on("request-data",async({id:P})=>{const ne=String(P),L=$(ne);try{const de=await Rx(L,a);if(!Array.isArray(de.entries))throw new Error("Invalid Hub filesystem entries response.");const ve=de.entries.map(ge=>{const ke=`${ne}/${ge.name}`;return C.current.set(ke,ge.id),{id:ke,parent:ne,name:ge.name,type:ge.type==="file"?"file":"folder",...ge.type==="file"?{size:ge.size}:{},date:ge.modifiedAt?new Date(ge.modifiedAt):void 0,lazy:ge.type!=="file"&&ge.hasChildren===!0,displayPath:ge.displayPath,locked:ge.locked,driveType:ge.driveType,totalBytes:ge.totalBytes,freeBytes:ge.freeBytes}});await E.exec("provide-data",{id:ne,data:ve})}catch(de){console.error("[LiveDesk FS] nested getEntries failed",{id:L,error:de}),b(de instanceof Error?de.message:"Unable to read this folder.")}}),E.on("select-file",()=>{window.setTimeout(()=>{const L=(E.getState().panels?.flatMap(de=>de.selected||[])||[]).map(de=>E.getFile(de)).filter(Boolean).map(de=>oe(de));p(L.map(de=>de.id),L)},0)}),E.on("set-path",({id:P})=>{S.current=String(P)})},H=(E,P)=>{const ne=P?oe(P):null,L=()=>{const de=ne?.type==="file"?String(P?.parent||S.current):String(P?.id||S.current);v.current?.exec("request-data",{id:de})};return E==="body"?[{id:"refresh",text:"Refresh",icon:"mdi mdi-refresh",handler:L},{id:"properties",text:"Properties",icon:"mdi mdi-information-outline",handler:()=>b("Select a file or folder to view its properties.")}]:E==="multiselect"?[{id:"share",text:"Share to workstations",icon:"mdi mdi-share-variant",handler:()=>{(v.current?.getState().panels?.flatMap(ve=>ve.selected||[])||[]).forEach(ve=>{const ge=v.current?.getFile(ve);ge&&g(oe(ge))})}},{id:"refresh",text:"Refresh",icon:"mdi mdi-refresh",handler:L}]:ne?[{id:"share",text:"Share to workstations",icon:"mdi mdi-share-variant",handler:()=>g(ne)},...ne.type==="folder"?[{id:"sync",text:"Add folder to Sync",icon:"mdi mdi-folder-sync-outline",handler:()=>x(ne)}]:[],{id:"copy-path",text:"Copy path",icon:"mdi mdi-content-copy",handler:()=>{Zi(ne.displayPath||ne.name)}},{id:"refresh",text:"Refresh",icon:"mdi mdi-refresh",handler:L},{id:"properties",text:"Properties",icon:"mdi mdi-information-outline",handler:()=>b(`${ne.name}
12
- ${ne.displayPath||""}`)}]:[]},X=async()=>{try{await c()}catch(E){b(E instanceof Error?E.message:"Unable to refresh Hub drives.")}},te=[{id:"local",label:"Local drives",icon:tr,roots:l.filter(E=>pu(E)==="local")},{id:"removable",label:"Removable drives",icon:kb,roots:l.filter(E=>pu(E)==="removable")},{id:"network",label:"Network drives",icon:tv,roots:l.filter(E=>pu(E)==="network")}];return o.jsxs("section",{className:"hub-file-explorer-panel","aria-label":"Hub file explorer",children:[o.jsxs("div",{className:"hub-file-explorer-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Hub file explorer"}),o.jsxs("strong",{children:[o.jsx(tr,{size:16})," Browse files on this Hub"]})]}),o.jsxs("div",{className:"hub-file-explorer-heading-actions",children:[o.jsx("button",{className:"icon-button",onClick:d,title:"Import files from this browser",type:"button",children:o.jsx(nv,{size:16})}),o.jsx("button",{className:"icon-button",onClick:h,title:"Import folder from this browser",type:"button",children:o.jsx(Eb,{size:16})}),o.jsx("button",{className:"icon-button",onClick:()=>{X()},title:"Refresh drives",type:"button",children:o.jsx(Au,{size:16})})]})]}),s?o.jsxs("div",{className:"hub-file-explorer-state",children:[o.jsx(tr,{size:24}),o.jsx("strong",{children:"Connecting to LiveDesk Hub file system..."})]}):r?o.jsxs("div",{className:"hub-file-explorer-state error",role:"alert",children:[o.jsx(Jf,{size:24}),o.jsx("strong",{children:r})]}):o.jsxs("div",{className:"hub-file-explorer-content",children:[o.jsxs("aside",{className:"hub-file-explorer-drive-sidebar","aria-label":"Hub drives",children:[o.jsxs("div",{className:"hub-drive-sidebar-title",children:[o.jsx(tr,{size:15}),o.jsx("strong",{children:"This PC"})]}),te.map(E=>E.roots.length>0&&o.jsxs("section",{className:"hub-drive-group",children:[o.jsxs("h3",{children:[o.jsx(E.icon,{size:13}),E.label]}),o.jsx("div",{className:"hub-drive-list",children:E.roots.map(P=>{const ne=E.icon,L=R.has(P.id)||P.locked===!0;return o.jsxs("button",{className:`hub-drive-item ${j===P.id?"active":""} ${L?"unavailable":""}`,onClick:()=>{le(P)},"aria-pressed":j===P.id,type:"button",children:[o.jsx("span",{className:"hub-drive-item-icon",children:o.jsx(ne,{size:16})}),o.jsxs("span",{className:"hub-drive-item-copy",children:[o.jsx("strong",{children:P.name}),o.jsx("small",{children:P.displayPath||P.name}),o.jsxs("em",{children:[_x(P.freeBytes||0)," free / ",_x(P.totalBytes||0)]})]}),I===P.id?o.jsx(Db,{className:"hub-drive-item-status spin",size:15}):L?o.jsx(Rb,{className:"hub-drive-item-status",size:15}):null]},P.id)})})]},E.id)),l.length===0&&o.jsxs("div",{className:"hub-drive-sidebar-empty",children:[o.jsx(Jf,{size:17}),o.jsx("span",{children:"No drives available."})]})]}),o.jsx("div",{className:"hub-file-explorer-svar",children:o.jsx(xM,{fonts:!1,children:o.jsx(gM,{data:fe,panels:V?[{path:V,selected:[]}]:void 0,readonly:!0,mode:"table",preview:!1,init:ue,icons:"simple",menuOptions:H},`${se?.id||"no-root"}:${z}`)})})]})]})}class DM extends m.Component{state={error:null};static getDerivedStateFromError(l){return{error:l}}componentDidCatch(l,s){console.error("[LiveDesk] Share Files runtime error",l,s.componentStack)}render(){return this.state.error?o.jsxs("section",{className:"file-share-error-boundary",role:"alert",children:[o.jsx(Lb,{size:24}),o.jsx("strong",{children:"Share Files could not be opened."}),o.jsx("span",{children:this.state.error.message||"An unexpected file explorer error occurred."}),o.jsxs("button",{className:"text-button",onClick:this.props.onRetry,type:"button",children:[o.jsx(Au,{size:15})," Retry"]})]}):this.props.children}}function RM(a){return a.deviceName||a.hostname||a.deviceId}function LM({devices:a,mode:l,selectedIds:s,onModeChange:r,onToggle:c}){const d=new Set(s);return o.jsxs("section",{className:"distribution-targets",children:[o.jsxs("div",{className:"file-share-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Target"}),o.jsx("strong",{children:l==="all"?`${a.length} connected`:`${s.length} selected`})]}),o.jsxs("div",{className:"file-share-tabs compact","aria-label":"File transfer targets",children:[o.jsxs("button",{className:l==="all"?"active":"",onClick:()=>r("all"),type:"button",children:[o.jsx(_b,{size:14})," All connected"]}),o.jsxs("button",{className:l==="selected"?"active":"",onClick:()=>r("selected"),type:"button",children:[o.jsx(tl,{size:14})," Selected"]})]})]}),o.jsx("div",{className:"file-share-device-list","aria-label":"Connected workstation targets",children:a.length===0?o.jsx("div",{className:"file-share-empty-inline",children:"No connected workstations."}):a.map(h=>{const p=l==="all"||d.has(h.deviceId);return o.jsxs("label",{className:`file-share-device-option ${p?"selected":""}`,children:[o.jsx("input",{type:"checkbox",checked:p,disabled:l==="all",onChange:()=>c(h.deviceId)}),o.jsx(tl,{size:20,"aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:RM(h)}),o.jsxs("small",{children:["Slot ",h.slotNumber?String(h.slotNumber).padStart(3,"0"):"-"," / ",h.platform||"unknown OS"]})]}),o.jsx(ja,{size:17,"aria-hidden":"true"})]},h.deviceId)})})]})}function _M(a){if(!Number.isFinite(a)||a<=0)return"0 B";const l=["B","KB","MB","GB","TB"];let s=a,r=0;for(;s>=1024&&r<l.length-1;)s/=1024,r+=1;return`${s.toFixed(r===0||s>=100?0:1)} ${l[r]}`}function zM({folders:a,loading:l,busy:s,canSync:r,onSyncAll:c,onSync:d,onToggleAuto:h,onRemove:p,onAdd:g}){return o.jsxs("section",{className:"file-share-sync-panel",children:[o.jsxs("div",{className:"file-share-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Hub folders"}),o.jsx("strong",{children:"Continuous sync"})]}),o.jsxs("button",{className:"text-button compact",onClick:c,disabled:s||!r||a.length===0,type:"button",children:[o.jsx(du,{size:15})," ",s?"Syncing":"Sync all"]})]}),l?o.jsx("div",{className:"file-share-empty-state",children:"Loading Hub sync folders..."}):a.length===0?o.jsxs("button",{className:"file-share-empty-state interactive",onClick:g,type:"button",children:[o.jsx(du,{size:28}),o.jsx("strong",{children:"Add a selected Hub folder"}),o.jsx("span",{children:"Hub keeps the manifest and can sync while this browser is closed."})]}):o.jsx("div",{className:"file-share-sync-list",children:a.map(x=>o.jsxs("article",{className:`file-share-sync-row state-${x.status}`,children:[o.jsx("div",{className:"file-share-sync-icon",children:o.jsx(du,{size:19})}),o.jsxs("div",{className:"file-share-sync-info",children:[o.jsx("strong",{children:x.name}),o.jsx("span",{children:x.displayPath}),o.jsxs("small",{children:[x.fileCount," files / ",_M(x.totalBytes)," · ",x.lastSyncedAt?`Last sync ${om(x.lastSyncedAt)} ago`:x.message||"Not synced yet"]})]}),o.jsxs("label",{className:"file-share-auto-sync",children:[o.jsx("input",{type:"checkbox",checked:x.autoSync,onChange:()=>h(x)}),o.jsx("span",{children:"Auto"})]}),o.jsxs("button",{className:"text-button compact",onClick:()=>d(x),disabled:s||!r||x.status==="syncing",type:"button",children:[o.jsx(Au,{size:14})," Sync now"]}),o.jsx("button",{className:"icon-button",onClick:()=>p(x),title:"Remove sync folder",type:"button",children:o.jsx(zb,{size:15})})]},x.id))})]})}function OM(a){const s=(a.targetMode==="all"?a.devices.map(r=>r.deviceId):a.selectedTargetIds).length>0;return o.jsxs("aside",{className:"file-share-distribution-panel",children:[o.jsxs("div",{className:"file-share-distribution-head",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Distribution"}),o.jsx("strong",{children:"Hub → workstations"})]}),o.jsx(So,{size:18})]}),o.jsxs("div",{className:"file-share-tabs",role:"tablist","aria-label":"Distribution mode",children:[o.jsx("button",{className:a.tab==="send"?"active":"",onClick:()=>a.onTabChange("send"),role:"tab","aria-selected":a.tab==="send",type:"button",children:"Send"}),o.jsx("button",{className:a.tab==="sync"?"active":"",onClick:()=>a.onTabChange("sync"),role:"tab","aria-selected":a.tab==="sync",type:"button",children:"Sync"})]}),a.tab==="send"?o.jsxs(o.Fragment,{children:[o.jsx(LM,{devices:a.devices,mode:a.targetMode,selectedIds:a.selectedTargetIds,onModeChange:a.onTargetModeChange,onToggle:a.onTargetToggle}),o.jsxs("label",{className:"file-share-destination",children:[o.jsx("span",{children:"Destination folder"}),o.jsxs("div",{children:[o.jsx(Mo,{size:15}),o.jsx("input",{value:a.remoteDirectory,onChange:r=>a.onRemoteDirectoryChange(r.target.value),placeholder:"Desktop/LiveDeskFiles"})]}),o.jsx("small",{children:"Blank uses Desktop/LiveDeskFiles."})]}),o.jsxs("div",{className:"file-share-selection-summary",children:[o.jsx("span",{children:"Selected"}),o.jsx("strong",{children:a.selectedSummary})]}),o.jsxs("button",{className:"file-share-share-button",onClick:a.onShare,disabled:!a.canShare,type:"button",children:[o.jsx(So,{size:17})," Share selected"]}),o.jsxs("button",{className:"file-share-secondary-button",onClick:a.onAddSync,disabled:!a.canAddSync,type:"button",children:[o.jsx(Mo,{size:16})," Add selected folder to Sync"]})]}):o.jsx(zM,{folders:a.folders,loading:a.foldersLoading,busy:a.syncBusy,canSync:s,onSyncAll:a.onSyncAll,onSync:a.onSync,onToggleAuto:a.onToggleAuto,onRemove:a.onRemove,onAdd:a.onAddFolder})]})}function BM(a){if(!Number.isFinite(a)||a<=0)return"0 B";const l=["B","KB","MB","GB","TB"];let s=a,r=0;for(;s>=1024&&r<l.length-1;)s/=1024,r+=1;return`${s.toFixed(r===0||s>=100?0:1)} ${l[r]}`}function zx(a){return a.totalBytes>0?Math.max(0,Math.min(100,Math.round(a.sentBytes/a.totalBytes*100))):a.totalFiles>0?Math.max(0,Math.min(100,Math.round(a.completedFiles/a.totalFiles*100))):a.state==="completed"?100:0}function Ox(a){return a.state==="scanning"?"Scanning selected Hub items":a.state==="queued"?"Preparing transfer":a.state==="sending"?`${a.completedFiles}/${a.totalFiles} · ${a.currentPath||"sending"}`:a.state==="completed"?`Sent ${a.totalFiles} file${a.totalFiles===1?"":"s"} to ${a.targetCount} workstation${a.targetCount===1?"":"s"}`:a.state==="partially-failed"?`${a.failedTargets.length} workstation${a.failedTargets.length===1?"":"s"} failed`:a.state==="cancelled"?"Transfer cancelled":a.error||"Transfer failed"}function Bx(a){return["completed","partially-failed","failed","cancelled"].includes(a)}function HM({hubUrl:a,devices:l,localFeatureAccess:s,upgradeNotice:r,notice:c,remoteDirectory:d,onRemoteDirectoryChange:h,targetMode:p,selectedTargetIds:g,onTargetModeChange:x,onTargetToggle:b,filePickerRef:v,folderPickerRef:S,onBrowserFileImport:M,onBrowserFolderImport:C,onNotice:j,onTransferChange:k}){const T=Array.isArray(l)?l:[],[A,z]=m.useState([]),[G,I]=m.useState(!0),[W,R]=m.useState(""),[ee,se]=m.useState([]),[V,fe]=m.useState([]),[$,oe]=m.useState(null),[le,ue]=m.useState(!1),[H,X]=m.useState([]),[te,E]=m.useState(!0),[P,ne]=m.useState(!1),[L,de]=m.useState("send"),[ve,ge]=m.useState([]),ke=m.useRef(new Set),qe=m.useMemo(()=>p==="all"?T.map(pe=>pe.deviceId):g.filter(pe=>T.some(je=>je.deviceId===pe)),[T,g,p]),_e=ve.find(pe=>!Bx(pe.state)),Ee=V.length===1&&V[0].type==="folder"?V[0]:null,$e=V.length===0?"Select files or folders from the Hub explorer.":le?"Calculating selection size...":$?`${$.files} files, ${$.folders} folders · ${BM($.totalBytes)}`:`${V.length} item${V.length===1?"":"s"} selected`,Ne=pe=>{k({id:pe.jobId,state:pe.state,progress:zx(pe),message:Ox(pe)})},Mt=m.useCallback(async()=>{const pe=await Dx(a,!0);return z(pe),R(""),pe},[a]),tn=async()=>{try{const je=(await wM(a,!0)).jobs||[],Re=await Promise.all([...ke.current].map(async Ie=>{try{return await SM(Ie,a)}catch{return null}})),It=[...je,...Re.filter(Boolean)],xn=[...new Map(It.map(Ie=>[Ie.jobId,Ie])).values()];ge(xn),xn.forEach(Ne),xn.filter(Ie=>Bx(Ie.state)).forEach(Ie=>ke.current.delete(Ie.jobId))}catch{}};m.useEffect(()=>{let pe=!0;I(!0),R(""),Promise.all([Mt(),Lx(a).then(Re=>{pe&&X(Re)})]).catch(Re=>{pe&&(R(Re instanceof Error?"Hub file system is unavailable. Make sure LiveDesk Hub is running on this computer.":"Hub file system is unavailable."),j(Re instanceof Error?Re.message:"Hub file system is unavailable."))}).finally(()=>{pe&&(I(!1),E(!1))}),tn();const je=window.setInterval(()=>{tn()},800);return()=>{pe=!1,window.clearInterval(je)}},[a,Mt]),m.useEffect(()=>{if(ee.length===0){oe(null);return}let pe=!1;return ue(!0),yM(ee,a).then(je=>{pe||oe(je)}).catch(je=>{pe||j(je instanceof Error?je.message:"Unable to calculate selected size.")}).finally(()=>{pe||ue(!1)}),()=>{pe=!0}},[a,ee.join("|")]);const Xe=(pe,je)=>{se(pe),fe(je)},Kn=pe=>{pe.forEach(je=>ke.current.add(je.jobId)),ge(je=>[...new Map([...je,...pe].map(Re=>[Re.jobId,Re])).values()]),pe.forEach(Ne)},Xn=async()=>{if(!s){j(r);return}if(ee.length===0){j("Select files or folders from the Hub explorer.");return}if(qe.length===0){j("Choose at least one connected workstation.");return}if(_e){j("A Hub transfer is already running.");return}try{const pe=await bM(ee,qe,d.trim(),a);ke.current.add(pe.jobId),j("Hub transfer queued."),await tn()}catch(pe){j(pe instanceof Error?pe.message:"Unable to start Hub transfer.")}},Lt=async pe=>{const je=pe||Ee;if(!je||je.type!=="folder"){j("Select one folder to add it to Sync.");return}try{const Re=await CM(je.id,a);X(It=>[...It.filter(xn=>xn.id!==Re.folder.id),Re.folder]),de("sync"),j(`${je.name} is ready for Hub sync.`)}catch(Re){j(Re instanceof Error?Re.message:"Unable to add the Hub folder to Sync.")}},Vt=async pe=>{if(qe.length===0){j("Choose at least one connected workstation.");return}ne(!0),X(je=>je.map(Re=>Re.id===pe.id?{...Re,status:"syncing"}:Re));try{const je=await AM(pe.id,qe,d.trim(),a);Kn(je.jobs||[]),j(je.jobs?.length?"Hub sync queued.":"No changed files to sync.");const Re=await Lx(a);X(Re)}catch(je){j(je instanceof Error?je.message:"Unable to sync the Hub folder."),X(Re=>Re.map(It=>It.id===pe.id?{...It,status:"error",message:"Sync failed"}:It))}finally{ne(!1)}},be=async()=>{ne(!0);try{for(const pe of H)await Vt(pe)}finally{ne(!1)}},gn=async pe=>{try{const je=await jM(pe.id,{autoSync:!pe.autoSync},a);X(Re=>Re.map(It=>It.id===pe.id?je.folder:It))}catch(je){j(je instanceof Error?je.message:"Unable to update auto sync.")}},De=async pe=>{try{await NM(pe.id,a),X(je=>je.filter(Re=>Re.id!==pe.id))}catch(je){j(je instanceof Error?je.message:"Unable to remove the sync folder.")}};return o.jsxs("section",{className:"livedesk-file-explorer",children:[o.jsx("input",{ref:v,className:"hidden-file-input",type:"file",multiple:!0,onChange:pe=>{pe.currentTarget.files&&M(pe.currentTarget.files),pe.currentTarget.value=""}}),o.jsx("input",{ref:S,className:"hidden-file-input",type:"file",multiple:!0,webkitdirectory:"",directory:"",onChange:pe=>{pe.currentTarget.files&&C(pe.currentTarget.files),pe.currentTarget.value=""}}),(c||W)&&o.jsxs("section",{className:"file-share-notice",role:W?"alert":void 0,children:[W||c,o.jsx("button",{className:"icon-button",onClick:()=>{R(""),I(!0),Dx(a).then(pe=>z(pe)).catch(()=>R("Hub file system is unavailable.")).finally(()=>I(!1))},title:"Retry",type:"button",children:o.jsx(Au,{size:15})})]}),o.jsx("div",{className:"file-share-workspace",children:o.jsxs(DM,{onRetry:()=>window.location.reload(),children:[o.jsx(EM,{hubUrl:a,roots:A,loading:G,error:W,onRefreshRoots:Mt,onImportFiles:()=>v.current?.click(),onImportFolder:()=>S.current?.click(),onSelectionChange:Xe,onShareItem:pe=>{se([pe.id]),fe([pe]),de("send")},onAddSyncFolder:pe=>{se([pe.id]),fe([pe]),Lt(pe)},onNotice:j}),o.jsx(OM,{devices:T,targetMode:p,selectedTargetIds:g,onTargetModeChange:x,onTargetToggle:b,remoteDirectory:d,onRemoteDirectoryChange:h,selectedEntries:V,selectedSummary:$e,canShare:s&&!_e&&ee.length>0&&qe.length>0&&!le,onShare:()=>{Xn()},canAddSync:!!Ee,onAddSync:()=>{Lt()},tab:L,onTabChange:de,folders:H,foldersLoading:te,syncBusy:P,onSyncAll:()=>{be()},onSync:pe=>{Vt(pe)},onToggleAuto:pe=>{gn(pe)},onRemove:pe=>{De(pe)},onAddFolder:()=>{Lt()}})]})}),o.jsxs("footer",{className:"file-share-workspace-footer",children:[o.jsxs("span",{children:[o.jsx(tr,{size:15})," Hub filesystem stays on the Hub; browser bytes are not read for Hub-direct transfers."]}),_e&&o.jsxs("span",{children:[Ox(_e)," · ",zx(_e),"% ",o.jsx("button",{className:"icon-button",onClick:()=>{MM(_e.jobId,a).then(pe=>{ge(je=>je.map(Re=>Re.jobId===pe.jobId?pe:Re)),Ne(pe)})},title:"Cancel transfer",type:"button",children:o.jsx(em,{size:14})})]})]})]})}const FM=120,IM=999,er=5,bo=30,UM=Number.POSITIVE_INFINITY,Wv="livedesk.remoteDirectory",hm="livedesk.localHubAccessEnabled",Jv="livedesk.streamSettings",ey=15,ty="livedesk.controlStreamSettings",pm=6,$f=512*1024,gm="".trim(),ny="".trim(),Hx="livedesk-adsense-script",Gf=!!gm&&!!ny,qM=1e3/60,Yf=1500,$M=650,GM=1800,YM=650,VM=2500,Fx=1500,Ix=15e3,Ux=240,PM=1024,QM=480,KM=270;function XM(a,l){if(l.deviceId!==a.deviceId)return!1;const s=Number(l.browserReceivedEpochMs);if(!Number.isFinite(s)||s<a.startedAtEpochMs)return!1;const r=Number(l.monitorIndex);if(Number.isFinite(r)&&Math.floor(r)!==a.monitorIndex)return!1;const c=String(l.frameMode||l.mode||"").trim().toLowerCase();return!c||c===a.frameMode?!0:a.frameMode==="mode5-lzo-delta"&&c==="mode3-h264-hw"}const Bl={free:{name:"Free",price:"$0",limit:er,audience:"Personal trial",note:"5 devices with a standard ad banner."},ltd:{name:"Plus",price:"$5/mo",yearly:"$40/year",ltd:"$79 LTD",limit:bo,audience:"Creators and homelabs",note:"30 devices, no ads, personal use."},pro:{name:"Pro",price:"$15/mo",yearly:"$120/year",ltd:"$199 LTD",limit:UM,audience:"Business and studios",note:"Commercial use and larger workstation walls."}},ay={"mode1-jpeg":5,"mode2-lzo":8,"mode3-h264-hw":20,"mode4-h264-atlas":20};function el(a,l){return`${a}:${l}`}const Gn={frameMode:"mode3-h264-hw",h264DecodeAcceleration:"prefer-hardware",fps:ay["mode3-h264-hw"],maxWidth:1920,maxHeight:1080,atlasTileWidth:320,atlasTileHeight:180,atlasTileSizeMode:"auto",quality:75,autoStartLive:!0,showScreenStatus:!0,visibleOnlyLive:!0,adaptiveLoadShedding:!0,adaptiveSizeByWall:!0},Yn={frameMode:"mode3-h264-hw",h264DecodeAcceleration:"prefer-software",fps:30,maxWidth:1920,maxHeight:1080,quality:75,showScreenStatus:!1};function gu(a,l){if(a.length===0)return 0;const s=[...a].sort((c,d)=>c-d),r=Math.max(0,Math.min(s.length-1,Math.ceil(s.length*l)-1));return s[r]}function Fm(a,l){a.push(l),a.length>Ux&&a.splice(0,a.length-Ux)}function qx(a,l){a.sampleFrames=0,a.sampleStartedAt=l,a.intervalCount=0,a.intervalSumMs=0,a.minIntervalMs=Number.POSITIVE_INFINITY,a.maxIntervalMs=0,a.intervalSamplesMs.length=0,a.seqGapCount=0,a.maxSeqGap=0}function $x(a,l,s){if(a.lastAt!==void 0){const r=Math.max(0,l-a.lastAt);a.intervalCount+=1,a.intervalSumMs+=r,a.minIntervalMs=Math.min(a.minIntervalMs,r),a.maxIntervalMs=Math.max(a.maxIntervalMs,r),Fm(a.intervalSamplesMs,r)}if(a.lastFrameSeq!==void 0){const r=s-a.lastFrameSeq;r!==1&&(a.seqGapCount+=1,a.maxSeqGap=Math.max(a.maxSeqGap,Math.abs(r)))}a.lastAt=l,a.lastFrameSeq=s}function Gx(a){return!a||a.intervalCount<=0?"waiting":`${Math.round(a.averageIntervalMs)}ms avg / p95 ${Math.round(a.p95IntervalMs)}ms / max ${Math.round(a.maxIntervalMs)}ms`}function ZM(){const[a,l]=m.useState({framesPerSecond:0,averageIntervalMs:0,p95IntervalMs:0,maxIntervalMs:0,longTaskCount:0,longTaskMs:0});return m.useEffect(()=>{let s=0,r=performance.now(),c=0,d=0,h=[],p=0,g=0,x=null;const b=S=>{document.visibilityState==="visible"?(c+=1,d>0&&Fm(h,Math.max(0,S-d)),d=S):d=0,s=window.requestAnimationFrame(b)};try{x=new PerformanceObserver(S=>{for(const M of S.getEntries())p+=1,g+=M.duration}),x.observe({entryTypes:["longtask"]})}catch{x=null}s=window.requestAnimationFrame(b);const v=window.setInterval(()=>{const S=performance.now(),M=Math.max(1,S-r),C=h.reduce((j,k)=>j+k,0);l({framesPerSecond:c*1e3/M,averageIntervalMs:h.length>0?C/h.length:0,p95IntervalMs:gu(h,.95),maxIntervalMs:h.length>0?Math.max(...h):0,longTaskCount:p,longTaskMs:g}),r=S,c=0,h=[],p=0,g=0},1e3);return()=>{window.cancelAnimationFrame(s),window.clearInterval(v),x?.disconnect()}},[]),a}function Yx(a){return!a||a.seqGapCount<=0?"none":`${a.seqGapCount} gaps / max ${a.maxSeqGap}`}function WM(a){return Number.isFinite(a)?String(a):"30+"}const xu=[{id:"mode4-h264-atlas",label:"Mode 4",detail:"Hub H.264 Atlas"},{id:"mode3-h264-hw",label:"Mode 3",detail:"H.264 hardware"},{id:"mode2-lzo",label:"Mode 2",detail:"RGB565 LZO wall"},{id:"mode1-jpeg",label:"Mode 1",detail:"JPEG test"}],xm=[{id:"prefer-software",label:"Software low latency"},{id:"prefer-hardware",label:"Hardware decode"},{id:"no-preference",label:"Browser auto"}],JM=[{id:"mode3-h264-hw",label:"Mode 3 - H.264 hardware"},{id:"mode5-lzo-delta",label:"Mode 5 - LZO tile delta"}],vu=[{id:"640x360",label:"Compact",width:640,height:360},{id:"960x540",label:"Standard",width:960,height:540},{id:"1280x720",label:"HD",width:1280,height:720},{id:"1920x1080",label:"Full HD",width:1920,height:1080},{id:"2560x1440",label:"QHD",width:2560,height:1440},{id:"3840x2160",label:"4K",width:3840,height:2160}],Vf=vu.filter(a=>a.width>=1280),Pf=[{id:"auto",label:"Auto by wall size"},{id:"320x180",label:"Standard 320x180",width:320,height:180},{id:"480x270",label:"Sharp 480x270",width:480,height:270}],Im=[1,2,5,8,12,20,30],eC=[20,30,60],Vx=[45,60,75,90],Px={large:{maxWidth:1280,maxHeight:720},medium:{maxWidth:960,maxHeight:540},small:{maxWidth:640,maxHeight:360}},pn={preserveConfiguredFpsDeviceCount:12,visibleRootMargin:"520px 0px 760px 0px",fallbackVisibleCounts:{large:12,medium:18,small:32},maxWallFramesPerSecond:96,maxWallBytesPerSecond:80*1024*1024,maxFrameGapMs:280,lowLoadFrameRatio:.58,lowLoadByteRatio:.52,downshiftCooldownMs:1800,recoveryCooldownMs:14e3,minFps:5},Qx=2200,tC=8e3,nC=3500,aC=2600,lC=4200,iC=750,sC=2,Kx=4200;function Xx(a,l){return Math.min(3e4,a*2**Math.min(3,Math.max(0,l)))}function To(a,l){const s=a.capabilities?.[l];return typeof s=="boolean"?s:/^(1|true|yes|on)$/i.test(String(s||"").trim())}function ko(a){return a.deviceName||a.hostname||a.deviceId}function rC(){return"npx -y livedesk client"}function oC(){return"npx -y livedesk"}function cC(){try{return localStorage.getItem(Wv)||""}catch{return""}}function uC(){try{return localStorage.getItem(hm)==="1"}catch{return!1}}function Zs(a){try{a?localStorage.setItem(hm,"1"):localStorage.removeItem(hm)}catch{}}function Na(a,l,s,r){const c=Number(a);return Number.isFinite(c)?Math.max(l,Math.min(s,Math.round(c))):r}function vm(a){const l=String(a||"").trim();return l==="mode2-lz4"||l==="lz4"?"mode2-lzo":xu.some(s=>s.id===l)?l:Gn.frameMode}function Nu(a){const l=String(a||"").trim();return xm.some(s=>s.id===l)?l:Gn.h264DecodeAcceleration}function ym(a){return a==="mode3-h264-hw"||a==="mode5-lzo-delta"?a:Yn.frameMode}function ly(a){return ay[a]||12}function iy(a){return a==="mode3-h264-hw"||a==="mode4-h264-atlas"?20:30}function bm(a,l){return Na(a,1,iy(l),ly(l))}function ts(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}function $n(a){const l=ts(a.status),s=ts(l.screens),r=ts(a.capabilities),c=[l.monitorCount,l.screenCount,s.count,r.monitorCount,r.screenCount];for(const d of c){const h=Number(d);if(Number.isFinite(h)&&h>0)return Math.max(1,Math.min(64,Math.floor(h)))}return 1}function ji(a){const l=Number(a);return Number.isFinite(l)&&l>0?Math.floor(l):0}function dC(a){const l=ts(a.status),r=[ts(l.screens).displays,l.displays,l.monitors];for(const c of r)if(!(!Array.isArray(c)||c.length===0))return c.map(d=>ts(d));return[]}function sy(a,l){const s=dC(a),r=s.find(g=>Number(g.index)===l)||s[l]||s[0]||{},c=ji(r.width),d=ji(r.height),h=[r.name,r.displayName,r.deviceName,r.id].find(g=>typeof g=="string"&&g.trim()),p=typeof h=="string"?h.trim():`Display ${l+1}`;return{index:l,name:p,width:c,height:d,primary:r.primary===!0||r.isPrimary===!0}}function fC(a){const l=$n(a);return Array.from({length:l},(s,r)=>sy(a,r))}function mC(a){const l=[a.name||`Display ${a.index+1}`];return a.width>0&&a.height>0&&l.push(`${a.width}x${a.height}`),a.primary&&l.push("Primary"),l.join(" - ")}function ry(a,l){const s=sy(a,l);if(s.width>0&&s.height>0)return{width:s.width,height:s.height};const r=ts(a.status),c=ji(r.screenWidth||r.width),d=ji(r.screenHeight||r.height);return c>0&&d>0?{width:c,height:d}:null}function oy(a){if(!a)return null;const l=ji(a.sourceWidth)||ji(a.width),s=ji(a.sourceHeight)||ji(a.height);return l>0&&s>0?{width:l,height:s}:null}function hC(a,l,s){const d=((typeof l?.monitorIndex=="number"?ra(l.monitorIndex,Math.max(1,l.monitorCount||1)):s)===s?oy(l):null)||ry(a,s);return d?Math.max(.25,Math.min(4,d.width/d.height)):16/9}const ou=16/9;function ra(a,l){const s=Math.max(1,Math.min(64,Math.floor(Number(l)||1))),r=Math.floor(Number(a));return Number.isFinite(r)?Math.max(0,Math.min(s-1,r)):0}function pC(){try{const a=JSON.parse(localStorage.getItem(Jv)||"{}");if(![ey,14,13,12,11].includes(Number(a.version)))return Gn;const l=vm(a.frameMode),s=Na(a.maxWidth,320,3840,Gn.maxWidth),r=Na(a.maxHeight,180,2160,Gn.maxHeight);return{frameMode:l,h264DecodeAcceleration:Nu(a.h264DecodeAcceleration),fps:bm(a.fps,l),maxWidth:s,maxHeight:r,atlasTileWidth:Number(a.atlasTileWidth)>=480?480:320,atlasTileHeight:Number(a.atlasTileHeight)>=270?270:180,atlasTileSizeMode:a.atlasTileSizeMode==="fixed"?"fixed":"auto",quality:Na(a.quality,20,95,Gn.quality),autoStartLive:typeof a.autoStartLive=="boolean"?a.autoStartLive:Gn.autoStartLive,showScreenStatus:typeof a.showScreenStatus=="boolean"?a.showScreenStatus:Gn.showScreenStatus,visibleOnlyLive:typeof a.visibleOnlyLive=="boolean"?a.visibleOnlyLive:Gn.visibleOnlyLive,adaptiveLoadShedding:typeof a.adaptiveLoadShedding=="boolean"?a.adaptiveLoadShedding:Gn.adaptiveLoadShedding,adaptiveSizeByWall:typeof a.adaptiveSizeByWall=="boolean"?a.adaptiveSizeByWall:Gn.adaptiveSizeByWall}}catch{return Gn}}function gC(a){try{localStorage.setItem(Jv,JSON.stringify({...a,version:ey}))}catch{}}function xC(){try{const a=JSON.parse(localStorage.getItem(ty)||"{}"),l=Number(a.version);if(![pm,5,4,3,2,1].includes(l))return Yn;const s=Na(a.fps,20,60,Yn.fps),r=l<pm;return{frameMode:r?Yn.frameMode:ym(a.frameMode),h264DecodeAcceleration:r?Yn.h264DecodeAcceleration:Nu(a.h264DecodeAcceleration),fps:r?Yn.fps:s,maxWidth:Na(a.maxWidth,1280,3840,Yn.maxWidth),maxHeight:Na(a.maxHeight,720,2160,Yn.maxHeight),quality:Na(a.quality,20,95,Yn.quality),showScreenStatus:typeof a.showScreenStatus=="boolean"?a.showScreenStatus:Yn.showScreenStatus}}catch{return Yn}}function vC(a){try{localStorage.setItem(ty,JSON.stringify({...a,version:pm}))}catch{}}function cu(a,l){return a.length!==l.length?!1:a.every((s,r)=>s===l[r])}function Qf(a){return[...new Set(a.filter(Boolean))].sort()}function yC(a){return pn.fallbackVisibleCounts[a]||pn.fallbackVisibleCounts.large}function bC(a,l,s){if(a.frameMode==="mode2-lzo")return{maxWidth:320,maxHeight:180};if(a.frameMode==="mode4-h264-atlas")return a.atlasTileSizeMode==="auto"?l==="large"?{maxWidth:480,maxHeight:270}:{maxWidth:320,maxHeight:180}:{maxWidth:a.atlasTileWidth,maxHeight:a.atlasTileHeight};if(!a.adaptiveSizeByWall)return{maxWidth:a.maxWidth,maxHeight:a.maxHeight};const r=Px[l]||Px.large;return{maxWidth:Math.min(a.maxWidth,r.maxWidth),maxHeight:Math.min(a.maxHeight,r.maxHeight)}}function wC(a,l=pn.minFps){const s=[...Im].sort((c,d)=>c-d),r=Math.max(l,Math.floor(a/2));return[...s].reverse().find(c=>c<a&&c>=l)||r}function SC(a,l){return[...Im].sort((r,c)=>r-c).find(r=>r>a&&r<=l)||l}function wo(a){if(!Number.isFinite(a)||a<=0)return"0 B";const l=["B","KB","MB","GB","TB"];let s=a,r=0;for(;s>=1024&&r<l.length-1;)s/=1024,r+=1;const c=r===0||s>=100?0:1;return`${s.toFixed(c)} ${l[r]}`}function Zx(a){if(!Number.isFinite(a)||!a||a<=0)return"0GB";const l=1024**4,s=1024**3;return a>=l?`${Math.max(1,Math.round(a/l))}TB`:`${Math.max(1,Math.round(a/s))}GB`}function Kf(a,l){if(!Number.isFinite(a)||!a||a<=0)return"not reported";const s=Math.max(0,a-Math.max(0,Number(l||0)));return`${Zx(s)} / ${Zx(a)}`}function MC(a){const l=new Uint8Array(a),s=32768;let r="";for(let c=0;c<l.length;c+=s){const d=l.subarray(c,c+s);r+=String.fromCharCode(...d)}return btoa(r)}function Wx(a){return Array.from(a).filter(l=>l.size>=0).map(l=>{const s=l.webkitRelativePath||l.name;return{file:l,relativePath:s,fingerprint:`${l.size}:${l.lastModified}`}})}function CC(a){return a===1?"middle":a===2?"right":"left"}function Jx(a,...l){for(const s of l){const r=a?.[s];if(typeof r=="string"&&r.trim())return r.trim()}return""}function xo(a){const l=Number(a);return Number.isInteger(l)&&l>=1&&l<=IM?l:0}const jC={cpu:"CPU",memory:"MEM",disk:"Disk",gpu:"GPU",vram:"VRAM",npu:"NPU",temp:"Temp",network:"Net"};function NC(a,l,s){if(a==="online")return"Online";if(a==="busy")return"Busy";if(a==="stale")return"Stale";if(a==="offline")return"Offline";if(s==="failed")return"Task failed";const r=a==="critical"?"critical":"warn",c=l.find(h=>h.state===r)||l.find(h=>h.state==="critical"||h.state==="warn");if(!c)return a==="critical"?"Issue":"Check";const d=jC[c.id]||c.label;return c.value&&c.value!=="-"?`${d} ${c.value}`:d}function zu(a,l){const s=l.split(".");let r=a;for(const c of s){if(r==null)return;if(Array.isArray(r)){const d=Number(c);r=Number.isInteger(d)?r[d]:void 0;continue}if(typeof r=="object"){r=r[c];continue}return}return r}function St(a,...l){for(const s of l){const r=zu(a,s),c=Number(r);if(Number.isFinite(c))return c}}function Vn(a,...l){for(const s of l){const r=zu(a,s);if(typeof r=="string"&&r.trim())return r.trim();if(typeof r=="number"&&Number.isFinite(r))return String(r)}return""}function AC(a,...l){for(const s of l){const r=zu(a,s);if(typeof r=="boolean")return r;if(/^(1|true|yes|on|online|running|ready)$/i.test(String(r||"").trim()))return!0;if(/^(0|false|no|off|offline|stopped|missing)$/i.test(String(r||"").trim()))return!1}}function Hl(a){const l=Number(a);if(Number.isFinite(l))return Math.max(0,Math.min(1,l>1?l/100:l))}function Xf(a,l){if(!(typeof a!="number"||typeof l!="number"||!Number.isFinite(a)||!Number.isFinite(l)||a<=0))return Hl((a-Math.max(0,l))/a)}function Ws(a){return a===void 0?"-":`${Math.round(a*100)}%`}function Zf(a){return a===void 0||!Number.isFinite(a)?"":a>=1e3?`${(a/1e3).toFixed(a>=1e4?0:1)}Gb/s`:`${Math.round(a)}Mb/s`}function Xi(a,l=.92,s=.78){return a===void 0?"unknown":a>=l?"critical":a>=s?"warn":"good"}function cy(a){return!Number.isFinite(a)||!a||a<=0?"-":a<3600?`${Math.round(a/60)}m`:a<86400?`${Math.round(a/3600)}h`:`${Math.round(a/86400)}d`}function uu(a,l,s){const r=zu(a,`tools.${l}`),c=Vn(a,`tools.${l}.status`,`tooling.${l}.status`,`${l}.status`).toLowerCase(),d=AC(a,`tools.${l}.running`,`tooling.${l}.running`,`${l}.running`),h=Vn(a,`tools.${l}.version`,`tooling.${l}.version`,`${l}.version`),p=Vn(a,`tools.${l}.port`,`tooling.${l}.port`,`${l}.port`);let g="unknown";return c==="busy"?g="busy":["online","running","ready","active"].includes(c)||d===!0?g="online":(["offline","stopped","missing","not-found"].includes(c)||d===!1||r===!1)&&(g="offline"),{id:l,label:s,status:g,detail:g==="offline"?"offline":h||(p?`:${p}`:g==="unknown"?"not reported":g)}}function uy(a){const l=a.status||{},s=St(l,"cpu.cores","cpuCores","processorCount"),r=St(l,"loadavg.0","cpu.load1"),c=Hl(St(l,"cpu.usedRatio","cpu.usageRatio","cpu.ratio","cpu.usedPct","cpu.usagePct","cpu.percent")??(s&&r!==void 0?r/Math.max(1,s):void 0)),d=St(l,"memory.totalBytes","totalMem"),h=St(l,"memory.freeBytes","freeMem"),p=Hl(St(l,"memory.usedRatio","memory.usedPct","usedMemRatio"))??Xf(d,h),g=St(l,"disk.totalBytes","rootDisk.totalBytes","storage.totalBytes"),x=St(l,"disk.freeBytes","rootDisk.freeBytes","storage.freeBytes"),b=Hl(St(l,"disk.usedRatio","disk.usedPct","rootDisk.usedRatio","storage.usedRatio"))??Xf(g,x),v=St(l,"thermal.cpuC","temperatureC","cpu.temperatureC","gpu.temperatureC"),S=Hl(St(l,"gpu.usedRatio","gpu.usageRatio","gpu.usedPct","gpu.usagePct","gpu.percent","accelerators.gpu.usageRatio")),M=Vn(l,"gpu.name","gpu.model","accelerators.gpu.name"),C=St(l,"gpu.memory.totalBytes","gpu.totalMemoryBytes","gpu.vramTotalBytes"),j=St(l,"gpu.memory.freeBytes","gpu.freeMemoryBytes","gpu.vramFreeBytes"),k=Hl(St(l,"gpu.memory.usedRatio","gpu.vramUsedRatio"))??Xf(C,j),T=St(l,"gpu.temperatureC","thermal.gpuC"),A=Hl(St(l,"npu.usedRatio","npu.usageRatio","npu.usedPct","npu.usagePct","npu.percent","accelerators.npu.usageRatio")),z=Vn(l,"npu.name","npu.model","accelerators.npu.name"),G=St(l,"npu.tops","npu.topsInt8","accelerators.npu.tops"),I=St(l,"network.rxMbps","network.receiveMbps","network.downMbps"),W=St(l,"network.txMbps","network.transmitMbps","network.upMbps"),R=St(l,"network.latencyMs","network.rttMs"),ee=Hl(St(l,"network.usedRatio","network.usageRatio","network.saturationRatio")),se=Vn(l,"network.link","network.interface","network.name"),V=v===void 0?void 0:Hl((v-35)/60),fe=Vn(l,"workload.role","role","lane")||(To(a,"aiAssist")?"Agent worker":To(a,"taskDispatch")?"Task worker":"Local machine"),$=Vn(a.latestTask,"status")||Vn(l,"workload.status")||"idle",oe=Vn(a.latestTask,"title","instructionPreview")||Vn(l,"workload.title"),le=Vn(a.latestTask,"resultSummary","error","instructionPreview")||Vn(l,"workload.summary"),ue=[uu(l,"ollama","Ollama"),uu(l,"lmStudio","LM Studio"),uu(l,"comfyui","ComfyUI"),uu(l,"stableDiffusion","Stable Diffusion")],H=ue.some(L=>L.status!=="unknown"),X=Date.parse(a.lastSeenAt||a.connectedAt||""),te=Number.isFinite(X)?Date.now()-X:0;let E="online";a.connected?te>5*6e4?E="stale":(v??0)>=86||(T??0)>=88||(c??0)>=.94||(S??0)>=.96||(k??0)>=.96||(A??0)>=.96||(p??0)>=.94||(b??0)>=.94||(R??0)>=200||$==="failed"?E="critical":(v??0)>=78||(T??0)>=80||(c??0)>=.82||(S??0)>=.86||(k??0)>=.88||(A??0)>=.86||(p??0)>=.82||(b??0)>=.86||(R??0)>=80?E="warn":(["queued","running","targeted"].includes($)||ue.some(L=>L.status==="busy"))&&(E="busy"):E="offline";const P=ue.filter(L=>L.status==="online"||L.status==="busy").length,ne=[{id:"cpu",label:"CPU",value:Ws(c),detail:s?`${s} cores`:r!==void 0?`load ${r.toFixed(1)}`:"not reported",ratio:c,state:Xi(c,.92,.78)},{id:"memory",label:"RAM",value:Ws(p),detail:Kf(d,h),ratio:p,state:Xi(p,.92,.78)},{id:"disk",label:"DISK",value:Ws(b),detail:Kf(g,x),ratio:b,state:Xi(b,.92,.82)},{id:"gpu",label:"GPU",value:Ws(S),detail:M||(C&&j!==void 0?`${wo(j)} VRAM free`:T!==void 0?`${Math.round(T)}C`:"not reported"),ratio:S,state:T!==void 0&&T>=88?"critical":T!==void 0&&T>=80?"warn":Xi(S,.96,.86)},{id:"vram",label:"VRAM",value:Ws(k),detail:Kf(C,j),ratio:k,state:Xi(k,.96,.88)},{id:"npu",label:"NPU",value:A!==void 0?Ws(A):G!==void 0?`${Math.round(G)} TOPS`:"-",detail:z||(G!==void 0?"neural engine":"not reported"),ratio:A,state:Xi(A,.96,.86)},{id:"temp",label:"TEMP",value:v===void 0?"-":`${Math.round(v)}C`,detail:P>0?`${P} local tools`:`uptime ${cy(St(l,"uptimeSec"))}`,ratio:V,state:v===void 0?"unknown":v>=86?"critical":v>=78?"warn":"good"},{id:"network",label:"NET",value:Zf(I)||(R!==void 0?`${Math.round(R)}ms`:se||"-"),detail:Zf(W)?`${Zf(W)} up`:se||"not reported",ratio:ee,state:R!==void 0&&R>=200?"critical":R!==void 0&&R>=80?"warn":Xi(ee,.9,.75)}];return{state:E,label:NC(E,ne,$),role:fe,taskLabel:oe||($==="idle"?"idle":$),taskStatus:$,taskSummary:le,tools:H?ue:ue.map(L=>({...L,detail:"not reported"})),metrics:ne}}const TC=[{id:"small",label:"Small"},{id:"medium",label:"Medium"},{id:"large",label:"Large"}],kC=[{id:"wall",label:"Wall",icon:tm,accent:"blue"},{id:"control",label:"Control",icon:fu,accent:"red"},{id:"share-files",label:"Share Files",icon:du,accent:"green"},{id:"agents",label:"Agents",icon:vo,accent:"violet"},{id:"doc",label:"Doc",icon:nm,accent:"amber"},{id:"pricing",label:"Pricing",icon:yo,accent:"green"}];function Rt(a){return a.replace(/\bRemoteHub\b/g,"Hub client endpoint").replace(/\bManagers\b/g,"Hubs").replace(/\bManager\b/g,"Hub").replace(/\bmanager\b/g,"Hub").replace(/\bMANAGER\b/g,"HUB").replace(/매니저/g,"Hub")}function Js(a){return a.map(l=>Rt(l))}function mn(a){return{languageName:a.languageName,languageLabel:a.languageLabel,eyebrow:a.eyebrow,title:Rt(a.title),intro:Rt(a.intro),sections:[{title:Rt(a.managerTitle),body:Rt(a.managerBody),points:Js(a.managerPoints)},{title:Rt(a.clientTitle),body:Rt(a.clientBody),points:Js(a.clientPoints)},{title:Rt(a.syncTitle),body:Rt(a.syncBody),points:Js(a.syncPoints)},{title:Rt(a.platformTitle),body:Rt(a.platformBody),points:Js(a.platformPoints)}],sync:{title:Rt(a.syncTitle),body:Rt(a.syncBody),points:Js(a.syncPoints)},firewall:{title:Rt(a.firewallTitle),body:Rt(a.firewallBody),points:Js(a.firewallPoints)},commands:{title:Rt(a.commandsTitle),body:Rt(a.commandsBody),manager:Rt(a.managerCommandLabel),primary:Rt(a.clientCommandLabel),slot:Rt(a.slotCommandLabel),manual:Rt(a.manualCommandLabel)}}}const lr={ko:mn({languageName:"한국어",languageLabel:"문서 언어",eyebrow:"LiveDesk Manual",title:"한 줄로 여는 로컬 Screen Wall",intro:"LiveDesk는 매니저 PC 한 대에서 여러 작업 PC, AI 박스, 맥미니, 개발 장비를 한 화면에 모니터링하고 필요한 제어를 실행하는 npm-first 원격 작업 데크입니다.",managerTitle:"1. 매니저 실행",managerBody:"화면을 모아 볼 컴퓨터에서 LiveDesk 매니저를 실행합니다. 매니저는 UI와 로컬 서버를 같이 열고 브라우저를 http://127.0.0.1:5179 로 띄웁니다.",managerPoints:["명령은 npx -y livedesk 입니다.","매니저는 Screen Wall/API 포트 5179와 클라이언트 접속 포트 5197을 사용합니다.","기존 LiveDesk 포트가 남아 있으면 기본적으로 정리하고 새로 시작합니다. 필요하면 --no-clean 을 붙입니다."],clientTitle:"2. 워크스테이션 연결",clientBody:"모니터링할 PC에서는 Google 로그인 또는 Hub 화면의 6자리 PIN으로 연결합니다. Hub가 켜져 있지 않아도 클라이언트는 종료하지 않고 5초마다 계속 찾습니다.",clientPoints:["빈 자리에 자동 배치하려면 npx -y livedesk client 를 실행합니다.","자리 번호를 고정하려면 npx -y livedesk client 3 처럼 번호를 붙입니다.","브라우저 연결 페이지에서 Google 버튼 또는 6자리 PIN 입력 중 하나를 선택합니다."],syncTitle:"3. Sync Server와 자동 발견",syncBody:"Sync Server는 이 매니저를 현재 계정의 활성 Screen Wall로 Supabase에 등록합니다. 클라이언트는 같은 Google 계정으로 로그인한 뒤 그 기록을 읽고 접속 후보들을 순서대로 시도합니다.",syncPoints:["등록 정보에는 host instance, LAN/private 주소, public 후보 주소, pair token, 짧은 lease가 포함됩니다.","같은 LAN 후보를 먼저 쓰고, 필요하면 외부 주소 후보를 시도합니다.","매니저 위치, VPN, 방화벽, 공유기 설정이 바뀌었거나 개발 중 활성 매니저를 바꿀 때 Sync Server를 누릅니다.","이제 livedesk.pages.dev의 Chrome Local Network Access 허용은 기본 실행 경로가 아닙니다. npm 매니저 앱이 실제 서버입니다."],platformTitle:"4. 현재 플랫폼 상태",platformBody:"Windows는 실제 화면 전송까지 확인되었습니다. macOS와 Linux도 npm 구조로 같은 명령을 목표로 지원을 넓히고 있습니다.",platformPoints:["Windows: 현재 작동 확인.","macOS: manager/client 경로는 준비되어 있으며 화면 캡처와 제어에는 Screen Recording/Accessibility 권한이 필요합니다.","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot 캡처, xdotool 입력 백엔드가 추가되었습니다. 오디오는 아직 비활성입니다."],firewallTitle:"방화벽과 외부 장소 연결",firewallBody:"같은 LAN 안에서는 보통 공유기 포트포워딩이 필요 없습니다. 다른 장소의 PC를 붙이려면 클라이언트가 매니저의 클라이언트 접속 포트에 도달할 수 있어야 합니다.",firewallPoints:["클라이언트 접속 포트는 TCP 5197입니다.","클라이언트 쪽은 나가는 연결이므로 보통 인바운드 포트 개방이 필요 없습니다.","다른 네트워크에서 붙일 때는 매니저 PC 방화벽에서 TCP 5197 인바운드를 허용하고, 공유기에서는 TCP 5197을 매니저 PC로 전달합니다.","Screen Wall/API 포트 5179는 매니저 UI용입니다. 외부 브라우저에서 Wall을 직접 열 필요가 있을 때만 별도로 노출을 검토합니다.","공개 인터넷에 바로 열기보다 VPN, Tailscale, ZeroTier, 고정 IP allowlist를 우선합니다."],commandsTitle:"현재 사용 명령",commandsBody:"웹사이트를 찾아가 설치 파일을 받는 방식보다 터미널 한 줄로 모든 운영체제에서 거의 같은 흐름을 쓰는 것이 LiveDesk의 기본 방향입니다.",managerCommandLabel:"매니저 시작",clientCommandLabel:"워크스테이션 연결",slotCommandLabel:"3번 슬롯에 고정",manualCommandLabel:"고급 수동 연결"}),en:mn({languageName:"English",languageLabel:"Document language",eyebrow:"LiveDesk Manual",title:"Open a local Screen Wall with one command",intro:"LiveDesk is an npm-first remote work deck for monitoring many workstations, AI boxes, Mac minis, and dev machines from one manager PC.",managerTitle:"1. Run the manager",managerBody:"Run LiveDesk on the computer that will watch the screens. The manager starts the UI and local server together, then opens http://127.0.0.1:5179.",managerPoints:["The command is npx -y livedesk.","The manager uses port 5179 for the Screen Wall/API and port 5197 for client connections.","If an old LiveDesk process still owns those ports, startup cleans it by default. Add --no-clean when you want to keep it."],clientTitle:"2. Connect a workstation",clientBody:"On each monitored computer, connect with Google sign-in or the 6-digit PIN shown on the Hub screen. If no manager is online yet, the client keeps running and retries every 5 seconds.",clientPoints:["Run npx -y livedesk client for first available placement.","Run npx -y livedesk client 3 to pin the machine to slot 3.","The browser connection page lets you choose Google or a 6-digit PIN."],syncTitle:"3. Sync Server and discovery",syncBody:"Sync Server publishes this manager as the active Screen Wall for the signed-in account. Clients read that Supabase record after Google sign-in and try the endpoint candidates in order.",syncPoints:["The record includes host instance, LAN/private addresses, public endpoint candidates, pair token, and a short lease.","LAN candidates are preferred first, then public candidates if needed.","Press Sync Server after manager moves, VPN/firewall/router changes, or when this development machine should take over as active manager.","Chrome Local Network Access on livedesk.pages.dev is no longer the default runtime path. The npm manager app is the real server."],platformTitle:"4. Current platform state",platformBody:"Windows has been verified with live screen transfer. macOS and Linux follow the same npm command path as support expands.",platformPoints:["Windows: verified working.","macOS: manager/client paths are prepared; screen capture and control require Screen Recording/Accessibility permissions.","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot capture, and xdotool input backend are added. Audio is still disabled."],firewallTitle:"Firewall and remote locations",firewallBody:"On the same LAN, router forwarding is usually unnecessary. For another office, building, or country, clients must be able to reach the manager client port.",firewallPoints:["Client connection port: TCP 5197.","Client machines normally only need outbound access.","For remote networks, allow inbound TCP 5197 on the manager firewall and forward TCP 5197 from the router to the manager PC.","Screen Wall/API port 5179 is for the manager UI. Expose it only if a remote browser must open the Wall directly.","Prefer VPN, Tailscale, ZeroTier, or fixed-IP allowlists over public internet exposure."],commandsTitle:"Current commands",commandsBody:"The product direction is one terminal command across operating systems instead of finding a website, downloading, and installing manually.",managerCommandLabel:"Start manager",clientCommandLabel:"Connect workstation",slotCommandLabel:"Pin to slot 3",manualCommandLabel:"Advanced manual connection"}),ja:mn({languageName:"日本語",languageLabel:"ドキュメント言語",eyebrow:"LiveDesk Manual",title:"1行でローカル Screen Wall を開く",intro:"LiveDesk は、複数の作業 PC、AI マシン、Mac mini、開発機を1台の manager PC から監視する npm-first のリモート作業デッキです。",managerTitle:"1. manager を実行",managerBody:"画面を集めて見るコンピューターで LiveDesk manager を実行します。UI とローカルサーバーが同時に起動し、http://127.0.0.1:5179 が開きます。",managerPoints:["コマンドは npx -y livedesk です。","Screen Wall/API は 5179、client 接続は 5197 を使います。","古い LiveDesk プロセスがポートを使っている場合は、基本的に自動で整理して起動します。"],clientTitle:"2. workstation を接続",clientBody:"監視される PC で同じ Google アカウントにログインします。manager がまだ無くても client は終了せず、5秒ごとに再試行します。",clientPoints:["空きスロットに入れるには npx -y livedesk client を実行します。","スロットを固定するには npx -y livedesk client 3 のように番号を付けます。","大量の PC でも再ログインなしで待ち続けます。"],syncTitle:"3. Sync Server と自動検出",syncBody:"Sync Server はこの manager を現在の Google アカウントの active Screen Wall として Supabase に登録します。",syncPoints:["host instance、LAN/private アドレス、public 候補、pair token、短い lease を登録します。","client は LAN 候補を優先し、必要なら public 候補も試します。","VPN、firewall、router、manager の場所が変わったら Sync Server を押します。","livedesk.pages.dev の Chrome Local Network Access は標準実行経路ではありません。npm manager アプリが実際のサーバーです。"],platformTitle:"4. 現在のプラットフォーム状態",platformBody:"Windows は live screen transfer まで確認済みです。macOS と Linux も同じ npm コマンド経路を目標に対応を広げています。",platformPoints:["Windows: 動作確認済み。","macOS: 画面取得と制御には Screen Recording/Accessibility 権限が必要です。","Linux: linux-x64 runtime、grim/gnome-screenshot/import/scrot capture、xdotool input backend を追加済み。audio は未対応です。"],firewallTitle:"Firewall と外部拠点",firewallBody:"同じ LAN なら通常 router forwarding は不要です。外部拠点では client が manager の接続ポートへ到達できる必要があります。",firewallPoints:["client 接続ポートは TCP 5197 です。","client 側は通常 outbound だけで足ります。","外部 network では manager PC の firewall で TCP 5197 inbound を許可し、router から manager PC へ forward します。","5179 は manager UI 用なので、外部ブラウザで Wall を開く必要がある時だけ公開を検討します。","公開 internet より VPN、Tailscale、ZeroTier、IP allowlist を優先してください。"],commandsTitle:"現在のコマンド",commandsBody:"Web サイトから installer を探すより、OS をまたいで terminal 1行で動かす方向です。",managerCommandLabel:"manager 起動",clientCommandLabel:"workstation 接続",slotCommandLabel:"slot 3 に固定",manualCommandLabel:"高度な手動接続"}),"zh-CN":mn({languageName:"简体中文",languageLabel:"文档语言",eyebrow:"LiveDesk Manual",title:"用一条命令打开本地 Screen Wall",intro:"LiveDesk 是 npm-first 的远程工作台,用一台 manager PC 监控多台工作站、AI 主机、Mac mini 和开发机器。",managerTitle:"1. 运行 manager",managerBody:"在负责查看屏幕的电脑上运行 LiveDesk manager。它会同时启动 UI 和本地服务器,并打开 http://127.0.0.1:5179。",managerPoints:["命令是 npx -y livedesk。","Screen Wall/API 使用 5179,client 连接使用 5197。","如果旧的 LiveDesk 进程占用端口,默认会清理后重新启动。"],clientTitle:"2. 连接 workstation",clientBody:"在被监控的电脑上使用同一个 Google 账号登录。即使 manager 还没在线,client 也会继续运行并每 5 秒重试。",clientPoints:["自动放入空位: npx -y livedesk client。","固定到 3 号位置: npx -y livedesk client 3。","大量电脑也可以持续等待,不需要反复登录。"],syncTitle:"3. Sync Server 和自动发现",syncBody:"Sync Server 会把当前 manager 作为该账号的 active Screen Wall 写入 Supabase。client 登录后读取记录并依次尝试连接候选地址。",syncPoints:["记录包括 host instance、LAN/private 地址、public 候选、pair token 和短 lease。","优先尝试同一 LAN 地址,需要时再尝试外部地址。","manager 位置、VPN、防火墙或路由变化后请点击 Sync Server。","livedesk.pages.dev 的 Chrome Local Network Access 不再是默认运行方式。npm manager app 才是真正服务器。"],platformTitle:"4. 当前平台状态",platformBody:"Windows 已确认可传输实时画面。macOS 和 Linux 正按同一 npm 命令路径扩展支持。",platformPoints:["Windows: 已确认可用。","macOS: 画面捕获和控制需要 Screen Recording/Accessibility 权限。","Linux: 已加入 linux-x64 runtime、grim/gnome-screenshot/import/scrot 捕获、xdotool 输入后端。音频尚未启用。"],firewallTitle:"防火墙和外部地点",firewallBody:"同一 LAN 通常不需要路由端口转发。不同地点连接时,client 必须能访问 manager 的 client 连接端口。",firewallPoints:["client 连接端口是 TCP 5197。","client 机器通常只需要出站访问。","跨网络时,在 manager 防火墙放行 TCP 5197 入站,并在路由器转发到 manager PC。","5179 是 manager UI 端口,仅在需要远程浏览器直接打开 Wall 时考虑暴露。","优先使用 VPN、Tailscale、ZeroTier 或固定 IP allowlist。"],commandsTitle:"当前命令",commandsBody:"产品方向是跨操作系统使用一条终端命令,而不是先找网站、下载、安装。",managerCommandLabel:"启动 manager",clientCommandLabel:"连接 workstation",slotCommandLabel:"固定到 slot 3",manualCommandLabel:"高级手动连接"}),"zh-TW":mn({languageName:"繁體中文",languageLabel:"文件語言",eyebrow:"LiveDesk Manual",title:"用一行指令開啟本機 Screen Wall",intro:"LiveDesk 是 npm-first 的遠端工作台,用一台 manager PC 監看多台工作站、AI 主機、Mac mini 與開發機。",managerTitle:"1. 執行 manager",managerBody:"在負責看畫面的電腦上執行 LiveDesk manager。它會同時啟動 UI 與本機伺服器,並開啟 http://127.0.0.1:5179。",managerPoints:["指令是 npx -y livedesk。","Screen Wall/API 使用 5179,client 連線使用 5197。","若舊的 LiveDesk 程序占用連接埠,預設會清理後重新啟動。"],clientTitle:"2. 連接 workstation",clientBody:"在被監看的電腦上使用同一個 Google 帳號登入。即使 manager 尚未上線,client 也會持續執行並每 5 秒重試。",clientPoints:["自動放入空位: npx -y livedesk client。","固定到 3 號位置: npx -y livedesk client 3。","大量電腦也能持續等待,不需要反覆登入。"],syncTitle:"3. Sync Server 與自動探索",syncBody:"Sync Server 會把目前 manager 登錄為此帳號的 active Screen Wall。client 登入後讀取 Supabase 記錄並依序嘗試連線候選地址。",syncPoints:["記錄包含 host instance、LAN/private 位址、public 候選、pair token 與短 lease。","優先嘗試 LAN 位址,需要時再嘗試外部位址。","manager 位置、VPN、防火牆或路由設定改變後請按 Sync Server。","livedesk.pages.dev 的 Chrome Local Network Access 不再是預設執行路徑。npm manager app 才是真正伺服器。"],platformTitle:"4. 目前平台狀態",platformBody:"Windows 已確認可傳輸即時畫面。macOS 與 Linux 也沿用相同 npm 指令路徑擴充支援。",platformPoints:["Windows: 已確認可用。","macOS: 畫面擷取與控制需要 Screen Recording/Accessibility 權限。","Linux: 已加入 linux-x64 runtime、grim/gnome-screenshot/import/scrot capture、xdotool input backend。音訊尚未啟用。"],firewallTitle:"防火牆與外部地點",firewallBody:"同一 LAN 通常不需要路由器轉發。不同地點連線時,client 必須能到達 manager 的 client 連線埠。",firewallPoints:["client 連線埠是 TCP 5197。","client 電腦通常只需要對外連線。","跨網路時,請在 manager 防火牆允許 TCP 5197 inbound,並從路由器轉發到 manager PC。","5179 是 manager UI 連接埠,只在需要遠端瀏覽器直接打開 Wall 時才考慮公開。","優先使用 VPN、Tailscale、ZeroTier 或固定 IP allowlist。"],commandsTitle:"目前指令",commandsBody:"產品方向是跨作業系統用一行 terminal 指令,而不是先找網站、下載、安裝。",managerCommandLabel:"啟動 manager",clientCommandLabel:"連接 workstation",slotCommandLabel:"固定到 slot 3",manualCommandLabel:"進階手動連線"}),es:mn({languageName:"Español",languageLabel:"Idioma del documento",eyebrow:"LiveDesk Manual",title:"Abre un Screen Wall local con un comando",intro:"LiveDesk es una consola npm-first para vigilar muchas estaciones, cajas de IA, Mac mini y equipos de desarrollo desde un PC manager.",managerTitle:"1. Ejecuta el manager",managerBody:"Ejecuta LiveDesk en el equipo que verá las pantallas. El manager inicia la UI y el servidor local juntos y abre http://127.0.0.1:5179.",managerPoints:["El comando es npx -y livedesk.","El manager usa 5179 para Screen Wall/API y 5197 para conexiones client.","Si un proceso antiguo ocupa los puertos, el arranque lo limpia por defecto."],clientTitle:"2. Conecta una workstation",clientBody:"En cada equipo monitoreado, inicia sesión con la misma cuenta Google. Si el manager aún no está activo, el client sigue intentando cada 5 segundos.",clientPoints:["Usa npx -y livedesk client para el primer slot libre.","Usa npx -y livedesk client 3 para fijar el equipo al slot 3.","Los clients siguen esperando para no repetir login en muchas máquinas."],syncTitle:"3. Sync Server y descubrimiento",syncBody:"Sync Server publica este manager como Screen Wall activo para la cuenta. Los clients leen el registro en Supabase y prueban los endpoints.",syncPoints:["Incluye host instance, direcciones LAN/private, candidatos public, pair token y lease corto.","Primero se prueban candidatos LAN, luego públicos si hace falta.","Pulsa Sync Server después de cambios de manager, VPN, firewall o router.","Chrome Local Network Access en livedesk.pages.dev ya no es el flujo principal. La app npm manager es el servidor real."],platformTitle:"4. Estado de plataformas",platformBody:"Windows ya fue verificado con transferencia de pantalla. macOS y Linux siguen el mismo camino npm.",platformPoints:["Windows: verificado.","macOS: captura y control requieren permisos Screen Recording/Accessibility.","Linux: agregado linux-x64 runtime, captura grim/gnome-screenshot/import/scrot y entrada xdotool. Audio aún desactivado."],firewallTitle:"Firewall y sedes remotas",firewallBody:"En la misma LAN normalmente no hace falta port forwarding. Para otra red, los clients deben llegar al puerto client del manager.",firewallPoints:["Puerto de conexión client: TCP 5197.","Los equipos client normalmente solo necesitan salida.","Para redes remotas, permite TCP 5197 inbound en el manager y reenvía TCP 5197 al PC manager.","El puerto 5179 es para la UI del manager; expónlo solo si un navegador remoto debe abrir el Wall.","Prefiere VPN, Tailscale, ZeroTier o allowlist de IP fijas."],commandsTitle:"Comandos actuales",commandsBody:"La dirección del producto es un comando de terminal común entre sistemas, no descargar e instalar desde una web.",managerCommandLabel:"Iniciar manager",clientCommandLabel:"Conectar workstation",slotCommandLabel:"Fijar al slot 3",manualCommandLabel:"Conexión manual avanzada"}),fr:mn({languageName:"Français",languageLabel:"Langue du document",eyebrow:"LiveDesk Manual",title:"Ouvrir un Screen Wall local en une commande",intro:"LiveDesk est un deck npm-first pour surveiller plusieurs postes, machines IA, Mac mini et machines dev depuis un PC manager.",managerTitle:"1. Lancer le manager",managerBody:"Lancez LiveDesk sur l’ordinateur qui observe les écrans. Le manager démarre l’UI et le serveur local, puis ouvre http://127.0.0.1:5179.",managerPoints:["La commande est npx -y livedesk.","Le manager utilise 5179 pour Screen Wall/API et 5197 pour les connexions client.","Si un ancien processus utilise les ports, le démarrage le nettoie par défaut."],clientTitle:"2. Connecter une workstation",clientBody:"Sur chaque ordinateur surveillé, connectez-vous avec le même compte Google. Si le manager n’est pas encore actif, le client réessaie toutes les 5 secondes.",clientPoints:["Utilisez npx -y livedesk client pour le premier slot libre.","Utilisez npx -y livedesk client 3 pour fixer la machine au slot 3.","Les clients continuent d’attendre pour éviter les reconnexions répétées."],syncTitle:"3. Sync Server et découverte",syncBody:"Sync Server publie ce manager comme Screen Wall actif du compte. Les clients lisent l’enregistrement Supabase et testent les endpoints.",syncPoints:["Il contient host instance, adresses LAN/private, candidats public, pair token et lease court.","Les candidats LAN sont essayés en premier, puis les candidats publics si besoin.","Cliquez Sync Server après un changement de manager, VPN, firewall ou routeur.","Chrome Local Network Access sur livedesk.pages.dev n’est plus le chemin par défaut. L’app npm manager est le vrai serveur."],platformTitle:"4. État des plateformes",platformBody:"Windows est vérifié avec transfert d’écran live. macOS et Linux suivent le même chemin npm.",platformPoints:["Windows: vérifié.","macOS: capture et contrôle nécessitent Screen Recording/Accessibility.","Linux: runtime linux-x64, capture grim/gnome-screenshot/import/scrot et entrée xdotool ajoutés. Audio désactivé."],firewallTitle:"Firewall et sites distants",firewallBody:"Sur le même LAN, le port forwarding est rarement nécessaire. Depuis un autre réseau, les clients doivent atteindre le port client du manager.",firewallPoints:["Port de connexion client: TCP 5197.","Les machines client ont normalement seulement besoin de sortie réseau.","Pour un réseau distant, autorisez TCP 5197 entrant sur le manager et redirigez TCP 5197 vers le PC manager.","Le port 5179 sert à l’UI manager; exposez-le seulement si un navigateur distant doit ouvrir le Wall.","Préférez VPN, Tailscale, ZeroTier ou allowlist IP fixes."],commandsTitle:"Commandes actuelles",commandsBody:"La direction produit est une commande terminal commune aux OS, plutôt qu’un téléchargement manuel depuis un site.",managerCommandLabel:"Démarrer manager",clientCommandLabel:"Connecter workstation",slotCommandLabel:"Fixer au slot 3",manualCommandLabel:"Connexion manuelle avancée"}),de:mn({languageName:"Deutsch",languageLabel:"Dokumentsprache",eyebrow:"LiveDesk Manual",title:"Lokale Screen Wall mit einem Befehl öffnen",intro:"LiveDesk ist ein npm-first Arbeitsdeck, um viele Workstations, AI-Boxen, Mac minis und Dev-Rechner von einem Manager-PC zu überwachen.",managerTitle:"1. Manager starten",managerBody:"Starte LiveDesk auf dem Computer, der die Screens sieht. Der Manager startet UI und lokalen Server zusammen und öffnet http://127.0.0.1:5179.",managerPoints:["Der Befehl ist npx -y livedesk.","Der Manager nutzt 5179 für Screen Wall/API und 5197 für Client-Verbindungen.","Wenn alte LiveDesk-Prozesse Ports belegen, werden sie beim Start standardmäßig bereinigt."],clientTitle:"2. Workstation verbinden",clientBody:"Melde dich auf jedem überwachten Computer mit demselben Google-Konto an. Wenn kein Manager online ist, versucht der Client alle 5 Sekunden weiter.",clientPoints:["npx -y livedesk client nutzt den ersten freien Slot.","npx -y livedesk client 3 fixiert den Rechner auf Slot 3.","Clients warten weiter, damit große Setups kein wiederholtes Login brauchen."],syncTitle:"3. Sync Server und Discovery",syncBody:"Sync Server veröffentlicht diesen Manager als aktive Screen Wall des Kontos. Clients lesen den Supabase-Eintrag und testen Endpoints der Reihe nach.",syncPoints:["Enthält host instance, LAN/private Adressen, public Kandidaten, pair token und kurze lease.","LAN-Kandidaten werden zuerst versucht, danach public Kandidaten.","Nach Änderungen an Manager, VPN, Firewall oder Router Sync Server drücken.","Chrome Local Network Access auf livedesk.pages.dev ist nicht mehr der Standardpfad. Die npm Manager App ist der echte Server."],platformTitle:"4. Plattformstatus",platformBody:"Windows wurde mit Live-Screen-Transfer geprüft. macOS und Linux folgen demselben npm-Pfad.",platformPoints:["Windows: verifiziert.","macOS: Capture und Control brauchen Screen Recording/Accessibility Rechte.","Linux: linux-x64 Runtime, grim/gnome-screenshot/import/scrot Capture und xdotool Input Backend sind ergänzt. Audio ist deaktiviert."],firewallTitle:"Firewall und entfernte Standorte",firewallBody:"Im gleichen LAN ist Router-Forwarding meist unnötig. Aus anderen Netzwerken müssen Clients den Client-Port des Managers erreichen.",firewallPoints:["Client-Verbindungsport: TCP 5197.","Client-Rechner brauchen normalerweise nur ausgehenden Zugriff.","Für entfernte Netzwerke TCP 5197 inbound am Manager erlauben und vom Router zum Manager-PC forwarden.","Port 5179 ist für die Manager-UI; nur öffnen, wenn ein Remote-Browser die Wall direkt öffnen muss.","VPN, Tailscale, ZeroTier oder feste IP-Allowlists bevorzugen."],commandsTitle:"Aktuelle Befehle",commandsBody:"Die Produktlinie ist ein Terminalbefehl über Betriebssysteme hinweg, statt Website suchen, herunterladen und installieren.",managerCommandLabel:"Manager starten",clientCommandLabel:"Workstation verbinden",slotCommandLabel:"An Slot 3 fixieren",manualCommandLabel:"Erweiterte manuelle Verbindung"}),"pt-BR":mn({languageName:"Português",languageLabel:"Idioma do documento",eyebrow:"LiveDesk Manual",title:"Abra um Screen Wall local com um comando",intro:"LiveDesk é um deck npm-first para monitorar várias estações, caixas de IA, Mac minis e máquinas dev a partir de um PC manager.",managerTitle:"1. Execute o manager",managerBody:"Rode LiveDesk no computador que verá as telas. O manager inicia a UI e o servidor local juntos e abre http://127.0.0.1:5179.",managerPoints:["O comando é npx -y livedesk.","O manager usa 5179 para Screen Wall/API e 5197 para conexões client.","Se um processo antigo ocupa as portas, a inicialização limpa por padrão."],clientTitle:"2. Conecte uma workstation",clientBody:"Em cada computador monitorado, entre com a mesma conta Google. Se o manager ainda não estiver online, o client tenta a cada 5 segundos.",clientPoints:["Use npx -y livedesk client para o primeiro slot livre.","Use npx -y livedesk client 3 para fixar no slot 3.","Clients continuam tentando para evitar login repetido em muitos PCs."],syncTitle:"3. Sync Server e descoberta",syncBody:"Sync Server publica este manager como Screen Wall ativo da conta. Clients leem o registro no Supabase e testam endpoints.",syncPoints:["Inclui host instance, endereços LAN/private, candidatos public, pair token e lease curto.","Candidatos LAN vêm primeiro; public depois se necessário.","Clique Sync Server após mudanças de manager, VPN, firewall ou roteador.","Chrome Local Network Access em livedesk.pages.dev não é mais o caminho padrão. O app npm manager é o servidor real."],platformTitle:"4. Estado das plataformas",platformBody:"Windows foi verificado com transferência de tela. macOS e Linux seguem o mesmo caminho npm.",platformPoints:["Windows: verificado.","macOS: captura e controle precisam de permissões Screen Recording/Accessibility.","Linux: runtime linux-x64, captura grim/gnome-screenshot/import/scrot e entrada xdotool adicionados. Áudio ainda desativado."],firewallTitle:"Firewall e locais remotos",firewallBody:"Na mesma LAN normalmente não é preciso port forwarding. Em outra rede, clients precisam alcançar a porta client do manager.",firewallPoints:["Porta client: TCP 5197.","Máquinas client normalmente só precisam de saída.","Para redes remotas, permita TCP 5197 inbound no manager e encaminhe TCP 5197 para o PC manager.","A porta 5179 é para a UI do manager; exponha apenas se um navegador remoto precisar abrir o Wall.","Prefira VPN, Tailscale, ZeroTier ou allowlist de IP fixo."],commandsTitle:"Comandos atuais",commandsBody:"A direção do produto é um comando de terminal comum entre sistemas, não baixar e instalar manualmente.",managerCommandLabel:"Iniciar manager",clientCommandLabel:"Conectar workstation",slotCommandLabel:"Fixar no slot 3",manualCommandLabel:"Conexão manual avançada"}),it:mn({languageName:"Italiano",languageLabel:"Lingua documento",eyebrow:"LiveDesk Manual",title:"Apri uno Screen Wall locale con un comando",intro:"LiveDesk è un deck npm-first per monitorare workstation, box AI, Mac mini e macchine dev da un solo PC manager.",managerTitle:"1. Avvia il manager",managerBody:"Esegui LiveDesk sul computer che guarderà gli schermi. Il manager avvia UI e server locale e apre http://127.0.0.1:5179.",managerPoints:["Il comando è npx -y livedesk.","Il manager usa 5179 per Screen Wall/API e 5197 per connessioni client.","Se vecchi processi occupano le porte, l’avvio le pulisce di default."],clientTitle:"2. Connetti una workstation",clientBody:"Su ogni computer monitorato, accedi con lo stesso account Google. Se il manager non è online, il client riprova ogni 5 secondi.",clientPoints:["npx -y livedesk client usa il primo slot libero.","npx -y livedesk client 3 fissa la macchina allo slot 3.","I client continuano a provare per evitare login ripetuti."],syncTitle:"3. Sync Server e discovery",syncBody:"Sync Server pubblica questo manager come Screen Wall attivo dell’account. I client leggono Supabase e provano gli endpoint.",syncPoints:["Include host instance, indirizzi LAN/private, candidati public, pair token e lease breve.","Prima LAN, poi public se necessario.","Premi Sync Server dopo cambi di manager, VPN, firewall o router.","Chrome Local Network Access su livedesk.pages.dev non è più il percorso principale. L’app npm manager è il server reale."],platformTitle:"4. Stato piattaforme",platformBody:"Windows è verificato con trasferimento schermo live. macOS e Linux seguono lo stesso percorso npm.",platformPoints:["Windows: verificato.","macOS: capture e control richiedono permessi Screen Recording/Accessibility.","Linux: aggiunti runtime linux-x64, capture grim/gnome-screenshot/import/scrot e input xdotool. Audio disattivato."],firewallTitle:"Firewall e sedi remote",firewallBody:"Nella stessa LAN di solito non serve port forwarding. Da altre reti, i client devono raggiungere la porta client del manager.",firewallPoints:["Porta client: TCP 5197.","I client normalmente richiedono solo uscita.","Per reti remote, abilita TCP 5197 inbound sul manager e inoltra TCP 5197 al PC manager.","La porta 5179 è per la UI manager; esponila solo se un browser remoto deve aprire il Wall.","Preferisci VPN, Tailscale, ZeroTier o IP allowlist."],commandsTitle:"Comandi attuali",commandsBody:"La direzione è un comando terminale comune tra sistemi operativi, invece di download e install manuale.",managerCommandLabel:"Avvia manager",clientCommandLabel:"Connetti workstation",slotCommandLabel:"Fissa allo slot 3",manualCommandLabel:"Connessione manuale avanzata"}),id:mn({languageName:"Bahasa Indonesia",languageLabel:"Bahasa dokumen",eyebrow:"LiveDesk Manual",title:"Buka Screen Wall lokal dengan satu perintah",intro:"LiveDesk adalah deck npm-first untuk memantau banyak workstation, AI box, Mac mini, dan mesin dev dari satu PC manager.",managerTitle:"1. Jalankan manager",managerBody:"Jalankan LiveDesk di komputer yang melihat layar. Manager membuka UI dan server lokal bersama, lalu membuka http://127.0.0.1:5179.",managerPoints:["Perintahnya npx -y livedesk.","Manager memakai 5179 untuk Screen Wall/API dan 5197 untuk koneksi client.","Jika proses lama memakai port itu, startup membersihkannya secara default."],clientTitle:"2. Hubungkan workstation",clientBody:"Di komputer yang dipantau, masuk dengan akun Google yang sama. Jika manager belum online, client tetap mencoba tiap 5 detik.",clientPoints:["npx -y livedesk client memakai slot kosong pertama.","npx -y livedesk client 3 mengunci mesin ke slot 3.","Client terus mencoba agar banyak PC tidak perlu login berulang."],syncTitle:"3. Sync Server dan discovery",syncBody:"Sync Server menerbitkan manager ini sebagai Screen Wall aktif untuk akun. Client membaca Supabase dan mencoba endpoint.",syncPoints:["Berisi host instance, alamat LAN/private, kandidat public, pair token, dan lease pendek.","Kandidat LAN dicoba lebih dulu, lalu public jika perlu.","Tekan Sync Server setelah perubahan manager, VPN, firewall, atau router.","Chrome Local Network Access di livedesk.pages.dev bukan jalur utama lagi. App npm manager adalah server sebenarnya."],platformTitle:"4. Status platform",platformBody:"Windows sudah diverifikasi dengan live screen transfer. macOS dan Linux mengikuti jalur npm yang sama.",platformPoints:["Windows: terverifikasi.","macOS: capture dan control perlu izin Screen Recording/Accessibility.","Linux: runtime linux-x64, capture grim/gnome-screenshot/import/scrot, dan input xdotool sudah ditambahkan. Audio belum aktif."],firewallTitle:"Firewall dan lokasi luar",firewallBody:"Di LAN yang sama biasanya tidak perlu port forwarding. Dari jaringan lain, client harus mencapai port client manager.",firewallPoints:["Port client: TCP 5197.","Mesin client biasanya hanya perlu akses keluar.","Untuk jaringan luar, izinkan TCP 5197 inbound di manager dan forward TCP 5197 ke PC manager.","Port 5179 untuk UI manager; buka hanya jika browser luar harus membuka Wall.","Utamakan VPN, Tailscale, ZeroTier, atau IP allowlist."],commandsTitle:"Perintah saat ini",commandsBody:"Arah produk adalah satu perintah terminal lintas OS, bukan download dan instal manual.",managerCommandLabel:"Mulai manager",clientCommandLabel:"Hubungkan workstation",slotCommandLabel:"Kunci ke slot 3",manualCommandLabel:"Koneksi manual lanjutan"}),vi:mn({languageName:"Tiếng Việt",languageLabel:"Ngôn ngữ tài liệu",eyebrow:"LiveDesk Manual",title:"Mở Screen Wall cục bộ bằng một lệnh",intro:"LiveDesk là deck npm-first để giám sát nhiều workstation, máy AI, Mac mini và máy dev từ một PC manager.",managerTitle:"1. Chạy manager",managerBody:"Chạy LiveDesk trên máy dùng để xem màn hình. Manager khởi động UI và server cục bộ cùng lúc, rồi mở http://127.0.0.1:5179.",managerPoints:["Lệnh là npx -y livedesk.","Manager dùng 5179 cho Screen Wall/API và 5197 cho kết nối client.","Nếu tiến trình cũ giữ port, startup mặc định sẽ dọn và khởi động lại."],clientTitle:"2. Kết nối workstation",clientBody:"Trên mỗi máy được giám sát, đăng nhập cùng tài khoản Google. Nếu manager chưa online, client tiếp tục thử mỗi 5 giây.",clientPoints:["npx -y livedesk client dùng slot trống đầu tiên.","npx -y livedesk client 3 ghim máy vào slot 3.","Client tiếp tục chờ để nhiều máy không cần đăng nhập lại."],syncTitle:"3. Sync Server và tự phát hiện",syncBody:"Sync Server đăng manager này là Screen Wall đang hoạt động của tài khoản. Client đọc Supabase và thử các endpoint.",syncPoints:["Bao gồm host instance, địa chỉ LAN/private, public candidate, pair token và lease ngắn.","Ưu tiên LAN trước, sau đó thử public nếu cần.","Bấm Sync Server sau thay đổi manager, VPN, firewall hoặc router.","Chrome Local Network Access trên livedesk.pages.dev không còn là đường chạy chính. App npm manager mới là server thật."],platformTitle:"4. Trạng thái nền tảng",platformBody:"Windows đã được kiểm chứng với truyền màn hình live. macOS và Linux đi theo cùng đường npm.",platformPoints:["Windows: đã kiểm chứng.","macOS: capture và control cần quyền Screen Recording/Accessibility.","Linux: đã thêm runtime linux-x64, capture grim/gnome-screenshot/import/scrot và input xdotool. Audio chưa bật."],firewallTitle:"Firewall và địa điểm ngoài",firewallBody:"Trong cùng LAN thường không cần port forwarding. Từ mạng khác, client phải truy cập được port client của manager.",firewallPoints:["Port client: TCP 5197.","Máy client thường chỉ cần kết nối outbound.","Với mạng ngoài, cho phép TCP 5197 inbound trên manager và forward TCP 5197 tới PC manager.","Port 5179 dành cho UI manager; chỉ mở nếu trình duyệt từ xa cần mở Wall trực tiếp.","Ưu tiên VPN, Tailscale, ZeroTier hoặc allowlist IP cố định."],commandsTitle:"Lệnh hiện tại",commandsBody:"Hướng sản phẩm là một lệnh terminal dùng chung giữa các OS, thay vì tải và cài thủ công.",managerCommandLabel:"Khởi động manager",clientCommandLabel:"Kết nối workstation",slotCommandLabel:"Ghim vào slot 3",manualCommandLabel:"Kết nối thủ công nâng cao"}),th:mn({languageName:"ไทย",languageLabel:"ภาษาของเอกสาร",eyebrow:"LiveDesk Manual",title:"เปิด Screen Wall ภายในด้วยคำสั่งเดียว",intro:"LiveDesk คือ deck แบบ npm-first สำหรับดู workstation, กล่อง AI, Mac mini และเครื่อง dev หลายเครื่องจาก manager PC เครื่องเดียว",managerTitle:"1. รัน manager",managerBody:"รัน LiveDesk บนเครื่องที่ใช้ดูหน้าจอ Manager จะเปิด UI และ local server พร้อมกัน แล้วเปิด http://127.0.0.1:5179",managerPoints:["คำสั่งคือ npx -y livedesk","Manager ใช้ 5179 สำหรับ Screen Wall/API และ 5197 สำหรับ client connection","ถ้า process เก่ายังใช้ port อยู่ startup จะล้างให้โดย default"],clientTitle:"2. เชื่อม workstation",clientBody:"บนเครื่องที่ต้อง monitor ให้ login ด้วย Google account เดียวกัน ถ้า manager ยังไม่ออนไลน์ client จะลองใหม่ทุก 5 วินาที",clientPoints:["npx -y livedesk client จะใช้ slot ว่างแรก","npx -y livedesk client 3 จะตรึงเครื่องไว้ที่ slot 3","Client จะรอต่อเนื่องเพื่อไม่ต้อง login ซ้ำเมื่อมีหลายเครื่อง"],syncTitle:"3. Sync Server และ discovery",syncBody:"Sync Server จะ publish manager นี้เป็น active Screen Wall ของ account แล้ว client อ่านข้อมูลจาก Supabase และลอง endpoint ต่างๆ",syncPoints:["มี host instance, LAN/private address, public candidate, pair token และ short lease","ลอง LAN ก่อน แล้วค่อยลอง public ถ้าจำเป็น","กด Sync Server หลังเปลี่ยน manager, VPN, firewall หรือ router","Chrome Local Network Access บน livedesk.pages.dev ไม่ใช่ runtime หลักแล้ว app npm manager คือ server จริง"],platformTitle:"4. สถานะ platform",platformBody:"Windows ตรวจสอบแล้วว่าส่งภาพ live ได้ macOS และ Linux ใช้เส้นทาง npm เดียวกัน",platformPoints:["Windows: verified","macOS: capture/control ต้องใช้สิทธิ์ Screen Recording/Accessibility","Linux: เพิ่ม linux-x64 runtime, grim/gnome-screenshot/import/scrot capture และ xdotool input แล้ว audio ยังปิดอยู่"],firewallTitle:"Firewall และเครื่องต่างสถานที่",firewallBody:"ใน LAN เดียวกันปกติไม่ต้อง port forwarding ถ้าอยู่คนละ network client ต้องเข้าถึง client port ของ manager ได้",firewallPoints:["Client port คือ TCP 5197","เครื่อง client ปกติต้องการ outbound เท่านั้น","ถ้าอยู่นอก network ให้เปิด TCP 5197 inbound ที่ manager และ forward TCP 5197 ไปยัง manager PC","Port 5179 เป็น UI ของ manager เปิดเฉพาะเมื่อ browser ระยะไกลต้องเปิด Wall โดยตรง","ควรใช้ VPN, Tailscale, ZeroTier หรือ IP allowlist ก่อนเปิดสู่ public internet"],commandsTitle:"คำสั่งปัจจุบัน",commandsBody:"ทิศทาง product คือคำสั่ง terminal เดียวข้าม OS ไม่ใช่ download/install จากเว็บไซต์",managerCommandLabel:"เริ่ม manager",clientCommandLabel:"เชื่อม workstation",slotCommandLabel:"ตรึง slot 3",manualCommandLabel:"manual connection ขั้นสูง"}),hi:mn({languageName:"हिन्दी",languageLabel:"दस्तावेज़ भाषा",eyebrow:"LiveDesk Manual",title:"एक कमांड से local Screen Wall खोलें",intro:"LiveDesk एक npm-first remote work deck है जिससे एक manager PC से कई workstation, AI box, Mac mini और dev machines देखे जा सकते हैं।",managerTitle:"1. manager चलाएं",managerBody:"जिस computer से screens देखनी हैं उस पर LiveDesk manager चलाएं। यह UI और local server साथ में शुरू करता है और http://127.0.0.1:5179 खोलता है।",managerPoints:["कमांड है npx -y livedesk।","Manager Screen Wall/API के लिए 5179 और client connections के लिए 5197 इस्तेमाल करता है।","अगर पुराने LiveDesk ports बचे हों तो startup default रूप से साफ करता है।"],clientTitle:"2. workstation जोड़ें",clientBody:"हर monitored computer पर उसी Google account से sign in करें। Manager online न हो तब भी client बंद नहीं होता और हर 5 सेकंड retry करता है।",clientPoints:["npx -y livedesk client पहला खाली slot लेता है।","npx -y livedesk client 3 machine को slot 3 पर pin करता है।","बहुत सी machines हों तब भी बार-बार login की जरूरत नहीं रहती।"],syncTitle:"3. Sync Server और discovery",syncBody:"Sync Server इस manager को account का active Screen Wall बनाकर Supabase में publish करता है। Clients record पढ़कर endpoints try करते हैं।",syncPoints:["इसमें host instance, LAN/private addresses, public candidates, pair token और short lease होता है।","LAN candidates पहले try होते हैं, जरूरत हो तो public candidates।","Manager, VPN, firewall या router बदलने के बाद Sync Server दबाएं।","livedesk.pages.dev का Chrome Local Network Access अब default runtime नहीं है। npm manager app ही real server है।"],platformTitle:"4. Platform status",platformBody:"Windows live screen transfer के साथ verified है। macOS और Linux भी इसी npm path पर आगे बढ़ रहे हैं।",platformPoints:["Windows: verified.","macOS: capture/control के लिए Screen Recording/Accessibility permissions चाहिए।","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot capture और xdotool input backend जोड़े गए हैं। Audio अभी disabled है।"],firewallTitle:"Firewall और remote locations",firewallBody:"Same LAN में आम तौर पर router forwarding जरूरी नहीं। दूसरे network से clients को manager client port तक पहुंचना होगा।",firewallPoints:["Client connection port: TCP 5197.","Client machines को आम तौर पर सिर्फ outbound access चाहिए।","Remote network के लिए manager firewall में TCP 5197 inbound allow करें और router से TCP 5197 manager PC पर forward करें।","5179 manager UI port है; इसे तभी expose करें जब remote browser को Wall खोलना हो।","Public internet से पहले VPN, Tailscale, ZeroTier या fixed IP allowlist बेहतर है।"],commandsTitle:"Current commands",commandsBody:"Product direction है OS के बीच एक terminal command, website से download/install नहीं।",managerCommandLabel:"Start manager",clientCommandLabel:"Connect workstation",slotCommandLabel:"Pin to slot 3",manualCommandLabel:"Advanced manual connection"}),ar:mn({languageName:"العربية",languageLabel:"لغة المستند",eyebrow:"LiveDesk Manual",title:"افتح Screen Wall محلي بأمر واحد",intro:"LiveDesk هو deck بنمط npm-first لمراقبة عدة workstations وأجهزة AI وMac mini وأجهزة تطوير من كمبيوتر manager واحد.",managerTitle:"1. شغل manager",managerBody:"شغل LiveDesk على الكمبيوتر الذي سيعرض الشاشات. يبدأ manager الواجهة والخادم المحلي معا ويفتح http://127.0.0.1:5179.",managerPoints:["الأمر هو npx -y livedesk.","يستخدم manager المنفذ 5179 للواجهة/API والمنفذ 5197 لاتصالات client.","إذا بقيت عملية LiveDesk قديمة على المنافذ، يتم تنظيفها افتراضيا عند التشغيل."],clientTitle:"2. وصل workstation",clientBody:"على كل كمبيوتر تتم مراقبته، سجل الدخول بنفس حساب Google. إذا لم يكن manager متاحا، يبقى client يعمل ويحاول كل 5 ثوان.",clientPoints:["npx -y livedesk client يختار أول slot فارغ.","npx -y livedesk client 3 يثبت الجهاز في slot 3.","clients تستمر بالمحاولة لتجنب تكرار تسجيل الدخول عند كثرة الأجهزة."],syncTitle:"3. Sync Server والاكتشاف",syncBody:"Sync Server ينشر هذا manager كـ active Screen Wall للحساب. يقرأ clients سجل Supabase ويجربون endpoints بالترتيب.",syncPoints:["السجل يتضمن host instance وعناوين LAN/private وpublic candidates وpair token وlease قصير.","يتم تفضيل LAN أولا، ثم public عند الحاجة.","اضغط Sync Server بعد تغيير manager أو VPN أو firewall أو router.","Chrome Local Network Access على livedesk.pages.dev لم يعد مسار التشغيل الافتراضي. تطبيق npm manager هو الخادم الحقيقي."],platformTitle:"4. حالة المنصات",platformBody:"Windows تم التحقق منه مع نقل شاشة live. macOS وLinux يتبعان نفس مسار npm.",platformPoints:["Windows: تم التحقق.","macOS: capture/control يحتاجان أذونات Screen Recording/Accessibility.","Linux: تمت إضافة linux-x64 runtime وgrim/gnome-screenshot/import/scrot capture وxdotool input. الصوت ما زال معطلا."],firewallTitle:"Firewall والمواقع البعيدة",firewallBody:"داخل نفس LAN غالبا لا تحتاج port forwarding. من شبكة أخرى يجب أن يصل client إلى منفذ manager client.",firewallPoints:["منفذ client: TCP 5197.","أجهزة client تحتاج عادة اتصال outbound فقط.","للشبكات البعيدة، اسمح TCP 5197 inbound على manager ووجه TCP 5197 من router إلى manager PC.","المنفذ 5179 مخصص لواجهة manager؛ اكشفه فقط إذا كان متصفح بعيد يحتاج فتح Wall مباشرة.","يفضل VPN أو Tailscale أو ZeroTier أو fixed IP allowlist بدل التعريض العام."],commandsTitle:"الأوامر الحالية",commandsBody:"اتجاه المنتج هو أمر terminal واحد عبر الأنظمة، وليس تحميل وتثبيت يدوي من موقع.",managerCommandLabel:"Start manager",clientCommandLabel:"Connect workstation",slotCommandLabel:"Pin to slot 3",manualCommandLabel:"Advanced manual connection"}),tr:mn({languageName:"Türkçe",languageLabel:"Belge dili",eyebrow:"LiveDesk Manual",title:"Yerel Screen Wall tek komutla açılsın",intro:"LiveDesk, tek bir manager PC üzerinden birçok workstation, AI box, Mac mini ve dev machine izlemek için npm-first bir çalışma deckidir.",managerTitle:"1. Manager çalıştır",managerBody:"Ekranları izleyecek bilgisayarda LiveDesk manager çalıştır. Manager UI ve local server birlikte başlar ve http://127.0.0.1:5179 açılır.",managerPoints:["Komut: npx -y livedesk.","Manager Screen Wall/API için 5179, client bağlantıları için 5197 kullanır.","Eski LiveDesk process portları tutuyorsa başlangıç varsayılan olarak temizler."],clientTitle:"2. Workstation bağla",clientBody:"İzlenecek bilgisayarda aynı Google hesabıyla giriş yap. Manager henüz online değilse client kapanmaz ve her 5 saniyede tekrar dener.",clientPoints:["npx -y livedesk client ilk boş slota yerleşir.","npx -y livedesk client 3 makineyi slot 3’e sabitler.","Çok makinede tekrar tekrar login gerekmesin diye client beklemeye devam eder."],syncTitle:"3. Sync Server ve discovery",syncBody:"Sync Server bu managerı hesabın active Screen Wall kaydı olarak Supabase’e yazar. Clients bu kaydı okuyup endpoint adaylarını dener.",syncPoints:["Host instance, LAN/private adresler, public adaylar, pair token ve kısa lease içerir.","Önce LAN adayları, gerekirse public adaylar denenir.","Manager, VPN, firewall veya router değişince Sync Server’a bas.","livedesk.pages.dev üzerindeki Chrome Local Network Access artık default runtime yolu değil. Gerçek server npm manager app."],platformTitle:"4. Platform durumu",platformBody:"Windows live screen transfer ile doğrulandı. macOS ve Linux aynı npm yolunu takip ediyor.",platformPoints:["Windows: doğrulandı.","macOS: capture/control için Screen Recording/Accessibility izinleri gerekir.","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot capture ve xdotool input backend eklendi. Audio kapalı."],firewallTitle:"Firewall ve uzak konumlar",firewallBody:"Aynı LAN içinde genelde router forwarding gerekmez. Başka ağdan clients manager client portuna ulaşabilmelidir.",firewallPoints:["Client port: TCP 5197.","Client makineler normalde sadece outbound erişim ister.","Uzak ağ için manager firewall üzerinde TCP 5197 inbound aç ve routerdan TCP 5197yi manager PCye forward et.","5179 manager UI portudur; sadece uzak browser Wall açacaksa expose et.","Public internet yerine VPN, Tailscale, ZeroTier veya sabit IP allowlist tercih et."],commandsTitle:"Güncel komutlar",commandsBody:"Ürün yönü, webden indirip kurmak yerine işletim sistemleri arasında ortak tek terminal komutu.",managerCommandLabel:"Manager başlat",clientCommandLabel:"Workstation bağla",slotCommandLabel:"Slot 3’e sabitle",manualCommandLabel:"Gelişmiş manuel bağlantı"})},EC=Object.entries(lr).map(([a,l])=>({id:a,label:l.languageName}));function DC(){if(typeof navigator>"u")return"en";const a=navigator.languages?.length?navigator.languages:[navigator.language];for(const l of a){const s=l.toLowerCase();if(lr[l])return l;if(s.startsWith("zh-tw")||s.startsWith("zh-hk"))return"zh-TW";if(s.startsWith("pt"))return"pt-BR";const r=s.split("-")[0];if(lr[r])return r}return"en"}function ev({index:a,selected:l,onSelect:s}){const r=a+1;return o.jsx("article",{className:`device-tile placeholder-tile ${l?"selected":""}`,children:o.jsxs("button",{className:"tile-screen",onClick:s,"aria-pressed":l,title:`Select slot ${r}`,type:"button",children:[o.jsx("span",{className:"slot-grid","aria-hidden":"true"}),o.jsxs("span",{className:"empty-screen",children:[o.jsx(tl,{size:24}),o.jsxs("strong",{children:["Slot ",String(r).padStart(3,"0")]})]})]})})}function Wf({device:a,frame:l,selected:s,controlEnabled:r,showStatus:c,monitorIndex:d,monitorCount:h,onSelect:p,onFocusDevice:g,onOpenControl:x,onCycleMonitor:b,onCanvasReady:v,sendInput:S,presentationReady:M}){const C=m.useRef(null),j=m.useRef(null),k=m.useRef(0),T=m.useRef(null),A=uy(a),z=["cpu","gpu","memory","vram"].map(E=>A.metrics.find(P=>P.id===E)).filter(E=>!!E),G=ra(d,h),I=h>1,W=M??!!l,R=hC(a,l,G),ee=R>=ou?100:R/ou*100,se=R>=ou?ou/R*100:100,V={"--screen-aspect":R.toFixed(5),"--screen-content-width":`${Math.max(1,Math.min(100,ee)).toFixed(3)}%`,"--screen-content-height":`${Math.max(1,Math.min(100,se)).toFixed(3)}%`},fe=m.useCallback(E=>{C.current=E,v(a.deviceId,E)},[a.deviceId,v]),$=E=>{const P=E.currentTarget.getBoundingClientRect();return{normalizedX:Math.max(0,Math.min(1,(E.clientX-P.left)/Math.max(1,P.width))),normalizedY:Math.max(0,Math.min(1,(E.clientY-P.top)/Math.max(1,P.height)))}},oe=E=>({shiftKey:E.shiftKey,ctrlKey:E.ctrlKey,altKey:E.altKey,metaKey:E.metaKey}),le=m.useCallback(()=>{T.current!==null&&(window.cancelAnimationFrame(T.current),T.current=null)},[]),ue=m.useCallback(()=>{const E=j.current;if(!E)return;j.current=null;const P=Number(E.input.normalizedX),ne=Number(E.input.normalizedY);if(!Number.isFinite(P)||!Number.isFinite(ne))return;S(a.deviceId,{...E.input,normalizedX:P,normalizedY:ne})&&(k.current=performance.now())},[a.deviceId,S]),H=m.useCallback(()=>{T.current===null&&(T.current=window.requestAnimationFrame(()=>{T.current=null,ue()}))},[ue]);m.useEffect(()=>()=>{le(),j.current=null},[le]);const X=(E,P)=>{if(!r)return;const ne={type:P,monitorIndex:G,...$(E),button:CC(E.button),...oe(E)};if(P==="pointermove"){const L=performance.now();j.current={input:ne},L-k.current>=qM&&(le(),ue()),H();return}j.current&&(le(),ue()),S(a.deviceId,ne)},te=m.useCallback(E=>{const P=document.activeElement;P instanceof HTMLElement&&E.contains(P)&&P.classList.contains("monitor-cycle-button")&&P.blur()},[]);return o.jsx("article",{className:`device-tile ${s?"selected":""} ${a.connected?"online":"offline"}`,"data-live-device-id":a.deviceId,style:V,children:o.jsxs("div",{className:`tile-screen ${W?"has-frame":"is-empty"}`,role:"button",tabIndex:r?-1:0,"aria-pressed":s,onClick:()=>{r||p()},onKeyDown:E=>{r||(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),p())},onDoubleClick:E=>{E.preventDefault(),x()},onPointerLeave:E=>te(E.currentTarget),children:[o.jsx("span",{className:`screen-content ${W?"has-frame":"is-empty"}`,children:o.jsx("canvas",{ref:fe,className:`remote-canvas ${W?"has-frame":"is-empty"}`,tabIndex:r?0:-1,onPointerDown:E=>{r&&(E.preventDefault(),E.stopPropagation(),g(),E.currentTarget.focus(),E.currentTarget.setPointerCapture(E.pointerId),X(E,"pointerdown"))},onPointerMove:E=>{r&&E.preventDefault(),X(E,"pointermove")},onPointerUp:E=>{r&&(E.preventDefault(),E.stopPropagation(),X(E,"pointerup"),E.currentTarget.hasPointerCapture(E.pointerId)&&E.currentTarget.releasePointerCapture(E.pointerId))},onPointerCancel:E=>{E.currentTarget.hasPointerCapture(E.pointerId)&&E.currentTarget.releasePointerCapture(E.pointerId)},onWheel:E=>{r&&(E.preventDefault(),S(a.deviceId,{type:"wheel",monitorIndex:G,...$(E),deltaX:E.deltaX,deltaY:E.deltaY,...oe(E)}))},onKeyDown:E=>{r&&(E.preventDefault(),E.stopPropagation(),S(a.deviceId,{type:"keydown",monitorIndex:G,key:E.key,code:E.code,keyCode:E.keyCode||E.which||0,location:E.location,text:E.key.length===1?E.key:"",repeat:E.repeat,...oe(E)}))},onKeyUp:E=>{r&&(E.preventDefault(),E.stopPropagation(),S(a.deviceId,{type:"keyup",monitorIndex:G,key:E.key,code:E.code,keyCode:E.keyCode||E.which||0,location:E.location,text:E.key.length===1?E.key:"",repeat:!1,...oe(E)}))},onContextMenu:E=>r&&E.preventDefault()})}),!W&&o.jsx("span",{className:"empty-screen",children:o.jsx(tl,{size:26})}),c&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`tile-health-pill state-${A.state}`,children:A.label}),o.jsx("span",{className:"tile-metrics","aria-label":`${ko(a)} status`,children:z.map(E=>o.jsxs("span",{className:`tile-metric state-${E.state}`,children:[o.jsx("b",{children:E.label}),o.jsx("em",{children:E.value}),E.ratio!==void 0&&o.jsx("i",{style:{width:`${Math.round(E.ratio*100)}%`}})]},E.id))})]}),I&&o.jsxs("span",{className:"monitor-cycle","aria-label":`${ko(a)} display ${G+1} of ${h}`,children:[o.jsx("button",{className:"monitor-cycle-button previous",onClick:E=>{E.preventDefault(),E.stopPropagation(),b(-1),E.currentTarget.blur()},title:"Previous display",type:"button",children:o.jsx(av,{size:18})}),o.jsxs("span",{className:"monitor-cycle-count",children:["Screen ",G+1,"/",h]}),o.jsx("button",{className:"monitor-cycle-button next",onClick:E=>{E.preventDefault(),E.stopPropagation(),b(1),E.currentTarget.blur()},title:"Next display",type:"button",children:o.jsx(lv,{size:18})})]})]})})}function RC({visible:a}){return m.useEffect(()=>{if(!a||!Gf)return;if(!document.getElementById(Hx)){const s=document.createElement("script");s.id=Hx,s.async=!0,s.crossOrigin="anonymous",s.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${encodeURIComponent(gm)}`,document.head.appendChild(s)}const l=window.setTimeout(()=>{try{window.adsbygoogle=window.adsbygoogle||[],window.adsbygoogle.push({})}catch{}},120);return()=>window.clearTimeout(l)},[a]),a?o.jsxs("aside",{className:`free-ad-banner ${Gf?"adsense-ready":"house-ad"}`,"aria-label":"Advertisement",children:[o.jsx("span",{className:"ad-label",children:"Advertisement"}),Gf?o.jsx("ins",{className:"adsbygoogle livedesk-ad-unit",style:{display:"block"},"data-ad-client":gm,"data-ad-slot":ny,"data-ad-format":"auto","data-full-width-responsive":"true"}):o.jsxs("div",{className:"house-ad-copy",children:[o.jsx("strong",{children:"Sponsored placement"}),o.jsx("span",{children:"Local AI gear, mini PCs, GPUs, NAS, and developer tools."})]})]}):null}function LC(){const a=ZM(),{session:l,loading:s}=q0(),{target:r,error:c,refresh:d}=G0(l),h=m.useMemo(()=>{if(!r?.active)return null;const w=r.expires_at?Date.parse(r.expires_at):Number.POSITIVE_INFINITY;return Number.isFinite(w)&&w<=Date.now()?null:r},[r]),p=m.useMemo(()=>ex(h),[h]),g=m.useMemo(()=>p.length>0?[...new Set([...p,on])]:[on],[p]),[x,b]=m.useState(uC),v=m.useMemo(()=>g.some(w=>!!jo(w)),[g]),S=!v||x,{status:M,devices:C,error:j,refresh:k,hubBaseUrl:T}=$0(g,S),{entitlement:A,licensed:z,loading:G,error:I,refresh:W}=Y0(l),[R,ee]=m.useState([]),[se,V]=m.useState([]),[fe,$]=m.useState(""),[oe,le]=m.useState(""),[ue,H]=m.useState(!1),[X,te]=m.useState(!1),[E,P]=m.useState(""),[ne,L]=m.useState(""),[de,ve]=m.useState(""),[ge,ke]=m.useState("wall"),[qe,_e]=m.useState("large"),[Ee,$e]=m.useState(DC),[Ne,Mt]=m.useState(!1),[tn,Xe]=m.useState(!1),[Kn,Xn]=m.useState(!1),[Lt,Vt]=m.useState(cC),[be,gn]=m.useState(pC),[De,pe]=m.useState(xC),[je,Re]=m.useState({}),[It,xn]=m.useState([]),[Ie,ca]=m.useState(be.fps),Ta=m.useRef(new Map),Nn=m.useRef(new Map),cn=m.useRef(null),il=m.useRef(new Map),An=m.useRef(null),nt=m.useRef(0),Pt=m.useRef(new Map),[At,ns]=m.useState({}),Ti=m.useRef(new Map),[ki,sl]=m.useState({}),[ka,Tn]=m.useState(!1),Zn=m.useRef(null),kn=m.useRef(new Map),ua=m.useRef(new Map),Il=m.useRef(performance.now()),rl=m.useRef(new Map),Ea=m.useRef(new Map),Da=m.useRef(new Map),$a=m.useRef(0),ol=m.useRef(0),En=m.useRef(0),Ra=m.useRef(0),Ga=m.useRef(0),cl=m.useRef(new Map),vn=m.useRef(new Map),[Wn,Ut]=m.useState(null),[Y,me]=m.useState(!1),[we,Oe]=m.useState([]),[at,mt]=m.useState("all"),[Ae,Ze]=m.useState([]),[nn,qt]=m.useState(!1),[un,xt]=m.useState(!0),Tt=m.useRef(null),gt=m.useRef(null),ul=m.useRef(null),dl=m.useRef(null),$t=m.useRef(!1),kt=m.useRef(!1),as=m.useRef(0),da=m.useRef(0),Dn=m.useRef(0),ls=ge==="settings",Ei=ge==="pricing",Di=ge==="doc",yn=ge==="share-files",bn=!ls&&!Ei&&!Di&&!yn,He=ge==="control",rt=be.frameMode==="mode4-h264-atlas",Ri=De.frameMode==="mode5-lzo-delta"?Math.min(30,De.fps):De.fps,La=De.frameMode==="mode5-lzo-delta"?{maxWidth:Math.min(1920,De.maxWidth),maxHeight:Math.min(1080,De.maxHeight)}:{maxWidth:De.maxWidth,maxHeight:De.maxHeight};m.useEffect(()=>{if(M?.started){if(!l?.access_token){pt("/api/remote/license",{method:"DELETE"},T).catch(()=>{});return}pt("/api/remote/license/sync",{method:"POST",headers:{Authorization:`Bearer ${l.access_token}`}},T).catch(w=>{console.warn("[LiveDesk] Hub license sync failed",w)})}},[A?.updated_at,T,l?.access_token,M?.started]);const Ye=m.useMemo(()=>C.filter(w=>w.connected),[C]),Bo=at==="all"?Ye.length:Ae.filter(w=>Ye.some(D=>D.deviceId===w)).length,Rn=m.useMemo(()=>Ye.reduce((w,D)=>Math.max(w,xo(D.slotNumber)),0),[Ye]),Ln=Math.max(FM,Ye.length,Rn),Ul=m.useMemo(()=>{const w=Array(Ln).fill(null),D=[];for(const F of Ye){const O=xo(F.slotNumber);O>0&&O<=Ln&&!w[O-1]?w[O-1]=F:D.push(F)}for(const F of D){const O=w.findIndex(U=>!U);O<0?w.push(F):w[O]=F}return w},[Ye,Ln]),Li=m.useMemo(()=>Ye.map(w=>w.deviceId),[Ye]),_a=m.useMemo(()=>new Set(R),[R]),fl=m.useMemo(()=>new Set(se),[se]),fa=m.useMemo(()=>Ye.filter(w=>_a.has(w.deviceId)||fl.has(xo(w.slotNumber))),[Ye,_a,fl]),ml=m.useMemo(()=>C.find(w=>w.deviceId===fe)||fa[0]||null,[C,fe,fa]),hl=m.useMemo(()=>C.find(w=>w.deviceId===oe)||null,[oe,C]),rr=hl?ra(je[hl.deviceId],$n(hl)):0,ye=He?hl:ml,is=m.useMemo(()=>new Set(Ae),[Ae]),Ou=m.useMemo(()=>at==="all"?Ye.map(w=>w.deviceId):Ye.filter(w=>is.has(w.deviceId)).map(w=>w.deviceId),[Ye,is,at]),ma=m.useMemo(()=>ye?uy(ye):null,[ye]),ss=ye?To(ye,"control"):!1,Jn=ye?To(ye,"audio")||To(ye,"remoteAudio"):!1,ot=z?A?.plan==="pro"?"pro":"ltd":"free",rs=Bl[ot],pl=rs.limit,ql=ot==="free"&&Ye.length<=er,yt=Ye.length<=pl,za=ot==="ltd"?`Plus includes up to ${bo} workstations. Upgrade to Pro for commercial use and larger walls.`:`Free includes up to ${er} workstations. Upgrade to Plus for ${bo} devices and no ads.`,Ho=ot==="free",$l=yt&&!!ye,Qt=yt&&!!ye&&ss,os=yt&&!!ye&&Jn,Ya=m.useMemo(()=>Ul.filter(w=>!!w?.connected).slice(0,yC(qe)).map(w=>w.deviceId),[Ul,qe]),wn=m.useMemo(()=>rt?Li:be.visibleOnlyLive?It.length>0?It:Ya:Li,[Ya,rt,It,be.visibleOnlyLive,Li]),Kt=m.useMemo(()=>yt?Qf(wn):[],[yt,wn]),Oa=m.useMemo(()=>yt&&He&&ye?[ye.deviceId]:[],[yt,ye,He]),Fo=m.useMemo(()=>Qf([...Kt,...Oa]),[Oa,Kt]),Xt=m.useMemo(()=>bC(be,qe),[be,qe]),cs=m.useCallback((w,D)=>{const F=Ta.current.get(w);if(F&&F!==D&&Of(F),D){Ta.current.set(w,D);return}Ta.current.delete(w)},[]),Io=m.useCallback((w,D)=>{const F=Nn.current.get(w);if(F&&F!==D&&Of(F),D){Nn.current.set(w,D);return}Nn.current.delete(w)},[]),Gt=m.useCallback((w,D,F)=>{const O=performance.now(),U=el(w,F.deviceId);let ce=F;if(w==="control"&&F.visualChanged){const Se=X0(F.deviceId),We=cl.current.get(F.deviceId)||0,Ue=Se?O-Se.sentAt:Number.POSITIVE_INFINITY;Se&&Se.inputSeq>We&&Ue<=Fx&&(ce={...F,inputFeedbackSeq:Se.inputSeq,inputFeedbackMs:Math.max(0,Ue),inputFeedbackAt:O},cl.current.set(F.deviceId,Se.inputSeq))}ua.current.set(U,O);const he=Pt.current.get(U)||{totalFrames:0,totalChangedFrames:0,sampleFrames:0,sampleChangedFrames:0,sampleStartedAt:O,intervalCount:0,intervalSumMs:0,minIntervalMs:Number.POSITIVE_INFINITY,maxIntervalMs:0,intervalSamplesMs:[],seqGapCount:0,maxSeqGap:0,sampleDecoderInputBase:0,sampleDecoderOutputBase:0};w==="control"&&ce.inputFeedbackMs===void 0&&he.lastInfo?.inputFeedbackMs!==void 0&&he.lastInfo.inputFeedbackAt!==void 0&&O-he.lastInfo.inputFeedbackAt<=Fx&&(ce={...ce,inputFeedbackSeq:he.lastInfo.inputFeedbackSeq,inputFeedbackMs:he.lastInfo.inputFeedbackMs,inputFeedbackAt:he.lastInfo.inputFeedbackAt}),he.totalFrames+=1,he.sampleFrames+=1,$x(he,O,ce.frameSeq),ce.visualChanged&&(he.totalChangedFrames+=1,he.sampleChangedFrames+=1),he.lastInfo=ce,Pt.current.set(U,he)},[]),ha=m.useCallback((w,D)=>{Gt("wall",w,D)},[Gt]),_i=m.useCallback((w,D)=>{Gt("control",w,D);const F=Zn.current;!F||!XM(F,w)||Tn(!0)},[Gt]);m.useEffect(()=>{const w=window.setInterval(()=>{const D=performance.now(),F={};for(const[O,U]of Pt.current.entries()){const ce=Math.max(1,D-U.sampleStartedAt);F[O]={totalFrames:U.totalFrames,totalChangedFrames:U.totalChangedFrames,framesPerSecond:U.sampleFrames*1e3/ce,changedFramesPerSecond:U.sampleChangedFrames*1e3/ce,averageIntervalMs:U.intervalCount>0?U.intervalSumMs/U.intervalCount:0,minIntervalMs:Number.isFinite(U.minIntervalMs)?U.minIntervalMs:0,maxIntervalMs:U.maxIntervalMs,p95IntervalMs:gu(U.intervalSamplesMs,.95),intervalCount:U.intervalCount,seqGapCount:U.seqGapCount,maxSeqGap:U.maxSeqGap,decoderInputFps:Math.max(0,(Number(U.lastInfo?.decoderInputCount||0)-U.sampleDecoderInputBase)*1e3/ce),decoderOutputFps:Math.max(0,(Number(U.lastInfo?.decoderOutputCount||0)-U.sampleDecoderOutputBase)*1e3/ce),sampleMs:ce,lastInfo:U.lastInfo},U.sampleDecoderInputBase=Number(U.lastInfo?.decoderInputCount||0),U.sampleDecoderOutputBase=Number(U.lastInfo?.decoderOutputCount||0),U.sampleChangedFrames=0,qx(U,D)}ns(F)},1e3);return()=>window.clearInterval(w)},[]);const pa=m.useCallback((w,D)=>{const F=performance.now(),O=el(w,D.deviceId);kn.current.set(O,F),vn.current.delete(O);const U=Ti.current.get(O)||{totalFrames:0,sampleFrames:0,sampleStartedAt:F,intervalCount:0,intervalSumMs:0,minIntervalMs:Number.POSITIVE_INFINITY,maxIntervalMs:0,intervalSamplesMs:[],seqGapCount:0,maxSeqGap:0,sampleBytes:0,sampleH264Frames:0,sampleTinyFrames:0,sampleRepeatedFrames:0,sourceSendIntervalsMs:[]};if(U.totalFrames+=1,U.sampleFrames+=1,U.sampleBytes+=Math.max(0,Number(D.byteLength||0)),String(D.frameMode||D.mode||D.codec||D.mimeType||"").toLowerCase().includes("h264")){U.sampleH264Frames+=1,Number(D.byteLength||0)<=PM&&(U.sampleTinyFrames+=1);const We=String(D.contentHash||"");We&&U.lastContentHash===We&&(U.sampleRepeatedFrames+=1),U.lastContentHash=We}const Se=Number(D.agentSendGapMs||0);Se>0&&Se<1e3&&Fm(U.sourceSendIntervalsMs,Se),U.lastFrame=D,$x(U,F,D.frameSeq),Ti.current.set(O,U)},[]);m.useEffect(()=>{const w=window.setInterval(()=>{const D=performance.now(),F={};for(const[O,U]of Ti.current.entries()){const ce=Math.max(1,D-U.sampleStartedAt);F[O]={totalFrames:U.totalFrames,framesPerSecond:U.sampleFrames*1e3/ce,averageIntervalMs:U.intervalCount>0?U.intervalSumMs/U.intervalCount:0,minIntervalMs:Number.isFinite(U.minIntervalMs)?U.minIntervalMs:0,maxIntervalMs:U.maxIntervalMs,p95IntervalMs:gu(U.intervalSamplesMs,.95),intervalCount:U.intervalCount,seqGapCount:U.seqGapCount,maxSeqGap:U.maxSeqGap,averageFrameBytes:U.sampleFrames>0?U.sampleBytes/U.sampleFrames:0,tinyFrameRatio:U.sampleH264Frames>0?U.sampleTinyFrames/U.sampleH264Frames:0,repeatedFrameRatio:U.sampleH264Frames>0?U.sampleRepeatedFrames/U.sampleH264Frames:0,sourceSendAverageMs:U.sourceSendIntervalsMs.length>0?U.sourceSendIntervalsMs.reduce((he,Se)=>he+Se,0)/U.sourceSendIntervalsMs.length:0,sourceSendP95Ms:gu(U.sourceSendIntervalsMs,.95),sourceSendSampleCount:U.sourceSendIntervalsMs.length,sampleMs:ce,lastFrame:U.lastFrame},U.sampleBytes=0,U.sampleH264Frames=0,U.sampleTinyFrames=0,U.sampleRepeatedFrames=0,U.sourceSendIntervalsMs.length=0,qx(U,D)}sl(F)},1e3);return()=>window.clearInterval(w)},[]);const Uo=m.useCallback(w=>{pa("wall",w);const D=Ta.current.get(w.deviceId);D&&Bf(D,w,()=>Ta.current.get(w.deviceId)!==D,ha,be.h264DecodeAcceleration).catch(()=>{})},[ha,pa,be.h264DecodeAcceleration]),us=m.useCallback(w=>{pa("control",w);const D=Nn.current.get(w.deviceId);D&&Bf(D,w,()=>Nn.current.get(w.deviceId)!==D,_i,De.h264DecodeAcceleration,"interactive").catch(()=>{})},[De.h264DecodeAcceleration,_i,pa]),or=m.useCallback(w=>{const D=cn.current;D&&D!==w&&Of(D),cn.current=w,$a.current=0,ol.current=0,En.current=0,Ra.current=0,Ga.current=0,nt.current=0},[]),ga=m.useCallback(()=>{const w=cn.current,D=An.current;if(!(!w||!D||w.width<=0||w.height<=0||nt.current!==D.layoutVersion))for(const F of D.tiles){const O=il.current.get(F.deviceId);if(!O||F.width<=0||F.height<=0)continue;const U=Math.max(1,Math.round(F.width)),ce=Math.max(1,Math.round(F.height)),he=QM,Se=KM;(O.width!==he||O.height!==Se)&&(O.width=he,O.height=Se);const We=O.getContext("2d",{alpha:!1});if(We){We.imageSmoothingEnabled=!0,We.imageSmoothingQuality="high";try{We.drawImage(w,Math.round(F.x),Math.round(F.y),U,ce,0,0,he,Se)}catch{}}}},[]),ds=m.useCallback((w,D)=>{if(D){il.current.set(w,D),window.requestAnimationFrame(ga);return}il.current.delete(w)},[ga]),cr=m.useCallback((w,D)=>{En.current=performance.now(),nt.current=Number(w.layoutVersion||0),ga();const F=An.current?.tiles||[],O=F.length>0?Math.round(w.byteLength/F.length):w.byteLength;for(const U of F){const ce={...w,deviceId:U.deviceId,width:U.width,height:U.height,sourceWidth:U.width,sourceHeight:U.height,byteLength:O};ha(ce,{...D,deviceId:U.deviceId,width:U.width,height:U.height,byteLength:O})}},[ha,ga]),Bu=m.useCallback(w=>{const D=performance.now();$a.current<=0&&($a.current=D),ol.current=D;const F=cn.current;if(!F)return;const O=An.current?.tiles||[],U=O.length>0?Math.round(w.byteLength/O.length):w.byteLength;for(const ce of O)pa("wall",{...w,deviceId:ce.deviceId,width:ce.width,height:ce.height,sourceWidth:ce.width,sourceHeight:ce.height,byteLength:U});Bf(F,w,()=>cn.current!==F,cr).catch(()=>{})},[cr,pa]),Hu=m.useMemo(()=>({fps:Ie,maxWidth:Xt.maxWidth,maxHeight:Xt.maxHeight,quality:be.quality,mode:be.frameMode,frameMode:be.frameMode,streamPurpose:"wall",monitorSelections:je,onFrame:Uo}),[Ie,Uo,Xt,je,be]),Fu=m.useMemo(()=>({fps:Ri,maxWidth:La.maxWidth,maxHeight:La.maxHeight,quality:De.quality,mode:De.frameMode,frameMode:De.frameMode,streamPurpose:"control",monitorSelections:je,onFrame:us}),[De.frameMode,De.quality,us,Ri,La.maxHeight,La.maxWidth,je]),{frames:fs,state:zi,stats:Va,restartLive:ms}=lx(rt?[]:Kt,!rt&&be.autoStartLive&&Kt.length>0,T,Hu),{frame:Gl,layout:gl,state:hs,stats:Iu,refreshInputs:qo}=Z0(wn,rt&&be.autoStartLive&&wn.length>0,T,{fps:20,width:1920,height:1080,tileWidth:Xt.maxWidth,tileHeight:Xt.maxHeight,monitorSelections:je,onFrame:Bu});m.useEffect(()=>{An.current=gl,gl&&window.requestAnimationFrame(ga)},[gl,ga]),m.useEffect(()=>{if(!rt||hs!=="open"){$a.current=0,ol.current=0,En.current=0;return}const w=window.setInterval(()=>{const D=cn.current,F=performance.now();if(!D||document.visibilityState!=="visible"||F-Il.current<Yf)return;const O=ol.current,U=$a.current;if(O<=0||U<=0||F-O>500)return;const ce=En.current||U,he=F-ce;if(he>=GM&&F-Ga.current>=VM){Jg(D)&&(Ga.current=F,Ra.current=F);return}he>=$M&&F-Ra.current>=YM&&E0(D)&&(Ra.current=F)},250);return()=>window.clearInterval(w)},[hs,rt]);const{frames:ur,state:dr,error:ps,stats:Uu,restartLive:gs}=lx(Oa,Oa.length>0,T,Fu),xs=m.useMemo(()=>{const w=new Map(fs);if(rt&&Gl){const D=new Map((gl?.tiles||[]).map(O=>[O.deviceId,O])),F=Math.max(1,D.size);for(const O of wn){const U=D.get(O);w.set(O,{...Gl,deviceId:O,width:U?.width||Xt.maxWidth,height:U?.height||Xt.maxHeight,sourceWidth:U?.width||Xt.maxWidth,sourceHeight:U?.height||Xt.maxHeight,byteLength:Math.round(Gl.byteLength/F)})}}for(const[D,F]of ur.entries())w.set(D,F);return w},[Gl,gl,ur,Xt,rt,fs,wn]),vs=He&&Oa.length>0?dr:rt?hs:zi,fr=He&&Oa.length>0?Uu:rt?Iu:Va;m.useCallback((w,D="browser-stale")=>{const F=ms(w,D),O=gs(w,D);return F||O},[gs,ms]),m.useEffect(()=>{rt&&!He&&qo()},[rt,qo,He]);const ys=m.useCallback((w,D,F)=>{const O=D==="control"?Nn.current.get(w)||null:Ta.current.get(w)||null;if(!O||!Jg(O))return!1;const U=performance.now();return Da.current.set(el(D,w),U),!0},[]);m.useEffect(()=>{Tn(!1);const w=He?hl:null;if(w){Zn.current={deviceId:w.deviceId,monitorIndex:rr,frameMode:De.frameMode,startedAtEpochMs:Date.now()};const D=el("control",oe);Ea.current.set(D,performance.now()),kn.current.delete(D),ua.current.delete(D),vn.current.delete(D);return}Zn.current=null},[hl?.sessionId,oe,De.frameMode,rr,He]);const{state:bs,sendInput:Oi,stats:xa}=W0(Qt&&ue,T),{state:$o,error:Go}=tw(ye?.deviceId||"",os&&X,T);m.useEffect(()=>{if(!He||!ue||!Qt||!ye)return;const w=(O,U)=>{const ce=O.target,he=ce?.tagName?.toLowerCase();ce?.isContentEditable||he==="input"||he==="textarea"||he==="select"||(O.preventDefault(),O.stopPropagation(),Oi(ye.deviceId,{type:U,monitorIndex:ra(je[ye.deviceId],$n(ye)),key:O.key,code:O.code,keyCode:O.keyCode||O.which||0,location:O.location,text:O.key.length===1?O.key:"",repeat:U==="keydown"?O.repeat:!1,shiftKey:O.shiftKey,ctrlKey:O.ctrlKey,altKey:O.altKey,metaKey:O.metaKey}))},D=O=>w(O,"keydown"),F=O=>w(O,"keyup");return window.addEventListener("keydown",D),window.addEventListener("keyup",F),()=>{window.removeEventListener("keydown",D),window.removeEventListener("keyup",F)}},[Qt,ue,je,ye,Oi,He]),m.useEffect(()=>{const w=()=>{document.visibilityState==="visible"&&(Il.current=performance.now())};return document.addEventListener("visibilitychange",w),window.addEventListener("pageshow",w),()=>{document.removeEventListener("visibilitychange",w),window.removeEventListener("pageshow",w)}},[]),m.useEffect(()=>{if(!He||!ye||dr!=="open")return;const w=ye.deviceId,D=el("control",w),F=window.setInterval(()=>{const O=performance.now();if(document.visibilityState!=="visible"||O-Il.current<Yf)return;const U=kn.current.get(D)||0,ce=ua.current.get(D)||0,he=rl.current.get(D)||0,Se=Ea.current.get(D)||O;Ea.current.has(D)||Ea.current.set(D,Se);const We=U<=0,Ue=We?O-Se>tC:O-U>Qx,ct=U>0&&(ce<=0||O-ce>Qx);if(!Ue&&ct){const Cn=Da.current.get(D)||0;O-Cn>=Kx&&ys(w,"control","decoder-paint-stale");return}if(!Ue)return;const Ct=vn.current.get(D)||0;if(O-he<Xx(nC,Ct))return;gs([w],We?"control-first-frame-timeout":"control-receive-stale")&&(rl.current.set(D,O),Ea.current.set(D,O),vn.current.set(D,Ct+1))},650);return()=>window.clearInterval(F)},[dr,ys,gs,ye,He]),m.useEffect(()=>{if(rt||zi!=="open"||!be.autoStartLive||Kt.length===0)return;const w=window.setInterval(()=>{const D=performance.now();if(document.visibilityState!=="visible"||D-Il.current<Yf)return;const F=1e3/Math.max(1,Ie||be.fps||1),O=Math.max(aC,Math.ceil(F*4)),U=[];for(const ce of Kt){if(U.length>=sC)break;const he=el("wall",ce),Se=kn.current.get(he)||0;if(Se<=0)continue;const We=rl.current.get(he)||0,Ue=ua.current.get(he)||0,ct=D-Se>O,Ct=Ue<=0||D-Ue>O;if(!ct&&Ct){const Cn=Da.current.get(he)||0;D-Cn>=Kx&&ys(ce,"wall","decoder-paint-stale");continue}if(!ct)continue;const wa=vn.current.get(he)||0;D-We>=Xx(lC,wa)&&U.push(ce)}if(U.length>0&&ms(U,"wall-frame-stale"))for(const ce of U){const he=el("wall",ce);rl.current.set(he,D),vn.current.set(he,(vn.current.get(he)||0)+1)}},iC);return()=>window.clearInterval(w)},[Ie,rt,ys,ms,be.autoStartLive,be.fps,Kt,zi]),m.useEffect(()=>{ca(be.fps),da.current=Date.now(),Dn.current=0},[be.fps,be.frameMode,be.adaptiveLoadShedding]),m.useEffect(()=>{w0({h264DecodeAcceleration:be.h264DecodeAcceleration})},[be.h264DecodeAcceleration]),m.useEffect(()=>{if(!yt||He||!be.visibleOnlyLive){xn([]);return}const w=Tt.current;if(!w||typeof IntersectionObserver>"u"){xn(Ya);return}const D=Array.from(w.querySelectorAll("[data-live-device-id]"));if(D.length===0){xn([]);return}const F=new Map,O=()=>{const ce=Qf(D.map(he=>String(he.dataset.liveDeviceId||"")).filter(he=>(F.get(he)||0)>0));xn(he=>cu(he,ce)?he:ce)},U=new IntersectionObserver(ce=>{for(const he of ce){const Se=String(he.target.dataset.liveDeviceId||"");Se&&F.set(Se,he.isIntersecting?he.intersectionRatio||.01:0)}O()},{root:null,rootMargin:pn.visibleRootMargin,threshold:[0,.01,.2,.6,1]});return D.forEach(ce=>U.observe(ce)),O(),()=>U.disconnect()},[Ya,yt,He,Ul,be.visibleOnlyLive,qe]),m.useEffect(()=>{if(rt||!be.adaptiveLoadShedding||!be.autoStartLive||Kt.length===0)return;const w=be.fps;if(Kt.length<=pn.preserveConfiguredFpsDeviceCount){Ie!==w&&(ca(w),da.current=Date.now(),Dn.current=0);return}if(zi!=="open"||Va.sampleMs<500)return;const D=Date.now(),F=Kt.length*Ie,O=Va.framesPerSecond,U=Va.bytesPerSecond,ce=Math.max(0,...Kt.map(ct=>ki[el("wall",ct)]?.maxIntervalMs||0)),he=Math.max(0,...Kt.map(ct=>At[el("wall",ct)]?.maxIntervalMs||0)),Se=F>8&&O>0&&O<F*.72;if(O>pn.maxWallFramesPerSecond||U>pn.maxWallBytesPerSecond||ce>pn.maxFrameGapMs||he>pn.maxFrameGapMs||Se){Dn.current=0;const ct=pn.minFps;if(D-da.current>=pn.downshiftCooldownMs&&Ie>ct){const Ct=Math.max(ct,wC(Ie,ct));Ct<Ie&&(ca(Ct),da.current=D)}return}const Ue=O<pn.maxWallFramesPerSecond*pn.lowLoadFrameRatio&&U<pn.maxWallBytesPerSecond*pn.lowLoadByteRatio;if(!Ue||Ie>=w){Ue||(Dn.current=0);return}if(!Dn.current){Dn.current=D;return}if(D-Dn.current>=pn.recoveryCooldownMs){const ct=Math.min(w,SC(Ie,w));ct>Ie&&(ca(ct),da.current=D,Dn.current=0)}},[Ie,rt,At,ki,Kt.length,Kt,zi,Va.bytesPerSecond,Va.framesPerSecond,Va.lastUpdatedAt,Va.sampleMs,be.adaptiveLoadShedding,be.autoStartLive,be.frameMode,be.fps]),m.useEffect(()=>{const w=new URLSearchParams(window.location.search).get("checkout");if(w==="success"){L("Checkout returned. Waiting for Dodo confirmation."),W();const D=window.setInterval(()=>{W()},4e3),F=window.setTimeout(()=>{window.clearInterval(D)},45e3);return()=>{window.clearInterval(D),window.clearTimeout(F)}}w==="cancelled"&&L("Checkout cancelled.")},[W]),m.useEffect(()=>{!yt&&ue&&H(!1),!yt&&X&&te(!1)},[X,ue,yt]),m.useEffect(()=>{te(!1)},[ye?.deviceId]),m.useEffect(()=>{const w=Ye.map(O=>O.deviceId),D=new Set(w),F=new Map(Ye.map(O=>[O.deviceId,O]));ee(O=>{const U=O.filter(ce=>D.has(ce));return cu(O,U)?O:U}),$(O=>O&&D.has(O)?O:""),le(O=>O&&D.has(O)?O:""),V(O=>{const U=O.filter(ce=>ce>=1&&ce<=Ln);return cu(O.map(String),U.map(String))?O:U}),Re(O=>{let U=!1;const ce={};for(const[he,Se]of Object.entries(O)){if(!D.has(he)){U=!0;continue}const We=F.get(he),Ue=ra(Se,We?$n(We):1);ce[he]=Ue,Ue!==Se&&(U=!0)}return U?ce:O}),Ze(O=>{const U=O.filter(ce=>D.has(ce));return cu(O,U)?O:U})},[Ye,Ln]),m.useEffect(()=>{Oe([]),xt(!1)},[]),m.useEffect(()=>{!yn||at!=="selected"||Ae.length>0||fa.length===0||Ze(fa.map(w=>w.deviceId))},[fa,Ae.length,at,yn]),m.useEffect(()=>{try{localStorage.setItem(Wv,Lt)}catch{}},[Lt]),m.useEffect(()=>{gC(be)},[be]),m.useEffect(()=>{vC(De)},[De]);const mr=m.useCallback(async()=>{const w=new Set(g);w.add(on);try{const ce=await pt("/api/remote/status",void 0,on);ex({endpoint:ce.agentEndpoint,endpoint_candidates:[...ce.agentEndpointCandidates||[],...ce.hostTargetEndpointCandidates||[]]}).forEach(he=>w.add(he))}catch{}const D=[...w].sort((ce,he)=>{const Se=We=>{const Ue=jo(We);return Ue==="local"?0:Ue==="loopback"?1:2};return Se(ce)-Se(he)||ce.localeCompare(he)});let F=!1,O="",U=!1;try{for(const ce of D){const he=jo(ce);try{if(await pt("/api/health",void 0,ce),he==="local")return b(!0),Zs(!0),ce;he==="loopback"&&(F=!0,O=ce)}catch{he==="local"&&(U=!0)}}return F?(U&&L("LiveDesk Hub is reachable on this PC, but not through the LAN address yet. Restart LiveDesk Hub to bind 5179 on the network."),b(!0),Zs(!0),O||on):(b(!1),Zs(!1),"")}catch{return b(!1),Zs(!1),""}},[g]),ws=async()=>{P("auth"),Xe(!1),await mr();const{error:w}=await nl.auth.signInWithOAuth({provider:"google",options:{redirectTo:window.location.origin}});w&&(L(w.message),P(""))},hr=async()=>{P("auth"),Xe(!1),await nl.auth.signOut(),P("")};m.useEffect(()=>{if(!tn)return;const w=F=>{F.target instanceof Element&&(F.target.closest(".account-popover, .rail-account")||Xe(!1))},D=F=>{F.key==="Escape"&&Xe(!1)};return window.addEventListener("pointerdown",w),window.addEventListener("keydown",D),()=>{window.removeEventListener("pointerdown",w),window.removeEventListener("keydown",D)}},[tn]);const va=m.useCallback(async(w={})=>{const D=w.silent===!0,F=w.takeover===!0,O=w.requestLocalAccess===!0,U=O?await mr():"";if(!l?.user){D||L("Sign in before publishing this host.");return}if(!kt.current){kt.current=!0,D||P("host");try{const ce=U||T||on,he=M||await pt("/api/remote/status",void 0,ce);if(!he.started)throw new Error("Start LiveDesk on this computer before syncing the server.");const Se=`livedesk-${l.user.id}`,We=await pt("/api/remote/host-target",{method:"POST",body:JSON.stringify({nodeId:Se,leaseMs:6e4,takeover:F})},ce);if(!We.ok)throw new Error(We.error||"host-target-failed");const Ue=await pt("/api/remote/status",void 0,ce),ct=await pt("/api/remote/registry-credentials",void 0,ce),Ct=We.hostTarget||{},wa=Ue.hostTargetEndpointCandidates||Ue.agentEndpointCandidates||he.agentEndpointCandidates||[Ue.agentEndpoint||he.agentEndpoint].filter(Boolean),{data:Cn,error:Cl}=await nl.rpc("set_livedesk_remote_host_target",{p_node_id:Se,p_lease_id:String(Ct.leaseId||Ue.hostTargetLeaseId||crypto.randomUUID()),p_host_instance_id:Ue.hostInstanceId||Se,p_endpoint:Ue.hostTargetEndpoint||Ue.agentEndpoint||he.agentEndpoint,p_pair_token:ct.pairToken||"",p_manager_package:"@livedesk/hub",p_manager_version:Ue.managerVersion||"0.1.0",p_agent_package:"@livedesk/client",p_activated_at:new Date().toISOString(),p_expires_at:new Date(Date.now()+6e4).toISOString(),p_takeover:F,p_endpoint_candidates:wa,p_pairing_pin:ct.pairingPin||Ue.pairingPin||""});if(Cl)throw Cl;const ta=Array.isArray(Cn)?Cn[0]:Cn;if(ta&&ta.ok===!1)throw new Error(ta.reason||"registry-rejected");D||(L("Host published."),(O||v)&&(b(!0),Zs(!0)),k()),d()}catch(ce){if(!D){const he=ce instanceof Error?ce.message:String(ce);he.includes("local network access")&&(b(!1),Zs(!1)),L(he)}}finally{kt.current=!1,D||P("")}}},[T,v,k,d,mr,l,M]),qu=m.useCallback(async()=>{if(!E){P("pin");try{const D=await pt("/api/remote/pairing-pin",{method:"POST"},T||on);if(!D.ok)throw new Error(D.error||"pin-rotation-failed");await k(),l?.user&&await va({silent:!0,takeover:!0}),L("New PIN published.")}catch(w){L(w instanceof Error?w.message:String(w))}finally{P("")}}},[E,T,va,k,l]);m.useEffect(()=>{if(!l?.user||!M?.started||j)return;const w=r?.expires_at?Date.parse(r.expires_at):Number.POSITIVE_INFINITY,D=r?.active===!0&&(!r.expires_at||!Number.isFinite(w)||w>Date.now()),F=!!r?.host_instance_id&&!!M.hostInstanceId&&r.host_instance_id===M.hostInstanceId;if(D&&!F)return;let O=!1;const U=()=>{if(O)return;const he=Date.now();he-as.current<25e3||(as.current=he,va({silent:!0}))};U();const ce=window.setInterval(U,3e4);return()=>{O=!0,window.clearInterval(ce)}},[j,va,l?.user?.id,M?.agentEndpoint,M?.hostInstanceId,M?.started,r?.active,r?.expires_at,r?.host_instance_id]);const xl=m.useCallback(w=>{w&&($(w),ee(D=>D.includes(w)?D:[...D,w]))},[]),pr=m.useCallback(w=>{if(!w)return;const D=Ye.find(O=>O.deviceId===w),F=xo(D?.slotNumber);$(w),F>0&&V(O=>O.filter(U=>U!==F)),ee(O=>O.includes(w)?O:[...O,w])},[Ye]),gr=m.useCallback(w=>{!Number.isInteger(w)||w<1||w>Ln||($(""),V(D=>D.includes(w)?D.filter(F=>F!==w):[...D,w].sort((F,O)=>F-O)))},[Ln]),Yl=m.useCallback(()=>{ee([]),V([]),$("")},[]),xr=m.useCallback(()=>{ee([]),$(""),V(Array.from({length:Ln},(w,D)=>D+1))},[Ln]),Pa=m.useCallback((w,D)=>{const F=Ye.find(U=>U.deviceId===w);if(!F)return;const O=$n(F);O<=1||(Re(U=>{const he=(ra(U[w],O)+D+O)%O;return{...U,[w]:he}}),He?le(w):xl(w))},[Ye,xl,He]);m.useEffect(()=>{const w=D=>{if(He&&ue&&Qt)return;const F=D.target,O=F?.tagName?.toLowerCase();F?.isContentEditable||O==="input"||O==="textarea"||O==="select"||((D.ctrlKey||D.metaKey)&&D.key.toLowerCase()==="a"&&(D.preventDefault(),xr()),D.key==="Escape"&&Yl())};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[Qt,Yl,ue,xr,He]);const Yo=async(w,D={})=>{if(!yt){L(za);return}const F=D.focused||He;F?le(w):xl(w);try{const O=Ye.find(he=>he.deviceId===w),U=F?{maxWidth:De.maxWidth,maxHeight:De.maxHeight}:Xt,ce=ra(D.monitorIndex??je[w],O?$n(O):1);await pt(`/api/remote/devices/${encodeURIComponent(w)}/live/start`,{method:"POST",body:JSON.stringify({fps:F?De.fps:Ie,maxWidth:U.maxWidth,maxHeight:U.maxHeight,quality:F?De.quality:be.quality,mode:F?De.frameMode:be.frameMode,frameMode:F?De.frameMode:be.frameMode,streamPurpose:F?"control":"wall",monitorIndex:ce})},T),L("Live stream requested."),k()}catch(O){L(O instanceof Error?O.message:String(O))}},$u=(w,D)=>{const F=Ye.find(U=>U.deviceId===w),O=ra(D,F?$n(F):1);Re(U=>({...U,[w]:O})),He?le(w):xl(w)},vr=async w=>{if(le(w),ke("control"),!yt){H(!1),L(za);return}H(!0)},Vo=async()=>{if(!ye){L("Select a workstation before playing audio.");return}if(!yt){L(za);return}if(!Jn){L("Selected workstation does not report remote audio support yet.");return}const w=!X;te(w);try{await pt(`/api/remote/devices/${encodeURIComponent(ye.deviceId)}/audio/${w?"start":"stop"}`,{method:"POST",body:JSON.stringify({mimeType:"audio/webm;codecs=opus",sampleRate:48e3,channels:2})},T),L(w?"Remote audio requested.":"Remote audio stopped.")}catch(D){te(!1),L(D instanceof Error?D.message:String(D))}},yr=async(w,D,F="files")=>{const O=w.filter(Se=>Se.file.size>=0);if(O.length===0)return{files:0,bytes:0};if(!yt)throw new Error(za);if(D.length===0)throw new Error("Select at least one connected workstation.");const U=crypto.randomUUID(),ce=O.reduce((Se,We)=>Se+We.file.size,0);let he=0;Ut({id:U,status:"reading",progress:1,message:`Preparing ${O.length} ${F}`});try{for(let Se=0;Se<O.length;Se+=1){const We=O[Se],Ue=We.file,ct=Math.max(1,Math.ceil(Ue.size/$f));for(let Ct=0;Ct<ct;Ct+=1){const wa=Ct*$f,Cn=Math.min(Ue.size,wa+$f),Cl=Ue.size===0?new ArrayBuffer(0):await Ue.slice(wa,Cn).arrayBuffer(),ta=Ct===ct-1;Ut({id:U,status:"sending",progress:Math.max(2,Math.min(98,Math.round(he/Math.max(1,ce)*96))),message:`${Se+1}/${O.length} ${We.relativePath}`});const Bn=await pt("/api/remote/files/chunk",{method:"POST",body:JSON.stringify({transferId:U,deviceIds:D,remoteDirectory:Lt.trim(),name:Ue.name,relativePath:We.relativePath,size:Ue.size,type:Ue.type,lastModified:Ue.lastModified,offset:wa,totalBytes:Ue.size,final:ta,dataBase64:MC(Cl)})},T);if(!Bn.ok||Bn.queued!==D.length)throw new Error(Bn.error||`file-chunk-not-queued-${Bn.queued}/${D.length}`);he+=Cl.byteLength,await new Promise(Za=>window.setTimeout(Za,0))}}return Ut({id:U,status:"queued",progress:100,message:`Sent ${O.length} file${O.length===1?"":"s"} to ${D.length} workstation${D.length===1?"":"s"}`}),window.setTimeout(()=>{Ut(Se=>Se?.id===U&&Se.status==="queued"?null:Se)},4500),{files:O.length,bytes:ce}}catch(Se){throw Ut({id:U,status:"failed",progress:100,message:Se instanceof Error?Se.message:String(Se)}),Se}},Vl=async w=>{const D=fa.length>0?fa.map(F=>F.deviceId):ye?[ye.deviceId]:[];try{await yr(Wx(w),D)}catch(F){L(F instanceof Error?F.message:String(F))}},Pl=async w=>{try{await yr(Wx(w),Ou)}catch(D){L(D instanceof Error?D.message:String(D))}};m.useEffect(()=>{$t.current=!1},[]);const Gu=w=>{w.preventDefault(),w.stopPropagation(),me(!1),Vl(w.dataTransfer.files)},Ss=async()=>{const w=de.trim();if(w){if(!yt){L(za);return}P("task");try{await pt("/api/remote/tasks",{method:"POST",body:JSON.stringify({instruction:w,allConnected:!0,approvalLevel:"task-only"})},T),ve(""),L("Task queued."),k()}catch(D){L(D instanceof Error?D.message:String(D))}finally{P("")}}},Bi=async(w="ltd")=>{if(!l){L("Sign in with Google before checkout.");return}if(z&&w===ot){L("LiveDesk license is already active.");return}if(z&&ot==="pro"){L("LiveDesk Pro is already active.");return}P("checkout");try{const{data:D,error:F}=await nl.functions.invoke("dodo-checkout",{body:{plan:w}});if(F)throw F;if(!D?.checkout_url)throw new Error("Checkout function did not return a checkout URL.");window.location.assign(D.checkout_url)}catch(D){L(D instanceof Error?D.message:String(D)),P("")}},Ba=rC(),Ql=oC(),br=Ye.length,Ms=Fo.filter(w=>xs.has(w)).length,Cs=vs==="open"&&fr.sampleMs>0?`${fr.framesPerSecond.toFixed(1)} fps`:vs,xe=ye?He?ur.get(ye.deviceId):xs.get(ye.deviceId):void 0,js=ye?ra(je[ye.deviceId],$n(ye)):0,Po=ye?fC(ye):[],Yu=typeof xe?.monitorIndex=="number"?ra(xe.monitorIndex,Math.max(1,xe.monitorCount||1)):js,wr=(xe&&Yu===js?oy(xe):null)||(ye?ry(ye,js):null),Sn=wr?`${wr.width}x${wr.height}`:"-",Qa=ye?el(He?"control":"wall",ye.deviceId):"",_t=Qa?ki[Qa]:void 0,dn=Qa?At[Qa]:void 0,Ge=dn?.lastInfo,Qo=_t&&_t.sampleMs>0?`${_t.framesPerSecond.toFixed(1)} fps`:"waiting",Sr=_t?`#${_t.totalFrames} / ${Qo}`:"waiting",Vu=dn&&dn.sampleMs>0?`${dn.framesPerSecond.toFixed(1)} fps`:"waiting",Kl=dn&&dn.sampleMs>0?`${dn.changedFramesPerSecond.toFixed(1)} fps`:"waiting",Mr=Ge?`#${Ge.frameSeq} ${Ge.decoderLabel} q${Ge.queueSize} r${Ge.renderQueueSize} d${Ge.droppedForLatency} f${Ge.decoderFlushCount} t${Ge.decoderTimestampFallbacks} io${Ge.decoderInputCount}/${Ge.decoderOutputCount} ${Ge.visualChanged?"changed":"same"}`:"waiting",Hi=Ge?`${Math.round(Ge.queuedForMs)}ms total / ${Math.round(Ge.decodedForMs)}ms decode / ${Math.round(Ge.scheduledForMs)}ms pace / ${Ge.drawMs.toFixed(1)}ms draw`:"-",Cr=Ge?.targetPaintIntervalMs?`${Ge.targetPaintIntervalMs.toFixed(1)}ms / ${(1e3/Ge.targetPaintIntervalMs).toFixed(1)} fps`:"-",Ko=dn?`${dn.decoderInputFps.toFixed(1)} in / ${dn.decoderOutputFps.toFixed(1)} out fps`:"waiting",vl=Ge?.canvasPresentation||"-",Xl=Ge?`${Ge.interactiveBufferWaitCount} waits / ${Math.round(Ge.interactiveBufferWaitMs)}ms / ${Ge.interactiveQueueDrainCount} drains`:"waiting",jr=a.framesPerSecond>0?`${a.framesPerSecond.toFixed(1)} fps / p95 ${a.p95IntervalMs.toFixed(1)}ms / max ${a.maxIntervalMs.toFixed(1)}ms / long ${a.longTaskCount} (${Math.round(a.longTaskMs)}ms)`:"waiting",Xo=_t?xe?.frameMode==="mode5-lzo-delta"?`${wo(_t.averageFrameBytes)} avg / visual ${xe.deltaVisualTileCount||0} + refresh ${xe.deltaRefreshTileCount||0} / ${xe.deltaTotalTiles||0}`:`${wo(_t.averageFrameBytes)} avg / tiny ${Math.round(_t.tinyFrameRatio*100)}% / repeat ${Math.round(_t.repeatedFrameRatio*100)}%`:"waiting",yl=_t&&_t.sourceSendSampleCount>0?`${_t.sourceSendAverageMs.toFixed(1)}ms avg / p95 ${_t.sourceSendP95Ms.toFixed(1)}ms`:"waiting",Zo=Gx(_t),Wo=Gx(dn),Jo=_t&&dn?`rx ${Yx(_t)} / paint ${Yx(dn)}`:"waiting",Nr=xe?xe.frameMode||xe.mode||xe.codec||xe.mimeType:He?De.frameMode:be.frameMode,Ar=He?De.frameMode:be.frameMode,Pu=Nr!==Ar?`${Ar} -> ${Nr}`:Ar,ec=xe?`${xe.width}x${xe.height} ${wo(xe.byteLength)}`:He?`${La.maxWidth}x${La.maxHeight}`:`${be.maxWidth}x${be.maxHeight}`,tc=xe?xe.frameMode==="mode2-lzo"?"independent":`${xe.isKeyFrame?"key":String(xe.chunkType||"delta")}`:"-",Tr=xe&&xe.monitorCount?`${(xe.monitorIndex??0)+1}/${xe.monitorCount}`:"-",ea=xe?[`src ${Math.round(xe.sourceGapMs||0)}ms`,`gap ${Math.round(xe.agentSendGapMs||0)}ms`,`tx ${Math.round(xe.agentSendDurationMs||0)}ms`,`pace ${Math.round(xe.agentPaceMs||0)}ms`,`queue ${Math.round(xe.agentQueueBeforePaceMs||0)}ms`,`age ${Math.round(xe.agentFrameAgeMs||0)}ms`,xe.browserReceivedEpochMs&&xe.receivedAt?`hub ${Math.max(0,Math.round(xe.browserReceivedEpochMs-Date.parse(xe.receivedAt)))}ms`:"",xe.browserReceivedEpochMs&&xe.hubPacketEpochMs?`sock ${Math.max(0,Math.round(xe.browserReceivedEpochMs-xe.hubPacketEpochMs))}ms`:"",xe.droppedByAgent?`drop ${xe.droppedByAgent}`:"",xe.hubIngressDropped?`ingress-drop ${xe.hubIngressDropped}`:"",xe.hubClientDropped?`ws-drop ${xe.hubClientDropped}`:"",xe.captureStageMs?`capture ${Math.round(xe.captureStageMs)}ms`:"",xe.convertMs?`rgb565 ${Math.round(xe.convertMs)}ms`:"",xe.compressMs?`lzo ${Math.round(xe.compressMs)}ms`:"",xe.captureSourceSerial?`cap #${xe.captureSourceSerial}`:"",xe.captureSourceSkipped?`cap skip ${xe.captureSourceSkipped}`:"",xe.frameMode==="mode5-lzo-delta"?`tiles ${xe.deltaVisualTileCount||0}+${xe.deltaRefreshTileCount||0}/${xe.deltaTotalTiles||0}@${xe.deltaTileSize||0}`:"",xe.platformProfile||xe.hardwareEncoder||"-",xe.atlasComposeMs?`atlas ${xe.atlasComposeMs.toFixed(1)}ms`:"",xe.atlasPoolStarved?`pool ${xe.atlasPoolStarved}`:"",xe.atlasTileCount?`tiles ${xe.atlasReadyTiles||0}/${xe.atlasTileCount}`:"",Ge?.inputFeedbackMs!==void 0&&Ge.inputFeedbackAt!==void 0&&performance.now()-Ge.inputFeedbackAt<=Ix?`feedback ${Math.round(Ge.inputFeedbackMs)}ms`:"",xe.contentHash?`enc ${xe.contentHash.slice(0,6)}`:"",Ge?.visualHash?`pix ${Ge.visualHash.slice(0,6)}`:""].filter(Boolean).join(" / "):"-",Ns=bs==="open"?[`${xa.sentPerSecond.toFixed(1)} hz`,xa.lastInputSeq>0?`rtt ${Math.round(xa.lastRoundTripMs)}ms`:"",xa.lastInputSeq>0?`apply ${xa.lastAgentApplyMs.toFixed(1)}ms`:"",xa.droppedPerSecond>0?`drop ${xa.droppedPerSecond.toFixed(1)}/s`:"",xa.bufferedAmount>0?`buf ${wo(xa.bufferedAmount)}`:"",xa.lastInputType||"ready"].filter(Boolean).join(" / "):bs,_n=Ge?.inputFeedbackMs!==void 0&&Ge.inputFeedbackAt!==void 0&&performance.now()-Ge.inputFeedbackAt<=Ix?`${Math.round(Ge.inputFeedbackMs)}ms / input #${Ge.inputFeedbackSeq||0}`:"waiting for changed frame",Zl=xe?`#${xe.frameSeq} ${om(xe.receivedAt||xe.capturedAt)}`:"waiting",Ka=Math.max(0,fr.bytesPerSecond*8/1e6),Fi=Gl?.atlasReadyTiles??Ms,Wl=Gl?.atlasTileCount??Ms,kr=Fi===Wl?`${Wl} tiles`:`${Fi}/${Wl} tiles`,bl=He?`1 stream / ${Cs} / ${Ka.toFixed(Ka>=10?0:1)}Mbps`:rt?`1 stream / ${kr} / ${Cs} / ${Ka.toFixed(Ka>=10?0:1)}Mbps`:`${Ms} screens / ${Cs} / ${Ka.toFixed(Ka>=10?0:1)}Mbps`,Er=j?"offline":M?.started?"online":"starting",wl=fa.length+se.filter(w=>!Ye.some(D=>xo(D.slotNumber)===w)).length,Jl=se.length===1?`Slot ${String(se[0]).padStart(3,"0")}`:`${se.length} slots selected`,Qu=He?ye?ko(ye):"No workstation":wl===0?"No workstation":wl>1?`${wl} selected`:ye?ko(ye):Jl,lt=lr[Ee]||lr.en,ei=lt.sync||lr.en.sync,ya=s||G?"checking":z?ot==="pro"?"Pro LTD active":`Plus LTD ${Ye.length}/${bo}`:ql?`Free ${Ye.length}/${er}`:`Upgrade ${Ye.length}/${er}`,nc=ot==="pro"?"Pro active":E==="checkout"?"Opening":ot==="ltd"?"Pro $199":"Plus $79",Sl=z?ot==="pro"?"Pro active":"Upgrade to Pro LTD":l?E==="checkout"?"Opening checkout":ot==="ltd"?"Buy Pro LTD":"Buy Plus LTD":E==="auth"?"Opening Google":"Sign in to buy",Rr=ot==="pro"||E==="checkout"||E==="auth"||s||G,Lr=l?.user.user_metadata,ti=Jx(Lr,"avatar_url","picture"),ni=Jx(Lr,"full_name","name")||l?.user.email||"Google",Mn=ni.slice(0,1).toUpperCase(),ai=M?.started?"Local app ready":"Start LiveDesk",li=r?.active?"Published":l?"Not published":"Sign in required",As=/^\d{6}$/.test(M?.pairingPin||"")?M?.pairingPin:"------",Ii=vu.find(w=>w.width===be.maxWidth&&w.height===be.maxHeight)?.id||`${be.maxWidth}x${be.maxHeight}`,zn=be.atlasTileSizeMode==="auto"?"auto":Pf.find(w=>w.width===be.atlasTileWidth&&w.height===be.atlasTileHeight)?.id||"320x180",On=Vf.find(w=>w.width===De.maxWidth&&w.height===De.maxHeight)?.id||`${De.maxWidth}x${De.maxHeight}`,Xa=xu.find(w=>w.id===be.frameMode)||xu[0],wt=w=>{gn(D=>{const F=w.frameMode?vm(w.frameMode):D.frameMode,O=w.frameMode!==void 0&&F!==D.frameMode;return{...D,...w,frameMode:F,fps:bm(w.fps??(O?ly(F):D.fps),F)}})},ba=w=>{const D=vu.find(F=>F.id===w);D&&wt({maxWidth:D.width,maxHeight:D.height})},Ha=w=>{if(w==="auto"){wt({atlasTileSizeMode:"auto"});return}const D=Pf.find(F=>F.id===w);!D?.width||!D?.height||wt({atlasTileSizeMode:"fixed",atlasTileWidth:D.width,atlasTileHeight:D.height})},Ml=w=>{pe(D=>{const F=w.frameMode?ym(w.frameMode):D.frameMode,O=w.frameMode!==void 0&&F!==D.frameMode,U=w.fps??(O?30:D.fps),ce=w.maxWidth??D.maxWidth,he=w.maxHeight??D.maxHeight;return{...D,...w,frameMode:F,fps:Na(U,20,F==="mode5-lzo-delta"?30:60,F==="mode5-lzo-delta"?30:60),maxWidth:F==="mode5-lzo-delta"?Math.min(1920,ce):ce,maxHeight:F==="mode5-lzo-delta"?Math.min(1080,he):he}})},_r=w=>{const D=Vf.find(F=>F.id===w);D&&Ml({maxWidth:D.width,maxHeight:D.height})},zr=w=>{if(w==="control"){const D=hl||ml;if(D&&le(D.deviceId),ke(w),!yt){H(!1),L(za);return}H(!0);return}ke(w),H(!1)};return o.jsxs("main",{className:"app-shell",children:[o.jsxs("aside",{className:"tool-rail","aria-label":"LiveDesk tools",children:[o.jsx("div",{className:"rail-brand",title:"LiveDesk",children:o.jsx(tl,{size:22})}),o.jsx("nav",{className:"rail-tools",children:kC.map(w=>{const D=w.icon;return o.jsxs("button",{className:`rail-tool ${ge===w.id?"active":""} accent-${w.accent}`,onClick:()=>zr(w.id),title:w.label,type:"button",children:[o.jsx(D,{size:19}),o.jsx("span",{children:w.label})]},w.id)})}),o.jsxs("div",{className:"rail-footer",children:[o.jsxs("button",{className:"rail-tool compact sync-server",onClick:()=>va({takeover:!0,requestLocalAccess:!0}),title:"Sync Server",type:"button",children:[o.jsx(Nf,{size:18}),o.jsx("span",{children:"Sync Server"})]}),o.jsxs("button",{className:`rail-tool compact local-settings ${ls?"active":""}`,onClick:()=>{ke("settings"),Xe(!1),H(!1),Mt(!1)},title:"Settings",type:"button",children:[o.jsx(Ob,{size:18}),o.jsx("span",{children:"Settings"})]}),o.jsxs("button",{className:`rail-account ${l?"signed-in":""}`,onClick:()=>{Xe(w=>!w)},disabled:s||E==="auth","aria-expanded":tn,title:l?`Account: ${l.user.email||ni}`:"Sign in with Google",type:"button",children:[l?ti?o.jsx("img",{src:ti,alt:ni,referrerPolicy:"no-referrer"}):o.jsx("span",{className:"avatar-fallback",children:Mn}):o.jsx(Af,{size:18}),o.jsx("span",{children:l?"Account":"Google"})]}),tn&&o.jsxs("section",{className:"account-popover",role:"dialog","aria-label":"LiveDesk account",children:[o.jsxs("div",{className:"account-popover-head",children:[o.jsx("div",{className:"account-popover-avatar",children:l&&ti?o.jsx("img",{src:ti,alt:ni,referrerPolicy:"no-referrer"}):l?o.jsx("span",{children:Mn}):o.jsx(Af,{size:18})}),o.jsxs("div",{children:[o.jsx("strong",{children:l?ni:"Account"}),o.jsx("p",{children:l?.user.email||"Not signed in"})]})]}),o.jsxs("dl",{className:"account-popover-facts",children:[o.jsx("dt",{children:"User"}),o.jsx("dd",{children:l?.user.email||"Not signed in"}),o.jsx("dt",{children:"Network"}),o.jsx("dd",{children:ai}),o.jsx("dt",{children:"Access"}),o.jsx("dd",{children:li}),o.jsx("dt",{children:"Plan"}),o.jsx("dd",{children:ya}),o.jsx("dt",{children:"Ads"}),o.jsx("dd",{children:ot==="free"?"Standard banner":"Removed"})]}),l?o.jsxs("button",{className:"account-popover-action",onClick:hr,disabled:E==="auth",type:"button",children:[o.jsx(Bb,{size:16}),"Logout"]}):o.jsxs("button",{className:"account-popover-action primary",onClick:ws,disabled:E==="auth",type:"button",children:[o.jsx(Af,{size:16}),"Sign in with Google"]})]})]})]}),o.jsxs("section",{className:`desk-stage ${bn&&!Ne?"dock-open":""} ${He?"control-stage":""}`,children:[o.jsxs("header",{className:"topbar",children:[o.jsxs("div",{className:"brand",children:[o.jsx("span",{className:"brand-mark",children:o.jsx(Tf,{size:18})}),o.jsxs("div",{children:[o.jsx("h1",{children:"LiveDesk"}),o.jsx("p",{children:"Control wall for local machines"})]})]}),yn&&!He&&o.jsxs("div",{className:"file-share-top-route","aria-label":"File distribution route",children:[o.jsxs("div",{children:[o.jsx(tr,{size:17}),o.jsxs("span",{children:[o.jsx("small",{children:"Source"}),o.jsx("strong",{children:"LiveDesk Hub"})]})]}),o.jsx(tv,{size:15}),o.jsx(Hb,{size:16}),o.jsxs("div",{children:[o.jsx("span",{className:"file-share-top-route-laptops",children:"▣ ▣ ▣"}),o.jsxs("span",{children:[o.jsx("small",{children:"Destination"}),o.jsxs("strong",{children:[Bo," workstation",Bo===1?"":"s"]}),o.jsx("em",{children:Lt.trim()||"Desktop/LiveDeskFiles"})]})]})]}),bn&&!He&&o.jsx("div",{className:"top-actions",children:o.jsx("div",{className:"segmented-control","aria-label":"Screen size",children:TC.map(w=>o.jsx("button",{className:qe===w.id?"active":"",onClick:()=>_e(w.id),type:"button",children:w.label},w.id))})})]}),Di?o.jsxs("section",{className:"doc-page",lang:Ee,dir:Ee==="ar"?"rtl":"ltr",children:[o.jsxs("section",{className:"doc-hero",children:[o.jsxs("div",{className:"doc-hero-copy",children:[o.jsxs("span",{className:"pricing-eyebrow",children:[o.jsx(nm,{size:16}),lt.eyebrow]}),o.jsx("h2",{children:lt.title}),o.jsx("p",{children:lt.intro})]}),o.jsxs("label",{className:"doc-language-picker",children:[o.jsxs("span",{children:[o.jsx(Fb,{size:17}),lt.languageLabel]}),o.jsx("select",{value:Ee,onChange:w=>$e(w.target.value),children:EC.map(w=>o.jsx("option",{value:w.id,children:w.label},w.id))})]})]}),o.jsx("section",{className:"doc-grid",children:lt.sections.map((w,D)=>{const O=[Bg,vo,tm,Ib][D]||nm;return o.jsxs("article",{className:"doc-card",children:[o.jsx("div",{className:"doc-card-icon",children:o.jsx(O,{size:19})}),o.jsxs("div",{children:[o.jsx("h3",{children:w.title}),o.jsx("p",{children:w.body}),o.jsx("ul",{children:w.points.map(U=>o.jsx("li",{children:U},U))})]})]},w.title)})}),ei&&o.jsxs("section",{className:"doc-sync",children:[o.jsxs("div",{className:"doc-sync-head",children:[o.jsx(Nf,{size:20}),o.jsxs("div",{children:[o.jsx("h3",{children:ei.title}),o.jsx("p",{children:ei.body})]})]}),o.jsx("ul",{children:ei.points.map(w=>o.jsx("li",{children:w},w))})]}),o.jsxs("section",{className:"doc-firewall",children:[o.jsxs("div",{className:"doc-firewall-head",children:[o.jsx(Hg,{size:20}),o.jsxs("div",{children:[o.jsx("h3",{children:lt.firewall.title}),o.jsx("p",{children:lt.firewall.body})]})]}),o.jsx("ul",{children:lt.firewall.points.map(w=>o.jsx("li",{children:w},w))})]}),o.jsxs("section",{className:"doc-command-panel",children:[o.jsxs("div",{className:"doc-command-head",children:[o.jsx(vo,{size:20}),o.jsxs("div",{children:[o.jsx("h3",{children:lt.commands.title}),o.jsx("p",{children:lt.commands.body})]})]}),o.jsxs("div",{className:"doc-command-list",children:[lt.commands.manager&&o.jsxs("div",{className:"doc-command-row",children:[o.jsx("span",{children:lt.commands.manager}),o.jsx("code",{children:Ql}),o.jsx("button",{className:"icon-button",onClick:()=>Zi(Ql),title:"Copy command",type:"button",children:o.jsx(Ks,{size:16})})]}),o.jsxs("div",{className:"doc-command-row",children:[o.jsx("span",{children:lt.commands.primary}),o.jsx("code",{children:Ba}),o.jsx("button",{className:"icon-button",onClick:()=>Zi(Ba),title:"Copy command",type:"button",children:o.jsx(Ks,{size:16})})]}),o.jsxs("div",{className:"doc-command-row",children:[o.jsx("span",{children:lt.commands.slot}),o.jsx("code",{children:`${Ba} 3`}),o.jsx("button",{className:"icon-button",onClick:()=>Zi(`${Ba} 3`),title:"Copy command",type:"button",children:o.jsx(Ks,{size:16})})]})]})]})]}):yn?o.jsx(HM,{hubUrl:T,devices:Ye,localFeatureAccess:yt,upgradeNotice:za,notice:ne,remoteDirectory:Lt,onRemoteDirectoryChange:Vt,targetMode:at,selectedTargetIds:Ae,onTargetModeChange:mt,onTargetToggle:w=>Ze(D=>D.includes(w)?D.filter(F=>F!==w):[...D,w]),filePickerRef:ul,folderPickerRef:dl,onBrowserFileImport:w=>{Pl(w)},onBrowserFolderImport:w=>{Pl(w)},onNotice:L,onTransferChange:w=>{if(!w){Ut(null);return}const D=w.state==="failed"||w.state==="partially-failed"||w.state==="cancelled"?"failed":w.state==="completed"?"queued":w.state==="sending"?"sending":"reading";Ut({id:w.id,status:D,progress:w.progress,message:w.message}),["completed","partially-failed","failed","cancelled"].includes(w.state)&&window.setTimeout(()=>Ut(F=>F?.id===w.id?null:F),4500)}}):ls?o.jsx(aw,{pin:o.jsxs(lw,{children:[(j||c||I||ne)&&o.jsx("section",{className:"notice-band",children:j||c||I||ne}),o.jsxs("div",{className:"settings-section-grid",children:[o.jsxs("section",{className:"settings-section-card settings-pairing-card",children:[o.jsxs("div",{className:"settings-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Pair a workstation"}),o.jsx("h3",{children:"Connect another local PC"})]}),o.jsx(tl,{size:20})]}),o.jsxs("div",{className:"settings-pin-display",children:[o.jsx("span",{children:"Hub PIN"}),o.jsx("strong",{children:As}),o.jsxs("button",{className:"text-button ghost compact",onClick:qu,disabled:!M?.started||E==="pin",type:"button",children:[o.jsx(Jf,{size:15}),E==="pin"?"Creating":"New PIN"]})]}),o.jsxs("div",{className:"settings-command-list",children:[o.jsxs("div",{className:"settings-command-row",children:[o.jsx("span",{children:"Client"}),o.jsx("code",{children:Ba}),o.jsx("button",{className:"icon-button",onClick:()=>Zi(Ba),title:"Copy client command",type:"button",children:o.jsx(Ks,{size:16})})]}),o.jsxs("div",{className:"settings-command-row",children:[o.jsx("span",{children:"Slot example"}),o.jsx("code",{children:`${Ba} 3`}),o.jsx("button",{className:"icon-button",onClick:()=>Zi(`${Ba} 3`),title:"Copy slot command",type:"button",children:o.jsx(Ks,{size:16})})]}),o.jsxs("div",{className:"settings-command-row",children:[o.jsx("span",{children:"Hub"}),o.jsx("code",{children:Ql}),o.jsx("button",{className:"icon-button",onClick:()=>Zi(Ql),title:"Copy Hub command",type:"button",children:o.jsx(Ks,{size:16})})]})]})]}),o.jsxs("section",{className:"settings-section-card",children:[o.jsxs("div",{className:"settings-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Hub status"}),o.jsx("h3",{children:Er})]}),o.jsx("span",{className:`settings-status-dot state-${Er}`})]}),o.jsxs("dl",{className:"settings-facts",children:[o.jsx("dt",{children:"Address"}),o.jsx("dd",{children:T||"-"}),o.jsx("dt",{children:"Connected workstations"}),o.jsxs("dd",{children:[br,"/",Ln]}),o.jsx("dt",{children:"Sync access"}),o.jsx("dd",{children:M?.started?"Local app ready":"Start Hub first"}),o.jsx("dt",{children:"Plan"}),o.jsx("dd",{children:ya})]}),o.jsxs("div",{className:"settings-action-row",children:[o.jsxs("button",{className:"text-button primary",onClick:()=>va({takeover:!0,requestLocalAccess:!0}),disabled:!l||E==="host",type:"button",children:[o.jsx(Nf,{size:16}),"Sync access"]}),o.jsxs("button",{className:"text-button buy",onClick:()=>Bi(ot==="ltd"?"pro":"ltd"),disabled:E==="checkout"||ot==="pro",type:"button",children:[o.jsx(yo,{size:16}),nc]})]})]})]}),o.jsxs("section",{className:"settings-section-card",children:[o.jsxs("div",{className:"settings-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"File transfer"}),o.jsx("h3",{children:"Client destination folder"})]}),o.jsx(Mo,{size:20})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Remote folder"}),o.jsx("input",{value:Lt,onChange:w=>Vt(w.target.value),placeholder:"Desktop/LiveDeskFiles"})]}),o.jsx("p",{className:"settings-help",children:"Blank uses Desktop/LiveDeskFiles on each workstation."})]})]}),wall:o.jsx(iw,{children:o.jsxs("div",{className:"settings-section-grid",children:[o.jsxs("section",{className:"settings-section-card",children:[o.jsxs("div",{className:"settings-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Wall stream"}),o.jsx("h3",{children:"Frame delivery"})]}),o.jsx(tm,{size:20})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Frame mode"}),o.jsx("select",{value:be.frameMode,onChange:w=>wt({frameMode:vm(w.target.value)}),children:xu.map(w=>o.jsxs("option",{value:w.id,children:[w.label," - ",w.detail]},w.id))})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"H.264 decode"}),o.jsx("select",{value:be.h264DecodeAcceleration,onChange:w=>wt({h264DecodeAcceleration:Nu(w.target.value)}),children:xm.map(w=>o.jsx("option",{value:w.id,children:w.label},w.id))})]}),o.jsxs("div",{className:"settings-field-grid",children:[o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"FPS"}),o.jsx("select",{value:be.fps,onChange:w=>wt({fps:bm(w.target.value,be.frameMode)}),children:Im.filter(w=>w<=iy(be.frameMode)).map(w=>o.jsx("option",{value:w,children:w},w))})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:rt?"Atlas tile":"Resolution"}),o.jsx("select",{value:rt?zn:Ii,onChange:w=>rt?Ha(w.target.value):ba(w.target.value),children:(rt?Pf:vu).map(w=>o.jsx("option",{value:w.id,children:w.label},w.id))})]})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Quality"}),o.jsx("select",{value:be.quality,onChange:w=>wt({quality:Na(w.target.value,20,95,Gn.quality)}),children:Vx.map(w=>o.jsx("option",{value:w,children:w},w))})]})]}),o.jsxs("section",{className:"settings-section-card",children:[o.jsxs("div",{className:"settings-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Wall behavior"}),o.jsx("h3",{children:"Visibility and load"})]}),o.jsx(Tf,{size:20})]}),o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:be.autoStartLive,onChange:w=>wt({autoStartLive:w.target.checked})}),o.jsx("span",{children:"Auto live on connected screens"})]}),o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:be.visibleOnlyLive,onChange:w=>wt({visibleOnlyLive:w.target.checked})}),o.jsx("span",{children:"Stream visible tiles first"})]}),!rt&&o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:be.adaptiveSizeByWall,onChange:w=>wt({adaptiveSizeByWall:w.target.checked})}),o.jsx("span",{children:"Fit stream size to Wall"})]}),o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:be.adaptiveLoadShedding,onChange:w=>wt({adaptiveLoadShedding:w.target.checked})}),o.jsx("span",{children:"Reduce FPS under load"})]}),o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:be.showScreenStatus,onChange:w=>wt({showScreenStatus:w.target.checked})}),o.jsx("span",{children:"Screen status overlay"})]}),o.jsxs("div",{className:"settings-summary",children:[o.jsx("span",{children:Xa.label}),o.jsxs("strong",{children:[Xt.maxWidth,"x",Xt.maxHeight," / ",Ie,"fps"]})]}),o.jsxs("button",{className:"settings-reset",onClick:()=>gn(Gn),type:"button",children:[o.jsx(kf,{size:15})," Reset Wall settings"]})]})]})}),control:o.jsx(sw,{children:o.jsxs("div",{className:"settings-section-grid",children:[o.jsxs("section",{className:"settings-section-card",children:[o.jsxs("div",{className:"settings-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Control stream"}),o.jsx("h3",{children:"Low-latency delivery"})]}),o.jsx(fu,{size:20})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Frame mode"}),o.jsx("select",{value:De.frameMode,onChange:w=>Ml({frameMode:ym(w.target.value)}),children:JM.map(w=>o.jsx("option",{value:w.id,children:w.label},w.id))})]}),De.frameMode==="mode3-h264-hw"&&o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"H.264 decode"}),o.jsx("select",{value:De.h264DecodeAcceleration,onChange:w=>Ml({h264DecodeAcceleration:Nu(w.target.value)}),children:xm.map(w=>o.jsx("option",{value:w.id,children:w.label},w.id))})]}),o.jsxs("div",{className:"settings-field-grid",children:[o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"FPS"}),o.jsx("select",{value:De.fps,onChange:w=>Ml({fps:Na(w.target.value,20,60,Yn.fps)}),children:eC.filter(w=>De.frameMode==="mode3-h264-hw"||w<=30).map(w=>o.jsx("option",{value:w,children:w},w))})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Resolution"}),o.jsx("select",{value:On,onChange:w=>_r(w.target.value),children:Vf.filter(w=>De.frameMode==="mode3-h264-hw"||w.width<=1920).map(w=>o.jsx("option",{value:w.id,children:w.label},w.id))})]})]}),De.frameMode==="mode3-h264-hw"&&o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Quality"}),o.jsx("select",{value:De.quality,onChange:w=>Ml({quality:Na(w.target.value,20,95,Yn.quality)}),children:Vx.map(w=>o.jsx("option",{value:w,children:w},w))})]})]}),o.jsxs("section",{className:"settings-section-card",children:[o.jsxs("div",{className:"settings-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Control behavior"}),o.jsx("h3",{children:"Session display"})]}),o.jsx(tl,{size:20})]}),o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:De.showScreenStatus,onChange:w=>Ml({showScreenStatus:w.target.checked})}),o.jsx("span",{children:"Screen status overlay"})]}),o.jsxs("div",{className:"settings-summary control",children:[o.jsx("span",{children:De.frameMode==="mode5-lzo-delta"?"Mode 5 tile delta":"Mode 3 H.264"}),o.jsxs("strong",{children:[La.maxWidth,"x",La.maxHeight," / ",Ri,"fps"]})]}),o.jsxs("button",{className:"settings-reset",onClick:()=>pe(Yn),type:"button",children:[o.jsx(kf,{size:15})," Reset Control settings"]})]})]})})}):Ei?o.jsxs("section",{className:"pricing-page",children:[o.jsxs("header",{className:"pricing-header",children:[o.jsxs("div",{children:[o.jsxs("span",{className:"pricing-eyebrow",children:[o.jsx(Ub,{size:15})," LiveDesk plans"]}),o.jsx("h2",{children:"Choose the plan that fits your wall"}),o.jsx("p",{children:"Start free with a local screen wall. Upgrade when you need ad-free monitoring, more workstations, or commercial controls."})]}),o.jsx("button",{className:"pricing-close",onClick:()=>ke("wall"),title:"Close pricing",type:"button",children:o.jsx(em,{size:18})})]}),(I||ne)&&o.jsx("section",{className:"notice-band",children:I||ne}),o.jsxs("div",{className:"pricing-status","aria-live":"polite",children:[o.jsx("span",{children:"Current plan"}),o.jsx("strong",{children:rs.name}),o.jsxs("small",{children:[Ye.length,"/",WM(pl)," connected devices"]})]}),o.jsxs("div",{className:"pricing-cards","aria-label":"LiveDesk plans",children:[o.jsxs("article",{className:`pricing-plan-card ${ot==="free"?"current":""}`,children:[o.jsxs("div",{className:"pricing-plan-topline",children:[o.jsx("span",{className:"pricing-plan-badge free",children:"Free"}),o.jsx("strong",{children:"$0"})]}),o.jsx("p",{className:"pricing-plan-audience",children:Bl.free.audience}),o.jsx("h3",{children:"Monitor your local wall"}),o.jsx("p",{children:Bl.free.note}),o.jsxs("ul",{children:[o.jsxs("li",{children:[o.jsx(ja,{size:16})," Up to ",er," devices"]}),o.jsxs("li",{children:[o.jsx(ja,{size:16})," Live view and local control"]}),o.jsxs("li",{children:[o.jsx(ja,{size:16})," Standard ad-supported banner"]})]}),o.jsx("span",{className:"pricing-current-label",children:ot==="free"?"Current plan":"Included for everyone"})]}),o.jsxs("article",{className:`pricing-plan-card featured ${ot==="ltd"?"current":""}`,children:[o.jsxs("div",{className:"pricing-plan-topline",children:[o.jsxs("span",{className:"pricing-plan-badge plus",children:[o.jsx(qb,{size:14})," Plus"]}),o.jsx("strong",{children:"$5"})]}),o.jsx("p",{className:"pricing-plan-audience",children:Bl.ltd.audience}),o.jsx("h3",{children:"Ad-free monitoring"}),o.jsx("p",{children:"More room for personal AI workstations without the standard banner."}),o.jsxs("ul",{children:[o.jsxs("li",{children:[o.jsx(ja,{size:16})," Up to ",bo," devices"]}),o.jsxs("li",{children:[o.jsx(ja,{size:16})," No standard ad banner"]}),o.jsxs("li",{children:[o.jsx(ja,{size:16})," ",Bl.ltd.yearly," or ",Bl.ltd.ltd]})]}),o.jsxs("button",{className:"pricing-plan-button",onClick:l?()=>Bi("ltd"):ws,disabled:ot!=="free"||E==="checkout"||E==="auth"||s||G,type:"button",children:[o.jsx(yo,{size:16}),ot==="free"?l?"Choose Plus":"Sign in for Plus":"Plus active"]})]}),o.jsxs("article",{className:`pricing-plan-card pro ${ot==="pro"?"current":""}`,children:[o.jsxs("div",{className:"pricing-plan-topline",children:[o.jsxs("span",{className:"pricing-plan-badge pro",children:[o.jsx(Hg,{size:14})," Pro"]}),o.jsx("strong",{children:"$15"})]}),o.jsx("p",{className:"pricing-plan-audience",children:Bl.pro.audience}),o.jsx("h3",{children:"For serious operations"}),o.jsx("p",{children:"Commercial-ready monitoring for larger AI labs, studios, and teams."}),o.jsxs("ul",{children:[o.jsxs("li",{children:[o.jsx(ja,{size:16})," 30+ workstation walls"]}),o.jsxs("li",{children:[o.jsx(ja,{size:16})," Commercial use included"]}),o.jsxs("li",{children:[o.jsx(ja,{size:16})," ",Bl.pro.yearly," or ",Bl.pro.ltd]})]}),o.jsxs("button",{className:"pricing-plan-button",onClick:l?()=>Bi("pro"):ws,disabled:ot==="pro"||E==="checkout"||E==="auth"||s||G,type:"button",children:[o.jsx(yo,{size:16}),ot==="pro"?"Pro active":l?"Choose Pro":"Sign in for Pro"]})]})]}),o.jsxs("section",{className:"pricing-includes",children:[o.jsxs("div",{children:[o.jsx(tl,{size:17}),o.jsx("span",{children:"Screen wall"}),o.jsx("strong",{children:"120+ slots"})]}),o.jsxs("div",{children:[o.jsx(fu,{size:17}),o.jsx("span",{children:"Focused control"}),o.jsx("strong",{children:"Local-first"})]}),o.jsxs("div",{children:[o.jsx(Fg,{size:17}),o.jsx("span",{children:"Remote audio"}),o.jsx("strong",{children:"Available"})]}),o.jsxs("div",{children:[o.jsx(Mo,{size:17}),o.jsx("span",{children:"File transfer"}),o.jsx("strong",{children:"Included"})]})]}),o.jsxs("p",{className:"pricing-note",children:[o.jsx(ja,{size:15})," Commercial use requires Pro. Plus LTD is for personal, creator, and homelab use."]}),o.jsxs("button",{className:"pricing-primary-cta",onClick:l?()=>Bi(ot==="ltd"?"pro":"ltd"):ws,disabled:Rr,type:"button",children:[o.jsx(yo,{size:18}),Sl]})]}):o.jsx(o.Fragment,{children:o.jsxs("section",{className:`monitor-layout ${Ne?"dock-collapsed":""}`,children:[o.jsxs("section",{ref:Tt,className:`screen-wall-panel ${Y?"drop-active":""}`,onClick:w=>{w.currentTarget===w.target&&Yl()},onDragEnter:w=>{w.preventDefault(),me(!0)},onDragOver:w=>{w.preventDefault(),w.dataTransfer.dropEffect="copy"},onDragLeave:w=>{w.currentTarget===w.target&&me(!1)},onDrop:Gu,children:[rt&&o.jsx("canvas",{ref:or,className:"atlas-source-canvas",width:gl?.width||1920,height:gl?.height||1080,"aria-hidden":"true"}),He?o.jsx("section",{className:"control-focus",children:o.jsxs("div",{className:"control-wall",children:[ye&&Po.length>1&&o.jsx("div",{className:"control-monitor-tabs","aria-label":"Select monitor",children:Po.map(w=>o.jsxs("button",{className:w.index===js?"active":"",onClick:()=>$u(ye.deviceId,w.index),title:mC(w),type:"button",children:[o.jsx("span",{children:w.name||`Display ${w.index+1}`}),w.width>0&&w.height>0&&o.jsxs("small",{children:[w.width,"x",w.height]})]},w.index))}),ye?o.jsx(Wf,{device:ye,frame:xe,selected:!1,controlEnabled:Qt&&ue,showStatus:De.showScreenStatus,monitorIndex:ra(je[ye.deviceId],$n(ye)),monitorCount:$n(ye),onSelect:()=>{},onFocusDevice:()=>le(ye.deviceId),onOpenControl:()=>vr(ye.deviceId),onCycleMonitor:w=>Pa(ye.deviceId,w),onCanvasReady:Io,sendInput:Oi,presentationReady:ka},ye.deviceId):o.jsxs("div",{className:"control-empty",children:[o.jsx(tl,{size:30}),o.jsx("strong",{children:"No workstation"}),o.jsx("span",{children:"Open a workstation from the Wall."})]}),ye&&!ka&&o.jsxs("div",{className:"control-connection-overlay",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"control-connection-spinner","aria-hidden":"true"}),o.jsx("strong",{children:"Connecting"}),o.jsx("small",{children:ps?`Control stream: ${ps}`:vs==="open"?"Preparing the first control frame":"Opening the Control stream"})]})]})}):rt?o.jsx("div",{className:`screen-wall atlas-slot-wall size-${qe}`,onClick:w=>{w.currentTarget===w.target&&Yl()},children:Ul.map((w,D)=>{const F=D+1;return w?o.jsx(Wf,{device:w,frame:xs.get(w.deviceId),selected:_a.has(w.deviceId)||fl.has(F),controlEnabled:!1,showStatus:be.showScreenStatus,monitorIndex:ra(je[w.deviceId],$n(w)),monitorCount:$n(w),onSelect:()=>pr(w.deviceId),onFocusDevice:()=>xl(w.deviceId),onOpenControl:()=>vr(w.deviceId),onCycleMonitor:O=>Pa(w.deviceId,O),onCanvasReady:ds,sendInput:Oi},w.deviceId):o.jsx(ev,{index:D,selected:fl.has(F),onSelect:()=>gr(F)},`slot-${D}`)})}):o.jsx("div",{className:`screen-wall size-${qe}`,onClick:w=>{w.currentTarget===w.target&&Yl()},children:Ul.map((w,D)=>{const F=D+1;return w?o.jsx(Wf,{device:w,frame:xs.get(w.deviceId),selected:_a.has(w.deviceId)||fl.has(F),controlEnabled:Qt&&ue&&ye?.deviceId===w.deviceId,showStatus:be.showScreenStatus,monitorIndex:ra(je[w.deviceId],$n(w)),monitorCount:$n(w),onSelect:()=>pr(w.deviceId),onFocusDevice:()=>xl(w.deviceId),onOpenControl:()=>vr(w.deviceId),onCycleMonitor:O=>Pa(w.deviceId,O),onCanvasReady:cs,sendInput:Oi},w.deviceId):o.jsx(ev,{index:D,selected:fl.has(F),onSelect:()=>gr(F)},`slot-${D}`)})}),o.jsx(RC,{visible:Ho&&!He})]}),!ls&&o.jsxs("aside",{className:`right-dock actions-mode ${Ne?"collapsed":""}`,"aria-label":"LiveDesk tools",children:[o.jsx("button",{className:"dock-toggle",onClick:()=>Mt(w=>!w),"aria-label":Ne?"Show control panel":"Hide control panel",title:Ne?"Show control panel":"Hide control panel",type:"button",children:Ne?o.jsx(av,{size:18}):o.jsx(lv,{size:18})}),!Ne&&o.jsxs(o.Fragment,{children:[o.jsxs("section",{className:"action-dock",children:[o.jsxs("div",{className:"action-context",children:[o.jsx("span",{children:He?"Control target":wl>0?"Selection":"No selection"}),o.jsx("strong",{children:Qu})]}),o.jsx("input",{ref:gt,className:"hidden-file-input",type:"file",multiple:!0,onChange:w=>{w.currentTarget.files&&Vl(w.currentTarget.files),w.currentTarget.value=""}}),(j||ne)&&o.jsx("div",{className:"notice-band compact",children:o.jsx("span",{children:j||ne})}),o.jsxs("div",{className:"action-grid",children:[o.jsxs("button",{className:"action-tile primary",onClick:()=>ye&&Yo(ye.deviceId),disabled:!$l,type:"button",children:[o.jsx(Ig,{size:21}),o.jsx("span",{children:"Live"})]}),o.jsxs("button",{className:`action-tile ${ue?"active":""}`,onClick:()=>H(w=>!w),disabled:!Qt,type:"button",children:[o.jsx(fu,{size:21}),o.jsx("span",{children:bs!=="idle"?bs:"Control"})]}),o.jsxs("button",{className:`action-tile ${X?"active":""}`,onClick:Vo,disabled:!os,type:"button",title:Jn?"Remote PC audio":"Remote audio is not supported by this workstation yet",children:[o.jsx(Fg,{size:21}),o.jsx("span",{children:X&&$o!=="idle"?$o:"Audio"})]}),o.jsxs("button",{className:"action-tile",onClick:()=>gt.current?.click(),disabled:!yt||(He?!ye:fa.length===0),type:"button",title:"File transfer",children:[o.jsx(Mo,{size:21}),o.jsx("span",{children:"Files"})]}),o.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Reboot",children:[o.jsx(kf,{size:21}),o.jsx("span",{children:"Reboot"})]}),o.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Power",children:[o.jsx($b,{size:21}),o.jsx("span",{children:"Power"})]}),o.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Terminal",children:[o.jsx(vo,{size:21}),o.jsx("span",{children:"Shell"})]})]})]}),ye&&ma&&o.jsxs("section",{className:"side-panel selected-panel",children:[o.jsxs("div",{className:"machine-detail-head",children:[o.jsxs("div",{className:"panel-title",children:[o.jsx(tl,{size:17}),o.jsx("h2",{children:"Machine detail"})]}),o.jsx("span",{className:`machine-health state-${ma.state}`,children:ma.label})]}),o.jsxs("div",{className:"machine-title",children:[o.jsx("strong",{children:ko(ye)}),o.jsx("span",{children:ma.role})]}),o.jsx("div",{className:"machine-metric-grid",children:ma.metrics.map(w=>o.jsxs("article",{className:`machine-metric state-${w.state}`,children:[o.jsx("span",{children:w.label}),o.jsx("strong",{children:w.value}),o.jsx("small",{children:w.detail}),w.ratio!==void 0&&o.jsx("i",{children:o.jsx("b",{style:{width:`${Math.round(w.ratio*100)}%`}})})]},w.id))}),o.jsxs("section",{className:"machine-section",children:[o.jsxs("div",{className:"machine-section-title",children:[o.jsx(Tf,{size:15}),o.jsx("span",{children:"Stream"})]}),o.jsxs("dl",{className:"facts compact",children:[o.jsx("dt",{children:"Frames"}),o.jsx("dd",{children:Sr}),o.jsx("dt",{children:He?"Control RX":rt?"Atlas RX":"Wall RX"}),o.jsx("dd",{children:bl}),o.jsx("dt",{children:"Painted"}),o.jsx("dd",{children:Vu}),o.jsx("dt",{children:He?"Encoded changes":"Visual samples"}),o.jsx("dd",{children:Kl}),o.jsx("dt",{children:"Decoder"}),o.jsx("dd",{children:Mr}),o.jsx("dt",{children:"Decoder IO"}),o.jsx("dd",{children:Ko}),o.jsx("dt",{children:"Canvas"}),o.jsx("dd",{children:vl}),o.jsx("dt",{children:"Control buffer"}),o.jsx("dd",{children:Xl}),o.jsx("dt",{children:"Browser RAF"}),o.jsx("dd",{children:jr}),o.jsx("dt",{children:"Latency"}),o.jsx("dd",{children:Hi}),o.jsx("dt",{children:"Cadence"}),o.jsx("dd",{children:Cr}),o.jsx("dt",{children:"Source send"}),o.jsx("dd",{children:yl}),o.jsx("dt",{children:"Packet mix"}),o.jsx("dd",{children:Xo}),o.jsx("dt",{children:"Receive gap"}),o.jsx("dd",{children:Zo}),o.jsx("dt",{children:"Paint gap"}),o.jsx("dd",{children:Wo}),o.jsx("dt",{children:"Seq gap"}),o.jsx("dd",{children:Jo}),o.jsx("dt",{children:"Selected"}),o.jsx("dd",{children:Zl}),o.jsx("dt",{children:"Requested"}),o.jsx("dd",{children:Pu}),o.jsx("dt",{children:"Mode"}),o.jsx("dd",{children:Nr}),o.jsx("dt",{children:"Chunk"}),o.jsx("dd",{children:tc}),o.jsx("dt",{children:"Size"}),o.jsx("dd",{children:ec}),o.jsx("dt",{children:"Native"}),o.jsx("dd",{children:Sn}),o.jsx("dt",{children:"Monitor"}),o.jsx("dd",{children:Tr}),o.jsx("dt",{children:"Source"}),o.jsx("dd",{children:ea}),o.jsx("dt",{children:"Input"}),o.jsx("dd",{children:Ns}),He&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Visual feedback"}),o.jsx("dd",{children:_n})]})]})]}),o.jsxs("section",{className:"machine-section",children:[o.jsxs("div",{className:"machine-section-title",children:[o.jsx(vo,{size:15}),o.jsx("span",{children:"Local services"})]}),o.jsx("div",{className:"tool-probe-list",children:ma.tools.map(w=>o.jsxs("span",{className:`tool-probe state-${w.status}`,children:[o.jsx("b",{children:w.label}),o.jsx("em",{children:w.detail})]},w.id))})]}),o.jsxs("section",{className:"machine-section",children:[o.jsxs("div",{className:"machine-section-title",children:[o.jsx(So,{size:15}),o.jsx("span",{children:"Workload"})]}),o.jsxs("div",{className:"workload-card",children:[o.jsx("strong",{children:ma.taskLabel}),o.jsx("span",{children:ma.taskStatus}),ma.taskSummary&&o.jsx("p",{children:ma.taskSummary})]})]}),o.jsxs("div",{className:"machine-section",children:[o.jsxs("div",{className:"machine-section-title",children:[o.jsx(Bg,{size:15}),o.jsx("span",{children:"System"})]}),o.jsxs("dl",{className:"facts compact",children:[o.jsx("dt",{children:"Platform"}),o.jsxs("dd",{children:[ye.platform||"-"," ",ye.arch||""]}),o.jsx("dt",{children:"Release"}),o.jsx("dd",{children:Vn(ye.status,"release")||"-"}),o.jsx("dt",{children:"Uptime"}),o.jsx("dd",{children:cy(St(ye.status,"uptimeSec"))}),o.jsx("dt",{children:"Last seen"}),o.jsx("dd",{children:om(ye.lastSeenAt||ye.connectedAt)}),o.jsx("dt",{children:"Agent"}),o.jsx("dd",{children:ye.agentVersion||"-"}),o.jsx("dt",{children:"Address"}),o.jsx("dd",{children:ye.remoteAddress||"-"})]})]}),Go&&o.jsx("p",{className:"panel-warning",children:Go}),o.jsxs("button",{className:"text-button full",onClick:()=>ye&&Yo(ye.deviceId),disabled:!$l,type:"button",children:[o.jsx(Ig,{size:16}),"Start live"]})]}),o.jsxs("section",{className:"side-panel task-panel",children:[o.jsxs("div",{className:"panel-title",children:[o.jsx(So,{size:17}),o.jsx("h2",{children:"Task"})]}),o.jsx("textarea",{value:de,onChange:w=>ve(w.target.value),placeholder:"Prepare a short status report.",rows:4}),o.jsxs("button",{className:"text-button full primary",onClick:Ss,disabled:E==="task"||!de.trim()||!yt,type:"button",children:[o.jsx(So,{size:16}),"Send to connected"]})]})]})]})]})})]}),Wn&&o.jsxs("aside",{className:`transfer-bar state-${Wn.status}`,"aria-live":"polite",children:[o.jsx("span",{className:"transfer-bar-icon","aria-hidden":"true",children:Wn.status==="queued"?o.jsx(ja,{size:18}):Wn.status==="failed"?o.jsx(em,{size:18}):o.jsx(nv,{size:18})}),o.jsxs("div",{className:"transfer-bar-copy",children:[o.jsx("p",{children:Wn.message}),o.jsx("div",{className:"transfer-bar-track",children:o.jsx("span",{style:{width:`${Math.max(0,Math.min(100,Wn.progress))}%`}})})]}),o.jsxs("strong",{children:[Math.max(0,Math.min(100,Wn.progress)),"%"]})]})]})}Zb.createRoot(document.getElementById("root")).render(o.jsx(m.StrictMode,{children:o.jsx(LC,{})}));