@kingsimba/nc-ui 0.1.15 → 0.1.16
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/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +474 -473
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var Ue=Object.defineProperty;var Xe=(e,t,n)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var V=(e,t,n)=>Xe(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),d=require("react"),ce=require("react-dom"),q=require("react-i18next"),O=require("./GeneratedIcons-CGjL38ny.cjs"),Je=require("i18next"),Qe=require("./clsx-C11secjj.cjs");function me({size:e="default",color:t,overlay:n=!1,className:s=""}){const o=r.jsx("svg",{className:`nc-activity-indicator nc-${e} ${s}`,viewBox:"0 0 50 50",style:t?{color:t}:void 0,children:r.jsx("circle",{className:"nc-activity-indicator-circle",cx:"25",cy:"25",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round"})});return n?r.jsx("div",{className:"nc-activity-indicator-overlay",children:o}):o}function H({variant:e="default",block:t,size:n="default",className:s,disabled:o,textSelectable:i,loading:l,onClick:a,children:u,...h}){const p=["nc-button",e!=="default"?`nc-${e}`:"",t?"nc-block":"",n==="small"?"nc-small":"",n==="large"?"nc-large":"",o||l?"nc-disabled":"",i?"nc-text-selectable":"",l?"nc-loading":"",s??""].filter(Boolean).join(" "),x=c=>{if(!l){if(i){const f=window.getSelection();if(f&&f.toString().length>0)return}a==null||a(c)}};return r.jsxs("button",{className:p,disabled:o||l,onClick:x,...h,children:[l&&r.jsx(me,{size:"small",className:"nc-button-spinner",color:e!=="default"&&e!=="ghost"?"white":void 0}),u]})}function Ze({code:e,text:t,type:n,button:s,onAction:o}){return r.jsxs("div",{className:`nc-alert nc-${n}`,children:[r.jsxs("span",{className:`nc-alert-message nc-${n}`,children:[r.jsx("span",{className:"nc-alert-code",children:e}),t]}),s&&r.jsx("span",{className:"nc-alert-action",children:r.jsx(H,{size:"small",variant:s.variant??(n==="error"?"danger":"warning"),onClick:o,children:s.text})})]})}function et({percentage:e=.5,status:t="discharging",darkMode:n=!1,colored:s=!1}){const o=Math.max(0,Math.min(1,Number(e)||0));let i;s?o<.1?i="var(--nc-danger)":o<.2?i="var(--nc-warning)":i="var(--nc-success)":i=n?"#ffffff":"#000000";const l=n?"rgba(255, 255, 255, 0.5)":"rgba(0, 0, 0, 0.2)",a=24,u=14,h=2,p=0,x=12,c=0,f=0,v=0,b=a,w=u,k=w-c*2,m=b-c*2,j=Math.max(1,Math.min(4,w/4)),g=o===0?0:.05+o*.95,S=a+h+x,E=20,A=.65,$=Math.max(u,E*A),y=a+h+1,N=(u-E*A)/2;return r.jsxs("svg",{className:"nc-battery",width:S,height:$,viewBox:`0 0 ${S} ${$}`,role:"img","aria-label":`Battery ${o===0?"-":Math.round(o*100)+"%"} ${t}`,children:[r.jsxs("defs",{children:[r.jsx("mask",{id:`nc-battery-fill-mask-${o}`,children:r.jsx("rect",{x:"0",y:"0",width:m*g,height:k,fill:"white"})}),r.jsxs("mask",{id:`nc-battery-text-mask-${o}`,children:[r.jsx("rect",{x:"0",y:"0",width:S,height:$,fill:"white"}),r.jsx("text",{x:f+b/2,y:u-3,fontSize:11,fontWeight:"bold",fill:"black",textAnchor:"middle",children:o===0?"-":Math.round(o*100)})]})]}),r.jsxs("g",{mask:`url(#nc-battery-text-mask-${o})`,children:[r.jsx("rect",{x:f,y:v,rx:j,ry:j,width:b,height:w,fill:l}),r.jsx("rect",{x:f+c,y:v+c,width:m,height:k,fill:i,rx:j,ry:j,mask:`url(#nc-battery-fill-mask-${o})`}),r.jsx("rect",{x:a+p,y:u*.26,width:h,height:u*.48,rx:.8,ry:.8,fill:o===1?i:l}),t==="charging"?r.jsx("g",{transform:`translate(${y}, ${N}) scale(${A})`,fill:i,children:r.jsx("path",{d:"M10 0 L2 11 H8 L5 20 L14 8 H8 L10 0 Z"})}):null]})]})}function tt({value:e,onChange:t,options:n,disabled:s,labels:o,size:i="default"}){return r.jsx("div",{className:`nc-button-group ${i==="small"?"nc-small":""}`,children:n.map((l,a)=>r.jsx("button",{className:`nc-button-group-item ${e===l?"nc-active":""} ${a<n.length-1?"nc-has-border":""}`,onClick:()=>!s&&t(l),disabled:s,children:o&&o[l]?o[l]:l},l))})}function nt({size:e}){return r.jsx("svg",{className:`nc-checkbox-icon ${e==="small"?"nc-small":""}`,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("path",{d:"M2 6L5 9L10 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function rt({checked:e,onChange:t,disabled:n,label:s,size:o="default",labelColor:i,style:l,className:a=""}){const u=o==="small";return r.jsxs("label",{className:`nc-checkbox-label ${u?"nc-small":""} ${n?"nc-disabled":""} ${a}`.trim(),style:l,onClick:h=>{n||(h.preventDefault(),t(!e))},children:[r.jsx("span",{role:"checkbox","aria-checked":e,tabIndex:0,className:`nc-checkbox-box ${u?"nc-small":""} ${e?"nc-checked":""}`,onKeyDown:h=>{n||(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),t(!e))},children:e&&r.jsx(nt,{size:o})}),s&&r.jsx("span",{className:"nc-checkbox-text",style:i?{color:i}:void 0,children:s})]})}function st({option:e,onChange:t,selected:n,highlighted:s,small:o}){const i=d.useRef(null),{t:l}=q.useTranslation();return d.useEffect(()=>{s&&i.current&&i.current.scrollIntoView({block:"nearest"})},[s]),r.jsxs("div",{ref:i,className:`nc-combo-dropdown-option ${o?"nc-small":""} ${s?"nc-highlighted":""}`,role:"option",onMouseDown:()=>t(e.value),"aria-selected":n,style:{cursor:"pointer",background:s?"rgba(59,130,246,0.18)":n?"rgba(59,130,246,0.12)":void 0},children:[e.label,e.default&&r.jsxs("span",{style:{fontSize:"0.85em",color:"var(--nc-text-weak)",marginLeft:6},children:["(",l("common.default"),")"]})]})}function ot({isOpen:e,options:t,onSelect:n,selectedValue:s,placement:o="bottom",anchorRef:i,small:l,highlightedIndex:a=-1}){const[u,h]=d.useState({top:0,left:0,width:0}),[p,x]=d.useState(o),{t:c}=q.useTranslation();if(d.useEffect(()=>{if(e&&i.current){const v=i.current.getBoundingClientRect();let b=o;if(o==="bottom"){const w=window.innerHeight-v.bottom,k=v.top;w<320&&k>w&&(b="top")}x(b),h({top:b==="top"?v.top-4:v.bottom+4,left:v.left,width:v.width})}},[e,i,o]),!e)return null;const f=r.jsx("div",{className:"nc-combo-dropdown",style:{position:"fixed",top:p==="top"?void 0:u.top,bottom:p==="top"?window.innerHeight-u.top:void 0,left:u.left,width:u.width,zIndex:1e3,maxHeight:300,overflowY:"auto"},children:t.length===0?r.jsx("div",{className:`nc-combo-dropdown-option nc-no-results ${l?"nc-small":""}`,children:c("common.noResults")}):t.map((v,b)=>r.jsx(st,{option:v,onChange:n,selected:v.value===s,highlighted:b===a,small:l},v.value))});return ce.createPortal(f,document.body)}function it({onClick:e,small:t}){return r.jsx("button",{className:`nc-button nc-ghost nc-combo-button nc-combo-clear ${t?"nc-small":""}`,onClick:e,onMouseDown:n=>n.stopPropagation(),"aria-label":"Clear selection",children:"✕"})}function ct({open:e,onClick:t,small:n}){return r.jsx("button",{className:`nc-button nc-ghost nc-combo-button nc-combo-toggle ${n?"nc-small":""} ${e?"nc-open":""}`,onClick:t,onMouseDown:s=>s.stopPropagation(),"aria-label":e?"Close":"Open",children:"▾"})}function at({value:e,onChange:t,placeholder:n="Select…",options:s,disabled:o,label:i,clearable:l=!0,allowTyping:a=!1,placement:u="bottom",size:h="default",style:p,className:x}){const[c,f]=d.useState(!1),[v,b]=d.useState(""),[w,k]=d.useState(-1),m=d.useRef(null),j=d.useRef(null),g=h==="small",{t:S}=q.useTranslation(),E=d.useMemo(()=>{const M=v.toLowerCase();return a?s.filter(T=>T.label.toLowerCase().includes(M)):s},[s,v,a]);d.useEffect(()=>{c&&k(-1)},[c,E]),d.useEffect(()=>{if(!l&&!e&&s.length>0&&t){const M=s.find(T=>T.default)||s[0];t(M.value)}},[l,e,s,t]),d.useEffect(()=>{function M(T){var L;T.target instanceof Node&&m.current&&((L=m.current.parentElement)!=null&&L.contains(T.target)||f(!1))}return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[]);const A=s.find(M=>M.value===e),$=A&&l,y=!o&&!$,N=!(c&&a)&&!!A,I=(M,T=!1)=>{var L;t==null||t(M),f(!1),b(""),T&&((L=m.current)==null||L.blur())},C=()=>{t==null||t(void 0),b(""),f(!1)},z=M=>{if(!c){(M.key==="ArrowDown"||M.key==="ArrowUp")&&(f(!0),M.preventDefault());return}switch(M.key){case"ArrowDown":M.preventDefault(),k(T=>{const L=T+1;return L>=E.length?0:L});break;case"ArrowUp":M.preventDefault(),k(T=>{const L=T-1;return L<0?E.length-1:L});break;case"Enter":M.preventDefault(),w>=0&&w<E.length&&I(E[w].value,!0);break;case"Escape":M.preventDefault(),f(!1),b("");break}};return r.jsxs("div",{className:`nc-combo-container ${x||""}`.trim(),style:{position:"relative",...p},children:[i&&r.jsx("span",{className:`nc-label ${g?"nc-small":""}`,children:i}),r.jsxs("div",{ref:j,style:{position:"relative",display:"flex",alignItems:"center"},onMouseDown:M=>{o||a&&M.target===m.current||(f(T=>(!T&&a&&A&&b(A.label),!T)),a&&!c&&setTimeout(()=>{var T,L;(T=m.current)==null||T.focus(),(L=m.current)==null||L.select()},0))},children:[r.jsx("input",{ref:m,className:`nc-input ${g?"nc-small":""}`,placeholder:n,onFocus:()=>{var M;!o&&a&&(f(!0),A&&(b(A.label),setTimeout(()=>{var T;return(T=m.current)==null?void 0:T.select()},0))),a||(M=m.current)==null||M.blur()},onChange:M=>a&&b(M.target.value),onKeyDown:z,value:c&&a?v:(A==null?void 0:A.label)||"",readOnly:o||!a,style:{width:"100%",paddingRight:y||$?g?32:44:12,caretColor:a?void 0:"transparent",cursor:a?void 0:"pointer",userSelect:a?void 0:"none",color:N?"transparent":"var(--nc-text)"}}),N&&r.jsxs("div",{"aria-hidden":!0,style:{position:"absolute",left:g?8:12,right:y||$?g?12:24:g?8:12,top:"50%",transform:"translateY(-50%)",pointerEvents:"none",display:"flex",alignItems:"center",gap:6,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[r.jsx("span",{className:`nc-combo-overlay-text ${g?"nc-small":""}`,children:A==null?void 0:A.label}),(A==null?void 0:A.default)&&r.jsxs("span",{className:`nc-combo-overlay-default ${g?"nc-small":""}`,children:["(",S("common.default"),")"]})]}),$&&r.jsx(it,{onClick:C,small:g}),y&&r.jsx(ct,{open:c,onClick:()=>f(M=>!M),small:g})]}),r.jsx(ot,{isOpen:c,options:E,onSelect:I,selectedValue:e,placement:u,anchorRef:j,small:g,highlightedIndex:w})]})}function lt({onClick:e,loading:t=!1,disabled:n=!1,size:s="default",title:o,"aria-label":i}){const l=s==="small"?14:s==="large"?20:18,a=t?"Refreshing...":"Refresh",u=t?"Refreshing":"Refresh";return r.jsx("button",{className:"nc-icon-button",onClick:e,disabled:n||t,title:o??a,"aria-label":i??u,"data-size":s,children:r.jsx(O.RefreshIcon,{size:l,className:t?"nc-spinning":""})})}function ge({onClick:e,disabled:t=!1,size:n="default",title:s="Close","aria-label":o="Close"}){const i=n==="small"?14:n==="large"?20:18;return r.jsx("button",{className:"nc-icon-button nc-icon-button-close",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":n,children:r.jsx(O.CloseIcon,{size:i})})}function dt({onClick:e,disabled:t=!1,size:n="default",title:s="Edit","aria-label":o="Edit"}){const i=n==="small"?14:n==="large"?20:18;return r.jsx("button",{className:"nc-icon-button nc-icon-button-edit",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":n,children:r.jsx(O.EditIcon,{size:i})})}function ut({onClick:e,disabled:t=!1,size:n="default",title:s="Delete","aria-label":o="Delete"}){const i=n==="small"?14:n==="large"?20:18;return r.jsx("button",{className:"nc-icon-button nc-icon-button-trash",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":n,children:r.jsx(O.TrashIcon,{size:i})})}function pt({onClick:e,disabled:t=!1,children:n,title:s,"aria-label":o,size:i="default"}){return r.jsx("button",{className:"nc-hyperlink",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":i,children:n})}function ft({open:e,onClose:t,options:n,anchorRef:s,anchor:o,preferredDirection:i="down"}){const l=d.useRef(null),[a,u]=d.useState({top:0,left:0}),h=o||(s==null?void 0:s.current);if(d.useEffect(()=>{if(!e||!h||!l.current)return;const c=h.getBoundingClientRect(),f=l.current.getBoundingClientRect(),v=window.innerHeight,b=window.innerWidth,w=c.bottom+8,k=w+f.height<=v-8;let m=i;(!k&&i==="down"||i==="up"&&k)&&(m="up");let j;m==="down"?j=w:j=c.top-f.height-8;let g=c.left;g+f.width>b-8&&(g=c.right-f.width),u({top:Math.max(8,j),left:Math.max(8,g)})},[e,h,i]),d.useEffect(()=>{if(!e)return;const c=v=>{l.current&&!l.current.contains(v.target)&&h&&!h.contains(v.target)&&t()},f=v=>{v.key==="Escape"&&t()};return document.addEventListener("mousedown",c),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",f)}},[e,t,h]),!e)return null;const p=c=>{c.type!=="separator"&&!c.disabled&&c.onClick&&(c.onClick(),t())},x=n.some(c=>c.icon);return ce.createPortal(r.jsx("div",{ref:l,className:"nc-context-menu",style:{position:"fixed",top:`${a.top}px`,left:`${a.left}px`,zIndex:1e4},role:"menu",children:n.map(c=>{if(c.type==="separator")return r.jsx("div",{className:"nc-context-menu-separator",role:"separator"},c.id);const f=["nc-context-menu-item",c.variant&&c.variant!=="default"?`nc-${c.variant}`:"",c.disabled?"nc-disabled":"",x&&!c.icon?"nc-indented":""].filter(Boolean).join(" ");return r.jsxs("button",{className:f,onClick:()=>p(c),disabled:c.disabled,role:"menuitem",children:[c.icon&&r.jsx("span",{className:"nc-context-menu-icon",children:c.icon}),r.jsx("span",{className:"nc-context-menu-label",children:c.label})]},c.id)})}),document.body)}const Te=d.createContext(null);function Pe(){const e=d.useContext(Te);if(!e)throw new Error("useDialog must be used inside a Dialog component");return e}function U({children:e,onClick:t,...n}){const{close:s}=Pe(),{t:o}=q.useTranslation(),i=l=>{t==null||t(l),s()};return r.jsx(H,{onClick:i,...n,children:e??o("common.close")})}function ht({open:e,onClose:t,title:n,children:s,style:o,footerType:i="ok-cancel",footer:l,onOk:a,onSave:u,onDelete:h,onCancel:p,onConnect:x,closeOnOverlay:c=!0,primaryDisabled:f=!1,fullScreen:v=!1,hideTitleBar:b=!1,className:w="",onContentHeightChange:k}){const m=d.useRef(null),j=d.useRef(null),{t:g}=q.useTranslation(),S={close:t},E=y=>{c&&y.target===y.currentTarget&&t()};if(d.useEffect(()=>{e&&m.current&&m.current.focus()},[e]),d.useEffect(()=>{if(!k||!j.current)return;const y=new ResizeObserver(N=>{for(const I of N){const C=I.contentRect.height;k(C)}});return y.observe(j.current),()=>{y.disconnect()}},[k]),!e)return null;const A=()=>{switch(i){case"ok":return r.jsx("div",{className:"nc-dialog-footer",children:r.jsx(H,{variant:"primary",onClick:a??t,disabled:f,children:g("common.ok")})});case"ok-cancel":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"primary",onClick:a??t,disabled:f,children:g("common.ok")}),r.jsx(U,{onClick:p,children:g("common.cancel")})]});case"save-cancel":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"primary",onClick:u,disabled:f,children:g("common.save")}),r.jsx(U,{onClick:p,children:g("common.cancel")})]});case"delete-cancel":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"danger",onClick:h,disabled:f,children:g("common.delete")}),r.jsx(U,{onClick:p,children:g("common.cancel")})]});case"connect":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"primary",onClick:x,disabled:f,children:g("common.connect")}),r.jsx(U,{onClick:p,children:g("common.cancel")})]});case"close":return r.jsx("div",{className:"nc-dialog-footer",children:r.jsx(U,{variant:"primary"})});case"gotit":return r.jsx("div",{className:"nc-dialog-footer",children:r.jsx(U,{variant:"primary",children:g("common.gotit")})});case"custom":return r.jsx("div",{className:"nc-dialog-footer",children:l});case"none":return null;default:return null}},$=r.jsx(Te.Provider,{value:S,children:r.jsx("div",{className:`nc-dialog-overlay${v?" nc-fullscreen":""}`,onClick:E,children:r.jsxs("div",{ref:m,className:`nc-dialog-container ${w}`,style:o,tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":b?void 0:"nc-dialog-title",children:[!b&&r.jsxs("div",{className:"nc-dialog-header",children:[r.jsx("h3",{id:"nc-dialog-title",className:"nc-dialog-title",children:n}),r.jsx(ge,{onClick:t,"aria-label":"Close dialog"})]}),r.jsx("div",{ref:j,className:"nc-dialog-content",children:s}),A()]})})});return v?ce.createPortal($,document.body):$}function mt({onClick:e,size:t="default",rightOffset:n=4}){const s=t==="small"?28:34;return r.jsx("button",{className:"nc-button nc-ghost",onClick:e,onMouseDown:o=>{o.preventDefault(),o.stopPropagation()},tabIndex:-1,"aria-label":"Clear input",style:{position:"absolute",right:n,padding:0,minHeight:0,height:s,width:s,border:"none",display:"flex",alignItems:"center",justifyContent:"center",fontSize:t==="small"?"12px":"14px"},children:"✕"})}function gt({visible:e,onClick:t,size:n="default"}){const s=n==="small"?28:34,o=n==="small"?16:18;return r.jsx("button",{className:"nc-button nc-ghost",onClick:t,onMouseDown:i=>{i.preventDefault(),i.stopPropagation()},tabIndex:-1,"aria-label":e?"Hide password":"Show password",style:{position:"absolute",right:4,padding:0,minHeight:0,height:s,width:s,border:"none",display:"flex",alignItems:"center",justifyContent:"center"},children:e?r.jsx(O.EyeHiddenIcon,{size:o}):r.jsx(O.ViewIcon,{size:o})})}function bt({value:e,defaultValue:t="",onChange:n,onEnter:s,onClear:o,placeholder:i,disabled:l,label:a,clearable:u=!0,type:h="text",className:p="",size:x="default",style:c,showPasswordToggle:f=!1,multiline:v=!1,rows:b=3,validator:w,showErrorMessage:k=!0}){const m=d.useRef(null),j=d.useRef(null),[g,S]=d.useState(!1),[E,A]=d.useState(!1),$=e!==void 0,[y,N]=d.useState(t),I=$?e:y,C=w?w(I):null,z=!!C,M=h==="password",T=M&&f&&!l&&!v,L=u&&I&&!l&&E,Q=x==="small"?32:44;let G=12;L&&T?G=Q*2:(L||T)&&(G=Q);const _=()=>{var Z,re;$||N(""),n==null||n(""),o==null||o(),v?(Z=j.current)==null||Z.focus():(re=m.current)==null||re.focus()},ne=Z=>{Z.key==="Enter"&&!v&&(s==null||s())},B=Z=>{const re=Z.target.value;$||N(re),n==null||n(re)},ke=()=>{A(!0)},Ne=()=>{A(!1)},Se=`nc-input ${x==="small"?"nc-small ":""} ${z?"nc-error ":""}${p}`;return r.jsxs("div",{className:"nc-col",style:{position:"relative",flex:1,...c},children:[a&&r.jsx("span",{className:"nc-label",children:a}),r.jsxs("div",{style:{position:"relative",display:"flex",alignItems:v?"flex-start":"center"},children:[v?r.jsx("textarea",{ref:j,className:Se,placeholder:i,value:I,onChange:B,onKeyDown:ne,onFocus:ke,onBlur:Ne,disabled:l,rows:b,style:{width:"100%",paddingRight:G}}):r.jsx("input",{ref:m,type:M&&g?"text":h,className:Se,placeholder:i,value:I,onChange:B,onKeyDown:ne,onFocus:ke,onBlur:Ne,disabled:l,style:{width:"100%",paddingRight:G}}),L&&r.jsx(mt,{onClick:_,size:x,rightOffset:T?Q+4:4}),T&&r.jsx(gt,{visible:g,onClick:()=>S(!g),size:x})]}),z&&k&&r.jsx("span",{className:"nc-error-message",children:C})]})}function xt({children:e,onClick:t,showBorder:n=!0,selectable:s=!1,style:o}){const[i,l]=d.useState(!1),a=u=>{if(t){if(s){const h=window.getSelection();if(h&&h.toString().length>0)return}t(u)}};return r.jsx("div",{onClick:a,onMouseDown:()=>t&&l(!0),onMouseUp:()=>l(!1),onMouseLeave:()=>l(!1),style:{cursor:t?"pointer":"default",userSelect:s?"text":void 0,borderBottom:n?void 0:"none",...o},className:`nc-list-group-item ${t?"nc-list-group-item-clickable":""} ${i?"nc-list-group-item-active":""}`,children:r.jsx("div",{style:{flex:1},children:e})})}function vt({title:e,titleTools:t,children:n,style:s}){return r.jsxs("div",{className:"nc-list-group",style:s,children:[(e||t)&&r.jsxs("div",{className:"nc-list-group-title",children:[r.jsx("div",{children:e}),t&&r.jsx("div",{className:"nc-list-group-title-tools",children:t})]}),r.jsx("div",{className:"nc-list-group-content",children:n})]})}function wt({values:e,onChange:t,options:n,placeholder:s="Select…",label:o}){const[i,l]=d.useState(!1),[a,u]=d.useState(""),h=d.useRef(null),p=d.useMemo(()=>n.filter(c=>c.label.toLowerCase().includes(a.toLowerCase())),[n,a]);d.useEffect(()=>{function c(f){!(f.target instanceof Node)||!h.current||h.current.contains(f.target)||l(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[]);const x=c=>{e.includes(c)?t(e.filter(f=>f!==c)):t([...e,c])};return r.jsxs("div",{ref:h,className:"nc-col",style:{position:"relative"},children:[o&&r.jsx("span",{className:"nc-label",children:o}),r.jsxs("div",{className:"nc-row",style:{flexWrap:"wrap",gap:6,minHeight:42,alignItems:"center",border:"1px solid var(--nc-button-border)",borderRadius:8,background:"var(--nc-button-bg)",padding:"4px 8px"},children:[e.length===0&&r.jsx("span",{className:"nc-label",children:s}),e.map(c=>{const f=n.find(v=>v.value===c);return f?r.jsxs("span",{style:{padding:"4px 8px",borderRadius:6,display:"inline-flex",alignItems:"center",gap:4,background:"var(--nc-button-bg)",border:"1px solid var(--nc-button-border)"},children:[f.label,r.jsx("button",{className:"nc-button nc-ghost",style:{padding:0,minHeight:0,height:20,width:20,display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none"},onClick:()=>x(c),"aria-label":`Remove ${f.label}`,children:"✕"})]},c):null}),r.jsx("input",{className:"nc-input",value:a,onChange:c=>u(c.target.value),onFocus:()=>l(!0),style:{minWidth:50,border:"none",background:"transparent",padding:4,minHeight:32,flex:1}})]}),i&&r.jsxs("div",{className:"nc-combo-dropdown",style:{position:"absolute",top:"100%",left:0,right:0,zIndex:10,marginTop:4,boxShadow:"0 4px 12px var(--nc-shadow)"},children:[p.map(c=>{const f=e.includes(c.value);return r.jsxs("div",{className:"nc-section nc-row",style:{justifyContent:"space-between",cursor:"pointer",padding:12},onMouseDown:()=>x(c.value),children:[r.jsx("span",{children:c.label}),r.jsx("span",{children:f?"✔️":""})]},c.value)}),p.length===0&&r.jsx("div",{className:"nc-section nc-label",children:"No results"})]})]})}function ae(e){if(!e)return null;const t=/^\d{2}-\d{1,2}$/,n=/^\d{4}-\d{1,2}$/;if(!t.test(e)&&!n.test(e))return"Format must be YY-M(M) or YYYY-M(M)";const s=e.split("-"),o=parseInt(s[1],10);return o<1||o>12?"Month must be between 1 and 12":null}function ie(e){if(!e)return"";const t=e.split("-");if(t.length!==2)return e;let n=t[0];const s=t[1].padStart(2,"0");if(n.length===2){const o=parseInt(n,10);n=String(o<50?2e3+o:1900+o)}return`${n}-${s}`}function Ce(e){if(!e)return"";const t=ie(e);if(!/^\d{4}-\d{2}$/.test(t))return e;const[n,s]=t.split("-");return`${n}/${s}`}function Ae(){const e=new Date,t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0");return`${t}-${n}`}function yt({startMonth:e,endMonth:t,onChange:n,label:s,className:o="",disabled:i=!1}){const[l,a]=d.useState(!1),[u,h]=d.useState(""),[p,x]=d.useState(""),[c,f]=d.useState({top:0,left:0,width:0,right:void 0}),v=d.useRef(null),b=d.useRef(null);d.useEffect(()=>{if(l&&v.current){const N=v.current.getBoundingClientRect(),C=Math.max(N.width,400);window.innerWidth-N.left<C&&N.right>=C?f({top:N.bottom+4,left:0,right:window.innerWidth-N.right,width:C}):f({top:N.bottom+4,left:N.left,right:void 0,width:C})}},[l]),d.useEffect(()=>{if(!l)return;const N=I=>{v.current&&!v.current.contains(I.target)&&b.current&&!b.current.contains(I.target)&&a(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]);const w=()=>{h(e||Ae()),x(t||Ae()),a(!0)},k=()=>{a(!1)},m=()=>{const N=ae(u),I=ae(p);if(N||I)return;const C=ie(u),z=ie(p);C&&z&&(n==null||n(C,z)),a(!1)},j=e&&t?`${Ce(e)} - ${Ce(t)}`:"Select month range",g=ae(u),S=ae(p),E=ie(u),A=ie(p),$=E&&A&&E>A,y=l?ce.createPortal(r.jsx("div",{ref:b,className:"nc-month-range-picker-popup",style:{position:"fixed",top:c.top,...c.right!==void 0?{right:c.right}:{left:c.left},width:c.width,zIndex:1e3},children:r.jsxs("div",{className:"nc-month-range-picker-content",children:[r.jsxs("div",{className:"nc-month-range-picker-row",children:[r.jsxs("div",{className:"nc-month-range-picker-column",children:[r.jsx("label",{className:"nc-label",children:"Start Month"}),r.jsx("input",{type:"text",className:`nc-month-input ${g?"nc-error":""}`,value:u,onChange:N=>h(N.target.value),placeholder:"YY-M(M) or YYYY-M(M)"}),g&&r.jsx("div",{className:"nc-month-error-text",children:g})]}),r.jsxs("div",{className:"nc-month-range-picker-column",children:[r.jsx("label",{className:"nc-label",children:"End Month"}),r.jsx("input",{type:"text",className:`nc-month-input ${S?"nc-error":""}`,value:p,onChange:N=>x(N.target.value),placeholder:"YY-M(M) or YYYY-M(M)"}),S&&r.jsx("div",{className:"nc-month-error-text",children:S})]})]}),$&&!g&&!S&&r.jsx("div",{className:"nc-month-range-error",children:"End month must be after or equal to start month"}),r.jsxs("div",{className:"nc-month-range-picker-footer",children:[r.jsx(H,{variant:"primary",onClick:m,disabled:!u||!p||!!g||!!S||!!$,children:"Apply"}),r.jsx(H,{variant:"ghost",onClick:k,children:"Cancel"})]})]})}),document.body):null;return r.jsxs("div",{className:`nc-month-range-picker ${o}`,children:[s&&r.jsx("label",{className:"nc-label",children:s}),r.jsx("button",{ref:v,className:"nc-month-range-picker-input",onClick:w,disabled:i,children:j}),y]})}function jt({value:e,onChange:t,min:n,max:s,step:o=1,label:i,disabled:l,size:a="default"}){const u=a==="small",h=()=>{const c=e-o;n!==void 0&&c<n||t(parseFloat(c.toFixed(10)))},p=()=>{const c=e+o;s!==void 0&&c>s||t(parseFloat(c.toFixed(10)))},x=c=>{const f=parseFloat(c.target.value);isNaN(f)||n!==void 0&&f<n||s!==void 0&&f>s||t(f)};return r.jsxs("div",{className:`nc-col nc-number-input-col ${u?"nc-small":""}`,children:[i&&r.jsx("span",{className:`nc-label ${u?"nc-small":""}`,children:i}),r.jsxs("div",{className:`nc-number-input-container ${u?"nc-small":""}`,children:[r.jsx("input",{className:`nc-input nc-number-input ${u?"nc-small":""}`,type:"number",value:e,onChange:x,min:n,max:s,step:o,disabled:l}),r.jsx("button",{className:`nc-button nc-ghost nc-number-input-button ${u?"nc-small":""}`,onClick:h,disabled:l||n!==void 0&&e<=n,children:"−"}),r.jsx("button",{className:`nc-button nc-ghost nc-number-input-button ${u?"nc-small":""}`,onClick:p,disabled:l||s!==void 0&&e>=s,children:"+"})]})]})}function kt({value:e,onChange:t,min:n=0,max:s=100,step:o=1,label:i,disabled:l,showValue:a=!0,formatValue:u=p=>p.toString(),width:h=200}){const p=c=>{const f=parseFloat(c.target.value);t(f)},x=(e-n)/(s-n)*100;return r.jsxs("div",{className:"nc-col",style:{gap:6},children:[i&&r.jsx("span",{className:"nc-label",children:i}),r.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[r.jsx("input",{type:"range",className:"nc-slider",value:e,onChange:p,min:n,max:s,step:o,disabled:l,style:{width:h,"--nc-slider-percentage":`${x}%`}}),a&&r.jsx("span",{style:{color:"var(--nc-text)",fontFamily:"monospace",fontSize:14,minWidth:60,textAlign:"right"},children:u(e)})]})]})}const Nt=({size:e=24,className:t,style:n})=>r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,style:n,children:r.jsx("polyline",{points:"18 15 12 9 6 15"})});function ze({children:e,className:t="",style:n}){return r.jsx("div",{className:`nc-tab-panel ${t}`,style:n,children:e})}function St({active:e,children:t,keepMounted:n=!1,className:s="",style:o}){const i=d.Children.toArray(t).filter(a=>d.isValidElement(a)&&(a.type===ze||a.type.displayName==="TabPanel"));if(n)return r.jsx("div",{className:`nc-tab-panels ${s}`,style:o,children:i.map(a=>{const u=a.props.tab===e;return r.jsx("div",{className:`nc-tab-panel-wrapper ${u?"nc-active":""}`,style:{display:u?void 0:"none"},"aria-hidden":!u,children:a},a.props.tab)})});const l=i.find(a=>a.props.tab===e);return r.jsx("div",{className:`nc-tab-panels ${s}`,style:o,children:l})}function Ct({tabs:e,active:t,onChange:n,onClose:s,permanentTabs:o,className:i,toolbar:l,multiline:a,orientation:u="horizontal",style:h}){const p=d.useRef(null),[x,c]=d.useState(!1),[f,v]=d.useState(!1),b=u==="verticalLeft"||u==="verticalRight",w=d.useRef(!1),k=d.useRef(0),m=d.useRef(0),j=d.useRef(!1);d.useEffect(()=>{const y=()=>{if(p.current)if(b){const{scrollTop:I,scrollHeight:C,clientHeight:z}=p.current;c(I>1),v(I<C-z-1)}else{const{scrollLeft:I,scrollWidth:C,clientWidth:z}=p.current;c(I>1),v(I<C-z-1)}},N=p.current;if(N)return y(),N.addEventListener("scroll",y),window.addEventListener("resize",y),()=>{N.removeEventListener("scroll",y),window.removeEventListener("resize",y)}},[e,b]);const g=y=>{p.current&&(w.current=!0,j.current=!1,k.current=b?y.clientY:y.clientX,m.current=b?p.current.scrollTop:p.current.scrollLeft,p.current.style.cursor="grabbing",p.current.style.userSelect="none")},S=y=>{if(!w.current||!p.current)return;const N=b?y.clientY:y.clientX,I=k.current-N;Math.abs(I)>3&&(j.current=!0),b?p.current.scrollTop=m.current+I:p.current.scrollLeft=m.current+I},E=()=>{p.current&&(w.current=!1,p.current.style.cursor="",p.current.style.userSelect="")},A=()=>{E()};d.useEffect(()=>{const y=p.current;if(!y||b)return;const N=I=>{I.deltaY!==0&&(I.preventDefault(),y.scrollLeft+=I.deltaY*.3)};return y.addEventListener("wheel",N,{passive:!1}),()=>{y.removeEventListener("wheel",N)}},[b]);const $=y=>{j.current||n(y)};return r.jsxs("div",{className:`nc-tab-container ${b?`nc-vertical nc-${u}`:""} ${i||""}`,style:h,children:[r.jsxs("div",{className:"nc-tab-scroll-wrapper",children:[x&&r.jsx("div",{className:`nc-tab-scroll-indicator ${b?"nc-top":"nc-left"}`,children:b?r.jsx(Nt,{size:16}):r.jsx(O.ChevronLeftIcon,{size:16})}),r.jsx("div",{ref:p,className:`nc-tab-scroll ${a?"nc-multiline":""}`,onMouseDown:g,onMouseMove:S,onMouseUp:E,onMouseLeave:A,style:{cursor:"grab"},children:e.map(y=>{const N=typeof y=="string"?y:y.id,I=typeof y=="string"?y:y.label,C=s&&!(o!=null&&o.includes(N));return r.jsxs("div",{className:`nc-tab-item ${t===N?"nc-active":""} ${C?"nc-closable":""}`,onClick:()=>$(N),role:"button",tabIndex:0,onKeyDown:z=>{(z.key==="Enter"||z.key===" ")&&n(N)},children:[r.jsx("span",{className:"nc-tab-label",children:b?I:typeof I=="string"?I.toUpperCase():I}),C&&r.jsx("span",{className:"nc-tab-close",role:"button",tabIndex:0,"aria-label":`Close ${typeof I=="string"?I:N}`,onClick:z=>{z.stopPropagation(),s(N)},onKeyDown:z=>{(z.key==="Enter"||z.key===" ")&&(z.stopPropagation(),s(N))},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},N)})}),f&&r.jsx("div",{className:`nc-tab-scroll-indicator ${b?"nc-bottom":"nc-right"}`,children:b?r.jsx(O.ChevronDownIcon,{size:16}):r.jsx(O.ChevronRightIcon,{size:16})})]}),l&&r.jsx("div",{className:"nc-tab-toolbar",children:l})]})}function At({checked:e,onChange:t,disabled:n,label:s}){return r.jsxs("label",{className:"nc-row",style:{gap:10,alignItems:"center",cursor:n?"not-allowed":"pointer"},children:[s&&r.jsx("span",{className:"nc-label",children:s}),r.jsx("span",{role:"switch","aria-checked":e,tabIndex:0,onKeyDown:o=>{n||(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t(!e))},onClick:()=>!n&&t(!e),style:{position:"relative",width:56,height:30,borderRadius:18,padding:4,display:"inline-flex",alignItems:"center",justifyContent:"flex-start",border:`2px solid ${e?"var(--nc-primary)":"var(--nc-button-border)"}`,background:e?"rgba(99,102,241,0.08)":"transparent",transition:"border-color 160ms, background 160ms"},children:r.jsx("span",{style:{width:22,height:22,borderRadius:12,background:e?"var(--nc-text)":"var(--nc-muted)",transform:`translateX(${e?24:0}px)`,transition:"transform 160ms, background 160ms",boxShadow:e?"0 2px 6px rgba(99,102,241,0.28)":"0 1px 2px rgba(0,0,0,0.08)",border:"none"}})})]})}const Re=["var(--nc-csv-col-0)","var(--nc-csv-col-1)","var(--nc-csv-col-2)","var(--nc-csv-col-3)","var(--nc-csv-col-4)","var(--nc-csv-col-5)","var(--nc-csv-col-6)","var(--nc-csv-col-7)","var(--nc-csv-col-8)","var(--nc-csv-col-9)"];function Rt(e,t){const s=e.slice(0,t).split(`
|
|
1
|
+
"use strict";var Ue=Object.defineProperty;var Xe=(e,t,n)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var V=(e,t,n)=>Xe(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),d=require("react"),ce=require("react-dom"),q=require("react-i18next"),O=require("./GeneratedIcons-CGjL38ny.cjs"),Je=require("i18next"),Qe=require("./clsx-C11secjj.cjs");function me({size:e="default",color:t,overlay:n=!1,className:s=""}){const o=r.jsx("svg",{className:`nc-activity-indicator nc-${e} ${s}`,viewBox:"0 0 50 50",style:t?{color:t}:void 0,children:r.jsx("circle",{className:"nc-activity-indicator-circle",cx:"25",cy:"25",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round"})});return n?r.jsx("div",{className:"nc-activity-indicator-overlay",children:o}):o}function H({variant:e="default",block:t,size:n="default",className:s,disabled:o,textSelectable:i,loading:l,onClick:a,children:u,...f}){const h=["nc-button",e!=="default"?`nc-${e}`:"",t?"nc-block":"",n==="small"?"nc-small":"",n==="large"?"nc-large":"",o||l?"nc-disabled":"",i?"nc-text-selectable":"",l?"nc-loading":"",s??""].filter(Boolean).join(" "),g=c=>{if(!l){if(i){const p=window.getSelection();if(p&&p.toString().length>0)return}a==null||a(c)}};return r.jsxs("button",{className:h,disabled:o||l,onClick:g,...f,children:[l&&r.jsx(me,{size:"small",className:"nc-button-spinner",color:e!=="default"&&e!=="ghost"?"white":void 0}),u]})}function Ze({code:e,text:t,type:n,button:s,onAction:o}){return r.jsxs("div",{className:`nc-alert nc-${n}`,children:[r.jsxs("span",{className:`nc-alert-message nc-${n}`,children:[r.jsx("span",{className:"nc-alert-code",children:e}),t]}),s&&r.jsx("span",{className:"nc-alert-action",children:r.jsx(H,{size:"small",variant:s.variant??(n==="error"?"danger":"warning"),onClick:o,children:s.text})})]})}function et({percentage:e=.5,status:t="discharging",darkMode:n=!1,colored:s=!1}){const o=Math.max(0,Math.min(1,Number(e)||0));let i;s?o<.1?i="var(--nc-danger)":o<.2?i="var(--nc-warning)":i="var(--nc-success)":i=n?"#ffffff":"#000000";const l=n?"rgba(255, 255, 255, 0.5)":"rgba(0, 0, 0, 0.2)",a=24,u=14,f=2,h=0,g=12,c=0,p=0,w=0,b=a,v=u,k=v-c*2,m=b-c*2,j=Math.max(1,Math.min(4,v/4)),x=o===0?0:.05+o*.95,S=a+f+g,M=20,A=.65,$=Math.max(u,M*A),y=a+f+1,E=(u-M*A)/2;return r.jsxs("svg",{className:"nc-battery",width:S,height:$,viewBox:`0 0 ${S} ${$}`,role:"img","aria-label":`Battery ${o===0?"-":Math.round(o*100)+"%"} ${t}`,children:[r.jsxs("defs",{children:[r.jsx("mask",{id:`nc-battery-fill-mask-${o}`,children:r.jsx("rect",{x:"0",y:"0",width:m*x,height:k,fill:"white"})}),r.jsxs("mask",{id:`nc-battery-text-mask-${o}`,children:[r.jsx("rect",{x:"0",y:"0",width:S,height:$,fill:"white"}),r.jsx("text",{x:p+b/2,y:u-3,fontSize:11,fontWeight:"bold",fill:"black",textAnchor:"middle",children:o===0?"-":Math.round(o*100)})]})]}),r.jsxs("g",{mask:`url(#nc-battery-text-mask-${o})`,children:[r.jsx("rect",{x:p,y:w,rx:j,ry:j,width:b,height:v,fill:l}),r.jsx("rect",{x:p+c,y:w+c,width:m,height:k,fill:i,rx:j,ry:j,mask:`url(#nc-battery-fill-mask-${o})`}),r.jsx("rect",{x:a+h,y:u*.26,width:f,height:u*.48,rx:.8,ry:.8,fill:o===1?i:l}),t==="charging"?r.jsx("g",{transform:`translate(${y}, ${E}) scale(${A})`,fill:i,children:r.jsx("path",{d:"M10 0 L2 11 H8 L5 20 L14 8 H8 L10 0 Z"})}):null]})]})}function tt({value:e,onChange:t,options:n,disabled:s,labels:o,size:i="default"}){return r.jsx("div",{className:`nc-button-group ${i==="small"?"nc-small":""}`,children:n.map((l,a)=>r.jsx("button",{className:`nc-button-group-item ${e===l?"nc-active":""} ${a<n.length-1?"nc-has-border":""}`,onClick:()=>!s&&t(l),disabled:s,children:o&&o[l]?o[l]:l},l))})}function nt({size:e}){return r.jsx("svg",{className:`nc-checkbox-icon ${e==="small"?"nc-small":""}`,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("path",{d:"M2 6L5 9L10 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function rt({checked:e,onChange:t,disabled:n,label:s,size:o="default",labelColor:i,style:l,className:a=""}){const u=o==="small";return r.jsxs("label",{className:`nc-checkbox-label ${u?"nc-small":""} ${n?"nc-disabled":""} ${a}`.trim(),style:l,onClick:f=>{n||(f.preventDefault(),t(!e))},children:[r.jsx("span",{role:"checkbox","aria-checked":e,tabIndex:0,className:`nc-checkbox-box ${u?"nc-small":""} ${e?"nc-checked":""}`,onKeyDown:f=>{n||(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),t(!e))},children:e&&r.jsx(nt,{size:o})}),s&&r.jsx("span",{className:"nc-checkbox-text",style:i?{color:i}:void 0,children:s})]})}function st({option:e,onChange:t,selected:n,highlighted:s,small:o}){const i=d.useRef(null),{t:l}=q.useTranslation();return d.useEffect(()=>{s&&i.current&&i.current.scrollIntoView({block:"nearest"})},[s]),r.jsxs("div",{ref:i,className:`nc-combo-dropdown-option ${o?"nc-small":""} ${s?"nc-highlighted":""}`,role:"option",onMouseDown:()=>t(e.value),"aria-selected":n,style:{cursor:"pointer",background:s?"rgba(59,130,246,0.18)":n?"rgba(59,130,246,0.12)":void 0},children:[e.label,e.default&&r.jsxs("span",{style:{fontSize:"0.85em",color:"var(--nc-text-weak)",marginLeft:6},children:["(",l("common.default"),")"]})]})}function ot({isOpen:e,options:t,onSelect:n,selectedValue:s,placement:o="bottom",anchorRef:i,small:l,highlightedIndex:a=-1}){const[u,f]=d.useState({top:0,left:0,width:0}),[h,g]=d.useState(o),{t:c}=q.useTranslation();if(d.useEffect(()=>{if(e&&i.current){const w=i.current.getBoundingClientRect();let b=o;if(o==="bottom"){const v=window.innerHeight-w.bottom,k=w.top;v<320&&k>v&&(b="top")}g(b),f({top:b==="top"?w.top-4:w.bottom+4,left:w.left,width:w.width})}},[e,i,o]),!e)return null;const p=r.jsx("div",{className:"nc-combo-dropdown",style:{position:"fixed",top:h==="top"?void 0:u.top,bottom:h==="top"?window.innerHeight-u.top:void 0,left:u.left,width:u.width,zIndex:1e3,maxHeight:300,overflowY:"auto"},children:t.length===0?r.jsx("div",{className:`nc-combo-dropdown-option nc-no-results ${l?"nc-small":""}`,children:c("common.noResults")}):t.map((w,b)=>r.jsx(st,{option:w,onChange:n,selected:w.value===s,highlighted:b===a,small:l},w.value))});return ce.createPortal(p,document.body)}function it({onClick:e,small:t}){return r.jsx("button",{className:`nc-button nc-ghost nc-combo-button nc-combo-clear ${t?"nc-small":""}`,onClick:e,onMouseDown:n=>n.stopPropagation(),"aria-label":"Clear selection",children:"✕"})}function ct({open:e,onClick:t,small:n}){return r.jsx("button",{className:`nc-button nc-ghost nc-combo-button nc-combo-toggle ${n?"nc-small":""} ${e?"nc-open":""}`,onClick:t,onMouseDown:s=>s.stopPropagation(),"aria-label":e?"Close":"Open",children:"▾"})}function at({value:e,onChange:t,placeholder:n="Select…",options:s,disabled:o,label:i,clearable:l=!0,allowTyping:a=!1,placement:u="bottom",size:f="default",style:h,className:g}){const[c,p]=d.useState(!1),[w,b]=d.useState(""),[v,k]=d.useState(-1),m=d.useRef(null),j=d.useRef(null),x=f==="small",{t:S}=q.useTranslation(),M=d.useMemo(()=>{const I=w.toLowerCase();return a?s.filter(T=>T.label.toLowerCase().includes(I)):s},[s,w,a]);d.useEffect(()=>{c&&k(-1)},[c,M]),d.useEffect(()=>{if(!l&&!e&&s.length>0&&t){const I=s.find(T=>T.default)||s[0];t(I.value)}},[l,e,s,t]),d.useEffect(()=>{function I(T){var L;T.target instanceof Node&&m.current&&((L=m.current.parentElement)!=null&&L.contains(T.target)||p(!1))}return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[]);const A=s.find(I=>I.value===e),$=A&&l,y=!o&&!$,E=!(c&&a)&&!!A,N=(I,T=!1)=>{var L;t==null||t(I),p(!1),b(""),T&&((L=m.current)==null||L.blur())},C=()=>{t==null||t(void 0),b(""),p(!1)},P=I=>{if(!c){(I.key==="ArrowDown"||I.key==="ArrowUp")&&(p(!0),I.preventDefault());return}switch(I.key){case"ArrowDown":I.preventDefault(),k(T=>{const L=T+1;return L>=M.length?0:L});break;case"ArrowUp":I.preventDefault(),k(T=>{const L=T-1;return L<0?M.length-1:L});break;case"Enter":I.preventDefault(),v>=0&&v<M.length&&N(M[v].value,!0);break;case"Escape":I.preventDefault(),p(!1),b("");break}};return r.jsxs("div",{className:`nc-combo-container ${g||""}`.trim(),style:{position:"relative",...h},children:[i&&r.jsx("span",{className:`nc-label ${x?"nc-small":""}`,children:i}),r.jsxs("div",{ref:j,style:{position:"relative",display:"flex",alignItems:"center"},onMouseDown:I=>{o||a&&I.target===m.current||(p(T=>(!T&&a&&A&&b(A.label),!T)),a&&!c&&setTimeout(()=>{var T,L;(T=m.current)==null||T.focus(),(L=m.current)==null||L.select()},0))},children:[r.jsx("input",{ref:m,className:`nc-input ${x?"nc-small":""}`,placeholder:n,onFocus:()=>{var I;!o&&a&&(p(!0),A&&(b(A.label),setTimeout(()=>{var T;return(T=m.current)==null?void 0:T.select()},0))),a||(I=m.current)==null||I.blur()},onChange:I=>a&&b(I.target.value),onKeyDown:P,value:c&&a?w:(A==null?void 0:A.label)||"",readOnly:o||!a,style:{width:"100%",paddingRight:y||$?x?32:44:12,caretColor:a?void 0:"transparent",cursor:a?void 0:"pointer",userSelect:a?void 0:"none",color:E?"transparent":"var(--nc-text)"}}),E&&r.jsxs("div",{"aria-hidden":!0,style:{position:"absolute",left:x?8:12,right:y||$?x?12:24:x?8:12,top:"50%",transform:"translateY(-50%)",pointerEvents:"none",display:"flex",alignItems:"center",gap:6,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[r.jsx("span",{className:`nc-combo-overlay-text ${x?"nc-small":""}`,children:A==null?void 0:A.label}),(A==null?void 0:A.default)&&r.jsxs("span",{className:`nc-combo-overlay-default ${x?"nc-small":""}`,children:["(",S("common.default"),")"]})]}),$&&r.jsx(it,{onClick:C,small:x}),y&&r.jsx(ct,{open:c,onClick:()=>p(I=>!I),small:x})]}),r.jsx(ot,{isOpen:c,options:M,onSelect:N,selectedValue:e,placement:u,anchorRef:j,small:x,highlightedIndex:v})]})}function lt({onClick:e,loading:t=!1,disabled:n=!1,size:s="default",title:o,"aria-label":i}){const l=s==="small"?14:s==="large"?20:18,a=t?"Refreshing...":"Refresh",u=t?"Refreshing":"Refresh";return r.jsx("button",{className:"nc-icon-button",onClick:e,disabled:n||t,title:o??a,"aria-label":i??u,"data-size":s,children:r.jsx(O.RefreshIcon,{size:l,className:t?"nc-spinning":""})})}function ge({onClick:e,disabled:t=!1,size:n="default",title:s="Close","aria-label":o="Close"}){const i=n==="small"?14:n==="large"?20:18;return r.jsx("button",{className:"nc-icon-button nc-icon-button-close",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":n,children:r.jsx(O.CloseIcon,{size:i})})}function dt({onClick:e,disabled:t=!1,size:n="default",title:s="Edit","aria-label":o="Edit"}){const i=n==="small"?14:n==="large"?20:18;return r.jsx("button",{className:"nc-icon-button nc-icon-button-edit",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":n,children:r.jsx(O.EditIcon,{size:i})})}function ut({onClick:e,disabled:t=!1,size:n="default",title:s="Delete","aria-label":o="Delete"}){const i=n==="small"?14:n==="large"?20:18;return r.jsx("button",{className:"nc-icon-button nc-icon-button-trash",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":n,children:r.jsx(O.TrashIcon,{size:i})})}function pt({onClick:e,disabled:t=!1,children:n,title:s,"aria-label":o,size:i="default"}){return r.jsx("button",{className:"nc-hyperlink",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":i,children:n})}function ft({open:e,onClose:t,options:n,anchorRef:s,anchor:o,preferredDirection:i="down"}){const l=d.useRef(null),[a,u]=d.useState({top:0,left:0}),f=o||(s==null?void 0:s.current);if(d.useEffect(()=>{if(!e||!f||!l.current)return;const c=f.getBoundingClientRect(),p=l.current.getBoundingClientRect(),w=window.innerHeight,b=window.innerWidth,v=c.bottom+8,k=v+p.height<=w-8;let m=i;(!k&&i==="down"||i==="up"&&k)&&(m="up");let j;m==="down"?j=v:j=c.top-p.height-8;let x=c.left;x+p.width>b-8&&(x=c.right-p.width),u({top:Math.max(8,j),left:Math.max(8,x)})},[e,f,i]),d.useEffect(()=>{if(!e)return;const c=w=>{l.current&&!l.current.contains(w.target)&&f&&!f.contains(w.target)&&t()},p=w=>{w.key==="Escape"&&t()};return document.addEventListener("mousedown",c),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",p)}},[e,t,f]),!e)return null;const h=c=>{c.type!=="separator"&&!c.disabled&&c.onClick&&(c.onClick(),t())},g=n.some(c=>c.icon);return ce.createPortal(r.jsx("div",{ref:l,className:"nc-context-menu",style:{position:"fixed",top:`${a.top}px`,left:`${a.left}px`,zIndex:1e4},role:"menu",children:n.map(c=>{if(c.type==="separator")return r.jsx("div",{className:"nc-context-menu-separator",role:"separator"},c.id);const p=["nc-context-menu-item",c.variant&&c.variant!=="default"?`nc-${c.variant}`:"",c.disabled?"nc-disabled":"",g&&!c.icon?"nc-indented":""].filter(Boolean).join(" ");return r.jsxs("button",{className:p,onClick:()=>h(c),disabled:c.disabled,role:"menuitem",children:[c.icon&&r.jsx("span",{className:"nc-context-menu-icon",children:c.icon}),r.jsx("span",{className:"nc-context-menu-label",children:c.label})]},c.id)})}),document.body)}const Te=d.createContext(null);function Pe(){const e=d.useContext(Te);if(!e)throw new Error("useDialog must be used inside a Dialog component");return e}function U({children:e,onClick:t,...n}){const{close:s}=Pe(),{t:o}=q.useTranslation(),i=l=>{t==null||t(l),s()};return r.jsx(H,{onClick:i,...n,children:e??o("common.close")})}function ht({open:e,onClose:t,title:n,children:s,style:o,footerType:i="ok-cancel",footer:l,onOk:a,onSave:u,onDelete:f,onCancel:h,onConnect:g,closeOnOverlay:c=!0,primaryDisabled:p=!1,fullScreen:w=!1,hideTitleBar:b=!1,className:v="",onContentHeightChange:k}){const m=d.useRef(null),j=d.useRef(null),{t:x}=q.useTranslation(),S={close:t},M=y=>{c&&y.target===y.currentTarget&&t()};if(d.useEffect(()=>{e&&m.current&&m.current.focus()},[e]),d.useEffect(()=>{if(!k||!j.current)return;const y=new ResizeObserver(E=>{for(const N of E){const C=N.contentRect.height;k(C)}});return y.observe(j.current),()=>{y.disconnect()}},[k]),!e)return null;const A=()=>{switch(i){case"ok":return r.jsx("div",{className:"nc-dialog-footer",children:r.jsx(H,{variant:"primary",onClick:a??t,disabled:p,children:x("common.ok")})});case"ok-cancel":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"primary",onClick:a??t,disabled:p,children:x("common.ok")}),r.jsx(U,{onClick:h,children:x("common.cancel")})]});case"save-cancel":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"primary",onClick:u,disabled:p,children:x("common.save")}),r.jsx(U,{onClick:h,children:x("common.cancel")})]});case"delete-cancel":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"danger",onClick:f,disabled:p,children:x("common.delete")}),r.jsx(U,{onClick:h,children:x("common.cancel")})]});case"connect":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"primary",onClick:g,disabled:p,children:x("common.connect")}),r.jsx(U,{onClick:h,children:x("common.cancel")})]});case"close":return r.jsx("div",{className:"nc-dialog-footer",children:r.jsx(U,{variant:"primary"})});case"gotit":return r.jsx("div",{className:"nc-dialog-footer",children:r.jsx(U,{variant:"primary",children:x("common.gotit")})});case"custom":return r.jsx("div",{className:"nc-dialog-footer",children:l});case"none":return null;default:return null}},$=r.jsx(Te.Provider,{value:S,children:r.jsx("div",{className:`nc-dialog-overlay${w?" nc-fullscreen":""}`,onClick:M,children:r.jsxs("div",{ref:m,className:`nc-dialog-container ${v}`,style:o,tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":b?void 0:"nc-dialog-title",children:[!b&&r.jsxs("div",{className:"nc-dialog-header",children:[r.jsx("h3",{id:"nc-dialog-title",className:"nc-dialog-title",children:n}),r.jsx(ge,{onClick:t,"aria-label":"Close dialog"})]}),r.jsx("div",{ref:j,className:"nc-dialog-content",children:s}),A()]})})});return w?ce.createPortal($,document.body):$}function mt({onClick:e,size:t="default",rightOffset:n=4}){const s=t==="small"?28:34;return r.jsx("button",{className:"nc-button nc-ghost",onClick:e,onMouseDown:o=>{o.preventDefault(),o.stopPropagation()},tabIndex:-1,"aria-label":"Clear input",style:{position:"absolute",right:n,padding:0,minHeight:0,height:s,width:s,border:"none",display:"flex",alignItems:"center",justifyContent:"center",fontSize:t==="small"?"12px":"14px"},children:"✕"})}function gt({visible:e,onClick:t,size:n="default"}){const s=n==="small"?28:34,o=n==="small"?16:18;return r.jsx("button",{className:"nc-button nc-ghost",onClick:t,onMouseDown:i=>{i.preventDefault(),i.stopPropagation()},tabIndex:-1,"aria-label":e?"Hide password":"Show password",style:{position:"absolute",right:4,padding:0,minHeight:0,height:s,width:s,border:"none",display:"flex",alignItems:"center",justifyContent:"center"},children:e?r.jsx(O.EyeHiddenIcon,{size:o}):r.jsx(O.ViewIcon,{size:o})})}function bt({value:e,defaultValue:t="",onChange:n,onEnter:s,onClear:o,placeholder:i,disabled:l,label:a,clearable:u=!0,type:f="text",className:h="",size:g="default",style:c,showPasswordToggle:p=!1,multiline:w=!1,rows:b=3,validator:v,showErrorMessage:k=!0}){const m=d.useRef(null),j=d.useRef(null),[x,S]=d.useState(!1),[M,A]=d.useState(!1),$=e!==void 0,[y,E]=d.useState(t),N=$?e:y,C=v?v(N):null,P=!!C,I=f==="password",T=I&&p&&!l&&!w,L=u&&N&&!l&&M,Q=g==="small"?32:44;let G=12;L&&T?G=Q*2:(L||T)&&(G=Q);const _=()=>{var Z,re;$||E(""),n==null||n(""),o==null||o(),w?(Z=j.current)==null||Z.focus():(re=m.current)==null||re.focus()},ne=Z=>{Z.key==="Enter"&&!w&&(s==null||s())},B=Z=>{const re=Z.target.value;$||E(re),n==null||n(re)},ke=()=>{A(!0)},Ne=()=>{A(!1)},Se=`nc-input ${g==="small"?"nc-small ":""} ${P?"nc-error ":""}${h}`;return r.jsxs("div",{className:"nc-col",style:{position:"relative",flex:1,...c},children:[a&&r.jsx("span",{className:"nc-label",children:a}),r.jsxs("div",{style:{position:"relative",display:"flex",alignItems:w?"flex-start":"center"},children:[w?r.jsx("textarea",{ref:j,className:Se,placeholder:i,value:N,onChange:B,onKeyDown:ne,onFocus:ke,onBlur:Ne,disabled:l,rows:b,style:{width:"100%",paddingRight:G}}):r.jsx("input",{ref:m,type:I&&x?"text":f,className:Se,placeholder:i,value:N,onChange:B,onKeyDown:ne,onFocus:ke,onBlur:Ne,disabled:l,style:{width:"100%",paddingRight:G}}),L&&r.jsx(mt,{onClick:_,size:g,rightOffset:T?Q+4:4}),T&&r.jsx(gt,{visible:x,onClick:()=>S(!x),size:g})]}),P&&k&&r.jsx("span",{className:"nc-error-message",children:C})]})}function xt({children:e,onClick:t,showBorder:n=!0,selectable:s=!1,style:o}){const[i,l]=d.useState(!1),a=u=>{if(t){if(s){const f=window.getSelection();if(f&&f.toString().length>0)return}t(u)}};return r.jsx("div",{onClick:a,onMouseDown:()=>t&&l(!0),onMouseUp:()=>l(!1),onMouseLeave:()=>l(!1),style:{cursor:t?"pointer":"default",userSelect:s?"text":void 0,borderBottom:n?void 0:"none",...o},className:`nc-list-group-item ${t?"nc-list-group-item-clickable":""} ${i?"nc-list-group-item-active":""}`,children:r.jsx("div",{style:{flex:1},children:e})})}function vt({title:e,titleTools:t,children:n,style:s}){return r.jsxs("div",{className:"nc-list-group",style:s,children:[(e||t)&&r.jsxs("div",{className:"nc-list-group-title",children:[r.jsx("div",{children:e}),t&&r.jsx("div",{className:"nc-list-group-title-tools",children:t})]}),r.jsx("div",{className:"nc-list-group-content",children:n})]})}function wt({values:e,onChange:t,options:n,placeholder:s="Select…",label:o}){const[i,l]=d.useState(!1),[a,u]=d.useState(""),f=d.useRef(null),h=d.useMemo(()=>n.filter(c=>c.label.toLowerCase().includes(a.toLowerCase())),[n,a]);d.useEffect(()=>{function c(p){!(p.target instanceof Node)||!f.current||f.current.contains(p.target)||l(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[]);const g=c=>{e.includes(c)?t(e.filter(p=>p!==c)):t([...e,c])};return r.jsxs("div",{ref:f,className:"nc-col",style:{position:"relative"},children:[o&&r.jsx("span",{className:"nc-label",children:o}),r.jsxs("div",{className:"nc-row",style:{flexWrap:"wrap",gap:6,minHeight:42,alignItems:"center",border:"1px solid var(--nc-button-border)",borderRadius:8,background:"var(--nc-button-bg)",padding:"4px 8px"},children:[e.length===0&&r.jsx("span",{className:"nc-label",children:s}),e.map(c=>{const p=n.find(w=>w.value===c);return p?r.jsxs("span",{style:{padding:"4px 8px",borderRadius:6,display:"inline-flex",alignItems:"center",gap:4,background:"var(--nc-button-bg)",border:"1px solid var(--nc-button-border)"},children:[p.label,r.jsx("button",{className:"nc-button nc-ghost",style:{padding:0,minHeight:0,height:20,width:20,display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none"},onClick:()=>g(c),"aria-label":`Remove ${p.label}`,children:"✕"})]},c):null}),r.jsx("input",{className:"nc-input",value:a,onChange:c=>u(c.target.value),onFocus:()=>l(!0),style:{minWidth:50,border:"none",background:"transparent",padding:4,minHeight:32,flex:1}})]}),i&&r.jsxs("div",{className:"nc-combo-dropdown",style:{position:"absolute",top:"100%",left:0,right:0,zIndex:10,marginTop:4,boxShadow:"0 4px 12px var(--nc-shadow)"},children:[h.map(c=>{const p=e.includes(c.value);return r.jsxs("div",{className:"nc-section nc-row",style:{justifyContent:"space-between",cursor:"pointer",padding:12},onMouseDown:()=>g(c.value),children:[r.jsx("span",{children:c.label}),r.jsx("span",{children:p?"✔️":""})]},c.value)}),h.length===0&&r.jsx("div",{className:"nc-section nc-label",children:"No results"})]})]})}function ae(e){if(!e)return null;const t=/^\d{2}-\d{1,2}$/,n=/^\d{4}-\d{1,2}$/;if(!t.test(e)&&!n.test(e))return"Format must be YY-M(M) or YYYY-M(M)";const s=e.split("-"),o=parseInt(s[1],10);return o<1||o>12?"Month must be between 1 and 12":null}function ie(e){if(!e)return"";const t=e.split("-");if(t.length!==2)return e;let n=t[0];const s=t[1].padStart(2,"0");if(n.length===2){const o=parseInt(n,10);n=String(o<50?2e3+o:1900+o)}return`${n}-${s}`}function Ce(e){if(!e)return"";const t=ie(e);if(!/^\d{4}-\d{2}$/.test(t))return e;const[n,s]=t.split("-");return`${n}/${s}`}function Ae(){const e=new Date,t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0");return`${t}-${n}`}function yt({startMonth:e,endMonth:t,onChange:n,label:s,className:o="",disabled:i=!1,size:l="default"}){const[a,u]=d.useState(!1),[f,h]=d.useState(""),[g,c]=d.useState(""),[p,w]=d.useState({top:0,left:0,width:0,right:void 0}),b=d.useRef(null),v=d.useRef(null);d.useEffect(()=>{if(a&&b.current){const N=b.current.getBoundingClientRect(),P=Math.max(N.width,400);window.innerWidth-N.left<P&&N.right>=P?w({top:N.bottom+4,left:0,right:window.innerWidth-N.right,width:P}):w({top:N.bottom+4,left:N.left,right:void 0,width:P})}},[a]),d.useEffect(()=>{if(!a)return;const N=C=>{b.current&&!b.current.contains(C.target)&&v.current&&!v.current.contains(C.target)&&u(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[a]);const k=()=>{h(e||Ae()),c(t||Ae()),u(!0)},m=()=>{u(!1)},j=()=>{const N=ae(f),C=ae(g);if(N||C)return;const P=ie(f),I=ie(g);P&&I&&(n==null||n(P,I)),u(!1)},x=e&&t?`${Ce(e)} - ${Ce(t)}`:"Select month range",S=ae(f),M=ae(g),A=ie(f),$=ie(g),y=A&&$&&A>$,E=a?ce.createPortal(r.jsx("div",{ref:v,className:"nc-month-range-picker-popup",style:{position:"fixed",top:p.top,...p.right!==void 0?{right:p.right}:{left:p.left},width:p.width,zIndex:1e3},children:r.jsxs("div",{className:"nc-month-range-picker-content",children:[r.jsxs("div",{className:"nc-month-range-picker-row",children:[r.jsxs("div",{className:"nc-month-range-picker-column",children:[r.jsx("label",{className:"nc-label",children:"Start Month"}),r.jsx("input",{type:"text",className:`nc-month-input ${S?"nc-error":""}`,value:f,onChange:N=>h(N.target.value),placeholder:"YY-M(M) or YYYY-M(M)"}),S&&r.jsx("div",{className:"nc-month-error-text",children:S})]}),r.jsxs("div",{className:"nc-month-range-picker-column",children:[r.jsx("label",{className:"nc-label",children:"End Month"}),r.jsx("input",{type:"text",className:`nc-month-input ${M?"nc-error":""}`,value:g,onChange:N=>c(N.target.value),placeholder:"YY-M(M) or YYYY-M(M)"}),M&&r.jsx("div",{className:"nc-month-error-text",children:M})]})]}),y&&!S&&!M&&r.jsx("div",{className:"nc-month-range-error",children:"End month must be after or equal to start month"}),r.jsxs("div",{className:"nc-month-range-picker-footer",children:[r.jsx(H,{variant:"primary",onClick:j,disabled:!f||!g||!!S||!!M||!!y,children:"Apply"}),r.jsx(H,{variant:"ghost",onClick:m,children:"Cancel"})]})]})}),document.body):null;return r.jsxs("div",{className:`nc-month-range-picker ${l==="small"?"nc-small ":""}${o}`,children:[s&&r.jsx("label",{className:`nc-label${l==="small"?" nc-small":""}`,children:s}),r.jsx("button",{ref:b,className:`nc-month-range-picker-input${l==="small"?" nc-small":""}`,onClick:k,disabled:i,children:x}),E]})}function jt({value:e,onChange:t,min:n,max:s,step:o=1,label:i,disabled:l,size:a="default"}){const u=a==="small",f=()=>{const c=e-o;n!==void 0&&c<n||t(parseFloat(c.toFixed(10)))},h=()=>{const c=e+o;s!==void 0&&c>s||t(parseFloat(c.toFixed(10)))},g=c=>{const p=parseFloat(c.target.value);isNaN(p)||n!==void 0&&p<n||s!==void 0&&p>s||t(p)};return r.jsxs("div",{className:`nc-col nc-number-input-col ${u?"nc-small":""}`,children:[i&&r.jsx("span",{className:`nc-label ${u?"nc-small":""}`,children:i}),r.jsxs("div",{className:`nc-number-input-container ${u?"nc-small":""}`,children:[r.jsx("input",{className:`nc-input nc-number-input ${u?"nc-small":""}`,type:"number",value:e,onChange:g,min:n,max:s,step:o,disabled:l}),r.jsx("button",{className:`nc-button nc-ghost nc-number-input-button ${u?"nc-small":""}`,onClick:f,disabled:l||n!==void 0&&e<=n,children:"−"}),r.jsx("button",{className:`nc-button nc-ghost nc-number-input-button ${u?"nc-small":""}`,onClick:h,disabled:l||s!==void 0&&e>=s,children:"+"})]})]})}function kt({value:e,onChange:t,min:n=0,max:s=100,step:o=1,label:i,disabled:l,showValue:a=!0,formatValue:u=h=>h.toString(),width:f=200}){const h=c=>{const p=parseFloat(c.target.value);t(p)},g=(e-n)/(s-n)*100;return r.jsxs("div",{className:"nc-col",style:{gap:6},children:[i&&r.jsx("span",{className:"nc-label",children:i}),r.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[r.jsx("input",{type:"range",className:"nc-slider",value:e,onChange:h,min:n,max:s,step:o,disabled:l,style:{width:f,"--nc-slider-percentage":`${g}%`}}),a&&r.jsx("span",{style:{color:"var(--nc-text)",fontFamily:"monospace",fontSize:14,minWidth:60,textAlign:"right"},children:u(e)})]})]})}const Nt=({size:e=24,className:t,style:n})=>r.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,style:n,children:r.jsx("polyline",{points:"18 15 12 9 6 15"})});function ze({children:e,className:t="",style:n}){return r.jsx("div",{className:`nc-tab-panel ${t}`,style:n,children:e})}function St({active:e,children:t,keepMounted:n=!1,className:s="",style:o}){const i=d.Children.toArray(t).filter(a=>d.isValidElement(a)&&(a.type===ze||a.type.displayName==="TabPanel"));if(n)return r.jsx("div",{className:`nc-tab-panels ${s}`,style:o,children:i.map(a=>{const u=a.props.tab===e;return r.jsx("div",{className:`nc-tab-panel-wrapper ${u?"nc-active":""}`,style:{display:u?void 0:"none"},"aria-hidden":!u,children:a},a.props.tab)})});const l=i.find(a=>a.props.tab===e);return r.jsx("div",{className:`nc-tab-panels ${s}`,style:o,children:l})}function Ct({tabs:e,active:t,onChange:n,onClose:s,permanentTabs:o,className:i,toolbar:l,multiline:a,orientation:u="horizontal",style:f}){const h=d.useRef(null),[g,c]=d.useState(!1),[p,w]=d.useState(!1),b=u==="verticalLeft"||u==="verticalRight",v=d.useRef(!1),k=d.useRef(0),m=d.useRef(0),j=d.useRef(!1);d.useEffect(()=>{const y=()=>{if(h.current)if(b){const{scrollTop:N,scrollHeight:C,clientHeight:P}=h.current;c(N>1),w(N<C-P-1)}else{const{scrollLeft:N,scrollWidth:C,clientWidth:P}=h.current;c(N>1),w(N<C-P-1)}},E=h.current;if(E)return y(),E.addEventListener("scroll",y),window.addEventListener("resize",y),()=>{E.removeEventListener("scroll",y),window.removeEventListener("resize",y)}},[e,b]);const x=y=>{h.current&&(v.current=!0,j.current=!1,k.current=b?y.clientY:y.clientX,m.current=b?h.current.scrollTop:h.current.scrollLeft,h.current.style.cursor="grabbing",h.current.style.userSelect="none")},S=y=>{if(!v.current||!h.current)return;const E=b?y.clientY:y.clientX,N=k.current-E;Math.abs(N)>3&&(j.current=!0),b?h.current.scrollTop=m.current+N:h.current.scrollLeft=m.current+N},M=()=>{h.current&&(v.current=!1,h.current.style.cursor="",h.current.style.userSelect="")},A=()=>{M()};d.useEffect(()=>{const y=h.current;if(!y||b)return;const E=N=>{N.deltaY!==0&&(N.preventDefault(),y.scrollLeft+=N.deltaY*.3)};return y.addEventListener("wheel",E,{passive:!1}),()=>{y.removeEventListener("wheel",E)}},[b]);const $=y=>{j.current||n(y)};return r.jsxs("div",{className:`nc-tab-container ${b?`nc-vertical nc-${u}`:""} ${i||""}`,style:f,children:[r.jsxs("div",{className:"nc-tab-scroll-wrapper",children:[g&&r.jsx("div",{className:`nc-tab-scroll-indicator ${b?"nc-top":"nc-left"}`,children:b?r.jsx(Nt,{size:16}):r.jsx(O.ChevronLeftIcon,{size:16})}),r.jsx("div",{ref:h,className:`nc-tab-scroll ${a?"nc-multiline":""}`,onMouseDown:x,onMouseMove:S,onMouseUp:M,onMouseLeave:A,style:{cursor:"grab"},children:e.map(y=>{const E=typeof y=="string"?y:y.id,N=typeof y=="string"?y:y.label,C=s&&!(o!=null&&o.includes(E));return r.jsxs("div",{className:`nc-tab-item ${t===E?"nc-active":""} ${C?"nc-closable":""}`,onClick:()=>$(E),role:"button",tabIndex:0,onKeyDown:P=>{(P.key==="Enter"||P.key===" ")&&n(E)},children:[r.jsx("span",{className:"nc-tab-label",children:b?N:typeof N=="string"?N.toUpperCase():N}),C&&r.jsx("span",{className:"nc-tab-close",role:"button",tabIndex:0,"aria-label":`Close ${typeof N=="string"?N:E}`,onClick:P=>{P.stopPropagation(),s(E)},onKeyDown:P=>{(P.key==="Enter"||P.key===" ")&&(P.stopPropagation(),s(E))},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},E)})}),p&&r.jsx("div",{className:`nc-tab-scroll-indicator ${b?"nc-bottom":"nc-right"}`,children:b?r.jsx(O.ChevronDownIcon,{size:16}):r.jsx(O.ChevronRightIcon,{size:16})})]}),l&&r.jsx("div",{className:"nc-tab-toolbar",children:l})]})}function At({checked:e,onChange:t,disabled:n,label:s}){return r.jsxs("label",{className:"nc-row",style:{gap:10,alignItems:"center",cursor:n?"not-allowed":"pointer"},children:[s&&r.jsx("span",{className:"nc-label",children:s}),r.jsx("span",{role:"switch","aria-checked":e,tabIndex:0,onKeyDown:o=>{n||(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t(!e))},onClick:()=>!n&&t(!e),style:{position:"relative",width:56,height:30,borderRadius:18,padding:4,display:"inline-flex",alignItems:"center",justifyContent:"flex-start",border:`2px solid ${e?"var(--nc-primary)":"var(--nc-button-border)"}`,background:e?"rgba(99,102,241,0.08)":"transparent",transition:"border-color 160ms, background 160ms"},children:r.jsx("span",{style:{width:22,height:22,borderRadius:12,background:e?"var(--nc-text)":"var(--nc-muted)",transform:`translateX(${e?24:0}px)`,transition:"transform 160ms, background 160ms",boxShadow:e?"0 2px 6px rgba(99,102,241,0.28)":"0 1px 2px rgba(0,0,0,0.08)",border:"none"}})})]})}const Re=["var(--nc-csv-col-0)","var(--nc-csv-col-1)","var(--nc-csv-col-2)","var(--nc-csv-col-3)","var(--nc-csv-col-4)","var(--nc-csv-col-5)","var(--nc-csv-col-6)","var(--nc-csv-col-7)","var(--nc-csv-col-8)","var(--nc-csv-col-9)"];function Rt(e,t){const s=e.slice(0,t).split(`
|
|
2
2
|
`),o=s.length,l=s[o-1].split(" "),a=l.length,u=l[a-1].length+1;return{line:o,column:a,character:u,offset:t}}function It(e,t,n,s){const o=e.split(`
|
|
3
|
-
`),i=Math.max(1,Math.min(t,o.length));let l=0;for(let
|
|
4
|
-
`),s=Math.max(1,Math.min(t,n.length));let o=0;for(let i=0;i<s-1;i++)o+=n[i].length+1;return o}const Et=d.forwardRef(function({value:t,onChange:n,placeholder:s,className:o,style:i,showLineNumbers:l=!1,onCursorChange:a,highlightLine:u},
|
|
5
|
-
`).length,[t]),
|
|
6
|
-
`).map((
|
|
7
|
-
`]},S)}):null;return r.jsxs("div",{className:`nc-csv-textarea-container ${l?"nc-csv-with-gutter":""} ${o??""}`,style:i,children:[l&&w(),r.jsxs("div",{className:"nc-csv-textarea-editor",children:[r.jsx("div",{className:"nc-csv-textarea-backdrop",ref:x,children:r.jsx("pre",{className:"nc-csv-textarea-highlights",children:k(t)})}),r.jsx("textarea",{ref:p,className:"nc-csv-textarea-input",value:t,onChange:m=>{n(m.target.value),requestAnimationFrame(f)},onScroll:v,onSelect:f,onKeyUp:f,onClick:f,placeholder:s,spellCheck:!1,autoComplete:"off",autoCorrect:"off"})]})]})});let X={notifications:[]};const pe=new Set,Ie=new Map;function fe(){const e=X.notifications.slice();for(const t of Array.from(pe))try{t(e)}catch{}}function $t(e){pe.add(e);try{e(X.notifications.slice())}catch{}return()=>{pe.delete(e)}}function Tt(e){const t=`notification-${Date.now()}-${Math.random()}`,n={id:t,dismissible:!0,lastingTime:5e3,...e};return X.notifications=[n,...X.notifications],fe(),n.lastingTime&&n.lastingTime>0&&setTimeout(()=>{Le(t)},n.lastingTime),t}function Le(e){const t=X.notifications.find(s=>s.id===e);if(!t)return;t.isRemoving=!0,fe();const n=window.setTimeout(()=>{X.notifications=X.notifications.filter(s=>s.id!==e),fe(),Ie.delete(e)},300);Ie.set(e,n)}function Be({notification:e}){const{t}=q.useTranslation(),n=()=>{if(e.title)return e.title;switch(e.type){case"success":return t("common.success");case"danger":return t("common.error");case"warning":return t("common.warning");default:return t("common.info")}},s=()=>{Le(e.id)};return r.jsx("div",{className:`nc-notification nc-notification-${e.type||"info"}`,children:r.jsxs("div",{className:"nc-notification-content",children:[r.jsxs("div",{className:"nc-notification-body",style:{paddingRight:e.dismissible?"8px":"0"},children:[r.jsx("div",{className:"nc-notification-title",children:n()}),r.jsx("div",{className:"nc-notification-message",children:e.message})]}),e.dismissible&&r.jsx("button",{className:"nc-notification-dismiss",onClick:s,children:r.jsx(O.CloseIcon,{size:16})})]})})}function Pt(){const[e,t]=d.useState([]),[n,s]=d.useState(new Map),[o,i]=d.useState(new Set),l=d.useRef(null),a=d.useRef([]);return d.useEffect(()=>$t(h=>{const p=new Set(a.current.map(c=>c.id)),x=h.filter(c=>!p.has(c.id)).map(c=>c.id);x.length>0?(t(h),i(new Set(x)),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i(new Set)})})):t(h),a.current=h}),[]),d.useEffect(()=>{if(!l.current)return;const u=new Map;let h=0;const p=l.current.children;e.forEach((x,c)=>{if(u.set(x.id,h),p[c]){const f=p[c].offsetHeight;x.isRemoving||(h+=f+12)}}),s(u)},[e]),r.jsx("div",{style:{position:"fixed",top:"16px",left:"16px",zIndex:9999,pointerEvents:"none"},children:r.jsx("div",{ref:l,style:{pointerEvents:"auto",position:"relative"},children:e.map(u=>{const h=o.has(u.id),p=u.isRemoving,x=n.get(u.id)||0;return r.jsx("div",{style:{position:"absolute",top:0,left:0,transform:h?"translateY(-120px)":`translateY(${x}px)`,transition:p?"opacity 300ms ease-out":"transform 300ms ease-out, opacity 300ms ease-out",opacity:p?0:1,width:"100%"},children:r.jsx(Be,{notification:u})},u.id)})})})}const zt={show:e=>Tt(e)};function Lt(e){const t=Je.createInstance(),n={};for(const o in e)n[o]={translation:e[o]};const s=typeof document<"u"&&document.documentElement.lang||"en";return t.init({resources:n,lng:s,fallbackLng:"en",interpolation:{escapeValue:!1}}),typeof MutationObserver<"u"&&typeof document<"u"&&new MutationObserver(i=>{for(const l of i)if(l.type==="attributes"&&l.attributeName==="lang"){const a=document.documentElement.lang||"en";t.changeLanguage(a)}}).observe(document.documentElement,{attributes:!0}),t}class Bt{constructor(){V(this,"apps",new Map)}register(t){this.apps.has(t.id)&&console.warn(`App "${t.id}" is already registered. Overwriting.`),this.apps.set(t.id,{...t,width:t.width??400,padding:t.padding??0})}unregister(t){this.apps.delete(t)}get(t){return this.apps.get(t)}list(){return Array.from(this.apps.values())}has(t){return this.apps.has(t)}}const J=new Bt,Me="nc-ui-app-state";class Dt{constructor(){V(this,"state");V(this,"listeners",new Map);this.state=this.loadState()}loadState(){try{const t=localStorage.getItem(Me);if(t)return JSON.parse(t)}catch{}return{activeAppId:null}}saveState(){try{localStorage.setItem(Me,JSON.stringify(this.state))}catch{}}getActiveAppId(){return this.state.activeAppId}_setActiveAppId(t){this.state.activeAppId!==t&&(this.state.activeAppId=t,this.saveState(),this.notify("activeAppId",t))}subscribe(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>{var s;(s=this.listeners.get(t))==null||s.delete(n)}}notify(t,n){var s;(s=this.listeners.get(t))==null||s.forEach(o=>o(n))}}const W=new Dt;class Ht{constructor(){V(this,"apps",[]);V(this,"activeAppId",null);V(this,"listeners",new Set);V(this,"refReadyResolvers",new Map)}async launchApp(t,n){const{launchInBackground:s=!1}=n||{};if(!J.has(t))return console.error(`Cannot launch app "${t}": not registered`),null;const o=this.apps.find(l=>l.appId===t);if(o)return s||(this.setActiveApp(t),W._setActiveAppId(t)),o.ref?o:this.waitForRef(t);const i={appId:t,launchedAt:Date.now()};return this.apps.push(i),s||(this.activeAppId=t,W._setActiveAppId(t)),this.notify(),this.waitForRef(t)}waitForRef(t){return new Promise(n=>{const s=this.refReadyResolvers.get(t)||[];s.push(n),this.refReadyResolvers.set(t,s)})}setAppRef(t,n){const s=this.apps.find(i=>i.appId===t);if(!s){console.warn(`Cannot set ref for app "${t}": not running`);return}s.ref=n;const o=this.refReadyResolvers.get(t);o&&(o.forEach(i=>i(s)),this.refReadyResolvers.delete(t))}getApp(t){return this.apps.find(n=>n.appId===t)}closeApp(t){const n=this.apps.findIndex(o=>o.appId===t);if(n===-1)return;const s=this.apps[n];if(s.ref&&(s.ref=void 0),this.apps.splice(n,1),this.activeAppId===t){const o=window.innerWidth>=768;this.activeAppId=o&&this.apps.length>0?this.apps[this.apps.length-1].appId:null,W._setActiveAppId(this.activeAppId)}this.notify()}setActiveApp(t){if(t!==null&&!this.apps.find(n=>n.appId===t)){console.warn(`Cannot activate app "${t}": not running`);return}this.activeAppId!==t&&(this.activeAppId=t,this.notify(),W._setActiveAppId(t))}toggleApp(t){this.activeAppId===t?this.setActiveApp(null):this.launchApp(t)}getActiveAppId(){return this.activeAppId}getActiveApp(){return this.activeAppId?J.get(this.activeAppId)??null:null}getRunningApps(){return[...this.apps]}isRunning(t){return this.apps.some(n=>n.appId===t)}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){this.listeners.forEach(t=>t())}}const D=new Ht,be=d.createContext(null);function De(){const e=d.useContext(be);if(!e)throw new Error("useApp must be used inside an App");return e}function Wt({size:e=16}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M19 12H5"}),r.jsx("path",{d:"M12 19l-7-7 7-7"})]})}function He({title:e,onClose:t,onBack:n,toolbar:s,hideBackButton:o}){const i=n&&!o;return r.jsxs("div",{className:"nc-app-title-bar",children:[r.jsxs("div",{className:"nc-app-title-bar-left",children:[i&&r.jsx("button",{className:"nc-app-title-bar-back",onClick:n,title:"Back","aria-label":"Go back",children:r.jsx(Wt,{size:16})}),r.jsx("span",{className:"nc-app-title-bar-title",children:e})]}),r.jsxs("div",{className:"nc-app-title-bar-right",children:[s&&r.jsx("div",{className:"nc-app-title-bar-toolbar",children:s}),r.jsx(ge,{onClick:t,"aria-label":"Close application"})]})]})}class Ot extends d.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error(`Error loading app ${this.props.appId}:`,t,n)}render(){return this.state.hasError?r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",flex:1,flexDirection:"column",gap:"16px",padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:[r.jsx("div",{children:"Failed to load app"}),this.state.error&&r.jsx("div",{style:{fontSize:"12px",opacity:.7},children:this.state.error.message})]}):this.props.children}}function xe({appId:e,isActive:t,onClose:n}){const{t:s}=q.useTranslation(),o=J.get(e),[i,l]=d.useState(""),[a,u]=d.useState(null),[h,p]=d.useState(null),[x,c]=d.useState(!1),[f,v]=d.useState(!1);d.useEffect(()=>{o!=null&&o.titleKey&&l(s(o.titleKey))},[o,s]);const b=d.useCallback(y=>{l(y)},[]),w=d.useCallback(y=>{u(()=>y)},[]),k=d.useCallback(()=>{u(null)},[]),m=d.useCallback(y=>{p(y)},[]),j=d.useCallback(()=>{p(null)},[]),g=d.useCallback(y=>{c(y)},[]),S=d.useCallback(y=>{v(y)},[]),E=d.useMemo(()=>({setTitle:b,setBackHandler:w,clearBackHandler:k,setToolbar:m,clearToolbar:j,setHideBackButton:g,setHideTitleBar:S,close:n}),[b,w,k,m,j,g,S,n]);if(!o)return null;const A=o.component,$=!o.hideTitleBar&&!f;return r.jsxs("div",{style:{display:t?"flex":"none",flexDirection:"column",flex:1,minHeight:0},children:[$&&r.jsx(He,{title:i,onClose:n,onBack:a??void 0,toolbar:h,hideBackButton:x}),r.jsx("div",{className:$?"nc-app-content-wrapper":"",style:{padding:o.padding,flex:1,minHeight:0,display:"flex",flexDirection:"column",backgroundColor:"var(--nc-bg-secondary)",position:"relative"},children:r.jsx(be.Provider,{value:E,children:r.jsx(Ot,{appId:e,children:r.jsx(d.Suspense,{fallback:r.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",flex:1},children:r.jsx(me,{})}),children:r.jsx(A,{})})})})})]})}const le=768,de=1024,We={isMobile:!1,isTablet:!1,isDesktop:!0,width:typeof window<"u"?window.innerWidth:1024,height:typeof window<"u"?window.innerHeight:768},Oe=d.createContext(We);function Ft({children:e}){const[t,n]=d.useState(()=>{if(typeof window>"u")return We;const s=window.innerWidth,o=window.innerHeight;return{isMobile:s<le,isTablet:s>=le&&s<de,isDesktop:s>=de,width:s,height:o}});return d.useEffect(()=>{const s=()=>{const o=window.innerWidth,i=window.innerHeight;n({isMobile:o<le,isTablet:o>=le&&o<de,isDesktop:o>=de,width:o,height:i})};return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),r.jsx(Oe.Provider,{value:t,children:e})}function ve(){return d.useContext(Oe)}const we="-",Gt=e=>{const t=Yt(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:l=>{const a=l.split(we);return a[0]===""&&a.length!==1&&a.shift(),Fe(a,t)||Vt(l)},getConflictingClassGroupIds:(l,a)=>{const u=n[l]||[];return a&&s[l]?[...u,...s[l]]:u}}},Fe=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),o=s?Fe(e.slice(1),s):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(we);return(l=t.validators.find(({validator:a})=>a(i)))==null?void 0:l.classGroupId},Ee=/^\[(.+)\]$/,Vt=e=>{if(Ee.test(e)){const t=Ee.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Yt=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return qt(Object.entries(e.classGroups),n).forEach(([i,l])=>{he(l,s,i,t)}),s},he=(e,t,n,s)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:$e(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(Kt(o)){he(o(s),t,n,s);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,l])=>{he(l,$e(t,i),n,s)})})},$e=(e,t)=>{let n=e;return t.split(we).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},Kt=e=>e.isThemeGetter,qt=(e,t)=>t?e.map(([n,s])=>{const o=s.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([l,a])=>[t+l,a])):i);return[n,o]}):e,_t=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const o=(i,l)=>{n.set(i,l),t++,t>e&&(t=0,s=n,n=new Map)};return{get(i){let l=n.get(i);if(l!==void 0)return l;if((l=s.get(i))!==void 0)return o(i,l),l},set(i,l){n.has(i)?n.set(i,l):o(i,l)}}},Ge="!",Ut=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,o=t[0],i=t.length,l=a=>{const u=[];let h=0,p=0,x;for(let w=0;w<a.length;w++){let k=a[w];if(h===0){if(k===o&&(s||a.slice(w,w+i)===t)){u.push(a.slice(p,w)),p=w+i;continue}if(k==="/"){x=w;continue}}k==="["?h++:k==="]"&&h--}const c=u.length===0?a:a.substring(p),f=c.startsWith(Ge),v=f?c.substring(1):c,b=x&&x>p?x-p:void 0;return{modifiers:u,hasImportantModifier:f,baseClassName:v,maybePostfixModifierPosition:b}};return n?a=>n({className:a,parseClassName:l}):l},Xt=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(s=>{s[0]==="["?(t.push(...n.sort(),s),n=[]):n.push(s)}),t.push(...n.sort()),t},Jt=e=>({cache:_t(e.cacheSize),parseClassName:Ut(e),...Gt(e)}),Qt=/\s+/,Zt=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o}=t,i=[],l=e.trim().split(Qt);let a="";for(let u=l.length-1;u>=0;u-=1){const h=l[u],{modifiers:p,hasImportantModifier:x,baseClassName:c,maybePostfixModifierPosition:f}=n(h);let v=!!f,b=s(v?c.substring(0,f):c);if(!b){if(!v){a=h+(a.length>0?" "+a:a);continue}if(b=s(c),!b){a=h+(a.length>0?" "+a:a);continue}v=!1}const w=Xt(p).join(":"),k=x?w+Ge:w,m=k+b;if(i.includes(m))continue;i.push(m);const j=o(b,v);for(let g=0;g<j.length;++g){const S=j[g];i.push(k+S)}a=h+(a.length>0?" "+a:a)}return a};function en(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Ve(t))&&(s&&(s+=" "),s+=n);return s}const Ve=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Ve(e[s]))&&(n&&(n+=" "),n+=t);return n};function tn(e,...t){let n,s,o,i=l;function l(u){const h=t.reduce((p,x)=>x(p),e());return n=Jt(h),s=n.cache.get,o=n.cache.set,i=a,a(u)}function a(u){const h=s(u);if(h)return h;const p=Zt(u,n);return o(u,p),p}return function(){return i(en.apply(null,arguments))}}const P=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Ye=/^\[(?:([a-z-]+):)?(.+)\]$/i,nn=/^\d+\/\d+$/,rn=new Set(["px","full","screen"]),sn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,on=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,cn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,an=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ln=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,F=e=>ee(e)||rn.has(e)||nn.test(e),Y=e=>te(e,"length",bn),ee=e=>!!e&&!Number.isNaN(Number(e)),ue=e=>te(e,"number",ee),se=e=>!!e&&Number.isInteger(Number(e)),dn=e=>e.endsWith("%")&&ee(e.slice(0,-1)),R=e=>Ye.test(e),K=e=>sn.test(e),un=new Set(["length","size","percentage"]),pn=e=>te(e,un,Ke),fn=e=>te(e,"position",Ke),hn=new Set(["image","url"]),mn=e=>te(e,hn,vn),gn=e=>te(e,"",xn),oe=()=>!0,te=(e,t,n)=>{const s=Ye.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},bn=e=>on.test(e)&&!cn.test(e),Ke=()=>!1,xn=e=>an.test(e),vn=e=>ln.test(e),wn=()=>{const e=P("colors"),t=P("spacing"),n=P("blur"),s=P("brightness"),o=P("borderColor"),i=P("borderRadius"),l=P("borderSpacing"),a=P("borderWidth"),u=P("contrast"),h=P("grayscale"),p=P("hueRotate"),x=P("invert"),c=P("gap"),f=P("gradientColorStops"),v=P("gradientColorStopPositions"),b=P("inset"),w=P("margin"),k=P("opacity"),m=P("padding"),j=P("saturate"),g=P("scale"),S=P("sepia"),E=P("skew"),A=P("space"),$=P("translate"),y=()=>["auto","contain","none"],N=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",R,t],C=()=>[R,t],z=()=>["",F,Y],M=()=>["auto",ee,R],T=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],L=()=>["solid","dashed","dotted","double","none"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>["start","end","center","between","around","evenly","stretch"],_=()=>["","0",R],ne=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>[ee,R];return{cacheSize:500,separator:":",theme:{colors:[oe],spacing:[F,Y],blur:["none","",K,R],brightness:B(),borderColor:[e],borderRadius:["none","","full",K,R],borderSpacing:C(),borderWidth:z(),contrast:B(),grayscale:_(),hueRotate:B(),invert:_(),gap:C(),gradientColorStops:[e],gradientColorStopPositions:[dn,Y],inset:I(),margin:I(),opacity:B(),padding:C(),saturate:B(),scale:B(),sepia:_(),skew:B(),space:C(),translate:C()},classGroups:{aspect:[{aspect:["auto","square","video",R]}],container:["container"],columns:[{columns:[K]}],"break-after":[{"break-after":ne()}],"break-before":[{"break-before":ne()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...T(),R]}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:y()}],"overscroll-x":[{"overscroll-x":y()}],"overscroll-y":[{"overscroll-y":y()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[b]}],"inset-x":[{"inset-x":[b]}],"inset-y":[{"inset-y":[b]}],start:[{start:[b]}],end:[{end:[b]}],top:[{top:[b]}],right:[{right:[b]}],bottom:[{bottom:[b]}],left:[{left:[b]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",se,R]}],basis:[{basis:I()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",R]}],grow:[{grow:_()}],shrink:[{shrink:_()}],order:[{order:["first","last","none",se,R]}],"grid-cols":[{"grid-cols":[oe]}],"col-start-end":[{col:["auto",{span:["full",se,R]},R]}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":[oe]}],"row-start-end":[{row:["auto",{span:[se,R]},R]}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",R]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",R]}],gap:[{gap:[c]}],"gap-x":[{"gap-x":[c]}],"gap-y":[{"gap-y":[c]}],"justify-content":[{justify:["normal",...G()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...G(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...G(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[m]}],px:[{px:[m]}],py:[{py:[m]}],ps:[{ps:[m]}],pe:[{pe:[m]}],pt:[{pt:[m]}],pr:[{pr:[m]}],pb:[{pb:[m]}],pl:[{pl:[m]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",R,t]}],"min-w":[{"min-w":[R,t,"min","max","fit"]}],"max-w":[{"max-w":[R,t,"none","full","min","max","fit","prose",{screen:[K]},K]}],h:[{h:[R,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[R,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[R,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[R,t,"auto","min","max","fit"]}],"font-size":[{text:["base",K,Y]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ue]}],"font-family":[{font:[oe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",R]}],"line-clamp":[{"line-clamp":["none",ee,ue]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",F,R]}],"list-image":[{"list-image":["none",R]}],"list-style-type":[{list:["none","disc","decimal",R]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...L(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",F,Y]}],"underline-offset":[{"underline-offset":["auto",F,R]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",R]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",R]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...T(),fn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",pn]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},mn]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...L(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:L()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...L()]}],"outline-offset":[{"outline-offset":[F,R]}],"outline-w":[{outline:[F,Y]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[F,Y]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",K,gn]}],"shadow-color":[{shadow:[oe]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...Q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Q()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",K,R]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[x]}],saturate:[{saturate:[j]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[x]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[j]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",R]}],duration:[{duration:B()}],ease:[{ease:["linear","in","out","in-out",R]}],delay:[{delay:B()}],animate:[{animate:["none","spin","ping","pulse","bounce",R]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[g]}],"scale-x":[{"scale-x":[g]}],"scale-y":[{"scale-y":[g]}],rotate:[{rotate:[se,R]}],"translate-x":[{"translate-x":[$]}],"translate-y":[{"translate-y":[$]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",R]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",R]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",R]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[F,Y,ue]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},yn=tn(wn);function qe(...e){return yn(Qe.clsx(e))}function jn({autoWidth:e=!0,className:t,style:n}){const[s,o]=d.useState(()=>W.getActiveAppId()),[i,l]=d.useState(()=>D.getRunningApps()),{isMobile:a}=ve();d.useEffect(()=>{const w=W.subscribe("activeAppId",k=>{o(k)});return()=>{w()}},[]),d.useEffect(()=>D.subscribe(()=>{l(D.getRunningApps())}),[]),d.useEffect(()=>{if(!new URLSearchParams(window.location.search).has("app")){const m=W.getActiveAppId();m&&!D.isRunning(m)&&D.launchApp(m)}},[]);const u=w=>{D.closeApp(w)},h=s?J.get(s):null,x=(h==null?void 0:h.width)??400,c=s!==null,b={...{overflow:"hidden",display:c?"flex":"none",flexDirection:"column",flexShrink:0,...e&&c?{width:a?"100%":x}:{}},...n};return r.jsx("div",{className:qe("nc-app-panel",t),style:b,children:i.map(w=>r.jsx(xe,{appId:w.appId,isActive:s===w.appId,onClose:()=>u(w.appId)},w.appId))})}function kn({pinnedAppIds:e,className:t=""}){const{isMobile:n}=ve(),[s,o]=d.useState(()=>W.getActiveAppId()),[i,l]=d.useState(()=>D.getRunningApps());d.useEffect(()=>{const c=W.subscribe("activeAppId",f=>{o(f)});return()=>{c()}},[]),d.useEffect(()=>D.subscribe(()=>{l(D.getRunningApps())}),[]);const a=c=>{s===c?D.setActiveApp(null):D.launchApp(c)},u=e.map(c=>J.get(c)).filter(c=>!!c),h=i.filter(c=>!e.includes(c.appId)).map(c=>({running:c,def:J.get(c.appId)})).filter(c=>!!c.def),p=c=>i.some(f=>f.appId===c),x=n?24:28;return r.jsxs("div",{className:`nc-app-taskbar ${n?"nc-mobile":"nc-desktop"} ${t}`,children:[u.map(c=>{const f=c.icon,v=s===c.id,b=p(c.id);return r.jsxs("button",{className:`nc-app-taskbar-button ${v?"nc-active":""} ${b?"nc-running":""}`,onClick:()=>a(c.id),title:c.titleKey||c.id,children:[r.jsx(f,{size:x}),b&&r.jsx("span",{className:"nc-app-taskbar-indicator"})]},c.id)}),h.length>0&&r.jsx("div",{className:"nc-app-taskbar-separator"}),h.map(({running:c,def:f})=>{const v=f.icon,b=s===c.appId;return r.jsxs("button",{className:`nc-app-taskbar-button ${b?"nc-active":""} nc-running`,onClick:()=>a(c.appId),title:f.titleKey||f.id,children:[r.jsx(v,{size:x}),r.jsx("span",{className:"nc-app-taskbar-indicator"})]},c.appId)})]})}function Nn({appId:e,open:t,onClose:n,closeOnBackdrop:s=!1,className:o="",style:i}){const l=u=>{s&&u.target===u.currentTarget&&n()};if(!t)return null;const a=r.jsx("div",{className:"nc-dialog-overlay nc-fullscreen",onClick:l,children:r.jsx("div",{className:`nc-app-dialog-container ${o}`,style:i,onClick:u=>u.stopPropagation(),children:r.jsx(xe,{appId:e,isActive:!0,onClose:n})})});return ce.createPortal(a,document.body)}const ye=d.createContext(null),_e=d.createContext(null);function Sn(){const e=d.useContext(ye);if(!e)throw new Error("useNavStack must be used within a NavStackProvider");return e}function Cn(){const e=d.useContext(_e);if(!e)throw new Error("useNavView must be used within NavStack");return e}const je=d.createContext(null);function An({rootView:e,children:t}){const{t:n}=q.useTranslation(),s=De(),[o,i]=d.useState([e]),[l,a]=d.useState([null]),u=d.useCallback((g,S)=>{a(E=>{const A=[...E];return A[g]=S,A})},[]),h=d.useCallback(g=>{a(S=>{const E=[...S];return E[g]=null,E})},[]),p=d.useCallback(g=>{i(S=>[...S,g]),a(S=>[...S,null])},[]),x=d.useCallback(()=>{i(g=>g.length<=1?g:g.slice(0,-1)),a(g=>g.slice(0,-1))},[]),c=d.useCallback(()=>{i([e]),a([null])},[e]),f=o.length,v=f>1,b=o.length-1,w=o[o.length-1],k=w!=null&&w.titleKey?n(w.titleKey):(w==null?void 0:w.title)??"";d.useEffect(()=>{s.setTitle(k)},[k,s]),d.useEffect(()=>{v?s.setBackHandler(x):s.clearBackHandler()},[v,x,s]),d.useEffect(()=>{const g=l[l.length-1];g?s.setToolbar(g):s.clearToolbar()},[l,s]);const m={push:p,pop:x,reset:c,depth:f,canGoBack:v,currentTitle:k},j={stack:o,toolbarStack:l,updateToolbar:u,clearToolbarAt:h,topIndex:b};return r.jsx(ye.Provider,{value:m,children:r.jsx(je.Provider,{value:j,children:t})})}function Rn({index:e,children:t}){const n=d.useContext(je);if(!n)throw new Error("NavViewProvider must be used within NavStackProvider");const{updateToolbar:s,clearToolbarAt:o,topIndex:i}=n,l=d.useCallback(h=>{e===i&&s(e,h)},[e,i,s]),a=d.useCallback(()=>{e===i&&o(e)},[e,i,o]),u={setToolbar:l,clearToolbar:a};return r.jsx(_e.Provider,{value:u,children:t})}function In(){const e=d.useContext(ye),t=d.useContext(je);if(!e||!t)throw new Error("NavStackContainer must be used within a NavStackProvider");const{stack:n}=t;return r.jsx("div",{className:"nav-stack-container",children:r.jsx("div",{className:"nav-stack-content",children:n.map((s,o)=>{const i=o===n.length-1;return r.jsx(Rn,{index:o,children:r.jsx("div",{style:{display:i?"flex":"none",flexDirection:"column",height:"100%"},children:s.component})},s.id)})})})}exports.ActivityIndicator=me;exports.Alert=Ze;exports.AppContainer=xe;exports.AppContext=be;exports.AppDialog=Nn;exports.AppPanel=jn;exports.AppTaskbar=kn;exports.AppTitleBar=He;exports.Battery=et;exports.Button=H;exports.ButtonGroup=tt;exports.Checkbox=rt;exports.CloseButton=ge;exports.ComboBox=at;exports.ContextMenu=ft;exports.CsvTextArea=Et;exports.Dialog=ht;exports.DialogClose=U;exports.EditButton=dt;exports.Hyperlink=pt;exports.Input=bt;exports.ListGroup=vt;exports.ListGroupItem=xt;exports.MonthRangePicker=yt;exports.MultiSelect=wt;exports.NavStackContainer=In;exports.NavStackProvider=An;exports.Notification=Be;exports.NotificationContainer=Pt;exports.NumberInput=jt;exports.RefreshButton=lt;exports.Slider=kt;exports.TabPanel=ze;exports.TabPanels=St;exports.Tabs=Ct;exports.Toggle=At;exports.TrashButton=ut;exports.ViewportProvider=Ft;exports.appRegistry=J;exports.appStateStore=W;exports.cn=qe;exports.createAppI18nFactory=Lt;exports.notificationManager=zt;exports.runningAppsStore=D;exports.useApp=De;exports.useDialog=Pe;exports.useNavStack=Sn;exports.useNavView=Cn;exports.useViewport=ve;
|
|
3
|
+
`),i=Math.max(1,Math.min(t,o.length));let l=0;for(let g=0;g<i-1;g++)l+=o[g].length+1;const u=o[i-1].split(" "),f=Math.max(1,Math.min(n,u.length));for(let g=0;g<f-1;g++)l+=u[g].length+1;const h=Math.max(1,Math.min(s,u[f-1].length+1));return l+=h-1,l}function Mt(e,t){const n=e.split(`
|
|
4
|
+
`),s=Math.max(1,Math.min(t,n.length));let o=0;for(let i=0;i<s-1;i++)o+=n[i].length+1;return o}const Et=d.forwardRef(function({value:t,onChange:n,placeholder:s,className:o,style:i,showLineNumbers:l=!1,onCursorChange:a,highlightLine:u},f){const h=d.useRef(null),g=d.useRef(null),c=d.useRef(null);d.useImperativeHandle(f,()=>({goToLine(m){const j=h.current;if(!j)return;const x=Mt(t,m);j.focus(),j.setSelectionRange(x,x);const S=parseFloat(getComputedStyle(j).lineHeight)||18;j.scrollTop=(Math.max(1,m)-1)*S,w(),p()},goToPosition(m,j,x){const S=h.current;if(!S)return;const M=It(t,m,j,x);S.focus(),S.setSelectionRange(M,M);const A=parseFloat(getComputedStyle(S).lineHeight)||18;S.scrollTop=(Math.max(1,m)-1)*A,w(),p()}}),[t]);const p=d.useCallback(()=>{if(!a||!h.current)return;const m=Rt(t,h.current.selectionStart);a(m)},[a,t]),w=d.useCallback(()=>{const m=h.current;m&&(g.current&&(g.current.scrollTop=m.scrollTop,g.current.scrollLeft=m.scrollLeft),c.current&&(c.current.scrollTop=m.scrollTop))},[]);d.useEffect(()=>{if(u==null||u<1)return;const m=h.current;if(!m)return;const j=parseFloat(getComputedStyle(m).lineHeight)||18,x=(u-1)*j,S=x+j;(x<m.scrollTop||S>m.scrollTop+m.clientHeight)&&(m.scrollTop=x-m.clientHeight/2+j/2),w()},[u]);const b=d.useMemo(()=>t.split(`
|
|
5
|
+
`).length,[t]),v=()=>{const m=[];for(let j=1;j<=b;j++)m.push(r.jsx("div",{className:`nc-csv-line-number ${u===j?"nc-csv-highlight":""}`,children:j},j));return r.jsx("div",{className:"nc-csv-gutter",ref:c,children:m})},k=m=>m?m.split(`
|
|
6
|
+
`).map((x,S)=>{const M=x.split(" ");return r.jsxs("div",{className:`nc-csv-line ${u===S+1?"nc-csv-highlight":""}`,children:[M.map((A,$)=>r.jsxs("span",{children:[$>0&&r.jsx("span",{className:"nc-csv-tab-char",children:" "}),r.jsx("span",{style:{color:Re[$%Re.length]},children:A})]},$)),x===""&&`
|
|
7
|
+
`]},S)}):null;return r.jsxs("div",{className:`nc-csv-textarea-container ${l?"nc-csv-with-gutter":""} ${o??""}`,style:i,children:[l&&v(),r.jsxs("div",{className:"nc-csv-textarea-editor",children:[r.jsx("div",{className:"nc-csv-textarea-backdrop",ref:g,children:r.jsx("pre",{className:"nc-csv-textarea-highlights",children:k(t)})}),r.jsx("textarea",{ref:h,className:"nc-csv-textarea-input",value:t,onChange:m=>{n(m.target.value),requestAnimationFrame(p)},onScroll:w,onSelect:p,onKeyUp:p,onClick:p,placeholder:s,spellCheck:!1,autoComplete:"off",autoCorrect:"off"})]})]})});let X={notifications:[]};const pe=new Set,Ie=new Map;function fe(){const e=X.notifications.slice();for(const t of Array.from(pe))try{t(e)}catch{}}function $t(e){pe.add(e);try{e(X.notifications.slice())}catch{}return()=>{pe.delete(e)}}function Tt(e){const t=`notification-${Date.now()}-${Math.random()}`,n={id:t,dismissible:!0,lastingTime:5e3,...e};return X.notifications=[n,...X.notifications],fe(),n.lastingTime&&n.lastingTime>0&&setTimeout(()=>{Le(t)},n.lastingTime),t}function Le(e){const t=X.notifications.find(s=>s.id===e);if(!t)return;t.isRemoving=!0,fe();const n=window.setTimeout(()=>{X.notifications=X.notifications.filter(s=>s.id!==e),fe(),Ie.delete(e)},300);Ie.set(e,n)}function Be({notification:e}){const{t}=q.useTranslation(),n=()=>{if(e.title)return e.title;switch(e.type){case"success":return t("common.success");case"danger":return t("common.error");case"warning":return t("common.warning");default:return t("common.info")}},s=()=>{Le(e.id)};return r.jsx("div",{className:`nc-notification nc-notification-${e.type||"info"}`,children:r.jsxs("div",{className:"nc-notification-content",children:[r.jsxs("div",{className:"nc-notification-body",style:{paddingRight:e.dismissible?"8px":"0"},children:[r.jsx("div",{className:"nc-notification-title",children:n()}),r.jsx("div",{className:"nc-notification-message",children:e.message})]}),e.dismissible&&r.jsx("button",{className:"nc-notification-dismiss",onClick:s,children:r.jsx(O.CloseIcon,{size:16})})]})})}function Pt(){const[e,t]=d.useState([]),[n,s]=d.useState(new Map),[o,i]=d.useState(new Set),l=d.useRef(null),a=d.useRef([]);return d.useEffect(()=>$t(f=>{const h=new Set(a.current.map(c=>c.id)),g=f.filter(c=>!h.has(c.id)).map(c=>c.id);g.length>0?(t(f),i(new Set(g)),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i(new Set)})})):t(f),a.current=f}),[]),d.useEffect(()=>{if(!l.current)return;const u=new Map;let f=0;const h=l.current.children;e.forEach((g,c)=>{if(u.set(g.id,f),h[c]){const p=h[c].offsetHeight;g.isRemoving||(f+=p+12)}}),s(u)},[e]),r.jsx("div",{style:{position:"fixed",top:"16px",left:"16px",zIndex:9999,pointerEvents:"none"},children:r.jsx("div",{ref:l,style:{pointerEvents:"auto",position:"relative"},children:e.map(u=>{const f=o.has(u.id),h=u.isRemoving,g=n.get(u.id)||0;return r.jsx("div",{style:{position:"absolute",top:0,left:0,transform:f?"translateY(-120px)":`translateY(${g}px)`,transition:h?"opacity 300ms ease-out":"transform 300ms ease-out, opacity 300ms ease-out",opacity:h?0:1,width:"100%"},children:r.jsx(Be,{notification:u})},u.id)})})})}const zt={show:e=>Tt(e)};function Lt(e){const t=Je.createInstance(),n={};for(const o in e)n[o]={translation:e[o]};const s=typeof document<"u"&&document.documentElement.lang||"en";return t.init({resources:n,lng:s,fallbackLng:"en",interpolation:{escapeValue:!1}}),typeof MutationObserver<"u"&&typeof document<"u"&&new MutationObserver(i=>{for(const l of i)if(l.type==="attributes"&&l.attributeName==="lang"){const a=document.documentElement.lang||"en";t.changeLanguage(a)}}).observe(document.documentElement,{attributes:!0}),t}class Bt{constructor(){V(this,"apps",new Map)}register(t){this.apps.has(t.id)&&console.warn(`App "${t.id}" is already registered. Overwriting.`),this.apps.set(t.id,{...t,width:t.width??400,padding:t.padding??0})}unregister(t){this.apps.delete(t)}get(t){return this.apps.get(t)}list(){return Array.from(this.apps.values())}has(t){return this.apps.has(t)}}const J=new Bt,Me="nc-ui-app-state";class Dt{constructor(){V(this,"state");V(this,"listeners",new Map);this.state=this.loadState()}loadState(){try{const t=localStorage.getItem(Me);if(t)return JSON.parse(t)}catch{}return{activeAppId:null}}saveState(){try{localStorage.setItem(Me,JSON.stringify(this.state))}catch{}}getActiveAppId(){return this.state.activeAppId}_setActiveAppId(t){this.state.activeAppId!==t&&(this.state.activeAppId=t,this.saveState(),this.notify("activeAppId",t))}subscribe(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>{var s;(s=this.listeners.get(t))==null||s.delete(n)}}notify(t,n){var s;(s=this.listeners.get(t))==null||s.forEach(o=>o(n))}}const W=new Dt;class Ht{constructor(){V(this,"apps",[]);V(this,"activeAppId",null);V(this,"listeners",new Set);V(this,"refReadyResolvers",new Map)}async launchApp(t,n){const{launchInBackground:s=!1}=n||{};if(!J.has(t))return console.error(`Cannot launch app "${t}": not registered`),null;const o=this.apps.find(l=>l.appId===t);if(o)return s||(this.setActiveApp(t),W._setActiveAppId(t)),o.ref?o:this.waitForRef(t);const i={appId:t,launchedAt:Date.now()};return this.apps.push(i),s||(this.activeAppId=t,W._setActiveAppId(t)),this.notify(),this.waitForRef(t)}waitForRef(t){return new Promise(n=>{const s=this.refReadyResolvers.get(t)||[];s.push(n),this.refReadyResolvers.set(t,s)})}setAppRef(t,n){const s=this.apps.find(i=>i.appId===t);if(!s){console.warn(`Cannot set ref for app "${t}": not running`);return}s.ref=n;const o=this.refReadyResolvers.get(t);o&&(o.forEach(i=>i(s)),this.refReadyResolvers.delete(t))}getApp(t){return this.apps.find(n=>n.appId===t)}closeApp(t){const n=this.apps.findIndex(o=>o.appId===t);if(n===-1)return;const s=this.apps[n];if(s.ref&&(s.ref=void 0),this.apps.splice(n,1),this.activeAppId===t){const o=window.innerWidth>=768;this.activeAppId=o&&this.apps.length>0?this.apps[this.apps.length-1].appId:null,W._setActiveAppId(this.activeAppId)}this.notify()}setActiveApp(t){if(t!==null&&!this.apps.find(n=>n.appId===t)){console.warn(`Cannot activate app "${t}": not running`);return}this.activeAppId!==t&&(this.activeAppId=t,this.notify(),W._setActiveAppId(t))}toggleApp(t){this.activeAppId===t?this.setActiveApp(null):this.launchApp(t)}getActiveAppId(){return this.activeAppId}getActiveApp(){return this.activeAppId?J.get(this.activeAppId)??null:null}getRunningApps(){return[...this.apps]}isRunning(t){return this.apps.some(n=>n.appId===t)}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){this.listeners.forEach(t=>t())}}const D=new Ht,be=d.createContext(null);function De(){const e=d.useContext(be);if(!e)throw new Error("useApp must be used inside an App");return e}function Wt({size:e=16}){return r.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M19 12H5"}),r.jsx("path",{d:"M12 19l-7-7 7-7"})]})}function He({title:e,onClose:t,onBack:n,toolbar:s,hideBackButton:o}){const i=n&&!o;return r.jsxs("div",{className:"nc-app-title-bar",children:[r.jsxs("div",{className:"nc-app-title-bar-left",children:[i&&r.jsx("button",{className:"nc-app-title-bar-back",onClick:n,title:"Back","aria-label":"Go back",children:r.jsx(Wt,{size:16})}),r.jsx("span",{className:"nc-app-title-bar-title",children:e})]}),r.jsxs("div",{className:"nc-app-title-bar-right",children:[s&&r.jsx("div",{className:"nc-app-title-bar-toolbar",children:s}),r.jsx(ge,{onClick:t,"aria-label":"Close application"})]})]})}class Ot extends d.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error(`Error loading app ${this.props.appId}:`,t,n)}render(){return this.state.hasError?r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",flex:1,flexDirection:"column",gap:"16px",padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:[r.jsx("div",{children:"Failed to load app"}),this.state.error&&r.jsx("div",{style:{fontSize:"12px",opacity:.7},children:this.state.error.message})]}):this.props.children}}function xe({appId:e,isActive:t,onClose:n}){const{t:s}=q.useTranslation(),o=J.get(e),[i,l]=d.useState(""),[a,u]=d.useState(null),[f,h]=d.useState(null),[g,c]=d.useState(!1),[p,w]=d.useState(!1);d.useEffect(()=>{o!=null&&o.titleKey&&l(s(o.titleKey))},[o,s]);const b=d.useCallback(y=>{l(y)},[]),v=d.useCallback(y=>{u(()=>y)},[]),k=d.useCallback(()=>{u(null)},[]),m=d.useCallback(y=>{h(y)},[]),j=d.useCallback(()=>{h(null)},[]),x=d.useCallback(y=>{c(y)},[]),S=d.useCallback(y=>{w(y)},[]),M=d.useMemo(()=>({setTitle:b,setBackHandler:v,clearBackHandler:k,setToolbar:m,clearToolbar:j,setHideBackButton:x,setHideTitleBar:S,close:n}),[b,v,k,m,j,x,S,n]);if(!o)return null;const A=o.component,$=!o.hideTitleBar&&!p;return r.jsxs("div",{style:{display:t?"flex":"none",flexDirection:"column",flex:1,minHeight:0},children:[$&&r.jsx(He,{title:i,onClose:n,onBack:a??void 0,toolbar:f,hideBackButton:g}),r.jsx("div",{className:$?"nc-app-content-wrapper":"",style:{padding:o.padding,flex:1,minHeight:0,display:"flex",flexDirection:"column",backgroundColor:"var(--nc-bg-secondary)",position:"relative"},children:r.jsx(be.Provider,{value:M,children:r.jsx(Ot,{appId:e,children:r.jsx(d.Suspense,{fallback:r.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",flex:1},children:r.jsx(me,{})}),children:r.jsx(A,{})})})})})]})}const le=768,de=1024,We={isMobile:!1,isTablet:!1,isDesktop:!0,width:typeof window<"u"?window.innerWidth:1024,height:typeof window<"u"?window.innerHeight:768},Oe=d.createContext(We);function Ft({children:e}){const[t,n]=d.useState(()=>{if(typeof window>"u")return We;const s=window.innerWidth,o=window.innerHeight;return{isMobile:s<le,isTablet:s>=le&&s<de,isDesktop:s>=de,width:s,height:o}});return d.useEffect(()=>{const s=()=>{const o=window.innerWidth,i=window.innerHeight;n({isMobile:o<le,isTablet:o>=le&&o<de,isDesktop:o>=de,width:o,height:i})};return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),r.jsx(Oe.Provider,{value:t,children:e})}function ve(){return d.useContext(Oe)}const we="-",Gt=e=>{const t=Yt(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:l=>{const a=l.split(we);return a[0]===""&&a.length!==1&&a.shift(),Fe(a,t)||Vt(l)},getConflictingClassGroupIds:(l,a)=>{const u=n[l]||[];return a&&s[l]?[...u,...s[l]]:u}}},Fe=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),o=s?Fe(e.slice(1),s):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(we);return(l=t.validators.find(({validator:a})=>a(i)))==null?void 0:l.classGroupId},Ee=/^\[(.+)\]$/,Vt=e=>{if(Ee.test(e)){const t=Ee.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Yt=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return qt(Object.entries(e.classGroups),n).forEach(([i,l])=>{he(l,s,i,t)}),s},he=(e,t,n,s)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:$e(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(Kt(o)){he(o(s),t,n,s);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,l])=>{he(l,$e(t,i),n,s)})})},$e=(e,t)=>{let n=e;return t.split(we).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},Kt=e=>e.isThemeGetter,qt=(e,t)=>t?e.map(([n,s])=>{const o=s.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([l,a])=>[t+l,a])):i);return[n,o]}):e,_t=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const o=(i,l)=>{n.set(i,l),t++,t>e&&(t=0,s=n,n=new Map)};return{get(i){let l=n.get(i);if(l!==void 0)return l;if((l=s.get(i))!==void 0)return o(i,l),l},set(i,l){n.has(i)?n.set(i,l):o(i,l)}}},Ge="!",Ut=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,o=t[0],i=t.length,l=a=>{const u=[];let f=0,h=0,g;for(let v=0;v<a.length;v++){let k=a[v];if(f===0){if(k===o&&(s||a.slice(v,v+i)===t)){u.push(a.slice(h,v)),h=v+i;continue}if(k==="/"){g=v;continue}}k==="["?f++:k==="]"&&f--}const c=u.length===0?a:a.substring(h),p=c.startsWith(Ge),w=p?c.substring(1):c,b=g&&g>h?g-h:void 0;return{modifiers:u,hasImportantModifier:p,baseClassName:w,maybePostfixModifierPosition:b}};return n?a=>n({className:a,parseClassName:l}):l},Xt=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(s=>{s[0]==="["?(t.push(...n.sort(),s),n=[]):n.push(s)}),t.push(...n.sort()),t},Jt=e=>({cache:_t(e.cacheSize),parseClassName:Ut(e),...Gt(e)}),Qt=/\s+/,Zt=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o}=t,i=[],l=e.trim().split(Qt);let a="";for(let u=l.length-1;u>=0;u-=1){const f=l[u],{modifiers:h,hasImportantModifier:g,baseClassName:c,maybePostfixModifierPosition:p}=n(f);let w=!!p,b=s(w?c.substring(0,p):c);if(!b){if(!w){a=f+(a.length>0?" "+a:a);continue}if(b=s(c),!b){a=f+(a.length>0?" "+a:a);continue}w=!1}const v=Xt(h).join(":"),k=g?v+Ge:v,m=k+b;if(i.includes(m))continue;i.push(m);const j=o(b,w);for(let x=0;x<j.length;++x){const S=j[x];i.push(k+S)}a=f+(a.length>0?" "+a:a)}return a};function en(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Ve(t))&&(s&&(s+=" "),s+=n);return s}const Ve=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Ve(e[s]))&&(n&&(n+=" "),n+=t);return n};function tn(e,...t){let n,s,o,i=l;function l(u){const f=t.reduce((h,g)=>g(h),e());return n=Jt(f),s=n.cache.get,o=n.cache.set,i=a,a(u)}function a(u){const f=s(u);if(f)return f;const h=Zt(u,n);return o(u,h),h}return function(){return i(en.apply(null,arguments))}}const z=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Ye=/^\[(?:([a-z-]+):)?(.+)\]$/i,nn=/^\d+\/\d+$/,rn=new Set(["px","full","screen"]),sn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,on=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,cn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,an=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ln=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,F=e=>ee(e)||rn.has(e)||nn.test(e),Y=e=>te(e,"length",bn),ee=e=>!!e&&!Number.isNaN(Number(e)),ue=e=>te(e,"number",ee),se=e=>!!e&&Number.isInteger(Number(e)),dn=e=>e.endsWith("%")&&ee(e.slice(0,-1)),R=e=>Ye.test(e),K=e=>sn.test(e),un=new Set(["length","size","percentage"]),pn=e=>te(e,un,Ke),fn=e=>te(e,"position",Ke),hn=new Set(["image","url"]),mn=e=>te(e,hn,vn),gn=e=>te(e,"",xn),oe=()=>!0,te=(e,t,n)=>{const s=Ye.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},bn=e=>on.test(e)&&!cn.test(e),Ke=()=>!1,xn=e=>an.test(e),vn=e=>ln.test(e),wn=()=>{const e=z("colors"),t=z("spacing"),n=z("blur"),s=z("brightness"),o=z("borderColor"),i=z("borderRadius"),l=z("borderSpacing"),a=z("borderWidth"),u=z("contrast"),f=z("grayscale"),h=z("hueRotate"),g=z("invert"),c=z("gap"),p=z("gradientColorStops"),w=z("gradientColorStopPositions"),b=z("inset"),v=z("margin"),k=z("opacity"),m=z("padding"),j=z("saturate"),x=z("scale"),S=z("sepia"),M=z("skew"),A=z("space"),$=z("translate"),y=()=>["auto","contain","none"],E=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto",R,t],C=()=>[R,t],P=()=>["",F,Y],I=()=>["auto",ee,R],T=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],L=()=>["solid","dashed","dotted","double","none"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>["start","end","center","between","around","evenly","stretch"],_=()=>["","0",R],ne=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>[ee,R];return{cacheSize:500,separator:":",theme:{colors:[oe],spacing:[F,Y],blur:["none","",K,R],brightness:B(),borderColor:[e],borderRadius:["none","","full",K,R],borderSpacing:C(),borderWidth:P(),contrast:B(),grayscale:_(),hueRotate:B(),invert:_(),gap:C(),gradientColorStops:[e],gradientColorStopPositions:[dn,Y],inset:N(),margin:N(),opacity:B(),padding:C(),saturate:B(),scale:B(),sepia:_(),skew:B(),space:C(),translate:C()},classGroups:{aspect:[{aspect:["auto","square","video",R]}],container:["container"],columns:[{columns:[K]}],"break-after":[{"break-after":ne()}],"break-before":[{"break-before":ne()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...T(),R]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:y()}],"overscroll-x":[{"overscroll-x":y()}],"overscroll-y":[{"overscroll-y":y()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[b]}],"inset-x":[{"inset-x":[b]}],"inset-y":[{"inset-y":[b]}],start:[{start:[b]}],end:[{end:[b]}],top:[{top:[b]}],right:[{right:[b]}],bottom:[{bottom:[b]}],left:[{left:[b]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",se,R]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",R]}],grow:[{grow:_()}],shrink:[{shrink:_()}],order:[{order:["first","last","none",se,R]}],"grid-cols":[{"grid-cols":[oe]}],"col-start-end":[{col:["auto",{span:["full",se,R]},R]}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[oe]}],"row-start-end":[{row:["auto",{span:[se,R]},R]}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",R]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",R]}],gap:[{gap:[c]}],"gap-x":[{"gap-x":[c]}],"gap-y":[{"gap-y":[c]}],"justify-content":[{justify:["normal",...G()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...G(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...G(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[m]}],px:[{px:[m]}],py:[{py:[m]}],ps:[{ps:[m]}],pe:[{pe:[m]}],pt:[{pt:[m]}],pr:[{pr:[m]}],pb:[{pb:[m]}],pl:[{pl:[m]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",R,t]}],"min-w":[{"min-w":[R,t,"min","max","fit"]}],"max-w":[{"max-w":[R,t,"none","full","min","max","fit","prose",{screen:[K]},K]}],h:[{h:[R,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[R,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[R,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[R,t,"auto","min","max","fit"]}],"font-size":[{text:["base",K,Y]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ue]}],"font-family":[{font:[oe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",R]}],"line-clamp":[{"line-clamp":["none",ee,ue]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",F,R]}],"list-image":[{"list-image":["none",R]}],"list-style-type":[{list:["none","disc","decimal",R]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...L(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",F,Y]}],"underline-offset":[{"underline-offset":["auto",F,R]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",R]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",R]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...T(),fn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",pn]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},mn]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...L(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:L()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...L()]}],"outline-offset":[{"outline-offset":[F,R]}],"outline-w":[{outline:[F,Y]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:P()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[F,Y]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",K,gn]}],"shadow-color":[{shadow:[oe]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...Q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Q()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",K,R]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[g]}],saturate:[{saturate:[j]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[j]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",R]}],duration:[{duration:B()}],ease:[{ease:["linear","in","out","in-out",R]}],delay:[{delay:B()}],animate:[{animate:["none","spin","ping","pulse","bounce",R]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[se,R]}],"translate-x":[{"translate-x":[$]}],"translate-y":[{"translate-y":[$]}],"skew-x":[{"skew-x":[M]}],"skew-y":[{"skew-y":[M]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",R]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",R]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",R]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[F,Y,ue]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},yn=tn(wn);function qe(...e){return yn(Qe.clsx(e))}function jn({autoWidth:e=!0,className:t,style:n}){const[s,o]=d.useState(()=>W.getActiveAppId()),[i,l]=d.useState(()=>D.getRunningApps()),{isMobile:a}=ve();d.useEffect(()=>{const v=W.subscribe("activeAppId",k=>{o(k)});return()=>{v()}},[]),d.useEffect(()=>D.subscribe(()=>{l(D.getRunningApps())}),[]),d.useEffect(()=>{if(!new URLSearchParams(window.location.search).has("app")){const m=W.getActiveAppId();m&&!D.isRunning(m)&&D.launchApp(m)}},[]);const u=v=>{D.closeApp(v)},f=s?J.get(s):null,g=(f==null?void 0:f.width)??400,c=s!==null,b={...{overflow:"hidden",display:c?"flex":"none",flexDirection:"column",flexShrink:0,...e&&c?{width:a?"100%":g}:{}},...n};return r.jsx("div",{className:qe("nc-app-panel",t),style:b,children:i.map(v=>r.jsx(xe,{appId:v.appId,isActive:s===v.appId,onClose:()=>u(v.appId)},v.appId))})}function kn({pinnedAppIds:e,className:t=""}){const{isMobile:n}=ve(),[s,o]=d.useState(()=>W.getActiveAppId()),[i,l]=d.useState(()=>D.getRunningApps());d.useEffect(()=>{const c=W.subscribe("activeAppId",p=>{o(p)});return()=>{c()}},[]),d.useEffect(()=>D.subscribe(()=>{l(D.getRunningApps())}),[]);const a=c=>{s===c?D.setActiveApp(null):D.launchApp(c)},u=e.map(c=>J.get(c)).filter(c=>!!c),f=i.filter(c=>!e.includes(c.appId)).map(c=>({running:c,def:J.get(c.appId)})).filter(c=>!!c.def),h=c=>i.some(p=>p.appId===c),g=n?24:28;return r.jsxs("div",{className:`nc-app-taskbar ${n?"nc-mobile":"nc-desktop"} ${t}`,children:[u.map(c=>{const p=c.icon,w=s===c.id,b=h(c.id);return r.jsxs("button",{className:`nc-app-taskbar-button ${w?"nc-active":""} ${b?"nc-running":""}`,onClick:()=>a(c.id),title:c.titleKey||c.id,children:[r.jsx(p,{size:g}),b&&r.jsx("span",{className:"nc-app-taskbar-indicator"})]},c.id)}),f.length>0&&r.jsx("div",{className:"nc-app-taskbar-separator"}),f.map(({running:c,def:p})=>{const w=p.icon,b=s===c.appId;return r.jsxs("button",{className:`nc-app-taskbar-button ${b?"nc-active":""} nc-running`,onClick:()=>a(c.appId),title:p.titleKey||p.id,children:[r.jsx(w,{size:g}),r.jsx("span",{className:"nc-app-taskbar-indicator"})]},c.appId)})]})}function Nn({appId:e,open:t,onClose:n,closeOnBackdrop:s=!1,className:o="",style:i}){const l=u=>{s&&u.target===u.currentTarget&&n()};if(!t)return null;const a=r.jsx("div",{className:"nc-dialog-overlay nc-fullscreen",onClick:l,children:r.jsx("div",{className:`nc-app-dialog-container ${o}`,style:i,onClick:u=>u.stopPropagation(),children:r.jsx(xe,{appId:e,isActive:!0,onClose:n})})});return ce.createPortal(a,document.body)}const ye=d.createContext(null),_e=d.createContext(null);function Sn(){const e=d.useContext(ye);if(!e)throw new Error("useNavStack must be used within a NavStackProvider");return e}function Cn(){const e=d.useContext(_e);if(!e)throw new Error("useNavView must be used within NavStack");return e}const je=d.createContext(null);function An({rootView:e,children:t}){const{t:n}=q.useTranslation(),s=De(),[o,i]=d.useState([e]),[l,a]=d.useState([null]),u=d.useCallback((x,S)=>{a(M=>{const A=[...M];return A[x]=S,A})},[]),f=d.useCallback(x=>{a(S=>{const M=[...S];return M[x]=null,M})},[]),h=d.useCallback(x=>{i(S=>[...S,x]),a(S=>[...S,null])},[]),g=d.useCallback(()=>{i(x=>x.length<=1?x:x.slice(0,-1)),a(x=>x.slice(0,-1))},[]),c=d.useCallback(()=>{i([e]),a([null])},[e]),p=o.length,w=p>1,b=o.length-1,v=o[o.length-1],k=v!=null&&v.titleKey?n(v.titleKey):(v==null?void 0:v.title)??"";d.useEffect(()=>{s.setTitle(k)},[k,s]),d.useEffect(()=>{w?s.setBackHandler(g):s.clearBackHandler()},[w,g,s]),d.useEffect(()=>{const x=l[l.length-1];x?s.setToolbar(x):s.clearToolbar()},[l,s]);const m={push:h,pop:g,reset:c,depth:p,canGoBack:w,currentTitle:k},j={stack:o,toolbarStack:l,updateToolbar:u,clearToolbarAt:f,topIndex:b};return r.jsx(ye.Provider,{value:m,children:r.jsx(je.Provider,{value:j,children:t})})}function Rn({index:e,children:t}){const n=d.useContext(je);if(!n)throw new Error("NavViewProvider must be used within NavStackProvider");const{updateToolbar:s,clearToolbarAt:o,topIndex:i}=n,l=d.useCallback(f=>{e===i&&s(e,f)},[e,i,s]),a=d.useCallback(()=>{e===i&&o(e)},[e,i,o]),u={setToolbar:l,clearToolbar:a};return r.jsx(_e.Provider,{value:u,children:t})}function In(){const e=d.useContext(ye),t=d.useContext(je);if(!e||!t)throw new Error("NavStackContainer must be used within a NavStackProvider");const{stack:n}=t;return r.jsx("div",{className:"nav-stack-container",children:r.jsx("div",{className:"nav-stack-content",children:n.map((s,o)=>{const i=o===n.length-1;return r.jsx(Rn,{index:o,children:r.jsx("div",{style:{display:i?"flex":"none",flexDirection:"column",height:"100%"},children:s.component})},s.id)})})})}exports.ActivityIndicator=me;exports.Alert=Ze;exports.AppContainer=xe;exports.AppContext=be;exports.AppDialog=Nn;exports.AppPanel=jn;exports.AppTaskbar=kn;exports.AppTitleBar=He;exports.Battery=et;exports.Button=H;exports.ButtonGroup=tt;exports.Checkbox=rt;exports.CloseButton=ge;exports.ComboBox=at;exports.ContextMenu=ft;exports.CsvTextArea=Et;exports.Dialog=ht;exports.DialogClose=U;exports.EditButton=dt;exports.Hyperlink=pt;exports.Input=bt;exports.ListGroup=vt;exports.ListGroupItem=xt;exports.MonthRangePicker=yt;exports.MultiSelect=wt;exports.NavStackContainer=In;exports.NavStackProvider=An;exports.Notification=Be;exports.NotificationContainer=Pt;exports.NumberInput=jt;exports.RefreshButton=lt;exports.Slider=kt;exports.TabPanel=ze;exports.TabPanels=St;exports.Tabs=Ct;exports.Toggle=At;exports.TrashButton=ut;exports.ViewportProvider=Ft;exports.appRegistry=J;exports.appStateStore=W;exports.cn=qe;exports.createAppI18nFactory=Lt;exports.notificationManager=zt;exports.runningAppsStore=D;exports.useApp=De;exports.useDialog=Pe;exports.useNavStack=Sn;exports.useNavView=Cn;exports.useViewport=ve;
|
|
8
8
|
//# sourceMappingURL=index.cjs.map
|