@kingsimba/nc-ui 0.1.11 → 0.1.12
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/README.md +1 -0
- package/dist/index.cjs +7 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +60 -1
- package/dist/index.js +1094 -949
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -0
- package/dist/yaml.cjs.map +1 -1
- package/dist/yaml.js.map +1 -1
- package/package.json +3 -3
- package/dist/styles.css +0 -1429
package/README.md
CHANGED
|
@@ -80,6 +80,7 @@ nc-ui provides 23+ ready-to-use components. Click any component to see it in the
|
|
|
80
80
|
| [CommonButtons](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=buttons-icon) | Pre-configured buttons (Close, Edit, Refresh, Trash) |
|
|
81
81
|
| [ComboBox](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=combobox) | Searchable dropdown with autocomplete |
|
|
82
82
|
| [ContextMenu](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=context-menu) | Right-click menu with customizable items |
|
|
83
|
+
| [CsvTextArea](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=csv-textarea) | Tab-separated text editor with per-column color highlighting |
|
|
83
84
|
| [Dialog](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=dialog) | Modal dialogs with header, footer, and action buttons |
|
|
84
85
|
| [Hyperlink](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=hyperlink) | Styled anchor/link component |
|
|
85
86
|
| [Icons](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=icons) | 50+ SVG icons (separate import path) |
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
"use strict";var _e=Object.defineProperty;var Ue=(e,t,n)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var O=(e,t,n)=>Ue(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),u=require("react"),ae=require("react-dom"),q=require("react-i18next"),W=require("./GeneratedIcons-CGjL38ny.cjs"),Xe=require("i18next"),Je=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:c,children:d,...f}){const m=["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(" "),w=a=>{if(!l){if(i){const p=window.getSelection();if(p&&p.toString().length>0)return}c==null||c(a)}};return r.jsxs("button",{className:m,disabled:o||l,onClick:w,...f,children:[l&&r.jsx(me,{size:"small",className:"nc-button-spinner",color:e!=="default"&&e!=="ghost"?"white":void 0}),d]})}function Qe({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 Ze({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)",c=24,d=14,f=2,m=0,w=12,a=0,p=0,g=0,v=c,h=d,y=h-a*2,j=v-a*2,R=Math.max(1,Math.min(4,h/4)),b=o===0?0:.05+o*.95,C=c+f+w,$=20,x=.65,S=Math.max(d,$*x),k=c+f+1,E=(d-$*x)/2;return r.jsxs("svg",{className:"nc-battery",width:C,height:S,viewBox:`0 0 ${C} ${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:j*b,height:y,fill:"white"})}),r.jsxs("mask",{id:`nc-battery-text-mask-${o}`,children:[r.jsx("rect",{x:"0",y:"0",width:C,height:S,fill:"white"}),r.jsx("text",{x:p+v/2,y:d-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:g,rx:R,ry:R,width:v,height:h,fill:l}),r.jsx("rect",{x:p+a,y:g+a,width:j,height:y,fill:i,rx:R,ry:R,mask:`url(#nc-battery-fill-mask-${o})`}),r.jsx("rect",{x:c+m,y:d*.26,width:f,height:d*.48,rx:.8,ry:.8,fill:o===1?i:l}),t==="charging"?r.jsx("g",{transform:`translate(${k}, ${E}) scale(${x})`,fill:i,children:r.jsx("path",{d:"M10 0 L2 11 H8 L5 20 L14 8 H8 L10 0 Z"})}):null]})]})}function et({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,c)=>r.jsx("button",{className:`nc-button-group-item ${e===l?"nc-active":""} ${c<n.length-1?"nc-has-border":""}`,onClick:()=>!s&&t(l),disabled:s,children:o&&o[l]?o[l]:l},l))})}function tt({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 nt({checked:e,onChange:t,disabled:n,label:s,size:o="default",labelColor:i,style:l,className:c=""}){const d=o==="small";return r.jsxs("label",{className:`nc-checkbox-label ${d?"nc-small":""} ${n?"nc-disabled":""} ${c}`.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 ${d?"nc-small":""} ${e?"nc-checked":""}`,onKeyDown:f=>{n||(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),t(!e))},children:e&&r.jsx(tt,{size:o})}),s&&r.jsx("span",{className:"nc-checkbox-text",style:i?{color:i}:void 0,children:s})]})}function rt({option:e,onChange:t,selected:n,highlighted:s,small:o}){const i=u.useRef(null),{t:l}=q.useTranslation();return u.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 st({isOpen:e,options:t,onSelect:n,selectedValue:s,placement:o="bottom",anchorRef:i,small:l,highlightedIndex:c=-1}){const[d,f]=u.useState({top:0,left:0,width:0}),[m,w]=u.useState(o),{t:a}=q.useTranslation();if(u.useEffect(()=>{if(e&&i.current){const g=i.current.getBoundingClientRect();let v=o;if(o==="bottom"){const h=window.innerHeight-g.bottom,y=g.top;h<320&&y>h&&(v="top")}w(v),f({top:v==="top"?g.top-4:g.bottom+4,left:g.left,width:g.width})}},[e,i,o]),!e)return null;const p=r.jsx("div",{className:"nc-combo-dropdown",style:{position:"fixed",top:m==="top"?void 0:d.top,bottom:m==="top"?window.innerHeight-d.top:void 0,left:d.left,width:d.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:a("common.noResults")}):t.map((g,v)=>r.jsx(rt,{option:g,onChange:n,selected:g.value===s,highlighted:v===c,small:l},g.value))});return ae.createPortal(p,document.body)}function ot({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 it({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:c=!1,placement:d="bottom",size:f="default",style:m,className:w}){const[a,p]=u.useState(!1),[g,v]=u.useState(""),[h,y]=u.useState(-1),j=u.useRef(null),R=u.useRef(null),b=f==="small",{t:C}=q.useTranslation(),$=u.useMemo(()=>{const A=g.toLowerCase();return c?s.filter(M=>M.label.toLowerCase().includes(A)):s},[s,g,c]);u.useEffect(()=>{a&&y(-1)},[a,$]),u.useEffect(()=>{if(!l&&!e&&s.length>0&&t){const A=s.find(M=>M.default)||s[0];t(A.value)}},[l,e,s,t]),u.useEffect(()=>{function A(M){var T;M.target instanceof Node&&j.current&&((T=j.current.parentElement)!=null&&T.contains(M.target)||p(!1))}return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);const x=s.find(A=>A.value===e),S=x&&l,k=!o&&!S,E=!(a&&c)&&!!x,z=(A,M=!1)=>{var T;t==null||t(A),p(!1),v(""),M&&((T=j.current)==null||T.blur())},I=()=>{t==null||t(void 0),v(""),p(!1)},D=A=>{if(!a){(A.key==="ArrowDown"||A.key==="ArrowUp")&&(p(!0),A.preventDefault());return}switch(A.key){case"ArrowDown":A.preventDefault(),y(M=>{const T=M+1;return T>=$.length?0:T});break;case"ArrowUp":A.preventDefault(),y(M=>{const T=M-1;return T<0?$.length-1:T});break;case"Enter":A.preventDefault(),h>=0&&h<$.length&&z($[h].value,!0);break;case"Escape":A.preventDefault(),p(!1),v("");break}};return r.jsxs("div",{className:`nc-combo-container ${w||""}`.trim(),style:{position:"relative",...m},children:[i&&r.jsx("span",{className:`nc-label ${b?"nc-small":""}`,children:i}),r.jsxs("div",{ref:R,style:{position:"relative",display:"flex",alignItems:"center"},onMouseDown:A=>{o||c&&A.target===j.current||(p(M=>(!M&&c&&x&&v(x.label),!M)),c&&!a&&setTimeout(()=>{var M,T;(M=j.current)==null||M.focus(),(T=j.current)==null||T.select()},0))},children:[r.jsx("input",{ref:j,className:`nc-input ${b?"nc-small":""}`,placeholder:n,onFocus:()=>{var A;!o&&c&&(p(!0),x&&(v(x.label),setTimeout(()=>{var M;return(M=j.current)==null?void 0:M.select()},0))),c||(A=j.current)==null||A.blur()},onChange:A=>c&&v(A.target.value),onKeyDown:D,value:a&&c?g:(x==null?void 0:x.label)||"",readOnly:o||!c,style:{width:"100%",paddingRight:k||S?b?32:44:12,caretColor:c?void 0:"transparent",cursor:c?void 0:"pointer",userSelect:c?void 0:"none",color:E?"transparent":"var(--nc-text)"}}),E&&r.jsxs("div",{"aria-hidden":!0,style:{position:"absolute",left:b?8:12,right:k||S?b?12:24:b?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 ${b?"nc-small":""}`,children:x==null?void 0:x.label}),(x==null?void 0:x.default)&&r.jsxs("span",{className:`nc-combo-overlay-default ${b?"nc-small":""}`,children:["(",C("common.default"),")"]})]}),S&&r.jsx(ot,{onClick:I,small:b}),k&&r.jsx(it,{open:a,onClick:()=>p(A=>!A),small:b})]}),r.jsx(st,{isOpen:a,options:$,onSelect:z,selectedValue:e,placement:d,anchorRef:R,small:b,highlightedIndex:h})]})}function ct({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,c=t?"Refreshing...":"Refresh",d=t?"Refreshing":"Refresh";return r.jsx("button",{className:"nc-icon-button",onClick:e,disabled:n||t,title:o??c,"aria-label":i??d,"data-size":s,children:r.jsx(W.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(W.CloseIcon,{size:i})})}function lt({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(W.EditIcon,{size:i})})}function dt({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(W.TrashIcon,{size:i})})}function ut({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 pt({open:e,onClose:t,options:n,anchorRef:s,anchor:o,preferredDirection:i="down"}){const l=u.useRef(null),[c,d]=u.useState({top:0,left:0}),f=o||(s==null?void 0:s.current);if(u.useEffect(()=>{if(!e||!f||!l.current)return;const a=f.getBoundingClientRect(),p=l.current.getBoundingClientRect(),g=window.innerHeight,v=window.innerWidth,h=a.bottom+8,y=h+p.height<=g-8;let j=i;(!y&&i==="down"||i==="up"&&y)&&(j="up");let R;j==="down"?R=h:R=a.top-p.height-8;let b=a.left;b+p.width>v-8&&(b=a.right-p.width),d({top:Math.max(8,R),left:Math.max(8,b)})},[e,f,i]),u.useEffect(()=>{if(!e)return;const a=g=>{l.current&&!l.current.contains(g.target)&&f&&!f.contains(g.target)&&t()},p=g=>{g.key==="Escape"&&t()};return document.addEventListener("mousedown",a),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",p)}},[e,t,f]),!e)return null;const m=a=>{a.type!=="separator"&&!a.disabled&&a.onClick&&(a.onClick(),t())},w=n.some(a=>a.icon);return ae.createPortal(r.jsx("div",{ref:l,className:"nc-context-menu",style:{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,zIndex:1e4},role:"menu",children:n.map(a=>{if(a.type==="separator")return r.jsx("div",{className:"nc-context-menu-separator",role:"separator"},a.id);const p=["nc-context-menu-item",a.variant&&a.variant!=="default"?`nc-${a.variant}`:"",a.disabled?"nc-disabled":"",w&&!a.icon?"nc-indented":""].filter(Boolean).join(" ");return r.jsxs("button",{className:p,onClick:()=>m(a),disabled:a.disabled,role:"menuitem",children:[a.icon&&r.jsx("span",{className:"nc-context-menu-icon",children:a.icon}),r.jsx("span",{className:"nc-context-menu-label",children:a.label})]},a.id)})}),document.body)}const $e=u.createContext(null);function Pe(){const e=u.useContext($e);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 ft({open:e,onClose:t,title:n,children:s,style:o,footerType:i="ok-cancel",footer:l,onOk:c,onSave:d,onDelete:f,onCancel:m,onConnect:w,closeOnOverlay:a=!0,primaryDisabled:p=!1,fullScreen:g=!1,hideTitleBar:v=!1,className:h="",onContentHeightChange:y}){const j=u.useRef(null),R=u.useRef(null),{t:b}=q.useTranslation(),C={close:t},$=k=>{a&&k.target===k.currentTarget&&t()};if(u.useEffect(()=>{e&&j.current&&j.current.focus()},[e]),u.useEffect(()=>{if(!y||!R.current)return;const k=new ResizeObserver(E=>{for(const z of E){const I=z.contentRect.height;y(I)}});return k.observe(R.current),()=>{k.disconnect()}},[y]),!e)return null;const x=()=>{switch(i){case"ok":return r.jsx("div",{className:"nc-dialog-footer",children:r.jsx(H,{variant:"primary",onClick:c??t,disabled:p,children:b("common.ok")})});case"ok-cancel":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"primary",onClick:c??t,disabled:p,children:b("common.ok")}),r.jsx(U,{onClick:m,children:b("common.cancel")})]});case"save-cancel":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"primary",onClick:d,disabled:p,children:b("common.save")}),r.jsx(U,{onClick:m,children:b("common.cancel")})]});case"delete-cancel":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"danger",onClick:f,disabled:p,children:b("common.delete")}),r.jsx(U,{onClick:m,children:b("common.cancel")})]});case"connect":return r.jsxs("div",{className:"nc-dialog-footer",children:[r.jsx(H,{variant:"primary",onClick:w,disabled:p,children:b("common.connect")}),r.jsx(U,{onClick:m,children:b("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:b("common.gotit")})});case"custom":return r.jsx("div",{className:"nc-dialog-footer",children:l});case"none":return null;default:return null}},S=r.jsx($e.Provider,{value:C,children:r.jsx("div",{className:`nc-dialog-overlay${g?" nc-fullscreen":""}`,onClick:$,children:r.jsxs("div",{ref:j,className:`nc-dialog-container ${h}`,style:o,tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":v?void 0:"nc-dialog-title",children:[!v&&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:R,className:"nc-dialog-content",children:s}),x()]})})});return g?ae.createPortal(S,document.body):S}function ht({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 mt({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(W.EyeHiddenIcon,{size:o}):r.jsx(W.ViewIcon,{size:o})})}function gt({value:e,defaultValue:t="",onChange:n,onEnter:s,onClear:o,placeholder:i,disabled:l,label:c,clearable:d=!0,type:f="text",className:m="",size:w="default",style:a,showPasswordToggle:p=!1,multiline:g=!1,rows:v=3,validator:h,showErrorMessage:y=!0}){const j=u.useRef(null),R=u.useRef(null),[b,C]=u.useState(!1),[$,x]=u.useState(!1),S=e!==void 0,[k,E]=u.useState(t),z=S?e:k,I=h?h(z):null,D=!!I,A=f==="password",M=A&&p&&!l&&!g,T=d&&z&&!l&&$,Q=w==="small"?32:44;let F=12;T&&M?F=Q*2:(T||M)&&(F=Q);const _=()=>{var Z,re;S||E(""),n==null||n(""),o==null||o(),g?(Z=R.current)==null||Z.focus():(re=j.current)==null||re.focus()},ne=Z=>{Z.key==="Enter"&&!g&&(s==null||s())},B=Z=>{const re=Z.target.value;S||E(re),n==null||n(re)},ke=()=>{x(!0)},Ne=()=>{x(!1)},Se=`nc-input ${w==="small"?"nc-small ":""} ${D?"nc-error ":""}${m}`;return r.jsxs("div",{className:"nc-col",style:{position:"relative",flex:1,...a},children:[c&&r.jsx("span",{className:"nc-label",children:c}),r.jsxs("div",{style:{position:"relative",display:"flex",alignItems:g?"flex-start":"center"},children:[g?r.jsx("textarea",{ref:R,className:Se,placeholder:i,value:z,onChange:B,onKeyDown:ne,onFocus:ke,onBlur:Ne,disabled:l,rows:v,style:{width:"100%",paddingRight:F}}):r.jsx("input",{ref:j,type:A&&b?"text":f,className:Se,placeholder:i,value:z,onChange:B,onKeyDown:ne,onFocus:ke,onBlur:Ne,disabled:l,style:{width:"100%",paddingRight:F}}),T&&r.jsx(ht,{onClick:_,size:w,rightOffset:M?Q+4:4}),M&&r.jsx(mt,{visible:b,onClick:()=>C(!b),size:w})]}),D&&y&&r.jsx("span",{className:"nc-error-message",children:I})]})}function bt({children:e,onClick:t,showBorder:n=!0,selectable:s=!1,style:o}){const[i,l]=u.useState(!1),c=d=>{if(t){if(s){const f=window.getSelection();if(f&&f.toString().length>0)return}t(d)}};return r.jsx("div",{onClick:c,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 xt({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 vt({values:e,onChange:t,options:n,placeholder:s="Select…",label:o}){const[i,l]=u.useState(!1),[c,d]=u.useState(""),f=u.useRef(null),m=u.useMemo(()=>n.filter(a=>a.label.toLowerCase().includes(c.toLowerCase())),[n,c]);u.useEffect(()=>{function a(p){!(p.target instanceof Node)||!f.current||f.current.contains(p.target)||l(!1)}return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]);const w=a=>{e.includes(a)?t(e.filter(p=>p!==a)):t([...e,a])};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(a=>{const p=n.find(g=>g.value===a);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:()=>w(a),"aria-label":`Remove ${p.label}`,children:"✕"})]},a):null}),r.jsx("input",{className:"nc-input",value:c,onChange:a=>d(a.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:[m.map(a=>{const p=e.includes(a.value);return r.jsxs("div",{className:"nc-section nc-row",style:{justifyContent:"space-between",cursor:"pointer",padding:12},onMouseDown:()=>w(a.value),children:[r.jsx("span",{children:a.label}),r.jsx("span",{children:p?"✔️":""})]},a.value)}),m.length===0&&r.jsx("div",{className:"nc-section nc-label",children:"No results"})]})]})}function ce(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 Ae(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 Ce(){const e=new Date,t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0");return`${t}-${n}`}function wt({startMonth:e,endMonth:t,onChange:n,label:s,className:o="",disabled:i=!1}){const[l,c]=u.useState(!1),[d,f]=u.useState(""),[m,w]=u.useState(""),[a,p]=u.useState({top:0,left:0,width:0}),g=u.useRef(null),v=u.useRef(null);u.useEffect(()=>{if(l&&g.current){const E=g.current.getBoundingClientRect();p({top:E.bottom+4,left:E.left,width:E.width})}},[l]),u.useEffect(()=>{if(!l)return;const E=z=>{g.current&&!g.current.contains(z.target)&&v.current&&!v.current.contains(z.target)&&c(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[l]);const h=()=>{f(e||Ce()),w(t||Ce()),c(!0)},y=()=>{c(!1)},j=()=>{const E=ce(d),z=ce(m);if(E||z)return;const I=ie(d),D=ie(m);I&&D&&(n==null||n(I,D)),c(!1)},R=e&&t?`${Ae(e)} - ${Ae(t)}`:"Select month range",b=ce(d),C=ce(m),$=ie(d),x=ie(m),S=$&&x&&$>x,k=l?ae.createPortal(r.jsx("div",{ref:v,className:"nc-month-range-picker-popup",style:{position:"fixed",top:a.top,left:a.left,width:Math.max(a.width,400),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 ${b?"nc-error":""}`,value:d,onChange:E=>f(E.target.value),placeholder:"YY-M(M) or YYYY-M(M)"}),b&&r.jsx("div",{className:"nc-month-error-text",children:b})]}),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 ${C?"nc-error":""}`,value:m,onChange:E=>w(E.target.value),placeholder:"YY-M(M) or YYYY-M(M)"}),C&&r.jsx("div",{className:"nc-month-error-text",children:C})]})]}),S&&!b&&!C&&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:!d||!m||!!b||!!C||!!S,children:"Apply"}),r.jsx(H,{variant:"ghost",onClick:y,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:g,className:"nc-month-range-picker-input",onClick:h,disabled:i,children:R}),k]})}function yt({value:e,onChange:t,min:n,max:s,step:o=1,label:i,disabled:l,size:c="default"}){const d=c==="small",f=()=>{const a=e-o;n!==void 0&&a<n||t(parseFloat(a.toFixed(10)))},m=()=>{const a=e+o;s!==void 0&&a>s||t(parseFloat(a.toFixed(10)))},w=a=>{const p=parseFloat(a.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 ${d?"nc-small":""}`,children:[i&&r.jsx("span",{className:`nc-label ${d?"nc-small":""}`,children:i}),r.jsxs("div",{className:`nc-number-input-container ${d?"nc-small":""}`,children:[r.jsx("input",{className:`nc-input nc-number-input ${d?"nc-small":""}`,type:"number",value:e,onChange:w,min:n,max:s,step:o,disabled:l}),r.jsx("button",{className:`nc-button nc-ghost nc-number-input-button ${d?"nc-small":""}`,onClick:f,disabled:l||n!==void 0&&e<=n,children:"−"}),r.jsx("button",{className:`nc-button nc-ghost nc-number-input-button ${d?"nc-small":""}`,onClick:m,disabled:l||s!==void 0&&e>=s,children:"+"})]})]})}function jt({value:e,onChange:t,min:n=0,max:s=100,step:o=1,label:i,disabled:l,showValue:c=!0,formatValue:d=m=>m.toString(),width:f=200}){const m=a=>{const p=parseFloat(a.target.value);t(p)},w=(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:m,min:n,max:s,step:o,disabled:l,style:{width:f,"--nc-slider-percentage":`${w}%`}}),c&&r.jsx("span",{style:{color:"var(--nc-text)",fontFamily:"monospace",fontSize:14,minWidth:60,textAlign:"right"},children:d(e)})]})]})}const kt=({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 Te({children:e,className:t="",style:n}){return r.jsx("div",{className:`nc-tab-panel ${t}`,style:n,children:e})}function Nt({active:e,children:t,keepMounted:n=!1,className:s="",style:o}){const i=u.Children.toArray(t).filter(c=>u.isValidElement(c)&&(c.type===Te||c.type.displayName==="TabPanel"));if(n)return r.jsx("div",{className:`nc-tab-panels ${s}`,style:o,children:i.map(c=>{const d=c.props.tab===e;return r.jsx("div",{className:`nc-tab-panel-wrapper ${d?"nc-active":""}`,style:{display:d?void 0:"none"},"aria-hidden":!d,children:c},c.props.tab)})});const l=i.find(c=>c.props.tab===e);return r.jsx("div",{className:`nc-tab-panels ${s}`,style:o,children:l})}function St({tabs:e,active:t,onChange:n,className:s,toolbar:o,multiline:i,orientation:l="horizontal",style:c}){const d=u.useRef(null),[f,m]=u.useState(!1),[w,a]=u.useState(!1),p=l==="verticalLeft"||l==="verticalRight",g=u.useRef(!1),v=u.useRef(0),h=u.useRef(0),y=u.useRef(!1);u.useEffect(()=>{const x=()=>{if(d.current)if(p){const{scrollTop:k,scrollHeight:E,clientHeight:z}=d.current;m(k>1),a(k<E-z-1)}else{const{scrollLeft:k,scrollWidth:E,clientWidth:z}=d.current;m(k>1),a(k<E-z-1)}},S=d.current;if(S)return x(),S.addEventListener("scroll",x),window.addEventListener("resize",x),()=>{S.removeEventListener("scroll",x),window.removeEventListener("resize",x)}},[e,p]);const j=x=>{d.current&&(g.current=!0,y.current=!1,v.current=p?x.clientY:x.clientX,h.current=p?d.current.scrollTop:d.current.scrollLeft,d.current.style.cursor="grabbing",d.current.style.userSelect="none")},R=x=>{if(!g.current||!d.current)return;const S=p?x.clientY:x.clientX,k=v.current-S;Math.abs(k)>3&&(y.current=!0),p?d.current.scrollTop=h.current+k:d.current.scrollLeft=h.current+k},b=()=>{d.current&&(g.current=!1,d.current.style.cursor="",d.current.style.userSelect="")},C=()=>{b()};u.useEffect(()=>{const x=d.current;if(!x||p)return;const S=k=>{k.deltaY!==0&&(k.preventDefault(),x.scrollLeft+=k.deltaY*.3)};return x.addEventListener("wheel",S,{passive:!1}),()=>{x.removeEventListener("wheel",S)}},[p]);const $=x=>{y.current||n(x)};return r.jsxs("div",{className:`nc-tab-container ${p?`nc-vertical nc-${l}`:""} ${s||""}`,style:c,children:[r.jsxs("div",{className:"nc-tab-scroll-wrapper",children:[f&&r.jsx("div",{className:`nc-tab-scroll-indicator ${p?"nc-top":"nc-left"}`,children:p?r.jsx(kt,{size:16}):r.jsx(W.ChevronLeftIcon,{size:16})}),r.jsx("div",{ref:d,className:`nc-tab-scroll ${i?"nc-multiline":""}`,onMouseDown:j,onMouseMove:R,onMouseUp:b,onMouseLeave:C,style:{cursor:"grab"},children:e.map(x=>r.jsx("div",{className:`nc-tab-item ${t===x?"nc-active":""}`,onClick:()=>$(x),role:"button",tabIndex:0,onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&n(x)},children:p?x:x.toUpperCase()},x))}),w&&r.jsx("div",{className:`nc-tab-scroll-indicator ${p?"nc-bottom":"nc-right"}`,children:p?r.jsx(W.ChevronDownIcon,{size:16}):r.jsx(W.ChevronRightIcon,{size:16})})]}),o&&r.jsx("div",{className:"nc-tab-toolbar",children:o})]})}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"}})})]})}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 Ct(e){pe.add(e);try{e(X.notifications.slice())}catch{}return()=>{pe.delete(e)}}function It(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(()=>{ze(t)},n.lastingTime),t}function ze(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=()=>{ze(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(W.CloseIcon,{size:16})})]})})}function Rt(){const[e,t]=u.useState([]),[n,s]=u.useState(new Map),[o,i]=u.useState(new Set),l=u.useRef(null),c=u.useRef([]);return u.useEffect(()=>Ct(f=>{const m=new Set(c.current.map(a=>a.id)),w=f.filter(a=>!m.has(a.id)).map(a=>a.id);w.length>0?(t(f),i(new Set(w)),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i(new Set)})})):t(f),c.current=f}),[]),u.useEffect(()=>{if(!l.current)return;const d=new Map;let f=0;const m=l.current.children;e.forEach((w,a)=>{if(d.set(w.id,f),m[a]){const p=m[a].offsetHeight;w.isRemoving||(f+=p+12)}}),s(d)},[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(d=>{const f=o.has(d.id),m=d.isRemoving,w=n.get(d.id)||0;return r.jsx("div",{style:{position:"absolute",top:0,left:0,transform:f?"translateY(-120px)":`translateY(${w}px)`,transition:m?"opacity 300ms ease-out":"transform 300ms ease-out, opacity 300ms ease-out",opacity:m?0:1,width:"100%"},children:r.jsx(Be,{notification:d})},d.id)})})})}const Et={show:e=>It(e)};function Mt(e){const t=Xe.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 c=document.documentElement.lang||"en";t.changeLanguage(c)}}).observe(document.documentElement,{attributes:!0}),t}class $t{constructor(){O(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 $t,Re="nc-ui-app-state";class Pt{constructor(){O(this,"state");O(this,"listeners",new Map);this.state=this.loadState()}loadState(){try{const t=localStorage.getItem(Re);if(t)return JSON.parse(t)}catch{}return{activeAppId:null}}saveState(){try{localStorage.setItem(Re,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 V=new Pt;class Tt{constructor(){O(this,"apps",[]);O(this,"activeAppId",null);O(this,"listeners",new Set);O(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),V._setActiveAppId(t)),o.ref?o:this.waitForRef(t);const i={appId:t,launchedAt:Date.now()};return this.apps.push(i),s||(this.activeAppId=t,V._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,V._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(),V._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 L=new Tt,be=u.createContext(null);function Le(){const e=u.useContext(be);if(!e)throw new Error("useApp must be used inside an App");return e}function zt({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 De({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(zt,{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 Bt extends u.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]=u.useState(""),[c,d]=u.useState(null),[f,m]=u.useState(null),[w,a]=u.useState(!1),[p,g]=u.useState(!1);u.useEffect(()=>{o!=null&&o.titleKey&&l(s(o.titleKey))},[o,s]);const v=u.useCallback(k=>{l(k)},[]),h=u.useCallback(k=>{d(()=>k)},[]),y=u.useCallback(()=>{d(null)},[]),j=u.useCallback(k=>{m(k)},[]),R=u.useCallback(()=>{m(null)},[]),b=u.useCallback(k=>{a(k)},[]),C=u.useCallback(k=>{g(k)},[]),$=u.useMemo(()=>({setTitle:v,setBackHandler:h,clearBackHandler:y,setToolbar:j,clearToolbar:R,setHideBackButton:b,setHideTitleBar:C,close:n}),[v,h,y,j,R,b,C,n]);if(!o)return null;const x=o.component,S=!o.hideTitleBar&&!p;return r.jsxs("div",{style:{display:t?"flex":"none",flexDirection:"column",flex:1,minHeight:0},children:[S&&r.jsx(De,{title:i,onClose:n,onBack:c??void 0,toolbar:f,hideBackButton:w}),r.jsx("div",{className:S?"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:$,children:r.jsx(Bt,{appId:e,children:r.jsx(u.Suspense,{fallback:r.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",flex:1},children:r.jsx(me,{})}),children:r.jsx(x,{})})})})})]})}const le=768,de=1024,He={isMobile:!1,isTablet:!1,isDesktop:!0,width:typeof window<"u"?window.innerWidth:1024,height:typeof window<"u"?window.innerHeight:768},Ve=u.createContext(He);function Lt({children:e}){const[t,n]=u.useState(()=>{if(typeof window>"u")return He;const s=window.innerWidth,o=window.innerHeight;return{isMobile:s<le,isTablet:s>=le&&s<de,isDesktop:s>=de,width:s,height:o}});return u.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(Ve.Provider,{value:t,children:e})}function ve(){return u.useContext(Ve)}const we="-",Dt=e=>{const t=Vt(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:l=>{const c=l.split(we);return c[0]===""&&c.length!==1&&c.shift(),We(c,t)||Ht(l)},getConflictingClassGroupIds:(l,c)=>{const d=n[l]||[];return c&&s[l]?[...d,...s[l]]:d}}},We=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),o=s?We(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:c})=>c(i)))==null?void 0:l.classGroupId},Ee=/^\[(.+)\]$/,Ht=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}},Vt=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return Gt(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:Me(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(Wt(o)){he(o(s),t,n,s);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,l])=>{he(l,Me(t,i),n,s)})})},Me=(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},Wt=e=>e.isThemeGetter,Gt=(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,c])=>[t+l,c])):i);return[n,o]}):e,Ft=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="!",Ot=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,o=t[0],i=t.length,l=c=>{const d=[];let f=0,m=0,w;for(let h=0;h<c.length;h++){let y=c[h];if(f===0){if(y===o&&(s||c.slice(h,h+i)===t)){d.push(c.slice(m,h)),m=h+i;continue}if(y==="/"){w=h;continue}}y==="["?f++:y==="]"&&f--}const a=d.length===0?c:c.substring(m),p=a.startsWith(Ge),g=p?a.substring(1):a,v=w&&w>m?w-m:void 0;return{modifiers:d,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:v}};return n?c=>n({className:c,parseClassName:l}):l},Yt=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},Kt=e=>({cache:Ft(e.cacheSize),parseClassName:Ot(e),...Dt(e)}),qt=/\s+/,_t=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o}=t,i=[],l=e.trim().split(qt);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{modifiers:m,hasImportantModifier:w,baseClassName:a,maybePostfixModifierPosition:p}=n(f);let g=!!p,v=s(g?a.substring(0,p):a);if(!v){if(!g){c=f+(c.length>0?" "+c:c);continue}if(v=s(a),!v){c=f+(c.length>0?" "+c:c);continue}g=!1}const h=Yt(m).join(":"),y=w?h+Ge:h,j=y+v;if(i.includes(j))continue;i.push(j);const R=o(v,g);for(let b=0;b<R.length;++b){const C=R[b];i.push(y+C)}c=f+(c.length>0?" "+c:c)}return c};function Ut(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Fe(t))&&(s&&(s+=" "),s+=n);return s}const Fe=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Fe(e[s]))&&(n&&(n+=" "),n+=t);return n};function Xt(e,...t){let n,s,o,i=l;function l(d){const f=t.reduce((m,w)=>w(m),e());return n=Kt(f),s=n.cache.get,o=n.cache.set,i=c,c(d)}function c(d){const f=s(d);if(f)return f;const m=_t(d,n);return o(d,m),m}return function(){return i(Ut.apply(null,arguments))}}const P=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Oe=/^\[(?:([a-z-]+):)?(.+)\]$/i,Jt=/^\d+\/\d+$/,Qt=new Set(["px","full","screen"]),Zt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,en=/\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$/,tn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,nn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,G=e=>ee(e)||Qt.has(e)||Jt.test(e),Y=e=>te(e,"length",pn),ee=e=>!!e&&!Number.isNaN(Number(e)),ue=e=>te(e,"number",ee),se=e=>!!e&&Number.isInteger(Number(e)),sn=e=>e.endsWith("%")&&ee(e.slice(0,-1)),N=e=>Oe.test(e),K=e=>Zt.test(e),on=new Set(["length","size","percentage"]),an=e=>te(e,on,Ye),cn=e=>te(e,"position",Ye),ln=new Set(["image","url"]),dn=e=>te(e,ln,hn),un=e=>te(e,"",fn),oe=()=>!0,te=(e,t,n)=>{const s=Oe.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},pn=e=>en.test(e)&&!tn.test(e),Ye=()=>!1,fn=e=>nn.test(e),hn=e=>rn.test(e),mn=()=>{const e=P("colors"),t=P("spacing"),n=P("blur"),s=P("brightness"),o=P("borderColor"),i=P("borderRadius"),l=P("borderSpacing"),c=P("borderWidth"),d=P("contrast"),f=P("grayscale"),m=P("hueRotate"),w=P("invert"),a=P("gap"),p=P("gradientColorStops"),g=P("gradientColorStopPositions"),v=P("inset"),h=P("margin"),y=P("opacity"),j=P("padding"),R=P("saturate"),b=P("scale"),C=P("sepia"),$=P("skew"),x=P("space"),S=P("translate"),k=()=>["auto","contain","none"],E=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto",N,t],I=()=>[N,t],D=()=>["",G,Y],A=()=>["auto",ee,N],M=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],T=()=>["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"],F=()=>["start","end","center","between","around","evenly","stretch"],_=()=>["","0",N],ne=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>[ee,N];return{cacheSize:500,separator:":",theme:{colors:[oe],spacing:[G,Y],blur:["none","",K,N],brightness:B(),borderColor:[e],borderRadius:["none","","full",K,N],borderSpacing:I(),borderWidth:D(),contrast:B(),grayscale:_(),hueRotate:B(),invert:_(),gap:I(),gradientColorStops:[e],gradientColorStopPositions:[sn,Y],inset:z(),margin:z(),opacity:B(),padding:I(),saturate:B(),scale:B(),sepia:_(),skew:B(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",N]}],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:[...M(),N]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",se,N]}],basis:[{basis:z()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",N]}],grow:[{grow:_()}],shrink:[{shrink:_()}],order:[{order:["first","last","none",se,N]}],"grid-cols":[{"grid-cols":[oe]}],"col-start-end":[{col:["auto",{span:["full",se,N]},N]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[oe]}],"row-start-end":[{row:["auto",{span:[se,N]},N]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",N]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",N]}],gap:[{gap:[a]}],"gap-x":[{"gap-x":[a]}],"gap-y":[{"gap-y":[a]}],"justify-content":[{justify:["normal",...F()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...F(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...F(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[j]}],px:[{px:[j]}],py:[{py:[j]}],ps:[{ps:[j]}],pe:[{pe:[j]}],pt:[{pt:[j]}],pr:[{pr:[j]}],pb:[{pb:[j]}],pl:[{pl:[j]}],m:[{m:[h]}],mx:[{mx:[h]}],my:[{my:[h]}],ms:[{ms:[h]}],me:[{me:[h]}],mt:[{mt:[h]}],mr:[{mr:[h]}],mb:[{mb:[h]}],ml:[{ml:[h]}],"space-x":[{"space-x":[x]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[x]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",N,t]}],"min-w":[{"min-w":[N,t,"min","max","fit"]}],"max-w":[{"max-w":[N,t,"none","full","min","max","fit","prose",{screen:[K]},K]}],h:[{h:[N,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[N,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[N,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[N,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",N]}],"line-clamp":[{"line-clamp":["none",ee,ue]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",G,N]}],"list-image":[{"list-image":["none",N]}],"list-style-type":[{list:["none","disc","decimal",N]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...T(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",G,Y]}],"underline-offset":[{"underline-offset":["auto",G,N]}],"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:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",N]}],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",N]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...M(),cn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",an]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},dn]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"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:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...T(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:T()}],"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:["",...T()]}],"outline-offset":[{"outline-offset":[G,N]}],"outline-w":[{outline:[G,Y]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[G,Y]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",K,un]}],"shadow-color":[{shadow:[oe]}],opacity:[{opacity:[y]}],"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:[d]}],"drop-shadow":[{"drop-shadow":["","none",K,N]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[w]}],saturate:[{saturate:[R]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[w]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[R]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"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",N]}],duration:[{duration:B()}],ease:[{ease:["linear","in","out","in-out",N]}],delay:[{delay:B()}],animate:[{animate:["none","spin","ping","pulse","bounce",N]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[se,N]}],"translate-x":[{"translate-x":[S]}],"translate-y":[{"translate-y":[S]}],"skew-x":[{"skew-x":[$]}],"skew-y":[{"skew-y":[$]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",N]}],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",N]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"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",N]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[G,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"]}}},gn=Xt(mn);function Ke(...e){return gn(Je.clsx(e))}function bn({autoWidth:e=!0,className:t,style:n}){const[s,o]=u.useState(()=>V.getActiveAppId()),[i,l]=u.useState(()=>L.getRunningApps()),{isMobile:c}=ve();u.useEffect(()=>{const h=V.subscribe("activeAppId",y=>{o(y)});return()=>{h()}},[]),u.useEffect(()=>L.subscribe(()=>{l(L.getRunningApps())}),[]),u.useEffect(()=>{if(!new URLSearchParams(window.location.search).has("app")){const j=V.getActiveAppId();j&&!L.isRunning(j)&&L.launchApp(j)}},[]);const d=h=>{L.closeApp(h)},f=s?J.get(s):null,w=(f==null?void 0:f.width)??400,a=s!==null,v={...{overflow:"hidden",display:a?"flex":"none",flexDirection:"column",flexShrink:0,...e&&a?{width:c?"100%":w}:{}},...n};return r.jsx("div",{className:Ke("nc-app-panel",t),style:v,children:i.map(h=>r.jsx(xe,{appId:h.appId,isActive:s===h.appId,onClose:()=>d(h.appId)},h.appId))})}function xn({pinnedAppIds:e,className:t=""}){const{isMobile:n}=ve(),[s,o]=u.useState(()=>V.getActiveAppId()),[i,l]=u.useState(()=>L.getRunningApps());u.useEffect(()=>{const a=V.subscribe("activeAppId",p=>{o(p)});return()=>{a()}},[]),u.useEffect(()=>L.subscribe(()=>{l(L.getRunningApps())}),[]);const c=a=>{s===a?L.setActiveApp(null):L.launchApp(a)},d=e.map(a=>J.get(a)).filter(a=>!!a),f=i.filter(a=>!e.includes(a.appId)).map(a=>({running:a,def:J.get(a.appId)})).filter(a=>!!a.def),m=a=>i.some(p=>p.appId===a),w=n?24:28;return r.jsxs("div",{className:`nc-app-taskbar ${n?"nc-mobile":"nc-desktop"} ${t}`,children:[d.map(a=>{const p=a.icon,g=s===a.id,v=m(a.id);return r.jsxs("button",{className:`nc-app-taskbar-button ${g?"nc-active":""} ${v?"nc-running":""}`,onClick:()=>c(a.id),title:a.titleKey||a.id,children:[r.jsx(p,{size:w}),v&&r.jsx("span",{className:"nc-app-taskbar-indicator"})]},a.id)}),f.length>0&&r.jsx("div",{className:"nc-app-taskbar-separator"}),f.map(({running:a,def:p})=>{const g=p.icon,v=s===a.appId;return r.jsxs("button",{className:`nc-app-taskbar-button ${v?"nc-active":""} nc-running`,onClick:()=>c(a.appId),title:p.titleKey||p.id,children:[r.jsx(g,{size:w}),r.jsx("span",{className:"nc-app-taskbar-indicator"})]},a.appId)})]})}function vn({appId:e,open:t,onClose:n,closeOnBackdrop:s=!1,className:o="",style:i}){const l=d=>{s&&d.target===d.currentTarget&&n()};if(!t)return null;const c=r.jsx("div",{className:"nc-dialog-overlay nc-fullscreen",onClick:l,children:r.jsx("div",{className:`nc-app-dialog-container ${o}`,style:i,onClick:d=>d.stopPropagation(),children:r.jsx(xe,{appId:e,isActive:!0,onClose:n})})});return ae.createPortal(c,document.body)}const ye=u.createContext(null),qe=u.createContext(null);function wn(){const e=u.useContext(ye);if(!e)throw new Error("useNavStack must be used within a NavStackProvider");return e}function yn(){const e=u.useContext(qe);if(!e)throw new Error("useNavView must be used within NavStack");return e}const je=u.createContext(null);function jn({rootView:e,children:t}){const{t:n}=q.useTranslation(),s=Le(),[o,i]=u.useState([e]),[l,c]=u.useState([null]),d=u.useCallback((b,C)=>{c($=>{const x=[...$];return x[b]=C,x})},[]),f=u.useCallback(b=>{c(C=>{const $=[...C];return $[b]=null,$})},[]),m=u.useCallback(b=>{i(C=>[...C,b]),c(C=>[...C,null])},[]),w=u.useCallback(()=>{i(b=>b.length<=1?b:b.slice(0,-1)),c(b=>b.slice(0,-1))},[]),a=u.useCallback(()=>{i([e]),c([null])},[e]),p=o.length,g=p>1,v=o.length-1,h=o[o.length-1],y=h!=null&&h.titleKey?n(h.titleKey):(h==null?void 0:h.title)??"";u.useEffect(()=>{s.setTitle(y)},[y,s]),u.useEffect(()=>{g?s.setBackHandler(w):s.clearBackHandler()},[g,w,s]),u.useEffect(()=>{const b=l[l.length-1];b?s.setToolbar(b):s.clearToolbar()},[l,s]);const j={push:m,pop:w,reset:a,depth:p,canGoBack:g,currentTitle:y},R={stack:o,toolbarStack:l,updateToolbar:d,clearToolbarAt:f,topIndex:v};return r.jsx(ye.Provider,{value:j,children:r.jsx(je.Provider,{value:R,children:t})})}function kn({index:e,children:t}){const n=u.useContext(je);if(!n)throw new Error("NavViewProvider must be used within NavStackProvider");const{updateToolbar:s,clearToolbarAt:o,topIndex:i}=n,l=u.useCallback(f=>{e===i&&s(e,f)},[e,i,s]),c=u.useCallback(()=>{e===i&&o(e)},[e,i,o]),d={setToolbar:l,clearToolbar:c};return r.jsx(qe.Provider,{value:d,children:t})}function Nn(){const e=u.useContext(ye),t=u.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(kn,{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=Qe;exports.AppContainer=xe;exports.AppContext=be;exports.AppDialog=vn;exports.AppPanel=bn;exports.AppTaskbar=xn;exports.AppTitleBar=De;exports.Battery=Ze;exports.Button=H;exports.ButtonGroup=et;exports.Checkbox=nt;exports.CloseButton=ge;exports.ComboBox=at;exports.ContextMenu=pt;exports.Dialog=ft;exports.DialogClose=U;exports.EditButton=lt;exports.Hyperlink=ut;exports.Input=gt;exports.ListGroup=xt;exports.ListGroupItem=bt;exports.MonthRangePicker=wt;exports.MultiSelect=vt;exports.NavStackContainer=Nn;exports.NavStackProvider=jn;exports.Notification=Be;exports.NotificationContainer=Rt;exports.NumberInput=yt;exports.RefreshButton=ct;exports.Slider=jt;exports.TabPanel=Te;exports.TabPanels=Nt;exports.Tabs=St;exports.Toggle=At;exports.TrashButton=dt;exports.ViewportProvider=Lt;exports.appRegistry=J;exports.appStateStore=V;exports.cn=Ke;exports.createAppI18nFactory=Mt;exports.notificationManager=Et;exports.runningAppsStore=L;exports.useApp=Le;exports.useDialog=Pe;exports.useNavStack=wn;exports.useNavView=yn;exports.useViewport=ve;
|
|
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"),F=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,N=a+h+x,E=20,S=.65,$=Math.max(u,E*S),y=a+h+1,R=(u-E*S)/2;return r.jsxs("svg",{className:"nc-battery",width:N,height:$,viewBox:`0 0 ${N} ${$}`,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:N,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}, ${R}) scale(${S})`,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:N}=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 z;T.target instanceof Node&&m.current&&((z=m.current.parentElement)!=null&&z.contains(T.target)||f(!1))}return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[]);const S=s.find(M=>M.value===e),$=S&&l,y=!o&&!$,R=!(c&&a)&&!!S,C=(M,T=!1)=>{var z;t==null||t(M),f(!1),b(""),T&&((z=m.current)==null||z.blur())},I=()=>{t==null||t(void 0),b(""),f(!1)},B=M=>{if(!c){(M.key==="ArrowDown"||M.key==="ArrowUp")&&(f(!0),M.preventDefault());return}switch(M.key){case"ArrowDown":M.preventDefault(),k(T=>{const z=T+1;return z>=E.length?0:z});break;case"ArrowUp":M.preventDefault(),k(T=>{const z=T-1;return z<0?E.length-1:z});break;case"Enter":M.preventDefault(),w>=0&&w<E.length&&C(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&&S&&b(S.label),!T)),a&&!c&&setTimeout(()=>{var T,z;(T=m.current)==null||T.focus(),(z=m.current)==null||z.select()},0))},children:[r.jsx("input",{ref:m,className:`nc-input ${g?"nc-small":""}`,placeholder:n,onFocus:()=>{var M;!o&&a&&(f(!0),S&&(b(S.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:B,value:c&&a?v:(S==null?void 0:S.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:R?"transparent":"var(--nc-text)"}}),R&&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:S==null?void 0:S.label}),(S==null?void 0:S.default)&&r.jsxs("span",{className:`nc-combo-overlay-default ${g?"nc-small":""}`,children:["(",N("common.default"),")"]})]}),$&&r.jsx(it,{onClick:I,small:g}),y&&r.jsx(ct,{open:c,onClick:()=>f(M=>!M),small:g})]}),r.jsx(ot,{isOpen:c,options:E,onSelect:C,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(F.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(F.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(F.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(F.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(),N={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(R=>{for(const C of R){const I=C.contentRect.height;k(I)}});return y.observe(j.current),()=>{y.disconnect()}},[k]),!e)return null;const S=()=>{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:N,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}),S()]})})});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(F.EyeHiddenIcon,{size:o}):r.jsx(F.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,N]=d.useState(!1),[E,S]=d.useState(!1),$=e!==void 0,[y,R]=d.useState(t),C=$?e:y,I=w?w(C):null,B=!!I,M=h==="password",T=M&&f&&!l&&!v,z=u&&C&&!l&&E,Q=x==="small"?32:44;let G=12;z&&T?G=Q*2:(z||T)&&(G=Q);const _=()=>{var Z,re;$||R(""),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())},L=Z=>{const re=Z.target.value;$||R(re),n==null||n(re)},ke=()=>{S(!0)},Ne=()=>{S(!1)},Se=`nc-input ${x==="small"?"nc-small ":""} ${B?"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:C,onChange:L,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:C,onChange:L,onKeyDown:ne,onFocus:ke,onBlur:Ne,disabled:l,style:{width:"100%",paddingRight:G}}),z&&r.jsx(mt,{onClick:_,size:x,rightOffset:T?Q+4:4}),T&&r.jsx(gt,{visible:g,onClick:()=>N(!g),size:x})]}),B&&k&&r.jsx("span",{className:"nc-error-message",children:I})]})}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}),v=d.useRef(null),b=d.useRef(null);d.useEffect(()=>{if(l&&v.current){const R=v.current.getBoundingClientRect();f({top:R.bottom+4,left:R.left,width:R.width})}},[l]),d.useEffect(()=>{if(!l)return;const R=C=>{v.current&&!v.current.contains(C.target)&&b.current&&!b.current.contains(C.target)&&a(!1)};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[l]);const w=()=>{h(e||Ae()),x(t||Ae()),a(!0)},k=()=>{a(!1)},m=()=>{const R=ae(u),C=ae(p);if(R||C)return;const I=ie(u),B=ie(p);I&&B&&(n==null||n(I,B)),a(!1)},j=e&&t?`${Ce(e)} - ${Ce(t)}`:"Select month range",g=ae(u),N=ae(p),E=ie(u),S=ie(p),$=E&&S&&E>S,y=l?ce.createPortal(r.jsx("div",{ref:b,className:"nc-month-range-picker-popup",style:{position:"fixed",top:c.top,left:c.left,width:Math.max(c.width,400),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:R=>h(R.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 ${N?"nc-error":""}`,value:p,onChange:R=>x(R.target.value),placeholder:"YY-M(M) or YYYY-M(M)"}),N&&r.jsx("div",{className:"nc-month-error-text",children:N})]})]}),$&&!g&&!N&&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||!!N||!!$,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:C,scrollHeight:I,clientHeight:B}=p.current;c(C>1),v(C<I-B-1)}else{const{scrollLeft:C,scrollWidth:I,clientWidth:B}=p.current;c(C>1),v(C<I-B-1)}},R=p.current;if(R)return y(),R.addEventListener("scroll",y),window.addEventListener("resize",y),()=>{R.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")},N=y=>{if(!w.current||!p.current)return;const R=b?y.clientY:y.clientX,C=k.current-R;Math.abs(C)>3&&(j.current=!0),b?p.current.scrollTop=m.current+C:p.current.scrollLeft=m.current+C},E=()=>{p.current&&(w.current=!1,p.current.style.cursor="",p.current.style.userSelect="")},S=()=>{E()};d.useEffect(()=>{const y=p.current;if(!y||b)return;const R=C=>{C.deltaY!==0&&(C.preventDefault(),y.scrollLeft+=C.deltaY*.3)};return y.addEventListener("wheel",R,{passive:!1}),()=>{y.removeEventListener("wheel",R)}},[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(F.ChevronLeftIcon,{size:16})}),r.jsx("div",{ref:p,className:`nc-tab-scroll ${a?"nc-multiline":""}`,onMouseDown:g,onMouseMove:N,onMouseUp:E,onMouseLeave:S,style:{cursor:"grab"},children:e.map(y=>{const R=s&&!(o!=null&&o.includes(y));return r.jsxs("div",{className:`nc-tab-item ${t===y?"nc-active":""} ${R?"nc-closable":""}`,onClick:()=>$(y),role:"button",tabIndex:0,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&n(y)},children:[r.jsx("span",{className:"nc-tab-label",children:b?y:y.toUpperCase()}),R&&r.jsx("span",{className:"nc-tab-close",role:"button",tabIndex:0,"aria-label":`Close ${y}`,onClick:C=>{C.stopPropagation(),s(y)},onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.stopPropagation(),s(y))},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"})]})})]},y)})}),f&&r.jsx("div",{className:`nc-tab-scroll-indicator ${b?"nc-bottom":"nc-right"}`,children:b?r.jsx(F.ChevronDownIcon,{size:16}):r.jsx(F.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
|
+
`),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 x=0;x<i-1;x++)l+=o[x].length+1;const u=o[i-1].split(" "),h=Math.max(1,Math.min(n,u.length));for(let x=0;x<h-1;x++)l+=u[x].length+1;const p=Math.max(1,Math.min(s,u[h-1].length+1));return l+=p-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},h){const p=d.useRef(null),x=d.useRef(null),c=d.useRef(null);d.useImperativeHandle(h,()=>({goToLine(m){const j=p.current;if(!j)return;const g=Mt(t,m);j.focus(),j.setSelectionRange(g,g);const N=parseFloat(getComputedStyle(j).lineHeight)||18;j.scrollTop=(Math.max(1,m)-1)*N,v(),f()},goToPosition(m,j,g){const N=p.current;if(!N)return;const E=It(t,m,j,g);N.focus(),N.setSelectionRange(E,E);const S=parseFloat(getComputedStyle(N).lineHeight)||18;N.scrollTop=(Math.max(1,m)-1)*S,v(),f()}}),[t]);const f=d.useCallback(()=>{if(!a||!p.current)return;const m=Rt(t,p.current.selectionStart);a(m)},[a,t]),v=d.useCallback(()=>{const m=p.current;m&&(x.current&&(x.current.scrollTop=m.scrollTop,x.current.scrollLeft=m.scrollLeft),c.current&&(c.current.scrollTop=m.scrollTop))},[]);d.useEffect(()=>{if(u==null||u<1)return;const m=p.current;if(!m)return;const j=parseFloat(getComputedStyle(m).lineHeight)||18,g=(u-1)*j,N=g+j;(g<m.scrollTop||N>m.scrollTop+m.clientHeight)&&(m.scrollTop=g-m.clientHeight/2+j/2),v()},[u]);const b=d.useMemo(()=>t.split(`
|
|
5
|
+
`).length,[t]),w=()=>{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((g,N)=>{const E=g.split(" ");return r.jsxs("div",{className:`nc-csv-line ${u===N+1?"nc-csv-highlight":""}`,children:[E.map((S,$)=>r.jsxs("span",{children:[$>0&&r.jsx("span",{className:"nc-csv-tab-char",children:" "}),r.jsx("span",{style:{color:Re[$%Re.length]},children:S})]},$)),g===""&&`
|
|
7
|
+
`]},N)}):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(()=>{Be(t)},n.lastingTime),t}function Be(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 Le({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=()=>{Be(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(F.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(Le,{notification:u})},u.id)})})})}const zt={show:e=>Tt(e)};function Bt(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 Lt{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 Lt,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 O=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),O._setActiveAppId(t)),o.ref?o:this.waitForRef(t);const i={appId:t,launchedAt:Date.now()};return this.apps.push(i),s||(this.activeAppId=t,O._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,O._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(),O._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 Ot({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(Ot,{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 Ft 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)},[]),N=d.useCallback(y=>{v(y)},[]),E=d.useMemo(()=>({setTitle:b,setBackHandler:w,clearBackHandler:k,setToolbar:m,clearToolbar:j,setHideBackButton:g,setHideTitleBar:N,close:n}),[b,w,k,m,j,g,N,n]);if(!o)return null;const S=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(Ft,{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(S,{})})})})})]})}const le=768,de=1024,Oe={isMobile:!1,isTablet:!1,isDesktop:!0,width:typeof window<"u"?window.innerWidth:1024,height:typeof window<"u"?window.innerHeight:768},Fe=d.createContext(Oe);function Wt({children:e}){const[t,n]=d.useState(()=>{if(typeof window>"u")return Oe;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(Fe.Provider,{value:t,children:e})}function ve(){return d.useContext(Fe)}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(),We(a,t)||Vt(l)},getConflictingClassGroupIds:(l,a)=>{const u=n[l]||[];return a&&s[l]?[...u,...s[l]]:u}}},We=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),o=s?We(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 N=j[g];i.push(k+N)}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))\(.+\)$/,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)\(.+\)$/,W=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)),A=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"),N=P("sepia"),E=P("skew"),S=P("space"),$=P("translate"),y=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto",A,t],I=()=>[A,t],B=()=>["",W,Y],M=()=>["auto",ee,A],T=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],z=()=>["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",A],ne=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>[ee,A];return{cacheSize:500,separator:":",theme:{colors:[oe],spacing:[W,Y],blur:["none","",K,A],brightness:L(),borderColor:[e],borderRadius:["none","","full",K,A],borderSpacing:I(),borderWidth:B(),contrast:L(),grayscale:_(),hueRotate:L(),invert:_(),gap:I(),gradientColorStops:[e],gradientColorStopPositions:[dn,Y],inset:C(),margin:C(),opacity:L(),padding:I(),saturate:L(),scale:L(),sepia:_(),skew:L(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",A]}],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(),A]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],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,A]}],basis:[{basis:C()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",A]}],grow:[{grow:_()}],shrink:[{shrink:_()}],order:[{order:["first","last","none",se,A]}],"grid-cols":[{"grid-cols":[oe]}],"col-start-end":[{col:["auto",{span:["full",se,A]},A]}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":[oe]}],"row-start-end":[{row:["auto",{span:[se,A]},A]}],"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",A]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",A]}],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":[S]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[S]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",A,t]}],"min-w":[{"min-w":[A,t,"min","max","fit"]}],"max-w":[{"max-w":[A,t,"none","full","min","max","fit","prose",{screen:[K]},K]}],h:[{h:[A,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[A,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[A,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[A,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",A]}],"line-clamp":[{"line-clamp":["none",ee,ue]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",W,A]}],"list-image":[{"list-image":["none",A]}],"list-style-type":[{list:["none","disc","decimal",A]}],"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:[...z(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",W,Y]}],"underline-offset":[{"underline-offset":["auto",W,A]}],"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:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",A]}],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",A]}],"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:[...z(),"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:z()}],"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:["",...z()]}],"outline-offset":[{"outline-offset":[W,A]}],"outline-w":[{outline:[W,Y]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[W,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,A]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[x]}],saturate:[{saturate:[j]}],sepia:[{sepia:[N]}],"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":[N]}],"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",A]}],duration:[{duration:L()}],ease:[{ease:["linear","in","out","in-out",A]}],delay:[{delay:L()}],animate:[{animate:["none","spin","ping","pulse","bounce",A]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[g]}],"scale-x":[{"scale-x":[g]}],"scale-y":[{"scale-y":[g]}],rotate:[{rotate:[se,A]}],"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",A]}],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",A]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"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",A]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[W,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(()=>O.getActiveAppId()),[i,l]=d.useState(()=>D.getRunningApps()),{isMobile:a}=ve();d.useEffect(()=>{const w=O.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=O.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(()=>O.getActiveAppId()),[i,l]=d.useState(()=>D.getRunningApps());d.useEffect(()=>{const c=O.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,N)=>{a(E=>{const S=[...E];return S[g]=N,S})},[]),h=d.useCallback(g=>{a(N=>{const E=[...N];return E[g]=null,E})},[]),p=d.useCallback(g=>{i(N=>[...N,g]),a(N=>[...N,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=Le;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=Wt;exports.appRegistry=J;exports.appStateStore=O;exports.cn=qe;exports.createAppI18nFactory=Bt;exports.notificationManager=zt;exports.runningAppsStore=D;exports.useApp=De;exports.useDialog=Pe;exports.useNavStack=Sn;exports.useNavView=Cn;exports.useViewport=ve;
|
|
2
8
|
//# sourceMappingURL=index.cjs.map
|