@uxuissk/design-system 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sellsuki-ds.css +1 -1
- package/dist/sellsuki-ds.js +5105 -2347
- package/dist/sellsuki-ds.umd.cjs +80 -80
- package/dist/types/index.d.ts +1000 -9
- package/package.json +1 -1
package/dist/sellsuki-ds.umd.cjs
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
${
|
|
3
|
-
${
|
|
1
|
+
(function(C,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react"),require("lucide-react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","lucide-react","react-dom"],e):(C=typeof globalThis<"u"?globalThis:C||self,e(C.SellsukiDS={},C.jsxRuntime,C.React,C.LucideReact,C.ReactDOM))})(this,(function(C,e,c,v,Le){"use strict";const fo={sm:"h-8 px-3 gap-1.5",md:"h-9 px-4 gap-2",lg:"h-10 px-5 gap-2",xl:"h-11 px-6 gap-2.5"},ho={sm:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},md:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},lg:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},xl:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"}},zr={sm:14,md:16,lg:18,xl:20},Cr={primary:"bg-primary text-primary-foreground border border-primary hover:bg-primary/90 active:bg-primary/80 shadow-elevation-sm",secondary:"bg-secondary text-secondary-foreground border border-secondary hover:bg-secondary/90 active:bg-secondary/80 shadow-elevation-sm",outline:"bg-transparent text-foreground border border-border hover:bg-muted active:bg-muted/80",ghost:"bg-transparent text-foreground border border-transparent hover:bg-muted active:bg-muted/80",destructive:"bg-destructive text-destructive-foreground border border-destructive hover:bg-destructive/90 active:bg-destructive/80 shadow-elevation-sm",link:"bg-transparent text-primary border border-transparent underline-offset-4 hover:underline px-0 h-auto"},Ue=c.forwardRef(({variant:r="primary",size:t="md",loading:o=!1,loadingText:a,leftIcon:s,rightIcon:n,fullWidth:l=!1,active:d=!1,disabled:i,children:f,className:u="",...x},y)=>{const h=i||o;return e.jsx("button",{ref:y,disabled:h,className:`inline-flex items-center justify-center rounded-[var(--radius-md)] transition-all duration-150
|
|
2
|
+
${fo[t]}
|
|
3
|
+
${Cr[r]}
|
|
4
4
|
${l?"w-full":""}
|
|
5
|
-
${
|
|
6
|
-
${
|
|
5
|
+
${d?"ring-2 ring-ring/30":""}
|
|
6
|
+
${h?"opacity-50 cursor-not-allowed pointer-events-none":"cursor-pointer active:scale-[0.98]"}
|
|
7
7
|
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40
|
|
8
|
-
${
|
|
9
|
-
`,style:
|
|
10
|
-
${
|
|
11
|
-
${
|
|
12
|
-
${
|
|
8
|
+
${u}
|
|
9
|
+
`,style:ho[t],...x,children:o?e.jsxs(e.Fragment,{children:[e.jsx(v.Loader2,{size:zr[t],className:"animate-spin flex-shrink-0"}),a&&e.jsx("span",{children:a})]}):e.jsxs(e.Fragment,{children:[s&&e.jsx("span",{className:"flex-shrink-0",children:s}),f&&e.jsx("span",{className:"inline-flex items-center gap-2",children:f}),n&&e.jsx("span",{className:"flex-shrink-0",children:n})]})})});Ue.displayName="DSButton";const Fr=c.forwardRef(({variant:r="ghost",size:t="md",loading:o=!1,icon:a,disabled:s,className:n="",...l},d)=>{const i=s||o,f={sm:"w-8 h-8",md:"w-9 h-9",lg:"w-10 h-10",xl:"w-11 h-11"};return e.jsx("button",{ref:d,disabled:i,className:`inline-flex items-center justify-center rounded-[var(--radius-md)] transition-all duration-150
|
|
10
|
+
${f[t]}
|
|
11
|
+
${Cr[r]}
|
|
12
|
+
${i?"opacity-50 cursor-not-allowed pointer-events-none":"cursor-pointer active:scale-[0.98]"}
|
|
13
13
|
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40
|
|
14
14
|
${n}
|
|
15
|
-
`,...l,children:o?e.jsx(v.Loader2,{size:
|
|
16
|
-
${
|
|
17
|
-
${
|
|
18
|
-
${
|
|
19
|
-
${
|
|
20
|
-
${
|
|
21
|
-
${
|
|
22
|
-
`,children:[
|
|
23
|
-
${
|
|
24
|
-
${
|
|
25
|
-
${
|
|
26
|
-
${
|
|
27
|
-
${
|
|
28
|
-
`,children:[e.jsx("textarea",{ref:
|
|
29
|
-
${
|
|
30
|
-
${i?"!cursor-not-allowed":""}
|
|
31
|
-
focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 outline-none`,children:t?e.jsx(v.Minus,{size:p.icon,strokeWidth:3}):f?e.jsx(v.Check,{size:p.icon,strokeWidth:3}):null}),(a||n)&&e.jsxs("div",{className:"min-w-0",children:[a&&e.jsx("label",{htmlFor:w,className:`text-foreground block cursor-pointer ${i?"!cursor-not-allowed":""}`,style:p.labelStyle,onClick:u,children:a}),n&&e.jsx("span",{className:"text-muted-foreground block",style:p.descStyle,children:n}),d&&e.jsx("span",{className:"text-destructive block mt-0.5",style:p.descStyle,children:d})]})]})}function xt({label:r,children:t,direction:o="vertical",className:s=""}){return e.jsxs("fieldset",{className:`${s}`,children:[r&&e.jsx("legend",{className:"text-foreground mb-2 block",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},children:r}),e.jsx("div",{className:`flex ${o==="vertical"?"flex-col gap-3":"flex-wrap gap-4"}`,children:t})]})}const ir=b.createContext(null),mt={sm:{outer:"w-4 h-4",inner:"w-1.5 h-1.5",labelStyle:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},descStyle:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"}},md:{outer:"w-5 h-5",inner:"w-2 h-2",labelStyle:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},descStyle:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"}},lg:{outer:"w-6 h-6",inner:"w-2.5 h-2.5",labelStyle:{fontFamily:"var(--font-caption)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-label)"},descStyle:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"}}};function dr({value:r,label:t,description:o,disabled:s,size:a,className:n=""}){const l=b.useContext(ir),i=l?l.value===r:!1,d=s??(l==null?void 0:l.disabled)??!1,c=a??(l==null?void 0:l.size)??"md",h=mt[c],g=()=>{d||l==null||l.onChange(r)};return e.jsxs("div",{className:`inline-flex items-start gap-2.5 ${d?"opacity-50":""} ${n}`,children:[e.jsx("button",{role:"radio","aria-checked":i,disabled:d,onClick:g,className:`${h.outer} flex-shrink-0 rounded-full border-2 transition-all flex items-center justify-center cursor-pointer mt-0.5
|
|
32
|
-
${i?"border-primary":"border-border hover:border-primary/50"}
|
|
15
|
+
`,...l,children:o?e.jsx(v.Loader2,{size:zr[t],className:"animate-spin"}):a})});Fr.displayName="IconButton";function uo({children:r,className:t=""}){return e.jsx("div",{className:`inline-flex [&>button]:rounded-none [&>button:first-child]:rounded-l-[var(--radius-md)] [&>button:last-child]:rounded-r-[var(--radius-md)] [&>button:not(:last-child)]:border-r-0 ${t}`,children:r})}const Mr={sm:{wrapper:"h-9 px-2.5 gap-1.5",textStyle:{fontFamily:"var(--font-caption)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-caption)"},icon:14},md:{wrapper:"h-11 px-3 gap-2",textStyle:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},icon:16},lg:{wrapper:"h-13 px-4 gap-2.5",textStyle:{fontFamily:"var(--font-p)",fontSize:"var(--text-p)",fontWeight:"var(--weight-p)"},icon:18}},Wr={default:{base:"border border-border bg-input-background",hover:"hover:border-foreground/30",focus:"ring-2 ring-ring/20 border-ring"},outlined:{base:"border-2 border-border bg-transparent",hover:"hover:border-foreground/40",focus:"ring-2 ring-ring/20 border-ring"},filled:{base:"border border-transparent bg-muted",hover:"hover:bg-muted/80",focus:"ring-2 ring-ring/20 border-ring bg-input-background"},ghost:{base:"border border-transparent bg-transparent",hover:"hover:bg-muted/50",focus:"ring-2 ring-ring/20 bg-input-background"}},Lr={default:"",error:"!border-destructive ring-destructive/20",success:"!border-chart-2 ring-chart-2/20",warning:"!border-chart-5 ring-chart-5/20"},De={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},Xe=c.forwardRef(({label:r,helperText:t,errorMessage:o,successMessage:a,size:s="md",variant:n="default",state:l="default",leftIcon:d,rightIcon:i,prefix:f,suffix:u,clearable:x=!1,showPasswordToggle:y=!1,loading:h=!1,fullWidth:p=!0,required:g=!1,showCount:m=!1,onClear:S,disabled:z,type:b="text",value:w,defaultValue:N,onChange:F,className:W="",...D},M)=>{const[L,I]=c.useState(!1),[A,k]=c.useState(!1),[$,E]=c.useState(N??""),T=w!==void 0?w:$,P=String(T).length,B=D.maxLength,_=Mr[s],K=Wr[n],R=o?"error":l,te=b==="password",oe=te&&A?"text":b,Q=c.useCallback(H=>{E(H.target.value),F==null||F(H)},[F]),ee=c.useCallback(()=>{E(""),S==null||S()},[S]),Y=String(T).length>0;return e.jsxs("div",{className:`${p?"w-full":"inline-flex flex-col"} ${W}`,children:[r&&e.jsxs("label",{className:"block mb-1.5 text-foreground",children:[r,g&&e.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),e.jsxs("div",{className:`flex items-center rounded-[var(--radius-md)] transition-all duration-150
|
|
16
|
+
${_.wrapper}
|
|
17
|
+
${K.base}
|
|
18
|
+
${z?"":K.hover}
|
|
19
|
+
${L&&!z?K.focus:""}
|
|
20
|
+
${z?"opacity-50 cursor-not-allowed":""}
|
|
21
|
+
${Lr[R]}
|
|
22
|
+
`,children:[d&&e.jsx("span",{className:"flex-shrink-0 text-muted-foreground",children:d}),f&&e.jsx("span",{className:"flex-shrink-0 text-muted-foreground",style:De,children:f}),e.jsx("input",{ref:M,type:oe,disabled:z||h,value:T,onChange:Q,onFocus:()=>I(!0),onBlur:()=>I(!1),className:"flex-1 min-w-0 bg-transparent border-none outline-none text-foreground placeholder:text-muted-foreground disabled:cursor-not-allowed",style:_.textStyle,...D}),u&&e.jsx("span",{className:"flex-shrink-0 text-muted-foreground",style:De,children:u}),x&&Y&&!z&&e.jsx("button",{type:"button",onClick:ee,className:"flex-shrink-0 text-muted-foreground hover:text-foreground transition-colors cursor-pointer p-0.5",children:e.jsx(v.X,{size:_.icon-2})}),te&&y&&e.jsx("button",{type:"button",onClick:()=>k(!A),className:"flex-shrink-0 text-muted-foreground hover:text-foreground transition-colors cursor-pointer p-0.5",children:A?e.jsx(v.EyeOff,{size:_.icon}):e.jsx(v.Eye,{size:_.icon})}),i&&!te&&e.jsx("span",{className:"flex-shrink-0 text-muted-foreground",children:i}),h&&e.jsx("span",{className:"flex-shrink-0",children:e.jsx("span",{className:"block w-4 h-4 border-2 border-muted-foreground border-t-transparent rounded-full animate-spin"})})]}),m&&B&&e.jsxs("div",{className:"flex justify-end mt-1",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-caption)",color:P>=B?"var(--destructive)":"var(--muted-foreground)"},children:[P," / ",B]}),(t||o||a)&&e.jsxs("div",{className:"mt-1.5 flex items-center gap-1",children:[R==="error"&&e.jsx(v.AlertCircle,{size:12,className:"text-destructive flex-shrink-0"}),R==="success"&&e.jsx(v.CheckCircle2,{size:12,className:"text-chart-2 flex-shrink-0"}),e.jsx("span",{className:`${R==="error"?"text-destructive":R==="success"?"text-chart-2":"text-muted-foreground"}`,style:De,children:o||a||t})]})]})});Xe.displayName="DSInput";const Ke=c.forwardRef(({label:r,helperText:t,errorMessage:o,successMessage:a,size:s="md",variant:n="default",state:l="default",showCharCount:d=!1,maxLength:i,required:f=!1,disabled:u,value:x,defaultValue:y,onChange:h,className:p="",...g},m)=>{const[S,z]=c.useState(!1),[b,w]=c.useState(String(y??"").length),N=Mr[s],F=Wr[n],W=o?"error":l,D=c.useCallback(M=>{w(M.target.value.length),h==null||h(M)},[h]);return e.jsxs("div",{className:`w-full ${p}`,children:[r&&e.jsxs("label",{className:"block mb-1.5 text-foreground",children:[r,f&&e.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),e.jsxs("div",{className:`transition-all duration-150 overflow-hidden rounded-[var(--radius-md)]
|
|
23
|
+
${F.base}
|
|
24
|
+
${u?"":F.hover}
|
|
25
|
+
${S&&!u?F.focus:""}
|
|
26
|
+
${u?"opacity-50 cursor-not-allowed":""}
|
|
27
|
+
${Lr[W]}
|
|
28
|
+
`,children:[e.jsx("textarea",{ref:m,disabled:u,value:x,defaultValue:y,maxLength:i,onChange:D,onFocus:()=>z(!0),onBlur:()=>z(!1),className:"w-full min-h-[100px] px-3 py-2.5 bg-transparent border-none outline-none text-foreground placeholder:text-muted-foreground resize-y disabled:cursor-not-allowed",style:N.textStyle,...g}),d&&e.jsxs("div",{className:"flex justify-end px-3 py-1.5 border-t border-border text-muted-foreground bg-muted/20",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-label)"},children:[b,i?` / ${i}`:""," chars"]})]}),(t||o||a)&&e.jsxs("div",{className:"mt-1.5 flex items-center gap-1",children:[W==="error"&&e.jsx(v.AlertCircle,{size:12,className:"text-destructive flex-shrink-0"}),W==="success"&&e.jsx(v.CheckCircle2,{size:12,className:"text-chart-2 flex-shrink-0"}),e.jsx("span",{className:`${W==="error"?"text-destructive":W==="success"?"text-chart-2":"text-muted-foreground"}`,style:De,children:o||a||t})]})]})});Ke.displayName="DSTextarea";const bo={info:{bg:"bg-primary/5",border:"border-primary/30",text:"text-primary",icon:e.jsx(v.Info,{size:18})},success:{bg:"bg-chart-2/5",border:"border-chart-2/30",text:"text-chart-2",icon:e.jsx(v.CheckCircle2,{size:18})},warning:{bg:"bg-chart-5/5",border:"border-chart-5/30",text:"text-chart-5",icon:e.jsx(v.AlertTriangle,{size:18})},error:{bg:"bg-destructive/5",border:"border-destructive/30",text:"text-destructive",icon:e.jsx(v.XCircle,{size:18})}};function Ze({variant:r="info",title:t,children:o,dismissible:a=!1,onDismiss:s,action:n,icon:l,className:d=""}){const[i,f]=c.useState(!0),u=bo[r];if(!i)return null;const x=()=>{f(!1),s==null||s()};return e.jsxs("div",{className:`flex gap-3 p-4 rounded-[var(--radius)] border ${u.bg} ${u.border} ${d}`,role:"alert",children:[e.jsx("span",{className:`flex-shrink-0 mt-0.5 ${u.text}`,children:l??u.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[t&&e.jsx("span",{className:`block ${u.text}`,style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},children:t}),e.jsx("span",{className:"text-foreground block",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},children:o}),n&&e.jsx("div",{className:"mt-2",children:n})]}),a&&e.jsx("button",{onClick:x,className:"flex-shrink-0 text-muted-foreground hover:text-foreground transition-colors cursor-pointer","aria-label":"Dismiss",children:e.jsx(v.X,{size:16})})]})}let Dr=[],ze=[];function Ar(){Dr.forEach(r=>r([...ze]))}const me={show:r=>{const t={...r,id:`toast-${Date.now()}-${Math.random().toString(36).slice(2)}`};ze=[...ze,t],Ar(),setTimeout(()=>{me.dismiss(t.id)},r.duration??4e3)},info:(r,t)=>me.show({variant:"info",message:r,title:t}),success:(r,t)=>me.show({variant:"success",message:r,title:t}),warning:(r,t)=>me.show({variant:"warning",message:r,title:t}),error:(r,t)=>me.show({variant:"error",message:r,title:t}),dismiss:r=>{ze=ze.filter(t=>t.id!==r),Ar()}};function jr(){const[r,t]=c.useState([]),o=c.useRef(!1);return o.current||(o.current=!0,Dr.push(t)),r.length===0?null:e.jsx("div",{className:"fixed bottom-4 right-4 z-[200] flex flex-col gap-2 max-w-sm w-full pointer-events-none",children:r.map(a=>e.jsx("div",{className:"pointer-events-auto animate-in slide-in-from-right fade-in duration-300",children:e.jsx(Ze,{variant:a.variant,title:a.title,dismissible:!0,onDismiss:()=>me.dismiss(a.id),children:a.message})},a.id))})}const go={default:"bg-primary text-primary-foreground",secondary:"bg-secondary/15 text-secondary",outline:"bg-transparent border border-border text-foreground",destructive:"bg-destructive/15 text-destructive",success:"bg-chart-2/15 text-chart-2",warning:"bg-chart-5/15 text-chart-5"},po={sm:{className:"px-1.5 py-0.5 gap-1",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},iconSize:10},md:{className:"px-2.5 py-0.5 gap-1.5",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},iconSize:12},lg:{className:"px-3 py-1 gap-1.5",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},iconSize:14}},vo={default:"bg-primary-foreground",secondary:"bg-secondary",outline:"bg-foreground",destructive:"bg-destructive",success:"bg-chart-2",warning:"bg-chart-5"};function mo({children:r,variant:t="default",size:o="md",icon:a,dot:s,removable:n,onRemove:l,className:d=""}){const i=po[o];return e.jsxs("span",{className:`inline-flex items-center rounded-full whitespace-nowrap ${go[t]} ${i.className} ${d}`,style:{...i.style,lineHeight:"1.2"},children:[s&&e.jsx("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${vo[t]}`}),a&&e.jsx("span",{className:"flex-shrink-0",children:a}),e.jsx("span",{children:r}),n&&e.jsx("button",{onClick:l,className:"flex-shrink-0 hover:opacity-70 transition-opacity cursor-pointer rounded-full -mr-0.5","aria-label":"Remove",children:e.jsx(v.X,{size:i.iconSize})})]})}const xo={sm:{box:"w-4 h-4",icon:10,labelStyle:{fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},descStyle:{fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"}},md:{box:"w-5 h-5",icon:12,labelStyle:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},descStyle:{fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"}},lg:{box:"w-6 h-6",icon:14,labelStyle:{fontFamily:"var(--font-label)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-label)"},descStyle:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"}}};function ye({checked:r,indeterminate:t=!1,defaultChecked:o=!1,onChange:a,label:s,description:n,size:l="md",disabled:d=!1,error:i,className:f="",id:u}){const[x,y]=c.useState(o),h=r??x,p=xo[l],g=u??`cb-${c.useId()}`,m=()=>{if(d)return;const z=!h;r===void 0&&y(z),a==null||a(z)},S=h||t;return e.jsxs("div",{className:`inline-flex items-start gap-2.5 ${d?"opacity-50":""} ${f}`,children:[e.jsx("button",{id:g,role:"checkbox","aria-checked":t?"mixed":h,disabled:d,onClick:m,className:`${p.box} flex-shrink-0 rounded-[var(--radius-sm)] border-2 transition-all flex items-center justify-center cursor-pointer mt-0.5
|
|
29
|
+
${S?"bg-primary border-primary text-primary-foreground":i?"border-destructive bg-card":"border-border bg-card hover:border-primary/50"}
|
|
33
30
|
${d?"!cursor-not-allowed":""}
|
|
34
|
-
focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 outline-none`,children:
|
|
31
|
+
focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 outline-none`,children:t?e.jsx(v.Minus,{size:p.icon,strokeWidth:3}):h?e.jsx(v.Check,{size:p.icon,strokeWidth:3}):null}),(s||n)&&e.jsxs("div",{className:"min-w-0",children:[s&&e.jsx("label",{htmlFor:g,className:`text-foreground block cursor-pointer ${d?"!cursor-not-allowed":""}`,style:p.labelStyle,onClick:m,children:s}),n&&e.jsx("span",{className:"text-muted-foreground block",style:p.descStyle,children:n}),i&&e.jsx("span",{className:"text-destructive block mt-0.5",style:p.descStyle,children:i})]})]})}function yo({label:r,children:t,direction:o="vertical",className:a=""}){return e.jsxs("fieldset",{className:`${a}`,children:[r&&e.jsx("legend",{className:"text-foreground mb-2 block",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},children:r}),e.jsx("div",{className:`flex ${o==="vertical"?"flex-col gap-3":"flex-wrap gap-4"}`,children:t})]})}const Er=c.createContext(null),wo={sm:{outer:"w-4 h-4",inner:"w-1.5 h-1.5",labelStyle:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},descStyle:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"}},md:{outer:"w-5 h-5",inner:"w-2 h-2",labelStyle:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},descStyle:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"}},lg:{outer:"w-6 h-6",inner:"w-2.5 h-2.5",labelStyle:{fontFamily:"var(--font-caption)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-label)"},descStyle:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"}}};function Tr({value:r,label:t,description:o,disabled:a,size:s,className:n=""}){const l=c.useContext(Er),d=l?l.value===r:!1,i=a??(l==null?void 0:l.disabled)??!1,f=s??(l==null?void 0:l.size)??"md",u=wo[f],x=()=>{i||l==null||l.onChange(r)};return e.jsxs("div",{className:`inline-flex items-start gap-2.5 ${i?"opacity-50":""} ${n}`,children:[e.jsx("button",{role:"radio","aria-checked":d,disabled:i,onClick:x,className:`${u.outer} flex-shrink-0 rounded-full border-2 transition-all flex items-center justify-center cursor-pointer mt-0.5
|
|
32
|
+
${d?"border-primary":"border-border hover:border-primary/50"}
|
|
33
|
+
${i?"!cursor-not-allowed":""}
|
|
34
|
+
focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 outline-none`,children:d&&e.jsx("span",{className:`${u.inner} rounded-full bg-primary transition-transform scale-100`})}),(t||o)&&e.jsxs("div",{className:"min-w-0",children:[t&&e.jsx("span",{className:`text-foreground block cursor-pointer ${i?"!cursor-not-allowed":""}`,style:u.labelStyle,onClick:x,children:t}),o&&e.jsx("span",{className:"text-muted-foreground block",style:u.descStyle,children:o})]})]})}function No({name:r,value:t,defaultValue:o="",onChange:a,label:s,size:n="md",disabled:l=!1,direction:d="vertical",children:i,error:f,className:u=""}){const[x,y]=c.useState(o),h=t??x,p=g=>{t===void 0&&y(g),a==null||a(g)};return e.jsx(Er.Provider,{value:{value:h,onChange:p,size:n,disabled:l,name:r},children:e.jsxs("fieldset",{className:u,role:"radiogroup",children:[s&&e.jsx("legend",{className:"text-foreground mb-2 block",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},children:s}),e.jsx("div",{className:`flex ${d==="vertical"?"flex-col gap-3":"flex-wrap gap-4"}`,children:i}),f&&e.jsx("span",{className:"text-destructive block mt-1.5",style:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},children:f})]})})}const So=["Su","Mo","Tu","We","Th","Fr","Sa"],qe=["January","February","March","April","May","June","July","August","September","October","November","December"];function Ce(r,t){return r.getFullYear()===t.getFullYear()&&r.getMonth()===t.getMonth()&&r.getDate()===t.getDate()}function Ir(r,t,o){if(!t||!o)return!1;const a=r.getTime();return a>t.getTime()&&a<o.getTime()}function Br(r,t,o,a){return!!(t&&r<new Date(t.getFullYear(),t.getMonth(),t.getDate())||o&&r>new Date(o.getFullYear(),o.getMonth(),o.getDate())||a!=null&&a.some(s=>Ce(s,r)))}function ko(r,t){return new Date(r,t+1,0).getDate()}function _r(r,t){const o=new Date(r,t,1).getDay(),a=ko(r,t),s=[];for(let n=0;n<o;n++)s.push(null);for(let n=1;n<=a;n++)s.push(new Date(r,t,n));return s}function Ae(r,t){if(!r)return"";const o=String(r.getDate()).padStart(2,"0"),a=String(r.getMonth()+1).padStart(2,"0"),s=r.getFullYear();let n=`${o}/${a}/${s}`;if(t){const l=String(r.getHours()).padStart(2,"0"),d=String(r.getMinutes()).padStart(2,"0");n+=` ${l}:${d}`}return n}const $o={sm:{trigger:"h-8 px-2.5",text:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},icon:14,cell:"w-7 h-7"},md:{trigger:"h-10 px-3",text:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},icon:16,cell:"w-9 h-9"},lg:{trigger:"h-12 px-4",text:{fontFamily:"var(--font-caption)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-caption)"},icon:18,cell:"w-10 h-10"}},zo={default:"bg-input-background border border-border",outlined:"bg-transparent border-2 border-border",filled:"bg-muted/30 border border-transparent",ghost:"bg-transparent border border-transparent"},Co={default:"focus-within:ring-2 focus-within:ring-ring/30 focus-within:border-primary",error:"ring-2 ring-destructive/30 border-destructive",success:"ring-2 ring-chart-2/30 border-chart-2"};function Fo({value:r=null,rangeValue:t,onChange:o,onRangeChange:a,mode:s="single",label:n,placeholder:l,helperText:d,errorMessage:i,successMessage:f,size:u="md",variant:x="default",state:y="default",disabled:h=!1,required:p=!1,clearable:g=!1,showTime:m=!1,minDate:S,maxDate:z,disabledDates:b,showToday:w=!0,footer:N,fullWidth:F=!1}){const[W,D]=c.useState(!1),[M,L]=c.useState(()=>r??new Date),[I,A]=c.useState("days"),[k,$]=c.useState(null),[E,T]=c.useState(()=>r?r.getHours():0),[P,B]=c.useState(()=>r?r.getMinutes():0),_=c.useRef(null),K=$o[u];c.useEffect(()=>{function G(V){_.current&&!_.current.contains(V.target)&&(D(!1),A("days"))}return W&&document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[W]),c.useMemo(()=>_r(M.getFullYear(),M.getMonth()),[M]);const R=c.useMemo(()=>new Date,[]),te=()=>L(new Date(M.getFullYear(),M.getMonth()-1,1)),oe=()=>L(new Date(M.getFullYear(),M.getMonth()+1,1)),Q=()=>L(new Date(M.getFullYear()-1,M.getMonth(),1)),ee=()=>L(new Date(M.getFullYear()+1,M.getMonth(),1)),Y=c.useCallback(G=>{if(!Br(G,S,z,b))if(s==="single"){let V=new Date(G);m&&V.setHours(E,P),o==null||o(V),m||(D(!1),A("days"))}else{const V=t==null?void 0:t.start,de=t==null?void 0:t.end;!V||V&&de?a==null||a({start:G,end:null}):(G<V?a==null||a({start:G,end:V}):a==null||a({start:V,end:G}),D(!1),A("days"))}},[s,o,a,t,S,z,b,m,E,P]),H=G=>{G.stopPropagation(),s==="single"?o==null||o(null):a==null||a({start:null,end:null})},q=()=>{const G=new Date;if(L(G),s==="single"){const V=new Date(G);m&&V.setHours(E,P),o==null||o(V),m||(D(!1),A("days"))}},Z=()=>{if(r){const G=new Date(r);G.setHours(E,P),o==null||o(G)}D(!1),A("days")},le=c.useMemo(()=>s==="single"?Ae(r,m):t!=null&&t.start&&(t!=null&&t.end)?`${Ae(t.start)} – ${Ae(t.end)}`:t!=null&&t.start?`${Ae(t.start)} – ...`:"",[s,r,t,m]),ue=s==="single"?!!r:!!(t!=null&&t.start||t!=null&&t.end),Me=y==="error"?e.jsx(v.AlertCircle,{size:K.icon,className:"text-destructive flex-shrink-0"}):y==="success"?e.jsx(v.CheckCircle2,{size:K.icon,className:"text-chart-2 flex-shrink-0"}):null,U=y==="error"?i:y==="success"?f:d,ve=y==="error"?"text-destructive":y==="success"?"text-chart-2":"text-muted-foreground",We={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},he={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},se={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},Se=Math.floor(M.getFullYear()/12)*12;return e.jsxs("div",{className:`relative ${F?"w-full":""}`,ref:_,children:[n&&e.jsxs("label",{className:"block text-foreground mb-1.5",style:We,children:[n,p&&e.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),e.jsxs("button",{type:"button",onClick:()=>!h&&D(!W),disabled:h,className:`
|
|
35
35
|
w-full flex items-center gap-2 rounded-[var(--radius-md)] transition-all cursor-pointer
|
|
36
|
-
${
|
|
37
|
-
${
|
|
38
|
-
${
|
|
39
|
-
${
|
|
40
|
-
`,style:
|
|
41
|
-
${
|
|
42
|
-
${
|
|
43
|
-
${
|
|
44
|
-
${
|
|
45
|
-
${
|
|
46
|
-
`,style:
|
|
36
|
+
${K.trigger}
|
|
37
|
+
${zo[x]}
|
|
38
|
+
${Co[y]}
|
|
39
|
+
${h?"opacity-50 cursor-not-allowed":"hover:border-primary/50"}
|
|
40
|
+
`,style:K.text,children:[e.jsx(v.Calendar,{size:K.icon,className:"text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:`flex-1 text-left truncate ${ue?"text-foreground":"text-muted-foreground"}`,children:ue?le:l||(s==="range"?"Select date range…":"Select date…")}),Me,g&&ue&&!h&&e.jsx("span",{onClick:H,className:"text-muted-foreground hover:text-foreground cursor-pointer",children:e.jsx(v.X,{size:K.icon-2})})]}),U&&e.jsx("p",{className:`mt-1.5 ${ve}`,style:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},children:U}),W&&e.jsxs("div",{className:"absolute z-50 mt-1.5 bg-popover border border-border rounded-[var(--radius-md)] shadow-elevation-sm overflow-hidden",style:{minWidth:s==="range"?"560px":"300px"},children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:Q,className:"p-1 rounded-[var(--radius-sm)] hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:"Previous year",children:e.jsx(v.ChevronsLeft,{size:16})}),e.jsx("button",{onClick:te,className:"p-1 rounded-[var(--radius-sm)] hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:"Previous month",children:e.jsx(v.ChevronLeft,{size:16})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>A(I==="months"?"days":"months"),className:"px-2 py-1 rounded-[var(--radius-sm)] hover:bg-muted text-foreground transition-colors cursor-pointer",style:se,children:qe[M.getMonth()]}),e.jsx("button",{onClick:()=>A(I==="years"?"days":"years"),className:"px-2 py-1 rounded-[var(--radius-sm)] hover:bg-muted text-foreground transition-colors cursor-pointer",style:se,children:M.getFullYear()})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:oe,className:"p-1 rounded-[var(--radius-sm)] hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:"Next month",children:e.jsx(v.ChevronRight,{size:16})}),e.jsx("button",{onClick:ee,className:"p-1 rounded-[var(--radius-sm)] hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:"Next year",children:e.jsx(v.ChevronsRight,{size:16})})]})]}),I==="days"&&e.jsx("div",{className:`p-3 ${s==="range"?"flex gap-3":""}`,children:(s==="range"?[0,1]:[0]).map(G=>{const V=new Date(M.getFullYear(),M.getMonth()+G,1),de=_r(V.getFullYear(),V.getMonth());return e.jsxs("div",{className:"flex-1",children:[G>0&&e.jsxs("div",{className:"text-center mb-2 text-foreground",style:se,children:[qe[V.getMonth()]," ",V.getFullYear()]}),e.jsx("div",{className:"grid grid-cols-7 mb-1",children:So.map(re=>e.jsx("div",{className:"text-center text-muted-foreground py-1",style:he,children:re},`${G}-${re}`))}),e.jsx("div",{className:"grid grid-cols-7",children:de.map((re,Pe)=>{if(!re)return e.jsx("div",{},`empty-${G}-${Pe}`);const Oe=Br(re,S,z,b),Nr=Ce(re,R),ke=s==="single"?r&&Ce(re,r):(t==null?void 0:t.start)&&Ce(re,t.start)||(t==null?void 0:t.end)&&Ce(re,t.end),Sr=s==="range"&&(Ir(re,(t==null?void 0:t.start)??null,(t==null?void 0:t.end)??null)||(t==null?void 0:t.start)&&!(t!=null&&t.end)&&k&&Ir(re,t.start,k>t.start?k:null));return e.jsx("button",{onClick:()=>Y(re),onMouseEnter:()=>s==="range"&&$(re),disabled:Oe,className:`
|
|
41
|
+
${K.cell} flex items-center justify-center rounded-[var(--radius-sm)] transition-all cursor-pointer
|
|
42
|
+
${Oe?"opacity-30 cursor-not-allowed":"hover:bg-muted"}
|
|
43
|
+
${ke?"bg-primary text-primary-foreground hover:bg-primary/90":""}
|
|
44
|
+
${Sr&&!ke?"bg-accent text-accent-foreground":""}
|
|
45
|
+
${Nr&&!ke?"border border-primary text-primary":""}
|
|
46
|
+
`,style:se,children:re.getDate()},`${G}-${re.getTime()}`)})})]},G)})}),I==="months"&&e.jsx("div",{className:"p-3 grid grid-cols-3 gap-2",children:qe.map((G,V)=>e.jsx("button",{onClick:()=>{L(new Date(M.getFullYear(),V,1)),A("days")},className:`
|
|
47
47
|
py-2.5 rounded-[var(--radius-md)] transition-all cursor-pointer
|
|
48
|
-
${
|
|
49
|
-
`,style:
|
|
48
|
+
${M.getMonth()===V?"bg-primary text-primary-foreground":"text-foreground hover:bg-muted"}
|
|
49
|
+
`,style:se,children:G.substring(0,3)},G))}),I==="years"&&e.jsxs("div",{className:"p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("button",{onClick:()=>L(new Date(M.getFullYear()-12,M.getMonth(),1)),className:"p-1 rounded-[var(--radius-sm)] hover:bg-muted text-muted-foreground hover:text-foreground cursor-pointer",children:e.jsx(v.ChevronLeft,{size:16})}),e.jsxs("span",{className:"text-foreground",style:se,children:[Se," – ",Se+11]}),e.jsx("button",{onClick:()=>L(new Date(M.getFullYear()+12,M.getMonth(),1)),className:"p-1 rounded-[var(--radius-sm)] hover:bg-muted text-muted-foreground hover:text-foreground cursor-pointer",children:e.jsx(v.ChevronRight,{size:16})})]}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:Array.from({length:12},(G,V)=>Se+V).map(G=>e.jsx("button",{onClick:()=>{L(new Date(G,M.getMonth(),1)),A("months")},className:`
|
|
50
50
|
py-2.5 rounded-[var(--radius-md)] transition-all cursor-pointer
|
|
51
|
-
${
|
|
52
|
-
${
|
|
53
|
-
`,style:
|
|
54
|
-
${
|
|
55
|
-
${
|
|
56
|
-
${W?S.active:`${S.base} ${P?"":S.hover}`}`,T=h?(r-1)*d+1:0,E=h?Math.min(r*d,h):0,j={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"};return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[w&&h!==void 0&&e.jsxs("span",{className:"text-muted-foreground",style:j,children:[T,"–",E," of ",h]}),l&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",style:j,children:"Rows per page:"}),e.jsx("select",{value:d,onChange:W=>c==null?void 0:c(Number(W.target.value)),disabled:f,className:"bg-input-background text-foreground border border-border rounded-[var(--radius-md)] px-2 py-1 cursor-pointer focus:outline-none focus:ring-2 focus:ring-ring/30",style:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},children:i.map(W=>e.jsx("option",{value:W,children:W},W))})]})]}),e.jsxs("nav",{className:`flex items-center ${y.gap}`,"aria-label":"Pagination",role:"navigation",children:[a&&e.jsx("button",{onClick:()=>z(1),disabled:f||r<=1,className:M(!1,f||r<=1),style:y.text,"aria-label":"First page",title:"First page",children:e.jsx(v.ChevronsLeft,{size:y.icon})}),n&&e.jsx("button",{onClick:()=>z(r-1),disabled:f||r<=1,className:M(!1,f||r<=1),style:y.text,"aria-label":"Previous page",children:u??e.jsx(v.ChevronLeft,{size:y.icon})}),F.map((W,P)=>W==="dots-left"||W==="dots-right"?e.jsx("span",{className:`inline-flex items-center justify-center text-muted-foreground ${y.btn}`,style:y.text,children:e.jsx(v.MoreHorizontal,{size:y.icon})},W):e.jsx("button",{onClick:()=>z(W),disabled:f,className:M(W===r,f),style:y.text,"aria-label":`Page ${W}`,"aria-current":W===r?"page":void 0,children:W},W)),n&&e.jsx("button",{onClick:()=>z(r+1),disabled:f||r>=t,className:M(!1,f||r>=t),style:y.text,"aria-label":"Next page",children:m??e.jsx(v.ChevronRight,{size:y.icon})}),a&&e.jsx("button",{onClick:()=>z(t),disabled:f||r>=t,className:M(!1,f||r>=t),style:y.text,"aria-label":"Last page",title:"Last page",children:e.jsx(v.ChevronsRight,{size:y.icon})})]}),p&&e.jsxs("span",{className:"text-muted-foreground",style:j,children:["Page ",r," of ",t]})]})}const At={sm:{input:"h-8 px-8",icon:14,style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"}},md:{input:"h-10 px-9",icon:16,style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"}},lg:{input:"h-12 px-10",icon:18,style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"}}},Dt={default:"bg-card border border-border focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20",outlined:"bg-transparent border-2 border-border focus-within:border-primary",filled:"bg-muted/50 border border-transparent focus-within:border-ring focus-within:bg-card"};function Tt({value:r,onChange:t,onSearch:o,placeholder:s="Search...",size:a="md",variant:n="default",loading:l=!1,suggestions:i=[],onSuggestionSelect:d,clearable:c=!0,disabled:h=!1,autoFocus:g=!1,debounce:x=0,className:f=""}){const[p,w]=b.useState(""),[u,m]=b.useState(!1),[F,y]=b.useState(-1),S=r??p,z=b.useRef(null),M=b.useRef(null),T=b.useRef(void 0),E=At[a],j=b.useCallback(C=>{r===void 0&&w(C),t==null||t(C),x>0&&(clearTimeout(T.current),T.current=setTimeout(()=>o==null?void 0:o(C),x))},[r,t,o,x]),W=C=>{C.key==="Enter"?F>=0&&i[F]?(d==null||d(i[F]),m(!1)):o==null||o(S):C.key==="ArrowDown"?(C.preventDefault(),y(A=>Math.min(A+1,i.length-1))):C.key==="ArrowUp"?(C.preventDefault(),y(A=>Math.max(A-1,-1))):C.key==="Escape"&&m(!1)};b.useEffect(()=>{const C=A=>{M.current&&!M.current.contains(A.target)&&m(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[]),b.useEffect(()=>{m(i.length>0&&S.length>0),y(-1)},[i,S]);const P={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},L={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};return e.jsxs("div",{ref:M,className:`relative ${f}`,children:[e.jsxs("div",{className:`relative rounded-[var(--radius-md)] transition-all ${Dt[n]} ${h?"opacity-50 pointer-events-none":""}`,children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none",children:e.jsx(v.Search,{size:E.icon})}),e.jsx("input",{ref:z,type:"text",value:S,onChange:C=>j(C.target.value),onKeyDown:W,onFocus:()=>i.length>0&&S.length>0&&m(!0),placeholder:s,disabled:h,autoFocus:g,className:`w-full ${E.input} rounded-[var(--radius-md)] bg-transparent outline-none text-foreground placeholder:text-muted-foreground`,style:E.style}),e.jsxs("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-1",children:[l&&e.jsx(v.Loader2,{size:E.icon,className:"animate-spin text-muted-foreground"}),c&&S&&!l&&e.jsx("button",{onClick:()=>{var C;j(""),(C=z.current)==null||C.focus()},className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:e.jsx(v.X,{size:E.icon})})]})]}),u&&i.length>0&&e.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-popover border border-border rounded-[var(--radius-md)] shadow-elevation-sm z-50 overflow-hidden max-h-64 overflow-y-auto",style:{padding:"var(--Spacing--Spacing-sm)"},children:i.map((C,A)=>e.jsxs("button",{onClick:()=>{d==null||d(C),m(!1)},className:`w-full text-left flex items-center rounded-[var(--radius-sm)] transition-colors cursor-pointer ${A===F?"bg-[var(--Colors--Background--bg-brand-secondary)]":"hover:bg-[var(--Colors--Background--bg-primary_hover)]"}`,style:{padding:"var(--Spacing--Spacing-md) var(--Spacing--Spacing-2xl)",gap:"var(--Spacing--Spacing-lg)"},children:[C.icon&&e.jsx("span",{className:"text-muted-foreground flex-shrink-0",children:C.icon}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"text-foreground block truncate",style:P,children:C.label}),C.description&&e.jsx("span",{className:"text-muted-foreground block truncate",style:{marginTop:"var(--Spacing--Spacing-xxs)",...L},children:C.description})]})]},C.id))})]})}const ue={sm:"px-3 py-2",md:"px-4 py-3",lg:"px-5 py-4"};function ur({columns:r,data:t,size:o="md",striped:s=!1,hoverable:a=!0,bordered:n=!1,selectable:l=!1,selectedRows:i,onSelectionChange:d,loading:c=!1,emptyMessage:h="No data available",stickyHeader:g=!1,flush:x=!1,className:f=""}){const[p,w]=b.useState(null),[u,m]=b.useState("asc"),[F,y]=b.useState(new Set),S=i??F,z=A=>{i||y(A),d==null||d(A)},M=b.useMemo(()=>p?[...t].sort((A,_)=>{const K=A[p],Z=_[p];if(K==null)return 1;if(Z==null)return-1;const G=typeof K=="string"?K.localeCompare(Z):K-Z;return u==="asc"?G:-G}):t,[t,p,u]),T=A=>{p===A?m(_=>_==="asc"?"desc":"asc"):(w(A),m("asc"))},E=t.length>0&&S.size===t.length,j=S.size>0&&!E,W=()=>{z(E?new Set:new Set(t.map((A,_)=>_)))},P=A=>{const _=new Set(S);_.has(A)?_.delete(A):_.add(A),z(_)},L={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},C={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"};return e.jsx("div",{className:`${x?"":"rounded-[var(--radius-lg)] border border-border"} overflow-hidden ${f}`,children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{className:g?"sticky top-0 z-10":"",children:e.jsxs("tr",{className:"border-b border-border",style:{backgroundColor:"color-mix(in srgb, var(--muted) 30%, var(--background) 70%)"},children:[l&&e.jsx("th",{className:`${ue[o]} w-12`,children:e.jsx(be,{size:"sm",checked:E,indeterminate:j,onChange:W})}),r.map(A=>e.jsx("th",{className:`${ue[o]} text-${A.align??"left"} text-foreground ${A.sortable?"cursor-pointer select-none hover:text-primary transition-colors":""} ${n?"border-x border-border first:border-l-0 last:border-r-0":""}`,style:{...C,width:A.width},onClick:()=>A.sortable&&T(A.key),children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[A.header,A.sortable&&e.jsx("span",{className:"text-muted-foreground/50",children:p===A.key?u==="asc"?e.jsx(v.ChevronUp,{size:14}):e.jsx(v.ChevronDown,{size:14}):e.jsx(v.ChevronsUpDown,{size:12})})]})},A.key))]})}),e.jsx("tbody",{children:c?e.jsx("tr",{children:e.jsx("td",{colSpan:r.length+(l?1:0),className:`${ue[o]} text-center text-muted-foreground`,children:e.jsxs("div",{className:"flex items-center justify-center gap-2 py-8",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-primary border-t-transparent rounded-full animate-spin"}),e.jsx("span",{style:L,children:"Loading..."})]})})}):M.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:r.length+(l?1:0),className:`${ue[o]} text-center text-muted-foreground py-12`,children:e.jsx("span",{style:L,children:h})})}):M.map((A,_)=>{const K=S.has(_);return e.jsxs("tr",{className:`border-b border-border last:border-b-0 transition-colors ${K?"bg-primary/5":s&&_%2===1?"bg-muted/20":"bg-card"} ${a?"hover:bg-[var(--row-hover-bg)]":""}`,children:[l&&e.jsx("td",{className:`${ue[o]} w-12`,children:e.jsx(be,{size:"sm",checked:K,onChange:()=>P(_)})}),r.map(Z=>e.jsx("td",{className:`${ue[o]} text-${Z.align??"left"} text-foreground ${n?"border-x border-border first:border-l-0 last:border-r-0":""}`,style:L,children:Z.render?Z.render(A[Z.key],A,_):A[Z.key]},Z.key))]},_)})})]})})})}const It={sm:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)",padding:"6px 12px"},md:{fontFamily:"var(--font-label)",fontSize:"var(--text-p)",fontWeight:"var(--weight-p)",padding:"8px 16px"},lg:{fontFamily:"var(--font-label)",fontSize:"var(--text-h4)",fontWeight:"var(--weight-p)",padding:"10px 20px"}};function Et({tabs:r,variant:t="default",size:o="md",defaultTab:s,activeTab:a,onChange:n,fullWidth:l=!1,className:i=""}){var F,y;const[d,c]=b.useState(s??((F=r[0])==null?void 0:F.id)??""),h=a??d,g=b.useRef(null),[x,f]=b.useState({left:0,width:0}),p=S=>{a||c(S),n==null||n(S)};b.useEffect(()=>{if(t!=="underline"&&t!=="default")return;const S=g.current;if(!S)return;const z=S.querySelector(`[data-tab-id="${h}"]`);z&&f({left:z.offsetLeft,width:z.offsetWidth})},[h,t]);const w=(y=r.find(S=>S.id===h))==null?void 0:y.content,u=(()=>{switch(t){case"bordered":return"border border-border rounded-[var(--radius)] bg-muted/30 p-1 gap-1";case"pills":return"gap-1.5";case"underline":return"border-b border-border relative";default:return"border-b border-border relative"}})(),m=(S,z)=>{const M="relative flex items-center gap-1.5 transition-all cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring whitespace-nowrap";if(z)return`${M} opacity-40 !cursor-not-allowed`;switch(t){case"bordered":return`${M} rounded-[var(--radius-sm)] ${S?"bg-card text-foreground shadow-elevation-sm":"text-muted-foreground hover:text-foreground hover:bg-card/50"}`;case"pills":return`${M} rounded-[var(--radius)] ${S?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"}`;case"underline":return`${M} ${S?"text-primary":"text-muted-foreground hover:text-foreground"}`;default:return`${M} ${S?"text-primary":"text-muted-foreground hover:text-foreground"}`}};return e.jsxs("div",{className:i,children:[e.jsxs("div",{ref:g,className:`flex ${l?"":"inline-flex"} ${u}`,role:"tablist",children:[(t==="default"||t==="underline")&&e.jsx("div",{className:"absolute bottom-0 h-0.5 bg-primary transition-all duration-200 rounded-full",style:{left:x.left,width:x.width}}),r.map(S=>{const z=h===S.id;return e.jsxs("button",{"data-tab-id":S.id,role:"tab","aria-selected":z,disabled:S.disabled,onClick:()=>!S.disabled&&p(S.id),className:`${m(z,!!S.disabled)} ${l?"flex-1 justify-center":""}`,style:It[o],children:[S.icon&&e.jsx("span",{className:"flex-shrink-0",children:S.icon}),e.jsx("span",{children:S.label}),S.badge!==void 0&&e.jsx("span",{className:`ml-1 rounded-full min-w-[18px] text-center inline-flex items-center justify-center ${z&&t==="pills"?"bg-primary-foreground/20 text-primary-foreground":"bg-muted text-muted-foreground"}`,style:{fontFamily:"var(--font-label)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-caption)",lineHeight:"1",padding:"1px 6px"},children:S.badge})]},S.id)})]}),w&&e.jsx("div",{className:"pt-4",role:"tabpanel",children:w})]})}const Bt={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},Ht={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"};function Ee({title:r,children:t,open:o,onToggle:s,icon:a}){return e.jsxs("div",{className:"border-b border-border last:border-b-0",children:[e.jsxs("button",{onClick:s,className:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-muted/20 transition-colors cursor-pointer",children:[a&&e.jsx("span",{className:"text-primary flex-shrink-0",children:a}),e.jsx("span",{className:"flex-1 text-foreground",style:Bt,children:r}),e.jsx(v.ChevronDown,{size:16,className:`text-muted-foreground transition-transform ${o?"rotate-180":""}`})]}),e.jsx("div",{className:`overflow-hidden transition-all ${o?"max-h-96 opacity-100":"max-h-0 opacity-0"}`,children:e.jsx("div",{className:"px-4 pb-4 text-muted-foreground",style:Ht,children:t})})]})}function vr({type:r="single",items:t,defaultOpen:o,value:s,onChange:a,className:n=""}){const[l,i]=b.useState(typeof o=="string"?o:null),[d,c]=b.useState(Array.isArray(o)?new Set(o):new Set),h=s!==void 0,g=f=>h?r==="single"?s===f:Array.isArray(s)&&s.includes(f):r==="single"?l===f:d.has(f),x=f=>{if(r==="single"){const p=(h?s===f:l===f)?null:f;h||i(p),a==null||a(p)}else if(h){const p=Array.isArray(s)?s:[],w=p.includes(f)?p.filter(u=>u!==f):[...p,f];a==null||a(w)}else c(p=>{const w=new Set(p);return w.has(f)?w.delete(f):w.add(f),w})};return e.jsx("div",{className:`rounded-[var(--radius)] border border-border overflow-hidden ${n}`,children:t.map(f=>e.jsx(Ee,{title:f.title,open:g(f.id),onToggle:()=>x(f.id),icon:f.icon,children:f.content},f.id))})}vr.displayName="Accordion",Ee.displayName="AccordionItem";const gr=["bg-primary","bg-chart-2","bg-chart-5","bg-destructive","bg-secondary"],_t={xs:{box:"w-6 h-6",font:{fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"}},sm:{box:"w-8 h-8",font:{fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"}},md:{box:"w-10 h-10",font:{fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"}},lg:{box:"w-14 h-14",font:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"}},xl:{box:"w-20 h-20",font:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"}}},Yt={xs:"w-2 h-2",sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5",xl:"w-4 h-4"},Xt={online:"bg-chart-2",offline:"bg-secondary",busy:"bg-destructive",away:"bg-chart-5"},Ot={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};function pr({src:r,name:t,size:o="md",status:s,className:a=""}){const n=_t[o],l=t?t.split(" ").map(d=>d[0]).join("").slice(0,2).toUpperCase():"?",i=t?gr[t.length%gr.length]:"bg-muted";return e.jsxs("div",{className:`relative inline-flex ${a}`,children:[r?e.jsx("img",{src:r,alt:t||"avatar",className:`${n.box} rounded-full object-cover`}):e.jsx("div",{className:`${n.box} rounded-full ${i} text-primary-foreground flex items-center justify-center`,style:n.font,children:l}),s&&e.jsx("span",{className:`absolute bottom-0 right-0 ${Yt[o]} ${Xt[s]} rounded-full border-2 border-card`})]})}function xr({children:r,max:t,className:o=""}){const s=b.Children.toArray(r),a=t?s.slice(0,t):s,n=t&&s.length>t?s.length-t:0;return e.jsxs("div",{className:`flex -space-x-2 ${o}`,children:[a.map((l,i)=>e.jsx("div",{className:"relative",style:{zIndex:a.length-i},children:l},i)),n>0&&e.jsxs("div",{className:"relative w-10 h-10 rounded-full bg-muted text-foreground flex items-center justify-center border-2 border-card",style:{...Ot,zIndex:0},children:["+",n]})]})}pr.displayName="Avatar",xr.displayName="AvatarGroup";const Ut={sm:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},md:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},lg:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"}};function Pt({items:r,separator:t="chevron",size:o="md",maxItems:s}){const a=t==="slash"?e.jsx(v.Slash,{size:12,className:"text-muted-foreground"}):t==="dot"?e.jsx(v.Dot,{size:16,className:"text-muted-foreground"}):e.jsx(v.ChevronRight,{size:12,className:"text-muted-foreground"}),n=o==="sm"?"gap-1":o==="lg"?"gap-2.5":"gap-1.5",l=Ut[o];let i=r;if(s&&r.length>s){const d=r.slice(0,1),c=r.slice(-(s-1));i=[...d,{label:"…"},...c]}return e.jsx("nav",{"aria-label":"Breadcrumb",children:e.jsx("ol",{className:`flex items-center flex-wrap ${n}`,children:i.map((d,c)=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[c>0&&e.jsx("span",{className:"mx-0.5",children:a}),d.label==="…"?e.jsx("span",{className:"w-6 h-6 flex items-center justify-center rounded-[var(--radius-sm)] text-muted-foreground hover:bg-accent cursor-pointer",children:e.jsx(v.MoreHorizontal,{size:14})}):c===i.length-1?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-foreground",style:{...l,fontWeight:"var(--weight-button)"},children:[d.icon,d.label]}):e.jsxs("a",{href:d.href||"#",onClick:h=>h.preventDefault(),className:"inline-flex items-center gap-1.5 text-muted-foreground hover:text-foreground transition-colors",style:l,children:[d.icon,d.label]})]},c))})})}const Gt={none:"",sm:"shadow-elevation-sm",md:"shadow-elevation-sm",lg:"shadow-elevation-sm"};function mr({children:r,className:t,hover:o,elevation:s="none"}){return e.jsx("div",{className:`rounded-[var(--radius-lg)] border border-border bg-card overflow-hidden ${Gt[s]??""} ${o?"hover:border-primary/40 hover:shadow-elevation-sm transition-all cursor-pointer":""} ${t??""}`,children:r})}mr.displayName="Card";function yr({children:r,action:t}){return e.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[e.jsx("div",{children:r}),t]})}yr.displayName="CardHeader";function wr({children:r}){return e.jsx("div",{className:"px-5 py-4",children:r})}wr.displayName="CardBody";function Nr({children:r}){return e.jsx("div",{className:"px-5 py-3 border-t border-border bg-muted/10 flex items-center gap-2",children:r})}Nr.displayName="CardFooter";const Kt=["#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#0ea5e9","#e11d48","#991b1b","#9a3412","#854d0e","#166534","#155e75","#1e40af","#0369a1","#9f1239","#fca5a5","#fdba74","#fde047","#86efac","#67e8f9","#93c5fd","#bae6fd","#fecdd3"];function Zt(r){const t=parseInt(r.slice(1,3),16),o=parseInt(r.slice(3,5),16),s=parseInt(r.slice(5,7),16);return`rgb(${t}, ${o}, ${s})`}function qt(r){const t=parseInt(r.slice(1,3),16)/255,o=parseInt(r.slice(3,5),16)/255,s=parseInt(r.slice(5,7),16)/255,a=Math.max(t,o,s),n=Math.min(t,o,s),l=(a+n)/2;if(a===n)return`hsl(0, 0%, ${Math.round(l*100)}%)`;const i=a-n,d=l>.5?i/(2-a-n):i/(a+n);let c=0;return a===t?c=((o-s)/i+(o<s?6:0))/6:a===o?c=((s-t)/i+2)/6:c=((t-o)/i+4)/6,`hsl(${Math.round(c*360)}, ${Math.round(d*100)}%, ${Math.round(l*100)}%)`}const Jt={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},Qt={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},Sr={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"};function Vt({value:r,onChange:t,label:o,presets:s,showInput:a=!0,showFormats:n,size:l="md"}){const[i,d]=b.useState(!1),c=b.useRef(null),h=l==="sm"?"w-5 h-5":l==="lg"?"w-8 h-8":"w-6 h-6",g=s||Kt,x=f=>{navigator.clipboard.writeText(f).then(()=>{d(!0),setTimeout(()=>d(!1),1500)})};return e.jsxs("div",{className:"space-y-3",children:[o&&e.jsx("label",{className:"block text-foreground",style:Jt,children:o}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-10 h-10 rounded-[var(--radius-md)] border border-border cursor-pointer overflow-hidden",style:{backgroundColor:r},onClick:()=>{var f;return(f=c.current)==null?void 0:f.click()}}),e.jsx("input",{ref:c,type:"color",value:r,onChange:f=>t(f.target.value),className:"absolute inset-0 opacity-0 cursor-pointer w-full h-full"})]}),a&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("input",{value:r,onChange:f=>{(/^#[0-9a-fA-F]{0,6}$/.test(f.target.value)||f.target.value==="#")&&t(f.target.value)},className:"w-24 px-2.5 py-1.5 rounded-[var(--radius-md)] border border-border bg-background text-foreground outline-none focus:border-primary",style:Sr,maxLength:7}),e.jsx("button",{onClick:()=>x(r),className:"w-8 h-8 flex items-center justify-center rounded-[var(--radius-md)] text-muted-foreground hover:text-foreground hover:bg-accent transition-colors cursor-pointer",children:i?e.jsx(v.Check,{size:14,className:"text-chart-2"}):e.jsx(v.Copy,{size:14})})]})]}),g.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.map(f=>e.jsx("button",{onClick:()=>t(f),className:`${h} rounded-[var(--radius-sm)] border-2 transition-transform hover:scale-110 cursor-pointer
|
|
57
|
-
${r===
|
|
51
|
+
${M.getFullYear()===G?"bg-primary text-primary-foreground":"text-foreground hover:bg-muted"}
|
|
52
|
+
${G===R.getFullYear()&&M.getFullYear()!==G?"border border-primary text-primary":""}
|
|
53
|
+
`,style:se,children:G},G))})]}),m&&s==="single"&&I==="days"&&e.jsxs("div",{className:"px-4 py-3 border-t border-border flex items-center gap-3",children:[e.jsx(v.Clock,{size:14,className:"text-muted-foreground"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("input",{type:"number",min:0,max:23,value:String(E).padStart(2,"0"),onChange:G=>T(Math.max(0,Math.min(23,Number(G.target.value)))),className:"w-10 text-center bg-input-background border border-border rounded-[var(--radius-sm)] py-1 text-foreground focus:outline-none focus:ring-1 focus:ring-ring/30",style:se}),e.jsx("span",{className:"text-muted-foreground",style:se,children:":"}),e.jsx("input",{type:"number",min:0,max:59,value:String(P).padStart(2,"0"),onChange:G=>B(Math.max(0,Math.min(59,Number(G.target.value)))),className:"w-10 text-center bg-input-background border border-border rounded-[var(--radius-sm)] py-1 text-foreground focus:outline-none focus:ring-1 focus:ring-ring/30",style:se})]}),e.jsx("button",{onClick:Z,className:"ml-auto px-3 py-1 rounded-[var(--radius-md)] bg-primary text-primary-foreground hover:bg-primary/90 transition-colors cursor-pointer",style:se,children:"Apply"})]}),e.jsxs("div",{className:"px-4 py-2.5 border-t border-border bg-card flex items-center justify-between",children:[w?e.jsx("button",{onClick:q,className:"text-primary hover:underline cursor-pointer",style:se,children:"Today"}):e.jsx("span",{}),N??e.jsx("button",{onClick:()=>{D(!1),A("days")},className:"text-muted-foreground hover:text-foreground cursor-pointer",style:se,children:"Close"})]})]})]})}const Mo={sm:"max-w-sm",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-[calc(100vw-2rem)] max-h-[calc(100vh-2rem)]"};function Hr({open:r,onClose:t,title:o,description:a,size:s="md",children:n,footer:l,closeOnOverlay:d=!0,showCloseButton:i=!0,className:f=""}){const u=c.useRef(null);return c.useEffect(()=>{if(!r)return;const x=y=>{y.key==="Escape"&&t()};return document.addEventListener("keydown",x),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",x),document.body.style.overflow=""}},[r,t]),c.useEffect(()=>{r&&u.current&&u.current.focus()},[r]),r?e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",children:[e.jsx("div",{className:"absolute inset-0 bg-foreground/40 backdrop-blur-sm animate-in fade-in duration-200",onClick:d?t:void 0}),e.jsxs("div",{ref:u,tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":o?"modal-title":void 0,className:`relative w-full ${Mo[s]} bg-card rounded-[var(--radius-md)] shadow-elevation-sm border border-border animate-in zoom-in-95 fade-in duration-200 flex flex-col ${s==="full"?"h-full":"max-h-[85vh]"} ${f}`,children:[(o||i)&&e.jsxs("div",{className:"flex items-start justify-between gap-4 px-6 pt-6 pb-2 flex-shrink-0",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[o&&e.jsx("h4",{id:"modal-title",className:"text-foreground",children:o}),a&&e.jsx("span",{className:"text-muted-foreground block mt-0.5",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},children:a})]}),i&&e.jsx("button",{onClick:t,className:"flex-shrink-0 w-8 h-8 rounded-[var(--radius-sm)] flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-muted transition-colors cursor-pointer","aria-label":"Close",children:e.jsx(v.X,{size:16})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},children:n}),l&&e.jsx("div",{className:"flex items-center justify-end gap-2 px-6 py-4 border-t border-border flex-shrink-0",children:l})]})]}):null}function Wo({open:r,onClose:t,onConfirm:o,title:a="Are you sure?",description:s="This action cannot be undone.",confirmLabel:n="Confirm",cancelLabel:l="Cancel",variant:d="default"}){const i={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};return e.jsx(Hr,{open:r,onClose:t,title:a,description:s,size:"sm",children:e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-4",children:[e.jsx("button",{onClick:t,className:"px-4 py-2 rounded-[var(--radius-md)] border border-border text-foreground hover:bg-muted transition-colors cursor-pointer",style:i,children:l}),e.jsx("button",{onClick:()=>{o(),t()},className:`px-4 py-2 rounded-[var(--radius-md)] text-primary-foreground transition-colors cursor-pointer ${d==="destructive"?"bg-destructive hover:bg-destructive/90":"bg-primary hover:bg-primary/90"}`,style:i,children:n})]})})}const Lo={sm:{btn:"min-w-[28px] h-7 px-1.5",icon:14,text:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},gap:"gap-1"},md:{btn:"min-w-[34px] h-9 px-2",icon:16,text:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},gap:"gap-1.5"},lg:{btn:"min-w-[42px] h-11 px-3",icon:18,text:{fontFamily:"var(--font-button)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},gap:"gap-2"}},Do={default:{base:"bg-transparent text-foreground border border-transparent",active:"bg-primary text-primary-foreground border-primary shadow-elevation-sm",hover:"hover:bg-muted"},outlined:{base:"bg-transparent text-foreground border border-border",active:"bg-primary text-primary-foreground border-primary shadow-elevation-sm",hover:"hover:bg-muted hover:border-muted"},filled:{base:"bg-muted/50 text-foreground border border-transparent",active:"bg-primary text-primary-foreground border-primary shadow-elevation-sm",hover:"hover:bg-muted"},minimal:{base:"bg-transparent text-foreground border border-transparent",active:"bg-accent text-accent-foreground border-accent",hover:"hover:text-primary"}};function Ao(r,t,o){return c.useMemo(()=>{if(o*2+5>=t)return Array.from({length:t},(f,u)=>u+1);const s=Math.max(r-o,1),n=Math.min(r+o,t),l=s>2,d=n<t-1;if(!l&&d){const f=3+2*o;return[...Array.from({length:f},(x,y)=>y+1),"dots-right",t]}if(l&&!d){const f=3+2*o;return[1,"dots-left",...Array.from({length:f},(x,y)=>t-f+y+1)]}return[1,"dots-left",...Array.from({length:n-s+1},(f,u)=>s+u),"dots-right",t]},[r,t,o])}function jo({currentPage:r,totalPages:t,onPageChange:o,siblingCount:a=1,showFirstLast:s=!1,showPrevNext:n=!0,showPageSize:l=!1,pageSizeOptions:d=[10,20,50,100],pageSize:i=10,onPageSizeChange:f,totalItems:u,size:x="md",variant:y="default",disabled:h=!1,showPageInfo:p=!1,showItemsInfo:g=!1,prevLabel:m,nextLabel:S}){const z=Ao(r,t,a),b=Lo[x],w=Do[y],N=c.useCallback(L=>{!h&&L>=1&&L<=t&&o(L)},[h,t,o]),F=(L,I)=>`inline-flex items-center justify-center rounded-[var(--radius-md)] transition-all cursor-pointer select-none
|
|
54
|
+
${b.btn}
|
|
55
|
+
${I?"opacity-40 pointer-events-none cursor-default":""}
|
|
56
|
+
${L?w.active:`${w.base} ${I?"":w.hover}`}`,W=u?(r-1)*i+1:0,D=u?Math.min(r*i,u):0,M={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"};return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[g&&u!==void 0&&e.jsxs("span",{className:"text-muted-foreground",style:M,children:[W,"–",D," of ",u]}),l&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",style:M,children:"Rows per page:"}),e.jsx("select",{value:i,onChange:L=>f==null?void 0:f(Number(L.target.value)),disabled:h,className:"bg-input-background text-foreground border border-border rounded-[var(--radius-md)] px-2 py-1 cursor-pointer focus:outline-none focus:ring-2 focus:ring-ring/30",style:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},children:d.map(L=>e.jsx("option",{value:L,children:L},L))})]})]}),e.jsxs("nav",{className:`flex items-center ${b.gap}`,"aria-label":"Pagination",role:"navigation",children:[s&&e.jsx("button",{onClick:()=>N(1),disabled:h||r<=1,className:F(!1,h||r<=1),style:b.text,"aria-label":"First page",title:"First page",children:e.jsx(v.ChevronsLeft,{size:b.icon})}),n&&e.jsx("button",{onClick:()=>N(r-1),disabled:h||r<=1,className:F(!1,h||r<=1),style:b.text,"aria-label":"Previous page",children:m??e.jsx(v.ChevronLeft,{size:b.icon})}),z.map((L,I)=>L==="dots-left"||L==="dots-right"?e.jsx("span",{className:`inline-flex items-center justify-center text-muted-foreground ${b.btn}`,style:b.text,children:e.jsx(v.MoreHorizontal,{size:b.icon})},L):e.jsx("button",{onClick:()=>N(L),disabled:h,className:F(L===r,h),style:b.text,"aria-label":`Page ${L}`,"aria-current":L===r?"page":void 0,children:L},L)),n&&e.jsx("button",{onClick:()=>N(r+1),disabled:h||r>=t,className:F(!1,h||r>=t),style:b.text,"aria-label":"Next page",children:S??e.jsx(v.ChevronRight,{size:b.icon})}),s&&e.jsx("button",{onClick:()=>N(t),disabled:h||r>=t,className:F(!1,h||r>=t),style:b.text,"aria-label":"Last page",title:"Last page",children:e.jsx(v.ChevronsRight,{size:b.icon})})]}),p&&e.jsxs("span",{className:"text-muted-foreground",style:M,children:["Page ",r," of ",t]})]})}const Eo={sm:{input:"h-8 px-8",icon:14,style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"}},md:{input:"h-10 px-9",icon:16,style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"}},lg:{input:"h-12 px-10",icon:18,style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"}}},To={default:"bg-card border border-border focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20",outlined:"bg-transparent border-2 border-border focus-within:border-primary",filled:"bg-muted/50 border border-transparent focus-within:border-ring focus-within:bg-card"};function Io({value:r,onChange:t,onSearch:o,placeholder:a="Search...",size:s="md",variant:n="default",loading:l=!1,suggestions:d=[],onSuggestionSelect:i,clearable:f=!0,disabled:u=!1,autoFocus:x=!1,debounce:y=0,className:h=""}){const[p,g]=c.useState(""),[m,S]=c.useState(!1),[z,b]=c.useState(-1),w=r??p,N=c.useRef(null),F=c.useRef(null),W=c.useRef(void 0),D=Eo[s],M=c.useCallback(k=>{r===void 0&&g(k),t==null||t(k),y>0&&(clearTimeout(W.current),W.current=setTimeout(()=>o==null?void 0:o(k),y))},[r,t,o,y]),L=k=>{k.key==="Enter"?z>=0&&d[z]?(i==null||i(d[z]),S(!1)):o==null||o(w):k.key==="ArrowDown"?(k.preventDefault(),b($=>Math.min($+1,d.length-1))):k.key==="ArrowUp"?(k.preventDefault(),b($=>Math.max($-1,-1))):k.key==="Escape"&&S(!1)};c.useEffect(()=>{const k=$=>{F.current&&!F.current.contains($.target)&&S(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[]),c.useEffect(()=>{S(d.length>0&&w.length>0),b(-1)},[d,w]);const I={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},A={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};return e.jsxs("div",{ref:F,className:`relative ${h}`,children:[e.jsxs("div",{className:`relative rounded-[var(--radius-md)] transition-all ${To[n]} ${u?"opacity-50 pointer-events-none":""}`,children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none",children:e.jsx(v.Search,{size:D.icon})}),e.jsx("input",{ref:N,type:"text",value:w,onChange:k=>M(k.target.value),onKeyDown:L,onFocus:()=>d.length>0&&w.length>0&&S(!0),placeholder:a,disabled:u,autoFocus:x,className:`w-full ${D.input} rounded-[var(--radius-md)] bg-transparent outline-none text-foreground placeholder:text-muted-foreground`,style:D.style}),e.jsxs("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-1",children:[l&&e.jsx(v.Loader2,{size:D.icon,className:"animate-spin text-muted-foreground"}),f&&w&&!l&&e.jsx("button",{onClick:()=>{var k;M(""),(k=N.current)==null||k.focus()},className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:e.jsx(v.X,{size:D.icon})})]})]}),m&&d.length>0&&e.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-popover border border-border rounded-[var(--radius-md)] shadow-elevation-sm z-50 overflow-hidden max-h-64 overflow-y-auto",style:{padding:"var(--Spacing--Spacing-sm)"},children:d.map((k,$)=>e.jsxs("button",{onClick:()=>{i==null||i(k),S(!1)},className:`w-full text-left flex items-center rounded-[var(--radius-sm)] transition-colors cursor-pointer ${$===z?"bg-[var(--Colors--Background--bg-brand-secondary)]":"hover:bg-[var(--Colors--Background--bg-primary_hover)]"}`,style:{padding:"var(--Spacing--Spacing-md) var(--Spacing--Spacing-2xl)",gap:"var(--Spacing--Spacing-lg)"},children:[k.icon&&e.jsx("span",{className:"text-muted-foreground flex-shrink-0",children:k.icon}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"text-foreground block truncate",style:I,children:k.label}),k.description&&e.jsx("span",{className:"text-muted-foreground block truncate",style:{marginTop:"var(--Spacing--Spacing-xxs)",...A},children:k.description})]})]},k.id))})]})}const xe={sm:"px-3 py-2",md:"px-4 py-3",lg:"px-5 py-4"};function Pr({columns:r,data:t,size:o="md",striped:a=!1,hoverable:s=!0,bordered:n=!1,selectable:l=!1,selectedRows:d,onSelectionChange:i,loading:f=!1,error:u,emptyMessage:x="No data available",stickyHeader:y=!1,flush:h=!1,className:p=""}){const[g,m]=c.useState(null),[S,z]=c.useState("asc"),[b,w]=c.useState(new Set),N=d??b,F=E=>{d||w(E),i==null||i(E)},W=c.useMemo(()=>g?[...t].sort((E,T)=>{const P=E[g],B=T[g];if(P==null)return 1;if(B==null)return-1;const _=typeof P=="string"?P.localeCompare(B):P-B;return S==="asc"?_:-_}):t,[t,g,S]),D=E=>{g===E?z(T=>T==="asc"?"desc":"asc"):(m(E),z("asc"))},M=t.length>0&&N.size===t.length,L=N.size>0&&!M,I=()=>{F(M?new Set:new Set(t.map((E,T)=>T)))},A=E=>{const T=new Set(N);T.has(E)?T.delete(E):T.add(E),F(T)},k={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},$={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"};return e.jsx("div",{className:`${h?"":"rounded-[var(--radius-md)] border border-border"} overflow-hidden ${p}`,children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{className:y?"sticky top-0 z-10":"",children:e.jsxs("tr",{className:"border-b border-border",style:{backgroundColor:"color-mix(in srgb, var(--muted) 30%, var(--background) 70%)"},children:[l&&e.jsx("th",{className:`${xe[o]} w-12`,children:e.jsx(ye,{size:"sm",checked:M,indeterminate:L,onChange:I})}),r.map(E=>e.jsx("th",{className:`${xe[o]} text-${E.align??"left"} text-foreground ${E.sortable?"cursor-pointer select-none hover:text-primary transition-colors":""} ${n?"border-x border-border first:border-l-0 last:border-r-0":""}`,style:{...$,width:E.width},onClick:()=>E.sortable&&D(E.key),children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[E.header,E.sortable&&e.jsx("span",{className:"text-muted-foreground/50",children:g===E.key?S==="asc"?e.jsx(v.ChevronUp,{size:14}):e.jsx(v.ChevronDown,{size:14}):e.jsx(v.ChevronsUpDown,{size:12})})]})},E.key))]})}),e.jsx("tbody",{children:f?e.jsx("tr",{children:e.jsx("td",{colSpan:r.length+(l?1:0),className:`${xe[o]} text-center text-muted-foreground`,children:e.jsxs("div",{className:"flex items-center justify-center gap-2 py-8",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-primary border-t-transparent rounded-full animate-spin"}),e.jsx("span",{style:k,children:"Loading..."})]})})}):u?e.jsx("tr",{children:e.jsx("td",{colSpan:r.length+(l?1:0),className:`${xe[o]} text-center py-12`,children:e.jsx("div",{className:"flex flex-col items-center gap-2",children:e.jsx("span",{style:{...k,color:"var(--destructive)"},children:u})})})}):W.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:r.length+(l?1:0),className:`${xe[o]} text-center text-muted-foreground py-12`,children:e.jsx("span",{style:k,children:x})})}):W.map((E,T)=>{const P=N.has(T);return e.jsxs("tr",{className:`border-b border-border last:border-b-0 transition-colors ${P?"bg-primary/5":a&&T%2===1?"bg-muted/20":"bg-card"} ${s?"hover:bg-[var(--row-hover-bg)]":""}`,children:[l&&e.jsx("td",{className:`${xe[o]} w-12`,children:e.jsx(ye,{size:"sm",checked:P,onChange:()=>A(T)})}),r.map(B=>e.jsx("td",{className:`${xe[o]} text-${B.align??"left"} text-foreground ${n?"border-x border-border first:border-l-0 last:border-r-0":""}`,style:k,children:B.render?B.render(E[B.key],E,T):E[B.key]},B.key))]},T)})})]})})})}const Bo={sm:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)",padding:"6px 12px"},md:{fontFamily:"var(--font-label)",fontSize:"var(--text-p)",fontWeight:"var(--weight-p)",padding:"8px 16px"},lg:{fontFamily:"var(--font-label)",fontSize:"var(--text-h4)",fontWeight:"var(--weight-p)",padding:"10px 20px"}};function _o({tabs:r,variant:t="default",size:o="md",defaultTab:a,activeTab:s,onChange:n,fullWidth:l=!1,className:d=""}){var z,b;const[i,f]=c.useState(a??((z=r[0])==null?void 0:z.id)??""),u=s??i,x=c.useRef(null),[y,h]=c.useState({left:0,width:0}),p=w=>{s||f(w),n==null||n(w)};c.useEffect(()=>{if(t!=="underline"&&t!=="default")return;const w=x.current;if(!w)return;const N=w.querySelector(`[data-tab-id="${u}"]`);N&&h({left:N.offsetLeft,width:N.offsetWidth})},[u,t]);const g=(b=r.find(w=>w.id===u))==null?void 0:b.content,m=(()=>{switch(t){case"bordered":return"border border-border rounded-[var(--radius)] bg-muted/30 p-1 gap-1";case"pills":return"gap-1.5";case"underline":return"border-b border-border relative";default:return"border-b border-border relative"}})(),S=(w,N)=>{const F="relative flex items-center gap-1.5 transition-all cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring whitespace-nowrap";if(N)return`${F} opacity-40 !cursor-not-allowed`;switch(t){case"bordered":return`${F} rounded-[var(--radius-sm)] ${w?"bg-card text-foreground shadow-elevation-sm":"text-muted-foreground hover:text-foreground hover:bg-card/50"}`;case"pills":return`${F} rounded-[var(--radius)] ${w?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"}`;case"underline":return`${F} ${w?"text-primary":"text-muted-foreground hover:text-foreground"}`;default:return`${F} ${w?"text-primary":"text-muted-foreground hover:text-foreground"}`}};return e.jsxs("div",{className:d,children:[e.jsxs("div",{ref:x,className:`flex ${l?"":"inline-flex"} ${m}`,role:"tablist",children:[(t==="default"||t==="underline")&&e.jsx("div",{className:"absolute bottom-0 h-0.5 bg-primary transition-all duration-200 rounded-full",style:{left:y.left,width:y.width}}),r.map(w=>{const N=u===w.id;return e.jsxs("button",{"data-tab-id":w.id,role:"tab","aria-selected":N,disabled:w.disabled,onClick:()=>!w.disabled&&p(w.id),className:`${S(N,!!w.disabled)} ${l?"flex-1 justify-center":""}`,style:Bo[o],children:[w.icon&&e.jsx("span",{className:"flex-shrink-0",children:w.icon}),e.jsx("span",{children:w.label}),w.badge!==void 0&&e.jsx("span",{className:`ml-1 rounded-full min-w-[18px] text-center inline-flex items-center justify-center ${N&&t==="pills"?"bg-primary-foreground/20 text-primary-foreground":"bg-muted text-muted-foreground"}`,style:{fontFamily:"var(--font-label)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-caption)",lineHeight:"1",padding:"1px 6px"},children:w.badge})]},w.id)})]}),g&&e.jsx("div",{className:"pt-4",role:"tabpanel",children:g})]})}const Ho={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},Po={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"};function Je({title:r,children:t,open:o,onToggle:a,icon:s,disabled:n=!1}){return e.jsxs("div",{className:`border-b border-border last:border-b-0 ${n?"opacity-50":""}`,children:[e.jsxs("button",{onClick:n?void 0:a,disabled:n,className:`w-full flex items-center gap-3 px-4 py-3 text-left transition-colors ${n?"cursor-not-allowed":"hover:bg-muted/20 cursor-pointer"}`,children:[s&&e.jsx("span",{className:"text-primary flex-shrink-0",children:s}),e.jsx("span",{className:"flex-1 text-foreground",style:Ho,children:r}),e.jsx(v.ChevronDown,{size:16,className:`text-muted-foreground transition-transform ${o?"rotate-180":""}`})]}),e.jsx("div",{className:`overflow-hidden transition-all ${o?"max-h-96 opacity-100":"max-h-0 opacity-0"}`,children:e.jsx("div",{className:"px-4 pb-4 text-muted-foreground",style:Po,children:t})})]})}function Or({type:r="single",items:t,defaultOpen:o,value:a,onChange:s,className:n=""}){const[l,d]=c.useState(typeof o=="string"?o:null),[i,f]=c.useState(Array.isArray(o)?new Set(o):new Set),u=a!==void 0,x=h=>u?r==="single"?a===h:Array.isArray(a)&&a.includes(h):r==="single"?l===h:i.has(h),y=h=>{if(r==="single"){const p=(u?a===h:l===h)?null:h;u||d(p),s==null||s(p)}else if(u){const p=Array.isArray(a)?a:[],g=p.includes(h)?p.filter(m=>m!==h):[...p,h];s==null||s(g)}else f(p=>{const g=new Set(p);return g.has(h)?g.delete(h):g.add(h),g})};return e.jsx("div",{className:`rounded-[var(--radius)] border border-border overflow-hidden ${n}`,children:t.map(h=>e.jsx(Je,{title:h.title,open:x(h.id),onToggle:()=>y(h.id),icon:h.icon,disabled:h.disabled,children:h.content},h.id))})}Or.displayName="Accordion",Je.displayName="AccordionItem";const Yr=["bg-primary","bg-chart-2","bg-chart-5","bg-destructive","bg-secondary"],Oo={xs:{box:"w-6 h-6",font:{fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"}},sm:{box:"w-8 h-8",font:{fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"}},md:{box:"w-10 h-10",font:{fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"}},lg:{box:"w-14 h-14",font:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"}},xl:{box:"w-20 h-20",font:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"}}},Yo={xs:"w-2 h-2",sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5",xl:"w-4 h-4"},Go={online:"bg-chart-2",offline:"bg-secondary",busy:"bg-destructive",away:"bg-chart-5"},Uo={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};function Gr({src:r,name:t,size:o="md",status:a,className:s=""}){const n=Oo[o],l=t?t.split(" ").map(i=>i[0]).join("").slice(0,2).toUpperCase():"?",d=t?Yr[t.length%Yr.length]:"bg-muted";return e.jsxs("div",{className:`relative inline-flex ${s}`,children:[r?e.jsx("img",{src:r,alt:t||"avatar",className:`${n.box} rounded-full object-cover`}):e.jsx("div",{className:`${n.box} rounded-full ${d} text-primary-foreground flex items-center justify-center`,style:n.font,children:l}),a&&e.jsx("span",{className:`absolute bottom-0 right-0 ${Yo[o]} ${Go[a]} rounded-full border-2 border-card`})]})}function Ur({children:r,max:t,className:o=""}){const a=c.Children.toArray(r),s=t?a.slice(0,t):a,n=t&&a.length>t?a.length-t:0;return e.jsxs("div",{className:`flex -space-x-2 ${o}`,children:[s.map((l,d)=>e.jsx("div",{className:"relative",style:{zIndex:s.length-d},children:l},d)),n>0&&e.jsxs("div",{className:"relative w-10 h-10 rounded-full bg-muted text-foreground flex items-center justify-center border-2 border-card",style:{...Uo,zIndex:0},children:["+",n]})]})}Gr.displayName="Avatar",Ur.displayName="AvatarGroup";const Xo={sm:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},md:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},lg:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"}};function Ko({items:r,separator:t="chevron",size:o="md",maxItems:a}){const s=t==="slash"?e.jsx(v.Slash,{size:12,className:"text-muted-foreground"}):t==="dot"?e.jsx(v.Dot,{size:16,className:"text-muted-foreground"}):e.jsx(v.ChevronRight,{size:12,className:"text-muted-foreground"}),n=o==="sm"?"gap-1":o==="lg"?"gap-2.5":"gap-1.5",l=Xo[o];let d=r;if(a&&r.length>a){const i=r.slice(0,1),f=r.slice(-(a-1));d=[...i,{label:"…"},...f]}return e.jsx("nav",{"aria-label":"Breadcrumb",children:e.jsx("ol",{className:`flex items-center flex-wrap ${n}`,children:d.map((i,f)=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[f>0&&e.jsx("span",{className:"mx-0.5",children:s}),i.label==="…"?e.jsx("span",{className:"w-6 h-6 flex items-center justify-center rounded-[var(--radius-sm)] text-muted-foreground hover:bg-accent cursor-pointer",children:e.jsx(v.MoreHorizontal,{size:14})}):f===d.length-1?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-foreground",style:{...l,fontWeight:"var(--weight-button)"},children:[i.icon,i.label]}):e.jsxs("a",{href:i.href||"#",onClick:u=>u.preventDefault(),className:"inline-flex items-center gap-1.5 text-muted-foreground hover:text-foreground transition-colors",style:l,children:[i.icon,i.label]})]},f))})})}const Zo={none:"",sm:"shadow-elevation-sm",md:"shadow-elevation-sm",lg:"shadow-elevation-sm"};function Xr({children:r,className:t,hover:o,elevation:a="none"}){return e.jsx("div",{className:`rounded-[var(--radius-md)] border border-border bg-card overflow-hidden ${Zo[a]??""} ${o?"hover:border-primary/40 hover:shadow-elevation-sm transition-all cursor-pointer":""} ${t??""}`,children:r})}Xr.displayName="Card";function Kr({children:r,action:t}){return e.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[e.jsx("div",{children:r}),t]})}Kr.displayName="CardHeader";function Zr({children:r}){return e.jsx("div",{className:"px-5 py-4",children:r})}Zr.displayName="CardBody";function qr({children:r}){return e.jsx("div",{className:"px-5 py-3 border-t border-border bg-muted/10 flex items-center gap-2",children:r})}qr.displayName="CardFooter";const qo=["#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#0ea5e9","#e11d48","#991b1b","#9a3412","#854d0e","#166534","#155e75","#1e40af","#0369a1","#9f1239","#fca5a5","#fdba74","#fde047","#86efac","#67e8f9","#93c5fd","#bae6fd","#fecdd3"];function Jo(r){const t=parseInt(r.slice(1,3),16),o=parseInt(r.slice(3,5),16),a=parseInt(r.slice(5,7),16);return`rgb(${t}, ${o}, ${a})`}function Qo(r){const t=parseInt(r.slice(1,3),16)/255,o=parseInt(r.slice(3,5),16)/255,a=parseInt(r.slice(5,7),16)/255,s=Math.max(t,o,a),n=Math.min(t,o,a),l=(s+n)/2;if(s===n)return`hsl(0, 0%, ${Math.round(l*100)}%)`;const d=s-n,i=l>.5?d/(2-s-n):d/(s+n);let f=0;return s===t?f=((o-a)/d+(o<a?6:0))/6:s===o?f=((a-t)/d+2)/6:f=((t-o)/d+4)/6,`hsl(${Math.round(f*360)}, ${Math.round(i*100)}%, ${Math.round(l*100)}%)`}const Vo={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},Ro={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},Jr={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"};function ea({value:r,onChange:t,label:o,presets:a,showInput:s=!0,showFormats:n,size:l="md",disabled:d=!1}){const[i,f]=c.useState(!1),u=c.useRef(null),x=l==="sm"?"w-5 h-5":l==="lg"?"w-8 h-8":"w-6 h-6",y=a||qo,h=p=>{navigator.clipboard.writeText(p).then(()=>{f(!0),setTimeout(()=>f(!1),1500)})};return e.jsxs("div",{className:`space-y-3 ${d?"opacity-50 pointer-events-none":""}`,children:[o&&e.jsx("label",{className:"block text-foreground",style:Vo,children:o}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-10 h-10 rounded-[var(--radius-md)] border border-border cursor-pointer overflow-hidden",style:{backgroundColor:r},onClick:()=>{var p;return(p=u.current)==null?void 0:p.click()}}),e.jsx("input",{ref:u,type:"color",value:r,onChange:p=>t(p.target.value),className:"absolute inset-0 opacity-0 cursor-pointer w-full h-full"})]}),s&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("input",{value:r,onChange:p=>{(/^#[0-9a-fA-F]{0,6}$/.test(p.target.value)||p.target.value==="#")&&t(p.target.value)},className:"w-24 px-2.5 py-1.5 rounded-[var(--radius-md)] border border-border bg-background text-foreground outline-none focus:border-primary",style:Jr,maxLength:7}),e.jsx("button",{onClick:()=>h(r),className:"w-8 h-8 flex items-center justify-center rounded-[var(--radius-md)] text-muted-foreground hover:text-foreground hover:bg-accent transition-colors cursor-pointer",children:i?e.jsx(v.Check,{size:14,className:"text-chart-2"}):e.jsx(v.Copy,{size:14})})]})]}),y.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:y.map(p=>e.jsx("button",{onClick:()=>t(p),className:`${x} rounded-[var(--radius-sm)] border-2 transition-transform hover:scale-110 cursor-pointer
|
|
57
|
+
${r===p?"border-foreground ring-1 ring-foreground/20":"border-transparent"}`,style:{backgroundColor:p},title:p},p))}),n&&e.jsx("div",{className:"space-y-1",children:[{label:"HEX",val:r.toUpperCase()},{label:"RGB",val:Jo(r)},{label:"HSL",val:Qo(r)}].map(p=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-8 text-muted-foreground",style:Ro,children:p.label}),e.jsx("code",{className:"text-foreground",style:Jr,children:p.val}),e.jsx("button",{onClick:()=>h(p.val),className:"text-muted-foreground hover:text-foreground cursor-pointer",children:e.jsx(v.Copy,{size:12})})]},p.label))})]})}const ra={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"};function Qr({label:r,orientation:t="horizontal",dashed:o,spacing:a="md",className:s=""}){const n={sm:"my-2",md:"my-4",lg:"my-8"},l=o?"border-dashed":"border-solid";return t==="vertical"?e.jsx("div",{className:`inline-block h-full min-h-[24px] border-l border-border ${l} mx-3 ${s}`}):r?e.jsxs("div",{className:`flex items-center gap-3 ${n[a]} ${s}`,children:[e.jsx("div",{className:`flex-1 border-t border-border ${l}`}),e.jsx("span",{className:"text-muted-foreground flex-shrink-0",style:ra,children:r}),e.jsx("div",{className:`flex-1 border-t border-border ${l}`})]}):e.jsx("hr",{className:`border-t border-border ${l} ${n[a]} ${s}`})}Qr.displayName="Divider";const ta={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"};function Vr({open:r,onClose:t,title:o,children:a,side:s="right",size:n="md",footer:l,className:d=""}){if(!r)return null;const i={sm:"w-72",md:"w-96",lg:"w-[480px]"},f={sm:"h-48",md:"h-72",lg:"h-96"},u={right:`top-0 right-0 h-full ${i[n]} animate-[slideRight_0.2s_ease]`,left:`top-0 left-0 h-full ${i[n]} animate-[slideLeft_0.2s_ease]`,top:`top-0 left-0 w-full ${f[n]} animate-[slideTop_0.2s_ease]`,bottom:`bottom-0 left-0 w-full ${f[n]} animate-[slideBottom_0.2s_ease]`};return e.jsxs("div",{className:"fixed inset-0 z-50",children:[e.jsx("div",{className:"absolute inset-0 bg-foreground/20",onClick:t}),e.jsxs("div",{className:`absolute bg-card border border-border shadow-elevation-sm flex flex-col ${u[s]} ${d}`,children:[o&&e.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between flex-shrink-0",children:[e.jsx("span",{className:"text-foreground",style:ta,children:o}),e.jsx("button",{onClick:t,className:"text-muted-foreground hover:text-foreground cursor-pointer",children:e.jsx(v.X,{size:18})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-5",children:a}),l&&e.jsx("div",{className:"px-5 py-3 border-t border-border flex items-center gap-2 flex-shrink-0",children:l})]}),e.jsx("style",{children:`
|
|
58
58
|
@keyframes slideRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
|
|
59
59
|
@keyframes slideLeft { from { transform: translateX(-100%); } to { transform: translateX(0); } }
|
|
60
60
|
@keyframes slideTop { from { transform: translateY(-100%); } to { transform: translateY(0); } }
|
|
61
61
|
@keyframes slideBottom { from { transform: translateY(100%); } to { transform: translateY(0); } }
|
|
62
|
-
`})]})}
|
|
63
|
-
${
|
|
64
|
-
${
|
|
65
|
-
${
|
|
66
|
-
`,style:
|
|
67
|
-
${
|
|
68
|
-
${
|
|
69
|
-
${
|
|
70
|
-
`,style:{...
|
|
71
|
-
${
|
|
72
|
-
`,children:
|
|
73
|
-
${
|
|
74
|
-
${!
|
|
75
|
-
${
|
|
76
|
-
${
|
|
77
|
-
${
|
|
78
|
-
${
|
|
79
|
-
`,style:
|
|
80
|
-
${
|
|
81
|
-
`,children:[
|
|
82
|
-
${
|
|
83
|
-
${
|
|
84
|
-
${
|
|
85
|
-
${
|
|
86
|
-
${m===a?"border-primary-foreground":"border-transparent opacity-50 hover:opacity-80"}`,children:e.jsx("img",{src:u.thumbnail||u.src,alt:u.alt,className:"w-full h-full object-cover"})},m))})]})]})}const uo={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},vo={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},go={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};function po({items:r,parentRect:t}){const o=b.useRef(null),[s,a]=b.useState({top:t.top,left:t.right+4});return b.useEffect(()=>{if(!o.current)return;const l=o.current.getBoundingClientRect();let i=t.top,d=t.right+4;d+l.width>window.innerWidth-8&&(d=t.left-l.width-4),i+l.height>window.innerHeight-8&&(i=window.innerHeight-l.height-8),a({top:i,left:d})},[t]),Se.createPortal(e.jsx("div",{ref:o,className:"fixed z-[9999] min-w-[200px] rounded-[var(--radius)] border border-border bg-popover shadow-elevation-sm py-1",style:{top:s.top,left:s.left},children:r.map((n,l)=>e.jsx(Mr,{item:n},l))}),document.body)}function Mr({item:r}){const[t,o]=b.useState(!1),s=b.useRef(null),a=b.useRef(null);if(r.divider)return e.jsx("div",{className:"my-1 border-t border-border"});if(r.label)return e.jsx("div",{className:"px-3 py-1.5 text-muted-foreground",style:go,children:r.label});const n=r.children&&r.children.length>0,l=()=>{a.current&&clearTimeout(a.current),n&&o(!0)},i=()=>{a.current=setTimeout(()=>o(!1),150)};return e.jsxs("div",{ref:s,className:"relative",onMouseEnter:l,onMouseLeave:i,children:[e.jsxs("button",{onClick:()=>{var d;n||(d=r.onClick)==null||d.call(r)},disabled:r.disabled,className:`w-full flex items-center text-left rounded-[var(--radius-sm)] transition-colors cursor-pointer ${r.destructive?"text-destructive hover:bg-destructive/10":r.disabled?"text-muted-foreground opacity-50 cursor-not-allowed":"text-popover-foreground hover:bg-[var(--Colors--Background--bg-primary_hover)]"}`,style:{padding:"var(--Spacing--Spacing-md) var(--Spacing--Spacing-2xl)",gap:"var(--Spacing--Spacing-lg)",...uo},children:[r.icon&&e.jsx("span",{className:"flex-shrink-0",children:r.icon}),e.jsx("span",{className:"flex-1",children:r.text}),r.shortcut&&e.jsx("span",{className:"text-muted-foreground ml-4",style:vo,children:r.shortcut}),n&&e.jsx(v.ChevronRight,{size:14,className:"text-muted-foreground"})]}),n&&t&&s.current&&e.jsx(po,{items:r.children,parentRect:s.current.getBoundingClientRect()})]})}function jr({items:r,open:t,onClose:o,triggerRef:s,className:a=""}){const n=b.useRef(null),[l,i]=b.useState({top:0,left:0});return b.useEffect(()=>{if(!t||!s.current)return;const d=s.current.getBoundingClientRect();let c=d.bottom+4,h=d.left;requestAnimationFrame(()=>{if(!n.current)return;const g=n.current.getBoundingClientRect();h+g.width>window.innerWidth-8&&(h=d.right-g.width),c+g.height>window.innerHeight-8&&(c=d.top-g.height-4),i({top:c,left:h})}),i({top:c,left:h})},[t,s]),b.useEffect(()=>{if(!t)return;const d=c=>{var h,g;(h=s.current)!=null&&h.contains(c.target)||(g=n.current)!=null&&g.contains(c.target)||o()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[t,o,s]),t?Se.createPortal(e.jsxs("div",{ref:n,className:`fixed z-[9999] min-w-[200px] rounded-[var(--radius)] border border-border bg-popover shadow-elevation-sm py-1 animate-[fadeIn_0.15s_ease] ${a}`,style:{top:l.top,left:l.left},children:[r.map((d,c)=>e.jsx(Mr,{item:d},c)),e.jsx("style",{children:"@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }"})]}),document.body):null}jr.displayName="Menu";const Ar={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},Be={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},xo={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},Fe={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};function Dr({type:r="info",title:t,message:o,closable:s=!0,onClose:a,action:n,avatar:l,time:i,read:d}){const c={info:e.jsx(v.Info,{size:16,className:"text-primary"}),success:e.jsx(v.CheckCircle2,{size:16,className:"text-chart-2"}),warning:e.jsx(v.AlertTriangle,{size:16,className:"text-chart-5"}),error:e.jsx(v.XCircle,{size:16,className:"text-destructive"})},h={info:"border-l-primary",success:"border-l-chart-2",warning:"border-l-chart-5",error:"border-l-destructive"};return e.jsxs("div",{className:`flex gap-3 px-4 py-3 rounded-[var(--radius-md)] border border-border bg-card border-l-[3px] ${h[r]} ${d===!1?"bg-primary/5":""}`,children:[l?e.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex-shrink-0 flex items-center justify-center overflow-hidden",style:Be,children:e.jsx("span",{className:"text-primary",children:l.slice(0,2).toUpperCase()})}):e.jsx("span",{className:"flex-shrink-0 mt-0.5",children:c[r]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("span",{className:"text-foreground",style:Be,children:t}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[i&&e.jsx("span",{className:"text-muted-foreground",style:xo,children:i}),d===!1&&e.jsx("span",{className:"w-2 h-2 rounded-full bg-primary"}),s&&a&&e.jsx("button",{onClick:a,className:"text-muted-foreground hover:text-foreground cursor-pointer",children:e.jsx(v.X,{size:14})})]})]}),o&&e.jsx("p",{className:"text-muted-foreground mt-0.5",style:Ar,children:o}),n&&e.jsxs("button",{onClick:n.onClick,className:"inline-flex items-center gap-1 text-primary mt-2 hover:underline cursor-pointer",style:Fe,children:[n.label," ",e.jsx(v.ExternalLink,{size:12})]})]})]})}function mo({items:r,onMarkRead:t,onMarkAllRead:o,onDismiss:s,onClearAll:a}){const[n,l]=b.useState(r),i=t!==void 0||o!==void 0,d=i?r:n,c=d.filter(f=>!f.read).length,h=()=>{o&&o(),i||l(f=>f.map(p=>({...p,read:!0})))},g=f=>{s&&s(f),i||l(p=>p.filter(w=>w.id!==f))},x=f=>{t&&t(f),i||l(p=>p.map(w=>w.id===f?{...w,read:!0}:w))};return e.jsxs("div",{className:"max-w-md rounded-[var(--radius-lg)] border border-border bg-card overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(v.Bell,{size:16,className:"text-foreground"}),e.jsx("span",{className:"text-foreground",style:Be,children:"Notifications"}),c>0&&e.jsx("span",{className:"px-1.5 py-0.5 rounded-full bg-primary text-primary-foreground",style:Fe,children:c})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[c>0&&e.jsx("button",{onClick:h,className:"text-primary cursor-pointer",style:Fe,children:"Mark all read"}),d.length>0&&a&&e.jsx("button",{onClick:a,className:"text-muted-foreground hover:text-destructive cursor-pointer",style:Fe,children:"Clear all"})]})]}),e.jsx("div",{className:"divide-y divide-border max-h-[360px] overflow-y-auto",children:d.map(f=>e.jsx("div",{className:`px-3 py-2 ${f.read?"":"bg-primary/5"}`,onClick:()=>!f.read&&x(f.id),children:e.jsx(Dr,{type:f.type,title:f.title,message:f.message,time:f.time,read:f.read,closable:!!s,onClose:()=>g(f.id)})},f.id))}),d.length===0&&e.jsxs("div",{className:"py-10 text-center text-muted-foreground",children:[e.jsx(v.BellOff,{size:24,className:"mx-auto mb-2 opacity-40"}),e.jsx("span",{style:Ar,children:"No notifications"})]})]})}const yo={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"};function wo({trigger:r,children:t,placement:o="bottom",title:s,open:a,onOpenChange:n}){const[l,i]=b.useState(!1),d=a!==void 0?a:l,c=x=>{n==null||n(x),a===void 0&&i(x)},h=b.useRef(null);b.useEffect(()=>{if(!d)return;const x=f=>{h.current&&!h.current.contains(f.target)&&c(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[d]);const g={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"};return e.jsxs("div",{className:"relative inline-block",ref:h,children:[e.jsx("div",{onClick:()=>c(!d),className:"cursor-pointer",children:r}),d&&e.jsx("div",{className:`absolute z-50 ${g[o]} w-max max-w-xs`,children:e.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-border bg-card shadow-elevation-sm overflow-hidden",children:[s&&e.jsxs("div",{className:"px-4 py-2.5 border-b border-border flex items-center justify-between",children:[e.jsx("span",{className:"text-foreground",style:yo,children:s}),e.jsx("button",{onClick:()=>c(!1),className:"text-muted-foreground hover:text-foreground cursor-pointer",children:e.jsx(v.X,{size:14})})]}),e.jsx("div",{className:"px-4 py-3",children:t})]})})]})}const No={fontFamily:"var(--font-label)",fontSize:"var(--text-label)"},So={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"};function Tr({value:r,max:t=100,size:o="md",color:s,label:a,showValue:n,indeterminate:l,className:i=""}){const d={sm:"h-1.5",md:"h-2.5",lg:"h-4"},c=l?0:Math.min(100,Math.max(0,(r??0)/t*100));return e.jsxs("div",{className:`w-full ${i}`,children:[(a||n)&&e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[a&&e.jsx("span",{className:"text-foreground",style:No,children:a}),n&&!l&&e.jsxs("span",{className:"text-muted-foreground",style:So,children:[Math.round(c),"%"]})]}),e.jsx("div",{className:`w-full ${d[o]} rounded-full bg-muted overflow-hidden`,children:l?e.jsx("div",{className:"h-full w-1/3 rounded-full animate-[indeterminate_1.5s_infinite_ease-in-out]",style:{backgroundColor:s??"var(--primary)"}}):e.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${c}%`,backgroundColor:s??"var(--primary)"}})}),e.jsx("style",{children:"@keyframes indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }"})]})}Tr.displayName="ProgressBar";const ko={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},$o={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"};function zo({value:r=0,onChange:t,max:o=5,size:s="md",disabled:a,readOnly:n,icon:l="star",showValue:i,label:d}){const[c,h]=b.useState(0),g=s==="sm"?16:s==="lg"?28:20,x=s==="sm"?"gap-0.5":s==="lg"?"gap-1.5":"gap-1",f=l==="heart"?v.Heart:l==="thumb"?v.ThumbsUp:v.Star,p=l==="heart"?"text-destructive":"text-chart-5",w=Array.from({length:o},(u,m)=>m+1);return e.jsxs("div",{className:`inline-flex items-center ${x} ${a?"opacity-50 pointer-events-none":""}`,children:[d&&e.jsx("span",{className:"text-foreground mr-2",style:ko,children:d}),w.map(u=>{const m=u<=(c||r);return e.jsx("button",{type:"button",className:`transition-transform ${n||a?"":"cursor-pointer hover:scale-110"} ${m?p:"text-muted-foreground/40"}`,onMouseEnter:()=>!n&&!a&&h(u),onMouseLeave:()=>h(0),onClick:()=>!n&&!a&&(t==null?void 0:t(u===r?0:u)),disabled:a||n,children:e.jsx(f,{size:g,fill:m?"currentColor":"none"})},u)}),i&&e.jsxs("span",{className:"text-foreground ml-1",style:$o,children:[r,"/",o]})]})}const Fo={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"};function He({children:r,content:t,placement:o="top",className:s=""}){const[a,n]=b.useState(!1),[l,i]=b.useState({top:0,left:0}),d=b.useRef(null),c=()=>{if(!d.current)return;const p=d.current.getBoundingClientRect(),w=8;let u=0,m=0;o==="right"?(u=p.top+p.height/2,m=p.right+w):o==="left"?(u=p.top+p.height/2,m=p.left-w):o==="bottom"?(u=p.bottom+w,m=p.left+p.width/2):(u=p.top-w,m=p.left+p.width/2),i({top:u,left:m})},h=()=>{c(),n(!0)},g=()=>n(!1);b.useEffect(()=>{if(!a)return;const p=()=>c();return window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[a]);const x=o==="right"?{transform:"translateY(-50%)"}:o==="left"?{transform:"translate(-100%, -50%)"}:o==="bottom"?{transform:"translateX(-50%)"}:{transform:"translate(-50%, -100%)"},f=a?e.jsx("div",{style:{position:"fixed",top:l.top,left:l.left,zIndex:9999,pointerEvents:"none",...x},children:e.jsx("div",{className:"px-2.5 py-1.5 rounded-[var(--radius-sm)] bg-foreground text-background whitespace-nowrap shadow-elevation-sm",style:Fo,role:"tooltip",children:t})}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:d,className:`relative inline-flex ${s}`,onMouseEnter:h,onMouseLeave:g,onFocus:h,onBlur:g,children:r}),typeof document<"u"&&Se.createPortal(f,document.body)]})}He.displayName="Tooltip";const Ir={fontFamily:"var(--font-p)",fontSize:"var(--text-p)",fontWeight:"var(--weight-button)",lineHeight:"1"},Co={fontFamily:"var(--font-p)",fontSize:"var(--text-p)",fontWeight:"var(--weight-p)",lineHeight:"1"},Wo={fontFamily:"var(--font-p)",fontSize:"var(--text-p)",fontWeight:"var(--weight-p)",lineHeight:"1"};function _e({item:r,size:t=40}){const o=t+"px",s=Math.round(t*.4)+"px";if(r.avatarUrl)return e.jsx("img",{src:r.avatarUrl,alt:r.name,style:{width:o,height:o,borderRadius:"50%",objectFit:"cover",flexShrink:0}});const a=r.avatarFallback||r.name.charAt(0).toUpperCase();return e.jsx("div",{style:{width:o,height:o,borderRadius:"50%",flexShrink:0,background:"var(--Base_Color--Sky--100, #e0f2fe)",display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"var(--font-label)",fontSize:s,fontWeight:"600",color:"var(--Base_Color--Sky--600, #1b8bf5)"},children:a})}function Ye({company:r,branch:t,provider:o,companies:s=[],branches:a=[],providers:n=[],onCompanyChange:l,onBranchChange:i,onProviderChange:d,collapsed:c=!1}){const[h,g]=b.useState(!1),x=b.useRef(null);b.useEffect(()=>{if(!h)return;const u=m=>{x.current&&!x.current.contains(m.target)&&g(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[h]);const f=r,p=(t==null?void 0:t.name)??(o==null?void 0:o.name),w=u=>{l==null||l(u),g(!1)};return c?e.jsx("button",{onClick:()=>g(!h),title:(f==null?void 0:f.name)??"Switch account",style:{width:40,height:40,borderRadius:"50%",border:"none",background:"rgba(240,249,255,1)",cursor:"pointer",padding:0,display:"flex",alignItems:"center",justifyContent:"center"},children:f?e.jsx(_e,{item:f,size:36}):e.jsx("div",{style:{width:36,height:36,borderRadius:"50%",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontFamily:"var(--font-label)",fontSize:"14px",fontWeight:"600"},children:"S"})}):e.jsxs("div",{ref:x,style:{position:"relative",width:"100%"},children:[e.jsxs("button",{onClick:()=>g(!h),style:{width:"100%",background:"rgba(240,249,255,1)",border:"1px solid rgba(217,242,255,1)",borderRadius:"8px",padding:"8px 16px 8px 8px",display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",textAlign:"left",minHeight:"56px"},children:[f?e.jsx(_e,{item:f,size:40}):e.jsx("div",{style:{width:40,height:40,borderRadius:"50%",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontFamily:"var(--font-label)",fontSize:"16px",fontWeight:"600",flexShrink:0},children:"S"}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:"4px"},children:[e.jsx("span",{style:{...Ir,color:"var(--foreground, #1f2937)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:(f==null?void 0:f.name)??"Select Company"}),p&&e.jsx("span",{style:{...Co,color:"var(--Base_Color--Sky--500, #32a9ff)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:p})]}),e.jsx(v.ChevronUp,{size:16,color:"rgba(50,169,255,1)",style:{flexShrink:0,transition:"transform 0.2s ease",transform:h?"rotate(0deg)":"rotate(180deg)"}})]}),h&&e.jsx("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:50,background:"var(--background, #fff)",border:"1px solid var(--border, #e5e7eb)",borderRadius:"8px",boxShadow:"0px 4px 12px 0px rgba(0,0,0,0.08)",overflow:"hidden"},children:e.jsx("div",{style:{maxHeight:"240px",overflowY:"auto"},children:s.map(u=>{const m=(r==null?void 0:r.id)===u.id;return e.jsxs("button",{onClick:()=>w(u),style:{width:"100%",display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",background:m?"rgba(240,249,255,0.6)":"none",border:"none",cursor:"pointer",textAlign:"left",transition:"background 0.15s",minHeight:"48px"},onMouseEnter:F=>{m||(F.currentTarget.style.background="var(--accent, #f3f4f6)")},onMouseLeave:F=>{F.currentTarget.style.background=m?"rgba(240,249,255,0.6)":"none"},children:[e.jsx(_e,{item:u,size:36}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{...Ir,color:"var(--foreground, #1f2937)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.name}),u.handle&&e.jsx("div",{style:{...Wo,color:"var(--muted-foreground, #6b7280)",marginTop:"2px"},children:u.handle})]}),m&&e.jsx(v.Check,{size:16,color:"var(--Base_Color--Sky--500, #32a9ff)",style:{flexShrink:0}})]},u.id)})})})]})}Ye.displayName="SidebarAccountSwitcher";const Lo={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},Mo={fontFamily:"var(--font-p)",fontSize:"var(--text-p)"},jo={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},Ao={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},Do={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"};function Er({brand:r,accountSwitcher:t,groups:o,activeItem:s,onNavigate:a,collapsed:n=!1,onCollapsedChange:l,showCollapseToggle:i=!0,version:d,versionDate:c,className:h=""}){const[g,x]=b.useState(new Set),f=p=>{x(w=>{const u=new Set(w);return u.has(p)?u.delete(p):u.add(p),u})};return e.jsxs("div",{className:`bg-sidebar border-r border-sidebar-border flex flex-col flex-shrink-0 ${h}`,style:{width:n?"64px":"256px",minWidth:n?"64px":"256px",transition:"width 0.25s cubic-bezier(0.4,0,0.2,1), min-width 0.25s cubic-bezier(0.4,0,0.2,1)",overflow:"visible"},children:[t?e.jsx("div",{className:`${n?"px-2 py-2":"px-3 py-3"} border-b border-sidebar-border flex items-center ${n?"justify-center":""}`,children:e.jsx(Ye,{...t,collapsed:n})}):r&&e.jsxs("div",{className:`${n?"px-2":"px-4"} py-4 border-b border-sidebar-border flex items-center ${n?"justify-center":"gap-2"}`,children:[r.logo?e.jsx("img",{src:r.logo,alt:r.name,className:"w-8 h-8 rounded-[var(--radius-sm)] flex-shrink-0 object-cover"}):e.jsx("div",{className:"w-8 h-8 rounded-[var(--radius-sm)] bg-primary flex items-center justify-center text-primary-foreground flex-shrink-0",style:jo,children:r.name.charAt(0).toUpperCase()}),!n&&e.jsx("span",{className:"text-sidebar-foreground truncate",style:Lo,children:r.name})]}),e.jsx("nav",{className:`flex-1 overflow-y-auto py-3 ${n?"px-1.5":"px-2"}`,children:o.map(p=>{const w=g.has(p.label);return e.jsxs("div",{className:"mb-4",children:[!n&&e.jsxs("button",{onClick:()=>f(p.label),className:"w-full flex items-center justify-between px-2 mb-1.5 text-muted-foreground hover:text-foreground transition-colors cursor-pointer",style:Ao,children:[e.jsx("span",{children:p.label}),e.jsx(v.ChevronUp,{size:12,style:{transition:"transform 0.2s ease",transform:w?"rotate(180deg)":"rotate(0deg)"}})]}),n&&e.jsx("div",{className:"h-px bg-sidebar-border mx-1 mb-2 mt-1"}),!w&&e.jsx("div",{className:"space-y-0.5",children:p.items.map(u=>{const m=s===u.id,F=e.jsxs("button",{onClick:()=>a==null?void 0:a(u),className:`w-full flex items-center ${n?"justify-center":"gap-2"} ${n?"px-0":"px-2"} py-2 rounded-[var(--radius-md)] transition-colors cursor-pointer ${m?"bg-sidebar-accent text-sidebar-accent-foreground":"text-sidebar-foreground hover:bg-sidebar-accent/50"}`,style:Mo,children:[e.jsx("span",{className:`flex-shrink-0 ${m?"text-sidebar-primary":"text-muted-foreground"}`,children:u.icon}),!n&&e.jsx("span",{className:"truncate flex-1 text-left",children:u.label}),!n&&u.badge&&e.jsx("span",{className:"rounded-full bg-primary text-primary-foreground",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-badge)",fontWeight:"var(--weight-button)",lineHeight:"1",padding:"2px 6px",display:"inline-flex",alignItems:"center",minWidth:"18px",justifyContent:"center"},children:u.badge})]},u.id);return n?e.jsx("div",{className:"w-full flex",children:e.jsx(He,{content:u.label,placement:"right",className:"flex-1",children:F})},u.id):F})})]},p.label)})}),(i&&l||d)&&e.jsxs("div",{className:`${n?"px-1.5":"px-3"} py-3 border-t border-sidebar-border flex flex-col gap-1`,children:[i&&l&&e.jsxs("button",{onClick:()=>l(!n),className:`w-full flex items-center ${n?"justify-center":"gap-2 px-2"} py-1.5 rounded-[var(--radius-md)] text-muted-foreground hover:text-foreground hover:bg-sidebar-accent/50 cursor-pointer`,style:Do,title:n?"Expand sidebar":"Collapse sidebar",children:[n?e.jsx(v.PanelLeftOpen,{size:16}):e.jsx(v.PanelLeftClose,{size:16}),!n&&e.jsx("span",{children:"Collapse"})]}),d&&!n&&e.jsxs("div",{className:"px-2 flex items-center gap-1.5 text-muted-foreground/60",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-label)"},children:[e.jsx("span",{children:d}),c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:c})]})]}),d&&n&&e.jsx("div",{className:"flex justify-center text-muted-foreground/60",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-label)"},title:`${d}${c?` · ${c}`:""}`,children:d})]})]})}Er.displayName="Sidebar";function Q({width:r,height:t,variant:o="rectangular",animate:s=!0,className:a}){const n="bg-muted",l=s?"animate-pulse":"",i=o==="circular"?"rounded-full":o==="rounded"?"rounded-[var(--radius-md)]":"rounded-[var(--radius-sm)]";return e.jsx("div",{className:`${n} ${l} ${i} ${a??""}`,style:{width:r??"100%",height:t??(o==="text"?"1em":o==="circular"?40:20)}})}function To(){return e.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-border bg-card p-4 space-y-4 w-full max-w-sm",children:[e.jsx(Q,{variant:"rounded",height:160}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Q,{variant:"text",width:"60%",height:20}),e.jsx(Q,{variant:"text",width:"100%",height:14}),e.jsx(Q,{variant:"text",width:"80%",height:14})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Q,{variant:"circular",width:36,height:36}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(Q,{variant:"text",width:"40%",height:14}),e.jsx(Q,{variant:"text",width:"25%",height:12})]})]})]})}function Io(){return e.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-border bg-card overflow-hidden",children:[e.jsx("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex gap-4",children:[120,160,100,80].map((r,t)=>e.jsx(Q,{variant:"text",width:r,height:14},t))}),[0,1,2,3].map(r=>e.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center gap-4",children:[e.jsx(Q,{variant:"circular",width:28,height:28}),e.jsx(Q,{variant:"text",width:100+r*15,height:14}),e.jsx(Q,{variant:"text",width:140,height:14,className:"flex-1"}),e.jsx(Q,{variant:"rounded",width:60,height:22}),e.jsx(Q,{variant:"text",width:80,height:14})]},r))]})}function Eo(){return e.jsx("div",{className:"space-y-3 w-full max-w-md",children:[0,1,2].map(r=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-[var(--radius-md)] border border-border bg-card",children:[e.jsx(Q,{variant:"circular",width:40,height:40}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(Q,{variant:"text",width:`${60+r*10}%`,height:14}),e.jsx(Q,{variant:"text",width:`${40+r*5}%`,height:12})]}),e.jsx(Q,{variant:"rounded",width:50,height:24})]},r))})}const Bo={sm:"w-4 h-4 border-2",md:"w-8 h-8 border-[3px]",lg:"w-12 h-12 border-4",xl:"w-16 h-16 border-4"};function Br({size:r="md",color:t,className:o=""}){return e.jsx("div",{className:`${Bo[r]} rounded-full border-muted animate-spin ${o}`,style:{borderTopColor:t??"var(--primary)"},role:"status","aria-label":"Loading"})}Br.displayName="Spinner";const Xe={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},Hr={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},_r={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},Yr={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},Ho={sm:{fontFamily:"var(--font-h4)",fontSize:"var(--text-h4)",fontWeight:"var(--weight-h4)"},md:{fontFamily:"var(--font-h2)",fontSize:"var(--text-h2)",fontWeight:"var(--weight-h2)"},lg:{fontFamily:"var(--font-h1)",fontSize:"var(--text-h1)",fontWeight:"var(--weight-h1)"}};function _o({title:r,value:t,prefix:o,suffix:s,trend:a,trendLabel:n,icon:l,size:i="md",loading:d}){const c=Ho[i],h=(a==null?void 0:a.direction)==="up"?"text-chart-2":(a==null?void 0:a.direction)==="down"?"text-destructive":"text-muted-foreground",g=(a==null?void 0:a.direction)==="up"?v.ArrowUpRight:(a==null?void 0:a.direction)==="down"?v.ArrowDownRight:v.Minus;return d?e.jsxs("div",{className:"space-y-2 animate-pulse",children:[e.jsx("div",{className:"h-3 w-20 bg-muted rounded-[var(--radius-sm)]"}),e.jsx("div",{className:"h-8 w-32 bg-muted rounded-[var(--radius-sm)]"}),e.jsx("div",{className:"h-3 w-24 bg-muted rounded-[var(--radius-sm)]"})]}):e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[l&&e.jsx("span",{className:"text-muted-foreground",children:l}),e.jsx("span",{className:"text-muted-foreground",style:Xe,children:r})]}),e.jsxs("div",{className:"flex items-baseline gap-1",children:[o&&e.jsx("span",{className:"text-muted-foreground",style:Hr,children:o}),e.jsx("span",{className:"text-foreground",style:c,children:typeof t=="number"?t.toLocaleString():t}),s&&e.jsx("span",{className:"text-muted-foreground",style:Xe,children:s})]}),a&&e.jsxs("div",{className:`flex items-center gap-1 ${h}`,children:[e.jsx(g,{size:14}),e.jsxs("span",{style:Yr,children:[a.value,"%"]}),n&&e.jsx("span",{className:"text-muted-foreground",style:_r,children:n})]})]})}function Yo({title:r,value:t,prefix:o,trend:s,trendLabel:a,icon:n,iconBg:l}){const i=(s==null?void 0:s.direction)==="up"?"text-chart-2":(s==null?void 0:s.direction)==="down"?"text-destructive":"text-muted-foreground",d=(s==null?void 0:s.direction)==="up"?v.ArrowUpRight:(s==null?void 0:s.direction)==="down"?v.ArrowDownRight:v.Minus;return e.jsx("div",{className:"rounded-[var(--radius-lg)] border border-border bg-card p-5 overflow-hidden",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1 min-w-0 flex-1",children:[e.jsx("span",{className:"text-muted-foreground",style:Xe,children:r}),e.jsxs("div",{className:"flex items-baseline gap-1",children:[o&&e.jsx("span",{className:"text-muted-foreground",style:Hr,children:o}),e.jsx("span",{className:"text-foreground",style:{fontFamily:"var(--font-h3)",fontSize:"var(--text-h3)",fontWeight:"var(--weight-h3)"},children:typeof t=="number"?t.toLocaleString():t})]}),s&&e.jsxs("div",{className:`flex items-center gap-1 ${i}`,children:[e.jsx(d,{size:12}),e.jsxs("span",{style:Yr,children:[s.value,"%"]}),a&&e.jsx("span",{className:"text-muted-foreground",style:_r,children:a})]})]}),n&&e.jsx("div",{className:`w-10 h-10 rounded-[var(--radius-md)] flex items-center justify-center flex-shrink-0 ${l||"bg-primary/10 text-primary"}`,children:n})]})})}const Xo={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},Xr={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},Or={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},Ur={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};function Pr({steps:r,current:t,orientation:o="horizontal",onStepClick:s,className:a=""}){return o==="vertical"?e.jsx("div",{className:`flex flex-col ${a}`,children:r.map((n,l)=>{const i=l<t,d=l===t;return e.jsxs("div",{className:"flex gap-3",onClick:()=>s==null?void 0:s(l),children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 transition-colors ${s?"cursor-pointer":""} ${i||d?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,style:Ur,children:i?e.jsx(v.Check,{size:14}):l+1}),l<r.length-1&&e.jsx("div",{className:`w-px flex-1 min-h-[24px] my-1 ${i?"bg-primary":"bg-border"}`})]}),e.jsxs("div",{className:`pb-6 ${l===r.length-1?"pb-0":""}`,children:[e.jsx("span",{className:`block ${d?"text-foreground":"text-muted-foreground"}`,style:d?Xr:Xo,children:n.title}),n.description&&e.jsx("span",{className:"text-muted-foreground block",style:Or,children:n.description})]})]},l)})}):e.jsx("div",{className:`flex items-center ${a}`,children:r.map((n,l)=>{const i=l<t,d=l===t;return e.jsxs("div",{className:`flex items-center ${l<r.length-1?"flex-1":""}`,children:[e.jsxs("div",{className:"flex flex-col items-center gap-1",onClick:()=>s==null?void 0:s(l),children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 transition-colors ${s?"cursor-pointer":""} ${i||d?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,style:Ur,children:i?e.jsx(v.Check,{size:14}):l+1}),e.jsx("span",{className:`text-center ${d?"text-foreground":"text-muted-foreground"}`,style:d?Xr:Or,children:n.title})]}),l<r.length-1&&e.jsx("div",{className:`flex-1 h-px mx-2 mt-[-20px] ${i?"bg-primary":"bg-border"}`})]},l)})})}Pr.displayName="Stepper";const Oo={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},Uo={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},Po={sm:{track:"w-7 h-4",thumb:"w-3 h-3",on:"translate-x-3"},md:{track:"w-10 h-6",thumb:"w-4.5 h-4.5",on:"translate-x-4.5"},lg:{track:"w-14 h-8",thumb:"w-6.5 h-6.5",on:"translate-x-6"}},Go={primary:"bg-primary",success:"bg-chart-2",warning:"bg-chart-5",destructive:"bg-destructive"},Ko={sm:{w:12,h:12,on:14},md:{w:18,h:18,on:18},lg:{w:26,h:26,on:24}};function Zo({checked:r,onChange:t,label:o,description:s,size:a="md",disabled:n,color:l="primary"}){const i=Po[a],d=Ko[a];return e.jsxs("label",{className:`inline-flex items-start gap-3 ${n?"opacity-50 pointer-events-none":"cursor-pointer"}`,children:[e.jsx("button",{role:"switch","aria-checked":r,onClick:()=>t(!r),disabled:n,className:`${i.track} rounded-full relative flex-shrink-0 transition-colors cursor-pointer ${r?Go[l]:"bg-muted"}`,children:e.jsx("span",{className:"rounded-full bg-background shadow-elevation-sm absolute transition-transform",style:{width:d.w,height:d.h,top:"50%",transform:`translateY(-50%) translateX(${r?d.on:2}px)`,left:0}})}),(o||s)&&e.jsxs("div",{children:[o&&e.jsx("span",{className:"text-foreground block",style:Oo,children:o}),s&&e.jsx("span",{className:"text-muted-foreground block",style:Uo,children:s})]})]})}const qo={default:"bg-muted/50 text-foreground border-border",primary:"bg-primary/10 text-primary border-primary/20",success:"bg-chart-2/10 text-chart-2 border-chart-2/20",warning:"bg-chart-5/10 text-chart-5 border-chart-5/20",destructive:"bg-destructive/10 text-destructive border-destructive/20",info:"bg-accent text-accent-foreground border-primary/20"},Jo={sm:"px-1.5 py-0.5",md:"px-2 py-0.5",lg:"px-3 py-1.5"},Qo={sm:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},md:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},lg:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"}};function Gr({children:r,color:t="default",size:o="md",icon:s,closable:a,onClose:n,className:l=""}){const i=qo[t],d=Jo[o],c=Qo[o];return e.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full border ${i} ${d} ${l}`,style:c,children:[s&&e.jsx("span",{className:"flex-shrink-0",children:s}),r,a&&e.jsx("button",{className:"hover:opacity-70 cursor-pointer",onClick:n,children:e.jsx(v.X,{size:o==="sm"?10:12})})]})}Gr.displayName="Tag";const Vo={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},Ro={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},es={default:"bg-card border-border",outline:"bg-transparent border-border",filled:"bg-muted/30 border-transparent"};function Kr({tags:r,onChange:t,placeholder:o,disabled:s,maxTags:a,variant:n="default",className:l=""}){const[i,d]=b.useState(""),c=()=>{const g=i.trim();!g||r.includes(g)||a&&r.length>=a||(t([...r,g]),d(""))},h=g=>{t(r.filter(x=>x!==g))};return e.jsxs("div",{className:`flex flex-wrap items-center gap-1.5 px-3 py-2 rounded-[var(--radius)] border ${es[n]} transition-colors focus-within:border-primary ${s?"opacity-50 pointer-events-none":""} ${l}`,children:[r.map(g=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-[var(--radius-sm)] bg-primary/10 text-primary",style:Ro,children:[g,e.jsx("button",{className:"hover:text-destructive cursor-pointer",onClick:()=>h(g),children:e.jsx(v.X,{size:12})})]},g)),e.jsx("input",{value:i,onChange:g=>d(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),c()),g.key==="Backspace"&&!i&&r.length&&t(r.slice(0,-1))},placeholder:r.length?"":o,className:"flex-1 min-w-[80px] bg-transparent outline-none text-foreground placeholder:text-muted-foreground",style:Vo,disabled:s})]})}Kr.displayName="TagInput";const rs={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},Zr={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},Oe={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"};function ts({items:r,variant:t="default",size:o="md"}){const s=o==="sm"?"w-6 h-6":o==="lg"?"w-10 h-10":"w-8 h-8",a=o==="sm"?12:o==="lg"?18:14,n=l=>l==="completed"?"bg-chart-2 text-primary-foreground":l==="current"?"bg-primary text-primary-foreground":l==="error"?"bg-destructive text-primary-foreground":"bg-muted text-muted-foreground";return t==="compact"?e.jsx("div",{className:"space-y-0",children:r.map((l,i)=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:`${s} rounded-full flex items-center justify-center flex-shrink-0 ${n(l.status)}`,children:l.icon||(l.status==="completed"?e.jsx(v.CheckCircle2,{size:a}):e.jsx(v.Circle,{size:a}))}),i<r.length-1&&e.jsx("div",{className:"w-0.5 flex-1 min-h-4 bg-border"})]}),e.jsxs("div",{className:"pb-4 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-foreground",style:Zr,children:l.title}),l.time&&e.jsx("span",{className:"text-muted-foreground",style:Oe,children:l.time})]}),l.description&&e.jsx("p",{className:"text-muted-foreground mt-0.5",style:Oe,children:l.description})]})]},i))}):e.jsx("div",{className:"relative",children:r.map((l,i)=>{const d=t==="alternate"&&i%2===1;return e.jsxs("div",{className:`flex gap-4 pb-8 last:pb-0 ${d?"flex-row-reverse":""}`,children:[e.jsxs("div",{className:"flex flex-col items-center flex-shrink-0",children:[e.jsx("div",{className:`${s} rounded-full flex items-center justify-center ${n(l.status)}`,children:l.icon||(l.status==="completed"?e.jsx(v.CheckCircle2,{size:a}):e.jsx(v.Circle,{size:a}))}),i<r.length-1&&e.jsx("div",{className:"w-0.5 flex-1 bg-border mt-1"})]}),e.jsxs("div",{className:`flex-1 min-w-0 ${d?"text-right":""}`,children:[e.jsxs("div",{className:`flex items-center gap-2 ${d?"justify-end":""}`,children:[e.jsx("span",{className:"text-foreground",style:Zr,children:l.title}),l.time&&e.jsx("span",{className:"text-muted-foreground",style:Oe,children:l.time})]}),l.description&&e.jsx("p",{className:"text-muted-foreground mt-0.5",style:rs,children:l.description}),l.children&&e.jsx("div",{className:"mt-2",children:l.children})]})]},i)})})}const ye={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"};function qr({brand:r,breadcrumbs:t,title:o,actions:s,user:a,height:n="72px",showSearch:l=!1,searchPlaceholder:i="Search... (Ctrl+K)",onSearchClick:d,notificationCount:c,onNotificationClick:h,onMobileMenuClick:g,onSidebarToggle:x,onUserClick:f,onBreadcrumbClick:p,className:w=""}){const u=a!=null&&a.name?a.name.split(" ").map(m=>m[0]).join("").slice(0,2).toUpperCase():"";return e.jsxs("div",{className:`bg-card border-b border-border flex items-center px-5 gap-4 ${w}`,style:{height:n},children:[x&&e.jsx("button",{className:"w-9 h-9 flex items-center justify-center rounded-[var(--radius-md)] text-foreground hover:bg-muted/30 transition-colors cursor-pointer",onClick:x,title:"Toggle sidebar",children:e.jsx(v.Menu,{size:18})}),!x&&g&&e.jsx("button",{className:"lg:hidden w-8 h-8 flex items-center justify-center rounded-[var(--radius-md)] text-foreground hover:bg-muted/30 transition-colors cursor-pointer",onClick:g,children:e.jsx(v.Menu,{size:16})}),r&&e.jsx(e.Fragment,{children:typeof r.logo=="string"?e.jsx("img",{src:r.logo,alt:r.name,className:"w-8 h-8 rounded-[var(--radius-sm)] flex-shrink-0 object-cover"}):r.logo?e.jsx("div",{className:"w-8 h-8 rounded-[var(--radius-sm)] overflow-hidden flex-shrink-0",children:r.logo}):e.jsx("div",{className:"w-8 h-8 rounded-[var(--radius-sm)] bg-primary flex items-center justify-center text-primary-foreground flex-shrink-0",style:ye,children:r.name.charAt(0).toUpperCase()})}),o&&e.jsx("span",{className:"text-foreground hidden sm:block truncate",style:ye,children:o}),t&&t.length>0&&e.jsx("nav",{className:"hidden sm:flex items-center gap-1.5 text-muted-foreground",style:ye,children:t.map((m,F)=>e.jsxs(b.Fragment,{children:[F>0&&e.jsx(v.ChevronRight,{size:12}),m.href||p?e.jsx("span",{className:`cursor-pointer ${F===t.length-1?"text-foreground":"hover:text-foreground"}`,onClick:()=>p==null?void 0:p(m,F),children:m.label}):e.jsx("span",{className:F===t.length-1?"text-foreground":"",children:m.label})]},F))}),e.jsx("div",{className:"flex-1"}),l&&e.jsxs("div",{className:"hidden md:flex items-center gap-2 px-3 h-8 rounded-[var(--radius)] border border-border bg-muted/20 text-muted-foreground w-56 cursor-pointer hover:border-primary/40 transition-colors",onClick:d,children:[e.jsx(v.Search,{size:14}),e.jsx("span",{style:ye,children:i})]}),s,h&&e.jsxs("button",{className:"relative w-8 h-8 flex items-center justify-center rounded-[var(--radius-md)] text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors cursor-pointer",onClick:h,children:[e.jsx(v.Bell,{size:16}),c!==void 0&&c>0&&e.jsx("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-destructive"})]}),a&&e.jsx("div",{className:"cursor-pointer",onClick:f,children:a.avatar?e.jsx("img",{src:a.avatar,alt:a.name,className:"w-8 h-8 rounded-full object-cover"}):e.jsx("div",{className:"w-8 h-8 rounded-full bg-primary text-primary-foreground flex items-center justify-center",style:ye,children:u})})]})}qr.displayName="TopNavbar";const os={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},ss={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},Ue={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"};function Jr({title:r,items:t,selected:o,onToggle:s,search:a,onSearch:n,searchable:l}){return e.jsxs("div",{className:"flex-1 min-w-[180px] rounded-[var(--radius-lg)] border border-border bg-card overflow-hidden",children:[e.jsxs("div",{className:"px-3 py-2.5 border-b border-border bg-muted/30 flex items-center justify-between",children:[e.jsx("span",{className:"text-foreground",style:ss,children:r}),e.jsxs("span",{className:"text-muted-foreground",style:Ue,children:[t.length," items"]})]}),l&&e.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:[e.jsx(v.Search,{size:12,className:"text-muted-foreground"}),e.jsx("input",{value:a,onChange:i=>n(i.target.value),placeholder:"Search\\u2026",className:"flex-1 bg-transparent outline-none text-foreground placeholder:text-muted-foreground",style:Ue})]}),e.jsxs("div",{className:"max-h-[240px] overflow-y-auto py-1",children:[t.length===0&&e.jsx("div",{className:"px-3 py-6 text-center text-muted-foreground",style:Ue,children:"No items"}),t.map(i=>e.jsxs("button",{onClick:()=>!i.disabled&&s(i.id),className:`w-full flex items-center gap-2 px-3 py-1.5 transition-colors cursor-pointer
|
|
87
|
-
${o.has(
|
|
88
|
-
${
|
|
89
|
-
${o.has(
|
|
62
|
+
`})]})}Vr.displayName="Drawer";const oa={sm:{trigger:"h-9 px-[var(--Spacing--Spacing-xl)] gap-[var(--Spacing--Spacing-sm)]",option:"rounded-[var(--radius-sm)]",optionStyle:{padding:"var(--Spacing--Spacing-sm) var(--Spacing--Spacing-xl)"},textStyle:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},descStyle:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},icon:14,avatarSize:20},md:{trigger:"h-11 px-[var(--Spacing--Spacing-2xl)] gap-[var(--Spacing--Spacing-lg)]",option:"rounded-[var(--radius-sm)]",optionStyle:{padding:"var(--Spacing--Spacing-md) var(--Spacing--Spacing-2xl)"},textStyle:{fontFamily:"var(--font-caption)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-caption)"},descStyle:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},icon:16,avatarSize:24},lg:{trigger:"h-13 px-[var(--Spacing--Spacing-3xl)] gap-[var(--Spacing--Spacing-xl)]",option:"rounded-[var(--radius-sm)]",optionStyle:{padding:"var(--Spacing--Spacing-lg) var(--Spacing--Spacing-3xl)"},textStyle:{fontFamily:"var(--font-p)",fontSize:"var(--text-p)",fontWeight:"var(--weight-p)"},descStyle:{fontFamily:"var(--font-caption)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-caption)"},icon:18,avatarSize:28}},aa={default:{base:"border border-border bg-input-background",hover:"hover:border-foreground/30",focus:"ring-2 ring-ring/20 border-ring"},outlined:{base:"border-2 border-border bg-transparent",hover:"hover:border-foreground/40",focus:"ring-2 ring-ring/20 border-ring"},filled:{base:"border border-transparent bg-muted",hover:"hover:bg-muted/80",focus:"ring-2 ring-ring/20 border-ring bg-input-background"},ghost:{base:"border border-transparent bg-transparent",hover:"hover:bg-muted/50",focus:"ring-2 ring-ring/20 bg-input-background"}},sa={default:"",error:"!border-destructive ring-destructive/20",success:"!border-chart-2 ring-chart-2/20",warning:"!border-chart-5 ring-chart-5/20"},Rr=c.forwardRef(({options:r,value:t,defaultValue:o,onChange:a,placeholder:s="Select an option…",label:n,helperText:l,errorMessage:d,successMessage:i,size:f="md",variant:u="default",state:x="default",disabled:y=!1,loading:h=!1,searchable:p=!1,clearable:g=!1,multiple:m=!1,maxSelections:S,grouped:z=!1,required:b=!1,id:w,className:N="",showSelectAll:F=!1,tagLimit:W,creatable:D=!1,onCreateOption:M,createLabel:L='Create "{query}"',emptyState:I,footer:A,onSearch:k,searchDebounce:$=300,searchLoading:E=!1,renderOption:T},P)=>{const[B,_]=c.useState(!1),[K,R]=c.useState(""),[te,oe]=c.useState(-1),[Q,ee]=c.useState(o??(m?[]:"")),Y=t??Q,H=c.useRef(null),q=c.useRef(null),Z=c.useRef(null),le=c.useRef(null),[ue,Me]=c.useState({top:0,left:0,width:0}),U=oa[f],ve=aa[u];c.useEffect(()=>{if(!B||!H.current)return;const j=()=>{const O=H.current.getBoundingClientRect();Me({top:O.bottom+4,left:O.left,width:O.width})};return j(),window.addEventListener("scroll",j,!0),window.addEventListener("resize",j),()=>{window.removeEventListener("scroll",j,!0),window.removeEventListener("resize",j)}},[B]);const We=c.useCallback(j=>{R(j),k&&(le.current&&clearTimeout(le.current),le.current=setTimeout(()=>{k(j)},$))},[k,$]);c.useEffect(()=>()=>{le.current&&clearTimeout(le.current)},[]);const he=c.useMemo(()=>!K||k?r:r.filter(j=>{var O;return j.label.toLowerCase().includes(K.toLowerCase())||((O=j.description)==null?void 0:O.toLowerCase().includes(K.toLowerCase()))}),[r,K,k]),se=c.useMemo(()=>{if(!z)return null;const j={};return he.forEach(O=>{const X=O.group||"Other";j[X]||(j[X]=[]),j[X].push(O)}),j},[he,z]),Se=c.useMemo(()=>{var j;return m&&Array.isArray(Y)?Y.map(O=>{var X;return(X=r.find($e=>$e.value===O))==null?void 0:X.label}).filter(Boolean):(j=r.find(O=>O.value===Y))!=null&&j.label?[r.find(O=>O.value===Y).label]:[]},[Y,r,m]),G=c.useCallback(j=>m&&Array.isArray(Y)?Y.includes(j):Y===j,[Y,m]),V=c.useCallback(j=>{if(m){const O=Array.isArray(Y)?[...Y]:[],X=O.indexOf(j);if(X>-1)O.splice(X,1);else{if(S&&O.length>=S)return;O.push(j)}ee(O),a==null||a(O)}else ee(j),a==null||a(j),_(!1);R("")},[Y,m,S,a]),de=c.useMemo(()=>he.filter(j=>!j.disabled).map(j=>j.value),[he]),re=c.useMemo(()=>!m||!Array.isArray(Y)?!1:de.length>0&&de.every(j=>Y.includes(j)),[m,Y,de]),Pe=c.useMemo(()=>!m||!Array.isArray(Y)?!1:de.some(j=>Y.includes(j))&&!re,[m,Y,de,re]),Oe=c.useCallback(()=>{if(m)if(re){const j=Array.isArray(Y)?Y.filter(O=>!de.includes(O)):[];ee(j),a==null||a(j)}else{const j=Array.isArray(Y)?[...Y]:[];for(const O of de)if(!j.includes(O)){if(S&&j.length>=S)break;j.push(O)}ee(j),a==null||a(j)}},[m,re,Y,de,S,a]),Nr=c.useCallback(()=>{K.trim()&&(M==null||M(K.trim()),R(""))},[K,M]),ke=c.useMemo(()=>!D||!K.trim()?!1:!r.some(j=>j.label.toLowerCase()===K.toLowerCase()),[D,K,r]),Sr=c.useCallback(j=>{j.stopPropagation();const O=m?[]:"";ee(O),a==null||a(O)},[m,a]),Ye=z?Object.values(se||{}).flat():he,no=c.useCallback(j=>{var O;if(!(y||h))switch(j.key){case"ArrowDown":j.preventDefault(),B?oe(X=>X<Ye.length-1?X+1:0):_(!0);break;case"ArrowUp":j.preventDefault(),oe(X=>X>0?X-1:Ye.length-1);break;case"Enter":case" ":if(j.preventDefault(),B&&te>=0){const X=Ye[te];X&&!X.disabled&&V(X.value)}else _(!0);break;case"Escape":_(!1),(O=H.current)==null||O.focus();break}},[y,h,B,te,Ye,V]);c.useEffect(()=>{const j=O=>{const X=O.target;H.current&&!H.current.contains(X)&&q.current&&!q.current.contains(X)&&(_(!1),R(""))};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[]),c.useEffect(()=>{B&&p&&setTimeout(()=>{var j;return(j=Z.current)==null?void 0:j.focus()},50),B&&oe(-1)},[B,p]);const kr=m?Array.isArray(Y)&&Y.length>0:!!Y,Ge=d?"error":x,yn=()=>{const j=Se,O=W&&W>0?W:j.length,X=j.slice(0,O),$e=j.length-X.length;return e.jsxs("span",{className:"flex flex-wrap gap-1",children:[X.map($r=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-[var(--radius-sm)] bg-[var(--Colors--Background--bg-brand-secondary)] text-[var(--Colors--Text--text-brand-primary)]",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},children:[$r,e.jsx(v.X,{size:10,className:"cursor-pointer hover:text-destructive transition-colors",onClick:wn=>{wn.stopPropagation();const co=r.find(Nn=>Nn.label===$r);co&&V(co.value)}})]},$r)),$e>0&&e.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-[var(--radius-sm)] bg-muted text-muted-foreground",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},children:["+",$e," more"]})]})},lo=(j,O)=>{const X=G(j.value);return T?e.jsx("button",{type:"button",role:"option","aria-selected":X,disabled:j.disabled,className:`w-full ${U.option} transition-colors cursor-pointer
|
|
63
|
+
${X?"bg-[var(--Colors--Background--bg-brand-secondary)]":""}
|
|
64
|
+
${te===O&&!X?"bg-[var(--Colors--Background--bg-primary_hover)]":""}
|
|
65
|
+
${j.disabled?"opacity-40 cursor-not-allowed":"hover:bg-[var(--Colors--Background--bg-primary_hover)]"}
|
|
66
|
+
`,style:U.optionStyle,onClick:()=>!j.disabled&&V(j.value),onMouseEnter:()=>oe(O),children:T(j,X)},j.value):e.jsxs("button",{type:"button",role:"option","aria-selected":X,disabled:j.disabled,className:`w-full flex items-center gap-[var(--Spacing--Spacing-lg)] ${U.option} transition-colors cursor-pointer
|
|
67
|
+
${X?"bg-[var(--Colors--Background--bg-brand-secondary)] text-[var(--Colors--Text--text-brand-primary)]":""}
|
|
68
|
+
${te===O&&!X?"bg-[var(--Colors--Background--bg-primary_hover)]":""}
|
|
69
|
+
${j.disabled?"opacity-40 cursor-not-allowed":"hover:bg-[var(--Colors--Background--bg-primary_hover)]"}
|
|
70
|
+
`,style:{...U.optionStyle,...U.textStyle},onClick:()=>!j.disabled&&V(j.value),onMouseEnter:()=>oe(O),children:[m&&e.jsx("span",{className:`flex-shrink-0 w-4 h-4 rounded-[var(--radius-sm)] border flex items-center justify-center transition-colors
|
|
71
|
+
${X?"bg-primary border-primary":"border-border"}
|
|
72
|
+
`,children:X&&e.jsx(v.Check,{size:10,className:"text-primary-foreground"})}),j.avatar&&e.jsx("img",{src:j.avatar,alt:"",className:"flex-shrink-0 rounded-full object-cover",style:{width:U.avatarSize,height:U.avatarSize}}),j.icon&&e.jsx("span",{className:"flex-shrink-0",children:j.icon}),e.jsxs("span",{className:"flex-1 text-left",children:[e.jsx("span",{className:"block",children:j.label}),j.description&&e.jsx("span",{className:"block text-muted-foreground",style:{marginTop:"var(--Spacing--Spacing-xxs)",...U.descStyle},children:j.description})]}),!m&&X&&e.jsx(v.Check,{size:U.icon,className:"text-primary flex-shrink-0"})]},j.value)};let io=0;return e.jsxs("div",{ref:P,className:`relative w-full ${N}`,id:w,children:[n&&e.jsxs("label",{className:"block mb-1.5 text-foreground",children:[n,b&&e.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),e.jsxs("button",{ref:H,type:"button",role:"combobox","aria-expanded":B,"aria-haspopup":"listbox",disabled:y||h,onClick:()=>!y&&!h&&_(!B),onKeyDown:no,className:`w-full flex items-center rounded-[var(--radius-md)] transition-all duration-150 ${U.trigger}
|
|
73
|
+
${ve.base}
|
|
74
|
+
${!y&&!h?ve.hover:""}
|
|
75
|
+
${B?ve.focus:""}
|
|
76
|
+
${y?"opacity-50 cursor-not-allowed":"cursor-pointer"}
|
|
77
|
+
${h?"opacity-70 cursor-wait":""}
|
|
78
|
+
${sa[Ge]}
|
|
79
|
+
`,style:U.textStyle,children:[h?e.jsx(v.Loader2,{size:U.icon,className:"animate-spin text-muted-foreground"}):null,e.jsx("span",{className:`flex-1 text-left truncate ${kr?"text-foreground":"text-muted-foreground"}`,children:kr?m?yn():Se[0]:s}),g&&kr&&!y&&e.jsx(v.X,{size:U.icon,className:"flex-shrink-0 text-muted-foreground hover:text-foreground cursor-pointer transition-colors",onClick:Sr}),e.jsx(v.ChevronDown,{size:U.icon,className:`flex-shrink-0 text-muted-foreground transition-transform duration-200 ${B?"rotate-180":""}`})]}),B&&Le.createPortal(e.jsxs("div",{ref:q,role:"listbox",className:"fixed z-[9999] bg-popover border border-border rounded-[var(--radius)] shadow-elevation-sm overflow-hidden",style:{top:ue.top,left:ue.left,width:ue.width||"auto"},children:[p&&e.jsx("div",{className:"p-2 border-b border-border",children:e.jsxs("div",{className:"relative",children:[e.jsx(v.Search,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.jsx("input",{ref:Z,type:"text",value:K,onChange:j=>We(j.target.value),placeholder:"Search\\u2026",className:"w-full pl-8 pr-3 py-1.5 bg-background border border-border rounded-[var(--radius-sm)] outline-none placeholder:text-muted-foreground focus:border-ring focus:ring-1 focus:ring-ring/20 transition-colors",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},onKeyDown:no})]})}),m&&F&&he.length>0&&e.jsxs("button",{type:"button",className:`w-full flex items-center gap-[var(--Spacing--Spacing-lg)] ${U.option} border-b border-border transition-colors hover:bg-[var(--Colors--Background--bg-primary_hover)] cursor-pointer`,style:{...U.optionStyle,...U.textStyle},onClick:Oe,children:[e.jsxs("span",{className:`flex-shrink-0 w-4 h-4 rounded-[var(--radius-sm)] border flex items-center justify-center transition-colors
|
|
80
|
+
${re?"bg-primary border-primary":Pe?"bg-primary/50 border-primary":"border-border"}
|
|
81
|
+
`,children:[re&&e.jsx(v.Check,{size:10,className:"text-primary-foreground"}),Pe&&!re&&e.jsx("span",{className:"w-2 h-0.5 bg-primary-foreground rounded-full"})]}),e.jsx("span",{className:"text-foreground",children:re?"Deselect All":"Select All"}),e.jsxs("span",{className:"ml-auto text-muted-foreground",style:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},children:[Array.isArray(Y)?Y.length:0,"/",he.filter(j=>!j.disabled).length]})]}),e.jsxs("div",{className:"max-h-60 overflow-y-auto p-1",children:[E?e.jsxs("div",{className:"flex items-center justify-center py-6 gap-2 text-muted-foreground",children:[e.jsx(v.Loader2,{size:16,className:"animate-spin"}),e.jsx("span",{style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)"},children:"Searching\\u2026"})]}):he.length===0&&!ke?I?e.jsx("div",{className:"py-4 px-3",children:I}):e.jsxs("div",{className:"text-center py-6 text-muted-foreground flex flex-col items-center gap-2",children:[e.jsx(v.Inbox,{size:24,className:"opacity-40"}),e.jsx("span",{style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)"},children:"No options found"})]}):z&&se?Object.entries(se).map(([j,O])=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-1.5 text-muted-foreground",style:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},children:j}),O.map(X=>{const $e=lo(X,io);return io++,$e})]},j)):he.map((j,O)=>lo(j,O)),ke&&e.jsxs("button",{type:"button",className:`w-full flex items-center gap-[var(--Spacing--Spacing-lg)] ${U.option} text-primary transition-colors hover:bg-[var(--Colors--Background--bg-primary_hover)] cursor-pointer`,style:{...U.optionStyle,...U.textStyle},onClick:Nr,children:[e.jsx(v.Plus,{size:U.icon,className:"flex-shrink-0"}),e.jsx("span",{children:L.replace("{query}",K.trim())})]})]}),(A||m&&S)&&e.jsxs("div",{className:"border-t border-border",children:[m&&S&&e.jsxs("div",{className:"px-3 py-2 text-muted-foreground",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},children:[Array.isArray(Y)?Y.length:0," / ",S," selected"]}),A&&e.jsx("div",{className:"px-3 py-2",children:A})]})]}),document.body),(l||d||i)&&e.jsxs("div",{className:"mt-1.5 flex items-center gap-1",children:[Ge==="error"&&e.jsx(v.AlertCircle,{size:12,className:"text-destructive flex-shrink-0"}),e.jsx("span",{className:`${Ge==="error"?"text-destructive":Ge==="success"?"text-chart-2":"text-muted-foreground"}`,style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},children:d||i||l})]})]})});Rr.displayName="Dropdown";const na={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},et={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};function la({icon:r,title:t,description:o,action:a,secondaryAction:s,size:n="md"}){const l=n==="sm"?"w-10 h-10":n==="lg"?"w-16 h-16":"w-12 h-12",d=n==="sm"?"py-6 px-4":n==="lg"?"py-14 px-8":"py-10 px-6";return e.jsxs("div",{className:`flex flex-col items-center text-center ${d}`,children:[r&&e.jsx("div",{className:`${l} rounded-full bg-muted flex items-center justify-center mb-4`,children:e.jsx("span",{className:"text-muted-foreground",children:r})}),e.jsx("h4",{className:"text-foreground",children:t}),o&&e.jsx("p",{className:"text-muted-foreground mt-1.5 max-w-sm",style:na,children:o}),(a||s)&&e.jsxs("div",{className:"flex items-center gap-3 mt-5",children:[a&&e.jsxs("button",{onClick:a.onClick,className:"inline-flex items-center gap-2 px-4 py-2 rounded-[var(--radius-md)] bg-primary text-primary-foreground hover:bg-primary/90 transition-colors cursor-pointer",style:et,children:[a.icon,a.label]}),s&&e.jsx("button",{onClick:s.onClick,className:"inline-flex items-center gap-2 px-4 py-2 rounded-[var(--radius-md)] border border-border text-foreground hover:bg-accent transition-colors cursor-pointer",style:et,children:s.label})]})]})}const ia={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},je={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},rt={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},da={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};function tt(r){return r<1024?r+" B":r<1024*1024?(r/1024).toFixed(1)+" KB":(r/(1024*1024)).toFixed(1)+" MB"}function ca(r){return r.startsWith("image/")?e.jsx(v.Image,{size:16,className:"text-chart-2"}):r.startsWith("video/")?e.jsx(v.Film,{size:16,className:"text-chart-5"}):r.includes("pdf")||r.includes("document")?e.jsx(v.FileText,{size:16,className:"text-destructive"}):e.jsx(v.File,{size:16,className:"text-muted-foreground"})}function ot({files:r,onRemove:t}){return e.jsx("div",{className:"space-y-2",children:r.map(o=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-[var(--radius-md)] border border-border bg-card",children:[ca(o.type),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-foreground truncate",style:ia,children:o.name}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",style:rt,children:tt(o.size)}),o.status==="uploading"&&e.jsx("div",{className:"flex-1 h-1 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${o.progress}%`}})}),o.status==="done"&&e.jsx(v.CheckCircle2,{size:12,className:"text-chart-2"})]})]}),e.jsx("button",{onClick:()=>t(o.id),className:"text-muted-foreground hover:text-destructive cursor-pointer",children:e.jsx(v.X,{size:14})})]},o.id))})}function fa({accept:r,maxSize:t,multiple:o,disabled:a,variant:s="dropzone",label:n,description:l,value:d,onChange:i,onUpload:f,onRemove:u}){const[x,y]=c.useState([]),[h,p]=c.useState(!1),g=c.useRef(null),m=d??x,S=b=>{if(!b)return;const w=Array.from(b);if(i&&i(w),d===void 0){const N=w.map(F=>({id:Math.random().toString(36).slice(2),name:F.name,size:F.size,type:F.type,progress:0,status:"uploading"}));y(F=>[...F,...N]),N.forEach(F=>{let W=0;const D=setInterval(()=>{W+=Math.random()*30+10,W>=100&&(W=100,clearInterval(D)),y(M=>M.map(L=>L.id===F.id?{...L,progress:Math.min(W,100),status:W>=100?"done":"uploading"}:L)),W>=100&&f&&f({...F,progress:100,status:"done"})},300)})}},z=b=>{u&&u(b),d===void 0&&y(w=>w.filter(N=>N.id!==b))};return s==="button"?e.jsxs("div",{className:"space-y-3",children:[n&&e.jsx("label",{className:"block text-foreground",style:je,children:n}),e.jsxs("button",{onClick:()=>{var b;return(b=g.current)==null?void 0:b.click()},disabled:a,className:`inline-flex items-center gap-2 px-4 py-2 rounded-[var(--radius-md)] border border-border bg-background text-foreground hover:bg-accent transition-colors cursor-pointer ${a?"opacity-50 pointer-events-none":""}`,style:da,children:[e.jsx(v.Upload,{size:14})," Choose File",o?"s":""]}),e.jsx("input",{ref:g,type:"file",className:"hidden",accept:r,multiple:o,onChange:b=>S(b.target.files)}),m.length>0&&e.jsx(ot,{files:m,onRemove:z})]}):s==="avatar"?e.jsxs("div",{className:"space-y-2",children:[n&&e.jsx("label",{className:"block text-foreground",style:je,children:n}),e.jsx("div",{onClick:()=>{var b;return!a&&((b=g.current)==null?void 0:b.click())},className:`w-24 h-24 rounded-full border-2 border-dashed flex items-center justify-center cursor-pointer transition-colors
|
|
82
|
+
${a?"opacity-50 pointer-events-none":""} ${h?"border-primary bg-primary/5":"border-border hover:border-primary/40"}`,children:m.length>0&&m[m.length-1].status==="done"?e.jsx(v.CheckCircle2,{size:24,className:"text-chart-2"}):e.jsx(v.Upload,{size:20,className:"text-muted-foreground"})}),e.jsx("input",{ref:g,type:"file",className:"hidden",accept:r||"image/*",onChange:b=>S(b.target.files)})]}):e.jsxs("div",{className:"space-y-3",children:[n&&e.jsx("label",{className:"block text-foreground",style:je,children:n}),e.jsxs("div",{onDragOver:b=>{b.preventDefault(),p(!0)},onDragLeave:()=>p(!1),onDrop:b=>{b.preventDefault(),p(!1),S(b.dataTransfer.files)},onClick:()=>{var b;return!a&&((b=g.current)==null?void 0:b.click())},className:`relative flex flex-col items-center justify-center gap-2 px-6 py-10 rounded-[var(--radius-md)] border-2 border-dashed transition-all cursor-pointer
|
|
83
|
+
${a?"opacity-50 pointer-events-none":""}
|
|
84
|
+
${h?"border-primary bg-primary/5":"border-border hover:border-primary/40 hover:bg-accent/30"}`,children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(v.Upload,{size:20,className:"text-primary"})}),e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-foreground",style:je,children:[e.jsx("span",{className:"text-primary",children:"Click to upload"})," or drag and drop"]}),e.jsxs("p",{className:"text-muted-foreground",style:rt,children:[l||(r?`Accepted: ${r}`:"Any file type"),t&&` · Max ${tt(t)}`]})]})]}),e.jsx("input",{ref:g,type:"file",className:"hidden",accept:r,multiple:o,onChange:b=>S(b.target.files)}),m.length>0&&e.jsx(ot,{files:m,onRemove:z})]})}const ha={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},ua={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};function ba({images:r,initialIndex:t=0}){const[o,a]=c.useState(!1),[s,n]=c.useState(t),[l,d]=c.useState(1),[i,f]=c.useState(0),u=r[s],x=()=>{n(m=>(m-1+r.length)%r.length),d(1),f(0)},y=()=>{n(m=>(m+1)%r.length),d(1),f(0)},h=()=>d(m=>Math.min(m+.25,3)),p=()=>d(m=>Math.max(m-.25,.5)),g=()=>f(m=>(m+90)%360);return e.jsxs("div",{children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:r.map((m,S)=>e.jsx("button",{onClick:()=>{n(S),a(!0),d(1),f(0)},className:`rounded-[var(--radius-md)] overflow-hidden border-2 transition-all cursor-pointer hover:opacity-80
|
|
85
|
+
${s===S&&o?"border-primary":"border-border"}`,children:e.jsx("div",{className:"w-20 h-20 bg-muted flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:m.thumbnail||m.src,alt:m.alt,className:"w-full h-full object-cover",loading:"lazy"})})},S))}),o&&e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":`Image preview: ${u.alt}`,className:"fixed inset-0 z-[60] bg-foreground/80 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 bg-foreground/20",children:[e.jsxs("span",{className:"text-primary-foreground",style:ha,children:[u.alt," (",s+1,"/",r.length,")"]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:p,"aria-label":"Zoom out",className:"w-8 h-8 flex items-center justify-center rounded-[var(--radius-md)] text-primary-foreground/70 hover:text-primary-foreground hover:bg-primary-foreground/10 cursor-pointer",children:e.jsx(v.ZoomOut,{size:16})}),e.jsxs("span",{className:"text-primary-foreground/70 px-2",style:ua,"aria-live":"polite","aria-label":`Zoom level ${Math.round(l*100)}%`,children:[Math.round(l*100),"%"]}),e.jsx("button",{onClick:h,"aria-label":"Zoom in",className:"w-8 h-8 flex items-center justify-center rounded-[var(--radius-md)] text-primary-foreground/70 hover:text-primary-foreground hover:bg-primary-foreground/10 cursor-pointer",children:e.jsx(v.ZoomIn,{size:16})}),e.jsx("button",{onClick:g,"aria-label":"Rotate clockwise",className:"w-8 h-8 flex items-center justify-center rounded-[var(--radius-md)] text-primary-foreground/70 hover:text-primary-foreground hover:bg-primary-foreground/10 cursor-pointer",children:e.jsx(v.RotateCw,{size:16})}),e.jsx("div",{className:"w-px h-5 bg-primary-foreground/20 mx-1"}),e.jsx("button",{onClick:()=>{a(!1),d(1),f(0)},"aria-label":"Close preview",className:"w-8 h-8 flex items-center justify-center rounded-[var(--radius-md)] text-primary-foreground/70 hover:text-primary-foreground hover:bg-primary-foreground/10 cursor-pointer",children:e.jsx(v.X,{size:16})})]})]}),e.jsxs("div",{className:"flex-1 flex items-center justify-center relative overflow-hidden",onClick:m=>{m.target===m.currentTarget&&(a(!1),d(1),f(0))},children:[r.length>1&&e.jsx("button",{onClick:x,"aria-label":"Previous image",className:"absolute left-4 w-10 h-10 rounded-full bg-foreground/30 text-primary-foreground flex items-center justify-center hover:bg-foreground/50 cursor-pointer z-10",children:e.jsx(v.ChevronLeft,{size:20})}),e.jsx("img",{src:u.src,alt:u.alt,className:"max-w-[90%] max-h-[80vh] object-contain transition-transform",style:{transform:`scale(${l}) rotate(${i}deg)`}}),r.length>1&&e.jsx("button",{onClick:y,"aria-label":"Next image",className:"absolute right-4 w-10 h-10 rounded-full bg-foreground/30 text-primary-foreground flex items-center justify-center hover:bg-foreground/50 cursor-pointer z-10",children:e.jsx(v.ChevronRight,{size:20})})]}),r.length>1&&e.jsx("div",{className:"flex items-center justify-center gap-2 py-3 bg-foreground/20",children:r.map((m,S)=>e.jsx("button",{onClick:()=>{n(S),d(1),f(0)},className:`w-12 h-12 rounded-[var(--radius-sm)] overflow-hidden border-2 cursor-pointer transition-all
|
|
86
|
+
${S===s?"border-primary-foreground":"border-transparent opacity-50 hover:opacity-80"}`,children:e.jsx("img",{src:m.thumbnail||m.src,alt:m.alt,className:"w-full h-full object-cover"})},S))})]})]})}const ga={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},pa={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},va={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};function ma({items:r,parentRect:t}){const o=c.useRef(null),[a,s]=c.useState({top:t.top,left:t.right+4});return c.useEffect(()=>{if(!o.current)return;const l=o.current.getBoundingClientRect();let d=t.top,i=t.right+4;i+l.width>window.innerWidth-8&&(i=t.left-l.width-4),d+l.height>window.innerHeight-8&&(d=window.innerHeight-l.height-8),s({top:d,left:i})},[t]),Le.createPortal(e.jsx("div",{ref:o,className:"fixed z-[9999] min-w-[200px] rounded-[var(--radius)] border border-border bg-popover shadow-elevation-sm py-1",style:{top:a.top,left:a.left},children:r.map((n,l)=>e.jsx(at,{item:n},l))}),document.body)}function at({item:r}){const[t,o]=c.useState(!1),a=c.useRef(null),s=c.useRef(null);if(r.divider)return e.jsx("div",{className:"my-1 border-t border-border"});if(r.label)return e.jsx("div",{className:"px-3 py-1.5 text-muted-foreground",style:va,children:r.label});const n=r.children&&r.children.length>0,l=()=>{s.current&&clearTimeout(s.current),n&&o(!0)},d=()=>{s.current=setTimeout(()=>o(!1),150)};return e.jsxs("div",{ref:a,className:"relative",onMouseEnter:l,onMouseLeave:d,children:[e.jsxs("button",{onClick:()=>{var i;n||(i=r.onClick)==null||i.call(r)},disabled:r.disabled,className:`w-full flex items-center text-left rounded-[var(--radius-sm)] transition-colors cursor-pointer ${r.destructive?"text-destructive hover:bg-destructive/10":r.disabled?"text-muted-foreground opacity-50 cursor-not-allowed":"text-popover-foreground hover:bg-[var(--Colors--Background--bg-primary_hover)]"}`,style:{padding:"var(--Spacing--Spacing-md) var(--Spacing--Spacing-2xl)",gap:"var(--Spacing--Spacing-lg)",...ga},children:[r.icon&&e.jsx("span",{className:"flex-shrink-0",children:r.icon}),e.jsx("span",{className:"flex-1",children:r.text}),r.shortcut&&e.jsx("span",{className:"text-muted-foreground ml-4",style:pa,children:r.shortcut}),n&&e.jsx(v.ChevronRight,{size:14,className:"text-muted-foreground"})]}),n&&t&&a.current&&e.jsx(ma,{items:r.children,parentRect:a.current.getBoundingClientRect()})]})}function st({items:r,open:t,onClose:o,triggerRef:a,className:s=""}){const n=c.useRef(null),[l,d]=c.useState({top:0,left:0});return c.useEffect(()=>{if(!t||!a.current)return;const i=a.current.getBoundingClientRect();let f=i.bottom+4,u=i.left;requestAnimationFrame(()=>{if(!n.current)return;const x=n.current.getBoundingClientRect();u+x.width>window.innerWidth-8&&(u=i.right-x.width),f+x.height>window.innerHeight-8&&(f=i.top-x.height-4),d({top:f,left:u})}),d({top:f,left:u})},[t,a]),c.useEffect(()=>{if(!t)return;const i=f=>{var u,x;(u=a.current)!=null&&u.contains(f.target)||(x=n.current)!=null&&x.contains(f.target)||o()};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[t,o,a]),t?Le.createPortal(e.jsxs("div",{ref:n,className:`fixed z-[9999] min-w-[200px] rounded-[var(--radius)] border border-border bg-popover shadow-elevation-sm py-1 animate-[fadeIn_0.15s_ease] ${s}`,style:{top:l.top,left:l.left},children:[r.map((i,f)=>e.jsx(at,{item:i},f)),e.jsx("style",{children:"@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }"})]}),document.body):null}st.displayName="Menu";const nt={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},Qe={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},xa={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},Ee={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};function lt({type:r="info",title:t,message:o,closable:a=!0,onClose:s,action:n,avatar:l,time:d,read:i}){const f={info:e.jsx(v.Info,{size:16,className:"text-primary"}),success:e.jsx(v.CheckCircle2,{size:16,className:"text-chart-2"}),warning:e.jsx(v.AlertTriangle,{size:16,className:"text-chart-5"}),error:e.jsx(v.XCircle,{size:16,className:"text-destructive"})},u={info:"border-l-primary",success:"border-l-chart-2",warning:"border-l-chart-5",error:"border-l-destructive"};return e.jsxs("div",{className:`flex gap-3 px-4 py-3 rounded-[var(--radius-md)] border border-border bg-card border-l-[3px] ${u[r]} ${i===!1?"bg-primary/5":""}`,children:[l?e.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex-shrink-0 flex items-center justify-center overflow-hidden",style:Qe,children:e.jsx("span",{className:"text-primary",children:l.slice(0,2).toUpperCase()})}):e.jsx("span",{className:"flex-shrink-0 mt-0.5",children:f[r]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("span",{className:"text-foreground",style:Qe,children:t}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[d&&e.jsx("span",{className:"text-muted-foreground",style:xa,children:d}),i===!1&&e.jsx("span",{className:"w-2 h-2 rounded-full bg-primary"}),a&&s&&e.jsx("button",{onClick:s,className:"text-muted-foreground hover:text-foreground cursor-pointer",children:e.jsx(v.X,{size:14})})]})]}),o&&e.jsx("p",{className:"text-muted-foreground mt-0.5",style:nt,children:o}),n&&e.jsxs("button",{onClick:n.onClick,className:"inline-flex items-center gap-1 text-primary mt-2 hover:underline cursor-pointer",style:Ee,children:[n.label," ",e.jsx(v.ExternalLink,{size:12})]})]})]})}function ya({items:r,onMarkRead:t,onMarkAllRead:o,onDismiss:a,onClearAll:s}){const[n,l]=c.useState(r),d=t!==void 0||o!==void 0,i=d?r:n,f=i.filter(h=>!h.read).length,u=()=>{o&&o(),d||l(h=>h.map(p=>({...p,read:!0})))},x=h=>{a&&a(h),d||l(p=>p.filter(g=>g.id!==h))},y=h=>{t&&t(h),d||l(p=>p.map(g=>g.id===h?{...g,read:!0}:g))};return e.jsxs("div",{className:"max-w-md rounded-[var(--radius-md)] border border-border bg-card overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(v.Bell,{size:16,className:"text-foreground"}),e.jsx("span",{className:"text-foreground",style:Qe,children:"Notifications"}),f>0&&e.jsx("span",{className:"px-1.5 py-0.5 rounded-full bg-primary text-primary-foreground",style:Ee,children:f})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[f>0&&e.jsx("button",{onClick:u,className:"text-primary cursor-pointer",style:Ee,children:"Mark all read"}),i.length>0&&s&&e.jsx("button",{onClick:s,className:"text-muted-foreground hover:text-destructive cursor-pointer",style:Ee,children:"Clear all"})]})]}),e.jsx("div",{className:"divide-y divide-border max-h-[360px] overflow-y-auto",children:i.map(h=>e.jsx("div",{className:`px-3 py-2 ${h.read?"":"bg-primary/5"}`,onClick:()=>!h.read&&y(h.id),children:e.jsx(lt,{type:h.type,title:h.title,message:h.message,time:h.time,read:h.read,closable:!!a,onClose:()=>x(h.id)})},h.id))}),i.length===0&&e.jsxs("div",{className:"py-10 text-center text-muted-foreground",children:[e.jsx(v.BellOff,{size:24,className:"mx-auto mb-2 opacity-40"}),e.jsx("span",{style:nt,children:"No notifications"})]})]})}const wa={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"};function Na({trigger:r,children:t,placement:o="bottom",title:a,open:s,onOpenChange:n}){const[l,d]=c.useState(!1),i=s!==void 0?s:l,f=y=>{n==null||n(y),s===void 0&&d(y)},u=c.useRef(null);c.useEffect(()=>{if(!i)return;const y=h=>{u.current&&!u.current.contains(h.target)&&f(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]);const x={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"};return e.jsxs("div",{className:"relative inline-block",ref:u,children:[e.jsx("div",{onClick:()=>f(!i),className:"cursor-pointer",children:r}),i&&e.jsx("div",{className:`absolute z-50 ${x[o]} w-max max-w-xs`,children:e.jsxs("div",{className:"rounded-[var(--radius-md)] border border-border bg-card shadow-elevation-sm overflow-hidden",children:[a&&e.jsxs("div",{className:"px-4 py-2.5 border-b border-border flex items-center justify-between",children:[e.jsx("span",{className:"text-foreground",style:wa,children:a}),e.jsx("button",{onClick:()=>f(!1),className:"text-muted-foreground hover:text-foreground cursor-pointer",children:e.jsx(v.X,{size:14})})]}),e.jsx("div",{className:"px-4 py-3",children:t})]})})]})}const Sa={fontFamily:"var(--font-label)",fontSize:"var(--text-label)"},ka={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"};function it({value:r,max:t=100,size:o="md",color:a,label:s,showValue:n,indeterminate:l,className:d=""}){const i={sm:"h-1.5",md:"h-2.5",lg:"h-4"},f=l?0:Math.min(100,Math.max(0,(r??0)/t*100));return e.jsxs("div",{className:`w-full ${d}`,children:[(s||n)&&e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s&&e.jsx("span",{className:"text-foreground",style:Sa,children:s}),n&&!l&&e.jsxs("span",{className:"text-muted-foreground",style:ka,children:[Math.round(f),"%"]})]}),e.jsx("div",{className:`w-full ${i[o]} rounded-full bg-muted overflow-hidden`,children:l?e.jsx("div",{className:"h-full w-1/3 rounded-full animate-[indeterminate_1.5s_infinite_ease-in-out]",style:{backgroundColor:a??"var(--primary)"}}):e.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${f}%`,backgroundColor:a??"var(--primary)"}})}),e.jsx("style",{children:"@keyframes indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }"})]})}it.displayName="ProgressBar";const $a={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},za={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"};function Ca({value:r=0,onChange:t,max:o=5,size:a="md",disabled:s,readOnly:n,icon:l="star",showValue:d,label:i}){const[f,u]=c.useState(0),x=a==="sm"?16:a==="lg"?28:20,y=a==="sm"?"gap-0.5":a==="lg"?"gap-1.5":"gap-1",h=l==="heart"?v.Heart:l==="thumb"?v.ThumbsUp:v.Star,p=l==="heart"?"text-destructive":"text-chart-5",g=Array.from({length:o},(m,S)=>S+1);return e.jsxs("div",{className:`inline-flex items-center ${y} ${s?"opacity-50 pointer-events-none":""}`,children:[i&&e.jsx("span",{className:"text-foreground mr-2",style:$a,children:i}),g.map(m=>{const S=m<=(f||r);return e.jsx("button",{type:"button",className:`transition-transform ${n||s?"":"cursor-pointer hover:scale-110"} ${S?p:"text-muted-foreground/40"}`,onMouseEnter:()=>!n&&!s&&u(m),onMouseLeave:()=>u(0),onClick:()=>!n&&!s&&(t==null?void 0:t(m===r?0:m)),disabled:s||n,children:e.jsx(h,{size:x,fill:S?"currentColor":"none"})},m)}),d&&e.jsxs("span",{className:"text-foreground ml-1",style:za,children:[r,"/",o]})]})}const Fa={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"};function Ve({children:r,content:t,placement:o="top",className:a=""}){const[s,n]=c.useState(!1),[l,d]=c.useState({top:0,left:0}),i=c.useRef(null),f=()=>{if(!i.current)return;const p=i.current.getBoundingClientRect(),g=8;let m=0,S=0;o==="right"?(m=p.top+p.height/2,S=p.right+g):o==="left"?(m=p.top+p.height/2,S=p.left-g):o==="bottom"?(m=p.bottom+g,S=p.left+p.width/2):(m=p.top-g,S=p.left+p.width/2),d({top:m,left:S})},u=()=>{f(),n(!0)},x=()=>n(!1);c.useEffect(()=>{if(!s)return;const p=()=>f();return window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[s]);const y=o==="right"?{transform:"translateY(-50%)"}:o==="left"?{transform:"translate(-100%, -50%)"}:o==="bottom"?{transform:"translateX(-50%)"}:{transform:"translate(-50%, -100%)"},h=s?e.jsx("div",{style:{position:"fixed",top:l.top,left:l.left,zIndex:9999,pointerEvents:"none",...y},children:e.jsx("div",{className:"px-2.5 py-1.5 rounded-[var(--radius-sm)] bg-foreground text-background whitespace-nowrap shadow-elevation-sm",style:Fa,role:"tooltip",children:t})}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:i,className:`relative inline-flex ${a}`,onMouseEnter:u,onMouseLeave:x,onFocus:u,onBlur:x,children:r}),typeof document<"u"&&Le.createPortal(h,document.body)]})}Ve.displayName="Tooltip";const dt={fontFamily:"var(--font-p)",fontSize:"var(--text-p)",fontWeight:"var(--weight-button)",lineHeight:"1"},Ma={fontFamily:"var(--font-p)",fontSize:"var(--text-p)",fontWeight:"var(--weight-p)",lineHeight:"1"},Wa={fontFamily:"var(--font-p)",fontSize:"var(--text-p)",fontWeight:"var(--weight-p)",lineHeight:"1"};function Re({item:r,size:t=40}){const o=t+"px",a=t>=40?"var(--text-label)":"var(--text-caption)";if(r.avatarUrl)return e.jsx("img",{src:r.avatarUrl,alt:r.name,style:{width:o,height:o,borderRadius:"50%",objectFit:"cover",flexShrink:0}});const s=r.avatarFallback||r.name.charAt(0).toUpperCase();return e.jsx("div",{style:{width:o,height:o,borderRadius:"50%",flexShrink:0,background:"var(--Base_Color--Sky--100, #e0f2fe)",display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"var(--font-label)",fontSize:a,fontWeight:"var(--weight-button)",color:"var(--Base_Color--Sky--600, #1b8bf5)"},children:s})}function er({company:r,branch:t,provider:o,companies:a=[],branches:s=[],providers:n=[],onCompanyChange:l,onBranchChange:d,onProviderChange:i,collapsed:f=!1}){const[u,x]=c.useState(!1),y=c.useRef(null);c.useEffect(()=>{if(!u)return;const m=S=>{y.current&&!y.current.contains(S.target)&&x(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[u]);const h=r,p=(t==null?void 0:t.name)??(o==null?void 0:o.name),g=m=>{l==null||l(m),x(!1)};return f?e.jsx("button",{onClick:()=>x(!u),title:(h==null?void 0:h.name)??"Switch account",style:{width:40,height:40,borderRadius:"50%",border:"none",background:"rgba(240,249,255,1)",cursor:"pointer",padding:0,display:"flex",alignItems:"center",justifyContent:"center"},children:h?e.jsx(Re,{item:h,size:36}):e.jsx("div",{style:{width:36,height:36,borderRadius:"50%",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontFamily:"var(--font-label)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-button)"},children:"S"})}):e.jsxs("div",{ref:y,style:{position:"relative",width:"100%"},children:[e.jsxs("button",{onClick:()=>x(!u),style:{width:"100%",background:"rgba(240,249,255,1)",border:"1px solid rgba(217,242,255,1)",borderRadius:"8px",padding:"8px 16px 8px 8px",display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",textAlign:"left",minHeight:"56px"},children:[h?e.jsx(Re,{item:h,size:40}):e.jsx("div",{style:{width:40,height:40,borderRadius:"50%",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)",flexShrink:0},children:"S"}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:"4px"},children:[e.jsx("span",{style:{...dt,color:"var(--foreground, #1f2937)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:(h==null?void 0:h.name)??"Select Company"}),p&&e.jsx("span",{style:{...Ma,color:"var(--Base_Color--Sky--500, #32a9ff)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:p})]}),e.jsx(v.ChevronUp,{size:16,color:"rgba(50,169,255,1)",style:{flexShrink:0,transition:"transform 0.2s ease",transform:u?"rotate(0deg)":"rotate(180deg)"}})]}),u&&e.jsx("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:50,background:"var(--background, #fff)",border:"1px solid var(--border, #e5e7eb)",borderRadius:"8px",boxShadow:"0px 4px 12px 0px rgba(0,0,0,0.08)",overflow:"hidden"},children:e.jsx("div",{style:{maxHeight:"240px",overflowY:"auto"},children:a.map(m=>{const S=(r==null?void 0:r.id)===m.id;return e.jsxs("button",{onClick:()=>g(m),style:{width:"100%",display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",background:S?"rgba(240,249,255,0.6)":"none",border:"none",cursor:"pointer",textAlign:"left",transition:"background 0.15s",minHeight:"48px"},onMouseEnter:z=>{S||(z.currentTarget.style.background="var(--accent, #f3f4f6)")},onMouseLeave:z=>{z.currentTarget.style.background=S?"rgba(240,249,255,0.6)":"none"},children:[e.jsx(Re,{item:m,size:36}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{...dt,color:"var(--foreground, #1f2937)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m.name}),m.handle&&e.jsx("div",{style:{...Wa,color:"var(--muted-foreground, #6b7280)",marginTop:"2px"},children:m.handle})]}),S&&e.jsx(v.Check,{size:16,color:"var(--Base_Color--Sky--500, #32a9ff)",style:{flexShrink:0}})]},m.id)})})})]})}er.displayName="SidebarAccountSwitcher";const La={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},Da={fontFamily:"var(--font-p)",fontSize:"var(--text-p)"},Aa={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},ja={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},Ea={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"};function Te({brand:r,accountSwitcher:t,groups:o,activeItem:a,onNavigate:s,collapsed:n=!1,onCollapsedChange:l,showCollapseToggle:d=!0,version:i,versionDate:f,className:u=""}){const[x,y]=c.useState(new Set),h=p=>{y(g=>{const m=new Set(g);return m.has(p)?m.delete(p):m.add(p),m})};return e.jsxs("div",{className:`bg-sidebar border-r border-sidebar-border flex flex-col flex-shrink-0 ${u}`,style:{width:n?"64px":"256px",minWidth:n?"64px":"256px",transition:"width 0.25s cubic-bezier(0.4,0,0.2,1), min-width 0.25s cubic-bezier(0.4,0,0.2,1)",overflow:"visible"},children:[t?e.jsx("div",{className:`${n?"px-2 py-2":"px-3 py-3"} border-b border-sidebar-border flex items-center ${n?"justify-center":""}`,children:e.jsx(er,{...t,collapsed:n})}):r&&e.jsxs("div",{className:`${n?"px-2":"px-4"} py-4 border-b border-sidebar-border flex items-center ${n?"justify-center":"gap-2"}`,children:[r.logo?e.jsx("img",{src:r.logo,alt:r.name,className:"w-8 h-8 rounded-[var(--radius-sm)] flex-shrink-0 object-cover"}):e.jsx("div",{className:"w-8 h-8 rounded-[var(--radius-sm)] bg-primary flex items-center justify-center text-primary-foreground flex-shrink-0",style:Aa,children:r.name.charAt(0).toUpperCase()}),!n&&e.jsx("span",{className:"text-sidebar-foreground truncate",style:La,children:r.name})]}),e.jsx("nav",{className:`flex-1 overflow-y-auto py-3 ${n?"px-1.5":"px-2"}`,children:o.map(p=>{const g=x.has(p.label);return e.jsxs("div",{className:"mb-4",children:[!n&&e.jsxs("button",{onClick:()=>h(p.label),className:"w-full flex items-center justify-between px-2 mb-1.5 text-muted-foreground hover:text-foreground transition-colors cursor-pointer",style:ja,children:[e.jsx("span",{children:p.label}),e.jsx(v.ChevronUp,{size:12,style:{transition:"transform 0.2s ease",transform:g?"rotate(180deg)":"rotate(0deg)"}})]}),n&&e.jsx("div",{className:"h-px bg-sidebar-border mx-1 mb-2 mt-1"}),!g&&e.jsx("div",{className:"space-y-0.5",children:p.items.map(m=>{const S=a===m.id,z=e.jsxs("button",{onClick:()=>s==null?void 0:s(m),className:`w-full flex items-center ${n?"justify-center":"gap-2"} ${n?"px-0":"px-2"} py-2 rounded-[var(--radius-md)] transition-colors cursor-pointer ${S?"bg-sidebar-accent text-sidebar-accent-foreground":"text-sidebar-foreground hover:bg-sidebar-accent/50"}`,style:Da,children:[e.jsx("span",{className:`flex-shrink-0 ${S?"text-sidebar-primary":"text-muted-foreground"}`,children:m.icon}),!n&&e.jsx("span",{className:"truncate flex-1 text-left",children:m.label}),m.badge!=null&&!n&&e.jsx("span",{className:"rounded-full bg-primary text-primary-foreground",style:{fontFamily:"var(--font-caption)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-button)",lineHeight:"1",padding:"2px 6px",display:"inline-flex",alignItems:"center",minWidth:"18px",justifyContent:"center"},children:String(m.badge)})]},m.id);return n?e.jsx("div",{className:"w-full flex",children:e.jsx(Ve,{content:m.label,placement:"right",className:"flex-1",children:z})},m.id):z})})]},p.label)})}),(d&&l||i)&&e.jsxs("div",{className:`${n?"px-1.5":"px-3"} py-3 border-t border-sidebar-border flex flex-col gap-1`,children:[d&&l&&e.jsxs("button",{onClick:()=>l(!n),className:`w-full flex items-center ${n?"justify-center":"gap-2 px-2"} py-1.5 rounded-[var(--radius-md)] text-muted-foreground hover:text-foreground hover:bg-sidebar-accent/50 cursor-pointer`,style:Ea,title:n?"Expand sidebar":"Collapse sidebar",children:[n?e.jsx(v.PanelLeftOpen,{size:16}):e.jsx(v.PanelLeftClose,{size:16}),!n&&e.jsx("span",{children:"Collapse"})]}),i&&!n&&e.jsxs("div",{className:"px-2 flex items-center gap-1.5 text-muted-foreground/60",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-label)"},children:[e.jsx("span",{children:i}),f&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:f})]})]}),i&&n&&e.jsx("div",{className:"flex justify-center text-muted-foreground/60",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-label)"},title:`${i}${f?` · ${f}`:""}`,children:i})]})]})}Te.displayName="Sidebar";function ae({width:r,height:t,variant:o="rectangular",animate:a=!0,className:s}){const n="bg-muted",l=a?"animate-pulse":"",d=o==="circular"?"rounded-full":o==="rounded"?"rounded-[var(--radius-md)]":"rounded-[var(--radius-sm)]";return e.jsx("div",{className:`${n} ${l} ${d} ${s??""}`,style:{width:r??"100%",height:t??(o==="text"?"1em":o==="circular"?40:20)}})}function Ta(){return e.jsxs("div",{className:"rounded-[var(--radius-md)] border border-border bg-card p-4 space-y-4 w-full max-w-sm",children:[e.jsx(ae,{variant:"rounded",height:160}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ae,{variant:"text",width:"60%",height:20}),e.jsx(ae,{variant:"text",width:"100%",height:14}),e.jsx(ae,{variant:"text",width:"80%",height:14})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ae,{variant:"circular",width:36,height:36}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(ae,{variant:"text",width:"40%",height:14}),e.jsx(ae,{variant:"text",width:"25%",height:12})]})]})]})}function Ia(){return e.jsxs("div",{className:"rounded-[var(--radius-md)] border border-border bg-card overflow-hidden",children:[e.jsx("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex gap-4",children:[120,160,100,80].map((r,t)=>e.jsx(ae,{variant:"text",width:r,height:14},t))}),[0,1,2,3].map(r=>e.jsxs("div",{className:"px-4 py-3 border-b border-border flex items-center gap-4",children:[e.jsx(ae,{variant:"circular",width:28,height:28}),e.jsx(ae,{variant:"text",width:100+r*15,height:14}),e.jsx(ae,{variant:"text",width:140,height:14,className:"flex-1"}),e.jsx(ae,{variant:"rounded",width:60,height:22}),e.jsx(ae,{variant:"text",width:80,height:14})]},r))]})}function rr({rows:r=3}){return e.jsx("div",{className:"space-y-3 w-full max-w-md",children:Array.from({length:r}).map((t,o)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-[var(--radius-md)] border border-border bg-card",children:[e.jsx(ae,{variant:"circular",width:40,height:40}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(ae,{variant:"text",width:`${60+o*10}%`,height:14}),e.jsx(ae,{variant:"text",width:`${40+o*5}%`,height:12})]}),e.jsx(ae,{variant:"rounded",width:50,height:24})]},o))})}const Ba={sm:"w-4 h-4 border-2",md:"w-8 h-8 border-[3px]",lg:"w-12 h-12 border-4",xl:"w-16 h-16 border-4"};function ct({size:r="md",color:t,className:o=""}){return e.jsx("div",{className:`${Ba[r]} rounded-full border-muted animate-spin ${o}`,style:{borderTopColor:t??"var(--primary)"},role:"status","aria-label":"Loading"})}ct.displayName="Spinner";const tr={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},ft={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},ht={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},ut={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},_a={sm:{fontFamily:"var(--font-h4)",fontSize:"var(--text-h4)",fontWeight:"var(--weight-h4)"},md:{fontFamily:"var(--font-h2)",fontSize:"var(--text-h2)",fontWeight:"var(--weight-h2)"},lg:{fontFamily:"var(--font-h1)",fontSize:"var(--text-h1)",fontWeight:"var(--weight-h1)"}};function Ha({title:r,value:t,prefix:o,suffix:a,trend:s,trendLabel:n,icon:l,size:d="md",loading:i}){const f=_a[d],u=(s==null?void 0:s.direction)==="up"?"text-chart-2":(s==null?void 0:s.direction)==="down"?"text-destructive":"text-muted-foreground",x=(s==null?void 0:s.direction)==="up"?v.ArrowUpRight:(s==null?void 0:s.direction)==="down"?v.ArrowDownRight:v.Minus;return i?e.jsxs("div",{className:"space-y-2 animate-pulse",children:[e.jsx("div",{className:"h-3 w-20 bg-muted rounded-[var(--radius-sm)]"}),e.jsx("div",{className:"h-8 w-32 bg-muted rounded-[var(--radius-sm)]"}),e.jsx("div",{className:"h-3 w-24 bg-muted rounded-[var(--radius-sm)]"})]}):e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[l&&e.jsx("span",{className:"text-muted-foreground",children:l}),e.jsx("span",{className:"text-muted-foreground",style:tr,children:r})]}),e.jsxs("div",{className:"flex items-baseline gap-1",children:[o&&e.jsx("span",{className:"text-muted-foreground",style:ft,children:o}),e.jsx("span",{className:"text-foreground",style:f,children:typeof t=="number"?t.toLocaleString():t}),a&&e.jsx("span",{className:"text-muted-foreground",style:tr,children:a})]}),s&&e.jsxs("div",{className:`flex items-center gap-1 ${u}`,children:[e.jsx(x,{size:14}),e.jsxs("span",{style:ut,children:[s.value,"%"]}),n&&e.jsx("span",{className:"text-muted-foreground",style:ht,children:n})]})]})}function Pa({title:r,value:t,prefix:o,trend:a,trendLabel:s,icon:n,iconBg:l}){const d=(a==null?void 0:a.direction)==="up"?"text-chart-2":(a==null?void 0:a.direction)==="down"?"text-destructive":"text-muted-foreground",i=(a==null?void 0:a.direction)==="up"?v.ArrowUpRight:(a==null?void 0:a.direction)==="down"?v.ArrowDownRight:v.Minus;return e.jsx("div",{className:"rounded-[var(--radius-md)] border border-border bg-card p-5 overflow-hidden",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1 min-w-0 flex-1",children:[e.jsx("span",{className:"text-muted-foreground",style:tr,children:r}),e.jsxs("div",{className:"flex items-baseline gap-1",children:[o&&e.jsx("span",{className:"text-muted-foreground",style:ft,children:o}),e.jsx("span",{className:"text-foreground",style:{fontFamily:"var(--font-h3)",fontSize:"var(--text-h3)",fontWeight:"var(--weight-h3)"},children:typeof t=="number"?t.toLocaleString():t})]}),a&&e.jsxs("div",{className:`flex items-center gap-1 ${d}`,children:[e.jsx(i,{size:12}),e.jsxs("span",{style:ut,children:[a.value,"%"]}),s&&e.jsx("span",{className:"text-muted-foreground",style:ht,children:s})]})]}),n&&e.jsx("div",{className:`w-10 h-10 rounded-[var(--radius-md)] flex items-center justify-center flex-shrink-0 ${l||"bg-primary/10 text-primary"}`,children:n})]})})}const Oa={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},bt={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},gt={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},pt={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};function vt({steps:r,current:t,orientation:o="horizontal",onStepClick:a,className:s=""}){return o==="vertical"?e.jsx("div",{className:`flex flex-col ${s}`,children:r.map((n,l)=>{const d=l<t,i=l===t,f=n.disabled;return e.jsxs("div",{className:`flex gap-3 ${f?"opacity-50":""}`,onClick:()=>!f&&(a==null?void 0:a(l)),children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 transition-colors ${f?"cursor-not-allowed":a?"cursor-pointer":""} ${d||i?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,style:pt,children:d?e.jsx(v.Check,{size:14}):l+1}),l<r.length-1&&e.jsx("div",{className:`w-px flex-1 min-h-[24px] my-1 ${d?"bg-primary":"bg-border"}`})]}),e.jsxs("div",{className:`pb-6 ${l===r.length-1?"pb-0":""}`,children:[e.jsx("span",{className:`block ${i?"text-foreground":"text-muted-foreground"}`,style:i?bt:Oa,children:n.title}),n.description&&e.jsx("span",{className:"text-muted-foreground block",style:gt,children:n.description})]})]},l)})}):e.jsx("div",{className:`flex items-center ${s}`,children:r.map((n,l)=>{const d=l<t,i=l===t;return e.jsxs("div",{className:`flex items-center ${l<r.length-1?"flex-1":""} ${n.disabled?"opacity-50":""}`,children:[e.jsxs("div",{className:"flex flex-col items-center gap-1",onClick:()=>!n.disabled&&(a==null?void 0:a(l)),children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 transition-colors ${n.disabled?"cursor-not-allowed":a?"cursor-pointer":""} ${d||i?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,style:pt,children:d?e.jsx(v.Check,{size:14}):l+1}),e.jsx("span",{className:`text-center ${i?"text-foreground":"text-muted-foreground"}`,style:i?bt:gt,children:n.title})]}),l<r.length-1&&e.jsx("div",{className:`flex-1 h-px mx-2 mt-[-20px] ${d?"bg-primary":"bg-border"}`})]},l)})})}vt.displayName="Stepper";const Ya={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},Ga={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},Ua={sm:{track:"w-7 h-4",thumb:"w-3 h-3",on:"translate-x-3"},md:{track:"w-10 h-6",thumb:"w-4.5 h-4.5",on:"translate-x-4.5"},lg:{track:"w-14 h-8",thumb:"w-6.5 h-6.5",on:"translate-x-6"}},Xa={primary:"bg-primary",success:"bg-chart-2",warning:"bg-chart-5",destructive:"bg-destructive"},Ka={sm:{w:12,h:12,on:14},md:{w:18,h:18,on:18},lg:{w:26,h:26,on:24}};function Za({checked:r,onChange:t,label:o,description:a,size:s="md",disabled:n,color:l="primary"}){const d=Ua[s],i=Ka[s];return e.jsxs("label",{className:`inline-flex items-start gap-3 ${n?"opacity-50 pointer-events-none":"cursor-pointer"}`,children:[e.jsx("button",{role:"switch","aria-checked":r,onClick:()=>t(!r),disabled:n,className:`${d.track} rounded-full relative flex-shrink-0 transition-colors cursor-pointer ${r?Xa[l]:"bg-muted"}`,children:e.jsx("span",{className:"rounded-full bg-background shadow-elevation-sm absolute transition-transform",style:{width:i.w,height:i.h,top:"50%",transform:`translateY(-50%) translateX(${r?i.on:2}px)`,left:0}})}),(o||a)&&e.jsxs("div",{children:[o&&e.jsx("span",{className:"text-foreground block",style:Ya,children:o}),a&&e.jsx("span",{className:"text-muted-foreground block",style:Ga,children:a})]})]})}const qa={default:"bg-muted/50 text-foreground border-border",primary:"bg-primary/10 text-primary border-primary/20",success:"bg-chart-2/10 text-chart-2 border-chart-2/20",warning:"bg-chart-5/10 text-chart-5 border-chart-5/20",destructive:"bg-destructive/10 text-destructive border-destructive/20",info:"bg-accent text-accent-foreground border-primary/20"},Ja={sm:"px-1.5 py-0.5",md:"px-2 py-0.5",lg:"px-3 py-1.5"},Qa={sm:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},md:{fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},lg:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"}};function mt({children:r,color:t="default",size:o="md",icon:a,closable:s,onClose:n,className:l=""}){const d=qa[t],i=Ja[o],f=Qa[o];return e.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full border ${d} ${i} ${l}`,style:f,children:[a&&e.jsx("span",{className:"flex-shrink-0",children:a}),r,s&&e.jsx("button",{className:"hover:opacity-70 cursor-pointer",onClick:n,children:e.jsx(v.X,{size:o==="sm"?10:12})})]})}mt.displayName="Tag";const Va={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},Ra={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},es={default:"bg-card border-border",outline:"bg-transparent border-border",filled:"bg-muted/30 border-transparent"};function xt({tags:r,onChange:t,placeholder:o,disabled:a,maxTags:s,variant:n="default",className:l=""}){const[d,i]=c.useState(""),f=()=>{const x=d.trim();!x||r.includes(x)||s&&r.length>=s||(t([...r,x]),i(""))},u=x=>{t(r.filter(y=>y!==x))};return e.jsxs("div",{className:`flex flex-wrap items-center gap-1.5 px-3 py-2 rounded-[var(--radius)] border ${es[n]} transition-colors focus-within:border-primary ${a?"opacity-50 pointer-events-none":""} ${l}`,children:[r.map(x=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-[var(--radius-sm)] bg-primary/10 text-primary",style:Ra,children:[x,e.jsx("button",{className:"hover:text-destructive cursor-pointer",onClick:()=>u(x),children:e.jsx(v.X,{size:12})})]},x)),e.jsx("input",{value:d,onChange:x=>i(x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),f()),x.key==="Backspace"&&!d&&r.length&&t(r.slice(0,-1))},placeholder:r.length?"":o,className:"flex-1 min-w-[80px] bg-transparent outline-none text-foreground placeholder:text-muted-foreground",style:Va,disabled:a})]})}xt.displayName="TagInput";const rs={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},yt={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},or={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"};function ts({items:r,variant:t="default",size:o="md"}){const a=o==="sm"?"w-6 h-6":o==="lg"?"w-10 h-10":"w-8 h-8",s=o==="sm"?12:o==="lg"?18:14,n=l=>l==="completed"?"bg-chart-2 text-primary-foreground":l==="current"?"bg-primary text-primary-foreground":l==="error"?"bg-destructive text-primary-foreground":"bg-muted text-muted-foreground";return t==="compact"?e.jsx("div",{className:"space-y-0",children:r.map((l,d)=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:`${a} rounded-full flex items-center justify-center flex-shrink-0 ${n(l.status)}`,children:l.icon||(l.status==="completed"?e.jsx(v.CheckCircle2,{size:s}):e.jsx(v.Circle,{size:s}))}),d<r.length-1&&e.jsx("div",{className:"w-0.5 flex-1 min-h-4 bg-border"})]}),e.jsxs("div",{className:"pb-4 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-foreground",style:yt,children:l.title}),l.time&&e.jsx("span",{className:"text-muted-foreground",style:or,children:l.time})]}),l.description&&e.jsx("p",{className:"text-muted-foreground mt-0.5",style:or,children:l.description})]})]},d))}):e.jsx("div",{className:"relative",children:r.map((l,d)=>{const i=t==="alternate"&&d%2===1;return e.jsxs("div",{className:`flex gap-4 pb-8 last:pb-0 ${i?"flex-row-reverse":""}`,children:[e.jsxs("div",{className:"flex flex-col items-center flex-shrink-0",children:[e.jsx("div",{className:`${a} rounded-full flex items-center justify-center ${n(l.status)}`,children:l.icon||(l.status==="completed"?e.jsx(v.CheckCircle2,{size:s}):e.jsx(v.Circle,{size:s}))}),d<r.length-1&&e.jsx("div",{className:"w-0.5 flex-1 bg-border mt-1"})]}),e.jsxs("div",{className:`flex-1 min-w-0 ${i?"text-right":""}`,children:[e.jsxs("div",{className:`flex items-center gap-2 ${i?"justify-end":""}`,children:[e.jsx("span",{className:"text-foreground",style:yt,children:l.title}),l.time&&e.jsx("span",{className:"text-muted-foreground",style:or,children:l.time})]}),l.description&&e.jsx("p",{className:"text-muted-foreground mt-0.5",style:rs,children:l.description}),l.children&&e.jsx("div",{className:"mt-2",children:l.children})]})]},d)})})}const Fe={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"};function ar({brand:r,breadcrumbs:t,title:o,actions:a,user:s,height:n="72px",showSearch:l=!1,searchPlaceholder:d="Search... (Ctrl+K)",onSearchClick:i,notificationCount:f,onNotificationClick:u,onMobileMenuClick:x,onSidebarToggle:y,onUserClick:h,onBreadcrumbClick:p,workspaceSwitcher:g,className:m=""}){const S=s!=null&&s.name?s.name.split(" ").map(z=>z[0]).join("").slice(0,2).toUpperCase():"";return e.jsxs("div",{className:`bg-card border-b border-border flex items-center px-5 gap-4 ${m}`,style:{height:n},children:[y&&e.jsx("button",{className:"w-9 h-9 flex items-center justify-center rounded-[var(--radius-md)] text-foreground hover:bg-muted/30 transition-colors cursor-pointer",onClick:y,title:"Toggle sidebar",children:e.jsx(v.Menu,{size:18})}),!y&&x&&e.jsx("button",{className:"lg:hidden w-8 h-8 flex items-center justify-center rounded-[var(--radius-md)] text-foreground hover:bg-muted/30 transition-colors cursor-pointer",onClick:x,children:e.jsx(v.Menu,{size:16})}),r&&e.jsx(e.Fragment,{children:typeof r.logo=="string"?e.jsx("img",{src:r.logo,alt:r.name,className:"w-8 h-8 rounded-[var(--radius-sm)] flex-shrink-0 object-cover"}):r.logo?e.jsx("div",{className:"w-8 h-8 rounded-[var(--radius-sm)] overflow-hidden flex-shrink-0",children:r.logo}):e.jsx("div",{className:"w-8 h-8 rounded-[var(--radius-sm)] bg-primary flex items-center justify-center text-primary-foreground flex-shrink-0",style:Fe,children:r.name.charAt(0).toUpperCase()})}),g&&e.jsx("div",{className:"flex items-center ml-1",children:g}),o&&e.jsx("span",{className:"text-foreground hidden sm:block truncate",style:Fe,children:o}),t&&t.length>0&&e.jsx("nav",{className:"hidden sm:flex items-center gap-1.5 text-muted-foreground",style:Fe,children:t.map((z,b)=>e.jsxs(c.Fragment,{children:[b>0&&e.jsx(v.ChevronRight,{size:12}),z.href||p?e.jsx("span",{className:`cursor-pointer ${b===t.length-1?"text-foreground":"hover:text-foreground"}`,onClick:()=>p==null?void 0:p(z,b),children:z.label}):e.jsx("span",{className:b===t.length-1?"text-foreground":"",children:z.label})]},b))}),e.jsx("div",{className:"flex-1"}),l&&e.jsxs("div",{className:"hidden md:flex items-center gap-2 px-3 h-8 rounded-[var(--radius)] border border-border bg-muted/20 text-muted-foreground w-56 cursor-pointer hover:border-primary/40 transition-colors",onClick:i,children:[e.jsx(v.Search,{size:14}),e.jsx("span",{style:Fe,children:d})]}),a,u&&e.jsxs("button",{className:"relative w-8 h-8 flex items-center justify-center rounded-[var(--radius-md)] text-muted-foreground hover:text-foreground hover:bg-muted/30 transition-colors cursor-pointer",onClick:u,children:[e.jsx(v.Bell,{size:16}),f!==void 0&&f>0&&e.jsx("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-destructive"})]}),s&&e.jsx("div",{className:"cursor-pointer",onClick:h,children:s.avatar?e.jsx("img",{src:s.avatar,alt:s.name,className:"w-8 h-8 rounded-full object-cover"}):e.jsx("div",{className:"w-8 h-8 rounded-full bg-primary text-primary-foreground flex items-center justify-center",style:Fe,children:S})})]})}ar.displayName="TopNavbar";const os={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},wt={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},sr={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"};function Nt({title:r,items:t,selected:o,onToggle:a,search:s,onSearch:n,searchable:l}){return e.jsxs("div",{className:"flex-1 min-w-[180px] rounded-[var(--radius-md)] border border-border bg-card overflow-hidden",children:[e.jsxs("div",{className:"px-3 py-2.5 border-b border-border bg-muted/30 flex items-center justify-between",children:[e.jsx("span",{className:"text-foreground",style:wt,children:r}),e.jsxs("span",{className:"text-muted-foreground",style:sr,children:[t.length," items"]})]}),l&&e.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:[e.jsx(v.Search,{size:12,className:"text-muted-foreground"}),e.jsx("input",{value:s,onChange:d=>n(d.target.value),placeholder:"Search\\u2026",className:"flex-1 bg-transparent outline-none text-foreground placeholder:text-muted-foreground",style:sr})]}),e.jsxs("div",{className:"max-h-[240px] overflow-y-auto py-1",children:[t.length===0&&e.jsx("div",{className:"px-3 py-6 text-center text-muted-foreground",style:sr,children:"No items"}),t.map(d=>e.jsxs("button",{onClick:()=>!d.disabled&&a(d.id),className:`w-full flex items-center gap-2 px-3 py-1.5 transition-colors cursor-pointer
|
|
87
|
+
${o.has(d.id)?"bg-primary/10":"hover:bg-accent"}
|
|
88
|
+
${d.disabled?"opacity-40 pointer-events-none":""}`,style:os,children:[e.jsx("span",{className:`w-4 h-4 rounded-[var(--radius-sm)] border flex items-center justify-center flex-shrink-0
|
|
89
|
+
${o.has(d.id)?"bg-primary border-primary":"border-border"}`,children:o.has(d.id)&&e.jsx("span",{className:"w-2 h-2 rounded-[1px] bg-primary-foreground"})}),e.jsx("span",{className:"text-foreground truncate",children:d.label})]},d.id))]})]})}function as({sourceTitle:r="Available",targetTitle:t="Selected",items:o,defaultTarget:a=[],searchable:s,value:n,onChange:l,loading:d=!1,error:i}){const[f,u]=c.useState(new Set(a)),x=n!==void 0?new Set(n):f,y=$=>{l&&l(Array.from($)),n===void 0&&u($)},[h,p]=c.useState(new Set),[g,m]=c.useState(new Set),[S,z]=c.useState(""),[b,w]=c.useState(""),N=o.filter($=>!x.has($.id)),F=o.filter($=>x.has($.id)),W=S?N.filter($=>$.label.toLowerCase().includes(S.toLowerCase())):N,D=b?F.filter($=>$.label.toLowerCase().includes(b.toLowerCase())):F,M=()=>{const $=new Set(x);h.forEach(E=>$.add(E)),y($),p(new Set)},L=()=>{const $=new Set(x);g.forEach(E=>$.delete(E)),y($),m(new Set)},I=()=>{y(new Set(o.filter($=>!$.disabled).map($=>$.id))),p(new Set)},A=()=>{y(new Set),m(new Set)},k=($,E,T)=>{const P=new Set(E);P.has($)?P.delete($):P.add($),T(P)};return i?e.jsx("div",{className:"flex items-center justify-center rounded-[var(--radius-md)] border border-border bg-card px-6 py-10 text-center",children:e.jsx("span",{style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",color:"var(--destructive)"},children:i})}):d?e.jsx("div",{className:"flex items-stretch gap-3 flex-wrap opacity-60 pointer-events-none",children:[r,t].map($=>e.jsxs("div",{className:"flex-1 min-w-[180px] rounded-[var(--radius-md)] border border-border bg-card overflow-hidden",children:[e.jsx("div",{className:"px-3 py-2.5 border-b border-border bg-muted/30",children:e.jsx("span",{style:wt,children:$})}),e.jsx("div",{className:"p-3 flex flex-col gap-2",children:[1,2,3,4].map(E=>e.jsx("div",{className:"h-8 rounded bg-muted/50 animate-pulse"},E))})]},$))}):e.jsxs("div",{className:"flex items-stretch gap-3 flex-wrap",children:[e.jsx(Nt,{title:r,items:W,selected:h,onToggle:$=>k($,h,p),search:S,onSearch:z,searchable:s}),e.jsxs("div",{className:"flex flex-col items-center justify-center gap-1.5 py-4",children:[e.jsx("button",{onClick:I,disabled:N.length===0,className:"w-8 h-8 flex items-center justify-center rounded-[var(--radius-md)] border border-border text-muted-foreground hover:text-foreground hover:bg-accent disabled:opacity-30 transition-colors cursor-pointer",children:e.jsx(v.ChevronsRight,{size:14})}),e.jsx("button",{onClick:M,disabled:h.size===0,className:"w-8 h-8 flex items-center justify-center rounded-[var(--radius-md)] border border-border text-muted-foreground hover:text-foreground hover:bg-accent disabled:opacity-30 transition-colors cursor-pointer",children:e.jsx(v.ChevronRight,{size:14})}),e.jsx("button",{onClick:L,disabled:g.size===0,className:"w-8 h-8 flex items-center justify-center rounded-[var(--radius-md)] border border-border text-muted-foreground hover:text-foreground hover:bg-accent disabled:opacity-30 transition-colors cursor-pointer",children:e.jsx(v.ChevronLeft,{size:14})}),e.jsx("button",{onClick:A,disabled:F.length===0,className:"w-8 h-8 flex items-center justify-center rounded-[var(--radius-md)] border border-border text-muted-foreground hover:text-foreground hover:bg-accent disabled:opacity-30 transition-colors cursor-pointer",children:e.jsx(v.ChevronsLeft,{size:14})})]}),e.jsx(Nt,{title:t,items:D,selected:g,onToggle:$=>k($,g,m),search:b,onSearch:w,searchable:s})]})}const nr={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"};function St({node:r,level:t,expanded:o,selected:a,onToggle:s,onSelect:n,selectable:l,showLines:d}){const i=r.children&&r.children.length>0,f=o.has(r.id),u=a.has(r.id),x=i?f?e.jsx(v.FolderOpen,{size:14,className:"text-chart-5"}):e.jsx(v.Folder,{size:14,className:"text-chart-5"}):e.jsx(v.File,{size:14,className:"text-muted-foreground"});return e.jsxs("div",{children:[e.jsxs("div",{className:`flex items-center gap-1.5 py-1 px-2 rounded-[var(--radius-sm)] transition-colors
|
|
90
90
|
${r.disabled?"opacity-40 pointer-events-none":"cursor-pointer hover:bg-accent"}
|
|
91
|
-
${
|
|
91
|
+
${u?"bg-primary/10 text-primary":"text-foreground"}`,style:{paddingLeft:`${t*20+8}px`,...nr},onClick:()=>{i&&s(r.id),l&&n(r.id)},children:[i?e.jsx("span",{className:"w-4 h-4 flex items-center justify-center flex-shrink-0",children:f?e.jsx(v.ChevronDown,{size:12}):e.jsx(v.ChevronRight,{size:12})}):e.jsx("span",{className:"w-4"}),l&&e.jsx("span",{className:`w-4 h-4 rounded-[var(--radius-sm)] border flex items-center justify-center flex-shrink-0 ${u?"bg-primary border-primary":"border-border"}`,children:u&&e.jsx("span",{className:"w-2 h-2 rounded-[1px] bg-primary-foreground"})}),e.jsx("span",{className:"flex-shrink-0",children:r.icon||x}),e.jsx("span",{className:"truncate",children:r.label})]}),i&&f&&e.jsx("div",{className:d?"border-l border-border ml-[22px]":"",children:r.children.map(y=>e.jsx(St,{node:y,level:t+1,expanded:o,selected:a,onToggle:s,onSelect:n,selectable:l,showLines:d},y.id))})]})}function ss({data:r,selectable:t,showLines:o,defaultExpanded:a,expandedItems:s,onExpandChange:n,selectedItems:l,onSelect:d,loading:i=!1,error:f,emptyMessage:u="No items"}){const[x,y]=c.useState(new Set(a||[])),[h,p]=c.useState(new Set),g=s!==void 0?new Set(s):x,m=l!==void 0?new Set(l):h,S=b=>{const w=new Set(g);w.has(b)?w.delete(b):w.add(b),n&&n(Array.from(w)),s===void 0&&y(w)},z=b=>{const w=new Set(m);w.has(b)?w.delete(b):w.add(b),d&&d(Array.from(w)),l===void 0&&p(w)};return f?e.jsx("div",{className:"rounded-[var(--radius-md)] border border-border bg-card px-4 py-8 text-center",children:e.jsx("span",{style:{...nr,color:"var(--destructive)"},children:f})}):i?e.jsx("div",{className:"rounded-[var(--radius-md)] border border-border bg-card py-2 px-3 flex flex-col gap-2",children:[1,2,3,4,5].map(b=>e.jsx("div",{className:"h-7 rounded bg-muted/50 animate-pulse",style:{width:`${60+b%3*15}%`}},b))}):e.jsx("div",{className:"rounded-[var(--radius-md)] border border-border bg-card py-1",children:r.length===0?e.jsx("div",{className:"px-4 py-8 text-center text-muted-foreground",style:nr,children:u}):r.map(b=>e.jsx(St,{node:b,level:0,expanded:g,selected:m,onToggle:S,onSelect:z,selectable:t,showLines:o},b.id))})}const ns={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},lr={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},kt=c.createContext({name:""});function ls(){return c.useContext(kt)}function ir({htmlFor:r,required:t,children:o,className:a=""}){return e.jsxs("label",{htmlFor:r,className:`block text-foreground mb-1.5 ${a}`,style:ns,children:[o,t&&e.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]})}function $t({message:r,className:t=""}){return r?e.jsxs("div",{className:`flex items-center gap-1 mt-1.5 text-destructive ${t}`,style:lr,role:"alert",children:[e.jsx(v.AlertCircle,{size:12,className:"flex-shrink-0"}),e.jsx("span",{children:r})]}):null}function zt({message:r,className:t=""}){return r?e.jsxs("div",{className:`flex items-center gap-1 mt-1.5 text-chart-2 ${t}`,style:lr,role:"status",children:[e.jsx(v.CheckCircle2,{size:12,className:"flex-shrink-0"}),e.jsx("span",{children:r})]}):null}function Ct({children:r,className:t=""}){return e.jsx("p",{className:`mt-1.5 text-muted-foreground ${t}`,style:lr,children:r})}function is({name:r,label:t,required:o,error:a,successMessage:s,helperText:n,layout:l="vertical",labelWidth:d="160px",children:i,className:f=""}){const u=l==="horizontal",x=a?e.jsx($t,{message:a}):s?e.jsx(zt,{message:s}):n?e.jsx(Ct,{children:n}):null;return e.jsx(kt.Provider,{value:{name:r,error:a},children:u?e.jsxs("div",{className:`flex items-start gap-4 ${f}`,children:[t&&e.jsx("div",{style:{width:d,flexShrink:0,paddingTop:"6px"},children:e.jsx(ir,{htmlFor:r,required:o,children:t})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[i,x]})]}):e.jsxs("div",{className:`${f}`,children:[t&&e.jsx(ir,{htmlFor:r,required:o,children:t}),i,x]})})}const ds={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},cs={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},fs={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},hs={sm:"h-8",md:"h-10",lg:"h-12"},Ft={sm:14,md:16,lg:18};function us({value:r,defaultValue:t=0,onChange:o,min:a,max:s,step:n=1,disabled:l,size:d="md",label:i,placeholder:f,error:u,className:x=""}){const[y,h]=c.useState(t),p=r??y,g=z=>{const b=Math.max(a??-1/0,Math.min(s??1/0,z));o&&o(b),r===void 0&&h(b)},m=a===void 0||p-n>=a,S=s===void 0||p+n<=s;return e.jsxs("div",{className:x,children:[i&&e.jsx("label",{className:"block text-foreground mb-1.5",style:ds,children:i}),e.jsxs("div",{className:`inline-flex items-center rounded-[var(--radius-md)] border ${u?"border-destructive":"border-border"} bg-background overflow-hidden ${l?"opacity-50 pointer-events-none":""}`,children:[e.jsx("button",{type:"button",onClick:()=>g(p-n),disabled:l||!m,className:"flex items-center justify-center px-2.5 border-r border-border text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors cursor-pointer",style:{height:"100%"},children:e.jsx(v.Minus,{size:Ft[d]})}),e.jsx("input",{type:"number",value:p,placeholder:f,onChange:z=>{const b=parseFloat(z.target.value);isNaN(b)||g(b)},disabled:l,className:`w-20 text-center bg-transparent outline-none text-foreground ${hs[d]} [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none`,style:cs}),e.jsx("button",{type:"button",onClick:()=>g(p+n),disabled:l||!S,className:"flex items-center justify-center px-2.5 border-l border-border text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors cursor-pointer",style:{height:"100%"},children:e.jsx(v.Plus,{size:Ft[d]})})]}),u&&e.jsx("p",{className:"mt-1.5 text-destructive",style:fs,children:u})]})}const bs={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},gs={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},ps={sm:"w-9 h-9",md:"w-11 h-11",lg:"w-14 h-14"};function vs({length:r=6,value:t,onChange:o,onComplete:a,disabled:s,error:n,size:l="md",label:d,masked:i,className:f=""}){const[u,x]=c.useState(()=>"".padEnd(r,"")),y=c.useRef([]),p=(t??u).padEnd(r,"").split("").slice(0,r),g=c.useCallback(b=>{o&&o(b),t===void 0&&x(b),b.replace(/ /g,"").length===r&&a&&a(b)},[o,a,t,r]),m=(b,w)=>{var W;if(!/^\d$/.test(w))return;const N=p.slice();N[b]=w;const F=N.join("");g(F),b<r-1&&((W=y.current[b+1])==null||W.focus())},S=(b,w)=>{var N,F,W;if(w.key==="Backspace"){w.preventDefault();const D=p.slice();D[b]!==" "&&D[b]!==""?(D[b]=" ",g(D.join(""))):b>0&&(D[b-1]=" ",g(D.join("")),(N=y.current[b-1])==null||N.focus())}else w.key==="ArrowLeft"&&b>0?(F=y.current[b-1])==null||F.focus():w.key==="ArrowRight"&&b<r-1&&((W=y.current[b+1])==null||W.focus())},z=b=>{var N;b.preventDefault();const w=b.clipboardData.getData("text").replace(/\D/g,"").slice(0,r);if(w){g(w.padEnd(r," "));const F=Math.min(w.length,r-1);(N=y.current[F])==null||N.focus()}};return e.jsxs("div",{className:f,children:[d&&e.jsx("label",{className:"block text-foreground mb-2",style:bs,children:d}),e.jsx("div",{className:"flex gap-2",onPaste:z,children:p.map((b,w)=>e.jsx("input",{ref:N=>{y.current[w]=N},type:i?"password":"text",inputMode:"numeric",maxLength:1,value:b===" "?"":b,disabled:s,onChange:N=>{const F=N.target.value;F&&m(w,F[F.length-1])},onKeyDown:N=>S(w,N),onFocus:N=>N.target.select(),className:`${ps[l]} text-center rounded-[var(--radius-md)] border outline-none transition-all
|
|
92
92
|
${n?"border-destructive focus:ring-2 focus:ring-destructive/30":"border-border focus:border-primary focus:ring-2 focus:ring-primary/20"}
|
|
93
|
-
${
|
|
94
|
-
text-foreground`,style:{fontFamily:"var(--font-button)",fontWeight:"var(--weight-button)"}},S))}),n&&e.jsx("p",{className:"mt-2 text-destructive",style:ps,children:n})]})}const ys={fontFamily:"var(--font-h3, 'DB HeaventRounded', sans-serif)",fontSize:"var(--text-h3, 28px)",fontWeight:"var(--weight-h3, 700)",color:"var(--foreground)",lineHeight:1.3},ws={fontFamily:"var(--font-p, 'DB HeaventRounded', sans-serif)",fontSize:"var(--text-p, 20px)",fontWeight:"var(--weight-p, 400)",color:"var(--muted-foreground)",lineHeight:1.4},Ns={fontFamily:"var(--font-caption, 'DB HeaventRounded', sans-serif)",fontSize:"var(--text-caption, 14px)"};function Ss({title:r,subtitle:t,breadcrumb:o,actions:s,tabs:a,sticky:n=!1,className:l=""}){return e.jsxs("div",{className:`bg-background border-b border-border ${n?"sticky top-0 z-10":""} ${l}`,children:[e.jsxs("div",{className:"px-6 pt-5 pb-4",children:[o&&e.jsx("div",{className:"mb-2",style:Ns,children:o}),e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{style:ys,className:"truncate",children:r}),t&&e.jsx("p",{className:"mt-0.5",style:ws,children:t})]}),s&&e.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 pt-0.5",children:s})]})]}),a&&e.jsx("div",{className:"px-6",children:a})]})}const ks={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},Ce={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:400};function $s({config:r,value:t,onChange:o}){var c;const[s,a]=b.useState(!1),n=Array.isArray(t)?t:t?[t]:[],l=n.length>0,i=b.useCallback(h=>{if(r.type==="single"){const g=n[0]===h?null:h;o(r.key,g),a(!1)}else{const g=n.includes(h)?n.filter(x=>x!==h):[...n,h];o(r.key,g.length?g:null)}},[r,n,o]),d=n.length===1?(c=r.options.find(h=>h.value===n[0]))==null?void 0:c.label:n.length>1?`${r.label} (${n.length})`:r.label;return e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>a(h=>!h),className:`inline-flex items-center gap-1.5 h-9 px-3 rounded-lg border transition-colors cursor-pointer select-none ${l?"bg-[var(--primary)]/10 border-[var(--primary)] text-[var(--primary)]":"bg-[var(--background)] border-[var(--border)] text-[var(--foreground)] hover:bg-[var(--muted)]"}`,style:ks,children:[d,l&&e.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 rounded-full bg-[var(--primary)] text-primary-foreground text-[10px] font-bold",children:n.length}),e.jsx(v.ChevronDown,{size:14,className:`transition-transform ${s?"rotate-180":""}`})]}),s&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>a(!1)}),e.jsx("div",{className:"absolute left-0 top-full mt-1 z-20 bg-[var(--card)] border border-[var(--border)] rounded-lg shadow-elevation-sm min-w-[160px] py-1 overflow-hidden",children:r.options.map(h=>{const g=n.includes(h.value);return e.jsxs("button",{type:"button",onClick:()=>i(h.value),className:`w-full flex items-center gap-2 px-3 py-2 text-left transition-colors cursor-pointer ${g?"bg-[var(--primary)]/10 text-[var(--primary)]":"text-[var(--foreground)] hover:bg-[var(--muted)]"}`,style:Ce,children:[r.type==="multi"&&e.jsx("span",{className:`inline-flex items-center justify-center w-4 h-4 rounded border flex-shrink-0 ${g?"bg-[var(--primary)] border-[var(--primary)] text-primary-foreground":"border-[var(--border)]"}`,children:g&&e.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",children:e.jsx("path",{d:"M1 4L3.5 6.5L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),h.label]},h.value)})})]})]})}function zs({filters:r=[],searchPlaceholder:t="Search...",showSearch:o=!0,value:s,onFilterChange:a,className:n=""}){const[l,i]=b.useState({search:"",filters:{}}),d=s??l,c=b.useCallback(w=>{i(w),a==null||a(w)},[a]),h=b.useCallback(w=>{c({...d,search:w.target.value})},[d,c]),g=b.useCallback((w,u)=>{c({...d,filters:{...d.filters,[w]:u}})},[d,c]),x=b.useCallback(()=>{c({search:"",filters:{}})},[c]),f=Object.values(d.filters).filter(w=>w!==null&&(!Array.isArray(w)||w.length>0)).length,p=f>0||d.search&&d.search.length>0;return e.jsxs("div",{className:`flex items-center gap-2 flex-wrap bg-[var(--background)] border border-[var(--border)] rounded-lg px-3 py-2 ${n}`,children:[o&&e.jsxs("div",{className:"relative flex items-center",children:[e.jsx(v.Search,{size:14,className:"absolute left-2.5 text-[var(--muted-foreground)] pointer-events-none"}),e.jsx("input",{type:"text",value:d.search??"",onChange:h,placeholder:t,className:"h-8 pl-8 pr-3 rounded-md border border-[var(--border)] bg-[var(--background)] text-[var(--foreground)] placeholder:text-[var(--muted-foreground)] focus:outline-none focus:border-[var(--primary)] focus:ring-1 focus:ring-[var(--primary)] transition-colors min-w-[200px]",style:Ce})]}),o&&r.length>0&&e.jsx("div",{className:"w-px h-5 bg-[var(--border)] flex-shrink-0"}),r.length>0&&e.jsx(v.SlidersHorizontal,{size:14,className:"text-[var(--muted-foreground)] flex-shrink-0"}),r.map(w=>e.jsx($s,{config:w,value:d.filters[w.key]??null,onChange:g},w.key)),f>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-[var(--primary)]/10 text-[var(--primary)]",style:Ce,children:[f," active"]}),p&&e.jsxs("button",{type:"button",onClick:x,className:"inline-flex items-center gap-1 h-7 px-2 rounded-md text-[var(--muted-foreground)] hover:text-[var(--foreground)] hover:bg-[var(--muted)] transition-colors cursor-pointer ml-auto",style:Ce,children:[e.jsx(v.X,{size:12}),"Clear all"]})]})}const ot={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},Ke={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},ce={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:400},oe={sm:"px-3 py-2",md:"px-4 py-3",lg:"px-5 py-4"};function Fs({width:r}){return e.jsx("div",{className:"h-4 rounded bg-muted animate-pulse",style:{width:r??"80%"}})}function Cs({columns:r,hidden:t,onToggle:o}){const[s,a]=b.useState(!1),n=b.useRef(null);b.useEffect(()=>{function i(d){n.current&&!n.current.contains(d.target)&&a(!1)}return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);const l=r.filter(i=>i.hideable!==!1);return e.jsxs("div",{ref:n,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>a(i=>!i),className:"inline-flex items-center gap-1.5 h-8 px-3 rounded-lg border border-[var(--border)] bg-[var(--background)] text-[var(--muted-foreground)] hover:bg-[var(--muted)] hover:text-[var(--foreground)] transition-colors cursor-pointer",style:ce,children:[e.jsx(v.Columns3,{size:14}),"Columns"]}),s&&e.jsx("div",{className:"absolute right-0 top-full mt-1 z-30 bg-[var(--card)] border border-[var(--border)] rounded-lg shadow-elevation-sm w-44 py-1",children:l.map(i=>{const d=!t.has(i.key);return e.jsxs("button",{type:"button",onClick:()=>o(i.key),className:"w-full flex items-center justify-between gap-2 px-3 py-2 hover:bg-[var(--muted)] text-[var(--foreground)] transition-colors cursor-pointer",style:ce,children:[e.jsx("span",{children:i.header}),d&&e.jsx(v.Check,{size:13,className:"text-[var(--primary)]"})]},i.key)})})]})}function Ws({count:r,actions:t,selectedKeys:o,onClear:s}){return e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 bg-[var(--primary)]/8 border-b border-[var(--primary)]/20",children:[e.jsxs("span",{className:"text-[var(--primary)] flex-shrink-0",style:ot,children:[r," selected"]}),e.jsx("div",{className:"flex items-center gap-2 flex-1 flex-wrap",children:t.map((a,n)=>e.jsxs("button",{type:"button",onClick:()=>a.onClick(o),className:`inline-flex items-center gap-1.5 h-7 px-3 rounded-md border transition-colors cursor-pointer ${a.variant==="destructive"?"border-[var(--destructive)] text-[var(--destructive)] hover:bg-[var(--destructive)]/10":"border-[var(--primary)] text-[var(--primary)] hover:bg-[var(--primary)]/10"}`,style:{...ce,fontWeight:500},children:[a.icon,a.label]},n))}),e.jsx("button",{type:"button",onClick:s,className:"text-[var(--muted-foreground)] hover:text-[var(--foreground)] transition-colors cursor-pointer p-1 rounded",title:"Clear selection",children:e.jsx(v.X,{size:14})})]})}const Ls=[10,20,50,100];function Ms({meta:r,onPageChange:t}){const{page:o,pageSize:s,totalCount:a}=r,n=Math.max(1,Math.ceil(a/s)),l=a===0?0:(o-1)*s+1,i=Math.min(o*s,a),d=b.useMemo(()=>{const c=[];if(n<=7)for(let h=1;h<=n;h++)c.push(h);else{c.push(1),o>3&&c.push("...");for(let h=Math.max(2,o-1);h<=Math.min(n-1,o+1);h++)c.push(h);o<n-2&&c.push("..."),c.push(n)}return c},[o,n]);return e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-[var(--border)] flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-[var(--muted-foreground)] whitespace-nowrap",style:ce,children:[l,"–",i," of ",a.toLocaleString()]}),e.jsx("select",{value:s,onChange:c=>t(1,Number(c.target.value)),className:"h-7 px-2 rounded-md border border-[var(--border)] bg-[var(--background)] text-[var(--foreground)] focus:outline-none focus:border-[var(--primary)] cursor-pointer",style:ce,children:Ls.map(c=>e.jsxs("option",{value:c,children:[c," / page"]},c))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Ze,{disabled:o===1,onClick:()=>t(o-1,s),label:"‹ Prev"}),d.map((c,h)=>c==="..."?e.jsx("span",{className:"px-2 text-[var(--muted-foreground)]",style:ce,children:"…"},`ellipsis-${h}`):e.jsx(Ze,{active:c===o,onClick:()=>t(c,s),label:String(c)},c)),e.jsx(Ze,{disabled:o===n,onClick:()=>t(o+1,s),label:"Next ›"})]})]})}function Ze({label:r,active:t,disabled:o,onClick:s}){return e.jsx("button",{type:"button",onClick:s,disabled:o,className:`min-w-[28px] h-7 px-2 rounded-md border transition-colors cursor-pointer ${t?"bg-[var(--primary)] border-[var(--primary)] text-primary-foreground":o?"border-transparent text-[var(--muted-foreground)] cursor-not-allowed":"border-[var(--border)] text-[var(--foreground)] hover:bg-[var(--muted)]"}`,style:{...ce,fontWeight:t?600:400},children:r})}function js({columns:r,data:t,rowKey:o="id",pagination:s,sortBy:a,sortOrder:n,onPageChange:l,onSortChange:i,selectable:d=!1,selectedRows:c,onSelectionChange:h,bulkActions:g=[],onRowClick:x,expandedRowRender:f,loading:p=!1,loadingRows:w=5,error:u,emptyMessage:m="No data found",emptyDescription:F,showColumnToggle:y=!1,size:S="md",stickyHeader:z=!1,className:M=""}){const[T,E]=b.useState(new Set(r.filter($=>$.defaultHidden).map($=>$.key))),j=b.useCallback($=>{E(O=>{const Y=new Set(O);return Y.has($)?Y.delete($):Y.add($),Y})},[]),W=b.useMemo(()=>r.filter($=>!T.has($.key)),[r,T]),[P,L]=b.useState(new Set),C=c??P,A=b.useCallback($=>{c||L($);const O=t.filter(Y=>$.has(Y[o]));h==null||h($,O)},[c,t,o,h]),_=b.useMemo(()=>t.map($=>$[o]),[t,o]),K=_.length>0&&_.every($=>C.has($)),Z=C.size>0&&!K,G=b.useCallback(()=>{A(K?new Set:new Set(_))},[K,_,A]),R=b.useCallback($=>{const O=new Set(C);O.has($)?O.delete($):O.add($),A(O)},[C,A]),[q,se]=b.useState(new Set),re=b.useCallback($=>{se(O=>{const Y=new Set(O);return Y.has($)?Y.delete($):Y.add($),Y})},[]),ae=b.useCallback($=>{i&&(a===$?i($,n==="asc"?"desc":"asc"):i($,"asc"))},[a,n,i]),ne=b.useMemo(()=>{const $={};let O=0;d&&(O+=48),f&&(O+=40);for(const Y of W)if(Y.frozen){$[Y.key]=O;const ee=typeof Y.width=="number"?Y.width:parseInt(Y.width??"120");O+=isNaN(ee)?120:ee}return $},[W,d,f]),le=W.length+(d?1:0)+(f?1:0),X="sticky z-[2] bg-inherit";return e.jsxs("div",{className:`rounded-[var(--radius-lg)] border border-[var(--border)] overflow-hidden ${M}`,children:[y&&e.jsx("div",{className:"flex items-center justify-end gap-2 px-4 py-2.5 border-b border-[var(--border)] bg-[var(--background)]",children:e.jsx(Cs,{columns:r,hidden:T,onToggle:j})}),d&&C.size>0&&g.length>0&&e.jsx(Ws,{count:C.size,actions:g,selectedKeys:Array.from(C),onClear:()=>A(new Set)}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",style:{minWidth:"100%"},children:[e.jsx("thead",{className:z?"sticky top-0 z-10":"",children:e.jsxs("tr",{className:"border-b border-border",style:{backgroundColor:"color-mix(in srgb, var(--muted) 30%, var(--background) 70%)"},children:[f&&e.jsx("th",{className:`${oe[S]} w-10`}),d&&e.jsx("th",{className:`${oe[S]} w-12`,children:e.jsx(be,{size:"sm",checked:K,indeterminate:Z&&!K,onChange:G})}),W.map($=>{const O=$.frozen&&$.key in ne,Y=a===$.key;return e.jsx("th",{className:`${oe[S]} text-${$.align??"left"} text-[var(--foreground)] whitespace-nowrap select-none ${$.sortable&&i?"cursor-pointer hover:text-[var(--primary)]":""} ${O?X:""}`,style:{...ot,width:$.width,minWidth:$.minWidth??80,...O?{left:ne[$.key],boxShadow:"2px 0 4px rgba(0,0,0,0.04)"}:{}},onClick:()=>$.sortable&&ae($.key),children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[$.header,$.sortable&&i&&e.jsx("span",{className:Y?"text-[var(--primary)]":"text-[var(--muted-foreground)]/60",children:Y?n==="asc"?e.jsx(v.ChevronUp,{size:13}):e.jsx(v.ChevronDown,{size:13}):e.jsx(v.ChevronsUpDown,{size:12})})]})},$.key)})]})}),e.jsxs("tbody",{children:[u&&e.jsx("tr",{children:e.jsx("td",{colSpan:le,className:`${oe[S]} text-center`,children:e.jsxs("div",{className:"flex flex-col items-center gap-2 py-10",children:[e.jsx(v.AlertCircle,{size:32,className:"text-[var(--destructive)] opacity-60"}),e.jsx("span",{className:"text-[var(--destructive)]",style:Ke,children:u})]})})}),!u&&p&&Array.from({length:w}).map(($,O)=>e.jsxs("tr",{className:"border-b border-[var(--border)] last:border-b-0",children:[f&&e.jsx("td",{className:`${oe[S]} w-10`}),d&&e.jsx("td",{className:`${oe[S]} w-12`,children:e.jsx("div",{className:"w-4 h-4 rounded bg-muted animate-pulse"})}),W.map(Y=>e.jsx("td",{className:`${oe[S]}`,children:e.jsx(Fs,{width:Y.align==="right"?"60%":Y.align==="center"?"50%":"75%"})},Y.key))]},`skel-${O}`)),!u&&!p&&t.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:le,className:`${oe[S]} text-center`,children:e.jsxs("div",{className:"flex flex-col items-center gap-2 py-12",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-[var(--muted)] flex items-center justify-center text-[var(--muted-foreground)]",children:e.jsx(v.ChevronsUpDown,{size:20})}),e.jsx("span",{className:"text-[var(--foreground)]",style:Ke,children:m}),F&&e.jsx("span",{className:"text-[var(--muted-foreground)]",style:ce,children:F})]})})}),!u&&!p&&t.map(($,O)=>{const Y=$[o],ee=C.has(Y),de=q.has(Y),we=!!x||!!f;return e.jsxs(b.Fragment,{children:[e.jsxs("tr",{className:`group/row border-b border-[var(--border)] last:border-b-0 transition-colors ${ee?"bg-primary/5":"bg-[var(--card)] hover:bg-[var(--row-hover-bg)]"} ${we?"cursor-pointer":""}`,onClick:()=>{x==null||x($),f&&re(Y)},children:[f&&e.jsx("td",{className:`${oe[S]} w-10 text-center`,onClick:B=>{B.stopPropagation(),re(Y)},children:e.jsx(v.ChevronRight,{size:14,className:`text-[var(--muted-foreground)] transition-transform mx-auto ${de?"rotate-90":""}`})}),d&&e.jsx("td",{className:`${oe[S]} w-12`,onClick:B=>B.stopPropagation(),children:e.jsx(be,{size:"sm",checked:ee,onChange:()=>R(Y)})}),W.map(B=>{const fe=B.frozen&&B.key in ne,Ne=fe?ee?"sticky z-[1] bg-primary/5":"sticky z-[1] bg-[var(--card)] group-hover/row:bg-[var(--row-hover-bg)] transition-colors":"";return e.jsx("td",{className:`${oe[S]} text-${B.align??"left"} text-[var(--foreground)] ${Ne}`,style:{...Ke,...fe?{left:ne[B.key],boxShadow:"2px 0 4px rgba(0,0,0,0.04)"}:{}},children:B.render?B.render($[B.key],$,O):$[B.key]},B.key)})]}),f&&de&&e.jsx("tr",{className:"bg-[var(--muted)] border-b border-[var(--border)]",children:e.jsx("td",{colSpan:le,className:"px-6 py-4",children:f($)})})]},Y??O)})]})]})}),s&&l&&!p&&!u&&e.jsx(Ms,{meta:s,onPageChange:l})]})}k.Accordion=vr,k.AccordionItem=Ee,k.AdvancedDataTable=js,k.Alert=ar,k.Avatar=pr,k.AvatarGroup=xr,k.Badge=gt,k.Breadcrumb=Pt,k.Button=Ae,k.ButtonGroup=ct,k.Card=mr,k.CardBody=wr,k.CardFooter=Nr,k.CardHeader=yr,k.Checkbox=be,k.CheckboxGroup=xt,k.ColorPicker=Vt,k.ConfirmDialog=Ct,k.DSButton=Ae,k.DSCheckbox=be,k.DSInput=De,k.DSRadio=dr,k.DSTable=ur,k.DSTextarea=Te,k.DatePicker=zt,k.Divider=kr,k.Drawer=$r,k.Dropdown=zr,k.EmptyState=ao,k.FileUpload=co,k.FilterBar=zs,k.FormError=Rr,k.FormField=cs,k.FormHelperText=rt,k.FormLabel=Ge,k.FormSuccess=et,k.IconButton=rr,k.ImagePreview=bo,k.Input=De,k.Menu=jr,k.Modal=br,k.Notification=Dr,k.NotificationCenter=mo,k.NumberInput=vs,k.OTPInput=ms,k.PageHeader=Ss,k.Pagination=jt,k.Popover=wo,k.ProgressBar=Tr,k.Radio=dr,k.RadioGroup=yt,k.Rating=zo,k.SearchField=Tt,k.Sidebar=Er,k.SidebarAccountSwitcher=Ye,k.Skeleton=Q,k.SkeletonCard=To,k.SkeletonList=Eo,k.SkeletonTable=Io,k.Spinner=Br,k.StatCard=Yo,k.Statistic=_o,k.Stepper=Pr,k.Switch=Zo,k.Table=ur,k.Tabs=Et,k.Tag=Gr,k.TagInput=Kr,k.Textarea=Te,k.Timeline=ts,k.ToastContainer=ht,k.Tooltip=He,k.TopNavbar=qr,k.TransferList=as,k.Tree=ls,k.toast=he,k.useFormField=ds,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})}));
|
|
93
|
+
${s?"opacity-50 pointer-events-none bg-muted":"bg-background"}
|
|
94
|
+
text-foreground`,style:{fontFamily:"var(--font-button)",fontWeight:"var(--weight-button)"}},w))}),n&&e.jsx("p",{className:"mt-2 text-destructive",style:gs,children:n})]})}const ms={fontFamily:"var(--font-h3, 'DB HeaventRounded', sans-serif)",fontSize:"var(--text-h3, 28px)",fontWeight:"var(--weight-h3, 700)",color:"var(--foreground)",lineHeight:1.3},xs={fontFamily:"var(--font-p, 'DB HeaventRounded', sans-serif)",fontSize:"var(--text-p, 20px)",fontWeight:"var(--weight-p, 400)",color:"var(--muted-foreground)",lineHeight:1.4},ys={fontFamily:"var(--font-caption, 'DB HeaventRounded', sans-serif)",fontSize:"var(--text-caption, 14px)"};function ws({title:r,subtitle:t,breadcrumb:o,actions:a,tabs:s,sticky:n=!1,className:l=""}){return e.jsxs("div",{className:`bg-background border-b border-border ${n?"sticky top-0 z-10":""} ${l}`,children:[e.jsxs("div",{className:"px-6 pt-5 pb-4",children:[o&&e.jsx("div",{className:"mb-2",style:ys,children:o}),e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{style:ms,className:"truncate",children:r}),t&&e.jsx("p",{className:"mt-0.5",style:xs,children:t})]}),a&&e.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 pt-0.5",children:a})]})]}),s&&e.jsx("div",{className:"px-6",children:s})]})}const Ns={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},Ie={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:400};function Ss({config:r,value:t,onChange:o}){var f;const[a,s]=c.useState(!1),n=Array.isArray(t)?t:t?[t]:[],l=n.length>0,d=c.useCallback(u=>{if(r.type==="single"){const x=n[0]===u?null:u;o(r.key,x),s(!1)}else{const x=n.includes(u)?n.filter(y=>y!==u):[...n,u];o(r.key,x.length?x:null)}},[r,n,o]),i=n.length===1?(f=r.options.find(u=>u.value===n[0]))==null?void 0:f.label:n.length>1?`${r.label} (${n.length})`:r.label;return e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>s(u=>!u),className:`inline-flex items-center gap-1.5 h-9 px-3 rounded-lg border transition-colors cursor-pointer select-none ${l?"bg-[var(--primary)]/10 border-[var(--primary)] text-[var(--primary)]":"bg-[var(--background)] border-[var(--border)] text-[var(--foreground)] hover:bg-[var(--muted)]"}`,style:Ns,children:[i,l&&e.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 rounded-full bg-[var(--primary)] text-primary-foreground font-bold",style:{fontSize:"var(--text-caption)",lineHeight:1},children:n.length}),e.jsx(v.ChevronDown,{size:14,className:`transition-transform ${a?"rotate-180":""}`})]}),a&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>s(!1)}),e.jsx("div",{className:"absolute left-0 top-full mt-1 z-20 bg-[var(--card)] border border-[var(--border)] rounded-lg shadow-elevation-sm min-w-[160px] py-1 overflow-hidden",children:r.options.map(u=>{const x=n.includes(u.value);return e.jsxs("button",{type:"button",onClick:()=>d(u.value),className:`w-full flex items-center gap-2 px-3 py-2 text-left transition-colors cursor-pointer ${x?"bg-[var(--primary)]/10 text-[var(--primary)]":"text-[var(--foreground)] hover:bg-[var(--muted)]"}`,style:Ie,children:[r.type==="multi"&&e.jsx("span",{className:`inline-flex items-center justify-center w-4 h-4 rounded border flex-shrink-0 ${x?"bg-[var(--primary)] border-[var(--primary)] text-primary-foreground":"border-[var(--border)]"}`,children:x&&e.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",children:e.jsx("path",{d:"M1 4L3.5 6.5L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),u.label]},u.value)})})]})]})}function ks({filters:r=[],searchPlaceholder:t="Search...",showSearch:o=!0,value:a,onFilterChange:s,className:n=""}){const[l,d]=c.useState({search:"",filters:{}}),i=a??l,f=c.useCallback(g=>{d(g),s==null||s(g)},[s]),u=c.useCallback(g=>{f({...i,search:g.target.value})},[i,f]),x=c.useCallback((g,m)=>{f({...i,filters:{...i.filters,[g]:m}})},[i,f]),y=c.useCallback(()=>{f({search:"",filters:{}})},[f]),h=Object.values(i.filters).filter(g=>g!==null&&(!Array.isArray(g)||g.length>0)).length,p=h>0||i.search&&i.search.length>0;return e.jsxs("div",{className:`flex items-center gap-2 flex-wrap bg-[var(--background)] border border-[var(--border)] rounded-lg px-3 py-2 ${n}`,children:[o&&e.jsxs("div",{className:"relative flex items-center",children:[e.jsx(v.Search,{size:14,className:"absolute left-2.5 text-[var(--muted-foreground)] pointer-events-none"}),e.jsx("input",{type:"text",value:i.search??"",onChange:u,placeholder:t,className:"h-8 pl-8 pr-3 rounded-md border border-[var(--border)] bg-[var(--background)] text-[var(--foreground)] placeholder:text-[var(--muted-foreground)] focus:outline-none focus:border-[var(--primary)] focus:ring-1 focus:ring-[var(--primary)] transition-colors min-w-[200px]",style:Ie})]}),o&&r.length>0&&e.jsx("div",{className:"w-px h-5 bg-[var(--border)] flex-shrink-0"}),r.length>0&&e.jsx(v.SlidersHorizontal,{size:14,className:"text-[var(--muted-foreground)] flex-shrink-0"}),r.map(g=>e.jsx(Ss,{config:g,value:i.filters[g.key]??null,onChange:x},g.key)),h>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-[var(--primary)]/10 text-[var(--primary)]",style:Ie,children:[h," active"]}),p&&e.jsxs("button",{type:"button",onClick:y,className:"inline-flex items-center gap-1 h-7 px-2 rounded-md text-[var(--muted-foreground)] hover:text-[var(--foreground)] hover:bg-[var(--muted)] transition-colors cursor-pointer ml-auto",style:Ie,children:[e.jsx(v.X,{size:12}),"Clear all"]})]})}const Mt={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},dr={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},pe={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:400},ce={sm:"px-3 py-2",md:"px-4 py-3",lg:"px-5 py-4"};function $s({width:r}){return e.jsx("div",{className:"h-4 rounded bg-muted animate-pulse",style:{width:r??"80%"}})}function zs({columns:r,hidden:t,onToggle:o}){const[a,s]=c.useState(!1),n=c.useRef(null);c.useEffect(()=>{function d(i){n.current&&!n.current.contains(i.target)&&s(!1)}return a&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]);const l=r.filter(d=>d.hideable!==!1);return e.jsxs("div",{ref:n,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>s(d=>!d),className:"inline-flex items-center gap-1.5 h-8 px-3 rounded-lg border border-[var(--border)] bg-[var(--background)] text-[var(--muted-foreground)] hover:bg-[var(--muted)] hover:text-[var(--foreground)] transition-colors cursor-pointer",style:pe,children:[e.jsx(v.Columns3,{size:14}),"Columns"]}),a&&e.jsx("div",{className:"absolute right-0 top-full mt-1 z-30 bg-[var(--card)] border border-[var(--border)] rounded-lg shadow-elevation-sm w-44 py-1",children:l.map(d=>{const i=!t.has(d.key);return e.jsxs("button",{type:"button",onClick:()=>o(d.key),className:"w-full flex items-center justify-between gap-2 px-3 py-2 hover:bg-[var(--muted)] text-[var(--foreground)] transition-colors cursor-pointer",style:pe,children:[e.jsx("span",{children:d.header}),i&&e.jsx(v.Check,{size:13,className:"text-[var(--primary)]"})]},d.key)})})]})}function Cs({count:r,actions:t,selectedKeys:o,onClear:a}){return e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 bg-[var(--primary)]/8 border-b border-[var(--primary)]/20",children:[e.jsxs("span",{className:"text-[var(--primary)] flex-shrink-0",style:Mt,children:[r," selected"]}),e.jsx("div",{className:"flex items-center gap-2 flex-1 flex-wrap",children:t.map((s,n)=>e.jsxs("button",{type:"button",onClick:()=>s.onClick(o),className:`inline-flex items-center gap-1.5 h-7 px-3 rounded-md border transition-colors cursor-pointer ${s.variant==="destructive"?"border-[var(--destructive)] text-[var(--destructive)] hover:bg-[var(--destructive)]/10":"border-[var(--primary)] text-[var(--primary)] hover:bg-[var(--primary)]/10"}`,style:{...pe,fontWeight:500},children:[s.icon,s.label]},n))}),e.jsx("button",{type:"button",onClick:a,className:"text-[var(--muted-foreground)] hover:text-[var(--foreground)] transition-colors cursor-pointer p-1 rounded",title:"Clear selection",children:e.jsx(v.X,{size:14})})]})}const Fs=[10,20,50,100];function Ms({meta:r,onPageChange:t}){const{page:o,pageSize:a,totalCount:s}=r,n=Math.max(1,Math.ceil(s/a)),l=s===0?0:(o-1)*a+1,d=Math.min(o*a,s),i=c.useMemo(()=>{const f=[];if(n<=7)for(let u=1;u<=n;u++)f.push(u);else{f.push(1),o>3&&f.push("...");for(let u=Math.max(2,o-1);u<=Math.min(n-1,o+1);u++)f.push(u);o<n-2&&f.push("..."),f.push(n)}return f},[o,n]);return e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-[var(--border)] flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-[var(--muted-foreground)] whitespace-nowrap",style:pe,children:[l,"–",d," of ",s.toLocaleString()]}),e.jsx("select",{value:a,onChange:f=>t(1,Number(f.target.value)),className:"h-7 px-2 rounded-md border border-[var(--border)] bg-[var(--background)] text-[var(--foreground)] focus:outline-none focus:border-[var(--primary)] cursor-pointer",style:pe,children:Fs.map(f=>e.jsxs("option",{value:f,children:[f," / page"]},f))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(cr,{disabled:o===1,onClick:()=>t(o-1,a),label:"‹ Prev"}),i.map((f,u)=>f==="..."?e.jsx("span",{className:"px-2 text-[var(--muted-foreground)]",style:pe,children:"…"},`ellipsis-${u}`):e.jsx(cr,{active:f===o,onClick:()=>t(f,a),label:String(f)},f)),e.jsx(cr,{disabled:o===n,onClick:()=>t(o+1,a),label:"Next ›"})]})]})}function cr({label:r,active:t,disabled:o,onClick:a}){return e.jsx("button",{type:"button",onClick:a,disabled:o,className:`min-w-[28px] h-7 px-2 rounded-md border transition-colors cursor-pointer ${t?"bg-[var(--primary)] border-[var(--primary)] text-primary-foreground":o?"border-transparent text-[var(--muted-foreground)] cursor-not-allowed":"border-[var(--border)] text-[var(--foreground)] hover:bg-[var(--muted)]"}`,style:{...pe,fontWeight:t?600:400},children:r})}function Ws({columns:r,data:t,rowKey:o="id",pagination:a,sortBy:s,sortOrder:n,onPageChange:l,onSortChange:d,selectable:i=!1,selectedRows:f,onSelectionChange:u,bulkActions:x=[],onRowClick:y,expandedRowRender:h,loading:p=!1,loadingRows:g=5,error:m,emptyMessage:S="No data found",emptyDescription:z,showColumnToggle:b=!1,size:w="md",stickyHeader:N=!1,className:F=""}){const[W,D]=c.useState(new Set(r.filter(H=>H.defaultHidden).map(H=>H.key))),M=c.useCallback(H=>{D(q=>{const Z=new Set(q);return Z.has(H)?Z.delete(H):Z.add(H),Z})},[]),L=c.useMemo(()=>r.filter(H=>!W.has(H.key)),[r,W]),[I,A]=c.useState(new Set),k=f??I,$=c.useCallback(H=>{f||A(H);const q=t.filter(Z=>H.has(Z[o]));u==null||u(H,q)},[f,t,o,u]),E=c.useMemo(()=>t.map(H=>H[o]),[t,o]),T=E.length>0&&E.every(H=>k.has(H)),P=k.size>0&&!T,B=c.useCallback(()=>{$(T?new Set:new Set(E))},[T,E,$]),_=c.useCallback(H=>{const q=new Set(k);q.has(H)?q.delete(H):q.add(H),$(q)},[k,$]),[K,R]=c.useState(new Set),te=c.useCallback(H=>{R(q=>{const Z=new Set(q);return Z.has(H)?Z.delete(H):Z.add(H),Z})},[]),oe=c.useCallback(H=>{d&&(s===H?d(H,n==="asc"?"desc":"asc"):d(H,"asc"))},[s,n,d]),Q=c.useMemo(()=>{const H={};let q=0;i&&(q+=48),h&&(q+=40);for(const Z of L)if(Z.frozen){H[Z.key]=q;const le=typeof Z.width=="number"?Z.width:parseInt(Z.width??"120");q+=isNaN(le)?120:le}return H},[L,i,h]),ee=L.length+(i?1:0)+(h?1:0),Y="sticky z-[2] bg-inherit";return e.jsxs("div",{className:`rounded-[var(--radius-md)] border border-[var(--border)] overflow-hidden ${F}`,children:[b&&e.jsx("div",{className:"flex items-center justify-end gap-2 px-4 py-2.5 border-b border-[var(--border)] bg-[var(--background)]",children:e.jsx(zs,{columns:r,hidden:W,onToggle:M})}),i&&k.size>0&&x.length>0&&e.jsx(Cs,{count:k.size,actions:x,selectedKeys:Array.from(k),onClear:()=>$(new Set)}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",style:{minWidth:"100%"},children:[e.jsx("thead",{className:N?"sticky top-0 z-10":"",children:e.jsxs("tr",{className:"border-b border-border",style:{backgroundColor:"color-mix(in srgb, var(--muted) 30%, var(--background) 70%)"},children:[h&&e.jsx("th",{className:`${ce[w]} w-10`}),i&&e.jsx("th",{className:`${ce[w]} w-12`,children:e.jsx(ye,{size:"sm",checked:T,indeterminate:P&&!T,onChange:B})}),L.map(H=>{const q=H.frozen&&H.key in Q,Z=s===H.key;return e.jsx("th",{className:`${ce[w]} text-${H.align??"left"} text-[var(--foreground)] whitespace-nowrap select-none ${H.sortable&&d?"cursor-pointer hover:text-[var(--primary)]":""} ${q?Y:""}`,style:{...Mt,width:H.width,minWidth:H.minWidth??80,...q?{left:Q[H.key],boxShadow:"2px 0 4px rgba(0,0,0,0.04)"}:{}},onClick:()=>H.sortable&&oe(H.key),children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[H.header,H.sortable&&d&&e.jsx("span",{className:Z?"text-[var(--primary)]":"text-[var(--muted-foreground)]/60",children:Z?n==="asc"?e.jsx(v.ChevronUp,{size:13}):e.jsx(v.ChevronDown,{size:13}):e.jsx(v.ChevronsUpDown,{size:12})})]})},H.key)})]})}),e.jsxs("tbody",{children:[m&&e.jsx("tr",{children:e.jsx("td",{colSpan:ee,className:`${ce[w]} text-center`,children:e.jsxs("div",{className:"flex flex-col items-center gap-2 py-10",children:[e.jsx(v.AlertCircle,{size:32,className:"text-[var(--destructive)] opacity-60"}),e.jsx("span",{className:"text-[var(--destructive)]",style:dr,children:m})]})})}),!m&&p&&Array.from({length:g}).map((H,q)=>e.jsxs("tr",{className:"border-b border-[var(--border)] last:border-b-0",children:[h&&e.jsx("td",{className:`${ce[w]} w-10`}),i&&e.jsx("td",{className:`${ce[w]} w-12`,children:e.jsx("div",{className:"w-4 h-4 rounded bg-muted animate-pulse"})}),L.map(Z=>e.jsx("td",{className:`${ce[w]}`,children:e.jsx($s,{width:Z.align==="right"?"60%":Z.align==="center"?"50%":"75%"})},Z.key))]},`skel-${q}`)),!m&&!p&&t.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:ee,className:`${ce[w]} text-center`,children:e.jsxs("div",{className:"flex flex-col items-center gap-2 py-12",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-[var(--muted)] flex items-center justify-center text-[var(--muted-foreground)]",children:e.jsx(v.ChevronsUpDown,{size:20})}),e.jsx("span",{className:"text-[var(--foreground)]",style:dr,children:S}),z&&e.jsx("span",{className:"text-[var(--muted-foreground)]",style:pe,children:z})]})})}),!m&&!p&&t.map((H,q)=>{const Z=H[o],le=k.has(Z),ue=K.has(Z),Me=!!y||!!h;return e.jsxs(c.Fragment,{children:[e.jsxs("tr",{className:`group/row border-b border-[var(--border)] last:border-b-0 transition-colors ${le?"bg-primary/5":"bg-[var(--card)] hover:bg-[var(--row-hover-bg)]"} ${Me?"cursor-pointer":""}`,onClick:()=>{y==null||y(H),h&&te(Z)},children:[h&&e.jsx("td",{className:`${ce[w]} w-10 text-center`,onClick:U=>{U.stopPropagation(),te(Z)},children:e.jsx(v.ChevronRight,{size:14,className:`text-[var(--muted-foreground)] transition-transform mx-auto ${ue?"rotate-90":""}`})}),i&&e.jsx("td",{className:`${ce[w]} w-12`,onClick:U=>U.stopPropagation(),children:e.jsx(ye,{size:"sm",checked:le,onChange:()=>_(Z)})}),L.map(U=>{const ve=U.frozen&&U.key in Q,We=ve?le?"sticky z-[1] bg-primary/5":"sticky z-[1] bg-[var(--card)] group-hover/row:bg-[var(--row-hover-bg)] transition-colors":"";return e.jsx("td",{className:`${ce[w]} text-${U.align??"left"} text-[var(--foreground)] ${We}`,style:{...dr,...ve?{left:Q[U.key],boxShadow:"2px 0 4px rgba(0,0,0,0.04)"}:{}},children:U.render?U.render(H[U.key],H,q):H[U.key]},U.key)})]}),h&&ue&&e.jsx("tr",{className:"bg-[var(--muted)] border-b border-[var(--border)]",children:e.jsx("td",{colSpan:ee,className:"px-6 py-4",children:h(H)})})]},Z??q)})]})]})}),a&&l&&!p&&!m&&e.jsx(Ms,{meta:a,onPageChange:l})]})}const we=["var(--chart-1, #32a9ff)","var(--chart-2, #22c55e)","var(--chart-3, #f59e0b)","var(--chart-4, #ef4444)","var(--chart-5, #a855f7)","var(--chart-6, #06b6d4)"];function ie(r,t){return r.color??we[t%we.length]}const ne={fontFamily:"var(--font-label)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-label)"};function fr(r,t,o){return Math.max(t,Math.min(o,r))}function Be(r){const t=Math.max(...r,0);if(t===0)return 10;const o=Math.pow(10,Math.floor(Math.log10(t)));return Math.ceil(t/o)*o}function hr(r,t){if(r.length===0)return"";if(!t||r.length<3)return r.map((a,s)=>`${s===0?"M":"L"}${a[0]},${a[1]}`).join(" ");let o=`M${r[0][0]},${r[0][1]}`;for(let a=1;a<r.length;a++){const s=r[a-1],n=r[a],l=s[0]+(n[0]-s[0])*.4,d=n[0]-(n[0]-s[0])*.4;o+=` C${l},${s[1]} ${d},${n[1]} ${n[0]},${n[1]}`}return o}function ur({x:r,y:t,label:o,items:a}){return e.jsx("foreignObject",{x:r,y:t,width:160,height:40+a.length*22,style:{overflow:"visible"},children:e.jsxs("div",{className:"bg-card border border-border rounded-[var(--radius-md)] shadow-[0_4px_16px_rgba(0,0,0,0.12)] p-2 pointer-events-none",style:{width:"max-content",...ne},children:[e.jsx("div",{className:"text-muted-foreground mb-1",children:o}),a.map(s=>e.jsxs("div",{className:"flex items-center gap-1.5 text-foreground",children:[e.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:s.color}}),e.jsxs("span",{className:"truncate",children:[s.name,":"]}),e.jsx("span",{className:"font-medium ml-auto pl-2",children:s.value.toLocaleString()})]},s.name))]})})}function Wt({series:r,height:t=240,width:o,showXAxis:a=!0,showYAxis:s=!0,showGrid:n=!0,showLegend:l=!0,showTooltip:d=!0,showDots:i=!0,smooth:f=!1,className:u=""}){c.useId();const x=c.useRef(null),[y,h]=c.useState(null);if(!r.length||!r[0].data.length)return null;const p=r[0].data.map(I=>I.label),g=r.flatMap(I=>I.data.map(A=>A.value)),m=Be(g),S=0,z={top:12,right:16,bottom:a?36:12,left:s?48:16},b=o??600,w=t,N=b-z.left-z.right,F=w-z.top-z.bottom,W=p.length>1?N/(p.length-1):N;function D(I){return z.left+I*W}function M(I){return z.top+F-(I-S)/(m-S||1)*F}const L=Array.from({length:5},(I,A)=>S+A/4*(m-S));return e.jsxs("div",{className:`w-full ${u}`,children:[e.jsxs("svg",{ref:x,width:o?b:"100%",height:w,viewBox:`0 0 ${b} ${w}`,onMouseLeave:()=>h(null),children:[n&&L.map((I,A)=>e.jsx("line",{x1:z.left,y1:M(I),x2:b-z.right,y2:M(I),stroke:"var(--border)",strokeWidth:.5,strokeDasharray:"4 2"},A)),s&&L.map((I,A)=>e.jsx("text",{x:z.left-8,y:M(I)+4,textAnchor:"end",fill:"var(--muted-foreground)",style:ne,children:I>=1e3?`${(I/1e3).toFixed(1)}k`:I},A)),a&&p.map((I,A)=>{const k=Math.max(1,Math.floor(p.length/8));return A%k!==0&&A!==p.length-1?null:e.jsx("text",{x:D(A),y:w-z.bottom+16,textAnchor:"middle",fill:"var(--muted-foreground)",style:ne,children:I},A)}),r.map((I,A)=>{const k=ie(I,A),$=I.data.map((T,P)=>[D(P),M(T.value)]),E=hr($,f);return e.jsxs("g",{children:[e.jsx("path",{d:E,fill:"none",stroke:k,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),i&&$.map(([T,P],B)=>e.jsx("circle",{cx:T,cy:P,r:3,fill:"var(--card)",stroke:k,strokeWidth:2},B))]},A)}),d&&p.map((I,A)=>e.jsx("rect",{x:D(A)-W/2,y:z.top,width:W,height:F,fill:"transparent",onMouseEnter:()=>h({x:D(A),y:z.top,labelIdx:A})},A)),y&&e.jsx("line",{x1:D(y.labelIdx),y1:z.top,x2:D(y.labelIdx),y2:z.top+F,stroke:"var(--border)",strokeWidth:1,strokeDasharray:"4 2"}),y&&d&&e.jsx(ur,{x:fr(D(y.labelIdx)+8,z.left,b-180),y:z.top,label:p[y.labelIdx],items:r.map((I,A)=>{var k;return{name:I.name,value:((k=I.data[y.labelIdx])==null?void 0:k.value)??0,color:ie(I,A)}})})]}),l&&r.length>1&&e.jsx("div",{className:"flex flex-wrap gap-4 mt-2 justify-center",children:r.map((I,A)=>e.jsxs("div",{className:"flex items-center gap-1.5",style:ne,children:[e.jsx("div",{className:"w-3 h-0.5 rounded-full",style:{backgroundColor:ie(I,A)}}),e.jsx("span",{className:"text-muted-foreground",children:I.name})]},A))})]})}Wt.displayName="LineChart";function Lt({series:r,height:t=240,width:o,showXAxis:a=!0,showYAxis:s=!0,showGrid:n=!0,showLegend:l=!0,showTooltip:d=!0,showDots:i=!1,smooth:f=!0,fillOpacity:u=.15,className:x=""}){const y=c.useId(),[h,p]=c.useState(null);if(!r.length||!r[0].data.length)return null;const g=r[0].data.map(k=>k.label),m=r.flatMap(k=>k.data.map($=>$.value)),S=Be(m),z=0,b={top:12,right:16,bottom:a?36:12,left:s?48:16},w=o??600,N=t,F=w-b.left-b.right,W=N-b.top-b.bottom,D=g.length>1?F/(g.length-1):F;function M(k){return b.left+k*D}function L(k){return b.top+W-(k-z)/(S-z||1)*W}const I=Array.from({length:5},(k,$)=>z+$/4*(S-z)),A=b.top+W;return e.jsxs("div",{className:`w-full ${x}`,children:[e.jsxs("svg",{width:o?w:"100%",height:N,viewBox:`0 0 ${w} ${N}`,onMouseLeave:()=>p(null),children:[e.jsx("defs",{children:r.map((k,$)=>e.jsxs("linearGradient",{id:`${y}-grad-${$}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:ie(k,$),stopOpacity:u*4}),e.jsx("stop",{offset:"100%",stopColor:ie(k,$),stopOpacity:0})]},$))}),n&&I.map((k,$)=>e.jsx("line",{x1:b.left,y1:L(k),x2:w-b.right,y2:L(k),stroke:"var(--border)",strokeWidth:.5,strokeDasharray:"4 2"},$)),s&&I.map((k,$)=>e.jsx("text",{x:b.left-8,y:L(k)+4,textAnchor:"end",fill:"var(--muted-foreground)",style:ne,children:k>=1e3?`${(k/1e3).toFixed(1)}k`:k},$)),a&&g.map((k,$)=>{const E=Math.max(1,Math.floor(g.length/8));return $%E!==0&&$!==g.length-1?null:e.jsx("text",{x:M($),y:N-b.bottom+16,textAnchor:"middle",fill:"var(--muted-foreground)",style:ne,children:k},$)}),r.map((k,$)=>{const E=ie(k,$),T=k.data.map((_,K)=>[M(K),L(_.value)]),P=hr(T,f),B=P+` L${T[T.length-1][0]},${A} L${T[0][0]},${A} Z`;return e.jsxs("g",{children:[e.jsx("path",{d:B,fill:`url(#${y}-grad-${$})`}),e.jsx("path",{d:P,fill:"none",stroke:E,strokeWidth:2,strokeLinecap:"round"}),i&&T.map(([_,K],R)=>e.jsx("circle",{cx:_,cy:K,r:3,fill:"var(--card)",stroke:E,strokeWidth:2},R))]},$)}),d&&g.map((k,$)=>e.jsx("rect",{x:M($)-D/2,y:b.top,width:D,height:W,fill:"transparent",onMouseEnter:()=>p({x:M($),y:b.top,labelIdx:$})},$)),h&&e.jsx("line",{x1:M(h.labelIdx),y1:b.top,x2:M(h.labelIdx),y2:b.top+W,stroke:"var(--border)",strokeWidth:1,strokeDasharray:"4 2"}),h&&e.jsx(ur,{x:fr(M(h.labelIdx)+8,b.left,w-180),y:b.top,label:g[h.labelIdx],items:r.map((k,$)=>{var E;return{name:k.name,value:((E=k.data[h.labelIdx])==null?void 0:E.value)??0,color:ie(k,$)}})})]}),l&&r.length>1&&e.jsx("div",{className:"flex flex-wrap gap-4 mt-2 justify-center",children:r.map((k,$)=>e.jsxs("div",{className:"flex items-center gap-1.5",style:ne,children:[e.jsx("div",{className:"w-3 h-0.5 rounded-full",style:{backgroundColor:ie(k,$)}}),e.jsx("span",{className:"text-muted-foreground",children:k.name})]},$))})]})}Lt.displayName="AreaChart";function Dt({series:r,height:t=240,width:o,showXAxis:a=!0,showYAxis:s=!0,showGrid:n=!0,showLegend:l=!0,showTooltip:d=!0,stacked:i=!1,radius:f=4,className:u=""}){const[x,y]=c.useState(null);if(!r.length||!r[0].data.length)return null;const h=r[0].data.map(A=>A.label);let p;i?p=Be(h.map((A,k)=>r.reduce(($,E)=>{var T;return $+(((T=E.data[k])==null?void 0:T.value)??0)},0))):p=Be(r.flatMap(A=>A.data.map(k=>k.value)));const g={top:12,right:16,bottom:a?36:12,left:s?48:16},m=o??600,S=t,z=m-g.left-g.right,b=S-g.top-g.bottom,w=z/h.length,N=w*.2,F=w-N*2,W=i?F:F/r.length;function D(A){return g.top+b-A/p*b}function M(A){return A/p*b}function L(A){return g.left+A*w+N}const I=Array.from({length:5},(A,k)=>k/4*p);return e.jsxs("div",{className:`w-full ${u}`,children:[e.jsxs("svg",{width:o?m:"100%",height:S,viewBox:`0 0 ${m} ${S}`,onMouseLeave:()=>y(null),children:[n&&I.map((A,k)=>e.jsx("line",{x1:g.left,y1:D(A),x2:m-g.right,y2:D(A),stroke:"var(--border)",strokeWidth:.5,strokeDasharray:"4 2"},k)),s&&I.map((A,k)=>e.jsx("text",{x:g.left-8,y:D(A)+4,textAnchor:"end",fill:"var(--muted-foreground)",style:ne,children:A>=1e3?`${(A/1e3).toFixed(1)}k`:A},k)),a&&h.map((A,k)=>e.jsx("text",{x:L(k)+F/2,y:S-g.bottom+16,textAnchor:"middle",fill:"var(--muted-foreground)",style:ne,children:A},k)),h.map((A,k)=>{if(i){let $=g.top+b;return e.jsx("g",{children:r.map((E,T)=>{var q;const P=((q=E.data[k])==null?void 0:q.value)??0,B=M(P),_=$-B;$=_;const K=ie(E,T),R=T===r.length-1,te=T===0,oe=f,Q=L(k),ee=F,Y=B,H=R&&te?`M${Q},${_+oe} Q${Q},${_} ${Q+oe},${_} L${Q+ee-oe},${_} Q${Q+ee},${_} ${Q+ee},${_+oe} L${Q+ee},${_+Y} L${Q},${_+Y} Z`:R?`M${Q},${_+oe} Q${Q},${_} ${Q+oe},${_} L${Q+ee-oe},${_} Q${Q+ee},${_} ${Q+ee},${_+oe} L${Q+ee},${_+Y} L${Q},${_+Y} Z`:`M${Q},${_} L${Q+ee},${_} L${Q+ee},${_+Y} L${Q},${_+Y} Z`;return e.jsx("path",{d:H,fill:K},T)})},k)}else return e.jsx("g",{children:r.map(($,E)=>{var te;const T=((te=$.data[k])==null?void 0:te.value)??0,P=M(T),B=L(k)+E*W,_=D(T),K=ie($,E),R=Math.min(f,W/2);return e.jsx("path",{d:`M${B},${_+R} Q${B},${_} ${B+R},${_} L${B+W-R},${_} Q${B+W},${_} ${B+W},${_+R} L${B+W},${_+P} L${B},${_+P} Z`,fill:K},E)})},k)}),d&&h.map((A,k)=>e.jsx("rect",{x:L(k),y:g.top,width:F,height:b,fill:"transparent",style:{cursor:"default"},onMouseEnter:()=>y({x:L(k)+F/2,y:g.top,labelIdx:k})},k)),x&&e.jsx(ur,{x:fr(x.x+8,g.left,m-180),y:g.top,label:h[x.labelIdx],items:r.map((A,k)=>{var $;return{name:A.name,value:(($=A.data[x.labelIdx])==null?void 0:$.value)??0,color:ie(A,k)}})})]}),l&&r.length>1&&e.jsx("div",{className:"flex flex-wrap gap-4 mt-2 justify-center",children:r.map((A,k)=>e.jsxs("div",{className:"flex items-center gap-1.5",style:ne,children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:ie(A,k)}}),e.jsx("span",{className:"text-muted-foreground",children:A.name})]},k))})]})}Dt.displayName="BarChart";function At({data:r,size:t=200,innerRatio:o=.6,centerLabel:a,centerValue:s,showLegend:n=!0,showTooltip:l=!0,className:d=""}){const[i,f]=c.useState(null),u=r.reduce((b,w)=>b+w.value,0);if(u===0||r.length===0)return null;const x=t/2,y=t/2,h=t/2-4,p=h*o;let g=-Math.PI/2;const m=r.map((b,w)=>{const N=b.value/u,F=g,W=g+N*2*Math.PI;g=W;const D=x+h*Math.cos(F),M=y+h*Math.sin(F),L=x+h*Math.cos(W),I=y+h*Math.sin(W),A=x+p*Math.cos(W),k=y+p*Math.sin(W),$=x+p*Math.cos(F),E=y+p*Math.sin(F),T=N>.5?1:0;return{path:[`M${D},${M}`,`A${h},${h} 0 ${T} 1 ${L},${I}`,`L${A},${k}`,`A${p},${p} 0 ${T} 0 ${$},${E}`,"Z"].join(" "),color:b.color??we[w%we.length],ratio:N,d:b,i:w}}),S=s??u.toLocaleString(),z=i!==null?r[i]:null;return e.jsxs("div",{className:`flex items-center gap-6 ${d}`,children:[e.jsx("div",{className:"relative flex-shrink-0",children:e.jsxs("svg",{width:t,height:t,viewBox:`0 0 ${t} ${t}`,children:[m.map(b=>e.jsx("path",{d:b.path,fill:b.color,opacity:i===null||i===b.i?1:.4,style:{transition:"opacity 0.15s"},onMouseEnter:()=>f(b.i),onMouseLeave:()=>f(null)},b.i)),o>0&&e.jsxs(e.Fragment,{children:[e.jsx("text",{x,y:y-6,textAnchor:"middle",fill:"var(--foreground)",style:{...ne,fontWeight:"700",fontSize:"18px"},children:z?z.value.toLocaleString():S}),(a||z)&&e.jsx("text",{x,y:y+12,textAnchor:"middle",fill:"var(--muted-foreground)",style:{...ne,fontSize:"12px"},children:z?z.label:a})]})]})}),n&&e.jsx("div",{className:"flex flex-col gap-2",children:r.map((b,w)=>e.jsxs("div",{className:"flex items-center gap-2 cursor-default",style:ne,onMouseEnter:()=>f(w),onMouseLeave:()=>f(null),children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:b.color??we[w%we.length]}}),e.jsx("span",{className:"text-foreground",children:b.label}),e.jsxs("span",{className:"text-muted-foreground ml-auto pl-4",children:[(b.value/u*100).toFixed(1),"%"]})]},w))})]})}At.displayName="DonutChart";function jt({values:r,type:t="line",width:o=80,height:a=32,color:s,showValue:n=!1,trend:l,className:d=""}){if(!r.length)return null;const i=Math.min(...r),u=Math.max(...r)-i||1,x=r[r.length-1]>r[0]?"up":r[r.length-1]<r[0]?"down":"neutral",y=l??x,p=s??(y==="up"?"var(--chart-1, #22c55e)":y==="down"?"var(--chart-4, #ef4444)":"var(--muted-foreground)"),g=2,m=o-g*2,S=a-g*2;function z(W){return g+W/(r.length-1||1)*m}function b(W){return g+S-(W-i)/u*S}if(t==="bar"){const W=m/r.length-1;return e.jsxs("div",{className:`inline-flex items-center gap-1.5 ${d}`,children:[e.jsx("svg",{width:o,height:a,viewBox:`0 0 ${o} ${a}`,children:r.map((D,M)=>{const L=(D-i)/u*S;return e.jsx("rect",{x:g+M*(m/r.length),y:g+S-L,width:W,height:L,fill:p,rx:1,opacity:M===r.length-1?1:.5},M)})}),n&&e.jsx("span",{style:{...ne,color:p},children:r[r.length-1].toLocaleString()})]})}const w=r.map((W,D)=>[z(D),b(W)]),N=hr(w,!1),F=N+` L${w[w.length-1][0]},${g+S} L${w[0][0]},${g+S} Z`;return e.jsxs("div",{className:`inline-flex items-center gap-1.5 ${d}`,children:[e.jsxs("svg",{width:o,height:a,viewBox:`0 0 ${o} ${a}`,children:[t==="area"&&e.jsx("path",{d:F,fill:p,fillOpacity:.15}),e.jsx("path",{d:N,fill:"none",stroke:p,strokeWidth:1.5,strokeLinecap:"round"}),e.jsx("circle",{cx:w[w.length-1][0],cy:w[w.length-1][1],r:2,fill:p})]}),n&&e.jsx("span",{style:{...ne,color:p},children:r[r.length-1].toLocaleString()})]})}jt.displayName="MiniSparkline";function be(r){const t=new Date(r);return t.setHours(0,0,0,0),t}function ge(r){const t=new Date(r);return t.setHours(23,59,59,999),t}const Ls=[{label:"Today",value:"today",range:()=>{const r=new Date;return{from:be(r),to:ge(r)}}},{label:"Yesterday",value:"yesterday",range:()=>{const r=new Date;return r.setDate(r.getDate()-1),{from:be(r),to:ge(r)}}},{label:"Last 7 days",value:"last7",range:()=>{const r=new Date,t=new Date;return t.setDate(t.getDate()-6),{from:be(t),to:ge(r)}}},{label:"Last 30 days",value:"last30",range:()=>{const r=new Date,t=new Date;return t.setDate(t.getDate()-29),{from:be(t),to:ge(r)}}},{label:"This month",value:"thisMonth",range:()=>{const r=new Date,t=new Date(r.getFullYear(),r.getMonth(),1),o=new Date(r.getFullYear(),r.getMonth()+1,0);return{from:be(t),to:ge(o)}}},{label:"Last month",value:"lastMonth",range:()=>{const r=new Date,t=new Date(r.getFullYear(),r.getMonth()-1,1),o=new Date(r.getFullYear(),r.getMonth(),0);return{from:be(t),to:ge(o)}}},{label:"Custom range",value:"custom",range:()=>({from:null,to:null})}],Ds=["January","February","March","April","May","June","July","August","September","October","November","December"],As=["Su","Mo","Tu","We","Th","Fr","Sa"];function br(r){return r?r.toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}):""}function gr(r,t){return r.getFullYear()===t.getFullYear()&&r.getMonth()===t.getMonth()&&r.getDate()===t.getDate()}function js(r,t){const o=[],a=new Date(r,t,1),s=new Date(a);s.setDate(s.getDate()-s.getDay());for(let n=0;n<42;n++)o.push(new Date(s)),s.setDate(s.getDate()+1);return o}const Es={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-p)"},Et={fontFamily:"var(--font-label)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-label)"},Tt={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},Ts={sm:"h-8 px-3 text-sm",md:"h-10 px-3.5",lg:"h-11 px-4"};function It({month:r,year:t,range:o,hovered:a,onHover:s,onSelect:n,onPrevMonth:l,onNextMonth:d,minDate:i,maxDate:f}){const u=js(t,r);function x(h){const p=o.from,g=o.to??a;if(!p||!g)return!1;const[m,S]=p<=g?[p,g]:[g,p];return h>m&&h<S}function y(h){return!!(i&&h<be(i)||f&&h>ge(f))}return e.jsxs("div",{className:"select-none flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("button",{type:"button",onClick:l,className:"w-7 h-7 flex items-center justify-center rounded-[var(--radius-md)] hover:bg-muted/40 text-muted-foreground cursor-pointer",children:e.jsx(v.ChevronLeft,{size:14})}),e.jsxs("span",{className:"text-foreground",style:Tt,children:[Ds[r]," ",t]}),e.jsx("button",{type:"button",onClick:d,className:"w-7 h-7 flex items-center justify-center rounded-[var(--radius-md)] hover:bg-muted/40 text-muted-foreground cursor-pointer",children:e.jsx(v.ChevronRight,{size:14})})]}),e.jsx("div",{className:"grid grid-cols-7 mb-1",children:As.map(h=>e.jsx("div",{className:"h-8 flex items-center justify-center text-muted-foreground",style:Et,children:h},h))}),e.jsx("div",{className:"grid grid-cols-7",children:u.map((h,p)=>{const g=h.getMonth()===r,m=o.from?gr(h,o.from):!1,S=o.to?gr(h,o.to):a&&o.from?gr(h,a):!1,z=x(h),b=y(h);return e.jsx("button",{type:"button",disabled:b,onMouseEnter:()=>!b&&s(h),onMouseLeave:()=>s(null),onClick:()=>!b&&n(h),className:["h-8 w-full flex items-center justify-center text-center transition-colors",b?"opacity-30 cursor-not-allowed":"cursor-pointer",g?"":"text-muted-foreground/40",m||S?"bg-primary text-primary-foreground rounded-[var(--radius-md)] font-semibold":z?"bg-primary/10 text-primary":b?"":"hover:bg-muted/40 rounded-[var(--radius-md)]"].filter(Boolean).join(" "),style:Et,children:h.getDate()},p)})})]})}function Bt({value:r,onChange:t,presets:o=["today","last7","last30","custom"],placeholder:a="Select date range",size:s="md",minDate:n,maxDate:l,clearable:d=!0,disabled:i=!1,className:f=""}){const u=new Date,[x,y]=c.useState(!1),[h,p]=c.useState({from:null,to:null}),[g,m]=c.useState(null),[S,z]=c.useState(void 0),[b,w]=c.useState(u.getMonth()),[N,F]=c.useState(u.getFullYear()),[W,D]=c.useState("from"),M=c.useRef(null),L=r??h,I=(b+1)%12,A=b===11?N+1:N;c.useEffect(()=>{function B(_){M.current&&!M.current.contains(_.target)&&y(!1)}return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);function k(B){if(B.value==="custom"){z("custom");return}const _=B.range();p(_),t==null||t(_,B.value),z(B.value),y(!1)}function $(B){if(W==="from")p({from:be(B),to:null}),D("to");else{const _=h.from,[K,R]=B>=_?[_,ge(B)]:[be(B),ge(_)],te={from:K,to:R};p(te),t==null||t(te,"custom"),z("custom"),D("from"),y(!1)}}function E(B){B.stopPropagation();const _={from:null,to:null};p(_),t==null||t(_,void 0),z(void 0)}const T=L.from&&L.to?`${br(L.from)} – ${br(L.to)}`:L.from?`${br(L.from)} – ...`:"",P=Ls.filter(B=>o.includes(B.value));return e.jsxs("div",{ref:M,className:`relative inline-block ${f}`,children:[e.jsxs("button",{type:"button",disabled:i,onClick:()=>!i&&y(!x),className:["flex items-center gap-2 border border-border bg-card text-left rounded-[var(--radius-md)] transition-colors w-full min-w-[260px]",Ts[s],x?"border-primary ring-2 ring-primary/20":"hover:border-primary/40",i?"opacity-50 cursor-not-allowed":"cursor-pointer"].join(" "),style:Es,children:[e.jsx(v.Calendar,{size:14,className:"text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:T?"text-foreground flex-1":"text-muted-foreground flex-1",children:T||a}),d&&L.from&&e.jsx("span",{role:"button",tabIndex:0,onClick:E,onKeyDown:B=>B.key==="Enter"&&E(B),className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer flex-shrink-0",children:e.jsx(v.X,{size:12})})]}),x&&e.jsxs("div",{className:"absolute top-full mt-1 z-50 bg-card border border-border rounded-[var(--radius-md)] shadow-[0_4px_24px_0_rgba(0,0,0,0.1)] flex overflow-y-auto",style:{minWidth:"620px",maxHeight:"calc(100vh - 120px)"},children:[e.jsx("div",{className:"w-36 border-r border-border py-2 flex flex-col gap-0.5 flex-shrink-0",children:P.map(B=>e.jsx("button",{type:"button",onClick:()=>k(B),className:["w-full text-left px-3 py-1.5 rounded-none transition-colors",S===B.value?"bg-primary/10 text-primary":"text-foreground hover:bg-muted/30"].join(" "),style:Tt,children:B.label},B.value))}),e.jsxs("div",{className:"flex gap-4 p-4 flex-1 min-w-0",children:[e.jsx(It,{month:b,year:N,range:L,hovered:g,onHover:m,onSelect:$,onPrevMonth:()=>{b===0?(w(11),F(N-1)):w(b-1)},onNextMonth:()=>{b===11?(w(0),F(N+1)):w(b+1)},minDate:n,maxDate:l}),e.jsx("div",{className:"w-px bg-border"}),e.jsx(It,{month:I,year:A,range:L,hovered:g,onHover:m,onSelect:$,onPrevMonth:()=>{b===0?(w(11),F(N-1)):w(b-1)},onNextMonth:()=>{b===11?(w(0),F(N+1)):w(b+1)},minDate:n,maxDate:l})]})]})]})}Bt.displayName="DateRangePicker";function fe(r){return String(r).padStart(2,"0")}function _t(r,t,o){if(t==="12h"){const a=r.hours%12||12,s=r.hours<12?"AM":"PM";return o?`${fe(a)}:${fe(r.minutes)}:${fe(r.seconds??0)} ${s}`:`${fe(a)}:${fe(r.minutes)} ${s}`}return o?`${fe(r.hours)}:${fe(r.minutes)}:${fe(r.seconds??0)}`:`${fe(r.hours)}:${fe(r.minutes)}`}const Ht={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-p)"},_e={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)",fontVariantNumeric:"tabular-nums"},Pt={sm:"h-8 px-3",md:"h-10 px-3.5",lg:"h-11 px-4"};function He({options:r,value:t,onChange:o,label:a}){const s=r.indexOf(t);return e.jsxs("div",{className:"flex flex-col items-center gap-1 w-12",children:[e.jsx("button",{type:"button",onClick:()=>{const n=r[(s-1+r.length)%r.length];o(n)},className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:e.jsx(v.ChevronUp,{size:14})}),e.jsx("div",{className:"text-foreground w-full text-center px-1 py-1 rounded-[var(--radius-md)] bg-muted/20",style:_e,children:fe(t)}),e.jsx("button",{type:"button",onClick:()=>{const n=r[(s+1)%r.length];o(n)},className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:e.jsx(v.ChevronDown,{size:14})}),e.jsx("span",{className:"text-muted-foreground",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-caption)"},children:a})]})}function pr({value:r,onChange:t,format:o="24h",showSeconds:a=!1,minuteStep:s=1,placeholder:n="Select time",size:l="md",disabled:d=!1,className:i=""}){const[f,u]=c.useState(!1),[x,y]=c.useState({hours:0,minutes:0,seconds:0}),h=c.useRef(null),p=r??x,g=o==="12h"?Array.from({length:12},(M,L)=>L+1):Array.from({length:24},(M,L)=>L),m=Array.from({length:Math.ceil(60/s)},(M,L)=>L*s),S=Array.from({length:60},(M,L)=>L),z=["AM","PM"];c.useEffect(()=>{function M(L){h.current&&!h.current.contains(L.target)&&u(!1)}return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[]);function b(M){const L={...p,...M};y(L),t==null||t(L)}const w=_t(p,o,a),N=r!==void 0||x.hours!==0||x.minutes!==0,F=o==="12h"?p.hours%12||12:p.hours,W=p.hours<12;function D(M,L){let I=M%12;L||(I+=12),b({hours:I})}return e.jsxs("div",{ref:h,className:`relative inline-block ${i}`,children:[e.jsxs("button",{type:"button",disabled:d,onClick:()=>!d&&u(!f),className:["flex items-center gap-2 border border-border bg-card rounded-[var(--radius-md)] transition-colors min-w-[120px]",Pt[l],f?"border-primary ring-2 ring-primary/20":"hover:border-primary/40",d?"opacity-50 cursor-not-allowed":"cursor-pointer"].join(" "),style:Ht,children:[e.jsx(v.Clock,{size:14,className:"text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:N?"text-foreground":"text-muted-foreground",children:N?w:n})]}),f&&e.jsx("div",{className:"absolute top-full mt-1 z-50 bg-card border border-border rounded-[var(--radius-md)] shadow-[0_4px_24px_0_rgba(0,0,0,0.1)] p-4",children:e.jsxs("div",{className:"flex items-start gap-2",children:[o==="12h"?e.jsx(He,{options:g,value:F,onChange:M=>D(M,W),label:"Hour"}):e.jsx(He,{options:g,value:p.hours,onChange:M=>b({hours:M}),label:"Hour"}),e.jsx("div",{className:"text-muted-foreground text-lg mt-3",style:_e,children:":"}),e.jsx(He,{options:m,value:p.minutes,onChange:M=>b({minutes:M}),label:"Min"}),a&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-muted-foreground text-lg mt-3",style:_e,children:":"}),e.jsx(He,{options:S,value:p.seconds??0,onChange:M=>b({seconds:M}),label:"Sec"})]}),o==="12h"&&e.jsxs("div",{className:"flex flex-col gap-1 ml-1",children:[e.jsx("div",{className:"h-5"}),z.map(M=>e.jsx("button",{type:"button",onClick:()=>D(F,M==="AM"),className:["px-2 py-1 rounded-[var(--radius-md)] transition-colors",M==="AM"===W?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted/30 cursor-pointer"].join(" "),style:_e,children:M},M))]})]})})]})}pr.displayName="TimePicker";function Ot({value:r,onChange:t,format:o="24h",showSeconds:a=!1,placeholder:s="Select date & time",size:n="md",minDate:l,maxDate:d,disabled:i=!1,className:f=""}){const[u,x]=c.useState(!1),[y,h]=c.useState(r??new Date),p=c.useRef(null),g=r??y,m=new Date,[S,z]=c.useState(g.getMonth()),[b,w]=c.useState(g.getFullYear());c.useEffect(()=>{function $(E){p.current&&!p.current.contains(E.target)&&x(!1)}return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[]);function N($){h($),t==null||t($)}function F($){const E=new Date($);E.setHours(g.getHours(),g.getMinutes(),g.getSeconds(),0),N(E)}function W($){const E=new Date(g);E.setHours($.hours,$.minutes,$.seconds??0,0),N(E)}const D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],M=["Su","Mo","Tu","We","Th","Fr","Sa"];function L(){const $=[],E=new Date(b,S,1),T=new Date(E);T.setDate(T.getDate()-T.getDay());for(let P=0;P<42;P++)$.push(new Date(T)),T.setDate(T.getDate()+1);return $}const I={fontFamily:"var(--font-label)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-label)"},A={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},k=`${g.toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"})} ${_t({hours:g.getHours(),minutes:g.getMinutes(),seconds:g.getSeconds()},o,a)}`;return e.jsxs("div",{ref:p,className:`relative inline-block ${f}`,children:[e.jsxs("button",{type:"button",disabled:i,onClick:()=>!i&&x(!u),className:["flex items-center gap-2 border border-border bg-card rounded-[var(--radius-md)] transition-colors min-w-[200px]",Pt[n],u?"border-primary ring-2 ring-primary/20":"hover:border-primary/40",i?"opacity-50 cursor-not-allowed":"cursor-pointer"].join(" "),style:Ht,children:[e.jsx(v.Clock,{size:14,className:"text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-foreground",children:k})]}),u&&e.jsxs("div",{className:"absolute top-full mt-1 z-50 bg-card border border-border rounded-[var(--radius-md)] shadow-[0_4px_24px_0_rgba(0,0,0,0.1)] p-4 flex gap-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("button",{type:"button",onClick:()=>{S===0?(z(11),w(b-1)):z(S-1)},className:"w-7 h-7 flex items-center justify-center rounded-[var(--radius-md)] hover:bg-muted/40 text-muted-foreground cursor-pointer",children:e.jsx(v.ChevronLeft,{size:14})}),e.jsxs("span",{style:A,children:[D[S]," ",b]}),e.jsx("button",{type:"button",onClick:()=>{S===11?(z(0),w(b+1)):z(S+1)},className:"w-7 h-7 flex items-center justify-center rounded-[var(--radius-md)] hover:bg-muted/40 text-muted-foreground cursor-pointer",children:e.jsx(v.ChevronRight,{size:14})})]}),e.jsx("div",{className:"grid grid-cols-7 mb-1",children:M.map($=>e.jsx("div",{className:"text-center text-muted-foreground",style:I,children:$},$))}),e.jsx("div",{className:"grid grid-cols-7 gap-y-0.5",children:L().map(($,E)=>{const T=$.getMonth()===S,P=r?$.toDateString()===r.toDateString():$.toDateString()===y.toDateString(),B=$.toDateString()===m.toDateString();return e.jsx("button",{type:"button",onClick:()=>F($),className:["h-7 w-full text-center transition-colors rounded-[var(--radius-md)] cursor-pointer",T?"":"text-muted-foreground/40",P?"bg-primary text-primary-foreground font-semibold":B?"border border-primary text-primary":"hover:bg-muted/40"].filter(Boolean).join(" "),style:I,children:$.getDate()},E)})})]}),e.jsx("div",{className:"w-px bg-border"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-muted-foreground",style:I,children:"Time"}),e.jsx(pr,{value:{hours:g.getHours(),minutes:g.getMinutes(),seconds:g.getSeconds()},onChange:W,format:o,showSeconds:a,size:"sm"})]})]})]})}Ot.displayName="DateTimePicker";const Is={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},Bs={fontFamily:"var(--font-p)",fontSize:"var(--text-button)",fontWeight:"var(--weight-p)"},_s={fontFamily:"var(--font-label)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-button)"},Hs={sm:"p-3 gap-2.5 rounded-[var(--radius-md)]",md:"p-4 gap-3 rounded-[var(--radius-md)]",lg:"p-5 gap-4 rounded-[var(--radius-md)]"},Ps={sm:"w-8 h-8 rounded-[var(--radius-sm)] text-sm",md:"w-10 h-10 rounded-[var(--radius-md)] text-base",lg:"w-12 h-12 rounded-[var(--radius-md)] text-lg"};function Yt({value:r,title:t,description:o,icon:a,badge:s,selected:n=!1,disabled:l=!1,showArrow:d=!0,showCheck:i=!1,size:f="md",layout:u="horizontal",onClick:x,className:y=""}){const h=u==="vertical";return e.jsxs("button",{type:"button",disabled:l,onClick:()=>!l&&(x==null?void 0:x(r)),className:["w-full text-left border transition-all duration-150",Hs[f],h?"flex flex-col items-center text-center":"flex items-center",n?"border-primary bg-primary/5 shadow-[0_0_0_1px_var(--primary)]":"border-border bg-card hover:border-primary/40 hover:bg-muted/20",l?"opacity-50 cursor-not-allowed":"cursor-pointer",y].filter(Boolean).join(" "),"aria-pressed":n,children:[a&&e.jsx("div",{className:[Ps[f],"flex items-center justify-center flex-shrink-0",n?"bg-primary/10 text-primary":"bg-muted/40 text-muted-foreground"].join(" "),children:a}),e.jsxs("div",{className:`flex-1 ${h?"mt-2":"min-w-0"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-foreground",style:Is,children:t}),s&&e.jsx("span",{className:"px-1.5 py-0.5 rounded-full bg-primary/10 text-primary",style:_s,children:s})]}),o&&e.jsx("p",{className:"text-muted-foreground mt-0.5 truncate",style:Bs,children:o})]}),!h&&e.jsx("div",{className:"flex-shrink-0 ml-auto pl-2",children:i&&n?e.jsx("span",{className:"w-5 h-5 rounded-full bg-primary text-primary-foreground flex items-center justify-center",children:e.jsx(v.Check,{size:12})}):d?e.jsx(v.ChevronRight,{size:16,className:n?"text-primary":"text-muted-foreground"}):null}),h&&n&&e.jsx("div",{className:"mt-2 w-5 h-5 rounded-full bg-primary text-primary-foreground flex items-center justify-center",children:e.jsx(v.Check,{size:12})})]})}Yt.displayName="ChoiceCard";function Gt({value:r,onChange:t,layout:o="horizontal",size:a="md",children:s,className:n=""}){return e.jsx("div",{className:["grid gap-3",o==="vertical"?"grid-cols-2 sm:grid-cols-3":"grid-cols-1",n].join(" "),role:"group",children:c.Children.map(s,l=>c.isValidElement(l)?c.cloneElement(l,{selected:r===l.props.value,onClick:d=>t==null?void 0:t(d),layout:o,size:a}):l)})}Gt.displayName="ChoiceCardGroup";const Os={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},Ys={fontFamily:"var(--font-p)",fontSize:"var(--text-button)",fontWeight:"var(--weight-p)"},Gs={fontFamily:"var(--font-label)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-button)"},Us={sm:"p-3",md:"p-4",lg:"p-5"},Xs={sm:"w-8 h-8",md:"w-10 h-10",lg:"w-12 h-12"},Ks={1:"grid-cols-1",2:"grid-cols-1 sm:grid-cols-2",3:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",4:"grid-cols-2 lg:grid-cols-4"};function Ut({options:r,value:t,onChange:o,columns:a=2,layout:s="grid",size:n="md",name:l,className:d=""}){const i=l??`radio-card-${Math.random().toString(36).slice(2,7)}`;return e.jsx("div",{className:[s==="grid"?`grid gap-3 ${Ks[a]}`:"flex flex-col gap-2",d].join(" "),role:"radiogroup",children:r.map(f=>{const u=t===f.value,x=f.disabled??!1;return e.jsxs("label",{className:["relative flex items-start gap-3 border rounded-[var(--radius-md)] cursor-pointer transition-all duration-150",Us[n],u?"border-primary bg-primary/5 shadow-[0_0_0_1px_var(--primary)]":"border-border bg-card hover:border-primary/40 hover:bg-muted/10",x?"opacity-50 cursor-not-allowed":""].filter(Boolean).join(" "),children:[e.jsx("input",{type:"radio",name:i,value:f.value,checked:u,disabled:x,onChange:()=>!x&&(o==null?void 0:o(f.value)),className:"sr-only"}),e.jsx("div",{className:["flex-shrink-0 mt-0.5 w-4 h-4 rounded-full border-2 flex items-center justify-center transition-colors",u?"border-primary bg-primary":"border-border bg-transparent"].join(" "),children:u&&e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-primary-foreground"})}),f.icon&&e.jsx("div",{className:[Xs[n],"flex-shrink-0 flex items-center justify-center rounded-[var(--radius-md)]",u?"bg-primary/10 text-primary":"bg-muted/40 text-muted-foreground"].join(" "),children:f.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-foreground",style:Os,children:f.title}),f.badge&&e.jsx("span",{className:"px-1.5 py-0.5 rounded-full bg-primary/10 text-primary",style:Gs,children:f.badge})]}),f.description&&e.jsx("p",{className:"text-muted-foreground mt-0.5",style:Ys,children:f.description})]})]},f.value)})})}Ut.displayName="RadioCard";function Zs(){return Math.random().toString(36).slice(2,9)}function qs(r={}){return{id:Zs(),values:{...r}}}const Js={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},Xt={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};function Kt({columns:r,value:t,onChange:o,defaultRow:a={},minRows:s=0,maxRows:n,addLabel:l="Add row",sortable:d=!1,disabled:i=!1,className:f=""}){const[u,x]=c.useState(()=>t??[]),y=t??u,h=N=>{x(N),o==null||o(N)},p=()=>{n!==void 0&&y.length>=n||h([...y,qs(a)])},g=N=>{y.length<=s||h(y.filter(F=>F.id!==N))},m=(N,F,W)=>{h(y.map(D=>D.id===N?{...D,values:{...D.values,[F]:W}}:D))},S=(N,F)=>{const W=[...y],[D]=W.splice(N,1);W.splice(F,0,D),h(W)},z=y.length<=s,b=n!==void 0&&y.length>=n,w=c.useRef(null);return e.jsxs("div",{className:`space-y-2 ${f}`,children:[e.jsxs("div",{className:["flex items-center gap-2 px-3 text-muted-foreground",d?"pl-9":""].join(" "),children:[r.map(N=>e.jsx("div",{style:{width:N.width??"1fr",flex:N.width?"none":"1"},className:"min-w-0",children:e.jsx("span",{style:Js,children:N.label})},N.key)),e.jsx("div",{className:"w-8 flex-shrink-0"})]}),e.jsx("div",{className:"space-y-2",children:y.map((N,F)=>e.jsxs("div",{className:["flex items-center gap-2 p-2 rounded-[var(--radius-md)] border border-border bg-card transition-colors",i?"opacity-60":""].join(" "),draggable:d&&!i,onDragStart:()=>{w.current=F},onDragOver:W=>{W.preventDefault()},onDrop:()=>{w.current!==null&&w.current!==F&&(S(w.current,F),w.current=null)},children:[d&&e.jsx("div",{className:"cursor-grab text-muted-foreground/50 hover:text-muted-foreground flex-shrink-0",children:e.jsx(v.GripVertical,{size:14})}),r.map(W=>e.jsx("div",{style:{width:W.width??"1fr",flex:W.width?"none":"1"},className:"min-w-0",children:W.render(N.values[W.key],D=>m(N.id,W.key,D),F)},W.key)),e.jsx("button",{type:"button",disabled:i||z,onClick:()=>g(N.id),className:["flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-[var(--radius-md)] transition-colors",i||z?"text-muted-foreground/30 cursor-not-allowed":"text-muted-foreground hover:text-destructive hover:bg-destructive/10 cursor-pointer"].join(" "),"aria-label":"Remove row",children:e.jsx(v.Trash2,{size:14})})]},N.id))}),y.length===0&&e.jsx("div",{className:"text-center py-6 text-muted-foreground rounded-[var(--radius-md)] border border-dashed border-border",children:e.jsxs("span",{style:Xt,children:['No rows yet. Click "',l,'" to begin.']})}),!b&&e.jsxs("button",{type:"button",disabled:i,onClick:p,className:["flex items-center gap-1.5 px-3 py-1.5 rounded-[var(--radius-md)] border border-dashed border-primary/40 text-primary hover:bg-primary/5 transition-colors",i?"opacity-50 cursor-not-allowed":"cursor-pointer"].join(" "),style:Xt,children:[e.jsx(v.Plus,{size:14}),l]})]})}Kt.displayName="RepeatableFieldList";const Qs={history:[{cmd:"undo",icon:v.Undo,title:"Undo"},{cmd:"redo",icon:v.Redo,title:"Redo"}],format:[{cmd:"bold",icon:v.Bold,title:"Bold"},{cmd:"italic",icon:v.Italic,title:"Italic"},{cmd:"underline",icon:v.Underline,title:"Underline"},{cmd:"strikethrough",icon:v.Strikethrough,title:"Strikethrough"}],list:[{cmd:"insertUnorderedList",icon:v.List,title:"Bullet list"},{cmd:"insertOrderedList",icon:v.ListOrdered,title:"Numbered list"}],align:[{cmd:"justifyLeft",icon:v.AlignLeft,title:"Align left"},{cmd:"justifyCenter",icon:v.AlignCenter,title:"Align center"},{cmd:"justifyRight",icon:v.AlignRight,title:"Align right"}],block:[{cmd:"formatBlock-h2",icon:v.Heading2,title:"Heading 2"},{cmd:"formatBlock-blockquote",icon:v.Quote,title:"Blockquote"},{cmd:"formatBlock-pre",icon:v.Code,title:"Code block"}],link:[{cmd:"createLink",icon:v.Link,title:"Insert link"},{cmd:"unlink",icon:v.Unlink,title:"Remove link"}]},Vs={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-p)"},Rs={fontFamily:"var(--font-p)",fontSize:"var(--text-p)",fontWeight:"var(--weight-p)",lineHeight:"1.6",color:"var(--foreground)"};function Zt({value:r="",onChange:t,placeholder:o="Start typing…",minHeight:a=160,maxHeight:s=480,toolbar:n=["history","format","list","align","link","block"],fullscreen:l=!0,disabled:d=!1,readOnly:i=!1,size:f="md",className:u=""}){const x=c.useRef(null),[y,h]=c.useState(!1),[p,g]=c.useState(new Set),[m,S]=c.useState(!r);c.useEffect(()=>{x.current&&r&&x.current.innerHTML!==r&&(x.current.innerHTML=r,S(!1))},[]);const z=c.useCallback(()=>{const D=new Set;["bold","italic","underline","strikethrough","insertUnorderedList","insertOrderedList","justifyLeft","justifyCenter","justifyRight"].forEach(M=>{try{document.queryCommandState(M)&&D.add(M)}catch{}}),g(D)},[]);function b(D){var M;if(!(d||i)){if((M=x.current)==null||M.focus(),D.startsWith("formatBlock-")){const L=D.replace("formatBlock-","");document.execCommand("formatBlock",!1,L)}else if(D==="createLink"){const L=window.prompt("Enter URL:");L&&document.execCommand("createLink",!1,L)}else document.execCommand(D,!1);z(),x.current&&t&&t(x.current.innerHTML)}}function w(){if(x.current){const D=x.current.innerHTML,M=x.current.innerText.trim();S(!M),t==null||t(D),z()}}const F=a??{sm:120,md:160,lg:240}[f],W=["border border-border rounded-[var(--radius-md)] bg-card overflow-hidden transition-all",y?"fixed inset-4 z-[var(--z-modal)] flex flex-col shadow-[0_8px_48px_rgba(0,0,0,0.2)]":"relative",d?"opacity-60":"",u].filter(Boolean).join(" ");return e.jsxs("div",{className:W,children:[!i&&e.jsxs("div",{className:"flex items-center gap-0.5 flex-wrap px-2 py-1.5 border-b border-border bg-muted/10",children:[n.map((D,M)=>{const L=Qs[D];return e.jsxs(c.Fragment,{children:[M>0&&e.jsx("div",{className:"w-px h-5 bg-border mx-1"}),L.map(I=>{const A=I.icon,k=p.has(I.cmd);return e.jsx("button",{type:"button",title:I.title,disabled:d,onMouseDown:$=>{$.preventDefault(),b(I.cmd)},className:["w-7 h-7 flex items-center justify-center rounded-[var(--radius-sm)] transition-colors",k?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-muted/40 hover:text-foreground",d?"cursor-not-allowed":"cursor-pointer"].join(" "),children:e.jsx(A,{size:13})},I.cmd)})]},D)}),l&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ml-auto w-px h-5 bg-border mx-1"}),e.jsx("button",{type:"button",title:y?"Exit fullscreen":"Fullscreen",onClick:()=>h(!y),className:"w-7 h-7 flex items-center justify-center rounded-[var(--radius-sm)] text-muted-foreground hover:bg-muted/40 hover:text-foreground transition-colors cursor-pointer",children:y?e.jsx(v.Minimize2,{size:13}):e.jsx(v.Maximize2,{size:13})})]})]}),e.jsxs("div",{className:"relative flex-1",children:[m&&e.jsx("div",{className:"absolute top-0 left-0 pointer-events-none p-4 text-muted-foreground",style:Vs,children:o}),e.jsx("div",{ref:x,contentEditable:!d&&!i,suppressContentEditableWarning:!0,onInput:w,onKeyUp:z,onMouseUp:z,className:["outline-none p-4 overflow-y-auto","prose-p:my-2 [&_h2]:text-xl [&_h2]:font-bold [&_h2]:my-3","[&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground","[&_pre]:bg-muted/30 [&_pre]:rounded [&_pre]:p-2 [&_pre]:text-sm","[&_a]:text-primary [&_a]:underline","[&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5",y?"flex-1":""].filter(Boolean).join(" "),style:{...Rs,minHeight:y?void 0:F,maxHeight:y?void 0:s},"data-placeholder":o})]})]})}Zt.displayName="RichTextEditor";const vr={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},Ne={fontFamily:"var(--font-label)",fontSize:"var(--text-caption)",fontWeight:"var(--weight-p)"},en={2:"grid-cols-2",3:"grid-cols-2 sm:grid-cols-3",4:"grid-cols-2 sm:grid-cols-3 lg:grid-cols-4",5:"grid-cols-2 sm:grid-cols-3 lg:grid-cols-5",6:"grid-cols-2 sm:grid-cols-4 lg:grid-cols-6"};function rn({images:r,startIdx:t,onClose:o}){const[a,s]=c.useState(t),n=r[a],l=()=>s(i=>(i-1+r.length)%r.length),d=()=>s(i=>(i+1)%r.length);return c.useEffect(()=>{function i(f){f.key==="Escape"&&o(),f.key==="ArrowLeft"&&l(),f.key==="ArrowRight"&&d()}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[]),e.jsxs("div",{className:"fixed inset-0 z-[var(--z-modal)] bg-black/90 flex items-center justify-center",onClick:o,children:[e.jsx("button",{type:"button",onClick:o,className:"absolute top-4 right-4 w-9 h-9 flex items-center justify-center rounded-full bg-white/10 hover:bg-white/20 text-white transition-colors cursor-pointer",children:e.jsx(v.X,{size:16})}),r.length>1&&e.jsx("button",{type:"button",onClick:i=>{i.stopPropagation(),l()},className:"absolute left-4 w-10 h-10 flex items-center justify-center rounded-full bg-white/10 hover:bg-white/20 text-white transition-colors cursor-pointer",children:e.jsx(v.ChevronLeft,{size:20})}),e.jsxs("div",{className:"max-w-4xl max-h-[80vh] px-16",onClick:i=>i.stopPropagation(),children:[e.jsx("img",{src:n.src,alt:n.alt??n.name,className:"max-w-full max-h-[70vh] object-contain rounded-[var(--radius-md)]"}),n.name&&e.jsxs("p",{className:"text-center text-white/70 mt-3",style:Ne,children:[n.name," ",n.size?`· ${n.size}`:""]}),r.length>1&&e.jsxs("p",{className:"text-center text-white/40 mt-1",style:Ne,children:[a+1," / ",r.length]})]}),r.length>1&&e.jsx("button",{type:"button",onClick:i=>{i.stopPropagation(),d()},className:"absolute right-4 w-10 h-10 flex items-center justify-center rounded-full bg-white/10 hover:bg-white/20 text-white transition-colors cursor-pointer",children:e.jsx(v.ChevronRight,{size:20})})]})}function mr({src:r,alt:t="",caption:o,subCaption:a,size:s="sm",onClick:n,className:l=""}){const d={xs:"w-8 h-8",sm:"w-10 h-10",md:"w-14 h-14"};return e.jsxs("div",{className:`flex items-center gap-2.5 ${n?"cursor-pointer":""} ${l}`,onClick:n,children:[e.jsx("div",{className:`${d[s]} flex-shrink-0 rounded-[var(--radius-md)] overflow-hidden bg-muted/20 border border-border`,children:e.jsx("img",{src:r,alt:t,className:"w-full h-full object-cover",onError:i=>{i.target.style.display="none"}})}),(o||a)&&e.jsxs("div",{className:"min-w-0",children:[o&&e.jsx("div",{className:"truncate text-foreground",style:vr,children:o}),a&&e.jsx("div",{className:"truncate text-muted-foreground",style:Ne,children:a})]})]})}mr.displayName="ThumbnailCell";function qt({images:r,selectable:t=!1,selectedIds:o=[],onSelectChange:a,maxSelect:s,lightbox:n=!0,uploadable:l=!1,onUpload:d,onDelete:i,defaultLayout:f="grid",columns:u=4,disabled:x=!1,className:y=""}){const[h,p]=c.useState(f),[g,m]=c.useState(null),S=c.useRef(null);function z(N){if(x)return;if(o.includes(N))a==null||a(o.filter(W=>W!==N));else{if(s&&o.length>=s)return;a==null||a([...o,N])}}function b(N,F){t?z(F):n&&m(N)}const w=c.useCallback(N=>{var F;(F=N.target.files)!=null&&F.length&&(d==null||d(N.target.files),N.target.value="")},[d]);return r.length===0&&!l?e.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground border border-dashed border-border rounded-[var(--radius-md)]",children:e.jsx("span",{style:vr,children:"No images yet"})}):e.jsxs("div",{className:y,children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("span",{className:"text-muted-foreground",style:Ne,children:[r.length," image",r.length!==1?"s":"",t&&o.length>0&&` · ${o.length} selected`]}),e.jsxs("div",{className:"flex items-center gap-1",children:[l&&e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:S,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:w}),e.jsxs("button",{type:"button",disabled:x,onClick:()=>{var N;return(N=S.current)==null?void 0:N.click()},className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-[var(--radius-md)] border border-border bg-card hover:bg-muted/20 text-foreground transition-colors cursor-pointer",style:Ne,children:[e.jsx(v.Upload,{size:12}),"Upload"]})]}),e.jsx("button",{type:"button",onClick:()=>p("grid"),className:`w-7 h-7 flex items-center justify-center rounded-[var(--radius-md)] transition-colors ${h==="grid"?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-muted/30"}`,children:e.jsx(v.Grid,{size:14})}),e.jsx("button",{type:"button",onClick:()=>p("list"),className:`w-7 h-7 flex items-center justify-center rounded-[var(--radius-md)] transition-colors ${h==="list"?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-muted/30"}`,children:e.jsx(v.List,{size:14})})]})]}),h==="grid"&&e.jsx("div",{className:`grid gap-2 ${en[u]}`,children:r.map((N,F)=>{const W=o.includes(N.id);return e.jsxs("div",{className:["relative group rounded-[var(--radius-md)] overflow-hidden border transition-all cursor-pointer",W?"border-primary shadow-[0_0_0_2px_var(--primary)]":"border-border hover:border-primary/40"].join(" "),onClick:()=>b(F,N.id),children:[e.jsx("div",{className:"aspect-square",children:e.jsx("img",{src:N.src,alt:N.alt??N.name,className:"w-full h-full object-cover"})}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors flex items-center justify-center",children:!t&&n&&e.jsx(v.ZoomIn,{size:20,className:"text-white opacity-0 group-hover:opacity-100 transition-opacity"})}),t&&e.jsx("div",{className:["absolute top-1.5 left-1.5 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all",W?"bg-primary border-primary":"bg-white/80 border-white"].join(" "),children:W&&e.jsx(v.Check,{size:10,className:"text-primary-foreground"})}),i&&e.jsx("button",{type:"button",onClick:D=>{D.stopPropagation(),i(N.id)},className:"absolute top-1.5 right-1.5 w-6 h-6 flex items-center justify-center rounded-full bg-black/60 text-white opacity-0 group-hover:opacity-100 transition-opacity hover:bg-destructive cursor-pointer",children:e.jsx(v.Trash2,{size:10})})]},N.id)})}),h==="list"&&e.jsx("div",{className:"space-y-1.5",children:r.map((N,F)=>{const W=o.includes(N.id);return e.jsxs("div",{className:["flex items-center gap-3 p-2.5 rounded-[var(--radius-md)] border transition-all cursor-pointer",W?"border-primary bg-primary/5":"border-border hover:bg-muted/10"].join(" "),onClick:()=>b(F,N.id),children:[e.jsx(mr,{src:N.src,alt:N.alt,size:"sm"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"truncate text-foreground",style:vr,children:N.name??N.alt??`Image ${F+1}`}),N.size&&e.jsx("div",{className:"text-muted-foreground",style:Ne,children:N.size})]}),t&&W&&e.jsx("div",{className:"w-5 h-5 rounded-full bg-primary flex items-center justify-center flex-shrink-0",children:e.jsx(v.Check,{size:10,className:"text-primary-foreground"})}),i&&e.jsx("button",{type:"button",onClick:D=>{D.stopPropagation(),i(N.id)},className:"w-7 h-7 flex items-center justify-center rounded-[var(--radius-md)] text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors cursor-pointer flex-shrink-0",children:e.jsx(v.Trash2,{size:13})})]},N.id)})}),g!==null&&e.jsx(rn,{images:r,startIdx:g,onClose:()=>m(null)})]})}qt.displayName="ImageGallery";const xr=c.createContext(null);xr.displayName="AppShellContext";const yr=c.createContext(null);yr.displayName="AppShellFullContext";function wr({user:r=null,product:t=null,navResolver:o,sidebarOpen:a,onSidebarChange:s,defaultSidebarOpen:n=!0,children:l}){const d=a!==void 0,[i,f]=c.useState(n),u=d?a:i,x=c.useCallback(w=>{d||f(w),s==null||s(w)},[d,s]),[y,h]=c.useState([]),p=c.useCallback(w=>{h(w)},[]),[g,m]=c.useState({groups:[],loading:!1,error:null}),S=c.useRef(0),z=c.useCallback(async()=>{if(!o||!r){m({groups:[],loading:!1,error:null});return}const w=++S.current;m(N=>({...N,loading:!0,error:null}));try{const N=await o(r);if(w!==S.current)return;m({groups:N,loading:!1,error:null})}catch(N){if(w!==S.current)return;m({groups:[],loading:!1,error:N instanceof Error?N.message:"Failed to load navigation"})}},[o,r]);c.useEffect(()=>{z()},[z]),c.useEffect(()=>{if(!(t!=null&&t.product))return;const w=document.documentElement.getAttribute("data-product");return document.documentElement.setAttribute("data-product",t.product),()=>{w?document.documentElement.setAttribute("data-product",w):document.documentElement.removeAttribute("data-product")}},[t==null?void 0:t.product]);const b=c.useMemo(()=>({sidebarOpen:u,setSidebarOpen:x,user:r,product:t,breadcrumbs:y,setBreadcrumbs:p,navGroups:g.groups,navLoading:g.loading,navError:g.error,refreshNav:z}),[u,x,r,t,y,p,g.groups,g.loading,g.error,z]);return e.jsx(yr.Provider,{value:b,children:e.jsx(xr.Provider,{value:b,children:l})})}wr.displayName="AppShellProvider";function Jt(){const r=c.useContext(xr);if(!r)throw new Error("[useAppShell] must be used inside <AppShellProvider>. Wrap your app root with <AppShellProvider user={...} product={...}>.");return r}function Qt(){const r=c.useContext(yr);if(!r)throw new Error("[useAppShellFull] must be used inside <AppShellProvider>.");return r}function tn(r){const{setBreadcrumbs:t}=Jt(),o=JSON.stringify(r);c.useEffect(()=>(t(r),()=>t([])),[o])}function on(r,t){const[o,a]=c.useState({groups:[],loading:!1,error:null}),s=c.useRef(0),n=c.useCallback(async()=>{if(!r||!t){a({groups:[],loading:!1,error:null});return}const l=++s.current;a(d=>({...d,loading:!0,error:null}));try{const d=await r(t);if(l!==s.current)return;a({groups:d,loading:!1,error:null})}catch(d){if(l!==s.current)return;a({groups:[],loading:!1,error:d instanceof Error?d.message:"Navigation load failed"})}},[r,t]);return c.useEffect(()=>{n()},[n]),{...o,refresh:n}}class Vt extends c.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,o){console.error("[AppShellErrorBoundary] Caught error:",t,o)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[200px] gap-3 p-6 text-center",role:"alert",children:[e.jsx("div",{className:"text-destructive",style:{fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},children:"Something went wrong in this section."}),e.jsx("button",{type:"button",onClick:()=>this.setState({hasError:!1}),className:"px-4 py-1.5 rounded-[var(--radius-md)] border border-border text-muted-foreground hover:bg-muted/20 transition-colors text-sm cursor-pointer",children:"Try again"})]}):this.props.children}}function J({children:r,className:t=""}){return r?e.jsx("div",{className:t,children:r}):null}function Rt({children:r}){return r?e.jsx("div",{className:"sticky bottom-0 left-0 right-0 z-[var(--z-sticky)] bg-card border-t border-border px-6 py-3 flex items-center justify-end gap-3",children:r}):null}function eo({p:r}){const t=r.gap??"gap-5";return e.jsxs("div",{className:`flex flex-col ${t}`,children:[e.jsx(J,{children:r.header}),e.jsx(J,{children:r.banner}),e.jsx(J,{children:r.stats}),e.jsx(J,{children:r.filters}),e.jsx(J,{className:"min-h-0",children:r.content}),e.jsx(J,{children:r.footer})]})}function an({p:r}){const t=r.gap??"gap-6",o=r.asideWidth??"w-80";return e.jsxs("div",{className:`flex flex-col ${t}`,children:[e.jsx(J,{children:r.header}),e.jsx(J,{children:r.banner}),e.jsxs("div",{className:`flex flex-col lg:flex-row ${t} min-h-0`,children:[r.asideLeft&&e.jsx("div",{className:`flex-shrink-0 ${o} lg:sticky lg:top-4 lg:max-h-[calc(100vh-5rem)] lg:overflow-y-auto`,children:r.aside}),e.jsx("div",{className:"flex-1 min-w-0 flex flex-col gap-5",children:r.main??r.content}),!r.asideLeft&&e.jsx("div",{className:`flex-shrink-0 ${o} lg:sticky lg:top-4 lg:max-h-[calc(100vh-5rem)] lg:overflow-y-auto`,children:r.aside})]})]})}function sn({p:r}){const t=r.gap??"gap-8";return e.jsxs("div",{className:`flex flex-col ${t} max-w-3xl`,children:[e.jsx(J,{children:r.header}),e.jsx(J,{children:r.banner}),e.jsx(J,{className:`flex flex-col ${t}`,children:r.sections??r.content})]})}function nn({p:r}){const t=r.gap??"gap-6";return e.jsxs("div",{className:"flex flex-col min-h-screen",children:[e.jsxs("div",{className:`flex flex-col ${t} flex-1 pb-24`,children:[e.jsx(J,{children:r.header}),e.jsx(J,{children:r.banner}),e.jsx(J,{children:r.stepper}),e.jsx(J,{className:"flex-1",children:r.form??r.content})]}),e.jsx(Rt,{children:r.actions})]})}function ln({p:r}){const t=r.gap??"gap-6",o=r.primaryChart&&r.secondaryCharts;return e.jsxs("div",{className:`flex flex-col ${t}`,children:[e.jsx(J,{children:r.header}),e.jsx(J,{children:r.banner}),e.jsx(J,{children:r.kpis??r.stats}),o?e.jsxs("div",{className:`grid grid-cols-1 lg:grid-cols-3 ${t}`,children:[e.jsx("div",{className:"lg:col-span-2",children:r.primaryChart}),e.jsx("div",{className:"flex flex-col gap-4",children:r.secondaryCharts})]}):e.jsxs(e.Fragment,{children:[e.jsx(J,{children:r.primaryChart??r.charts}),e.jsx(J,{children:r.secondaryCharts})]}),e.jsx(J,{children:r.content??r.table}),e.jsx(J,{children:r.footer})]})}function dn({p:r}){const t=r.gap??"gap-6";return e.jsxs("div",{className:"flex flex-col min-h-screen",children:[e.jsxs("div",{className:`flex flex-col ${t} flex-1 pb-24`,children:[e.jsx(J,{children:r.header}),e.jsx(J,{children:r.banner}),e.jsx(J,{className:"flex-1 max-w-2xl",children:r.form??r.content})]}),e.jsx(Rt,{children:r.actions})]})}function cn({p:r}){const t=r.gap??"gap-6";return e.jsxs("div",{className:`flex flex-col ${t}`,children:[e.jsx(J,{children:r.header}),e.jsx(J,{children:r.banner}),e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[r.stats&&e.jsx("div",{className:"flex-1",children:r.stats}),r.dateRange&&e.jsx("div",{className:"flex-shrink-0",children:r.dateRange})]}),e.jsx(J,{children:r.filters}),e.jsx(J,{children:r.charts??r.primaryChart}),r.secondaryCharts&&e.jsx("div",{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 ${t}`,children:r.secondaryCharts}),e.jsx(J,{children:r.table??r.content}),e.jsx(J,{children:r.footer})]})}function ro(r){const{layout:t="list",maxWidth:o,padding:a,className:s=""}=r,n=a??"p-4 sm:p-6",l=o?`${o} mx-auto w-full`:"w-full",d=(()=>{switch(t){case"list":return e.jsx(eo,{p:r});case"detail":return e.jsx(an,{p:r});case"settings":return e.jsx(sn,{p:r});case"wizard":return e.jsx(nn,{p:r});case"dashboard":return e.jsx(ln,{p:r});case"form":return e.jsx(dn,{p:r});case"report":return e.jsx(cn,{p:r});default:return e.jsx(eo,{p:r})}})();return e.jsx("div",{className:`${n} ${l} ${s}`,children:d})}ro.displayName="FeaturePageScaffold";const fn={fontFamily:"var(--font-label)",fontSize:"var(--text-h4)",fontWeight:"var(--weight-button)",color:"var(--foreground)"},hn={fontFamily:"var(--font-p)",fontSize:"var(--text-label)",fontWeight:"var(--weight-p)",color:"var(--muted-foreground)"};function to({title:r,description:t,action:o,children:a,className:s=""}){return e.jsxs("section",{className:`space-y-4 ${s}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{style:fn,children:r}),t&&e.jsx("p",{className:"mt-1",style:hn,children:t})]}),o&&e.jsx("div",{className:"flex-shrink-0",children:o})]}),e.jsx("div",{className:"border-t border-border pt-4",children:a})]})}to.displayName="ScaffoldSection";function oo({children:r,className:t=""}){return e.jsx("div",{className:`grid grid-cols-2 lg:grid-cols-4 gap-4 ${t}`,children:r})}oo.displayName="ScaffoldKPIRow";function un(r){return r.map(t=>({label:t.title??"",items:t.items.filter(o=>!o.disabled).map(o=>({id:o.id,label:o.label,icon:o.icon,badge:typeof o.badge=="function"?void 0:o.badge}))}))}function bn({activeItemId:r,onNavigate:t,notificationCount:o,onNotificationClick:a,onUserClick:s,onSearchClick:n,showSearch:l=!1,version:d,versionDate:i,contentPadding:f=!0,children:u,className:x=""}){var A,k,$,E;const{sidebarOpen:y,setSidebarOpen:h,user:p,product:g,breadcrumbs:m,navGroups:S,navLoading:z,navError:b,refreshNav:w}=Qt(),[N,F]=c.useState(!(((A=g==null?void 0:g.shell)==null?void 0:A.sidebarDefaultOpen)??!0)),[W,D]=c.useState(!1);c.useEffect(()=>{function T(){window.innerWidth>=768&&D(!1)}return window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)},[]);const M=un(S),L=c.useCallback(T=>{const P=S.flatMap(B=>B.items).find(B=>B.id===T.id);P&&t&&t(P),D(!1)},[S,t]),I=e.jsx(Te,{brand:g?{name:g.brand.name}:{name:"Sellsuki"},groups:z?[{label:"Loading",items:[]}]:M,activeItem:r,onNavigate:L,collapsed:N,onCollapsedChange:F,showCollapseToggle:((k=g==null?void 0:g.shell)==null?void 0:k.sidebarCollapsible)??!0,version:d,versionDate:i});return e.jsxs("div",{className:`min-h-screen bg-[var(--background)] flex flex-col ${x}`,"data-product":g==null?void 0:g.product,children:[e.jsx(ar,{brand:g?{name:g.brand.name,logo:g.brand.logo}:{name:"Sellsuki"},breadcrumbs:m.map(T=>({label:T.label,href:T.href})),user:p?{name:p.name,avatar:p.avatar}:void 0,showSearch:l,onSearchClick:n,notificationCount:o,onNotificationClick:a,onUserClick:s,workspaceSwitcher:($=g==null?void 0:g.brand)==null?void 0:$.workspaceSwitcher,onSidebarToggle:()=>{window.innerWidth<768?D(T=>!T):F(T=>!T)},onMobileMenuClick:()=>D(T=>!T)}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsx("div",{className:"hidden md:flex flex-shrink-0 sticky top-[56px] h-[calc(100vh-56px)] overflow-y-auto",style:{width:N?"var(--shell-sidebar-collapsed, 64px)":"var(--shell-sidebar-width, 240px)",transition:"width var(--duration-sidebar, 250ms) var(--easing-default, cubic-bezier(0.4,0,0.2,1))"},children:z?e.jsx("div",{className:"p-4 w-full",children:e.jsx(rr,{rows:6})}):b?e.jsxs("div",{className:"p-3",children:[e.jsx(Ze,{variant:"error",children:e.jsx("span",{style:{fontSize:"var(--text-caption)"},children:"Nav load failed"})}),e.jsx("button",{type:"button",className:"mt-2 text-xs text-primary cursor-pointer hover:underline",onClick:w,children:"Retry"})]}):I}),W&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[var(--z-shell-overlay,80)] bg-black/40 md:hidden",onClick:()=>D(!1)}),e.jsx("div",{className:"fixed left-0 top-[56px] bottom-0 z-[var(--z-shell-sidebar,90)] w-[240px] bg-card shadow-lg md:hidden overflow-y-auto",style:{transition:"transform var(--duration-sidebar, 250ms) var(--easing-default)"},children:z?e.jsx("div",{className:"p-4",children:e.jsx(rr,{rows:6})}):e.jsx(Te,{brand:g?{name:g.brand.name}:{name:"Sellsuki"},groups:M,activeItem:r,onNavigate:L,collapsed:!1,showCollapseToggle:!1,version:d,versionDate:i})})]}),e.jsx("main",{className:`flex-1 min-w-0 overflow-y-auto ${f?"":"p-0"}`,style:{maxWidth:(E=g==null?void 0:g.shell)==null?void 0:E.contentMaxWidth},children:e.jsx(Vt,{children:u})})]}),e.jsx(jr,{})]})}function ao({product:r,user:t,navResolver:o,...a}){var s;return e.jsx(wr,{product:r,user:t,navResolver:o,defaultSidebarOpen:((s=r==null?void 0:r.shell)==null?void 0:s.sidebarDefaultOpen)??!0,children:e.jsx(bn,{...a})})}ao.displayName="AppShell";function so(){return e.jsxs("div",{className:"min-h-screen bg-[var(--background)] flex flex-col",children:[e.jsxs("div",{className:"h-14 bg-card border-b border-border flex items-center px-4 gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-[var(--radius-md)] bg-muted/40 animate-pulse"}),e.jsx("div",{className:"w-24 h-4 rounded bg-muted/40 animate-pulse"}),e.jsxs("div",{className:"ml-auto flex gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-muted/40 animate-pulse"}),e.jsx("div",{className:"w-8 h-8 rounded-full bg-muted/40 animate-pulse"})]})]}),e.jsxs("div",{className:"flex flex-1",children:[e.jsxs("div",{className:"w-60 border-r border-border p-4 space-y-3 hidden md:block",children:[e.jsx("div",{className:"w-full h-8 rounded-[var(--radius-md)] bg-muted/40 animate-pulse"}),Array.from({length:6}).map((r,t)=>e.jsx("div",{className:"w-full h-7 rounded-[var(--radius-md)] bg-muted/30 animate-pulse"},t))]}),e.jsxs("div",{className:"flex-1 p-6 space-y-4",children:[e.jsx("div",{className:"h-8 w-48 rounded bg-muted/40 animate-pulse"}),e.jsx("div",{className:"h-32 rounded-[var(--radius-md)] bg-muted/30 animate-pulse"}),e.jsx("div",{className:"h-64 rounded-[var(--radius-md)] bg-muted/30 animate-pulse"})]})]})]})}so.displayName="AppShellSkeleton";const gn={product:"sellsuki",brand:{name:"Sellsuki",theme:"sellsuki"},shell:{sidebarCollapsible:!0,sidebarDefaultOpen:!0}},pn={product:"patona",brand:{name:"Patona",theme:"patona"},shell:{sidebarCollapsible:!0,sidebarDefaultOpen:!0}},vn={product:"sukispace",brand:{name:"Sukispace",theme:"sukispace"},shell:{sidebarCollapsible:!0,sidebarDefaultOpen:!0}},mn={product:"shipmunk",brand:{name:"Shipmunk",theme:"shipmunk"}},xn={product:"akita",brand:{name:"Akita",theme:"akita"}};C.Accordion=Or,C.AccordionItem=Je,C.AdvancedDataTable=Ws,C.Alert=Ze,C.AppShell=ao,C.AppShellErrorBoundary=Vt,C.AppShellProvider=wr,C.AppShellSkeleton=so,C.AreaChart=Lt,C.Avatar=Gr,C.AvatarGroup=Ur,C.Badge=mo,C.BarChart=Dt,C.Breadcrumb=Ko,C.Button=Ue,C.ButtonGroup=uo,C.Card=Xr,C.CardBody=Zr,C.CardFooter=qr,C.CardHeader=Kr,C.Checkbox=ye,C.CheckboxGroup=yo,C.ChoiceCard=Yt,C.ChoiceCardGroup=Gt,C.ColorPicker=ea,C.ConfirmDialog=Wo,C.DSButton=Ue,C.DSCheckbox=ye,C.DSInput=Xe,C.DSRadio=Tr,C.DSTable=Pr,C.DSTextarea=Ke,C.DatePicker=Fo,C.DateRangePicker=Bt,C.DateTimePicker=Ot,C.Divider=Qr,C.DonutChart=At,C.Drawer=Vr,C.Dropdown=Rr,C.EmptyState=la,C.FeaturePageScaffold=ro,C.FileUpload=fa,C.FilterBar=ks,C.FormError=$t,C.FormField=is,C.FormHelperText=Ct,C.FormLabel=ir,C.FormSuccess=zt,C.IconButton=Fr,C.ImageGallery=qt,C.ImagePreview=ba,C.Input=Xe,C.LineChart=Wt,C.Menu=st,C.MiniSparkline=jt,C.Modal=Hr,C.Notification=lt,C.NotificationCenter=ya,C.NumberInput=us,C.OTPInput=vs,C.PageHeader=ws,C.Pagination=jo,C.Popover=Na,C.ProgressBar=it,C.Radio=Tr,C.RadioCard=Ut,C.RadioGroup=No,C.Rating=Ca,C.RepeatableFieldList=Kt,C.RichTextEditor=Zt,C.ScaffoldKPIRow=oo,C.ScaffoldSection=to,C.SearchField=Io,C.Sidebar=Te,C.SidebarAccountSwitcher=er,C.Skeleton=ae,C.SkeletonCard=Ta,C.SkeletonList=rr,C.SkeletonTable=Ia,C.Spinner=ct,C.StatCard=Pa,C.Statistic=Ha,C.Stepper=vt,C.Switch=Za,C.Table=Pr,C.Tabs=_o,C.Tag=mt,C.TagInput=xt,C.Textarea=Ke,C.ThumbnailCell=mr,C.TimePicker=pr,C.Timeline=ts,C.ToastContainer=jr,C.Tooltip=Ve,C.TopNavbar=ar,C.TransferList=as,C.Tree=ss,C.akitaBrandConfig=xn,C.patonaBrandConfig=pn,C.sellsukiBrandConfig=gn,C.shipmunkBrandConfig=mn,C.sukispaceBrandConfig=vn,C.toast=me,C.useAppShell=Jt,C.useAppShellFull=Qt,C.useBreadcrumbs=tn,C.useFormField=ls,C.useNavResolver=on,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})}));
|
|
95
95
|
//# sourceMappingURL=sellsuki-ds.umd.cjs.map
|