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.
@@ -0,0 +1,12 @@
1
+ import{r as kb,a as m,K as Eb,S as Hg,m as Sm,H as xo,U as Db,N as lv,F as iv,b as Rb,R as Au,L as em,c as Fg,C as Ig,d as Mm,A as Lb,e as _b,f as zb,M as tl,g as ja,h as du,T as Ob,i as So,j as Mo,X as tm,k as nm,l as fu,n as vo,B as am,o as yo,D as Nf,p as Bb,q as Af,s as Hb,t as Tf,u as Fb,E as Ib,v as Ug,W as Ub,w as $g,x as Qs,y as kf,z as $b,G as qb,V as qg,I as sv,P as Gg,J as Gb}from"./icons-CcFpdliC.js";import{r as rv}from"./react-Cdiodqh1.js";import{c as Pb}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:{}},fo={};var Pg;function Yb(){if(Pg)return fo;Pg=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 fo.Fragment=l,fo.jsx=s,fo.jsxs=s,fo}var Yg;function Vb(){return Yg||(Yg=1,Ef.exports=Yb()),Ef.exports}var o=Vb(),Df={exports:{}},mo={},Rf={exports:{}},Lf={};var Vg;function Kb(){return Vg||(Vg=1,(function(a){function l(H,Q){var J=H.length;H.push(Q);e:for(;0<J;){var z=J-1>>>1,te=H[z];if(0<c(te,Q))H[z]=Q,H[J]=te,J=z;else break e}}function s(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var Q=H[0],J=H.pop();if(J!==Q){H[0]=J;e:for(var z=0,te=H.length,fe=te>>>1;z<fe;){var L=2*(z+1)-1,xe=H[L],we=L+1,Se=H[we];if(0>c(xe,J))we<te&&0>c(Se,xe)?(H[z]=Se,H[we]=J,z=we):(H[z]=xe,H[L]=J,z=L);else if(we<te&&0>c(Se,J))H[z]=Se,H[we]=J,z=we;else break e}}return Q}function c(H,Q){var J=H.sortIndex-Q.sortIndex;return J!==0?J:H.id-Q.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,w=3,M=!1,C=!1,j=!1,k=!1,T=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function q(H){for(var Q=s(x);Q!==null;){if(Q.callback===null)r(x);else if(Q.startTime<=H)r(x),Q.sortIndex=Q.expirationTime,l(g,Q);else break;Q=s(x)}}function F(H){if(j=!1,q(H),!C)if(s(g)!==null)C=!0,Z||(Z=!0,G());else{var Q=s(x);Q!==null&&ce(F,Q.startTime-H)}}var Z=!1,D=-1,ee=5,re=-1;function Y(){return k?!0:!(a.unstable_now()-re<ee)}function de(){if(k=!1,Z){var H=a.unstable_now();re=H;var Q=!0;try{e:{C=!1,j&&(j=!1,A(D),D=-1),M=!0;var J=w;try{t:{for(q(H),v=s(g);v!==null&&!(v.expirationTime>H&&Y());){var z=v.callback;if(typeof z=="function"){v.callback=null,w=v.priorityLevel;var te=z(v.expirationTime<=H);if(H=a.unstable_now(),typeof te=="function"){v.callback=te,q(H),Q=!0;break t}v===s(g)&&r(g),q(H)}else r(g);v=s(g)}if(v!==null)Q=!0;else{var fe=s(x);fe!==null&&ce(F,fe.startTime-H),Q=!1}}break e}finally{v=null,w=J,M=!1}Q=void 0}}finally{Q?G():Z=!1}}}var G;if(typeof _=="function")G=function(){_(de)};else if(typeof MessageChannel<"u"){var oe=new MessageChannel,le=oe.port2;oe.port1.onmessage=de,G=function(){le.postMessage(null)}}else G=function(){T(de,0)};function ce(H,Q){D=T(function(){H(a.unstable_now())},Q)}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 w},a.unstable_next=function(H){switch(w){case 1:case 2:case 3:var Q=3;break;default:Q=w}var J=w;w=Q;try{return H()}finally{w=J}},a.unstable_requestPaint=function(){k=!0},a.unstable_runWithPriority=function(H,Q){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var J=w;w=H;try{return Q()}finally{w=J}},a.unstable_scheduleCallback=function(H,Q,J){var z=a.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?z+J:z):J=z,H){case 1:var te=-1;break;case 2:te=250;break;case 5:te=1073741823;break;case 4:te=1e4;break;default:te=5e3}return te=J+te,H={id:b++,callback:Q,priorityLevel:H,startTime:J,expirationTime:te,sortIndex:-1},J>z?(H.sortIndex=J,l(x,H),s(g)===null&&H===s(x)&&(j?(A(D),D=-1):j=!0,ce(F,J-z))):(H.sortIndex=te,l(g,H),C||M||(C=!0,Z||(Z=!0,G()))),H},a.unstable_shouldYield=Y,a.unstable_wrapCallback=function(H){var Q=w;return function(){var J=w;w=Q;try{return H.apply(this,arguments)}finally{w=J}}}})(Lf)),Lf}var Kg;function Qb(){return Kg||(Kg=1,Rf.exports=Kb()),Rf.exports}var Qg;function Xb(){if(Qg)return mo;Qg=1;var a=Qb(),l=kb(),s=rv();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,w=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"),_=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),re=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),de=Symbol.iterator;function G(e){return e===null||typeof e!="object"?null:(e=de&&e[de]||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 F:return"Suspense";case Z:return"SuspenseList";case re:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case _:return e.displayName||"Context";case A:return(e._context.displayName||"Context")+".Consumer";case q:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case D: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 ce=Array.isArray,H=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},z=[],te=-1;function fe(e){return{current:e}}function L(e){0>te||(e.current=z[te],z[te]=null,te--)}function xe(e,t){te++,z[te]=e.current,e.current=t}var we=fe(null),Se=fe(null),ze=fe(null),qe=fe(null);function Oe(e,t){switch(xe(ze,t),xe(Se,e),xe(we,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?rg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=rg(t),e=og(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}L(we),xe(we,e)}function _e(){L(we),L(Se),L(ze)}function Ge(e){e.memoizedState!==null&&xe(qe,e);var t=we.current,n=og(t,e.type);t!==n&&(xe(Se,e),xe(we,n))}function Te(e){Se.current===e&&(L(we),L(Se)),qe.current===e&&(L(qe),ro._currentValue=J)}var Ct,ne;function pe(e){if(Ct===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ct=t&&t[1]||"",ne=-1<n.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+Ct+e+ne}var Re=!1;function Le(e,t){if(!e||Re)return"";Re=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var se=function(){throw Error()};if(Object.defineProperty(se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(se,[])}catch(W){var X=W}Reflect.construct(e,[],se)}else{try{se.call()}catch(W){X=W}e.call(se.prototype)}}else{try{throw Error()}catch(W){X=W}(se=e())&&typeof se.catch=="function"&&se.catch(function(){})}}catch(W){if(W&&X&&typeof W.stack=="string")return[W.stack,X.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 R=y.split(`
4
+ `),K=N.split(`
5
+ `);for(u=i=0;i<R.length&&!R[i].includes("DetermineComponentFrameRoot");)i++;for(;u<K.length&&!K[u].includes("DetermineComponentFrameRoot");)u++;if(i===R.length||u===K.length)for(i=R.length-1,u=K.length-1;1<=i&&0<=u&&R[i]!==K[u];)u--;for(;1<=i&&0<=u;i--,u--)if(R[i]!==K[u]){if(i!==1||u!==1)do if(i--,u--,0>u||R[i]!==K[u]){var ae=`
6
+ `+R[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{Re=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?pe(n):""}function Ce(e,t){switch(e.tag){case 26:case 27:case 5:return pe(e.type);case 16:return pe("Lazy");case 13:return e.child!==t&&t!==null?pe("Suspense Fallback"):pe("Suspense");case 19:return pe("SuspenseList");case 0:case 15:return Le(e.type,!1);case 11:return Le(e.type.render,!1);case 1:return Le(e.type,!0);case 31:return pe("Activity");default:return""}}function tt(e){try{var t="",n=null;do t+=Ce(e,n),n=e,e=e.return;while(e);return t}catch(i){return`
7
+ Error generating stack: `+i.message+`
8
+ `+i.stack}}var he=Object.prototype.hasOwnProperty,Ht=a.unstable_scheduleCallback,Be=a.unstable_cancelCallback,ve=a.unstable_shouldYield,ke=a.unstable_requestPaint,He=a.unstable_now,Pt=a.unstable_getCurrentPriorityLevel,yn=a.unstable_ImmediatePriority,Ve=a.unstable_UserBlockingPriority,ca=a.unstable_NormalPriority,Ta=a.unstable_LowPriority,Tn=a.unstable_IdlePriority,fn=a.log,il=a.unstable_setDisableYieldValue,kn=null,rt=null;function Zt(e){if(typeof fn=="function"&&il(e),rt&&typeof rt.setStrictMode=="function")try{rt.setStrictMode(kn,e)}catch{}}var Rt=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,En=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 Dn(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=En;return En<<=1,(En&62914560)===0&&(En=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 qa(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,R=e.expirationTimes,K=e.hiddenUpdates;for(n=y&~n;0<n;){var ae=31-Rt(n),se=1<<ae;N[ae]=0,R[ae]=-1;var X=K[ae];if(X!==null)for(K[ae]=null,ae=0;ae<X.length;ae++){var W=X[ae];W!==null&&(W.lane&=-536870913)}n&=~se}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-Rt(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|n&261930}function Rn(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-Rt(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 bn(){var e=Q.p;return e!==0?e:(e=window.event,e===void 0?32:Dg(e.type))}function Wn(e,t){var n=Q.p;try{return Q.p=e,t()}finally{Q.p=n}}var Yt=Math.random().toString(36).slice(2),P="__reactFiber$"+Yt,me="__reactProps$"+Yt,Me="__reactContainer$"+Yt,Ue="__reactEvents$"+Yt,ot="__reactListeners$"+Yt,vt="__reactHandles$"+Yt,Ee="__reactResources$"+Yt,nt="__reactMarker$"+Yt;function sn(e){delete e[P],delete e[me],delete e[Ue],delete e[ot],delete e[vt]}function Vt(e){var t=e[P];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Me]||n[P]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=pg(e);e!==null;){if(n=e[P])return n;e=pg(e)}return t}e=n,n=e.parentNode}return null}function mn(e){if(e=e[P]||e[Me]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function St(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function Lt(e){var t=e[Ee];return t||(t=e[Ee]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function wt(e){e[nt]=!0}var ul=new Set,dl={};function Kt(e,t){_t(e,t),_t(e+"Capture",t)}function _t(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={},Ln={};function ls(e){return he.call(Ln,e)?!0:he.call(da,e)?!1:as.test(e)?Ln[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 wn(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 Sn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Pe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ft(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=Pe(e)?"checked":"value";e._valueTracker=ft(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=Pe(e)?e.checked?"true":"false":e.value),e=i,e!==n?(t.setValue(e),!0):!1}function Xe(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 _n(e){return e.replace(Bo,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function zn(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=""+Sn(t)):e.value!==""+Sn(t)&&(e.value=""+Sn(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?Li(e,y,Sn(t)):n!=null?Li(e,y,Sn(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=""+Sn(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?""+Sn(n):"",t=t!=null?""+Sn(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"&&Xe(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=""+Sn(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=""+Sn(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Sn(n):""}function fa(e,t,n,i){if(t==null){if(i!=null){if(n!=null)throw Error(r(92));if(ce(i)){if(1<i.length)throw Error(r(93));i=i[0]}n=i}n==null&&(n=""),t=n}n=Sn(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 sr(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 be(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&&sr(e,u,i)}else for(var f in t)t.hasOwnProperty(f)&&sr(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 mt=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,$l=null;function jt(e){var t=mn(e);if(t&&(e=t.stateNode)){var n=e[me]||null;e:switch(e=t.stateNode,t.type){case"input":if(zn(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="'+_n(""+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));zn(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||$l!==null)&&(Dc(),pl&&(t=pl,e=$l,$l=pl=null,jt(t),e)))for(t=0;t<e.length;t++)jt(e[t])}}function ql(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 Wt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),os=!1;if(Wt)try{var Pa={};Object.defineProperty(Pa,"passive",{get:function(){os=!0}}),window.addEventListener("test",Pa,Pa),window.removeEventListener("test",Pa,Pa)}catch{os=!1}var Mn=null,Jt=null,Oa=null;function Fo(){if(Oa)return Oa;var e,t=Jt,n=t.length,i,u="value"in Mn?Mn.value:Mn.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 en(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 Qt(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=Qt(ha),pa=v({},ha,{view:0,detail:0}),Uo=Qt(pa),us,rr,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,rr=e.screenY-ga.screenY):rr=us=0,ga=e),us)},movementY:function(e){return"movementY"in e?e.movementY:rr}}),or=Qt(ds),Bu=v({},ds,{dataTransfer:0}),Hu=Qt(Bu),Fu=v({},pa,{relatedTarget:0}),fs=Qt(Fu),zi=v({},ha,{animationName:0,elapsedTime:0,pseudoElement:0}),Ya=Qt(zi),ms=v({},ha,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Gl=Qt(ms),gl=v({},ha,{data:0}),hs=Qt(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"},$o={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"},cr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ur(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=cr[e])?!!t[e]:!1}function ps(){return ur}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=en(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?$o[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"?en(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?en(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),gs=Qt(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=Qt(xs),dr=v({},pa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ps}),ys=Qt(dr),bs=v({},ha,{propertyName:0,elapsedTime:0,pseudoElement:0}),Oi=Qt(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}),qo=Qt(xa),Go=v({},ha,{newState:0,oldState:0}),fr=Qt(Go),ws=[9,13,27,32],mr=Wt&&"CompositionEvent"in window,va=null;Wt&&"documentMode"in document&&(va=document.documentMode);var $u=Wt&&"TextEvent"in window&&!va,xl=Wt&&(!mr||va&&8<va&&11>=va),hr=" ",pr=!1;function Pl(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 gr(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Va=!1;function Po(e,t){switch(e){case"compositionend":return gr(t);case"keypress":return t.which!==32?null:(pr=!0,hr);case"textInput":return e=t.data,e===hr&&pr?null:e;default:return null}}function qu(e,t){if(Va)return e==="compositionend"||!mr&&Pl(e,t)?(e=Fo(),Oa=Jt=Mn=null,Va=!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 xr={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 Yo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!xr[e.type]:t==="textarea"}function vr(e,t,n,i){pl?$l?$l.push(i):$l=[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 Yl=null,Vl=null;function Gu(e){tg(e,0)}function Ss(e){var t=St(e);if(La(t))return e}function Bi(e,t){if(e==="change")return t}var Ba=!1;if(Wt){var Kl;if(Wt){var yr="oninput"in document;if(!yr){var Ms=document.createElement("div");Ms.setAttribute("oninput","return;"),yr=typeof Ms.oninput=="function"}Kl=yr}else Kl=!1;Ba=Kl&&(!document.documentMode||9<document.documentMode)}function Cs(){Yl&&(Yl.detachEvent("onpropertychange",ye),Vl=Yl=null)}function ye(e){if(e.propertyName==="value"&&Ss(Vl)){var t=[];vr(t,Vl,e,rs(e)),Ho(Gu,t)}}function js(e,t,n){e==="focusin"?(Cs(),Yl=t,Vl=n,Yl.attachEvent("onpropertychange",ye)):e==="focusout"&&Cs()}function Vo(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ss(Vl)}function Pu(e,t){if(e==="click")return Ss(t)}function qm(e,t){if(e==="input"||e==="change")return Ss(t)}function br(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Cn=typeof Object.is=="function"?Object.is:br;function Ka(e,t){if(Cn(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(!he.call(t,u)||!Cn(e[u],t[u]))return!1}return!0}function Ft(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function hn(e,t){var n=Ft(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=Ft(n)}}function Qe(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Qe(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ko(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Xe(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=Xe(e.document)}return t}function wr(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 Yu=Wt&&"documentMode"in document&&11>=document.documentMode,Ql=null,Sr=null,Hi=null,Mr=!1;function Qo(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mr||Ql==null||Ql!==Xe(i)||(i=Ql,"selectionStart"in i&&wr(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&&Ka(Hi,i)||(Hi=i,i=Hc(Sr,"onSelect"),0<i.length&&(t=new _i("onSelect","select",null,t,n),e.push({event:t,listeners:i}),t.target=Ql)))}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")},Cr={},Xo={};Wt&&(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(Cr[e])return Cr[e];if(!Xl[e])return e;var t=Xl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Xo)return Cr[e]=t[n];return e}var Zo=yl("animationend"),Wo=yl("animationiteration"),Jo=yl("animationstart"),jr=yl("transitionrun"),Nr=yl("transitionstart"),Vu=yl("transitioncancel"),ec=yl("transitionend"),tc=new Map,Ar="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(" ");Ar.push("scrollEnd");function ea(e,t){tc.set(e,t),Kt(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)},On=[],Zl=0,Qa=0;function Fi(){for(var e=Zl,t=Qa=Zl=0;t<e;){var n=On[t];On[t++]=null;var i=On[t];On[t++]=null;var u=On[t];On[t++]=null;var f=On[t];if(On[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&&kr(n,u,f)}}function Wl(e,t,n,i){On[Zl++]=e,On[Zl++]=t,On[Zl++]=n,On[Zl++]=i,Qa|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function Tr(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 kr(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-Rt(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<eo)throw eo=0,Qd=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 Ku(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 ct(e,t,n,i){return new Ku(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=ct(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 Er(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=xb(e,n,we.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case re:return e=ct(31,n,t,u),e.elementType=re,e.lanes=f,e;case j:return Sl(n.children,u,f,t);case k:y=8,u|=24;break;case T:return e=ct(12,n,t,u|2),e.elementType=T,e.lanes=f,e;case F:return e=ct(13,n,t,u),e.elementType=F,e.lanes=f,e;case Z:return e=ct(19,n,t,u),e.elementType=Z,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case _:y=10;break e;case A:y=9;break e;case q:y=11;break e;case D: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=ct(y,n,t,u),t.elementType=e,t.type=i,t.lanes=f,t}function Sl(e,t,n,i){return e=ct(7,e,i,t),e.lanes=n,e}function Dr(e,t,n){return e=ct(6,e,null,t),e.lanes=n,e}function Rr(e){var t=ct(18,null,null,0);return t.stateNode=e,t}function ti(e,t,n){return t=ct(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 jn(e,t){if(typeof e=="object"&&e!==null){var n=ni.get(e);return n!==void 0?n:(t={value:e,source:t,stack:tt(t)},ni.set(e,t),t)}return{value:e,source:t,stack:tt(t)}}var ai=[],li=0,As=null,Ii=0,Bn=[],Hn=0,Xa=null,At=1,ba="";function Ha(e,t){ai[li++]=Ii,ai[li++]=As,As=e,Ii=t}function Ml(e,t,n){Bn[Hn++]=At,Bn[Hn++]=ba,Bn[Hn++]=Xa,Xa=e;var i=At;e=ba;var u=32-Rt(i)-1;i&=~(1<<u),n+=1;var f=32-Rt(t)+u;if(30<f){var y=u-u%5;f=(i&(1<<y)-1).toString(32),i>>=y,u-=y,At=1<<32-Rt(t)+u|n<<u|i,ba=f+e}else At=1<<f|n<<u|i,ba=e}function Lr(e){e.return!==null&&(Ha(e,1),Ml(e,1,0))}function _r(e){for(;e===As;)As=ai[--li],ai[li]=null,Ii=ai[--li],ai[li]=null;for(;e===Xa;)Xa=Bn[--Hn],Bn[Hn]=null,ba=Bn[--Hn],Bn[Hn]=null,At=Bn[--Hn],Bn[Hn]=null}function S(e,t){Bn[Hn++]=At,Bn[Hn++]=ba,Bn[Hn++]=Xa,At=t.id,ba=t.overflow,Xa=e}var E=null,I=null,O=!1,U=null,ue=!1,ge=Error(r(519));function je(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Nn(jn(t,e)),ge}function at(e){var t=e.stateNode,n=e.type,i=e.memoizedProps;switch(t[P]=e,t[me]=i,n){case"dialog":We("cancel",t),We("close",t);break;case"iframe":case"object":case"embed":We("load",t);break;case"video":case"audio":for(n=0;n<no.length;n++)We(no[n],t);break;case"source":We("error",t);break;case"img":case"image":case"link":We("error",t),We("load",t);break;case"details":We("toggle",t);break;case"input":We("invalid",t),Ul(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":We("invalid",t);break;case"textarea":We("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||ig(t.textContent,n)?(i.popover!=null&&(We("beforetoggle",t),We("toggle",t)),i.onScroll!=null&&We("scroll",t),i.onScrollEnd!=null&&We("scrollend",t),i.onClick!=null&&(t.onclick=Jn),t=!0):t=!1,t||je(e,!0)}function Ke(e){for(E=e.return;E;)switch(E.tag){case 5:case 31:case 13:ue=!1;return;case 27:case 3:ue=!0;return;default:E=E.return}}function ht(e){if(e!==E)return!1;if(!O)return Ke(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&&I&&je(e),Ke(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));I=hg(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));I=hg(e)}else t===27?(t=I,xi(e.type)?(e=gf,gf=null,I=e):I=t):I=E?Ma(e.stateNode.nextSibling):null;return!0}function kt(){I=E=null,O=!1}function wa(){var e=U;return e!==null&&(qn===null?qn=e:qn.push.apply(qn,e),U=null),e}function Nn(e){U===null?U=[e]:U.push(e)}var Cl=fe(null),ta=null,Fn=null;function Za(e,t,n){xe(Cl,t._currentValue),t._currentValue=n}function jl(e){e._currentValue=Cl.current,L(Cl)}function Qu(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 R=0;R<t.length;R++)if(N.context===t[R]){f.lanes|=n,N=f.alternate,N!==null&&(N.lanes|=n),Qu(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),Qu(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;Cn(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(ro):e=[ro])}u=u.return}e!==null&&Xu(t,e,n,i),t.flags|=262144}function ac(e){for(e=e.firstContext;e!==null;){if(!Cn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ui(e){ta=e,Fn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function rn(e){return Gm(ta,e)}function lc(e,t){return ta===null&&Ui(e),Gm(e,t)}function Gm(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Fn===null){if(e===null)throw Error(r(308));Fn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Fn=Fn.next=t;return n}var my=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()})}},hy=a.unstable_scheduleCallback,py=a.unstable_NormalPriority,It={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Zu(){return{controller:new my,data:new Map,refCount:0}}function zr(e){e.refCount--,e.refCount===0&&hy(py,function(){e.controller.abort()})}var Or=null,Wu=0,ks=0,Es=null;function gy(e,t){if(Or===null){var n=Or=[];Wu=0,ks=tf(),Es={status:"pending",value:void 0,then:function(i){n.push(i)}}}return Wu++,t.then(Pm,Pm),t}function Pm(){if(--Wu===0&&Or!==null){Es!==null&&(Es.status="fulfilled");var e=Or;Or=null,ks=0,Es=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function xy(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 Ym=H.S;H.S=function(e,t){kp=He(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&gy(e,t),Ym!==null&&Ym(e,t)};var $i=fe(null);function Ju(){var e=$i.current;return e!==null?e:yt.pooledCache}function ic(e,t){t===null?xe($i,$i.current):xe($i,t.pool)}function Vm(){var e=Ju();return e===null?null:{parent:It._currentValue,pool:e}}var Ds=Error(r(460)),ed=Error(r(474)),sc=Error(r(542)),rc={then:function(){}};function Km(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Qm(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,Zm(e),e;default:if(typeof t.status=="string")t.then(Jn,Jn);else{if(e=yt,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,Zm(e),e}throw Gi=t,Ds}}function qi(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 Xm(){if(Gi===null)throw Error(r(459));var e=Gi;return Gi=null,e}function Zm(e){if(e===Ds||e===sc)throw Error(r(483))}var Rs=null,Br=0;function oc(e){var t=Br;return Br+=1,Rs===null&&(Rs=[]),Qm(Rs,e,t)}function Hr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function cc(e,t){throw t.$$typeof===w?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Wm(e){function t($,B){if(e){var V=$.deletions;V===null?($.deletions=[B],$.flags|=16):V.push(B)}}function n($,B){if(!e)return null;for(;B!==null;)t($,B),B=B.sibling;return null}function i($){for(var B=new Map;$!==null;)$.key!==null?B.set($.key,$):B.set($.index,$),$=$.sibling;return B}function u($,B){return $=ya($,B),$.index=0,$.sibling=null,$}function f($,B,V){return $.index=V,e?(V=$.alternate,V!==null?(V=V.index,V<B?($.flags|=67108866,B):V):($.flags|=67108866,B)):($.flags|=1048576,B)}function y($){return e&&$.alternate===null&&($.flags|=67108866),$}function N($,B,V,ie){return B===null||B.tag!==6?(B=Dr(V,$.mode,ie),B.return=$,B):(B=u(B,V),B.return=$,B)}function R($,B,V,ie){var De=V.type;return De===j?ae($,B,V.props.children,ie,V.key):B!==null&&(B.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===ee&&qi(De)===B.type)?(B=u(B,V.props),Hr(B,V),B.return=$,B):(B=Er(V.type,V.key,V.props,null,$.mode,ie),Hr(B,V),B.return=$,B)}function K($,B,V,ie){return B===null||B.tag!==4||B.stateNode.containerInfo!==V.containerInfo||B.stateNode.implementation!==V.implementation?(B=ti(V,$.mode,ie),B.return=$,B):(B=u(B,V.children||[]),B.return=$,B)}function ae($,B,V,ie,De){return B===null||B.tag!==7?(B=Sl(V,$.mode,ie,De),B.return=$,B):(B=u(B,V),B.return=$,B)}function se($,B,V){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return B=Dr(""+B,$.mode,V),B.return=$,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case M:return V=Er(B.type,B.key,B.props,null,$.mode,V),Hr(V,B),V.return=$,V;case C:return B=ti(B,$.mode,V),B.return=$,B;case ee:return B=qi(B),se($,B,V)}if(ce(B)||G(B))return B=Sl(B,$.mode,V,null),B.return=$,B;if(typeof B.then=="function")return se($,oc(B),V);if(B.$$typeof===_)return se($,lc($,B),V);cc($,B)}return null}function X($,B,V,ie){var De=B!==null?B.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return De!==null?null:N($,B,""+V,ie);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case M:return V.key===De?R($,B,V,ie):null;case C:return V.key===De?K($,B,V,ie):null;case ee:return V=qi(V),X($,B,V,ie)}if(ce(V)||G(V))return De!==null?null:ae($,B,V,ie,null);if(typeof V.then=="function")return X($,B,oc(V),ie);if(V.$$typeof===_)return X($,B,lc($,V),ie);cc($,V)}return null}function W($,B,V,ie,De){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return $=$.get(V)||null,N(B,$,""+ie,De);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case M:return $=$.get(ie.key===null?V:ie.key)||null,R(B,$,ie,De);case C:return $=$.get(ie.key===null?V:ie.key)||null,K(B,$,ie,De);case ee:return ie=qi(ie),W($,B,V,ie,De)}if(ce(ie)||G(ie))return $=$.get(V)||null,ae(B,$,ie,De,null);if(typeof ie.then=="function")return W($,B,V,oc(ie),De);if(ie.$$typeof===_)return W($,B,V,lc(B,ie),De);cc(B,ie)}return null}function Ne($,B,V,ie){for(var De=null,lt=null,Ae=B,Ye=B=0,et=null;Ae!==null&&Ye<V.length;Ye++){Ae.index>Ye?(et=Ae,Ae=null):et=Ae.sibling;var it=X($,Ae,V[Ye],ie);if(it===null){Ae===null&&(Ae=et);break}e&&Ae&&it.alternate===null&&t($,Ae),B=f(it,B,Ye),lt===null?De=it:lt.sibling=it,lt=it,Ae=et}if(Ye===V.length)return n($,Ae),O&&Ha($,Ye),De;if(Ae===null){for(;Ye<V.length;Ye++)Ae=se($,V[Ye],ie),Ae!==null&&(B=f(Ae,B,Ye),lt===null?De=Ae:lt.sibling=Ae,lt=Ae);return O&&Ha($,Ye),De}for(Ae=i(Ae);Ye<V.length;Ye++)et=W(Ae,$,Ye,V[Ye],ie),et!==null&&(e&&et.alternate!==null&&Ae.delete(et.key===null?Ye:et.key),B=f(et,B,Ye),lt===null?De=et:lt.sibling=et,lt=et);return e&&Ae.forEach(function(Si){return t($,Si)}),O&&Ha($,Ye),De}function Fe($,B,V,ie){if(V==null)throw Error(r(151));for(var De=null,lt=null,Ae=B,Ye=B=0,et=null,it=V.next();Ae!==null&&!it.done;Ye++,it=V.next()){Ae.index>Ye?(et=Ae,Ae=null):et=Ae.sibling;var Si=X($,Ae,it.value,ie);if(Si===null){Ae===null&&(Ae=et);break}e&&Ae&&Si.alternate===null&&t($,Ae),B=f(Si,B,Ye),lt===null?De=Si:lt.sibling=Si,lt=Si,Ae=et}if(it.done)return n($,Ae),O&&Ha($,Ye),De;if(Ae===null){for(;!it.done;Ye++,it=V.next())it=se($,it.value,ie),it!==null&&(B=f(it,B,Ye),lt===null?De=it:lt.sibling=it,lt=it);return O&&Ha($,Ye),De}for(Ae=i(Ae);!it.done;Ye++,it=V.next())it=W(Ae,$,Ye,it.value,ie),it!==null&&(e&&it.alternate!==null&&Ae.delete(it.key===null?Ye:it.key),B=f(it,B,Ye),lt===null?De=it:lt.sibling=it,lt=it);return e&&Ae.forEach(function(Tb){return t($,Tb)}),O&&Ha($,Ye),De}function xt($,B,V,ie){if(typeof V=="object"&&V!==null&&V.type===j&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case M:e:{for(var De=V.key;B!==null;){if(B.key===De){if(De=V.type,De===j){if(B.tag===7){n($,B.sibling),ie=u(B,V.props.children),ie.return=$,$=ie;break e}}else if(B.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===ee&&qi(De)===B.type){n($,B.sibling),ie=u(B,V.props),Hr(ie,V),ie.return=$,$=ie;break e}n($,B);break}else t($,B);B=B.sibling}V.type===j?(ie=Sl(V.props.children,$.mode,ie,V.key),ie.return=$,$=ie):(ie=Er(V.type,V.key,V.props,null,$.mode,ie),Hr(ie,V),ie.return=$,$=ie)}return y($);case C:e:{for(De=V.key;B!==null;){if(B.key===De)if(B.tag===4&&B.stateNode.containerInfo===V.containerInfo&&B.stateNode.implementation===V.implementation){n($,B.sibling),ie=u(B,V.children||[]),ie.return=$,$=ie;break e}else{n($,B);break}else t($,B);B=B.sibling}ie=ti(V,$.mode,ie),ie.return=$,$=ie}return y($);case ee:return V=qi(V),xt($,B,V,ie)}if(ce(V))return Ne($,B,V,ie);if(G(V)){if(De=G(V),typeof De!="function")throw Error(r(150));return V=De.call(V),Fe($,B,V,ie)}if(typeof V.then=="function")return xt($,B,oc(V),ie);if(V.$$typeof===_)return xt($,B,lc($,V),ie);cc($,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,B!==null&&B.tag===6?(n($,B.sibling),ie=u(B,V),ie.return=$,$=ie):(n($,B),ie=Dr(V,$.mode,ie),ie.return=$,$=ie),y($)):n($,B)}return function($,B,V,ie){try{Br=0;var De=xt($,B,V,ie);return Rs=null,De}catch(Ae){if(Ae===Ds||Ae===sc)throw Ae;var lt=ct(29,Ae,null,$.mode);return lt.lanes=ie,lt.return=$,lt}}}var Pi=Wm(!0),Jm=Wm(!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,(st&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),kr(e,null,n),t}return Wl(e,i,t,n),wl(e)}function Fr(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,Rn(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 Ir(){if(ld){var e=Es;if(e!==null)throw e}}function Ur(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 R=N,K=R.next;R.next=null,y===null?f=K:y.next=K,y=R;var ae=e.alternate;ae!==null&&(ae=ae.updateQueue,N=ae.lastBaseUpdate,N!==y&&(N===null?ae.firstBaseUpdate=K:N.next=K,ae.lastBaseUpdate=R))}if(f!==null){var se=u.baseState;y=0,ae=K=R=null,N=f;do{var X=N.lane&-536870913,W=X!==N.lane;if(W?(Je&X)===X:(i&X)===X){X!==0&&X===ks&&(ld=!0),ae!==null&&(ae=ae.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Ne=e,Fe=N;X=t;var xt=n;switch(Fe.tag){case 1:if(Ne=Fe.payload,typeof Ne=="function"){se=Ne.call(xt,se,X);break e}se=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Fe.payload,X=typeof Ne=="function"?Ne.call(xt,se,X):Ne,X==null)break e;se=v({},se,X);break e;case 2:ii=!0}}X=N.callback,X!==null&&(e.flags|=64,W&&(e.flags|=8192),W=u.callbacks,W===null?u.callbacks=[X]:W.push(X))}else W={lane:X,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ae===null?(K=ae=W,R=se):ae=ae.next=W,y|=X;if(N=N.next,N===null){if(N=u.shared.pending,N===null)break;W=N,N=W.next,W.next=null,u.lastBaseUpdate=W,u.shared.pending=null}}while(!0);ae===null&&(R=se),u.baseState=R,u.firstBaseUpdate=K,u.lastBaseUpdate=ae,f===null&&(u.shared.lanes=0),fi|=y,e.lanes=y,e.memoizedState=se}}function eh(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function th(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)eh(n[e],t)}var Ls=fe(null),uc=fe(0);function nh(e,t){e=_l,xe(uc,e),xe(Ls,t),_l=e|t.baseLanes}function id(){xe(uc,_l),xe(Ls,Ls.current)}function sd(){_l=uc.current,L(Ls),L(uc)}var na=fe(null),Sa=null;function oi(e){var t=e.alternate;xe(zt,zt.current&1),xe(na,e),Sa===null&&(t===null||Ls.current!==null||t.memoizedState!==null)&&(Sa=e)}function rd(e){xe(zt,zt.current),xe(na,e),Sa===null&&(Sa=e)}function ah(e){e.tag===22?(xe(zt,zt.current),xe(na,e),Sa===null&&(Sa=e)):ci()}function ci(){xe(zt,zt.current),xe(na,na.current)}function aa(e){L(na),Sa===e&&(Sa=null),L(zt)}var zt=fe(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,$e=null,pt=null,Ut=null,fc=!1,_s=!1,Yi=!1,mc=0,$r=0,zs=null,vy=0;function Et(){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(!Cn(e[n],t[n]))return!1;return!0}function cd(e,t,n,i,u,f){return Nl=f,$e=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,H.H=e===null||e.memoizedState===null?Ih:Cd,Yi=!1,f=n(i,u),Yi=!1,_s&&(f=ih(t,n,i,u)),lh(e),f}function lh(e){H.H=Pr;var t=pt!==null&&pt.next!==null;if(Nl=0,Ut=pt=$e=null,fc=!1,$r=0,zs=null,t)throw Error(r(300));e===null||$t||(e=e.dependencies,e!==null&&ac(e)&&($t=!0))}function ih(e,t,n,i){$e=e;var u=0;do{if(_s&&(zs=null),$r=0,_s=!1,25<=u)throw Error(r(301));if(u+=1,Ut=pt=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=Uh,f=t(n,i)}while(_s);return f}function yy(){var e=H.H,t=e.useState()[0];return t=typeof t.then=="function"?qr(t):t,e=e.useState()[0],(pt!==null?pt.memoizedState:null)!==e&&($e.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,Ut=pt=$e=null,_s=!1,$r=mc=0,zs=null}function An(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ut===null?$e.memoizedState=Ut=e:Ut=Ut.next=e,Ut}function Ot(){if(pt===null){var e=$e.alternate;e=e!==null?e.memoizedState:null}else e=pt.next;var t=Ut===null?$e.memoizedState:Ut.next;if(t!==null)Ut=t,pt=e;else{if(e===null)throw $e.alternate===null?Error(r(467)):Error(r(310));pt=e,e={memoizedState:pt.memoizedState,baseState:pt.baseState,baseQueue:pt.baseQueue,queue:pt.queue,next:null},Ut===null?$e.memoizedState=Ut=e:Ut=Ut.next=e}return Ut}function hc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function qr(e){var t=$r;return $r+=1,zs===null&&(zs=[]),e=Qm(zs,e,t),t=$e,(Ut===null?t.memoizedState:Ut.next)===null&&(t=t.alternate,H.H=t===null||t.memoizedState===null?Ih:Cd),e}function pc(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return qr(e);if(e.$$typeof===_)return rn(e)}throw Error(r(438,String(e)))}function md(e){var t=null,n=$e.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var i=$e.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(),$e.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]=Y;return t.index++,n}function Al(e,t){return typeof t=="function"?t(e):t}function gc(e){var t=Ot();return hd(t,pt,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,R=null,K=t,ae=!1;do{var se=K.lane&-536870913;if(se!==K.lane?(Je&se)===se:(Nl&se)===se){var X=K.revertLane;if(X===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),se===ks&&(ae=!0);else if((Nl&X)===X){K=K.next,X===ks&&(ae=!0);continue}else se={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},R===null?(N=R=se,y=f):R=R.next=se,$e.lanes|=X,fi|=X;se=K.action,Yi&&n(f,se),f=K.hasEagerState?K.eagerState:n(f,se)}else X={lane:se,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},R===null?(N=R=X,y=f):R=R.next=X,$e.lanes|=se,fi|=se;K=K.next}while(K!==null&&K!==t);if(R===null?y=f:R.next=N,!Cn(f,e.memoizedState)&&($t=!0,ae&&(n=Es,n!==null)))throw n;e.memoizedState=f,e.baseState=y,e.baseQueue=R,i.lastRenderedState=f}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function pd(e){var t=Ot(),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);Cn(f,t.memoizedState)||($t=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),n.lastRenderedState=f}return[f,i]}function sh(e,t,n){var i=$e,u=Ot(),f=O;if(f){if(n===void 0)throw Error(r(407));n=n()}else n=t();var y=!Cn((pt||u).memoizedState,n);if(y&&(u.memoizedState=n,$t=!0),u=u.queue,vd(ch.bind(null,i,u,e),[e]),u.getSnapshot!==t||y||Ut!==null&&Ut.memoizedState.tag&1){if(i.flags|=2048,Os(9,{destroy:void 0},oh.bind(null,i,u,n,t),null),yt===null)throw Error(r(349));f||(Nl&127)!==0||rh(i,t,n)}return n}function rh(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=$e.updateQueue,t===null?(t=hc(),$e.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function oh(e,t,n,i){t.value=n,t.getSnapshot=i,uh(t)&&dh(e)}function ch(e,t,n){return n(function(){uh(t)&&dh(e)})}function uh(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Cn(e,n)}catch{return!0}}function dh(e){var t=bl(e,2);t!==null&&Gn(t,e,2)}function gd(e){var t=An();if(typeof e=="function"){var n=e;if(e=n(),Yi){Zt(!0);try{n()}finally{Zt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Al,lastRenderedState:e},t}function fh(e,t,n,i){return e.baseState=n,hd(e,pt,typeof i=="function"?i:Al)}function by(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,mh(t,f)):(f.next=n.next,t.pending=n.next=f)}}function mh(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),R=H.S;R!==null&&R(y,N),hh(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),hh(e,t,f)}catch(K){xd(e,t,K)}}function hh(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){ph(e,t,i)},function(i){return xd(e,t,i)}):ph(e,t,n)}function ph(e,t,n){t.status="fulfilled",t.value=n,gh(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,mh(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,gh(t),t=t.next;while(t!==i)}e.action=null}function gh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function xh(e,t){return t}function vh(e,t){if(O){var n=yt.formState;if(n!==null){e:{var i=$e;if(O){if(I){t:{for(var u=I,f=ue;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){I=Ma(u.nextSibling),i=u.data==="F!";break e}}je(i)}i=!1}i&&(t=n[0])}}return n=An(),n.memoizedState=n.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xh,lastRenderedState:t},n.queue=i,n=Bh.bind(null,$e,i),i.dispatch=n,i=gd(!1),f=Md.bind(null,$e,!1,i.queue),i=An(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,n=by.bind(null,$e,u,f,n),u.dispatch=n,i.memoizedState=e,[t,n,!1]}function yh(e){var t=Ot();return bh(t,pt,e)}function bh(e,t,n){if(t=hd(e,t,xh)[0],e=gc(Al)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=qr(t)}catch(y){throw y===Ds?sc:y}else i=t;t=Ot();var u=t.queue,f=u.dispatch;return n!==t.memoizedState&&($e.flags|=2048,Os(9,{destroy:void 0},wy.bind(null,u,n),null)),[i,f,e]}function wy(e,t){e.action=t}function wh(e){var t=Ot(),n=pt;if(n!==null)return bh(t,n,e);Ot(),t=t.memoizedState,n=Ot();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=$e.updateQueue,t===null&&(t=hc(),$e.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 Sh(){return Ot().memoizedState}function xc(e,t,n,i){var u=An();$e.flags|=e,u.memoizedState=Os(1|t,{destroy:void 0},n,i===void 0?null:i)}function vc(e,t,n,i){var u=Ot();i=i===void 0?null:i;var f=u.memoizedState.inst;pt!==null&&i!==null&&od(i,pt.memoizedState.deps)?u.memoizedState=Os(t,f,n,i):($e.flags|=e,u.memoizedState=Os(1|t,f,n,i))}function Mh(e,t){xc(8390656,8,e,t)}function vd(e,t){vc(2048,8,e,t)}function Sy(e){$e.flags|=4;var t=$e.updateQueue;if(t===null)t=hc(),$e.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ch(e){var t=Ot().memoizedState;return Sy({ref:t,nextImpl:e}),function(){if((st&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function jh(e,t){return vc(4,2,e,t)}function Nh(e,t){return vc(4,4,e,t)}function Ah(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 Th(e,t,n){n=n!=null?n.concat([e]):null,vc(4,4,Ah.bind(null,t,e),n)}function yd(){}function kh(e,t){var n=Ot();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 Eh(e,t){var n=Ot();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&od(t,i[1]))return i[0];if(i=e(),Yi){Zt(!0);try{e()}finally{Zt(!1)}}return n.memoizedState=[i,t],i}function bd(e,t,n){return n===void 0||(Nl&1073741824)!==0&&(Je&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Dp(),$e.lanes|=e,fi|=e,n)}function Dh(e,t,n,i){return Cn(n,t)?n:Ls.current!==null?(e=bd(e,n,i),Cn(e,t)||($t=!0),e):(Nl&42)===0||(Nl&1073741824)!==0&&(Je&261930)===0?($t=!0,e.memoizedState=n):(e=Dp(),$e.lanes|=e,fi|=e,t)}function Rh(e,t,n,i,u){var f=Q.p;Q.p=f!==0&&8>f?f:8;var y=H.T,N={};H.T=N,Md(e,!1,t,n);try{var R=u(),K=H.S;if(K!==null&&K(N,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var ae=xy(R,i);Gr(e,t,ae,sa(e))}else Gr(e,t,i,sa(e))}catch(se){Gr(e,t,{then:function(){},status:"rejected",reason:se},sa())}finally{Q.p=f,y!==null&&N.types!==null&&(y.types=N.types),H.T=y}}function My(){}function wd(e,t,n,i){if(e.tag!==5)throw Error(r(476));var u=Lh(e).queue;Rh(e,u,t,J,n===null?My:function(){return _h(e),n(i)})}function Lh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Al,lastRenderedState:J},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 _h(e){var t=Lh(e);t.next===null&&(t=e.alternate.memoizedState),Gr(e,t.next.queue,{},sa())}function Sd(){return rn(ro)}function zh(){return Ot().memoizedState}function Oh(){return Ot().memoizedState}function Cy(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&&(Gn(i,t,n),Fr(i,t,n)),t={cache:Zu()},e.payload=t;return}t=t.return}}function jy(e,t,n){var i=sa();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},yc(e)?Hh(t,n):(n=Tr(e,t,n,i),n!==null&&(Gn(n,e,i),Fh(n,t,i)))}function Bh(e,t,n){var i=sa();Gr(e,t,n,i)}function Gr(e,t,n,i){var u={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(yc(e))Hh(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,Cn(N,y))return Wl(e,t,u,0),yt===null&&Fi(),!1}catch{}if(n=Tr(e,t,u,i),n!==null)return Gn(n,e,i),Fh(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=Tr(e,n,i,2),t!==null&&Gn(t,e,2)}function yc(e){var t=e.alternate;return e===$e||t!==null&&t===$e}function Hh(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 Fh(e,t,n){if((n&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,Rn(e,n)}}var Pr={readContext:rn,use:pc,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useLayoutEffect:Et,useInsertionEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useSyncExternalStore:Et,useId:Et,useHostTransitionStatus:Et,useFormState:Et,useActionState:Et,useOptimistic:Et,useMemoCache:Et,useCacheRefresh:Et};Pr.useEffectEvent=Et;var Ih={readContext:rn,use:pc,useCallback:function(e,t){return An().memoizedState=[e,t===void 0?null:t],e},useContext:rn,useEffect:Mh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,xc(4194308,4,Ah.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=An();t=t===void 0?null:t;var i=e();if(Yi){Zt(!0);try{e()}finally{Zt(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=An();if(n!==void 0){var u=n(t);if(Yi){Zt(!0);try{n(t)}finally{Zt(!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=jy.bind(null,$e,e),[i.memoizedState,e]},useRef:function(e){var t=An();return e={current:e},t.memoizedState=e},useState:function(e){e=gd(e);var t=e.queue,n=Bh.bind(null,$e,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:yd,useDeferredValue:function(e,t){var n=An();return bd(n,e,t)},useTransition:function(){var e=gd(!1);return e=Rh.bind(null,$e,e.queue,!0,!1),An().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=$e,u=An();if(O){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),yt===null)throw Error(r(349));(Je&127)!==0||rh(i,t,n)}u.memoizedState=n;var f={value:n,getSnapshot:t};return u.queue=f,Mh(ch.bind(null,i,f,e),[e]),i.flags|=2048,Os(9,{destroy:void 0},oh.bind(null,i,f,n,t),null),n},useId:function(){var e=An(),t=yt.identifierPrefix;if(O){var n=ba,i=At;n=(i&~(1<<32-Rt(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=mc++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=vy++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Sd,useFormState:vh,useActionState:vh,useOptimistic:function(e){var t=An();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,$e,!0,n),n.dispatch=t,[e,t]},useMemoCache:md,useCacheRefresh:function(){return An().memoizedState=Cy.bind(null,$e)},useEffectEvent:function(e){var t=An(),n={impl:e};return t.memoizedState=n,function(){if((st&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},Cd={readContext:rn,use:pc,useCallback:kh,useContext:rn,useEffect:vd,useImperativeHandle:Th,useInsertionEffect:jh,useLayoutEffect:Nh,useMemo:Eh,useReducer:gc,useRef:Sh,useState:function(){return gc(Al)},useDebugValue:yd,useDeferredValue:function(e,t){var n=Ot();return Dh(n,pt.memoizedState,e,t)},useTransition:function(){var e=gc(Al)[0],t=Ot().memoizedState;return[typeof e=="boolean"?e:qr(e),t]},useSyncExternalStore:sh,useId:zh,useHostTransitionStatus:Sd,useFormState:yh,useActionState:yh,useOptimistic:function(e,t){var n=Ot();return fh(n,pt,e,t)},useMemoCache:md,useCacheRefresh:Oh};Cd.useEffectEvent=Ch;var Uh={readContext:rn,use:pc,useCallback:kh,useContext:rn,useEffect:vd,useImperativeHandle:Th,useInsertionEffect:jh,useLayoutEffect:Nh,useMemo:Eh,useReducer:pd,useRef:Sh,useState:function(){return pd(Al)},useDebugValue:yd,useDeferredValue:function(e,t){var n=Ot();return pt===null?bd(n,e,t):Dh(n,pt.memoizedState,e,t)},useTransition:function(){var e=pd(Al)[0],t=Ot().memoizedState;return[typeof e=="boolean"?e:qr(e),t]},useSyncExternalStore:sh,useId:zh,useHostTransitionStatus:Sd,useFormState:wh,useActionState:wh,useOptimistic:function(e,t){var n=Ot();return pt!==null?fh(n,pt,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:md,useCacheRefresh:Oh};Uh.useEffectEvent=Ch;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&&(Gn(t,e,i),Fr(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&&(Gn(t,e,i),Fr(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&&(Gn(t,e,n),Fr(t,e,n))}};function $h(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?!Ka(n,i)||!Ka(u,f):!0}function qh(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 Vi(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 Gh(e){Ns(e)}function Ph(e){console.error(e)}function Yh(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 Vh(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 Kh(e){return e=si(e),e.tag=3,e}function Qh(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(){Vh(t,n,i)}}var y=n.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){Vh(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 Ny(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&&Dt===0&&(Dt=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!==ge&&(e=Error(r(422),{cause:i}),Nn(jn(e,n)))):(i!==ge&&(t=Error(r(423),{cause:i}),Nn(jn(t,n))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=jn(i,n),u=Ad(e.stateNode,i,u),ad(e,u),Dt!==4&&(Dt=2)),!1;var f=Error(r(520),{cause:i});if(f=jn(f,n),Jr===null?Jr=[f]:Jr.push(f),Dt!==4&&(Dt=2),t===null)return!0;i=jn(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=Kh(u),Qh(u,e,n,i),ad(n,u),!1}n=n.return}while(n!==null);return!1}var Td=Error(r(461)),$t=!1;function on(e,t,n,i){t.child=e===null?Jm(t,null,n,i):Pi(t,e.child,n,i)}function Xh(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&&!$t?(dd(e,t,u),Tl(e,t,u)):(O&&N&&Lr(t),t.flags|=1,on(e,t,i,u),t.child)}function Zh(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,Wh(e,t,f,i,u)):(e=Er(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:Ka,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 Wh(e,t,n,i,u){if(e!==null){var f=e.memoizedProps;if(Ka(f,i)&&e.ref===t.ref)if($t=!1,t.pendingProps=i=f,Od(e,u))(e.flags&131072)!==0&&($t=!0);else return t.lanes=e.lanes,Tl(e,t,u)}return kd(e,t,n,i,u)}function Jh(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 ep(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?nh(t,f):id(),ah(t);else return i=t.lanes=536870912,ep(e,t,f!==null?f.baseLanes|n:n,n,i)}else f!==null?(ic(t,f.cachePool),nh(t,f),ci(),t.memoizedState=null):(e!==null&&ic(t,null),id(),ci());return on(e,t,u,n),t.child}function Yr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ep(e,t,n,i,u){var f=Ju();return f=f===null?null:{parent:It._currentValue,pool:f},t.memoizedState={baseLanes:n,cachePool:f},e!==null&&ic(t,null),id(),ah(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 tp(e,t,n){return Pi(t,e.child,null,n),e=wc(t,t.pendingProps),e.flags|=2,aa(t),t.memoizedState=null,e}function Ay(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,Yr(null,e);if(rd(t),(e=I)?(e=mg(e,ue),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Xa!==null?{id:At,overflow:ba}:null,retryLane:536870912,hydrationErrors:null},n=Rr(e),n.return=t,t.child=n,E=t,I=null)):e=null,e===null)throw je(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=tp(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if($t||Ts(e,t,n,!1),u=(n&e.childLanes)!==0,$t||u){if(i=yt,i!==null&&(y=Ra(i,n),y!==0&&y!==f.retryLane))throw f.retryLane=y,bl(e,y),Gn(i,e,y),Td;Rc(),t=tp(e,t,n)}else e=f.treeContext,I=Ma(y.nextSibling),E=t,O=!0,U=null,ue=!1,e!==null&&S(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&&!$t?(dd(e,t,u),Tl(e,t,u)):(O&&i&&Lr(t),t.flags|=1,on(e,t,n,u),t.child)}function np(e,t,n,i,u,f){return Ui(t),t.updateQueue=null,n=ih(t,i,n,u),lh(e),i=ud(),e!==null&&!$t?(dd(e,t,f),Tl(e,t,f)):(O&&i&&Lr(t),t.flags|=1,on(e,t,n,f),t.child)}function ap(e,t,n,i,u){if(Ui(t),t.stateNode===null){var f=Jl,y=n.contextType;typeof y=="object"&&y!==null&&(f=rn(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?rn(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),Ur(t,i,f,u),Ir(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){f=t.stateNode;var N=t.memoizedProps,R=Vi(n,N);f.props=R;var K=f.context,ae=n.contextType;y=Jl,typeof ae=="object"&&ae!==null&&(y=rn(ae));var se=n.getDerivedStateFromProps;ae=typeof se=="function"||typeof f.getSnapshotBeforeUpdate=="function",N=t.pendingProps!==N,ae||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(N||K!==y)&&qh(t,f,i,y),ii=!1;var X=t.memoizedState;f.state=X,Ur(t,i,f,u),Ir(),K=t.memoizedState,N||X!==K||ii?(typeof se=="function"&&(jd(t,n,se,i),K=t.memoizedState),(R=ii||$h(t,n,R,i,X,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=R):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{f=t.stateNode,nd(e,t),y=t.memoizedProps,ae=Vi(n,y),f.props=ae,se=t.pendingProps,X=f.context,K=n.contextType,R=Jl,typeof K=="object"&&K!==null&&(R=rn(K)),N=n.getDerivedStateFromProps,(K=typeof N=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y!==se||X!==R)&&qh(t,f,i,R),ii=!1,X=t.memoizedState,f.state=X,Ur(t,i,f,u),Ir();var W=t.memoizedState;y!==se||X!==W||ii||e!==null&&e.dependencies!==null&&ac(e.dependencies)?(typeof N=="function"&&(jd(t,n,N,i),W=t.memoizedState),(ae=ii||$h(t,n,ae,i,X,W,R)||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,W,R),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(i,W,R)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&X===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&X===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=W),f.props=i,f.state=W,f.context=R,i=ae):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&X===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&X===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=Pi(t,e.child,null,u),t.child=Pi(t,null,n,u)):on(e,t,n,u),t.memoizedState=f.state,e=t.child):e=Tl(e,t,u),e}function lp(e,t,n,i){return kt(),t.flags|=256,on(e,t,n,i),t.child}var Ed={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Dd(e){return{baseLanes:e,cachePool:Vm()}}function Rd(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=ia),e}function ip(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:(zt.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=I)?(e=mg(e,ue),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Xa!==null?{id:At,overflow:ba}:null,retryLane:536870912,hydrationErrors:null},n=Rr(e),n.return=t,t.child=n,E=t,I=null)):e=null,e===null)throw je(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,Yr(null,i)):(oi(t),Ld(t,N))}var R=e.memoizedState;if(R!==null&&(N=R.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,Pi(t,e.child,null,n),i=t.child,i.memoizedState=Dd(n),i.childLanes=Rd(e,y,n),t.memoizedState=Ed,t=Yr(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,Nn({value:i,source:null,stack:null}),t=_d(e,t,n)}else if($t||Ts(e,t,n,!1),y=(n&e.childLanes)!==0,$t||y){if(y=yt,y!==null&&(i=Ra(y,n),i!==0&&i!==R.retryLane))throw R.retryLane=i,bl(e,i),Gn(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=R.treeContext,I=Ma(N.nextSibling),E=t,O=!0,U=null,ue=!1,e!==null&&S(t,e),t=Ld(t,i.children),t.flags|=4096);return t}return u?(ci(),N=i.fallback,u=t.mode,R=e.child,K=R.sibling,i=ya(R,{mode:"hidden",children:i.children}),i.subtreeFlags=R.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,Yr(null,i),i=t.child,N=e.child.memoizedState,N===null?N=Dd(n):(u=N.cachePool,u!==null?(R=It._currentValue,u=u.parent!==R?{parent:R,pool:R}:u):u=Vm(),N={baseLanes:N.baseLanes|n,cachePool:u}),i.memoizedState=N,i.childLanes=Rd(e,y,n),t.memoizedState=Ed,Yr(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=ct(22,e,null,t),e.lanes=0,e}function _d(e,t,n){return Pi(t,e.child,null,n),e=Ld(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function sp(e,t,n){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Qu(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 rp(e,t,n){var i=t.pendingProps,u=i.revealOrder,f=i.tail;i=i.children;var y=zt.current,N=(y&2)!==0;if(N?(y=y&1|2,t.flags|=128):y&=1,xe(zt,y),on(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&&sp(e,n,t);else if(e.tag===19)sp(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 Ty(e,t,n){switch(t.tag){case 3:Oe(t,t.stateNode.containerInfo),Za(t,It,e.memoizedState.cache),kt();break;case 27:case 5:Ge(t);break;case 4:Oe(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?ip(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 rp(e,t,n);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),xe(zt,zt.current),i)break;return null;case 22:return t.lanes=0,Jh(e,t,n,t.pendingProps);case 24:Za(t,It,e.memoizedState.cache)}return Tl(e,t,n)}function op(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)$t=!0;else{if(!Od(e,n)&&(t.flags&128)===0)return $t=!1,Ty(e,t,n);$t=(e.flags&131072)!==0}else $t=!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=qi(t.elementType),t.type=e,typeof e=="function")ei(e)?(i=Vi(e,i),t.tag=1,t=ap(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===q){t.tag=11,t=Xh(null,t,e,i,n);break e}else if(u===D){t.tag=14,t=Zh(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=Vi(i,t.pendingProps),ap(e,t,i,u,n);case 3:e:{if(Oe(t,t.stateNode.containerInfo),e===null)throw Error(r(387));i=t.pendingProps;var f=t.memoizedState;u=f.element,nd(e,t),Ur(t,i,null,n);var y=t.memoizedState;if(i=y.cache,Za(t,It,i),i!==f.cache&&Xu(t,[It],n,!0),Ir(),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=lp(e,t,i,n);break e}else if(i!==u){u=jn(Error(r(424)),t),Nn(u),t=lp(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,I=Ma(e.firstChild),E=t,O=!0,U=null,ue=!0,n=Jm(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(kt(),i===u){t=Tl(e,t,n);break e}on(e,t,i,n)}t=t.child}return t;case 26:return Sc(e,t),e===null?(n=yg(t.type,null,t.pendingProps,null))?t.memoizedState=n:O||(n=t.type,e=t.pendingProps,i=Fc(ze.current).createElement(n),i[P]=t,i[me]=e,cn(i,n,e),wt(i),t.stateNode=i):t.memoizedState=yg(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ge(t),e===null&&O&&(i=t.stateNode=gg(t.type,t.pendingProps,ze.current),E=t,ue=!0,u=I,xi(t.type)?(gf=u,I=Ma(i.firstChild)):I=u),on(e,t,t.pendingProps.children,n),Sc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&O&&((u=i=I)&&(i=lb(i,t.type,t.pendingProps,ue),i!==null?(t.stateNode=i,E=t,I=Ma(i.firstChild),ue=!1,u=!0):u=!1),u||je(t)),Ge(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,yy,null,null,n),ro._currentValue=u),Sc(e,t),on(e,t,i,n),t.child;case 6:return e===null&&O&&((e=n=I)&&(n=ib(n,t.pendingProps,ue),n!==null?(t.stateNode=n,E=t,I=null,e=!0):e=!1),e||je(t)),null;case 13:return ip(e,t,n);case 4:return Oe(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Pi(t,null,i,n):on(e,t,i,n),t.child;case 11:return Xh(e,t,t.type,t.pendingProps,n);case 7:return on(e,t,t.pendingProps,n),t.child;case 8:return on(e,t,t.pendingProps.children,n),t.child;case 12:return on(e,t,t.pendingProps.children,n),t.child;case 10:return i=t.pendingProps,Za(t,t.type,i.value),on(e,t,i.children,n),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,Ui(t),u=rn(u),i=i(u),t.flags|=1,on(e,t,i,n),t.child;case 14:return Zh(e,t,t.type,t.pendingProps,n);case 15:return Wh(e,t,t.type,t.pendingProps,n);case 19:return rp(e,t,n);case 31:return Ay(e,t,n);case 22:return Jh(e,t,n,t.pendingProps);case 24:return Ui(t),i=rn(It),e===null?(u=Ju(),u===null&&(u=yt,f=Zu(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=n),u=f),t.memoizedState={parent:i,cache:u},td(t),Za(t,It,u)):((e.lanes&n)!==0&&(nd(e,t),Ur(t,null,null,n),Ir()),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,It,i)):(i=f.cache,Za(t,It,i),i!==u.cache&&Xu(t,[It],n,!0))),on(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(zp())e.flags|=8192;else throw Gi=rc,ed}else e.flags&=-16777217}function cp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Cg(t))if(zp())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 Vr(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 Mt(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 ky(e,t,n){var i=t.pendingProps;switch(_r(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(t),null;case 1:return Mt(t),null;case 3:return n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),jl(It),_e(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ht(t)?kl(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,wa())),Mt(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(kl(t),f!==null?(Mt(t),cp(t,f)):(Mt(t),Bd(t,u,null,i,n))):f?f!==e.memoizedState?(kl(t),Mt(t),cp(t,f)):(Mt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&kl(t),Mt(t),Bd(t,u,e,i,n)),null;case 27:if(Te(t),n=ze.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 Mt(t),null}e=we.current,ht(t)?at(t):(e=gg(u,i,n),t.stateNode=e,kl(t))}return Mt(t),null;case 5:if(Te(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 Mt(t),null}if(f=we.current,ht(t))at(t);else{var y=Fc(ze.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[P]=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(cn(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 Mt(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=ze.current,ht(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,u=E,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[P]=t,e=!!(e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||ig(e.nodeValue,n)),e||je(t,!0)}else e=Fc(e).createTextNode(i),e[P]=t,t.stateNode=e}return Mt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=ht(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[P]=t}else kt(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Mt(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 Mt(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=ht(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[P]=t}else kt(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Mt(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),Mt(t),null);case 4:return _e(),e===null&&sf(t.stateNode.containerInfo),Mt(t),null;case 10:return jl(t.type),Mt(t),null;case 19:if(L(zt),i=t.memoizedState,i===null)return Mt(t),null;if(u=(t.flags&128)!==0,f=i.rendering,f===null)if(u)Vr(i,!1);else{if(Dt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=dc(e),f!==null){for(t.flags|=128,Vr(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 xe(zt,zt.current&1|2),O&&Ha(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&He()>kc&&(t.flags|=128,u=!0,Vr(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),Vr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!f.alternate&&!O)return Mt(t),null}else 2*He()-i.renderingStartTime>kc&&n!==536870912&&(t.flags|=128,u=!0,Vr(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=He(),e.sibling=null,n=zt.current,xe(zt,u?n&1|2:n&1),O&&Ha(t,i.treeForkCount),e):(Mt(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&&(Mt(t),t.subtreeFlags&6&&(t.flags|=8192)):Mt(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($i),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),jl(It),Mt(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Ey(e,t){switch(_r(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return jl(It),_e(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Te(t),null;case 31:if(t.memoizedState!==null){if(aa(t),t.alternate===null)throw Error(r(340));kt()}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));kt()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return L(zt),null;case 4:return _e(),null;case 10:return jl(t.type),null;case 22:case 23:return aa(t),sd(),e!==null&&L($i),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return jl(It),null;case 25:return null;default:return null}}function up(e,t){switch(_r(t),t.tag){case 3:jl(It),_e();break;case 26:case 27:case 5:Te(t);break;case 4:_e();break;case 31:t.memoizedState!==null&&aa(t);break;case 13:aa(t);break;case 19:L(zt);break;case 10:jl(t.type);break;case 22:case 23:aa(t),sd(),e!==null&&L($i);break;case 24:jl(It)}}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){dt(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 R=n,K=N;try{K()}catch(ae){dt(u,R,ae)}}}i=i.next}while(i!==f)}}catch(ae){dt(t,t.return,ae)}}function dp(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{th(t,n)}catch(i){dt(e,e.return,i)}}}function fp(e,t,n){n.props=Vi(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){dt(e,t,i)}}function Qr(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){dt(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){dt(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){dt(e,t,u)}else n.current=null}function mp(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){dt(e,e.return,u)}}function Hd(e,t,n){try{var i=e.stateNode;Wy(i,e.type,n,t),i[me]=t}catch(u){dt(e,e.return,u)}}function hp(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||hp(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 pp(e){var t=e.stateNode,n=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);cn(t,i,n),t[P]=e,t[me]=n}catch(f){dt(e,e.return,f)}}var El=!1,qt=!1,Ud=!1,gp=typeof WeakSet=="function"?WeakSet:Set,tn=null;function Dy(e,t){if(e=e.containerInfo,cf=Yc,e=Ko(e),wr(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,R=-1,K=0,ae=0,se=e,X=null;t:for(;;){for(var W;se!==n||u!==0&&se.nodeType!==3||(N=y+u),se!==f||i!==0&&se.nodeType!==3||(R=y+i),se.nodeType===3&&(y+=se.nodeValue.length),(W=se.firstChild)!==null;)X=se,se=W;for(;;){if(se===e)break t;if(X===n&&++K===u&&(N=y),X===f&&++ae===i&&(R=y),(W=se.nextSibling)!==null)break;se=X,X=se.parentNode}se=W}n=N===-1||R===-1?null:{start:N,end:R}}else n=null}n=n||{start:0,end:0}}else n=null;for(uf={focusedElem:e,selectionRange:n},Yc=!1,tn=t;tn!==null;)if(t=tn,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,tn=e;else for(;tn!==null;){switch(t=tn,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 Ne=Vi(n.type,u);e=i.getSnapshotBeforeUpdate(Ne,f),i.__reactInternalSnapshotBeforeUpdate=e}catch(Fe){dt(n,n.return,Fe)}}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,tn=e;break}tn=t.return}}function xp(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){dt(n,n.return,y)}else{var u=Vi(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){dt(n,n.return,y)}}i&64&&dp(n),i&512&&Qr(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{th(e,t)}catch(y){dt(n,n.return,y)}}break;case 27:t===null&&i&4&&pp(n);case 26:case 5:Rl(e,n),t===null&&i&4&&mp(n),i&512&&Qr(n,n.return);break;case 12:Rl(e,n);break;case 31:Rl(e,n),i&4&&bp(e,n);break;case 13:Rl(e,n),i&4&&wp(e,n),i&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Iy.bind(null,n),sb(e,n))));break;case 22:if(i=n.memoizedState!==null||El,!i){t=t!==null&&t.memoizedState!==null||qt,u=El;var f=qt;El=i,(qt=t)&&!f?Ll(e,n,(n.subtreeFlags&8772)!==0):Rl(e,n),El=u,qt=f}break;case 30:break;default:Rl(e,n)}}function vp(e){var t=e.alternate;t!==null&&(e.alternate=null,vp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&sn(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 Nt=null,In=!1;function Dl(e,t,n){for(n=n.child;n!==null;)yp(e,t,n),n=n.sibling}function yp(e,t,n){if(rt&&typeof rt.onCommitFiberUnmount=="function")try{rt.onCommitFiberUnmount(kn,n)}catch{}switch(n.tag){case 26:qt||Wa(n,t),Dl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:qt||Wa(n,t);var i=Nt,u=In;xi(n.type)&&(Nt=n.stateNode,In=!1),Dl(e,t,n),lo(n.stateNode),Nt=i,In=u;break;case 5:qt||Wa(n,t);case 6:if(i=Nt,u=In,Nt=null,Dl(e,t,n),Nt=i,In=u,Nt!==null)if(In)try{(Nt.nodeType===9?Nt.body:Nt.nodeName==="HTML"?Nt.ownerDocument.body:Nt).removeChild(n.stateNode)}catch(f){dt(n,t,f)}else try{Nt.removeChild(n.stateNode)}catch(f){dt(n,t,f)}break;case 18:Nt!==null&&(In?(e=Nt,dg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Ks(e)):dg(Nt,n.stateNode));break;case 4:i=Nt,u=In,Nt=n.stateNode.containerInfo,In=!0,Dl(e,t,n),Nt=i,In=u;break;case 0:case 11:case 14:case 15:ui(2,n,t),qt||ui(4,n,t),Dl(e,t,n);break;case 1:qt||(Wa(n,t),i=n.stateNode,typeof i.componentWillUnmount=="function"&&fp(n,t,i)),Dl(e,t,n);break;case 21:Dl(e,t,n);break;case 22:qt=(i=qt)||n.memoizedState!==null,Dl(e,t,n),qt=i;break;default:Dl(e,t,n)}}function bp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ks(e)}catch(n){dt(t,t.return,n)}}}function wp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ks(e)}catch(n){dt(t,t.return,n)}}function Ry(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new gp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new gp),t;default:throw Error(r(435,e.tag))}}function Nc(e,t){var n=Ry(e);t.forEach(function(i){if(!n.has(i)){n.add(i);var u=Uy.bind(null,e,i);i.then(u,u)}})}function Un(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)){Nt=N.stateNode,In=!1;break e}break;case 5:Nt=N.stateNode,In=!1;break e;case 3:case 4:Nt=N.stateNode.containerInfo,In=!0;break e}N=N.return}if(Nt===null)throw Error(r(160));yp(f,y,u),Nt=null,In=!1,f=u.alternate,f!==null&&(f.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Sp(t,e),t=t.sibling}var Fa=null;function Sp(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Un(t,e),$n(e),i&4&&(ui(3,e,e.return),Kr(3,e),ui(5,e,e.return));break;case 1:Un(t,e),$n(e),i&512&&(qt||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(Un(t,e),$n(e),i&512&&(qt||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[nt]||f[P]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=u.createElement(i),u.head.insertBefore(f,u.querySelector("head > title"))),cn(f,i,n),f[P]=e,wt(f),i=f;break e;case"link":var y=Sg("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),cn(f,i,n),u.head.appendChild(f);break;case"meta":if(y=Sg("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),cn(f,i,n),u.head.appendChild(f);break;default:throw Error(r(468,i))}f[P]=e,wt(f),i=f}e.stateNode=i}else Mg(u,e.type,e.stateNode);else e.stateNode=wg(u,i,e.memoizedProps);else f!==i?(f===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):f.count--,i===null?Mg(u,e.type,e.stateNode):wg(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&Hd(e,e.memoizedProps,n.memoizedProps)}break;case 27:Un(t,e),$n(e),i&512&&(qt||n===null||Wa(n,n.return)),n!==null&&i&4&&Hd(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Un(t,e),$n(e),i&512&&(qt||n===null||Wa(n,n.return)),e.flags&32){u=e.stateNode;try{ml(u,"")}catch(Ne){dt(e,e.return,Ne)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,Hd(e,u,n!==null?n.memoizedProps:u)),i&1024&&(Ud=!0);break;case 6:if(Un(t,e),$n(e),i&4){if(e.stateNode===null)throw Error(r(162));i=e.memoizedProps,n=e.stateNode;try{n.nodeValue=i}catch(Ne){dt(e,e.return,Ne)}}break;case 3:if($c=null,u=Fa,Fa=Ic(t.containerInfo),Un(t,e),Fa=u,$n(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{Ks(t.containerInfo)}catch(Ne){dt(e,e.return,Ne)}Ud&&(Ud=!1,Mp(e));break;case 4:i=Fa,Fa=Ic(e.stateNode.containerInfo),Un(t,e),$n(e),Fa=i;break;case 12:Un(t,e),$n(e);break;case 31:Un(t,e),$n(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Nc(e,i)));break;case 13:Un(t,e),$n(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Tc=He()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Nc(e,i)));break;case 22:u=e.memoizedState!==null;var R=n!==null&&n.memoizedState!==null,K=El,ae=qt;if(El=K||u,qt=ae||R,Un(t,e),qt=ae,El=K,$n(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(n===null||R||El||qt||Ki(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){R=n=t;try{if(f=R.stateNode,u)y=f.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{N=R.stateNode;var se=R.memoizedProps.style,X=se!=null&&se.hasOwnProperty("display")?se.display:null;N.style.display=X==null||typeof X=="boolean"?"":(""+X).trim()}}catch(Ne){dt(R,R.return,Ne)}}}else if(t.tag===6){if(n===null){R=t;try{R.stateNode.nodeValue=u?"":R.memoizedProps}catch(Ne){dt(R,R.return,Ne)}}}else if(t.tag===18){if(n===null){R=t;try{var W=R.stateNode;u?fg(W,!0):fg(R.stateNode,!1)}catch(Ne){dt(R,R.return,Ne)}}}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:Un(t,e),$n(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Nc(e,i)));break;case 30:break;case 21:break;default:Un(t,e),$n(e)}}function $n(e){var t=e.flags;if(t&2){try{for(var n,i=e.return;i!==null;){if(hp(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 R=n.stateNode.containerInfo,K=Fd(e);Id(e,K,R);break;default:throw Error(r(161))}}catch(ae){dt(e,e.return,ae)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Mp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Mp(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;)xp(e,t.alternate,t),t=t.sibling}function Ki(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),Ki(t);break;case 1:Wa(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&fp(t,t.return,n),Ki(t);break;case 27:lo(t.stateNode);case 26:case 5:Wa(t,t.return),Ki(t);break;case 22:t.memoizedState===null&&Ki(t);break;case 30:Ki(t);break;default:Ki(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){dt(i,i.return,K)}if(i=f,u=i.updateQueue,u!==null){var N=i.stateNode;try{var R=u.shared.hiddenCallbacks;if(R!==null)for(u.shared.hiddenCallbacks=null,u=0;u<R.length;u++)eh(R[u],N)}catch(K){dt(i,i.return,K)}}n&&y&64&&dp(f),Qr(f,f.return);break;case 27:pp(f);case 26:case 5:Ll(u,f,n),n&&i===null&&y&4&&mp(f),Qr(f,f.return);break;case 12:Ll(u,f,n);break;case 31:Ll(u,f,n),n&&y&4&&bp(u,f);break;case 13:Ll(u,f,n),n&&y&4&&wp(u,f);break;case 22:f.memoizedState===null&&Ll(u,f,n),Qr(f,f.return);break;case 30:break;default:Ll(u,f,n)}t=t.sibling}}function $d(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&&zr(n))}function qd(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&zr(e))}function Ia(e,t,n,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Cp(e,t,n,i),t=t.sibling}function Cp(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&&zr(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(R){dt(t,t.return,R)}}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):Xr(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&&$d(y,t);break;case 24:Ia(e,t,n,i),u&2048&&qd(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,R=i,K=y.flags;switch(y.tag){case 0:case 11:case 15:Bs(f,y,N,R,u),Kr(8,y);break;case 23:break;case 22:var ae=y.stateNode;y.memoizedState!==null?ae._visibility&2?Bs(f,y,N,R,u):Xr(f,y):(ae._visibility|=2,Bs(f,y,N,R,u)),u&&K&2048&&$d(y.alternate,y);break;case 24:Bs(f,y,N,R,u),u&&K&2048&&qd(y.alternate,y);break;default:Bs(f,y,N,R,u)}t=t.sibling}}function Xr(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:Xr(n,i),u&2048&&$d(i.alternate,i);break;case 24:Xr(n,i),u&2048&&qd(i.alternate,i);break;default:Xr(n,i)}t=t.sibling}}var Zr=8192;function Hs(e,t,n){if(e.subtreeFlags&Zr)for(e=e.child;e!==null;)jp(e,t,n),e=e.sibling}function jp(e,t,n){switch(e.tag){case 26:Hs(e,t,n),e.flags&Zr&&e.memoizedState!==null&&vb(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=Zr,Zr=16777216,Hs(e,t,n),Zr=i):Hs(e,t,n));break;default:Hs(e,t,n)}}function Np(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 Wr(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];tn=i,Tp(i,e)}Np(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ap(e),e=e.sibling}function Ap(e){switch(e.tag){case 0:case 11:case 15:Wr(e),e.flags&2048&&ui(9,e,e.return);break;case 3:Wr(e);break;case 12:Wr(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)):Wr(e);break;default:Wr(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];tn=i,Tp(i,e)}Np(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 Tp(e,t){for(;tn!==null;){var n=tn;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:zr(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,tn=i;else e:for(n=e;tn!==null;){i=tn;var u=i.sibling,f=i.return;if(vp(i),i===n){tn=null;break e}if(u!==null){u.return=f,tn=u;break e}tn=f}}}var Ly={getCacheForType:function(e){var t=rn(It),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return rn(It).controller.signal}},_y=typeof WeakMap=="function"?WeakMap:Map,st=0,yt=null,Ze=null,Je=0,ut=0,la=null,di=!1,Fs=!1,Gd=!1,_l=0,Dt=0,fi=0,Qi=0,Pd=0,ia=0,Is=0,Jr=null,qn=null,Yd=!1,Tc=0,kp=0,kc=1/0,Ec=null,mi=null,Xt=0,hi=null,Us=null,zl=0,Vd=0,Kd=null,Ep=null,eo=0,Qd=null;function sa(){return(st&2)!==0&&Je!==0?Je&-Je:H.T!==null?tf():bn()}function Dp(){if(ia===0)if((Je&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 Gn(e,t,n){(e===yt&&(ut===2||ut===9)||e.cancelPendingCommit!==null)&&($s(e,0),pi(e,Je,ia,!1)),Da(e,n),((st&2)===0||e!==yt)&&(e===yt&&((st&2)===0&&(Qi|=n),Dt===4&&pi(e,Je,ia,!1)),Ja(e))}function Rp(e,t,n){if((st&6)!==0)throw Error(r(327));var i=!n&&(t&127)===0&&(t&e.expiredLanes)===0||ua(e,t),u=i?By(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&&!zy(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=Jr;var R=N.current.memoizedState.isDehydrated;if(R&&($s(N,y).flags|=256),y=Zd(N,y,!1),y!==2){if(Gd&&!R){N.errorRecoveryDisabledLanes|=f,Qi|=f,u=4;break e}f=qn,qn=u,f!==null&&(qn===null?qn=f:qn.push.apply(qn,f))}u=y}if(f=!1,u!==2)continue}}if(u===1){$s(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:qn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(u=Tc+300-He(),10<u)){if(pi(i,t,ia,!di),Dn(i,0,!0)!==0)break e;zl=t,i.timeoutHandle=cg(Lp.bind(null,i,n,qn,Ec,Yd,t,ia,Qi,Is,di,f,"Throttled",-0,0),u);break e}Lp(i,n,qn,Ec,Yd,t,ia,Qi,Is,di,f,null,-0,0)}}break}while(!0);Ja(e)}function Lp(e,t,n,i,u,f,y,N,R,K,ae,se,X,W){if(e.timeoutHandle=-1,se=t.subtreeFlags,se&8192||(se&16785408)===16785408){se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Jn},jp(t,f,se);var Ne=(f&62914560)===f?Tc-He():(f&4194048)===f?kp-He():0;if(Ne=yb(se,Ne),Ne!==null){zl=f,e.cancelPendingCommit=Ne(Up.bind(null,e,t,f,n,i,u,y,N,R,ae,se,null,X,W)),pi(e,f,y,!K);return}}Up(e,t,f,n,i,u,y,N,R)}function zy(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(!Cn(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&=~Pd,t&=~Qi,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var f=31-Rt(u),y=1<<f;i[f]=-1,u&=~y}n!==0&&ol(e,n,t)}function Dc(){return(st&6)===0?(to(0),!1):!0}function Xd(){if(Ze!==null){if(ut===0)var e=Ze.return;else e=Ze,Fn=ta=null,fd(e),Rs=null,Br=0,e=Ze;for(;e!==null;)up(e.alternate,e),e=e.return;Ze=null}}function $s(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,tb(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),zl=0,Xd(),yt=e,Ze=n=ya(e.current,null),Je=t,ut=0,la=null,di=!1,Fs=ua(e,t),Gd=!1,Is=ia=Pd=Qi=fi=Dt=0,qn=Jr=null,Yd=!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-Rt(i),f=1<<u;t|=e[u],i&=~f}return _l=t,Fi(),n}function _p(e,t){$e=null,H.H=Pr,t===Ds||t===sc?(t=Xm(),ut=3):t===ed?(t=Xm(),ut=4):ut=t===Td?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,la=t,Ze===null&&(Dt=1,bc(e,jn(t,e.current)))}function zp(){var e=na.current;return e===null?!0:(Je&4194048)===Je?Sa===null:(Je&62914560)===Je||(Je&536870912)!==0?e===Sa:!1}function Op(){var e=H.H;return H.H=Pr,e===null?Pr:e}function Bp(){var e=H.A;return H.A=Ly,e}function Rc(){Dt=4,di||(Je&4194048)!==Je&&na.current!==null||(Fs=!0),(fi&134217727)===0&&(Qi&134217727)===0||yt===null||pi(yt,Je,ia,!1)}function Zd(e,t,n){var i=st;st|=2;var u=Op(),f=Bp();(yt!==e||Je!==t)&&(Ec=null,$s(e,t)),t=!1;var y=Dt;e:do try{if(ut!==0&&Ze!==null){var N=Ze,R=la;switch(ut){case 8:Xd(),y=6;break e;case 3:case 2:case 9:case 6:na.current===null&&(t=!0);var K=ut;if(ut=0,la=null,qs(e,N,R,K),n&&Fs){y=0;break e}break;default:K=ut,ut=0,la=null,qs(e,N,R,K)}}Oy(),y=Dt;break}catch(ae){_p(e,ae)}while(!0);return t&&e.shellSuspendCounter++,Fn=ta=null,st=i,H.H=u,H.A=f,Ze===null&&(yt=null,Je=0,Fi()),y}function Oy(){for(;Ze!==null;)Hp(Ze)}function By(e,t){var n=st;st|=2;var i=Op(),u=Bp();yt!==e||Je!==t?(Ec=null,kc=He()+500,$s(e,t)):Fs=ua(e,t);e:do try{if(ut!==0&&Ze!==null){t=Ze;var f=la;t:switch(ut){case 1:ut=0,la=null,qs(e,t,f,1);break;case 2:case 9:if(Km(f)){ut=0,la=null,Fp(t);break}t=function(){ut!==2&&ut!==9||yt!==e||(ut=7),Ja(e)},f.then(t,t);break e;case 3:ut=7;break e;case 4:ut=5;break e;case 7:Km(f)?(ut=0,la=null,Fp(t)):(ut=0,la=null,qs(e,t,f,7));break;case 5:var y=null;switch(Ze.tag){case 26:y=Ze.memoizedState;case 5:case 27:var N=Ze;if(y?Cg(y):N.stateNode.complete){ut=0,la=null;var R=N.sibling;if(R!==null)Ze=R;else{var K=N.return;K!==null?(Ze=K,Lc(K)):Ze=null}break t}}ut=0,la=null,qs(e,t,f,5);break;case 6:ut=0,la=null,qs(e,t,f,6);break;case 8:Xd(),Dt=6;break e;default:throw Error(r(462))}}Hy();break}catch(ae){_p(e,ae)}while(!0);return Fn=ta=null,H.H=i,H.A=u,st=n,Ze!==null?0:(yt=null,Je=0,Fi(),Dt)}function Hy(){for(;Ze!==null&&!ve();)Hp(Ze)}function Hp(e){var t=op(e.alternate,e,_l);e.memoizedProps=e.pendingProps,t===null?Lc(e):Ze=t}function Fp(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=np(n,t,t.pendingProps,t.type,void 0,Je);break;case 11:t=np(n,t,t.pendingProps,t.type.render,t.ref,Je);break;case 5:fd(t);default:up(n,t),t=Ze=nc(t,_l),t=op(n,t,_l)}e.memoizedProps=e.pendingProps,t===null?Lc(e):Ze=t}function qs(e,t,n,i){Fn=ta=null,fd(t),Rs=null,Br=0;var u=t.return;try{if(Ny(e,u,t,n,Je)){Dt=1,bc(e,jn(n,e.current)),Ze=null;return}}catch(f){if(u!==null)throw Ze=u,f;Dt=1,bc(e,jn(n,e.current)),Ze=null;return}t.flags&32768?(O||i===1?e=!0:Fs||(Je&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))),Ip(t,e)):Lc(t)}function Lc(e){var t=e;do{if((t.flags&32768)!==0){Ip(t,di);return}e=t.return;var n=ky(t.alternate,t,_l);if(n!==null){Ze=n;return}if(t=t.sibling,t!==null){Ze=t;return}Ze=t=e}while(t!==null);Dt===0&&(Dt=5)}function Ip(e,t){do{var n=Ey(e.alternate,e);if(n!==null){n.flags&=32767,Ze=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ze=e;return}Ze=e=n}while(e!==null);Dt=6,Ze=null}function Up(e,t,n,i,u,f,y,N,R){e.cancelPendingCommit=null;do _c();while(Xt!==0);if((st&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(f=t.lanes|t.childLanes,f|=Qa,qa(e,n,f,y,N,R),e===yt&&(Ze=yt=null,Je=0),Us=t,hi=e,zl=n,Vd=f,Kd=u,Ep=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,$y(ca,function(){return Yp(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=H.T,H.T=null,u=Q.p,Q.p=2,y=st,st|=4;try{Dy(e,t,n)}finally{st=y,Q.p=u,H.T=i}}Xt=1,$p(),qp(),Gp()}}function $p(){if(Xt===1){Xt=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=Q.p;Q.p=2;var u=st;st|=4;try{Sp(t,e);var f=uf,y=Ko(e.containerInfo),N=f.focusedElem,R=f.selectionRange;if(y!==N&&N&&N.ownerDocument&&Qe(N.ownerDocument.documentElement,N)){if(R!==null&&wr(N)){var K=R.start,ae=R.end;if(ae===void 0&&(ae=K),"selectionStart"in N)N.selectionStart=K,N.selectionEnd=Math.min(ae,N.value.length);else{var se=N.ownerDocument||document,X=se&&se.defaultView||window;if(X.getSelection){var W=X.getSelection(),Ne=N.textContent.length,Fe=Math.min(R.start,Ne),xt=R.end===void 0?Fe:Math.min(R.end,Ne);!W.extend&&Fe>xt&&(y=xt,xt=Fe,Fe=y);var $=hn(N,Fe),B=hn(N,xt);if($&&B&&(W.rangeCount!==1||W.anchorNode!==$.node||W.anchorOffset!==$.offset||W.focusNode!==B.node||W.focusOffset!==B.offset)){var V=se.createRange();V.setStart($.node,$.offset),W.removeAllRanges(),Fe>xt?(W.addRange(V),W.extend(B.node,B.offset)):(V.setEnd(B.node,B.offset),W.addRange(V))}}}}for(se=[],W=N;W=W.parentNode;)W.nodeType===1&&se.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<se.length;N++){var ie=se[N];ie.element.scrollLeft=ie.left,ie.element.scrollTop=ie.top}}Yc=!!cf,uf=cf=null}finally{st=u,Q.p=i,H.T=n}}e.current=t,Xt=2}}function qp(){if(Xt===2){Xt=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=Q.p;Q.p=2;var u=st;st|=4;try{xp(e,t.alternate,t)}finally{st=u,Q.p=i,H.T=n}}Xt=3}}function Gp(){if(Xt===4||Xt===3){Xt=0,ke();var e=hi,t=Us,n=zl,i=Ep;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Xt=5:(Xt=0,Us=hi=null,Pp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(mi=null),cl(n),t=t.stateNode,rt&&typeof rt.onCommitFiberRoot=="function")try{rt.onCommitFiberRoot(kn,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=H.T,u=Q.p,Q.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,Q.p=u}}(zl&3)!==0&&_c(),Ja(e),u=e.pendingLanes,(n&261930)!==0&&(u&42)!==0?e===Qd?eo++:(eo=0,Qd=e):eo=0,to(0)}}function Pp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,zr(t)))}function _c(){return $p(),qp(),Gp(),Yp()}function Yp(){if(Xt!==5)return!1;var e=hi,t=Vd;Vd=0;var n=cl(zl),i=H.T,u=Q.p;try{Q.p=32>n?32:n,H.T=null,n=Kd,Kd=null;var f=hi,y=zl;if(Xt=0,Us=hi=null,zl=0,(st&6)!==0)throw Error(r(331));var N=st;if(st|=4,Ap(f.current),Cp(f,f.current,y,n),st=N,to(0,!1),rt&&typeof rt.onPostCommitFiberRoot=="function")try{rt.onPostCommitFiberRoot(kn,f)}catch{}return!0}finally{Q.p=u,H.T=i,Pp(e,t)}}function Vp(e,t,n){t=jn(n,t),t=Ad(e.stateNode,t,2),e=ri(e,t,2),e!==null&&(Da(e,2),Ja(e))}function dt(e,t,n){if(e.tag===3)Vp(e,e,n);else for(;t!==null;){if(t.tag===3){Vp(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=jn(n,e),n=Kh(2),i=ri(t,n,2),i!==null&&(Qh(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 _y;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=Fy.bind(null,e,t,n),t.then(e,e))}function Fy(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,yt===e&&(Je&n)===n&&(Dt===4||Dt===3&&(Je&62914560)===Je&&300>He()-Tc?(st&2)===0&&$s(e,0):Pd|=n,Is===Je&&(Is=0)),Ja(e)}function Kp(e,t){t===0&&(t=rl()),e=bl(e,t),e!==null&&(Da(e,t),Ja(e))}function Iy(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Kp(e,n)}function Uy(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),Kp(e,n)}function $y(e,t){return Ht(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,Gy())}function to(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-Rt(42|e)+1)-1,f&=u&~(y&~N),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(n=!0,Wp(i,f))}else f=Je,f=Dn(i,i===yt?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(f&3)===0||ua(i,f)||(n=!0,Wp(i,f));i=i.next}while(n);ef=!1}}function qy(){Qp()}function Qp(){Oc=Jd=!1;var e=0;gi!==0&&eb()&&(e=gi);for(var t=He(),n=null,i=zc;i!==null;){var u=i.next,f=Xp(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}Xt!==0&&Xt!==5||to(e),gi!==0&&(gi=0)}function Xp(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var y=31-Rt(f),N=1<<y,R=u[y];R===-1?((N&n)===0||(N&i)!==0)&&(u[y]=Il(N,t)):R<=t&&(e.expiredLanes|=N),f&=~N}if(t=yt,n=Je,n=Dn(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,n===0||e===t&&(ut===2||ut===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&Be(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&&Be(i),cl(n)){case 2:case 8:n=Ve;break;case 32:n=ca;break;case 268435456:n=Tn;break;default:n=ca}return i=Zp.bind(null,e),n=Ht(n,i),e.callbackPriority=t,e.callbackNode=n,t}return i!==null&&i!==null&&Be(i),e.callbackPriority=2,e.callbackNode=null,2}function Zp(e,t){if(Xt!==0&&Xt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(_c()&&e.callbackNode!==n)return null;var i=Je;return i=Dn(e,e===yt?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(Rp(e,i,t),Xp(e,He()),e.callbackNode!=null&&e.callbackNode===n?Zp.bind(null,e):null)}function Wp(e,t){if(_c())return null;Rp(e,t,!0)}function Gy(){nb(function(){(st&6)!==0?Ht(yn,qy):Qp()})}function tf(){if(gi===0){var e=ks;e===0&&(e=sl,sl<<=1,(sl&261888)===0&&(sl=256)),gi=e}return gi}function Jp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ss(""+e)}function eg(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 Py(e,t,n,i,u){if(t==="submit"&&n&&n.stateNode===u){var f=Jp((u[me]||null).action),y=i.submitter;y&&(t=(t=y[me]||null)?Jp(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 R=y?eg(u,y):new FormData(u);wd(n,{pending:!0,data:R,method:u.method,action:f},null,R)}}else typeof f=="function"&&(N.preventDefault(),R=y?eg(u,y):new FormData(u),wd(n,{pending:!0,data:R,method:u.method,action:f},f,R))},currentTarget:u}]})}}for(var nf=0;nf<Ar.length;nf++){var af=Ar[nf],Yy=af.toLowerCase(),Vy=af[0].toUpperCase()+af.slice(1);ea(Yy,"on"+Vy)}ea(Zo,"onAnimationEnd"),ea(Wo,"onAnimationIteration"),ea(Jo,"onAnimationStart"),ea("dblclick","onDoubleClick"),ea("focusin","onFocus"),ea("focusout","onBlur"),ea(jr,"onTransitionRun"),ea(Nr,"onTransitionStart"),ea(Vu,"onTransitionCancel"),ea(ec,"onTransitionEnd"),_t("onMouseEnter",["mouseout","mouseover"]),_t("onMouseLeave",["mouseout","mouseover"]),_t("onPointerEnter",["pointerout","pointerover"]),_t("onPointerLeave",["pointerout","pointerover"]),Kt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Kt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Kt("onBeforeInput",["compositionend","keypress","textInput","paste"]),Kt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Kt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Kt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var no="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(" "),Ky=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(no));function tg(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],R=N.instance,K=N.currentTarget;if(N=N.listener,R!==f&&u.isPropagationStopped())break e;f=N,u.currentTarget=K;try{f(u)}catch(ae){Ns(ae)}u.currentTarget=null,f=R}else for(y=0;y<i.length;y++){if(N=i[y],R=N.instance,K=N.currentTarget,N=N.listener,R!==f&&u.isPropagationStopped())break e;f=N,u.currentTarget=K;try{f(u)}catch(ae){Ns(ae)}u.currentTarget=null,f=R}}}}function We(e,t){var n=t[Ue];n===void 0&&(n=t[Ue]=new Set);var i=e+"__bubble";n.has(i)||(ng(t,e,2,!1),n.add(i))}function lf(e,t,n){var i=0;t&&(i|=4),ng(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"&&(Ky.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 ng(e,t,n,i){switch(Dg(t)){case 2:var u=Sb;break;case 8:u=Mb;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 R=y.tag;if((R===3||R===4)&&y.stateNode.containerInfo===u)return;y=y.return}for(;N!==null;){if(y=Vt(N),y===null)return;if(R=y.tag,R===5||R===6||R===26||R===27){i=f=y;continue e}N=N.parentNode}}i=i.return}Ho(function(){var K=f,ae=rs(n),se=[];e:{var X=tc.get(e);if(X!==void 0){var W=_i,Ne=e;switch(e){case"keypress":if(en(n)===0)break e;case"keydown":case"keyup":W=gs;break;case"focusin":Ne="focus",W=fs;break;case"focusout":Ne="blur",W=fs;break;case"beforeblur":case"afterblur":W=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":W=or;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=Hu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=ys;break;case Zo:case Wo:case Jo:W=Ya;break;case ec:W=Oi;break;case"scroll":case"scrollend":W=Uo;break;case"wheel":W=qo;break;case"copy":case"cut":case"paste":W=Gl;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=vs;break;case"toggle":case"beforetoggle":W=fr}var Fe=(t&4)!==0,xt=!Fe&&(e==="scroll"||e==="scrollend"),$=Fe?X!==null?X+"Capture":null:X;Fe=[];for(var B=K,V;B!==null;){var ie=B;if(V=ie.stateNode,ie=ie.tag,ie!==5&&ie!==26&&ie!==27||V===null||$===null||(ie=ql(B,$),ie!=null&&Fe.push(ao(B,ie,V))),xt)break;B=B.return}0<Fe.length&&(X=new W(X,Ne,null,n,ae),se.push({event:X,listeners:Fe}))}}if((t&7)===0){e:{if(X=e==="mouseover"||e==="pointerover",W=e==="mouseout"||e==="pointerout",X&&n!==mt&&(Ne=n.relatedTarget||n.fromElement)&&(Vt(Ne)||Ne[Me]))break e;if((W||X)&&(X=ae.window===ae?ae:(X=ae.ownerDocument)?X.defaultView||X.parentWindow:window,W?(Ne=n.relatedTarget||n.toElement,W=K,Ne=Ne?Vt(Ne):null,Ne!==null&&(xt=d(Ne),Fe=Ne.tag,Ne!==xt||Fe!==5&&Fe!==27&&Fe!==6)&&(Ne=null)):(W=null,Ne=K),W!==Ne)){if(Fe=or,ie="onMouseLeave",$="onMouseEnter",B="mouse",(e==="pointerout"||e==="pointerover")&&(Fe=vs,ie="onPointerLeave",$="onPointerEnter",B="pointer"),xt=W==null?X:St(W),V=Ne==null?X:St(Ne),X=new Fe(ie,B+"leave",W,n,ae),X.target=xt,X.relatedTarget=V,ie=null,Vt(ae)===K&&(Fe=new Fe($,B+"enter",Ne,n,ae),Fe.target=V,Fe.relatedTarget=xt,ie=Fe),xt=ie,W&&Ne)t:{for(Fe=Qy,$=W,B=Ne,V=0,ie=$;ie;ie=Fe(ie))V++;ie=0;for(var De=B;De;De=Fe(De))ie++;for(;0<V-ie;)$=Fe($),V--;for(;0<ie-V;)B=Fe(B),ie--;for(;V--;){if($===B||B!==null&&$===B.alternate){Fe=$;break t}$=Fe($),B=Fe(B)}Fe=null}else Fe=null;W!==null&&ag(se,X,W,Fe,!1),Ne!==null&&xt!==null&&ag(se,xt,Ne,Fe,!0)}}e:{if(X=K?St(K):window,W=X.nodeName&&X.nodeName.toLowerCase(),W==="select"||W==="input"&&X.type==="file")var lt=Bi;else if(Yo(X))if(Ba)lt=qm;else{lt=Vo;var Ae=js}else W=X.nodeName,!W||W.toLowerCase()!=="input"||X.type!=="checkbox"&&X.type!=="radio"?K&&is(K.elementType)&&(lt=Bi):lt=Pu;if(lt&&(lt=lt(e,K))){vr(se,lt,n,ae);break e}Ae&&Ae(e,X,K),e==="focusout"&&K&&X.type==="number"&&K.memoizedProps.value!=null&&Li(X,"number",X.value)}switch(Ae=K?St(K):window,e){case"focusin":(Yo(Ae)||Ae.contentEditable==="true")&&(Ql=Ae,Sr=K,Hi=null);break;case"focusout":Hi=Sr=Ql=null;break;case"mousedown":Mr=!0;break;case"contextmenu":case"mouseup":case"dragend":Mr=!1,Qo(se,n,ae);break;case"selectionchange":if(Yu)break;case"keydown":case"keyup":Qo(se,n,ae)}var Ye;if(mr)e:{switch(e){case"compositionstart":var et="onCompositionStart";break e;case"compositionend":et="onCompositionEnd";break e;case"compositionupdate":et="onCompositionUpdate";break e}et=void 0}else Va?Pl(e,n)&&(et="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(et="onCompositionStart");et&&(xl&&n.locale!=="ko"&&(Va||et!=="onCompositionStart"?et==="onCompositionEnd"&&Va&&(Ye=Fo()):(Mn=ae,Jt="value"in Mn?Mn.value:Mn.textContent,Va=!0)),Ae=Hc(K,et),0<Ae.length&&(et=new hs(et,e,null,n,ae),se.push({event:et,listeners:Ae}),Ye?et.data=Ye:(Ye=gr(n),Ye!==null&&(et.data=Ye)))),(Ye=$u?Po(e,n):qu(e,n))&&(et=Hc(K,"onBeforeInput"),0<et.length&&(Ae=new hs("onBeforeInput","beforeinput",null,n,ae),se.push({event:Ae,listeners:et}),Ae.data=Ye)),Py(se,e,K,n,ae)}tg(se,t)})}function ao(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=ql(e,n),u!=null&&i.unshift(ao(e,u,f)),u=ql(e,t),u!=null&&i.push(ao(e,u,f))),e.tag===3)return i;e=e.return}return[]}function Qy(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ag(e,t,n,i,u){for(var f=t._reactName,y=[];n!==null&&n!==i;){var N=n,R=N.alternate,K=N.stateNode;if(N=N.tag,R!==null&&R===i)break;N!==5&&N!==26&&N!==27||K===null||(R=K,u?(K=ql(n,f),K!=null&&y.unshift(ao(n,K,R))):u||(K=ql(n,f),K!=null&&y.push(ao(n,K,R)))),n=n.return}y.length!==0&&e.push({event:t,listeners:y})}var Xy=/\r\n?/g,Zy=/\u0000|\uFFFD/g;function lg(e){return(typeof e=="string"?e:""+e).replace(Xy,`
9
+ `).replace(Zy,"")}function ig(e,t){return t=lg(t),lg(e)===t}function gt(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":be(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"&&gt(e,t,"name",u.name,u,null),gt(e,t,"formEncType",u.formEncType,u,null),gt(e,t,"formMethod",u.formMethod,u,null),gt(e,t,"formTarget",u.formTarget,u,null)):(gt(e,t,"encType",u.encType,u,null),gt(e,t,"method",u.method,u,null),gt(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&&We("scroll",e);break;case"onScrollEnd":i!=null&&We("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":We("beforetoggle",e),We("toggle",e),Ei(e,"popover",i);break;case"xlinkActuate":wn(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":wn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":wn(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":wn(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":wn(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":wn(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":wn(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":wn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":wn(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":be(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&&We("scroll",e);break;case"onScrollEnd":i!=null&&We("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 cn(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":We("error",e),We("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:gt(e,t,f,y,n,null)}}u&&gt(e,t,"srcSet",n.srcSet,n,null),i&&gt(e,t,"src",n.src,n,null);return;case"input":We("invalid",e);var N=f=y=u=null,R=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":R=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:gt(e,t,i,ae,n,null)}}Ul(e,f,N,R,K,y,u,!1);return;case"select":We("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:gt(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":We("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:gt(e,t,y,N,n,null)}fa(e,i,u,f);return;case"option":for(R in n)n.hasOwnProperty(R)&&(i=n[R],i!=null)&&(R==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":gt(e,t,R,i,n,null));return;case"dialog":We("beforetoggle",e),We("toggle",e),We("cancel",e),We("close",e);break;case"iframe":case"object":We("load",e);break;case"video":case"audio":for(i=0;i<no.length;i++)We(no[i],e);break;case"image":We("error",e),We("load",e);break;case"details":We("toggle",e);break;case"embed":case"source":case"link":We("error",e),We("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:gt(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&&gt(e,t,N,i,n,null))}function Wy(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,R=null,K=null,ae=null;for(W in n){var se=n[W];if(n.hasOwnProperty(W)&&se!=null)switch(W){case"checked":break;case"value":break;case"defaultValue":R=se;default:i.hasOwnProperty(W)||gt(e,t,W,null,i,se)}}for(var X in i){var W=i[X];if(se=n[X],i.hasOwnProperty(X)&&(W!=null||se!=null))switch(X){case"type":f=W;break;case"name":u=W;break;case"checked":K=W;break;case"defaultChecked":ae=W;break;case"value":y=W;break;case"defaultValue":N=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(r(137,t));break;default:W!==se&&gt(e,t,X,W,i,se)}}zn(e,y,N,R,K,ae,f,u);return;case"select":W=y=N=X=null;for(f in n)if(R=n[f],n.hasOwnProperty(f)&&R!=null)switch(f){case"value":break;case"multiple":W=R;default:i.hasOwnProperty(f)||gt(e,t,f,null,i,R)}for(u in i)if(f=i[u],R=n[u],i.hasOwnProperty(u)&&(f!=null||R!=null))switch(u){case"value":X=f;break;case"defaultValue":N=f;break;case"multiple":y=f;default:f!==R&&gt(e,t,u,f,i,R)}t=N,n=y,i=W,X!=null?_a(e,!!n,X,!1):!!i!=!!n&&(t!=null?_a(e,!!n,t,!0):_a(e,!!n,n?[]:"",!1));return;case"textarea":W=X=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:gt(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":X=u;break;case"defaultValue":W=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(r(91));break;default:u!==f&&gt(e,t,y,u,i,f)}fl(e,X,W);return;case"option":for(var Ne in n)X=n[Ne],n.hasOwnProperty(Ne)&&X!=null&&!i.hasOwnProperty(Ne)&&(Ne==="selected"?e.selected=!1:gt(e,t,Ne,null,i,X));for(R in i)X=i[R],W=n[R],i.hasOwnProperty(R)&&X!==W&&(X!=null||W!=null)&&(R==="selected"?e.selected=X&&typeof X!="function"&&typeof X!="symbol":gt(e,t,R,X,i,W));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 Fe in n)X=n[Fe],n.hasOwnProperty(Fe)&&X!=null&&!i.hasOwnProperty(Fe)&&gt(e,t,Fe,null,i,X);for(K in i)if(X=i[K],W=n[K],i.hasOwnProperty(K)&&X!==W&&(X!=null||W!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,t));break;default:gt(e,t,K,X,i,W)}return;default:if(is(t)){for(var xt in n)X=n[xt],n.hasOwnProperty(xt)&&X!==void 0&&!i.hasOwnProperty(xt)&&of(e,t,xt,void 0,i,X);for(ae in i)X=i[ae],W=n[ae],!i.hasOwnProperty(ae)||X===W||X===void 0&&W===void 0||of(e,t,ae,X,i,W);return}}for(var $ in n)X=n[$],n.hasOwnProperty($)&&X!=null&&!i.hasOwnProperty($)&&gt(e,t,$,null,i,X);for(se in i)X=i[se],W=n[se],!i.hasOwnProperty(se)||X===W||X==null&&W==null||gt(e,t,se,X,i,W)}function sg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Jy(){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&&sg(y)){for(y=0,N=u.responseEnd,i+=1;i<n.length;i++){var R=n[i],K=R.startTime;if(K>N)break;var ae=R.transferSize,se=R.initiatorType;ae&&sg(se)&&(R=R.responseEnd,y+=ae*(R<N?1:(N-K)/(R-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 rg(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 og(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 eb(){var e=window.event;return e&&e.type==="popstate"?e===ff?!1:(ff=e,!0):(ff=null,!1)}var cg=typeof setTimeout=="function"?setTimeout:void 0,tb=typeof clearTimeout=="function"?clearTimeout:void 0,ug=typeof Promise=="function"?Promise:void 0,nb=typeof queueMicrotask=="function"?queueMicrotask:typeof ug<"u"?function(e){return ug.resolve(null).then(e).catch(ab)}:cg;function ab(e){setTimeout(function(){throw e})}function xi(e){return e==="head"}function dg(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),Ks(t);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")lo(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,lo(n);for(var f=n.firstChild;f;){var y=f.nextSibling,N=f.nodeName;f[nt]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&f.rel.toLowerCase()==="stylesheet"||n.removeChild(f),f=y}}else n==="body"&&lo(e.ownerDocument.body);n=u}while(n);Ks(t)}function fg(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),sn(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function lb(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[nt])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 ib(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 mg(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 sb(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 hg(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 pg(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 gg(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 lo(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);sn(e)}var Ca=new Map,xg=new Set;function Ic(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ol=Q.d;Q.d={f:rb,r:ob,D:cb,C:ub,L:db,m:fb,X:hb,S:mb,M:pb};function rb(){var e=Ol.f(),t=Dc();return e||t}function ob(e){var t=mn(e);t!==null&&t.tag===5&&t.type==="form"?_h(t):Ol.r(e)}var Ps=typeof document>"u"?null:document;function vg(e,t,n){var i=Ps;if(i&&typeof t=="string"&&t){var u=_n(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof n=="string"&&(u+='[crossorigin="'+n+'"]'),xg.has(u)||(xg.add(u),e={rel:e,crossOrigin:n,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),cn(t,"link",e),wt(t),i.head.appendChild(t)))}}function cb(e){Ol.D(e),vg("dns-prefetch",e,null)}function ub(e,t){Ol.C(e,t),vg("preconnect",e,t)}function db(e,t,n){Ol.L(e,t,n);var i=Ps;if(i&&e&&t){var u='link[rel="preload"][as="'+_n(t)+'"]';t==="image"&&n&&n.imageSrcSet?(u+='[imagesrcset="'+_n(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(u+='[imagesizes="'+_n(n.imageSizes)+'"]')):u+='[href="'+_n(e)+'"]';var f=u;switch(t){case"style":f=Ys(e);break;case"script":f=Vs(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(io(f))||t==="script"&&i.querySelector(so(f))||(t=i.createElement("link"),cn(t,"link",e),wt(t),i.head.appendChild(t)))}}function fb(e,t){Ol.m(e,t);var n=Ps;if(n&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+_n(i)+'"][href="'+_n(e)+'"]',f=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=Vs(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(so(f)))return}i=n.createElement("link"),cn(i,"link",e),wt(i),n.head.appendChild(i)}}}function mb(e,t,n){Ol.S(e,t,n);var i=Ps;if(i&&e){var u=Lt(i).hoistableStyles,f=Ys(e);t=t||"default";var y=u.get(f);if(!y){var N={loading:0,preload:null};if(y=i.querySelector(io(f)))N.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Ca.get(f))&&xf(e,n);var R=y=i.createElement("link");wt(R),cn(R,"link",e),R._p=new Promise(function(K,ae){R.onload=K,R.onerror=ae}),R.addEventListener("load",function(){N.loading|=1}),R.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 hb(e,t){Ol.X(e,t);var n=Ps;if(n&&e){var i=Lt(n).hoistableScripts,u=Vs(e),f=i.get(u);f||(f=n.querySelector(so(u)),f||(e=v({src:e,async:!0},t),(t=Ca.get(u))&&vf(e,t),f=n.createElement("script"),wt(f),cn(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function pb(e,t){Ol.M(e,t);var n=Ps;if(n&&e){var i=Lt(n).hoistableScripts,u=Vs(e),f=i.get(u);f||(f=n.querySelector(so(u)),f||(e=v({src:e,async:!0,type:"module"},t),(t=Ca.get(u))&&vf(e,t),f=n.createElement("script"),wt(f),cn(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function yg(e,t,n,i){var u=(u=ze.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=Ys(n.href),n=Lt(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=Ys(n.href);var f=Lt(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(io(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||gb(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=Vs(n),n=Lt(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 Ys(e){return'href="'+_n(e)+'"'}function io(e){return'link[rel="stylesheet"]['+e+"]"}function bg(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function gb(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}),cn(t,"link",n),wt(t),e.head.appendChild(t))}function Vs(e){return'[src="'+_n(e)+'"]'}function so(e){return"script[async]"+e}function wg(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+_n(n.href)+'"]');if(i)return t.instance=i,wt(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"),wt(i),cn(i,"style",u),Uc(i,n.precedence,e),t.instance=i;case"stylesheet":u=Ys(n.href);var f=e.querySelector(io(u));if(f)return t.state.loading|=4,t.instance=f,wt(f),f;i=bg(n),(u=Ca.get(u))&&xf(i,u),f=(e.ownerDocument||e).createElement("link"),wt(f);var y=f;return y._p=new Promise(function(N,R){y.onload=N,y.onerror=R}),cn(f,"link",i),t.state.loading|=4,Uc(f,n.precedence,e),t.instance=f;case"script":return f=Vs(n.src),(u=e.querySelector(so(f)))?(t.instance=u,wt(u),u):(i=n,(u=Ca.get(f))&&(i=v({},n),vf(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),wt(u),cn(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 $c=null;function Sg(e,t,n){if($c===null){var i=new Map,u=$c=new Map;u.set(n,i)}else u=$c,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[nt]||f[P]||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 Mg(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function xb(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 Cg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function vb(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=Ys(i.href),f=t.querySelector(io(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=qc.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=f,wt(f);return}f=t.ownerDocument||t,i=bg(i),(u=Ca.get(u))&&xf(i,u),f=f.createElement("link"),wt(f);var y=f;y._p=new Promise(function(N,R){y.onload=N,y.onerror=R}),cn(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=qc.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var yf=0;function yb(e,t){return e.stylesheets&&e.count===0&&Pc(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var i=setTimeout(function(){if(e.stylesheets&&Pc(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&yf===0&&(yf=62500*Jy());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Pc(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 qc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Pc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Gc=null;function Pc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Gc=new Map,t.forEach(bb,e),Gc=null,qc.call(e))}function bb(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=qc.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 ro={$$typeof:_,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function wb(e,t,n,i,u,f,y,N,R){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=R,this.incompleteTransitions=new Map}function jg(e,t,n,i,u,f,y,N,R,K,ae,se){return e=new wb(e,t,n,y,R,K,ae,se,N),t=1,f===!0&&(t|=24),f=ct(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 Ng(e){return e?(e=Jl,e):Jl}function Ag(e,t,n,i,u,f){u=Ng(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&&(Gn(n,e,t),Fr(n,e,t))}function Tg(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){Tg(e,t),(e=e.alternate)&&Tg(e,t)}function kg(e){if(e.tag===13||e.tag===31){var t=bl(e,67108864);t!==null&&Gn(t,e,67108864),bf(e,67108864)}}function Eg(e){if(e.tag===13||e.tag===31){var t=sa();t=Ga(t);var n=bl(e,t);n!==null&&Gn(n,e,t),bf(e,t)}}var Yc=!0;function Sb(e,t,n,i){var u=H.T;H.T=null;var f=Q.p;try{Q.p=2,wf(e,t,n,i)}finally{Q.p=f,H.T=u}}function Mb(e,t,n,i){var u=H.T;H.T=null;var f=Q.p;try{Q.p=8,wf(e,t,n,i)}finally{Q.p=f,H.T=u}}function wf(e,t,n,i){if(Yc){var u=Sf(i);if(u===null)rf(e,t,i,Vc,n),Rg(e,i);else if(jb(u,e,t,n,i))i.stopPropagation();else if(Rg(e,i),t&4&&-1<Cb.indexOf(e)){for(;u!==null;){var f=mn(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 R=1<<31-Rt(y);N.entanglements[1]|=R,y&=~R}Ja(f),(st&6)===0&&(kc=He()+500,to(0))}}break;case 31:case 13:N=bl(f,2),N!==null&&Gn(N,f,2),Dc(),bf(f,2)}if(f=Sf(i),f===null&&rf(e,t,i,Vc,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 Vc=null;function Mf(e){if(Vc=null,e=Vt(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 Vc=e,null}function Dg(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(Pt()){case yn:return 2;case Ve:return 8;case ca:case Ta:return 32;case Tn:return 268435456;default:return 32}default:return 32}}var Cf=!1,vi=null,yi=null,bi=null,oo=new Map,co=new Map,wi=[],Cb="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 Rg(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":oo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":co.delete(t.pointerId)}}function uo(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=mn(t),t!==null&&kg(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function jb(e,t,n,i,u){switch(t){case"focusin":return vi=uo(vi,e,t,n,i,u),!0;case"dragenter":return yi=uo(yi,e,t,n,i,u),!0;case"mouseover":return bi=uo(bi,e,t,n,i,u),!0;case"pointerover":var f=u.pointerId;return oo.set(f,uo(oo.get(f)||null,e,t,n,i,u)),!0;case"gotpointercapture":return f=u.pointerId,co.set(f,uo(co.get(f)||null,e,t,n,i,u)),!0}return!1}function Lg(e){var t=Vt(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(){Eg(n)});return}}else if(t===31){if(t=p(n),t!==null){e.blockedOn=t,Wn(e.priority,function(){Eg(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 Kc(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);mt=i,n.target.dispatchEvent(i),mt=null}else return t=mn(n),t!==null&&kg(t),e.blockedOn=n,!1;t.shift()}return!0}function _g(e,t,n){Kc(e)&&n.delete(t)}function Nb(){Cf=!1,vi!==null&&Kc(vi)&&(vi=null),yi!==null&&Kc(yi)&&(yi=null),bi!==null&&Kc(bi)&&(bi=null),oo.forEach(_g),co.forEach(_g)}function Qc(e,t){e.blockedOn===t&&(e.blockedOn=null,Cf||(Cf=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Nb)))}var Xc=null;function zg(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=mn(n);f!==null&&(e.splice(t,3),t-=3,wd(f,{pending:!0,data:u,method:n.method,action:i},i,u))}}))}function Ks(e){function t(R){return Qc(R,e)}vi!==null&&Qc(vi,e),yi!==null&&Qc(yi,e),bi!==null&&Qc(bi,e),oo.forEach(t),co.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);)Lg(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||zg(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),zg(n)}}}function Og(){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();Ag(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;Ag(e.current,2,null,e,null,null),Dc(),t[Me]=null}};function Zc(e){this._internalRoot=e}Zc.prototype.unstable_scheduleHydration=function(e){if(e){var t=bn();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&&Lg(e)}};var Bg=l.version;if(Bg!=="19.2.7")throw Error(r(527,Bg,"19.2.7"));Q.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 Ab={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{kn=Wc.inject(Ab),rt=Wc}catch{}}return mo.createRoot=function(e,t){if(!c(e))throw Error(r(299));var n=!1,i="",u=Gh,f=Ph,y=Yh;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=jg(e,1,!1,null,null,n,i,null,u,f,y,Og),e[Me]=t.current,sf(e),new jf(t)},mo.hydrateRoot=function(e,t,n){if(!c(e))throw Error(r(299));var i=!1,u="",f=Gh,y=Ph,N=Yh,R=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&&(R=n.formState)),t=jg(e,1,!0,t,n??null,i,u,R,f,y,N,Og),t.context=Ng(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[Me]=t.current,sf(e),new Zc(t)},mo.version="19.2.7",mo}var Xg;function Zb(){if(Xg)return Df.exports;Xg=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=Xb(),Df.exports}var Wb=Zb();const Jb="https://otbyfkjxrkngvjziawki.supabase.co",e0="sb_publishable_NpUs0RDJH2YnllsqTKO6TQ_1jTdSsNQ",nl=Pb(Jb,e0,{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 t0(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 ov(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=t0(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 Zg=16,Wg=8,n0=24*1024*1024,cv=new Uint8Array(new Uint32Array([16909060]).buffer)[0]===4,lm=new Uint32Array(65536);for(let a=0;a<lm.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);lm[a]=cv?(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 a0(a,l){const s=Number(l);if(!Number.isSafeInteger(s)||s<Zg||s>n0)throw new Error(`Invalid Mode 5 packet length: ${l}.`);const r=ov(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=Zg;for(let v=0;v<g;v+=1){if(b+Wg>r.length)throw new Error("Mode 5 tile header is truncated.");const w=Mi(r,b),M=Mi(r,b+2),C=Mi(r,b+4),j=Mi(r,b+6);b+=Wg;const k=C*j*2;if(C<=0||j<=0||C>p||j>p||w+C>d||M+j>h||b+k>r.length)throw new Error(`Invalid Mode 5 tile ${v}.`);x.push({x:w,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 l0(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=cv&&(x.pixels.byteOffset&1)===0?new Uint16Array(x.pixels.buffer,x.pixels.byteOffset,x.pixels.byteLength>>>1):null;let v=0;for(let w=0;w<x.height;w+=1){let M=(x.y+w)*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]=lm[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 Qn=new WeakMap,Eo=new WeakMap,im=new WeakMap,Do=new Set,Wi=new Set,yu=new WeakMap,sm=new WeakMap,rm=new WeakMap,bu=new WeakMap,Cm=32,i0=2,s0=2,r0=2,o0=18,c0=40,u0=0,d0=750,uv=80,Jg=5,f0=150,m0=24,h0=180,p0=1200,g0=18,x0=.65,v0=2e3,y0=500,dv=250;let wu=!1;function b0(){return typeof navigator>"u"?!1:/mac/i.test(`${navigator.platform||""} ${navigator.userAgent||""}`)}function w0(){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:w0()};function S0(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 fv(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 M0(a,l,s,r=64){try{let c=sm.get(a);c||(c={canvas:document.createElement("canvas"),lastHash:"",initialized:!1},sm.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 w=0;w<g.length;w+=4)x^=g[w],x=Math.imul(x,16777619),x^=g[w+1],x=Math.imul(x,16777619),x^=g[w+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 om(a,l,s,r=dv,c=64){let d=rm.get(a);d||(d={lastHash:"",initialized:!1,lastCanvasSampleAt:0},rm.set(a,d));const h=performance.now();if(d.initialized&&r>0&&h-d.lastCanvasSampleAt<r)return{visualHash:d.lastHash,visualChanged:!1};const p=M0(a,l,s,c);return d.initialized=!0,d.lastHash=p.visualHash,d.lastCanvasSampleAt=h,p}function C0(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 mv(a,l){const s=im.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 im.set(a,d),d}return null}function j0(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 N0(a){return String(a.frameMode||a.mode||"").toLowerCase()==="mode3-h264-hw"||String(a.codec||"").toLowerCase()==="h264"||String(a.mimeType||"").toLowerCase()==="video/h264"}function A0(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 ex(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 T0(a,l){const s=new Uint8Array(l);let r=0,c=0;for(;r<a.length;){const d=a[r];r+=1;const h=ex(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=ex(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 w=0;w<b;w+=1)s[c]=s[v],c+=1,v+=1}if(c!==s.length)throw new Error("Invalid LZ4 block: incomplete output.");return s}function k0(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,w=Math.floor(a.uncompressedByteLength||v);if(b!==2||w!==v)throw new Error(`Invalid mode2 RGB565 frame size: ${w} for ${l}x${s}.`);if(c&&c!=="rgb565le"&&c!=="rgb565")throw new Error(`Unsupported mode2 pixel format: ${c}`);const M=ov(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,_=T>>5&63,q=T&31;C[k]=A<<3|A>>2,C[k+1]=_<<2|_>>4,C[k+2]=q<<3|q>>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=T0(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 tx(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=Qn.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(Qn.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),w=Number(h.duration||0),M=Math.max(16,Math.min(250,(v>0?v:w||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>hv(c);)Su(c,c.decodedFrames.shift());pv(c),c.renderTimer!==null&&c.renderScheduledAt>0&&performance.now()-c.renderScheduledAt>y0&&(typeof document>"u"||document.visibilityState==="visible")&&(window.cancelAnimationFrame(c.renderTimer),c.renderTimer=null,c.renderScheduledAt=0),c.renderTimer!==null&&c.decodedFrames.length>=Cm&&(window.cancelAnimationFrame(c.renderTimer),c.renderTimer=null,c.renderScheduledAt=0),Mu(a,c)},error:()=>{Qn.get(a)===c&&(Tu(a,c.hardwareAcceleration),jm(c),Do.delete(a),Qn.delete(a))}}),configured:!1,configKey:"",hardwareAcceleration:fv(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},Qn.set(a,c),Do.add(a),c}function jm(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 hv(a){return a.latencyMode==="interactive"?s0:String(a.decodedFrames[0]?.pending?.frame.frameMode||a.decodedFrames[0]?.pending?.frame.mode||"").toLowerCase()==="mode4-h264-atlas"?i0:Cm}function pv(a,l=performance.now()){const s=hv(a);for(;a.decodedFrames.length>s;)Su(a,a.decodedFrames.shift());const r=a.latencyMode==="interactive"?uv:d0;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 gv(a,l){if(l.hardwareAcceleration!=="prefer-hardware"||l.flushTimer!==null||l.flushInFlight)return;const s=l.latencyMode==="interactive"?m0:f0,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>v0&&l.pendingFrames.delete(p);if(Qn.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{Qn.get(a)===l&&mu(l)}finally{l.flushInFlight=!1;const p=performance.now()-h;if(r&&p>=h0&&l.hardwareAcceleration==="prefer-hardware"){wu=!0,Tu(a,l.hardwareAcceleration),Ua(a);return}Qn.get(a)===l&&l.inputSerial>d&&l.pendingFrames.size>0&&(r||performance.now()-l.lastOutputAt>=s)&&gv(a,l)}},s)}function nx(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=mv(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"?C0(a,s.pending.frame):om(a,s.width,s.height,dv,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(pv(l,c),l.decodedFrames.length===0)return;if(l.latencyMode==="interactive"){const g=l.targetPaintIntervalMs<=c0,x=l.targetPaintIntervalMs<=20;if(x&&!l.interactiveBufferPrimed){l.interactiveBufferStartedAt<=0&&(l.interactiveBufferStartedAt=c,l.interactiveBufferWaitCount+=1);const j=l.decodedFrames.length>=r0,k=c-l.interactiveBufferStartedAt>=o0;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,w=l.lastPaintAt>0?l.lastPaintAt+s:c;if(!(!g||c+Jg>=w||v>=uv)){l.renderScheduledAt=performance.now(),l.renderTimer=window.requestAnimationFrame(r);return}const C=l.decodedFrames.shift();if(C)try{nx(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+u0;if(!(c+Jg>=d||l.decodedFrames.length>=Cm-1)){l.renderScheduledAt=performance.now(),l.renderTimer=window.requestAnimationFrame(r);return}const p=l.decodedFrames.shift();if(p)try{nx(a,l,p)}catch{}Mu(a,l)};l.renderScheduledAt=performance.now(),l.renderTimer=window.requestAnimationFrame(r)}function xv(a,l){if(Qn.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=Qn.get(a);if(!l||l.decoder.state==="closed"){Do.delete(a);continue}xv(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=Qn.get(a);if(l){Qn.delete(a);try{jm(l),l.decoder.state!=="closed"&&l.decoder.close()}catch{}}}function Of(a){a&&(yu.delete(a),im.delete(a),rm.delete(a),sm.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(),jm(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 E0(a,l){if(l.latencyMode!=="interactive"||l.hardwareAcceleration!=="prefer-hardware")return!1;const s=performance.now();if(s-l.healthSampleStartedAt<p0)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<g0||c/Math.max(1,r)>=x0?!1:(wu=!0,Tu(a,l.hardwareAcceleration),Ua(a),!0)}function ax(a,l=1){if(!a)return!1;const s=Qn.get(a);return s?(s.droppedForLatency+=Math.max(1,Math.min(1e4,Math.floor(l))),Ua(a),!0):!1}function D0(a){if(!a)return!1;const l=Qn.get(a);return l?xv(a,l):!1}function R0(a,l,s,r="interactive"){Ua(a);const c=performance.now(),d=a0(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=l0(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 w=mv(a,r),M=performance.now();b&&w?.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:w?.presentation||"sync",interactiveBufferWaitCount:0,interactiveBufferWaitMs:0,interactiveQueueDrainCount:0,visualHash:String(l.contentHash||""),visualChanged:Number(l.deltaVisualTileCount||0)>0,paintedAt:C})}function L0(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"&&b0(),v=g==="mode4-h264-atlas"?"prefer-software":fv(a,c==="interactive"&&(wu||x)?"prefer-software":r),w=[l.streamId||"",l.commandId||"",h,p,d,v,c].join("|");let M=tx(a,c);M.onPaint=s,M.configured&&M.decoder.state!=="configured"&&(M.configured=!1,M.configKey=""),M.configured&&M.configKey!==w&&(Ua(a),M=tx(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,w,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,w,v)}if(k>M.lastInputFrameSeq+1){if(mu(M,k-M.lastInputFrameSeq-1),!j)return;eu(M,C,w,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,w,v),M.keyFrameSeen=!0}const A=Math.max(1,Math.floor(l.durationUs||1e6/12)),_=M.nextChunkTimestampUs;M.nextChunkTimestampUs+=A,M.pendingFrames.set(_,{frame:l,queuedAt:performance.now(),queueSize:T}),M.inputSerial+=1,M.lastInputAt=performance.now();const q=new EncodedVideoChunk({type:j?"key":"delta",timestamp:_,duration:A,data:l.payload});try{M.decoder.decode(q)}catch(F){throw Ua(a),F}gv(a,M),E0(a,M)}async function Bf(a,l,s,r,c,d="smooth"){if(A0(l)){s()||R0(a,l,r,d);return}if(N0(l)){s()||L0(a,l,r,c,d);return}if(Eo.delete(a),j0(l)){Ua(a);const v=k0(l);if(s())return;(a.width!==v.width||a.height!==v.height)&&(a.width=v.width,a.height=v.height);const w=a.getContext("2d"),M=performance.now();w?.putImageData(v,0,0);const C=performance.now(),j=om(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 w=performance.now(),M=om(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,w-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:w})}p.close()}const Co=5179,dn=_o(`http://127.0.0.1:${Co}`);function _0(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 z0(a){const l=a.trim().toLowerCase();return l==="localhost"||l==="127.0.0.1"||l==="::1"||l==="[::1]"}function O0(a){const l=a.trim().toLowerCase();return!l||l==="0.0.0.0"||l==="::"||l==="[::]"}function B0(a){const l=_0(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 H0(a){return a.includes(":")&&!a.startsWith("[")?`[${a}]`:a}function F0(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||O0(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 I0(a){const l=F0(a);return l?_o(`http://${H0(l.host)}:${Co}`):""}function lx(a){const s=[a?.endpoint,...Array.isArray(a?.endpoint_candidates)?a.endpoint_candidates:[]].map(r=>I0(String(r||""))).filter(Boolean);return[...new Set(s)]}function jo(a=dn){if(!(typeof window>"u"||window.location.protocol!=="https:"))try{const l=new URL(a);if(l.protocol!=="http:")return;if(z0(l.hostname))return"loopback";if(B0(l.hostname))return"local"}catch{return}}function ku(a,l=dn){const s=new URL(a,_o(l));return s.protocol=s.protocol==="https:"?"wss:":"ws:",s.toString()}async function bt(a,l,s=dn){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 cm(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 ix="livedesk_remote_host_targets",U0="livedesk_entitlements";function $0(a){const s=(Array.isArray(a)?a:[a||dn]).map(r=>_o(r||dn));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 G0(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),w=m.useRef(new Map),M=Array.isArray(a)?a.join(`
10
+ `):String(a||""),C=m.useMemo(()=>$0(a),[M]),j=m.useMemo(()=>C.find(A=>jo(A)==="loopback")||C[0]||dn,[C]),k=m.useCallback(async()=>{if(!l){r(null),d([]),x(""),p("");return}let A=null;const _=Date.now(),q=C.filter(F=>(w.current.get(F)||0)<=_);if(q.length===0)throw new Error("No LiveDesk Hub endpoint is reachable. Retrying shortly.");for(const F of q)try{const[Z,D]=await Promise.all([bt("/api/remote/status",void 0,F),bt("/api/remote/devices",void 0,F)]);if(!Array.isArray(D.devices))throw new Error("Invalid Hub devices response.");w.current.delete(F),r(Z),d(D.devices),x(F),p("");return}catch(Z){A=Z,w.current.set(F,Date.now()+1e4)}throw x(""),A||new Error("No LiveDesk Hub endpoint is reachable.")},[l,C]),T=m.useCallback(()=>{w.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 _=async()=>{try{await k()}catch(F){A&&p(F instanceof Error?F.message:String(F))}};_();const q=window.setInterval(_,2500);return()=>{A=!1,window.clearInterval(q)}},[l,k,b]),{status:s,devices:c,error:h,refresh:T,hubBaseUrl:g||j,hubCandidates:C}}function P0(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(ix).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:ix,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(U0).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,K0=3e4,Q0=64*1024,X0=6,vv=new Map;function Z0(a){return vv.get(a)}const sx={totalSent:0,totalDropped:0,sentPerSecond:0,droppedPerSecond:0,bufferedAmount:0,lastInputType:"",lastInputSeq:0,lastRoundTripMs:0,lastAgentApplyMs:0,lastUpdatedAt:0};function rx(a){const l=Date.parse(String(a||""));if(!Number.isFinite(l))return 0;const s=Date.now()-l;return s>0&&s<=K0?s:0}function ox(a,l,s=dn,r={}){const[c,d]=m.useState(new Map),[h,p]=m.useState("idle"),[g,x]=m.useState(""),[b,v]=m.useState(No),w=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),_=m.useRef({totalFrames:0,totalBytes:0,sampleFrames:0,sampleBytes:0,sampleStartedAt:0}),q=m.useMemo(()=>[...a].sort().join(","),[a]),F=Number.isFinite(r.fps)?Number(r.fps):2,Z=Number.isFinite(r.maxWidth)?Number(r.maxWidth):640,D=Number.isFinite(r.maxHeight)?Number(r.maxHeight):360,ee=Number.isFinite(r.quality)?Number(r.quality):45,re=String(r.frameMode||r.mode||"mode3-h264-hw").trim()||"mode3-h264-hw",Y=r.streamPurpose==="control"?"control":"wall",de=m.useMemo(()=>{const H=Object.entries(r.monitorSelections||{}).filter(([Q])=>!!Q).sort(([Q],[J])=>Q.localeCompare(J));return JSON.stringify(Object.fromEntries(H))},[r.monitorSelections]);m.useEffect(()=>{A.current=r.onFrame},[r.onFrame]);const G=m.useCallback((H,Q="livedesk-frame-socket-release")=>{H.disposed=!0;try{H.socket.readyState===WebSocket.CONNECTING||H.socket.readyState===WebSocket.OPEN?H.socket.close(1e3,Q):H.socket.close()}catch{}},[]),oe=m.useCallback(()=>{const H=[...M.current.values()].map(Q=>Q.socket);if(H.length===0){p("idle");return}if(H.some(Q=>Q.readyState===WebSocket.OPEN)){p("open");return}if(H.some(Q=>Q.readyState===WebSocket.CONNECTING)){p("connecting");return}p("closed")},[]),le=m.useCallback((H,Q)=>{if(!H||H.byteLength<5)return;const J=Date.now(),te=new DataView(H).getUint32(0,!1);if(te<=0||te+4>H.byteLength)return;const fe=new Uint8Array(H.slice(4,4+te)),L=JSON.parse(new TextDecoder().decode(fe));if(Math.max(rx(L.receivedAt),rx(L.capturedAt))>V0)return;const we=H.slice(4+te),Se={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:J,byteLength:Number(L.byteLength||we.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:we};if(!Se.deviceId)return;const ze={streamId:Q.lastFrameStreamId,commandId:Q.lastFrameCommandId,order:Q.lastFrameOrder},qe=Number(Se.streamFrameSeq||Se.frameSeq||0),Oe=!!ze.commandId&&!!Se.commandId,_e=ze.streamId===Se.streamId&&(!Oe||ze.commandId===Se.commandId),Ge=ze.order;if(_e&&Ge>=qe&&(Ge===qe||Oe))return;Q.lastFrameStreamId=Se.streamId,Q.lastFrameCommandId=Se.commandId||"",Q.lastFrameOrder=qe;const Te=_.current;Te.totalFrames+=1,Te.totalBytes+=we.byteLength,Te.sampleFrames+=1,Te.sampleBytes+=we.byteLength,w.current.set(Se.deviceId,Se),A.current?.(Se)},[]);m.useEffect(()=>{const H=window.setInterval(()=>{const Q=performance.now(),J=_.current,z=Math.max(1,Q-J.sampleStartedAt);v({totalFrames:J.totalFrames,totalBytes:J.totalBytes,framesPerSecond:J.sampleFrames*1e3/z,bytesPerSecond:J.sampleBytes*1e3/z,sampleMs:z,lastUpdatedAt:Date.now()}),d(new Map(w.current)),J.sampleFrames=0,J.sampleBytes=0,J.sampleStartedAt=Q},2e3);return()=>{window.clearInterval(H)}},[]),m.useEffect(()=>{const H=q?q.split(",").filter(Boolean):[],Q=new Set(H),J=performance.now();for(const[z,te]of M.current.entries())Q.has(z)||(G(te,"livedesk-device-unsubscribed"),M.current.delete(z),w.current.delete(z));if(H.length===0){for(const z of M.current.values())G(z,"livedesk-no-devices");M.current.clear(),w.current=new Map,d(new Map),x(""),_.current={totalFrames:0,totalBytes:0,sampleFrames:0,sampleBytes:0,sampleStartedAt:0},v(No),oe();return}_.current.sampleStartedAt<=0&&(_.current.sampleStartedAt=J,v({...No,lastUpdatedAt:Date.now()}));for(const z of H){const te=r.monitorSelections?.[z],fe=Number.isFinite(Number(te))?{[z]:Number(te)}:{},L={type:"subscribe",deviceIds:[z],autoStartLive:l,fps:F,maxWidth:Z,maxHeight:D,quality:ee,mode:re,frameMode:re,streamPurpose:Y,forceRestart:Y==="control",restartReason:Y==="control"?"control-subscribe":"",monitorSelections:fe},xe=JSON.stringify(L),we=M.current.get(z),Se=!!we&&we.payloadKey!==xe;if(we){const _e=we.socket.readyState===WebSocket.CONNECTING||we.socket.readyState===WebSocket.OPEN;if(we.payloadKey===xe&&_e&&!we.disposed)continue;G(we,we.payloadKey===xe?"livedesk-frame-socket-refresh":"livedesk-subscription-replaced"),M.current.delete(z)}const ze=new WebSocket(ku(`/api/remote/frames/ws?devices=${encodeURIComponent(z)}`,s));ze.binaryType="arraybuffer";const qe=Se?{...L,forceRestart:!0,restartReason:"subscription-options-changed",restartToken:`${Date.now()}-${Math.random().toString(36).slice(2)}`}:L,Oe={socket:ze,payload:qe,payloadKey:xe,generation:C.current+1,disposed:!1,lastFrameStreamId:"",lastFrameCommandId:"",lastFrameOrder:-1};C.current=Oe.generation,M.current.set(z,Oe),ze.addEventListener("open",()=>{if(Oe.disposed||M.current.get(z)!==Oe){G(Oe,"livedesk-stale-frame-socket");return}x(""),ze.send(JSON.stringify(Oe.payload)),oe()}),ze.addEventListener("message",_e=>{if(Oe.disposed||M.current.get(z)!==Oe)return;if(typeof _e.data=="string"){try{const Te=JSON.parse(_e.data);if(Te?.type==="RemoteFrameSubscriptionError")x(String(Te.error||"control-stream-start-failed"));else if(Te?.type==="RemoteFrameLiveAutoStart"){const ne=(Array.isArray(Te.skipped)?Te.skipped:[]).find(pe=>pe?.deviceId===z);ne?x(String(ne.reason||"control-stream-start-failed")):Array.isArray(Te.started)&&Te.started.some(pe=>pe?.deviceId===z)&&x("")}}catch{}return}const Ge=_e.data instanceof ArrayBuffer?_e.data:null;Ge&&(x(""),le(Ge,Oe))}),ze.addEventListener("error",()=>{Oe.disposed||M.current.get(z)!==Oe||(x("frame-socket-error"),p("error"))}),ze.addEventListener("close",()=>{const _e=!Oe.disposed;Oe.disposed=!0;const Ge=M.current.get(z);if(Ge===Oe&&M.current.delete(z),oe(),_e&&Ge===Oe){const Te=window.setTimeout(()=>{j.current.delete(Te),T(Ct=>Ct+1)},750);j.current.add(Te)}})}oe()},[l,G,q,F,re,le,s,D,Z,de,r.monitorSelections,ee,k,Y,oe]),m.useEffect(()=>()=>{for(const H of M.current.values())G(H,"livedesk-hook-unmount");M.current.clear();for(const H of j.current)window.clearTimeout(H);j.current.clear()},[G]);const ce=m.useCallback((H,Q="browser-stale")=>{const J=Array.isArray(H)&&H.length>0?H:q.split(",").filter(Boolean);if(J.length===0)return!1;let z=!1;for(const te of J){const fe=M.current.get(te);!fe||fe.socket.readyState!==WebSocket.OPEN||(fe.socket.send(JSON.stringify({...fe.payload,type:"restart-live",deviceIds:[te],forceRestart:!0,restartReason:Q,restartToken:`${Date.now()}-${Math.random().toString(36).slice(2)}`})),z=!0)}return z},[q]);return{frames:c,state:h,error:g,stats:b,restartLive:ce}}function W0(a,l,s=dn,r={}){const[c,d]=m.useState(null),[h,p]=m.useState(null),[g,x]=m.useState("idle"),[b,v]=m.useState(No),w=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]),_=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]),q=m.useMemo(()=>JSON.stringify(_),[_]),F=m.useRef(_);F.current=_;const Z=l&&_.deviceIds.length>0,D=m.useCallback(re=>re.readyState!==WebSocket.OPEN?!1:(re.send(JSON.stringify({type:"configure",...F.current})),!0),[]);m.useEffect(()=>{M.current=r.onFrame},[r.onFrame]),m.useEffect(()=>{const re=window.setInterval(()=>{const Y=k.current,de=performance.now(),G=Math.max(1,de-Y.sampleStartedAt);v({totalFrames:Y.totalFrames,totalBytes:Y.totalBytes,framesPerSecond:Y.sampleFrames*1e3/G,bytesPerSecond:Y.sampleBytes*1e3/G,sampleMs:G,lastUpdatedAt:Date.now()});const oe=C.current;oe&&oe.frameSeq!==j.current&&(j.current=oe.frameSeq,d(oe)),Y.sampleFrames=0,Y.sampleBytes=0,Y.sampleStartedAt=de},1e3);return()=>window.clearInterval(re)},[]),m.useEffect(()=>{if(!Z){w.current?.close(),w.current=null,d(null),C.current=null,j.current=0,p(null),x("idle"),v(No);return}let re=!1,Y=0;const de=()=>{if(re)return;const G=new WebSocket(ku("/api/remote/atlas/ws",s));G.binaryType="arraybuffer",w.current=G,x("connecting"),G.addEventListener("open",()=>{k.current.sampleStartedAt=performance.now(),x("open"),D(G)}),G.addEventListener("message",oe=>{if(typeof oe.data=="string"){try{const ce=JSON.parse(oe.data);ce?.type==="Mode4AtlasLayout"&&p({layoutVersion:Number(ce.layoutVersion||0),width:Number(ce.width||1920),height:Number(ce.height||1080),columns:Number(ce.columns||1),rows:Number(ce.rows||1),tiles:Array.isArray(ce.tiles)?ce.tiles:[]})}catch{}return}const le=oe.data instanceof ArrayBuffer?oe.data:null;if(!(!le||le.byteLength<5))try{const ce=Date.now(),Q=new DataView(le).getUint32(0,!1);if(Q<=0||Q+4>le.byteLength)return;const J=JSON.parse(new TextDecoder().decode(new Uint8Array(le,4,Q))),z=le.slice(4+Q),te={deviceId:String(J.deviceId||"__livedesk_mode4_atlas__"),kind:"live",frameSeq:Number(J.frameSeq||0),streamFrameSeq:Number(J.streamFrameSeq||0)||void 0,streamId:String(J.streamId||"mode4-atlas"),commandId:J.commandId?String(J.commandId):void 0,width:Number(J.width||1920),height:Number(J.height||1080),sourceWidth:Number(J.sourceWidth||J.width||1920),sourceHeight:Number(J.sourceHeight||J.height||1080),mimeType:String(J.mimeType||"video/h264"),mode:String(J.mode||"mode4-h264-atlas"),frameMode:String(J.frameMode||"mode4-h264-atlas"),frameProfile:String(J.frameProfile||"mode4-h264-atlas-v1"),encoding:String(J.encoding||"video-atlas"),codec:String(J.codec||"h264"),compression:String(J.compression||"video/h264"),h264Format:String(J.h264Format||"annexb"),isKeyFrame:J.isKeyFrame===!0,chunkType:String(J.chunkType||""),timestampUs:Number(J.timestampUs||0),durationUs:Number(J.durationUs||0),hardwareEncoder:J.hardwareEncoder?String(J.hardwareEncoder):void 0,platformProfile:J.platformProfile?String(J.platformProfile):void 0,capturedAt:String(J.capturedAt||""),receivedAt:String(J.receivedAt||""),hubPacketAt:J.hubPacketAt?String(J.hubPacketAt):void 0,hubPacketEpochMs:Number(J.hubPacketEpochMs||0)||void 0,browserReceivedEpochMs:ce,byteLength:z.byteLength,layoutVersion:Number(J.layoutVersion||0),atlasComposeMs:Number(J.atlasComposeMs||0),atlasPoolStarved:Number(J.atlasPoolStarved||0),atlasReadyTiles:Number(J.atlasReadyTiles||0),atlasTileCount:Number(J.atlasTileCount||0),payload:z},fe=k.current;fe.totalFrames+=1,fe.totalBytes+=z.byteLength,fe.sampleFrames+=1,fe.sampleBytes+=z.byteLength,C.current=te,j.current===0&&(j.current=te.frameSeq,d(te)),M.current?.(te)}catch{}}),G.addEventListener("error",()=>x("error")),G.addEventListener("close",()=>{w.current===G&&(w.current=null),!re&&(x("closed"),Y=window.setTimeout(de,1200))})};return de(),()=>{re=!0,window.clearTimeout(Y),w.current?.close(),w.current=null}},[Z,s,D]),m.useEffect(()=>{if(!Z)return;const re=w.current;re&&D(re)},[q,Z,D]);const ee=m.useCallback(()=>{const re=w.current;return re?D(re):!1},[D]);return{frame:c,layout:h,state:g,stats:b,refreshInputs:ee}}function J0(a,l=dn){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(sx),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(sx);return}const w=new WebSocket(ku("/api/remote/input/ws",l));return s.current=w,b.current.sampleStartedAt=performance.now(),p("connecting"),w.addEventListener("open",()=>p("open")),w.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{}}),w.addEventListener("close",()=>p("closed")),w.addEventListener("error",()=>p("error")),()=>{w.close(),d.current.clear(),s.current===w&&(s.current=null)}},[a,l]),m.useEffect(()=>{if(!a)return;const w=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(w)},[a]);const v=m.useCallback((w,M)=>{const C=s.current;if(!C||C.readyState!==WebSocket.OPEN||!w)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 _=Date.now(),q=!k||A-c.current>=X0;for(q&&(d.current.set(A,performance.now()),k&&(c.current=A)),k||vv.set(w,{inputSeq:A,inputType:j||"input",sentAt:performance.now()});d.current.size>256;){const F=d.current.keys().next().value;if(F===void 0)break;d.current.delete(F)}return C.send(JSON.stringify({type:"input",requestId:k?"":crypto.randomUUID(),fireAndForget:k,deviceId:w,input:{...M,inputSeq:A,requestAck:q,issuedAtEpochMs:_,issuedAt:new Date(_).toISOString()}})),T.totalSent+=1,T.sampleSent+=1,T.lastInputType=j||"input",!0},[]);return{state:h,sendInput:v,stats:g}}function ew(a){const l=String(a||"").toLowerCase();return l.includes("audio/pcm")||l.includes("audio/l16")||l.includes("f32le")||l.includes("s16le")}function tw(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 w=0;w<r;w+=1){const M=b.getChannelData(w);for(let C=0;C<x;C+=1){const k=(C*r+w)*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 nw(a,l,s=dn){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 w=new v;r.current=w,c.current=w.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]})),w.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 _=new Uint8Array(k.slice(4,4+A)),q=JSON.parse(new TextDecoder().decode(_)),F=k.slice(4+A),Z={deviceId:String(q.deviceId||""),frameSeq:Number(q.frameSeq||0),streamId:String(q.streamId||""),mimeType:String(q.mimeType||"audio/webm;codecs=opus"),sampleRate:Number(q.sampleRate||48e3),channels:Number(q.channels||2),capturedAt:String(q.capturedAt||""),receivedAt:String(q.receivedAt||""),byteLength:Number(q.byteLength||F.byteLength),payload:F};if(!Z.deviceId||C)return;const D=ew(Z.mimeType)?tw(w,Z,F):await w.decodeAudioData(F.slice(0));if(C)return;const ee=w.createBufferSource();ee.buffer=D,ee.connect(w.destination);const re=Math.max(w.currentTime+.02,c.current);ee.start(re),c.current=re+D.duration,g(Z),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(),w.close().catch(()=>{}),r.current===w&&(r.current=null)}},[a,l,s]),{state:d,lastFrame:p,error:x}}const aw=[{id:"pin",label:"PIN",icon:Eb},{id:"wall",label:"Wall",icon:Hg},{id:"control",label:"Control",icon:Hg}];function lw({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:aw.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 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})}function rw({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 Nm(a,l){return typeof a=="function"?typeof l=="object"?a(l):a():a}function lr(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 ow(a,l="data-id"){const s=lr(a,l);return s?s.getAttribute(l):null}function Ro(a,l="data-id"){const s=lr(a,l);return s?Eu(s,l):null}function Eu(a,l="data-id"){const s=a.getAttribute(l);return s?cw(s):null}function nn(a){return typeof a=="string"?":"+a:a}function cw(a){if(a.startsWith(":"))return a.substring(1);const l=a*1;return isNaN(l)?a:l}function uw(){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 Xn=uw();function Am(a){Object.assign(Xn,a)}function cx(a,l,s){function r(c){const d=lr(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)}Xn.addEvent(a,s,r)}function ir(a,l){cx(a,l,"click"),l.dblclick&&cx(a,l.dblclick,"dblclick")}function dw(a,l){for(let s=a.length-1;s>=0;s--)if(a[s]===l){a.splice(s,1);break}}function fw(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 yv=new Date,Cu=!1,tu=[],Fl=[],ux=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>yv)&&!r.contains(l)&&r!==l&&(fw(r,l,s)||(d.callback&&d.callback(a),d.modal||a.defaultPrevented)))break}},mw=a=>{yv=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=[Xn.addGlobalEvent("click",ux,a),Xn.addGlobalEvent("contextmenu",ux,a),Xn.addGlobalEvent("mousedown",mw,a)]),typeof l!="object"&&(l={callback:l});const s={node:a,date:new Date,props:l};return Fl.push(s),{destroy(){dw(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,dx=a=>a.indexOf("fit")!==-1,ho=a=>a.indexOf("overlap")!==-1,hw=a=>a.split("-").every(l=>["center","fit"].indexOf(l)>-1),pw=a=>{const l=a.match(/(start|center|end)/);return l?l[0]:null};function gw(a,l){let s=0;const r=Xn.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 Gt,pn,po,un;function bv(a,l,s="bottom",r=0,c=0){if(!a)return null;Gt=r,pn=c,po="auto";let d=0,h=0,p=s;const g=wv(a),x=ho(s)?Xn.getTopNode(a):g;if(!g)return null;const b=g.getBoundingClientRect(),v=a.getBoundingClientRect(),w=x.getBoundingClientRect(),M=window.getComputedStyle(x),C={left:0,top:0,bottom:0,right:0};for(const q in C){const F=`border-${q}-width`;C[q]=parseFloat(M.getPropertyValue(F))}if(l){const q=gw(l,g);d=Math.max(q+1,20)}if(l){if(un=l.getBoundingClientRect(),dx(s)&&(po=un.width+"px"),s!=="point")if(hw(s))dx(s)?Gt=0:(Gt=w.width/2,h=1),pn=(w.height-v.height)/2;else{const q=ho(s)?0:1;Gt=lu(s)?un.right+q:un.left-q,pn=nu(s)?un.bottom+1:un.top;const F=pw(s);F&&(lu(s)||au(s)?F==="center"?pn-=(v.height-un.height)/2:F==="end"&&(pn-=v.height-un.height):(nu(s)||Hf(s))&&(F==="center"?Gt-=(v.width-un.width)/2:F==="end"&&(Gt-=v.width-un.width),ho(s)||(Gt+=1)))}}else un={left:r,right:r,top:c,bottom:c};const j=(au(s)||lu(s))&&(nu(s)||Hf(s));au(s)&&(h=2);const k=Gt-v.width-w.left;l&&au(s)&&!j&&k<0&&(Gt=un.right,h=0,p=p.replace("left","right"));const T=Gt+v.width*(1-h/2)-w.right;if(T>0)if(!lu(s))Gt=w.right-C.right-v.width;else{const q=un.left-w.x-v.width;l&&!j&&q>=0?(Gt=un.left-v.width,p=p.replace("right","left")):Gt-=T+C.right}h&&(Gt=Math.round(Gt-v.width*h/2));const A=k<0||T>0||!j;Hf(s)&&(pn=un.top-v.height,l&&pn<w.y&&A&&(pn=un.bottom,p=p.replace("top","bottom")));const _=pn+v.height-w.bottom;return _>0&&(l&&nu(s)&&A?(pn-=v.height+un.height+1,p=p.replace("bottom","top")):pn-=_+C.bottom),Gt-=b.left+C.left,pn-=b.top+C.top,Gt=(ho(s)?Gt:Math.max(Gt,0))+x.scrollLeft,pn=(ho(s)?pn:Math.max(pn,0))+x.scrollTop,po=po||"auto",{at:p,x:Gt,y:pn,z:d,width:po}}function wv(a){const l=Xn.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 xw(a){const l=[];let s=a;const r=Xn.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 fx=new Date().valueOf();function Tm(){return fx+=1,fx}function xn(a){return a<10?"0"+a:a.toString()}function vw(a){const l=xn(a);return l.length==2?"0"+l:l}function Sv(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 mx=["",""];function yw(a,l,s){switch(a){case"%d":return xn(l.getDate());case"%m":return xn(l.getMonth()+1);case"%j":return l.getDate();case"%n":return l.getMonth()+1;case"%y":return xn(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 xn((l.getHours()+11)%12+1);case"%g":return(l.getHours()+11)%12+1;case"%G":return l.getHours();case"%H":return xn(l.getHours());case"%i":return xn(l.getMinutes());case"%a":return((l.getHours()>11?s.pm:s.am)||mx)[0];case"%A":return((l.getHours()>11?s.pm:s.am)||mx)[1];case"%s":return xn(l.getSeconds());case"%S":return vw(l.getMilliseconds());case"%W":return xn(Ff(l));case"%w":{const r=s.weekStart??1;if(r===1)return xn(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)),xn(Ff(h))}case"%c":{let r=l.getFullYear()+"";return r+="-"+xn(l.getMonth()+1),r+="-"+xn(l.getDate()),r+="T",r+=xn(l.getHours()),r+=":"+xn(l.getMinutes()),r+=":"+xn(l.getSeconds()),r}case"%Q":return Math.floor(l.getMonth()/3)+1;default:return a}}var bw=/%[a-zA-Z]/g;function tr(a,l){return typeof a=="function"?a:function(s){return s?(s.getMonth||(s=new Date(s)),a.replace(bw,r=>yw(r,s,l))):""}}function hx(a){return a&&typeof a=="object"&&!Array.isArray(a)}function um(a,l){for(const s in l){const r=l[s];hx(a[s])&&hx(r)?a[s]=um({...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=um({...l},a):r=um({...a},l),zo(r)}}}var ww=rv();const Sw="en-US",Mw={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},Cw={ok:"OK",cancel:"Cancel",select:"Select","No data":"No data","Rows per page":"Rows per page","Total pages":"Total pages"},jw={timeFormat:"%H:%i",dateFormat:"%m/%d/%Y",monthYearFormat:"%F %Y",yearFormat:"%Y"},Mv={core:Cw,calendar:Mw,formats:jw,lang:Sw},km=m.createContext(""),Cv=m.createContext({}),$a=m.createContext(null),jv=m.createContext(null),ln=Object.freeze(Object.defineProperty({__proto__:null,fieldId:jv,helpers:Cv,i18n:$a,theme:km},Symbol.toStringTag,{value:"Module"}));function Nv(a){const l=m.useContext(jv),[s]=m.useState(()=>a||l||Tm());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(w=>w!=="").map(w=>"wx-"+w).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 Nw({id:a,label:l="",inputValue:s="",value:r=!1,onChange:c,disabled:d=!1,css:h=""}){const p=Nv(a),[g,x]=al(r),b=({target:v})=>{const w=v.checked;x(w),c&&c({value:w,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 Em({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(km);return m.useEffect(()=>{h(l||Aw(c.current)||Xn.getTopNode(c.current))},[c.current]),o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:c,style:{display:"none"}}),c.current&&d?ww.createPortal(o.jsx("div",{className:`wx-3ZWsT0 wx-${a||p}-theme`,children:s}),d):null]})}function Aw(a){const l=Xn.getTopNode(a);for(;a&&a!==l&&!a.getAttribute("data-wx-portal-root");)a=a.parentNode;return a}function Tw({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,w]=m.useState(0),[M,C]=m.useState("auto"),[j,k]=m.useState(!1),T=m.useRef(null),A=m.useRef(null),_=m.useRef(h);m.useEffect(()=>{_.current=h},[h]);function q(Z){return r&&(c+"").indexOf("%")>-1?c.replace(/(\d+)%/,(D,ee)=>(ee=ee*r.offsetWidth/100+"px",c.replace(D,ee))):c&&c!=="auto"?c:Z}const F=m.useCallback(()=>{if(!T.current)return;const Z=bv(T.current,r,s,a,l);Z&&(b(Z.x),w(Z.y),C(q(Z.width)))},[T,r,s,a,l,c]);return m.useLayoutEffect(()=>{const Z=ee=>{_.current&&ee.target!==A.current&&T.current&&!T.current.contains(ee.target)&&_.current(ee)};let D;return requestAnimationFrame(()=>{F(),k(!0),g&&T.current&&(A.current=wv(T.current),A.current&&A.current.addEventListener("scroll",Z,!0)),r&&(D=new ResizeObserver(F),D.observe(r))}),()=>{g&&A.current&&A.current.removeEventListener("scroll",Z,!0),D?.disconnect()}},[]),m.useLayoutEffect(()=>{F()},[r,s,a,l]),m.useEffect(()=>{const Z=D=>{_.current&&_.current(D)};if(T.current)return ll(T.current,{callback:Z,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 kw({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),w=m.useRef(r);return m.useEffect(()=>{w.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=>{w.current&&w.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 Dm({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(kw,{onCancel:c,position:a,align:l,autoFit:s,width:d,...p,children:h}):o.jsx(Em,{children:o.jsx(Tw,{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(Mv)}function Ew(){let a=null,l=!1,s=!1,r,c,d,h;const p=(v,w,M,C,j)=>{r=v,c=w,d=M,h=C,s=j},g=v=>{a=v,l=a!==null,d(a)},x=(v,w)=>{if(!s&&v!==null&&r){const M=r.querySelectorAll(".wx-list > .wx-item")[v];M&&(M.scrollIntoView({block:"nearest"}),w&&w.preventDefault())}},b=(v,w)=>{const M=v===null?null:Math.max(0,Math.min(a+v,c.length-1));M!==a&&(g(M),r?x(M,w):requestAnimationFrame(()=>x(M,w)))};return{move:v=>{const w=Ro(v),M=c.findIndex(C=>C.id===w);M!==a&&g(M)},keydown:(v,w)=>{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:w||0,v);break;case"ArrowUp":b(l?-1:w||0,v);break}},init:p,navigate:b}}const px=10,Dw=m.memo(function({data:a,checkboxes:l,itemTemplate:s,value:r}){return o.jsxs(o.Fragment,{children:[l&&o.jsx(Nw,{id:a.id,css:"wx-list-checkbox",value:r&&r.includes(a.id)}),s?Nm(s,{option:a}):a.label]})});function gx({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(Dw,{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(Ew()),[w,M]=m.useState(null),C=m.useRef(w),[j,k]=m.useState(0),[T,A]=m.useState(24),_=m.useRef(!1),q=(m.useContext($a)||Du()).getGroup("core"),F=m.useRef(a);m.useEffect(()=>{F.current=a},[a]);const Z=m.useRef(p);m.useEffect(()=>{Z.current=p},[p]);const D=m.useRef(0);m.useEffect(()=>{D.current=T},[T]);const ee=m.useCallback(L=>{L&&L.stopPropagation();const xe=F.current,we=Z.current,Se=C.current;let ze;const qe=xe[Se]?.id;h?we&&we.includes(qe)?ze=we.filter(Oe=>Oe!==qe):ze=[...we||[],qe]:ze=qe,s&&s({id:ze})},[h,s]),re=m.useRef(ee);m.useEffect(()=>{re.current=ee},[ee]);const Y=m.useCallback(L=>{if(x.current){let xe=L*D.current-x.current.clientHeight+D.current;k(xe),x.current.scrollTop=xe}},[D.current]),de=m.useCallback(L=>{x.current=L,c&&(L&&!b.current&&C.current!==null&&requestAnimationFrame(()=>{x.current&&(Y(C.current),b.current=!0)}),L||(b.current=!1))},[Y]),G=m.useCallback(L=>{if(!L||_.current)return;const xe=L.getBoundingClientRect().height;xe&&(A(xe),D.current=xe,_.current=!0)},[]);m.useEffect(()=>{v.current.init(x.current,a,L=>{M(L),C.current=L},L=>re.current(L),c)},[a,x.current,c]),m.useEffect(()=>{const L=(we,Se)=>{v.current.navigate(we,Se),Y(C.current)},xe=(we,Se)=>{const ze=C.current,qe=F.current;if(ze!==0&&ze!==qe.length-1&&(we.key==="ArrowDown"||we.key==="ArrowUp")&&we.preventDefault(),v.current.keydown(we,Se),x.current){const Oe=x.current.scrollTop<=C.current*D.current,_e=x.current.scrollTop+x.current.clientHeight>=C.current*D.current+D.current;Oe?_e||Y(C.current):(x.current.scrollTop=C.current*D.current,k(x.current.scrollTop))}};r&&r({navigate:c?L:v.current.navigate,keydown:c?xe: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 ce=m.useCallback(()=>{v.current.navigate(null)},[v]),H=m.useCallback(L=>{c&&k(L.target.scrollTop)},[c]),Q=m.useMemo(()=>Math.ceil((x.current?.clientHeight||0)/T),[T,j]),J=m.useMemo(()=>{if(!c)return{start:0,end:a.length};if(!a.length)return{start:0,end:0};const L=Math.floor(j/T),xe=L+Q;return{start:Math.max(0,L-px),end:Math.min(a.length,xe+px)}},[c,a,j,T,Q]),z=m.useMemo(()=>{if(!c)return a;const{start:L,end:xe}=J;return a.slice(L,xe).map(we=>({...we}))},[c,a,J]),te=J.start*T,fe=a.length*T;return m.useEffect(()=>{c&&k(0)},[a,c]),m.useEffect(()=>{w===null&&(b.current=!1)},[w]),w===null?null:o.jsx(Dm,{onCancel:ce,...g,children:o.jsx("div",{className:"wx-233fr7 wx-list",ref:de,onClick:ee,onMouseMove:v.current.move,onScroll:H,children:a.length?c?o.jsx("div",{className:"wx-233fr7 wx-list-wrapper",style:{height:`${fe}px`},children:o.jsx("div",{className:"wx-233fr7 wx-list-content",style:{transform:`translateY(${te}px)`},children:o.jsx(gx,{visibleRange:J,visibleItems:z,navIndex:w,measureRefCallback:G,checkboxes:d,itemTemplate:l,value:p})})}):o.jsx(gx,{visibleRange:J,visibleItems:z,navIndex:w,measureRefCallback:G,checkboxes:d,itemTemplate:l,value:p}):o.jsx("div",{className:"wx-233fr7 wx-no-data",children:q("No data")})})},oe.current)}function Rm({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:w="",clear:M=!1,onChange:C}){const j=Nv(l),[k,T]=al(a),A=m.useRef(null),_=m.useMemo(()=>w&&v.indexOf("wx-icon-left")===-1?"wx-icon-right "+v:v,[w,v]),q=m.useMemo(()=>w&&v.indexOf("wx-icon-left")!==-1,[w,v]);m.useEffect(()=>{const re=setTimeout(()=>{r&&A.current&&A.current.focus(),c&&A.current&&A.current.select()},1);return()=>clearTimeout(re)},[r,c]);const F=m.useCallback(re=>{const Y=re.target.value;T(Y),C&&C({value:Y,input:!0})},[C]),Z=m.useCallback(re=>C&&C({value:re.target.value}),[C]);function D(re){re.stopPropagation(),T(""),C&&C({value:""})}let ee=d;return d!=="password"&&d!=="number"&&(ee="text"),m.useEffect(()=>{const re=Z,Y=A.current;return Y.addEventListener("change",re),()=>{Y&&Y.removeEventListener("change",re)}},[Z]),o.jsxs("div",{className:`wx-hQ64J4 wx-text ${_} ${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:F}),M&&!p&&k?o.jsxs(o.Fragment,{children:[o.jsx("i",{className:"wx-hQ64J4 wx-icon wxi-close",onClick:D}),q&&o.jsx("i",{className:`wx-hQ64J4 wx-icon ${w}`})]}):w?o.jsx("i",{className:`wx-hQ64J4 wx-icon ${w}`}):null]})}function Rw({date:a,type:l,part:s,onShift:r}){const{calendar:c,formats:d}=m.useContext($a).getRaw(),h=a.getFullYear(),p=m.useMemo(()=>{switch(l){case"month":return tr(d.monthYearFormat,c)(a);case"year":return tr(d.yearFormat,c)(a);case"duodecade":{const{start:x,end:b}=Sv(h),v=tr(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 Lm({onClick:a,children:l}){return o.jsx("button",{className:"wx-3s8W4d wx-button",onClick:a,children:l})}function Lw({value:a,current:l,part:s="",markers:r=null,css:c="",onCancel:d,onChange:h}){const p=(m.useContext($a)||Du()).getRaw().calendar,g=(p.weekStart||7)%7,x=p.dayShort.slice(g).concat(p.dayShort.slice(0,g)),b=(F,Z,D)=>new Date(F.getFullYear(),F.getMonth()+(Z||0),F.getDate()+(D||0));let v=s!=="normal";function w(F){const Z=F.getDay();return Z===0||Z===6}function M(){const F=b(l,0,1-l.getDate());return F.setDate(F.getDate()-(F.getDay()-(g-7))%7),F}function C(){const F=b(l,1,-l.getDate());return F.setDate(F.getDate()+(6-F.getDay()+g)%7),F}const j=m.useRef(0);function k(F,Z){Z.timeStamp!==j.current&&(j.current=Z.timeStamp,Z.stopPropagation(),h&&h(new Date(F)),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 F=M(),Z=C(),D=l.getMonth();let ee=[];for(let re=F;re<=Z;re.setDate(re.getDate()+1)){const Y={day:re.getDate(),in:re.getMonth()===D,date:re.valueOf()};let de="";if(de+=Y.in?"":" wx-inactive",de+=T.indexOf(Y.date)>-1?" wx-selected":"",v){const G=Y.date==T[0],oe=Y.date==T[1];G&&!oe?de+=" wx-left":oe&&!G&&(de+=" wx-right"),Y.date>T[0]&&Y.date<T[1]&&(de+=" wx-inrange")}if(de+=w(re)?" wx-weekend":"",r){const G=r(re);G&&(de+=" "+G)}ee.push({...Y,css:de})}return ee},[l,T,v,r]),_=m.useRef(null);let q=m.useRef({});return q.current.click=k,m.useEffect(()=>{ir(_.current,q.current)},[]),o.jsxs("div",{className:`wx-398RBS wx-month ${c}`,children:[o.jsx("div",{className:"wx-398RBS wx-weekdays",children:x.map(F=>o.jsx("div",{className:"wx-398RBS wx-weekday",children:F},F))}),o.jsx("div",{className:"wx-398RBS wx-days",ref:_,children:A.map(F=>o.jsx("div",{className:`wx-398RBS wx-day ${F.css} ${F.in?"":"wx-out"}`,"data-id":F.date,children:F.day},F.date))})]})}function _w({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($a).getRaw().calendar,w=v.monthShort||[],M=m.useMemo(()=>x.getMonth(),[x]),C=m.useCallback((T,A)=>{if(T!=null){A.stopPropagation();const _=new Date(x);_.setMonth(T),b(_),d&&d({current:_})}s==="normal"&&g(new Date(x)),r&&r()},[x,s,d,r]),j=m.useCallback(()=>{const T=new Date(Av(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 _=parseInt(A.getAttribute("data-id"),10);C(_,T)}},[C]);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-34U8T8 wx-months",onClick:k,children:w.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(Lm,{onClick:j,children:v.done})})]})}const If="wx-1XEF33",zw=({value:a,current:l,onCancel:s,onChange:r,onShift:c,part:d})=>{const h=m.useContext($a).getRaw().calendar,[p,g]=al(l),[x,b]=al(a),v=m.useMemo(()=>p.getFullYear(),[p]),w=m.useMemo(()=>{const{start:T,end:A}=Sv(v),_=[];for(let q=T;q<=A;++q)_.push(q);return _},[v]),M={click:C};function C(T,A){if(T){A.stopPropagation();const _=new Date(p);_.setFullYear(T),g(_),c&&c({current:_})}d==="normal"&&b(new Date(p)),s&&s()}function j(){const T=new Date(Av(x,d)||p);T.setFullYear(p.getFullYear()),r&&r(T)}const k=m.useRef(null);return m.useEffect(()=>{k.current&&ir(k.current,M)},[]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:If+" wx-years",ref:k,children:w.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(Lm,{onClick:j,children:h.done})})]})},xx={month:{component:Lw,next:Bw,prev:Ow},year:{component:_w,next:Fw,prev:Hw},duodecade:{component:zw,next:Uw,prev:Iw}};function Ow(a){return a=new Date(a),a.setMonth(a.getMonth()-1),a}function Bw(a){return a=new Date(a),a.setMonth(a.getMonth()+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()+1),a}function Iw(a){return a=new Date(a),a.setFullYear(a.getFullYear()-10),a}function Uw(a){return a=new Date(a),a.setFullYear(a.getFullYear()+10),a}function Av(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 $w=["clear","today"];function qw(a){if(a==="done")return-1;if(a==="clear")return null;if(a==="today")return new Date}function Gw({value:a,current:l,onCurrentChange:s,part:r="normal",markers:c=null,buttons:d,css:h="",onShift:p,onChange:g}){const x=m.useContext($a).getGroup("calendar"),[b,v]=m.useState("month"),w=Array.isArray(d)?d:d?$w:[],M=(A,_)=>{A.preventDefault(),g&&g({value:_})},C=()=>{b==="duodecade"?v("year"):b==="year"&&v("month")},j=A=>{const{diff:_,current:q}=A;if(_===0){b==="month"?v("year"):b==="year"&&v("duodecade");return}if(_){const F=xx[b];s(_>0?F.next(l):F.prev(l))}else q&&s(q);p&&p()},k=A=>{v("month"),g&&g({select:!0,value:A})},T=m.useMemo(()=>xx[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(Rw,{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"&&w.length>0&&o.jsx("div",{className:"wx-2Gr4AS wx-buttons",children:w.map(A=>o.jsx("div",{className:"wx-2Gr4AS wx-button-item",children:o.jsx(Lm,{onClick:_=>M(_,qw(A)),children:x(A)})},A))})]})]})})}function _m(a){let{words:l=null,optional:s=!1,children:r}=a,c=m.useContext($a);const d=m.useMemo(()=>{let h=c;return(!h||!h.extend)&&(h=zo(Mv)),l!==null&&(h=h.extend(l,s)),h},[l,s,c]);return o.jsx($a.Provider,{value:d,children:r})}function vx(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 Pw=["clear","today"];function Tv({value:a,current:l,markers:s=null,buttons:r=Pw,css:c="",onChange:d}){const[h,p]=al(a),[g,x]=al(l);m.useEffect(()=>{vx(g,h,x,!1)},[h,g]);const b=m.useCallback(w=>{const M=w.value;M?(p(new Date(M)),vx(g,new Date(M),x,!0)):p(null),d&&d({value:M?new Date(M):null})},[d,g]),v=m.useCallback(w=>{x(w)},[x]);return g?o.jsx(_m,{children:o.jsx(Gw,{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 Kw({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:w,dropdown:M={}}){const{calendar:C,formats:j}=(m.useContext($a)||Du()).getRaw(),k=d||j?.dateFormat;let T=typeof k=="function"?k:tr(k,C);const[A,_]=m.useState(a),[q,F]=m.useState(!1);m.useEffect(()=>{_(a)},[a]);function Z(){F(!1)}function D(Y){const de=Y===A||Y&&A&&Y.valueOf()===A.valueOf()||!Y&&!A;_(Y),de||w&&w({value:Y}),setTimeout(Z,1)}const ee=m.useMemo(()=>A?T(A):"",[A,T]);function re({value:Y,input:de}){if(!b&&!v||de)return;let G=typeof b=="function"?b(Y):Y?new Date(Y):null;G=isNaN(G)?A||null:G||null,D(G)}return m.useEffect(()=>{const Y=Z;return window.addEventListener("scroll",Y),()=>window.removeEventListener("scroll",Y)},[]),o.jsxs("div",{className:"wx-1lKOFG wx-datepicker",onClick:()=>F(!0),children:[o.jsx(Rm,{css:`wx-date-input ${p}`,title:g,tooltip:x,value:ee,id:l,readonly:!b,disabled:s,error:r,placeholder:c,onInput:Z,onChange:re,icon:"wxi-calendar",clear:v}),q&&!s&&o.jsx(Dm,{onCancel:Z,...Yw(M),children:o.jsx(Tv,{buttons:h,value:A,onChange:Y=>D(Y.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:w,dropdown:M={}}){const C=m.useRef(null),j=m.useRef(null);let[k,T]=al(a);function A(D){C.current=D.navigate,j.current=D.keydown}const _=m.useMemo(()=>k||k===0?(s||l).find(D=>D.id===k):null,[k,s,l]),q=m.useCallback(({id:D})=>{(D||D===0)&&(T(D),C.current(null),w&&w({value:D}))},[T,w]),F=m.useCallback(D=>{D.stopPropagation(),T(""),w&&w({value:""})},[T,w]),Z=m.useCallback(()=>l.findIndex(D=>D.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(Z()),onKeyDown:D=>j.current(D,Z()),tabIndex:0,"data-tooltip-text":p,children:[o.jsx("div",{className:"wx-2YgblL wx-label",children:_?v?v(_):_[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:F}):o.jsx("i",{className:"wx-2YgblL wx-icon wxi-angle-down"}),!c&&o.jsx(Ru,{items:l,onReady:A,onSelect:q,...M,children:({option:D})=>v?v(D):D[g]})]})}const Xw=({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?Nm(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 Zw({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 Ww({data:a=[]}){return o.jsx("div",{className:"wx-3nwoO9 wx-notices",children:a.map(l=>o.jsx(Zw,{notice:l},l.id))})}function dm({title:a="",buttons:l=["cancel","ok"],header:s,children:r,footer:c,css:d="",onConfirm:h,onCancel:p}){const g=(m.useContext($a)||Du()).getGroup("core"),x=m.useRef(null);m.useEffect(()=>{x.current?.focus()},[]);function b(w){switch(w.code){case"Enter":{const M=w.target.tagName;if(M==="TEXTAREA"||M==="BUTTON")return;h&&h({event:w});break}case"Escape":p&&p({event:w});break}}function v(w,M){const C={event:w,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(w=>o.jsx("div",{className:"wx-1FxkZa wx-button",children:o.jsx(Ao,{type:`block ${w==="ok"?"primary":"secondary"}`,onClick:M=>v(M,w),children:g(w)})},w))})]})})}function Jw({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||Tm(),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(dm,{title:s.title,buttons:s.buttons,onConfirm:s.resolve,onCancel:s.reject,children:s.message}),o.jsx(Ww,{data:c})]})}const eS=m.forwardRef(Jw);function tS(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(Cv.Provider,{value:r,children:o.jsx(eS,{ref:s,children:l})})}const nS=({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:w,onChange:M})=>{const[C,j]=al(a),k=m.useMemo(()=>(C?"pressed":"")+(l?" "+l:""),[C,l]),T=m.useCallback(A=>{let _=!C;d&&d(A),A.defaultPrevented||(j(_),M&&M({value:_}))},[C,d,M]);return C&&w?o.jsx(Ao,{title:h,tooltip:p,text:C&&b||x,css:g,type:k,icon:C&&c||s,onClick:T,disabled:r,children:Nm(w,{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 aS(){return o.jsx(o.Fragment,{})}function yx(a){const{fonts:l=!0,children:s}=a;return o.jsx(km.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(aS,{}),o.jsx("link",{rel:"stylesheet",href:"https://cdn.svar.dev/fonts/wxi/wx-icons.css"})]})]})})}Am(Xn);const zm={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 kv=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 lS=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]:bx(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);iS(p,x);const b=c?g.data.length:iu(g,d.id)+(l==="after"?1:0);if(bx(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&&Ev(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 Ev(a,l){a.forEach(s=>{l.push(s),s.open===!0&&Ev(s.data,l)})}function iS(a,l){const s=[...a.data];s.splice(l,1),a.data=s}function bx(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 Dv=2,sS=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&Dv?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 wx(a,l){return Object.defineProperty(a,"__reactive",{value:!0,enumerable:!1,writable:!1}),a}var rS=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=>Rv(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,Dv);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 Rv(a,l,s){const r=l.get(a);if(!r)return s;const c=Object.keys(r).map(d=>Rv(d,l,s+1));return Math.max(...c)}var oS=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 Sx(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(Mx(l)),d=r.sort(Mx(l));return[...c,...d]}function cS(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 uS(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 Mx({key:a,order:l}){const s=l==="asc"?cS:uS;return(r,c)=>s(r[a],c[a])}function Om(a,l){const s=a==="/"?1:a.split("/").length;return s>=l.length?null:l[s].id}function dS(a){return a.length>1?a[a.length-2].id:null}let fS=class extends lS{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()}}},mS=class extends sS{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:w}=g[d];b=Sx(b,w[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],w=Sx(x,v[b]),M=[];M[d]={_selected:w},this.setState({panels:M},h)}});this._router=new rS(super.setState.bind(this),s,{data:d=>new fS(d)});const r=this.in=new oS;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 w=[...b[g].selected];if(h){const C=w.indexOf(d);C===-1?w.push(d):w.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);w=[...new Set([...w,...T])]}else w=d?[d]:[];const M=[];M[g]={selected:w,_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(w=>r.exec("select-file",{id:w,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 w={[h]:v.id};b.data?.forEach(C=>w={...g.moveFiles([C.id],v.id),...w});const M=x.map(C=>({selected:C.selected,_crumbs:C._crumbs,_lastSelected:C._lastSelected,_sorts:C._sorts}));g.remove(h),this._updatePanels(M,w),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(w=>v[w]),this.setState({data:g}),x[b].path==p&&(r.exec("select-file",{}),h.forEach(w=>{r.exec("select-file",{id:v[w],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 w=x.map(M=>({selected:M.selected,_crumbs:M._crumbs,_lastSelected:M._lastSelected,_sorts:M._sorts}));this._updatePanels(w,v,!0),this.setState({data:g,panels:w}),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]=wx({_crumbs:[],_files:[],_selected:[],_sorts:{},path:"/",selected:[],...l[r]});const s={panels:wx(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 hS(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 pS(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 gS(a,l="data-id"){const s=pS(a,l);return s?s.getAttribute(l):null}new Date().valueOf();function xS(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 w=g?.[0]?s.getFile(g[0]):null;g?.length?g.length>1?v=l.menuOptions("multiselect"):v=l.menuOptions(w.type,w):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",w);break;case"delete":j("delete");break;case"ctrl+r":h.preventDefault(),j("rename",w);break;case"ctrl+d":h.preventDefault(),j("download",w);break;default:C.handler?.({context:w})}switch(d){case"enter":{if(x||b)break;const{_crumbs:k,_selectNavigation:T}=p;if(T){const A=dS(k);if(A){const _=Om(A,k);s.exec("set-path",{id:A,selected:[_]})}}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:_}=p;let q;if(T.length){const F=T.at(0).id,Z=k.findIndex(D=>D.id===F);if(Z!==-1){const D=Z-1;k[D]?q=k[D].id:A!=="/"&&!(x||b)&&s.exec("select-file",{type:"navigation"})}}else{if(_)break;if(A!=="/"){s.exec("select-file",{type:"navigation"});break}q=k.at(0)?.id}q&&s.exec("select-file",{id:q,toggle:x,range:b});break}case"arrowdown":case"arrowright":{const{_files:k,_selected:T,path:A,_selectNavigation:_}=p;let q;if(T.length){const F=T.at(-1).id,Z=k.findIndex(D=>D.id===F);if(Z!==-1){const D=Z+1;k[D]&&(q=k[D].id)}}else{if(A!=="/"&&!_){s.exec("select-file",{type:"navigation"});break}q=k.at(0)?.id}q&&s.exec("select-file",{id:q,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:+gS(p,"data-panel")})})}return a.addEventListener("keydown",c),{destroy:()=>{a.removeEventListener("keydown",c)}}}function vS(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 yS(a,l="data-id"){const s=a.getAttribute(l);return s?bS(s):null}function bS(a){if(a.startsWith(":"))return a.substring(1);const l=a*1;return isNaN(l)?a:l}function wS(){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 SS=wS();new Date().valueOf();function Lv(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 MS(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 Ie(a,l){const s=a.getState(),r=a.getReactiveState();return MS(r[l],s[l],l)}function CS(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 CS(r[l],s[l])}function _v(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 zv(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 Cx(a,l,s){function r(c){const d=vS(c);if(!d)return;const h=yS(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 SS.addEvent(a,s,r)}function jS(a,l){const s=[Cx(a,l,"click")];return l.dblclick&&s.push(Cx(a,l.dblclick,"dblclick")),()=>{s.forEach(r=>r())}}function Ov(a,l){return a.map((s,r)=>{const c=l(s,r);return s.data&&s.data.length&&(c.data=Ov(s.data,l)),c}).filter(Boolean)}function Bv(a,l){const s=[];return a.forEach(r=>{if(r.data){const c=Bv(r.data,l);c.length&&s.push({...r,data:c})}else l(r)&&s.push(r)}),s}function NS(a){return Ov(a,(l,s)=>{const r={...l,id:l.id||Tm()};return r.type&&(r.comp=r.type),r.comp==="separator"&&a[s-1]?.comp==="separator"?null:r})}const Hv={};function AS(a){return Hv[a]||a}function TS(a,l){Hv[a]=l}function kS({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?AS(s.comp):null,[s]);return o.jsxs("div",{ref:r,className:`wx-cDCz9rZQ wx-option ${s.css||""} ${s.disabled?"wx-disabled":""}`,"data-id":nn(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 Bm({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),[w,M]=m.useState(-1e4),[C,j]=m.useState(20),[k,T]=m.useState(),A=m.useRef(null),[_,q]=m.useState(!1),[F,Z]=m.useState(null),D=m.useCallback(()=>{const le=bv(A.current,c,r,l,s);le&&(v(le.x),M(le.y),T(le.width));let ce=le?.z??20;const H=c?xw(c):[];let Q=0;for(const J of H){const z=parseInt(getComputedStyle(J).zIndex,10);z>Q&&(Q=z)}Q>=ce&&(ce=Q+1),j(ce)},[c,r,l,s]);m.useEffect(()=>{d&&d(D)},[]);const ee=m.useCallback(()=>{q(!1)},[]),re=m.useCallback((le,ce)=>{q(le),Z(ce)},[]),Y=m.useMemo(()=>NS(a),[a]);m.useEffect(()=>{D()},[c,D]);const de=m.useRef(g),G=m.useRef(x),oe=m.useRef(c);return m.useEffect(()=>{de.current=g},[g]),m.useEffect(()=>{G.current=x},[x]),m.useEffect(()=>{oe.current=c},[c]),m.useEffect(()=>{if(!A.current)return;function le(ce){G.current?G.current(ce):de.current&&de.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:w+"px",left:b+"px",width:k,zIndex:C},onMouseLeave:ee,children:Y.map(le=>o.jsxs(m.Fragment,{children:[le.comp==="separator"?o.jsx("div",{className:"wx-XMmAGqVx wx-separator"}):o.jsx(kS,{option:le,onShow:re,onClick:ce=>{if(!le.data&&!ce.defaultPrevented){const H={context:h,action:le,option:le,event:ce};le.handler&&le.handler(H),g&&g(H),ce.stopPropagation()}}}),le.data&&_===le.id?o.jsx(Bm,{css:p,options:le.data,at:"right-overlap",parent:F,context:h,onClick:g,onCancel:x}):null]},le.id))})}const Fv=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),[w,M]=m.useState(null),[C,j]=m.useState(0),[k,T]=m.useState(0),A=m.useRef(null),_=m.useMemo(()=>`data-${d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,[d]),q=m.useMemo(()=>b!==null&&h?Bv(s,ee=>h(ee,b)):s,[b,h,s]);function F(ee){M(null),x&&x(ee)}function Z(ee){if(A.current===ee){A.current=null;return}M(null),x&&x({action:null,option:null})}const D=m.useCallback((ee,re)=>{if(!ee){M(null);return}if(ee.defaultPrevented)return;const Y=ee.target;if(Y&&Y.dataset&&Y.dataset.menuIgnore)return;if(w&&w===Y){M(null),ee.preventDefault();return}j(ee.clientX+1),T(ee.clientY+1);let de=typeof re<"u"?re:Ro(Y,_);c&&(de=c(de,ee),!de)||(v(de),M(Y),A.current=ee.nativeEvent||ee,ee.preventDefault())},[w,_,c]);return m.useImperativeHandle(l,()=>({show:D}),[D]),o.jsxs(o.Fragment,{children:[g?o.jsx("span",{onClick:D,"data-menu-ignore":"true",children:typeof g=="function"?g():g}):null,w?o.jsx(Em,{children:o.jsx(Bm,{css:p,at:r,top:k,left:C,parent:w,context:b,onClick:F,onCancel:Z,options:q},w)}):null]})}),ES=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 w=m.useCallback(C=>{g(C.target),x.current=C.nativeEvent||C,C.preventDefault()},[]);m.useImperativeHandle(l,()=>({show:w}),[w]);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(Em,{children:o.jsx(Bm,{css:c,at:r,parent:p,options:s,onClick:b,onCancel:v})}):null]})}),DS=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((w,M)=>{b.current.show(w,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(Fv,{css:p,at:r,options:s,resolver:c,dataKey:d,filter:h,ref:b,onClick:x})]})}),RS={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 LS=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 Iv(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 LS(s,c,h,g,a)),x.current.files=l,x.current.ready=r,x.current.signal=d,x.current.drag=p,x.current}function _S(a,l){{if(a){const s=a.getGroup(l);if(s)return s}return zo(RS).getGroup(l)}}const zS=()=>Math.random().toString(36).substr(2,9),OS=({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),[w,M]=m.useState({}),C=Iv(),j=a||C,k=m.useContext(ln.i18n),T=_S(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=Y=>{const de=new FormData;return de.append("upload",Y.file),fetch(c,{method:"POST",body:de}).then(G=>G.json()).then(G=>({id:Y.id,...G}),()=>({id:Y.id,status:"error"})).catch(G=>(console.log(G),{id:Y.id,status:"error"}))},_=(Y,de)=>{const G=j.updateFile(Y,de),oe={...G,status:j.getState()};G&&G.uploaded&&G.uploaded(oe),x&&x(oe),G.temp&&j.deleteFile(G.id)},q=Y=>{if(!Y)return;const de=typeof c=="function"?c(Y):A(Y);j.setReady(de.then(G=>{G.status=G.status||"server",_(Y.id,G)}).catch(G=>{_(Y.id,{status:"error",error:G})}))},F=(Y,de)=>{const G={...de||w,id:zS(),status:"client",name:Y.name,file:Y};G.selected&&G.selected(G),g&&g(G),j.addFile(G,s),q(G),b.current&&(b.current.value="")},Z=(Y,de,G)=>{Y.isFile?Y.file(oe=>{F(oe,G)}):Y.isDirectory&&Y.createReader().readEntries(oe=>{oe.forEach(le=>{Z(le,de+le.name+"/",G)})})},D=Y=>{Array.from(Y.target.files).forEach(de=>F(de))},ee=(Y,de)=>{Array.from(Y.dataTransfer.items).forEach(G=>{const oe=G.webkitGetAsEntry();oe&&Z(oe,"",de)})},re=()=>{b.current&&b.current.click()};return m.useEffect(()=>{if(j.signal){const[Y,de,G]=j.signal;M(de),Y==="click"?re():Y==="drop"&&ee(G,de),j.setSignal(null)}},[j.signal]),d?o.jsxs(o.Fragment,{children:[o.jsx("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:b,onChange:D,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:D,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:re,children:T("select files")})]})})]})};new Date().valueOf();function BS(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 BS(a,l);return a===l}function fm(a){if(typeof a!="object"||a===null)return a;if(a instanceof Date)return new Date(a);if(a instanceof Array)return a.map(fm);const l={};for(const s in a)l[s]=fm(a[s]);return l}var Uv=2,HS=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&Uv?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}}}},FS=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=>$v(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,Uv);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 $v(a,l,s){const r=l.get(a);if(!r)return s;const c=Object.keys(r).map(d=>$v(d,l,s+1));return Math.max(...c)}var IS=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 US(a){return l=>l[a]}function $S(a){return(l,s)=>l[a]=s}function Ai(a,l){return(l.getter||US(l.id))(a)}function Uf(a,l,s){return(l.setter||$S(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 GS(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=jx("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=jx("footer",h,r,d,c)),r}function jx(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 PS="portrait",YS=100,VS="a4",KS={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=XS(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 Nx(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,w)=>v+w.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 XS(a){const{mode:l,ppi:s,paper:r}=a,{width:c,height:d}=KS[r];return ZS(l==="portrait"?c:d,s)}function ZS(a,l){return a*l}function WS(a={}){const{mode:l,ppi:s,paper:r}=a;return{mode:l||PS,ppi:s||YS,paper:r||VS}}function qv(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 JS(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 Ax=["resize-column","hide-column","update-cell"],e1=["delete-row","update-row","update-cell"],t1=["move-item"],n1=["resize-column","move-item"];class a1{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(n1.includes(s)){(r.inProgress&&!this.progress[s]||typeof r.inProgress!="boolean")&&(t1.includes(s)&&this.setPrev("flatData"),Ax.includes(s)&&this.setPrev("columns")),this.progress[s]=r.inProgress;return}e1.includes(s)&&this.setPrev("data"),Ax.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]=fm(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 Gv(a,l){return typeof a>"u"||a===null?-1:typeof l>"u"||l===null?1:a===l?0:a>l?1:-1}function l1(a,l){return-Gv(a,l)}function i1(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"?Gv:l1;return function(r,c){return s(Ai(r,l),Ai(c,l))}}function s1(a,l){if(!a||!a.length)return;const s=a.map(r=>{const c=l.find(d=>d.id==r.key);return i1(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,r1=20;function o1(){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(),w=Math.ceil(v.width)+(r&&r.length?r[b]:0),M=Math.ceil(v.height);g=Math.max(g||0,w),x=Math.max(x||0,M)}return d.remove(),{width:g,height:x}}function Tx(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:w,rowspan:M,css:C}=p[x];if(!b){d[x]=Math.max(d[x]||0,r);continue}let j=0;if(v&&!w){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((_,q)=>_+q,0);if(A<j){const _=Math.ceil((j-A)/T);for(let q=x;q<x+T;q++)d[q]=(d[q]||r)+_}continue}}d[x]=Math.max(d[x]||r,j)}}return d}function c1(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 u1(a,l){const s="wx-measure-cell-header",r=a.sort?r1: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 d1={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&&m1(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 Pv(a){return d1[a]}function f1(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):Pv(h)(x,p)})}return r=>{for(let c=0;c<s.length;c++)if(!s[c](r))return!1;return!0}}function m1(a,l){return a.getFullYear()===l.getFullYear()&&a.getMonth()===l.getMonth()&&a.getDate()===l.getDate()}let h1=class extends HS{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 FS(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((w,M)=>Math.max(M.header.length,w),0),b=g.reduce((w,M)=>Math.max(M.footer.length,w),0);g.forEach(this.setCollapsibleColumns);const v=this.normalizeSizes(g,h,x,b,p);for(let w=0;w<g.length;w++)this.normalizeColumns(g,w,"header",x,v),this.normalizeColumns(g,w,"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(w=>x.has(w.id)):d,v=!p&&b.some(w=>w.rowHeight);this.setState({flatData:b,_rowHeightFromData:v},c)}}],{sizes:c=>({...s,...c})});const r=this.in=new IS;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:w}=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 w=="boolean"&&!w)&&(w||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 w={...this._branches[g]};Uf(w,v,b);const M=this.updateTreeRow(w);w.$parent===0&&(h=M)}else{const w=h.findIndex(C=>C.id===g),M={...h[w]};Uf(M,v,b),h[w]=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:w}=b;if(w.length||(h=d=!1),h){const{data:M}=this.getState();let C=M.findIndex(k=>k.id===w[w.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)||w.push(k.id)})}else if(d&&this.isSelected(c)){if(p===!0)return;w=w.filter(M=>M!==c)}else if(d){if(p===!1)return;w.push(c)}else w=[c];this.setState({selectedRows:[...w]}),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:w,_skin:M}=this.getState();let C=w.length;p&&(C=Math.min(p,C));const j=w.slice(0,C);x=c1(v,j,M)}if(h==="header"||h===!0){const{_skin:w}=this.getState();x=Math.max(u1(v,w),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:w="asc"}=c;let M=g.sortMarks;const C=Object.keys(M),j=C.length;!h||!j||j===1&&M[d]?M={[d]:{order:w}}:(j===1&&(M[C[0]]={...M[C[0]],index:0}),M={...M,[d]:{order:w,index:typeof h=="number"?h:M[d]?.index??j}});const k=Object.keys(M).sort((A,_)=>M[A].index-M[_].index).map(A=>({key:A,order:M[A].order}));this.setState({sortMarks:M});const T=s1(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 w=g.filterValues;const M={};h&&(w={...w,[h]:d},M.filterValues=w);const C=p??f1(w,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(),w=b.findIndex(j=>j.id===d);let M;if(g==="up"||g==="down"){if(g==="up"){if(w===0)return;M=w-1,g="before"}else if(g==="down"){if(w===b.length-1)return;M=w+1,g="after"}p=b[M]&&b[M].id}else M=b.findIndex(j=>j.id===p);if(w===-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 w=this.getRow(d);if(!w)return;const M={...w,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=GS(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,w=this.getNextEditor(this.getRow(v),this.getColumn(b));if(!w){const M=this.getNextRow(v);M&&(v=M.id,w=this.getNextEditor(M))}w&&(this.in.exec("open-editor",{id:v,column:w.id}),this.in.exec("focus-cell",{row:v,column:w.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,w=this.getPrevEditor(this.getRow(v),this.getColumn(b));if(!w){const M=this.getPrevRow(v);M&&(v=M.id,w=this.getPrevEditor(M))}w&&(this.in.exec("open-editor",{id:v,column:w.id}),this.in.exec("focus-cell",{row:v,column:w.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,w=this._getFirstVisibleColumn()?.id;v&&w&&(this.in.exec("focus-cell",{row:v,column:w,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,w=this._getLastVisibleColumn()?.id;v&&w&&(this.in.exec("focus-cell",{row:v,column:w,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,w=-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?(w=g.slice(0,j).reduce((k,T)=>k+(T.rowHeight||p.rowHeight),0),C=g[j].rowHeight):w=p.rowHeight*j)}this.setState({scroll:{top:w,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=WS(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=o1()),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 a1(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 w=1;w<b.colspan;w++)l[s+w][r].splice(x+v,0,{})}if(b.rowspan){const v=(b.rowspan===c?g:g.slice(x,b.rowspan+x)).reduce((w,M)=>w+M,0);b.height=v,x+b.rowspan!=c&&b.height--}if(b.colspan){let v=h.width,w=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?w+=j.flexgrow:v+=j.width||d.columnWidth),w?b.flexgrow=w: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):Pv(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=Tx(l,"header",r,s.headerHeight,d),p=Tx(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}}},p1=new Date().valueOf();function ru(){return"temp://"+p1++}function g1(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 x1=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)}}},nr=[],v1={subscribe:a=>{y1();const l=new x1;return nr.push(l),a(l),()=>{const s=nr.findIndex(r=>r===l);s>=0&&nr.splice(s,1)}}},kx=!1;function y1(){kx||(kx=!0,document.addEventListener("keydown",a=>{if(nr.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=nr.length-1;c>=0;c--){const d=nr[c],h=d.store.get(r)||d.store.get(s);h&&d.node.contains(a.target)&&h(a,{key:r,evKey:s})}}}))}const b1={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 w1(a,{keys:l,exec:s}){if(!l)return;function r(h){const p=h.target;return p.tagName==="INPUT"||p.tagName==="TEXTAREA"||g1(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=v1.subscribe(h=>{h.configure(c,a)});return{destroy:()=>{d()}}}function S1(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 M1(a,l){const s=new ResizeObserver(r=>{requestAnimationFrame(()=>l(r[0].contentRect))});return s.observe(a.parentNode),{destroy(){s.disconnect()}}}const Ex=5,C1=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 mm(a,l){const s=hu(l);return{x:a.clientX-s.x,y:a.clientY-s.y}}function j1(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(D){const ee=lr(D);ee&&(r={container:g,sourceNode:D.target,from:Eu(ee),pos:mm(D,a)},d=r.pos,v(D))}function v(D){if(!r)return;const ee=r.pos=mm(D,a);if(!h){if(!p&&!D?.target?.getAttribute("draggable-data")&&Math.abs(d.x-ee.x)<Ex&&Math.abs(d.y-ee.y)<Ex)return;if(F(D)===!1)return Z()}if(p){const re=window.scrollX||document.documentElement.scrollLeft||document.body.scrollLeft,Y=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop;r.targetNode=document.elementFromPoint(D.pageX-re,D.pageY-Y)}else r.targetNode=D.target;s.move&&s.move(D,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 w(D){g.parentNode&&g.parentNode.removeChild(g),g.innerHTML="",h&&s.end&&s.end(D,r),r=d=null,Z()}function M(D){s.getReorder&&!s.getReorder()||D.button===0&&(q(D),window.addEventListener("mousemove",C),window.addEventListener("mouseup",j),b(D))}function C(D){v(D)}function j(D){w(D)}function k(D){if(s.getReorder&&!s.getReorder())return;c=setTimeout(()=>{p=!0,b(D.touches[0])},C1),q(D);function ee(){c&&x(),D.target.removeEventListener("touchmove",T),D.target.removeEventListener("touchend",ee),w(D)}D.target.addEventListener("touchmove",T),D.target.addEventListener("touchend",ee),a.addEventListener("contextmenu",A)}function T(D){h?(D.preventDefault(),v(D.touches[0])):c&&x()}function A(D){if(h||c)return D.preventDefault(),!1}function _(D){D.preventDefault()}function q(D){if(!s.getDraggableInfo)return;const{hasDraggable:ee}=s.getDraggableInfo();(!ee||D.target.getAttribute("draggable-data"))&&(document.body.style.userSelect="none",document.body.style.webkitUserSelect="none")}function F(D){if(h=!0,s.start){if(s.start(D,r)===!1)return!1;a.appendChild(g),document.body.style.cursor="move"}}function Z(D){h=p=!1,document.body.style.cursor="",document.body.style.userSelect="",document.body.style.webkitUserSelect="",window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",j),D&&(a.removeEventListener("mousedown",M),a.removeEventListener("touchstart",k),a.removeEventListener("dragstart",_))}return a.addEventListener("mousedown",M),a.addEventListener("touchstart",k),a.addEventListener("dragstart",_),{destroy(){Z(!0)}}}const N1=.004;function A1(){return{dirX:0,dirY:0,scrollSpeedFactor:1}}function T1(a,l,s,r){const{node:c,left:d,top:h,bottom:p,sense:g,xScroll:x,yScroll:b}=r,v=mm(a,c);s.scrollState||(s.scrollState=A1());let w=0,M=0;v.x<d+g?w=-1:v.x>l.width-g&&(w=1),v.y<h+Math.round(g/2)?M=-1:v.y>l.height-p-Math.round(g/2)&&(M=1),(s.scrollState.dirX!==w||s.scrollState.dirY!==M)&&(Yv(s),s.scrollState.dirX=w,s.scrollState.dirY=M),(x&&s.scrollState.dirX!==0||b&&s.scrollState.dirY!==0)&&k1(s,r,{x:s.scrollState.dirX,y:s.scrollState.dirY})}function k1(a,l,s){a.autoScrollTimer||(a.autoScrollTimer=setTimeout(()=>{a.activeAutoScroll=setInterval(E1,15,a,l,s)},250))}function Yv(a){a.scrollSpeedFactor=1,a.autoScrollTimer&&(a.autoScrollTimer=clearTimeout(a.autoScrollTimer),a.activeAutoScroll=clearInterval(a.activeAutoScroll))}function E1(a,l,s){const{x:r,y:c}=s;a.scrollSpeedFactor+=N1,r!==0&&R1(a,l,r),c!==0&&D1(a,l,c)}function D1(a,l,s){const r=l.node.scrollTop;Vv(r+Math.round(l.sense/3)*a.scrollSpeedFactor*s,"scrollTop",l)}function R1(a,l,s){const r=l.node.scrollLeft;Vv(r+Math.round(l.sense/3)*a.scrollSpeedFactor*s,"scrollLeft",l)}function Vv(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 Kv(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 L1(a){const{row:l,column:s,cellStyle:r=null,columnStyle:c=null,children:d,focusable:h}=a,p=m.useContext(oa),g=Ie(p,"focusCell"),x=Ie(p,"search"),b=Ie(p,"reorder"),v=m.useMemo(()=>x?.rows[l.id]&&x.rows[l.id][s.id],[x,l.id,s.id]),w=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(F,Z){let D="wx-cell";return D+=s.fixed?" "+(s.fixed===-1?"wx-shadow":"wx-fixed"):"",D+=F?" "+F(s):"",D+=Z?" "+Z(l,s):"",D+=s.treetoggle?" wx-tree-cell":"",D}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(F){const Z=new RegExp(`(${x.value.trim()})`,"gi");return String(F).split(Z).map(D=>({text:D,highlight:Z.test(D)}))}const _=m.useMemo(()=>{const F=s.fixed&&s.fixed.left===-1||s.fixed.right===-1,Z=s.fixed&&s.fixed.right;return[C,F?"wx-shadow":"",Z?"wx-fixed-right":""].filter(Boolean).join(" ")},[C,s]),q=s.cell;return o.jsxs("div",{className:"wx-TSCaXsGV "+_,ref:k,onFocus:T,style:w,"data-row-id":nn(l.id),"data-col-id":nn(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,q?o.jsx(q,{api:p,row:l,column:s,onAction:({action:F,data:Z})=>p.exec(F,Z)}):d?d():v?o.jsx("span",{children:A(Ni(l,s)).map(({highlight:F,text:Z},D)=>F?o.jsx("mark",{className:"wx-TSCaXsGV wx-search",children:Z},D):o.jsx("span",{children:Z},D))}):Ni(l,s)]})}function Dx(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 _1({filter:a,column:l,action:s,filterValue:r}){function c({value:d}){s({value:d,key:l.id})}return o.jsx(Rm,{...a.config??{},value:r,onChange:c})}function z1({filter:a,column:l,action:s,filterValue:r}){const c=m.useContext(oa),d=Ie(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(w=>{const M=Ai(w,l);v.includes(M)||v.push(M)}),v.map(w=>({id:w,label:w}))}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 O1({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(Kw,{placeholder:"",clear:!0,...a?.config??{},value:r,onChange:c})})}function Qv(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,[w,M]=Lv(l||[]),C=m.useMemo(()=>(w||[]).map(Y=>s.find(de=>de.id===Y)).filter(Boolean),[w,s]),j=m.useRef(null),k=m.useRef(null),[T,A]=m.useState(null),_=()=>{const Y=w||[];if(!Y.length)return 0;const de=s.find(G=>Y.includes(G.id));return de?s.indexOf(de):0};function q(Y){k.current=Y.navigate,A(()=>Y.keydown),x&&Y.navigate(_())}m.useEffect(()=>{x&&(j.current?.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges())},[]);function F({id:Y}){M(Y),b&&b({value:Y})}function Z(Y){Y.stopPropagation(),M([]),b&&b({value:[]})}function D(){k.current?.(_())}function ee(){k.current?.(null)}function re(Y){T?.(Y,_())}return o.jsxs("div",{ref:j,className:"wx-multiselect wx-aadNNOwy",onClick:D,onKeyDown:re,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(Y=>Y.label).join(", ")}):r?o.jsx("span",{className:"wx-placeholder wx-aadNNOwy",children:r}):" "}),c&&w?.length?o.jsx("i",{className:"wx-icon wxi-close wx-aadNNOwy",onClick:Z}):o.jsx("i",{className:"wx-icon wxi-angle-down wx-aadNNOwy"}),o.jsx(Ru,{items:s,onReady:q,onSelect:F,multiselect:!0,checkboxes:!0,value:w||[],onCancel:ee,...g,children:({option:Y})=>o.jsx("div",{className:"wx-option wx-aadNNOwy",children:h?h(Y):p?o.jsx(p,{data:Y,onAction:v}):Y.label})})]})}function B1({filter:a,column:l,action:s,filterValue:r}){const c=m.useContext(ln.i18n)?.getGroup("grid")||zo(zm).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(Qv,{placeholder:"",...d,options:h,value:r||[],text:p,onChange:g})})}const H1={text:_1,richselect:z1,datepicker:O1,multiselect:B1};function F1({filter:a,column:l}){const s=m.useContext(oa),r=Ie(s,"filterValues");function c(h){s.exec("filter-rows",h)}const d=m.useMemo(()=>H1[a.type],[a.type]);return o.jsx(d,{filter:a,column:l,action:c,filterValue:r[l.id]})}function I1(a){const{cell:l,column:s,row:r,lastRow:c,sortRow:d,columnStyle:h,bodyHeight:p,hasSplit:g}=a,x=m.useContext(oa),b=Ie(x,"sortMarks"),v=m.useMemo(()=>b?b[s.id]:void 0,[b,s.id]),w=m.useRef(),M=m.useCallback(le=>{w.current=l.flexgrow?le.parentNode.clientWidth:l.width},[l.flexgrow,l.width]),C=m.useCallback((le,ce)=>{x.exec("resize-column",{id:l.id,width:Math.max(1,(w.current||0)+le),inProgress:ce})},[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 ce=v?.order;ce&&(ce=ce==="asc"?"desc":"asc"),x.exec("sort-rows",{key:l.id,add:le.ctrlKey||le.metaKey,order:ce})},[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]),_=m.useCallback(le=>{le.key==="Enter"&&A()},[A]),q=m.useCallback(le=>{le.key==="Enter"&&!l.filter&&T(le)},[T,l.filter]),F=m.useMemo(()=>l.collapsed&&s.collapsed,[l.collapsed,s.collapsed]),Z=m.useMemo(()=>F&&!g&&l.collapsible!=="header",[F,g,l.collapsible]),D=m.useMemo(()=>Z?{top:-p/2,position:"absolute"}:{},[Z,p]),ee=m.useMemo(()=>_u(l.width,l.flexgrow,s.fixed,s.left,l.right??s.right,l.height+(F&&Z?p:0)),[l.width,l.flexgrow,s.fixed,s.left,l.right,s.right,l.height,F,Z,p]),re=m.useMemo(()=>Kv(s,l,h),[s,l,h]),Y=m.useCallback(()=>Object.fromEntries(Object.entries(l).filter(([le])=>le!=="cell")),[l]),de=`wx-cell ${re} ${l.css||""} wx-collapsed`,G=["wx-cell",re,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 ce=Dx(le,{down:M,move:j,up:k});return()=>{typeof ce=="function"&&ce()}},[M,j,k,Dx]),F?o.jsx("div",{className:"wx-RsQD74qC "+de,style:ee,role:"button","aria-label":`Expand column ${l.text||""}`,"aria-expanded":!l.collapsed,tabIndex:0,onKeyDown:_,onClick:A,"data-header-id":nn(s.id),children:o.jsx("div",{className:"wx-RsQD74qC wx-text",style:D,children:l.text||""})}):o.jsxs("div",{className:"wx-RsQD74qC "+G,style:ee,onClick:T,"data-header-id":nn(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:q,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:_,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:Y(),column:s,row:r,onAction:({action:ce,data:H})=>x.exec(ce,H)})})():l.filter?o.jsx(F1,{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 U1({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(()=>Kv(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?Sm.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 Rx({deltaLeft:a,contentWidth:l,columns:s,type:r="header",columnStyle:c,bodyHeight:d}){const h=m.useContext(oa),p=Ie(h,"_sizes"),g=Ie(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((_,q)=>{const F={..._[r][T]};A||j[T].push(F),F.colspan>1?A=F.colspan-1:A&&A--})}}return j},[s,r]),v=m.useMemo(()=>g?.left||g?.right,[g]);function w(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 _=T.header[A];if(!_.filter&&!_._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=w(T.id);return r==="header"?o.jsx(I1,{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(U1,{cell:T,columnStyle:c,column:w(T.id),row:k},T.id)})},k))})}function $1({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 G1({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]),w=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(D=>D.id===d),[x,d]),k=m.useRef(null),T=m.useRef(null),A=m.useCallback(D=>{k.current=D.navigate,T.current=D.keydown,k.current(j)},[j,k]),_=m.useCallback(D=>{const ee=D?.target?.value??"";g(ee);const re=ee?(a?.options||[]).filter(Y=>(Y.label||"").toLowerCase().includes(ee.toLowerCase())):a?.options||[];b(re),re.length?k.current(-1/0):k.current(null)},[a]),q=m.useRef(null);m.useEffect(()=>{q.current&&q.current.focus()},[]);const F=m.useRef(s);m.useEffect(()=>{F.current=s},[s]),m.useEffect(()=>{if(!q.current)return;const D=ll(q.current,()=>F.current(!0));return()=>D.destroy()},[]),m.useEffect(()=>{h(a?.value),g(a?.renderedValue),b(a?.options||[])},[a]);const Z=m.useCallback(({id:D})=>{r(D),s()},[r,s]);return o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"wx-0UYfSd1x wx-input",ref:q,value:p??"",onChange:_,onKeyDown:D=>T.current?T.current(D,j):void 0}),o.jsx(Ru,{items:x,onReady:A,onSelect:Z,...C,onCancel:c,children:({option:D})=>v?v(D):w?o.jsx(w,{data:D,onAction:l}):D.label})]})}function P1({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),[w,M]=m.useState(null);return m.useEffect(()=>{v.current&&v.current.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges()},[]),m.useEffect(()=>{if(!w)return;const C=ll(w,()=>s(!0));return()=>C.destroy()},[w,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(Dm,{...x,onCancel:c,children:o.jsx("div",{ref:M,className:"wx-lNWNYUb6",children:o.jsx(Tv,{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(_=>_.id===l.value)),[b]=m.useState(l.value),[v]=m.useState(l.options),w=m.useMemo(()=>v.findIndex(_=>_.id===b),[v,b]);function M({id:_}){c(_),r()}let C;const[j,k]=m.useState();function T(_){C=_.navigate,k(()=>_.keydown),C(w)}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 _=ll(A.current,()=>r(!0));return()=>_.destroy()},[r]),o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:A,className:"wx-ywGRk611 wx-value",tabIndex:0,onClick:d,onKeyDown:_=>{j(_,w),_.preventDefault()},children:h.template?h.template(x):h.cell?(()=>{const _=h.cell;return o.jsx(_,{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:_})=>h.template?h.template(_):h.cell?(()=>{const q=h.cell;return o.jsx(q,{data:_,onAction:s})})():_.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:w}){c(w)}const v=m.useRef(null);return m.useEffect(()=>{if(!v.current)return;const w=ll(v.current,()=>r(!0));return()=>w.destroy()},[r]),o.jsx("div",{ref:v,className:"wx-value wx-aacZ4gNU",onClick:()=>r(!0),children:o.jsx(Qv,{value:p,options:h,text:g,template:d.template,cell:d.cell,clear:d.clear,dropdown:x,autoOpen:!0,onChange:b,onAction:s})})}const K1={text:q1,combo:G1,datepicker:P1,richselect:Y1,multiselect:V1};function Q1({column:a,row:l}){const s=m.useContext(oa),r=Ie(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 K1[j]},[a,l]),v=m.useRef(null);m.useEffect(()=>{v.current&&typeof x=="string"&&v.current.setAttribute("style",x)},[x]);const w=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:w,"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 Lx(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 w=h.find(j=>j.id===v.id),M=`wx-print-cell-${s}${g(w)}${v.filter?" wx-print-cell-filter":""}${v.vertical?" wx-vertical":""}`,C=v.cell;return o.jsx("th",{style:_v(qv(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:w,row:b}):v.filter?o.jsx("div",{className:"wx-Gy81xq2u wx-print-filter",children:JS(d,h,v)}):o.jsx("div",{className:"wx-Gy81xq2u wx-text",children:v.text??""})},v.id)})},b))})}function X1(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&&Nx(l,"header",b.headerRowHeights),w=h&&Nx(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(Lx,{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:_v(qv(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(Lx,{columns:w,type:"footer",columnStyle:r})}):null]})}function Z1(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}; }`,w=document.createElement("style");w.setAttribute("type","text/css"),w.setAttribute("media","print"),document.getElementsByTagName("head")[0].appendChild(w),w.appendChild(document.createTextNode(v)),window.print(),w.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(X1,{columns:g,...s})},x))})}function W1(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:w,responsiveLevel:M,hotkeys:C}=a,j=m.useContext(oa),k=Ie(j,"dynamic"),T=Ie(j,"_columns"),A=Ie(j,"flatData"),_=Ie(j,"split"),q=Ie(j,"_sizes"),[F,Z]=Aa(j,"selectedRows"),D=Ie(j,"select"),ee=Ie(j,"editor"),re=Ie(j,"scrollLeft"),Y=Ie(j,"scrollTop"),de=Ie(j,"tree"),G=Ie(j,"focusCell"),oe=Ie(j,"_print"),le=Ie(j,"undo"),ce=Ie(j,"reorder"),H=Ie(j,"_rowHeightFromData"),[Q,J]=m.useState(0);m.useEffect(()=>{J(Ea())},[]);const[z,te]=m.useState(0),fe=m.useMemo(()=>(T||[]).some(P=>!P.hidden&&P.flexgrow),[T]),L=m.useMemo(()=>q?.rowHeight||0,[q]),xe=m.useRef(null),[we,Se]=m.useState(null),[ze,qe]=m.useState(null),Oe=m.useMemo(()=>{let P=[],me=0;return _&&_.left&&(P=(T||[]).slice(0,_.left).filter(Me=>!Me.hidden).map(Me=>({...Me})),P.forEach(Me=>{Me.fixed={left:1,leftSize:_.left},Me.left=me,me+=Me.width}),P.length&&(P[P.length-1].fixed.left=-1)),{columns:P,width:me}},[_,T]),_e=m.useMemo(()=>{let P=[],me=0;if(_&&_.right){P=(T||[]).slice(_.right*-1).filter(Me=>!Me.hidden).map(Me=>({...Me}));for(let Me=P.length-1;Me>=0;Me--){const Ue=P[Me];Ue.fixed={right:1},Ue.right=me,me+=Ue.width}P.length&&(P[0].fixed={right:-1})}return{columns:P,width:me}},[_,T]),Ge=m.useMemo(()=>{const P=(T||[]).slice(_?.left||0,(T||[]).length-(_?.right??0)).filter(me=>!me.hidden);return P.forEach(me=>{me.fixed=0}),P},[T,_]),Te=m.useMemo(()=>(T||[]).reduce((P,me)=>(me.hidden||(P+=me.width),P),0),[T]),Ct=1;function ne(P,me,Me){let Ue=me,ot=P;if(Ge.length){let vt=Ge.length;for(let Ee=P;Ee>=0;Ee--)Ge[Ee][Me].forEach(nt=>{nt.colspan>1&&Ee>P-nt.colspan&&Ee<vt&&(vt=Ee)});if(vt!==Ge.length&&vt<P){for(let Ee=vt;Ee<P;Ee++)Ue-=Ge[Ee].width;ot=vt}}return{index:ot,delta:Ue}}const pe=m.useMemo(()=>{let P,me,Me;const Ue=re||0,ot=(re||0)+(v||0);let vt=0,Ee=0,nt=0,sn=0;Ge.forEach((Kt,_t)=>{Ue>nt&&(vt=_t,sn=nt),nt=nt+Kt.width,ot>nt&&(Ee=_t+Ct)});const Vt={header:0,footer:0};for(let Kt=Ee;Kt>=vt;Kt--)["header","footer"].forEach(_t=>{Ge[Kt]&&Ge[Kt][_t].forEach(as=>{const da=as.colspan;if(da&&da>1){const Ln=da-(Ee-Kt+1);Ln>0&&(Vt[_t]=Math.max(Vt[_t],Ln))}})});const mn=ne(vt,sn,"header"),St=ne(vt,sn,"footer"),Lt=mn.delta,wt=mn.index,ul=St.delta,dl=St.index;return fe&&Te>(v||0)?P=me=Me=[...Oe.columns,...Ge,..._e.columns]:(P=[...Oe.columns,...Ge.slice(vt,Ee+1),..._e.columns],me=[...Oe.columns,...Ge.slice(wt,Ee+Vt.header+1),..._e.columns],Me=[...Oe.columns,...Ge.slice(dl,Ee+Vt.footer+1),..._e.columns]),{data:P||[],header:me||[],footer:Me||[],d:sn,df:ul,dh:Lt}},[Ge,Oe,_e,re,v,fe,Te]),Re=m.useMemo(()=>l&&q?.headerHeight||0,[l,q]),Le=m.useMemo(()=>s&&q?.footerHeight||0,[s,q]),Ce=m.useMemo(()=>v&&w?Te>=v:!1,[v,w,Te]),[tt,he]=m.useState(!1),Ht=m.useMemo(()=>(w||0)-Re-Le-(Ce?Q:0),[w,Re,Le,Ce,Q]),Be=m.useMemo(()=>Math.ceil((Ht||0)/(L||1))+1,[Ht,L]),ve=m.useRef([]),[ke,He]=m.useState(0),[Pt,yn]=m.useState(void 0),Ve=m.useMemo(()=>{let P=0,me=0;const Me=2,Ue=Y||0;if(x){let Ee=Ue;for(;Ee>0;)Ee-=ve.current[P]||L,P++;me=Ue-Ee;for(let nt=Math.max(0,P-Me-1);nt<P;nt++)me-=ve.current[P-nt]||L;P=Math.max(0,P-Me)}else{if(H){let Ee=0,nt=0;for(let St=0;St<(A||[]).length;St++){const Lt=A[St].rowHeight||L;if(nt+Lt>Ue){Ee=St;break}nt+=Lt}P=Math.max(0,Ee-Me);for(let St=0;St<P;St++)me+=A[St].rowHeight||L;let sn=0,Vt=0;for(let St=Ee+1;St<(A||[]).length;St++){const Lt=A[St].rowHeight||L;if(sn++,Vt+Lt>Ht)break;Vt+=Lt}const mn=Math.min(k?k.rowCount:(A||[]).length,Ee+sn+Me);return{d:me,start:P,end:mn}}P=Math.floor(Ue/(L||1)),P=Math.max(0,P-Me),me=P*(L||0)}const ot=k?k.rowCount:(A||[]).length,vt=Math.min(ot,P+(Be||0)+Me);return{d:me,start:P,end:vt}},[x,H,Y,L,k,A,Be,Ht]),ca=m.useMemo(()=>{const P=k?k.rowCount:(A||[]).length;if(x)return ke+Ve.d+(P-(Pt||0))*(L||0);if(!H)return P*(L||0);let me=0;for(let Me=0;Me<P;Me++)me+=A[Me]?.rowHeight||L;return me},[k,A,L,x,H,ke,Ve.d,Pt]),Ta=m.useRef({});Ta.current={clientWidth:v,clientHeight:w,fullHeight:ca,headerHeight:Re,footerHeight:Le,fullWidth:Te,SCROLLSIZE:Q};const Tn=m.useCallback(()=>{const P=Ta.current;he(P.clientWidth&&P.clientHeight?P.fullHeight+P.headerHeight+P.footerHeight>=P.clientHeight-(P.fullWidth>=P.clientWidth?P.SCROLLSIZE:0):!1)},[]);m.useEffect(()=>{const P=requestAnimationFrame(Tn);return()=>window.cancelAnimationFrame(P)},[z,Tn]),m.useEffect(()=>{Tn()},[w,Tn]);const fn=m.useMemo(()=>fe&&Te<=(v||0)?(v||0)-0-(tt?Q:0):Te,[fe,Te,v,tt,Q,Ce]),il=m.useMemo(()=>fe&&Te<=(v||0)?v||0:fn<(v||0)?Te+(tt?Q:0):-1,[fe,Te,v,fn,tt,Q]),kn=m.useRef({});m.useEffect(()=>{if(k&&(kn.current.start!==Ve.start||kn.current.end!==Ve.end)){const{start:P,end:me}=Ve;kn.current={start:P,end:me},j&&j.exec&&j.exec("request-data",{row:{start:P,end:me}})}},[k,Ve,j]);const rt=m.useMemo(()=>k?A||[]:(A||[]).slice(Ve.start,Ve.end),[k,A,Ve]),Zt=m.useMemo(()=>(F||[]).filter(P=>(rt||[]).some(me=>me.id===P)),[Z,rt]),Rt=m.useMemo(()=>Ve.start,[Ve.start]),ns=m.useRef({top:Y,left:re});ns.current={top:Y,left:re};const Ti=m.useCallback(P=>{const me=P.target.scrollTop,Me=P.target.scrollLeft,Ue=ns.current;(me!==Ue.top||Me!==Ue.left)&&j.exec("scroll-to",{top:me,left:Me})},[j]),ki=m.useCallback(P=>{P.shiftKey&&P.preventDefault(),xe.current&&xe.current.focus&&xe.current.focus()},[]),sl=m.useCallback(()=>!!(T||[]).find(P=>!!P.draggable),[T]),ka=m.useRef(null),En=m.useRef(null),Zn=m.useRef({dblclick:(P,me)=>{const Me={id:P,column:Ro(me,"data-col-id")};j.exec("open-editor",Me)},click:(P,me)=>{if(me.target.closest("input")||ka.current)return;const Me=Ro(me,"data-col-id");if(G?.id!==P&&j.exec("focus-cell",{row:P,column:Me,eventSource:"click"}),D===!1)return;const Ue=c&&(me.ctrlKey||me.metaKey),ot=c&&me.shiftKey;(Ue||F.length>1||!F.includes(P))&&j.exec("select-row",{id:P,toggle:Ue,range:ot})},"toggle-row":P=>{const me=j.getRow(P);j.exec(me.open!==!1?"close-row":"open-row",{id:P})},"ignore-click":()=>!1}),Dn=m.useMemo(()=>({top:Re,bottom:Le,left:Oe.width,xScroll:Ce,yScroll:tt,sense:x&&ze?ze.offsetHeight:Math.max(q?.rowHeight||0,40),node:xe.current&&xe.current.firstElementChild}),[Re,Le,Oe.width,Ce,tt,x,ze,q]);function ua(P,me){const{container:Me,sourceNode:Ue,from:ot}=me;if(sl()&&!Ue.getAttribute("draggable-data"))return!1;Se(ot),de&&j.getRow(ot).open&&j.exec("close-row",{id:ot,nested:!0});const vt=lr(Ue),Ee=vt.cloneNode(!0);Ee.classList.remove("wx-selected"),Ee.querySelectorAll("[tabindex]").forEach(mn=>mn.setAttribute("tabindex","-1")),Me.appendChild(Ee),qe(Ee);const nt=(re||0)-pe.d,sn=tt?Q:0;Me.style.width=Math.min((v||0)-sn,fe&&Te<=(v||0)?fn:fn-sn)+nt+"px";const Vt=hu(vt);me.offset={x:nt,y:-Math.round(Vt.height/2)},En.current||(En.current=P.clientY)}function Il(P,me){const{from:Me}=me,Ue=me.pos,ot=hu(xe.current);Ue.x=ot.x;const vt=Dn.top;if(Ue.y<vt)Ue.y=vt;else{const Ee=ot.height-(Ce&&Q>0?Q:Math.round(Dn.sense/2))-Dn.bottom;Ue.y>Ee&&(Ue.y=Ee)}if(xe.current.contains(me.targetNode)){const Ee=lr(me.targetNode),nt=Ee&&Eu(Ee);if(nt&&nt!==Me){me.to=nt;const sn=x?ze?.offsetHeight:q?.rowHeight;if(ze&&((Y||0)===0||Ue.y>vt+sn-1)){const Vt=Ee.getBoundingClientRect(),mn=hu(ze).y,St=Vt.y,Lt=mn>St?-1:1,wt=Lt===1?"after":"before",ul=j.getState().flatData,dl=Math.abs(ul.findIndex(_t=>_t.id===Me)-ul.findIndex(_t=>_t.id===nt)),Kt=dl!==1?wt==="before"?"after":"before":wt;if(dl===1&&(Lt===-1&&P.clientY>En.current||Lt===1&&P.clientY<En.current))return;En.current=P.clientY,j.exec("move-item",{id:Me,target:nt,mode:Kt,inProgress:!0})}}d&&d({event:P,context:me})}T1(P,ot,me,Dn)}function rl(P,me){const{from:Me,to:Ue}=me;j.exec("move-item",{id:Me,target:Ue,inProgress:!1}),ka.current=setTimeout(()=>{ka.current=0},1),Se(null),qe(null),En.current=null,Yv(me)}function Ea(){const P=document.createElement("div");P.style.cssText="position:absolute;left:-1000px;width:100px;padding:0px;margin:0px;min-height:100px;overflow-y:scroll;",document.body.appendChild(P);const me=P.offsetWidth-P.clientWidth;return document.body.removeChild(P),me}const Da=m.useMemo(()=>il>0?{width:`${il}px`}:void 0,[il]),qa=m.useRef(null);function ol(){Promise.resolve().then(()=>{let P=0,me=Rt;const Me=qa.current;Me&&(Array.from(Me.children).forEach((Ue,ot)=>{ve.current[Rt+ot]=Ue.offsetHeight,P+=Ue.offsetHeight,me++}),He(P),yn(me))})}m.useEffect(()=>{rt&&x&&ol()},[rt,x,Rt]);let[Rn,Ra]=m.useState();m.useEffect(()=>{if(G&&(!D||!Zt.length||Zt.includes(G.row)))Ra({...G});else if(rt.length&&pe.data.length){if(!Rn||Zt.length&&!Zt.includes(Rn.row)||rt.findIndex(P=>P.id===Rn.row)===-1||pe.data.findIndex(P=>P.id===Rn.column&&!P.collapsed)===-1){const P=Zt[0]||rt[0].id,me=pe.data.findIndex(Me=>!Me.collapsed);Ra(me!==-1?{row:P,column:pe.data[me].id}:null)}}else Ra(null)},[G]);const Ga=m.useRef(null);m.useEffect(()=>{const P=xe.current;if(!P)return;const me=M1(P,b);return()=>{typeof me=="function"&&me()}},[b]);const cl=m.useRef({});Object.assign(cl.current,{start:ua,move:Il,end:rl,getReorder:()=>ce,getDraggableInfo:()=>({hasDraggable:sl()})}),m.useEffect(()=>{const P=xe.current;return P?j1(P,cl).destroy:void 0},[ce,xe.current]),m.useEffect(()=>{const P=xe.current;return P?w1(P,{keys:C!==!1&&{...b1,"ctrl+z":le,"ctrl+y":le,...C},exec:me=>j.exec("hotkey",me)}).destroy:void 0},[j,le,C]);const bn=m.useRef({scroll:j.getReactiveState().scroll,scrollLeft:j.getReactiveState().scrollLeft,scrollTop:j.getReactiveState().scrollTop});bn.current.getWidth=()=>(v||0)-(tt?Q:0),bn.current.getHeight=()=>Ht,bn.current.getScrollMargin=()=>Oe.width+_e.width,m.useEffect(()=>{S1(Ga.current,bn.current)},[]);const Wn=m.useRef(null);m.useEffect(()=>{const P=Wn.current;if(!P)return;const me=[];me.push(ll(P,()=>G&&j.exec("focus-cell",{eventSource:"click"})).destroy),me.push(jS(P,Zn.current)),te(P.clientHeight);const Me=new ResizeObserver(()=>{te(P.clientHeight)});return Me.observe(P),me.push(()=>Me.disconnect()),()=>me.forEach(Ue=>Ue())},[]);const Yt=`wx-grid ${M?`wx-responsive-${M}`:""}`;return m.useEffect(()=>{G&&(rt.some(P=>P.id===G.row)&&pe.data.some(P=>P.id===G.column&&!P.collapsed)||j.exec("focus-cell",{eventSource:"destroy"}))},[G,rt,pe.data,j]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-4VuBwK2D "+Yt,style:{"--header-height":`${Re}px`,"--footer-height":`${Le}px`,"--split-left-width":`${Oe.width}px`,"--split-right-width":`${_e.width}px`},children:o.jsx("div",{ref:xe,className:"wx-4VuBwK2D wx-table-box",style:Da,role:de?"treegrid":"grid","aria-colcount":pe.data.length,"aria-rowcount":rt.length,"aria-multiselectable":de&&c?!0:void 0,tabIndex:-1,children:o.jsxs("div",{ref:Ga,className:"wx-4VuBwK2D wx-scroll",style:{overflowX:Ce?"scroll":"hidden",overflowY:tt?"scroll":"hidden"},onScroll:Ti,children:[l?o.jsx("div",{className:"wx-4VuBwK2D wx-header-wrapper",children:o.jsx(Rx,{contentWidth:fn,deltaLeft:pe.dh,columns:pe.header,columnStyle:p,bodyHeight:Ht-+s})}):null,o.jsxs("div",{ref:Wn,className:"wx-4VuBwK2D wx-body",style:{width:`${fn}px`,height:`${ca}px`},onMouseDown:P=>ki(P),children:[r?o.jsx($1,{overlay:r}):null,o.jsx("div",{ref:qa,className:"wx-4VuBwK2D wx-data",style:{paddingTop:`${Ve.d}px`,paddingLeft:`${pe.d}px`},children:rt.map((P,me)=>{const Me=F.indexOf(P.id)!==-1,Ue=we===P.id,ot="wx-row"+(x?" wx-autoheight":"")+(h?" "+h(P):"")+(Me?" wx-selected":"")+(Ue?" wx-inactive":""),vt=x?{minHeight:`${P.rowHeight||L}px`}:{height:`${P.rowHeight||L}px`};return o.jsx("div",{className:"wx-4VuBwK2D "+ot,"data-id":nn(P.id),"data-context-id":nn(P.id),style:vt,role:"row","aria-rowindex":me,"aria-expanded":P.open,"aria-level":de?P.$level+1:void 0,"aria-selected":de?Me:void 0,tabIndex:-1,children:pe.data.map(Ee=>Ee.collapsed?o.jsx("div",{className:"wx-4VuBwK2D wx-cell wx-collapsed"},Ee.id):ee?.id===P.id&&ee.column===Ee.id?o.jsx(Q1,{row:P,column:Ee},Ee.id):o.jsx(L1,{row:P,column:Ee,columnStyle:p,cellStyle:g,reorder:ce,focusable:Rn?.row===P.id&&Rn?.column===Ee.id},Ee.id))},P.id)})})]}),s&&(A||[]).length?o.jsx(Rx,{type:"footer",contentWidth:fn,deltaLeft:pe.df,columns:pe.footer,columnStyle:p}):null]})})}),oe?o.jsx(Z1,{config:oe,rowStyle:h,columnStyle:p,cellStyle:g,header:l,footer:s,reorder:ce}):null]})}const J1=a=>a.split("-").map(l=>l?l.charAt(0).toUpperCase()+l.slice(1):"").join(""),eM=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:w=!1,onReorder:M=null,autoRowHeight:C=!1,sizes:j,split:k,tree:T=!1,autoConfig:A=!1,init:_=null,responsive:q=null,sortMarks:F,undo:Z=!1,hotkeys:D=null,filterValues:ee,...re},Y){const de=m.useRef();de.current=re;const G=m.useMemo(()=>new h1(zv),[]),oe=m.useMemo(()=>G.in,[G]),le=m.useRef(null);le.current===null&&(le.current=new kv((_e,Ge)=>{const Te="on"+J1(_e);de.current&&de.current[Te]&&de.current[Te](Ge)}),oe.setNext(le.current));const ce=m.useMemo(()=>({getState:G.getState.bind(G),getReactiveState:G.getReactive.bind(G),getStores:()=>({data:G}),exec:oe.exec,setNext:_e=>(le.current=le.current.setNext(_e),le.current),intercept:oe.intercept.bind(oe),on:oe.on.bind(oe),detach:oe.detach.bind(oe),getRow:G.getRow.bind(G),getColumn:G.getColumn.bind(G)}),[G,oe]),[H,Q]=m.useState(0),[J,z]=m.useState(0),[te,fe]=m.useState(null),[L,xe]=m.useState(null),we=m.useMemo(()=>{if(A&&!l.length&&a.length){const _e=a[0],Ge=[];for(let Te in _e)if(Te!=="id"&&Te[0]!=="$"){let Ct={id:Te,header:Te[0].toUpperCase()+Te.slice(1)};typeof A=="object"&&(Ct={...Ct,...A}),Ge.push(Ct)}return Ge}return(L&&L.columns)??l},[A,l,a,L]),Se=m.useMemo(()=>(L&&L.sizes)??j,[L,j]),ze=m.useCallback(_e=>{if(Q(_e.width),z(_e.height),q){const Ge=Object.keys(q).map(Number).sort((Te,Ct)=>Te-Ct).find(Te=>_e.width<=Te)??null;Ge!==te&&(xe(q[Ge]),fe(Ge))}},[q,te]),qe=m.useContext(ln.theme),Oe=m.useRef(0);return m.useEffect(()=>{if(!Oe.current)_&&_(ce);else{const _e=G.getState();G.init({data:a,columns:we,split:k||_e.split,sizes:Se||_e.sizes,selectedRows:d||_e.selectedRows,dynamic:b,tree:T,sortMarks:F||_e.sortMarks,filterValues:ee||_e.filterValues,undo:Z,reorder:w,_skin:qe,_select:h})}Oe.current++},[G,a,we,k,Se,d,b,T,F,ee,Z,w,qe,h,_,ce]),Oe.current===0&&G.init({data:a,columns:we,split:k||{left:0},sizes:Se||{},selectedRows:d||[],dynamic:b,tree:T,sortMarks:F||{},filterValues:ee||{},undo:Z,reorder:w,_skin:qe,select:h}),m.useImperativeHandle(Y,()=>({...ce}),[ce]),o.jsx(oa.Provider,{value:ce,children:o.jsx(_m,{words:zm,optional:!0,children:o.jsx(W1,{header:g,footer:x,overlay:v,rowStyle:s,columnStyle:r,cellStyle:c,onReorder:M,multiselect:p,autoRowHeight:C,clientWidth:H,clientHeight:J,responsiveLevel:te,resize:ze,hotkeys:D})})})});Am(Xn);const an=m.createContext(null),Hm=m.createContext(null),Fm=m.createContext(null);function tM({children:a}){const l=m.useContext(ln.i18n),s=m.useMemo(()=>l.getGroup("filemanager"),[l]),r=m.useContext(an),[c]=Aa(r,"panels"),d=Ie(r,"activePanel"),h=c[d].path,[p,g]=m.useState(null),[x,b]=m.useState(null),[v,w]=m.useState(""),[M,C]=m.useState(""),[j,k]=m.useState(!1);function T(){const F=v.trim();if(!F){k(!0);return}p.add?r.exec("create-file",{file:{...p.item,name:F},parent:h}):M!==F&&r.exec("rename-file",{id:p.item.id,name:F}),A()}function A(){g(null),k(null),C(""),w("")}function _(){r.exec("delete-files",{ids:x.selected}),b(null)}const q=m.useMemo(()=>({showPrompt(F){const Z=F.item.name||(F.item.type==="folder"?s("New folder"):`${s("New file")}.txt`);C(Z),w(Z),g({...F})},showConfirm(F){b({...F})}}),[s]);return o.jsxs(Hm.Provider,{value:q,children:[o.jsx(tS,{children:a}),p?o.jsx(dm,{title:s(`Enter ${p.item.type} name`),onConfirm:T,onCancel:A,children:o.jsx(Rm,{error:j,select:!0,focus:!0,value:v,onChange:({value:F})=>w(F)})}):null,x?o.jsx(dm,{title:s("Are you sure you want to delete these items:"),onConfirm:_,onCancel:()=>b(null),children:x.selected?o.jsx("ul",{className:"wx-gq7BMzEP wx-list",children:x.selected.map((F,Z)=>o.jsx("li",{children:F},Z))}):null}):null]})}let _x={"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 nM(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 aM({item:a}){const l=m.useContext(an),s=m.useContext(ln.i18n).getGroup("filemanager"),r=m.useContext(an).templates,[c]=Aa(l,"panels"),d=Ie(l,"activePanel"),h=Ie(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(()=>nM(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":nn("/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":nn(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":nn(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":nn(a.id),className:"wx-GAOa4kDV wx-more",children:o.jsx("i",{className:"wx-GAOa4kDV wxi-dots-v"})})]})]})})}function Xv(){const a=m.useContext(an),l=m.useContext(ln.i18n),s=m.useMemo(()=>l.getGroup("filemanager"),[l]),[r]=Aa(a,"panels"),c=Ie(a,"activePanel"),d=Ie(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,_)=>{const q=_&&(_.ctrlKey||_.metaKey),F=_&&_.shiftKey;if(A==="/wx-filemanager-parent-link"){if(p.length&&(q||F))return;a.exec("select-file",{type:"navigation"});return}let Z=A==="body"&&_?null:A;const D=_.target.className.indexOf("wx-more")!==-1||_.target.className.indexOf("wxi-dots-v")!==-1;setTimeout(()=>{a.exec("select-file",{id:Z,toggle:q&&!D,range:F&&!D,panel:c})},1)},[a,p,c]),w=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 w();d==="search"&&a.exec("filter-files",{text:""});const _=h.find(q=>q.id===A);_&&(_.type=="folder"?a.exec("set-path",{id:_.id,panel:c}):a.exec("open-file",{id:_.id}))},[a,w,d,h,c]),C=m.useCallback((A,_)=>{(!p?.length||!p.filter(q=>q?.id===A).length>0)&&v(A,_)},[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},ir(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":nn("body"),ref:k,children:j.map(A=>o.jsx(aM,{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 lM(){const a=m.useContext(ln.i18n).getGroup("filemanager"),l=m.useContext(an),s=Ie(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(Xv,{})]})}function $f({narrowMode:a,extraInfo:l}){const s=m.useContext(an),{preview:r,icon:c}=s.templates,d=m.useContext(ln.i18n),h=m.useMemo(()=>d.getGroup("filemanager"),[d]),p=m.useMemo(()=>tr("%D, %d %F %Y, %H:%i",d.getRaw().calendar),[d]),[g,x]=Aa(s,"panels"),b=Ie(s,"activePanel"),v=Ie(s,"preview"),w=Ie(s,"search"),M=m.useMemo(()=>{const D=g&&b!=null&&g[b]?._selected?.length||0;return w&&!D},[w,x,b]),C=m.useMemo(()=>{const D=g&&b!=null?g[b]:null;return D?M?D._files:D._selected:[]},[M,x,b]),j=m.useCallback((D,ee)=>(D?`${D} ${h(D>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(D=>D.type==="folder"?h("Folder"):D.ext||h("Unknown file"),[h]),A=m.useMemo(()=>{let D,ee,re,Y,de,G,oe,le;if(C.length===1&&!M){ee=C[0],D=ee.name;const ce=r(ee,400,500);ce?(re=ce,Y=""):(Y=c(ee,"big"),re=""),de=ee.type!=="folder"}else{if(ee=de=null,D="",C.length){let ce=0,H=0,Q=0,J=[],z;C.forEach(fe=>{typeof fe.size>"u"&&(z=!0,ce=void 0),z||(ce+=fe.size),J.push(T(fe)),fe.type==="folder"?H++:Q++});const te=new Set(J);G=te.size>1?h("multiple"):[...te][0],oe=j(H,Q),le=ce,M||(D=h("Multiple files"))}Y=c({type:M?"search":C.length?"multiple":"none"},"big"),re=""}return{name:D,item:ee,previewSrc:re,iconSrc:Y,showDownloadIcon:de,type:G,totalCount:oe,totalSize:le}},[C,M,r,c,h,T,j]),_=m.useCallback(()=>{s.exec("download-file",{id:C[0].id})},[s,C]),q=m.useCallback(async D=>{if(!l||!D)return null;try{return await l(D)}catch(ee){return console.log(ee),null}},[l]),[F,Z]=m.useState(null);return m.useEffect(()=>{let D=!1;return Z(null),Promise.resolve(q(A.item)).then(ee=>{D||Z(ee)}).catch(()=>{D||Z(null)}),()=>{D=!0}},[q,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:_}):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]}),F?Object.entries(F).map(([D,ee])=>o.jsxs(Sm.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:D}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:ee})]},D)):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 Zv({panel:a}){const l=m.useContext(an),s=m.useContext(ln.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=Om(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 w=m.useRef(null),M=m.useRef();return m.useEffect(()=>{M.current?M.current.click=g:(M.current={click:g},ir(w.current,M.current))},[g]),o.jsxs("div",{className:"wx-SNY5LTYx wx-breadcrumbs","data-menu-ignore":"true",ref:w,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(Sm.Fragment,{children:[j?o.jsx(es,{name:"angle-right"}):null,o.jsx("div",{className:"wx-SNY5LTYx wx-item","data-id":nn(C.id),"data-menu-ignore":"true",children:C.id=="/"?r(C.name):C.name})]},j))]})}function iM({row:a}){const l=m.useContext(ln.i18n),[s]=m.useState(()=>l.getGroup("filemanager")),r=m.useContext(an).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 Wv({children:a}){const l=m.useContext(an),s=Ie(l,"activePanel"),r=m.useContext(Fm),c=m.useRef(null);let d=m.useRef({});return d.current.drop=()=>{const h=c.current,p=ow(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 hm({panel:a,active:l=!1,onClick:s,onContextMenu:r}){const c=m.useContext(an),d=m.useContext(ln.i18n),h=m.useMemo(()=>d.getGroup("filemanager"),[d]),p=m.useMemo(()=>tr("%d %M %Y",d.getRaw().calendar),[d]),[g]=Aa(c,"panels"),x=g[a].selected,b=g[a].path,v=g[a]._crumbs,w=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:iM},{id:"size",header:h("Size"),width:100,sort:!0,resize:!0,template:G=>typeof G=="number"?Lo(G):""},{id:"date",header:h("Date"),width:120,sort:!0,resize:!0,template:G=>G?p(G):""}],[h,p]),k=m.useRef(null),T=m.useRef(null),A=m.useMemo(()=>M?["/wx-filemanager-parent-link"]:[...x],[M,x]);function _(G,oe){if(oe&&oe.target&&oe.target.className&&oe.target.className.indexOf("wx-grip")!==-1)return;const le=oe&&(oe.ctrlKey||oe.metaKey),ce=oe&&oe.shiftKey;if(G==="/wx-filemanager-parent-link"){if(x.length&&(le||ce))return;c.exec("select-file",{type:"navigation"});return}let H=G==="body"&&oe?null:G;!k.current&&!T.current?c.exec("select-file",{id:H,toggle:le,range:ce,panel:a}):(k.current=null,T.current=null)}function q(){v.length>1&&c.exec("set-path",{id:v[v.length-2].id,panel:a,selected:[v[v.length-1].id]})}function F(G){if(G==="/wx-filemanager-parent-link")return q();const oe=C.find(le=>le.id===G);oe&&(oe.type==="folder"?c.exec("set-path",{id:oe.id,panel:a}):c.exec("open-file",{id:oe.id}))}function Z(G){const oe=G.key,le=w[b];let ce=le?"asc":"desc";le&&le.key===oe&&(ce=le.order==="asc"?"desc":"asc"),c.exec("sort-files",{key:oe,order:ce,panel:a,path:b})}function D(G){G.intercept("sort-rows",oe=>(k.current=!0,Z(oe),!1)),G.intercept("select-row",()=>!1),G.on("resize-column",()=>T.current=!0),G.intercept("hotkey",()=>!1)}const ee=m.useMemo(()=>b!=="/"?[{id:"/wx-filemanager-parent-link",name:h("Back to parent folder")},...C]:C,[b,C,h]),re=m.useMemo(()=>{if(ee&&w&&w[b]){const{key:G,order:oe}=w[b];return{[G]:{order:oe}}}},[ee,w,b]),Y=m.useRef(null),de=m.useRef();return m.useEffect(()=>{de.current?(de.current.click=_,de.current._dblclick=F):(de.current={click:_,dblclick:G=>de.current._dblclick(G),_dblclick:F},ir(Y.current,de.current))},[_,F]),o.jsxs("div",{onClick:s,onContextMenu:r,className:"wx-SSaVhET7 wx-wrapper",children:[o.jsx(Zv,{panel:a}),o.jsx("div",{"data-id":nn("body"),className:`wx-SSaVhET7 wx-list ${l?"wx-active":""}`,ref:Y,children:o.jsx(Wv,{children:o.jsx(eM,{init:D,data:ee,columns:j,selectedRows:A,columnStyle:()=>"wx-SSaVhET7 wx-each-cell",sizes:{rowHeight:42,headerHeight:42},sortMarks:re})})})]})}function sM(){const a=m.useContext(an),l=Ie(a,"activePanel");function s(r){a.exec("set-active-panel",{panel:r})}return o.jsxs("div",{className:"wx-L55BfJa2 wx-panels","data-id":nn("body"),children:[o.jsx("div",{className:"wx-L55BfJa2 wx-item","data-panel":0,children:o.jsx(hm,{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(hm,{panel:1,active:l==1,onClick:()=>s(1),onContextMenu:()=>s(1)})})]})}function Jv({folderIcon:a=!1,folder:l={}}){const s=m.useContext(an),[r,c]=Aa(s,"panels"),d=Ie(s,"activePanel"),h=m.useMemo(()=>r[d].path,[c,d]),p=m.useContext(ln.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]),w=l.open;return o.jsxs(o.Fragment,{children:[o.jsxs("li",{"data-id":nn(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-${w?"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," "]})]}),w&&l.data&&l.data.length&&x?o.jsx(o.Fragment,{children:l.data.map(M=>M.type==="folder"?o.jsx(Jv,{folder:M},M.id):null)}):null]})}function rM(){const a=m.useContext(an),[l,s]=Aa(a,"data"),[r,c]=Aa(a,"panels"),d=Ie(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=Om(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),w=m.useRef();return m.useEffect(()=>{w.current?(w.current.click=g,w.current.toggle=p):(w.current={click:g,toggle:p},ir(v.current,w.current))},[g,p]),o.jsx("ul",{ref:v,className:"wx-LyHJ6R6A",children:x.map(M=>M.type==="folder"?o.jsx(Jv,{folder:M},M.id):null)})}function oM(){const a=m.useContext(an),l=m.useContext(ln.i18n),s=m.useMemo(()=>l.getGroup("filemanager"),[l]),r=Ie(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 cM({option:a}){const l=m.useContext(ln.i18n).getGroup("filemanager"),s=m.useContext(Fm),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 uM({readonly:a,menuOptions:l}){const s=m.useContext(ln.i18n).getGroup("filemanager"),{showPrompt:r}=m.useContext(Hm);m.useEffect(()=>{TS("upload",cM)},[]);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(ES,{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(rM,{})}),o.jsx(oM,{})]})}function dM({value:a="",onSearch:l}){const[s,r]=Lv(a),c=m.useContext(ln.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 fM({narrowMode:a=!1,onShowTree:l}){const s=m.useContext(an),r=m.useContext(ln.i18n).getGroup("filemanager"),c=Ie(s,"mode"),d=Ie(s,"preview"),h=Ie(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":nn("toggle-tree"),children:o.jsx(es,{onClick:()=>l&&l(),name:"subtask"})}):o.jsx("div",{className:"wx-5PZQQztG wx-name",children:r("Files")}),o.jsx(dM,{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(nS,{onClick:x,value:d,children:o.jsx("i",{className:"wx-5PZQQztG wxi-eye"})})}),o.jsx("div",{className:"wx-5PZQQztG wx-modes",children:o.jsx(Xw,{value:c,options:p,onChange:g})})]})]})}function mM(){const a=m.useContext(an),l=Ie(a,"activePanel");return o.jsxs("div",{className:"wx-NwohNJzN wx-wrapper",children:[o.jsx(Zv,{panel:l}),o.jsx(Wv,{children:o.jsx(Xv,{})})]})}function hM({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=Iv(),w=m.useContext(an),{showPrompt:M,showConfirm:C}=m.useContext(Hm),j=m.useContext(ln.i18n),k=m.useMemo(()=>j.getGroup("filemanager"),[j]),T=Ie(w,"mode"),A=Ie(w,"preview"),_=Ie(w,"activePanel"),[q,F]=Aa(w,"panels"),Z=m.useMemo(()=>(q&&_!=null?q[_]:null)?.selected??[],[F,_]),D=m.useMemo(()=>(q&&_!=null?q[_]:null)?.path,[F,_]),[ee,re]=m.useState([]);m.useEffect(()=>{const te=r.current;if(!te)return;const fe=new ResizeObserver(L=>{const xe=L[0]?.borderBoxSize?.[0]?.inlineSize;typeof xe=="number"&&g(xe<768)});return fe.observe(te),()=>{fe.disconnect()}},[]);const Y=m.useCallback(()=>{b(te=>!te)},[]),de=m.useCallback(te=>{p&&Ro(te)!=="toggle-tree"&&b(!1)},[p]);m.useEffect(()=>{const te=c.current;if(te)return ll(te,de).destroy},[de]),m.useEffect(()=>{const te=c.current;if(!te)return;const fe=new ResizeObserver(()=>{te&&h(te.clientWidth)});return fe.observe(te),te&&h(te.clientWidth),()=>{fe.disconnect()}},[]);const G=m.useMemo(()=>({icon:"wxi-eye",text:"Preview",id:"preview"}),[]),oe=m.useCallback(te=>{let fe=p?[G]:[];return te==="file"&&(fe=[...fe,...l().filter(L=>L.id==="download")]),fe},[p,G,l]),le=m.useRef(null),ce=m.useCallback((te,fe,L)=>{const xe=L?[fe.id]:Z;switch(te){case"download":w.exec("download-file",{id:fe.id});break;case"copy":case"move":le.current={action:te,ids:xe};break;case"paste":le.current&&w.exec(le.current.action==="copy"?"copy-files":"move-files",{ids:le.current.ids,target:fe?.type==="folder"?fe.id:D});break;case"rename":M({item:fe});break;case"delete":C({selected:xe});break;case"preview":w.exec("show-preview",{mode:!A});break}},[w,Z,D,M,C,A]),H=m.useCallback(()=>q?.[_],[q,_]);m.useEffect(()=>{const te=r.current;if(!te)return;const fe=xS(te,{api:w,menuOptions:a?oe:l,performAction:ce,getPanel:H});return()=>{typeof fe=="function"?fe():fe&&typeof fe.destroy=="function"&&fe.destroy()}},[w,a,oe,l,ce,H]);const Q=m.useCallback((te,fe)=>{const L=te?w.getFile(te):null,xe=fe.target.closest(".tree-item.folder");let we;if(a)we=oe(L?.type);else{switch(te){case"body":we=l(te);break;default:if(L)if(!xe&&Z.length>1)we=p?[G,...l("multiselect")]:l("multiselect");else if(te==="/")we=l("folder",L).filter(Se=>Se.id==="paste");else{const Se=l(L.type,L);Se&&(we=p?[G,...Se]:Se)}}T==="search"&&(we=we?.filter(Se=>Se.id!=="paste"))}if(L?.id&&(!Z.length||!Z.some(Se=>Se===L.id))&&!xe&&w.exec("select-file",{id:L.id}),we?.length)return we.forEach(Se=>{xe&&(Se.hotkey=""),Se.text&&(Se.text=k(Se.text)),Se.hotkey&&(Se.subtext=Se.hotkey)}),re(we),L||{}},[w,a,oe,l,Z,p,G,T,k]),J=m.useCallback(te=>{const{action:fe,context:L}=te;fe&&ce(fe.id,L,!fe.hotkey)},[ce]);async function z(te){await Promise.resolve();const{name:fe,size:L}=te.file;w.exec("create-file",{file:{name:fe,size:L,date:new Date,file:te.file},parent:D})}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($f,{narrowMode:p,extraInfo:s})}):o.jsxs(o.Fragment,{children:[o.jsx(fM,{narrowMode:p,onShowTree:Y}),o.jsx(DS,{dataKey:"id",at:"point",options:ee,resolver:Q,onClick:J,children:o.jsxs(Fv,{dataKey:"actionId",options:ee,resolver:Q,onClick:J,children:[o.jsx(OS,{data:v,apiOnly:!0,uploadURL:z}),o.jsx(Fm.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(uM,{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":nn("body"),children:T==="table"?o.jsx(hm,{panel:_}):o.jsx(mM,{})}),A?o.jsx("div",{className:"wx-RJbNonjJ wx-info",children:o.jsx($f,{extraInfo:s})}):null]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`wx-RJbNonjJ wx-content-item${A?"":"-fit"}`,children:T==="panels"?o.jsx(sM,{}):o.jsx(lM,{})}),A?o.jsx("div",{className:"wx-RJbNonjJ wx-info",children:o.jsx($f,{extraInfo:s})}):null]})})})]})})]})})}const pM=a=>a.split("-").map(l=>l?l.charAt(0).toUpperCase()+l.slice(1):"").join("");function gM(a,l){const{type:s,ext:r}=a;if(s==="folder")return!1;let c;return s&&s!=="file"&&_x[s]?c=s:r?c=_x[r]?r:"file":c="unknown",`https://cdn.svar.dev/icons/filemanager/vivid/${l}/${c}.svg`}const xM=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=hS,extraInfo:b=null,init:v=null,icons:w=gM,previews:M=null,...C}=a,j=m.useRef();j.current=C;const k=m.useMemo(()=>new mS(zv),[]),T=m.useMemo(()=>k.in,[k]),A=m.useRef(null);A.current===null&&(A.current=new kv((F,Z)=>{const D="on"+pM(F);j.current&&j.current[D]&&j.current[D](Z)}),T.setNext(A.current));const _=m.useMemo(()=>({getState:k.getState.bind(k),getReactiveState:k.getReactive.bind(k),getStores:()=>({data:k}),exec:T.exec,setNext:F=>(A.current=A.current.setNext(F),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:w==="simple"?(()=>null):w}}),[k,T]),q=m.useRef(0);return m.useEffect(()=>{if(!q.current)v&&v(_);else{const F=k.getState();k.init({data:s,mode:r,drive:c,preview:d,panels:h||F.panels||[],activePanel:p})}q.current++},[k,s,r,c,d,h,p,v,_]),q.current===0&&k.init({data:s,mode:r,drive:c,preview:d,panels:h||[],activePanel:p}),m.useImperativeHandle(l,()=>({..._}),[_]),o.jsx(an.Provider,{value:_,children:o.jsx(_m,{words:zm,optional:!0,children:o.jsx(tM,{children:o.jsx(hM,{readonly:g,menuOptions:x,extraInfo:b})})})})});function vM({fonts:a=!0,children:l}){return l?o.jsx(yx,{fonts:a,children:l}):o.jsx(yx,{fonts:a})}Am(Xn);function Im(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=Im(a,s);if(!Array.isArray(r[l]))throw new Error(`Invalid Hub ${s} response: ${l} must be an array.`);return r[l]}function yM(a,l,s){const r=Im(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 zx(a,l=!1){return Oo(await bt(`/api/remote/filesystem/roots${l?"?refresh=1":""}`,void 0,a),"roots","filesystem roots")}async function qf(a,l){const s=await bt(`/api/remote/filesystem/entries?id=${encodeURIComponent(a)}`,void 0,l);return{folder:yM(s,"folder","filesystem entries"),entries:Oo(s,"entries","filesystem entries")}}async function bM(a,l){return bt("/api/remote/filesystem/selection/scan",{method:"POST",body:JSON.stringify({itemIds:a})},l)}async function wM(a,l,s,r){return bt("/api/remote/files/from-hub",{method:"POST",body:JSON.stringify({itemIds:a,deviceIds:l,remoteDirectory:s})},r)}async function SM(a,l=!1){const s=await bt(`/api/remote/files/jobs?active=${l?"1":"0"}`,void 0,a);return{jobs:Oo(s,"jobs","file transfer jobs")}}async function MM(a,l){return bt(`/api/remote/files/jobs/${encodeURIComponent(a)}`,void 0,l)}async function CM(a,l){return bt(`/api/remote/files/jobs/${encodeURIComponent(a)}/cancel`,{method:"POST"},l)}async function Ox(a){return Oo(await bt("/api/remote/filesystem/shared-folders",void 0,a),"folders","shared folders")}async function jM(a,l){return bt("/api/remote/filesystem/shared-folders",{method:"POST",body:JSON.stringify({sourceId:a})},l)}async function NM(a,l,s){return bt(`/api/remote/filesystem/shared-folders/${encodeURIComponent(a)}`,{method:"PATCH",body:JSON.stringify(l)},s)}async function AM(a,l){return bt(`/api/remote/filesystem/shared-folders/${encodeURIComponent(a)}`,{method:"DELETE"},l)}async function TM(a,l,s,r){const c=await bt(`/api/remote/filesystem/shared-folders/${encodeURIComponent(a)}/sync`,{method:"POST",body:JSON.stringify({deviceIds:l,remoteDirectory:s})},r),d=Im(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 kM(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 Bx(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 EM(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 DM({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),w=m.useRef("/"),M=m.useRef(0),C=m.useRef([]),j=m.useRef(new Map),[k,T]=m.useState(null),[A,_]=m.useState([]),[q,F]=m.useState([]),[Z,D]=m.useState(0),[ee,re]=m.useState(null),[Y,de]=m.useState(!1),[G,oe]=m.useState(""),[le,ce]=m.useState(new Set),H=l.find(ne=>ne.id===k)||null,Q=A[A.length-1]||null,J=H?Q?.svarPath||`/${H.name}`:null,z=J;m.useEffect(()=>{C.current=A,w.current=z||"/"},[z,A]);const te=m.useMemo(()=>(j.current.clear(),!H||!z||A.length===0?[]:(A.forEach(ne=>j.current.set(ne.svarPath,ne.hubId)),[...A.map((ne,pe)=>({id:ne.svarPath,parent:pe===0?"/":A[pe-1].svarPath,type:"folder",name:ne.name,date:ne.modifiedAt?new Date(ne.modifiedAt):void 0,lazy:!1})),...q.map(ne=>{const pe=`${z}/${ne.name}`;return j.current.set(pe,ne.id),{id:pe,parent:z,name:ne.name,type:ne.type==="file"?"file":"folder",...ne.type==="file"?{size:ne.size}:{},date:ne.modifiedAt?new Date(ne.modifiedAt):void 0,lazy:ne.type!=="file"&&ne.hasChildren===!0,displayPath:ne.displayPath,locked:ne.locked,driveType:ne.driveType,totalBytes:ne.totalBytes,freeBytes:ne.freeBytes}})])),[H,q,z,A]),fe=ne=>j.current.get(String(ne))||String(ne),L=ne=>kM({...ne,id:fe(String(ne.id)),parent:fe(String(ne.parent))}),xe=async(ne,pe)=>{const Re=ne[ne.length-1];if(!Re)return;const Le=++M.current;de(!0),oe("");try{const Ce=await qf(Re.hubId,a);if(Le!==M.current)return;if(!Array.isArray(Ce.entries))throw new Error("Invalid Hub filesystem entries response.");const tt={...Re,displayPath:Ce.folder.displayPath||Re.displayPath,modifiedAt:Ce.folder.modifiedAt||Re.modifiedAt},he=[...ne.slice(0,-1),tt];C.current=he,_(he),F(Ce.entries),D(Ht=>Ht+1)}catch(Ce){if(Le!==M.current)return;console.error("[LiveDesk FS] folder navigation failed",{folderId:Re.hubId,error:Ce}),oe(Ce instanceof Error?`${pe}: ${Ce.message}`:`${pe}: Unable to read this folder.`)}finally{Le===M.current&&de(!1)}},we=async ne=>{const pe={svarPath:`/${ne.name}`,hubId:ne.id,name:ne.name,displayPath:ne.displayPath,modifiedAt:ne.modifiedAt},Re=++M.current;T(ne.id),C.current=[pe],_([pe]),w.current=pe.svarPath,F([]),oe(""),de(!0),re(ne.id),ce(Le=>{const Ce=new Set(Le);return Ce.delete(ne.id),Ce});try{const Le=await qf(ne.id,a);if(Re!==M.current)return;if(!Array.isArray(Le.entries))throw new Error("Invalid Hub filesystem entries response.");const Ce={...pe,displayPath:Le.folder.displayPath||pe.displayPath,modifiedAt:Le.folder.modifiedAt||pe.modifiedAt};C.current=[Ce],_([Ce]),F(Le.entries),D(tt=>tt+1)}catch(Le){if(Re!==M.current)return;console.error("[LiveDesk FS] getEntries failed",{rootId:ne.id,error:Le}),ce(Ce=>new Set(Ce).add(ne.id)),oe(Le instanceof Error?`${ne.name}: ${Le.message}`:`${ne.name}: Unable to read this drive.`),b(Le instanceof Error?`${ne.name}: ${Le.message}`:`${ne.name}: Unable to read this drive.`)}finally{Re===M.current&&(re(null),de(!1))}},Se=ne=>{const pe=C.current;ne<0||ne>=pe.length||ne===pe.length-1||xe(pe.slice(0,ne+1),pe[ne].name)},ze=(ne,pe)=>{if(ne.type!=="folder")return;const Re=C.current,Le=Re.findIndex(tt=>tt.svarPath===pe);if(Le<0)return;const Ce={svarPath:`${pe}/${ne.name}`,hubId:ne.id,name:ne.name,displayPath:ne.displayPath,modifiedAt:ne.modifiedAt};xe([...Re.slice(0,Le+1),Ce],ne.name)},qe=()=>Se(C.current.length-2),Oe=ne=>{if(ne.key!=="Enter"&&ne.code!=="Enter"&&ne.code!=="NumpadEnter"||ne.target?.closest('button, input, textarea, [contenteditable="true"]'))return;const Re=v.current;if(!Re)return;const Le=Re.getState().panels?.flatMap(tt=>tt.selected||[])||[];if(Le.length!==1)return;const Ce=Re.getFile(String(Le[0]));Ce?.type==="folder"&&(ne.preventDefault(),ne.stopPropagation(),ze(L(Ce),String(Ce.parent||w.current)))};m.useEffect(()=>{const ne=l.find(pe=>pe.id===k)||EM(l);if(ce(pe=>new Set([...pe].filter(Re=>l.some(Le=>Le.id===Re)))),!ne){T(null),C.current=[],_([]),F([]);return}we(ne)},[l]);const _e=ne=>{v.current=ne,ne.on("request-data",async({id:pe})=>{const Re=String(pe),Le=fe(Re);try{const Ce=await qf(Le,a);if(!Array.isArray(Ce.entries))throw new Error("Invalid Hub filesystem entries response.");const tt=Ce.entries.map(he=>{const Ht=`${Re}/${he.name}`;return j.current.set(Ht,he.id),{id:Ht,parent:Re,name:he.name,type:he.type==="file"?"file":"folder",...he.type==="file"?{size:he.size}:{},date:he.modifiedAt?new Date(he.modifiedAt):void 0,lazy:he.type!=="file"&&he.hasChildren===!0,displayPath:he.displayPath,locked:he.locked,driveType:he.driveType,totalBytes:he.totalBytes,freeBytes:he.freeBytes}});await ne.exec("provide-data",{id:Re,data:tt})}catch(Ce){console.error("[LiveDesk FS] nested getEntries failed",{id:Le,error:Ce}),b(Ce instanceof Error?Ce.message:"Unable to read this folder.")}}),ne.intercept("set-path",({id:pe})=>{const Re=String(pe),Le=C.current.findIndex(tt=>tt.svarPath===Re);if(Le>=0)return Se(Le),!1;const Ce=ne.getFile(Re);if(Ce?.type==="folder")return ze(L(Ce),String(Ce.parent||w.current)),!1}),ne.intercept("open-file",()=>!1),ne.on("select-file",()=>{window.setTimeout(()=>{const Le=(ne.getState().panels?.flatMap(Ce=>Ce.selected||[])||[]).map(Ce=>ne.getFile(Ce)).filter(Boolean).map(Ce=>L(Ce));p(Le.map(Ce=>Ce.id),Le)},0)})},Ge=(ne,pe)=>{const Re=pe?L(pe):null,Le=()=>{const Ce=Re?.type==="file"?String(pe?.parent||w.current):String(pe?.id||w.current);v.current?.exec("request-data",{id:Ce})};return ne==="body"?[{id:"refresh",text:"Refresh",icon:"mdi mdi-refresh",handler:Le},{id:"properties",text:"Properties",icon:"mdi mdi-information-outline",handler:()=>b("Select a file or folder to view its properties.")}]:ne==="multiselect"?[{id:"share",text:"Share to workstations",icon:"mdi mdi-share-variant",handler:()=>{(v.current?.getState().panels?.flatMap(tt=>tt.selected||[])||[]).forEach(tt=>{const he=v.current?.getFile(tt);he&&g(L(he))})}},{id:"refresh",text:"Refresh",icon:"mdi mdi-refresh",handler:Le}]:Re?[{id:"share",text:"Share to workstations",icon:"mdi mdi-share-variant",handler:()=>g(Re)},...Re.type==="folder"?[{id:"sync",text:"Add folder to Sync",icon:"mdi mdi-folder-sync-outline",handler:()=>x(Re)}]:[],{id:"copy-path",text:"Copy path",icon:"mdi mdi-content-copy",handler:()=>{Zi(Re.displayPath||Re.name)}},{id:"refresh",text:"Refresh",icon:"mdi mdi-refresh",handler:Le},{id:"properties",text:"Properties",icon:"mdi mdi-information-outline",handler:()=>b(`${Re.name}
12
+ ${Re.displayPath||""}`)}]:[]},Te=async()=>{try{await c()}catch(ne){b(ne instanceof Error?ne.message:"Unable to refresh Hub drives.")}},Ct=[{id:"local",label:"Local drives",icon:xo,roots:l.filter(ne=>pu(ne)==="local")},{id:"removable",label:"Removable drives",icon:Db,roots:l.filter(ne=>pu(ne)==="removable")},{id:"network",label:"Network drives",icon:lv,roots:l.filter(ne=>pu(ne)==="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(xo,{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(iv,{size:16})}),o.jsx("button",{className:"icon-button",onClick:h,title:"Import folder from this browser",type:"button",children:o.jsx(Rb,{size:16})}),o.jsx("button",{className:"icon-button",onClick:()=>{Te()},title:"Refresh drives",type:"button",children:o.jsx(Au,{size:16})})]})]}),s?o.jsxs("div",{className:"hub-file-explorer-state",children:[o.jsx(xo,{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(em,{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(xo,{size:15}),o.jsx("strong",{children:"This PC"})]}),Ct.map(ne=>ne.roots.length>0&&o.jsxs("section",{className:"hub-drive-group",children:[o.jsxs("h3",{children:[o.jsx(ne.icon,{size:13}),ne.label]}),o.jsx("div",{className:"hub-drive-list",children:ne.roots.map(pe=>{const Re=ne.icon,Le=le.has(pe.id)||pe.locked===!0;return o.jsxs("button",{className:`hub-drive-item ${k===pe.id?"active":""} ${Le?"unavailable":""}`,onClick:()=>{we(pe)},"aria-pressed":k===pe.id,type:"button",children:[o.jsx("span",{className:"hub-drive-item-icon",children:o.jsx(Re,{size:16})}),o.jsxs("span",{className:"hub-drive-item-copy",children:[o.jsx("strong",{children:pe.name}),o.jsx("small",{children:pe.displayPath||pe.name}),o.jsxs("em",{children:[Bx(pe.freeBytes||0)," free / ",Bx(pe.totalBytes||0)]})]}),ee===pe.id?o.jsx(Fg,{className:"hub-drive-item-status spin",size:15}):Le?o.jsx(Ig,{className:"hub-drive-item-status",size:15}):null]},pe.id)})})]},ne.id)),l.length===0&&o.jsxs("div",{className:"hub-drive-sidebar-empty",children:[o.jsx(em,{size:17}),o.jsx("span",{children:"No drives available."})]})]}),o.jsxs("div",{className:"hub-file-explorer-browser",children:[o.jsxs("div",{className:"hub-file-explorer-navigation",children:[o.jsx("nav",{className:"hub-file-explorer-breadcrumbs","aria-label":"Current Hub folder",children:A.map((ne,pe)=>o.jsxs("span",{className:"hub-file-explorer-breadcrumb-item",children:[pe>0&&o.jsx(Mm,{size:13,"aria-hidden":"true"}),o.jsx("button",{className:`hub-file-explorer-breadcrumb ${pe===A.length-1?"current":""}`,onClick:()=>Se(pe),"aria-current":pe===A.length-1?"location":void 0,type:"button",children:ne.name})]},ne.svarPath))}),o.jsxs("div",{className:"hub-file-explorer-navigation-actions",children:[Y&&o.jsx(Fg,{className:"hub-file-explorer-loading-icon spin",size:15,"aria-label":"Loading folder"}),o.jsx("button",{className:"icon-button",onClick:qe,disabled:A.length<=1||Y,title:"Back to parent folder",type:"button",children:o.jsx(Lb,{size:16})})]})]}),G&&o.jsxs("div",{className:"hub-file-explorer-folder-error",role:"alert",children:[o.jsx(Ig,{size:15}),o.jsx("span",{children:G})]}),o.jsx("div",{className:"hub-file-explorer-svar",onKeyDownCapture:Oe,children:o.jsx(vM,{fonts:!1,children:o.jsx(xM,{data:te,panels:J?[{path:J,selected:[]}]:void 0,readonly:!0,mode:"table",preview:!1,init:_e,icons:"simple",menuOptions:Ge},`${H?.id||"no-root"}:${Z}`)})})]})]})]})}class RM 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(_b,{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 LM(a){return a.deviceName||a.hostname||a.deviceId}function _M({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(zb,{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:LM(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 zM(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 OM({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 / ",zM(x.totalBytes)," · ",x.lastSyncedAt?`Last sync ${cm(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(Ob,{size:15})})]},x.id))})]})}function BM(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(_M,{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(OM,{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 HM(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 Hx(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 Fx(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 Ix(a){return["completed","partially-failed","failed","cancelled"].includes(a)}function FM({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:w,onBrowserFileImport:M,onBrowserFolderImport:C,onNotice:j,onTransferChange:k}){const T=Array.isArray(l)?l:[],[A,_]=m.useState([]),[q,F]=m.useState(!0),[Z,D]=m.useState(""),[ee,re]=m.useState([]),[Y,de]=m.useState([]),[G,oe]=m.useState(null),[le,ce]=m.useState(!1),[H,Q]=m.useState([]),[J,z]=m.useState(!0),[te,fe]=m.useState(!1),[L,xe]=m.useState("send"),[we,Se]=m.useState([]),ze=m.useRef(new Set),qe=m.useMemo(()=>p==="all"?T.map(ve=>ve.deviceId):g.filter(ve=>T.some(ke=>ke.deviceId===ve)),[T,g,p]),Oe=we.find(ve=>!Ix(ve.state)),_e=Y.length===1&&Y[0].type==="folder"?Y[0]:null,Ge=Y.length===0?"Select files or folders from the Hub explorer.":le?"Calculating selection size...":G?`${G.files} files, ${G.folders} folders · ${HM(G.totalBytes)}`:`${Y.length} item${Y.length===1?"":"s"} selected`,Te=ve=>{k({id:ve.jobId,state:ve.state,progress:Hx(ve),message:Fx(ve)})},Ct=m.useCallback(async()=>{const ve=await zx(a,!0);return _(ve),D(""),ve},[a]),ne=async()=>{try{const ke=(await SM(a,!0)).jobs||[],He=await Promise.all([...ze.current].map(async Ve=>{try{return await MM(Ve,a)}catch{return null}})),Pt=[...ke,...He.filter(Boolean)],yn=[...new Map(Pt.map(Ve=>[Ve.jobId,Ve])).values()];Se(yn),yn.forEach(Te),yn.filter(Ve=>Ix(Ve.state)).forEach(Ve=>ze.current.delete(Ve.jobId))}catch{}};m.useEffect(()=>{let ve=!0;F(!0),D(""),Promise.all([Ct(),Ox(a).then(He=>{ve&&Q(He)})]).catch(He=>{ve&&(D(He instanceof Error?"Hub file system is unavailable. Make sure LiveDesk Hub is running on this computer.":"Hub file system is unavailable."),j(He instanceof Error?He.message:"Hub file system is unavailable."))}).finally(()=>{ve&&(F(!1),z(!1))}),ne();const ke=window.setInterval(()=>{ne()},800);return()=>{ve=!1,window.clearInterval(ke)}},[a,Ct]),m.useEffect(()=>{if(ee.length===0){oe(null);return}let ve=!1;return ce(!0),bM(ee,a).then(ke=>{ve||oe(ke)}).catch(ke=>{ve||j(ke instanceof Error?ke.message:"Unable to calculate selected size.")}).finally(()=>{ve||ce(!1)}),()=>{ve=!0}},[a,ee.join("|")]);const pe=(ve,ke)=>{re(ve),de(ke)},Re=ve=>{ve.forEach(ke=>ze.current.add(ke.jobId)),Se(ke=>[...new Map([...ke,...ve].map(He=>[He.jobId,He])).values()]),ve.forEach(Te)},Le=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(Oe){j("A Hub transfer is already running.");return}try{const ve=await wM(ee,qe,d.trim(),a);ze.current.add(ve.jobId),j("Hub transfer queued."),await ne()}catch(ve){j(ve instanceof Error?ve.message:"Unable to start Hub transfer.")}},Ce=async ve=>{const ke=ve||_e;if(!ke||ke.type!=="folder"){j("Select one folder to add it to Sync.");return}try{const He=await jM(ke.id,a);Q(Pt=>[...Pt.filter(yn=>yn.id!==He.folder.id),He.folder]),xe("sync"),j(`${ke.name} is ready for Hub sync.`)}catch(He){j(He instanceof Error?He.message:"Unable to add the Hub folder to Sync.")}},tt=async ve=>{if(qe.length===0){j("Choose at least one connected workstation.");return}fe(!0),Q(ke=>ke.map(He=>He.id===ve.id?{...He,status:"syncing"}:He));try{const ke=await TM(ve.id,qe,d.trim(),a);Re(ke.jobs||[]),j(ke.jobs?.length?"Hub sync queued.":"No changed files to sync.");const He=await Ox(a);Q(He)}catch(ke){j(ke instanceof Error?ke.message:"Unable to sync the Hub folder."),Q(He=>He.map(Pt=>Pt.id===ve.id?{...Pt,status:"error",message:"Sync failed"}:Pt))}finally{fe(!1)}},he=async()=>{fe(!0);try{for(const ve of H)await tt(ve)}finally{fe(!1)}},Ht=async ve=>{try{const ke=await NM(ve.id,{autoSync:!ve.autoSync},a);Q(He=>He.map(Pt=>Pt.id===ve.id?ke.folder:Pt))}catch(ke){j(ke instanceof Error?ke.message:"Unable to update auto sync.")}},Be=async ve=>{try{await AM(ve.id,a),Q(ke=>ke.filter(He=>He.id!==ve.id))}catch(ke){j(ke instanceof Error?ke.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:ve=>{ve.currentTarget.files&&M(ve.currentTarget.files),ve.currentTarget.value=""}}),o.jsx("input",{ref:w,className:"hidden-file-input",type:"file",multiple:!0,webkitdirectory:"",directory:"",onChange:ve=>{ve.currentTarget.files&&C(ve.currentTarget.files),ve.currentTarget.value=""}}),(c||Z)&&o.jsxs("section",{className:"file-share-notice",role:Z?"alert":void 0,children:[Z||c,o.jsx("button",{className:"icon-button",onClick:()=>{D(""),F(!0),zx(a).then(ve=>_(ve)).catch(()=>D("Hub file system is unavailable.")).finally(()=>F(!1))},title:"Retry",type:"button",children:o.jsx(Au,{size:15})})]}),o.jsx("div",{className:"file-share-workspace",children:o.jsxs(RM,{onRetry:()=>window.location.reload(),children:[o.jsx(DM,{hubUrl:a,roots:A,loading:q,error:Z,onRefreshRoots:Ct,onImportFiles:()=>v.current?.click(),onImportFolder:()=>w.current?.click(),onSelectionChange:pe,onShareItem:ve=>{re([ve.id]),de([ve]),xe("send")},onAddSyncFolder:ve=>{re([ve.id]),de([ve]),Ce(ve)},onNotice:j}),o.jsx(BM,{devices:T,targetMode:p,selectedTargetIds:g,onTargetModeChange:x,onTargetToggle:b,remoteDirectory:d,onRemoteDirectoryChange:h,selectedEntries:Y,selectedSummary:Ge,canShare:s&&!Oe&&ee.length>0&&qe.length>0&&!le,onShare:()=>{Le()},canAddSync:!!_e,onAddSync:()=>{Ce()},tab:L,onTabChange:xe,folders:H,foldersLoading:J,syncBusy:te,onSyncAll:()=>{he()},onSync:ve=>{tt(ve)},onToggleAuto:ve=>{Ht(ve)},onRemove:ve=>{Be(ve)},onAddFolder:()=>{Ce()}})]})}),Oe&&o.jsx("footer",{className:"file-share-workspace-footer",children:o.jsxs("span",{children:[Fx(Oe)," · ",Hx(Oe),"% ",o.jsx("button",{className:"icon-button",onClick:()=>{CM(Oe.jobId,a).then(ve=>{Se(ke=>ke.map(He=>He.jobId===ve.jobId?ve:He)),Te(ve)})},title:"Cancel transfer",type:"button",children:o.jsx(tm,{size:14})})]})})]})}const IM=120,UM=999,er=5,bo=30,$M=Number.POSITIVE_INFINITY,ey="livedesk.remoteDirectory",pm="livedesk.localHubAccessEnabled",ty="livedesk.streamSettings",ny=15,ay="livedesk.controlStreamSettings",gm=6,Gf=512*1024,xm="".trim(),ly="".trim(),Ux="livedesk-adsense-script",Pf=!!xm&&!!ly,qM=1e3/60,Yf=1500,GM=650,PM=1800,YM=650,VM=2500,$x=1500,qx=15e3,Gx=240,KM=1024,QM=480,XM=270;function ZM(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:$M,audience:"Business and studios",note:"Commercial use and larger workstation walls."}},iy={"mode1-jpeg":5,"mode2-lzo":8,"mode3-h264-hw":20,"mode4-h264-atlas":20};function el(a,l){return`${a}:${l}`}const Yn={frameMode:"mode3-h264-hw",h264DecodeAcceleration:"prefer-hardware",fps:iy["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},Vn={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 Um(a,l){a.push(l),a.length>Gx&&a.splice(0,a.length-Gx)}function Px(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 Yx(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),Um(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 Vx(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 WM(){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=w=>{document.visibilityState==="visible"?(c+=1,d>0&&Um(h,Math.max(0,w-d)),d=w):d=0,s=window.requestAnimationFrame(b)};try{x=new PerformanceObserver(w=>{for(const M of w.getEntries())p+=1,g+=M.duration}),x.observe({entryTypes:["longtask"]})}catch{x=null}s=window.requestAnimationFrame(b);const v=window.setInterval(()=>{const w=performance.now(),M=Math.max(1,w-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=w,c=0,h=[],p=0,g=0},1e3);return()=>{window.cancelAnimationFrame(s),window.clearInterval(v),x?.disconnect()}},[]),a}function Kx(a){return!a||a.seqGapCount<=0?"none":`${a.seqGapCount} gaps / max ${a.maxSeqGap}`}function JM(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"}],vm=[{id:"prefer-software",label:"Software low latency"},{id:"prefer-hardware",label:"Hardware decode"},{id:"no-preference",label:"Browser auto"}],eC=[{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),Kf=[{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}],$m=[1,2,5,8,12,20,30],tC=[20,30,60],Qx=[45,60,75,90],Xx={large:{maxWidth:1280,maxHeight:720},medium:{maxWidth:960,maxHeight:540},small:{maxWidth:640,maxHeight:360}},vn={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},Zx=2200,nC=8e3,aC=3500,lC=2600,iC=4200,sC=750,rC=2,Wx=4200;function Jx(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 oC(){return"npx -y livedesk client"}function cC(){return"npx -y livedesk"}function uC(){try{return localStorage.getItem(ey)||""}catch{return""}}function dC(){try{return localStorage.getItem(pm)==="1"}catch{return!1}}function Zs(a){try{a?localStorage.setItem(pm,"1"):localStorage.removeItem(pm)}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 ym(a){const l=String(a||"").trim();return l==="mode2-lz4"||l==="lz4"?"mode2-lzo":xu.some(s=>s.id===l)?l:Yn.frameMode}function Nu(a){const l=String(a||"").trim();return vm.some(s=>s.id===l)?l:Yn.h264DecodeAcceleration}function bm(a){return a==="mode3-h264-hw"||a==="mode5-lzo-delta"?a:Vn.frameMode}function sy(a){return iy[a]||12}function ry(a){return a==="mode3-h264-hw"||a==="mode4-h264-atlas"?20:30}function wm(a,l){return Na(a,1,ry(l),sy(l))}function ts(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}function Pn(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 fC(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 oy(a,l){const s=fC(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 mC(a){const l=Pn(a);return Array.from({length:l},(s,r)=>oy(a,r))}function hC(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 cy(a,l){const s=oy(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 uy(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 pC(a,l,s){const d=((typeof l?.monitorIndex=="number"?ra(l.monitorIndex,Math.max(1,l.monitorCount||1)):s)===s?uy(l):null)||cy(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 gC(){try{const a=JSON.parse(localStorage.getItem(ty)||"{}");if(![ny,14,13,12,11].includes(Number(a.version)))return Yn;const l=ym(a.frameMode),s=Na(a.maxWidth,320,3840,Yn.maxWidth),r=Na(a.maxHeight,180,2160,Yn.maxHeight);return{frameMode:l,h264DecodeAcceleration:Nu(a.h264DecodeAcceleration),fps:wm(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,Yn.quality),autoStartLive:typeof a.autoStartLive=="boolean"?a.autoStartLive:Yn.autoStartLive,showScreenStatus:typeof a.showScreenStatus=="boolean"?a.showScreenStatus:Yn.showScreenStatus,visibleOnlyLive:typeof a.visibleOnlyLive=="boolean"?a.visibleOnlyLive:Yn.visibleOnlyLive,adaptiveLoadShedding:typeof a.adaptiveLoadShedding=="boolean"?a.adaptiveLoadShedding:Yn.adaptiveLoadShedding,adaptiveSizeByWall:typeof a.adaptiveSizeByWall=="boolean"?a.adaptiveSizeByWall:Yn.adaptiveSizeByWall}}catch{return Yn}}function xC(a){try{localStorage.setItem(ty,JSON.stringify({...a,version:ny}))}catch{}}function vC(){try{const a=JSON.parse(localStorage.getItem(ay)||"{}"),l=Number(a.version);if(![gm,5,4,3,2,1].includes(l))return Vn;const s=Na(a.fps,20,60,Vn.fps),r=l<gm;return{frameMode:r?Vn.frameMode:bm(a.frameMode),h264DecodeAcceleration:r?Vn.h264DecodeAcceleration:Nu(a.h264DecodeAcceleration),fps:r?Vn.fps:s,maxWidth:Na(a.maxWidth,1280,3840,Vn.maxWidth),maxHeight:Na(a.maxHeight,720,2160,Vn.maxHeight),quality:Na(a.quality,20,95,Vn.quality),showScreenStatus:typeof a.showScreenStatus=="boolean"?a.showScreenStatus:Vn.showScreenStatus}}catch{return Vn}}function yC(a){try{localStorage.setItem(ay,JSON.stringify({...a,version:gm}))}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 bC(a){return vn.fallbackVisibleCounts[a]||vn.fallbackVisibleCounts.large}function wC(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=Xx[l]||Xx.large;return{maxWidth:Math.min(a.maxWidth,r.maxWidth),maxHeight:Math.min(a.maxHeight,r.maxHeight)}}function SC(a,l=vn.minFps){const s=[...$m].sort((c,d)=>c-d),r=Math.max(l,Math.floor(a/2));return[...s].reverse().find(c=>c<a&&c>=l)||r}function MC(a,l){return[...$m].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 ev(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 Xf(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`${ev(s)} / ${ev(a)}`}function CC(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 tv(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 jC(a){return a===1?"middle":a===2?"right":"left"}function nv(a,...l){for(const s of l){const r=a?.[s];if(typeof r=="string"&&r.trim())return r.trim()}return""}function go(a){const l=Number(a);return Number.isInteger(l)&&l>=1&&l<=UM?l:0}const NC={cpu:"CPU",memory:"MEM",disk:"Disk",gpu:"GPU",vram:"VRAM",npu:"NPU",temp:"Temp",network:"Net"};function AC(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=NC[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 Tt(a,...l){for(const s of l){const r=zu(a,s),c=Number(r);if(Number.isFinite(c))return c}}function Kn(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 TC(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 Zf(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 Wf(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 dy(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=Kn(a,`tools.${l}.status`,`tooling.${l}.status`,`${l}.status`).toLowerCase(),d=TC(a,`tools.${l}.running`,`tooling.${l}.running`,`${l}.running`),h=Kn(a,`tools.${l}.version`,`tooling.${l}.version`,`${l}.version`),p=Kn(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 fy(a){const l=a.status||{},s=Tt(l,"cpu.cores","cpuCores","processorCount"),r=Tt(l,"loadavg.0","cpu.load1"),c=Hl(Tt(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=Tt(l,"memory.totalBytes","totalMem"),h=Tt(l,"memory.freeBytes","freeMem"),p=Hl(Tt(l,"memory.usedRatio","memory.usedPct","usedMemRatio"))??Zf(d,h),g=Tt(l,"disk.totalBytes","rootDisk.totalBytes","storage.totalBytes"),x=Tt(l,"disk.freeBytes","rootDisk.freeBytes","storage.freeBytes"),b=Hl(Tt(l,"disk.usedRatio","disk.usedPct","rootDisk.usedRatio","storage.usedRatio"))??Zf(g,x),v=Tt(l,"thermal.cpuC","temperatureC","cpu.temperatureC","gpu.temperatureC"),w=Hl(Tt(l,"gpu.usedRatio","gpu.usageRatio","gpu.usedPct","gpu.usagePct","gpu.percent","accelerators.gpu.usageRatio")),M=Kn(l,"gpu.name","gpu.model","accelerators.gpu.name"),C=Tt(l,"gpu.memory.totalBytes","gpu.totalMemoryBytes","gpu.vramTotalBytes"),j=Tt(l,"gpu.memory.freeBytes","gpu.freeMemoryBytes","gpu.vramFreeBytes"),k=Hl(Tt(l,"gpu.memory.usedRatio","gpu.vramUsedRatio"))??Zf(C,j),T=Tt(l,"gpu.temperatureC","thermal.gpuC"),A=Hl(Tt(l,"npu.usedRatio","npu.usageRatio","npu.usedPct","npu.usagePct","npu.percent","accelerators.npu.usageRatio")),_=Kn(l,"npu.name","npu.model","accelerators.npu.name"),q=Tt(l,"npu.tops","npu.topsInt8","accelerators.npu.tops"),F=Tt(l,"network.rxMbps","network.receiveMbps","network.downMbps"),Z=Tt(l,"network.txMbps","network.transmitMbps","network.upMbps"),D=Tt(l,"network.latencyMs","network.rttMs"),ee=Hl(Tt(l,"network.usedRatio","network.usageRatio","network.saturationRatio")),re=Kn(l,"network.link","network.interface","network.name"),Y=v===void 0?void 0:Hl((v-35)/60),de=Kn(l,"workload.role","role","lane")||(To(a,"aiAssist")?"Agent worker":To(a,"taskDispatch")?"Task worker":"Local machine"),G=Kn(a.latestTask,"status")||Kn(l,"workload.status")||"idle",oe=Kn(a.latestTask,"title","instructionPreview")||Kn(l,"workload.title"),le=Kn(a.latestTask,"resultSummary","error","instructionPreview")||Kn(l,"workload.summary"),ce=[uu(l,"ollama","Ollama"),uu(l,"lmStudio","LM Studio"),uu(l,"comfyui","ComfyUI"),uu(l,"stableDiffusion","Stable Diffusion")],H=ce.some(L=>L.status!=="unknown"),Q=Date.parse(a.lastSeenAt||a.connectedAt||""),J=Number.isFinite(Q)?Date.now()-Q:0;let z="online";a.connected?J>5*6e4?z="stale":(v??0)>=86||(T??0)>=88||(c??0)>=.94||(w??0)>=.96||(k??0)>=.96||(A??0)>=.96||(p??0)>=.94||(b??0)>=.94||(D??0)>=200||G==="failed"?z="critical":(v??0)>=78||(T??0)>=80||(c??0)>=.82||(w??0)>=.86||(k??0)>=.88||(A??0)>=.86||(p??0)>=.82||(b??0)>=.86||(D??0)>=80?z="warn":(["queued","running","targeted"].includes(G)||ce.some(L=>L.status==="busy"))&&(z="busy"):z="offline";const te=ce.filter(L=>L.status==="online"||L.status==="busy").length,fe=[{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:Xf(d,h),ratio:p,state:Xi(p,.92,.78)},{id:"disk",label:"DISK",value:Ws(b),detail:Xf(g,x),ratio:b,state:Xi(b,.92,.82)},{id:"gpu",label:"GPU",value:Ws(w),detail:M||(C&&j!==void 0?`${wo(j)} VRAM free`:T!==void 0?`${Math.round(T)}C`:"not reported"),ratio:w,state:T!==void 0&&T>=88?"critical":T!==void 0&&T>=80?"warn":Xi(w,.96,.86)},{id:"vram",label:"VRAM",value:Ws(k),detail:Xf(C,j),ratio:k,state:Xi(k,.96,.88)},{id:"npu",label:"NPU",value:A!==void 0?Ws(A):q!==void 0?`${Math.round(q)} TOPS`:"-",detail:_||(q!==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:te>0?`${te} local tools`:`uptime ${dy(Tt(l,"uptimeSec"))}`,ratio:Y,state:v===void 0?"unknown":v>=86?"critical":v>=78?"warn":"good"},{id:"network",label:"NET",value:Wf(F)||(D!==void 0?`${Math.round(D)}ms`:re||"-"),detail:Wf(Z)?`${Wf(Z)} up`:re||"not reported",ratio:ee,state:D!==void 0&&D>=200?"critical":D!==void 0&&D>=80?"warn":Xi(ee,.9,.75)}];return{state:z,label:AC(z,fe,G),role:de,taskLabel:oe||(G==="idle"?"idle":G),taskStatus:G,taskSummary:le,tools:H?ce:ce.map(L=>({...L,detail:"not reported"})),metrics:fe}}const kC=[{id:"small",label:"Small"},{id:"medium",label:"Medium"},{id:"large",label:"Large"}],EC=[{id:"wall",label:"Wall",icon:nm,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:am,accent:"amber"},{id:"pricing",label:"Pricing",icon:yo,accent:"green"}];function Bt(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=>Bt(l))}function gn(a){return{languageName:a.languageName,languageLabel:a.languageLabel,eyebrow:a.eyebrow,title:Bt(a.title),intro:Bt(a.intro),sections:[{title:Bt(a.managerTitle),body:Bt(a.managerBody),points:Js(a.managerPoints)},{title:Bt(a.clientTitle),body:Bt(a.clientBody),points:Js(a.clientPoints)},{title:Bt(a.syncTitle),body:Bt(a.syncBody),points:Js(a.syncPoints)},{title:Bt(a.platformTitle),body:Bt(a.platformBody),points:Js(a.platformPoints)}],sync:{title:Bt(a.syncTitle),body:Bt(a.syncBody),points:Js(a.syncPoints)},firewall:{title:Bt(a.firewallTitle),body:Bt(a.firewallBody),points:Js(a.firewallPoints)},commands:{title:Bt(a.commandsTitle),body:Bt(a.commandsBody),manager:Bt(a.managerCommandLabel),primary:Bt(a.clientCommandLabel),slot:Bt(a.slotCommandLabel),manual:Bt(a.manualCommandLabel)}}}const ar={ko:gn({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:gn({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:gn({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":gn({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":gn({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:gn({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:gn({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:gn({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":gn({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:gn({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:gn({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:gn({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:gn({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:gn({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:gn({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:gn({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ı"})},DC=Object.entries(ar).map(([a,l])=>({id:a,label:l.languageName}));function RC(){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(ar[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(ar[r])return r}return"en"}function av({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 Jf({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:w,presentationReady:M}){const C=m.useRef(null),j=m.useRef(null),k=m.useRef(0),T=m.useRef(null),A=fy(a),_=["cpu","gpu","memory","vram"].map(z=>A.metrics.find(te=>te.id===z)).filter(z=>!!z),q=ra(d,h),F=h>1,Z=M??!!l,D=pC(a,l,q),ee=D>=ou?100:D/ou*100,re=D>=ou?ou/D*100:100,Y={"--screen-aspect":D.toFixed(5),"--screen-content-width":`${Math.max(1,Math.min(100,ee)).toFixed(3)}%`,"--screen-content-height":`${Math.max(1,Math.min(100,re)).toFixed(3)}%`},de=m.useCallback(z=>{C.current=z,v(a.deviceId,z)},[a.deviceId,v]),G=z=>{const te=z.currentTarget.getBoundingClientRect();return{normalizedX:Math.max(0,Math.min(1,(z.clientX-te.left)/Math.max(1,te.width))),normalizedY:Math.max(0,Math.min(1,(z.clientY-te.top)/Math.max(1,te.height)))}},oe=z=>({shiftKey:z.shiftKey,ctrlKey:z.ctrlKey,altKey:z.altKey,metaKey:z.metaKey}),le=m.useCallback(()=>{T.current!==null&&(window.cancelAnimationFrame(T.current),T.current=null)},[]),ce=m.useCallback(()=>{const z=j.current;if(!z)return;j.current=null;const te=Number(z.input.normalizedX),fe=Number(z.input.normalizedY);if(!Number.isFinite(te)||!Number.isFinite(fe))return;w(a.deviceId,{...z.input,normalizedX:te,normalizedY:fe})&&(k.current=performance.now())},[a.deviceId,w]),H=m.useCallback(()=>{T.current===null&&(T.current=window.requestAnimationFrame(()=>{T.current=null,ce()}))},[ce]);m.useEffect(()=>()=>{le(),j.current=null},[le]);const Q=(z,te)=>{if(!r)return;const fe={type:te,monitorIndex:q,...G(z),button:jC(z.button),...oe(z)};if(te==="pointermove"){const L=performance.now();j.current={input:fe},L-k.current>=qM&&(le(),ce()),H();return}j.current&&(le(),ce()),w(a.deviceId,fe)},J=m.useCallback(z=>{const te=document.activeElement;te instanceof HTMLElement&&z.contains(te)&&te.classList.contains("monitor-cycle-button")&&te.blur()},[]);return o.jsx("article",{className:`device-tile ${s?"selected":""} ${a.connected?"online":"offline"}`,"data-live-device-id":a.deviceId,style:Y,children:o.jsxs("div",{className:`tile-screen ${Z?"has-frame":"is-empty"}`,role:"button",tabIndex:r?-1:0,"aria-pressed":s,onClick:()=>{r||p()},onKeyDown:z=>{r||(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),p())},onDoubleClick:z=>{z.preventDefault(),x()},onPointerLeave:z=>J(z.currentTarget),children:[o.jsx("span",{className:`screen-content ${Z?"has-frame":"is-empty"}`,children:o.jsx("canvas",{ref:de,className:`remote-canvas ${Z?"has-frame":"is-empty"}`,tabIndex:r?0:-1,onPointerDown:z=>{r&&(z.preventDefault(),z.stopPropagation(),g(),z.currentTarget.focus(),z.currentTarget.setPointerCapture(z.pointerId),Q(z,"pointerdown"))},onPointerMove:z=>{r&&z.preventDefault(),Q(z,"pointermove")},onPointerUp:z=>{r&&(z.preventDefault(),z.stopPropagation(),Q(z,"pointerup"),z.currentTarget.hasPointerCapture(z.pointerId)&&z.currentTarget.releasePointerCapture(z.pointerId))},onPointerCancel:z=>{z.currentTarget.hasPointerCapture(z.pointerId)&&z.currentTarget.releasePointerCapture(z.pointerId)},onWheel:z=>{r&&(z.preventDefault(),w(a.deviceId,{type:"wheel",monitorIndex:q,...G(z),deltaX:z.deltaX,deltaY:z.deltaY,...oe(z)}))},onKeyDown:z=>{r&&(z.preventDefault(),z.stopPropagation(),w(a.deviceId,{type:"keydown",monitorIndex:q,key:z.key,code:z.code,keyCode:z.keyCode||z.which||0,location:z.location,text:z.key.length===1?z.key:"",repeat:z.repeat,...oe(z)}))},onKeyUp:z=>{r&&(z.preventDefault(),z.stopPropagation(),w(a.deviceId,{type:"keyup",monitorIndex:q,key:z.key,code:z.code,keyCode:z.keyCode||z.which||0,location:z.location,text:z.key.length===1?z.key:"",repeat:!1,...oe(z)}))},onContextMenu:z=>r&&z.preventDefault()})}),!Z&&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:_.map(z=>o.jsxs("span",{className:`tile-metric state-${z.state}`,children:[o.jsx("b",{children:z.label}),o.jsx("em",{children:z.value}),z.ratio!==void 0&&o.jsx("i",{style:{width:`${Math.round(z.ratio*100)}%`}})]},z.id))})]}),F&&o.jsxs("span",{className:"monitor-cycle","aria-label":`${ko(a)} display ${q+1} of ${h}`,children:[o.jsx("button",{className:"monitor-cycle-button previous",onClick:z=>{z.preventDefault(),z.stopPropagation(),b(-1),z.currentTarget.blur()},title:"Previous display",type:"button",children:o.jsx(sv,{size:18})}),o.jsxs("span",{className:"monitor-cycle-count",children:["Screen ",q+1,"/",h]}),o.jsx("button",{className:"monitor-cycle-button next",onClick:z=>{z.preventDefault(),z.stopPropagation(),b(1),z.currentTarget.blur()},title:"Next display",type:"button",children:o.jsx(Mm,{size:18})})]})]})})}function LC({visible:a}){return m.useEffect(()=>{if(!a||!Pf)return;if(!document.getElementById(Ux)){const s=document.createElement("script");s.id=Ux,s.async=!0,s.crossOrigin="anonymous",s.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${encodeURIComponent(xm)}`,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 ${Pf?"adsense-ready":"house-ad"}`,"aria-label":"Advertisement",children:[o.jsx("span",{className:"ad-label",children:"Advertisement"}),Pf?o.jsx("ins",{className:"adsbygoogle livedesk-ad-unit",style:{display:"block"},"data-ad-client":xm,"data-ad-slot":ly,"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 _C(){const a=WM(),{session:l,loading:s}=q0(),{target:r,error:c,refresh:d}=P0(l),h=m.useMemo(()=>{if(!r?.active)return null;const S=r.expires_at?Date.parse(r.expires_at):Number.POSITIVE_INFINITY;return Number.isFinite(S)&&S<=Date.now()?null:r},[r]),p=m.useMemo(()=>lx(h),[h]),g=m.useMemo(()=>p.length>0?[...new Set([...p,dn])]:[dn],[p]),[x,b]=m.useState(dC),v=m.useMemo(()=>g.some(S=>!!jo(S)),[g]),w=!v||x,{status:M,devices:C,error:j,refresh:k,hubBaseUrl:T}=G0(g,w),{entitlement:A,licensed:_,loading:q,error:F,refresh:Z}=Y0(l),[D,ee]=m.useState([]),[re,Y]=m.useState([]),[de,G]=m.useState(""),[oe,le]=m.useState(""),[ce,H]=m.useState(!1),[Q,J]=m.useState(!1),[z,te]=m.useState(""),[fe,L]=m.useState(""),[xe,we]=m.useState(""),[Se,ze]=m.useState("wall"),[qe,Oe]=m.useState("large"),[_e,Ge]=m.useState(RC),[Te,Ct]=m.useState(!1),[ne,pe]=m.useState(!1),[Re,Le]=m.useState(!1),[Ce,tt]=m.useState(uC),[he,Ht]=m.useState(gC),[Be,ve]=m.useState(vC),[ke,He]=m.useState({}),[Pt,yn]=m.useState([]),[Ve,ca]=m.useState(he.fps),Ta=m.useRef(new Map),Tn=m.useRef(new Map),fn=m.useRef(null),il=m.useRef(new Map),kn=m.useRef(null),rt=m.useRef(0),Zt=m.useRef(new Map),[Rt,ns]=m.useState({}),Ti=m.useRef(new Map),[ki,sl]=m.useState({}),[ka,En]=m.useState(!1),Zn=m.useRef(null),Dn=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),qa=m.useRef(0),ol=m.useRef(0),Rn=m.useRef(0),Ra=m.useRef(0),Ga=m.useRef(0),cl=m.useRef(new Map),bn=m.useRef(new Map),[Wn,Yt]=m.useState(null),[P,me]=m.useState(!1),[Me,Ue]=m.useState([]),[ot,vt]=m.useState("all"),[Ee,nt]=m.useState([]),[sn,Vt]=m.useState(!1),[mn,St]=m.useState(!0),Lt=m.useRef(null),wt=m.useRef(null),ul=m.useRef(null),dl=m.useRef(null),Kt=m.useRef(!1),_t=m.useRef(!1),as=m.useRef(0),da=m.useRef(0),Ln=m.useRef(0),ls=Se==="settings",Ei=Se==="pricing",Di=Se==="doc",wn=Se==="share-files",Sn=!ls&&!Ei&&!Di&&!wn,Pe=Se==="control",ft=he.frameMode==="mode4-h264-atlas",Ri=Be.frameMode==="mode5-lzo-delta"?Math.min(30,Be.fps):Be.fps,La=Be.frameMode==="mode5-lzo-delta"?{maxWidth:Math.min(1920,Be.maxWidth),maxHeight:Math.min(1080,Be.maxHeight)}:{maxWidth:Be.maxWidth,maxHeight:Be.maxHeight};m.useEffect(()=>{if(M?.started){if(!l?.access_token){bt("/api/remote/license",{method:"DELETE"},T).catch(()=>{});return}bt("/api/remote/license/sync",{method:"POST",headers:{Authorization:`Bearer ${l.access_token}`}},T).catch(S=>{console.warn("[LiveDesk] Hub license sync failed",S)})}},[A?.updated_at,T,l?.access_token,M?.started]);const Xe=m.useMemo(()=>C.filter(S=>S.connected),[C]),Bo=ot==="all"?Xe.length:Ee.filter(S=>Xe.some(E=>E.deviceId===S)).length,_n=m.useMemo(()=>Xe.reduce((S,E)=>Math.max(S,go(E.slotNumber)),0),[Xe]),zn=Math.max(IM,Xe.length,_n),Ul=m.useMemo(()=>{const S=Array(zn).fill(null),E=[];for(const I of Xe){const O=go(I.slotNumber);O>0&&O<=zn&&!S[O-1]?S[O-1]=I:E.push(I)}for(const I of E){const O=S.findIndex(U=>!U);O<0?S.push(I):S[O]=I}return S},[Xe,zn]),Li=m.useMemo(()=>Xe.map(S=>S.deviceId),[Xe]),_a=m.useMemo(()=>new Set(D),[D]),fl=m.useMemo(()=>new Set(re),[re]),fa=m.useMemo(()=>Xe.filter(S=>_a.has(S.deviceId)||fl.has(go(S.slotNumber))),[Xe,_a,fl]),ml=m.useMemo(()=>C.find(S=>S.deviceId===de)||fa[0]||null,[C,de,fa]),hl=m.useMemo(()=>C.find(S=>S.deviceId===oe)||null,[oe,C]),sr=hl?ra(ke[hl.deviceId],Pn(hl)):0,be=Pe?hl:ml,is=m.useMemo(()=>new Set(Ee),[Ee]),Ou=m.useMemo(()=>ot==="all"?Xe.map(S=>S.deviceId):Xe.filter(S=>is.has(S.deviceId)).map(S=>S.deviceId),[Xe,is,ot]),ma=m.useMemo(()=>be?fy(be):null,[be]),ss=be?To(be,"control"):!1,Jn=be?To(be,"audio")||To(be,"remoteAudio"):!1,mt=_?A?.plan==="pro"?"pro":"ltd":"free",rs=Bl[mt],pl=rs.limit,$l=mt==="free"&&Xe.length<=er,jt=Xe.length<=pl,za=mt==="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=mt==="free",ql=jt&&!!be,Wt=jt&&!!be&&ss,os=jt&&!!be&&Jn,Pa=m.useMemo(()=>Ul.filter(S=>!!S?.connected).slice(0,bC(qe)).map(S=>S.deviceId),[Ul,qe]),Mn=m.useMemo(()=>ft?Li:he.visibleOnlyLive?Pt.length>0?Pt:Pa:Li,[Pa,ft,Pt,he.visibleOnlyLive,Li]),Jt=m.useMemo(()=>jt?Qf(Mn):[],[jt,Mn]),Oa=m.useMemo(()=>jt&&Pe&&be?[be.deviceId]:[],[jt,be,Pe]),Fo=m.useMemo(()=>Qf([...Jt,...Oa]),[Oa,Jt]),en=m.useMemo(()=>wC(he,qe),[he,qe]),cs=m.useCallback((S,E)=>{const I=Ta.current.get(S);if(I&&I!==E&&Of(I),E){Ta.current.set(S,E);return}Ta.current.delete(S)},[]),Io=m.useCallback((S,E)=>{const I=Tn.current.get(S);if(I&&I!==E&&Of(I),E){Tn.current.set(S,E);return}Tn.current.delete(S)},[]),Qt=m.useCallback((S,E,I)=>{const O=performance.now(),U=el(S,I.deviceId);let ue=I;if(S==="control"&&I.visualChanged){const je=Z0(I.deviceId),at=cl.current.get(I.deviceId)||0,Ke=je?O-je.sentAt:Number.POSITIVE_INFINITY;je&&je.inputSeq>at&&Ke<=$x&&(ue={...I,inputFeedbackSeq:je.inputSeq,inputFeedbackMs:Math.max(0,Ke),inputFeedbackAt:O},cl.current.set(I.deviceId,je.inputSeq))}ua.current.set(U,O);const ge=Zt.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};S==="control"&&ue.inputFeedbackMs===void 0&&ge.lastInfo?.inputFeedbackMs!==void 0&&ge.lastInfo.inputFeedbackAt!==void 0&&O-ge.lastInfo.inputFeedbackAt<=$x&&(ue={...ue,inputFeedbackSeq:ge.lastInfo.inputFeedbackSeq,inputFeedbackMs:ge.lastInfo.inputFeedbackMs,inputFeedbackAt:ge.lastInfo.inputFeedbackAt}),ge.totalFrames+=1,ge.sampleFrames+=1,Yx(ge,O,ue.frameSeq),ue.visualChanged&&(ge.totalChangedFrames+=1,ge.sampleChangedFrames+=1),ge.lastInfo=ue,Zt.current.set(U,ge)},[]),ha=m.useCallback((S,E)=>{Qt("wall",S,E)},[Qt]),_i=m.useCallback((S,E)=>{Qt("control",S,E);const I=Zn.current;!I||!ZM(I,S)||En(!0)},[Qt]);m.useEffect(()=>{const S=window.setInterval(()=>{const E=performance.now(),I={};for(const[O,U]of Zt.current.entries()){const ue=Math.max(1,E-U.sampleStartedAt);I[O]={totalFrames:U.totalFrames,totalChangedFrames:U.totalChangedFrames,framesPerSecond:U.sampleFrames*1e3/ue,changedFramesPerSecond:U.sampleChangedFrames*1e3/ue,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/ue),decoderOutputFps:Math.max(0,(Number(U.lastInfo?.decoderOutputCount||0)-U.sampleDecoderOutputBase)*1e3/ue),sampleMs:ue,lastInfo:U.lastInfo},U.sampleDecoderInputBase=Number(U.lastInfo?.decoderInputCount||0),U.sampleDecoderOutputBase=Number(U.lastInfo?.decoderOutputCount||0),U.sampleChangedFrames=0,Px(U,E)}ns(I)},1e3);return()=>window.clearInterval(S)},[]);const pa=m.useCallback((S,E)=>{const I=performance.now(),O=el(S,E.deviceId);Dn.current.set(O,I),bn.current.delete(O);const U=Ti.current.get(O)||{totalFrames:0,sampleFrames:0,sampleStartedAt:I,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(E.byteLength||0)),String(E.frameMode||E.mode||E.codec||E.mimeType||"").toLowerCase().includes("h264")){U.sampleH264Frames+=1,Number(E.byteLength||0)<=KM&&(U.sampleTinyFrames+=1);const at=String(E.contentHash||"");at&&U.lastContentHash===at&&(U.sampleRepeatedFrames+=1),U.lastContentHash=at}const je=Number(E.agentSendGapMs||0);je>0&&je<1e3&&Um(U.sourceSendIntervalsMs,je),U.lastFrame=E,Yx(U,I,E.frameSeq),Ti.current.set(O,U)},[]);m.useEffect(()=>{const S=window.setInterval(()=>{const E=performance.now(),I={};for(const[O,U]of Ti.current.entries()){const ue=Math.max(1,E-U.sampleStartedAt);I[O]={totalFrames:U.totalFrames,framesPerSecond:U.sampleFrames*1e3/ue,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((ge,je)=>ge+je,0)/U.sourceSendIntervalsMs.length:0,sourceSendP95Ms:gu(U.sourceSendIntervalsMs,.95),sourceSendSampleCount:U.sourceSendIntervalsMs.length,sampleMs:ue,lastFrame:U.lastFrame},U.sampleBytes=0,U.sampleH264Frames=0,U.sampleTinyFrames=0,U.sampleRepeatedFrames=0,U.sourceSendIntervalsMs.length=0,Px(U,E)}sl(I)},1e3);return()=>window.clearInterval(S)},[]);const Uo=m.useCallback(S=>{pa("wall",S);const E=Ta.current.get(S.deviceId);E&&Bf(E,S,()=>Ta.current.get(S.deviceId)!==E,ha,he.h264DecodeAcceleration).catch(()=>{})},[ha,pa,he.h264DecodeAcceleration]),us=m.useCallback(S=>{pa("control",S);const E=Tn.current.get(S.deviceId);E&&Bf(E,S,()=>Tn.current.get(S.deviceId)!==E,_i,Be.h264DecodeAcceleration,"interactive").catch(()=>{})},[Be.h264DecodeAcceleration,_i,pa]),rr=m.useCallback(S=>{const E=fn.current;E&&E!==S&&Of(E),fn.current=S,qa.current=0,ol.current=0,Rn.current=0,Ra.current=0,Ga.current=0,rt.current=0},[]),ga=m.useCallback(()=>{const S=fn.current,E=kn.current;if(!(!S||!E||S.width<=0||S.height<=0||rt.current!==E.layoutVersion))for(const I of E.tiles){const O=il.current.get(I.deviceId);if(!O||I.width<=0||I.height<=0)continue;const U=Math.max(1,Math.round(I.width)),ue=Math.max(1,Math.round(I.height)),ge=QM,je=XM;(O.width!==ge||O.height!==je)&&(O.width=ge,O.height=je);const at=O.getContext("2d",{alpha:!1});if(at){at.imageSmoothingEnabled=!0,at.imageSmoothingQuality="high";try{at.drawImage(S,Math.round(I.x),Math.round(I.y),U,ue,0,0,ge,je)}catch{}}}},[]),ds=m.useCallback((S,E)=>{if(E){il.current.set(S,E),window.requestAnimationFrame(ga);return}il.current.delete(S)},[ga]),or=m.useCallback((S,E)=>{Rn.current=performance.now(),rt.current=Number(S.layoutVersion||0),ga();const I=kn.current?.tiles||[],O=I.length>0?Math.round(S.byteLength/I.length):S.byteLength;for(const U of I){const ue={...S,deviceId:U.deviceId,width:U.width,height:U.height,sourceWidth:U.width,sourceHeight:U.height,byteLength:O};ha(ue,{...E,deviceId:U.deviceId,width:U.width,height:U.height,byteLength:O})}},[ha,ga]),Bu=m.useCallback(S=>{const E=performance.now();qa.current<=0&&(qa.current=E),ol.current=E;const I=fn.current;if(!I)return;const O=kn.current?.tiles||[],U=O.length>0?Math.round(S.byteLength/O.length):S.byteLength;for(const ue of O)pa("wall",{...S,deviceId:ue.deviceId,width:ue.width,height:ue.height,sourceWidth:ue.width,sourceHeight:ue.height,byteLength:U});Bf(I,S,()=>fn.current!==I,or).catch(()=>{})},[or,pa]),Hu=m.useMemo(()=>({fps:Ve,maxWidth:en.maxWidth,maxHeight:en.maxHeight,quality:he.quality,mode:he.frameMode,frameMode:he.frameMode,streamPurpose:"wall",monitorSelections:ke,onFrame:Uo}),[Ve,Uo,en,ke,he]),Fu=m.useMemo(()=>({fps:Ri,maxWidth:La.maxWidth,maxHeight:La.maxHeight,quality:Be.quality,mode:Be.frameMode,frameMode:Be.frameMode,streamPurpose:"control",monitorSelections:ke,onFrame:us}),[Be.frameMode,Be.quality,us,Ri,La.maxHeight,La.maxWidth,ke]),{frames:fs,state:zi,stats:Ya,restartLive:ms}=ox(ft?[]:Jt,!ft&&he.autoStartLive&&Jt.length>0,T,Hu),{frame:Gl,layout:gl,state:hs,stats:Iu,refreshInputs:$o}=W0(Mn,ft&&he.autoStartLive&&Mn.length>0,T,{fps:20,width:1920,height:1080,tileWidth:en.maxWidth,tileHeight:en.maxHeight,monitorSelections:ke,onFrame:Bu});m.useEffect(()=>{kn.current=gl,gl&&window.requestAnimationFrame(ga)},[gl,ga]),m.useEffect(()=>{if(!ft||hs!=="open"){qa.current=0,ol.current=0,Rn.current=0;return}const S=window.setInterval(()=>{const E=fn.current,I=performance.now();if(!E||document.visibilityState!=="visible"||I-Il.current<Yf)return;const O=ol.current,U=qa.current;if(O<=0||U<=0||I-O>500)return;const ue=Rn.current||U,ge=I-ue;if(ge>=PM&&I-Ga.current>=VM){ax(E)&&(Ga.current=I,Ra.current=I);return}ge>=GM&&I-Ra.current>=YM&&D0(E)&&(Ra.current=I)},250);return()=>window.clearInterval(S)},[hs,ft]);const{frames:cr,state:ur,error:ps,stats:Uu,restartLive:gs}=ox(Oa,Oa.length>0,T,Fu),xs=m.useMemo(()=>{const S=new Map(fs);if(ft&&Gl){const E=new Map((gl?.tiles||[]).map(O=>[O.deviceId,O])),I=Math.max(1,E.size);for(const O of Mn){const U=E.get(O);S.set(O,{...Gl,deviceId:O,width:U?.width||en.maxWidth,height:U?.height||en.maxHeight,sourceWidth:U?.width||en.maxWidth,sourceHeight:U?.height||en.maxHeight,byteLength:Math.round(Gl.byteLength/I)})}}for(const[E,I]of cr.entries())S.set(E,I);return S},[Gl,gl,cr,en,ft,fs,Mn]),vs=Pe&&Oa.length>0?ur:ft?hs:zi,dr=Pe&&Oa.length>0?Uu:ft?Iu:Ya;m.useCallback((S,E="browser-stale")=>{const I=ms(S,E),O=gs(S,E);return I||O},[gs,ms]),m.useEffect(()=>{ft&&!Pe&&$o()},[ft,$o,Pe]);const ys=m.useCallback((S,E,I)=>{const O=E==="control"?Tn.current.get(S)||null:Ta.current.get(S)||null;if(!O||!ax(O))return!1;const U=performance.now();return Da.current.set(el(E,S),U),!0},[]);m.useEffect(()=>{En(!1);const S=Pe?hl:null;if(S){Zn.current={deviceId:S.deviceId,monitorIndex:sr,frameMode:Be.frameMode,startedAtEpochMs:Date.now()};const E=el("control",oe);Ea.current.set(E,performance.now()),Dn.current.delete(E),ua.current.delete(E),bn.current.delete(E);return}Zn.current=null},[hl?.sessionId,oe,Be.frameMode,sr,Pe]);const{state:bs,sendInput:Oi,stats:xa}=J0(Wt&&ce,T),{state:qo,error:Go}=nw(be?.deviceId||"",os&&Q,T);m.useEffect(()=>{if(!Pe||!ce||!Wt||!be)return;const S=(O,U)=>{const ue=O.target,ge=ue?.tagName?.toLowerCase();ue?.isContentEditable||ge==="input"||ge==="textarea"||ge==="select"||(O.preventDefault(),O.stopPropagation(),Oi(be.deviceId,{type:U,monitorIndex:ra(ke[be.deviceId],Pn(be)),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}))},E=O=>S(O,"keydown"),I=O=>S(O,"keyup");return window.addEventListener("keydown",E),window.addEventListener("keyup",I),()=>{window.removeEventListener("keydown",E),window.removeEventListener("keyup",I)}},[Wt,ce,ke,be,Oi,Pe]),m.useEffect(()=>{const S=()=>{document.visibilityState==="visible"&&(Il.current=performance.now())};return document.addEventListener("visibilitychange",S),window.addEventListener("pageshow",S),()=>{document.removeEventListener("visibilitychange",S),window.removeEventListener("pageshow",S)}},[]),m.useEffect(()=>{if(!Pe||!be||ur!=="open")return;const S=be.deviceId,E=el("control",S),I=window.setInterval(()=>{const O=performance.now();if(document.visibilityState!=="visible"||O-Il.current<Yf)return;const U=Dn.current.get(E)||0,ue=ua.current.get(E)||0,ge=rl.current.get(E)||0,je=Ea.current.get(E)||O;Ea.current.has(E)||Ea.current.set(E,je);const at=U<=0,Ke=at?O-je>nC:O-U>Zx,ht=U>0&&(ue<=0||O-ue>Zx);if(!Ke&&ht){const Nn=Da.current.get(E)||0;O-Nn>=Wx&&ys(S,"control","decoder-paint-stale");return}if(!Ke)return;const kt=bn.current.get(E)||0;if(O-ge<Jx(aC,kt))return;gs([S],at?"control-first-frame-timeout":"control-receive-stale")&&(rl.current.set(E,O),Ea.current.set(E,O),bn.current.set(E,kt+1))},650);return()=>window.clearInterval(I)},[ur,ys,gs,be,Pe]),m.useEffect(()=>{if(ft||zi!=="open"||!he.autoStartLive||Jt.length===0)return;const S=window.setInterval(()=>{const E=performance.now();if(document.visibilityState!=="visible"||E-Il.current<Yf)return;const I=1e3/Math.max(1,Ve||he.fps||1),O=Math.max(lC,Math.ceil(I*4)),U=[];for(const ue of Jt){if(U.length>=rC)break;const ge=el("wall",ue),je=Dn.current.get(ge)||0;if(je<=0)continue;const at=rl.current.get(ge)||0,Ke=ua.current.get(ge)||0,ht=E-je>O,kt=Ke<=0||E-Ke>O;if(!ht&&kt){const Nn=Da.current.get(ge)||0;E-Nn>=Wx&&ys(ue,"wall","decoder-paint-stale");continue}if(!ht)continue;const wa=bn.current.get(ge)||0;E-at>=Jx(iC,wa)&&U.push(ue)}if(U.length>0&&ms(U,"wall-frame-stale"))for(const ue of U){const ge=el("wall",ue);rl.current.set(ge,E),bn.current.set(ge,(bn.current.get(ge)||0)+1)}},sC);return()=>window.clearInterval(S)},[Ve,ft,ys,ms,he.autoStartLive,he.fps,Jt,zi]),m.useEffect(()=>{ca(he.fps),da.current=Date.now(),Ln.current=0},[he.fps,he.frameMode,he.adaptiveLoadShedding]),m.useEffect(()=>{S0({h264DecodeAcceleration:he.h264DecodeAcceleration})},[he.h264DecodeAcceleration]),m.useEffect(()=>{if(!jt||Pe||!he.visibleOnlyLive){yn([]);return}const S=Lt.current;if(!S||typeof IntersectionObserver>"u"){yn(Pa);return}const E=Array.from(S.querySelectorAll("[data-live-device-id]"));if(E.length===0){yn([]);return}const I=new Map,O=()=>{const ue=Qf(E.map(ge=>String(ge.dataset.liveDeviceId||"")).filter(ge=>(I.get(ge)||0)>0));yn(ge=>cu(ge,ue)?ge:ue)},U=new IntersectionObserver(ue=>{for(const ge of ue){const je=String(ge.target.dataset.liveDeviceId||"");je&&I.set(je,ge.isIntersecting?ge.intersectionRatio||.01:0)}O()},{root:null,rootMargin:vn.visibleRootMargin,threshold:[0,.01,.2,.6,1]});return E.forEach(ue=>U.observe(ue)),O(),()=>U.disconnect()},[Pa,jt,Pe,Ul,he.visibleOnlyLive,qe]),m.useEffect(()=>{if(ft||!he.adaptiveLoadShedding||!he.autoStartLive||Jt.length===0)return;const S=he.fps;if(Jt.length<=vn.preserveConfiguredFpsDeviceCount){Ve!==S&&(ca(S),da.current=Date.now(),Ln.current=0);return}if(zi!=="open"||Ya.sampleMs<500)return;const E=Date.now(),I=Jt.length*Ve,O=Ya.framesPerSecond,U=Ya.bytesPerSecond,ue=Math.max(0,...Jt.map(ht=>ki[el("wall",ht)]?.maxIntervalMs||0)),ge=Math.max(0,...Jt.map(ht=>Rt[el("wall",ht)]?.maxIntervalMs||0)),je=I>8&&O>0&&O<I*.72;if(O>vn.maxWallFramesPerSecond||U>vn.maxWallBytesPerSecond||ue>vn.maxFrameGapMs||ge>vn.maxFrameGapMs||je){Ln.current=0;const ht=vn.minFps;if(E-da.current>=vn.downshiftCooldownMs&&Ve>ht){const kt=Math.max(ht,SC(Ve,ht));kt<Ve&&(ca(kt),da.current=E)}return}const Ke=O<vn.maxWallFramesPerSecond*vn.lowLoadFrameRatio&&U<vn.maxWallBytesPerSecond*vn.lowLoadByteRatio;if(!Ke||Ve>=S){Ke||(Ln.current=0);return}if(!Ln.current){Ln.current=E;return}if(E-Ln.current>=vn.recoveryCooldownMs){const ht=Math.min(S,MC(Ve,S));ht>Ve&&(ca(ht),da.current=E,Ln.current=0)}},[Ve,ft,Rt,ki,Jt.length,Jt,zi,Ya.bytesPerSecond,Ya.framesPerSecond,Ya.lastUpdatedAt,Ya.sampleMs,he.adaptiveLoadShedding,he.autoStartLive,he.frameMode,he.fps]),m.useEffect(()=>{const S=new URLSearchParams(window.location.search).get("checkout");if(S==="success"){L("Checkout returned. Waiting for Dodo confirmation."),Z();const E=window.setInterval(()=>{Z()},4e3),I=window.setTimeout(()=>{window.clearInterval(E)},45e3);return()=>{window.clearInterval(E),window.clearTimeout(I)}}S==="cancelled"&&L("Checkout cancelled.")},[Z]),m.useEffect(()=>{!jt&&ce&&H(!1),!jt&&Q&&J(!1)},[Q,ce,jt]),m.useEffect(()=>{J(!1)},[be?.deviceId]),m.useEffect(()=>{const S=Xe.map(O=>O.deviceId),E=new Set(S),I=new Map(Xe.map(O=>[O.deviceId,O]));ee(O=>{const U=O.filter(ue=>E.has(ue));return cu(O,U)?O:U}),G(O=>O&&E.has(O)?O:""),le(O=>O&&E.has(O)?O:""),Y(O=>{const U=O.filter(ue=>ue>=1&&ue<=zn);return cu(O.map(String),U.map(String))?O:U}),He(O=>{let U=!1;const ue={};for(const[ge,je]of Object.entries(O)){if(!E.has(ge)){U=!0;continue}const at=I.get(ge),Ke=ra(je,at?Pn(at):1);ue[ge]=Ke,Ke!==je&&(U=!0)}return U?ue:O}),nt(O=>{const U=O.filter(ue=>E.has(ue));return cu(O,U)?O:U})},[Xe,zn]),m.useEffect(()=>{Ue([]),St(!1)},[]),m.useEffect(()=>{!wn||ot!=="selected"||Ee.length>0||fa.length===0||nt(fa.map(S=>S.deviceId))},[fa,Ee.length,ot,wn]),m.useEffect(()=>{try{localStorage.setItem(ey,Ce)}catch{}},[Ce]),m.useEffect(()=>{xC(he)},[he]),m.useEffect(()=>{yC(Be)},[Be]);const fr=m.useCallback(async()=>{const S=new Set(g);S.add(dn);try{const ue=await bt("/api/remote/status",void 0,dn);lx({endpoint:ue.agentEndpoint,endpoint_candidates:[...ue.agentEndpointCandidates||[],...ue.hostTargetEndpointCandidates||[]]}).forEach(ge=>S.add(ge))}catch{}const E=[...S].sort((ue,ge)=>{const je=at=>{const Ke=jo(at);return Ke==="local"?0:Ke==="loopback"?1:2};return je(ue)-je(ge)||ue.localeCompare(ge)});let I=!1,O="",U=!1;try{for(const ue of E){const ge=jo(ue);try{if(await bt("/api/health",void 0,ue),ge==="local")return b(!0),Zs(!0),ue;ge==="loopback"&&(I=!0,O=ue)}catch{ge==="local"&&(U=!0)}}return I?(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||dn):(b(!1),Zs(!1),"")}catch{return b(!1),Zs(!1),""}},[g]),ws=async()=>{te("auth"),pe(!1),await fr();const{error:S}=await nl.auth.signInWithOAuth({provider:"google",options:{redirectTo:window.location.origin}});S&&(L(S.message),te(""))},mr=async()=>{te("auth"),pe(!1),await nl.auth.signOut(),te("")};m.useEffect(()=>{if(!ne)return;const S=I=>{I.target instanceof Element&&(I.target.closest(".account-popover, .rail-account")||pe(!1))},E=I=>{I.key==="Escape"&&pe(!1)};return window.addEventListener("pointerdown",S),window.addEventListener("keydown",E),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",E)}},[ne]);const va=m.useCallback(async(S={})=>{const E=S.silent===!0,I=S.takeover===!0,O=S.requestLocalAccess===!0,U=O?await fr():"";if(!l?.user){E||L("Sign in before publishing this host.");return}if(!_t.current){_t.current=!0,E||te("host");try{const ue=U||T||dn,ge=M||await bt("/api/remote/status",void 0,ue);if(!ge.started)throw new Error("Start LiveDesk on this computer before syncing the server.");const je=`livedesk-${l.user.id}`,at=await bt("/api/remote/host-target",{method:"POST",body:JSON.stringify({nodeId:je,leaseMs:6e4,takeover:I})},ue);if(!at.ok)throw new Error(at.error||"host-target-failed");const Ke=await bt("/api/remote/status",void 0,ue),ht=await bt("/api/remote/registry-credentials",void 0,ue),kt=at.hostTarget||{},wa=Ke.hostTargetEndpointCandidates||Ke.agentEndpointCandidates||ge.agentEndpointCandidates||[Ke.agentEndpoint||ge.agentEndpoint].filter(Boolean),{data:Nn,error:Cl}=await nl.rpc("set_livedesk_remote_host_target",{p_node_id:je,p_lease_id:String(kt.leaseId||Ke.hostTargetLeaseId||crypto.randomUUID()),p_host_instance_id:Ke.hostInstanceId||je,p_endpoint:Ke.hostTargetEndpoint||Ke.agentEndpoint||ge.agentEndpoint,p_pair_token:ht.pairToken||"",p_manager_package:"@livedesk/hub",p_manager_version:Ke.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:I,p_endpoint_candidates:wa,p_pairing_pin:ht.pairingPin||Ke.pairingPin||""});if(Cl)throw Cl;const ta=Array.isArray(Nn)?Nn[0]:Nn;if(ta&&ta.ok===!1)throw new Error(ta.reason||"registry-rejected");E||(L("Host published."),(O||v)&&(b(!0),Zs(!0)),k()),d()}catch(ue){if(!E){const ge=ue instanceof Error?ue.message:String(ue);ge.includes("local network access")&&(b(!1),Zs(!1)),L(ge)}}finally{_t.current=!1,E||te("")}}},[T,v,k,d,fr,l,M]),$u=m.useCallback(async()=>{if(!z){te("pin");try{const E=await bt("/api/remote/pairing-pin",{method:"POST"},T||dn);if(!E.ok)throw new Error(E.error||"pin-rotation-failed");await k(),l?.user&&await va({silent:!0,takeover:!0}),L("New PIN published.")}catch(S){L(S instanceof Error?S.message:String(S))}finally{te("")}}},[z,T,va,k,l]);m.useEffect(()=>{if(!l?.user||!M?.started||j)return;const S=r?.expires_at?Date.parse(r.expires_at):Number.POSITIVE_INFINITY,E=r?.active===!0&&(!r.expires_at||!Number.isFinite(S)||S>Date.now()),I=!!r?.host_instance_id&&!!M.hostInstanceId&&r.host_instance_id===M.hostInstanceId;if(E&&!I)return;let O=!1;const U=()=>{if(O)return;const ge=Date.now();ge-as.current<25e3||(as.current=ge,va({silent:!0}))};U();const ue=window.setInterval(U,3e4);return()=>{O=!0,window.clearInterval(ue)}},[j,va,l?.user?.id,M?.agentEndpoint,M?.hostInstanceId,M?.started,r?.active,r?.expires_at,r?.host_instance_id]);const xl=m.useCallback(S=>{S&&(G(S),ee(E=>E.includes(S)?E:[...E,S]))},[]),hr=m.useCallback(S=>{if(!S)return;const E=Xe.find(O=>O.deviceId===S),I=go(E?.slotNumber);G(S),I>0&&Y(O=>O.filter(U=>U!==I)),ee(O=>O.includes(S)?O:[...O,S])},[Xe]),pr=m.useCallback(S=>{!Number.isInteger(S)||S<1||S>zn||(G(""),Y(E=>E.includes(S)?E.filter(I=>I!==S):[...E,S].sort((I,O)=>I-O)))},[zn]),Pl=m.useCallback(()=>{ee([]),Y([]),G("")},[]),gr=m.useCallback(()=>{ee([]),G(""),Y(Array.from({length:zn},(S,E)=>E+1))},[zn]),Va=m.useCallback((S,E)=>{const I=Xe.find(U=>U.deviceId===S);if(!I)return;const O=Pn(I);O<=1||(He(U=>{const ge=(ra(U[S],O)+E+O)%O;return{...U,[S]:ge}}),Pe?le(S):xl(S))},[Xe,xl,Pe]);m.useEffect(()=>{const S=E=>{if(Pe&&ce&&Wt)return;const I=E.target,O=I?.tagName?.toLowerCase();I?.isContentEditable||O==="input"||O==="textarea"||O==="select"||((E.ctrlKey||E.metaKey)&&E.key.toLowerCase()==="a"&&(E.preventDefault(),gr()),E.key==="Escape"&&Pl())};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[Wt,Pl,ce,gr,Pe]);const Po=async(S,E={})=>{if(!jt){L(za);return}const I=E.focused||Pe;I?le(S):xl(S);try{const O=Xe.find(ge=>ge.deviceId===S),U=I?{maxWidth:Be.maxWidth,maxHeight:Be.maxHeight}:en,ue=ra(E.monitorIndex??ke[S],O?Pn(O):1);await bt(`/api/remote/devices/${encodeURIComponent(S)}/live/start`,{method:"POST",body:JSON.stringify({fps:I?Be.fps:Ve,maxWidth:U.maxWidth,maxHeight:U.maxHeight,quality:I?Be.quality:he.quality,mode:I?Be.frameMode:he.frameMode,frameMode:I?Be.frameMode:he.frameMode,streamPurpose:I?"control":"wall",monitorIndex:ue})},T),L("Live stream requested."),k()}catch(O){L(O instanceof Error?O.message:String(O))}},qu=(S,E)=>{const I=Xe.find(U=>U.deviceId===S),O=ra(E,I?Pn(I):1);He(U=>({...U,[S]:O})),Pe?le(S):xl(S)},xr=async S=>{if(le(S),ze("control"),!jt){H(!1),L(za);return}H(!0)},Yo=async()=>{if(!be){L("Select a workstation before playing audio.");return}if(!jt){L(za);return}if(!Jn){L("Selected workstation does not report remote audio support yet.");return}const S=!Q;J(S);try{await bt(`/api/remote/devices/${encodeURIComponent(be.deviceId)}/audio/${S?"start":"stop"}`,{method:"POST",body:JSON.stringify({mimeType:"audio/webm;codecs=opus",sampleRate:48e3,channels:2})},T),L(S?"Remote audio requested.":"Remote audio stopped.")}catch(E){J(!1),L(E instanceof Error?E.message:String(E))}},vr=async(S,E,I="files")=>{const O=S.filter(je=>je.file.size>=0);if(O.length===0)return{files:0,bytes:0};if(!jt)throw new Error(za);if(E.length===0)throw new Error("Select at least one connected workstation.");const U=crypto.randomUUID(),ue=O.reduce((je,at)=>je+at.file.size,0);let ge=0;Yt({id:U,status:"reading",progress:1,message:`Preparing ${O.length} ${I}`});try{for(let je=0;je<O.length;je+=1){const at=O[je],Ke=at.file,ht=Math.max(1,Math.ceil(Ke.size/Gf));for(let kt=0;kt<ht;kt+=1){const wa=kt*Gf,Nn=Math.min(Ke.size,wa+Gf),Cl=Ke.size===0?new ArrayBuffer(0):await Ke.slice(wa,Nn).arrayBuffer(),ta=kt===ht-1;Yt({id:U,status:"sending",progress:Math.max(2,Math.min(98,Math.round(ge/Math.max(1,ue)*96))),message:`${je+1}/${O.length} ${at.relativePath}`});const Fn=await bt("/api/remote/files/chunk",{method:"POST",body:JSON.stringify({transferId:U,deviceIds:E,remoteDirectory:Ce.trim(),name:Ke.name,relativePath:at.relativePath,size:Ke.size,type:Ke.type,lastModified:Ke.lastModified,offset:wa,totalBytes:Ke.size,final:ta,dataBase64:CC(Cl)})},T);if(!Fn.ok||Fn.queued!==E.length)throw new Error(Fn.error||`file-chunk-not-queued-${Fn.queued}/${E.length}`);ge+=Cl.byteLength,await new Promise(Za=>window.setTimeout(Za,0))}}return Yt({id:U,status:"queued",progress:100,message:`Sent ${O.length} file${O.length===1?"":"s"} to ${E.length} workstation${E.length===1?"":"s"}`}),window.setTimeout(()=>{Yt(je=>je?.id===U&&je.status==="queued"?null:je)},4500),{files:O.length,bytes:ue}}catch(je){throw Yt({id:U,status:"failed",progress:100,message:je instanceof Error?je.message:String(je)}),je}},Yl=async S=>{const E=fa.length>0?fa.map(I=>I.deviceId):be?[be.deviceId]:[];try{await vr(tv(S),E)}catch(I){L(I instanceof Error?I.message:String(I))}},Vl=async S=>{try{await vr(tv(S),Ou)}catch(E){L(E instanceof Error?E.message:String(E))}};m.useEffect(()=>{Kt.current=!1},[]);const Gu=S=>{S.preventDefault(),S.stopPropagation(),me(!1),Yl(S.dataTransfer.files)},Ss=async()=>{const S=xe.trim();if(S){if(!jt){L(za);return}te("task");try{await bt("/api/remote/tasks",{method:"POST",body:JSON.stringify({instruction:S,allConnected:!0,approvalLevel:"task-only"})},T),we(""),L("Task queued."),k()}catch(E){L(E instanceof Error?E.message:String(E))}finally{te("")}}},Bi=async(S="ltd")=>{if(!l){L("Sign in with Google before checkout.");return}if(_&&S===mt){L("LiveDesk license is already active.");return}if(_&&mt==="pro"){L("LiveDesk Pro is already active.");return}te("checkout");try{const{data:E,error:I}=await nl.functions.invoke("dodo-checkout",{body:{plan:S}});if(I)throw I;if(!E?.checkout_url)throw new Error("Checkout function did not return a checkout URL.");window.location.assign(E.checkout_url)}catch(E){L(E instanceof Error?E.message:String(E)),te("")}},Ba=oC(),Kl=cC(),yr=Xe.length,Ms=Fo.filter(S=>xs.has(S)).length,Cs=vs==="open"&&dr.sampleMs>0?`${dr.framesPerSecond.toFixed(1)} fps`:vs,ye=be?Pe?cr.get(be.deviceId):xs.get(be.deviceId):void 0,js=be?ra(ke[be.deviceId],Pn(be)):0,Vo=be?mC(be):[],Pu=typeof ye?.monitorIndex=="number"?ra(ye.monitorIndex,Math.max(1,ye.monitorCount||1)):js,br=(ye&&Pu===js?uy(ye):null)||(be?cy(be,js):null),Cn=br?`${br.width}x${br.height}`:"-",Ka=be?el(Pe?"control":"wall",be.deviceId):"",Ft=Ka?ki[Ka]:void 0,hn=Ka?Rt[Ka]:void 0,Qe=hn?.lastInfo,Ko=Ft&&Ft.sampleMs>0?`${Ft.framesPerSecond.toFixed(1)} fps`:"waiting",wr=Ft?`#${Ft.totalFrames} / ${Ko}`:"waiting",Yu=hn&&hn.sampleMs>0?`${hn.framesPerSecond.toFixed(1)} fps`:"waiting",Ql=hn&&hn.sampleMs>0?`${hn.changedFramesPerSecond.toFixed(1)} fps`:"waiting",Sr=Qe?`#${Qe.frameSeq} ${Qe.decoderLabel} q${Qe.queueSize} r${Qe.renderQueueSize} d${Qe.droppedForLatency} f${Qe.decoderFlushCount} t${Qe.decoderTimestampFallbacks} io${Qe.decoderInputCount}/${Qe.decoderOutputCount} ${Qe.visualChanged?"changed":"same"}`:"waiting",Hi=Qe?`${Math.round(Qe.queuedForMs)}ms total / ${Math.round(Qe.decodedForMs)}ms decode / ${Math.round(Qe.scheduledForMs)}ms pace / ${Qe.drawMs.toFixed(1)}ms draw`:"-",Mr=Qe?.targetPaintIntervalMs?`${Qe.targetPaintIntervalMs.toFixed(1)}ms / ${(1e3/Qe.targetPaintIntervalMs).toFixed(1)} fps`:"-",Qo=hn?`${hn.decoderInputFps.toFixed(1)} in / ${hn.decoderOutputFps.toFixed(1)} out fps`:"waiting",vl=Qe?.canvasPresentation||"-",Xl=Qe?`${Qe.interactiveBufferWaitCount} waits / ${Math.round(Qe.interactiveBufferWaitMs)}ms / ${Qe.interactiveQueueDrainCount} drains`:"waiting",Cr=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=Ft?ye?.frameMode==="mode5-lzo-delta"?`${wo(Ft.averageFrameBytes)} avg / visual ${ye.deltaVisualTileCount||0} + refresh ${ye.deltaRefreshTileCount||0} / ${ye.deltaTotalTiles||0}`:`${wo(Ft.averageFrameBytes)} avg / tiny ${Math.round(Ft.tinyFrameRatio*100)}% / repeat ${Math.round(Ft.repeatedFrameRatio*100)}%`:"waiting",yl=Ft&&Ft.sourceSendSampleCount>0?`${Ft.sourceSendAverageMs.toFixed(1)}ms avg / p95 ${Ft.sourceSendP95Ms.toFixed(1)}ms`:"waiting",Zo=Vx(Ft),Wo=Vx(hn),Jo=Ft&&hn?`rx ${Kx(Ft)} / paint ${Kx(hn)}`:"waiting",jr=ye?ye.frameMode||ye.mode||ye.codec||ye.mimeType:Pe?Be.frameMode:he.frameMode,Nr=Pe?Be.frameMode:he.frameMode,Vu=jr!==Nr?`${Nr} -> ${jr}`:Nr,ec=ye?`${ye.width}x${ye.height} ${wo(ye.byteLength)}`:Pe?`${La.maxWidth}x${La.maxHeight}`:`${he.maxWidth}x${he.maxHeight}`,tc=ye?ye.frameMode==="mode2-lzo"?"independent":`${ye.isKeyFrame?"key":String(ye.chunkType||"delta")}`:"-",Ar=ye&&ye.monitorCount?`${(ye.monitorIndex??0)+1}/${ye.monitorCount}`:"-",ea=ye?[`src ${Math.round(ye.sourceGapMs||0)}ms`,`gap ${Math.round(ye.agentSendGapMs||0)}ms`,`tx ${Math.round(ye.agentSendDurationMs||0)}ms`,`pace ${Math.round(ye.agentPaceMs||0)}ms`,`queue ${Math.round(ye.agentQueueBeforePaceMs||0)}ms`,`age ${Math.round(ye.agentFrameAgeMs||0)}ms`,ye.browserReceivedEpochMs&&ye.receivedAt?`hub ${Math.max(0,Math.round(ye.browserReceivedEpochMs-Date.parse(ye.receivedAt)))}ms`:"",ye.browserReceivedEpochMs&&ye.hubPacketEpochMs?`sock ${Math.max(0,Math.round(ye.browserReceivedEpochMs-ye.hubPacketEpochMs))}ms`:"",ye.droppedByAgent?`drop ${ye.droppedByAgent}`:"",ye.hubIngressDropped?`ingress-drop ${ye.hubIngressDropped}`:"",ye.hubClientDropped?`ws-drop ${ye.hubClientDropped}`:"",ye.captureStageMs?`capture ${Math.round(ye.captureStageMs)}ms`:"",ye.convertMs?`rgb565 ${Math.round(ye.convertMs)}ms`:"",ye.compressMs?`lzo ${Math.round(ye.compressMs)}ms`:"",ye.captureSourceSerial?`cap #${ye.captureSourceSerial}`:"",ye.captureSourceSkipped?`cap skip ${ye.captureSourceSkipped}`:"",ye.frameMode==="mode5-lzo-delta"?`tiles ${ye.deltaVisualTileCount||0}+${ye.deltaRefreshTileCount||0}/${ye.deltaTotalTiles||0}@${ye.deltaTileSize||0}`:"",ye.platformProfile||ye.hardwareEncoder||"-",ye.atlasComposeMs?`atlas ${ye.atlasComposeMs.toFixed(1)}ms`:"",ye.atlasPoolStarved?`pool ${ye.atlasPoolStarved}`:"",ye.atlasTileCount?`tiles ${ye.atlasReadyTiles||0}/${ye.atlasTileCount}`:"",Qe?.inputFeedbackMs!==void 0&&Qe.inputFeedbackAt!==void 0&&performance.now()-Qe.inputFeedbackAt<=qx?`feedback ${Math.round(Qe.inputFeedbackMs)}ms`:"",ye.contentHash?`enc ${ye.contentHash.slice(0,6)}`:"",Qe?.visualHash?`pix ${Qe.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,On=Qe?.inputFeedbackMs!==void 0&&Qe.inputFeedbackAt!==void 0&&performance.now()-Qe.inputFeedbackAt<=qx?`${Math.round(Qe.inputFeedbackMs)}ms / input #${Qe.inputFeedbackSeq||0}`:"waiting for changed frame",Zl=ye?`#${ye.frameSeq} ${cm(ye.receivedAt||ye.capturedAt)}`:"waiting",Qa=Math.max(0,dr.bytesPerSecond*8/1e6),Fi=Gl?.atlasReadyTiles??Ms,Wl=Gl?.atlasTileCount??Ms,Tr=Fi===Wl?`${Wl} tiles`:`${Fi}/${Wl} tiles`,bl=Pe?`1 stream / ${Cs} / ${Qa.toFixed(Qa>=10?0:1)}Mbps`:ft?`1 stream / ${Tr} / ${Cs} / ${Qa.toFixed(Qa>=10?0:1)}Mbps`:`${Ms} screens / ${Cs} / ${Qa.toFixed(Qa>=10?0:1)}Mbps`,kr=j?"offline":M?.started?"online":"starting",wl=fa.length+re.filter(S=>!Xe.some(E=>go(E.slotNumber)===S)).length,Jl=re.length===1?`Slot ${String(re[0]).padStart(3,"0")}`:`${re.length} slots selected`,Ku=Pe?be?ko(be):"No workstation":wl===0?"No workstation":wl>1?`${wl} selected`:be?ko(be):Jl,ct=ar[_e]||ar.en,ei=ct.sync||ar.en.sync,ya=s||q?"checking":_?mt==="pro"?"Pro LTD active":`Plus LTD ${Xe.length}/${bo}`:$l?`Free ${Xe.length}/${er}`:`Upgrade ${Xe.length}/${er}`,nc=mt==="pro"?"Pro active":z==="checkout"?"Opening":mt==="ltd"?"Pro $199":"Plus $79",Sl=_?mt==="pro"?"Pro active":"Upgrade to Pro LTD":l?z==="checkout"?"Opening checkout":mt==="ltd"?"Buy Pro LTD":"Buy Plus LTD":z==="auth"?"Opening Google":"Sign in to buy",Dr=mt==="pro"||z==="checkout"||z==="auth"||s||q,Rr=l?.user.user_metadata,ti=nv(Rr,"avatar_url","picture"),ni=nv(Rr,"full_name","name")||l?.user.email||"Google",jn=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(S=>S.width===he.maxWidth&&S.height===he.maxHeight)?.id||`${he.maxWidth}x${he.maxHeight}`,Bn=he.atlasTileSizeMode==="auto"?"auto":Kf.find(S=>S.width===he.atlasTileWidth&&S.height===he.atlasTileHeight)?.id||"320x180",Hn=Vf.find(S=>S.width===Be.maxWidth&&S.height===Be.maxHeight)?.id||`${Be.maxWidth}x${Be.maxHeight}`,Xa=xu.find(S=>S.id===he.frameMode)||xu[0],At=S=>{Ht(E=>{const I=S.frameMode?ym(S.frameMode):E.frameMode,O=S.frameMode!==void 0&&I!==E.frameMode;return{...E,...S,frameMode:I,fps:wm(S.fps??(O?sy(I):E.fps),I)}})},ba=S=>{const E=vu.find(I=>I.id===S);E&&At({maxWidth:E.width,maxHeight:E.height})},Ha=S=>{if(S==="auto"){At({atlasTileSizeMode:"auto"});return}const E=Kf.find(I=>I.id===S);!E?.width||!E?.height||At({atlasTileSizeMode:"fixed",atlasTileWidth:E.width,atlasTileHeight:E.height})},Ml=S=>{ve(E=>{const I=S.frameMode?bm(S.frameMode):E.frameMode,O=S.frameMode!==void 0&&I!==E.frameMode,U=S.fps??(O?30:E.fps),ue=S.maxWidth??E.maxWidth,ge=S.maxHeight??E.maxHeight;return{...E,...S,frameMode:I,fps:Na(U,20,I==="mode5-lzo-delta"?30:60,I==="mode5-lzo-delta"?30:60),maxWidth:I==="mode5-lzo-delta"?Math.min(1920,ue):ue,maxHeight:I==="mode5-lzo-delta"?Math.min(1080,ge):ge}})},Lr=S=>{const E=Vf.find(I=>I.id===S);E&&Ml({maxWidth:E.width,maxHeight:E.height})},_r=S=>{if(S==="control"){const E=hl||ml;if(E&&le(E.deviceId),ze(S),!jt){H(!1),L(za);return}H(!0);return}ze(S),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:EC.map(S=>{const E=S.icon;return o.jsxs("button",{className:`rail-tool ${Se===S.id?"active":""} accent-${S.accent}`,onClick:()=>_r(S.id),title:S.label,type:"button",children:[o.jsx(E,{size:19}),o.jsx("span",{children:S.label})]},S.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:()=>{ze("settings"),pe(!1),H(!1),Ct(!1)},title:"Settings",type:"button",children:[o.jsx(Bb,{size:18}),o.jsx("span",{children:"Settings"})]}),o.jsxs("button",{className:`rail-account ${l?"signed-in":""}`,onClick:()=>{pe(S=>!S)},disabled:s||z==="auth","aria-expanded":ne,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:jn}):o.jsx(Af,{size:18}),o.jsx("span",{children:l?"Account":"Google"})]}),ne&&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:jn}):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:mt==="free"?"Standard banner":"Removed"})]}),l?o.jsxs("button",{className:"account-popover-action",onClick:mr,disabled:z==="auth",type:"button",children:[o.jsx(Hb,{size:16}),"Logout"]}):o.jsxs("button",{className:"account-popover-action primary",onClick:ws,disabled:z==="auth",type:"button",children:[o.jsx(Af,{size:16}),"Sign in with Google"]})]})]})]}),o.jsxs("section",{className:`desk-stage ${Sn&&!Te?"dock-open":""} ${Pe?"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"})]})]}),wn&&!Pe&&o.jsxs("div",{className:"file-share-top-route","aria-label":"File distribution route",children:[o.jsxs("div",{children:[o.jsx(xo,{size:17}),o.jsxs("span",{children:[o.jsx("small",{children:"Source"}),o.jsx("strong",{children:"LiveDesk Hub"})]})]}),o.jsx(lv,{size:15}),o.jsx(Fb,{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:Ce.trim()||"Desktop/LiveDeskFiles"})]})]})]}),Sn&&!Pe&&o.jsx("div",{className:"top-actions",children:o.jsx("div",{className:"segmented-control","aria-label":"Screen size",children:kC.map(S=>o.jsx("button",{className:qe===S.id?"active":"",onClick:()=>Oe(S.id),type:"button",children:S.label},S.id))})})]}),Di?o.jsxs("section",{className:"doc-page",lang:_e,dir:_e==="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(am,{size:16}),ct.eyebrow]}),o.jsx("h2",{children:ct.title}),o.jsx("p",{children:ct.intro})]}),o.jsxs("label",{className:"doc-language-picker",children:[o.jsxs("span",{children:[o.jsx(Ib,{size:17}),ct.languageLabel]}),o.jsx("select",{value:_e,onChange:S=>Ge(S.target.value),children:DC.map(S=>o.jsx("option",{value:S.id,children:S.label},S.id))})]})]}),o.jsx("section",{className:"doc-grid",children:ct.sections.map((S,E)=>{const O=[Ug,vo,nm,Ub][E]||am;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:S.title}),o.jsx("p",{children:S.body}),o.jsx("ul",{children:S.points.map(U=>o.jsx("li",{children:U},U))})]})]},S.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(S=>o.jsx("li",{children:S},S))})]}),o.jsxs("section",{className:"doc-firewall",children:[o.jsxs("div",{className:"doc-firewall-head",children:[o.jsx($g,{size:20}),o.jsxs("div",{children:[o.jsx("h3",{children:ct.firewall.title}),o.jsx("p",{children:ct.firewall.body})]})]}),o.jsx("ul",{children:ct.firewall.points.map(S=>o.jsx("li",{children:S},S))})]}),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:ct.commands.title}),o.jsx("p",{children:ct.commands.body})]})]}),o.jsxs("div",{className:"doc-command-list",children:[ct.commands.manager&&o.jsxs("div",{className:"doc-command-row",children:[o.jsx("span",{children:ct.commands.manager}),o.jsx("code",{children:Kl}),o.jsx("button",{className:"icon-button",onClick:()=>Zi(Kl),title:"Copy command",type:"button",children:o.jsx(Qs,{size:16})})]}),o.jsxs("div",{className:"doc-command-row",children:[o.jsx("span",{children:ct.commands.primary}),o.jsx("code",{children:Ba}),o.jsx("button",{className:"icon-button",onClick:()=>Zi(Ba),title:"Copy command",type:"button",children:o.jsx(Qs,{size:16})})]}),o.jsxs("div",{className:"doc-command-row",children:[o.jsx("span",{children:ct.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(Qs,{size:16})})]})]})]})]}):wn?o.jsx(FM,{hubUrl:T,devices:Xe,localFeatureAccess:jt,upgradeNotice:za,notice:fe,remoteDirectory:Ce,onRemoteDirectoryChange:tt,targetMode:ot,selectedTargetIds:Ee,onTargetModeChange:vt,onTargetToggle:S=>nt(E=>E.includes(S)?E.filter(I=>I!==S):[...E,S]),filePickerRef:ul,folderPickerRef:dl,onBrowserFileImport:S=>{Vl(S)},onBrowserFolderImport:S=>{Vl(S)},onNotice:L,onTransferChange:S=>{if(!S){Yt(null);return}const E=S.state==="failed"||S.state==="partially-failed"||S.state==="cancelled"?"failed":S.state==="completed"?"queued":S.state==="sending"?"sending":"reading";Yt({id:S.id,status:E,progress:S.progress,message:S.message}),["completed","partially-failed","failed","cancelled"].includes(S.state)&&window.setTimeout(()=>Yt(I=>I?.id===S.id?null:I),4500)}}):ls?o.jsx(lw,{pin:o.jsxs(iw,{children:[(j||c||F||fe)&&o.jsx("section",{className:"notice-band",children:j||c||F||fe}),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:$u,disabled:!M?.started||z==="pin",type:"button",children:[o.jsx(em,{size:15}),z==="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(Qs,{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(Qs,{size:16})})]}),o.jsxs("div",{className:"settings-command-row",children:[o.jsx("span",{children:"Hub"}),o.jsx("code",{children:Kl}),o.jsx("button",{className:"icon-button",onClick:()=>Zi(Kl),title:"Copy Hub command",type:"button",children:o.jsx(Qs,{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:kr})]}),o.jsx("span",{className:`settings-status-dot state-${kr}`})]}),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:[yr,"/",zn]}),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||z==="host",type:"button",children:[o.jsx(Nf,{size:16}),"Sync access"]}),o.jsxs("button",{className:"text-button buy",onClick:()=>Bi(mt==="ltd"?"pro":"ltd"),disabled:z==="checkout"||mt==="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:Ce,onChange:S=>tt(S.target.value),placeholder:"Desktop/LiveDeskFiles"})]}),o.jsx("p",{className:"settings-help",children:"Blank uses Desktop/LiveDeskFiles on each workstation."})]})]}),wall: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:"Wall stream"}),o.jsx("h3",{children:"Frame delivery"})]}),o.jsx(nm,{size:20})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Frame mode"}),o.jsx("select",{value:he.frameMode,onChange:S=>At({frameMode:ym(S.target.value)}),children:xu.map(S=>o.jsxs("option",{value:S.id,children:[S.label," - ",S.detail]},S.id))})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"H.264 decode"}),o.jsx("select",{value:he.h264DecodeAcceleration,onChange:S=>At({h264DecodeAcceleration:Nu(S.target.value)}),children:vm.map(S=>o.jsx("option",{value:S.id,children:S.label},S.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:he.fps,onChange:S=>At({fps:wm(S.target.value,he.frameMode)}),children:$m.filter(S=>S<=ry(he.frameMode)).map(S=>o.jsx("option",{value:S,children:S},S))})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:ft?"Atlas tile":"Resolution"}),o.jsx("select",{value:ft?Bn:Ii,onChange:S=>ft?Ha(S.target.value):ba(S.target.value),children:(ft?Kf:vu).map(S=>o.jsx("option",{value:S.id,children:S.label},S.id))})]})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Quality"}),o.jsx("select",{value:he.quality,onChange:S=>At({quality:Na(S.target.value,20,95,Yn.quality)}),children:Qx.map(S=>o.jsx("option",{value:S,children:S},S))})]})]}),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:he.autoStartLive,onChange:S=>At({autoStartLive:S.target.checked})}),o.jsx("span",{children:"Auto live on connected screens"})]}),o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:he.visibleOnlyLive,onChange:S=>At({visibleOnlyLive:S.target.checked})}),o.jsx("span",{children:"Stream visible tiles first"})]}),!ft&&o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:he.adaptiveSizeByWall,onChange:S=>At({adaptiveSizeByWall:S.target.checked})}),o.jsx("span",{children:"Fit stream size to Wall"})]}),o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:he.adaptiveLoadShedding,onChange:S=>At({adaptiveLoadShedding:S.target.checked})}),o.jsx("span",{children:"Reduce FPS under load"})]}),o.jsxs("label",{className:"settings-toggle",children:[o.jsx("input",{type:"checkbox",checked:he.showScreenStatus,onChange:S=>At({showScreenStatus:S.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:[en.maxWidth,"x",en.maxHeight," / ",Ve,"fps"]})]}),o.jsxs("button",{className:"settings-reset",onClick:()=>Ht(Yn),type:"button",children:[o.jsx(kf,{size:15})," Reset Wall settings"]})]})]})}),control:o.jsx(rw,{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:Be.frameMode,onChange:S=>Ml({frameMode:bm(S.target.value)}),children:eC.map(S=>o.jsx("option",{value:S.id,children:S.label},S.id))})]}),Be.frameMode==="mode3-h264-hw"&&o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"H.264 decode"}),o.jsx("select",{value:Be.h264DecodeAcceleration,onChange:S=>Ml({h264DecodeAcceleration:Nu(S.target.value)}),children:vm.map(S=>o.jsx("option",{value:S.id,children:S.label},S.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:S=>Ml({fps:Na(S.target.value,20,60,Vn.fps)}),children:tC.filter(S=>Be.frameMode==="mode3-h264-hw"||S<=30).map(S=>o.jsx("option",{value:S,children:S},S))})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Resolution"}),o.jsx("select",{value:Hn,onChange:S=>Lr(S.target.value),children:Vf.filter(S=>Be.frameMode==="mode3-h264-hw"||S.width<=1920).map(S=>o.jsx("option",{value:S.id,children:S.label},S.id))})]})]}),Be.frameMode==="mode3-h264-hw"&&o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Quality"}),o.jsx("select",{value:Be.quality,onChange:S=>Ml({quality:Na(S.target.value,20,95,Vn.quality)}),children:Qx.map(S=>o.jsx("option",{value:S,children:S},S))})]})]}),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:Be.showScreenStatus,onChange:S=>Ml({showScreenStatus:S.target.checked})}),o.jsx("span",{children:"Screen status overlay"})]}),o.jsxs("div",{className:"settings-summary control",children:[o.jsx("span",{children:Be.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:()=>ve(Vn),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($b,{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:()=>ze("wall"),title:"Close pricing",type:"button",children:o.jsx(tm,{size:18})})]}),(F||fe)&&o.jsx("section",{className:"notice-band",children:F||fe}),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:[Xe.length,"/",JM(pl)," connected devices"]})]}),o.jsxs("div",{className:"pricing-cards","aria-label":"LiveDesk plans",children:[o.jsxs("article",{className:`pricing-plan-card ${mt==="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:mt==="free"?"Current plan":"Included for everyone"})]}),o.jsxs("article",{className:`pricing-plan-card featured ${mt==="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:mt!=="free"||z==="checkout"||z==="auth"||s||q,type:"button",children:[o.jsx(yo,{size:16}),mt==="free"?l?"Choose Plus":"Sign in for Plus":"Plus active"]})]}),o.jsxs("article",{className:`pricing-plan-card pro ${mt==="pro"?"current":""}`,children:[o.jsxs("div",{className:"pricing-plan-topline",children:[o.jsxs("span",{className:"pricing-plan-badge pro",children:[o.jsx($g,{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:mt==="pro"||z==="checkout"||z==="auth"||s||q,type:"button",children:[o.jsx(yo,{size:16}),mt==="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(qg,{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(mt==="ltd"?"pro":"ltd"):ws,disabled:Dr,type:"button",children:[o.jsx(yo,{size:18}),Sl]})]}):o.jsx(o.Fragment,{children:o.jsxs("section",{className:`monitor-layout ${Te?"dock-collapsed":""}`,children:[o.jsxs("section",{ref:Lt,className:`screen-wall-panel ${P?"drop-active":""}`,onClick:S=>{S.currentTarget===S.target&&Pl()},onDragEnter:S=>{S.preventDefault(),me(!0)},onDragOver:S=>{S.preventDefault(),S.dataTransfer.dropEffect="copy"},onDragLeave:S=>{S.currentTarget===S.target&&me(!1)},onDrop:Gu,children:[ft&&o.jsx("canvas",{ref:rr,className:"atlas-source-canvas",width:gl?.width||1920,height:gl?.height||1080,"aria-hidden":"true"}),Pe?o.jsx("section",{className:"control-focus",children:o.jsxs("div",{className:"control-wall",children:[be&&Vo.length>1&&o.jsx("div",{className:"control-monitor-tabs","aria-label":"Select monitor",children:Vo.map(S=>o.jsxs("button",{className:S.index===js?"active":"",onClick:()=>qu(be.deviceId,S.index),title:hC(S),type:"button",children:[o.jsx("span",{children:S.name||`Display ${S.index+1}`}),S.width>0&&S.height>0&&o.jsxs("small",{children:[S.width,"x",S.height]})]},S.index))}),be?o.jsx(Jf,{device:be,frame:ye,selected:!1,controlEnabled:Wt&&ce,showStatus:Be.showScreenStatus,monitorIndex:ra(ke[be.deviceId],Pn(be)),monitorCount:Pn(be),onSelect:()=>{},onFocusDevice:()=>le(be.deviceId),onOpenControl:()=>xr(be.deviceId),onCycleMonitor:S=>Va(be.deviceId,S),onCanvasReady:Io,sendInput:Oi,presentationReady:ka},be.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."})]}),be&&!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"})]})]})}):ft?o.jsx("div",{className:`screen-wall atlas-slot-wall size-${qe}`,onClick:S=>{S.currentTarget===S.target&&Pl()},children:Ul.map((S,E)=>{const I=E+1;return S?o.jsx(Jf,{device:S,frame:xs.get(S.deviceId),selected:_a.has(S.deviceId)||fl.has(I),controlEnabled:!1,showStatus:he.showScreenStatus,monitorIndex:ra(ke[S.deviceId],Pn(S)),monitorCount:Pn(S),onSelect:()=>hr(S.deviceId),onFocusDevice:()=>xl(S.deviceId),onOpenControl:()=>xr(S.deviceId),onCycleMonitor:O=>Va(S.deviceId,O),onCanvasReady:ds,sendInput:Oi},S.deviceId):o.jsx(av,{index:E,selected:fl.has(I),onSelect:()=>pr(I)},`slot-${E}`)})}):o.jsx("div",{className:`screen-wall size-${qe}`,onClick:S=>{S.currentTarget===S.target&&Pl()},children:Ul.map((S,E)=>{const I=E+1;return S?o.jsx(Jf,{device:S,frame:xs.get(S.deviceId),selected:_a.has(S.deviceId)||fl.has(I),controlEnabled:Wt&&ce&&be?.deviceId===S.deviceId,showStatus:he.showScreenStatus,monitorIndex:ra(ke[S.deviceId],Pn(S)),monitorCount:Pn(S),onSelect:()=>hr(S.deviceId),onFocusDevice:()=>xl(S.deviceId),onOpenControl:()=>xr(S.deviceId),onCycleMonitor:O=>Va(S.deviceId,O),onCanvasReady:cs,sendInput:Oi},S.deviceId):o.jsx(av,{index:E,selected:fl.has(I),onSelect:()=>pr(I)},`slot-${E}`)})}),o.jsx(LC,{visible:Ho&&!Pe})]}),!ls&&o.jsxs("aside",{className:`right-dock actions-mode ${Te?"collapsed":""}`,"aria-label":"LiveDesk tools",children:[o.jsx("button",{className:"dock-toggle",onClick:()=>Ct(S=>!S),"aria-label":Te?"Show control panel":"Hide control panel",title:Te?"Show control panel":"Hide control panel",type:"button",children:Te?o.jsx(sv,{size:18}):o.jsx(Mm,{size:18})}),!Te&&o.jsxs(o.Fragment,{children:[o.jsxs("section",{className:"action-dock",children:[o.jsxs("div",{className:"action-context",children:[o.jsx("span",{children:Pe?"Control target":wl>0?"Selection":"No selection"}),o.jsx("strong",{children:Ku})]}),o.jsx("input",{ref:wt,className:"hidden-file-input",type:"file",multiple:!0,onChange:S=>{S.currentTarget.files&&Yl(S.currentTarget.files),S.currentTarget.value=""}}),(j||fe)&&o.jsx("div",{className:"notice-band compact",children:o.jsx("span",{children:j||fe})}),o.jsxs("div",{className:"action-grid",children:[o.jsxs("button",{className:"action-tile primary",onClick:()=>be&&Po(be.deviceId),disabled:!ql,type:"button",children:[o.jsx(Gg,{size:21}),o.jsx("span",{children:"Live"})]}),o.jsxs("button",{className:`action-tile ${ce?"active":""}`,onClick:()=>H(S=>!S),disabled:!Wt,type:"button",children:[o.jsx(fu,{size:21}),o.jsx("span",{children:bs!=="idle"?bs:"Control"})]}),o.jsxs("button",{className:`action-tile ${Q?"active":""}`,onClick:Yo,disabled:!os,type:"button",title:Jn?"Remote PC audio":"Remote audio is not supported by this workstation yet",children:[o.jsx(qg,{size:21}),o.jsx("span",{children:Q&&qo!=="idle"?qo:"Audio"})]}),o.jsxs("button",{className:"action-tile",onClick:()=>wt.current?.click(),disabled:!jt||(Pe?!be: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(Gb,{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"})]})]})]}),be&&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(be)}),o.jsx("span",{children:ma.role})]}),o.jsx("div",{className:"machine-metric-grid",children:ma.metrics.map(S=>o.jsxs("article",{className:`machine-metric state-${S.state}`,children:[o.jsx("span",{children:S.label}),o.jsx("strong",{children:S.value}),o.jsx("small",{children:S.detail}),S.ratio!==void 0&&o.jsx("i",{children:o.jsx("b",{style:{width:`${Math.round(S.ratio*100)}%`}})})]},S.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:wr}),o.jsx("dt",{children:Pe?"Control RX":ft?"Atlas RX":"Wall RX"}),o.jsx("dd",{children:bl}),o.jsx("dt",{children:"Painted"}),o.jsx("dd",{children:Yu}),o.jsx("dt",{children:Pe?"Encoded changes":"Visual samples"}),o.jsx("dd",{children:Ql}),o.jsx("dt",{children:"Decoder"}),o.jsx("dd",{children:Sr}),o.jsx("dt",{children:"Decoder IO"}),o.jsx("dd",{children:Qo}),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:Cr}),o.jsx("dt",{children:"Latency"}),o.jsx("dd",{children:Hi}),o.jsx("dt",{children:"Cadence"}),o.jsx("dd",{children:Mr}),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:Vu}),o.jsx("dt",{children:"Mode"}),o.jsx("dd",{children:jr}),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:Cn}),o.jsx("dt",{children:"Monitor"}),o.jsx("dd",{children:Ar}),o.jsx("dt",{children:"Source"}),o.jsx("dd",{children:ea}),o.jsx("dt",{children:"Input"}),o.jsx("dd",{children:Ns}),Pe&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Visual feedback"}),o.jsx("dd",{children:On})]})]})]}),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(S=>o.jsxs("span",{className:`tool-probe state-${S.status}`,children:[o.jsx("b",{children:S.label}),o.jsx("em",{children:S.detail})]},S.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(Ug,{size:15}),o.jsx("span",{children:"System"})]}),o.jsxs("dl",{className:"facts compact",children:[o.jsx("dt",{children:"Platform"}),o.jsxs("dd",{children:[be.platform||"-"," ",be.arch||""]}),o.jsx("dt",{children:"Release"}),o.jsx("dd",{children:Kn(be.status,"release")||"-"}),o.jsx("dt",{children:"Uptime"}),o.jsx("dd",{children:dy(Tt(be.status,"uptimeSec"))}),o.jsx("dt",{children:"Last seen"}),o.jsx("dd",{children:cm(be.lastSeenAt||be.connectedAt)}),o.jsx("dt",{children:"Agent"}),o.jsx("dd",{children:be.agentVersion||"-"}),o.jsx("dt",{children:"Address"}),o.jsx("dd",{children:be.remoteAddress||"-"})]})]}),Go&&o.jsx("p",{className:"panel-warning",children:Go}),o.jsxs("button",{className:"text-button full",onClick:()=>be&&Po(be.deviceId),disabled:!ql,type:"button",children:[o.jsx(Gg,{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:xe,onChange:S=>we(S.target.value),placeholder:"Prepare a short status report.",rows:4}),o.jsxs("button",{className:"text-button full primary",onClick:Ss,disabled:z==="task"||!xe.trim()||!jt,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(tm,{size:18}):o.jsx(iv,{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)),"%"]})]})]})}Wb.createRoot(document.getElementById("root")).render(o.jsx(m.StrictMode,{children:o.jsx(_C,{})}));