livedesk 0.1.655 → 0.1.656
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.
- package/package.json +1 -1
- package/web/dist/app.html +3 -3
- package/web/dist/app.webmanifest +1 -1
- package/web/dist/assets/{AgentSettingsTab-7PWVlMXN.js → AgentSettingsTab-D0271Ynp.js} +1 -1
- package/web/dist/assets/{AgentsPage-DfmvWT29.js → AgentsPage-DEdUBoe0.js} +1 -1
- package/web/dist/assets/{App-DqucFaHW.js → App-DK9GZcvU.js} +13 -13
- package/web/dist/assets/{CaptureGallery-Cniuvvyq.js → CaptureGallery-C0xqFLap.js} +1 -1
- package/web/dist/assets/{DesktopUpdatePanel-Bn7N7m4V.js → DesktopUpdatePanel-uMaTnBsl.js} +1 -1
- package/web/dist/assets/{SettingsPage-es9HBQaT.js → SettingsPage-BoFLQBfH.js} +1 -1
- package/web/dist/assets/{SettingsTabs-qIgqY_Xj.js → SettingsTabs-D0zQN-Mo.js} +1 -1
- package/web/dist/assets/{ShareFilesPage-Bd2fe_H4.js → ShareFilesPage-BiCS0Nyd.js} +1 -1
- package/web/dist/assets/{SupportPage-D3n87Hpc.js → SupportPage-D241Vkb1.js} +1 -1
- package/web/dist/assets/{VuvoDeskApp-9GDuXg9F.js → VuvoDeskApp-36bRXXS2.js} +1 -1
- package/web/dist/assets/{app-C9DkE6HV.js → app-hMd5uyvT.js} +1 -1
- package/web/dist/assets/{main-SlpA0zpK.js → main-DT492iHt.js} +2 -2
- package/web/dist/assets/styles-Ba1tPFHg.js +16 -0
- package/web/dist/index.html +2 -2
- package/web/dist/sw.js +2 -2
- package/web/dist/vuvodesk-build-evidence.json +41 -41
- package/web/dist/assets/styles-aOuztJQq.js +0 -16
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as o,h as Me,f as Zs,g as Xs}from"./styles-aOuztJQq.js";import{a as c,K as Qt,O as pt,P as er,N as tr,Q as nr,V as sr,Y as Zt,Z as Cn,n as kn,_ as Nn,C as rr,$ as ir,u as or,U as ar,c as _n,b as lr,a0 as Pt,a1 as cr,o as Rn,a2 as $n,X as dr}from"./icons-CacEbnZu.js";import{r as ur}from"./react-Cfedt3N5.js";new Date().valueOf();function Oe(t){const[e,n]=c.useState(t),s=c.useRef(t);return c.useEffect(()=>{if(s.current!==t){if(Array.isArray(s.current)&&Array.isArray(t)&&s.current.length===0&&t.length===0)return;s.current=t,n(t)}},[t]),[e,n]}function Xt(t,e){return typeof t=="function"?typeof e=="object"?t(e):t():t}function Ze(t,e="data-id"){let n=t;for(!n.tagName&&t.target&&(n=t.target);n;){if(n.getAttribute&&n.getAttribute(e))return n;n=n.parentNode}return null}function fr(t,e="data-id"){const n=Ze(t,e);return n?n.getAttribute(e):null}function rt(t,e="data-id"){const n=Ze(t,e);return n?_t(n,e):null}function _t(t,e="data-id"){const n=t.getAttribute(e);return n?hr(n):null}function ge(t){return typeof t=="string"?":"+t:t}function hr(t){if(t.startsWith(":"))return t.substring(1);const e=t*1;return isNaN(e)?t:e}function xr(){return{detect:()=>!0,addEvent:function(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)},addGlobalEvent:function(t,e){return document.addEventListener(t,e),()=>document.removeEventListener(t,e)},getTopNode:function(){return window.document.body}}}var Ce=xr();function en(t){Object.assign(Ce,t)}function En(t,e,n){function s(r){const i=Ze(r);if(!i)return;const a=_t(i);if(typeof e=="function")return e(a,r);let l,d=r.target;for(;d!=i;){if(l=d.dataset?d.dataset.action:null,l&&e[l]){e[l](a,r);return}d=d.parentNode}e[n]&&e[n](a,r)}Ce.addEvent(t,n,s)}function Xe(t,e){En(t,e,"click"),e.dblclick&&En(t,e.dblclick,"dblclick")}function pr(t,e){for(let n=t.length-1;n>=0;n--)if(t[n]===e){t.splice(n,1);break}}function mr(t,e,n){for(let s=0;s<Le.length;s++){if(s===n)continue;const r=Le[s],i=r.props.parent?.();if(i&&t.contains(i)&&r.node.contains(e))return!0}return!1}var os=new Date,kt=!1,mt=[],Le=[],Mn=t=>{const e=t.target;if(kt||!e.isConnected){kt=!1;return}for(let n=Le.length-1;n>=0;n--){const{node:s,date:r,props:i}=Le[n];if(!(r>os)&&!s.contains(e)&&s!==e&&(mr(s,e,n)||(i.callback&&i.callback(t),i.modal||t.defaultPrevented)))break}},gr=t=>{os=new Date,kt=!0;for(let e=Le.length-1;e>=0;e--){const{node:n}=Le[e];if(!n.contains(t.target)&&n!==t.target){kt=!1;break}}};function Pe(t,e){mt.length||(mt=[Ce.addGlobalEvent("click",Mn,t),Ce.addGlobalEvent("contextmenu",Mn,t),Ce.addGlobalEvent("mousedown",gr,t)]),typeof e!="object"&&(e={callback:e});const n={node:t,date:new Date,props:e};return Le.push(n),{destroy(){pr(Le,n),Le.length||(mt.forEach(s=>s()),mt=[])}}}var gt=t=>t.indexOf("bottom")!==-1,wt=t=>t.indexOf("left")!==-1,vt=t=>t.indexOf("right")!==-1,Ht=t=>t.indexOf("top")!==-1,Dn=t=>t.indexOf("fit")!==-1,tt=t=>t.indexOf("overlap")!==-1,wr=t=>t.split("-").every(e=>["center","fit"].indexOf(e)>-1),vr=t=>{const e=t.match(/(start|center|end)/);return e?e[0]:null};function yr(t,e){let n=0;const s=Ce.getTopNode(t);for(;t&&t!==s;){const r=getComputedStyle(t).position;if((r==="absolute"||r==="relative"||r==="fixed")&&(n=parseInt(getComputedStyle(t).zIndex)||0),t=t.parentNode,t===e)break}return n}var me,je,nt,be;function as(t,e,n="bottom",s=0,r=0){if(!t)return null;me=s,je=r,nt="auto";let i=0,a=0,l=n;const d=ls(t),u=tt(n)?Ce.getTopNode(t):d;if(!d)return null;const h=d.getBoundingClientRect(),f=t.getBoundingClientRect(),x=u.getBoundingClientRect(),m=window.getComputedStyle(u),p={left:0,top:0,bottom:0,right:0};for(const R in p){const C=`border-${R}-width`;p[R]=parseFloat(m.getPropertyValue(C))}if(e){const R=yr(e,d);i=Math.max(R+1,20)}if(e){if(be=e.getBoundingClientRect(),Dn(n)&&(nt=be.width+"px"),n!=="point")if(wr(n))Dn(n)?me=0:(me=x.width/2,a=1),je=(x.height-f.height)/2;else{const R=tt(n)?0:1;me=vt(n)?be.right+R:be.left-R,je=gt(n)?be.bottom+1:be.top;const C=vr(n);C&&(vt(n)||wt(n)?C==="center"?je-=(f.height-be.height)/2:C==="end"&&(je-=f.height-be.height):(gt(n)||Ht(n))&&(C==="center"?me-=(f.width-be.width)/2:C==="end"&&(me-=f.width-be.width),tt(n)||(me+=1)))}}else be={left:s,right:s,top:r,bottom:r};const g=(wt(n)||vt(n))&&(gt(n)||Ht(n));wt(n)&&(a=2);const y=me-f.width-x.left;e&&wt(n)&&!g&&y<0&&(me=be.right,a=0,l=l.replace("left","right"));const v=me+f.width*(1-a/2)-x.right;if(v>0)if(!vt(n))me=x.right-p.right-f.width;else{const R=be.left-x.x-f.width;e&&!g&&R>=0?(me=be.left-f.width,l=l.replace("right","left")):me-=v+p.right}a&&(me=Math.round(me-f.width*a/2));const w=y<0||v>0||!g;Ht(n)&&(je=be.top-f.height,e&&je<x.y&&w&&(je=be.bottom,l=l.replace("top","bottom")));const j=je+f.height-x.bottom;return j>0&&(e&>(n)&&w?(je-=f.height+be.height+1,l=l.replace("bottom","top")):je-=j+p.bottom),me-=h.left+p.left,je-=h.top+p.top,me=(tt(n)?me:Math.max(me,0))+u.scrollLeft,je=(tt(n)?je:Math.max(je,0))+u.scrollTop,nt=nt||"auto",{at:l,x:me,y:je,z:i,width:nt}}function ls(t){const e=Ce.getTopNode(t);for(t&&(t=t.parentElement);t;){const n=getComputedStyle(t).position;if(t===e||n==="relative"||n==="absolute"||n==="fixed")return t;t=t.parentNode}return null}function br(t){const e=[];let n=t;const s=Ce.getTopNode(t);for(;n&&n!==s&&!n.getAttribute("data-wx-portal-root");)getComputedStyle(n).position==="absolute"&&e.push(n),n=n.parentNode;return e}var An=new Date().valueOf();function tn(){return An+=1,An}function Se(t){return t<10?"0"+t:t.toString()}function jr(t){const e=Se(t);return e.length==2?"0"+e:e}function cs(t){const e=Math.floor(t/11)*11;return{start:e,end:e+11}}function Lt(t){const e=(t.getDay()+6)%7,n=new Date(t.valueOf());n.setDate(t.getDate()+(3-e)),n.setHours(0,0,0,0);const s=new Date(n.getFullYear(),0,1),r=Math.round((n.getTime()-s.getTime())/864e5);return 1+Math.floor(r/7)}var Tn=["",""];function Sr(t,e,n){switch(t){case"%d":return Se(e.getDate());case"%m":return Se(e.getMonth()+1);case"%j":return e.getDate();case"%n":return e.getMonth()+1;case"%y":return Se(e.getFullYear()%100);case"%Y":return e.getFullYear();case"%D":return n.dayShort[e.getDay()];case"%l":return n.dayFull[e.getDay()];case"%M":return n.monthShort[e.getMonth()];case"%F":return n.monthFull[e.getMonth()];case"%h":return Se((e.getHours()+11)%12+1);case"%g":return(e.getHours()+11)%12+1;case"%G":return e.getHours();case"%H":return Se(e.getHours());case"%i":return Se(e.getMinutes());case"%a":return((e.getHours()>11?n.pm:n.am)||Tn)[0];case"%A":return((e.getHours()>11?n.pm:n.am)||Tn)[1];case"%s":return Se(e.getSeconds());case"%S":return jr(e.getMilliseconds());case"%W":return Se(Lt(e));case"%w":{const s=n.weekStart??1;if(s===1)return Se(Lt(e));const r=(e.getDay()-s+7)%7,i=(1-s+7)%7,a=new Date(e.valueOf());return a.setDate(e.getDate()+(i-r)),Se(Lt(a))}case"%c":{let s=e.getFullYear()+"";return s+="-"+Se(e.getMonth()+1),s+="-"+Se(e.getDate()),s+="T",s+=Se(e.getHours()),s+=":"+Se(e.getMinutes()),s+=":"+Se(e.getSeconds()),s}case"%Q":return Math.floor(e.getMonth()/3)+1;default:return t}}var Cr=/%[a-zA-Z]/g;function Je(t,e){return typeof t=="function"?t:function(n){return n?(n.getMonth||(n=new Date(n)),t.replace(Cr,s=>Sr(s,n,e))):""}}function In(t){return t&&typeof t=="object"&&!Array.isArray(t)}function Yt(t,e){for(const n in e){const s=e[n];In(t[n])&&In(s)?t[n]=Yt({...t[n]},e[n]):t[n]=e[n]}return t}function ot(t){return{getGroup(e){const n=t[e];return s=>n&&n[s]||s},getRaw(){return t},extend(e,n){if(!e)return this;let s;return n?s=Yt({...e},t):s=Yt({...t},e),ot(s)}}}var kr=ur();const Nr="en-US",_r={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},Rr={ok:"OK",cancel:"Cancel",select:"Select","No data":"No data","Rows per page":"Rows per page","Total pages":"Total pages"},$r={timeFormat:"%H:%i",dateFormat:"%m/%d/%Y",monthYearFormat:"%F %Y",yearFormat:"%Y"},ds={core:Rr,calendar:_r,formats:$r,lang:Nr},nn=c.createContext(""),us=c.createContext({}),Ie=c.createContext(null),fs=c.createContext(null),ve=Object.freeze(Object.defineProperty({__proto__:null,fieldId:fs,helpers:us,i18n:Ie,theme:nn},Symbol.toStringTag,{value:"Module"}));function hs(t){const e=c.useContext(fs),[n]=c.useState(()=>t||e||tn());return n}function st({type:t="",css:e="",icon:n="",disabled:s=!1,title:r="",tooltip:i,text:a="",children:l,onClick:d}){const u=c.useMemo(()=>{let f=t?t.split(" ").filter(x=>x!=="").map(x=>"wx-"+x).join(" "):"";return e+(e?" ":"")+f},[t,e]),h=f=>{d&&d(f)};return o.jsxs("button",{title:r,className:`wx-2ZWgb4 wx-button ${u} ${n&&!l?"wx-icon":""}`,disabled:s,onClick:h,"data-tooltip-text":i,children:[n&&o.jsx("i",{className:"wx-2ZWgb4 "+n}),l||a||" "]})}function Er({id:t,label:e="",inputValue:n="",value:s=!1,onChange:r,disabled:i=!1,css:a=""}){const l=hs(t),[d,u]=Oe(s),h=({target:f})=>{const x=f.checked;u(x),r&&r({value:x,inputValue:n})};return o.jsxs("div",{className:`wx-2IvefP wx-checkbox ${a}`,children:[o.jsx("input",{type:"checkbox",id:l,disabled:i,className:"wx-2IvefP wx-check",checked:d,value:n,onChange:h}),o.jsxs("label",{htmlFor:l,className:"wx-2IvefP wx-label",children:[o.jsx("span",{className:"wx-2IvefP wx-before"}),e&&o.jsx("span",{className:"wx-2IvefP wx-after",children:e})]})]})}function sn({theme:t="",target:e,children:n}){const s=c.useRef(null),r=c.useRef(null),[i,a]=c.useState(null);s.current||(s.current=document.createElement("div"));const l=c.useContext(nn);return c.useEffect(()=>{a(e||Mr(r.current)||Ce.getTopNode(r.current))},[r.current]),o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:r,style:{display:"none"}}),r.current&&i?kr.createPortal(o.jsx("div",{className:`wx-3ZWsT0 wx-${t||l}-theme`,children:n}),i):null]})}function Mr(t){const e=Ce.getTopNode(t);for(;t&&t!==e&&!t.getAttribute("data-wx-portal-root");)t=t.parentNode;return t}function Dr({left:t=0,top:e=0,at:n="bottom",parent:s=null,width:r="auto",css:i="",onCancel:a,children:l,trackScroll:d=!1}){const[u,h]=c.useState(0),[f,x]=c.useState(0),[m,p]=c.useState("auto"),[g,y]=c.useState(!1),v=c.useRef(null),w=c.useRef(null),j=c.useRef(a);c.useEffect(()=>{j.current=a},[a]);function R($){return s&&(r+"").indexOf("%")>-1?r.replace(/(\d+)%/,(b,E)=>(E=E*s.offsetWidth/100+"px",r.replace(b,E))):r&&r!=="auto"?r:$}const C=c.useCallback(()=>{if(!v.current)return;const $=as(v.current,s,n,t,e);$&&(h($.x),x($.y),p(R($.width)))},[v,s,n,t,e,r]);return c.useLayoutEffect(()=>{const $=E=>{j.current&&E.target!==w.current&&v.current&&!v.current.contains(E.target)&&j.current(E)};let b;return requestAnimationFrame(()=>{C(),y(!0),d&&v.current&&(w.current=ls(v.current),w.current&&w.current.addEventListener("scroll",$,!0)),s&&(b=new ResizeObserver(C),b.observe(s))}),()=>{d&&w.current&&w.current.removeEventListener("scroll",$,!0),b?.disconnect()}},[]),c.useLayoutEffect(()=>{C()},[s,n,t,e]),c.useEffect(()=>{const $=b=>{j.current&&j.current(b)};if(v.current)return Pe(v.current,{callback:$,parent:()=>s}).destroy},[s]),o.jsx("div",{ref:v,className:["wx-37M6Fj","wx-popup",i].filter(Boolean).join(" "),style:{position:"absolute",visibility:g?"visible":"hidden",top:f+"px",left:u+"px",width:m},children:l})}function Ar({position:t="bottom",align:e="start",autoFit:n=!0,onCancel:s=null,width:r="100%",css:i="",children:a}){const l=c.useRef(null),[d,u]=c.useState(t),[h,f]=c.useState(e),x=c.useRef(s);return c.useEffect(()=>{x.current=s},[s]),c.useEffect(()=>{if(n){const m=l.current;if(m){const p=m.getBoundingClientRect(),g=document.body.getBoundingClientRect();p.right>=g.right&&f("end"),p.bottom>=g.bottom&&u("top")}}},[]),c.useEffect(()=>{if(l.current){const m=p=>{x.current&&x.current(p)};return Pe(l.current,m).destroy}},[]),o.jsx("div",{ref:l,className:["wx-dropdown",`wx-${d}-${h}`,i||"","wx-aaaVytZW"].filter(Boolean).join(" "),style:{width:r},children:a})}function rn({position:t="bottom",align:e="start",autoFit:n=!0,inline:s=!1,onCancel:r,width:i="100%",children:a,...l}){const[d,u]=c.useState(void 0),h=c.useRef(null),f=c.useMemo(()=>`${t}-${e}`,[t,e]);return c.useLayoutEffect(()=>{h.current&&u(h.current.parentNode)},[]),o.jsxs(o.Fragment,{children:[d&&(s?o.jsx(Ar,{onCancel:r,position:t,align:e,autoFit:n,width:i,...l,children:a}):o.jsx(sn,{children:o.jsx(Dr,{parent:d,at:f,onCancel:r,width:i,...l,children:a})})),o.jsx("span",{ref:h,className:"wx-portal-node wx-32GZ52"})]})}function Rt(){return ot(ds)}function Tr(){let t=null,e=!1,n=!1,s,r,i,a;const l=(f,x,m,p,g)=>{s=f,r=x,i=m,a=p,n=g},d=f=>{t=f,e=t!==null,i(t)},u=(f,x)=>{if(!n&&f!==null&&s){const m=s.querySelectorAll(".wx-list > .wx-item")[f];m&&(m.scrollIntoView({block:"nearest"}),x&&x.preventDefault())}},h=(f,x)=>{const m=f===null?null:Math.max(0,Math.min(t+f,r.length-1));m!==t&&(d(m),s?u(m,x):requestAnimationFrame(()=>u(m,x)))};return{move:f=>{const x=rt(f),m=r.findIndex(p=>p.id===x);m!==t&&d(m)},keydown:(f,x)=>{switch(f.code){case"Enter":e?a():d(0);break;case"Space":e||d(0);break;case"Escape":i(t=null);break;case"Tab":i(t=null);break;case"ArrowDown":h(e?1:x||0,f);break;case"ArrowUp":h(e?-1:x||0,f);break}},init:l,navigate:h}}const Fn=10,Ir=c.memo(function({data:t,checkboxes:e,itemTemplate:n,value:s}){return o.jsxs(o.Fragment,{children:[e&&o.jsx(Er,{id:t.id,css:"wx-list-checkbox",value:s&&s.includes(t.id)}),n?Xt(n,{option:t}):t.label]})});function On({visibleItems:t,visibleRange:e,navIndex:n,checkboxes:s,itemTemplate:r,value:i,measureRefCallback:a}){return t.map((l,d)=>{const u=e.start+d;return o.jsx("div",{ref:d===0?a:void 0,className:`wx-233fr7 wx-item ${u===n?"wx-focus":""}`,"data-id":l.id,children:o.jsx(Ir,{data:l,checkboxes:s,itemTemplate:r,value:i})},l.id)})}function $t({items:t=[],children:e,onSelect:n,onReady:s,virtualized:r=!1,checkboxes:i,multiselect:a,value:l,...d}){const u=c.useRef(),h=c.useRef(!1),f=c.useRef(Tr()),[x,m]=c.useState(null),p=c.useRef(x),[g,y]=c.useState(0),[v,w]=c.useState(24),j=c.useRef(!1),R=(c.useContext(Ie)||Rt()).getGroup("core"),C=c.useRef(t);c.useEffect(()=>{C.current=t},[t]);const $=c.useRef(l);c.useEffect(()=>{$.current=l},[l]);const b=c.useRef(0);c.useEffect(()=>{b.current=v},[v]);const E=c.useCallback(T=>{T&&T.stopPropagation();const U=C.current,X=$.current,J=p.current;let ue;const he=U[J]?.id;a?X&&X.includes(he)?ue=X.filter(ie=>ie!==he):ue=[...X||[],he]:ue=he,n&&n({id:ue})},[a,n]),P=c.useRef(E);c.useEffect(()=>{P.current=E},[E]);const k=c.useCallback(T=>{if(u.current){let U=T*b.current-u.current.clientHeight+b.current;y(U),u.current.scrollTop=U}},[b.current]),D=c.useCallback(T=>{u.current=T,r&&(T&&!h.current&&p.current!==null&&requestAnimationFrame(()=>{u.current&&(k(p.current),h.current=!0)}),T||(h.current=!1))},[k]),N=c.useCallback(T=>{if(!T||j.current)return;const U=T.getBoundingClientRect().height;U&&(w(U),b.current=U,j.current=!0)},[]);c.useEffect(()=>{f.current.init(u.current,t,T=>{m(T),p.current=T},T=>P.current(T),r)},[t,u.current,r]),c.useEffect(()=>{const T=(X,J)=>{f.current.navigate(X,J),k(p.current)},U=(X,J)=>{const ue=p.current,he=C.current;if(ue!==0&&ue!==he.length-1&&(X.key==="ArrowDown"||X.key==="ArrowUp")&&X.preventDefault(),f.current.keydown(X,J),u.current){const ie=u.current.scrollTop<=p.current*b.current,se=u.current.scrollTop+u.current.clientHeight>=p.current*b.current+b.current;ie?se||k(p.current):(u.current.scrollTop=p.current*b.current,y(u.current.scrollTop))}};s&&s({navigate:r?T:f.current.navigate,keydown:r?U:f.current.keydown,move:f.current.move})},[]);const O=c.useRef(0),M=c.useRef(t);M.current!==t&&(M.current=t,O.current+=1);const H=c.useCallback(()=>{f.current.navigate(null)},[f]),Z=c.useCallback(T=>{r&&y(T.target.scrollTop)},[r]),te=c.useMemo(()=>Math.ceil((u.current?.clientHeight||0)/v),[v,g]),ce=c.useMemo(()=>{if(!r)return{start:0,end:t.length};if(!t.length)return{start:0,end:0};const T=Math.floor(g/v),U=T+te;return{start:Math.max(0,T-Fn),end:Math.min(t.length,U+Fn)}},[r,t,g,v,te]),de=c.useMemo(()=>{if(!r)return t;const{start:T,end:U}=ce;return t.slice(T,U).map(X=>({...X}))},[r,t,ce]),B=ce.start*v,G=t.length*v;return c.useEffect(()=>{r&&y(0)},[t,r]),c.useEffect(()=>{x===null&&(h.current=!1)},[x]),x===null?null:o.jsx(rn,{onCancel:H,...d,children:o.jsx("div",{className:"wx-233fr7 wx-list",ref:D,onClick:E,onMouseMove:f.current.move,onScroll:Z,children:t.length?r?o.jsx("div",{className:"wx-233fr7 wx-list-wrapper",style:{height:`${G}px`},children:o.jsx("div",{className:"wx-233fr7 wx-list-content",style:{transform:`translateY(${B}px)`},children:o.jsx(On,{visibleRange:ce,visibleItems:de,navIndex:x,measureRefCallback:N,checkboxes:i,itemTemplate:e,value:l})})}):o.jsx(On,{visibleRange:ce,visibleItems:de,navIndex:x,measureRefCallback:N,checkboxes:i,itemTemplate:e,value:l}):o.jsx("div",{className:"wx-233fr7 wx-no-data",children:R("No data")})})},O.current)}function on({value:t="",id:e,readonly:n=!1,focus:s=!1,select:r=!1,type:i="text",placeholder:a="",disabled:l=!1,error:d=!1,title:u="",tooltip:h,css:f="",icon:x="",clear:m=!1,onChange:p}){const g=hs(e),[y,v]=Oe(t),w=c.useRef(null),j=c.useMemo(()=>x&&f.indexOf("wx-icon-left")===-1?"wx-icon-right "+f:f,[x,f]),R=c.useMemo(()=>x&&f.indexOf("wx-icon-left")!==-1,[x,f]);c.useEffect(()=>{const P=setTimeout(()=>{s&&w.current&&w.current.focus(),r&&w.current&&w.current.select()},1);return()=>clearTimeout(P)},[s,r]);const C=c.useCallback(P=>{const k=P.target.value;v(k),p&&p({value:k,input:!0})},[p]),$=c.useCallback(P=>p&&p({value:P.target.value}),[p]);function b(P){P.stopPropagation(),v(""),p&&p({value:""})}let E=i;return i!=="password"&&i!=="number"&&(E="text"),c.useEffect(()=>{const P=$,k=w.current;return k.addEventListener("change",P),()=>{k&&k.removeEventListener("change",P)}},[$]),o.jsxs("div",{className:`wx-hQ64J4 wx-text ${j} ${d?"wx-error":""} ${l?"wx-disabled":""} ${m?"wx-clear":""}`,"data-tooltip-text":h,children:[o.jsx("input",{className:"wx-hQ64J4 wx-input",ref:w,id:g,readOnly:n,disabled:l,placeholder:a,type:E,title:u,value:y,onInput:C}),m&&!l&&y?o.jsxs(o.Fragment,{children:[o.jsx("i",{className:"wx-hQ64J4 wx-icon wxi-close",onClick:b}),R&&o.jsx("i",{className:`wx-hQ64J4 wx-icon ${x}`})]}):x?o.jsx("i",{className:`wx-hQ64J4 wx-icon ${x}`}):null]})}function Fr({date:t,type:e,part:n,onShift:s}){const{calendar:r,formats:i}=c.useContext(Ie).getRaw(),a=t.getFullYear(),l=c.useMemo(()=>{switch(e){case"month":return Je(i.monthYearFormat,r)(t);case"year":return Je(i.yearFormat,r)(t);case"duodecade":{const{start:u,end:h}=cs(a),f=Je(i.yearFormat,r);return`${f(new Date(u,0,1))} - ${f(new Date(h,11,31))}`}default:return""}},[t,e,a,r,i]);function d(){s&&s({diff:0,type:e})}return o.jsxs("div",{className:"wx-8HQVQV wx-header",children:[n!=="right"?o.jsx("i",{className:"wx-8HQVQV wx-pager wxi-angle-left",onClick:()=>s&&s({diff:-1,type:e})}):o.jsx("span",{className:"wx-8HQVQV wx-spacer"}),o.jsx("span",{className:"wx-8HQVQV wx-label",onClick:d,children:l}),n!=="left"?o.jsx("i",{className:"wx-8HQVQV wx-pager wxi-angle-right",onClick:()=>s&&s({diff:1,type:e})}):o.jsx("span",{className:"wx-8HQVQV wx-spacer"})]})}function an({onClick:t,children:e}){return o.jsx("button",{className:"wx-3s8W4d wx-button",onClick:t,children:e})}function Or({value:t,current:e,part:n="",markers:s=null,css:r="",onCancel:i,onChange:a}){const l=(c.useContext(Ie)||Rt()).getRaw().calendar,d=(l.weekStart||7)%7,u=l.dayShort.slice(d).concat(l.dayShort.slice(0,d)),h=(C,$,b)=>new Date(C.getFullYear(),C.getMonth()+($||0),C.getDate()+(b||0));let f=n!=="normal";function x(C){const $=C.getDay();return $===0||$===6}function m(){const C=h(e,0,1-e.getDate());return C.setDate(C.getDate()-(C.getDay()-(d-7))%7),C}function p(){const C=h(e,1,-e.getDate());return C.setDate(C.getDate()+(6-C.getDay()+d)%7),C}const g=c.useRef(0);function y(C,$){$.timeStamp!==g.current&&(g.current=$.timeStamp,$.stopPropagation(),a&&a(new Date(C)),i&&i())}const v=c.useMemo(()=>n=="normal"?[t?h(t).valueOf():0]:t?[t.start?h(t.start).valueOf():0,t.end?h(t.end).valueOf():0]:[0,0],[n,t]),w=c.useMemo(()=>{const C=m(),$=p(),b=e.getMonth();let E=[];for(let P=C;P<=$;P.setDate(P.getDate()+1)){const k={day:P.getDate(),in:P.getMonth()===b,date:P.valueOf()};let D="";if(D+=k.in?"":" wx-inactive",D+=v.indexOf(k.date)>-1?" wx-selected":"",f){const N=k.date==v[0],O=k.date==v[1];N&&!O?D+=" wx-left":O&&!N&&(D+=" wx-right"),k.date>v[0]&&k.date<v[1]&&(D+=" wx-inrange")}if(D+=x(P)?" wx-weekend":"",s){const N=s(P);N&&(D+=" "+N)}E.push({...k,css:D})}return E},[e,v,f,s]),j=c.useRef(null);let R=c.useRef({});return R.current.click=y,c.useEffect(()=>{Xe(j.current,R.current)},[]),o.jsxs("div",{className:`wx-398RBS wx-month ${r}`,children:[o.jsx("div",{className:"wx-398RBS wx-weekdays",children:u.map(C=>o.jsx("div",{className:"wx-398RBS wx-weekday",children:C},C))}),o.jsx("div",{className:"wx-398RBS wx-days",ref:j,children:w.map(C=>o.jsx("div",{className:`wx-398RBS wx-day ${C.css} ${C.in?"":"wx-out"}`,"data-id":C.date,children:C.day},C.date))})]})}function Pr({value:t,current:e,part:n,onCancel:s,onChange:r,onShift:i}){const a=c.useRef(new Date),[l,d]=Oe(t||a.current),[u,h]=Oe(e||a.current),f=c.useContext(Ie).getRaw().calendar,x=f.monthShort||[],m=c.useMemo(()=>u.getMonth(),[u]),p=c.useCallback((v,w)=>{if(v!=null){w.stopPropagation();const j=new Date(u);j.setMonth(v),h(j),i&&i({current:j})}n==="normal"&&d(new Date(u)),s&&s()},[u,n,i,s]),g=c.useCallback(()=>{const v=new Date(xs(l,n)||u);v.setMonth(u.getMonth()),v.setFullYear(u.getFullYear()),r&&r(v)},[l,u,n,r]),y=c.useCallback(v=>{const w=v.target.closest("[data-id]");if(w){const j=parseInt(w.getAttribute("data-id"),10);p(j,v)}},[p]);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-34U8T8 wx-months",onClick:y,children:x.map((v,w)=>o.jsx("div",{className:"wx-34U8T8 wx-month"+(m===w?" wx-current":""),"data-id":w,children:v},w))}),o.jsx("div",{className:"wx-34U8T8 wx-buttons",children:o.jsx(an,{onClick:g,children:f.done})})]})}const zt="wx-1XEF33",Hr=({value:t,current:e,onCancel:n,onChange:s,onShift:r,part:i})=>{const a=c.useContext(Ie).getRaw().calendar,[l,d]=Oe(e),[u,h]=Oe(t),f=c.useMemo(()=>l.getFullYear(),[l]),x=c.useMemo(()=>{const{start:v,end:w}=cs(f),j=[];for(let R=v;R<=w;++R)j.push(R);return j},[f]),m={click:p};function p(v,w){if(v){w.stopPropagation();const j=new Date(l);j.setFullYear(v),d(j),r&&r({current:j})}i==="normal"&&h(new Date(l)),n&&n()}function g(){const v=new Date(xs(u,i)||l);v.setFullYear(l.getFullYear()),s&&s(v)}const y=c.useRef(null);return c.useEffect(()=>{y.current&&Xe(y.current,m)},[]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:zt+" wx-years",ref:y,children:x.map((v,w)=>o.jsx("div",{className:zt+` wx-year ${f==v?"wx-current":""} ${w===0?"wx-prev-decade":""} ${w===11?"wx-next-decade":""}`,"data-id":v,children:v},w))}),o.jsx("div",{className:zt+" wx-buttons",children:o.jsx(an,{onClick:g,children:a.done})})]})},Pn={month:{component:Or,next:zr,prev:Lr},year:{component:Pr,next:Gr,prev:Br},duodecade:{component:Hr,next:Yr,prev:Vr}};function Lr(t){return t=new Date(t),t.setMonth(t.getMonth()-1),t}function zr(t){return t=new Date(t),t.setMonth(t.getMonth()+1),t}function Br(t){return t=new Date(t),t.setFullYear(t.getFullYear()-1),t}function Gr(t){return t=new Date(t),t.setFullYear(t.getFullYear()+1),t}function Vr(t){return t=new Date(t),t.setFullYear(t.getFullYear()-10),t}function Yr(t){return t=new Date(t),t.setFullYear(t.getFullYear()+10),t}function xs(t,e){let n;if(e==="normal")n=t;else{const{start:s,end:r}=t;e==="left"?n=s:e=="right"?n=r:n=s&&r}return n}const Kr=["clear","today"];function Wr(t){if(t==="done")return-1;if(t==="clear")return null;if(t==="today")return new Date}function Ur({value:t,current:e,onCurrentChange:n,part:s="normal",markers:r=null,buttons:i,css:a="",onShift:l,onChange:d}){const u=c.useContext(Ie).getGroup("calendar"),[h,f]=c.useState("month"),x=Array.isArray(i)?i:i?Kr:[],m=(w,j)=>{w.preventDefault(),d&&d({value:j})},p=()=>{h==="duodecade"?f("year"):h==="year"&&f("month")},g=w=>{const{diff:j,current:R}=w;if(j===0){h==="month"?f("year"):h==="year"&&f("duodecade");return}if(j){const C=Pn[h];n(j>0?C.next(e):C.prev(e))}else R&&n(R);l&&l()},y=w=>{f("month"),d&&d({select:!0,value:w})},v=c.useMemo(()=>Pn[h].component,[h]);return o.jsx("div",{className:`wx-2Gr4AS wx-calendar ${s!=="normal"&&s!=="both"?"wx-part":""} ${a}`,children:o.jsxs("div",{className:"wx-2Gr4AS wx-wrap",children:[o.jsx(Fr,{date:e,part:s,type:h,onShift:g}),o.jsxs("div",{children:[o.jsx(v,{value:t,current:e,onCurrentChange:n,part:s,markers:r,onCancel:p,onChange:y,onShift:g}),h==="month"&&x.length>0&&o.jsx("div",{className:"wx-2Gr4AS wx-buttons",children:x.map(w=>o.jsx("div",{className:"wx-2Gr4AS wx-button-item",children:o.jsx(an,{onClick:j=>m(j,Wr(w)),children:u(w)})},w))})]})]})})}function ln(t){let{words:e=null,optional:n=!1,children:s}=t,r=c.useContext(Ie);const i=c.useMemo(()=>{let a=r;return(!a||!a.extend)&&(a=ot(ds)),e!==null&&(a=a.extend(e,n)),a},[e,n,r]);return o.jsx(Ie.Provider,{value:i,children:s})}function Hn(t,e,n,s){if(!t||s){const r=e?new Date(e):new Date;r.setDate(1),n(r)}else if(t.getDate()!==1){const r=new Date(t);r.setDate(1),n(r)}}const qr=["clear","today"];function ps({value:t,current:e,markers:n=null,buttons:s=qr,css:r="",onChange:i}){const[a,l]=Oe(t),[d,u]=Oe(e);c.useEffect(()=>{Hn(d,a,u,!1)},[a,d]);const h=c.useCallback(x=>{const m=x.value;m?(l(new Date(m)),Hn(d,new Date(m),u,!0)):l(null),i&&i({value:m?new Date(m):null})},[i,d]),f=c.useCallback(x=>{u(x)},[u]);return d?o.jsx(ln,{children:o.jsx(Ur,{value:a,current:d,markers:n,buttons:s,css:r,onChange:h,onCurrentChange:f})}):null}function Jr(t){return t||(t={}),t.width||(t.width="unset"),t}const Qr=["clear","today"];function Zr({value:t,id:e,disabled:n=!1,error:s=!1,placeholder:r="",format:i="",buttons:a=Qr,css:l="",title:d="",tooltip:u,editable:h=!1,clear:f=!1,onChange:x,dropdown:m={}}){const{calendar:p,formats:g}=(c.useContext(Ie)||Rt()).getRaw(),y=i||g?.dateFormat;let v=typeof y=="function"?y:Je(y,p);const[w,j]=c.useState(t),[R,C]=c.useState(!1);c.useEffect(()=>{j(t)},[t]);function $(){C(!1)}function b(k){const D=k===w||k&&w&&k.valueOf()===w.valueOf()||!k&&!w;j(k),D||x&&x({value:k}),setTimeout($,1)}const E=c.useMemo(()=>w?v(w):"",[w,v]);function P({value:k,input:D}){if(!h&&!f||D)return;let N=typeof h=="function"?h(k):k?new Date(k):null;N=isNaN(N)?w||null:N||null,b(N)}return c.useEffect(()=>{const k=$;return window.addEventListener("scroll",k),()=>window.removeEventListener("scroll",k)},[]),o.jsxs("div",{className:"wx-1lKOFG wx-datepicker",onClick:()=>C(!0),children:[o.jsx(on,{css:`wx-date-input ${l}`,title:d,tooltip:u,value:E,id:e,readonly:!h,disabled:n,error:s,placeholder:r,onInput:$,onChange:P,icon:"wxi-calendar",clear:f}),R&&!n&&o.jsx(rn,{onCancel:$,...Jr(m),children:o.jsx(ps,{buttons:a,value:w,onChange:k=>b(k.value)})})]})}function Xr({value:t="",options:e=[],textOptions:n=null,placeholder:s="",disabled:r=!1,error:i=!1,title:a="",tooltip:l,textField:d="label",clear:u=!1,css:h="",children:f,onChange:x,dropdown:m={}}){const p=c.useRef(null),g=c.useRef(null);let[y,v]=Oe(t);function w(b){p.current=b.navigate,g.current=b.keydown}const j=c.useMemo(()=>y||y===0?(n||e).find(b=>b.id===y):null,[y,n,e]),R=c.useCallback(({id:b})=>{(b||b===0)&&(v(b),p.current(null),x&&x({value:b}))},[v,x]),C=c.useCallback(b=>{b.stopPropagation(),v(""),x&&x({value:""})},[v,x]),$=c.useCallback(()=>e.findIndex(b=>b.id===y),[e,y]);return o.jsxs("div",{className:`wx-2YgblL wx-richselect ${h} ${i?"wx-2YgblL wx-error":""} ${r?"wx-2YgblL wx-disabled":""} ${f?"":"wx-2YgblL wx-nowrap"}`,title:a,onClick:()=>p.current($()),onKeyDown:b=>g.current(b,$()),tabIndex:0,"data-tooltip-text":l,children:[o.jsx("div",{className:"wx-2YgblL wx-label",children:j?f?f(j):j[d]:s?o.jsx("span",{className:"wx-2YgblL wx-placeholder",children:s}):" "}),u&&!r&&y?o.jsx("i",{className:"wx-2YgblL wx-icon wxi-close",onClick:C}):o.jsx("i",{className:"wx-2YgblL wx-icon wxi-angle-down"}),!r&&o.jsx($t,{items:e,onReady:w,onSelect:R,...m,children:({option:b})=>f?f(b):b[d]})]})}const ei=({options:t=[],value:e="",css:n="",children:s,onChange:r})=>{const[i,a]=c.useState(e),l=d=>{a(d),r&&r({value:d})};return c.useEffect(()=>{a(e)},[e]),o.jsx("div",{className:`wx-0hMO7P wx-segmented ${n}`,children:t.map(d=>o.jsx("button",{className:`wx-0hMO7P wx-segment ${d.css} ${d.id===i?"wx-selected":""}`,title:d.title,onClick:()=>l(d.id),"data-tooltip-text":d.tooltip,children:s?Xt(s,{option:d}):o.jsxs(o.Fragment,{children:[d.icon&&o.jsx("i",{className:`wx-0hMO7P wx-icon ${d.icon} ${d.label?"":"wx-only"}`}),d.label&&o.jsx("span",{className:"wx-0hMO7P wx-label",children:d.label})]})},d.id))})};function ti({notice:t={}}){function e(){t.remove&&t.remove()}return o.jsxs("div",{className:`wx-11sNg5 wx-notice wx-${t.type?t.type:""}`,role:"status","aria-live":"polite",children:[o.jsx("div",{className:"wx-11sNg5 wx-text",children:t.text}),o.jsx("div",{className:"wx-11sNg5 wx-button",children:o.jsx("i",{className:"wx-11sNg5 wxi-close",onClick:e})})]})}function ni({data:t=[]}){return o.jsx("div",{className:"wx-3nwoO9 wx-notices",children:t.map(e=>o.jsx(ti,{notice:e},e.id))})}function Kt({title:t="",buttons:e=["cancel","ok"],header:n,children:s,footer:r,css:i="",onConfirm:a,onCancel:l}){const d=(c.useContext(Ie)||Rt()).getGroup("core"),u=c.useRef(null);c.useEffect(()=>{u.current?.focus()},[]);function h(x){switch(x.code){case"Enter":{const m=x.target.tagName;if(m==="TEXTAREA"||m==="BUTTON")return;a&&a({event:x});break}case"Escape":l&&l({event:x});break}}function f(x,m){const p={event:x,button:m};m==="cancel"?l&&l(p):a&&a(p)}return o.jsx("div",{className:`wx-1FxkZa wx-modal ${i}`,ref:u,tabIndex:0,onKeyDown:h,children:o.jsxs("div",{className:"wx-1FxkZa wx-window",children:[n||(t?o.jsx("div",{className:"wx-1FxkZa wx-header",children:t}):null),o.jsx("div",{children:s}),r||e&&o.jsx("div",{className:"wx-1FxkZa wx-buttons",children:e.map(x=>o.jsx("div",{className:"wx-1FxkZa wx-button",children:o.jsx(st,{type:`block ${x==="ok"?"primary":"secondary"}`,onClick:m=>f(m,x),children:d(x)})},x))})]})})}function si({children:t},e){const[n,s]=c.useState(null),[r,i]=c.useState([]);return c.useImperativeHandle(e,()=>({showModal:a=>{const l={...a};return s(l),new Promise((d,u)=>{l.resolve=h=>{s(null),d(h)},l.reject=h=>{s(null),u(h)}})},showNotice:a=>{a={...a},a.id=a.id||tn(),a.remove=()=>i(l=>l.filter(d=>d.id!==a.id)),a.expire!=-1&&setTimeout(a.remove,a.expire||5100),i(l=>[...l,a])}}),[]),o.jsxs(o.Fragment,{children:[t,n&&o.jsx(Kt,{title:n.title,buttons:n.buttons,onConfirm:n.resolve,onCancel:n.reject,children:n.message}),o.jsx(ni,{data:r})]})}const ri=c.forwardRef(si);function ii(t){let{children:e}=t,n=c.useRef();const s=c.useMemo(()=>({showNotice:r=>n.current.showNotice(r),showModal:r=>n.current.showModal(r)}),[]);return o.jsx(us.Provider,{value:s,children:o.jsx(ri,{ref:n,children:e})})}const oi=({value:t=!1,type:e="",icon:n="",disabled:s=!1,iconActive:r="",onClick:i,title:a="",tooltip:l,css:d="",text:u="",textActive:h="",children:f,active:x,onChange:m})=>{const[p,g]=Oe(t),y=c.useMemo(()=>(p?"pressed":"")+(e?" "+e:""),[p,e]),v=c.useCallback(w=>{let j=!p;i&&i(w),w.defaultPrevented||(g(j),m&&m({value:j}))},[p,i,m]);return p&&x?o.jsx(st,{title:a,tooltip:l,text:p&&h||u,css:d,type:y,icon:p&&r||n,onClick:v,disabled:s,children:Xt(x,{value:p})}):f?o.jsx(st,{title:a,tooltip:l,text:p&&h||u,css:d,type:y,icon:p&&r||n,onClick:v,disabled:s,children:f}):o.jsx(st,{title:a,tooltip:l,text:p&&h||u,css:d,type:y,icon:p&&r||n,onClick:v,disabled:s})};function ai(){return o.jsx(o.Fragment,{})}function Ln(t){const{fonts:e=!0,children:n}=t;return o.jsx(nn.Provider,{value:"willow",children:o.jsxs(o.Fragment,{children:[n&&n&&o.jsx("div",{className:"wx-theme wx-willow-theme",children:n}),e&&o.jsxs(o.Fragment,{children:[o.jsx("link",{rel:"preconnect",href:"https://cdn.svar.dev",crossOrigin:"true"}),o.jsx(ai,{}),o.jsx("link",{rel:"stylesheet",href:"https://cdn.svar.dev/fonts/wxi/wx-icons.css"})]})]})})}en(Ce);const cn={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 ms=class{constructor(t){this._nextHandler=null,this._dispatch=t,this.exec=this.exec.bind(this)}async exec(t,e){return this._dispatch(t,e),this._nextHandler&&await this._nextHandler.exec(t,e),e}setNext(t){return this._nextHandler=t}};new Date().valueOf();var li=class{constructor(t){const e={id:0,$level:0,data:[],parent:null},n=new Map;n.set(0,e),this._pool=n,t&&t.length&&this.parse(t,0)}parse(t,e){const n=this._pool;for(let r=0;r<t.length;r++){const i=t[r];i.parent=i.parent||e,i.data=null,n.set(i.id,i)}for(let r=0;r<t.length;r++){const i=t[r],a=n.get(i.parent);a&&(a.data||(a.data=[]),a.data.push(i))}const s=n.get(e);this.setLevel(s,s.$level+1,!1)}add(t,e){const n=this._pool.get(t.parent||0);t.$level=n.$level+1,this._pool.set(t.id,t),n.data?e===-1?n.data=[...n.data,t]:zn(n,e,t):n.data=[t]}addAfter(t,e){if(!e)return this.add(t,-1);const n=this.byId(e),s=this.byId(n.parent),r=yt(s,n.id)+1;t.parent=s.id,t.$level=s.$level+1,this.add(t,r)}remove(t){const e=this._pool.get(t);this._remove(e);const n=this._pool.get(e.parent);n.data=n.data.filter(s=>s.id!=t),this._clearBranch(n)}_remove(t){t.data&&t.data.forEach(e=>this._remove(e)),this._pool.delete(t.id)}update(t,e){let n=this._pool.get(t);const s=this._pool.get(n.parent),r=yt(s,n.id);n={...n,...e},s&&r>=0&&(s.data[r]=n,s.data=[...s.data]),this._pool.set(n.id,n)}move(t,e,n){const s=this._pool.get(t),r=e==="child",i=this._pool.get(n),a=i.$level+(r?1:0);if(!s||!i)return;const l=this._pool.get(s.parent),d=r?i:this._pool.get(i.parent);d.data||(d.data=[]);const u=yt(l,s.id);ci(l,u);const h=r?d.data.length:yt(d,i.id)+(e==="after"?1:0);if(zn(d,h,s),l.id===d.id&&u===h)return null;s.parent=d.id,s.$level!==a&&(s.$level=a,this.setLevel(s,a+1,!0)),this.update(s.id,s),this._clearBranch(l)}_clearBranch(t){t.data&&!t.data.length&&(t.open&&delete t.open,this.update(t.id,{data:null}))}toArray(){const t=[],e=this._pool.get(0).data;return e&&gs(e,t),t}byId(t){return this._pool.get(t)}getBranch(t){return this._pool.get(t).data}forEach(t){this._pool.forEach((e,n)=>{n!==0&&t(e)})}eachChild(t,e){const n=this.byId(e);!n||!n.data||n.data.forEach((s,r)=>{t(this.byId(s.id),r),this.eachChild(t,s.id)})}setLevel(t,e,n){t.data&&(t.data=t.data.map(s=>(n&&(s={...s},this._pool.set(s.id,s)),s.$level=e,s.data&&this.setLevel(s,e+1,n),s)))}};function gs(t,e){t.forEach(n=>{e.push(n),n.open===!0&&gs(n.data,e)})}function ci(t,e){const n=[...t.data];n.splice(e,1),t.data=n}function zn(t,e,n){const s=[...t.data];s.splice(e,0,n),t.data=s}function yt(t,e){return t?.data.findIndex(n=>n.id===e)}var ws=2,di=class{constructor(e){e&&(this._writable=e.writable,this._async=e.async),this._values={},this._state={}}setState(e,n=0){const s={};return this._wrapProperties(e,this._state,this._values,"",s,n),s}getState(){return this._values}getReactive(){return this._state}_wrapProperties(e,n,s,r,i,a){for(const l in e){const d=n[l],u=s[l],h=e[l];if(d&&(u===h&&typeof h!="object"||h instanceof Date&&u instanceof Date&&u.getTime()===h.getTime()))continue;const f=r+(r?".":"")+l;d?(d.__parse(h,f,i,a)&&(s[l]=h),a&ws?i[f]=d.__trigger:d.__trigger()):(h&&h.__reactive?n[l]=this._wrapNested(h,h,f,i):n[l]=this._wrapWritable(h),s[l]=h),i[f]=i[f]||null}}_wrapNested(e,n,s,r){const i=this._wrapWritable(e);return this._wrapProperties(e,i,n,s,r,0),i.__parse=(a,l,d,u)=>(this._wrapProperties(a,i,n,l,d,u),!1),i}_wrapWritable(e){const n=[],s=function(){for(let r=0;r<n.length;r++)n[r](e)};return{subscribe:r=>(n.push(r),this._async?setTimeout(r,1,e):r(e),()=>{const i=n.indexOf(r);i>=0&&n.splice(i,1)}),__trigger:()=>{n.length&&(this._async?setTimeout(s,1):s())},__parse:function(r){return e=r,!0}}}};function Bn(t,e){return Object.defineProperty(t,"__reactive",{value:!0,enumerable:!1,writable:!1}),t}var ui=class{constructor(e,n,s,r){typeof e=="function"?this._setter=e:this._setter=e.setState.bind(e),this._routes=n,this._parsers=s,this._prev={},this._triggers=new Map,this._sources=new Map,this._routes.forEach(i=>{i.in.forEach(a=>{const l=this._triggers.get(a)||[];l.push(i),this._triggers.set(a,l)}),i.out.forEach(a=>{const l=this._sources.get(a)||{};i.in.forEach(d=>l[d]=!0),this._sources.set(a,l)})}),this._routes.forEach(i=>{i.length=Math.max(...i.in.map(a=>vs(a,this._sources,1)))}),this._bus=r}init(e){const n={};for(const s in e)if(this._prev[s]!==e[s]){const r=this._parsers[s];n[s]=r?r(e[s]):e[s]}this._prev=this._prev?{...this._prev,...e}:{...e},this.setState(n),this._bus&&this._bus.exec("init-state",n)}setStateAsync(e){const n=this._setter(e,ws);return this._async?Object.assign(this._async.signals,n):this._async={signals:n,timer:setTimeout(this._applyState.bind(this),1)},n}_applyState(){const e=this._async;if(e){this._async=null,this._triggerUpdates(e.signals,[]);for(const n in e.signals){const s=e.signals[n];s&&s()}}}setState(e,n=[]){const s=this._setter(e);return this._triggerUpdates(s,n),s}_triggerUpdates(e,n){const s=Object.keys(e),r=!n.length;n=n||[];for(let i=0;i<s.length;i++){const a=s[i],l=this._triggers.get(a);l&&l.forEach(d=>{n.indexOf(d)==-1&&n.push(d)})}r&&this._execNext(n)}_execNext(e){for(;e.length;){e.sort((s,r)=>s.length<r.length?1:-1);const n=e[e.length-1];e.splice(e.length-1),n.exec(e)}}};function vs(t,e,n){const s=e.get(t);if(!s)return n;const r=Object.keys(s).map(i=>vs(i,e,n+1));return Math.max(...r)}var fi=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=new WeakMap,this.exec=this.exec.bind(this)}on(e,n,s){let r=this._handlers[e];r?s&&s.intercept?r.unshift(n):r.push(n):r=this._handlers[e]=[n],s&&s.tag&&this._tag.set(n,s.tag)}intercept(e,n,s){this.on(e,n,{...s,intercept:!0})}detach(e){for(const n in this._handlers){const s=this._handlers[n];for(let r=s.length-1;r>=0;r--)this._tag.get(s[r])===e&&s.splice(r,1)}}async exec(e,n){const s=this._handlers[e];if(s)for(let r=0;r<s.length;r++){const i=s[r](n);if(i===!1||i&&i.then&&await i===!1)return}return this._nextHandler&&await this._nextHandler.exec(e,n),n}setNext(e){return this._nextHandler=e}};const qe=1024;function it(t){return t<qe?`${t} B`:t<qe**2?`${(t/qe).toFixed(1)} KB`:t<qe**3?`${(t/qe**2).toFixed(1)} MB`:`${(t/qe**3).toFixed(1)} GB`}function Gn(t,e){e||(e={key:"name",order:"asc"});const n=t.filter(a=>a.type==="folder"),s=t.filter(a=>a.type!=="folder"),r=n.sort(Vn(e)),i=s.sort(Vn(e));return[...r,...i]}function hi(t,e){return typeof t=="string"?t.localeCompare(e,void 0,{numeric:!0}):typeof t=="object"?t.getTime()-e.getTime():(t??0)-(e??0)}function xi(t,e){return typeof t=="string"?-t.localeCompare(e,void 0,{numeric:!0}):typeof e=="object"?e.getTime()-t.getTime():(e??0)-(t??0)}function Vn({key:t,order:e}){const n=e==="asc"?hi:xi;return(s,r)=>n(s[t],r[t])}function dn(t,e){const n=t==="/"?1:t.split("/").length;return n>=e.length?null:e[n].id}function pi(t){return t.length>1?t[t.length-2].id:null}let mi=class extends li{constructor(e){const n={id:"/",name:"My files",open:!0,$level:1,parent:0,ext:"",type:"folder"};super([n]),this.parse(e,"/")}parse(e,n,s){!e||!e.length||(e.forEach(r=>this.parseId(r,s?n:void 0)),super.parse(e,n))}parseId(e,n){if(e.parent===0)return;const s=e.id,r=s.lastIndexOf("/");if(e.parent=n??(r===0?"/":s.slice(0,r)),e.name=s.slice(r+1),e.type=e.type||"file",e.type!=="folder"){const i=e.name.lastIndexOf("."),a=i!==-1?e.name.slice(i+1):"";e.ext=a!=="new"?a?.toLocaleLowerCase():""}}getParents(e){const n=[];let s=this.byId(e);if(!s)return n;for(;s.id!==0;)n.push(s),s=this.byId(s.parent);return n.reverse()}findFiles(e,n="/"){const s=[],r=e.toLocaleLowerCase();return this.eachChild(i=>{i.name.toLowerCase().indexOf(r)!==-1&&s.push(i)},n),s}add(e,n){const s=this.byId(e.parent||"/"),r=e.data?[...e.data]:null;e.data=null,super.add(e,n??s.data?s.data.length:0),r&&r.forEach(i=>this.add(i))}renameFiles(e,n,s){const r=this.byId(e),i=this.normalizeFile(r,n),a=[];return i.data?.forEach(l=>a.push(this.renameFiles(l.id,i.id,s))),a.length&&(i.data=a),s[e]=i.id,i}copyFiles(e,n,s){const r={};return e.forEach(i=>{const a=this.renameFiles(i,n,r);this.add(a),s&&this.remove(i),r[i]=a.id}),r}moveFiles(e,n){if(this.byId(e[0]).parent!==n)return this.copyFiles(e,n,!0)}serialize(e="/"){const n=[],s=this.byId(e);return s?(s.data?.forEach(r=>{const{id:i,date:a,type:l,size:d,lazy:u}=r,h={id:i,date:a,type:l??"file"};u&&(h.lazy=u),d&&(h.size=d),n.push(h);const f=this.serialize(i);f.length&&n.push(...f)}),n):null}normalizeFile(e,n){const s=e.name,r=s.lastIndexOf("."),i=r!==-1?s.slice(r+1):"",a=i?`.${i}`:"";let l=r!==-1?s.slice(0,r):s,d=n+(n==="/"?"":"/")+l;for(;this.byId(d+a);){const u=".new";d+=u,l+=u}return{...e,id:d+a,name:l+a,parent:n,ext:i.toLocaleLowerCase()}}},gi=class extends di{in;_router;constructor(e){super({writable:e,async:!1});const n=[];for(let i=0;i<2;i++)n.push({in:["data",`panels.${i}.path`],out:[`panels.${i}._crumbs`],exec:a=>{const{data:l,panels:d}=this.getState(),u=[];u[i]={_crumbs:l.getParents(d[i].path)},this.setState({panels:u},a)}}),n.push({in:["data",`panels.${i}.path`,`panels.${i}._sorts`,"search"],out:[`panels.${i}._files`],exec:a=>{const{data:l,panels:d,search:u}=this.getState();let h;u?h=l.findFiles(u,d[i].path):h=l.byId(d[i].path)?.data||[];const{path:f,_sorts:x}=d[i];h=Gn(h,x[f]);const m=[];m[i]={_files:h},this.setState({panels:m},a)}}),n.push({in:["data",`panels.${i}.selected`,`panels.${i}._sorts`],out:[`panels.${i}._selected`],exec:a=>{const{data:l,panels:d}=this.getState(),u=[];d[i].selected.forEach(p=>{const g=l.byId(p);g&&u.push(g)});const{path:h,_sorts:f}=d[i],x=Gn(u,f[h]),m=[];m[i]={_selected:x},this.setState({panels:m},a)}});this._router=new ui(super.setState.bind(this),n,{data:i=>new mi(i)});const s=this.in=new fi;s.on("select-file",({id:i,toggle:a,range:l,panel:d,type:u})=>{const{panels:h,activePanel:f}=this.getState();typeof d>"u"&&(d=f),i||(a=l=!1);let x=[...h[d].selected];if(a){const p=x.indexOf(i);p===-1?x.push(i):x.splice(p,1)}else if(l&&h[d]._lastSelected){const p=h[d]._files;let g=p.findIndex(w=>w.id==h[d]._lastSelected),y=p.findIndex(w=>w.id==i);y<g&&([g,y]=[y,g]);const v=p.slice(g,y+1).map(w=>w.id);x=[...new Set([...x,...v])]}else x=i?[i]:[];const m=[];m[d]={selected:x,_lastSelected:i,_selectNavigation:u==="navigation"},this.setState({panels:m})}),s.on("set-path",({id:i,panel:a,selected:l})=>{const{data:d,activePanel:u}=this.getState(),h=d.byId(i);if(h){const f=[];typeof a>"u"&&(a=u),f[a]={path:i},this.setState({panels:f}),s.exec("select-file",{panel:a}),l&&l.forEach(x=>s.exec("select-file",{id:x,panel:a,toggle:!0})),h.lazy&&s.exec("request-data",{id:i})}}),s.on("provide-data",({id:i,data:a})=>{const{mode:l,data:d}=this.getState(),u=d.byId(i);u&&(u.lazy||(u.data=[]),u.lazy=!1,d.parse(a,i,l==="search"),this.setState({data:d}))}),s.on("open-tree-folder",({id:i,mode:a})=>{const{data:l}=this.getState();l.update(i,{open:a}),this.setState({data:l})}),s.on("show-preview",({mode:i})=>{this.setState({preview:i})}),s.on("rename-file",i=>{const{id:a,name:l}=i,{data:d,panels:u}=this.getState(),h=d.byId(a);if(h.name!==l){h.name=l;const f=d.normalizeFile(h,h.parent);i.newId=f.id,f.data=null,d.add(f);let x={[a]:f.id};h.data?.forEach(p=>x={...d.moveFiles([p.id],f.id),...x});const m=u.map(p=>({selected:p.selected,_crumbs:p._crumbs,_lastSelected:p._lastSelected,_sorts:p._sorts}));d.remove(a),this._updatePanels(m,x),this.setState({data:d,panels:m})}}),s.on("create-file",i=>{const{file:a,parent:l}=i,{data:d}=this.getState(),u=d.normalizeFile(a,l);u.type=a.type||"file",i.newId=u.id,d.add(u),this.setState({data:d}),s.exec("select-file",{id:u.id})}),s.on("delete-files",({ids:i})=>{const{data:a,panels:l}=this.getState(),d=l.map(u=>({selected:u.selected,_crumbs:u._crumbs,_lastSelected:u._lastSelected,_sorts:u._sorts}));i.forEach(u=>a.remove(u)),this._updatePanels(d,{}),this.setState({data:a,panels:d})}),s.on("copy-files",i=>{const{ids:a,target:l}=i;if(this._isPlacedIntoSelf(a,l)){console.error("You cannot copy a folder into itself"),i.skipProvider=!0;return}const{data:d,panels:u,activePanel:h}=this.getState(),f=d.copyFiles(a,l);i.newIds=a.map(x=>f[x]),this.setState({data:d}),u[h].path==l&&(s.exec("select-file",{}),a.forEach(x=>{s.exec("select-file",{id:f[x],toggle:!0})}))}),s.on("move-files",i=>{const{ids:a,target:l}=i;if(this._isPlacedIntoSelf(a,l)){console.error("You cannot move a folder into itself"),i.skipProvider=!0;return}const{data:d,panels:u,activePanel:h}=this.getState(),f=d.moveFiles(a,l);if(f){i.newIds=a.map(m=>f[m]);const x=u.map(m=>({selected:m.selected,_crumbs:m._crumbs,_lastSelected:m._lastSelected,_sorts:m._sorts}));this._updatePanels(x,f,!0),this.setState({data:d,panels:x}),u[h].path==l&&(s.exec("select-file",{}),a.forEach(m=>{s.exec("select-file",{id:f[m],toggle:!0})}))}});let r=null;s.on("filter-files",({text:i})=>{if(!i){r&&this.setState({...r});return}s.exec("select-file",{});const{panels:a,mode:l}=this.getState();r||(r={panels:a,mode:l,search:""}),this.setState({mode:"search",search:i})}),s.on("set-mode",({mode:i})=>{const{activePanel:a}=this.getState(),l=[];l[a]={_selectNavigation:!1};const d={mode:i,search:"",panels:l};r=null,this.setState(d)}),s.on("set-active-panel",({panel:i})=>{this.setState({activePanel:i})}),s.on("sort-files",({key:i,order:a,panel:l,path:d})=>{const{activePanel:u,panels:h}=this.getState();l=l??u,d=d??h[l].path;const f=[];f[l]={_sorts:{...h[l]._sorts,[d]:{key:i,order:a}}},this.setState({panels:f})}),this.initOnce()}initOnce(){const e=[];for(let s=0;s<2;s++)e[s]=Bn({_crumbs:[],_files:[],_selected:[],_sorts:{},path:"/",selected:[],...e[s]});const n={panels:Bn(e),data:[],search:""};this._router.init(n)}init(e){const n={...e};this._router.init(n)}setState(e,n){return this._router.setState(e,n)}getFile(e){const{data:n}=this.getState();return n.byId(e)||null}serialize(e){const{data:n}=this.getState();return n.serialize(e)}_updatePanels(e,n,s){const{data:r}=this.getState();e.forEach(i=>{const a=[];i.selected.forEach(u=>{r.byId(u)?a.push(u):!s&&n[u]&&a.push(n[u])}),i.selected=a,r.byId(i._lastSelected)||(i._lastSelected=s?null:n[i._lastSelected]||null);const l={};Object.keys(i._sorts).forEach(u=>{r.byId(u)?l[u]=i._sorts[u]:n[u]&&!s&&(l[n[u]]=i._sorts[u])}),i._sorts=l;const d=i._crumbs[i._crumbs.length-1];d?.id!=="/"&&(n[d.id]?i.path=n[d.id]:r.byId(d.id)||(i.path="/"))})}_isPlacedIntoSelf(e,n){return e.some(s=>s===n||this.getState().data.getParents(n).some(r=>r.id===s))}};function wi(t){switch(t){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[t==="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(e=>e!==null)}}function vi(t,e="data-id"){let n=t;for(!n.tagName&&t.target&&(n=t.target);n;){if(n.getAttribute&&n.getAttribute(e))return n;n=n.parentNode}return null}function yi(t,e="data-id"){const n=vi(t,e);return n?n.getAttribute(e):null}new Date().valueOf();function bi(t,e){const{api:n}=e;function s(i,a){const l=e.getPanel(),d=l.selected,u=a.ctrlKey||a.metaKey,h=a.shiftKey;let f;const x=d?.[0]?n.getFile(d[0]):null;d?.length?d.length>1?f=e.menuOptions("multiselect"):f=e.menuOptions(x.type,x):f=e.menuOptions("body");const m=`${u?"ctrl+":""}${h?"shift+":""}${i}`,p=f?f.find(y=>y.hotkey?.toLowerCase()===m):!1,g=e.performAction;if(p)switch(m){case"ctrl+c":g("copy");break;case"ctrl+x":g("move");break;case"ctrl+v":g("paste",x);break;case"delete":g("delete");break;case"ctrl+r":a.preventDefault(),g("rename",x);break;case"ctrl+d":a.preventDefault(),g("download",x);break;default:p.handler?.({context:x})}switch(i){case"enter":{if(u||h)break;const{_crumbs:y,_selectNavigation:v}=l;if(v){const w=pi(y);if(w){const j=dn(w,y);n.exec("set-path",{id:w,selected:[j]})}}else if(d.length===1){const w=n.getFile(d[0]);w&&n.exec(w.type==="folder"?"set-path":"open-file",{id:w.id})}break}case"arrowup":case"arrowleft":{const{_files:y,_selected:v,path:w,_selectNavigation:j}=l;let R;if(v.length){const C=v.at(0).id,$=y.findIndex(b=>b.id===C);if($!==-1){const b=$-1;y[b]?R=y[b].id:w!=="/"&&!(u||h)&&n.exec("select-file",{type:"navigation"})}}else{if(j)break;if(w!=="/"){n.exec("select-file",{type:"navigation"});break}R=y.at(0)?.id}R&&n.exec("select-file",{id:R,toggle:u,range:h});break}case"arrowdown":case"arrowright":{const{_files:y,_selected:v,path:w,_selectNavigation:j}=l;let R;if(v.length){const C=v.at(-1).id,$=y.findIndex(b=>b.id===C);if($!==-1){const b=$+1;y[b]&&(R=y[b].id)}}else{if(w!=="/"&&!j){n.exec("select-file",{type:"navigation"});break}R=y.at(0)?.id}R&&n.exec("select-file",{id:R,toggle:u,range:h});break}}}function r(i){const a=i.code.replace("Key","").toLowerCase();s(a,i),a=="tab"&&setTimeout(()=>{const l=document.activeElement;l.className.indexOf("table")!=-1&&n.exec("set-active-panel",{panel:+yi(l,"data-panel")})})}return t.addEventListener("keydown",r),{destroy:()=>{t.removeEventListener("keydown",r)}}}function ji(t,e="data-id"){let n=t;for(!n.tagName&&t.target&&(n=t.target);n;){if(n.getAttribute&&n.getAttribute(e))return n;n=n.parentNode}return null}function Si(t,e="data-id"){const n=t.getAttribute(e);return n?Ci(n):null}function Ci(t){if(t.startsWith(":"))return t.substring(1);const e=t*1;return isNaN(e)?t:e}function ki(){return{detect:()=>!0,addEvent:function(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)},addGlobalEvent:function(t,e){return document.addEventListener(t,e),()=>document.removeEventListener(t,e)},getTopNode:function(){return window.document.body}}}var Ni=ki();new Date().valueOf();function ys(t){const[e,n]=c.useState(t),s=c.useRef(t);return c.useEffect(()=>{if(s.current!==t){if(Array.isArray(s.current)&&Array.isArray(t)&&s.current.length===0&&t.length===0)return;s.current=t,n(t)}},[t]),[e,n]}function _i(t,e,n){const[s,r]=c.useState(()=>e);return t||console.warn(`Writable ${n} is not defined`),c.useEffect(()=>t?t.subscribe(a=>{r(()=>a)}):void 0,[t]),s}function W(t,e){const n=t.getState(),s=t.getReactiveState();return _i(s[e],n[e],e)}function Ri(t,e){const n=c.useRef(e);n.current=e;const[s,r]=c.useState(1);return c.useEffect(()=>t.subscribe(a=>{n.current=a,r(l=>l+1)}),[t]),[n.current,s]}function Ee(t,e){const n=t.getState(),s=t.getReactiveState();return Ri(s[e],n[e])}function bs(t){const e={};return t.split(";").forEach(n=>{const[s,r]=n.split(":");if(r){let i=s.trim();i.indexOf("-")&&(i=i.replace(/-([a-z])/g,(a,l)=>l.toUpperCase())),e[i]=r.trim()}}),e}function js(t){let e=t,n=[];return{subscribe:l=>{n.push(l),l(e)},unsubscribe:l=>{n=n.filter(d=>d!==l)},set:l=>{e=l,n.forEach(d=>d(e))},update:l=>{e=l(e),n.forEach(d=>d(e))}}}function Yn(t,e,n){function s(r){const i=ji(r);if(!i)return;const a=Si(i);if(typeof e=="function")return e(a,r);let l,d=r.target;for(;d!=i;){if(l=d.dataset?d.dataset.action:null,l&&e[l]){e[l](a,r);return}d=d.parentNode}e[n]&&e[n](a,r)}return Ni.addEvent(t,n,s)}function $i(t,e){const n=[Yn(t,e,"click")];return e.dblclick&&n.push(Yn(t,e.dblclick,"dblclick")),()=>{n.forEach(s=>s())}}function Ss(t,e){return t.map((n,s)=>{const r=e(n,s);return n.data&&n.data.length&&(r.data=Ss(n.data,e)),r}).filter(Boolean)}function Cs(t,e){const n=[];return t.forEach(s=>{if(s.data){const r=Cs(s.data,e);r.length&&n.push({...s,data:r})}else e(s)&&n.push(s)}),n}function Ei(t){return Ss(t,(e,n)=>{const s={...e,id:e.id||tn()};return s.type&&(s.comp=s.type),s.comp==="separator"&&t[n-1]?.comp==="separator"?null:s})}const ks={};function Mi(t){return ks[t]||t}function Di(t,e){ks[t]=e}function Ai({onClick:t,onShow:e,option:n}){const s=c.useRef(null),r=c.useCallback(()=>{e(n.data?n.id:!1,s.current)},[e,n]),i=c.useCallback(l=>{if(n.data){l.stopPropagation(),e(n.id,s.current);return}t(l)},[t,e,n]),a=c.useMemo(()=>n&&n.comp?Mi(n.comp):null,[n]);return o.jsxs("div",{ref:s,className:`wx-cDCz9rZQ wx-option ${n.css||""} ${n.disabled?"wx-disabled":""}`,"data-id":ge(n.id),onMouseEnter:r,onClick:i,children:[n.icon?o.jsx("i",{className:`wx-cDCz9rZQ wx-icon ${n.icon}`}):null,n.comp?a?o.jsx(a,{item:n,option:n}):null:o.jsxs("span",{className:"wx-cDCz9rZQ wx-value",children:[" ",n.text," "]}),n.subtext?o.jsx("span",{className:"wx-cDCz9rZQ wx-subtext",children:n.subtext}):null,n.data?o.jsx("i",{className:"wx-cDCz9rZQ wx-sub-icon wxi-angle-right"}):null]})}function un({options:t,left:e=0,top:n=0,at:s="bottom",parent:r=null,mount:i=null,context:a=null,css:l="",onClick:d,onCancel:u}){const[h,f]=c.useState(-1e4),[x,m]=c.useState(-1e4),[p,g]=c.useState(20),[y,v]=c.useState(),w=c.useRef(null),[j,R]=c.useState(!1),[C,$]=c.useState(null),b=c.useCallback(()=>{const M=as(w.current,r,s,e,n);M&&(f(M.x),m(M.y),v(M.width));let H=M?.z??20;const Z=r?br(r):[];let te=0;for(const ce of Z){const de=parseInt(getComputedStyle(ce).zIndex,10);de>te&&(te=de)}te>=H&&(H=te+1),g(H)},[r,s,e,n]);c.useEffect(()=>{i&&i(b)},[]);const E=c.useCallback(()=>{R(!1)},[]),P=c.useCallback((M,H)=>{R(M),$(H)},[]),k=c.useMemo(()=>Ei(t),[t]);c.useEffect(()=>{b()},[r,b]);const D=c.useRef(d),N=c.useRef(u),O=c.useRef(r);return c.useEffect(()=>{D.current=d},[d]),c.useEffect(()=>{N.current=u},[u]),c.useEffect(()=>{O.current=r},[r]),c.useEffect(()=>{if(!w.current)return;function M(H){N.current?N.current(H):D.current&&D.current({action:null,option:null})}return Pe(w.current,{callback:M,modal:!0,parent:()=>O.current}).destroy},[]),o.jsx("div",{ref:w,"data-wx-menu":"true",className:`wx-XMmAGqVx wx-menu ${l}`,style:{position:"absolute",top:x+"px",left:h+"px",width:y,zIndex:p},onMouseLeave:E,children:k.map(M=>o.jsxs(c.Fragment,{children:[M.comp==="separator"?o.jsx("div",{className:"wx-XMmAGqVx wx-separator"}):o.jsx(Ai,{option:M,onShow:P,onClick:H=>{if(!M.data&&!H.defaultPrevented){const Z={context:a,action:M,option:M,event:H};M.handler&&M.handler(Z),d&&d(Z),H.stopPropagation()}}}),M.data&&j===M.id?o.jsx(un,{css:l,options:M.data,at:"right-overlap",parent:C,context:a,onClick:d,onCancel:u}):null]},M.id))})}const Ns=c.forwardRef(function(t,e){const{options:n,at:s="bottom",resolver:r=null,dataKey:i="contextId",filter:a=null,css:l="",children:d,onClick:u}=t,[h,f]=c.useState(null),[x,m]=c.useState(null),[p,g]=c.useState(0),[y,v]=c.useState(0),w=c.useRef(null),j=c.useMemo(()=>`data-${i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,[i]),R=c.useMemo(()=>h!==null&&a?Cs(n,E=>a(E,h)):n,[h,a,n]);function C(E){m(null),u&&u(E)}function $(E){if(w.current===E){w.current=null;return}m(null),u&&u({action:null,option:null})}const b=c.useCallback((E,P)=>{if(!E){m(null);return}if(E.defaultPrevented)return;const k=E.target;if(k&&k.dataset&&k.dataset.menuIgnore)return;if(x&&x===k){m(null),E.preventDefault();return}g(E.clientX+1),v(E.clientY+1);let D=typeof P<"u"?P:rt(k,j);r&&(D=r(D,E),!D)||(f(D),m(k),w.current=E.nativeEvent||E,E.preventDefault())},[x,j,r]);return c.useImperativeHandle(e,()=>({show:b}),[b]),o.jsxs(o.Fragment,{children:[d?o.jsx("span",{onClick:b,"data-menu-ignore":"true",children:typeof d=="function"?d():d}):null,x?o.jsx(sn,{children:o.jsx(un,{css:l,at:s,top:y,left:p,parent:x,context:h,onClick:C,onCancel:$,options:R},x)}):null]})}),Ti=c.forwardRef(function(t,e){const{options:n,at:s="bottom",css:r="",children:i,onClick:a}=t,[l,d]=c.useState(null),u=c.useRef(null);function h(p){d(null),a&&a(p)}function f(p){if(u.current===p){u.current=null;return}d(null),a&&a({action:null,option:null})}const x=c.useCallback(p=>{d(p.target),u.current=p.nativeEvent||p,p.preventDefault()},[]);c.useImperativeHandle(e,()=>({show:x}),[x]);function m(p){let g=p.target;for(;!g.dataset.menuIgnore;)d(g),g=g.parentNode}return o.jsxs(o.Fragment,{children:[o.jsx("span",{onClick:m,"data-menu-ignore":"true",children:i}),l?o.jsx(sn,{children:o.jsx(un,{css:r,at:s,parent:l,options:n,onClick:h,onCancel:f})}):null]})}),Ii=c.forwardRef(function(t,e){const{options:n,at:s="bottom",resolver:r=null,dataKey:i="contextId",filter:a=null,css:l="",children:d,onClick:u}=t,h=c.useRef(null),f=c.useCallback((x,m)=>{h.current.show(x,m)},[]);return c.useImperativeHandle(e,()=>({show:f}),[f]),o.jsxs(o.Fragment,{children:[d?o.jsx("span",{onContextMenu:f,"data-menu-ignore":"true",children:d}):null,o.jsx(Ns,{css:l,at:s,options:n,resolver:r,dataKey:i,filter:a,ref:h,onClick:u})]})}),Fi={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 Oi=class{constructor(e,n,s,r,i){this.setFiles=e,this.setReady=n,this.setSignal=s,this.setDrag=r,i&&i.length&&this.setFiles(i)}open(e){this.setSignal(["click",e||{}])}getState(){let e="server";const n=this.files;for(let s=0;s<n.length;s++){if(n[s].status==="client")return"client";n[s].status==="error"&&(e="error")}return e}droparea(e,n){n=n||{};const s=()=>{n.dragEnter&&n.dragEnter(),this.setDrag(!0)},r=()=>{n.dragLeave&&n.dragLeave(),this.setDrag(!1)},i=l=>{l.preventDefault()},a=l=>{l.preventDefault(),this.setDrag(!1),this.setSignal(["drop",n,l]),n.dragLeave&&n.dragLeave(),n.drop&&n.drop()};return e.addEventListener("dragenter",s),e.addEventListener("dragleave",r),e.addEventListener("dragover",i,!0),e.addEventListener("drop",a,!0),()=>{e.removeEventListener("dragenter",s),e.removeEventListener("dragleave",r),e.removeEventListener("dragover",i,!0),e.removeEventListener("drop",a,!0)}}updateFile(e,n){const s=this.files.findIndex(i=>i.id===e);if(s===-1)return;const r=[...this.files];return r[s]={...r[s],...n},this.files=r,this.setFiles(this.files),this.files[s]}deleteFile(e){this.files=this.files.filter(n=>n.id!==e),this.setFiles(this.files)}addFile(e,n){n?this.files=[...this.files,e]:this.files=[e],this.setFiles(this.files)}deleteAll(){this.files=[],this.setFiles(this.files)}};function _s(t){const[e,n]=c.useState([]),[s,r]=c.useState(Promise.resolve(null)),[i,a]=c.useState(null),[l,d]=c.useState(!1),u=c.useRef();return u.current||(u.current=new Oi(n,r,a,d,t)),u.current.files=e,u.current.ready=s,u.current.signal=i,u.current.drag=l,u.current}function Pi(t,e){{if(t){const n=t.getGroup(e);if(n)return n}return ot(Fi).getGroup(e)}}const Hi=()=>Math.random().toString(36).substr(2,9),Li=({data:t,accept:e="",multiple:n=!0,folder:s=!1,uploadURL:r="",apiOnly:i=!1,disabled:a=!1,children:l,onChange:d,onUpload:u})=>{const h=c.useRef(null),f=c.useRef(null),[x,m]=c.useState({}),p=_s(),g=t||p,y=c.useContext(ve.i18n),v=Pi(y,"uploader");c.useEffect(()=>{h.current&&s&&(h.current.webkitdirectory=!0)},[s]),c.useEffect(()=>{if(!i&&f.current&&!a)return g.droparea(f.current)},[i,a,f]);const w=k=>{const D=new FormData;return D.append("upload",k.file),fetch(r,{method:"POST",body:D}).then(N=>N.json()).then(N=>({id:k.id,...N}),()=>({id:k.id,status:"error"})).catch(N=>(console.log(N),{id:k.id,status:"error"}))},j=(k,D)=>{const N=g.updateFile(k,D),O={...N,status:g.getState()};N&&N.uploaded&&N.uploaded(O),u&&u(O),N.temp&&g.deleteFile(N.id)},R=k=>{if(!k)return;const D=typeof r=="function"?r(k):w(k);g.setReady(D.then(N=>{N.status=N.status||"server",j(k.id,N)}).catch(N=>{j(k.id,{status:"error",error:N})}))},C=(k,D)=>{const N={...D||x,id:Hi(),status:"client",name:k.name,file:k};N.selected&&N.selected(N),d&&d(N),g.addFile(N,n),R(N),h.current&&(h.current.value="")},$=(k,D,N)=>{k.isFile?k.file(O=>{C(O,N)}):k.isDirectory&&k.createReader().readEntries(O=>{O.forEach(M=>{$(M,D+M.name+"/",N)})})},b=k=>{Array.from(k.target.files).forEach(D=>C(D))},E=(k,D)=>{Array.from(k.dataTransfer.items).forEach(N=>{const O=N.webkitGetAsEntry();O&&$(O,"",D)})},P=()=>{h.current&&h.current.click()};return c.useEffect(()=>{if(g.signal){const[k,D,N]=g.signal;m(D),k==="click"?P():k==="drop"&&E(N,D),g.setSignal(null)}},[g.signal]),i?o.jsxs(o.Fragment,{children:[o.jsx("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:h,onChange:b,accept:e,multiple:n,disabled:a}),l]}):o.jsxs("div",{className:`wx-at1A8tb8 wx-label ${g.drag?"wx-active":""} ${a?"wx-disabled":""}`,ref:f,children:[o.jsx("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:h,onChange:b,accept:e,multiple:n,disabled:a}),l||o.jsx("div",{className:"wx-at1A8tb8 wx-dropzone",children:o.jsxs("span",{children:[v("Drop files here or")," ",o.jsx("span",{className:"wx-at1A8tb8 wx-action",onClick:P,children:v("select files")})]})})]})};new Date().valueOf();function zi(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in e){const s=t[n],r=e[n];if(!Et(s,r))return!1}return!0}function Et(t,e){if(typeof t=="number"||typeof t=="string"||typeof t=="boolean"||t===null)return t===e;if(typeof t!=typeof e||(t===null||e===null)&&t!==e||t instanceof Date&&e instanceof Date&&t.getTime()!==e.getTime())return!1;if(typeof t=="object")if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let n=t.length-1;n>=0;n--)if(!Et(t[n],e[n]))return!1;return!0}else return zi(t,e);return t===e}function Wt(t){if(typeof t!="object"||t===null)return t;if(t instanceof Date)return new Date(t);if(t instanceof Array)return t.map(Wt);const e={};for(const n in t)e[n]=Wt(t[n]);return e}var Rs=2,Bi=class{constructor(t){t&&(this._writable=t.writable,this._async=t.async),this._values={},this._state={}}setState(t,e=0){const n={};return this._wrapProperties(t,this._state,this._values,"",n,e),n}getState(){return this._values}getReactive(){return this._state}_wrapProperties(t,e,n,s,r,i){for(const a in t){const l=e[a],d=n[a],u=t[a];if(l&&(d===u&&typeof u!="object"||u instanceof Date&&d instanceof Date&&d.getTime()===u.getTime()))continue;const h=s+(s?".":"")+a;l?(l.__parse(u,h,r,i)&&(n[a]=u),i&Rs?r[h]=l.__trigger:l.__trigger()):(u&&u.__reactive?e[a]=this._wrapNested(u,u,h,r):e[a]=this._wrapWritable(u),n[a]=u),r[h]=r[h]||null}}_wrapNested(t,e,n,s){const r=this._wrapWritable(t);return this._wrapProperties(t,r,e,n,s,0),r.__parse=(i,a,l,d)=>(this._wrapProperties(i,r,e,a,l,d),!1),r}_wrapWritable(t){const e=[],n=function(){for(let s=0;s<e.length;s++)e[s](t)};return{subscribe:s=>(e.push(s),this._async?setTimeout(s,1,t):s(t),()=>{const r=e.indexOf(s);r>=0&&e.splice(r,1)}),__trigger:()=>{e.length&&(this._async?setTimeout(n,1):n())},__parse:function(s){return t=s,!0}}}},Gi=class{constructor(t,e,n,s){typeof t=="function"?this._setter=t:this._setter=t.setState.bind(t),this._routes=e,this._parsers=n,this._prev={},this._triggers=new Map,this._sources=new Map,this._routes.forEach(r=>{r.in.forEach(i=>{const a=this._triggers.get(i)||[];a.push(r),this._triggers.set(i,a)}),r.out.forEach(i=>{const a=this._sources.get(i)||{};r.in.forEach(l=>a[l]=!0),this._sources.set(i,a)})}),this._routes.forEach(r=>{r.length=Math.max(...r.in.map(i=>$s(i,this._sources,1)))}),this._bus=s}init(t){const e={};for(const n in t)if(this._prev[n]!==t[n]){const s=this._parsers[n];e[n]=s?s(t[n]):t[n]}this._prev=this._prev?{...this._prev,...t}:{...t},this.setState(e),this._bus&&this._bus.exec("init-state",e)}setStateAsync(t){const e=this._setter(t,Rs);return this._async?Object.assign(this._async.signals,e):this._async={signals:e,timer:setTimeout(this._applyState.bind(this),1)},e}_applyState(){const t=this._async;if(t){this._async=null,this._triggerUpdates(t.signals,[]);for(const e in t.signals){const n=t.signals[e];n&&n()}}}setState(t,e=[]){const n=this._setter(t);return this._triggerUpdates(n,e),n}_triggerUpdates(t,e){const n=Object.keys(t),s=!e.length;e=e||[];for(let r=0;r<n.length;r++){const i=n[r],a=this._triggers.get(i);a&&a.forEach(l=>{e.indexOf(l)==-1&&e.push(l)})}s&&this._execNext(e)}_execNext(t){for(;t.length;){t.sort((n,s)=>n.length<s.length?1:-1);const e=t[t.length-1];t.splice(t.length-1),e.exec(t)}}};function $s(t,e,n){const s=e.get(t);if(!s)return n;const r=Object.keys(s).map(i=>$s(i,e,n+1));return Math.max(...r)}var Vi=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=new WeakMap,this.exec=this.exec.bind(this)}on(t,e,n){let s=this._handlers[t];s?n&&n.intercept?s.unshift(e):s.push(e):s=this._handlers[t]=[e],n&&n.tag&&this._tag.set(e,n.tag)}intercept(t,e,n){this.on(t,e,{...n,intercept:!0})}detach(t){for(const e in this._handlers){const n=this._handlers[e];for(let s=n.length-1;s>=0;s--)this._tag.get(n[s])===t&&n.splice(s,1)}}async exec(t,e){const n=this._handlers[t];if(n)for(let s=0;s<n.length;s++){const r=n[s](e);if(r===!1||r&&r.then&&await r===!1)return}return this._nextHandler&&await this._nextHandler.exec(t,e),e}setNext(t){return this._nextHandler=t}};function Yi(t){return e=>e[t]}function Ki(t){return(e,n)=>e[t]=n}function Ge(t,e){return(e.getter||Yi(e.id))(t)}function Bt(t,e,n){return(e.setter||Ki(e.id))(t,n)}function Wi(t,e){const n=document.createElement("a");n.href=URL.createObjectURL(t),n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}function Be(t,e){let n=Ge(t,e)??"";return e.template?n=e.template(n,t,e):e.optionsMap&&(Array.isArray(n)?n=n.map(s=>e.optionsMap.get(s)).join(", "):n=e.optionsMap.get(n)),typeof n>"u"?"":n+""}function Ui(t,e){const n=/\n|"|;|,/;let s="";const r=e.rows||`
|
|
1
|
+
import{j as o,h as Me,f as Zs,g as Xs}from"./styles-Ba1tPFHg.js";import{a as c,K as Qt,O as pt,P as er,N as tr,Q as nr,V as sr,Y as Zt,Z as Cn,n as kn,_ as Nn,C as rr,$ as ir,u as or,U as ar,c as _n,b as lr,a0 as Pt,a1 as cr,o as Rn,a2 as $n,X as dr}from"./icons-CacEbnZu.js";import{r as ur}from"./react-Cfedt3N5.js";new Date().valueOf();function Oe(t){const[e,n]=c.useState(t),s=c.useRef(t);return c.useEffect(()=>{if(s.current!==t){if(Array.isArray(s.current)&&Array.isArray(t)&&s.current.length===0&&t.length===0)return;s.current=t,n(t)}},[t]),[e,n]}function Xt(t,e){return typeof t=="function"?typeof e=="object"?t(e):t():t}function Ze(t,e="data-id"){let n=t;for(!n.tagName&&t.target&&(n=t.target);n;){if(n.getAttribute&&n.getAttribute(e))return n;n=n.parentNode}return null}function fr(t,e="data-id"){const n=Ze(t,e);return n?n.getAttribute(e):null}function rt(t,e="data-id"){const n=Ze(t,e);return n?_t(n,e):null}function _t(t,e="data-id"){const n=t.getAttribute(e);return n?hr(n):null}function ge(t){return typeof t=="string"?":"+t:t}function hr(t){if(t.startsWith(":"))return t.substring(1);const e=t*1;return isNaN(e)?t:e}function xr(){return{detect:()=>!0,addEvent:function(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)},addGlobalEvent:function(t,e){return document.addEventListener(t,e),()=>document.removeEventListener(t,e)},getTopNode:function(){return window.document.body}}}var Ce=xr();function en(t){Object.assign(Ce,t)}function En(t,e,n){function s(r){const i=Ze(r);if(!i)return;const a=_t(i);if(typeof e=="function")return e(a,r);let l,d=r.target;for(;d!=i;){if(l=d.dataset?d.dataset.action:null,l&&e[l]){e[l](a,r);return}d=d.parentNode}e[n]&&e[n](a,r)}Ce.addEvent(t,n,s)}function Xe(t,e){En(t,e,"click"),e.dblclick&&En(t,e.dblclick,"dblclick")}function pr(t,e){for(let n=t.length-1;n>=0;n--)if(t[n]===e){t.splice(n,1);break}}function mr(t,e,n){for(let s=0;s<Le.length;s++){if(s===n)continue;const r=Le[s],i=r.props.parent?.();if(i&&t.contains(i)&&r.node.contains(e))return!0}return!1}var os=new Date,kt=!1,mt=[],Le=[],Mn=t=>{const e=t.target;if(kt||!e.isConnected){kt=!1;return}for(let n=Le.length-1;n>=0;n--){const{node:s,date:r,props:i}=Le[n];if(!(r>os)&&!s.contains(e)&&s!==e&&(mr(s,e,n)||(i.callback&&i.callback(t),i.modal||t.defaultPrevented)))break}},gr=t=>{os=new Date,kt=!0;for(let e=Le.length-1;e>=0;e--){const{node:n}=Le[e];if(!n.contains(t.target)&&n!==t.target){kt=!1;break}}};function Pe(t,e){mt.length||(mt=[Ce.addGlobalEvent("click",Mn,t),Ce.addGlobalEvent("contextmenu",Mn,t),Ce.addGlobalEvent("mousedown",gr,t)]),typeof e!="object"&&(e={callback:e});const n={node:t,date:new Date,props:e};return Le.push(n),{destroy(){pr(Le,n),Le.length||(mt.forEach(s=>s()),mt=[])}}}var gt=t=>t.indexOf("bottom")!==-1,wt=t=>t.indexOf("left")!==-1,vt=t=>t.indexOf("right")!==-1,Ht=t=>t.indexOf("top")!==-1,Dn=t=>t.indexOf("fit")!==-1,tt=t=>t.indexOf("overlap")!==-1,wr=t=>t.split("-").every(e=>["center","fit"].indexOf(e)>-1),vr=t=>{const e=t.match(/(start|center|end)/);return e?e[0]:null};function yr(t,e){let n=0;const s=Ce.getTopNode(t);for(;t&&t!==s;){const r=getComputedStyle(t).position;if((r==="absolute"||r==="relative"||r==="fixed")&&(n=parseInt(getComputedStyle(t).zIndex)||0),t=t.parentNode,t===e)break}return n}var me,je,nt,be;function as(t,e,n="bottom",s=0,r=0){if(!t)return null;me=s,je=r,nt="auto";let i=0,a=0,l=n;const d=ls(t),u=tt(n)?Ce.getTopNode(t):d;if(!d)return null;const h=d.getBoundingClientRect(),f=t.getBoundingClientRect(),x=u.getBoundingClientRect(),m=window.getComputedStyle(u),p={left:0,top:0,bottom:0,right:0};for(const R in p){const C=`border-${R}-width`;p[R]=parseFloat(m.getPropertyValue(C))}if(e){const R=yr(e,d);i=Math.max(R+1,20)}if(e){if(be=e.getBoundingClientRect(),Dn(n)&&(nt=be.width+"px"),n!=="point")if(wr(n))Dn(n)?me=0:(me=x.width/2,a=1),je=(x.height-f.height)/2;else{const R=tt(n)?0:1;me=vt(n)?be.right+R:be.left-R,je=gt(n)?be.bottom+1:be.top;const C=vr(n);C&&(vt(n)||wt(n)?C==="center"?je-=(f.height-be.height)/2:C==="end"&&(je-=f.height-be.height):(gt(n)||Ht(n))&&(C==="center"?me-=(f.width-be.width)/2:C==="end"&&(me-=f.width-be.width),tt(n)||(me+=1)))}}else be={left:s,right:s,top:r,bottom:r};const g=(wt(n)||vt(n))&&(gt(n)||Ht(n));wt(n)&&(a=2);const y=me-f.width-x.left;e&&wt(n)&&!g&&y<0&&(me=be.right,a=0,l=l.replace("left","right"));const v=me+f.width*(1-a/2)-x.right;if(v>0)if(!vt(n))me=x.right-p.right-f.width;else{const R=be.left-x.x-f.width;e&&!g&&R>=0?(me=be.left-f.width,l=l.replace("right","left")):me-=v+p.right}a&&(me=Math.round(me-f.width*a/2));const w=y<0||v>0||!g;Ht(n)&&(je=be.top-f.height,e&&je<x.y&&w&&(je=be.bottom,l=l.replace("top","bottom")));const j=je+f.height-x.bottom;return j>0&&(e&>(n)&&w?(je-=f.height+be.height+1,l=l.replace("bottom","top")):je-=j+p.bottom),me-=h.left+p.left,je-=h.top+p.top,me=(tt(n)?me:Math.max(me,0))+u.scrollLeft,je=(tt(n)?je:Math.max(je,0))+u.scrollTop,nt=nt||"auto",{at:l,x:me,y:je,z:i,width:nt}}function ls(t){const e=Ce.getTopNode(t);for(t&&(t=t.parentElement);t;){const n=getComputedStyle(t).position;if(t===e||n==="relative"||n==="absolute"||n==="fixed")return t;t=t.parentNode}return null}function br(t){const e=[];let n=t;const s=Ce.getTopNode(t);for(;n&&n!==s&&!n.getAttribute("data-wx-portal-root");)getComputedStyle(n).position==="absolute"&&e.push(n),n=n.parentNode;return e}var An=new Date().valueOf();function tn(){return An+=1,An}function Se(t){return t<10?"0"+t:t.toString()}function jr(t){const e=Se(t);return e.length==2?"0"+e:e}function cs(t){const e=Math.floor(t/11)*11;return{start:e,end:e+11}}function Lt(t){const e=(t.getDay()+6)%7,n=new Date(t.valueOf());n.setDate(t.getDate()+(3-e)),n.setHours(0,0,0,0);const s=new Date(n.getFullYear(),0,1),r=Math.round((n.getTime()-s.getTime())/864e5);return 1+Math.floor(r/7)}var Tn=["",""];function Sr(t,e,n){switch(t){case"%d":return Se(e.getDate());case"%m":return Se(e.getMonth()+1);case"%j":return e.getDate();case"%n":return e.getMonth()+1;case"%y":return Se(e.getFullYear()%100);case"%Y":return e.getFullYear();case"%D":return n.dayShort[e.getDay()];case"%l":return n.dayFull[e.getDay()];case"%M":return n.monthShort[e.getMonth()];case"%F":return n.monthFull[e.getMonth()];case"%h":return Se((e.getHours()+11)%12+1);case"%g":return(e.getHours()+11)%12+1;case"%G":return e.getHours();case"%H":return Se(e.getHours());case"%i":return Se(e.getMinutes());case"%a":return((e.getHours()>11?n.pm:n.am)||Tn)[0];case"%A":return((e.getHours()>11?n.pm:n.am)||Tn)[1];case"%s":return Se(e.getSeconds());case"%S":return jr(e.getMilliseconds());case"%W":return Se(Lt(e));case"%w":{const s=n.weekStart??1;if(s===1)return Se(Lt(e));const r=(e.getDay()-s+7)%7,i=(1-s+7)%7,a=new Date(e.valueOf());return a.setDate(e.getDate()+(i-r)),Se(Lt(a))}case"%c":{let s=e.getFullYear()+"";return s+="-"+Se(e.getMonth()+1),s+="-"+Se(e.getDate()),s+="T",s+=Se(e.getHours()),s+=":"+Se(e.getMinutes()),s+=":"+Se(e.getSeconds()),s}case"%Q":return Math.floor(e.getMonth()/3)+1;default:return t}}var Cr=/%[a-zA-Z]/g;function Je(t,e){return typeof t=="function"?t:function(n){return n?(n.getMonth||(n=new Date(n)),t.replace(Cr,s=>Sr(s,n,e))):""}}function In(t){return t&&typeof t=="object"&&!Array.isArray(t)}function Yt(t,e){for(const n in e){const s=e[n];In(t[n])&&In(s)?t[n]=Yt({...t[n]},e[n]):t[n]=e[n]}return t}function ot(t){return{getGroup(e){const n=t[e];return s=>n&&n[s]||s},getRaw(){return t},extend(e,n){if(!e)return this;let s;return n?s=Yt({...e},t):s=Yt({...t},e),ot(s)}}}var kr=ur();const Nr="en-US",_r={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},Rr={ok:"OK",cancel:"Cancel",select:"Select","No data":"No data","Rows per page":"Rows per page","Total pages":"Total pages"},$r={timeFormat:"%H:%i",dateFormat:"%m/%d/%Y",monthYearFormat:"%F %Y",yearFormat:"%Y"},ds={core:Rr,calendar:_r,formats:$r,lang:Nr},nn=c.createContext(""),us=c.createContext({}),Ie=c.createContext(null),fs=c.createContext(null),ve=Object.freeze(Object.defineProperty({__proto__:null,fieldId:fs,helpers:us,i18n:Ie,theme:nn},Symbol.toStringTag,{value:"Module"}));function hs(t){const e=c.useContext(fs),[n]=c.useState(()=>t||e||tn());return n}function st({type:t="",css:e="",icon:n="",disabled:s=!1,title:r="",tooltip:i,text:a="",children:l,onClick:d}){const u=c.useMemo(()=>{let f=t?t.split(" ").filter(x=>x!=="").map(x=>"wx-"+x).join(" "):"";return e+(e?" ":"")+f},[t,e]),h=f=>{d&&d(f)};return o.jsxs("button",{title:r,className:`wx-2ZWgb4 wx-button ${u} ${n&&!l?"wx-icon":""}`,disabled:s,onClick:h,"data-tooltip-text":i,children:[n&&o.jsx("i",{className:"wx-2ZWgb4 "+n}),l||a||" "]})}function Er({id:t,label:e="",inputValue:n="",value:s=!1,onChange:r,disabled:i=!1,css:a=""}){const l=hs(t),[d,u]=Oe(s),h=({target:f})=>{const x=f.checked;u(x),r&&r({value:x,inputValue:n})};return o.jsxs("div",{className:`wx-2IvefP wx-checkbox ${a}`,children:[o.jsx("input",{type:"checkbox",id:l,disabled:i,className:"wx-2IvefP wx-check",checked:d,value:n,onChange:h}),o.jsxs("label",{htmlFor:l,className:"wx-2IvefP wx-label",children:[o.jsx("span",{className:"wx-2IvefP wx-before"}),e&&o.jsx("span",{className:"wx-2IvefP wx-after",children:e})]})]})}function sn({theme:t="",target:e,children:n}){const s=c.useRef(null),r=c.useRef(null),[i,a]=c.useState(null);s.current||(s.current=document.createElement("div"));const l=c.useContext(nn);return c.useEffect(()=>{a(e||Mr(r.current)||Ce.getTopNode(r.current))},[r.current]),o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:r,style:{display:"none"}}),r.current&&i?kr.createPortal(o.jsx("div",{className:`wx-3ZWsT0 wx-${t||l}-theme`,children:n}),i):null]})}function Mr(t){const e=Ce.getTopNode(t);for(;t&&t!==e&&!t.getAttribute("data-wx-portal-root");)t=t.parentNode;return t}function Dr({left:t=0,top:e=0,at:n="bottom",parent:s=null,width:r="auto",css:i="",onCancel:a,children:l,trackScroll:d=!1}){const[u,h]=c.useState(0),[f,x]=c.useState(0),[m,p]=c.useState("auto"),[g,y]=c.useState(!1),v=c.useRef(null),w=c.useRef(null),j=c.useRef(a);c.useEffect(()=>{j.current=a},[a]);function R($){return s&&(r+"").indexOf("%")>-1?r.replace(/(\d+)%/,(b,E)=>(E=E*s.offsetWidth/100+"px",r.replace(b,E))):r&&r!=="auto"?r:$}const C=c.useCallback(()=>{if(!v.current)return;const $=as(v.current,s,n,t,e);$&&(h($.x),x($.y),p(R($.width)))},[v,s,n,t,e,r]);return c.useLayoutEffect(()=>{const $=E=>{j.current&&E.target!==w.current&&v.current&&!v.current.contains(E.target)&&j.current(E)};let b;return requestAnimationFrame(()=>{C(),y(!0),d&&v.current&&(w.current=ls(v.current),w.current&&w.current.addEventListener("scroll",$,!0)),s&&(b=new ResizeObserver(C),b.observe(s))}),()=>{d&&w.current&&w.current.removeEventListener("scroll",$,!0),b?.disconnect()}},[]),c.useLayoutEffect(()=>{C()},[s,n,t,e]),c.useEffect(()=>{const $=b=>{j.current&&j.current(b)};if(v.current)return Pe(v.current,{callback:$,parent:()=>s}).destroy},[s]),o.jsx("div",{ref:v,className:["wx-37M6Fj","wx-popup",i].filter(Boolean).join(" "),style:{position:"absolute",visibility:g?"visible":"hidden",top:f+"px",left:u+"px",width:m},children:l})}function Ar({position:t="bottom",align:e="start",autoFit:n=!0,onCancel:s=null,width:r="100%",css:i="",children:a}){const l=c.useRef(null),[d,u]=c.useState(t),[h,f]=c.useState(e),x=c.useRef(s);return c.useEffect(()=>{x.current=s},[s]),c.useEffect(()=>{if(n){const m=l.current;if(m){const p=m.getBoundingClientRect(),g=document.body.getBoundingClientRect();p.right>=g.right&&f("end"),p.bottom>=g.bottom&&u("top")}}},[]),c.useEffect(()=>{if(l.current){const m=p=>{x.current&&x.current(p)};return Pe(l.current,m).destroy}},[]),o.jsx("div",{ref:l,className:["wx-dropdown",`wx-${d}-${h}`,i||"","wx-aaaVytZW"].filter(Boolean).join(" "),style:{width:r},children:a})}function rn({position:t="bottom",align:e="start",autoFit:n=!0,inline:s=!1,onCancel:r,width:i="100%",children:a,...l}){const[d,u]=c.useState(void 0),h=c.useRef(null),f=c.useMemo(()=>`${t}-${e}`,[t,e]);return c.useLayoutEffect(()=>{h.current&&u(h.current.parentNode)},[]),o.jsxs(o.Fragment,{children:[d&&(s?o.jsx(Ar,{onCancel:r,position:t,align:e,autoFit:n,width:i,...l,children:a}):o.jsx(sn,{children:o.jsx(Dr,{parent:d,at:f,onCancel:r,width:i,...l,children:a})})),o.jsx("span",{ref:h,className:"wx-portal-node wx-32GZ52"})]})}function Rt(){return ot(ds)}function Tr(){let t=null,e=!1,n=!1,s,r,i,a;const l=(f,x,m,p,g)=>{s=f,r=x,i=m,a=p,n=g},d=f=>{t=f,e=t!==null,i(t)},u=(f,x)=>{if(!n&&f!==null&&s){const m=s.querySelectorAll(".wx-list > .wx-item")[f];m&&(m.scrollIntoView({block:"nearest"}),x&&x.preventDefault())}},h=(f,x)=>{const m=f===null?null:Math.max(0,Math.min(t+f,r.length-1));m!==t&&(d(m),s?u(m,x):requestAnimationFrame(()=>u(m,x)))};return{move:f=>{const x=rt(f),m=r.findIndex(p=>p.id===x);m!==t&&d(m)},keydown:(f,x)=>{switch(f.code){case"Enter":e?a():d(0);break;case"Space":e||d(0);break;case"Escape":i(t=null);break;case"Tab":i(t=null);break;case"ArrowDown":h(e?1:x||0,f);break;case"ArrowUp":h(e?-1:x||0,f);break}},init:l,navigate:h}}const Fn=10,Ir=c.memo(function({data:t,checkboxes:e,itemTemplate:n,value:s}){return o.jsxs(o.Fragment,{children:[e&&o.jsx(Er,{id:t.id,css:"wx-list-checkbox",value:s&&s.includes(t.id)}),n?Xt(n,{option:t}):t.label]})});function On({visibleItems:t,visibleRange:e,navIndex:n,checkboxes:s,itemTemplate:r,value:i,measureRefCallback:a}){return t.map((l,d)=>{const u=e.start+d;return o.jsx("div",{ref:d===0?a:void 0,className:`wx-233fr7 wx-item ${u===n?"wx-focus":""}`,"data-id":l.id,children:o.jsx(Ir,{data:l,checkboxes:s,itemTemplate:r,value:i})},l.id)})}function $t({items:t=[],children:e,onSelect:n,onReady:s,virtualized:r=!1,checkboxes:i,multiselect:a,value:l,...d}){const u=c.useRef(),h=c.useRef(!1),f=c.useRef(Tr()),[x,m]=c.useState(null),p=c.useRef(x),[g,y]=c.useState(0),[v,w]=c.useState(24),j=c.useRef(!1),R=(c.useContext(Ie)||Rt()).getGroup("core"),C=c.useRef(t);c.useEffect(()=>{C.current=t},[t]);const $=c.useRef(l);c.useEffect(()=>{$.current=l},[l]);const b=c.useRef(0);c.useEffect(()=>{b.current=v},[v]);const E=c.useCallback(T=>{T&&T.stopPropagation();const U=C.current,X=$.current,J=p.current;let ue;const he=U[J]?.id;a?X&&X.includes(he)?ue=X.filter(ie=>ie!==he):ue=[...X||[],he]:ue=he,n&&n({id:ue})},[a,n]),P=c.useRef(E);c.useEffect(()=>{P.current=E},[E]);const k=c.useCallback(T=>{if(u.current){let U=T*b.current-u.current.clientHeight+b.current;y(U),u.current.scrollTop=U}},[b.current]),D=c.useCallback(T=>{u.current=T,r&&(T&&!h.current&&p.current!==null&&requestAnimationFrame(()=>{u.current&&(k(p.current),h.current=!0)}),T||(h.current=!1))},[k]),N=c.useCallback(T=>{if(!T||j.current)return;const U=T.getBoundingClientRect().height;U&&(w(U),b.current=U,j.current=!0)},[]);c.useEffect(()=>{f.current.init(u.current,t,T=>{m(T),p.current=T},T=>P.current(T),r)},[t,u.current,r]),c.useEffect(()=>{const T=(X,J)=>{f.current.navigate(X,J),k(p.current)},U=(X,J)=>{const ue=p.current,he=C.current;if(ue!==0&&ue!==he.length-1&&(X.key==="ArrowDown"||X.key==="ArrowUp")&&X.preventDefault(),f.current.keydown(X,J),u.current){const ie=u.current.scrollTop<=p.current*b.current,se=u.current.scrollTop+u.current.clientHeight>=p.current*b.current+b.current;ie?se||k(p.current):(u.current.scrollTop=p.current*b.current,y(u.current.scrollTop))}};s&&s({navigate:r?T:f.current.navigate,keydown:r?U:f.current.keydown,move:f.current.move})},[]);const O=c.useRef(0),M=c.useRef(t);M.current!==t&&(M.current=t,O.current+=1);const H=c.useCallback(()=>{f.current.navigate(null)},[f]),Z=c.useCallback(T=>{r&&y(T.target.scrollTop)},[r]),te=c.useMemo(()=>Math.ceil((u.current?.clientHeight||0)/v),[v,g]),ce=c.useMemo(()=>{if(!r)return{start:0,end:t.length};if(!t.length)return{start:0,end:0};const T=Math.floor(g/v),U=T+te;return{start:Math.max(0,T-Fn),end:Math.min(t.length,U+Fn)}},[r,t,g,v,te]),de=c.useMemo(()=>{if(!r)return t;const{start:T,end:U}=ce;return t.slice(T,U).map(X=>({...X}))},[r,t,ce]),B=ce.start*v,G=t.length*v;return c.useEffect(()=>{r&&y(0)},[t,r]),c.useEffect(()=>{x===null&&(h.current=!1)},[x]),x===null?null:o.jsx(rn,{onCancel:H,...d,children:o.jsx("div",{className:"wx-233fr7 wx-list",ref:D,onClick:E,onMouseMove:f.current.move,onScroll:Z,children:t.length?r?o.jsx("div",{className:"wx-233fr7 wx-list-wrapper",style:{height:`${G}px`},children:o.jsx("div",{className:"wx-233fr7 wx-list-content",style:{transform:`translateY(${B}px)`},children:o.jsx(On,{visibleRange:ce,visibleItems:de,navIndex:x,measureRefCallback:N,checkboxes:i,itemTemplate:e,value:l})})}):o.jsx(On,{visibleRange:ce,visibleItems:de,navIndex:x,measureRefCallback:N,checkboxes:i,itemTemplate:e,value:l}):o.jsx("div",{className:"wx-233fr7 wx-no-data",children:R("No data")})})},O.current)}function on({value:t="",id:e,readonly:n=!1,focus:s=!1,select:r=!1,type:i="text",placeholder:a="",disabled:l=!1,error:d=!1,title:u="",tooltip:h,css:f="",icon:x="",clear:m=!1,onChange:p}){const g=hs(e),[y,v]=Oe(t),w=c.useRef(null),j=c.useMemo(()=>x&&f.indexOf("wx-icon-left")===-1?"wx-icon-right "+f:f,[x,f]),R=c.useMemo(()=>x&&f.indexOf("wx-icon-left")!==-1,[x,f]);c.useEffect(()=>{const P=setTimeout(()=>{s&&w.current&&w.current.focus(),r&&w.current&&w.current.select()},1);return()=>clearTimeout(P)},[s,r]);const C=c.useCallback(P=>{const k=P.target.value;v(k),p&&p({value:k,input:!0})},[p]),$=c.useCallback(P=>p&&p({value:P.target.value}),[p]);function b(P){P.stopPropagation(),v(""),p&&p({value:""})}let E=i;return i!=="password"&&i!=="number"&&(E="text"),c.useEffect(()=>{const P=$,k=w.current;return k.addEventListener("change",P),()=>{k&&k.removeEventListener("change",P)}},[$]),o.jsxs("div",{className:`wx-hQ64J4 wx-text ${j} ${d?"wx-error":""} ${l?"wx-disabled":""} ${m?"wx-clear":""}`,"data-tooltip-text":h,children:[o.jsx("input",{className:"wx-hQ64J4 wx-input",ref:w,id:g,readOnly:n,disabled:l,placeholder:a,type:E,title:u,value:y,onInput:C}),m&&!l&&y?o.jsxs(o.Fragment,{children:[o.jsx("i",{className:"wx-hQ64J4 wx-icon wxi-close",onClick:b}),R&&o.jsx("i",{className:`wx-hQ64J4 wx-icon ${x}`})]}):x?o.jsx("i",{className:`wx-hQ64J4 wx-icon ${x}`}):null]})}function Fr({date:t,type:e,part:n,onShift:s}){const{calendar:r,formats:i}=c.useContext(Ie).getRaw(),a=t.getFullYear(),l=c.useMemo(()=>{switch(e){case"month":return Je(i.monthYearFormat,r)(t);case"year":return Je(i.yearFormat,r)(t);case"duodecade":{const{start:u,end:h}=cs(a),f=Je(i.yearFormat,r);return`${f(new Date(u,0,1))} - ${f(new Date(h,11,31))}`}default:return""}},[t,e,a,r,i]);function d(){s&&s({diff:0,type:e})}return o.jsxs("div",{className:"wx-8HQVQV wx-header",children:[n!=="right"?o.jsx("i",{className:"wx-8HQVQV wx-pager wxi-angle-left",onClick:()=>s&&s({diff:-1,type:e})}):o.jsx("span",{className:"wx-8HQVQV wx-spacer"}),o.jsx("span",{className:"wx-8HQVQV wx-label",onClick:d,children:l}),n!=="left"?o.jsx("i",{className:"wx-8HQVQV wx-pager wxi-angle-right",onClick:()=>s&&s({diff:1,type:e})}):o.jsx("span",{className:"wx-8HQVQV wx-spacer"})]})}function an({onClick:t,children:e}){return o.jsx("button",{className:"wx-3s8W4d wx-button",onClick:t,children:e})}function Or({value:t,current:e,part:n="",markers:s=null,css:r="",onCancel:i,onChange:a}){const l=(c.useContext(Ie)||Rt()).getRaw().calendar,d=(l.weekStart||7)%7,u=l.dayShort.slice(d).concat(l.dayShort.slice(0,d)),h=(C,$,b)=>new Date(C.getFullYear(),C.getMonth()+($||0),C.getDate()+(b||0));let f=n!=="normal";function x(C){const $=C.getDay();return $===0||$===6}function m(){const C=h(e,0,1-e.getDate());return C.setDate(C.getDate()-(C.getDay()-(d-7))%7),C}function p(){const C=h(e,1,-e.getDate());return C.setDate(C.getDate()+(6-C.getDay()+d)%7),C}const g=c.useRef(0);function y(C,$){$.timeStamp!==g.current&&(g.current=$.timeStamp,$.stopPropagation(),a&&a(new Date(C)),i&&i())}const v=c.useMemo(()=>n=="normal"?[t?h(t).valueOf():0]:t?[t.start?h(t.start).valueOf():0,t.end?h(t.end).valueOf():0]:[0,0],[n,t]),w=c.useMemo(()=>{const C=m(),$=p(),b=e.getMonth();let E=[];for(let P=C;P<=$;P.setDate(P.getDate()+1)){const k={day:P.getDate(),in:P.getMonth()===b,date:P.valueOf()};let D="";if(D+=k.in?"":" wx-inactive",D+=v.indexOf(k.date)>-1?" wx-selected":"",f){const N=k.date==v[0],O=k.date==v[1];N&&!O?D+=" wx-left":O&&!N&&(D+=" wx-right"),k.date>v[0]&&k.date<v[1]&&(D+=" wx-inrange")}if(D+=x(P)?" wx-weekend":"",s){const N=s(P);N&&(D+=" "+N)}E.push({...k,css:D})}return E},[e,v,f,s]),j=c.useRef(null);let R=c.useRef({});return R.current.click=y,c.useEffect(()=>{Xe(j.current,R.current)},[]),o.jsxs("div",{className:`wx-398RBS wx-month ${r}`,children:[o.jsx("div",{className:"wx-398RBS wx-weekdays",children:u.map(C=>o.jsx("div",{className:"wx-398RBS wx-weekday",children:C},C))}),o.jsx("div",{className:"wx-398RBS wx-days",ref:j,children:w.map(C=>o.jsx("div",{className:`wx-398RBS wx-day ${C.css} ${C.in?"":"wx-out"}`,"data-id":C.date,children:C.day},C.date))})]})}function Pr({value:t,current:e,part:n,onCancel:s,onChange:r,onShift:i}){const a=c.useRef(new Date),[l,d]=Oe(t||a.current),[u,h]=Oe(e||a.current),f=c.useContext(Ie).getRaw().calendar,x=f.monthShort||[],m=c.useMemo(()=>u.getMonth(),[u]),p=c.useCallback((v,w)=>{if(v!=null){w.stopPropagation();const j=new Date(u);j.setMonth(v),h(j),i&&i({current:j})}n==="normal"&&d(new Date(u)),s&&s()},[u,n,i,s]),g=c.useCallback(()=>{const v=new Date(xs(l,n)||u);v.setMonth(u.getMonth()),v.setFullYear(u.getFullYear()),r&&r(v)},[l,u,n,r]),y=c.useCallback(v=>{const w=v.target.closest("[data-id]");if(w){const j=parseInt(w.getAttribute("data-id"),10);p(j,v)}},[p]);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-34U8T8 wx-months",onClick:y,children:x.map((v,w)=>o.jsx("div",{className:"wx-34U8T8 wx-month"+(m===w?" wx-current":""),"data-id":w,children:v},w))}),o.jsx("div",{className:"wx-34U8T8 wx-buttons",children:o.jsx(an,{onClick:g,children:f.done})})]})}const zt="wx-1XEF33",Hr=({value:t,current:e,onCancel:n,onChange:s,onShift:r,part:i})=>{const a=c.useContext(Ie).getRaw().calendar,[l,d]=Oe(e),[u,h]=Oe(t),f=c.useMemo(()=>l.getFullYear(),[l]),x=c.useMemo(()=>{const{start:v,end:w}=cs(f),j=[];for(let R=v;R<=w;++R)j.push(R);return j},[f]),m={click:p};function p(v,w){if(v){w.stopPropagation();const j=new Date(l);j.setFullYear(v),d(j),r&&r({current:j})}i==="normal"&&h(new Date(l)),n&&n()}function g(){const v=new Date(xs(u,i)||l);v.setFullYear(l.getFullYear()),s&&s(v)}const y=c.useRef(null);return c.useEffect(()=>{y.current&&Xe(y.current,m)},[]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:zt+" wx-years",ref:y,children:x.map((v,w)=>o.jsx("div",{className:zt+` wx-year ${f==v?"wx-current":""} ${w===0?"wx-prev-decade":""} ${w===11?"wx-next-decade":""}`,"data-id":v,children:v},w))}),o.jsx("div",{className:zt+" wx-buttons",children:o.jsx(an,{onClick:g,children:a.done})})]})},Pn={month:{component:Or,next:zr,prev:Lr},year:{component:Pr,next:Gr,prev:Br},duodecade:{component:Hr,next:Yr,prev:Vr}};function Lr(t){return t=new Date(t),t.setMonth(t.getMonth()-1),t}function zr(t){return t=new Date(t),t.setMonth(t.getMonth()+1),t}function Br(t){return t=new Date(t),t.setFullYear(t.getFullYear()-1),t}function Gr(t){return t=new Date(t),t.setFullYear(t.getFullYear()+1),t}function Vr(t){return t=new Date(t),t.setFullYear(t.getFullYear()-10),t}function Yr(t){return t=new Date(t),t.setFullYear(t.getFullYear()+10),t}function xs(t,e){let n;if(e==="normal")n=t;else{const{start:s,end:r}=t;e==="left"?n=s:e=="right"?n=r:n=s&&r}return n}const Kr=["clear","today"];function Wr(t){if(t==="done")return-1;if(t==="clear")return null;if(t==="today")return new Date}function Ur({value:t,current:e,onCurrentChange:n,part:s="normal",markers:r=null,buttons:i,css:a="",onShift:l,onChange:d}){const u=c.useContext(Ie).getGroup("calendar"),[h,f]=c.useState("month"),x=Array.isArray(i)?i:i?Kr:[],m=(w,j)=>{w.preventDefault(),d&&d({value:j})},p=()=>{h==="duodecade"?f("year"):h==="year"&&f("month")},g=w=>{const{diff:j,current:R}=w;if(j===0){h==="month"?f("year"):h==="year"&&f("duodecade");return}if(j){const C=Pn[h];n(j>0?C.next(e):C.prev(e))}else R&&n(R);l&&l()},y=w=>{f("month"),d&&d({select:!0,value:w})},v=c.useMemo(()=>Pn[h].component,[h]);return o.jsx("div",{className:`wx-2Gr4AS wx-calendar ${s!=="normal"&&s!=="both"?"wx-part":""} ${a}`,children:o.jsxs("div",{className:"wx-2Gr4AS wx-wrap",children:[o.jsx(Fr,{date:e,part:s,type:h,onShift:g}),o.jsxs("div",{children:[o.jsx(v,{value:t,current:e,onCurrentChange:n,part:s,markers:r,onCancel:p,onChange:y,onShift:g}),h==="month"&&x.length>0&&o.jsx("div",{className:"wx-2Gr4AS wx-buttons",children:x.map(w=>o.jsx("div",{className:"wx-2Gr4AS wx-button-item",children:o.jsx(an,{onClick:j=>m(j,Wr(w)),children:u(w)})},w))})]})]})})}function ln(t){let{words:e=null,optional:n=!1,children:s}=t,r=c.useContext(Ie);const i=c.useMemo(()=>{let a=r;return(!a||!a.extend)&&(a=ot(ds)),e!==null&&(a=a.extend(e,n)),a},[e,n,r]);return o.jsx(Ie.Provider,{value:i,children:s})}function Hn(t,e,n,s){if(!t||s){const r=e?new Date(e):new Date;r.setDate(1),n(r)}else if(t.getDate()!==1){const r=new Date(t);r.setDate(1),n(r)}}const qr=["clear","today"];function ps({value:t,current:e,markers:n=null,buttons:s=qr,css:r="",onChange:i}){const[a,l]=Oe(t),[d,u]=Oe(e);c.useEffect(()=>{Hn(d,a,u,!1)},[a,d]);const h=c.useCallback(x=>{const m=x.value;m?(l(new Date(m)),Hn(d,new Date(m),u,!0)):l(null),i&&i({value:m?new Date(m):null})},[i,d]),f=c.useCallback(x=>{u(x)},[u]);return d?o.jsx(ln,{children:o.jsx(Ur,{value:a,current:d,markers:n,buttons:s,css:r,onChange:h,onCurrentChange:f})}):null}function Jr(t){return t||(t={}),t.width||(t.width="unset"),t}const Qr=["clear","today"];function Zr({value:t,id:e,disabled:n=!1,error:s=!1,placeholder:r="",format:i="",buttons:a=Qr,css:l="",title:d="",tooltip:u,editable:h=!1,clear:f=!1,onChange:x,dropdown:m={}}){const{calendar:p,formats:g}=(c.useContext(Ie)||Rt()).getRaw(),y=i||g?.dateFormat;let v=typeof y=="function"?y:Je(y,p);const[w,j]=c.useState(t),[R,C]=c.useState(!1);c.useEffect(()=>{j(t)},[t]);function $(){C(!1)}function b(k){const D=k===w||k&&w&&k.valueOf()===w.valueOf()||!k&&!w;j(k),D||x&&x({value:k}),setTimeout($,1)}const E=c.useMemo(()=>w?v(w):"",[w,v]);function P({value:k,input:D}){if(!h&&!f||D)return;let N=typeof h=="function"?h(k):k?new Date(k):null;N=isNaN(N)?w||null:N||null,b(N)}return c.useEffect(()=>{const k=$;return window.addEventListener("scroll",k),()=>window.removeEventListener("scroll",k)},[]),o.jsxs("div",{className:"wx-1lKOFG wx-datepicker",onClick:()=>C(!0),children:[o.jsx(on,{css:`wx-date-input ${l}`,title:d,tooltip:u,value:E,id:e,readonly:!h,disabled:n,error:s,placeholder:r,onInput:$,onChange:P,icon:"wxi-calendar",clear:f}),R&&!n&&o.jsx(rn,{onCancel:$,...Jr(m),children:o.jsx(ps,{buttons:a,value:w,onChange:k=>b(k.value)})})]})}function Xr({value:t="",options:e=[],textOptions:n=null,placeholder:s="",disabled:r=!1,error:i=!1,title:a="",tooltip:l,textField:d="label",clear:u=!1,css:h="",children:f,onChange:x,dropdown:m={}}){const p=c.useRef(null),g=c.useRef(null);let[y,v]=Oe(t);function w(b){p.current=b.navigate,g.current=b.keydown}const j=c.useMemo(()=>y||y===0?(n||e).find(b=>b.id===y):null,[y,n,e]),R=c.useCallback(({id:b})=>{(b||b===0)&&(v(b),p.current(null),x&&x({value:b}))},[v,x]),C=c.useCallback(b=>{b.stopPropagation(),v(""),x&&x({value:""})},[v,x]),$=c.useCallback(()=>e.findIndex(b=>b.id===y),[e,y]);return o.jsxs("div",{className:`wx-2YgblL wx-richselect ${h} ${i?"wx-2YgblL wx-error":""} ${r?"wx-2YgblL wx-disabled":""} ${f?"":"wx-2YgblL wx-nowrap"}`,title:a,onClick:()=>p.current($()),onKeyDown:b=>g.current(b,$()),tabIndex:0,"data-tooltip-text":l,children:[o.jsx("div",{className:"wx-2YgblL wx-label",children:j?f?f(j):j[d]:s?o.jsx("span",{className:"wx-2YgblL wx-placeholder",children:s}):" "}),u&&!r&&y?o.jsx("i",{className:"wx-2YgblL wx-icon wxi-close",onClick:C}):o.jsx("i",{className:"wx-2YgblL wx-icon wxi-angle-down"}),!r&&o.jsx($t,{items:e,onReady:w,onSelect:R,...m,children:({option:b})=>f?f(b):b[d]})]})}const ei=({options:t=[],value:e="",css:n="",children:s,onChange:r})=>{const[i,a]=c.useState(e),l=d=>{a(d),r&&r({value:d})};return c.useEffect(()=>{a(e)},[e]),o.jsx("div",{className:`wx-0hMO7P wx-segmented ${n}`,children:t.map(d=>o.jsx("button",{className:`wx-0hMO7P wx-segment ${d.css} ${d.id===i?"wx-selected":""}`,title:d.title,onClick:()=>l(d.id),"data-tooltip-text":d.tooltip,children:s?Xt(s,{option:d}):o.jsxs(o.Fragment,{children:[d.icon&&o.jsx("i",{className:`wx-0hMO7P wx-icon ${d.icon} ${d.label?"":"wx-only"}`}),d.label&&o.jsx("span",{className:"wx-0hMO7P wx-label",children:d.label})]})},d.id))})};function ti({notice:t={}}){function e(){t.remove&&t.remove()}return o.jsxs("div",{className:`wx-11sNg5 wx-notice wx-${t.type?t.type:""}`,role:"status","aria-live":"polite",children:[o.jsx("div",{className:"wx-11sNg5 wx-text",children:t.text}),o.jsx("div",{className:"wx-11sNg5 wx-button",children:o.jsx("i",{className:"wx-11sNg5 wxi-close",onClick:e})})]})}function ni({data:t=[]}){return o.jsx("div",{className:"wx-3nwoO9 wx-notices",children:t.map(e=>o.jsx(ti,{notice:e},e.id))})}function Kt({title:t="",buttons:e=["cancel","ok"],header:n,children:s,footer:r,css:i="",onConfirm:a,onCancel:l}){const d=(c.useContext(Ie)||Rt()).getGroup("core"),u=c.useRef(null);c.useEffect(()=>{u.current?.focus()},[]);function h(x){switch(x.code){case"Enter":{const m=x.target.tagName;if(m==="TEXTAREA"||m==="BUTTON")return;a&&a({event:x});break}case"Escape":l&&l({event:x});break}}function f(x,m){const p={event:x,button:m};m==="cancel"?l&&l(p):a&&a(p)}return o.jsx("div",{className:`wx-1FxkZa wx-modal ${i}`,ref:u,tabIndex:0,onKeyDown:h,children:o.jsxs("div",{className:"wx-1FxkZa wx-window",children:[n||(t?o.jsx("div",{className:"wx-1FxkZa wx-header",children:t}):null),o.jsx("div",{children:s}),r||e&&o.jsx("div",{className:"wx-1FxkZa wx-buttons",children:e.map(x=>o.jsx("div",{className:"wx-1FxkZa wx-button",children:o.jsx(st,{type:`block ${x==="ok"?"primary":"secondary"}`,onClick:m=>f(m,x),children:d(x)})},x))})]})})}function si({children:t},e){const[n,s]=c.useState(null),[r,i]=c.useState([]);return c.useImperativeHandle(e,()=>({showModal:a=>{const l={...a};return s(l),new Promise((d,u)=>{l.resolve=h=>{s(null),d(h)},l.reject=h=>{s(null),u(h)}})},showNotice:a=>{a={...a},a.id=a.id||tn(),a.remove=()=>i(l=>l.filter(d=>d.id!==a.id)),a.expire!=-1&&setTimeout(a.remove,a.expire||5100),i(l=>[...l,a])}}),[]),o.jsxs(o.Fragment,{children:[t,n&&o.jsx(Kt,{title:n.title,buttons:n.buttons,onConfirm:n.resolve,onCancel:n.reject,children:n.message}),o.jsx(ni,{data:r})]})}const ri=c.forwardRef(si);function ii(t){let{children:e}=t,n=c.useRef();const s=c.useMemo(()=>({showNotice:r=>n.current.showNotice(r),showModal:r=>n.current.showModal(r)}),[]);return o.jsx(us.Provider,{value:s,children:o.jsx(ri,{ref:n,children:e})})}const oi=({value:t=!1,type:e="",icon:n="",disabled:s=!1,iconActive:r="",onClick:i,title:a="",tooltip:l,css:d="",text:u="",textActive:h="",children:f,active:x,onChange:m})=>{const[p,g]=Oe(t),y=c.useMemo(()=>(p?"pressed":"")+(e?" "+e:""),[p,e]),v=c.useCallback(w=>{let j=!p;i&&i(w),w.defaultPrevented||(g(j),m&&m({value:j}))},[p,i,m]);return p&&x?o.jsx(st,{title:a,tooltip:l,text:p&&h||u,css:d,type:y,icon:p&&r||n,onClick:v,disabled:s,children:Xt(x,{value:p})}):f?o.jsx(st,{title:a,tooltip:l,text:p&&h||u,css:d,type:y,icon:p&&r||n,onClick:v,disabled:s,children:f}):o.jsx(st,{title:a,tooltip:l,text:p&&h||u,css:d,type:y,icon:p&&r||n,onClick:v,disabled:s})};function ai(){return o.jsx(o.Fragment,{})}function Ln(t){const{fonts:e=!0,children:n}=t;return o.jsx(nn.Provider,{value:"willow",children:o.jsxs(o.Fragment,{children:[n&&n&&o.jsx("div",{className:"wx-theme wx-willow-theme",children:n}),e&&o.jsxs(o.Fragment,{children:[o.jsx("link",{rel:"preconnect",href:"https://cdn.svar.dev",crossOrigin:"true"}),o.jsx(ai,{}),o.jsx("link",{rel:"stylesheet",href:"https://cdn.svar.dev/fonts/wxi/wx-icons.css"})]})]})})}en(Ce);const cn={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 ms=class{constructor(t){this._nextHandler=null,this._dispatch=t,this.exec=this.exec.bind(this)}async exec(t,e){return this._dispatch(t,e),this._nextHandler&&await this._nextHandler.exec(t,e),e}setNext(t){return this._nextHandler=t}};new Date().valueOf();var li=class{constructor(t){const e={id:0,$level:0,data:[],parent:null},n=new Map;n.set(0,e),this._pool=n,t&&t.length&&this.parse(t,0)}parse(t,e){const n=this._pool;for(let r=0;r<t.length;r++){const i=t[r];i.parent=i.parent||e,i.data=null,n.set(i.id,i)}for(let r=0;r<t.length;r++){const i=t[r],a=n.get(i.parent);a&&(a.data||(a.data=[]),a.data.push(i))}const s=n.get(e);this.setLevel(s,s.$level+1,!1)}add(t,e){const n=this._pool.get(t.parent||0);t.$level=n.$level+1,this._pool.set(t.id,t),n.data?e===-1?n.data=[...n.data,t]:zn(n,e,t):n.data=[t]}addAfter(t,e){if(!e)return this.add(t,-1);const n=this.byId(e),s=this.byId(n.parent),r=yt(s,n.id)+1;t.parent=s.id,t.$level=s.$level+1,this.add(t,r)}remove(t){const e=this._pool.get(t);this._remove(e);const n=this._pool.get(e.parent);n.data=n.data.filter(s=>s.id!=t),this._clearBranch(n)}_remove(t){t.data&&t.data.forEach(e=>this._remove(e)),this._pool.delete(t.id)}update(t,e){let n=this._pool.get(t);const s=this._pool.get(n.parent),r=yt(s,n.id);n={...n,...e},s&&r>=0&&(s.data[r]=n,s.data=[...s.data]),this._pool.set(n.id,n)}move(t,e,n){const s=this._pool.get(t),r=e==="child",i=this._pool.get(n),a=i.$level+(r?1:0);if(!s||!i)return;const l=this._pool.get(s.parent),d=r?i:this._pool.get(i.parent);d.data||(d.data=[]);const u=yt(l,s.id);ci(l,u);const h=r?d.data.length:yt(d,i.id)+(e==="after"?1:0);if(zn(d,h,s),l.id===d.id&&u===h)return null;s.parent=d.id,s.$level!==a&&(s.$level=a,this.setLevel(s,a+1,!0)),this.update(s.id,s),this._clearBranch(l)}_clearBranch(t){t.data&&!t.data.length&&(t.open&&delete t.open,this.update(t.id,{data:null}))}toArray(){const t=[],e=this._pool.get(0).data;return e&&gs(e,t),t}byId(t){return this._pool.get(t)}getBranch(t){return this._pool.get(t).data}forEach(t){this._pool.forEach((e,n)=>{n!==0&&t(e)})}eachChild(t,e){const n=this.byId(e);!n||!n.data||n.data.forEach((s,r)=>{t(this.byId(s.id),r),this.eachChild(t,s.id)})}setLevel(t,e,n){t.data&&(t.data=t.data.map(s=>(n&&(s={...s},this._pool.set(s.id,s)),s.$level=e,s.data&&this.setLevel(s,e+1,n),s)))}};function gs(t,e){t.forEach(n=>{e.push(n),n.open===!0&&gs(n.data,e)})}function ci(t,e){const n=[...t.data];n.splice(e,1),t.data=n}function zn(t,e,n){const s=[...t.data];s.splice(e,0,n),t.data=s}function yt(t,e){return t?.data.findIndex(n=>n.id===e)}var ws=2,di=class{constructor(e){e&&(this._writable=e.writable,this._async=e.async),this._values={},this._state={}}setState(e,n=0){const s={};return this._wrapProperties(e,this._state,this._values,"",s,n),s}getState(){return this._values}getReactive(){return this._state}_wrapProperties(e,n,s,r,i,a){for(const l in e){const d=n[l],u=s[l],h=e[l];if(d&&(u===h&&typeof h!="object"||h instanceof Date&&u instanceof Date&&u.getTime()===h.getTime()))continue;const f=r+(r?".":"")+l;d?(d.__parse(h,f,i,a)&&(s[l]=h),a&ws?i[f]=d.__trigger:d.__trigger()):(h&&h.__reactive?n[l]=this._wrapNested(h,h,f,i):n[l]=this._wrapWritable(h),s[l]=h),i[f]=i[f]||null}}_wrapNested(e,n,s,r){const i=this._wrapWritable(e);return this._wrapProperties(e,i,n,s,r,0),i.__parse=(a,l,d,u)=>(this._wrapProperties(a,i,n,l,d,u),!1),i}_wrapWritable(e){const n=[],s=function(){for(let r=0;r<n.length;r++)n[r](e)};return{subscribe:r=>(n.push(r),this._async?setTimeout(r,1,e):r(e),()=>{const i=n.indexOf(r);i>=0&&n.splice(i,1)}),__trigger:()=>{n.length&&(this._async?setTimeout(s,1):s())},__parse:function(r){return e=r,!0}}}};function Bn(t,e){return Object.defineProperty(t,"__reactive",{value:!0,enumerable:!1,writable:!1}),t}var ui=class{constructor(e,n,s,r){typeof e=="function"?this._setter=e:this._setter=e.setState.bind(e),this._routes=n,this._parsers=s,this._prev={},this._triggers=new Map,this._sources=new Map,this._routes.forEach(i=>{i.in.forEach(a=>{const l=this._triggers.get(a)||[];l.push(i),this._triggers.set(a,l)}),i.out.forEach(a=>{const l=this._sources.get(a)||{};i.in.forEach(d=>l[d]=!0),this._sources.set(a,l)})}),this._routes.forEach(i=>{i.length=Math.max(...i.in.map(a=>vs(a,this._sources,1)))}),this._bus=r}init(e){const n={};for(const s in e)if(this._prev[s]!==e[s]){const r=this._parsers[s];n[s]=r?r(e[s]):e[s]}this._prev=this._prev?{...this._prev,...e}:{...e},this.setState(n),this._bus&&this._bus.exec("init-state",n)}setStateAsync(e){const n=this._setter(e,ws);return this._async?Object.assign(this._async.signals,n):this._async={signals:n,timer:setTimeout(this._applyState.bind(this),1)},n}_applyState(){const e=this._async;if(e){this._async=null,this._triggerUpdates(e.signals,[]);for(const n in e.signals){const s=e.signals[n];s&&s()}}}setState(e,n=[]){const s=this._setter(e);return this._triggerUpdates(s,n),s}_triggerUpdates(e,n){const s=Object.keys(e),r=!n.length;n=n||[];for(let i=0;i<s.length;i++){const a=s[i],l=this._triggers.get(a);l&&l.forEach(d=>{n.indexOf(d)==-1&&n.push(d)})}r&&this._execNext(n)}_execNext(e){for(;e.length;){e.sort((s,r)=>s.length<r.length?1:-1);const n=e[e.length-1];e.splice(e.length-1),n.exec(e)}}};function vs(t,e,n){const s=e.get(t);if(!s)return n;const r=Object.keys(s).map(i=>vs(i,e,n+1));return Math.max(...r)}var fi=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=new WeakMap,this.exec=this.exec.bind(this)}on(e,n,s){let r=this._handlers[e];r?s&&s.intercept?r.unshift(n):r.push(n):r=this._handlers[e]=[n],s&&s.tag&&this._tag.set(n,s.tag)}intercept(e,n,s){this.on(e,n,{...s,intercept:!0})}detach(e){for(const n in this._handlers){const s=this._handlers[n];for(let r=s.length-1;r>=0;r--)this._tag.get(s[r])===e&&s.splice(r,1)}}async exec(e,n){const s=this._handlers[e];if(s)for(let r=0;r<s.length;r++){const i=s[r](n);if(i===!1||i&&i.then&&await i===!1)return}return this._nextHandler&&await this._nextHandler.exec(e,n),n}setNext(e){return this._nextHandler=e}};const qe=1024;function it(t){return t<qe?`${t} B`:t<qe**2?`${(t/qe).toFixed(1)} KB`:t<qe**3?`${(t/qe**2).toFixed(1)} MB`:`${(t/qe**3).toFixed(1)} GB`}function Gn(t,e){e||(e={key:"name",order:"asc"});const n=t.filter(a=>a.type==="folder"),s=t.filter(a=>a.type!=="folder"),r=n.sort(Vn(e)),i=s.sort(Vn(e));return[...r,...i]}function hi(t,e){return typeof t=="string"?t.localeCompare(e,void 0,{numeric:!0}):typeof t=="object"?t.getTime()-e.getTime():(t??0)-(e??0)}function xi(t,e){return typeof t=="string"?-t.localeCompare(e,void 0,{numeric:!0}):typeof e=="object"?e.getTime()-t.getTime():(e??0)-(t??0)}function Vn({key:t,order:e}){const n=e==="asc"?hi:xi;return(s,r)=>n(s[t],r[t])}function dn(t,e){const n=t==="/"?1:t.split("/").length;return n>=e.length?null:e[n].id}function pi(t){return t.length>1?t[t.length-2].id:null}let mi=class extends li{constructor(e){const n={id:"/",name:"My files",open:!0,$level:1,parent:0,ext:"",type:"folder"};super([n]),this.parse(e,"/")}parse(e,n,s){!e||!e.length||(e.forEach(r=>this.parseId(r,s?n:void 0)),super.parse(e,n))}parseId(e,n){if(e.parent===0)return;const s=e.id,r=s.lastIndexOf("/");if(e.parent=n??(r===0?"/":s.slice(0,r)),e.name=s.slice(r+1),e.type=e.type||"file",e.type!=="folder"){const i=e.name.lastIndexOf("."),a=i!==-1?e.name.slice(i+1):"";e.ext=a!=="new"?a?.toLocaleLowerCase():""}}getParents(e){const n=[];let s=this.byId(e);if(!s)return n;for(;s.id!==0;)n.push(s),s=this.byId(s.parent);return n.reverse()}findFiles(e,n="/"){const s=[],r=e.toLocaleLowerCase();return this.eachChild(i=>{i.name.toLowerCase().indexOf(r)!==-1&&s.push(i)},n),s}add(e,n){const s=this.byId(e.parent||"/"),r=e.data?[...e.data]:null;e.data=null,super.add(e,n??s.data?s.data.length:0),r&&r.forEach(i=>this.add(i))}renameFiles(e,n,s){const r=this.byId(e),i=this.normalizeFile(r,n),a=[];return i.data?.forEach(l=>a.push(this.renameFiles(l.id,i.id,s))),a.length&&(i.data=a),s[e]=i.id,i}copyFiles(e,n,s){const r={};return e.forEach(i=>{const a=this.renameFiles(i,n,r);this.add(a),s&&this.remove(i),r[i]=a.id}),r}moveFiles(e,n){if(this.byId(e[0]).parent!==n)return this.copyFiles(e,n,!0)}serialize(e="/"){const n=[],s=this.byId(e);return s?(s.data?.forEach(r=>{const{id:i,date:a,type:l,size:d,lazy:u}=r,h={id:i,date:a,type:l??"file"};u&&(h.lazy=u),d&&(h.size=d),n.push(h);const f=this.serialize(i);f.length&&n.push(...f)}),n):null}normalizeFile(e,n){const s=e.name,r=s.lastIndexOf("."),i=r!==-1?s.slice(r+1):"",a=i?`.${i}`:"";let l=r!==-1?s.slice(0,r):s,d=n+(n==="/"?"":"/")+l;for(;this.byId(d+a);){const u=".new";d+=u,l+=u}return{...e,id:d+a,name:l+a,parent:n,ext:i.toLocaleLowerCase()}}},gi=class extends di{in;_router;constructor(e){super({writable:e,async:!1});const n=[];for(let i=0;i<2;i++)n.push({in:["data",`panels.${i}.path`],out:[`panels.${i}._crumbs`],exec:a=>{const{data:l,panels:d}=this.getState(),u=[];u[i]={_crumbs:l.getParents(d[i].path)},this.setState({panels:u},a)}}),n.push({in:["data",`panels.${i}.path`,`panels.${i}._sorts`,"search"],out:[`panels.${i}._files`],exec:a=>{const{data:l,panels:d,search:u}=this.getState();let h;u?h=l.findFiles(u,d[i].path):h=l.byId(d[i].path)?.data||[];const{path:f,_sorts:x}=d[i];h=Gn(h,x[f]);const m=[];m[i]={_files:h},this.setState({panels:m},a)}}),n.push({in:["data",`panels.${i}.selected`,`panels.${i}._sorts`],out:[`panels.${i}._selected`],exec:a=>{const{data:l,panels:d}=this.getState(),u=[];d[i].selected.forEach(p=>{const g=l.byId(p);g&&u.push(g)});const{path:h,_sorts:f}=d[i],x=Gn(u,f[h]),m=[];m[i]={_selected:x},this.setState({panels:m},a)}});this._router=new ui(super.setState.bind(this),n,{data:i=>new mi(i)});const s=this.in=new fi;s.on("select-file",({id:i,toggle:a,range:l,panel:d,type:u})=>{const{panels:h,activePanel:f}=this.getState();typeof d>"u"&&(d=f),i||(a=l=!1);let x=[...h[d].selected];if(a){const p=x.indexOf(i);p===-1?x.push(i):x.splice(p,1)}else if(l&&h[d]._lastSelected){const p=h[d]._files;let g=p.findIndex(w=>w.id==h[d]._lastSelected),y=p.findIndex(w=>w.id==i);y<g&&([g,y]=[y,g]);const v=p.slice(g,y+1).map(w=>w.id);x=[...new Set([...x,...v])]}else x=i?[i]:[];const m=[];m[d]={selected:x,_lastSelected:i,_selectNavigation:u==="navigation"},this.setState({panels:m})}),s.on("set-path",({id:i,panel:a,selected:l})=>{const{data:d,activePanel:u}=this.getState(),h=d.byId(i);if(h){const f=[];typeof a>"u"&&(a=u),f[a]={path:i},this.setState({panels:f}),s.exec("select-file",{panel:a}),l&&l.forEach(x=>s.exec("select-file",{id:x,panel:a,toggle:!0})),h.lazy&&s.exec("request-data",{id:i})}}),s.on("provide-data",({id:i,data:a})=>{const{mode:l,data:d}=this.getState(),u=d.byId(i);u&&(u.lazy||(u.data=[]),u.lazy=!1,d.parse(a,i,l==="search"),this.setState({data:d}))}),s.on("open-tree-folder",({id:i,mode:a})=>{const{data:l}=this.getState();l.update(i,{open:a}),this.setState({data:l})}),s.on("show-preview",({mode:i})=>{this.setState({preview:i})}),s.on("rename-file",i=>{const{id:a,name:l}=i,{data:d,panels:u}=this.getState(),h=d.byId(a);if(h.name!==l){h.name=l;const f=d.normalizeFile(h,h.parent);i.newId=f.id,f.data=null,d.add(f);let x={[a]:f.id};h.data?.forEach(p=>x={...d.moveFiles([p.id],f.id),...x});const m=u.map(p=>({selected:p.selected,_crumbs:p._crumbs,_lastSelected:p._lastSelected,_sorts:p._sorts}));d.remove(a),this._updatePanels(m,x),this.setState({data:d,panels:m})}}),s.on("create-file",i=>{const{file:a,parent:l}=i,{data:d}=this.getState(),u=d.normalizeFile(a,l);u.type=a.type||"file",i.newId=u.id,d.add(u),this.setState({data:d}),s.exec("select-file",{id:u.id})}),s.on("delete-files",({ids:i})=>{const{data:a,panels:l}=this.getState(),d=l.map(u=>({selected:u.selected,_crumbs:u._crumbs,_lastSelected:u._lastSelected,_sorts:u._sorts}));i.forEach(u=>a.remove(u)),this._updatePanels(d,{}),this.setState({data:a,panels:d})}),s.on("copy-files",i=>{const{ids:a,target:l}=i;if(this._isPlacedIntoSelf(a,l)){console.error("You cannot copy a folder into itself"),i.skipProvider=!0;return}const{data:d,panels:u,activePanel:h}=this.getState(),f=d.copyFiles(a,l);i.newIds=a.map(x=>f[x]),this.setState({data:d}),u[h].path==l&&(s.exec("select-file",{}),a.forEach(x=>{s.exec("select-file",{id:f[x],toggle:!0})}))}),s.on("move-files",i=>{const{ids:a,target:l}=i;if(this._isPlacedIntoSelf(a,l)){console.error("You cannot move a folder into itself"),i.skipProvider=!0;return}const{data:d,panels:u,activePanel:h}=this.getState(),f=d.moveFiles(a,l);if(f){i.newIds=a.map(m=>f[m]);const x=u.map(m=>({selected:m.selected,_crumbs:m._crumbs,_lastSelected:m._lastSelected,_sorts:m._sorts}));this._updatePanels(x,f,!0),this.setState({data:d,panels:x}),u[h].path==l&&(s.exec("select-file",{}),a.forEach(m=>{s.exec("select-file",{id:f[m],toggle:!0})}))}});let r=null;s.on("filter-files",({text:i})=>{if(!i){r&&this.setState({...r});return}s.exec("select-file",{});const{panels:a,mode:l}=this.getState();r||(r={panels:a,mode:l,search:""}),this.setState({mode:"search",search:i})}),s.on("set-mode",({mode:i})=>{const{activePanel:a}=this.getState(),l=[];l[a]={_selectNavigation:!1};const d={mode:i,search:"",panels:l};r=null,this.setState(d)}),s.on("set-active-panel",({panel:i})=>{this.setState({activePanel:i})}),s.on("sort-files",({key:i,order:a,panel:l,path:d})=>{const{activePanel:u,panels:h}=this.getState();l=l??u,d=d??h[l].path;const f=[];f[l]={_sorts:{...h[l]._sorts,[d]:{key:i,order:a}}},this.setState({panels:f})}),this.initOnce()}initOnce(){const e=[];for(let s=0;s<2;s++)e[s]=Bn({_crumbs:[],_files:[],_selected:[],_sorts:{},path:"/",selected:[],...e[s]});const n={panels:Bn(e),data:[],search:""};this._router.init(n)}init(e){const n={...e};this._router.init(n)}setState(e,n){return this._router.setState(e,n)}getFile(e){const{data:n}=this.getState();return n.byId(e)||null}serialize(e){const{data:n}=this.getState();return n.serialize(e)}_updatePanels(e,n,s){const{data:r}=this.getState();e.forEach(i=>{const a=[];i.selected.forEach(u=>{r.byId(u)?a.push(u):!s&&n[u]&&a.push(n[u])}),i.selected=a,r.byId(i._lastSelected)||(i._lastSelected=s?null:n[i._lastSelected]||null);const l={};Object.keys(i._sorts).forEach(u=>{r.byId(u)?l[u]=i._sorts[u]:n[u]&&!s&&(l[n[u]]=i._sorts[u])}),i._sorts=l;const d=i._crumbs[i._crumbs.length-1];d?.id!=="/"&&(n[d.id]?i.path=n[d.id]:r.byId(d.id)||(i.path="/"))})}_isPlacedIntoSelf(e,n){return e.some(s=>s===n||this.getState().data.getParents(n).some(r=>r.id===s))}};function wi(t){switch(t){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[t==="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(e=>e!==null)}}function vi(t,e="data-id"){let n=t;for(!n.tagName&&t.target&&(n=t.target);n;){if(n.getAttribute&&n.getAttribute(e))return n;n=n.parentNode}return null}function yi(t,e="data-id"){const n=vi(t,e);return n?n.getAttribute(e):null}new Date().valueOf();function bi(t,e){const{api:n}=e;function s(i,a){const l=e.getPanel(),d=l.selected,u=a.ctrlKey||a.metaKey,h=a.shiftKey;let f;const x=d?.[0]?n.getFile(d[0]):null;d?.length?d.length>1?f=e.menuOptions("multiselect"):f=e.menuOptions(x.type,x):f=e.menuOptions("body");const m=`${u?"ctrl+":""}${h?"shift+":""}${i}`,p=f?f.find(y=>y.hotkey?.toLowerCase()===m):!1,g=e.performAction;if(p)switch(m){case"ctrl+c":g("copy");break;case"ctrl+x":g("move");break;case"ctrl+v":g("paste",x);break;case"delete":g("delete");break;case"ctrl+r":a.preventDefault(),g("rename",x);break;case"ctrl+d":a.preventDefault(),g("download",x);break;default:p.handler?.({context:x})}switch(i){case"enter":{if(u||h)break;const{_crumbs:y,_selectNavigation:v}=l;if(v){const w=pi(y);if(w){const j=dn(w,y);n.exec("set-path",{id:w,selected:[j]})}}else if(d.length===1){const w=n.getFile(d[0]);w&&n.exec(w.type==="folder"?"set-path":"open-file",{id:w.id})}break}case"arrowup":case"arrowleft":{const{_files:y,_selected:v,path:w,_selectNavigation:j}=l;let R;if(v.length){const C=v.at(0).id,$=y.findIndex(b=>b.id===C);if($!==-1){const b=$-1;y[b]?R=y[b].id:w!=="/"&&!(u||h)&&n.exec("select-file",{type:"navigation"})}}else{if(j)break;if(w!=="/"){n.exec("select-file",{type:"navigation"});break}R=y.at(0)?.id}R&&n.exec("select-file",{id:R,toggle:u,range:h});break}case"arrowdown":case"arrowright":{const{_files:y,_selected:v,path:w,_selectNavigation:j}=l;let R;if(v.length){const C=v.at(-1).id,$=y.findIndex(b=>b.id===C);if($!==-1){const b=$+1;y[b]&&(R=y[b].id)}}else{if(w!=="/"&&!j){n.exec("select-file",{type:"navigation"});break}R=y.at(0)?.id}R&&n.exec("select-file",{id:R,toggle:u,range:h});break}}}function r(i){const a=i.code.replace("Key","").toLowerCase();s(a,i),a=="tab"&&setTimeout(()=>{const l=document.activeElement;l.className.indexOf("table")!=-1&&n.exec("set-active-panel",{panel:+yi(l,"data-panel")})})}return t.addEventListener("keydown",r),{destroy:()=>{t.removeEventListener("keydown",r)}}}function ji(t,e="data-id"){let n=t;for(!n.tagName&&t.target&&(n=t.target);n;){if(n.getAttribute&&n.getAttribute(e))return n;n=n.parentNode}return null}function Si(t,e="data-id"){const n=t.getAttribute(e);return n?Ci(n):null}function Ci(t){if(t.startsWith(":"))return t.substring(1);const e=t*1;return isNaN(e)?t:e}function ki(){return{detect:()=>!0,addEvent:function(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)},addGlobalEvent:function(t,e){return document.addEventListener(t,e),()=>document.removeEventListener(t,e)},getTopNode:function(){return window.document.body}}}var Ni=ki();new Date().valueOf();function ys(t){const[e,n]=c.useState(t),s=c.useRef(t);return c.useEffect(()=>{if(s.current!==t){if(Array.isArray(s.current)&&Array.isArray(t)&&s.current.length===0&&t.length===0)return;s.current=t,n(t)}},[t]),[e,n]}function _i(t,e,n){const[s,r]=c.useState(()=>e);return t||console.warn(`Writable ${n} is not defined`),c.useEffect(()=>t?t.subscribe(a=>{r(()=>a)}):void 0,[t]),s}function W(t,e){const n=t.getState(),s=t.getReactiveState();return _i(s[e],n[e],e)}function Ri(t,e){const n=c.useRef(e);n.current=e;const[s,r]=c.useState(1);return c.useEffect(()=>t.subscribe(a=>{n.current=a,r(l=>l+1)}),[t]),[n.current,s]}function Ee(t,e){const n=t.getState(),s=t.getReactiveState();return Ri(s[e],n[e])}function bs(t){const e={};return t.split(";").forEach(n=>{const[s,r]=n.split(":");if(r){let i=s.trim();i.indexOf("-")&&(i=i.replace(/-([a-z])/g,(a,l)=>l.toUpperCase())),e[i]=r.trim()}}),e}function js(t){let e=t,n=[];return{subscribe:l=>{n.push(l),l(e)},unsubscribe:l=>{n=n.filter(d=>d!==l)},set:l=>{e=l,n.forEach(d=>d(e))},update:l=>{e=l(e),n.forEach(d=>d(e))}}}function Yn(t,e,n){function s(r){const i=ji(r);if(!i)return;const a=Si(i);if(typeof e=="function")return e(a,r);let l,d=r.target;for(;d!=i;){if(l=d.dataset?d.dataset.action:null,l&&e[l]){e[l](a,r);return}d=d.parentNode}e[n]&&e[n](a,r)}return Ni.addEvent(t,n,s)}function $i(t,e){const n=[Yn(t,e,"click")];return e.dblclick&&n.push(Yn(t,e.dblclick,"dblclick")),()=>{n.forEach(s=>s())}}function Ss(t,e){return t.map((n,s)=>{const r=e(n,s);return n.data&&n.data.length&&(r.data=Ss(n.data,e)),r}).filter(Boolean)}function Cs(t,e){const n=[];return t.forEach(s=>{if(s.data){const r=Cs(s.data,e);r.length&&n.push({...s,data:r})}else e(s)&&n.push(s)}),n}function Ei(t){return Ss(t,(e,n)=>{const s={...e,id:e.id||tn()};return s.type&&(s.comp=s.type),s.comp==="separator"&&t[n-1]?.comp==="separator"?null:s})}const ks={};function Mi(t){return ks[t]||t}function Di(t,e){ks[t]=e}function Ai({onClick:t,onShow:e,option:n}){const s=c.useRef(null),r=c.useCallback(()=>{e(n.data?n.id:!1,s.current)},[e,n]),i=c.useCallback(l=>{if(n.data){l.stopPropagation(),e(n.id,s.current);return}t(l)},[t,e,n]),a=c.useMemo(()=>n&&n.comp?Mi(n.comp):null,[n]);return o.jsxs("div",{ref:s,className:`wx-cDCz9rZQ wx-option ${n.css||""} ${n.disabled?"wx-disabled":""}`,"data-id":ge(n.id),onMouseEnter:r,onClick:i,children:[n.icon?o.jsx("i",{className:`wx-cDCz9rZQ wx-icon ${n.icon}`}):null,n.comp?a?o.jsx(a,{item:n,option:n}):null:o.jsxs("span",{className:"wx-cDCz9rZQ wx-value",children:[" ",n.text," "]}),n.subtext?o.jsx("span",{className:"wx-cDCz9rZQ wx-subtext",children:n.subtext}):null,n.data?o.jsx("i",{className:"wx-cDCz9rZQ wx-sub-icon wxi-angle-right"}):null]})}function un({options:t,left:e=0,top:n=0,at:s="bottom",parent:r=null,mount:i=null,context:a=null,css:l="",onClick:d,onCancel:u}){const[h,f]=c.useState(-1e4),[x,m]=c.useState(-1e4),[p,g]=c.useState(20),[y,v]=c.useState(),w=c.useRef(null),[j,R]=c.useState(!1),[C,$]=c.useState(null),b=c.useCallback(()=>{const M=as(w.current,r,s,e,n);M&&(f(M.x),m(M.y),v(M.width));let H=M?.z??20;const Z=r?br(r):[];let te=0;for(const ce of Z){const de=parseInt(getComputedStyle(ce).zIndex,10);de>te&&(te=de)}te>=H&&(H=te+1),g(H)},[r,s,e,n]);c.useEffect(()=>{i&&i(b)},[]);const E=c.useCallback(()=>{R(!1)},[]),P=c.useCallback((M,H)=>{R(M),$(H)},[]),k=c.useMemo(()=>Ei(t),[t]);c.useEffect(()=>{b()},[r,b]);const D=c.useRef(d),N=c.useRef(u),O=c.useRef(r);return c.useEffect(()=>{D.current=d},[d]),c.useEffect(()=>{N.current=u},[u]),c.useEffect(()=>{O.current=r},[r]),c.useEffect(()=>{if(!w.current)return;function M(H){N.current?N.current(H):D.current&&D.current({action:null,option:null})}return Pe(w.current,{callback:M,modal:!0,parent:()=>O.current}).destroy},[]),o.jsx("div",{ref:w,"data-wx-menu":"true",className:`wx-XMmAGqVx wx-menu ${l}`,style:{position:"absolute",top:x+"px",left:h+"px",width:y,zIndex:p},onMouseLeave:E,children:k.map(M=>o.jsxs(c.Fragment,{children:[M.comp==="separator"?o.jsx("div",{className:"wx-XMmAGqVx wx-separator"}):o.jsx(Ai,{option:M,onShow:P,onClick:H=>{if(!M.data&&!H.defaultPrevented){const Z={context:a,action:M,option:M,event:H};M.handler&&M.handler(Z),d&&d(Z),H.stopPropagation()}}}),M.data&&j===M.id?o.jsx(un,{css:l,options:M.data,at:"right-overlap",parent:C,context:a,onClick:d,onCancel:u}):null]},M.id))})}const Ns=c.forwardRef(function(t,e){const{options:n,at:s="bottom",resolver:r=null,dataKey:i="contextId",filter:a=null,css:l="",children:d,onClick:u}=t,[h,f]=c.useState(null),[x,m]=c.useState(null),[p,g]=c.useState(0),[y,v]=c.useState(0),w=c.useRef(null),j=c.useMemo(()=>`data-${i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,[i]),R=c.useMemo(()=>h!==null&&a?Cs(n,E=>a(E,h)):n,[h,a,n]);function C(E){m(null),u&&u(E)}function $(E){if(w.current===E){w.current=null;return}m(null),u&&u({action:null,option:null})}const b=c.useCallback((E,P)=>{if(!E){m(null);return}if(E.defaultPrevented)return;const k=E.target;if(k&&k.dataset&&k.dataset.menuIgnore)return;if(x&&x===k){m(null),E.preventDefault();return}g(E.clientX+1),v(E.clientY+1);let D=typeof P<"u"?P:rt(k,j);r&&(D=r(D,E),!D)||(f(D),m(k),w.current=E.nativeEvent||E,E.preventDefault())},[x,j,r]);return c.useImperativeHandle(e,()=>({show:b}),[b]),o.jsxs(o.Fragment,{children:[d?o.jsx("span",{onClick:b,"data-menu-ignore":"true",children:typeof d=="function"?d():d}):null,x?o.jsx(sn,{children:o.jsx(un,{css:l,at:s,top:y,left:p,parent:x,context:h,onClick:C,onCancel:$,options:R},x)}):null]})}),Ti=c.forwardRef(function(t,e){const{options:n,at:s="bottom",css:r="",children:i,onClick:a}=t,[l,d]=c.useState(null),u=c.useRef(null);function h(p){d(null),a&&a(p)}function f(p){if(u.current===p){u.current=null;return}d(null),a&&a({action:null,option:null})}const x=c.useCallback(p=>{d(p.target),u.current=p.nativeEvent||p,p.preventDefault()},[]);c.useImperativeHandle(e,()=>({show:x}),[x]);function m(p){let g=p.target;for(;!g.dataset.menuIgnore;)d(g),g=g.parentNode}return o.jsxs(o.Fragment,{children:[o.jsx("span",{onClick:m,"data-menu-ignore":"true",children:i}),l?o.jsx(sn,{children:o.jsx(un,{css:r,at:s,parent:l,options:n,onClick:h,onCancel:f})}):null]})}),Ii=c.forwardRef(function(t,e){const{options:n,at:s="bottom",resolver:r=null,dataKey:i="contextId",filter:a=null,css:l="",children:d,onClick:u}=t,h=c.useRef(null),f=c.useCallback((x,m)=>{h.current.show(x,m)},[]);return c.useImperativeHandle(e,()=>({show:f}),[f]),o.jsxs(o.Fragment,{children:[d?o.jsx("span",{onContextMenu:f,"data-menu-ignore":"true",children:d}):null,o.jsx(Ns,{css:l,at:s,options:n,resolver:r,dataKey:i,filter:a,ref:h,onClick:u})]})}),Fi={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 Oi=class{constructor(e,n,s,r,i){this.setFiles=e,this.setReady=n,this.setSignal=s,this.setDrag=r,i&&i.length&&this.setFiles(i)}open(e){this.setSignal(["click",e||{}])}getState(){let e="server";const n=this.files;for(let s=0;s<n.length;s++){if(n[s].status==="client")return"client";n[s].status==="error"&&(e="error")}return e}droparea(e,n){n=n||{};const s=()=>{n.dragEnter&&n.dragEnter(),this.setDrag(!0)},r=()=>{n.dragLeave&&n.dragLeave(),this.setDrag(!1)},i=l=>{l.preventDefault()},a=l=>{l.preventDefault(),this.setDrag(!1),this.setSignal(["drop",n,l]),n.dragLeave&&n.dragLeave(),n.drop&&n.drop()};return e.addEventListener("dragenter",s),e.addEventListener("dragleave",r),e.addEventListener("dragover",i,!0),e.addEventListener("drop",a,!0),()=>{e.removeEventListener("dragenter",s),e.removeEventListener("dragleave",r),e.removeEventListener("dragover",i,!0),e.removeEventListener("drop",a,!0)}}updateFile(e,n){const s=this.files.findIndex(i=>i.id===e);if(s===-1)return;const r=[...this.files];return r[s]={...r[s],...n},this.files=r,this.setFiles(this.files),this.files[s]}deleteFile(e){this.files=this.files.filter(n=>n.id!==e),this.setFiles(this.files)}addFile(e,n){n?this.files=[...this.files,e]:this.files=[e],this.setFiles(this.files)}deleteAll(){this.files=[],this.setFiles(this.files)}};function _s(t){const[e,n]=c.useState([]),[s,r]=c.useState(Promise.resolve(null)),[i,a]=c.useState(null),[l,d]=c.useState(!1),u=c.useRef();return u.current||(u.current=new Oi(n,r,a,d,t)),u.current.files=e,u.current.ready=s,u.current.signal=i,u.current.drag=l,u.current}function Pi(t,e){{if(t){const n=t.getGroup(e);if(n)return n}return ot(Fi).getGroup(e)}}const Hi=()=>Math.random().toString(36).substr(2,9),Li=({data:t,accept:e="",multiple:n=!0,folder:s=!1,uploadURL:r="",apiOnly:i=!1,disabled:a=!1,children:l,onChange:d,onUpload:u})=>{const h=c.useRef(null),f=c.useRef(null),[x,m]=c.useState({}),p=_s(),g=t||p,y=c.useContext(ve.i18n),v=Pi(y,"uploader");c.useEffect(()=>{h.current&&s&&(h.current.webkitdirectory=!0)},[s]),c.useEffect(()=>{if(!i&&f.current&&!a)return g.droparea(f.current)},[i,a,f]);const w=k=>{const D=new FormData;return D.append("upload",k.file),fetch(r,{method:"POST",body:D}).then(N=>N.json()).then(N=>({id:k.id,...N}),()=>({id:k.id,status:"error"})).catch(N=>(console.log(N),{id:k.id,status:"error"}))},j=(k,D)=>{const N=g.updateFile(k,D),O={...N,status:g.getState()};N&&N.uploaded&&N.uploaded(O),u&&u(O),N.temp&&g.deleteFile(N.id)},R=k=>{if(!k)return;const D=typeof r=="function"?r(k):w(k);g.setReady(D.then(N=>{N.status=N.status||"server",j(k.id,N)}).catch(N=>{j(k.id,{status:"error",error:N})}))},C=(k,D)=>{const N={...D||x,id:Hi(),status:"client",name:k.name,file:k};N.selected&&N.selected(N),d&&d(N),g.addFile(N,n),R(N),h.current&&(h.current.value="")},$=(k,D,N)=>{k.isFile?k.file(O=>{C(O,N)}):k.isDirectory&&k.createReader().readEntries(O=>{O.forEach(M=>{$(M,D+M.name+"/",N)})})},b=k=>{Array.from(k.target.files).forEach(D=>C(D))},E=(k,D)=>{Array.from(k.dataTransfer.items).forEach(N=>{const O=N.webkitGetAsEntry();O&&$(O,"",D)})},P=()=>{h.current&&h.current.click()};return c.useEffect(()=>{if(g.signal){const[k,D,N]=g.signal;m(D),k==="click"?P():k==="drop"&&E(N,D),g.setSignal(null)}},[g.signal]),i?o.jsxs(o.Fragment,{children:[o.jsx("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:h,onChange:b,accept:e,multiple:n,disabled:a}),l]}):o.jsxs("div",{className:`wx-at1A8tb8 wx-label ${g.drag?"wx-active":""} ${a?"wx-disabled":""}`,ref:f,children:[o.jsx("input",{type:"file",className:"wx-at1A8tb8 wx-input",ref:h,onChange:b,accept:e,multiple:n,disabled:a}),l||o.jsx("div",{className:"wx-at1A8tb8 wx-dropzone",children:o.jsxs("span",{children:[v("Drop files here or")," ",o.jsx("span",{className:"wx-at1A8tb8 wx-action",onClick:P,children:v("select files")})]})})]})};new Date().valueOf();function zi(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in e){const s=t[n],r=e[n];if(!Et(s,r))return!1}return!0}function Et(t,e){if(typeof t=="number"||typeof t=="string"||typeof t=="boolean"||t===null)return t===e;if(typeof t!=typeof e||(t===null||e===null)&&t!==e||t instanceof Date&&e instanceof Date&&t.getTime()!==e.getTime())return!1;if(typeof t=="object")if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let n=t.length-1;n>=0;n--)if(!Et(t[n],e[n]))return!1;return!0}else return zi(t,e);return t===e}function Wt(t){if(typeof t!="object"||t===null)return t;if(t instanceof Date)return new Date(t);if(t instanceof Array)return t.map(Wt);const e={};for(const n in t)e[n]=Wt(t[n]);return e}var Rs=2,Bi=class{constructor(t){t&&(this._writable=t.writable,this._async=t.async),this._values={},this._state={}}setState(t,e=0){const n={};return this._wrapProperties(t,this._state,this._values,"",n,e),n}getState(){return this._values}getReactive(){return this._state}_wrapProperties(t,e,n,s,r,i){for(const a in t){const l=e[a],d=n[a],u=t[a];if(l&&(d===u&&typeof u!="object"||u instanceof Date&&d instanceof Date&&d.getTime()===u.getTime()))continue;const h=s+(s?".":"")+a;l?(l.__parse(u,h,r,i)&&(n[a]=u),i&Rs?r[h]=l.__trigger:l.__trigger()):(u&&u.__reactive?e[a]=this._wrapNested(u,u,h,r):e[a]=this._wrapWritable(u),n[a]=u),r[h]=r[h]||null}}_wrapNested(t,e,n,s){const r=this._wrapWritable(t);return this._wrapProperties(t,r,e,n,s,0),r.__parse=(i,a,l,d)=>(this._wrapProperties(i,r,e,a,l,d),!1),r}_wrapWritable(t){const e=[],n=function(){for(let s=0;s<e.length;s++)e[s](t)};return{subscribe:s=>(e.push(s),this._async?setTimeout(s,1,t):s(t),()=>{const r=e.indexOf(s);r>=0&&e.splice(r,1)}),__trigger:()=>{e.length&&(this._async?setTimeout(n,1):n())},__parse:function(s){return t=s,!0}}}},Gi=class{constructor(t,e,n,s){typeof t=="function"?this._setter=t:this._setter=t.setState.bind(t),this._routes=e,this._parsers=n,this._prev={},this._triggers=new Map,this._sources=new Map,this._routes.forEach(r=>{r.in.forEach(i=>{const a=this._triggers.get(i)||[];a.push(r),this._triggers.set(i,a)}),r.out.forEach(i=>{const a=this._sources.get(i)||{};r.in.forEach(l=>a[l]=!0),this._sources.set(i,a)})}),this._routes.forEach(r=>{r.length=Math.max(...r.in.map(i=>$s(i,this._sources,1)))}),this._bus=s}init(t){const e={};for(const n in t)if(this._prev[n]!==t[n]){const s=this._parsers[n];e[n]=s?s(t[n]):t[n]}this._prev=this._prev?{...this._prev,...t}:{...t},this.setState(e),this._bus&&this._bus.exec("init-state",e)}setStateAsync(t){const e=this._setter(t,Rs);return this._async?Object.assign(this._async.signals,e):this._async={signals:e,timer:setTimeout(this._applyState.bind(this),1)},e}_applyState(){const t=this._async;if(t){this._async=null,this._triggerUpdates(t.signals,[]);for(const e in t.signals){const n=t.signals[e];n&&n()}}}setState(t,e=[]){const n=this._setter(t);return this._triggerUpdates(n,e),n}_triggerUpdates(t,e){const n=Object.keys(t),s=!e.length;e=e||[];for(let r=0;r<n.length;r++){const i=n[r],a=this._triggers.get(i);a&&a.forEach(l=>{e.indexOf(l)==-1&&e.push(l)})}s&&this._execNext(e)}_execNext(t){for(;t.length;){t.sort((n,s)=>n.length<s.length?1:-1);const e=t[t.length-1];t.splice(t.length-1),e.exec(t)}}};function $s(t,e,n){const s=e.get(t);if(!s)return n;const r=Object.keys(s).map(i=>$s(i,e,n+1));return Math.max(...r)}var Vi=class{constructor(){this._nextHandler=null,this._handlers={},this._tag=new WeakMap,this.exec=this.exec.bind(this)}on(t,e,n){let s=this._handlers[t];s?n&&n.intercept?s.unshift(e):s.push(e):s=this._handlers[t]=[e],n&&n.tag&&this._tag.set(e,n.tag)}intercept(t,e,n){this.on(t,e,{...n,intercept:!0})}detach(t){for(const e in this._handlers){const n=this._handlers[e];for(let s=n.length-1;s>=0;s--)this._tag.get(n[s])===t&&n.splice(s,1)}}async exec(t,e){const n=this._handlers[t];if(n)for(let s=0;s<n.length;s++){const r=n[s](e);if(r===!1||r&&r.then&&await r===!1)return}return this._nextHandler&&await this._nextHandler.exec(t,e),e}setNext(t){return this._nextHandler=t}};function Yi(t){return e=>e[t]}function Ki(t){return(e,n)=>e[t]=n}function Ge(t,e){return(e.getter||Yi(e.id))(t)}function Bt(t,e,n){return(e.setter||Ki(e.id))(t,n)}function Wi(t,e){const n=document.createElement("a");n.href=URL.createObjectURL(t),n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}function Be(t,e){let n=Ge(t,e)??"";return e.template?n=e.template(n,t,e):e.optionsMap&&(Array.isArray(n)?n=n.map(s=>e.optionsMap.get(s)).join(", "):n=e.optionsMap.get(n)),typeof n>"u"?"":n+""}function Ui(t,e){const n=/\n|"|;|,/;let s="";const r=e.rows||`
|
|
2
2
|
`,i=e.cols||" ",a=t._columns,l=t.flatData;e.header!==!1&&a[0].header&&(s=Kn("header",a,s,i,r));for(let d=0;d<l.length;d++){const u=[];for(let h=0;h<a.length;h++){let f=Be(l[d],a[h]);n.test(f)&&(f='"'+f.replace(/"/g,'""')+'"'),u.push(f)}s+=(s?r:"")+u.join(i)}return e.footer!==!1&&a[0].footer&&(s=Kn("footer",a,s,i,r)),s}function Kn(t,e,n,s,r){const i=/\n|"|;|,/;for(let a=0;a<e[0][t].length;a++){const l=[];for(let d=0;d<e.length;d++){let u=(e[d][t][a].text||"")+"";i.test(u)&&(u='"'+u.replace(/"/g,'""')+'"'),l.push(u)}n+=(n?r:"")+l.join(s)}return n}const qi="portrait",Ji=100,Qi="a4",Zi={a3:{width:11.7,height:16.5},a4:{width:8.27,height:11.7},letter:{width:8.5,height:11}};function Xi(t,e){const n=[];let s=[],r=0;const i=t.filter(l=>!l.hidden),a=eo(e);return i.forEach((l,d)=>{r+l.width<=a?(r+=l.width,s.push(l)):(s.length&&n.push(s),s=[l],r=l.width),d===i.length-1&&s.length&&n.push(s)}),n}function Wn(t,e,n){const s=[];return t.forEach((r,i)=>{const a=r[e];for(let l=0;l<n.length;l++){s[l]||(s[l]=[]);const d={...a[l]};if(s[l][i]!==null){if(!i&&!d.rowspan&&!d.colspan){let u=1,h=t[i+u][e][l],f=d.width;for(;!h.rowspan&&!h.colspan;)u++,h=t[i+u][e][l],f+=h.width;d.colspan=u,d.width=f,d.height=n[l]}if(s[l].push(d),!d.collapsed&&d.colspan>1){let u=d.colspan-1;if(d.colspan+i>t.length){const h=d.colspan-(d.colspan+i-t.length);d.colspan=h,d.width=t.slice(i,i+u+1).reduce((f,x)=>f+x.width,0),h>1&&(u=h-1)}for(let h=0;h<u;h++)s[l].push(null)}if(d.rowspan>1){const u=d.rowspan;for(let h=1;h<u;h++)s[l+h]||(s[l+h]=[]),s[l+h].push(null)}}}if(r.collapsed)for(let l=0;l<s.length;l++){const d=s[l],u=d[i];if(u&&u.collapsed){if(d[i]=null,!l)break}else{const h=u||d.findLast(f=>f?.colspan>=1);h&&(h.colspan=h.colspan-1,h.width=h.width-r.width)}}}),s.map(r=>r.filter(i=>i&&i.colspan!==0))}function eo(t){const{mode:e,ppi:n,paper:s}=t,{width:r,height:i}=Zi[s];return to(e==="portrait"?r:i,n)}function to(t,e){return t*e}function no(t={}){const{mode:e,ppi:n,paper:s}=t;return{mode:e||qi,ppi:n||Ji,paper:s||Qi}}function Es(t,e){return t.flexgrow?`min-width:${e}px;width:auto`:`width:${t.width}px; max-width:${t.width}px; height:${t.height}px`}function so(t,e,n){let s=t[n.id];if(n.filter.type==="richselect"&&s){const r=n.filter.config?.options||e.find(({id:i})=>i==n.id).options;r&&(s=r.find(({id:i})=>i==s).label)}return s??""}const Un=["resize-column","hide-column","update-cell"],ro=["delete-row","update-row","update-cell"],io=["move-item"],oo=["resize-column","move-item"];class ao{undo=[];redo=[];progress={};in;getState;setState;_previousValues={};constructor(e,n,s){this.in=e,this.getState=n,this.setState=s,this.setHandlers(),this.resetStateHistory()}getHandlers(){return{"add-row":{handler:e=>({action:"delete-row",data:{id:e.id},source:{action:"add-row",data:e}})},"delete-row":{handler:e=>{const{id:n}=e,{data:s}=this.getPrev(),r=s.findIndex(i=>i.id===n);return{action:"add-row",data:{id:n,row:s[r],before:r<s.length-1?s[r+1].id:void 0},source:{action:"delete-row",data:e}}}},"update-cell":{handler:e=>{const{id:n,column:s}=e,r=this.getRow(n),i=this.getColumn(s),a=Ge(r,i);return Et(a,e.value)?null:{action:"update-cell",data:{id:n,column:s,value:a},source:{action:"update-cell",data:e}}}},"update-row":{handler:e=>{const{id:n,row:s}=e,r=this.getRow(n);for(const i in s)Object.keys(r).includes(i)||(r[i]=void 0);return{action:"update-row",data:{id:n,row:r},source:{action:"update-row",data:e}}}},"copy-row":{handler:e=>{const{id:n}=e,{data:s}=this.getState(),r=s.findIndex(a=>a.id===n),i=s[r];return{action:"delete-row",data:{id:n},source:{action:"add-row",data:{id:n,row:i,before:r<s.length-1?s[r+1].id:void 0}}}}},"resize-column":{handler:e=>{const{id:n,width:s}=e,r=this.getColumn(n),{_sizes:i}=this.getState();return{action:"resize-column",data:{id:n,width:r.width??i.columnWidth},source:{action:"resize-column",data:{id:n,width:s}}}}},"hide-column":{handler:e=>{const{id:n}=e,s=this.getColumn(n);return{action:"hide-column",data:{id:n,mode:s.hidden},source:{action:"hide-column",data:e}}}},"collapse-column":{handler:e=>{const{id:n,row:s,mode:r}=e;return{action:"collapse-column",data:{id:n,row:s,mode:typeof r=="boolean"?!r:r},source:{action:"collapse-column",data:e}}}},"move-item":{handler:e=>{const{id:n,target:s,mode:r}=e,{flatData:i}=this.getPrev(),a=i.findIndex(l=>l.id===n);return{action:"move-item",data:{id:n,target:i[a+(a?-1:1)].id,mode:a?"after":"before"},source:{action:"move-item",data:{id:n,target:s,mode:r}}}}},"open-row":{handler:e=>{const{id:n,nested:s}=e;return{action:"close-row",data:{id:n,nested:s},source:{action:"open-row",data:e}}}},"close-row":{handler:e=>{const{id:n,nested:s}=e;return{action:"open-row",data:{id:n,nested:s},source:{action:"close-row",data:e}}}}}}resetHistory(){this.undo=[],this.redo=[],this.progress={},this.resetStateHistory()}getPrev(){return this._previousValues}setHandlers(){const e=this.getHandlers();for(const n in e)this.in.intercept(n,s=>{if(!(s.eventSource==="undo"||s.eventSource==="redo"||s.skipUndo)){if(oo.includes(n)){(s.inProgress&&!this.progress[n]||typeof s.inProgress!="boolean")&&(io.includes(n)&&this.setPrev("flatData"),Un.includes(n)&&this.setPrev("columns")),this.progress[n]=s.inProgress;return}ro.includes(n)&&this.setPrev("data"),Un.includes(n)&&this.setPrev("columns")}}),this.in.on(n,s=>{if(s.eventSource==="undo"||s.eventSource==="redo"||s.skipUndo||s.inProgress)return;const r=e[n].handler(s);r&&this.addToHistory(r)})}setPrev(e){this._previousValues[e]=Wt(this.getState()[e])}addToHistory(e){this.undo.push(e),this.redo=[],this.setStateHistory()}handleUndo(){if(!this.undo.length)return;const e=this.undo.pop();this.redo.push({...e.source,source:e}),this.in.exec(e.action,{...e.data,eventSource:"undo"}),this.setStateHistory()}handleRedo(){if(!this.redo.length)return;const e=this.redo.pop();this.undo.push({...e.source,source:e}),this.in.exec(e.action,{...e.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(e){const{data:n}=this.getPrev();return this.getState().tree?this.getTreeRow(n,e):n.find(s=>s.id===e)}getTreeRow(e,n){for(let s=0;s<e.length;s++){if(e[s].id===n)return e[s];if(e[s].data){const r=this.getTreeRow(e[s].data,n);if(r)return r}}return null}getColumn(e){const{columns:n}=this.getPrev();return n.find(s=>s.id===e)}}function Ms(t,e){return typeof t>"u"||t===null?-1:typeof e>"u"||e===null?1:t===e?0:t>e?1:-1}function lo(t,e){return-Ms(t,e)}function co(t,e){if(typeof e.sort=="function")return function(s,r){const i=e.sort(s,r);return t==="asc"?i:-i};const n=t==="asc"?Ms:lo;return function(s,r){return n(Ge(s,e),Ge(r,e))}}function uo(t,e){if(!t||!t.length)return;const n=t.map(s=>{const r=e.find(i=>i.id==s.key);return co(s.order,r)});return t.length===1?n[0]:function(s,r){for(let i=0;i<n.length;i++){const a=n[i](s,r);if(a!==0)return a}return 0}}const bt=28,fo=20;function ho(){if(typeof document>"u")return"willow";const t=document.querySelector('[class^="wx"][class$="theme"]');return t?t.className.substring(3,t.className.length-6):"willow"}function Nt(t,e,n,s,r){const i=document.createElement("div"),a=document.createElement("div"),l=document.body;r=r?`${r}px`:"auto";let d,u;a.className=e,i.classList.add(`wx-${n}-theme`),i.style.cssText=`height:auto;position:absolute;top:0px;left:100px;overflow:hidden;width=${r};white-space:nowrap;`,i.appendChild(a),l.appendChild(i),typeof t!="object"&&(t=[t]);for(let h=0;h<t.length;h++){a.innerText=t[h]+"";const f=i.getBoundingClientRect(),x=Math.ceil(f.width)+(s&&s.length?s[h]:0),m=Math.ceil(f.height);d=Math.max(d||0,x),u=Math.max(u||0,m)}return i.remove(),{width:d,height:u}}function qn(t,e,n,s,r){const i=[];for(let a=0;a<t.length;a++){const l=t[a][e],d=l.length;for(let u=0;u<d;u++){const{text:h,vertical:f,collapsed:x,rowspan:m,css:p}=l[u];if(!h){i[u]=Math.max(i[u]||0,s);continue}let g=0;if(f&&!x){let y=`wx-measure-cell-${e}`;if(y+=p?` ${p}`:"",g=Nt(h,y,r).width,(m>1||!l[u+1])&&n>u+1){const v=m||n-u,w=i.slice(u,u+v).reduce((j,R)=>j+R,0);if(w<g){const j=Math.ceil((g-w)/v);for(let R=u;R<u+v;R++)i[R]=(i[R]||s)+j}continue}}i[u]=Math.max(i[u]||s,g)}}return i}function xo(t,e,n){const s=[],r=[];let i="wx-measure-cell-body";i+=t.css?` ${t.css}`:"";for(let a=0;a<e.length;a++){const l=e[a],d=Be(l,t);d&&(s.push(d),t.treetoggle?r.push(e[a].$level*bt+(e[a].$count?bt:0)+(t.draggable?bt:0)):t.draggable&&r.push(bt))}return Nt(s,i,n,r).width}function po(t,e){const n="wx-measure-cell-header",s=t.sort?fo:0;let r=t.header;if(typeof r=="string")return Nt(r,n,e).width+s;let i;Array.isArray(r)||(r=[r]);for(let a=0;a<r.length;a++){const l=r[a],d=typeof l=="string"?l:l.text,u=n+(typeof l=="string"?"":` ${l.css}`);let h=Nt(d,u,e).width;a===r.length-1&&(h+=s),i=Math.max(i||0,h)}return i}const mo={text:(t,e)=>t?t.toString().toLowerCase().indexOf(e.toLowerCase())!==-1:!e,richselect:(t,e)=>typeof e!="number"&&!e?!0:t==e,datepicker:(t,e)=>e?t&&wo(t,e):!0,multiselect:(t,e)=>!e||e?.length===0?!0:Array.isArray(t)?t?.some(n=>e.includes(n)):t&&e.includes(t)};function Ds(t){return mo[t]}function go(t,e){const n=[];for(const s in t){const r=e.find(d=>d.id==s),{config:i,type:a}=r.header.find(d=>d.filter).filter,l=t[s];n.push(d=>{const u=Ge(d,r);return i?.handler?i.handler(u,l):Ds(a)(u,l)})}return s=>{for(let r=0;r<n.length;r++)if(!n[r](s))return!1;return!0}}function wo(t,e){return t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}let vo=class extends Bi{in;_router;_branches;_xlsxWorker;_historyManager;constructor(e){super({writable:e,async:!1});const n={rowHeight:37,columnWidth:160,headerHeight:36,footerHeight:36};this._router=new Gi(super.setState.bind(this),[{in:["columns","sizes","_skin"],out:["_columns","_sizes"],exec:r=>{const{columns:i,sizes:a,_skin:l}=this.getState(),d=this.copyColumns(i),u=d.reduce((x,m)=>Math.max(m.header.length,x),0),h=d.reduce((x,m)=>Math.max(m.footer.length,x),0);d.forEach(this.setCollapsibleColumns);const f=this.normalizeSizes(d,a,u,h,l);for(let x=0;x<d.length;x++)this.normalizeColumns(d,x,"header",u,f),this.normalizeColumns(d,x,"footer",h,f);this.setState({_columns:d,_sizes:f},r)}},{in:["data","tree","_filterIds"],out:["flatData","_rowHeightFromData"],exec:r=>{const{data:i,tree:a,dynamic:l,_filterIds:d}=this.getState(),u=d&&new Set(d),h=a?this.flattenRows(i,[],d):u?i.filter(x=>u.has(x.id)):i,f=!l&&h.some(x=>x.rowHeight);this.setState({flatData:h,_rowHeightFromData:f},r)}}],{sizes:r=>({...n,...r})});const s=this.in=new Vi;s.on("close-editor",({ignore:r})=>{const{editor:i}=this.getState();i&&(r||s.exec("update-cell",i),this.setState({editor:null}))}),s.on("open-editor",({id:r,column:i})=>{let a=this.getState().editor;a&&s.exec("close-editor",{});const l=this.getRow(r),d=i?this.getColumn(i):this.getNextEditor(l);if(d?.editor){let u=d.editor;if(typeof u=="function"&&(u=u(l,d)),!u)return;a={column:d.id,id:r,value:Ge(l,d)??"",renderedValue:Be(l,d),type:u.type||u},typeof u=="object"&&u.config&&(a.config=u.config,u.config.options&&(a.options=u.config.options)),d.options&&!a.options&&(a.options=d.options),this.setState({editor:a})}}),s.on("editor",({value:r})=>{let i=this.getState().editor;if(i){i={...i},i.value=r;const a=this.getColumn(i.column),l={...this.getRow(i.id)};Bt(l,a,r),i.renderedValue=Be(l,a),this.setState({editor:i})}}),s.on("add-row",r=>{const i=this.getState();let{data:a}=i;const{select:l,_filterIds:d}=i,{row:u,before:h,after:f,select:x}=r;if(r.id=u.id=r.id||u.id||jt(),h||f){const p=h||f,g=a.findIndex(y=>y.id===p);a=[...a],a.splice(g+(f?1:0),0,r.row)}else a=[...a,r.row];const m={data:a};d&&(m._filterIds=[...d,r.id]),this.setState(m),!(typeof x=="boolean"&&!x)&&(x||l)&&s.exec("select-row",{id:u.id,show:!0})}),s.on("delete-row",r=>{const{data:i,selectedRows:a,focusCell:l,editor:d}=this.getState(),{id:u}=r,h={data:i.filter(f=>f.id!==u)};this.isSelected(u)&&(h.selectedRows=a.filter(f=>f!==u)),d?.id===u&&(h.editor=null),this.setState(h),l?.row===u&&this.in.exec("focus-cell",{eventSource:"delete-row"})}),s.on("update-cell",r=>{const i=this.getState();let{data:a}=i;a=[...a];const{tree:l}=i,{id:d,column:u,value:h}=r,f=this.getColumn(u);if(l){const x={...this._branches[d]};Bt(x,f,h);const m=this.updateTreeRow(x);x.$parent===0&&(a=m)}else{const x=a.findIndex(p=>p.id===d),m={...a[x]};Bt(m,f,h),a[x]=m}this.setState({data:a})}),s.on("update-row",r=>{let{data:i}=this.getState();const{id:a,row:l}=r,d=i.findIndex(u=>u.id===a);i=[...i],i[d]={...i[d],...l},this.setState({data:i})}),s.on("select-row",({id:r,toggle:i,range:a,mode:l,show:d,column:u})=>{const h=this.getState(),{focusCell:f}=h;let{selectedRows:x}=h;if(x.length||(a=i=!1),a){const{data:m}=this.getState();let p=m.findIndex(y=>y.id===x[x.length-1]),g=m.findIndex(y=>y.id===r);p>g&&([p,g]=[g,p]),m.slice(p,g+1).forEach(y=>{this.isSelected(y.id)||x.push(y.id)})}else if(i&&this.isSelected(r)){if(l===!0)return;x=x.filter(m=>m!==r)}else if(i){if(l===!1)return;x.push(r)}else x=[r];this.setState({selectedRows:[...x]}),f?.row!==r&&this.in.exec("focus-cell",{eventSource:"select-row"}),d&&this.in.exec("scroll",{row:r,column:u})}),this.in.on("focus-cell",r=>{const{row:i,column:a,eventSource:l}=r,{_columns:d,split:u}=this.getState();i&&a?(this.setState({focusCell:{row:i,column:a}}),l!=="click"&&((!u.left||d.findIndex(h=>h.id===r.column)>=u.left)&&(!u.right||d.findIndex(h=>h.id===r.column)<d.length-u.right)?this.in.exec("scroll",{row:i,column:a}):this.in.exec("scroll",{row:i}))):this.setState({focusCell:null})}),s.on("resize-column",r=>{const{id:i,auto:a,maxRows:l,inProgress:d}=r;if(d===!1)return;let u=r.width||0;const h=[...this.getState().columns],f=this.getColumn(i);if(a){if(a==="data"||a===!0){const{flatData:x,_skin:m}=this.getState();let p=x.length;l&&(p=Math.min(l,p));const g=x.slice(0,p);u=xo(f,g,m)}if(a==="header"||a===!0){const{_skin:x}=this.getState();u=Math.max(po(f,x),u)}}f.width=Math.max(17,u),delete f.flexgrow,this.setState({columns:h})}),s.on("hide-column",r=>{const{id:i,mode:a}=r,l=[...this.getState().columns],d=this.getColumn(i),u=l.reduce((h,f)=>h+(f.hidden?0:1),0);!a||u>1?(d.hidden=!d.hidden,this.setState({columns:l})):r.skipUndo=!0}),s.on("sort-rows",r=>{const{key:i,add:a,sort:l}=r,d=this.getState(),{columns:u,data:h,tree:f}=d;if(l){const w=[...h];w.sort(l),this.setState({data:w});return}const{order:x="asc"}=r;let m=d.sortMarks;const p=Object.keys(m),g=p.length;!a||!g||g===1&&m[i]?m={[i]:{order:x}}:(g===1&&(m[p[0]]={...m[p[0]],index:0}),m={...m,[i]:{order:x,index:typeof a=="number"?a:m[i]?.index??g}});const y=Object.keys(m).sort((w,j)=>m[w].index-m[j].index).map(w=>({key:w,order:m[w].order}));this.setState({sortMarks:m});const v=uo(y,u);if(v){const w=[...h];f?this.sortTree(w,v):w.sort(v),this.setState({data:w})}}),s.on("filter-rows",r=>{const{value:i,key:a,filter:l}=r;if(!Object.keys(r).length){this.setState({filterValues:{},_filterIds:null});return}const d=this.getState(),{data:u,tree:h,_columns:f}=d;let x=d.filterValues;const m={};a&&(x={...x,[a]:i},m.filterValues=x);const p=l??go(x,f);let g=[];h?g=this.filterTree(u,p,g):u.forEach(y=>{p(y)&&g.push(y.id)}),m._filterIds=g,this.setState(m)}),s.on("collapse-column",r=>{const{id:i,row:a,mode:l}=r,d=[...this.getState().columns],u=this.getColumn(i).header,h=Array.isArray(u)?u[a]:u;typeof h=="object"&&(h.collapsed=l??!h.collapsed,this.setState({columns:d}))}),s.on("move-item",r=>{const{id:i,inProgress:a}=r;let{target:l,mode:d="after"}=r;const{data:u,flatData:h,tree:f}=this.getState(),x=h.findIndex(g=>g.id===i);let m;if(d==="up"||d==="down"){if(d==="up"){if(x===0)return;m=x-1,d="before"}else if(d==="down"){if(x===h.length-1)return;m=x+1,d="after"}l=h[m]&&h[m].id}else m=h.findIndex(g=>g.id===l);if(x===-1||m===-1||a===!1)return;let p;f||(p=this.moveItem(i,l,u,d)),this.setState({data:f?this.normalizeTreeRows(p):p})}),s.on("copy-row",r=>{const{id:i,target:a,mode:l="after"}=r,d=this.getState(),{flatData:u,_filterIds:h}=d;let{data:f}=d;const x=this.getRow(i);if(!x)return;const m={...x,id:jt()};r.id=m.id;const p=u.findIndex(y=>y.id===a);if(p===-1)return;f.splice(p+(l==="after"?1:0),0,m),f=[...f];const g={data:f};h&&(g._filterIds=[...h,m.id]),this.setState(g)}),s.on("open-row",r=>{const{id:i,nested:a}=r;this.toggleBranch(i,!0,a)}),s.on("close-row",r=>{const{id:i,nested:a}=r;this.toggleBranch(i,!1,a)}),s.on("export-data",r=>new Promise((i,a)=>{const l=r.format||"csv",d=`${r.fileName||"data"}.${l}`;if(l==="csv"){const u=Ui(this.getState(),r.csv||{});r.download!==!1?Wi(new Blob(["\uFEFF"+u],{type:"text/csv"}),d):r.result=u,i(!0)}else a()})),s.on("hotkey",({key:r,event:i,isInput:a})=>{switch(r){case"arrowup":{const{flatData:l,focusCell:d,select:u}=this.getState();if(i.preventDefault(),a)return;const h=d?d.column:this._getFirstVisibleColumn()?.id,f=d?this.getPrevRow(d.row)?.id:l[l.length-1]?.id;h&&f&&(this.in.exec("focus-cell",{row:f,column:h,eventSource:"key"}),u&&this.in.exec("select-row",{id:f}));break}case"arrowdown":{const{flatData:l,focusCell:d,select:u}=this.getState();if(i.preventDefault(),a)return;const h=d?d.column:this._getFirstVisibleColumn()?.id,f=d?this.getNextRow(d.row)?.id:l[0]?.id;h&&f&&(this.in.exec("focus-cell",{row:f,column:h,eventSource:"key"}),u&&this.in.exec("select-row",{id:f}));break}case"arrowright":{const{focusCell:l}=this.getState();if(a)return;if(i.preventDefault(),l){const d=this.getNextColumn(l.column,!0)?.id;d&&this.in.exec("focus-cell",{row:l.row,column:d,eventSource:"key"})}break}case"arrowleft":{const{focusCell:l}=this.getState();if(a)return;if(i.preventDefault(),l){const d=this.getPrevColumn(l.column,!0)?.id;d&&this.in.exec("focus-cell",{row:l.row,column:d,eventSource:"key"})}break}case"tab":{const{editor:l,focusCell:d,select:u}=this.getState();if(l){i.preventDefault();const h=l.column;let f=l.id,x=this.getNextEditor(this.getRow(f),this.getColumn(h));if(!x){const m=this.getNextRow(f);m&&(f=m.id,x=this.getNextEditor(m))}x&&(this.in.exec("open-editor",{id:f,column:x.id}),this.in.exec("focus-cell",{row:f,column:x.id,eventSource:"key"}),u&&!this.isSelected(f)&&this.in.exec("select-row",{id:f}))}else d&&this.in.exec("focus-cell",{eventSource:"key"});break}case"shift+tab":{const{editor:l,focusCell:d,select:u}=this.getState();if(l){i.preventDefault();const h=l.column;let f=l.id,x=this.getPrevEditor(this.getRow(f),this.getColumn(h));if(!x){const m=this.getPrevRow(f);m&&(f=m.id,x=this.getPrevEditor(m))}x&&(this.in.exec("open-editor",{id:f,column:x.id}),this.in.exec("focus-cell",{row:f,column:x.id,eventSource:"key"}),u&&!this.isSelected(f)&&this.in.exec("select-row",{id:f}))}else d&&this.in.exec("focus-cell",{eventSource:"key"});break}case"escape":{const{editor:l}=this.getState();l&&(this.in.exec("close-editor",{ignore:l.type!="multiselect"}),this.in.exec("focus-cell",{row:l.id,column:l.column,eventSource:"key"}));break}case"f2":{const{editor:l,focusCell:d}=this.getState();!l&&d&&this.in.exec("open-editor",{id:d.row,column:d.column});break}case"enter":{const{focusCell:l,tree:d}=this.getState();if(!a&&d&&l&&this.getColumn(l.column).treetoggle){const u=this.getRow(l.row);if(!u.data)return;this.in.exec(u.open?"close-row":"open-row",{id:l.row,nested:!0})}break}case"home":{const{editor:l,focusCell:d}=this.getState();if(!l&&d){i.preventDefault();const u=this._getFirstVisibleColumn()?.id;this.in.exec("focus-cell",{row:d.row,column:u,eventSource:"key"})}break}case"ctrl+home":{const{editor:l,focusCell:d,flatData:u,select:h}=this.getState();if(!l&&d){i.preventDefault();const f=u[0]?.id,x=this._getFirstVisibleColumn()?.id;f&&x&&(this.in.exec("focus-cell",{row:f,column:x,eventSource:"key"}),h&&!this.isSelected(f)&&this.in.exec("select-row",{id:f}))}break}case"end":{const{editor:l,focusCell:d}=this.getState();if(!l&&d){i.preventDefault();const u=this._getLastVisibleColumn()?.id,h=d.row;this.in.exec("focus-cell",{row:h,column:u,eventSource:"key"})}break}case"ctrl+end":{const{editor:l,focusCell:d,flatData:u,select:h}=this.getState();if(!l&&d){i.preventDefault();const f=u.at(-1).id,x=this._getLastVisibleColumn()?.id;f&&x&&(this.in.exec("focus-cell",{row:f,column:x,eventSource:"key"}),h&&!this.isSelected(f)&&this.in.exec("select-row",{id:f}))}break}case"ctrl+z":{this.in.exec("undo",{});break}case"ctrl+y":{this.in.exec("redo",{});break}}}),s.on("scroll",r=>{const{_columns:i,split:a,_sizes:l,flatData:d,dynamic:u,_rowHeightFromData:h}=this.getState();let f=-1,x=-1,m=0,p=0;if(r.column){f=0;const g=i.findIndex(y=>y.id===r.column);m=i[g].width;for(let y=a.left??0;y<g;y++){const v=i[y];v.hidden||(f+=v.width)}}if(r.row&&!u){const g=d.findIndex(y=>y.id===r.row);g>=0&&(h?(x=d.slice(0,g).reduce((y,v)=>y+(v.rowHeight||l.rowHeight),0),p=d[g].rowHeight):x=l.rowHeight*g)}this.setState({scroll:{top:x,left:f,width:m,height:p||l.rowHeight}})}),s.on("scroll-to",r=>{const i={};r.top!==void 0&&(i.scrollTop=r.top),r.left!==void 0&&(i.scrollLeft=r.left),Object.keys(i).length&&this.setState(i)}),s.on("print",r=>{const i=no(r);this.setState({_print:i}),this.setStateAsync({_print:null})}),s.on("undo",()=>{this._historyManager?.handleUndo()}),s.on("redo",()=>{this._historyManager?.handleRedo()}),this.initOnce()}getXlsxWorker(e){if(!this._xlsxWorker){const n=window.URL.createObjectURL(new Blob([`importScripts('${e}');`],{type:"text/javascript"}));this._xlsxWorker=new Promise(s=>{const r=new Worker(n);r.addEventListener("message",i=>{i.data.type==="init"&&s(r)})})}return this._xlsxWorker}initOnce(){const e={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(e)}init(e){e.hasOwnProperty("_skin")&&!e._skin&&(e._skin=ho()),e.columns&&e.columns.forEach(n=>{n.options&&(n.optionsMap=new Map(n.options.map(s=>[s.id,s.label])))}),Et(this.getState().data,e.data)||(e.tree?e.data=this.normalizeTreeRows(e.data):e.data=this.normalizeRows(e.data),this.setState({_filterIds:null,filterValues:{},sortMarks:{},search:null}),this._historyManager&&this._historyManager.resetHistory()),e.tree&&(e.undo=!1,e.reorder=!1),e.split?.right&&(e.split.right=0),e.undo&&!this._historyManager&&(this._historyManager=new ao(this.in,this.getState.bind(this),this.setState.bind(this))),this._router.init({...e})}setState(e,n){return this._router.setState(e,n)}setStateAsync(e){this._router.setStateAsync(e)}getRow(e){const{tree:n}=this.getState();return n?this._branches[e]:this.getState().data.find(s=>s.id===e)}getRowIndex(e,n){return n||(n=this.getState().flatData),n.findIndex(s=>s.id===e)}getNextRow(e){const n=this.getState().flatData,s=this.getRowIndex(e,n);return n[s+1]}getPrevRow(e){const n=this.getState().flatData,s=this.getRowIndex(e,n);return n[s-1]}getColumn(e){return this.getState().columns.find(n=>n.id===e)}getNextColumn(e,n){const s=this.getState()._columns,r=s.findIndex(i=>i.id===e);return n?this._getFirstVisibleColumn(r+1):s[r+1]}getPrevColumn(e,n){const s=this.getState()._columns,r=s.findIndex(i=>i.id===e);return n?this._getLastVisibleColumn(r-1):s[r-1]}_getFirstVisibleColumn(e){const n=this.getState()._columns;let s=e??0;for(;s<n.length&&(n[s]?.hidden||n[s]?.collapsed);)s++;return n[s]}_getLastVisibleColumn(e){const n=this.getState()._columns;let s=e??n.length-1;for(;s<n.length&&(n[s]?.hidden||n[s]?.collapsed);)s--;return n[s]}isCellEditable(e,n){const{editor:s,hidden:r}=n;return!s||r?!1:typeof s=="function"?s(e,n):!0}getNextEditor(e,n){let s=this.getState().columns;if(n){const r=s.findIndex(i=>i.id===n.id);s=s.slice(r+1)}return s.find(r=>this.isCellEditable(e,r))}getPrevEditor(e,n){let s=this.getState().columns;if(n){const r=s.findLastIndex(i=>i.id===n.id);s=s.slice(0,r)}return s.findLast(r=>this.isCellEditable(e,r))}toggleBranch(e,n,s){let r=this._branches[e],{data:i}=this.getState();if(i=[...i],e!==0){r={...r,open:n};const a=this.updateTreeRow(r);r.$parent===0&&(i=a)}s&&r.data?.length&&r.data.forEach(a=>{const l=this.toggleKids(a,n,s);e===0&&(i=l)}),this.setState({data:i})}toggleKids(e,n,s){e={...e,open:n};const r=this.updateTreeRow(e);return s&&e.data?.length&&e.data.forEach(i=>{this.toggleKids(i,n,s)}),r}updateTreeRow(e){const n=e.id;this._branches[n]=e;const s=this._branches[e.$parent],r=s.data.findIndex(i=>i.id===n);return s.data=[...s.data],s.data[r]=e,s.data}isSelected(e){return this.getState().selectedRows.indexOf(e)!==-1}findAndRemove(e,n){for(let s=0;s<e.length;s++){if(e[s].id===n)return e.splice(s,1)[0];if(e[s].data){const r=[...e[s].data],i=this.findAndRemove(r,n);if(i)return e[s]={...e[s],data:r},i}}return null}insertItem(e,n,s,r){for(let i=0;i<e.length;i++){if(e[i].id===n){const a=e[i],l=r==="before"?i:i+1;if(a.data){if(r==="before"){const d=i>0?e[i-1]:null;return d?.data&&d.open?e[i-1]={...d,data:[...d.data,s]}:e.splice(l,0,s),!0}else if(a.open)return e[i]={...a,data:[s,...a.data]},!0}return e.splice(l,0,s),!0}if(e[i].data&&(e[i]={...e[i],data:[...e[i].data]},this.insertItem(e[i].data,n,s,r)))return!0}return!1}moveItem(e,n,s,r){const i=[...s],a=this.findAndRemove(i,e);return this.insertItem(i,n,a,r),i}copyColumns(e){const n=[];for(let s=0;s<e.length;s++){const r={...e[s]};this.copyHeaderFooter(r,"header"),this.copyHeaderFooter(r,"footer"),n[s]=r}return n}copyHeaderFooter(e,n){let s=e[n];s=Array.isArray(s)?[...s]:[s],s.forEach((r,i)=>{s[i]=typeof r=="string"?{text:r}:{...r}}),e[n]=s}setCollapsibleColumns(e,n,s){let r=e.header;for(let i=0;i<r.length;i++){const a=r[i];if(a.collapsible&&a.collapsed){if(a.collapsible!=="first"){e.collapsed=!0,e.width=36,a.vertical=!0;const d=r.length-i;r=r.slice(0,i+1),r[i].rowspan=d}const l=a.colspan;if(l){const d=r[i+1];let u=1;d&&d.colspan&&!d.collapsed&&(u=d.colspan);for(let h=u;h<l;h++){const f=s[n+h];f&&(f.hidden=!0)}}}}}normalizeColumns(e,n,s,r,i){const a=e[n];a.width||(a.width=a.flexgrow?17:i.columnWidth),a._colindex=n+1;const l=a[s],d=i[`${s}RowHeights`];for(let u=0;u<r;u++){const h=l[u];h.id=a.id,u===l.length-1&&(h.rowspan=h.rowspan?Math.min(h.rowspan,r-u):r-u);for(let f=1;f<h.rowspan;f++){l.splice(u+f,0,{_hidden:!0});for(let x=1;x<h.colspan;x++)e[n+x][s].splice(u+f,0,{})}if(h.rowspan){const f=(h.rowspan===r?d:d.slice(u,h.rowspan+u)).reduce((x,m)=>x+m,0);h.height=f,u+h.rowspan!=r&&h.height--}if(h.colspan){let f=a.width,x=a.flexgrow||0;const m=h.colspan;for(let p=1;p<m;p++){const g=e[n+p];g&&(g.hidden?h.colspan-=1:g.flexgrow?x+=g.flexgrow:f+=g.width||i.columnWidth),x?h.flexgrow=x:h.width=f}}else h.width=a.width,h.flexgrow=a.flexgrow;s==="header"&&h.filter&&typeof h.filter=="string"&&(h.filter={type:h.filter})}l.length>r&&(l.length=r),a[s]=l}normalizeRows(e){for(let n=0;n<e.length;n++)e[n].id||(e[n].id=jt());return e}normalizeTreeRows(e,n,s){return!n&&!s&&(this._branches={0:{data:e}}),e.forEach(r=>{r.id||(r.id=jt()),r.$level=n||0,r.$parent=s||0,this._branches[r.id]=r,r.data&&(r.data.length?(r.$count=r.data.length,this.normalizeTreeRows(r.data,r.$level+1,r.id)):(delete r.data,delete r.$count,delete r.open))}),e}sortTree(e,n){e.sort(n),e.forEach(s=>{s.data&&this.sortTree(s.data,n)})}filterTree(e,n,s){return e.forEach(r=>{n(r)&&s.push(r.id),r.data&&this.filterTree(r.data,n,s)}),s}flattenRows(e,n,s){const r=n;return e.forEach(i=>{(!s||s.includes(i.id))&&r.push(i),i.data?.length&&i.open!==!1&&this.flattenRows(i.data,r,s)}),r}createFilter(e){const{_columns:n}=this.getState(),s=[];for(const r in e){const i=n.find(u=>u.id==r),{config:a,type:l}=i.header.find(u=>u.filter).filter,d=e[r];s.push(u=>{const h=Ge(u,i);return a?.handler?a.handler(h,d):Ds(l)(h,d)})}return r=>{for(let i=0;i<s.length;i++)if(!s[i](r))return!1;return!0}}searchRows(e,n){e=e.trim().toLowerCase();const s={};if(!e)return s;const{flatData:r,columns:i}=this.getState(),a=n?i.filter(l=>n[l.id]):i;return r.forEach(l=>{const d={};a.forEach(u=>{const h=Be(l,u);String(h).toLowerCase().includes(e)&&(d[u.id]=!0)}),Object.keys(d).length&&(s[l.id]=d)}),s}normalizeSizes(e,n,s,r,i){const a=qn(e,"header",s,n.headerHeight,i),l=qn(e,"footer",r,n.footerHeight,i),d=a.reduce((h,f)=>h+f,0),u=l.reduce((h,f)=>h+f,0);return{...n,headerRowHeights:a,footerRowHeights:l,headerHeight:d,footerHeight:u}}},yo=new Date().valueOf();function jt(){return"temp://"+yo++}function bo(t,e="data-id"){let n=t;for(!n.tagName&&t.target&&(n=t.target);n;){if(n.getAttribute&&n.getAttribute(e))return n;n=n.parentNode}return null}new Date().valueOf();var jo=class{constructor(){this.store=new Map}configure(t,e){this.node=e;for(const n in t)if(t[n]){const s=n.toLowerCase().replace(/[ ]/g,""),r=t[n];this.store.set(s,r)}}},Qe=[],So={subscribe:t=>{Co();const e=new jo;return Qe.push(e),t(e),()=>{const n=Qe.findIndex(s=>s===e);n>=0&&Qe.splice(n,1)}}},Jn=!1;function Co(){Jn||(Jn=!0,document.addEventListener("keydown",t=>{if(Qe.length&&(t.ctrlKey||t.altKey||t.metaKey||t.shiftKey||t.key.length>1||t.key===" ")){const e=[];t.ctrlKey&&e.push("ctrl"),t.altKey&&e.push("alt"),t.metaKey&&e.push("meta"),t.shiftKey&&e.push("shift");let n=t.code.replace("Key","").toLocaleLowerCase();t.key===" "&&(n="space"),e.push(n);const s=e.join("+");for(let r=Qe.length-1;r>=0;r--){const i=Qe[r],a=i.store.get(s)||i.store.get(n);a&&i.node.contains(t.target)&&a(t,{key:s,evKey:n})}}}))}const ko={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 No(t,{keys:e,exec:n}){if(!e)return;function s(a){const l=a.target;return l.tagName==="INPUT"||l.tagName==="TEXTAREA"||bo(l,"data-header-id")?.classList.contains("wx-filter")||!!l.closest(".wx-cell.wx-editor")}const r={};for(const a in e){const l=e[a];typeof l<"u"&&(typeof l=="function"?r[a]=l:l&&(r[a]=d=>{const u=s(d);n({key:a,event:d,isInput:u})}))}const i=So.subscribe(a=>{a.configure(r,t)});return{destroy:()=>{i()}}}function _o(t,e){let n=null;e.scroll.subscribe(s=>{if(!s||s===n)return;n=s;const{left:r,top:i,height:a,width:l}=s,d=e.getHeight(),u=e.getWidth(),h=e.getScrollMargin();if(i>=0){const f=t.scrollTop;i<f?t.scrollTop=i:i+a>f+d&&(t.scrollTop=i-d+a)}if(r>=0){const f=t.scrollLeft;r<f?t.scrollLeft=r:r+l>f+u-h&&(t.scrollLeft=r-u+l+h)}}),e.scrollLeft?.subscribe?.(s=>{requestAnimationFrame(()=>{Math.abs(t.scrollLeft-s)>1&&(t.scrollLeft=s)})}),e.scrollTop?.subscribe?.(s=>{requestAnimationFrame(()=>{Math.abs(t.scrollTop-s)>1&&(t.scrollTop=s)})})}const Re=c.createContext(null);function Ro(t,e){const n=new ResizeObserver(s=>{requestAnimationFrame(()=>e(s[0].contentRect))});return n.observe(t.parentNode),{destroy(){n.disconnect()}}}const Qn=5,$o=700;function St(t){const e=t.getBoundingClientRect(),n=document.body,s=e.top+n.scrollTop-n.clientTop||0,r=e.left+n.scrollLeft-n.clientLeft||0;return{y:Math.round(s),x:Math.round(r),width:t.offsetWidth,height:t.offsetHeight}}function Ut(t,e){const n=St(e);return{x:t.clientX-n.x,y:t.clientY-n.y}}function Eo(t,e){const n=e.current;let s=null,r,i,a=!1,l=!1;const d=document.createElement("DIV");d.className="wx-drag-zone",d.setAttribute("tabindex",-1);function u(){clearTimeout(r),r=null}function h(b){const E=Ze(b);E&&(s={container:d,sourceNode:b.target,from:_t(E),pos:Ut(b,t)},i=s.pos,f(b))}function f(b){if(!s)return;const E=s.pos=Ut(b,t);if(!a){if(!l&&!b?.target?.getAttribute("draggable-data")&&Math.abs(i.x-E.x)<Qn&&Math.abs(i.y-E.y)<Qn)return;if(C(b)===!1)return $()}if(l){const P=window.scrollX||document.documentElement.scrollLeft||document.body.scrollLeft,k=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop;s.targetNode=document.elementFromPoint(b.pageX-P,b.pageY-k)}else s.targetNode=b.target;n.move&&n.move(b,s),d.style.left=-(s.offset?s.offset.x:0)+"px",d.style.top=s.pos.y+(s.offset?s.offset.y:0)+"px"}function x(b){d.parentNode&&d.parentNode.removeChild(d),d.innerHTML="",a&&n.end&&n.end(b,s),s=i=null,$()}function m(b){n.getReorder&&!n.getReorder()||b.button===0&&(R(b),window.addEventListener("mousemove",p),window.addEventListener("mouseup",g),h(b))}function p(b){f(b)}function g(b){x(b)}function y(b){if(n.getReorder&&!n.getReorder())return;r=setTimeout(()=>{l=!0,h(b.touches[0])},$o),R(b);function E(){r&&u(),b.target.removeEventListener("touchmove",v),b.target.removeEventListener("touchend",E),x(b)}b.target.addEventListener("touchmove",v),b.target.addEventListener("touchend",E),t.addEventListener("contextmenu",w)}function v(b){a?(b.preventDefault(),f(b.touches[0])):r&&u()}function w(b){if(a||r)return b.preventDefault(),!1}function j(b){b.preventDefault()}function R(b){if(!n.getDraggableInfo)return;const{hasDraggable:E}=n.getDraggableInfo();(!E||b.target.getAttribute("draggable-data"))&&(document.body.style.userSelect="none",document.body.style.webkitUserSelect="none")}function C(b){if(a=!0,n.start){if(n.start(b,s)===!1)return!1;t.appendChild(d),document.body.style.cursor="move"}}function $(b){a=l=!1,document.body.style.cursor="",document.body.style.userSelect="",document.body.style.webkitUserSelect="",window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",g),b&&(t.removeEventListener("mousedown",m),t.removeEventListener("touchstart",y),t.removeEventListener("dragstart",j))}return t.addEventListener("mousedown",m),t.addEventListener("touchstart",y),t.addEventListener("dragstart",j),{destroy(){$(!0)}}}const Mo=.004;function Do(){return{dirX:0,dirY:0,scrollSpeedFactor:1}}function Ao(t,e,n,s){const{node:r,left:i,top:a,bottom:l,sense:d,xScroll:u,yScroll:h}=s,f=Ut(t,r);n.scrollState||(n.scrollState=Do());let x=0,m=0;f.x<i+d?x=-1:f.x>e.width-d&&(x=1),f.y<a+Math.round(d/2)?m=-1:f.y>e.height-l-Math.round(d/2)&&(m=1),(n.scrollState.dirX!==x||n.scrollState.dirY!==m)&&(As(n),n.scrollState.dirX=x,n.scrollState.dirY=m),(u&&n.scrollState.dirX!==0||h&&n.scrollState.dirY!==0)&&To(n,s,{x:n.scrollState.dirX,y:n.scrollState.dirY})}function To(t,e,n){t.autoScrollTimer||(t.autoScrollTimer=setTimeout(()=>{t.activeAutoScroll=setInterval(Io,15,t,e,n)},250))}function As(t){t.scrollSpeedFactor=1,t.autoScrollTimer&&(t.autoScrollTimer=clearTimeout(t.autoScrollTimer),t.activeAutoScroll=clearInterval(t.activeAutoScroll))}function Io(t,e,n){const{x:s,y:r}=n;t.scrollSpeedFactor+=Mo,s!==0&&Oo(t,e,s),r!==0&&Fo(t,e,r)}function Fo(t,e,n){const s=e.node.scrollTop;Ts(s+Math.round(e.sense/3)*t.scrollSpeedFactor*n,"scrollTop",e)}function Oo(t,e,n){const s=e.node.scrollLeft;Ts(s+Math.round(e.sense/3)*t.scrollSpeedFactor*n,"scrollLeft",e)}function Ts(t,e,n){n.node[e]=t}function Mt(t,e,n,s,r,i){const a={};return t&&(a.width=`${t}px`,a.minWidth=`${t}px`),e&&(a.flexGrow=e),i&&(a.height=`${i}px`),n&&(a.position="sticky",n.left&&(a.left=`${s}px`),n.right&&(a.right=`${r}px`)),a}function Is(t,e,n){let s="";if(t.fixed)for(const r in t.fixed){let i=t.fixed[r]===-1;!i&&t.fixed.leftSize&&e.colspan&&(i=e.colspan+t._colindex-1===t.fixed.leftSize),s+=i?"wx-shadow ":"wx-fixed "}return s+=e.rowspan>1?"wx-rowspan ":"",s+=e.colspan>1?"wx-colspan ":"",s+=e.vertical?"wx-vertical ":"",s+=n?n(t)+" ":"",s}function Po(t){const{row:e,column:n,cellStyle:s=null,columnStyle:r=null,children:i,focusable:a}=t,l=c.useContext(Re),d=W(l,"focusCell"),u=W(l,"search"),h=W(l,"reorder"),f=c.useMemo(()=>u?.rows[e.id]&&u.rows[e.id][n.id],[u,e.id,n.id]),x=c.useMemo(()=>Mt(n.width,n.flexgrow,n.fixed,n.left,n.right),[n.width,n.flexgrow,n.fixed,n.left,n.right]);function m(C,$){let b="wx-cell";return b+=n.fixed?" "+(n.fixed===-1?"wx-shadow":"wx-fixed"):"",b+=C?" "+C(n):"",b+=$?" "+$(e,n):"",b+=n.treetoggle?" wx-tree-cell":"",b}const p=c.useMemo(()=>m(r,s),[r,s,n,e]),g=c.useMemo(()=>typeof n.draggable=="function"?n.draggable(e,n)!==!1:n.draggable,[n,e]),y=c.useRef(null);c.useEffect(()=>{y.current&&a&&d?.row===e.id&&d?.column===n.id&&y.current.focus()},[d,a,e.id,n.id]);const v=c.useCallback(()=>{a&&!d&&l.exec("focus-cell",{row:e.id,column:n.id,eventSource:"focus"})},[l,a,d,e.id,n.id]);function w(C){const $=new RegExp(`(${u.value.trim()})`,"gi");return String(C).split($).map(b=>({text:b,highlight:$.test(b)}))}const j=c.useMemo(()=>{const C=n.fixed&&n.fixed.left===-1||n.fixed.right===-1,$=n.fixed&&n.fixed.right;return[p,C?"wx-shadow":"",$?"wx-fixed-right":""].filter(Boolean).join(" ")},[p,n]),R=n.cell;return o.jsxs("div",{className:"wx-TSCaXsGV "+j,ref:y,onFocus:v,style:x,"data-row-id":ge(e.id),"data-col-id":ge(n.id),tabIndex:a?"0":"-1",role:"gridcell","aria-colindex":n._colindex,"aria-readonly":n.editor?void 0:!0,children:[h&&n.draggable?g?o.jsx("i",{"draggable-data":"true",className:"wx-TSCaXsGV wx-draggable wxi-drag"}):o.jsx("i",{className:"wx-TSCaXsGV wx-draggable-stub"}):null,n.treetoggle?o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{marginLeft:`${e.$level*28}px`}}),e.$count?o.jsx("i",{"data-action":"toggle-row",className:`wx-TSCaXsGV wx-table-tree-toggle wxi-menu-${e.open!==!1?"down":"right"}`}):null]}):null,R?o.jsx(R,{api:l,row:e,column:n,onAction:({action:C,data:$})=>l.exec(C,$)}):i?i():f?o.jsx("span",{children:w(Be(e,n)).map(({highlight:C,text:$},b)=>C?o.jsx("mark",{className:"wx-TSCaXsGV wx-search",children:$},b):o.jsx("span",{children:$},b))}):Be(e,n)]})}function Zn(t,e){let n,s;function r(l){n=l.clientX,t.style.opacity=1,document.body.style.cursor="ew-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",i),window.addEventListener("mouseup",a),e&&e.down&&e.down(t)}function i(l){s=l.clientX-n,e&&e.move&&e.move(s)}function a(){t.style.opacity="",document.body.style.cursor="",document.body.style.userSelect="",e&&e.up&&e.up(s),window.removeEventListener("mousemove",i),window.removeEventListener("mouseup",a)}return t.addEventListener("mousedown",r),{destroy(){t.removeEventListener("mousedown",r)}}}function Ho({filter:t,column:e,action:n,filterValue:s}){function r({value:i}){n({value:i,key:e.id})}return o.jsx(on,{...t.config??{},value:s,onChange:r})}function Lo({filter:t,column:e,action:n,filterValue:s}){const r=c.useContext(Re),i=W(r,"flatData"),a=c.useMemo(()=>t?.config?.options||e?.options||d(),[t,e,i]),l=c.useMemo(()=>t?.config?.template,[t]);function d(){const f=[];return i.forEach(x=>{const m=Ge(x,e);f.includes(m)||f.push(m)}),f.map(x=>({id:x,label:x}))}function u({value:f}){n({value:f,key:e.id})}function h(f){f.key!=="Tab"&&f.preventDefault()}return o.jsx("div",{style:{width:"100%"},onKeyDown:h,children:o.jsx(Xr,{placeholder:"",clear:!0,...t?.config??{},options:a,value:s,onChange:u,children:f=>l?l(f):f.label})})}function zo({filter:t,column:e,action:n,filterValue:s}){function r({value:i}){n({value:i,key:e.id})}return o.jsx("div",{className:"wx-aaaK5VYO",style:{width:"100%"},children:o.jsx(Zr,{placeholder:"",clear:!0,...t?.config??{},value:s,onChange:r})})}function Fs(t){const{value:e,options:n=[],placeholder:s="",clear:r=!1,text:i=null,template:a=null,cell:l=null,dropdown:d={},autoOpen:u=!1,onChange:h,onAction:f}=t,[x,m]=ys(e||[]),p=c.useMemo(()=>(x||[]).map(k=>n.find(D=>D.id===k)).filter(Boolean),[x,n]),g=c.useRef(null),y=c.useRef(null),[v,w]=c.useState(null),j=()=>{const k=x||[];if(!k.length)return 0;const D=n.find(N=>k.includes(N.id));return D?n.indexOf(D):0};function R(k){y.current=k.navigate,w(()=>k.keydown),u&&k.navigate(j())}c.useEffect(()=>{u&&(g.current?.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges())},[]);function C({id:k}){m(k),h&&h({value:k})}function $(k){k.stopPropagation(),m([]),h&&h({value:[]})}function b(){y.current?.(j())}function E(){y.current?.(null)}function P(k){v?.(k,j())}return o.jsxs("div",{ref:g,className:"wx-multiselect wx-aadNNOwy",onClick:b,onKeyDown:P,tabIndex:0,children:[o.jsx("div",{className:"wx-label wx-aadNNOwy",children:a?a(p):l?o.jsx(l,{data:p,onAction:f}):i?o.jsx("span",{className:"wx-text wx-aadNNOwy",children:i}):p.length?o.jsx("span",{className:"wx-text wx-aadNNOwy",children:p.map(k=>k.label).join(", ")}):s?o.jsx("span",{className:"wx-placeholder wx-aadNNOwy",children:s}):" "}),r&&x?.length?o.jsx("i",{className:"wx-icon wxi-close wx-aadNNOwy",onClick:$}):o.jsx("i",{className:"wx-icon wxi-angle-down wx-aadNNOwy"}),o.jsx($t,{items:n,onReady:R,onSelect:C,multiselect:!0,checkboxes:!0,value:x||[],onCancel:E,...d,children:({option:k})=>o.jsx("div",{className:"wx-option wx-aadNNOwy",children:a?a(k):l?o.jsx(l,{data:k,onAction:f}):k.label})})]})}function Bo({filter:t,column:e,action:n,filterValue:s}){const r=c.useContext(ve.i18n)?.getGroup("grid")||ot(cn).getGroup("grid"),i=c.useMemo(()=>({clear:!0,...t?.config||{}}),[t]),a=c.useMemo(()=>i.options||e.options,[i,e]),l=c.useMemo(()=>{const h=s?.length;return h?h<3?s.map(f=>e.optionsMap.get(f)).join(", "):h+" "+r("selected"):""},[s,e,r]);function d({value:h}){n({value:h,key:e.id})}function u(h){h.key!=="Tab"&&h.preventDefault()}return o.jsx("div",{style:{width:"100%"},onKeyDown:u,children:o.jsx(Fs,{placeholder:"",...i,options:a,value:s||[],text:l,onChange:d})})}const Go={text:Ho,richselect:Lo,datepicker:zo,multiselect:Bo};function Vo({filter:t,column:e}){const n=c.useContext(Re),s=W(n,"filterValues");function r(a){n.exec("filter-rows",a)}const i=c.useMemo(()=>Go[t.type],[t.type]);return o.jsx(i,{filter:t,column:e,action:r,filterValue:s[e.id]})}function Yo(t){const{cell:e,column:n,row:s,lastRow:r,sortRow:i,columnStyle:a,bodyHeight:l,hasSplit:d}=t,u=c.useContext(Re),h=W(u,"sortMarks"),f=c.useMemo(()=>h?h[n.id]:void 0,[h,n.id]),x=c.useRef(),m=c.useCallback(M=>{x.current=e.flexgrow?M.parentNode.clientWidth:e.width},[e.flexgrow,e.width]),p=c.useCallback((M,H)=>{u.exec("resize-column",{id:e.id,width:Math.max(1,(x.current||0)+M),inProgress:H})},[u,e.id]),g=c.useCallback(M=>p(M,!0),[p]),y=c.useCallback(M=>p(M,!1),[p]),v=c.useCallback(M=>{if(!n.sort||e.filter)return;let H=f?.order;H&&(H=H==="asc"?"desc":"asc"),u.exec("sort-rows",{key:e.id,add:M.ctrlKey||M.metaKey,order:H})},[u,e.id,e.filter,n.sort,f?.order]),w=c.useCallback(M=>{M&&M.stopPropagation(),u.exec("collapse-column",{id:e.id,row:s})},[u,e.id,s]),j=c.useCallback(M=>{M.key==="Enter"&&w()},[w]),R=c.useCallback(M=>{M.key==="Enter"&&!e.filter&&v(M)},[v,e.filter]),C=c.useMemo(()=>e.collapsed&&n.collapsed,[e.collapsed,n.collapsed]),$=c.useMemo(()=>C&&!d&&e.collapsible!=="header",[C,d,e.collapsible]),b=c.useMemo(()=>$?{top:-l/2,position:"absolute"}:{},[$,l]),E=c.useMemo(()=>Mt(e.width,e.flexgrow,n.fixed,n.left,e.right??n.right,e.height+(C&&$?l:0)),[e.width,e.flexgrow,n.fixed,n.left,e.right,n.right,e.height,C,$,l]),P=c.useMemo(()=>Is(n,e,a),[n,e,a]),k=c.useCallback(()=>Object.fromEntries(Object.entries(e).filter(([M])=>M!=="cell")),[e]),D=`wx-cell ${P} ${e.css||""} wx-collapsed`,N=["wx-cell",P,e.css||"",e.filter?"wx-filter":"",n.fixed&&n.fixed.right?"wx-fixed-right":""].filter(Boolean).join(" "),O=c.useRef(null);return c.useEffect(()=>{const M=O.current;if(!M)return;const H=Zn(M,{down:m,move:g,up:y});return()=>{typeof H=="function"&&H()}},[m,g,y,Zn]),C?o.jsx("div",{className:"wx-RsQD74qC "+D,style:E,role:"button","aria-label":`Expand column ${e.text||""}`,"aria-expanded":!e.collapsed,tabIndex:0,onKeyDown:j,onClick:w,"data-header-id":ge(n.id),children:o.jsx("div",{className:"wx-RsQD74qC wx-text",style:b,children:e.text||""})}):o.jsxs("div",{className:"wx-RsQD74qC "+N,style:E,onClick:v,"data-header-id":ge(n.id),tabIndex:!e._hidden&&n.sort&&!e.filter?0:void 0,role:"columnheader","aria-colindex":n._colindex,"aria-colspan":e.colspan>1?e.colspan:void 0,"aria-rowspan":e.rowspan>1?e.rowspan:void 0,"aria-sort":!f?.order||e.filter?"none":f?.order==="asc"?"ascending":"descending",onKeyDown:R,children:[e.collapsible?o.jsx("div",{className:"wx-RsQD74qC wx-collapse",role:"button","aria-label":e.collapsed?"Expand column":"Collapse column","aria-expanded":!e.collapsed,tabIndex:0,onKeyDown:j,onClick:w,children:o.jsx("i",{className:`wx-RsQD74qC wxi-angle-${e.collapsed?"down":"right"}`})}):null,e.cell?(()=>{const M=e.cell;return o.jsx(M,{api:u,cell:k(),column:n,row:s,onAction:({action:H,data:Z})=>u.exec(H,Z)})})():e.filter?o.jsx(Vo,{filter:e.filter,column:n}):o.jsx("div",{className:"wx-RsQD74qC wx-text",children:e.text||""}),n.resize&&r&&!e._hidden?o.jsx("div",{className:"wx-RsQD74qC wx-grip",role:"presentation","aria-label":"Resize column",ref:O,onClick:M=>M.stopPropagation(),children:o.jsx("div",{})}):null,i?o.jsx("div",{className:"wx-RsQD74qC wx-sort",children:f?o.jsxs(o.Fragment,{children:[typeof f.index<"u"?o.jsx("div",{className:"wx-RsQD74qC wx-order",children:f.index+1}):null,o.jsx("i",{className:`wx-RsQD74qC wxi-arrow-${f.order==="asc"?"up":"down"}`})]}):null}):null]})}function Ko({cell:t,column:e,row:n,columnStyle:s}){const r=c.useContext(Re),i=c.useMemo(()=>Mt(t?.width,t?.flexgrow,e?.fixed,e?.left,t?.right??e?.right,t?.height),[t?.width,t?.flexgrow,e?.fixed,e?.left,t?.right,e?.right,t?.height]),a=c.useMemo(()=>Is(e,t,s),[e,t,s]),l=c.useCallback(()=>Object.fromEntries(Object.entries(t||{}).filter(([u])=>u!=="cell")),[t]),d=`wx-6Sdi3Dfd wx-cell ${a||""} ${t?.css||""}`+(e?.fixed&&e?.fixed.right?" wx-fixed-right":"");return o.jsx("div",{className:d,style:i,children:!e?.collapsed&&!t?.collapsed?t?.cell?Qt.createElement(t.cell,{api:r,cell:l(),column:e,row:n,onAction:({action:u,data:h})=>r.exec(u,h)}):o.jsx("div",{className:"wx-6Sdi3Dfd wx-text",children:t?.text||""}):null})}function Xn({deltaLeft:t,contentWidth:e,columns:n,type:s="header",columnStyle:r,bodyHeight:i}){const a=c.useContext(Re),l=W(a,"_sizes"),d=W(a,"split"),u=c.useMemo(()=>l?.[`${s}RowHeights`],[l,s]),h=c.useMemo(()=>{let g=[];if(n&&n.length){const y=n[0][s].length;for(let v=0;v<y;v++){let w=0;g.push([]),n.forEach((j,R)=>{const C={...j[s][v]};w||g[v].push(C),C.colspan>1?w=C.colspan-1:w&&w--})}}return g},[n,s]),f=c.useMemo(()=>d?.left||d?.right,[d]);function x(g){return n.find(y=>y.id===g)}function m(g,y){let v=y;return g.rowspan&&(v+=g.rowspan-1),v===h.length-1}function p(g,y,v){if(!v.sort)return!1;for(let w=h.length-1;w>=0;w--){const j=v.header[w];if(!j.filter&&!j._hidden)return y===w}return m(g,y)}return o.jsx("div",{className:`wx-sAsPVaUK wx-${s}`,style:{paddingLeft:`${t}px`,width:`${e}px`},role:"rowgroup",children:h.map((g,y)=>o.jsx("div",{className:s==="header"?"wx-sAsPVaUK wx-h-row":"wx-sAsPVaUK wx-f-row",style:{height:`${u?.[y]}px`,display:"flex"},role:"row",children:g.map(v=>{const w=x(v.id);return s==="header"?o.jsx(Yo,{cell:v,columnStyle:r,column:w,row:y,lastRow:m(v,y),bodyHeight:i,sortRow:p(v,y,w),hasSplit:f},v.id):o.jsx(Ko,{cell:v,columnStyle:r,column:x(v.id),row:y},v.id)})},y))})}function Wo({overlay:t}){const e=c.useContext(Re);function n(r){return typeof r=="function"}const s=t;return o.jsx("div",{className:"wx-1ty666CQ wx-overlay",children:n(t)?o.jsx(s,{onAction:({action:r,data:i})=>e.exec(r,i)}):t})}function Uo(t){const{editor:e,onSave:n,onApply:s}=t,[r,i]=c.useState(e?.value||""),{type:a="text"}=c.useMemo(()=>e?.config||{},[e]),l=c.useRef(null);c.useEffect(()=>{l.current&&l.current.focus()},[]),c.useEffect(()=>{if(!l.current)return;const h=Pe(l.current,()=>n(!0));return()=>h.destroy()},[n]);function d(){l.current&&(i(l.current.value),s(l.current.value))}function u({key:h}){h==="Enter"&&n()}return o.jsx("input",{className:"wx-e7Ao5ejY wx-text",onInput:d,onKeyDown:u,ref:l,type:a,value:r})}function qo({editor:t,onAction:e,onSave:n,onApply:s,onCancel:r}){const[i,a]=c.useState(t?.value),[l,d]=c.useState(t?.renderedValue),[u,h]=c.useState(t?.options||[]),f=c.useMemo(()=>t?.config?.template,[t]),x=c.useMemo(()=>t?.config?.cell,[t]),m=c.useMemo(()=>t?.config?.dropdown||{},[t]),p=c.useMemo(()=>({trackScroll:!0,...m}),[m]),g=c.useMemo(()=>(u||[]).findIndex(b=>b.id===i),[u,i]),y=c.useRef(null),v=c.useRef(null),w=c.useCallback(b=>{y.current=b.navigate,v.current=b.keydown,y.current(g)},[g,y]),j=c.useCallback(b=>{const E=b?.target?.value??"";d(E);const P=E?(t?.options||[]).filter(k=>(k.label||"").toLowerCase().includes(E.toLowerCase())):t?.options||[];h(P),P.length?y.current(-1/0):y.current(null)},[t]),R=c.useRef(null);c.useEffect(()=>{R.current&&R.current.focus()},[]);const C=c.useRef(n);c.useEffect(()=>{C.current=n},[n]),c.useEffect(()=>{if(!R.current)return;const b=Pe(R.current,()=>C.current(!0));return()=>b.destroy()},[]),c.useEffect(()=>{a(t?.value),d(t?.renderedValue),h(t?.options||[])},[t]);const $=c.useCallback(({id:b})=>{s(b),n()},[s,n]);return o.jsxs(o.Fragment,{children:[o.jsx("input",{className:"wx-0UYfSd1x wx-input",ref:R,value:l??"",onChange:j,onKeyDown:b=>v.current?v.current(b,g):void 0}),o.jsx($t,{items:u,onReady:w,onSelect:$,...p,onCancel:r,children:({option:b})=>f?f(b):x?o.jsx(x,{data:b,onAction:e}):b.label})]})}function Jo({editor:t,onAction:e,onSave:n,onApply:s,onCancel:r}){const[i]=c.useState(()=>t.value||new Date),{template:a,cell:l,dropdown:d={}}=t?.config||{},u=c.useMemo(()=>({trackScroll:!0,width:"auto",...d}),[d]);function h({value:p}){s(p),n()}const f=c.useRef(null),[x,m]=c.useState(null);return c.useEffect(()=>{f.current&&f.current.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges()},[]),c.useEffect(()=>{if(!x)return;const p=Pe(x,()=>n(!0));return()=>p.destroy()},[x,n]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-lNWNYUb6 wx-value",ref:f,tabIndex:0,onClick:r,onKeyDown:p=>p.preventDefault(),children:a?a(i):l?o.jsx(l,{data:t.value,onAction:e}):o.jsx("span",{className:"wx-lNWNYUb6 wx-text",children:t.renderedValue})}),o.jsx(rn,{...u,onCancel:r,children:o.jsx("div",{ref:m,className:"wx-lNWNYUb6",children:o.jsx(ps,{value:i,onChange:h,buttons:t.config?.buttons})})})]})}function Qo(t){const{editor:e}=t,n=t.onAction??t.onaction,s=t.onSave??t.onsave,r=t.onApply??t.onapply,i=t.onCancel??t.oncancel,a=e.config||{},{dropdown:l={}}=a,d=c.useMemo(()=>({trackScroll:!0,...l}),[l]),[u]=c.useState(e.options.find(j=>j.id===e.value)),[h]=c.useState(e.value),[f]=c.useState(e.options),x=c.useMemo(()=>f.findIndex(j=>j.id===h),[f,h]);function m({id:j}){r(j),s()}let p;const[g,y]=c.useState();function v(j){p=j.navigate,y(()=>j.keydown),p(x)}const w=c.useRef(null);return c.useEffect(()=>{w.current&&w.current.focus(),typeof window<"u"&&window.getSelection&&window.getSelection().removeAllRanges()},[]),c.useEffect(()=>{if(!w.current)return;const j=Pe(w.current,()=>s(!0));return()=>j.destroy()},[s]),o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:w,className:"wx-ywGRk611 wx-value",tabIndex:0,onClick:i,onKeyDown:j=>{g(j,x),j.preventDefault()},children:a.template?a.template(u):a.cell?(()=>{const j=a.cell;return o.jsx(j,{data:u,onAction:n})})():o.jsx("span",{className:"wx-ywGRk611 wx-text",children:e.renderedValue})}),o.jsx($t,{items:f,onReady:v,onSelect:m,...d,onCancel:i,children:({option:j})=>a.template?a.template(j):a.cell?(()=>{const R=a.cell;return o.jsx(R,{data:j,onAction:n})})():j.label})]})}function Zo(t){const{editor:e,onAction:n,onSave:s,onApply:r}=t,i=e?.config||{},a=e?.options??[],l=e?.value||[],d=e?.renderedValue,u=c.useMemo(()=>({trackScroll:!0,...i.dropdown||{}}),[i]);function h({value:x}){r(x)}const f=c.useRef(null);return c.useEffect(()=>{if(!f.current)return;const x=Pe(f.current,()=>s(!0));return()=>x.destroy()},[s]),o.jsx("div",{ref:f,className:"wx-value wx-aacZ4gNU",onClick:()=>s(!0),children:o.jsx(Fs,{value:l,options:a,text:d,template:i.template,cell:i.cell,clear:i.clear,dropdown:u,autoOpen:!0,onChange:h,onAction:n})})}const Xo={text:Uo,combo:qo,datepicker:Jo,richselect:Qo,multiselect:Zo};function ea({column:t,row:e}){const n=c.useContext(Re),s=W(n,"editor"),r=c.useCallback((p,g)=>{n.exec("close-editor",{ignore:p}),g&&n.exec("focus-cell",{...g,eventSource:"click"})},[n]),i=c.useCallback(p=>{const g=p?null:{row:s?.id,column:s?.column};r(!1,g)},[s,r]),a=c.useCallback(()=>{r(!0,{row:s?.id,column:s?.column})},[s,r]),l=c.useCallback(p=>{n.exec("editor",{value:p})},[n]),d=c.useCallback(p=>{p.key==="Enter"&&s&&(t.editor.type==="multiselect"?l(s.value):a())},[s,t.editor,a,l]),u=c.useMemo(()=>Mt(t.width,t.flexgrow,t.fixed,t.left,t.right),[t.width,t.flexgrow,t.fixed,t.left,t.right]),h=c.useMemo(()=>{let p=t.editor;if(typeof p=="function"&&(p=p(e,t)),!p)return null;let g=typeof p=="string"?p:p.type;return Xo[g]},[t,e]),f=c.useRef(null);c.useEffect(()=>{f.current&&typeof u=="string"&&f.current.setAttribute("style",u)},[u]);const x=typeof e.$parent<"u"?"gridcell":"cell",m=typeof e.$parent<"u"?!t.editor:void 0;return o.jsx("div",{className:"wx-8l724t2g wx-cell wx-editor",ref:f,style:typeof u=="object"&&u!==null?u:void 0,role:x,"aria-readonly":m,tabIndex:-1,onClick:p=>p.stopPropagation(),onDoubleClick:p=>p.stopPropagation(),onKeyDown:d,children:h?o.jsx(h,{editor:s,onSave:i,onApply:l,onCancel:a,onAction:({action:p,data:g})=>n.exec(p,g)}):null})}function es(t){const{columns:e,type:n,columnStyle:s}=t,r=c.useContext(Re),{filterValues:i,_columns:a,_sizes:l}=r.getState();function d(u){return s?" "+s(u):""}return o.jsx(o.Fragment,{children:e.map((u,h)=>o.jsx("tr",{children:u.map(f=>{const x=a.find(g=>g.id===f.id),m=`wx-print-cell-${n}${d(x)}${f.filter?" wx-print-cell-filter":""}${f.vertical?" wx-vertical":""}`,p=f.cell;return o.jsx("th",{style:bs(Es(f,l.columnWidth)),className:"wx-Gy81xq2u "+m,rowSpan:f.rowspan,colSpan:f.colspan,children:p?o.jsx(p,{api:r,cell:Object.fromEntries(Object.entries(f).filter(([g])=>g!=="cell")),column:x,row:h}):f.filter?o.jsx("div",{className:"wx-Gy81xq2u wx-print-filter",children:so(i,a,f)}):o.jsx("div",{className:"wx-Gy81xq2u wx-text",children:f.text??""})},f.id)})},h))})}function ta(t){const{columns:e,rowStyle:n,columnStyle:s,cellStyle:r,header:i,footer:a,reorder:l}=t,d=c.useContext(Re),{flatData:u,_sizes:h}=d.getState(),f=i&&Wn(e,"header",h.headerRowHeights),x=a&&Wn(e,"footer",h.footerRowHeights);function m(g,y){let v="";return v+=s?" "+s(y):"",v+=r?" "+r(g,y):"",v}function p(g,y){return typeof y.draggable=="function"?y.draggable(g,y)!==!1:y.draggable}return o.jsxs("table",{className:`wx-8NTMLH0z wx-print-grid ${e.some(g=>g.flexgrow)?"wx-flex-columns":""}`,children:[i?o.jsx("thead",{children:o.jsx(es,{columns:f,type:"header",columnStyle:s})}):null,o.jsx("tbody",{children:u.map((g,y)=>o.jsx("tr",{className:"wx-8NTMLH0z wx-row"+(n?" "+n(g):""),style:{height:`${g.rowHeight||h.rowHeight}px`},children:e.map(v=>v.collapsed?null:o.jsxs("td",{className:`wx-8NTMLH0z wx-print-cell wx-cell ${m(g,v)}`,style:bs(Es(v,h.columnWidth)),children:[l&&v.draggable?o.jsx("span",{className:"wx-8NTMLH0z wx-print-draggable",children:p(g,v)?o.jsx("i",{className:"wx-8NTMLH0z wxi-drag"}):null}):null,v.treetoggle?o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{marginLeft:g.$level*28+"px"}}),g.$count?o.jsx("i",{className:`wx-8NTMLH0z wx-print-grid-tree-toggle wxi-menu-${g.open!==!1?"down":"right"}`}):null]}):null,v.cell?(()=>{const w=v.cell;return o.jsx(w,{api:d,row:g,column:v})})():o.jsx("span",{children:Be(g,v)})]},v.id))},y))}),a?o.jsx("tfoot",{children:o.jsx(es,{columns:x,type:"footer",columnStyle:s})}):null]})}function na(t){const{config:e,...n}=t,s=c.useContext(Re),{_skin:r,_columns:i}=s.getState(),a=c.useMemo(()=>Xi(i,e),[]),l=c.useRef(null);return c.useEffect(()=>{const d=document.body;d.classList.add("wx-print");const u=l.current;if(!u)return;const h=u.cloneNode(!0);d.appendChild(h);const f=`@media print { @page { size: ${e.paper} ${e.mode}; }`,x=document.createElement("style");x.setAttribute("type","text/css"),x.setAttribute("media","print"),document.getElementsByTagName("head")[0].appendChild(x),x.appendChild(document.createTextNode(f)),window.print(),x.remove(),d.classList.remove("wx-print"),h.remove()},[]),o.jsx("div",{className:`wx-4zwCKA7C wx-${r}-theme wx-print-container`,ref:l,children:a.map((d,u)=>o.jsx("div",{className:"wx-4zwCKA7C wx-print-grid-wrapper",children:o.jsx(ta,{columns:d,...n})},u))})}function sa(t){const{header:e,footer:n,overlay:s,multiselect:r,onreorder:i,rowStyle:a,columnStyle:l,cellStyle:d,autoRowHeight:u,resize:h,clientWidth:f,clientHeight:x,responsiveLevel:m,hotkeys:p}=t,g=c.useContext(Re),y=W(g,"dynamic"),v=W(g,"_columns"),w=W(g,"flatData"),j=W(g,"split"),R=W(g,"_sizes"),[C,$]=Ee(g,"selectedRows"),b=W(g,"select"),E=W(g,"editor"),P=W(g,"scrollLeft"),k=W(g,"scrollTop"),D=W(g,"tree"),N=W(g,"focusCell"),O=W(g,"_print"),M=W(g,"undo"),H=W(g,"reorder"),Z=W(g,"_rowHeightFromData"),[te,ce]=c.useState(0);c.useEffect(()=>{ce(Ws())},[]);const[de,B]=c.useState(0),G=c.useMemo(()=>(v||[]).some(S=>!S.hidden&&S.flexgrow),[v]),T=c.useMemo(()=>R?.rowHeight||0,[R]),U=c.useRef(null),[X,J]=c.useState(null),[ue,he]=c.useState(null),ie=c.useMemo(()=>{let S=[],A=0;return j&&j.left&&(S=(v||[]).slice(0,j.left).filter(L=>!L.hidden).map(L=>({...L})),S.forEach(L=>{L.fixed={left:1,leftSize:j.left},L.left=A,A+=L.width}),S.length&&(S[S.length-1].fixed.left=-1)),{columns:S,width:A}},[j,v]),se=c.useMemo(()=>{let S=[],A=0;if(j&&j.right){S=(v||[]).slice(j.right*-1).filter(L=>!L.hidden).map(L=>({...L}));for(let L=S.length-1;L>=0;L--){const Q=S[L];Q.fixed={right:1},Q.right=A,A+=Q.width}S.length&&(S[0].fixed={right:-1})}return{columns:S,width:A}},[j,v]),oe=c.useMemo(()=>{const S=(v||[]).slice(j?.left||0,(v||[]).length-(j?.right??0)).filter(A=>!A.hidden);return S.forEach(A=>{A.fixed=0}),S},[v,j]),ne=c.useMemo(()=>(v||[]).reduce((S,A)=>(A.hidden||(S+=A.width),S),0),[v]),ke=1;function _(S,A,L){let Q=A,pe=S;if(oe.length){let fe=oe.length;for(let K=S;K>=0;K--)oe[K][L].forEach(le=>{le.colspan>1&&K>S-le.colspan&&K<fe&&(fe=K)});if(fe!==oe.length&&fe<S){for(let K=fe;K<S;K++)Q-=oe[K].width;pe=fe}}return{index:pe,delta:Q}}const F=c.useMemo(()=>{let S,A,L;const Q=P||0,pe=(P||0)+(f||0);let fe=0,K=0,le=0,$e=0;oe.forEach((He,Fe)=>{Q>le&&(fe=Fe,$e=le),le=le+He.width,pe>le&&(K=Fe+ke)});const Ae={header:0,footer:0};for(let He=K;He>=fe;He--)["header","footer"].forEach(Fe=>{oe[He]&&oe[He][Fe].forEach(Qs=>{const Ot=Qs.colspan;if(Ot&&Ot>1){const Sn=Ot-(K-He+1);Sn>0&&(Ae[Fe]=Math.max(Ae[Fe],Sn))}})});const ze=_(fe,$e,"header"),ye=_(fe,$e,"footer"),Te=ze.delta,ft=ze.index,ht=ye.delta,xt=ye.index;return G&&ne>(f||0)?S=A=L=[...ie.columns,...oe,...se.columns]:(S=[...ie.columns,...oe.slice(fe,K+1),...se.columns],A=[...ie.columns,...oe.slice(ft,K+Ae.header+1),...se.columns],L=[...ie.columns,...oe.slice(xt,K+Ae.footer+1),...se.columns]),{data:S||[],header:A||[],footer:L||[],d:$e,df:ht,dh:Te}},[oe,ie,se,P,f,G,ne]),Y=c.useMemo(()=>e&&R?.headerHeight||0,[e,R]),V=c.useMemo(()=>n&&R?.footerHeight||0,[n,R]),z=c.useMemo(()=>f&&x?ne>=f:!1,[f,x,ne]),[re,ae]=c.useState(!1),Ne=c.useMemo(()=>(x||0)-Y-V-(z?te:0),[x,Y,V,z,te]),lt=c.useMemo(()=>Math.ceil((Ne||0)/(T||1))+1,[Ne,T]),I=c.useRef([]),[q,ee]=c.useState(0),[_e,Ve]=c.useState(void 0),xe=c.useMemo(()=>{let S=0,A=0;const L=2,Q=k||0;if(u){let K=Q;for(;K>0;)K-=I.current[S]||T,S++;A=Q-K;for(let le=Math.max(0,S-L-1);le<S;le++)A-=I.current[S-le]||T;S=Math.max(0,S-L)}else{if(Z){let K=0,le=0;for(let ye=0;ye<(w||[]).length;ye++){const Te=w[ye].rowHeight||T;if(le+Te>Q){K=ye;break}le+=Te}S=Math.max(0,K-L);for(let ye=0;ye<S;ye++)A+=w[ye].rowHeight||T;let $e=0,Ae=0;for(let ye=K+1;ye<(w||[]).length;ye++){const Te=w[ye].rowHeight||T;if($e++,Ae+Te>Ne)break;Ae+=Te}const ze=Math.min(y?y.rowCount:(w||[]).length,K+$e+L);return{d:A,start:S,end:ze}}S=Math.floor(Q/(T||1)),S=Math.max(0,S-L),A=S*(T||0)}const pe=y?y.rowCount:(w||[]).length,fe=Math.min(pe,S+(lt||0)+L);return{d:A,start:S,end:fe}},[u,Z,k,T,y,w,lt,Ne]),pn=c.useMemo(()=>{const S=y?y.rowCount:(w||[]).length;if(u)return q+xe.d+(S-(_e||0))*(T||0);if(!Z)return S*(T||0);let A=0;for(let L=0;L<S;L++)A+=w[L]?.rowHeight||T;return A},[y,w,T,u,Z,q,xe.d,_e]),mn=c.useRef({});mn.current={clientWidth:f,clientHeight:x,fullHeight:pn,headerHeight:Y,footerHeight:V,fullWidth:ne,SCROLLSIZE:te};const ct=c.useCallback(()=>{const S=mn.current;ae(S.clientWidth&&S.clientHeight?S.fullHeight+S.headerHeight+S.footerHeight>=S.clientHeight-(S.fullWidth>=S.clientWidth?S.SCROLLSIZE:0):!1)},[]);c.useEffect(()=>{const S=requestAnimationFrame(ct);return()=>window.cancelAnimationFrame(S)},[de,ct]),c.useEffect(()=>{ct()},[x,ct]);const Ye=c.useMemo(()=>G&&ne<=(f||0)?(f||0)-0-(re?te:0):ne,[G,ne,f,re,te,z]),Dt=c.useMemo(()=>G&&ne<=(f||0)?f||0:Ye<(f||0)?ne+(re?te:0):-1,[G,ne,f,Ye,re,te]),At=c.useRef({});c.useEffect(()=>{if(y&&(At.current.start!==xe.start||At.current.end!==xe.end)){const{start:S,end:A}=xe;At.current={start:S,end:A},g&&g.exec&&g.exec("request-data",{row:{start:S,end:A}})}},[y,xe,g]);const De=c.useMemo(()=>y?w||[]:(w||[]).slice(xe.start,xe.end),[y,w,xe]),et=c.useMemo(()=>(C||[]).filter(S=>(De||[]).some(A=>A.id===S)),[$,De]),Tt=c.useMemo(()=>xe.start,[xe.start]),gn=c.useRef({top:k,left:P});gn.current={top:k,left:P};const zs=c.useCallback(S=>{const A=S.target.scrollTop,L=S.target.scrollLeft,Q=gn.current;(A!==Q.top||L!==Q.left)&&g.exec("scroll-to",{top:A,left:L})},[g]),Bs=c.useCallback(S=>{S.shiftKey&&S.preventDefault(),U.current&&U.current.focus&&U.current.focus()},[]),wn=c.useCallback(()=>!!(v||[]).find(S=>!!S.draggable),[v]),It=c.useRef(null),We=c.useRef(null),Gs=c.useRef({dblclick:(S,A)=>{const L={id:S,column:rt(A,"data-col-id")};g.exec("open-editor",L)},click:(S,A)=>{if(A.target.closest("input")||It.current)return;const L=rt(A,"data-col-id");if(N?.id!==S&&g.exec("focus-cell",{row:S,column:L,eventSource:"click"}),b===!1)return;const Q=r&&(A.ctrlKey||A.metaKey),pe=r&&A.shiftKey;(Q||C.length>1||!C.includes(S))&&g.exec("select-row",{id:S,toggle:Q,range:pe})},"toggle-row":S=>{const A=g.getRow(S);g.exec(A.open!==!1?"close-row":"open-row",{id:S})},"ignore-click":()=>!1}),dt=c.useMemo(()=>({top:Y,bottom:V,left:ie.width,xScroll:z,yScroll:re,sense:u&&ue?ue.offsetHeight:Math.max(R?.rowHeight||0,40),node:U.current&&U.current.firstElementChild}),[Y,V,ie.width,z,re,u,ue,R]);function Vs(S,A){const{container:L,sourceNode:Q,from:pe}=A;if(wn()&&!Q.getAttribute("draggable-data"))return!1;J(pe),D&&g.getRow(pe).open&&g.exec("close-row",{id:pe,nested:!0});const fe=Ze(Q),K=fe.cloneNode(!0);K.classList.remove("wx-selected"),K.querySelectorAll("[tabindex]").forEach(ze=>ze.setAttribute("tabindex","-1")),L.appendChild(K),he(K);const le=(P||0)-F.d,$e=re?te:0;L.style.width=Math.min((f||0)-$e,G&&ne<=(f||0)?Ye:Ye-$e)+le+"px";const Ae=St(fe);A.offset={x:le,y:-Math.round(Ae.height/2)},We.current||(We.current=S.clientY)}function Ys(S,A){const{from:L}=A,Q=A.pos,pe=St(U.current);Q.x=pe.x;const fe=dt.top;if(Q.y<fe)Q.y=fe;else{const K=pe.height-(z&&te>0?te:Math.round(dt.sense/2))-dt.bottom;Q.y>K&&(Q.y=K)}if(U.current.contains(A.targetNode)){const K=Ze(A.targetNode),le=K&&_t(K);if(le&&le!==L){A.to=le;const $e=u?ue?.offsetHeight:R?.rowHeight;if(ue&&((k||0)===0||Q.y>fe+$e-1)){const Ae=K.getBoundingClientRect(),ze=St(ue).y,ye=Ae.y,Te=ze>ye?-1:1,ft=Te===1?"after":"before",ht=g.getState().flatData,xt=Math.abs(ht.findIndex(Fe=>Fe.id===L)-ht.findIndex(Fe=>Fe.id===le)),He=xt!==1?ft==="before"?"after":"before":ft;if(xt===1&&(Te===-1&&S.clientY>We.current||Te===1&&S.clientY<We.current))return;We.current=S.clientY,g.exec("move-item",{id:L,target:le,mode:He,inProgress:!0})}}i&&i({event:S,context:A})}Ao(S,pe,A,dt)}function Ks(S,A){const{from:L,to:Q}=A;g.exec("move-item",{id:L,target:Q,inProgress:!1}),It.current=setTimeout(()=>{It.current=0},1),J(null),he(null),We.current=null,As(A)}function Ws(){const S=document.createElement("div");S.style.cssText="position:absolute;left:-1000px;width:100px;padding:0px;margin:0px;min-height:100px;overflow-y:scroll;",document.body.appendChild(S);const A=S.offsetWidth-S.clientWidth;return document.body.removeChild(S),A}const Us=c.useMemo(()=>Dt>0?{width:`${Dt}px`}:void 0,[Dt]),vn=c.useRef(null);function qs(){Promise.resolve().then(()=>{let S=0,A=Tt;const L=vn.current;L&&(Array.from(L.children).forEach((Q,pe)=>{I.current[Tt+pe]=Q.offsetHeight,S+=Q.offsetHeight,A++}),ee(S),Ve(A))})}c.useEffect(()=>{De&&u&&qs()},[De,u,Tt]);let[Ue,Ft]=c.useState();c.useEffect(()=>{if(N&&(!b||!et.length||et.includes(N.row)))Ft({...N});else if(De.length&&F.data.length){if(!Ue||et.length&&!et.includes(Ue.row)||De.findIndex(S=>S.id===Ue.row)===-1||F.data.findIndex(S=>S.id===Ue.column&&!S.collapsed)===-1){const S=et[0]||De[0].id,A=F.data.findIndex(L=>!L.collapsed);Ft(A!==-1?{row:S,column:F.data[A].id}:null)}}else Ft(null)},[N]);const yn=c.useRef(null);c.useEffect(()=>{const S=U.current;if(!S)return;const A=Ro(S,h);return()=>{typeof A=="function"&&A()}},[h]);const bn=c.useRef({});Object.assign(bn.current,{start:Vs,move:Ys,end:Ks,getReorder:()=>H,getDraggableInfo:()=>({hasDraggable:wn()})}),c.useEffect(()=>{const S=U.current;return S?Eo(S,bn).destroy:void 0},[H,U.current]),c.useEffect(()=>{const S=U.current;return S?No(S,{keys:p!==!1&&{...ko,"ctrl+z":M,"ctrl+y":M,...p},exec:A=>g.exec("hotkey",A)}).destroy:void 0},[g,M,p]);const ut=c.useRef({scroll:g.getReactiveState().scroll,scrollLeft:g.getReactiveState().scrollLeft,scrollTop:g.getReactiveState().scrollTop});ut.current.getWidth=()=>(f||0)-(re?te:0),ut.current.getHeight=()=>Ne,ut.current.getScrollMargin=()=>ie.width+se.width,c.useEffect(()=>{_o(yn.current,ut.current)},[]);const jn=c.useRef(null);c.useEffect(()=>{const S=jn.current;if(!S)return;const A=[];A.push(Pe(S,()=>N&&g.exec("focus-cell",{eventSource:"click"})).destroy),A.push($i(S,Gs.current)),B(S.clientHeight);const L=new ResizeObserver(()=>{B(S.clientHeight)});return L.observe(S),A.push(()=>L.disconnect()),()=>A.forEach(Q=>Q())},[]);const Js=`wx-grid ${m?`wx-responsive-${m}`:""}`;return c.useEffect(()=>{N&&(De.some(S=>S.id===N.row)&&F.data.some(S=>S.id===N.column&&!S.collapsed)||g.exec("focus-cell",{eventSource:"destroy"}))},[N,De,F.data,g]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-4VuBwK2D "+Js,style:{"--header-height":`${Y}px`,"--footer-height":`${V}px`,"--split-left-width":`${ie.width}px`,"--split-right-width":`${se.width}px`},children:o.jsx("div",{ref:U,className:"wx-4VuBwK2D wx-table-box",style:Us,role:D?"treegrid":"grid","aria-colcount":F.data.length,"aria-rowcount":De.length,"aria-multiselectable":D&&r?!0:void 0,tabIndex:-1,children:o.jsxs("div",{ref:yn,className:"wx-4VuBwK2D wx-scroll",style:{overflowX:z?"scroll":"hidden",overflowY:re?"scroll":"hidden"},onScroll:zs,children:[e?o.jsx("div",{className:"wx-4VuBwK2D wx-header-wrapper",children:o.jsx(Xn,{contentWidth:Ye,deltaLeft:F.dh,columns:F.header,columnStyle:l,bodyHeight:Ne-+n})}):null,o.jsxs("div",{ref:jn,className:"wx-4VuBwK2D wx-body",style:{width:`${Ye}px`,height:`${pn}px`},onMouseDown:S=>Bs(S),children:[s?o.jsx(Wo,{overlay:s}):null,o.jsx("div",{ref:vn,className:"wx-4VuBwK2D wx-data",style:{paddingTop:`${xe.d}px`,paddingLeft:`${F.d}px`},children:De.map((S,A)=>{const L=C.indexOf(S.id)!==-1,Q=X===S.id,pe="wx-row"+(u?" wx-autoheight":"")+(a?" "+a(S):"")+(L?" wx-selected":"")+(Q?" wx-inactive":""),fe=u?{minHeight:`${S.rowHeight||T}px`}:{height:`${S.rowHeight||T}px`};return o.jsx("div",{className:"wx-4VuBwK2D "+pe,"data-id":ge(S.id),"data-context-id":ge(S.id),style:fe,role:"row","aria-rowindex":A,"aria-expanded":S.open,"aria-level":D?S.$level+1:void 0,"aria-selected":D?L:void 0,tabIndex:-1,children:F.data.map(K=>K.collapsed?o.jsx("div",{className:"wx-4VuBwK2D wx-cell wx-collapsed"},K.id):E?.id===S.id&&E.column===K.id?o.jsx(ea,{row:S,column:K},K.id):o.jsx(Po,{row:S,column:K,columnStyle:l,cellStyle:d,reorder:H,focusable:Ue?.row===S.id&&Ue?.column===K.id},K.id))},S.id)})})]}),n&&(w||[]).length?o.jsx(Xn,{type:"footer",contentWidth:Ye,deltaLeft:F.df,columns:F.footer,columnStyle:l}):null]})})}),O?o.jsx(na,{config:O,rowStyle:a,columnStyle:l,cellStyle:d,header:e,footer:n,reorder:H}):null]})}const ra=t=>t.split("-").map(e=>e?e.charAt(0).toUpperCase()+e.slice(1):"").join(""),ia=c.forwardRef(function({data:t=[],columns:e=[],rowStyle:n=null,columnStyle:s=null,cellStyle:r=null,selectedRows:i,select:a=!0,multiselect:l=!1,header:d=!0,footer:u=!1,dynamic:h=null,overlay:f=null,reorder:x=!1,onReorder:m=null,autoRowHeight:p=!1,sizes:g,split:y,tree:v=!1,autoConfig:w=!1,init:j=null,responsive:R=null,sortMarks:C,undo:$=!1,hotkeys:b=null,filterValues:E,...P},k){const D=c.useRef();D.current=P;const N=c.useMemo(()=>new vo(js),[]),O=c.useMemo(()=>N.in,[N]),M=c.useRef(null);M.current===null&&(M.current=new ms((se,oe)=>{const ne="on"+ra(se);D.current&&D.current[ne]&&D.current[ne](oe)}),O.setNext(M.current));const H=c.useMemo(()=>({getState:N.getState.bind(N),getReactiveState:N.getReactive.bind(N),getStores:()=>({data:N}),exec:O.exec,setNext:se=>(M.current=M.current.setNext(se),M.current),intercept:O.intercept.bind(O),on:O.on.bind(O),detach:O.detach.bind(O),getRow:N.getRow.bind(N),getColumn:N.getColumn.bind(N)}),[N,O]),[Z,te]=c.useState(0),[ce,de]=c.useState(0),[B,G]=c.useState(null),[T,U]=c.useState(null),X=c.useMemo(()=>{if(w&&!e.length&&t.length){const se=t[0],oe=[];for(let ne in se)if(ne!=="id"&&ne[0]!=="$"){let ke={id:ne,header:ne[0].toUpperCase()+ne.slice(1)};typeof w=="object"&&(ke={...ke,...w}),oe.push(ke)}return oe}return(T&&T.columns)??e},[w,e,t,T]),J=c.useMemo(()=>(T&&T.sizes)??g,[T,g]),ue=c.useCallback(se=>{if(te(se.width),de(se.height),R){const oe=Object.keys(R).map(Number).sort((ne,ke)=>ne-ke).find(ne=>se.width<=ne)??null;oe!==B&&(U(R[oe]),G(oe))}},[R,B]),he=c.useContext(ve.theme),ie=c.useRef(0);return c.useEffect(()=>{if(!ie.current)j&&j(H);else{const se=N.getState();N.init({data:t,columns:X,split:y||se.split,sizes:J||se.sizes,selectedRows:i||se.selectedRows,dynamic:h,tree:v,sortMarks:C||se.sortMarks,filterValues:E||se.filterValues,undo:$,reorder:x,_skin:he,_select:a})}ie.current++},[N,t,X,y,J,i,h,v,C,E,$,x,he,a,j,H]),ie.current===0&&N.init({data:t,columns:X,split:y||{left:0},sizes:J||{},selectedRows:i||[],dynamic:h,tree:v,sortMarks:C||{},filterValues:E||{},undo:$,reorder:x,_skin:he,select:a}),c.useImperativeHandle(k,()=>({...H}),[H]),o.jsx(Re.Provider,{value:H,children:o.jsx(ln,{words:cn,optional:!0,children:o.jsx(sa,{header:d,footer:u,overlay:f,rowStyle:n,columnStyle:s,cellStyle:r,onReorder:m,multiselect:l,autoRowHeight:p,clientWidth:Z,clientHeight:ce,responsiveLevel:B,resize:ue,hotkeys:b})})})});en(Ce);const we=c.createContext(null),fn=c.createContext(null),hn=c.createContext(null);function oa({children:t}){const e=c.useContext(ve.i18n),n=c.useMemo(()=>e.getGroup("filemanager"),[e]),s=c.useContext(we),[r]=Ee(s,"panels"),i=W(s,"activePanel"),a=r[i].path,[l,d]=c.useState(null),[u,h]=c.useState(null),[f,x]=c.useState(""),[m,p]=c.useState(""),[g,y]=c.useState(!1);function v(){const C=f.trim();if(!C){y(!0);return}l.add?s.exec("create-file",{file:{...l.item,name:C},parent:a}):m!==C&&s.exec("rename-file",{id:l.item.id,name:C}),w()}function w(){d(null),y(null),p(""),x("")}function j(){s.exec("delete-files",{ids:u.selected}),h(null)}const R=c.useMemo(()=>({showPrompt(C){const $=C.item.name||(C.item.type==="folder"?n("New folder"):`${n("New file")}.txt`);p($),x($),d({...C})},showConfirm(C){h({...C})}}),[n]);return o.jsxs(fn.Provider,{value:R,children:[o.jsx(ii,{children:t}),l?o.jsx(Kt,{title:n(`Enter ${l.item.type} name`),onConfirm:v,onCancel:w,children:o.jsx(on,{error:g,select:!0,focus:!0,value:f,onChange:({value:C})=>x(C)})}):null,u?o.jsx(Kt,{title:n("Are you sure you want to delete these items:"),onConfirm:j,onCancel:()=>h(null),children:u.selected?o.jsx("ul",{className:"wx-gq7BMzEP wx-list",children:u.selected.map((C,$)=>o.jsx("li",{children:C},$))}):null}):null]})}let ts={"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 aa(t){const e=t.lastIndexOf("."),n=e>0&&e<t.length-1?Math.min(10,t.length-e):Math.min(5,t.length),s=t.slice(0,-n),r=t.slice(-n);return[s,r]}function la({item:t}){const e=c.useContext(we),n=c.useContext(ve.i18n).getGroup("filemanager"),s=c.useContext(we).templates,[r]=Ee(e,"panels"),i=W(e,"activePanel"),a=W(e,"mode"),l=r[i].selected,d=c.useMemo(()=>s.preview(t,214,163),[s,t]),u=c.useMemo(()=>s.icon(t,"big"),[s,t]),[h,f]=c.useMemo(()=>aa(t.name),[t.name]);return o.jsx(o.Fragment,{children:t.id==="/wx-filemanager-parent-link"?a!=="search"?o.jsx("div",{className:"wx-GAOa4kDV wx-back-item",children:o.jsxs("div",{className:`wx-GAOa4kDV wx-back ${t.navigation?"wx-selected":""}`,"data-id":ge("/wx-filemanager-parent-link"),children:[o.jsx("i",{className:"wx-GAOa4kDV wxi-arrow-left"}),o.jsx("span",{children:n("Back to parent folder")})]})}):null:o.jsxs("div",{className:`wx-GAOa4kDV wx-item ${l?.length&&l.indexOf(t.id)>=0?"wx-selected":""}`,"data-id":ge(t.id),children:[d?o.jsx("div",{className:"wx-GAOa4kDV wx-preview wx-file-preview",children:o.jsx("img",{className:"wx-GAOa4kDV wx-card-preview",alt:n("A miniature file preview"),src:d})}):u?o.jsx("div",{className:"wx-GAOa4kDV wx-preview wx-file-icon",children:o.jsx("img",{className:"wx-GAOa4kDV wx-card-preview",alt:"",src:u})}):o.jsx("div",{className:"wx-GAOa4kDV wx-preview",children:o.jsx("i",{className:`wx-GAOa4kDV wxi-${t.type}`})}),t.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:n("Folder")}),o.jsxs("span",{className:"wx-GAOa4kDV wx-name",children:[o.jsx("span",{children:h}),o.jsx("span",{children:f})]})]}),o.jsx("div",{"data-action-id":ge(t.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:h}),o.jsx("span",{children:f})]})}),o.jsx("div",{"data-action-id":ge(t.id),className:"wx-GAOa4kDV wx-more",children:o.jsx("i",{className:"wx-GAOa4kDV wxi-dots-v"})})]})]})})}function Os(){const t=c.useContext(we),e=c.useContext(ve.i18n),n=c.useMemo(()=>e.getGroup("filemanager"),[e]),[s]=Ee(t,"panels"),r=W(t,"activePanel"),i=W(t,"mode"),a=s[r]._files,l=s[r].selected,d=s[r].path,u=s[r]._crumbs,h=s[r]._selectNavigation,f=c.useCallback((w,j)=>{const R=j&&(j.ctrlKey||j.metaKey),C=j&&j.shiftKey;if(w==="/wx-filemanager-parent-link"){if(l.length&&(R||C))return;t.exec("select-file",{type:"navigation"});return}let $=w==="body"&&j?null:w;const b=j.target.className.indexOf("wx-more")!==-1||j.target.className.indexOf("wxi-dots-v")!==-1;setTimeout(()=>{t.exec("select-file",{id:$,toggle:R&&!b,range:C&&!b,panel:r})},1)},[t,l,r]),x=c.useCallback(()=>{u.length>1&&t.exec("set-path",{id:u[u.length-2].id,panel:r,selected:[u[u.length-1].id]})},[t,u,r]),m=c.useCallback(w=>{if(w==="/wx-filemanager-parent-link")return x();i==="search"&&t.exec("filter-files",{text:""});const j=a.find(R=>R.id===w);j&&(j.type=="folder"?t.exec("set-path",{id:j.id,panel:r}):t.exec("open-file",{id:j.id}))},[t,x,i,a,r]),p=c.useCallback((w,j)=>{(!l?.length||!l.filter(R=>R?.id===w).length>0)&&f(w,j)},[l,f]),g=c.useMemo(()=>d!=="/"?[{id:"/wx-filemanager-parent-link",name:n("Back to parent folder"),navigation:h},...a]:a,[d,n,h,a]),y=c.useRef(null),v=c.useRef();return c.useEffect(()=>{y.current&&(v.current?(v.current.click=f,v.current._dblclick=m,v.current.context=p):(v.current={click:f,dblclick:w=>v.current._dblclick(w),_dblclick:m,context:p},Xe(y.current,v.current)))},[f,m,p]),i=="search"&&!g.length?o.jsx("div",{className:"wx-iyjASZCY wx-not-found",children:o.jsx("div",{className:"wx-iyjASZCY wx-not-found-text",children:n("Looks like nothing is here")})}):o.jsx("div",{tabIndex:0,className:"wx-iyjASZCY "+("wx-cards"+(d!=="/"&&i!=="search"?" wx-has-back-link":"")),"data-id":ge("body"),ref:y,children:g.map(w=>o.jsx(la,{item:w},w.id))})}function Ke({name:t="",spin:e=!1,onClick:n}){return o.jsx("i",{"data-menu-ignore":"true",className:`wx-uwcvNSAG wx-icon wxi-${t} ${e?"wx-spin":""} ${n?"wx-clickable":""}`,onClick:()=>{n&&n()}})}function ca(){const t=c.useContext(ve.i18n).getGroup("filemanager"),e=c.useContext(we),n=W(e,"activePanel"),[s]=Ee(e,"panels"),r=c.useMemo(()=>s[n]._crumbs,[s,n]);function i(){e.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(Ke,{name:"angle-left",onClick:i})}),o.jsxs("div",{className:"wx-GDJvtROw wx-text",children:[t("Search results in")," ",Array.isArray(r)&&r.map((a,l)=>o.jsxs(c.Fragment,{children:[l?"/":null,a.id=="/"?t(a.name):a.name]},l))]})]}),o.jsx(Os,{})]})}function Gt({narrowMode:t,extraInfo:e}){const n=c.useContext(we),{preview:s,icon:r}=n.templates,i=c.useContext(ve.i18n),a=c.useMemo(()=>i.getGroup("filemanager"),[i]),l=c.useMemo(()=>Je("%D, %d %F %Y, %H:%i",i.getRaw().calendar),[i]),[d,u]=Ee(n,"panels"),h=W(n,"activePanel"),f=W(n,"preview"),x=W(n,"search"),m=c.useMemo(()=>{const b=d&&h!=null&&d[h]?._selected?.length||0;return x&&!b},[x,u,h]),p=c.useMemo(()=>{const b=d&&h!=null?d[h]:null;return b?m?b._files:b._selected:[]},[m,u,h]),g=c.useCallback((b,E)=>(b?`${b} ${a(b>1?"folders":"folder")} `:"")+(E?`${E} ${a(E>1?"files":"file")}`:""),[a]),y=c.useCallback(()=>{n.exec("show-preview",{mode:!f})},[n,f]),v=c.useCallback(b=>b.type==="folder"?a("Folder"):b.ext||a("Unknown file"),[a]),w=c.useMemo(()=>{let b,E,P,k,D,N,O,M;if(p.length===1&&!m){E=p[0],b=E.name;const H=s(E,400,500);H?(P=H,k=""):(k=r(E,"big"),P=""),D=E.type!=="folder"}else{if(E=D=null,b="",p.length){let H=0,Z=0,te=0,ce=[],de;p.forEach(G=>{typeof G.size>"u"&&(de=!0,H=void 0),de||(H+=G.size),ce.push(v(G)),G.type==="folder"?Z++:te++});const B=new Set(ce);N=B.size>1?a("multiple"):[...B][0],O=g(Z,te),M=H,m||(b=a("Multiple files"))}k=r({type:m?"search":p.length?"multiple":"none"},"big"),P=""}return{name:b,item:E,previewSrc:P,iconSrc:k,showDownloadIcon:D,type:N,totalCount:O,totalSize:M}},[p,m,s,r,a,v,g]),j=c.useCallback(()=>{n.exec("download-file",{id:p[0].id})},[n,p]),R=c.useCallback(async b=>{if(!e||!b)return null;try{return await e(b)}catch(E){return console.log(E),null}},[e]),[C,$]=c.useState(null);return c.useEffect(()=>{let b=!1;return $(null),Promise.resolve(R(w.item)).then(E=>{b||$(E)}).catch(()=>{b||$(null)}),()=>{b=!0}},[R,w.item]),o.jsx("div",{className:"wx-O0BTtRrH wx-wrapper",children:p&&p.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:w.name}),o.jsxs("div",{className:"wx-O0BTtRrH wx-icons",children:[w.showDownloadIcon?o.jsx(Ke,{name:"download",onClick:j}):null,t?o.jsx(Ke,{name:"close",onClick:y}):null]})]}),w.previewSrc?o.jsx("div",{className:"wx-O0BTtRrH wx-img-wrapper",children:o.jsx("img",{src:w.previewSrc,alt:a("A miniature file preview")})}):w.iconSrc?o.jsx("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:o.jsx("img",{src:w.iconSrc,alt:a("A miniature file preview")})}):o.jsx("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:w.item?o.jsx("i",{className:`wx-O0BTtRrH wx-icon wxi-${w.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:a(m?"Found":"Information")}),o.jsxs("div",{className:"wx-O0BTtRrH wx-list",children:[w.item?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:a("Type")}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:v(w.item)}),typeof w.item.size<"u"?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:a("Size")}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:it(w.item.size)})]}):null,o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:a("Date")}),o.jsxs("span",{className:"wx-O0BTtRrH wx-value",children:[l(w.item.date)," "]})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:a("Count")}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:w.totalCount}),o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:a("Type")}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:w.type}),typeof w.totalSize<"u"?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:a("Size")}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:it(w.totalSize)})]}):null]}),C?Object.entries(C).map(([b,E])=>o.jsxs(Qt.Fragment,{children:[o.jsx("span",{className:"wx-O0BTtRrH wx-name",children:b}),o.jsx("span",{className:"wx-O0BTtRrH wx-value",children:E})]},b)):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:w.name}),o.jsx("div",{className:"wx-O0BTtRrH wx-icons",children:t?o.jsx(Ke,{name:"close",onClick:y}):null})]}),o.jsx("div",{className:"wx-O0BTtRrH wx-no-info-wrapper",children:o.jsxs("div",{className:"wx-O0BTtRrH wx-no-info",children:[w.previewSrc?o.jsx("div",{className:"wx-O0BTtRrH wx-img-wrapper",children:o.jsx("img",{src:w.previewSrc,alt:a("A miniature file preview")})}):w.iconSrc?o.jsx("div",{className:"wx-O0BTtRrH wx-icon-wrapper",children:o.jsx("img",{src:w.iconSrc,alt:a("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?"":a("Select file or folder to view details")})]})})]})})}function Ps({panel:t}){const e=c.useContext(we),n=c.useContext(ve.i18n),s=c.useMemo(()=>n.getGroup("filemanager"),[n]),[r,i]=Ee(e,"panels"),a=c.useMemo(()=>r[t]._files,[i,t]),l=c.useMemo(()=>r[t]._crumbs||[],[i,t]);function d(p){const g=dn(p,l);e.exec("set-path",{id:p,panel:t,...g&&{selected:[g]}})}const[u,h]=c.useState(null);c.useEffect(()=>{a&&h(null)},[a]);function f(){h(!0),e.exec("request-data",{id:l[l.length-1].id}),setTimeout(()=>{h(null)},5e3)}const x=c.useRef(null),m=c.useRef();return c.useEffect(()=>{m.current?m.current.click=d:(m.current={click:d},Xe(x.current,m.current))},[d]),o.jsxs("div",{className:"wx-SNY5LTYx wx-breadcrumbs","data-menu-ignore":"true",ref:x,children:[o.jsx("div",{className:"wx-SNY5LTYx wx-refresh-icon",children:o.jsx(Ke,{name:"refresh",spin:!!u,onClick:f})}),l.map((p,g)=>o.jsxs(Qt.Fragment,{children:[g?o.jsx(Ke,{name:"angle-right"}):null,o.jsx("div",{className:"wx-SNY5LTYx wx-item","data-id":ge(p.id),"data-menu-ignore":"true",children:p.id=="/"?s(p.name):p.name})]},g))]})}function da({row:t}){const e=c.useContext(ve.i18n),[n]=c.useState(()=>e.getGroup("filemanager")),s=c.useContext(we).templates,[r]=c.useState(()=>s.icon(t,"small"));return o.jsx("div",{className:"wx-qgAqG6sL wx-name-cell",children:t.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:[" ",n("Back to parent folder")]})]}):o.jsxs(o.Fragment,{children:[r?o.jsx("img",{className:"wx-qgAqG6sL wx-icon",alt:"",src:r,height:"24px",width:"24px"}):o.jsx("i",{className:`wx-qgAqG6sL wxi-${t.type}`}),o.jsxs("span",{className:"wx-qgAqG6sL wx-name",children:[" ",t.name," "]})]})})}function Hs({children:t}){const e=c.useContext(we),n=W(e,"activePanel"),s=c.useContext(hn),r=c.useRef(null);let i=c.useRef({});return i.current.drop=()=>{const a=r.current,l=fr(a,"data-panel");l&&l!=n&&e.exec("set-active-panel",{panel:l*1})},i.current.dragEnter=()=>{const a=r.current;a&&a.classList.toggle("wx-active")},i.current.dragLeave=()=>{const a=r.current;a&&a.classList.toggle("wx-active")},c.useEffect(()=>{const a=r.current;return s.droparea(a,i.current)},[]),o.jsx("div",{className:"wx-LT9X7tb7 wx-upload-area",ref:r,children:t})}function qt({panel:t,active:e=!1,onClick:n,onContextMenu:s}){const r=c.useContext(we),i=c.useContext(ve.i18n),a=c.useMemo(()=>i.getGroup("filemanager"),[i]),l=c.useMemo(()=>Je("%d %M %Y",i.getRaw().calendar),[i]),[d]=Ee(r,"panels"),u=d[t].selected,h=d[t].path,f=d[t]._crumbs,x=d[t]._sorts,m=d[t]._selectNavigation,p=d[t]._files,g=c.useMemo(()=>[{id:"name",header:a("Name"),flexgrow:3,sort:!0,resize:!0,cell:da},{id:"size",header:a("Size"),width:100,sort:!0,resize:!0,template:N=>typeof N=="number"?it(N):""},{id:"date",header:a("Date"),width:120,sort:!0,resize:!0,template:N=>N?l(N):""}],[a,l]),y=c.useRef(null),v=c.useRef(null),w=c.useMemo(()=>m?["/wx-filemanager-parent-link"]:[...u],[m,u]);function j(N,O){if(O&&O.target&&O.target.className&&O.target.className.indexOf("wx-grip")!==-1)return;const M=O&&(O.ctrlKey||O.metaKey),H=O&&O.shiftKey;if(N==="/wx-filemanager-parent-link"){if(u.length&&(M||H))return;r.exec("select-file",{type:"navigation"});return}let Z=N==="body"&&O?null:N;!y.current&&!v.current?r.exec("select-file",{id:Z,toggle:M,range:H,panel:t}):(y.current=null,v.current=null)}function R(){f.length>1&&r.exec("set-path",{id:f[f.length-2].id,panel:t,selected:[f[f.length-1].id]})}function C(N){if(N==="/wx-filemanager-parent-link")return R();const O=p.find(M=>M.id===N);O&&(O.type==="folder"?r.exec("set-path",{id:O.id,panel:t}):r.exec("open-file",{id:O.id}))}function $(N){const O=N.key,M=x[h];let H=M?"asc":"desc";M&&M.key===O&&(H=M.order==="asc"?"desc":"asc"),r.exec("sort-files",{key:O,order:H,panel:t,path:h})}function b(N){N.intercept("sort-rows",O=>(y.current=!0,$(O),!1)),N.intercept("select-row",()=>!1),N.on("resize-column",()=>v.current=!0),N.intercept("hotkey",()=>!1)}const E=c.useMemo(()=>h!=="/"?[{id:"/wx-filemanager-parent-link",name:a("Back to parent folder")},...p]:p,[h,p,a]),P=c.useMemo(()=>{if(E&&x&&x[h]){const{key:N,order:O}=x[h];return{[N]:{order:O}}}},[E,x,h]),k=c.useRef(null),D=c.useRef();return c.useEffect(()=>{D.current?(D.current.click=j,D.current._dblclick=C):(D.current={click:j,dblclick:N=>D.current._dblclick(N),_dblclick:C},Xe(k.current,D.current))},[j,C]),o.jsxs("div",{onClick:n,onContextMenu:s,className:"wx-SSaVhET7 wx-wrapper",children:[o.jsx(Ps,{panel:t}),o.jsx("div",{"data-id":ge("body"),className:`wx-SSaVhET7 wx-list ${e?"wx-active":""}`,ref:k,children:o.jsx(Hs,{children:o.jsx(ia,{init:b,data:E,columns:g,selectedRows:w,columnStyle:()=>"wx-SSaVhET7 wx-each-cell",sizes:{rowHeight:42,headerHeight:42},sortMarks:P})})})]})}function ua(){const t=c.useContext(we),e=W(t,"activePanel");function n(s){t.exec("set-active-panel",{panel:s})}return o.jsxs("div",{className:"wx-L55BfJa2 wx-panels","data-id":ge("body"),children:[o.jsx("div",{className:"wx-L55BfJa2 wx-item","data-panel":0,children:o.jsx(qt,{panel:0,active:e==0,onClick:()=>n(0),onContextMenu:()=>n(0)})}),o.jsx("div",{className:"wx-L55BfJa2 wx-item","data-panel":1,children:o.jsx(qt,{panel:1,active:e==1,onClick:()=>n(1),onContextMenu:()=>n(1)})})]})}function Ls({folderIcon:t=!1,folder:e={}}){const n=c.useContext(we),[s,r]=Ee(n,"panels"),i=W(n,"activePanel"),a=c.useMemo(()=>s[i].path,[r,i]),l=c.useContext(ve.i18n),d=c.useMemo(()=>l.getGroup("filemanager"),[l]),u=c.useMemo(()=>!!e.data?.find(m=>m.type==="folder"),[e]),h=c.useMemo(()=>e.id=="/"?d(e.name):e.name,[e,d]),f=c.useMemo(()=>e.$level>1?(e.$level-1)*20:0,[e]),x=e.open;return o.jsxs(o.Fragment,{children:[o.jsxs("li",{"data-id":ge(e.id),className:`wx-NYfhvGIt wx-folder${a===e.id?" wx-selected":""}`,style:{paddingLeft:`${f}px`},children:[u?o.jsx("i",{className:`wx-NYfhvGIt wx-toggle wxi-${x?"angle-down":"angle-right"}`,"data-action":"toggle"}):o.jsx("span",{className:"wx-NYfhvGIt wx-toggle-placeholder"}),o.jsx("i",{className:"wx-NYfhvGIt "+(t||"wxi-folder")}),o.jsxs("span",{className:"wx-NYfhvGIt wx-name",children:[" ",h," "]})]}),x&&e.data&&e.data.length&&u?o.jsx(o.Fragment,{children:e.data.map(m=>m.type==="folder"?o.jsx(Ls,{folder:m},m.id):null)}):null]})}function fa(){const t=c.useContext(we),[e,n]=Ee(t,"data"),[s,r]=Ee(t,"panels"),i=W(t,"activePanel"),a=c.useMemo(()=>s[i]._crumbs,[r,i]),l=c.useCallback(m=>{t.exec("open-tree-folder",{id:m,mode:!e.byId(m).open})},[t,n]),d=c.useCallback(m=>{const p=dn(m,a);t.exec("set-path",{id:m,panel:i,...p&&{selected:[p]}})},[t,a,i]),[u,h]=c.useState([]);c.useEffect(()=>{h(e.byId(0).data)},[n]);const f=c.useRef(null),x=c.useRef();return c.useEffect(()=>{x.current?(x.current.click=d,x.current.toggle=l):(x.current={click:d,toggle:l},Xe(f.current,x.current))},[d,l]),o.jsx("ul",{ref:f,className:"wx-LyHJ6R6A",children:u.map(m=>m.type==="folder"?o.jsx(Ls,{folder:m},m.id):null)})}function ha(){const t=c.useContext(we),e=c.useContext(ve.i18n),n=c.useMemo(()=>e.getGroup("filemanager"),[e]),s=W(t,"drive"),r=s?s.used:"",i=s?s.total:"";return r&&i?o.jsxs("div",{className:"wx-DetSyKGG wx-drive",children:[o.jsx("progress",{value:r,max:i,className:"wx-DetSyKGG wx-progress"}),o.jsxs("p",{children:[it(r)," ",n("of")," ",it(i)," ",n("used")]})]}):null}function xa({option:t}){const e=c.useContext(ve.i18n).getGroup("filemanager"),n=c.useContext(hn),s=c.useCallback(()=>{n.open({})},[n]);return o.jsx("div",{className:"wx-9XiKcxq5 wx-upload-button",onClick:s,children:o.jsx("span",{children:e(t.text)})})}function pa({readonly:t,menuOptions:e}){const n=c.useContext(ve.i18n).getGroup("filemanager"),{showPrompt:s}=c.useContext(fn);c.useEffect(()=>{Di("upload",xa)},[]);function r({action:a}){a&&(a.id==="add-file"?s({item:{type:"file",size:0,date:new Date},add:!0}):a.id==="add-folder"&&s({item:{type:"folder",date:new Date},add:!0}))}const i=c.useMemo(()=>e("add").map(a=>(a.text=n(a.text),a)),[e,n]);return o.jsxs("div",{className:"wx-FlucfALM wx-wrapper",children:[!t&&o.jsx("div",{className:"wx-FlucfALM wx-button",children:o.jsx(Ti,{options:i,at:"bottom-fit",onClick:r,children:o.jsx(st,{type:"primary block",children:n("Add New")})})}),o.jsx("div",{className:"wx-FlucfALM wx-tree",children:o.jsx(fa,{})}),o.jsx(ha,{})]})}function ma({value:t="",onSearch:e}){const[n,s]=ys(t),r=c.useContext(ve.i18n).getGroup("filemanager"),i=c.useRef(null),a=c.useMemo(()=>n!==""?"wxi-close":"wxi-search",[n]);function l(u){const h=u.target.value;s(h),e&&e({value:h})}function d(){s(""),i.current&&i.current.focus(),e&&e({value:""})}return o.jsxs("div",{className:"wx-lUZMtgT1 wx-search-input",children:[o.jsx("i",{className:`wx-lUZMtgT1 wx-icon ${a}`,onClick:d}),o.jsx("input",{type:"text",className:"wx-lUZMtgT1 wx-text",ref:i,value:n,onInput:l,placeholder:r("Search")})]})}function ga({narrowMode:t=!1,onShowTree:e}){const n=c.useContext(we),s=c.useContext(ve.i18n).getGroup("filemanager"),r=W(n,"mode"),i=W(n,"preview"),a=W(n,"search"),l=[{icon:"wxi-view-sequential",id:"table"},{icon:"wxi-view-grid",id:"cards"},{icon:"wxi-view-column",id:"panels"}];function d({value:f}){n.exec("set-mode",{mode:f})}function u(f){f.preventDefault(),n.exec("show-preview",{mode:!i})}function h(f){n.exec("filter-files",{text:f.value})}return o.jsxs("div",{className:"wx-5PZQQztG wx-toolbar",children:[o.jsxs("div",{className:"wx-5PZQQztG wx-left "+(t?"wx-left-narrow":""),children:[t?r==="panels"||r==="search"?null:o.jsx("div",{className:"wx-5PZQQztG wx-sidebar-icon","data-id":ge("toggle-tree"),children:o.jsx(Ke,{onClick:()=>e&&e(),name:"subtask"})}):o.jsx("div",{className:"wx-5PZQQztG wx-name",children:s("Files")}),o.jsx(ma,{onSearch:h,value:a})]}),o.jsxs("div",{className:"wx-5PZQQztG wx-right",children:[t?null:o.jsx("div",{className:"wx-5PZQQztG wx-preview-icon",children:o.jsx(oi,{onClick:u,value:i,children:o.jsx("i",{className:"wx-5PZQQztG wxi-eye"})})}),o.jsx("div",{className:"wx-5PZQQztG wx-modes",children:o.jsx(ei,{value:r,options:l,onChange:d})})]})]})}function wa(){const t=c.useContext(we),e=W(t,"activePanel");return o.jsxs("div",{className:"wx-NwohNJzN wx-wrapper",children:[o.jsx(Ps,{panel:e}),o.jsx(Hs,{children:o.jsx(Os,{})})]})}function va({readonly:t=!1,menuOptions:e,extraInfo:n}){const s=c.useRef(null),r=c.useRef(null),[i,a]=c.useState(void 0),[l,d]=c.useState(void 0),[u,h]=c.useState(!1),f=_s(),x=c.useContext(we),{showPrompt:m,showConfirm:p}=c.useContext(fn),g=c.useContext(ve.i18n),y=c.useMemo(()=>g.getGroup("filemanager"),[g]),v=W(x,"mode"),w=W(x,"preview"),j=W(x,"activePanel"),[R,C]=Ee(x,"panels"),$=c.useMemo(()=>(R&&j!=null?R[j]:null)?.selected??[],[C,j]),b=c.useMemo(()=>(R&&j!=null?R[j]:null)?.path,[C,j]),[E,P]=c.useState([]);c.useEffect(()=>{const B=s.current;if(!B)return;const G=new ResizeObserver(T=>{const U=T[0]?.borderBoxSize?.[0]?.inlineSize;typeof U=="number"&&d(U<768)});return G.observe(B),()=>{G.disconnect()}},[]);const k=c.useCallback(()=>{h(B=>!B)},[]),D=c.useCallback(B=>{l&&rt(B)!=="toggle-tree"&&h(!1)},[l]);c.useEffect(()=>{const B=r.current;if(B)return Pe(B,D).destroy},[D]),c.useEffect(()=>{const B=r.current;if(!B)return;const G=new ResizeObserver(()=>{B&&a(B.clientWidth)});return G.observe(B),B&&a(B.clientWidth),()=>{G.disconnect()}},[]);const N=c.useMemo(()=>({icon:"wxi-eye",text:"Preview",id:"preview"}),[]),O=c.useCallback(B=>{let G=l?[N]:[];return B==="file"&&(G=[...G,...e().filter(T=>T.id==="download")]),G},[l,N,e]),M=c.useRef(null),H=c.useCallback((B,G,T)=>{const U=T?[G.id]:$;switch(B){case"download":x.exec("download-file",{id:G.id});break;case"copy":case"move":M.current={action:B,ids:U};break;case"paste":M.current&&x.exec(M.current.action==="copy"?"copy-files":"move-files",{ids:M.current.ids,target:G?.type==="folder"?G.id:b});break;case"rename":m({item:G});break;case"delete":p({selected:U});break;case"preview":x.exec("show-preview",{mode:!w});break}},[x,$,b,m,p,w]),Z=c.useCallback(()=>R?.[j],[R,j]);c.useEffect(()=>{const B=s.current;if(!B)return;const G=bi(B,{api:x,menuOptions:t?O:e,performAction:H,getPanel:Z});return()=>{typeof G=="function"?G():G&&typeof G.destroy=="function"&&G.destroy()}},[x,t,O,e,H,Z]);const te=c.useCallback((B,G)=>{const T=B?x.getFile(B):null,U=G.target.closest(".tree-item.folder");let X;if(t)X=O(T?.type);else{switch(B){case"body":X=e(B);break;default:if(T)if(!U&&$.length>1)X=l?[N,...e("multiselect")]:e("multiselect");else if(B==="/")X=e("folder",T).filter(J=>J.id==="paste");else{const J=e(T.type,T);J&&(X=l?[N,...J]:J)}}v==="search"&&(X=X?.filter(J=>J.id!=="paste"))}if(T?.id&&(!$.length||!$.some(J=>J===T.id))&&!U&&x.exec("select-file",{id:T.id}),X?.length)return X.forEach(J=>{U&&(J.hotkey=""),J.text&&(J.text=y(J.text)),J.hotkey&&(J.subtext=J.hotkey)}),P(X),T||{}},[x,t,O,e,$,l,N,v,y]),ce=c.useCallback(B=>{const{action:G,context:T}=B;G&&H(G.id,T,!G.hotkey)},[H]);async function de(B){await Promise.resolve();const{name:G,size:T}=B.file;x.exec("create-file",{file:{name:G,size:T,date:new Date,file:B.file},parent:b})}return o.jsx("div",{className:"wx-RJbNonjJ wx-filemanager wx-flex",ref:s,"data-menu-ignore":"false",children:l&&w?o.jsx("div",{className:"wx-RJbNonjJ wx-info-narrow",children:o.jsx(Gt,{narrowMode:l,extraInfo:n})}):o.jsxs(o.Fragment,{children:[o.jsx(ga,{narrowMode:l,onShowTree:k}),o.jsx(Ii,{dataKey:"id",at:"point",options:E,resolver:te,onClick:ce,children:o.jsxs(Ns,{dataKey:"actionId",options:E,resolver:te,onClick:ce,children:[o.jsx(Li,{data:f,apiOnly:!0,uploadURL:de}),o.jsx(hn.Provider,{value:f,children:o.jsx("div",{className:"wx-RJbNonjJ wx-content-wrapper wx-flex",children:v!=="panels"&&v!=="search"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"wx-RJbNonjJ "+["wx-sidebar",l?"wx-sidebar-narrow":"",u?"wx-sidebar-visible":""].filter(Boolean).join(" "),ref:r,children:o.jsx(pa,{readonly:t,menuOptions:e})}),o.jsxs("div",{className:"wx-RJbNonjJ wx-content",style:{width:`calc(100% - ${i||0}px - 10px)`},children:[o.jsx("div",{className:`wx-RJbNonjJ wx-content-item${w?"":"-fit"}`,"data-id":ge("body"),children:v==="table"?o.jsx(qt,{panel:j}):o.jsx(wa,{})}),w?o.jsx("div",{className:"wx-RJbNonjJ wx-info",children:o.jsx(Gt,{extraInfo:n})}):null]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`wx-RJbNonjJ wx-content-item${w?"":"-fit"}`,children:v==="panels"?o.jsx(ua,{}):o.jsx(ca,{})}),w?o.jsx("div",{className:"wx-RJbNonjJ wx-info",children:o.jsx(Gt,{extraInfo:n})}):null]})})})]})})]})})}const ya=t=>t.split("-").map(e=>e?e.charAt(0).toUpperCase()+e.slice(1):"").join("");function ba(t,e){const{type:n,ext:s}=t;if(n==="folder")return!1;let r;return n&&n!=="file"&&ts[n]?r=n:s?r=ts[s]?s:"file":r="unknown",`https://cdn.svar.dev/icons/filemanager/vivid/${e}/${r}.svg`}const ja=c.forwardRef(function(t,e){const{data:n=[],mode:s="cards",drive:r=null,preview:i=!1,panels:a=null,activePanel:l=0,readonly:d=!1,menuOptions:u=wi,extraInfo:h=null,init:f=null,icons:x=ba,previews:m=null,...p}=t,g=c.useRef();g.current=p;const y=c.useMemo(()=>new gi(js),[]),v=c.useMemo(()=>y.in,[y]),w=c.useRef(null);w.current===null&&(w.current=new ms((C,$)=>{const b="on"+ya(C);g.current&&g.current[b]&&g.current[b]($)}),v.setNext(w.current));const j=c.useMemo(()=>({getState:y.getState.bind(y),getReactiveState:y.getReactive.bind(y),getStores:()=>({data:y}),exec:v.exec,setNext:C=>(w.current=w.current.setNext(C),w.current),intercept:v.intercept.bind(v),on:v.on.bind(v),detach:v.detach.bind(v),getFile:y.getFile.bind(y),serialize:y.serialize.bind(y),templates:{preview:m||(()=>null),icon:x==="simple"?(()=>null):x}}),[y,v]),R=c.useRef(0);return c.useEffect(()=>{if(!R.current)f&&f(j);else{const C=y.getState();y.init({data:n,mode:s,drive:r,preview:i,panels:a||C.panels||[],activePanel:l})}R.current++},[y,n,s,r,i,a,l,f,j]),R.current===0&&y.init({data:n,mode:s,drive:r,preview:i,panels:a||[],activePanel:l}),c.useImperativeHandle(e,()=>({...j}),[j]),o.jsx(we.Provider,{value:j,children:o.jsx(ln,{words:cn,optional:!0,children:o.jsx(oa,{children:o.jsx(va,{readonly:d,menuOptions:u,extraInfo:h})})})})});function Sa({fonts:t=!0,children:e}){return e?o.jsx(Ln,{fonts:t,children:e}):o.jsx(Ln,{fonts:t})}en(Ce);function xn(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid Hub ${e} response.`);return t}function at(t,e,n){const s=xn(t,n);if(!Array.isArray(s[e]))throw new Error(`Invalid Hub ${n} response: ${e} must be an array.`);return s[e]}function Ca(t,e,n){const s=xn(t,n);if(!s[e]||typeof s[e]!="object"||Array.isArray(s[e]))throw new Error(`Invalid Hub ${n} response: ${e} must be an object.`);return s[e]}async function ka(t,e=!1){return at(await Me(`/api/remote/filesystem/roots${e?"?refresh=1":""}`,void 0,t),"roots","filesystem roots")}async function Vt(t,e){const n=await Me(`/api/remote/filesystem/entries?id=${encodeURIComponent(t)}`,void 0,e);return{folder:Ca(n,"folder","filesystem entries"),entries:at(n,"entries","filesystem entries")}}async function Na(t,e){return Me("/api/remote/filesystem/selection/scan",{method:"POST",body:JSON.stringify({itemIds:t})},e)}async function _a(t,e,n,s){return Me("/api/remote/files/from-hub",{method:"POST",body:JSON.stringify({itemIds:t,deviceIds:e,remoteDirectory:n})},s)}async function Ra(t,e=!1){const n=await Me(`/api/remote/files/jobs?active=${e?"1":"0"}`,void 0,t);return{jobs:at(n,"jobs","file transfer jobs")}}async function $a(t,e){return Me(`/api/remote/files/jobs/${encodeURIComponent(t)}`,void 0,e)}async function Ea(t,e){return Me(`/api/remote/files/jobs/${encodeURIComponent(t)}/cancel`,{method:"POST"},e)}async function ns(t){return at(await Me("/api/remote/filesystem/shared-folders",void 0,t),"folders","shared folders")}async function Ma(t,e){return Me("/api/remote/filesystem/shared-folders",{method:"POST",body:JSON.stringify({sourceId:t})},e)}async function Da(t,e,n){return Me(`/api/remote/filesystem/shared-folders/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(e)},n)}async function Aa(t,e){return Me(`/api/remote/filesystem/shared-folders/${encodeURIComponent(t)}`,{method:"DELETE"},e)}async function Ta(t,e,n,s){const r=await Me(`/api/remote/filesystem/shared-folders/${encodeURIComponent(t)}/sync`,{method:"POST",body:JSON.stringify({deviceIds:e,remoteDirectory:n})},s),i=xn(r,"shared folder sync");return{ok:i.ok===!0,jobs:at(r,"jobs","shared folder sync"),files:Number(i.files||0),totalBytes:Number(i.totalBytes||0)}}function Ia(t){return{id:String(t.id),parentId:t.parent,name:t.name,type:t.type==="file"?"file":"folder",size:Number(t.size||0),modifiedAt:t.date?.toISOString()||null,displayPath:String(t.displayPath||t.name),hasChildren:t.lazy===!0||!!t.data?.length,locked:t.locked===!0}}function ss(t){if(!Number.isFinite(t)||t<=0)return"0 B";const e=["B","KB","MB","GB","TB"];let n=t,s=0;for(;n>=1024&&s<e.length-1;)n/=1024,s+=1;return`${n.toFixed(s===0||n>=100?0:1)} ${e[s]}`}function Ct(t){return t.driveType==="network"?"network":t.driveType==="removable"?"removable":"local"}function Fa(t){const e=t.filter(n=>Ct(n)==="local");return e.find(n=>/\bC:/i.test(`${n.name} ${n.displayPath||""}`))||e[0]||t[0]||null}function Oa(t){const e=String(t.displayPath||"").trim();if(e)return e;const n=String(t.name||"").match(/\(([A-Za-z]:)\)/)?.[1];return n?`${n}\\`:t.name}function Pa({hubUrl:t,roots:e,loading:n,error:s,onRefreshRoots:r,onImportFiles:i,onImportFolder:a,onSelectionChange:l,onShareItem:d,onAddSyncFolder:u,onNotice:h}){const f=c.useRef(null),x=c.useRef("/"),m=c.useRef(0),p=c.useRef([]),g=c.useRef(new Map),[y,v]=c.useState(null),[w,j]=c.useState([]),[R,C]=c.useState([]),[$,b]=c.useState(0),[E,P]=c.useState(null),[k,D]=c.useState(!1),[N,O]=c.useState(""),[M,H]=c.useState(new Set),Z=e.find(_=>_.id===y)||null,te=w[w.length-1]||null,ce=Z?te?.svarPath||`/${Z.name}`:null,de=ce;c.useEffect(()=>{p.current=w,x.current=de||"/"},[de,w]);const B=c.useMemo(()=>(g.current.clear(),!Z||!de||w.length===0?[]:(w.forEach(_=>g.current.set(_.svarPath,_.hubId)),[...w.map((_,F)=>({id:_.svarPath,parent:F===0?"/":w[F-1].svarPath,type:"folder",name:_.name,date:_.modifiedAt?new Date(_.modifiedAt):void 0,lazy:!1})),...R.map(_=>{const F=`${de}/${_.name}`;return g.current.set(F,_.id),{id:F,parent:de,name:_.name,type:_.type==="file"?"file":"folder",..._.type==="file"?{size:_.size}:{},date:_.modifiedAt?new Date(_.modifiedAt):void 0,lazy:_.type!=="file"&&_.hasChildren===!0,displayPath:_.displayPath,locked:_.locked,driveType:_.driveType,totalBytes:_.totalBytes,freeBytes:_.freeBytes}})])),[Z,R,de,w]),G=_=>g.current.get(String(_))||String(_),T=_=>Ia({..._,id:G(String(_.id)),parent:G(String(_.parent))}),U=async(_,F)=>{const Y=_[_.length-1];if(!Y)return;const V=++m.current;D(!0),O("");try{const z=await Vt(Y.hubId,t);if(V!==m.current)return;if(!Array.isArray(z.entries))throw new Error("Invalid Hub filesystem entries response.");const re={...Y,displayPath:z.folder.displayPath||Y.displayPath,modifiedAt:z.folder.modifiedAt||Y.modifiedAt},ae=[..._.slice(0,-1),re];p.current=ae,j(ae),C(z.entries),b(Ne=>Ne+1)}catch(z){if(V!==m.current)return;console.error("[VuvoDesk FS] folder navigation failed",{folderId:Y.hubId,error:z}),O(z instanceof Error?`${F}: ${z.message}`:`${F}: Unable to read this folder.`)}finally{V===m.current&&D(!1)}},X=async _=>{const F={svarPath:`/${_.name}`,hubId:_.id,name:_.name,pathLabel:Oa(_),displayPath:_.displayPath,modifiedAt:_.modifiedAt},Y=++m.current;v(_.id),p.current=[F],j([F]),x.current=F.svarPath,C([]),O(""),D(!0),P(_.id),H(V=>{const z=new Set(V);return z.delete(_.id),z});try{const V=await Vt(_.id,t);if(Y!==m.current)return;if(!Array.isArray(V.entries))throw new Error("Invalid Hub filesystem entries response.");const z={...F,pathLabel:V.folder.displayPath||F.pathLabel,displayPath:V.folder.displayPath||F.displayPath,modifiedAt:V.folder.modifiedAt||F.modifiedAt};p.current=[z],j([z]),C(V.entries),b(re=>re+1)}catch(V){if(Y!==m.current)return;console.error("[VuvoDesk FS] getEntries failed",{rootId:_.id,error:V}),H(z=>new Set(z).add(_.id)),O(V instanceof Error?`${_.name}: ${V.message}`:`${_.name}: Unable to read this drive.`),h(V instanceof Error?`${_.name}: ${V.message}`:`${_.name}: Unable to read this drive.`)}finally{Y===m.current&&(P(null),D(!1))}},J=_=>{const F=p.current;_<0||_>=F.length||_===F.length-1||U(F.slice(0,_+1),F[_].name)},ue=(_,F)=>{if(_.type!=="folder")return;const Y=p.current,V=Y.findIndex(re=>re.svarPath===F);if(V<0)return;const z={svarPath:`${F}/${_.name}`,hubId:_.id,name:_.name,pathLabel:_.name,displayPath:_.displayPath,modifiedAt:_.modifiedAt};U([...Y.slice(0,V+1),z],_.name)},he=()=>J(p.current.length-2),ie=_=>{if(_.key!=="Enter"&&_.code!=="Enter"&&_.code!=="NumpadEnter"||_.target?.closest('button, input, textarea, [contenteditable="true"]'))return;const Y=f.current;if(!Y)return;const V=Y.getState().panels?.flatMap(re=>re.selected||[])||[];if(V.length!==1)return;const z=Y.getFile(String(V[0]));z?.type==="folder"&&(_.preventDefault(),_.stopPropagation(),ue(T(z),String(z.parent||x.current)))};c.useEffect(()=>{const _=e.find(F=>F.id===y)||Fa(e);if(H(F=>new Set([...F].filter(Y=>e.some(V=>V.id===Y)))),!_){v(null),p.current=[],j([]),C([]);return}X(_)},[e]);const se=_=>{f.current=_,_.on("request-data",async({id:F})=>{const Y=String(F),V=G(Y);try{const z=await Vt(V,t);if(!Array.isArray(z.entries))throw new Error("Invalid Hub filesystem entries response.");const re=z.entries.map(ae=>{const Ne=`${Y}/${ae.name}`;return g.current.set(Ne,ae.id),{id:Ne,parent:Y,name:ae.name,type:ae.type==="file"?"file":"folder",...ae.type==="file"?{size:ae.size}:{},date:ae.modifiedAt?new Date(ae.modifiedAt):void 0,lazy:ae.type!=="file"&&ae.hasChildren===!0,displayPath:ae.displayPath,locked:ae.locked,driveType:ae.driveType,totalBytes:ae.totalBytes,freeBytes:ae.freeBytes}});await _.exec("provide-data",{id:Y,data:re})}catch(z){console.error("[VuvoDesk FS] nested getEntries failed",{id:V,error:z}),h(z instanceof Error?z.message:"Unable to read this folder.")}}),_.intercept("set-path",({id:F})=>{const Y=String(F),V=p.current.findIndex(re=>re.svarPath===Y);if(V>=0)return J(V),!1;const z=_.getFile(Y);if(z?.type==="folder")return ue(T(z),String(z.parent||x.current)),!1}),_.intercept("open-file",()=>!1),_.on("select-file",()=>{window.setTimeout(()=>{const V=(_.getState().panels?.flatMap(z=>z.selected||[])||[]).map(z=>_.getFile(z)).filter(Boolean).map(z=>T(z));l(V.map(z=>z.id),V)},0)})},oe=(_,F)=>{const Y=F?T(F):null,V=()=>{const z=Y?.type==="file"?String(F?.parent||x.current):String(F?.id||x.current);f.current?.exec("request-data",{id:z})};return _==="body"?[{id:"refresh",text:"Refresh",icon:"mdi mdi-refresh",handler:V},{id:"properties",text:"Properties",icon:"mdi mdi-information-outline",handler:()=>h("Select a file or folder to view its properties.")}]:_==="multiselect"?[{id:"share",text:"Share to Clients",icon:"mdi mdi-share-variant",handler:()=>{(f.current?.getState().panels?.flatMap(re=>re.selected||[])||[]).forEach(re=>{const ae=f.current?.getFile(re);ae&&d(T(ae))})}},{id:"refresh",text:"Refresh",icon:"mdi mdi-refresh",handler:V}]:Y?[{id:"share",text:"Share to Clients",icon:"mdi mdi-share-variant",handler:()=>d(Y)},...Y.type==="folder"?[{id:"sync",text:"Add folder to Sync",icon:"mdi mdi-folder-sync-outline",handler:()=>u(Y)}]:[],{id:"copy-path",text:"Copy path",icon:"mdi mdi-content-copy",handler:()=>{Zs(Y.displayPath||Y.name)}},{id:"refresh",text:"Refresh",icon:"mdi mdi-refresh",handler:V},{id:"properties",text:"Properties",icon:"mdi mdi-information-outline",handler:()=>h(`${Y.name}
|
|
3
3
|
${Y.displayPath||""}`)}]:[]},ne=async()=>{try{await r()}catch(_){h(_ instanceof Error?_.message:"Unable to refresh Hub drives.")}},ke=[{id:"local",label:"Local drives",icon:pt,roots:e.filter(_=>Ct(_)==="local")},{id:"removable",label:"Removable drives",icon:er,roots:e.filter(_=>Ct(_)==="removable")},{id:"network",label:"Network drives",icon:tr,roots:e.filter(_=>Ct(_)==="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(pt,{size:16})," Browse files on this Hub"]})]}),o.jsxs("div",{className:"hub-file-explorer-heading-actions",children:[o.jsx("button",{className:"icon-button",onClick:i,title:"Import files from this browser",type:"button",children:o.jsx(nr,{size:16})}),o.jsx("button",{className:"icon-button",onClick:a,title:"Import folder from this browser",type:"button",children:o.jsx(sr,{size:16})}),o.jsx("button",{className:"icon-button",onClick:()=>{ne()},title:"Refresh drives",type:"button",children:o.jsx(Zt,{size:16})})]})]}),n?o.jsxs("div",{className:"hub-file-explorer-state",children:[o.jsx(pt,{size:24}),o.jsx("strong",{children:"Connecting to VuvoDesk Hub file system..."})]}):s?o.jsxs("div",{className:"hub-file-explorer-state error",role:"alert",children:[o.jsx(Cn,{size:24}),o.jsx("strong",{children:s})]}):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(pt,{size:15}),o.jsx("strong",{children:"This PC"})]}),ke.map(_=>_.roots.length>0&&o.jsxs("section",{className:"hub-drive-group",children:[o.jsxs("h3",{children:[o.jsx(_.icon,{size:13}),_.label]}),o.jsx("div",{className:"hub-drive-list",children:_.roots.map(F=>{const Y=_.icon,V=M.has(F.id)||F.locked===!0;return o.jsxs("button",{className:`hub-drive-item ${y===F.id?"active":""} ${V?"unavailable":""}`,onClick:()=>{X(F)},"aria-pressed":y===F.id,type:"button",children:[o.jsx("span",{className:"hub-drive-item-icon",children:o.jsx(Y,{size:16})}),o.jsxs("span",{className:"hub-drive-item-copy",children:[o.jsx("strong",{children:F.name}),o.jsx("small",{children:F.displayPath||F.name}),o.jsxs("em",{children:[ss(F.freeBytes||0)," free / ",ss(F.totalBytes||0)]})]}),E===F.id?o.jsx(kn,{className:"hub-drive-item-status spin",size:15}):V?o.jsx(Nn,{className:"hub-drive-item-status",size:15}):null]},F.id)})})]},_.id)),e.length===0&&o.jsxs("div",{className:"hub-drive-sidebar-empty",children:[o.jsx(Cn,{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:w.map((_,F)=>o.jsxs("span",{className:"hub-file-explorer-breadcrumb-item",children:[F>0&&o.jsx(rr,{size:13,"aria-hidden":"true"}),o.jsx("button",{className:`hub-file-explorer-breadcrumb ${F===w.length-1?"current":""}`,onClick:()=>J(F),title:_.displayPath||_.pathLabel,"data-hub-folder-id":_.hubId,"aria-current":F===w.length-1?"location":void 0,type:"button",children:_.pathLabel})]},_.svarPath))}),o.jsxs("div",{className:"hub-file-explorer-navigation-actions",children:[k&&o.jsx(kn,{className:"hub-file-explorer-loading-icon spin",size:15,"aria-label":"Loading folder"}),o.jsx("button",{className:"icon-button",onClick:he,disabled:w.length<=1||k,title:"Back to parent folder",type:"button",children:o.jsx(ir,{size:16})})]})]}),N&&o.jsxs("div",{className:"hub-file-explorer-folder-error",role:"alert",children:[o.jsx(Nn,{size:15}),o.jsx("span",{children:N})]}),o.jsx("div",{className:"hub-file-explorer-svar",onKeyDownCapture:ie,children:o.jsx(Sa,{fonts:!1,children:o.jsx(ja,{data:B,panels:ce?[{path:ce,selected:[]}]:void 0,readonly:!0,mode:"table",preview:!1,init:se,icons:"simple",menuOptions:oe},`${Z?.id||"no-root"}:${$}`)})})]})]})]})}class Ha extends c.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,n){console.error("[VuvoDesk] Share Files runtime error",e,n.componentStack)}render(){return this.state.error?o.jsxs("section",{className:"file-share-error-boundary",role:"alert",children:[o.jsx(or,{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(Zt,{size:15})," Retry"]})]}):this.props.children}}function La(t){return t.deviceName||t.hostname||t.deviceId}function za({devices:t,mode:e,selectedIds:n,onModeChange:s,onToggle:r}){const i=new Set(n);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:e==="all"?`${t.length} connected`:`${n.length} selected`})]}),o.jsxs("div",{className:"file-share-tabs compact","aria-label":"File transfer targets",children:[o.jsxs("button",{className:e==="all"?"active":"",onClick:()=>s("all"),type:"button",children:[o.jsx(ar,{size:14})," All connected"]}),o.jsxs("button",{className:e==="selected"?"active":"",onClick:()=>s("selected"),type:"button",children:[o.jsx(_n,{size:14})," Selected"]})]})]}),o.jsx("div",{className:"file-share-device-list","aria-label":"Connected Client targets",children:t.length===0?o.jsx("div",{className:"file-share-empty-inline",children:"No connected Clients."}):t.map(a=>{const l=e==="all"||i.has(a.deviceId);return o.jsxs("label",{className:`file-share-device-option ${l?"selected":""}`,children:[o.jsx("input",{type:"checkbox",checked:l,disabled:e==="all",onChange:()=>r(a.deviceId)}),o.jsx(_n,{size:20,"aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:La(a)}),o.jsxs("small",{children:["Slot ",a.slotNumber?String(a.slotNumber).padStart(3,"0"):"-"," / ",a.platform||"unknown OS"]})]}),o.jsx(lr,{size:17,"aria-hidden":"true"})]},a.deviceId)})})]})}function Ba(t){if(!Number.isFinite(t)||t<=0)return"0 B";const e=["B","KB","MB","GB","TB"];let n=t,s=0;for(;n>=1024&&s<e.length-1;)n/=1024,s+=1;return`${n.toFixed(s===0||n>=100?0:1)} ${e[s]}`}function Ga({folders:t,loading:e,busy:n,canSync:s,onSyncAll:r,onSync:i,onToggleAuto:a,onRemove:l,onAdd:d}){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:r,disabled:n||!s||t.length===0,type:"button",children:[o.jsx(Pt,{size:15})," ",n?"Syncing":"Sync all"]})]}),e?o.jsx("div",{className:"file-share-empty-state",children:"Loading Hub sync folders..."}):t.length===0?o.jsxs("button",{className:"file-share-empty-state interactive",onClick:d,type:"button",children:[o.jsx(Pt,{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:t.map(u=>o.jsxs("article",{className:`file-share-sync-row state-${u.status}`,children:[o.jsx("div",{className:"file-share-sync-icon",children:o.jsx(Pt,{size:19})}),o.jsxs("div",{className:"file-share-sync-info",children:[o.jsx("strong",{children:u.name}),o.jsx("span",{children:u.displayPath}),o.jsxs("small",{children:[u.fileCount," files / ",Ba(u.totalBytes)," · ",u.lastSyncedAt?`Last sync ${Xs(u.lastSyncedAt)} ago`:u.message||"Not synced yet"]})]}),o.jsxs("label",{className:"file-share-auto-sync",children:[o.jsx("input",{type:"checkbox",checked:u.autoSync,onChange:()=>a(u)}),o.jsx("span",{children:"Auto"})]}),o.jsxs("button",{className:"text-button compact",onClick:()=>i(u),disabled:n||!s||u.status==="syncing",type:"button",children:[o.jsx(Zt,{size:14})," Sync now"]}),o.jsx("button",{className:"icon-button",onClick:()=>l(u),title:"Remove sync folder",type:"button",children:o.jsx(cr,{size:15})})]},u.id))})]})}function Va(t){const n=(t.targetMode==="all"?t.devices.map(s=>s.deviceId):t.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 → Clients"})]}),o.jsx(Rn,{size:18})]}),o.jsxs("div",{className:"file-share-tabs",role:"tablist","aria-label":"Distribution mode",children:[o.jsx("button",{className:t.tab==="send"?"active":"",onClick:()=>t.onTabChange("send"),role:"tab","aria-selected":t.tab==="send",type:"button",children:"Send"}),o.jsx("button",{className:t.tab==="sync"?"active":"",onClick:()=>t.onTabChange("sync"),role:"tab","aria-selected":t.tab==="sync",type:"button",children:"Sync"})]}),t.tab==="send"?o.jsxs(o.Fragment,{children:[o.jsx(za,{devices:t.devices,mode:t.targetMode,selectedIds:t.selectedTargetIds,onModeChange:t.onTargetModeChange,onToggle:t.onTargetToggle}),o.jsxs("label",{className:"file-share-destination",children:[o.jsx("span",{children:"Destination folder"}),o.jsxs("div",{children:[o.jsx($n,{size:15}),o.jsx("input",{value:t.remoteDirectory,onChange:s=>t.onRemoteDirectoryChange(s.target.value),placeholder:"Desktop/VuvoDeskFiles"})]}),o.jsx("small",{children:"Blank uses Desktop/VuvoDeskFiles."})]}),o.jsxs("div",{className:"file-share-selection-summary",children:[o.jsx("span",{children:"Selected"}),o.jsx("strong",{children:t.selectedSummary})]}),o.jsxs("button",{className:"file-share-share-button",onClick:t.onShare,disabled:!t.canShare,type:"button",children:[o.jsx(Rn,{size:17})," Share selected"]}),o.jsxs("button",{className:"file-share-secondary-button",onClick:t.onAddSync,disabled:!t.canAddSync,type:"button",children:[o.jsx($n,{size:16})," Add selected folder to Sync"]})]}):o.jsx(Ga,{folders:t.folders,loading:t.foldersLoading,busy:t.syncBusy,canSync:n,onSyncAll:t.onSyncAll,onSync:t.onSync,onToggleAuto:t.onToggleAuto,onRemove:t.onRemove,onAdd:t.onAddFolder})]})}function Ya(t){if(!Number.isFinite(t)||t<=0)return"0 B";const e=["B","KB","MB","GB","TB"];let n=t,s=0;for(;n>=1024&&s<e.length-1;)n/=1024,s+=1;return`${n.toFixed(s===0||n>=100?0:1)} ${e[s]}`}function rs(t){if(t.state==="completed")return 100;const e=t.totalBytes>0?Math.round(t.sentBytes/t.totalBytes*100):t.totalFiles>0?Math.round(t.completedFiles/t.totalFiles*100):0;return Math.max(0,Math.min(Jt(t.state)?100:99,e))}function is(t){return t.state==="scanning"?"Scanning selected Hub items":t.state==="queued"?"Preparing transfer":t.state==="sending"?`${t.completedFiles}/${t.totalFiles} · ${t.currentPath||"sending"}`:t.state==="completed"?`Sent ${t.totalFiles} file${t.totalFiles===1?"":"s"} to ${t.targetCount} Client${t.targetCount===1?"":"s"}`:t.state==="partially-failed"?`${t.failedTargets.length} Client${t.failedTargets.length===1?"":"s"} failed`:t.state==="cancelled"?"Transfer cancelled":t.error||"Transfer failed"}function Jt(t){return["completed","partially-failed","failed","cancelled"].includes(t)}function nl({hubUrl:t,devices:e,localFeatureAccess:n,upgradeNotice:s,remoteDirectory:r,onRemoteDirectoryChange:i,targetMode:a,selectedTargetIds:l,onTargetModeChange:d,onTargetToggle:u,filePickerRef:h,folderPickerRef:f,onBrowserFileImport:x,onBrowserFolderImport:m,onNotice:p,onTransferChange:g}){const y=Array.isArray(e)?e:[],[v,w]=c.useState([]),[j,R]=c.useState(!0),[C,$]=c.useState(""),[b,E]=c.useState([]),[P,k]=c.useState([]),[D,N]=c.useState(null),[O,M]=c.useState(!1),[H,Z]=c.useState([]),[te,ce]=c.useState(!0),[de,B]=c.useState(!1),[G,T]=c.useState("send"),[U,X]=c.useState([]),J=c.useRef(new Set),ue=c.useRef(!1),he=c.useMemo(()=>a==="all"?y.map(I=>I.deviceId):l.filter(I=>y.some(q=>q.deviceId===I)),[y,l,a]),ie=U.find(I=>!Jt(I.state)),se=P.length===1&&P[0].type==="folder"?P[0]:null,oe=P.length===0?"Select files or folders from the Hub explorer.":O?"Calculating selection size...":D?`${D.files} files, ${D.folders} folders · ${Ya(D.totalBytes)}`:`${P.length} item${P.length===1?"":"s"} selected`,ne=I=>{g({id:I.jobId,state:I.state,progress:rs(I),message:is(I)})},ke=c.useCallback(async()=>{const I=await ka(t,!0);return w(I),$(""),I},[t]),_=async()=>{if(!ue.current){ue.current=!0;try{const q=(await Ra(t,!0)).jobs||[],ee=await Promise.all([...J.current].map(async xe=>{try{return await $a(xe,t)}catch{return null}})),_e=[...q,...ee.filter(Boolean)],Ve=[...new Map(_e.map(xe=>[xe.jobId,xe])).values()];X(Ve),Ve.forEach(ne),Ve.filter(xe=>Jt(xe.state)).forEach(xe=>J.current.delete(xe.jobId))}catch{}finally{ue.current=!1}}};c.useEffect(()=>{let I=!0;R(!0),$(""),Promise.all([ke(),ns(t).then(ee=>{I&&Z(ee)})]).catch(ee=>{I&&($(ee instanceof Error?"Hub file system is unavailable. Make sure VuvoDesk Hub is running on this computer.":"Hub file system is unavailable."),p(ee instanceof Error?ee.message:"Hub file system is unavailable."))}).finally(()=>{I&&(R(!1),ce(!1))}),_();const q=window.setInterval(()=>{_()},800);return()=>{I=!1,window.clearInterval(q)}},[t,ke]),c.useEffect(()=>{if(b.length===0){N(null);return}let I=!1;return M(!0),Na(b,t).then(q=>{I||N(q)}).catch(q=>{I||p(q instanceof Error?q.message:"Unable to calculate selected size.")}).finally(()=>{I||M(!1)}),()=>{I=!0}},[t,b.join("|")]);const F=(I,q)=>{E(I),k(q)},Y=I=>{I.forEach(q=>J.current.add(q.jobId)),X(q=>[...new Map([...q,...I].map(ee=>[ee.jobId,ee])).values()]),I.forEach(ne)},V=async()=>{if(!n){p(s);return}if(b.length===0){p("Select files or folders from the Hub explorer.");return}if(he.length===0){p("Choose at least one connected Client.");return}if(ie){p("A Hub transfer is already running.");return}try{const I=await _a(b,he,r.trim(),t);J.current.add(I.jobId),p("Hub transfer queued."),await _()}catch(I){p(I instanceof Error?I.message:"Unable to start Hub transfer.")}},z=async I=>{const q=I||se;if(!q||q.type!=="folder"){p("Select one folder to add it to Sync.");return}try{const ee=await Ma(q.id,t);Z(_e=>[..._e.filter(Ve=>Ve.id!==ee.folder.id),ee.folder]),T("sync"),p(`${q.name} is ready for Hub sync.`)}catch(ee){p(ee instanceof Error?ee.message:"Unable to add the Hub folder to Sync.")}},re=async I=>{if(he.length===0){p("Choose at least one connected Client.");return}B(!0),Z(q=>q.map(ee=>ee.id===I.id?{...ee,status:"syncing"}:ee));try{const q=await Ta(I.id,he,r.trim(),t);Y(q.jobs||[]),p(q.jobs?.length?"Hub sync queued.":"No changed files to sync.");const ee=await ns(t);Z(ee)}catch(q){p(q instanceof Error?q.message:"Unable to sync the Hub folder."),Z(ee=>ee.map(_e=>_e.id===I.id?{..._e,status:"error",message:"Sync failed"}:_e))}finally{B(!1)}},ae=async()=>{B(!0);try{for(const I of H)await re(I)}finally{B(!1)}},Ne=async I=>{try{const q=await Da(I.id,{autoSync:!I.autoSync},t);Z(ee=>ee.map(_e=>_e.id===I.id?q.folder:_e))}catch(q){p(q instanceof Error?q.message:"Unable to update auto sync.")}},lt=async I=>{try{await Aa(I.id,t),Z(q=>q.filter(ee=>ee.id!==I.id))}catch(q){p(q instanceof Error?q.message:"Unable to remove the sync folder.")}};return o.jsxs("section",{className:"livedesk-file-explorer",children:[o.jsx("input",{ref:h,className:"hidden-file-input",type:"file",multiple:!0,onChange:I=>{I.currentTarget.files&&x(I.currentTarget.files),I.currentTarget.value=""}}),o.jsx("input",{ref:f,className:"hidden-file-input",type:"file",multiple:!0,webkitdirectory:"",directory:"",onChange:I=>{I.currentTarget.files&&m(I.currentTarget.files),I.currentTarget.value=""}}),o.jsx("div",{className:"file-share-workspace",children:o.jsxs(Ha,{onRetry:()=>window.location.reload(),children:[o.jsx(Pa,{hubUrl:t,roots:v,loading:j,error:C,onRefreshRoots:ke,onImportFiles:()=>h.current?.click(),onImportFolder:()=>f.current?.click(),onSelectionChange:F,onShareItem:I=>{E([I.id]),k([I]),T("send")},onAddSyncFolder:I=>{E([I.id]),k([I]),z(I)},onNotice:p}),o.jsx(Va,{devices:y,targetMode:a,selectedTargetIds:l,onTargetModeChange:d,onTargetToggle:u,remoteDirectory:r,onRemoteDirectoryChange:i,selectedEntries:P,selectedSummary:oe,canShare:n&&!ie&&b.length>0&&he.length>0&&!O,onShare:()=>{V()},canAddSync:!!se,onAddSync:()=>{z()},tab:G,onTabChange:T,folders:H,foldersLoading:te,syncBusy:de,onSyncAll:()=>{ae()},onSync:I=>{re(I)},onToggleAuto:I=>{Ne(I)},onRemove:I=>{lt(I)},onAddFolder:()=>{z()}})]})}),ie&&o.jsx("footer",{className:"file-share-workspace-footer",children:o.jsxs("span",{children:[is(ie)," · ",rs(ie),"% ",o.jsx("button",{className:"icon-button",onClick:()=>{Ea(ie.jobId,t).then(I=>{X(q=>q.map(ee=>ee.jobId===I.jobId?I:ee)),ne(I)})},title:"Cancel transfer",type:"button",children:o.jsx(dr,{size:14})})]})})]})}export{nl as ShareFilesPage};
|