@kingsimba/nc-ui 0.1.23 → 0.1.25
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 +54 -53
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,18 +29,20 @@ pnpm add @kingsimba/nc-ui
|
|
|
29
29
|
## Quick Start
|
|
30
30
|
|
|
31
31
|
```tsx
|
|
32
|
-
import { Button, ActivityIndicator } from
|
|
33
|
-
import
|
|
32
|
+
import { Button, ActivityIndicator } from "@kingsimba/nc-ui";
|
|
33
|
+
import "@kingsimba/nc-ui/styles.css";
|
|
34
34
|
|
|
35
35
|
function App() {
|
|
36
36
|
return (
|
|
37
37
|
<div>
|
|
38
38
|
<Button variant="primary">Click me</Button>
|
|
39
|
-
<Button variant="danger" size="small">
|
|
39
|
+
<Button variant="danger" size="small">
|
|
40
|
+
Delete
|
|
41
|
+
</Button>
|
|
40
42
|
<Button loading>Saving...</Button>
|
|
41
43
|
<ActivityIndicator size="large" />
|
|
42
44
|
</div>
|
|
43
|
-
)
|
|
45
|
+
);
|
|
44
46
|
}
|
|
45
47
|
```
|
|
46
48
|
|
|
@@ -49,7 +51,7 @@ function App() {
|
|
|
49
51
|
Icons are imported from a separate entry point to keep the main bundle size small:
|
|
50
52
|
|
|
51
53
|
```tsx
|
|
52
|
-
import { CloseIcon, EditIcon, TrashIcon } from
|
|
54
|
+
import { CloseIcon, EditIcon, TrashIcon } from "@kingsimba/nc-ui/icons";
|
|
53
55
|
|
|
54
56
|
function MyComponent() {
|
|
55
57
|
return (
|
|
@@ -58,7 +60,7 @@ function MyComponent() {
|
|
|
58
60
|
<EditIcon size={20} color="#3b82f6" />
|
|
59
61
|
<TrashIcon size={18} />
|
|
60
62
|
</div>
|
|
61
|
-
)
|
|
63
|
+
);
|
|
62
64
|
}
|
|
63
65
|
```
|
|
64
66
|
|
|
@@ -68,33 +70,33 @@ function MyComponent() {
|
|
|
68
70
|
|
|
69
71
|
nc-ui provides 23+ ready-to-use components. Click any component to see it in the interactive demo:
|
|
70
72
|
|
|
71
|
-
| Component
|
|
72
|
-
|
|
73
|
-
| [ActivityIndicator](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=activity)
|
|
74
|
-
| [Alert](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=alert)
|
|
75
|
-
| [AppDialog](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=app-dialog)
|
|
76
|
-
| [Battery](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=battery)
|
|
77
|
-
| [Button](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=buttons)
|
|
78
|
-
| [ButtonGroup](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=button-group)
|
|
79
|
-
| [Checkbox](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=checkbox)
|
|
80
|
-
| [CommonButtons](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=buttons-icon)
|
|
81
|
-
| [ComboBox](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=combobox)
|
|
82
|
-
| [ContextMenu](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=context-menu)
|
|
83
|
-
| [CsvTextArea](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=csv-textarea)
|
|
84
|
-
| [Dialog](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=dialog)
|
|
85
|
-
| [Hyperlink](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=hyperlink)
|
|
86
|
-
| [Icons](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=icons)
|
|
87
|
-
| [Input](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=input)
|
|
88
|
-
| [ListGroup](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=list-group)
|
|
89
|
-
| [MonthRangePicker](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=month-range) | Month range selector with validation (YY-M(M) or YYYY-M(M) format)
|
|
90
|
-
| [MultiSelect](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=multi-select)
|
|
91
|
-
| [NavStack](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=nav-stack)
|
|
92
|
-
| [Notification](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=notification)
|
|
93
|
-
| [NumberInput](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=number-input)
|
|
94
|
-
| [Slider](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=slider)
|
|
95
|
-
| [Tabs](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=tabs)
|
|
96
|
-
| [Toggle](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=toggle)
|
|
97
|
-
| [YamlTextArea](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=yaml-textarea)
|
|
73
|
+
| Component | Description |
|
|
74
|
+
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
|
|
75
|
+
| [ActivityIndicator](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=activity) | Loading spinner with size variants and overlay mode |
|
|
76
|
+
| [Alert](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=alert) | Status banners with simple content, optional dismissal, and legacy code/text support |
|
|
77
|
+
| [AppDialog](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=app-dialog) | Render any registered app inside a dialog overlay |
|
|
78
|
+
| [Battery](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=battery) | Visual battery level indicator |
|
|
79
|
+
| [Button](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=buttons) | Primary action button with variants, sizes, and loading states |
|
|
80
|
+
| [ButtonGroup](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=button-group) | Segmented control for switching between predefined options |
|
|
81
|
+
| [Checkbox](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=checkbox) | Toggle selection with indeterminate state support |
|
|
82
|
+
| [CommonButtons](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=buttons-icon) | Pre-configured buttons (Close, Edit, Refresh, Trash) |
|
|
83
|
+
| [ComboBox](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=combobox) | Searchable dropdown with autocomplete |
|
|
84
|
+
| [ContextMenu](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=context-menu) | Right-click menu with customizable items |
|
|
85
|
+
| [CsvTextArea](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=csv-textarea) | Tab-separated text editor with per-column color highlighting |
|
|
86
|
+
| [Dialog](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=dialog) | Modal dialogs with header, footer, and action buttons |
|
|
87
|
+
| [Hyperlink](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=hyperlink) | Styled anchor/link component |
|
|
88
|
+
| [Icons](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=icons) | 50+ SVG icons (separate import path) |
|
|
89
|
+
| [Input](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=input) | Text input with validation states and prefix/suffix support |
|
|
90
|
+
| [ListGroup](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=list-group) | Grouped content sections built from `ListGroupItem` children |
|
|
91
|
+
| [MonthRangePicker](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=month-range) | Month range selector with validation (YY-M(M) or YYYY-M(M) format) |
|
|
92
|
+
| [MultiSelect](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=multi-select) | Multi-selection dropdown with tag display |
|
|
93
|
+
| [NavStack](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=nav-stack) | Stack-based navigation for mobile-style settings UIs |
|
|
94
|
+
| [Notification](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=notification) | Toast-style notifications with auto-dismiss and stacking |
|
|
95
|
+
| [NumberInput](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=number-input) | Numeric input with increment/decrement controls |
|
|
96
|
+
| [Slider](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=slider) | Range slider with value display |
|
|
97
|
+
| [Tabs](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=tabs) | Tabbed navigation component |
|
|
98
|
+
| [Toggle](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=toggle) | Switch/toggle with on/off states |
|
|
99
|
+
| [YamlTextArea](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=yaml-textarea) | YAML editor with syntax highlighting and validation |
|
|
98
100
|
|
|
99
101
|
## App Framework
|
|
100
102
|
|
|
@@ -111,37 +113,37 @@ nc-ui includes a complete framework for building panel-based applications that r
|
|
|
111
113
|
### Quick Example
|
|
112
114
|
|
|
113
115
|
```tsx
|
|
114
|
-
import React from
|
|
115
|
-
import { appRegistry, runningAppsStore, useApp } from
|
|
116
|
-
import { MyAppIcon } from
|
|
116
|
+
import React from "react";
|
|
117
|
+
import { appRegistry, runningAppsStore, useApp } from "@kingsimba/nc-ui";
|
|
118
|
+
import { MyAppIcon } from "./MyAppIcon";
|
|
117
119
|
|
|
118
120
|
// 1. Create your app component
|
|
119
121
|
function MyApp() {
|
|
120
|
-
const { setTitle, close } = useApp()
|
|
121
|
-
|
|
122
|
+
const { setTitle, close } = useApp();
|
|
123
|
+
|
|
122
124
|
return (
|
|
123
125
|
<div>
|
|
124
126
|
<h1>My App</h1>
|
|
125
127
|
<button onClick={close}>Close</button>
|
|
126
128
|
</div>
|
|
127
|
-
)
|
|
129
|
+
);
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
// 2. Register the app (with lazy loading)
|
|
131
|
-
const LazyMyApp = React.lazy(() =>
|
|
132
|
-
import(
|
|
133
|
-
)
|
|
133
|
+
const LazyMyApp = React.lazy(() =>
|
|
134
|
+
import("./MyApp").then((m) => ({ default: m.MyApp })),
|
|
135
|
+
);
|
|
134
136
|
|
|
135
137
|
appRegistry.register({
|
|
136
|
-
id:
|
|
137
|
-
titleKey:
|
|
138
|
+
id: "my-app",
|
|
139
|
+
titleKey: "apps.myApp.name",
|
|
138
140
|
icon: MyAppIcon,
|
|
139
141
|
component: LazyMyApp,
|
|
140
142
|
width: 400,
|
|
141
|
-
})
|
|
143
|
+
});
|
|
142
144
|
|
|
143
145
|
// 3. Launch the app
|
|
144
|
-
await runningAppsStore.launchApp(
|
|
146
|
+
await runningAppsStore.launchApp("my-app");
|
|
145
147
|
```
|
|
146
148
|
|
|
147
149
|
### App-Specific i18n
|
|
@@ -149,20 +151,20 @@ await runningAppsStore.launchApp('my-app')
|
|
|
149
151
|
Each app can have isolated translations that won't conflict with other apps:
|
|
150
152
|
|
|
151
153
|
```tsx
|
|
152
|
-
import { createAppI18nFactory } from
|
|
153
|
-
import { I18nextProvider } from
|
|
154
|
+
import { createAppI18nFactory } from "@kingsimba/nc-ui";
|
|
155
|
+
import { I18nextProvider } from "react-i18next";
|
|
154
156
|
|
|
155
157
|
const myAppI18n = createAppI18nFactory({
|
|
156
|
-
en: { title:
|
|
157
|
-
zh: { title:
|
|
158
|
-
})
|
|
158
|
+
en: { title: "My App", save: "Save" },
|
|
159
|
+
zh: { title: "我的应用", save: "保存" },
|
|
160
|
+
});
|
|
159
161
|
|
|
160
162
|
export function MyApp() {
|
|
161
163
|
return (
|
|
162
164
|
<I18nextProvider i18n={myAppI18n}>
|
|
163
165
|
<MyAppContent />
|
|
164
166
|
</I18nextProvider>
|
|
165
|
-
)
|
|
167
|
+
);
|
|
166
168
|
}
|
|
167
169
|
```
|
|
168
170
|
|
|
@@ -228,4 +230,3 @@ All CSS classes and variables use `nc-` prefix to avoid conflicts:
|
|
|
228
230
|
- Variables: `--nc-primary`, `--nc-button-bg`, etc.
|
|
229
231
|
- Classes: `.nc-button`, `.nc-activity-indicator`, etc.
|
|
230
232
|
- Modifiers: `.nc-primary`, `.nc-small`, `.nc-loading`, etc.
|
|
231
|
-
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Ze=Object.defineProperty;var et=(e,t,r)=>t in e?Ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Y=(e,t,r)=>et(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),O=require("./GeneratedIcons-CGjL38ny.cjs"),l=require("react"),ie=require("react-dom"),_=require("react-i18next"),tt=require("i18next"),nt=require("./clsx-C11secjj.cjs");function me({size:e="default",color:t,overlay:r=!1,className:s=""}){const o=n.jsx("svg",{className:`nc-activity-indicator nc-${e} ${s}`,viewBox:"0 0 50 50",style:t?{color:t}:void 0,children:n.jsx("circle",{className:"nc-activity-indicator-circle",cx:"25",cy:"25",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round"})});return r?n.jsx("div",{className:"nc-activity-indicator-overlay",children:o}):o}function F({variant:e="default",block:t,size:r="default",appearance:s="default",className:o,disabled:i,textSelectable:c,loading:a,onClick:d,children:f,...h}){const b=["nc-button",e!=="default"?`nc-${e}`:"",t?"nc-block":"",r==="small"?"nc-small":"",r==="large"?"nc-large":"",s==="transparent"?"nc-transparent":"",i||a?"nc-disabled":"",c?"nc-text-selectable":"",a?"nc-loading":"",o??""].filter(Boolean).join(" "),u=p=>{if(!a){if(c){const g=window.getSelection();if(g&&g.toString().length>0)return}d==null||d(p)}};return n.jsxs("button",{className:b,disabled:i||a,onClick:u,...h,children:[a&&n.jsx(me,{size:"small",className:"nc-button-spinner",color:s==="transparent"||e!=="default"&&e!=="ghost"?"white":void 0}),f]})}const rt={info:"primary",success:"success",warning:"warning",error:"danger",danger:"danger"};function st({code:e,text:t,type:r,button:s,onAction:o,children:i,onClose:c,className:a="",style:d}){const f=i??n.jsxs(n.Fragment,{children:[e!==void 0&&n.jsx("span",{className:"nc-alert-code",children:e}),t]});return n.jsxs("div",{className:`nc-alert nc-${r} ${a}`.trim(),style:d,children:[n.jsxs("div",{className:"nc-alert-main",children:[n.jsx("div",{className:`nc-alert-message nc-${r}`,children:f}),c&&n.jsx("button",{type:"button",className:"nc-alert-close","aria-label":"Close alert",onClick:c,children:n.jsx(O.CloseIcon,{size:16})})]}),s&&n.jsx("span",{className:"nc-alert-action",children:n.jsx(F,{size:"small",variant:s.variant??rt[r],onClick:o,children:s.text})})]})}function ot({percentage:e=.5,status:t="discharging",darkMode:r=!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=r?"#ffffff":"#000000";const c=r?"rgba(255, 255, 255, 0.5)":"rgba(0, 0, 0, 0.2)",a=24,d=14,f=2,h=0,b=12,u=0,p=0,g=0,m=a,x=d,j=x-u*2,v=m-u*2,k=Math.max(1,Math.min(4,x/4)),w=o===0?0:.05+o*.95,N=a+f+b,A=20,P=.65,E=Math.max(d,A*P),y=a+f+1,M=(d-A*P)/2;return n.jsxs("svg",{className:"nc-battery",width:N,height:E,viewBox:`0 0 ${N} ${E}`,role:"img","aria-label":`Battery ${o===0?"-":Math.round(o*100)+"%"} ${t}`,children:[n.jsxs("defs",{children:[n.jsx("mask",{id:`nc-battery-fill-mask-${o}`,children:n.jsx("rect",{x:"0",y:"0",width:v*w,height:j,fill:"white"})}),n.jsxs("mask",{id:`nc-battery-text-mask-${o}`,children:[n.jsx("rect",{x:"0",y:"0",width:N,height:E,fill:"white"}),n.jsx("text",{x:p+m/2,y:d-3,fontSize:11,fontWeight:"bold",fill:"black",textAnchor:"middle",children:o===0?"-":Math.round(o*100)})]})]}),n.jsxs("g",{mask:`url(#nc-battery-text-mask-${o})`,children:[n.jsx("rect",{x:p,y:g,rx:k,ry:k,width:m,height:x,fill:c}),n.jsx("rect",{x:p+u,y:g+u,width:v,height:j,fill:i,rx:k,ry:k,mask:`url(#nc-battery-fill-mask-${o})`}),n.jsx("rect",{x:a+h,y:d*.26,width:f,height:d*.48,rx:.8,ry:.8,fill:o===1?i:c}),t==="charging"?n.jsx("g",{transform:`translate(${y}, ${M}) scale(${P})`,fill:i,children:n.jsx("path",{d:"M10 0 L2 11 H8 L5 20 L14 8 H8 L10 0 Z"})}):null]})]})}function it({value:e,onChange:t,options:r,disabled:s,size:o="default"}){return n.jsx("div",{className:`nc-button-group ${o==="small"?"nc-small":""}`,children:r.map((i,c)=>{const a=s||!!i.disabled;return n.jsx("button",{className:`nc-button-group-item ${e===i.key?"nc-active":""} ${c<r.length-1?"nc-has-border":""}`,onClick:()=>!a&&t(i.key),disabled:a,children:i.label},i.key)})})}function at({size:e}){return n.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:n.jsx("path",{d:"M2 6L5 9L10 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function ct({checked:e,onChange:t,disabled:r,label:s,size:o="default",labelColor:i,style:c,className:a=""}){const d=o==="small";return n.jsxs("label",{className:`nc-checkbox-label ${d?"nc-small":""} ${r?"nc-disabled":""} ${a}`.trim(),style:c,onClick:f=>{r||(f.preventDefault(),t(!e))},children:[n.jsx("span",{role:"checkbox","aria-checked":e,tabIndex:0,className:`nc-checkbox-box ${d?"nc-small":""} ${e?"nc-checked":""}`,onKeyDown:f=>{r||(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),t(!e))},children:e&&n.jsx(at,{size:o})}),s&&n.jsx("span",{className:"nc-checkbox-text",style:i?{color:i}:void 0,children:s})]})}function lt({option:e,onChange:t,selected:r,highlighted:s,small:o}){const i=l.useRef(null),{t:c}=_.useTranslation();return l.useEffect(()=>{s&&i.current&&i.current.scrollIntoView({block:"nearest"})},[s]),n.jsxs("div",{ref:i,className:`nc-combo-dropdown-option ${o?"nc-small":""} ${s?"nc-highlighted":""}`,role:"option",onMouseDown:()=>t(e.value),"aria-selected":r,style:{cursor:"pointer",background:s?"rgba(59,130,246,0.18)":r?"rgba(59,130,246,0.12)":void 0},children:[e.label,e.default&&n.jsxs("span",{style:{fontSize:"0.85em",color:"var(--nc-text-weak)",marginLeft:6},children:["(",c("common.default"),")"]})]})}function dt({isOpen:e,options:t,onSelect:r,selectedValue:s,placement:o="bottom",anchorRef:i,small:c,highlightedIndex:a=-1}){const[d,f]=l.useState({top:0,left:0,width:0}),[h,b]=l.useState(o),{t:u}=_.useTranslation();if(l.useEffect(()=>{if(e&&i.current){const g=i.current.getBoundingClientRect();let m=o;if(o==="bottom"){const x=window.innerHeight-g.bottom,j=g.top;x<320&&j>x&&(m="top")}b(m),f({top:m==="top"?g.top-4:g.bottom+4,left:g.left,width:g.width})}},[e,i,o]),!e)return null;const p=n.jsx("div",{className:"nc-combo-dropdown",style:{position:"fixed",top:h==="top"?void 0:d.top,bottom:h==="top"?window.innerHeight-d.top:void 0,left:d.left,width:d.width,zIndex:1e3,maxHeight:300,overflowY:"auto"},children:t.length===0?n.jsx("div",{className:`nc-combo-dropdown-option nc-no-results ${c?"nc-small":""}`,children:u("common.noResults")}):t.map((g,m)=>n.jsx(lt,{option:g,onChange:r,selected:g.value===s,highlighted:m===a,small:c},g.value))});return ie.createPortal(p,document.body)}function ut({onClick:e,small:t}){return n.jsx("button",{className:`nc-button nc-ghost nc-combo-button nc-combo-clear ${t?"nc-small":""}`,onClick:e,onMouseDown:r=>r.stopPropagation(),"aria-label":"Clear selection",children:"✕"})}function pt({open:e,onClick:t,small:r}){return n.jsx("button",{className:`nc-button nc-ghost nc-combo-button nc-combo-toggle ${r?"nc-small":""} ${e?"nc-open":""}`,onClick:t,onMouseDown:s=>s.stopPropagation(),"aria-label":e?"Close":"Open",children:"▾"})}function ft({value:e,onChange:t,placeholder:r="Select…",options:s,disabled:o,label:i,clearable:c=!0,allowTyping:a=!1,placement:d="bottom",size:f="default",appearance:h="default",textAlign:b="left",style:u,className:p}){const[g,m]=l.useState(!1),[x,j]=l.useState(""),[v,k]=l.useState(-1),w=l.useRef(null),N=l.useRef(null),A=f==="small",{t:P}=_.useTranslation(),E=l.useMemo(()=>{const I=x.toLowerCase();return a?s.filter(T=>T.label.toLowerCase().includes(I)):s},[s,x,a]);l.useEffect(()=>{g&&k(-1)},[g,E]),l.useEffect(()=>{if(!c&&!e&&s.length>0&&t){const I=s.find(T=>T.default)||s[0];t(I.value)}},[c,e,s,t]),l.useEffect(()=>{function I(T){var z;T.target instanceof Node&&w.current&&((z=w.current.parentElement)!=null&&z.contains(T.target)||m(!1))}return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[]);const y=s.find(I=>I.value===e),M=y&&c,C=!o&&!M,S=`nc-align-${b}`,$=!(g&&a)&&!!y,L=(I,T=!1)=>{var z;t==null||t(I),m(!1),j(""),T&&((z=w.current)==null||z.blur())},U=()=>{t==null||t(void 0),j(""),m(!1)},W=I=>{if(!g){(I.key==="ArrowDown"||I.key==="ArrowUp")&&(m(!0),I.preventDefault());return}switch(I.key){case"ArrowDown":I.preventDefault(),k(T=>{const z=T+1;return z>=E.length?0:z});break;case"ArrowUp":I.preventDefault(),k(T=>{const z=T-1;return z<0?E.length-1:z});break;case"Enter":I.preventDefault(),v>=0&&v<E.length&&L(E[v].value,!0);break;case"Escape":I.preventDefault(),m(!1),j("");break}};return n.jsxs("div",{className:`nc-combo-container ${h==="transparent"?"nc-transparent":""} ${S} ${p||""}`.trim(),style:{position:"relative",...u},children:[i&&n.jsx("span",{className:`nc-label ${A?"nc-small":""}`,children:i}),n.jsxs("div",{ref:N,style:{position:"relative",display:"flex",alignItems:"center"},onMouseDown:I=>{o||a&&I.target===w.current||(m(T=>(!T&&a&&y&&j(y.label),!T)),a&&!g&&setTimeout(()=>{var T,z;(T=w.current)==null||T.focus(),(z=w.current)==null||z.select()},0))},children:[n.jsx("input",{ref:w,className:`nc-input ${A?"nc-small":""}`,placeholder:r,onFocus:()=>{var I;!o&&a&&(m(!0),y&&(j(y.label),setTimeout(()=>{var T;return(T=w.current)==null?void 0:T.select()},0))),a||(I=w.current)==null||I.blur()},onChange:I=>a&&j(I.target.value),onKeyDown:W,value:g&&a?x:(y==null?void 0:y.label)||"",readOnly:o||!a,style:{width:"100%",paddingRight:C||M?A?32:44:12,caretColor:a?void 0:"transparent",cursor:a?void 0:"pointer",userSelect:a?void 0:"none",color:$?"transparent":"var(--nc-text)"}}),$&&n.jsxs("div",{"aria-hidden":!0,className:`nc-combo-overlay ${S}`,style:{position:"absolute",left:A?8:12,right:C||M?A?12:24:A?8:12,top:"50%",transform:"translateY(-50%)",pointerEvents:"none"},children:[n.jsx("span",{className:`nc-combo-overlay-text ${A?"nc-small":""}`,children:y==null?void 0:y.label}),(y==null?void 0:y.default)&&n.jsxs("span",{className:`nc-combo-overlay-default ${A?"nc-small":""}`,children:["(",P("common.default"),")"]})]}),M&&n.jsx(ut,{onClick:U,small:A}),C&&n.jsx(pt,{open:g,onClick:()=>m(I=>!I),small:A})]}),n.jsx(dt,{isOpen:g,options:E,onSelect:L,selectedValue:e,placement:d,anchorRef:N,small:A,highlightedIndex:v})]})}function ht({onClick:e,loading:t=!1,disabled:r=!1,size:s="default",title:o,"aria-label":i}){const c=s==="small"?14:s==="large"?20:18,a=t?"Refreshing...":"Refresh",d=t?"Refreshing":"Refresh";return n.jsx("button",{className:"nc-icon-button",onClick:e,disabled:r||t,title:o??a,"aria-label":i??d,"data-size":s,children:n.jsx(O.RefreshIcon,{size:c,className:t?"nc-spinning":""})})}function ge({onClick:e,disabled:t=!1,size:r="default",title:s="Close","aria-label":o="Close"}){const i=r==="small"?14:r==="large"?20:18;return n.jsx("button",{className:"nc-icon-button nc-icon-button-close",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":r,children:n.jsx(O.CloseIcon,{size:i})})}function mt({onClick:e,disabled:t=!1,size:r="default",title:s="Edit","aria-label":o="Edit"}){const i=r==="small"?14:r==="large"?20:18;return n.jsx("button",{className:"nc-icon-button nc-icon-button-edit",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":r,children:n.jsx(O.EditIcon,{size:i})})}function gt({onClick:e,disabled:t=!1,size:r="default",title:s="Delete","aria-label":o="Delete"}){const i=r==="small"?14:r==="large"?20:18;return n.jsx("button",{className:"nc-icon-button nc-icon-button-trash",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":r,children:n.jsx(O.TrashIcon,{size:i})})}function bt({onClick:e,disabled:t=!1,children:r,title:s,"aria-label":o,size:i="default"}){return n.jsx("button",{className:"nc-hyperlink",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":i,children:r})}function xt({open:e,onClose:t,options:r,anchorRef:s,anchor:o,preferredDirection:i="down"}){const c=l.useRef(null),[a,d]=l.useState({top:0,left:0}),f=o||(s==null?void 0:s.current);if(l.useEffect(()=>{if(!e||!f||!c.current)return;const u=f.getBoundingClientRect(),p=c.current.getBoundingClientRect(),g=window.innerHeight,m=window.innerWidth,x=u.bottom+8,j=x+p.height<=g-8;let v=i;(!j&&i==="down"||i==="up"&&j)&&(v="up");let k;v==="down"?k=x:k=u.top-p.height-8;let w=u.left;w+p.width>m-8&&(w=u.right-p.width),d({top:Math.max(8,k),left:Math.max(8,w)})},[e,f,i]),l.useEffect(()=>{if(!e)return;const u=g=>{c.current&&!c.current.contains(g.target)&&f&&!f.contains(g.target)&&t()},p=g=>{g.key==="Escape"&&t()};return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p)}},[e,t,f]),!e)return null;const h=u=>{u.type!=="separator"&&!u.disabled&&u.onClick&&(u.onClick(),t())},b=r.some(u=>u.icon);return ie.createPortal(n.jsx("div",{ref:c,className:"nc-context-menu",style:{position:"fixed",top:`${a.top}px`,left:`${a.left}px`,zIndex:1e4},role:"menu",children:r.map(u=>{if(u.type==="separator")return n.jsx("div",{className:"nc-context-menu-separator",role:"separator"},u.id);const p=["nc-context-menu-item",u.variant&&u.variant!=="default"?`nc-${u.variant}`:"",u.disabled?"nc-disabled":"",b&&!u.icon?"nc-indented":""].filter(Boolean).join(" ");return n.jsxs("button",{className:p,onClick:()=>h(u),disabled:u.disabled,role:"menuitem",children:[u.icon&&n.jsx("span",{className:"nc-context-menu-icon",children:u.icon}),n.jsx("span",{className:"nc-context-menu-label",children:u.label})]},u.id)})}),document.body)}const ze=l.createContext(null);function Be(){const e=l.useContext(ze);if(!e)throw new Error("useDialog must be used inside a Dialog component");return e}function X({children:e,onClick:t,...r}){const{close:s}=Be(),{t:o}=_.useTranslation(),i=c=>{t==null||t(c),s()};return n.jsx(F,{onClick:i,...r,children:e??o("common.close")})}function vt({open:e,onClose:t,title:r,children:s,style:o,footerType:i="ok-cancel",footer:c,onOk:a,onSave:d,onDelete:f,onCancel:h,onConnect:b,closeOnOverlay:u=!0,primaryDisabled:p=!1,fullScreen:g=!1,hideTitleBar:m=!1,className:x="",onContentHeightChange:j}){const v=l.useRef(null),k=l.useRef(null),{t:w}=_.useTranslation(),N={close:t},A=y=>{u&&y.target===y.currentTarget&&t()};if(l.useEffect(()=>{e&&v.current&&v.current.focus()},[e]),l.useEffect(()=>{if(!j||!k.current)return;const y=new ResizeObserver(M=>{for(const C of M){const S=C.contentRect.height;j(S)}});return y.observe(k.current),()=>{y.disconnect()}},[j]),!e)return null;const P=()=>{switch(i){case"ok":return n.jsx("div",{className:"nc-dialog-footer",children:n.jsx(F,{variant:"primary",onClick:a??t,disabled:p,children:w("common.ok")})});case"ok-cancel":return n.jsxs("div",{className:"nc-dialog-footer",children:[n.jsx(F,{variant:"primary",onClick:a??t,disabled:p,children:w("common.ok")}),n.jsx(X,{onClick:h,children:w("common.cancel")})]});case"save-cancel":return n.jsxs("div",{className:"nc-dialog-footer",children:[n.jsx(F,{variant:"primary",onClick:d,disabled:p,children:w("common.save")}),n.jsx(X,{onClick:h,children:w("common.cancel")})]});case"delete-cancel":return n.jsxs("div",{className:"nc-dialog-footer",children:[n.jsx(F,{variant:"danger",onClick:f,disabled:p,children:w("common.delete")}),n.jsx(X,{onClick:h,children:w("common.cancel")})]});case"connect":return n.jsxs("div",{className:"nc-dialog-footer",children:[n.jsx(F,{variant:"primary",onClick:b,disabled:p,children:w("common.connect")}),n.jsx(X,{onClick:h,children:w("common.cancel")})]});case"close":return n.jsx("div",{className:"nc-dialog-footer",children:n.jsx(X,{variant:"primary"})});case"gotit":return n.jsx("div",{className:"nc-dialog-footer",children:n.jsx(X,{variant:"primary",children:w("common.gotit")})});case"custom":return n.jsx("div",{className:"nc-dialog-footer",children:c});case"none":return null;default:return null}},E=n.jsx(ze.Provider,{value:N,children:n.jsx("div",{className:`nc-dialog-overlay${g?" nc-fullscreen":""}`,onClick:A,children:n.jsxs("div",{ref:v,className:`nc-dialog-container ${x}`,style:o,tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":m?void 0:"nc-dialog-title",children:[!m&&n.jsxs("div",{className:"nc-dialog-header",children:[n.jsx("h3",{id:"nc-dialog-title",className:"nc-dialog-title",children:r}),n.jsx(ge,{onClick:t,"aria-label":"Close dialog"})]}),n.jsx("div",{ref:k,className:"nc-dialog-content",children:s}),P()]})})});return g?ie.createPortal(E,document.body):E}function wt({onClick:e,size:t="default",rightOffset:r=4}){const s=t==="small"?28:34;return n.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:r,padding:0,minHeight:0,height:s,width:s,border:"none",display:"flex",alignItems:"center",justifyContent:"center",fontSize:t==="small"?"12px":"14px"},children:"✕"})}function yt({visible:e,onClick:t,size:r="default"}){const s=r==="small"?28:34,o=r==="small"?16:18;return n.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?n.jsx(O.EyeHiddenIcon,{size:o}):n.jsx(O.ViewIcon,{size:o})})}function jt({value:e,defaultValue:t="",onChange:r,onEnter:s,onClear:o,placeholder:i,disabled:c,label:a,clearable:d=!0,type:f="text",className:h="",size:b="default",style:u,leadingIcon:p,showPasswordToggle:g=!1,multiline:m=!1,rows:x=3,validator:j,showErrorMessage:v=!0}){const k=l.useRef(null),w=l.useRef(null),[N,A]=l.useState(!1),[P,E]=l.useState(!1),y=e!==void 0,[M,C]=l.useState(t),S=y?e:M,$=j?j(S):null,L=!!$,U=f==="password",W=U&&g&&!c&&!m,I=d&&S&&!c&&P,T=b==="small"?32:44;let z=12;I&&W?z=T*2:(I||W)&&(z=T);const D=p?b==="small"?28:34:void 0,Qe=()=>{var Z,ne;y||C(""),r==null||r(""),o==null||o(),m?(Z=w.current)==null||Z.focus():(ne=k.current)==null||ne.focus()},ke=Z=>{Z.key==="Enter"&&!m&&(s==null||s())},Ne=Z=>{const ne=Z.target.value;y||C(ne),r==null||r(ne)},Ce=()=>{E(!0)},Se=()=>{E(!1)},Ae=`nc-input ${b==="small"?"nc-small ":""} ${L?"nc-error ":""}${h}`;return n.jsxs("div",{className:"nc-col",style:{position:"relative",flex:1,...u},children:[a&&n.jsx("span",{className:"nc-label",children:a}),n.jsxs("div",{style:{position:"relative",display:"flex",alignItems:m?"flex-start":"center"},children:[p&&n.jsx("span",{className:"nc-input-leading-icon",style:{height:m?void 0:"100%",top:m?10:void 0},children:p}),m?n.jsx("textarea",{ref:w,className:Ae,placeholder:i,value:S,onChange:Ne,onKeyDown:ke,onFocus:Ce,onBlur:Se,readOnly:c,"aria-disabled":c,tabIndex:c?-1:void 0,rows:x,style:{width:"100%",paddingRight:z,...D!==void 0?{paddingLeft:D}:{}}}):n.jsx("input",{ref:k,type:U&&N?"text":f,className:Ae,placeholder:i,value:S,onChange:Ne,onKeyDown:ke,onFocus:Ce,onBlur:Se,readOnly:c,"aria-disabled":c,tabIndex:c?-1:void 0,style:{width:"100%",paddingRight:z,...D!==void 0?{paddingLeft:D}:{}}}),I&&n.jsx(wt,{onClick:Qe,size:b,rightOffset:W?T+4:4}),W&&n.jsx(yt,{visible:N,onClick:()=>A(!N),size:b})]}),L&&v&&n.jsx("span",{className:"nc-error-message",children:$})]})}function kt({children:e,onClick:t,showBorder:r=!0,selectable:s=!1,style:o}){const[i,c]=l.useState(!1),a=d=>{if(t){if(s){const f=window.getSelection();if(f&&f.toString().length>0)return}t(d)}};return n.jsx("div",{onClick:a,onMouseDown:()=>t&&c(!0),onMouseUp:()=>c(!1),onMouseLeave:()=>c(!1),style:{cursor:t?"pointer":"default",userSelect:s?"text":void 0,borderBottom:r?void 0:"none",...o},className:`nc-list-group-item ${t?"nc-list-group-item-clickable":""} ${i?"nc-list-group-item-active":""}`,children:n.jsx("div",{style:{flex:1},children:e})})}function Nt({title:e,titleTools:t,children:r,style:s}){return n.jsxs("div",{className:"nc-list-group",style:s,children:[(e||t)&&n.jsxs("div",{className:"nc-list-group-title",children:[n.jsx("div",{children:e}),t&&n.jsx("div",{className:"nc-list-group-title-tools",children:t})]}),n.jsx("div",{className:"nc-list-group-content",children:r})]})}function Ct({values:e,onChange:t,options:r,placeholder:s="Select…",label:o}){const[i,c]=l.useState(!1),[a,d]=l.useState(""),f=l.useRef(null),h=l.useMemo(()=>r.filter(u=>u.label.toLowerCase().includes(a.toLowerCase())),[r,a]);l.useEffect(()=>{function u(p){!(p.target instanceof Node)||!f.current||f.current.contains(p.target)||c(!1)}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[]);const b=u=>{e.includes(u)?t(e.filter(p=>p!==u)):t([...e,u])};return n.jsxs("div",{ref:f,className:"nc-col",style:{position:"relative"},children:[o&&n.jsx("span",{className:"nc-label",children:o}),n.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&&n.jsx("span",{className:"nc-label",children:s}),e.map(u=>{const p=r.find(g=>g.value===u);return p?n.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,n.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:()=>b(u),"aria-label":`Remove ${p.label}`,children:"✕"})]},u):null}),n.jsx("input",{className:"nc-input",value:a,onChange:u=>d(u.target.value),onFocus:()=>c(!0),style:{minWidth:50,border:"none",background:"transparent",padding:4,minHeight:32,flex:1}})]}),i&&n.jsxs("div",{className:"nc-combo-dropdown",style:{position:"absolute",top:"100%",left:0,right:0,zIndex:10,marginTop:4,boxShadow:"0 4px 12px var(--nc-shadow)"},children:[h.map(u=>{const p=e.includes(u.value);return n.jsxs("div",{className:"nc-section nc-row",style:{justifyContent:"space-between",cursor:"pointer",padding:12},onMouseDown:()=>b(u.value),children:[n.jsx("span",{children:u.label}),n.jsx("span",{children:p?"✔️":""})]},u.value)}),h.length===0&&n.jsx("div",{className:"nc-section nc-label",children:"No results"})]})]})}function ae(e){if(!e)return null;const t=/^\d{2}-\d{1,2}$/,r=/^\d{4}-\d{1,2}$/;if(!t.test(e)&&!r.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 oe(e){if(!e)return"";const t=e.split("-");if(t.length!==2)return e;let r=t[0];const s=t[1].padStart(2,"0");if(r.length===2){const o=parseInt(r,10);r=String(o<50?2e3+o:1900+o)}return`${r}-${s}`}function Re(e){if(!e)return"";const t=oe(e);if(!/^\d{4}-\d{2}$/.test(t))return e;const[r,s]=t.split("-");return`${r}/${s}`}function Ie(){const e=new Date,t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0");return`${t}-${r}`}function St({startMonth:e,endMonth:t,onChange:r,label:s,className:o="",disabled:i=!1,size:c="default"}){const[a,d]=l.useState(!1),[f,h]=l.useState(""),[b,u]=l.useState(""),[p,g]=l.useState({top:0,left:0,width:0,right:void 0}),m=l.useRef(null),x=l.useRef(null);l.useEffect(()=>{if(a&&m.current){const C=m.current.getBoundingClientRect(),$=Math.max(C.width,400);window.innerWidth-C.left<$&&C.right>=$?g({top:C.bottom+4,left:0,right:window.innerWidth-C.right,width:$}):g({top:C.bottom+4,left:C.left,right:void 0,width:$})}},[a]),l.useEffect(()=>{if(!a)return;const C=S=>{m.current&&!m.current.contains(S.target)&&x.current&&!x.current.contains(S.target)&&d(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[a]);const j=()=>{h(e||Ie()),u(t||Ie()),d(!0)},v=()=>{d(!1)},k=()=>{const C=ae(f),S=ae(b);if(C||S)return;const $=oe(f),L=oe(b);$&&L&&(r==null||r($,L)),d(!1)},w=e&&t?`${Re(e)} - ${Re(t)}`:"Select month range",N=ae(f),A=ae(b),P=oe(f),E=oe(b),y=P&&E&&P>E,M=a?ie.createPortal(n.jsx("div",{ref:x,className:"nc-month-range-picker-popup",style:{position:"fixed",top:p.top,...p.right!==void 0?{right:p.right}:{left:p.left},width:p.width,zIndex:1e3},children:n.jsxs("div",{className:"nc-month-range-picker-content",children:[n.jsxs("div",{className:"nc-month-range-picker-row",children:[n.jsxs("div",{className:"nc-month-range-picker-column",children:[n.jsx("label",{className:"nc-label",children:"Start Month"}),n.jsx("input",{type:"text",className:`nc-month-input ${N?"nc-error":""}`,value:f,onChange:C=>h(C.target.value),placeholder:"YY-M(M) or YYYY-M(M)"}),N&&n.jsx("div",{className:"nc-month-error-text",children:N})]}),n.jsxs("div",{className:"nc-month-range-picker-column",children:[n.jsx("label",{className:"nc-label",children:"End Month"}),n.jsx("input",{type:"text",className:`nc-month-input ${A?"nc-error":""}`,value:b,onChange:C=>u(C.target.value),placeholder:"YY-M(M) or YYYY-M(M)"}),A&&n.jsx("div",{className:"nc-month-error-text",children:A})]})]}),y&&!N&&!A&&n.jsx("div",{className:"nc-month-range-error",children:"End month must be after or equal to start month"}),n.jsxs("div",{className:"nc-month-range-picker-footer",children:[n.jsx(F,{variant:"primary",onClick:k,disabled:!f||!b||!!N||!!A||!!y,children:"Apply"}),n.jsx(F,{variant:"ghost",onClick:v,children:"Cancel"})]})]})}),document.body):null;return n.jsxs("div",{className:`nc-month-range-picker ${c==="small"?"nc-small ":""}${o}`,children:[s&&n.jsx("label",{className:`nc-label${c==="small"?" nc-small":""}`,children:s}),n.jsx("button",{ref:m,className:`nc-month-range-picker-input${c==="small"?" nc-small":""}`,onClick:j,disabled:i,children:w}),M]})}function At({value:e,onChange:t,min:r,max:s,step:o=1,label:i,disabled:c,size:a="default"}){const d=a==="small",f=()=>{const u=e-o;r!==void 0&&u<r||t(parseFloat(u.toFixed(10)))},h=()=>{const u=e+o;s!==void 0&&u>s||t(parseFloat(u.toFixed(10)))},b=u=>{const p=parseFloat(u.target.value);isNaN(p)||r!==void 0&&p<r||s!==void 0&&p>s||t(p)};return n.jsxs("div",{className:`nc-col nc-number-input-col ${d?"nc-small":""}`,children:[i&&n.jsx("span",{className:`nc-label ${d?"nc-small":""}`,children:i}),n.jsxs("div",{className:`nc-number-input-container ${d?"nc-small":""}`,children:[n.jsx("input",{className:`nc-input nc-number-input ${d?"nc-small":""}`,type:"number",value:e,onChange:b,min:r,max:s,step:o,disabled:c}),n.jsx("button",{className:`nc-button nc-ghost nc-number-input-button ${d?"nc-small":""}`,onClick:f,disabled:c||r!==void 0&&e<=r,children:"−"}),n.jsx("button",{className:`nc-button nc-ghost nc-number-input-button ${d?"nc-small":""}`,onClick:h,disabled:c||s!==void 0&&e>=s,children:"+"})]})]})}function Rt({value:e,onChange:t,min:r=0,max:s=100,step:o=1,label:i,disabled:c,showValue:a=!0,formatValue:d=h=>h.toString(),width:f=200}){const h=u=>{const p=parseFloat(u.target.value);t(p)},b=(e-r)/(s-r)*100;return n.jsxs("div",{className:"nc-col",style:{gap:6},children:[i&&n.jsx("span",{className:"nc-label",children:i}),n.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[n.jsx("input",{type:"range",className:"nc-slider",value:e,onChange:h,min:r,max:s,step:o,disabled:c,style:{width:f,"--nc-slider-percentage":`${b}%`}}),a&&n.jsx("span",{style:{color:"var(--nc-text)",fontFamily:"monospace",fontSize:14,minWidth:60,textAlign:"right"},children:d(e)})]})]})}const It=({size:e=24,className:t,style:r})=>n.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,style:r,children:n.jsx("polyline",{points:"18 15 12 9 6 15"})});function Le({children:e,className:t="",style:r}){return n.jsx("div",{className:`nc-tab-panel ${t}`,style:r,children:e})}function Mt({active:e,children:t,keepMounted:r=!1,className:s="",style:o}){const i=l.Children.toArray(t).filter(a=>l.isValidElement(a)&&(a.type===Le||a.type.displayName==="TabPanel"));if(r)return n.jsx("div",{className:`nc-tab-panels ${s}`,style:o,children:i.map(a=>{const d=a.props.tab===e;return n.jsx("div",{className:`nc-tab-panel-wrapper ${d?"nc-active":""}`,style:{display:d?void 0:"none"},"aria-hidden":!d,children:a},a.props.tab)})});const c=i.find(a=>a.props.tab===e);return n.jsx("div",{className:`nc-tab-panels ${s}`,style:o,children:c})}function Et({tabs:e,active:t,onChange:r,onClose:s,permanentTabs:o,className:i,toolbar:c,multiline:a,orientation:d="horizontal",style:f}){const h=l.useRef(null),[b,u]=l.useState(!1),[p,g]=l.useState(!1),m=d==="verticalLeft"||d==="verticalRight",x=l.useRef(!1),j=l.useRef(0),v=l.useRef(0),k=l.useRef(!1);l.useEffect(()=>{const y=()=>{if(h.current)if(m){const{scrollTop:C,scrollHeight:S,clientHeight:$}=h.current;u(C>1),g(C<S-$-1)}else{const{scrollLeft:C,scrollWidth:S,clientWidth:$}=h.current;u(C>1),g(C<S-$-1)}},M=h.current;if(M)return y(),M.addEventListener("scroll",y),window.addEventListener("resize",y),()=>{M.removeEventListener("scroll",y),window.removeEventListener("resize",y)}},[e,m]);const w=y=>{h.current&&(x.current=!0,k.current=!1,j.current=m?y.clientY:y.clientX,v.current=m?h.current.scrollTop:h.current.scrollLeft,h.current.style.cursor="grabbing",h.current.style.userSelect="none")},N=y=>{if(!x.current||!h.current)return;const M=m?y.clientY:y.clientX,C=j.current-M;Math.abs(C)>3&&(k.current=!0),m?h.current.scrollTop=v.current+C:h.current.scrollLeft=v.current+C},A=()=>{h.current&&(x.current=!1,h.current.style.cursor="",h.current.style.userSelect="")},P=()=>{A()};l.useEffect(()=>{const y=h.current;if(!y||m)return;const M=C=>{C.deltaY!==0&&(C.preventDefault(),y.scrollLeft+=C.deltaY*.3)};return y.addEventListener("wheel",M,{passive:!1}),()=>{y.removeEventListener("wheel",M)}},[m]);const E=y=>{k.current||r(y)};return n.jsxs("div",{className:`nc-tab-container ${m?`nc-vertical nc-${d}`:""} ${i||""}`,style:f,children:[n.jsxs("div",{className:"nc-tab-scroll-wrapper",children:[b&&n.jsx("div",{className:`nc-tab-scroll-indicator ${m?"nc-top":"nc-left"}`,children:m?n.jsx(It,{size:16}):n.jsx(O.ChevronLeftIcon,{size:16})}),n.jsx("div",{ref:h,className:`nc-tab-scroll ${a?"nc-multiline":""}`,onMouseDown:w,onMouseMove:N,onMouseUp:A,onMouseLeave:P,style:{cursor:"grab"},children:e.map(y=>{const M=typeof y=="string"?y:y.id,C=typeof y=="string"?y:y.label,S=s&&!(o!=null&&o.includes(M));return n.jsxs("div",{className:`nc-tab-item ${t===M?"nc-active":""} ${S?"nc-closable":""}`,onClick:()=>E(M),role:"button",tabIndex:0,onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&r(M)},children:[n.jsx("span",{className:"nc-tab-label",children:m?C:typeof C=="string"?C.toUpperCase():C}),S&&n.jsx("span",{className:"nc-tab-close",role:"button",tabIndex:0,"aria-label":`Close ${typeof C=="string"?C:M}`,onClick:$=>{$.stopPropagation(),s(M)},onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.stopPropagation(),s(M))},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},M)})}),p&&n.jsx("div",{className:`nc-tab-scroll-indicator ${m?"nc-bottom":"nc-right"}`,children:m?n.jsx(O.ChevronDownIcon,{size:16}):n.jsx(O.ChevronRightIcon,{size:16})})]}),c&&n.jsx("div",{className:"nc-tab-toolbar",children:c})]})}function $t({checked:e,onChange:t,disabled:r,label:s}){return n.jsxs("label",{className:"nc-row",style:{gap:10,alignItems:"center",cursor:r?"not-allowed":"pointer"},children:[s&&n.jsx("span",{className:"nc-label",children:s}),n.jsx("span",{role:"switch","aria-checked":e,tabIndex:0,onKeyDown:o=>{r||(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t(!e))},onClick:()=>!r&&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:n.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 Me=["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 Tt(e,t){const s=e.slice(0,t).split(`
|
|
1
|
+
"use strict";var Ze=Object.defineProperty;var et=(e,t,r)=>t in e?Ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Y=(e,t,r)=>et(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),O=require("./GeneratedIcons-CGjL38ny.cjs"),l=require("react"),ie=require("react-dom"),_=require("react-i18next"),tt=require("i18next"),nt=require("./clsx-C11secjj.cjs");function me({size:e="default",color:t,overlay:r=!1,className:s=""}){const o=n.jsx("svg",{className:`nc-activity-indicator nc-${e} ${s}`,viewBox:"0 0 50 50",style:t?{color:t}:void 0,children:n.jsx("circle",{className:"nc-activity-indicator-circle",cx:"25",cy:"25",r:"20",fill:"none",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round"})});return r?n.jsx("div",{className:"nc-activity-indicator-overlay",children:o}):o}function F({variant:e="default",block:t,size:r="default",appearance:s="default",className:o,disabled:i,textSelectable:c,loading:a,onClick:d,children:f,...h}){const b=["nc-button",e!=="default"?`nc-${e}`:"",t?"nc-block":"",r==="small"?"nc-small":"",r==="large"?"nc-large":"",s==="transparent"?"nc-transparent":"",i||a?"nc-disabled":"",c?"nc-text-selectable":"",a?"nc-loading":"",o??""].filter(Boolean).join(" "),u=p=>{if(!a){if(c){const g=window.getSelection();if(g&&g.toString().length>0)return}d==null||d(p)}};return n.jsxs("button",{className:b,disabled:i||a,onClick:u,...h,children:[a&&n.jsx(me,{size:"small",className:"nc-button-spinner",color:s==="transparent"||e!=="default"&&e!=="ghost"?"white":void 0}),f]})}const rt={info:"primary",success:"success",warning:"warning",error:"danger",danger:"danger"};function st({code:e,text:t,type:r,button:s,onAction:o,children:i,onClose:c,className:a="",style:d}){const f=i??n.jsxs(n.Fragment,{children:[e!==void 0&&n.jsx("span",{className:"nc-alert-code",children:e}),t]});return n.jsxs("div",{className:`nc-alert nc-${r} ${a}`.trim(),style:d,children:[n.jsxs("div",{className:"nc-alert-main",children:[n.jsx("div",{className:`nc-alert-message nc-${r}`,children:f}),c&&n.jsx("button",{type:"button",className:"nc-alert-close","aria-label":"Close alert",onClick:c,children:n.jsx(O.CloseIcon,{size:16})})]}),s&&n.jsx("span",{className:"nc-alert-action",children:n.jsx(F,{size:"small",variant:s.variant??rt[r],onClick:o,children:s.text})})]})}function ot({percentage:e=.5,status:t="discharging",darkMode:r=!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=r?"#ffffff":"#000000";const c=r?"rgba(255, 255, 255, 0.5)":"rgba(0, 0, 0, 0.2)",a=24,d=14,f=2,h=0,b=12,u=0,p=0,g=0,m=a,x=d,j=x-u*2,v=m-u*2,k=Math.max(1,Math.min(4,x/4)),w=o===0?0:.05+o*.95,N=a+f+b,A=20,P=.65,E=Math.max(d,A*P),y=a+f+1,M=(d-A*P)/2;return n.jsxs("svg",{className:"nc-battery",width:N,height:E,viewBox:`0 0 ${N} ${E}`,role:"img","aria-label":`Battery ${o===0?"-":Math.round(o*100)+"%"} ${t}`,children:[n.jsxs("defs",{children:[n.jsx("mask",{id:`nc-battery-fill-mask-${o}`,children:n.jsx("rect",{x:"0",y:"0",width:v*w,height:j,fill:"white"})}),n.jsxs("mask",{id:`nc-battery-text-mask-${o}`,children:[n.jsx("rect",{x:"0",y:"0",width:N,height:E,fill:"white"}),n.jsx("text",{x:p+m/2,y:d-3,fontSize:11,fontWeight:"bold",fill:"black",textAnchor:"middle",children:o===0?"-":Math.round(o*100)})]})]}),n.jsxs("g",{mask:`url(#nc-battery-text-mask-${o})`,children:[n.jsx("rect",{x:p,y:g,rx:k,ry:k,width:m,height:x,fill:c}),n.jsx("rect",{x:p+u,y:g+u,width:v,height:j,fill:i,rx:k,ry:k,mask:`url(#nc-battery-fill-mask-${o})`}),n.jsx("rect",{x:a+h,y:d*.26,width:f,height:d*.48,rx:.8,ry:.8,fill:o===1?i:c}),t==="charging"?n.jsx("g",{transform:`translate(${y}, ${M}) scale(${P})`,fill:i,children:n.jsx("path",{d:"M10 0 L2 11 H8 L5 20 L14 8 H8 L10 0 Z"})}):null]})]})}function it({value:e,onChange:t,options:r,disabled:s,size:o="default"}){return n.jsx("div",{className:`nc-button-group ${o==="small"?"nc-small":""}`,children:r.map(i=>{const c=s||!!i.disabled;return n.jsx("button",{type:"button",className:`nc-button-group-item ${e===i.key?"nc-active":""}`,onClick:()=>!c&&t(i.key),disabled:c,children:i.label},i.key)})})}function at({size:e}){return n.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:n.jsx("path",{d:"M2 6L5 9L10 3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function ct({checked:e,onChange:t,disabled:r,label:s,size:o="default",labelColor:i,style:c,className:a=""}){const d=o==="small";return n.jsxs("label",{className:`nc-checkbox-label ${d?"nc-small":""} ${r?"nc-disabled":""} ${a}`.trim(),style:c,onClick:f=>{r||(f.preventDefault(),t(!e))},children:[n.jsx("span",{role:"checkbox","aria-checked":e,tabIndex:0,className:`nc-checkbox-box ${d?"nc-small":""} ${e?"nc-checked":""}`,onKeyDown:f=>{r||(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),t(!e))},children:e&&n.jsx(at,{size:o})}),s&&n.jsx("span",{className:"nc-checkbox-text",style:i?{color:i}:void 0,children:s})]})}function lt({option:e,onChange:t,selected:r,highlighted:s,small:o}){const i=l.useRef(null),{t:c}=_.useTranslation();return l.useEffect(()=>{s&&i.current&&i.current.scrollIntoView({block:"nearest"})},[s]),n.jsxs("div",{ref:i,className:`nc-combo-dropdown-option ${o?"nc-small":""} ${s?"nc-highlighted":""}`,role:"option",onMouseDown:()=>t(e.value),"aria-selected":r,style:{cursor:"pointer",background:s?"rgba(59,130,246,0.18)":r?"rgba(59,130,246,0.12)":void 0},children:[e.label,e.default&&n.jsxs("span",{style:{fontSize:"0.85em",color:"var(--nc-text-weak)",marginLeft:6},children:["(",c("common.default"),")"]})]})}function dt({isOpen:e,options:t,onSelect:r,selectedValue:s,placement:o="bottom",anchorRef:i,small:c,highlightedIndex:a=-1}){const[d,f]=l.useState({top:0,left:0,width:0}),[h,b]=l.useState(o),{t:u}=_.useTranslation();if(l.useEffect(()=>{if(e&&i.current){const g=i.current.getBoundingClientRect();let m=o;if(o==="bottom"){const x=window.innerHeight-g.bottom,j=g.top;x<320&&j>x&&(m="top")}b(m),f({top:m==="top"?g.top-4:g.bottom+4,left:g.left,width:g.width})}},[e,i,o]),!e)return null;const p=n.jsx("div",{className:"nc-combo-dropdown",style:{position:"fixed",top:h==="top"?void 0:d.top,bottom:h==="top"?window.innerHeight-d.top:void 0,left:d.left,width:d.width,zIndex:1e3,maxHeight:300,overflowY:"auto"},children:t.length===0?n.jsx("div",{className:`nc-combo-dropdown-option nc-no-results ${c?"nc-small":""}`,children:u("common.noResults")}):t.map((g,m)=>n.jsx(lt,{option:g,onChange:r,selected:g.value===s,highlighted:m===a,small:c},g.value))});return ie.createPortal(p,document.body)}function ut({onClick:e,small:t}){return n.jsx("button",{className:`nc-button nc-ghost nc-combo-button nc-combo-clear ${t?"nc-small":""}`,onClick:e,onMouseDown:r=>r.stopPropagation(),"aria-label":"Clear selection",children:"✕"})}function pt({open:e,onClick:t,small:r}){return n.jsx("button",{className:`nc-button nc-ghost nc-combo-button nc-combo-toggle ${r?"nc-small":""} ${e?"nc-open":""}`,onClick:t,onMouseDown:s=>s.stopPropagation(),"aria-label":e?"Close":"Open",children:"▾"})}function ft({value:e,onChange:t,placeholder:r="Select…",options:s,disabled:o,label:i,clearable:c=!0,allowTyping:a=!1,placement:d="bottom",size:f="default",appearance:h="default",textAlign:b="left",style:u,className:p}){const[g,m]=l.useState(!1),[x,j]=l.useState(""),[v,k]=l.useState(-1),w=l.useRef(null),N=l.useRef(null),A=f==="small",{t:P}=_.useTranslation(),E=l.useMemo(()=>{const I=x.toLowerCase();return a?s.filter(T=>T.label.toLowerCase().includes(I)):s},[s,x,a]);l.useEffect(()=>{g&&k(-1)},[g,E]),l.useEffect(()=>{if(!c&&!e&&s.length>0&&t){const I=s.find(T=>T.default)||s[0];t(I.value)}},[c,e,s,t]),l.useEffect(()=>{function I(T){var z;T.target instanceof Node&&w.current&&((z=w.current.parentElement)!=null&&z.contains(T.target)||m(!1))}return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[]);const y=s.find(I=>I.value===e),M=y&&c,C=!o&&!M,S=`nc-align-${b}`,$=!(g&&a)&&!!y,L=(I,T=!1)=>{var z;t==null||t(I),m(!1),j(""),T&&((z=w.current)==null||z.blur())},U=()=>{t==null||t(void 0),j(""),m(!1)},W=I=>{if(!g){(I.key==="ArrowDown"||I.key==="ArrowUp")&&(m(!0),I.preventDefault());return}switch(I.key){case"ArrowDown":I.preventDefault(),k(T=>{const z=T+1;return z>=E.length?0:z});break;case"ArrowUp":I.preventDefault(),k(T=>{const z=T-1;return z<0?E.length-1:z});break;case"Enter":I.preventDefault(),v>=0&&v<E.length&&L(E[v].value,!0);break;case"Escape":I.preventDefault(),m(!1),j("");break}};return n.jsxs("div",{className:`nc-combo-container ${h==="transparent"?"nc-transparent":""} ${S} ${p||""}`.trim(),style:{position:"relative",...u},children:[i&&n.jsx("span",{className:`nc-label ${A?"nc-small":""}`,children:i}),n.jsxs("div",{ref:N,style:{position:"relative",display:"flex",alignItems:"center"},onMouseDown:I=>{o||a&&I.target===w.current||(m(T=>(!T&&a&&y&&j(y.label),!T)),a&&!g&&setTimeout(()=>{var T,z;(T=w.current)==null||T.focus(),(z=w.current)==null||z.select()},0))},children:[n.jsx("input",{ref:w,className:`nc-input ${A?"nc-small":""}`,placeholder:r,onFocus:()=>{var I;!o&&a&&(m(!0),y&&(j(y.label),setTimeout(()=>{var T;return(T=w.current)==null?void 0:T.select()},0))),a||(I=w.current)==null||I.blur()},onChange:I=>a&&j(I.target.value),onKeyDown:W,value:g&&a?x:(y==null?void 0:y.label)||"",readOnly:o||!a,style:{width:"100%",paddingRight:C||M?A?32:44:12,caretColor:a?void 0:"transparent",cursor:a?void 0:"pointer",userSelect:a?void 0:"none",color:$?"transparent":"var(--nc-text)"}}),$&&n.jsxs("div",{"aria-hidden":!0,className:`nc-combo-overlay ${S}`,style:{position:"absolute",left:A?8:12,right:C||M?A?12:24:A?8:12,top:"50%",transform:"translateY(-50%)",pointerEvents:"none"},children:[n.jsx("span",{className:`nc-combo-overlay-text ${A?"nc-small":""}`,children:y==null?void 0:y.label}),(y==null?void 0:y.default)&&n.jsxs("span",{className:`nc-combo-overlay-default ${A?"nc-small":""}`,children:["(",P("common.default"),")"]})]}),M&&n.jsx(ut,{onClick:U,small:A}),C&&n.jsx(pt,{open:g,onClick:()=>m(I=>!I),small:A})]}),n.jsx(dt,{isOpen:g,options:E,onSelect:L,selectedValue:e,placement:d,anchorRef:N,small:A,highlightedIndex:v})]})}function ht({onClick:e,loading:t=!1,disabled:r=!1,size:s="default",title:o,"aria-label":i}){const c=s==="small"?14:s==="large"?20:18,a=t?"Refreshing...":"Refresh",d=t?"Refreshing":"Refresh";return n.jsx("button",{className:"nc-icon-button",onClick:e,disabled:r||t,title:o??a,"aria-label":i??d,"data-size":s,children:n.jsx(O.RefreshIcon,{size:c,className:t?"nc-spinning":""})})}function ge({onClick:e,disabled:t=!1,size:r="default",title:s="Close","aria-label":o="Close"}){const i=r==="small"?14:r==="large"?20:18;return n.jsx("button",{className:"nc-icon-button nc-icon-button-close",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":r,children:n.jsx(O.CloseIcon,{size:i})})}function mt({onClick:e,disabled:t=!1,size:r="default",title:s="Edit","aria-label":o="Edit"}){const i=r==="small"?14:r==="large"?20:18;return n.jsx("button",{className:"nc-icon-button nc-icon-button-edit",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":r,children:n.jsx(O.EditIcon,{size:i})})}function gt({onClick:e,disabled:t=!1,size:r="default",title:s="Delete","aria-label":o="Delete"}){const i=r==="small"?14:r==="large"?20:18;return n.jsx("button",{className:"nc-icon-button nc-icon-button-trash",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":r,children:n.jsx(O.TrashIcon,{size:i})})}function bt({onClick:e,disabled:t=!1,children:r,title:s,"aria-label":o,size:i="default"}){return n.jsx("button",{className:"nc-hyperlink",onClick:e,disabled:t,title:s,"aria-label":o,"data-size":i,children:r})}function xt({open:e,onClose:t,options:r,anchorRef:s,anchor:o,preferredDirection:i="down"}){const c=l.useRef(null),[a,d]=l.useState({top:0,left:0}),f=o||(s==null?void 0:s.current);if(l.useEffect(()=>{if(!e||!f||!c.current)return;const u=f.getBoundingClientRect(),p=c.current.getBoundingClientRect(),g=window.innerHeight,m=window.innerWidth,x=u.bottom+8,j=x+p.height<=g-8;let v=i;(!j&&i==="down"||i==="up"&&j)&&(v="up");let k;v==="down"?k=x:k=u.top-p.height-8;let w=u.left;w+p.width>m-8&&(w=u.right-p.width),d({top:Math.max(8,k),left:Math.max(8,w)})},[e,f,i]),l.useEffect(()=>{if(!e)return;const u=g=>{c.current&&!c.current.contains(g.target)&&f&&!f.contains(g.target)&&t()},p=g=>{g.key==="Escape"&&t()};return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p)}},[e,t,f]),!e)return null;const h=u=>{u.type!=="separator"&&!u.disabled&&u.onClick&&(u.onClick(),t())},b=r.some(u=>u.icon);return ie.createPortal(n.jsx("div",{ref:c,className:"nc-context-menu",style:{position:"fixed",top:`${a.top}px`,left:`${a.left}px`,zIndex:1e4},role:"menu",children:r.map(u=>{if(u.type==="separator")return n.jsx("div",{className:"nc-context-menu-separator",role:"separator"},u.id);const p=["nc-context-menu-item",u.variant&&u.variant!=="default"?`nc-${u.variant}`:"",u.disabled?"nc-disabled":"",b&&!u.icon?"nc-indented":""].filter(Boolean).join(" ");return n.jsxs("button",{className:p,onClick:()=>h(u),disabled:u.disabled,role:"menuitem",children:[u.icon&&n.jsx("span",{className:"nc-context-menu-icon",children:u.icon}),n.jsx("span",{className:"nc-context-menu-label",children:u.label})]},u.id)})}),document.body)}const ze=l.createContext(null);function Be(){const e=l.useContext(ze);if(!e)throw new Error("useDialog must be used inside a Dialog component");return e}function X({children:e,onClick:t,...r}){const{close:s}=Be(),{t:o}=_.useTranslation(),i=c=>{t==null||t(c),s()};return n.jsx(F,{onClick:i,...r,children:e??o("common.close")})}function vt({open:e,onClose:t,title:r,children:s,style:o,footerType:i="ok-cancel",footer:c,onOk:a,onSave:d,onDelete:f,onCancel:h,onConnect:b,closeOnOverlay:u=!0,primaryDisabled:p=!1,fullScreen:g=!1,hideTitleBar:m=!1,className:x="",onContentHeightChange:j}){const v=l.useRef(null),k=l.useRef(null),{t:w}=_.useTranslation(),N={close:t},A=y=>{u&&y.target===y.currentTarget&&t()};if(l.useEffect(()=>{e&&v.current&&v.current.focus()},[e]),l.useEffect(()=>{if(!j||!k.current)return;const y=new ResizeObserver(M=>{for(const C of M){const S=C.contentRect.height;j(S)}});return y.observe(k.current),()=>{y.disconnect()}},[j]),!e)return null;const P=()=>{switch(i){case"ok":return n.jsx("div",{className:"nc-dialog-footer",children:n.jsx(F,{variant:"primary",onClick:a??t,disabled:p,children:w("common.ok")})});case"ok-cancel":return n.jsxs("div",{className:"nc-dialog-footer",children:[n.jsx(F,{variant:"primary",onClick:a??t,disabled:p,children:w("common.ok")}),n.jsx(X,{onClick:h,children:w("common.cancel")})]});case"save-cancel":return n.jsxs("div",{className:"nc-dialog-footer",children:[n.jsx(F,{variant:"primary",onClick:d,disabled:p,children:w("common.save")}),n.jsx(X,{onClick:h,children:w("common.cancel")})]});case"delete-cancel":return n.jsxs("div",{className:"nc-dialog-footer",children:[n.jsx(F,{variant:"danger",onClick:f,disabled:p,children:w("common.delete")}),n.jsx(X,{onClick:h,children:w("common.cancel")})]});case"connect":return n.jsxs("div",{className:"nc-dialog-footer",children:[n.jsx(F,{variant:"primary",onClick:b,disabled:p,children:w("common.connect")}),n.jsx(X,{onClick:h,children:w("common.cancel")})]});case"close":return n.jsx("div",{className:"nc-dialog-footer",children:n.jsx(X,{variant:"primary"})});case"gotit":return n.jsx("div",{className:"nc-dialog-footer",children:n.jsx(X,{variant:"primary",children:w("common.gotit")})});case"custom":return n.jsx("div",{className:"nc-dialog-footer",children:c});case"none":return null;default:return null}},E=n.jsx(ze.Provider,{value:N,children:n.jsx("div",{className:`nc-dialog-overlay${g?" nc-fullscreen":""}`,onClick:A,children:n.jsxs("div",{ref:v,className:`nc-dialog-container ${x}`,style:o,tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":m?void 0:"nc-dialog-title",children:[!m&&n.jsxs("div",{className:"nc-dialog-header",children:[n.jsx("h3",{id:"nc-dialog-title",className:"nc-dialog-title",children:r}),n.jsx(ge,{onClick:t,"aria-label":"Close dialog"})]}),n.jsx("div",{ref:k,className:"nc-dialog-content",children:s}),P()]})})});return g?ie.createPortal(E,document.body):E}function wt({onClick:e,size:t="default",rightOffset:r=4}){const s=t==="small"?28:34;return n.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:r,padding:0,minHeight:0,height:s,width:s,border:"none",display:"flex",alignItems:"center",justifyContent:"center",fontSize:t==="small"?"12px":"14px"},children:"✕"})}function yt({visible:e,onClick:t,size:r="default"}){const s=r==="small"?28:34,o=r==="small"?16:18;return n.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?n.jsx(O.EyeHiddenIcon,{size:o}):n.jsx(O.ViewIcon,{size:o})})}function jt({value:e,defaultValue:t="",onChange:r,onEnter:s,onClear:o,placeholder:i,disabled:c,label:a,clearable:d=!0,type:f="text",className:h="",size:b="default",style:u,leadingIcon:p,showPasswordToggle:g=!1,multiline:m=!1,rows:x=3,validator:j,showErrorMessage:v=!0}){const k=l.useRef(null),w=l.useRef(null),[N,A]=l.useState(!1),[P,E]=l.useState(!1),y=e!==void 0,[M,C]=l.useState(t),S=y?e:M,$=j?j(S):null,L=!!$,U=f==="password",W=U&&g&&!c&&!m,I=d&&S&&!c&&P,T=b==="small"?32:44;let z=12;I&&W?z=T*2:(I||W)&&(z=T);const D=p?b==="small"?28:34:void 0,Qe=()=>{var Z,ne;y||C(""),r==null||r(""),o==null||o(),m?(Z=w.current)==null||Z.focus():(ne=k.current)==null||ne.focus()},ke=Z=>{Z.key==="Enter"&&!m&&(s==null||s())},Ne=Z=>{const ne=Z.target.value;y||C(ne),r==null||r(ne)},Ce=()=>{E(!0)},Se=()=>{E(!1)},Ae=`nc-input ${b==="small"?"nc-small ":""} ${L?"nc-error ":""}${h}`;return n.jsxs("div",{className:"nc-col",style:{position:"relative",flex:1,...u},children:[a&&n.jsx("span",{className:"nc-label",children:a}),n.jsxs("div",{style:{position:"relative",display:"flex",alignItems:m?"flex-start":"center"},children:[p&&n.jsx("span",{className:"nc-input-leading-icon",style:{height:m?void 0:"100%",top:m?10:void 0},children:p}),m?n.jsx("textarea",{ref:w,className:Ae,placeholder:i,value:S,onChange:Ne,onKeyDown:ke,onFocus:Ce,onBlur:Se,readOnly:c,"aria-disabled":c,tabIndex:c?-1:void 0,rows:x,style:{width:"100%",paddingRight:z,...D!==void 0?{paddingLeft:D}:{}}}):n.jsx("input",{ref:k,type:U&&N?"text":f,className:Ae,placeholder:i,value:S,onChange:Ne,onKeyDown:ke,onFocus:Ce,onBlur:Se,readOnly:c,"aria-disabled":c,tabIndex:c?-1:void 0,style:{width:"100%",paddingRight:z,...D!==void 0?{paddingLeft:D}:{}}}),I&&n.jsx(wt,{onClick:Qe,size:b,rightOffset:W?T+4:4}),W&&n.jsx(yt,{visible:N,onClick:()=>A(!N),size:b})]}),L&&v&&n.jsx("span",{className:"nc-error-message",children:$})]})}function kt({children:e,onClick:t,showBorder:r=!0,selectable:s=!1,style:o}){const[i,c]=l.useState(!1),a=d=>{if(t){if(s){const f=window.getSelection();if(f&&f.toString().length>0)return}t(d)}};return n.jsx("div",{onClick:a,onMouseDown:()=>t&&c(!0),onMouseUp:()=>c(!1),onMouseLeave:()=>c(!1),style:{cursor:t?"pointer":"default",userSelect:s?"text":void 0,borderBottom:r?void 0:"none",...o},className:`nc-list-group-item ${t?"nc-list-group-item-clickable":""} ${i?"nc-list-group-item-active":""}`,children:n.jsx("div",{style:{flex:1},children:e})})}function Nt({title:e,titleTools:t,children:r,style:s}){return n.jsxs("div",{className:"nc-list-group",style:s,children:[(e||t)&&n.jsxs("div",{className:"nc-list-group-title",children:[n.jsx("div",{children:e}),t&&n.jsx("div",{className:"nc-list-group-title-tools",children:t})]}),n.jsx("div",{className:"nc-list-group-content",children:r})]})}function Ct({values:e,onChange:t,options:r,placeholder:s="Select…",label:o}){const[i,c]=l.useState(!1),[a,d]=l.useState(""),f=l.useRef(null),h=l.useMemo(()=>r.filter(u=>u.label.toLowerCase().includes(a.toLowerCase())),[r,a]);l.useEffect(()=>{function u(p){!(p.target instanceof Node)||!f.current||f.current.contains(p.target)||c(!1)}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[]);const b=u=>{e.includes(u)?t(e.filter(p=>p!==u)):t([...e,u])};return n.jsxs("div",{ref:f,className:"nc-col",style:{position:"relative"},children:[o&&n.jsx("span",{className:"nc-label",children:o}),n.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&&n.jsx("span",{className:"nc-label",children:s}),e.map(u=>{const p=r.find(g=>g.value===u);return p?n.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,n.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:()=>b(u),"aria-label":`Remove ${p.label}`,children:"✕"})]},u):null}),n.jsx("input",{className:"nc-input",value:a,onChange:u=>d(u.target.value),onFocus:()=>c(!0),style:{minWidth:50,border:"none",background:"transparent",padding:4,minHeight:32,flex:1}})]}),i&&n.jsxs("div",{className:"nc-combo-dropdown",style:{position:"absolute",top:"100%",left:0,right:0,zIndex:10,marginTop:4,boxShadow:"0 4px 12px var(--nc-shadow)"},children:[h.map(u=>{const p=e.includes(u.value);return n.jsxs("div",{className:"nc-section nc-row",style:{justifyContent:"space-between",cursor:"pointer",padding:12},onMouseDown:()=>b(u.value),children:[n.jsx("span",{children:u.label}),n.jsx("span",{children:p?"✔️":""})]},u.value)}),h.length===0&&n.jsx("div",{className:"nc-section nc-label",children:"No results"})]})]})}function ae(e){if(!e)return null;const t=/^\d{2}-\d{1,2}$/,r=/^\d{4}-\d{1,2}$/;if(!t.test(e)&&!r.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 oe(e){if(!e)return"";const t=e.split("-");if(t.length!==2)return e;let r=t[0];const s=t[1].padStart(2,"0");if(r.length===2){const o=parseInt(r,10);r=String(o<50?2e3+o:1900+o)}return`${r}-${s}`}function Re(e){if(!e)return"";const t=oe(e);if(!/^\d{4}-\d{2}$/.test(t))return e;const[r,s]=t.split("-");return`${r}/${s}`}function Ie(){const e=new Date,t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0");return`${t}-${r}`}function St({startMonth:e,endMonth:t,onChange:r,label:s,className:o="",disabled:i=!1,size:c="default"}){const[a,d]=l.useState(!1),[f,h]=l.useState(""),[b,u]=l.useState(""),[p,g]=l.useState({top:0,left:0,width:0,right:void 0}),m=l.useRef(null),x=l.useRef(null);l.useEffect(()=>{if(a&&m.current){const C=m.current.getBoundingClientRect(),$=Math.max(C.width,400);window.innerWidth-C.left<$&&C.right>=$?g({top:C.bottom+4,left:0,right:window.innerWidth-C.right,width:$}):g({top:C.bottom+4,left:C.left,right:void 0,width:$})}},[a]),l.useEffect(()=>{if(!a)return;const C=S=>{m.current&&!m.current.contains(S.target)&&x.current&&!x.current.contains(S.target)&&d(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[a]);const j=()=>{h(e||Ie()),u(t||Ie()),d(!0)},v=()=>{d(!1)},k=()=>{const C=ae(f),S=ae(b);if(C||S)return;const $=oe(f),L=oe(b);$&&L&&(r==null||r($,L)),d(!1)},w=e&&t?`${Re(e)} - ${Re(t)}`:"Select month range",N=ae(f),A=ae(b),P=oe(f),E=oe(b),y=P&&E&&P>E,M=a?ie.createPortal(n.jsx("div",{ref:x,className:"nc-month-range-picker-popup",style:{position:"fixed",top:p.top,...p.right!==void 0?{right:p.right}:{left:p.left},width:p.width,zIndex:1e3},children:n.jsxs("div",{className:"nc-month-range-picker-content",children:[n.jsxs("div",{className:"nc-month-range-picker-row",children:[n.jsxs("div",{className:"nc-month-range-picker-column",children:[n.jsx("label",{className:"nc-label",children:"Start Month"}),n.jsx("input",{type:"text",className:`nc-month-input ${N?"nc-error":""}`,value:f,onChange:C=>h(C.target.value),placeholder:"YY-M(M) or YYYY-M(M)"}),N&&n.jsx("div",{className:"nc-month-error-text",children:N})]}),n.jsxs("div",{className:"nc-month-range-picker-column",children:[n.jsx("label",{className:"nc-label",children:"End Month"}),n.jsx("input",{type:"text",className:`nc-month-input ${A?"nc-error":""}`,value:b,onChange:C=>u(C.target.value),placeholder:"YY-M(M) or YYYY-M(M)"}),A&&n.jsx("div",{className:"nc-month-error-text",children:A})]})]}),y&&!N&&!A&&n.jsx("div",{className:"nc-month-range-error",children:"End month must be after or equal to start month"}),n.jsxs("div",{className:"nc-month-range-picker-footer",children:[n.jsx(F,{variant:"primary",onClick:k,disabled:!f||!b||!!N||!!A||!!y,children:"Apply"}),n.jsx(F,{variant:"ghost",onClick:v,children:"Cancel"})]})]})}),document.body):null;return n.jsxs("div",{className:`nc-month-range-picker ${c==="small"?"nc-small ":""}${o}`,children:[s&&n.jsx("label",{className:`nc-label${c==="small"?" nc-small":""}`,children:s}),n.jsx("button",{ref:m,className:`nc-month-range-picker-input${c==="small"?" nc-small":""}`,onClick:j,disabled:i,children:w}),M]})}function At({value:e,onChange:t,min:r,max:s,step:o=1,label:i,disabled:c,size:a="default"}){const d=a==="small",f=()=>{const u=e-o;r!==void 0&&u<r||t(parseFloat(u.toFixed(10)))},h=()=>{const u=e+o;s!==void 0&&u>s||t(parseFloat(u.toFixed(10)))},b=u=>{const p=parseFloat(u.target.value);isNaN(p)||r!==void 0&&p<r||s!==void 0&&p>s||t(p)};return n.jsxs("div",{className:`nc-col nc-number-input-col ${d?"nc-small":""}`,children:[i&&n.jsx("span",{className:`nc-label ${d?"nc-small":""}`,children:i}),n.jsxs("div",{className:`nc-number-input-container ${d?"nc-small":""}`,children:[n.jsx("input",{className:`nc-input nc-number-input ${d?"nc-small":""}`,type:"number",value:e,onChange:b,min:r,max:s,step:o,disabled:c}),n.jsx("button",{className:`nc-button nc-ghost nc-number-input-button ${d?"nc-small":""}`,onClick:f,disabled:c||r!==void 0&&e<=r,children:"−"}),n.jsx("button",{className:`nc-button nc-ghost nc-number-input-button ${d?"nc-small":""}`,onClick:h,disabled:c||s!==void 0&&e>=s,children:"+"})]})]})}function Rt({value:e,onChange:t,min:r=0,max:s=100,step:o=1,label:i,disabled:c,showValue:a=!0,formatValue:d=h=>h.toString(),width:f=200}){const h=u=>{const p=parseFloat(u.target.value);t(p)},b=(e-r)/(s-r)*100;return n.jsxs("div",{className:"nc-col",style:{gap:6},children:[i&&n.jsx("span",{className:"nc-label",children:i}),n.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[n.jsx("input",{type:"range",className:"nc-slider",value:e,onChange:h,min:r,max:s,step:o,disabled:c,style:{width:f,"--nc-slider-percentage":`${b}%`}}),a&&n.jsx("span",{style:{color:"var(--nc-text)",fontFamily:"monospace",fontSize:14,minWidth:60,textAlign:"right"},children:d(e)})]})]})}const It=({size:e=24,className:t,style:r})=>n.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,style:r,children:n.jsx("polyline",{points:"18 15 12 9 6 15"})});function Le({children:e,className:t="",style:r}){return n.jsx("div",{className:`nc-tab-panel ${t}`,style:r,children:e})}function Mt({active:e,children:t,keepMounted:r=!1,className:s="",style:o}){const i=l.Children.toArray(t).filter(a=>l.isValidElement(a)&&(a.type===Le||a.type.displayName==="TabPanel"));if(r)return n.jsx("div",{className:`nc-tab-panels ${s}`,style:o,children:i.map(a=>{const d=a.props.tab===e;return n.jsx("div",{className:`nc-tab-panel-wrapper ${d?"nc-active":""}`,style:{display:d?void 0:"none"},"aria-hidden":!d,children:a},a.props.tab)})});const c=i.find(a=>a.props.tab===e);return n.jsx("div",{className:`nc-tab-panels ${s}`,style:o,children:c})}function Et({tabs:e,active:t,onChange:r,onClose:s,permanentTabs:o,className:i,toolbar:c,multiline:a,orientation:d="horizontal",style:f}){const h=l.useRef(null),[b,u]=l.useState(!1),[p,g]=l.useState(!1),m=d==="verticalLeft"||d==="verticalRight",x=l.useRef(!1),j=l.useRef(0),v=l.useRef(0),k=l.useRef(!1);l.useEffect(()=>{const y=()=>{if(h.current)if(m){const{scrollTop:C,scrollHeight:S,clientHeight:$}=h.current;u(C>1),g(C<S-$-1)}else{const{scrollLeft:C,scrollWidth:S,clientWidth:$}=h.current;u(C>1),g(C<S-$-1)}},M=h.current;if(M)return y(),M.addEventListener("scroll",y),window.addEventListener("resize",y),()=>{M.removeEventListener("scroll",y),window.removeEventListener("resize",y)}},[e,m]);const w=y=>{h.current&&(x.current=!0,k.current=!1,j.current=m?y.clientY:y.clientX,v.current=m?h.current.scrollTop:h.current.scrollLeft,h.current.style.cursor="grabbing",h.current.style.userSelect="none")},N=y=>{if(!x.current||!h.current)return;const M=m?y.clientY:y.clientX,C=j.current-M;Math.abs(C)>3&&(k.current=!0),m?h.current.scrollTop=v.current+C:h.current.scrollLeft=v.current+C},A=()=>{h.current&&(x.current=!1,h.current.style.cursor="",h.current.style.userSelect="")},P=()=>{A()};l.useEffect(()=>{const y=h.current;if(!y||m)return;const M=C=>{C.deltaY!==0&&(C.preventDefault(),y.scrollLeft+=C.deltaY*.3)};return y.addEventListener("wheel",M,{passive:!1}),()=>{y.removeEventListener("wheel",M)}},[m]);const E=y=>{k.current||r(y)};return n.jsxs("div",{className:`nc-tab-container ${m?`nc-vertical nc-${d}`:""} ${i||""}`,style:f,children:[n.jsxs("div",{className:"nc-tab-scroll-wrapper",children:[b&&n.jsx("div",{className:`nc-tab-scroll-indicator ${m?"nc-top":"nc-left"}`,children:m?n.jsx(It,{size:16}):n.jsx(O.ChevronLeftIcon,{size:16})}),n.jsx("div",{ref:h,className:`nc-tab-scroll ${a?"nc-multiline":""}`,onMouseDown:w,onMouseMove:N,onMouseUp:A,onMouseLeave:P,style:{cursor:"grab"},children:e.map(y=>{const M=typeof y=="string"?y:y.id,C=typeof y=="string"?y:y.label,S=s&&!(o!=null&&o.includes(M));return n.jsxs("div",{className:`nc-tab-item ${t===M?"nc-active":""} ${S?"nc-closable":""}`,onClick:()=>E(M),role:"button",tabIndex:0,onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&r(M)},children:[n.jsx("span",{className:"nc-tab-label",children:m?C:typeof C=="string"?C.toUpperCase():C}),S&&n.jsx("span",{className:"nc-tab-close",role:"button",tabIndex:0,"aria-label":`Close ${typeof C=="string"?C:M}`,onClick:$=>{$.stopPropagation(),s(M)},onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.stopPropagation(),s(M))},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},M)})}),p&&n.jsx("div",{className:`nc-tab-scroll-indicator ${m?"nc-bottom":"nc-right"}`,children:m?n.jsx(O.ChevronDownIcon,{size:16}):n.jsx(O.ChevronRightIcon,{size:16})})]}),c&&n.jsx("div",{className:"nc-tab-toolbar",children:c})]})}function $t({checked:e,onChange:t,disabled:r,label:s}){return n.jsxs("label",{className:"nc-row",style:{gap:10,alignItems:"center",cursor:r?"not-allowed":"pointer"},children:[s&&n.jsx("span",{className:"nc-label",children:s}),n.jsx("span",{role:"switch","aria-checked":e,tabIndex:0,onKeyDown:o=>{r||(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t(!e))},onClick:()=>!r&&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:n.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 Me=["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 Tt(e,t){const s=e.slice(0,t).split(`
|
|
2
2
|
`),o=s.length,c=s[o-1].split(" "),a=c.length,d=c[a-1].length+1;return{line:o,column:a,character:d,offset:t}}function Pt(e,t,r,s){const o=e.split(`
|
|
3
3
|
`),i=Math.max(1,Math.min(t,o.length));let c=0;for(let b=0;b<i-1;b++)c+=o[b].length+1;const d=o[i-1].split(" "),f=Math.max(1,Math.min(r,d.length));for(let b=0;b<f-1;b++)c+=d[b].length+1;const h=Math.max(1,Math.min(s,d[f-1].length+1));return c+=h-1,c}function zt(e,t){const r=e.split(`
|
|
4
4
|
`),s=Math.max(1,Math.min(t,r.length));let o=0;for(let i=0;i<s-1;i++)o+=r[i].length+1;return o}const Bt=l.forwardRef(function({value:t,onChange:r,placeholder:s,className:o,style:i,showLineNumbers:c=!1,onCursorChange:a,highlightLine:d},f){const h=l.useRef(null),b=l.useRef(null),u=l.useRef(null);l.useImperativeHandle(f,()=>({goToLine(v){const k=h.current;if(!k)return;const w=zt(t,v);k.focus(),k.setSelectionRange(w,w);const N=parseFloat(getComputedStyle(k).lineHeight)||18;k.scrollTop=(Math.max(1,v)-1)*N,g(),p()},goToPosition(v,k,w){const N=h.current;if(!N)return;const A=Pt(t,v,k,w);N.focus(),N.setSelectionRange(A,A);const P=parseFloat(getComputedStyle(N).lineHeight)||18;N.scrollTop=(Math.max(1,v)-1)*P,g(),p()}}),[t]);const p=l.useCallback(()=>{if(!a||!h.current)return;const v=Tt(t,h.current.selectionStart);a(v)},[a,t]),g=l.useCallback(()=>{const v=h.current;v&&(b.current&&(b.current.scrollTop=v.scrollTop,b.current.scrollLeft=v.scrollLeft),u.current&&(u.current.scrollTop=v.scrollTop))},[]);l.useEffect(()=>{if(d==null||d<1)return;const v=h.current;if(!v)return;const k=parseFloat(getComputedStyle(v).lineHeight)||18,w=(d-1)*k,N=w+k;(w<v.scrollTop||N>v.scrollTop+v.clientHeight)&&(v.scrollTop=w-v.clientHeight/2+k/2),g()},[d]);const m=l.useMemo(()=>t.split(`
|