@uxuissk/design-system 0.8.3 → 0.8.4

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.
@@ -1589,7 +1589,7 @@ const xo = {
1589
1589
  md: { fontFamily: "var(--font-label)", fontSize: "var(--text-p)", fontWeight: "var(--weight-p)", padding: "8px 16px" },
1590
1590
  lg: { fontFamily: "var(--font-label)", fontSize: "var(--text-h4)", fontWeight: "var(--weight-p)", padding: "10px 20px" }
1591
1591
  };
1592
- function ki({ tabs: t, variant: r = "default", size: n = "md", defaultTab: o, activeTab: l, onChange: i, fullWidth: d = !1, className: c = "" }) {
1592
+ function ki({ tabs: t = [], variant: r = "default", size: n = "md", defaultTab: o, activeTab: l, onChange: i, fullWidth: d = !1, className: c = "" }) {
1593
1593
  var k, m;
1594
1594
  const [s, f] = j(o ?? ((k = t[0]) == null ? void 0 : k.id) ?? ""), h = l ?? s, v = V(null), [x, u] = j({ left: 0, width: 0 }), p = (y) => {
1595
1595
  l || f(y), i == null || i(y);
@@ -5219,7 +5219,7 @@ function Ui({
5219
5219
  return /* @__PURE__ */ a(
5220
5220
  "div",
5221
5221
  {
5222
- className: `bg-background border-b border-border ${i ? "sticky top-0 z-10" : ""} ${d}`,
5222
+ className: `bg-card border-b border-border ${i ? "sticky top-0 z-10" : ""} ${d}`,
5223
5223
  children: [
5224
5224
  /* @__PURE__ */ a("div", { className: "px-6 pt-5 pb-4", children: [
5225
5225
  n && /* @__PURE__ */ e("div", { className: "mb-2", style: tl, children: n }),
@@ -53,7 +53,7 @@
53
53
  `,style:ae,children:Y},Y))})]}),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:Y=>T(Math.max(0,Math.min(23,Number(Y.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:ae}),e.jsx("span",{className:"text-muted-foreground",style:ae,children:":"}),e.jsx("input",{type:"number",min:0,max:59,value:String(O).padStart(2,"0"),onChange:Y=>H(Math.max(0,Math.min(59,Number(Y.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:ae})]}),e.jsx("button",{onClick:q,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:ae,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:Ie,className:"text-primary hover:underline cursor-pointer",style:ae,children:"Today"}):e.jsx("span",{}),N??e.jsx("button",{onClick:()=>{M(!1),A("days")},className:"text-muted-foreground hover:text-foreground cursor-pointer",style:ae,children:"Close"})]})]}),document.body)]})}const Wo={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 Pr({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 ${Wo[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 Lo({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(Pr,{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 Mo={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:k}){const z=Ao(r,t,a),b=Mo[x],w=Do[y],N=c.useCallback(D=>{!h&&D>=1&&D<=t&&o(D)},[h,t,o]),F=(D,I)=>`inline-flex items-center justify-center rounded-[var(--radius-md)] transition-all cursor-pointer select-none
54
54
  ${b.btn}
55
55
  ${I?"opacity-40 pointer-events-none cursor-default":""}
56
- ${D?w.active:`${w.base} ${I?"":w.hover}`}`,L=u?(r-1)*i+1:0,M=u?Math.min(r*i,u):0,W={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:W,children:[L,"–",M," of ",u]}),l&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",style:W,children:"Rows per page:"}),e.jsx("select",{value:i,onChange:D=>f==null?void 0:f(Number(D.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(D=>e.jsx("option",{value:D,children:D},D))})]})]}),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((D,I)=>D==="dots-left"||D==="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})},D):e.jsx("button",{onClick:()=>N(D),disabled:h,className:F(D===r,h),style:b.text,"aria-label":`Page ${D}`,"aria-current":D===r?"page":void 0,children:D},D)),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:k??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:W,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,k]=c.useState(!1),[z,b]=c.useState(-1),w=r??p,N=c.useRef(null),F=c.useRef(null),L=c.useRef(void 0),M=Eo[s],W=c.useCallback(S=>{r===void 0&&g(S),t==null||t(S),y>0&&(clearTimeout(L.current),L.current=setTimeout(()=>o==null?void 0:o(S),y))},[r,t,o,y]),D=S=>{S.key==="Enter"?z>=0&&d[z]?(i==null||i(d[z]),k(!1)):o==null||o(w):S.key==="ArrowDown"?(S.preventDefault(),b($=>Math.min($+1,d.length-1))):S.key==="ArrowUp"?(S.preventDefault(),b($=>Math.max($-1,-1))):S.key==="Escape"&&k(!1)};c.useEffect(()=>{const S=$=>{F.current&&!F.current.contains($.target)&&k(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]),c.useEffect(()=>{k(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:M.icon})}),e.jsx("input",{ref:N,type:"text",value:w,onChange:S=>W(S.target.value),onKeyDown:D,onFocus:()=>d.length>0&&w.length>0&&k(!0),placeholder:a,disabled:u,autoFocus:x,className:`w-full ${M.input} rounded-[var(--radius-md)] bg-transparent outline-none text-foreground placeholder:text-muted-foreground`,style:M.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:M.icon,className:"animate-spin text-muted-foreground"}),f&&w&&!l&&e.jsx("button",{onClick:()=>{var S;W(""),(S=N.current)==null||S.focus()},className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:e.jsx(v.X,{size:M.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((S,$)=>e.jsxs("button",{onClick:()=>{i==null||i(S),k(!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:[S.icon&&e.jsx("span",{className:"text-muted-foreground flex-shrink-0",children:S.icon}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"text-foreground block truncate",style:I,children:S.label}),S.description&&e.jsx("span",{className:"text-muted-foreground block truncate",style:{marginTop:"var(--Spacing--Spacing-xxs)",...A},children:S.description})]})]},S.id))})]})}const we={sm:"px-3 py-2",md:"px-4 py-3",lg:"px-5 py-4"};function Or({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),[k,z]=c.useState("asc"),[b,w]=c.useState(new Set),N=d??b,F=E=>{d||w(E),i==null||i(E)},L=c.useMemo(()=>g?[...t].sort((E,T)=>{const O=E[g],H=T[g];if(O==null)return 1;if(H==null)return-1;const _=typeof O=="string"?O.localeCompare(H):O-H;return k==="asc"?_:-_}):t,[t,g,k]),M=E=>{g===E?z(T=>T==="asc"?"desc":"asc"):(m(E),z("asc"))},W=t.length>0&&N.size===t.length,D=N.size>0&&!W,I=()=>{F(W?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)},S={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:`${we[o]} w-12`,children:e.jsx(Fe,{size:"sm",checked:W,indeterminate:D,onChange:I})}),r.map(E=>e.jsx("th",{className:`${we[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&&M(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?k==="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:`${we[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:S,children:"Loading..."})]})})}):u?e.jsx("tr",{children:e.jsx("td",{colSpan:r.length+(l?1:0),className:`${we[o]} text-center py-12`,children:e.jsx("div",{className:"flex flex-col items-center gap-2",children:e.jsx("span",{style:{...S,color:"var(--destructive)"},children:u})})})}):L.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:r.length+(l?1:0),className:`${we[o]} text-center text-muted-foreground py-12`,children:e.jsx("span",{style:S,children:x})})}):L.map((E,T)=>{const O=N.has(T);return e.jsxs("tr",{className:`border-b border-border last:border-b-0 transition-colors ${O?"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:`${we[o]} w-12`,children:e.jsx(Fe,{size:"sm",checked:O,onChange:()=>A(T)})}),r.map(H=>e.jsx("td",{className:`${we[o]} text-${H.align??"left"} text-foreground ${n?"border-x border-border first:border-l-0 last:border-r-0":""}`,style:S,children:H.render?H.render(E[H.key],E,T):E[H.key]},H.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"}})(),k=(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:`${k(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 Re({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 Yr({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(Re,{title:h.title,open:x(h.id),onToggle:()=>y(h.id),icon:h.icon,disabled:h.disabled,children:h.content},h.id))})}Yr.displayName="Accordion",Re.displayName="AccordionItem";const Gr=["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 Ur({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?Gr[t.length%Gr.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 Xr({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]})]})}Ur.displayName="Avatar",Xr.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 Kr({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})}Kr.displayName="Card";function Zr({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]})}Zr.displayName="CardHeader";function qr({children:r}){return e.jsx("div",{className:"px-5 py-4",children:r})}qr.displayName="CardBody";function Jr({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})}Jr.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)"},Qr={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:Qr,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
56
+ ${D?w.active:`${w.base} ${I?"":w.hover}`}`,L=u?(r-1)*i+1:0,M=u?Math.min(r*i,u):0,W={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:W,children:[L,"–",M," of ",u]}),l&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",style:W,children:"Rows per page:"}),e.jsx("select",{value:i,onChange:D=>f==null?void 0:f(Number(D.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(D=>e.jsx("option",{value:D,children:D},D))})]})]}),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((D,I)=>D==="dots-left"||D==="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})},D):e.jsx("button",{onClick:()=>N(D),disabled:h,className:F(D===r,h),style:b.text,"aria-label":`Page ${D}`,"aria-current":D===r?"page":void 0,children:D},D)),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:k??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:W,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,k]=c.useState(!1),[z,b]=c.useState(-1),w=r??p,N=c.useRef(null),F=c.useRef(null),L=c.useRef(void 0),M=Eo[s],W=c.useCallback(S=>{r===void 0&&g(S),t==null||t(S),y>0&&(clearTimeout(L.current),L.current=setTimeout(()=>o==null?void 0:o(S),y))},[r,t,o,y]),D=S=>{S.key==="Enter"?z>=0&&d[z]?(i==null||i(d[z]),k(!1)):o==null||o(w):S.key==="ArrowDown"?(S.preventDefault(),b($=>Math.min($+1,d.length-1))):S.key==="ArrowUp"?(S.preventDefault(),b($=>Math.max($-1,-1))):S.key==="Escape"&&k(!1)};c.useEffect(()=>{const S=$=>{F.current&&!F.current.contains($.target)&&k(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]),c.useEffect(()=>{k(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:M.icon})}),e.jsx("input",{ref:N,type:"text",value:w,onChange:S=>W(S.target.value),onKeyDown:D,onFocus:()=>d.length>0&&w.length>0&&k(!0),placeholder:a,disabled:u,autoFocus:x,className:`w-full ${M.input} rounded-[var(--radius-md)] bg-transparent outline-none text-foreground placeholder:text-muted-foreground`,style:M.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:M.icon,className:"animate-spin text-muted-foreground"}),f&&w&&!l&&e.jsx("button",{onClick:()=>{var S;W(""),(S=N.current)==null||S.focus()},className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:e.jsx(v.X,{size:M.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((S,$)=>e.jsxs("button",{onClick:()=>{i==null||i(S),k(!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:[S.icon&&e.jsx("span",{className:"text-muted-foreground flex-shrink-0",children:S.icon}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"text-foreground block truncate",style:I,children:S.label}),S.description&&e.jsx("span",{className:"text-muted-foreground block truncate",style:{marginTop:"var(--Spacing--Spacing-xxs)",...A},children:S.description})]})]},S.id))})]})}const we={sm:"px-3 py-2",md:"px-4 py-3",lg:"px-5 py-4"};function Or({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),[k,z]=c.useState("asc"),[b,w]=c.useState(new Set),N=d??b,F=E=>{d||w(E),i==null||i(E)},L=c.useMemo(()=>g?[...t].sort((E,T)=>{const O=E[g],H=T[g];if(O==null)return 1;if(H==null)return-1;const _=typeof O=="string"?O.localeCompare(H):O-H;return k==="asc"?_:-_}):t,[t,g,k]),M=E=>{g===E?z(T=>T==="asc"?"desc":"asc"):(m(E),z("asc"))},W=t.length>0&&N.size===t.length,D=N.size>0&&!W,I=()=>{F(W?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)},S={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:`${we[o]} w-12`,children:e.jsx(Fe,{size:"sm",checked:W,indeterminate:D,onChange:I})}),r.map(E=>e.jsx("th",{className:`${we[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&&M(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?k==="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:`${we[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:S,children:"Loading..."})]})})}):u?e.jsx("tr",{children:e.jsx("td",{colSpan:r.length+(l?1:0),className:`${we[o]} text-center py-12`,children:e.jsx("div",{className:"flex flex-col items-center gap-2",children:e.jsx("span",{style:{...S,color:"var(--destructive)"},children:u})})})}):L.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:r.length+(l?1:0),className:`${we[o]} text-center text-muted-foreground py-12`,children:e.jsx("span",{style:S,children:x})})}):L.map((E,T)=>{const O=N.has(T);return e.jsxs("tr",{className:`border-b border-border last:border-b-0 transition-colors ${O?"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:`${we[o]} w-12`,children:e.jsx(Fe,{size:"sm",checked:O,onChange:()=>A(T)})}),r.map(H=>e.jsx("td",{className:`${we[o]} text-${H.align??"left"} text-foreground ${n?"border-x border-border first:border-l-0 last:border-r-0":""}`,style:S,children:H.render?H.render(E[H.key],E,T):E[H.key]},H.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"}})(),k=(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:`${k(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 Re({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 Yr({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(Re,{title:h.title,open:x(h.id),onToggle:()=>y(h.id),icon:h.icon,disabled:h.disabled,children:h.content},h.id))})}Yr.displayName="Accordion",Re.displayName="AccordionItem";const Gr=["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 Ur({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?Gr[t.length%Gr.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 Xr({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]})]})}Ur.displayName="Avatar",Xr.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 Kr({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})}Kr.displayName="Card";function Zr({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]})}Zr.displayName="CardHeader";function qr({children:r}){return e.jsx("div",{className:"px-5 py-4",children:r})}qr.displayName="CardBody";function Jr({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})}Jr.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)"},Qr={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:Qr,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
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:Qr,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 Vr({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}`})}Vr.displayName="Divider";const ta={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"};function Rr({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); } }
@@ -91,5 +91,5 @@
91
91
  ${u?"bg-primary/10 text-primary":"text-foreground"}`,style:{paddingLeft:`${t*20+8}px`,...dr},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(kt,{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,k=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:{...dr,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:dr,children:u}):r.map(b=>e.jsx(kt,{node:b,level:0,expanded:g,selected:m,onToggle:k,onSelect:z,selectable:t,showLines:o},b.id))})}const ns={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-button)"},cr={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-label)"},$t=c.createContext({name:""});function ls(){return c.useContext($t)}function fr({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 zt({message:r,className:t=""}){return r?e.jsxs("div",{className:`flex items-center gap-1 mt-1.5 text-destructive ${t}`,style:cr,role:"alert",children:[e.jsx(v.AlertCircle,{size:12,className:"flex-shrink-0"}),e.jsx("span",{children:r})]}):null}function Ct({message:r,className:t=""}){return r?e.jsxs("div",{className:`flex items-center gap-1 mt-1.5 text-chart-2 ${t}`,style:cr,role:"status",children:[e.jsx(v.CheckCircle2,{size:12,className:"flex-shrink-0"}),e.jsx("span",{children:r})]}):null}function Ft({children:r,className:t=""}){return e.jsx("p",{className:`mt-1.5 text-muted-foreground ${t}`,style:cr,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(zt,{message:a}):s?e.jsx(Ct,{message:s}):n?e.jsx(Ft,{children:n}):null;return e.jsx($t.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(fr,{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(fr,{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"},Wt={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,k=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:Wt[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||!k,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:Wt[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 L;if(!/^\d$/.test(w))return;const N=p.slice();N[b]=w;const F=N.join("");g(F),b<r-1&&((L=y.current[b+1])==null||L.focus())},k=(b,w)=>{var N,F,L;if(w.key==="Backspace"){w.preventDefault();const M=p.slice();M[b]!==" "&&M[b]!==""?(M[b]=" ",g(M.join(""))):b>0&&(M[b-1]=" ",g(M.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&&((L=y.current[b+1])==null||L.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=>k(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
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-label, 'DB HeaventRounded', sans-serif)",fontSize:"var(--text-label)"};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)"},Ye={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-label)",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:Ye,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:Ye})]}),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:Ye,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:Ye,children:[e.jsx(v.X,{size:12}),"Clear all"]})]})}const Lt={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},hr={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},ve={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:400},fe={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:ve,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:ve,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:Lt,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:{...ve,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 Ws({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:ve,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:ve,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(ur,{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:ve,children:"…"},`ellipsis-${u}`):e.jsx(ur,{active:f===o,onClick:()=>t(f,a),label:String(f)},f)),e.jsx(ur,{disabled:o===n,onClick:()=>t(o+1,a),label:"Next ›"})]})]})}function ur({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:{...ve,fontWeight:t?600:400},children:r})}function Ls({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:k="No data found",emptyDescription:z,showColumnToggle:b=!1,size:w="md",stickyHeader:N=!1,className:F=""}){const[L,M]=c.useState(new Set(r.filter(B=>B.defaultHidden).map(B=>B.key))),W=c.useCallback(B=>{M(V=>{const J=new Set(V);return J.has(B)?J.delete(B):J.add(B),J})},[]),D=c.useMemo(()=>r.filter(B=>!L.has(B.key)),[r,L]),[I,A]=c.useState(new Set),S=f??I,$=c.useCallback(B=>{f||A(B);const V=t.filter(J=>B.has(J[o]));u==null||u(B,V)},[f,t,o,u]),E=c.useMemo(()=>t.map(B=>B[o]),[t,o]),T=E.length>0&&E.every(B=>S.has(B)),O=S.size>0&&!T,H=c.useCallback(()=>{$(T?new Set:new Set(E))},[T,E,$]),_=c.useCallback(B=>{const V=new Set(S);V.has(B)?V.delete(B):V.add(B),$(V)},[S,$]),[Q,P]=c.useState(new Set),Z=c.useCallback(B=>{P(V=>{const J=new Set(V);return J.has(B)?J.delete(B):J.add(B),J})},[]),oe=c.useCallback(B=>{d&&(s===B?d(B,n==="asc"?"desc":"asc"):d(B,"asc"))},[s,n,d]),X=c.useMemo(()=>{const B={};let V=0;i&&(V+=48),h&&(V+=40);for(const J of D)if(J.frozen){B[J.key]=V;const le=typeof J.width=="number"?J.width:parseInt(J.width??"120");V+=isNaN(le)?120:le}return B},[D,i,h]),re=D.length+(i?1:0)+(h?1:0),U="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:L,onToggle:W})}),i&&S.size>0&&x.length>0&&e.jsx(Cs,{count:S.size,actions:x,selectedKeys:Array.from(S),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:`${fe[w]} w-10`}),i&&e.jsx("th",{className:`${fe[w]} w-12`,children:e.jsx(Fe,{size:"sm",checked:T,indeterminate:O&&!T,onChange:H})}),D.map(B=>{const V=B.frozen&&B.key in X,J=s===B.key;return e.jsx("th",{className:`${fe[w]} text-${B.align??"left"} text-[var(--foreground)] whitespace-nowrap select-none ${B.sortable&&d?"cursor-pointer hover:text-[var(--primary)]":""} ${V?U:""}`,style:{...Lt,width:B.width,minWidth:B.minWidth??80,...V?{left:X[B.key],boxShadow:"2px 0 4px rgba(0,0,0,0.04)"}:{}},onClick:()=>B.sortable&&oe(B.key),children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[B.header,B.sortable&&d&&e.jsx("span",{className:J?"text-[var(--primary)]":"text-[var(--muted-foreground)]/60",children:J?n==="asc"?e.jsx(v.ChevronUp,{size:13}):e.jsx(v.ChevronDown,{size:13}):e.jsx(v.ChevronsUpDown,{size:12})})]})},B.key)})]})}),e.jsxs("tbody",{children:[m&&e.jsx("tr",{children:e.jsx("td",{colSpan:re,className:`${fe[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:hr,children:m})]})})}),!m&&p&&Array.from({length:g}).map((B,V)=>e.jsxs("tr",{className:"border-b border-[var(--border)] last:border-b-0",children:[h&&e.jsx("td",{className:`${fe[w]} w-10`}),i&&e.jsx("td",{className:`${fe[w]} w-12`,children:e.jsx("div",{className:"w-4 h-4 rounded bg-muted animate-pulse"})}),D.map(J=>e.jsx("td",{className:`${fe[w]}`,children:e.jsx($s,{width:J.align==="right"?"60%":J.align==="center"?"50%":"75%"})},J.key))]},`skel-${V}`)),!m&&!p&&t.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:re,className:`${fe[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:hr,children:k}),z&&e.jsx("span",{className:"text-[var(--muted-foreground)]",style:ve,children:z})]})})}),!m&&!p&&t.map((B,V)=>{const J=B[o],le=S.has(J),me=Q.has(J),Ie=!!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)]"} ${Ie?"cursor-pointer":""}`,onClick:()=>{y==null||y(B),h&&Z(J)},children:[h&&e.jsx("td",{className:`${fe[w]} w-10 text-center`,onClick:q=>{q.stopPropagation(),Z(J)},children:e.jsx(v.ChevronRight,{size:14,className:`text-[var(--muted-foreground)] transition-transform mx-auto ${me?"rotate-90":""}`})}),i&&e.jsx("td",{className:`${fe[w]} w-12`,onClick:q=>q.stopPropagation(),children:e.jsx(Fe,{size:"sm",checked:le,onChange:()=>_(J)})}),D.map(q=>{const xe=q.frozen&&q.key in X,Ne=xe?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:`${fe[w]} text-${q.align??"left"} text-[var(--foreground)] ${Ne}`,style:{...hr,...xe?{left:X[q.key],boxShadow:"2px 0 4px rgba(0,0,0,0.04)"}:{}},children:q.render?q.render(B[q.key],B,V):B[q.key]},q.key)})]}),h&&me&&e.jsx("tr",{className:"bg-[var(--muted)] border-b border-[var(--border)]",children:e.jsx("td",{colSpan:re,className:"px-6 py-4",children:h(B)})})]},J??V)})]})]})}),a&&l&&!p&&!m&&e.jsx(Ws,{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-label)",fontWeight:"var(--weight-label)"};function br(r,t,o){return Math.max(t,Math.min(o,r))}function Ge(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 gr(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 pr({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 Mt({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=Ge(g),k=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,L=p.length>1?N/(p.length-1):N;function M(I){return z.left+I*L}function W(I){return z.top+F-(I-k)/(m-k||1)*F}const D=Array.from({length:5},(I,A)=>k+A/4*(m-k));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&&D.map((I,A)=>e.jsx("line",{x1:z.left,y1:W(I),x2:b-z.right,y2:W(I),stroke:"var(--border)",strokeWidth:.5,strokeDasharray:"4 2"},A)),s&&D.map((I,A)=>e.jsx("text",{x:z.left-8,y:W(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 S=Math.max(1,Math.floor(p.length/8));return A%S!==0&&A!==p.length-1?null:e.jsx("text",{x:M(A),y:w-z.bottom+16,textAnchor:"middle",fill:"var(--muted-foreground)",style:ne,children:I},A)}),r.map((I,A)=>{const S=ie(I,A),$=I.data.map((T,O)=>[M(O),W(T.value)]),E=gr($,f);return e.jsxs("g",{children:[e.jsx("path",{d:E,fill:"none",stroke:S,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),i&&$.map(([T,O],H)=>e.jsx("circle",{cx:T,cy:O,r:3,fill:"var(--card)",stroke:S,strokeWidth:2},H))]},A)}),d&&p.map((I,A)=>e.jsx("rect",{x:M(A)-L/2,y:z.top,width:L,height:F,fill:"transparent",onMouseEnter:()=>h({x:M(A),y:z.top,labelIdx:A})},A)),y&&e.jsx("line",{x1:M(y.labelIdx),y1:z.top,x2:M(y.labelIdx),y2:z.top+F,stroke:"var(--border)",strokeWidth:1,strokeDasharray:"4 2"}),y&&d&&e.jsx(pr,{x:br(M(y.labelIdx)+8,z.left,b-180),y:z.top,label:p[y.labelIdx],items:r.map((I,A)=>{var S;return{name:I.name,value:((S=I.data[y.labelIdx])==null?void 0:S.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))})]})}Mt.displayName="LineChart";function Dt({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(S=>S.label),m=r.flatMap(S=>S.data.map($=>$.value)),k=Ge(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,L=N-b.top-b.bottom,M=g.length>1?F/(g.length-1):F;function W(S){return b.left+S*M}function D(S){return b.top+L-(S-z)/(k-z||1)*L}const I=Array.from({length:5},(S,$)=>z+$/4*(k-z)),A=b.top+L;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((S,$)=>e.jsxs("linearGradient",{id:`${y}-grad-${$}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:ie(S,$),stopOpacity:u*4}),e.jsx("stop",{offset:"100%",stopColor:ie(S,$),stopOpacity:0})]},$))}),n&&I.map((S,$)=>e.jsx("line",{x1:b.left,y1:D(S),x2:w-b.right,y2:D(S),stroke:"var(--border)",strokeWidth:.5,strokeDasharray:"4 2"},$)),s&&I.map((S,$)=>e.jsx("text",{x:b.left-8,y:D(S)+4,textAnchor:"end",fill:"var(--muted-foreground)",style:ne,children:S>=1e3?`${(S/1e3).toFixed(1)}k`:S},$)),a&&g.map((S,$)=>{const E=Math.max(1,Math.floor(g.length/8));return $%E!==0&&$!==g.length-1?null:e.jsx("text",{x:W($),y:N-b.bottom+16,textAnchor:"middle",fill:"var(--muted-foreground)",style:ne,children:S},$)}),r.map((S,$)=>{const E=ie(S,$),T=S.data.map((_,Q)=>[W(Q),D(_.value)]),O=gr(T,f),H=O+` L${T[T.length-1][0]},${A} L${T[0][0]},${A} Z`;return e.jsxs("g",{children:[e.jsx("path",{d:H,fill:`url(#${y}-grad-${$})`}),e.jsx("path",{d:O,fill:"none",stroke:E,strokeWidth:2,strokeLinecap:"round"}),i&&T.map(([_,Q],P)=>e.jsx("circle",{cx:_,cy:Q,r:3,fill:"var(--card)",stroke:E,strokeWidth:2},P))]},$)}),d&&g.map((S,$)=>e.jsx("rect",{x:W($)-M/2,y:b.top,width:M,height:L,fill:"transparent",onMouseEnter:()=>p({x:W($),y:b.top,labelIdx:$})},$)),h&&e.jsx("line",{x1:W(h.labelIdx),y1:b.top,x2:W(h.labelIdx),y2:b.top+L,stroke:"var(--border)",strokeWidth:1,strokeDasharray:"4 2"}),h&&e.jsx(pr,{x:br(W(h.labelIdx)+8,b.left,w-180),y:b.top,label:g[h.labelIdx],items:r.map((S,$)=>{var E;return{name:S.name,value:((E=S.data[h.labelIdx])==null?void 0:E.value)??0,color:ie(S,$)}})})]}),l&&r.length>1&&e.jsx("div",{className:"flex flex-wrap gap-4 mt-2 justify-center",children:r.map((S,$)=>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(S,$)}}),e.jsx("span",{className:"text-muted-foreground",children:S.name})]},$))})]})}Dt.displayName="AreaChart";function At({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=Ge(h.map((A,S)=>r.reduce(($,E)=>{var T;return $+(((T=E.data[S])==null?void 0:T.value)??0)},0))):p=Ge(r.flatMap(A=>A.data.map(S=>S.value)));const g={top:12,right:16,bottom:a?36:12,left:s?48:16},m=o??600,k=t,z=m-g.left-g.right,b=k-g.top-g.bottom,w=z/h.length,N=w*.2,F=w-N*2,L=i?F:F/r.length;function M(A){return g.top+b-A/p*b}function W(A){return A/p*b}function D(A){return g.left+A*w+N}const I=Array.from({length:5},(A,S)=>S/4*p);return e.jsxs("div",{className:`w-full ${u}`,children:[e.jsxs("svg",{width:o?m:"100%",height:k,viewBox:`0 0 ${m} ${k}`,onMouseLeave:()=>y(null),children:[n&&I.map((A,S)=>e.jsx("line",{x1:g.left,y1:M(A),x2:m-g.right,y2:M(A),stroke:"var(--border)",strokeWidth:.5,strokeDasharray:"4 2"},S)),s&&I.map((A,S)=>e.jsx("text",{x:g.left-8,y:M(A)+4,textAnchor:"end",fill:"var(--muted-foreground)",style:ne,children:A>=1e3?`${(A/1e3).toFixed(1)}k`:A},S)),a&&h.map((A,S)=>e.jsx("text",{x:D(S)+F/2,y:k-g.bottom+16,textAnchor:"middle",fill:"var(--muted-foreground)",style:ne,children:A},S)),h.map((A,S)=>{if(i){let $=g.top+b;return e.jsx("g",{children:r.map((E,T)=>{var V;const O=((V=E.data[S])==null?void 0:V.value)??0,H=W(O),_=$-H;$=_;const Q=ie(E,T),P=T===r.length-1,Z=T===0,oe=f,X=D(S),re=F,U=H,B=P&&Z?`M${X},${_+oe} Q${X},${_} ${X+oe},${_} L${X+re-oe},${_} Q${X+re},${_} ${X+re},${_+oe} L${X+re},${_+U} L${X},${_+U} Z`:P?`M${X},${_+oe} Q${X},${_} ${X+oe},${_} L${X+re-oe},${_} Q${X+re},${_} ${X+re},${_+oe} L${X+re},${_+U} L${X},${_+U} Z`:`M${X},${_} L${X+re},${_} L${X+re},${_+U} L${X},${_+U} Z`;return e.jsx("path",{d:B,fill:Q},T)})},S)}else return e.jsx("g",{children:r.map(($,E)=>{var Z;const T=((Z=$.data[S])==null?void 0:Z.value)??0,O=W(T),H=D(S)+E*L,_=M(T),Q=ie($,E),P=Math.min(f,L/2);return e.jsx("path",{d:`M${H},${_+P} Q${H},${_} ${H+P},${_} L${H+L-P},${_} Q${H+L},${_} ${H+L},${_+P} L${H+L},${_+O} L${H},${_+O} Z`,fill:Q},E)})},S)}),d&&h.map((A,S)=>e.jsx("rect",{x:D(S),y:g.top,width:F,height:b,fill:"transparent",style:{cursor:"default"},onMouseEnter:()=>y({x:D(S)+F/2,y:g.top,labelIdx:S})},S)),x&&e.jsx(pr,{x:br(x.x+8,g.left,m-180),y:g.top,label:h[x.labelIdx],items:r.map((A,S)=>{var $;return{name:A.name,value:(($=A.data[x.labelIdx])==null?void 0:$.value)??0,color:ie(A,S)}})})]}),l&&r.length>1&&e.jsx("div",{className:"flex flex-wrap gap-4 mt-2 justify-center",children:r.map((A,S)=>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,S)}}),e.jsx("span",{className:"text-muted-foreground",children:A.name})]},S))})]})}At.displayName="BarChart";function jt({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,L=g+N*2*Math.PI;g=L;const M=x+h*Math.cos(F),W=y+h*Math.sin(F),D=x+h*Math.cos(L),I=y+h*Math.sin(L),A=x+p*Math.cos(L),S=y+p*Math.sin(L),$=x+p*Math.cos(F),E=y+p*Math.sin(F),T=N>.5?1:0;return{path:[`M${M},${W}`,`A${h},${h} 0 ${T} 1 ${D},${I}`,`L${A},${S}`,`A${p},${p} 0 ${T} 0 ${$},${E}`,"Z"].join(" "),color:b.color??We[w%We.length],ratio:N,d:b,i:w}}),k=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():k}),(a||z)&&e.jsx("text",{x,y:y+12,textAnchor:"middle",fill:"var(--muted-foreground)",style:{...ne,fontSize:"var(--text-caption)"},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))})]})}jt.displayName="DonutChart";function Et({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,k=a-g*2;function z(L){return g+L/(r.length-1||1)*m}function b(L){return g+k-(L-i)/u*k}if(t==="bar"){const L=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((M,W)=>{const D=(M-i)/u*k;return e.jsx("rect",{x:g+W*(m/r.length),y:g+k-D,width:L,height:D,fill:p,rx:1,opacity:W===r.length-1?1:.5},W)})}),n&&e.jsx("span",{style:{...ne,color:p},children:r[r.length-1].toLocaleString()})]})}const w=r.map((L,M)=>[z(M),b(L)]),N=gr(w,!1),F=N+` L${w[w.length-1][0]},${g+k} L${w[0][0]},${g+k} 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()})]})}Et.displayName="MiniSparkline";function ge(r){const t=new Date(r);return t.setHours(0,0,0,0),t}function pe(r){const t=new Date(r);return t.setHours(23,59,59,999),t}const Ms=[{label:"Today",value:"today",range:()=>{const r=new Date;return{from:ge(r),to:pe(r)}}},{label:"Yesterday",value:"yesterday",range:()=>{const r=new Date;return r.setDate(r.getDate()-1),{from:ge(r),to:pe(r)}}},{label:"Last 7 days",value:"last7",range:()=>{const r=new Date,t=new Date;return t.setDate(t.getDate()-6),{from:ge(t),to:pe(r)}}},{label:"Last 30 days",value:"last30",range:()=>{const r=new Date,t=new Date;return t.setDate(t.getDate()-29),{from:ge(t),to:pe(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:ge(t),to:pe(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:ge(t),to:pe(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 vr(r){return r?r.toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}):""}function mr(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)"},Tt={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},It={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},Ts={sm:"h-8 px-3",md:"h-10 px-3.5",lg:"h-11 px-4"};function Bt({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,k]=p<=g?[p,g]:[g,p];return h>m&&h<k}function y(h){return!!(i&&h<ge(i)||f&&h>pe(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:It,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:Tt,children:h},h))}),e.jsx("div",{className:"grid grid-cols-7",children:u.map((h,p)=>{const g=h.getMonth()===r,m=o.from?mr(h,o.from):!1,k=o.to?mr(h,o.to):a&&o.from?mr(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||k?"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:Tt,children:h.getDate()},p)})})]})}function _t({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),[k,z]=c.useState(void 0),[b,w]=c.useState(u.getMonth()),[N,F]=c.useState(u.getFullYear()),[L,M]=c.useState("from"),[W,D]=c.useState({top:0,left:0,width:0}),I=c.useRef(null),A=c.useRef(null),S=r??h,$=(b+1)%12,E=b===11?N+1:N;c.useEffect(()=>{function P(Z){I.current&&!I.current.contains(Z.target)&&y(!1)}return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]),c.useEffect(()=>{if(!x||!A.current)return;const P=()=>{const Z=A.current.getBoundingClientRect();D({top:Z.bottom+4,left:Z.left,width:Z.width})};return P(),window.addEventListener("scroll",P,!0),window.addEventListener("resize",P),()=>{window.removeEventListener("scroll",P,!0),window.removeEventListener("resize",P)}},[x]);function T(P){if(P.value==="custom"){z("custom");return}const Z=P.range();p(Z),t==null||t(Z,P.value),z(P.value),y(!1)}function O(P){if(L==="from")p({from:ge(P),to:null}),M("to");else{const Z=h.from,[oe,X]=P>=Z?[Z,pe(P)]:[ge(P),pe(Z)],re={from:oe,to:X};p(re),t==null||t(re,"custom"),z("custom"),M("from"),y(!1)}}function H(P){P.stopPropagation();const Z={from:null,to:null};p(Z),t==null||t(Z,void 0),z(void 0)}const _=S.from&&S.to?`${vr(S.from)} – ${vr(S.to)}`:S.from?`${vr(S.from)} – ...`:"",Q=Ms.filter(P=>o.includes(P.value));return e.jsxs("div",{ref:I,className:`relative inline-block ${f}`,children:[e.jsxs("button",{ref:A,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:_?"text-foreground flex-1":"text-muted-foreground flex-1",children:_||a}),d&&S.from&&e.jsx("span",{role:"button",tabIndex:0,onClick:H,onKeyDown:P=>P.key==="Enter"&&H(P),className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer flex-shrink-0",children:e.jsx(v.X,{size:12})})]}),x&&Ce.createPortal(e.jsxs("div",{className:"fixed z-[9999] 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:{top:W.top,left:W.left,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:Q.map(P=>e.jsx("button",{type:"button",onClick:()=>T(P),className:["w-full text-left px-3 py-1.5 rounded-none transition-colors",k===P.value?"bg-primary/10 text-primary":"text-foreground hover:bg-muted/30"].join(" "),style:It,children:P.label},P.value))}),e.jsxs("div",{className:"flex gap-4 p-4 flex-1 min-w-0",children:[e.jsx(Bt,{month:b,year:N,range:S,hovered:g,onHover:m,onSelect:O,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(Bt,{month:$,year:E,range:S,hovered:g,onHover:m,onSelect:O,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})]})]}),document.body)]})}_t.displayName="DateRangePicker";function he(r){return String(r).padStart(2,"0")}function Ht(r,t,o){if(t==="12h"){const a=r.hours%12||12,s=r.hours<12?"AM":"PM";return o?`${he(a)}:${he(r.minutes)}:${he(r.seconds??0)} ${s}`:`${he(a)}:${he(r.minutes)} ${s}`}return o?`${he(r.hours)}:${he(r.minutes)}:${he(r.seconds??0)}`:`${he(r.hours)}:${he(r.minutes)}`}const Pt={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-p)"},Ue={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)",fontVariantNumeric:"tabular-nums"},Ot={sm:"h-8 px-3",md:"h-10 px-3.5",lg:"h-11 px-4"};function Xe({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:Ue,children:he(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-label)"},children:a})]})}function xr({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},(W,D)=>D+1):Array.from({length:24},(W,D)=>D),m=Array.from({length:Math.ceil(60/s)},(W,D)=>D*s),k=Array.from({length:60},(W,D)=>D),z=["AM","PM"];c.useEffect(()=>{function W(D){h.current&&!h.current.contains(D.target)&&u(!1)}return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[]);function b(W){const D={...p,...W};y(D),t==null||t(D)}const w=Ht(p,o,a),N=r!==void 0||x.hours!==0||x.minutes!==0,F=o==="12h"?p.hours%12||12:p.hours,L=p.hours<12;function M(W,D){let I=W%12;D||(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]",Ot[l],f?"border-primary ring-2 ring-primary/20":"hover:border-primary/40",d?"opacity-50 cursor-not-allowed":"cursor-pointer"].join(" "),style:Pt,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(Xe,{options:g,value:F,onChange:W=>M(W,L),label:"Hour"}):e.jsx(Xe,{options:g,value:p.hours,onChange:W=>b({hours:W}),label:"Hour"}),e.jsx("div",{className:"text-muted-foreground text-lg mt-3",style:Ue,children:":"}),e.jsx(Xe,{options:m,value:p.minutes,onChange:W=>b({minutes:W}),label:"Min"}),a&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-muted-foreground text-lg mt-3",style:Ue,children:":"}),e.jsx(Xe,{options:k,value:p.seconds??0,onChange:W=>b({seconds:W}),label:"Sec"})]}),o==="12h"&&e.jsxs("div",{className:"flex flex-col gap-1 ml-1",children:[e.jsx("div",{className:"h-5"}),z.map(W=>e.jsx("button",{type:"button",onClick:()=>M(F,W==="AM"),className:["px-2 py-1 rounded-[var(--radius-md)] transition-colors",W==="AM"===L?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted/30 cursor-pointer"].join(" "),style:Ue,children:W},W))]})]})})]})}xr.displayName="TimePicker";function Yt({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,[k,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 L($){const E=new Date(g);E.setHours($.hours,$.minutes,$.seconds??0,0),N(E)}const M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],W=["Su","Mo","Tu","We","Th","Fr","Sa"];function D(){const $=[],E=new Date(b,k,1),T=new Date(E);T.setDate(T.getDate()-T.getDay());for(let O=0;O<42;O++)$.push(new Date(T)),T.setDate(T.getDate()+1);return $}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)"},S=`${g.toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"})} ${Ht({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]",Ot[n],u?"border-primary ring-2 ring-primary/20":"hover:border-primary/40",i?"opacity-50 cursor-not-allowed":"cursor-pointer"].join(" "),style:Pt,children:[e.jsx(v.Clock,{size:14,className:"text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-foreground",children:S})]}),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:()=>{k===0?(z(11),w(b-1)):z(k-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:[M[k]," ",b]}),e.jsx("button",{type:"button",onClick:()=>{k===11?(z(0),w(b+1)):z(k+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:W.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:D().map(($,E)=>{const T=$.getMonth()===k,O=r?$.toDateString()===r.toDateString():$.toDateString()===y.toDateString(),H=$.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",O?"bg-primary text-primary-foreground font-semibold":H?"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(xr,{value:{hours:g.getHours(),minutes:g.getMinutes(),seconds:g.getSeconds()},onChange:L,format:o,showSeconds:a,size:"sm"})]})]})]})}Yt.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-label)",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)]",md:"w-10 h-10 rounded-[var(--radius-md)]",lg:"w-12 h-12 rounded-[var(--radius-md)] text-lg"};function Gt({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})})]})}Gt.displayName="ChoiceCard";function Ut({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)})}Ut.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-label)",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 Xt({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)})})}Xt.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)"},Kt={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};function Zt({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,L)=>{h(y.map(M=>M.id===N?{...M,values:{...M.values,[F]:L}}:M))},k=(N,F)=>{const L=[...y],[M]=L.splice(N,1);L.splice(F,0,M),h(L)},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:L=>{L.preventDefault()},onDrop:()=>{w.current!==null&&w.current!==F&&(k(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(L=>e.jsx("div",{style:{width:L.width??"1fr",flex:L.width?"none":"1"},className:"min-w-0",children:L.render(N.values[L.key],M=>m(N.id,L.key,M),F)},L.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:Kt,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:Kt,children:[e.jsx(v.Plus,{size:14}),l]})]})}Zt.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 qt({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,k]=c.useState(!r);c.useEffect(()=>{x.current&&r&&x.current.innerHTML!==r&&(x.current.innerHTML=r,k(!1))},[]);const z=c.useCallback(()=>{const M=new Set;["bold","italic","underline","strikethrough","insertUnorderedList","insertOrderedList","justifyLeft","justifyCenter","justifyRight"].forEach(W=>{try{document.queryCommandState(W)&&M.add(W)}catch{}}),g(M)},[]);function b(M){var W;if(!(d||i)){if((W=x.current)==null||W.focus(),M.startsWith("formatBlock-")){const D=M.replace("formatBlock-","");document.execCommand("formatBlock",!1,D)}else if(M==="createLink"){const D=window.prompt("Enter URL:");D&&document.execCommand("createLink",!1,D)}else document.execCommand(M,!1);z(),x.current&&t&&t(x.current.innerHTML)}}function w(){if(x.current){const M=x.current.innerHTML,W=x.current.innerText.trim();k(!W),t==null||t(M),z()}}const F=a??{sm:120,md:160,lg:240}[f],L=["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:L,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((M,W)=>{const D=Qs[M];return e.jsxs(c.Fragment,{children:[W>0&&e.jsx("div",{className:"w-px h-5 bg-border mx-1"}),D.map(I=>{const A=I.icon,S=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",S?"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)})]},M)}),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})]})]})}qt.displayName="RichTextEditor";const yr={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},Le={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",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:Le,children:[n.name," ",n.size?`· ${n.size}`:""]}),r.length>1&&e.jsxs("p",{className:"text-center text-white/40 mt-1",style:Le,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 wr({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:yr,children:o}),a&&e.jsx("div",{className:"truncate text-muted-foreground",style:Le,children:a})]})]})}wr.displayName="ThumbnailCell";function Jt({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),k=c.useRef(null);function z(N){if(x)return;if(o.includes(N))a==null||a(o.filter(L=>L!==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:yr,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:Le,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:k,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:w}),e.jsxs("button",{type:"button",disabled:x,onClick:()=>{var N;return(N=k.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:Le,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 L=o.includes(N.id);return e.jsxs("div",{className:["relative group rounded-[var(--radius-md)] overflow-hidden border transition-all cursor-pointer",L?"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",L?"bg-primary border-primary":"bg-white/80 border-white"].join(" "),children:L&&e.jsx(v.Check,{size:10,className:"text-primary-foreground"})}),i&&e.jsx("button",{type:"button",onClick:M=>{M.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 L=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",L?"border-primary bg-primary/5":"border-border hover:bg-muted/10"].join(" "),onClick:()=>b(F,N.id),children:[e.jsx(wr,{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:yr,children:N.name??N.alt??`Image ${F+1}`}),N.size&&e.jsx("div",{className:"text-muted-foreground",style:Le,children:N.size})]}),t&&L&&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:M=>{M.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)})]})}Jt.displayName="ImageGallery";const Nr=c.createContext(null);Nr.displayName="AppShellContext";const Sr=c.createContext(null);Sr.displayName="AppShellFullContext";function kr({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}),k=c.useRef(0),z=c.useCallback(async()=>{if(!o||!r){m({groups:[],loading:!1,error:null});return}const w=++k.current;m(N=>({...N,loading:!0,error:null}));try{const N=await o(r);if(w!==k.current)return;m({groups:N,loading:!1,error:null})}catch(N){if(w!==k.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(Sr.Provider,{value:b,children:e.jsx(Nr.Provider,{value:b,children:l})})}kr.displayName="AppShellProvider";function Qt(){const r=c.useContext(Nr);if(!r)throw new Error("[useAppShell] must be used inside <AppShellProvider>. Wrap your app root with <AppShellProvider user={...} product={...}>.");return r}function Vt(){const r=c.useContext(Sr);if(!r)throw new Error("[useAppShellFull] must be used inside <AppShellProvider>.");return r}function tn(r){const{setBreadcrumbs:t}=Qt(),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 Rt 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 R({children:r,className:t=""}){return r?e.jsx("div",{className:t,children:r}):null}function eo({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 ro({p:r}){const t=r.gap??"gap-5";return e.jsxs("div",{className:`flex flex-col ${t}`,children:[e.jsx(R,{children:r.header}),e.jsx(R,{children:r.banner}),e.jsx(R,{children:r.stats}),e.jsx(R,{children:r.filters}),e.jsx(R,{className:"min-h-0",children:r.content}),e.jsx(R,{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(R,{children:r.header}),e.jsx(R,{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(R,{children:r.header}),e.jsx(R,{children:r.banner}),e.jsx(R,{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(R,{children:r.header}),e.jsx(R,{children:r.banner}),e.jsx(R,{children:r.stepper}),e.jsx(R,{className:"flex-1",children:r.form??r.content})]}),e.jsx(eo,{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(R,{children:r.header}),e.jsx(R,{children:r.banner}),e.jsx(R,{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(R,{children:r.primaryChart??r.charts}),e.jsx(R,{children:r.secondaryCharts})]}),e.jsx(R,{children:r.content??r.table}),e.jsx(R,{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(R,{children:r.header}),e.jsx(R,{children:r.banner}),e.jsx(R,{className:"flex-1 max-w-2xl",children:r.form??r.content})]}),e.jsx(eo,{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(R,{children:r.header}),e.jsx(R,{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(R,{children:r.filters}),e.jsx(R,{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(R,{children:r.table??r.content}),e.jsx(R,{children:r.footer})]})}function to(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(ro,{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(ro,{p:r})}})();return e.jsx("div",{className:`${n} ${l} ${s}`,children:d})}to.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 oo({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})]})}oo.displayName="ScaffoldSection";function ao({children:r,className:t=""}){return e.jsx("div",{className:`grid grid-cols-2 lg:grid-cols-4 gap-4 ${t}`,children:r})}ao.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,S,$,E;const{sidebarOpen:y,setSidebarOpen:h,user:p,product:g,breadcrumbs:m,navGroups:k,navLoading:z,navError:b,refreshNav:w}=Vt(),[N,F]=c.useState(!(((A=g==null?void 0:g.shell)==null?void 0:A.sidebarDefaultOpen)??!0)),[L,M]=c.useState(!1);c.useEffect(()=>{function T(){window.innerWidth>=768&&M(!1)}return window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)},[]);const W=un(k),D=c.useCallback(T=>{const O=k.flatMap(H=>H.items).find(H=>H.id===T.id);O&&t&&t(O),M(!1)},[k,t]),I=e.jsx(Oe,{brand:g?{name:g.brand.name}:{name:"Sellsuki"},groups:z?[{label:"Loading",items:[]}]:W,activeItem:r,onNavigate:D,collapsed:N,onCollapsedChange:F,showCollapseToggle:((S=g==null?void 0:g.shell)==null?void 0:S.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(lr,{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?M(T=>!T):F(T=>!T)},onMobileMenuClick:()=>M(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(ar,{rows:6})}):b?e.jsxs("div",{className:"p-3",children:[e.jsx(Qe,{variant:"error",children:e.jsx("span",{style:{fontSize:"var(--text-label)"},children:"Nav load failed"})}),e.jsx("button",{type:"button",className:"mt-2 text-primary cursor-pointer hover:underline",style:{fontSize:"var(--text-label)"},onClick:w,children:"Retry"})]}):I}),L&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[var(--z-shell-overlay,80)] bg-black/40 md:hidden",onClick:()=>M(!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(ar,{rows:6})}):e.jsx(Oe,{brand:g?{name:g.brand.name}:{name:"Sellsuki"},groups:W,activeItem:r,onNavigate:D,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(Rt,{children:u})})]}),e.jsx(Er,{})]})}function so({product:r,user:t,navResolver:o,...a}){var s;return e.jsx(kr,{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})})}so.displayName="AppShell";function no(){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"})]})]})]})}no.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=Yr,C.AccordionItem=Re,C.AdvancedDataTable=Ls,C.Alert=Qe,C.AppShell=so,C.AppShellErrorBoundary=Rt,C.AppShellProvider=kr,C.AppShellSkeleton=no,C.AreaChart=Dt,C.Avatar=Ur,C.AvatarGroup=Xr,C.Badge=mo,C.BarChart=At,C.Breadcrumb=Ko,C.Button=Ze,C.ButtonGroup=uo,C.Card=Kr,C.CardBody=qr,C.CardFooter=Jr,C.CardHeader=Zr,C.Checkbox=Fe,C.CheckboxGroup=yo,C.ChoiceCard=Gt,C.ChoiceCardGroup=Ut,C.ColorPicker=ea,C.ConfirmDialog=Lo,C.DSButton=Ze,C.DSCheckbox=Fe,C.DSInput=qe,C.DSRadio=Ir,C.DSTable=Or,C.DSTextarea=Je,C.DatePicker=Fo,C.DateRangePicker=_t,C.DateTimePicker=Yt,C.Divider=Vr,C.DonutChart=jt,C.Drawer=Rr,C.Dropdown=et,C.EmptyState=la,C.FeaturePageScaffold=to,C.FileUpload=fa,C.FilterBar=ks,C.FormError=zt,C.FormField=is,C.FormHelperText=Ft,C.FormLabel=fr,C.FormSuccess=Ct,C.IconButton=Wr,C.ImageGallery=Jt,C.ImagePreview=ba,C.Input=qe,C.LineChart=Mt,C.Menu=nt,C.MiniSparkline=Et,C.Modal=Pr,C.Notification=it,C.NotificationCenter=ya,C.NumberInput=us,C.OTPInput=vs,C.PageHeader=ws,C.Pagination=jo,C.Popover=Na,C.ProgressBar=dt,C.Radio=Ir,C.RadioCard=Xt,C.RadioGroup=No,C.Rating=Ca,C.RepeatableFieldList=Zt,C.RichTextEditor=qt,C.ScaffoldKPIRow=ao,C.ScaffoldSection=oo,C.SearchField=Io,C.Sidebar=Oe,C.SidebarAccountSwitcher=or,C.Skeleton=se,C.SkeletonCard=Ta,C.SkeletonList=ar,C.SkeletonTable=Ia,C.Spinner=ft,C.StatCard=Pa,C.Statistic=Ha,C.Stepper=mt,C.Switch=Za,C.Table=Or,C.Tabs=_o,C.Tag=xt,C.TagInput=yt,C.Textarea=Je,C.ThumbnailCell=wr,C.TimePicker=xr,C.Timeline=ts,C.ToastContainer=Er,C.Tooltip=rr,C.TopNavbar=lr,C.TransferList=as,C.Tree=ss,C.akitaBrandConfig=xn,C.patonaBrandConfig=pn,C.sellsukiBrandConfig=gn,C.shipmunkBrandConfig=mn,C.sukispaceBrandConfig=vn,C.toast=ye,C.useAppShell=Qt,C.useAppShellFull=Vt,C.useBreadcrumbs=tn,C.useFormField=ls,C.useNavResolver=on,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})}));
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-label, 'DB HeaventRounded', sans-serif)",fontSize:"var(--text-label)"};function ws({title:r,subtitle:t,breadcrumb:o,actions:a,tabs:s,sticky:n=!1,className:l=""}){return e.jsxs("div",{className:`bg-card 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)"},Ye={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-label)",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:Ye,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:Ye})]}),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:Ye,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:Ye,children:[e.jsx(v.X,{size:12}),"Clear all"]})]})}const Lt={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},hr={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},ve={fontFamily:"var(--font-button)",fontSize:"var(--text-button)",fontWeight:400},fe={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:ve,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:ve,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:Lt,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:{...ve,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 Ws({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:ve,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:ve,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(ur,{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:ve,children:"…"},`ellipsis-${u}`):e.jsx(ur,{active:f===o,onClick:()=>t(f,a),label:String(f)},f)),e.jsx(ur,{disabled:o===n,onClick:()=>t(o+1,a),label:"Next ›"})]})]})}function ur({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:{...ve,fontWeight:t?600:400},children:r})}function Ls({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:k="No data found",emptyDescription:z,showColumnToggle:b=!1,size:w="md",stickyHeader:N=!1,className:F=""}){const[L,M]=c.useState(new Set(r.filter(B=>B.defaultHidden).map(B=>B.key))),W=c.useCallback(B=>{M(V=>{const J=new Set(V);return J.has(B)?J.delete(B):J.add(B),J})},[]),D=c.useMemo(()=>r.filter(B=>!L.has(B.key)),[r,L]),[I,A]=c.useState(new Set),S=f??I,$=c.useCallback(B=>{f||A(B);const V=t.filter(J=>B.has(J[o]));u==null||u(B,V)},[f,t,o,u]),E=c.useMemo(()=>t.map(B=>B[o]),[t,o]),T=E.length>0&&E.every(B=>S.has(B)),O=S.size>0&&!T,H=c.useCallback(()=>{$(T?new Set:new Set(E))},[T,E,$]),_=c.useCallback(B=>{const V=new Set(S);V.has(B)?V.delete(B):V.add(B),$(V)},[S,$]),[Q,P]=c.useState(new Set),Z=c.useCallback(B=>{P(V=>{const J=new Set(V);return J.has(B)?J.delete(B):J.add(B),J})},[]),oe=c.useCallback(B=>{d&&(s===B?d(B,n==="asc"?"desc":"asc"):d(B,"asc"))},[s,n,d]),X=c.useMemo(()=>{const B={};let V=0;i&&(V+=48),h&&(V+=40);for(const J of D)if(J.frozen){B[J.key]=V;const le=typeof J.width=="number"?J.width:parseInt(J.width??"120");V+=isNaN(le)?120:le}return B},[D,i,h]),re=D.length+(i?1:0)+(h?1:0),U="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:L,onToggle:W})}),i&&S.size>0&&x.length>0&&e.jsx(Cs,{count:S.size,actions:x,selectedKeys:Array.from(S),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:`${fe[w]} w-10`}),i&&e.jsx("th",{className:`${fe[w]} w-12`,children:e.jsx(Fe,{size:"sm",checked:T,indeterminate:O&&!T,onChange:H})}),D.map(B=>{const V=B.frozen&&B.key in X,J=s===B.key;return e.jsx("th",{className:`${fe[w]} text-${B.align??"left"} text-[var(--foreground)] whitespace-nowrap select-none ${B.sortable&&d?"cursor-pointer hover:text-[var(--primary)]":""} ${V?U:""}`,style:{...Lt,width:B.width,minWidth:B.minWidth??80,...V?{left:X[B.key],boxShadow:"2px 0 4px rgba(0,0,0,0.04)"}:{}},onClick:()=>B.sortable&&oe(B.key),children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[B.header,B.sortable&&d&&e.jsx("span",{className:J?"text-[var(--primary)]":"text-[var(--muted-foreground)]/60",children:J?n==="asc"?e.jsx(v.ChevronUp,{size:13}):e.jsx(v.ChevronDown,{size:13}):e.jsx(v.ChevronsUpDown,{size:12})})]})},B.key)})]})}),e.jsxs("tbody",{children:[m&&e.jsx("tr",{children:e.jsx("td",{colSpan:re,className:`${fe[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:hr,children:m})]})})}),!m&&p&&Array.from({length:g}).map((B,V)=>e.jsxs("tr",{className:"border-b border-[var(--border)] last:border-b-0",children:[h&&e.jsx("td",{className:`${fe[w]} w-10`}),i&&e.jsx("td",{className:`${fe[w]} w-12`,children:e.jsx("div",{className:"w-4 h-4 rounded bg-muted animate-pulse"})}),D.map(J=>e.jsx("td",{className:`${fe[w]}`,children:e.jsx($s,{width:J.align==="right"?"60%":J.align==="center"?"50%":"75%"})},J.key))]},`skel-${V}`)),!m&&!p&&t.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:re,className:`${fe[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:hr,children:k}),z&&e.jsx("span",{className:"text-[var(--muted-foreground)]",style:ve,children:z})]})})}),!m&&!p&&t.map((B,V)=>{const J=B[o],le=S.has(J),me=Q.has(J),Ie=!!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)]"} ${Ie?"cursor-pointer":""}`,onClick:()=>{y==null||y(B),h&&Z(J)},children:[h&&e.jsx("td",{className:`${fe[w]} w-10 text-center`,onClick:q=>{q.stopPropagation(),Z(J)},children:e.jsx(v.ChevronRight,{size:14,className:`text-[var(--muted-foreground)] transition-transform mx-auto ${me?"rotate-90":""}`})}),i&&e.jsx("td",{className:`${fe[w]} w-12`,onClick:q=>q.stopPropagation(),children:e.jsx(Fe,{size:"sm",checked:le,onChange:()=>_(J)})}),D.map(q=>{const xe=q.frozen&&q.key in X,Ne=xe?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:`${fe[w]} text-${q.align??"left"} text-[var(--foreground)] ${Ne}`,style:{...hr,...xe?{left:X[q.key],boxShadow:"2px 0 4px rgba(0,0,0,0.04)"}:{}},children:q.render?q.render(B[q.key],B,V):B[q.key]},q.key)})]}),h&&me&&e.jsx("tr",{className:"bg-[var(--muted)] border-b border-[var(--border)]",children:e.jsx("td",{colSpan:re,className:"px-6 py-4",children:h(B)})})]},J??V)})]})]})}),a&&l&&!p&&!m&&e.jsx(Ws,{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-label)",fontWeight:"var(--weight-label)"};function br(r,t,o){return Math.max(t,Math.min(o,r))}function Ge(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 gr(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 pr({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 Mt({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=Ge(g),k=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,L=p.length>1?N/(p.length-1):N;function M(I){return z.left+I*L}function W(I){return z.top+F-(I-k)/(m-k||1)*F}const D=Array.from({length:5},(I,A)=>k+A/4*(m-k));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&&D.map((I,A)=>e.jsx("line",{x1:z.left,y1:W(I),x2:b-z.right,y2:W(I),stroke:"var(--border)",strokeWidth:.5,strokeDasharray:"4 2"},A)),s&&D.map((I,A)=>e.jsx("text",{x:z.left-8,y:W(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 S=Math.max(1,Math.floor(p.length/8));return A%S!==0&&A!==p.length-1?null:e.jsx("text",{x:M(A),y:w-z.bottom+16,textAnchor:"middle",fill:"var(--muted-foreground)",style:ne,children:I},A)}),r.map((I,A)=>{const S=ie(I,A),$=I.data.map((T,O)=>[M(O),W(T.value)]),E=gr($,f);return e.jsxs("g",{children:[e.jsx("path",{d:E,fill:"none",stroke:S,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),i&&$.map(([T,O],H)=>e.jsx("circle",{cx:T,cy:O,r:3,fill:"var(--card)",stroke:S,strokeWidth:2},H))]},A)}),d&&p.map((I,A)=>e.jsx("rect",{x:M(A)-L/2,y:z.top,width:L,height:F,fill:"transparent",onMouseEnter:()=>h({x:M(A),y:z.top,labelIdx:A})},A)),y&&e.jsx("line",{x1:M(y.labelIdx),y1:z.top,x2:M(y.labelIdx),y2:z.top+F,stroke:"var(--border)",strokeWidth:1,strokeDasharray:"4 2"}),y&&d&&e.jsx(pr,{x:br(M(y.labelIdx)+8,z.left,b-180),y:z.top,label:p[y.labelIdx],items:r.map((I,A)=>{var S;return{name:I.name,value:((S=I.data[y.labelIdx])==null?void 0:S.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))})]})}Mt.displayName="LineChart";function Dt({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(S=>S.label),m=r.flatMap(S=>S.data.map($=>$.value)),k=Ge(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,L=N-b.top-b.bottom,M=g.length>1?F/(g.length-1):F;function W(S){return b.left+S*M}function D(S){return b.top+L-(S-z)/(k-z||1)*L}const I=Array.from({length:5},(S,$)=>z+$/4*(k-z)),A=b.top+L;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((S,$)=>e.jsxs("linearGradient",{id:`${y}-grad-${$}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:ie(S,$),stopOpacity:u*4}),e.jsx("stop",{offset:"100%",stopColor:ie(S,$),stopOpacity:0})]},$))}),n&&I.map((S,$)=>e.jsx("line",{x1:b.left,y1:D(S),x2:w-b.right,y2:D(S),stroke:"var(--border)",strokeWidth:.5,strokeDasharray:"4 2"},$)),s&&I.map((S,$)=>e.jsx("text",{x:b.left-8,y:D(S)+4,textAnchor:"end",fill:"var(--muted-foreground)",style:ne,children:S>=1e3?`${(S/1e3).toFixed(1)}k`:S},$)),a&&g.map((S,$)=>{const E=Math.max(1,Math.floor(g.length/8));return $%E!==0&&$!==g.length-1?null:e.jsx("text",{x:W($),y:N-b.bottom+16,textAnchor:"middle",fill:"var(--muted-foreground)",style:ne,children:S},$)}),r.map((S,$)=>{const E=ie(S,$),T=S.data.map((_,Q)=>[W(Q),D(_.value)]),O=gr(T,f),H=O+` L${T[T.length-1][0]},${A} L${T[0][0]},${A} Z`;return e.jsxs("g",{children:[e.jsx("path",{d:H,fill:`url(#${y}-grad-${$})`}),e.jsx("path",{d:O,fill:"none",stroke:E,strokeWidth:2,strokeLinecap:"round"}),i&&T.map(([_,Q],P)=>e.jsx("circle",{cx:_,cy:Q,r:3,fill:"var(--card)",stroke:E,strokeWidth:2},P))]},$)}),d&&g.map((S,$)=>e.jsx("rect",{x:W($)-M/2,y:b.top,width:M,height:L,fill:"transparent",onMouseEnter:()=>p({x:W($),y:b.top,labelIdx:$})},$)),h&&e.jsx("line",{x1:W(h.labelIdx),y1:b.top,x2:W(h.labelIdx),y2:b.top+L,stroke:"var(--border)",strokeWidth:1,strokeDasharray:"4 2"}),h&&e.jsx(pr,{x:br(W(h.labelIdx)+8,b.left,w-180),y:b.top,label:g[h.labelIdx],items:r.map((S,$)=>{var E;return{name:S.name,value:((E=S.data[h.labelIdx])==null?void 0:E.value)??0,color:ie(S,$)}})})]}),l&&r.length>1&&e.jsx("div",{className:"flex flex-wrap gap-4 mt-2 justify-center",children:r.map((S,$)=>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(S,$)}}),e.jsx("span",{className:"text-muted-foreground",children:S.name})]},$))})]})}Dt.displayName="AreaChart";function At({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=Ge(h.map((A,S)=>r.reduce(($,E)=>{var T;return $+(((T=E.data[S])==null?void 0:T.value)??0)},0))):p=Ge(r.flatMap(A=>A.data.map(S=>S.value)));const g={top:12,right:16,bottom:a?36:12,left:s?48:16},m=o??600,k=t,z=m-g.left-g.right,b=k-g.top-g.bottom,w=z/h.length,N=w*.2,F=w-N*2,L=i?F:F/r.length;function M(A){return g.top+b-A/p*b}function W(A){return A/p*b}function D(A){return g.left+A*w+N}const I=Array.from({length:5},(A,S)=>S/4*p);return e.jsxs("div",{className:`w-full ${u}`,children:[e.jsxs("svg",{width:o?m:"100%",height:k,viewBox:`0 0 ${m} ${k}`,onMouseLeave:()=>y(null),children:[n&&I.map((A,S)=>e.jsx("line",{x1:g.left,y1:M(A),x2:m-g.right,y2:M(A),stroke:"var(--border)",strokeWidth:.5,strokeDasharray:"4 2"},S)),s&&I.map((A,S)=>e.jsx("text",{x:g.left-8,y:M(A)+4,textAnchor:"end",fill:"var(--muted-foreground)",style:ne,children:A>=1e3?`${(A/1e3).toFixed(1)}k`:A},S)),a&&h.map((A,S)=>e.jsx("text",{x:D(S)+F/2,y:k-g.bottom+16,textAnchor:"middle",fill:"var(--muted-foreground)",style:ne,children:A},S)),h.map((A,S)=>{if(i){let $=g.top+b;return e.jsx("g",{children:r.map((E,T)=>{var V;const O=((V=E.data[S])==null?void 0:V.value)??0,H=W(O),_=$-H;$=_;const Q=ie(E,T),P=T===r.length-1,Z=T===0,oe=f,X=D(S),re=F,U=H,B=P&&Z?`M${X},${_+oe} Q${X},${_} ${X+oe},${_} L${X+re-oe},${_} Q${X+re},${_} ${X+re},${_+oe} L${X+re},${_+U} L${X},${_+U} Z`:P?`M${X},${_+oe} Q${X},${_} ${X+oe},${_} L${X+re-oe},${_} Q${X+re},${_} ${X+re},${_+oe} L${X+re},${_+U} L${X},${_+U} Z`:`M${X},${_} L${X+re},${_} L${X+re},${_+U} L${X},${_+U} Z`;return e.jsx("path",{d:B,fill:Q},T)})},S)}else return e.jsx("g",{children:r.map(($,E)=>{var Z;const T=((Z=$.data[S])==null?void 0:Z.value)??0,O=W(T),H=D(S)+E*L,_=M(T),Q=ie($,E),P=Math.min(f,L/2);return e.jsx("path",{d:`M${H},${_+P} Q${H},${_} ${H+P},${_} L${H+L-P},${_} Q${H+L},${_} ${H+L},${_+P} L${H+L},${_+O} L${H},${_+O} Z`,fill:Q},E)})},S)}),d&&h.map((A,S)=>e.jsx("rect",{x:D(S),y:g.top,width:F,height:b,fill:"transparent",style:{cursor:"default"},onMouseEnter:()=>y({x:D(S)+F/2,y:g.top,labelIdx:S})},S)),x&&e.jsx(pr,{x:br(x.x+8,g.left,m-180),y:g.top,label:h[x.labelIdx],items:r.map((A,S)=>{var $;return{name:A.name,value:(($=A.data[x.labelIdx])==null?void 0:$.value)??0,color:ie(A,S)}})})]}),l&&r.length>1&&e.jsx("div",{className:"flex flex-wrap gap-4 mt-2 justify-center",children:r.map((A,S)=>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,S)}}),e.jsx("span",{className:"text-muted-foreground",children:A.name})]},S))})]})}At.displayName="BarChart";function jt({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,L=g+N*2*Math.PI;g=L;const M=x+h*Math.cos(F),W=y+h*Math.sin(F),D=x+h*Math.cos(L),I=y+h*Math.sin(L),A=x+p*Math.cos(L),S=y+p*Math.sin(L),$=x+p*Math.cos(F),E=y+p*Math.sin(F),T=N>.5?1:0;return{path:[`M${M},${W}`,`A${h},${h} 0 ${T} 1 ${D},${I}`,`L${A},${S}`,`A${p},${p} 0 ${T} 0 ${$},${E}`,"Z"].join(" "),color:b.color??We[w%We.length],ratio:N,d:b,i:w}}),k=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():k}),(a||z)&&e.jsx("text",{x,y:y+12,textAnchor:"middle",fill:"var(--muted-foreground)",style:{...ne,fontSize:"var(--text-caption)"},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))})]})}jt.displayName="DonutChart";function Et({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,k=a-g*2;function z(L){return g+L/(r.length-1||1)*m}function b(L){return g+k-(L-i)/u*k}if(t==="bar"){const L=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((M,W)=>{const D=(M-i)/u*k;return e.jsx("rect",{x:g+W*(m/r.length),y:g+k-D,width:L,height:D,fill:p,rx:1,opacity:W===r.length-1?1:.5},W)})}),n&&e.jsx("span",{style:{...ne,color:p},children:r[r.length-1].toLocaleString()})]})}const w=r.map((L,M)=>[z(M),b(L)]),N=gr(w,!1),F=N+` L${w[w.length-1][0]},${g+k} L${w[0][0]},${g+k} 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()})]})}Et.displayName="MiniSparkline";function ge(r){const t=new Date(r);return t.setHours(0,0,0,0),t}function pe(r){const t=new Date(r);return t.setHours(23,59,59,999),t}const Ms=[{label:"Today",value:"today",range:()=>{const r=new Date;return{from:ge(r),to:pe(r)}}},{label:"Yesterday",value:"yesterday",range:()=>{const r=new Date;return r.setDate(r.getDate()-1),{from:ge(r),to:pe(r)}}},{label:"Last 7 days",value:"last7",range:()=>{const r=new Date,t=new Date;return t.setDate(t.getDate()-6),{from:ge(t),to:pe(r)}}},{label:"Last 30 days",value:"last30",range:()=>{const r=new Date,t=new Date;return t.setDate(t.getDate()-29),{from:ge(t),to:pe(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:ge(t),to:pe(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:ge(t),to:pe(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 vr(r){return r?r.toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}):""}function mr(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)"},Tt={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},It={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"},Ts={sm:"h-8 px-3",md:"h-10 px-3.5",lg:"h-11 px-4"};function Bt({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,k]=p<=g?[p,g]:[g,p];return h>m&&h<k}function y(h){return!!(i&&h<ge(i)||f&&h>pe(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:It,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:Tt,children:h},h))}),e.jsx("div",{className:"grid grid-cols-7",children:u.map((h,p)=>{const g=h.getMonth()===r,m=o.from?mr(h,o.from):!1,k=o.to?mr(h,o.to):a&&o.from?mr(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||k?"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:Tt,children:h.getDate()},p)})})]})}function _t({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),[k,z]=c.useState(void 0),[b,w]=c.useState(u.getMonth()),[N,F]=c.useState(u.getFullYear()),[L,M]=c.useState("from"),[W,D]=c.useState({top:0,left:0,width:0}),I=c.useRef(null),A=c.useRef(null),S=r??h,$=(b+1)%12,E=b===11?N+1:N;c.useEffect(()=>{function P(Z){I.current&&!I.current.contains(Z.target)&&y(!1)}return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]),c.useEffect(()=>{if(!x||!A.current)return;const P=()=>{const Z=A.current.getBoundingClientRect();D({top:Z.bottom+4,left:Z.left,width:Z.width})};return P(),window.addEventListener("scroll",P,!0),window.addEventListener("resize",P),()=>{window.removeEventListener("scroll",P,!0),window.removeEventListener("resize",P)}},[x]);function T(P){if(P.value==="custom"){z("custom");return}const Z=P.range();p(Z),t==null||t(Z,P.value),z(P.value),y(!1)}function O(P){if(L==="from")p({from:ge(P),to:null}),M("to");else{const Z=h.from,[oe,X]=P>=Z?[Z,pe(P)]:[ge(P),pe(Z)],re={from:oe,to:X};p(re),t==null||t(re,"custom"),z("custom"),M("from"),y(!1)}}function H(P){P.stopPropagation();const Z={from:null,to:null};p(Z),t==null||t(Z,void 0),z(void 0)}const _=S.from&&S.to?`${vr(S.from)} – ${vr(S.to)}`:S.from?`${vr(S.from)} – ...`:"",Q=Ms.filter(P=>o.includes(P.value));return e.jsxs("div",{ref:I,className:`relative inline-block ${f}`,children:[e.jsxs("button",{ref:A,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:_?"text-foreground flex-1":"text-muted-foreground flex-1",children:_||a}),d&&S.from&&e.jsx("span",{role:"button",tabIndex:0,onClick:H,onKeyDown:P=>P.key==="Enter"&&H(P),className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer flex-shrink-0",children:e.jsx(v.X,{size:12})})]}),x&&Ce.createPortal(e.jsxs("div",{className:"fixed z-[9999] 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:{top:W.top,left:W.left,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:Q.map(P=>e.jsx("button",{type:"button",onClick:()=>T(P),className:["w-full text-left px-3 py-1.5 rounded-none transition-colors",k===P.value?"bg-primary/10 text-primary":"text-foreground hover:bg-muted/30"].join(" "),style:It,children:P.label},P.value))}),e.jsxs("div",{className:"flex gap-4 p-4 flex-1 min-w-0",children:[e.jsx(Bt,{month:b,year:N,range:S,hovered:g,onHover:m,onSelect:O,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(Bt,{month:$,year:E,range:S,hovered:g,onHover:m,onSelect:O,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})]})]}),document.body)]})}_t.displayName="DateRangePicker";function he(r){return String(r).padStart(2,"0")}function Ht(r,t,o){if(t==="12h"){const a=r.hours%12||12,s=r.hours<12?"AM":"PM";return o?`${he(a)}:${he(r.minutes)}:${he(r.seconds??0)} ${s}`:`${he(a)}:${he(r.minutes)} ${s}`}return o?`${he(r.hours)}:${he(r.minutes)}:${he(r.seconds??0)}`:`${he(r.hours)}:${he(r.minutes)}`}const Pt={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-p)"},Ue={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)",fontVariantNumeric:"tabular-nums"},Ot={sm:"h-8 px-3",md:"h-10 px-3.5",lg:"h-11 px-4"};function Xe({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:Ue,children:he(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-label)"},children:a})]})}function xr({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},(W,D)=>D+1):Array.from({length:24},(W,D)=>D),m=Array.from({length:Math.ceil(60/s)},(W,D)=>D*s),k=Array.from({length:60},(W,D)=>D),z=["AM","PM"];c.useEffect(()=>{function W(D){h.current&&!h.current.contains(D.target)&&u(!1)}return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[]);function b(W){const D={...p,...W};y(D),t==null||t(D)}const w=Ht(p,o,a),N=r!==void 0||x.hours!==0||x.minutes!==0,F=o==="12h"?p.hours%12||12:p.hours,L=p.hours<12;function M(W,D){let I=W%12;D||(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]",Ot[l],f?"border-primary ring-2 ring-primary/20":"hover:border-primary/40",d?"opacity-50 cursor-not-allowed":"cursor-pointer"].join(" "),style:Pt,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(Xe,{options:g,value:F,onChange:W=>M(W,L),label:"Hour"}):e.jsx(Xe,{options:g,value:p.hours,onChange:W=>b({hours:W}),label:"Hour"}),e.jsx("div",{className:"text-muted-foreground text-lg mt-3",style:Ue,children:":"}),e.jsx(Xe,{options:m,value:p.minutes,onChange:W=>b({minutes:W}),label:"Min"}),a&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-muted-foreground text-lg mt-3",style:Ue,children:":"}),e.jsx(Xe,{options:k,value:p.seconds??0,onChange:W=>b({seconds:W}),label:"Sec"})]}),o==="12h"&&e.jsxs("div",{className:"flex flex-col gap-1 ml-1",children:[e.jsx("div",{className:"h-5"}),z.map(W=>e.jsx("button",{type:"button",onClick:()=>M(F,W==="AM"),className:["px-2 py-1 rounded-[var(--radius-md)] transition-colors",W==="AM"===L?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted/30 cursor-pointer"].join(" "),style:Ue,children:W},W))]})]})})]})}xr.displayName="TimePicker";function Yt({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,[k,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 L($){const E=new Date(g);E.setHours($.hours,$.minutes,$.seconds??0,0),N(E)}const M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],W=["Su","Mo","Tu","We","Th","Fr","Sa"];function D(){const $=[],E=new Date(b,k,1),T=new Date(E);T.setDate(T.getDate()-T.getDay());for(let O=0;O<42;O++)$.push(new Date(T)),T.setDate(T.getDate()+1);return $}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)"},S=`${g.toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"})} ${Ht({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]",Ot[n],u?"border-primary ring-2 ring-primary/20":"hover:border-primary/40",i?"opacity-50 cursor-not-allowed":"cursor-pointer"].join(" "),style:Pt,children:[e.jsx(v.Clock,{size:14,className:"text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"text-foreground",children:S})]}),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:()=>{k===0?(z(11),w(b-1)):z(k-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:[M[k]," ",b]}),e.jsx("button",{type:"button",onClick:()=>{k===11?(z(0),w(b+1)):z(k+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:W.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:D().map(($,E)=>{const T=$.getMonth()===k,O=r?$.toDateString()===r.toDateString():$.toDateString()===y.toDateString(),H=$.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",O?"bg-primary text-primary-foreground font-semibold":H?"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(xr,{value:{hours:g.getHours(),minutes:g.getMinutes(),seconds:g.getSeconds()},onChange:L,format:o,showSeconds:a,size:"sm"})]})]})]})}Yt.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-label)",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)]",md:"w-10 h-10 rounded-[var(--radius-md)]",lg:"w-12 h-12 rounded-[var(--radius-md)] text-lg"};function Gt({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})})]})}Gt.displayName="ChoiceCard";function Ut({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)})}Ut.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-label)",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 Xt({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)})})}Xt.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)"},Kt={fontFamily:"var(--font-label)",fontSize:"var(--text-button)",fontWeight:"var(--weight-button)"};function Zt({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,L)=>{h(y.map(M=>M.id===N?{...M,values:{...M.values,[F]:L}}:M))},k=(N,F)=>{const L=[...y],[M]=L.splice(N,1);L.splice(F,0,M),h(L)},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:L=>{L.preventDefault()},onDrop:()=>{w.current!==null&&w.current!==F&&(k(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(L=>e.jsx("div",{style:{width:L.width??"1fr",flex:L.width?"none":"1"},className:"min-w-0",children:L.render(N.values[L.key],M=>m(N.id,L.key,M),F)},L.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:Kt,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:Kt,children:[e.jsx(v.Plus,{size:14}),l]})]})}Zt.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 qt({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,k]=c.useState(!r);c.useEffect(()=>{x.current&&r&&x.current.innerHTML!==r&&(x.current.innerHTML=r,k(!1))},[]);const z=c.useCallback(()=>{const M=new Set;["bold","italic","underline","strikethrough","insertUnorderedList","insertOrderedList","justifyLeft","justifyCenter","justifyRight"].forEach(W=>{try{document.queryCommandState(W)&&M.add(W)}catch{}}),g(M)},[]);function b(M){var W;if(!(d||i)){if((W=x.current)==null||W.focus(),M.startsWith("formatBlock-")){const D=M.replace("formatBlock-","");document.execCommand("formatBlock",!1,D)}else if(M==="createLink"){const D=window.prompt("Enter URL:");D&&document.execCommand("createLink",!1,D)}else document.execCommand(M,!1);z(),x.current&&t&&t(x.current.innerHTML)}}function w(){if(x.current){const M=x.current.innerHTML,W=x.current.innerText.trim();k(!W),t==null||t(M),z()}}const F=a??{sm:120,md:160,lg:240}[f],L=["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:L,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((M,W)=>{const D=Qs[M];return e.jsxs(c.Fragment,{children:[W>0&&e.jsx("div",{className:"w-px h-5 bg-border mx-1"}),D.map(I=>{const A=I.icon,S=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",S?"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)})]},M)}),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})]})]})}qt.displayName="RichTextEditor";const yr={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",fontWeight:"var(--weight-label)"},Le={fontFamily:"var(--font-label)",fontSize:"var(--text-label)",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:Le,children:[n.name," ",n.size?`· ${n.size}`:""]}),r.length>1&&e.jsxs("p",{className:"text-center text-white/40 mt-1",style:Le,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 wr({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:yr,children:o}),a&&e.jsx("div",{className:"truncate text-muted-foreground",style:Le,children:a})]})]})}wr.displayName="ThumbnailCell";function Jt({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),k=c.useRef(null);function z(N){if(x)return;if(o.includes(N))a==null||a(o.filter(L=>L!==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:yr,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:Le,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:k,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:w}),e.jsxs("button",{type:"button",disabled:x,onClick:()=>{var N;return(N=k.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:Le,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 L=o.includes(N.id);return e.jsxs("div",{className:["relative group rounded-[var(--radius-md)] overflow-hidden border transition-all cursor-pointer",L?"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",L?"bg-primary border-primary":"bg-white/80 border-white"].join(" "),children:L&&e.jsx(v.Check,{size:10,className:"text-primary-foreground"})}),i&&e.jsx("button",{type:"button",onClick:M=>{M.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 L=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",L?"border-primary bg-primary/5":"border-border hover:bg-muted/10"].join(" "),onClick:()=>b(F,N.id),children:[e.jsx(wr,{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:yr,children:N.name??N.alt??`Image ${F+1}`}),N.size&&e.jsx("div",{className:"text-muted-foreground",style:Le,children:N.size})]}),t&&L&&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:M=>{M.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)})]})}Jt.displayName="ImageGallery";const Nr=c.createContext(null);Nr.displayName="AppShellContext";const Sr=c.createContext(null);Sr.displayName="AppShellFullContext";function kr({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}),k=c.useRef(0),z=c.useCallback(async()=>{if(!o||!r){m({groups:[],loading:!1,error:null});return}const w=++k.current;m(N=>({...N,loading:!0,error:null}));try{const N=await o(r);if(w!==k.current)return;m({groups:N,loading:!1,error:null})}catch(N){if(w!==k.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(Sr.Provider,{value:b,children:e.jsx(Nr.Provider,{value:b,children:l})})}kr.displayName="AppShellProvider";function Qt(){const r=c.useContext(Nr);if(!r)throw new Error("[useAppShell] must be used inside <AppShellProvider>. Wrap your app root with <AppShellProvider user={...} product={...}>.");return r}function Vt(){const r=c.useContext(Sr);if(!r)throw new Error("[useAppShellFull] must be used inside <AppShellProvider>.");return r}function tn(r){const{setBreadcrumbs:t}=Qt(),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 Rt 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 R({children:r,className:t=""}){return r?e.jsx("div",{className:t,children:r}):null}function eo({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 ro({p:r}){const t=r.gap??"gap-5";return e.jsxs("div",{className:`flex flex-col ${t}`,children:[e.jsx(R,{children:r.header}),e.jsx(R,{children:r.banner}),e.jsx(R,{children:r.stats}),e.jsx(R,{children:r.filters}),e.jsx(R,{className:"min-h-0",children:r.content}),e.jsx(R,{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(R,{children:r.header}),e.jsx(R,{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(R,{children:r.header}),e.jsx(R,{children:r.banner}),e.jsx(R,{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(R,{children:r.header}),e.jsx(R,{children:r.banner}),e.jsx(R,{children:r.stepper}),e.jsx(R,{className:"flex-1",children:r.form??r.content})]}),e.jsx(eo,{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(R,{children:r.header}),e.jsx(R,{children:r.banner}),e.jsx(R,{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(R,{children:r.primaryChart??r.charts}),e.jsx(R,{children:r.secondaryCharts})]}),e.jsx(R,{children:r.content??r.table}),e.jsx(R,{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(R,{children:r.header}),e.jsx(R,{children:r.banner}),e.jsx(R,{className:"flex-1 max-w-2xl",children:r.form??r.content})]}),e.jsx(eo,{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(R,{children:r.header}),e.jsx(R,{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(R,{children:r.filters}),e.jsx(R,{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(R,{children:r.table??r.content}),e.jsx(R,{children:r.footer})]})}function to(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(ro,{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(ro,{p:r})}})();return e.jsx("div",{className:`${n} ${l} ${s}`,children:d})}to.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 oo({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})]})}oo.displayName="ScaffoldSection";function ao({children:r,className:t=""}){return e.jsx("div",{className:`grid grid-cols-2 lg:grid-cols-4 gap-4 ${t}`,children:r})}ao.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,S,$,E;const{sidebarOpen:y,setSidebarOpen:h,user:p,product:g,breadcrumbs:m,navGroups:k,navLoading:z,navError:b,refreshNav:w}=Vt(),[N,F]=c.useState(!(((A=g==null?void 0:g.shell)==null?void 0:A.sidebarDefaultOpen)??!0)),[L,M]=c.useState(!1);c.useEffect(()=>{function T(){window.innerWidth>=768&&M(!1)}return window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)},[]);const W=un(k),D=c.useCallback(T=>{const O=k.flatMap(H=>H.items).find(H=>H.id===T.id);O&&t&&t(O),M(!1)},[k,t]),I=e.jsx(Oe,{brand:g?{name:g.brand.name}:{name:"Sellsuki"},groups:z?[{label:"Loading",items:[]}]:W,activeItem:r,onNavigate:D,collapsed:N,onCollapsedChange:F,showCollapseToggle:((S=g==null?void 0:g.shell)==null?void 0:S.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(lr,{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?M(T=>!T):F(T=>!T)},onMobileMenuClick:()=>M(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(ar,{rows:6})}):b?e.jsxs("div",{className:"p-3",children:[e.jsx(Qe,{variant:"error",children:e.jsx("span",{style:{fontSize:"var(--text-label)"},children:"Nav load failed"})}),e.jsx("button",{type:"button",className:"mt-2 text-primary cursor-pointer hover:underline",style:{fontSize:"var(--text-label)"},onClick:w,children:"Retry"})]}):I}),L&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[var(--z-shell-overlay,80)] bg-black/40 md:hidden",onClick:()=>M(!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(ar,{rows:6})}):e.jsx(Oe,{brand:g?{name:g.brand.name}:{name:"Sellsuki"},groups:W,activeItem:r,onNavigate:D,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(Rt,{children:u})})]}),e.jsx(Er,{})]})}function so({product:r,user:t,navResolver:o,...a}){var s;return e.jsx(kr,{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})})}so.displayName="AppShell";function no(){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"})]})]})]})}no.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=Yr,C.AccordionItem=Re,C.AdvancedDataTable=Ls,C.Alert=Qe,C.AppShell=so,C.AppShellErrorBoundary=Rt,C.AppShellProvider=kr,C.AppShellSkeleton=no,C.AreaChart=Dt,C.Avatar=Ur,C.AvatarGroup=Xr,C.Badge=mo,C.BarChart=At,C.Breadcrumb=Ko,C.Button=Ze,C.ButtonGroup=uo,C.Card=Kr,C.CardBody=qr,C.CardFooter=Jr,C.CardHeader=Zr,C.Checkbox=Fe,C.CheckboxGroup=yo,C.ChoiceCard=Gt,C.ChoiceCardGroup=Ut,C.ColorPicker=ea,C.ConfirmDialog=Lo,C.DSButton=Ze,C.DSCheckbox=Fe,C.DSInput=qe,C.DSRadio=Ir,C.DSTable=Or,C.DSTextarea=Je,C.DatePicker=Fo,C.DateRangePicker=_t,C.DateTimePicker=Yt,C.Divider=Vr,C.DonutChart=jt,C.Drawer=Rr,C.Dropdown=et,C.EmptyState=la,C.FeaturePageScaffold=to,C.FileUpload=fa,C.FilterBar=ks,C.FormError=zt,C.FormField=is,C.FormHelperText=Ft,C.FormLabel=fr,C.FormSuccess=Ct,C.IconButton=Wr,C.ImageGallery=Jt,C.ImagePreview=ba,C.Input=qe,C.LineChart=Mt,C.Menu=nt,C.MiniSparkline=Et,C.Modal=Pr,C.Notification=it,C.NotificationCenter=ya,C.NumberInput=us,C.OTPInput=vs,C.PageHeader=ws,C.Pagination=jo,C.Popover=Na,C.ProgressBar=dt,C.Radio=Ir,C.RadioCard=Xt,C.RadioGroup=No,C.Rating=Ca,C.RepeatableFieldList=Zt,C.RichTextEditor=qt,C.ScaffoldKPIRow=ao,C.ScaffoldSection=oo,C.SearchField=Io,C.Sidebar=Oe,C.SidebarAccountSwitcher=or,C.Skeleton=se,C.SkeletonCard=Ta,C.SkeletonList=ar,C.SkeletonTable=Ia,C.Spinner=ft,C.StatCard=Pa,C.Statistic=Ha,C.Stepper=mt,C.Switch=Za,C.Table=Or,C.Tabs=_o,C.Tag=xt,C.TagInput=yt,C.Textarea=Je,C.ThumbnailCell=wr,C.TimePicker=xr,C.Timeline=ts,C.ToastContainer=Er,C.Tooltip=rr,C.TopNavbar=lr,C.TransferList=as,C.Tree=ss,C.akitaBrandConfig=xn,C.patonaBrandConfig=pn,C.sellsukiBrandConfig=gn,C.shipmunkBrandConfig=mn,C.sukispaceBrandConfig=vn,C.toast=ye,C.useAppShell=Qt,C.useAppShellFull=Vt,C.useBreadcrumbs=tn,C.useFormField=ls,C.useNavResolver=on,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})}));
95
95
  //# sourceMappingURL=sellsuki-ds.umd.cjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxuissk/design-system",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "workspaces": [