@opencxh/ui-kit 3.172.0 → 3.175.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const gt=require("clsx"),d=require("react"),e=require("react/jsx-runtime"),P=require("lucide-react"),bt=require("dompurify"),pt=require("react-markdown"),vt=require("remark-gfm");function jt(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return s.default=t,Object.freeze(s)}const yt=jt(P);function c(...t){return gt.clsx(t)}function Nt(t){return(s,r)=>t[s]?.[r]||""}function wt(t){return s=>t[s]||""}function Ne(t,s,{gap:r=6,matchWidth:n=!1,placement:a="bottom-start"}={}){const[l,o]=d.useState({});return d.useLayoutEffect(()=>{if(!t)return;const u=()=>{const i=s.current;if(!i)return;const v=i.getBoundingClientRect(),x=window.innerHeight-v.bottom,m=v.top,g=a.startsWith("top"),b=g?m<200&&x>m:x<200&&m>x,y=g!==b,p={position:"fixed"};y?(p.bottom=window.innerHeight-v.top+r,p.maxHeight=Math.max(120,m-r*2)):(p.top=v.bottom+r,p.maxHeight=Math.max(120,x-r*2)),a.endsWith("end")?p.right=window.innerWidth-v.right:p.left=v.left,n&&(p.width=v.width),o(p)};return u(),window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[t,s,r,n,a]),l}const Ue=5;function kt(t){let s=2166136261;for(let r=0;r<t.length;r++)s^=t.charCodeAt(r),s=Math.imul(s,16777619);return s>>>0}function _e(t){const s=(t??"").trim().toLowerCase();return s?kt(s)%Ue+1:1}const Ct={1:"bg-cat-1-soft text-cat-1-fg",2:"bg-cat-2-soft text-cat-2-fg",3:"bg-cat-3-soft text-cat-3-fg",4:"bg-cat-4-soft text-cat-4-fg",5:"bg-cat-5-soft text-cat-5-fg"},St={1:"bg-cat-1",2:"bg-cat-2",3:"bg-cat-3",4:"bg-cat-4",5:"bg-cat-5"};function Le(t){return Ct[_e(t)]}function Et(t){return St[_e(t)]}const Be=["cat-1","cat-2","cat-3","cat-4","cat-5"];function Mt(t){let s=0;for(let r=0;r<t.length;r++)s=s*31+t.charCodeAt(r)>>>0;return Be[s%Be.length]}const je=t=>t==null?"":String(t),Ke=t=>je(t).trim().toLowerCase(),Tt=[{upTo:1,cols:"grid-cols-1"},{upTo:2,cols:"grid-cols-1 @[22rem]:grid-cols-2"},{upTo:4,cols:"grid-cols-1 @[18rem]:grid-cols-2"},{upTo:9,cols:"grid-cols-2 @[26rem]:grid-cols-3"}],zt="grid-cols-2 @[26rem]:grid-cols-3 @[40rem]:grid-cols-4";function Dt(t){return Tt.find(s=>t<=s.upTo)?.cols??zt}function At(t,s){const r=s??t;if(t<=r)return{shown:t,hidden:0};const n=Math.max(0,r-1);return{shown:n,hidden:t-n}}function _t({tiles:t,pinned:s,maxStrip:r,className:n}){if(s){const{shown:a,hidden:l}=At(t.length,r),o=t.slice(0,a);return e.jsxs("div",{className:c("@container flex h-full min-h-0 flex-col gap-2",n),children:[e.jsx("div",{className:"min-h-0 flex-1",children:s}),t.length>0&&e.jsxs("div",{className:"flex h-[22%] min-h-14 shrink-0 gap-2 overflow-x-auto",children:[o.map((u,i)=>e.jsx("div",{className:"h-full min-w-0 shrink-0 aspect-video",children:u},i)),l>0&&e.jsxs("div",{className:"flex h-full aspect-video shrink-0 items-center justify-center rounded-lg bg-video-surface text-sm font-semibold tabular-nums text-white/80",children:["+",l]})]})]})}return e.jsx("div",{className:c("@container grid h-full min-h-0 auto-rows-fr gap-2",Dt(t.length),n),children:t.map((a,l)=>e.jsx("div",{className:"min-h-0 min-w-0",children:a},l))})}function Lt({name:t,avatarUrl:s,muted:r,speaking:n,hasVideo:a,videoSlot:l,className:o,fill:u}){return e.jsxs("div",{className:c("@container relative flex min-h-0 min-w-0 items-center justify-center overflow-hidden rounded-lg bg-video-surface",u?"h-full w-full":"aspect-video",n&&"ring-2 ring-speaking",o),children:[a&&l?e.jsx("div",{className:"absolute inset-0",children:l}):e.jsx("div",{className:"flex min-h-0 min-w-0 items-center justify-center text-gray-300",children:s?e.jsx("img",{src:s,alt:t,className:"aspect-square w-[38%] max-w-16 min-w-6 rounded-full object-cover"}):e.jsx("div",{className:"flex aspect-square w-[38%] max-w-16 min-w-6 items-center justify-center rounded-full bg-video-surface-strong",children:a?e.jsx(P.VideoOff,{className:"w-1/2 h-1/2"}):e.jsx(P.User,{className:"w-1/2 h-1/2"})})}),e.jsxs("div",{className:"absolute inset-x-2 bottom-2 flex w-fit max-w-[calc(100%-1rem)] items-center gap-1.5 rounded bg-video-overlay px-1.5 py-1 text-xs text-white",children:[r?e.jsx(P.MicOff,{className:"size-3 shrink-0"}):e.jsx(P.Mic,{className:"size-3 shrink-0"}),e.jsx("span",{className:"hidden truncate @[9rem]:inline",children:t})]})]})}function $t({attach:t,active:s=!0,mirrored:r=!1,className:n}){const a=d.useRef(null);return d.useEffect(()=>{if(!s||!a.current)return;const l=t(a.current);return()=>{typeof l=="function"&&l(),a.current&&(a.current.innerHTML="")}},[t,s]),e.jsx("div",{ref:a,className:c("w-full h-full bg-video-surface-strong overflow-hidden",r&&"[&>*]:scale-x-[-1]",n)})}const Pt={primary:"bg-accent text-accent-fg hover:bg-accent-hover disabled:bg-surface-hover",secondary:"bg-surface-sunk text-text-strong hover:bg-surface-hover disabled:bg-surface-hover",outline:"border border-border text-text-strong hover:bg-surface-hover",ghost:"text-text-muted hover:bg-surface-hover hover:text-text",destructive:"border border-danger-border bg-danger-soft text-danger-fg hover:border-danger disabled:bg-surface-hover",success:"bg-success text-text-inverse hover:opacity-90 disabled:bg-surface-hover",warning:"bg-warning text-text-inverse hover:opacity-90 disabled:bg-surface-hover","danger-solid":"bg-danger text-text-inverse hover:opacity-90 disabled:bg-surface-hover"},Rt={xs:"h-control-xs px-2 text-xs",sm:"h-control-sm px-3 text-sm",md:"h-control-md px-4 text-sm",lg:"h-control-lg px-4 text-sm",xl:"h-control-xl px-6 text-base","2xl":"h-control-2xl px-6 text-base",full:"h-control-md px-4 text-sm"},It={xs:"h-control-xs w-6",sm:"h-control-sm w-7",md:"h-control-md w-8",lg:"h-control-lg w-9",xl:"h-control-xl w-10","2xl":"h-control-2xl w-12",full:"h-control-md w-8"},te=d.forwardRef(({variant:t="primary",size:s="md",fullWidth:r=!1,loading:n=!1,leftIcon:a,rightIcon:l,iconOnly:o=!1,shape:u="default",className:i,children:v,disabled:x,...m},g)=>{const b=x||n;return e.jsxs("button",{ref:g,type:"button",className:c("inline-flex shrink-0 items-center justify-center gap-2 cursor-pointer font-medium",u==="circle"?"rounded-full":"rounded-md","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:border-border-subtle","disabled:text-text-disabled",Pt[t],o?It[s]:Rt[s],(r||s==="full")&&"w-full",n&&"cursor-wait",i),disabled:b,"aria-busy":n||void 0,...m,children:[n&&e.jsx("span",{"aria-hidden":!0,className:"size-icon-md shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent"}),!n&&a&&e.jsx("span",{className:"flex items-center justify-center shrink-0",children:a}),!o&&v,!n&&l&&e.jsx("span",{className:"flex items-center justify-center shrink-0",children:l}),o&&!n&&!a&&!l&&v]})});te.displayName="Button";const Ft=({children:t,size:s="md",orientation:r="horizontal",attached:n=!0,className:a})=>{const l=c("inline-flex",{"flex-row":r==="horizontal","flex-col":r==="vertical","[&>*:not(:first-child):not(:last-child)]:rounded-none":n,"[&>*:first-child]:rounded-r-none":n&&r==="horizontal","[&>*:last-child]:rounded-l-none":n&&r==="horizontal","[&>*:first-child]:rounded-b-none":n&&r==="vertical","[&>*:last-child]:rounded-t-none":n&&r==="vertical","[&>*:not(:first-child)]:-ml-px":n&&r==="horizontal","[&>*:not(:first-child)]:-mt-px":n&&r==="vertical","gap-1":!n&&s==="xs","gap-2":!n&&(s==="sm"||s==="md"),"gap-3":!n&&(s==="lg"||s==="xl")},a);return e.jsx("div",{className:l,role:"group",children:t})};function Ot(t){if(!t)return;const s=t.split(/[-_ ]/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(""),r=yt[s];return typeof r=="function"||typeof r=="object"&&r!==null?r:void 0}const Bt={primary:"text-text",secondary:"text-text-muted",accent:"text-accent",success:"text-success-fg",warning:"text-warning-fg",error:"text-danger-fg",info:"text-info-fg",neutral:"text-text-subtle",current:"text-current"},Y=({icon:t,size:s="md",color:r="current",clickable:n=!1,onClick:a,className:l,"aria-label":o,...u})=>{const i=typeof s=="number"?s:Ht(s),v=c("inline-block shrink-0",Bt[r],n&&["cursor-pointer rounded-sm transition-opacity duration-fast ease-out hover:opacity-80","focus-visible:outline-none focus-visible:focus-ring"],l),x={size:i,strokeWidth:2,className:v,onClick:n?a:void 0,"aria-label":o,"aria-hidden":o?void 0:!0,role:n?"button":void 0,tabIndex:n?0:void 0,onKeyDown:n?m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),a?.())}:void 0,...u};return e.jsx(t,{...x})};function Ht(t){return{xs:12,sm:14,md:16,lg:20,xl:24}[t]}const $e=({trigger:t,children:s,placement:r="bottom-start",className:n,rootClassName:a,triggerClassName:l,disabled:o=!1,triggerLabel:u})=>{const[i,v]=d.useState(!1),x=d.useRef(null),m=d.useRef(null),g=Ne(i,m,{placement:r});d.useEffect(()=>{if(!i)return;const p=k=>{x.current&&!x.current.contains(k.target)&&v(!1)},h=k=>{k.key==="Escape"&&v(!1)};return document.addEventListener("mousedown",p),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",h)}},[i]);const b=p=>{p.stopPropagation(),!o&&v(h=>!h)},y=()=>v(!1);return e.jsxs("div",{ref:x,className:c("relative inline-flex",a),children:[e.jsx("button",{ref:m,type:"button",onClick:b,disabled:o,"aria-label":u,"aria-expanded":i,className:c("inline-flex items-center",o&&"cursor-not-allowed opacity-50",l),children:t}),i&&e.jsx("div",{className:c("fixed z-overlay overflow-y-auto rounded-lg border border-border bg-surface shadow-overlay",n),style:g,children:typeof s=="function"?s(y):s})]})},qt={none:"hover:bg-surface-sunk hover:text-text",default:"bg-surface-sunk text-text-muted hover:text-text",muted:"bg-surface-sunk text-text-subtle hover:text-text",outline:"text-text-muted ring-1 ring-inset ring-border-strong hover:bg-surface-hover hover:text-text",warning:"bg-warning-soft text-warning-fg",danger:"bg-danger-soft text-danger-fg"},Vt=t=>c("inline-flex cursor-pointer select-none items-center text-sm font-medium",t.size==="sm"?"h-control-sm":"h-control-md","transition-colors duration-fast ease-out",t.shape==="pill"?"rounded-full":"rounded-md",t.active?"bg-info-soft text-info-fg":qt[t.tone??"default"],t.className),Ut=t=>c("inline-flex items-center gap-1.5 pl-3",t.shape==="pill"?"rounded-full":"rounded-md",t.withClear?"pr-1.5":"pr-3","focus-visible:outline-none focus-visible:focus-ring");function We({label:t,icon:s,tone:r="default",shape:n="rect",size:a="md",active:l=!1,caret:o=!1,menu:u,menuClassName:i,onClear:v,clearLabel:x="Filter wissen",onClick:m,title:g,className:b}){const y=l&&!!v,p=n==="pill"?"rounded-full":"rounded-md",h=Vt({active:l,tone:r,shape:n,size:a,className:b}),k=e.jsxs(e.Fragment,{children:[s,t,o&&e.jsx(Y,{icon:P.ChevronDown,size:"xs"})]}),C=Ut({shape:n,withClear:y}),$=y&&e.jsx("button",{type:"button","aria-label":x,onClick:v,className:c("inline-flex h-full items-center pr-3 focus-visible:outline-none focus-visible:focus-ring",p),children:e.jsx(Y,{icon:P.X,size:"xs"})});return u?e.jsxs("span",{className:h,title:g,children:[e.jsx($e,{trigger:k,rootClassName:"h-full",triggerClassName:c(C,"h-full"),className:c("min-w-menu p-1.5",i),children:u}),$]}):y?e.jsxs("span",{className:h,title:g,children:[e.jsx("button",{type:"button",onClick:m,className:C,children:k}),$]}):e.jsx("button",{type:"button",title:g,onClick:m,className:c(h,C),children:k})}const Kt={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-md",xl:"text-lg"},Wt={primary:"text-text hover:text-info-fg hover:underline",info:"text-info-fg hover:underline",secondary:"text-text-muted hover:text-text",neutral:"text-text-muted hover:text-text",accent:"text-accent hover:underline",success:"text-success-fg hover:underline",warning:"text-warning-fg hover:underline",error:"text-danger-fg hover:underline"},Gt={primary:"bg-accent-soft",accent:"bg-accent-soft",secondary:"bg-surface-hover",neutral:"bg-surface-hover",success:"bg-success-soft",warning:"bg-warning-soft",error:"bg-danger-soft",info:"bg-info-soft"},Yt=({variant:t="default",size:s="md",color:r="primary",disabled:n=!1,external:a=!1,className:l,children:o,href:u,target:i,rel:v,...x})=>{const m=a||u&&(u.startsWith("http")||u.startsWith("mailto:")),g=c("inline-flex items-center gap-1 underline-offset-2","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",Kt[s],!n&&Wt[r],t==="subtle"&&"no-underline opacity-70 hover:opacity-100",t==="underline"&&"underline decoration-1 hover:decoration-2",t==="button"&&["h-control-md rounded-md px-3 font-semibold no-underline hover:no-underline",Gt[r]],n&&"pointer-events-none cursor-not-allowed text-text-disabled opacity-50",l),b={...x,href:n?void 0:u,target:m?"_blank":i,rel:m?"noopener noreferrer":v,"aria-disabled":n||void 0};return e.jsxs("a",{className:g,...b,children:[o,m&&e.jsx(P.ExternalLink,{className:"size-icon-sm shrink-0","aria-hidden":!0})]})},Jt={sm:"h-control-sm px-3 text-sm",md:"h-control-md px-3 text-sm"};function Ge({options:t,value:s,onChange:r,size:n="sm",tone:a="sunk",fullWidth:l=!1,className:o,"aria-label":u}){return e.jsx("div",{role:"tablist","aria-label":u,className:c("gap-0.5 rounded-md p-0.5",a==="track"?"bg-surface-track":"bg-surface-sunk",l?"flex w-full":"inline-flex",o),children:t.map(i=>{const v=i.value===s;return e.jsx("button",{role:"tab","aria-selected":v,"aria-label":i.title,title:i.title,type:"button",onClick:()=>r(i.value),className:c("inline-flex cursor-pointer items-center justify-center gap-1.5 rounded-sm","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",l&&"min-w-0 flex-1",Jt[n],v?"bg-surface text-text font-medium shadow-sm":"text-text-muted hover:text-text"),children:i.label},i.value)})})}const Xt={primary:"bg-accent text-accent-fg hover:bg-accent-hover",secondary:"border border-border bg-surface text-text hover:bg-surface-hover",outline:"border border-accent-border text-accent hover:bg-accent-soft"},Zt={sm:"h-control-sm w-7",md:"h-control-md w-8"};function Pe({label:t,onClick:s,variant:r="primary",size:n="md",icon:a,options:l,disabled:o=!1,loading:u=!1,menuPlacement:i="bottom-end",menuLabel:v="More options"}){const x=o||u,m=l.length>0;return e.jsxs("div",{className:c("inline-flex items-center",r==="primary"&&"gap-px"),children:[e.jsx(te,{variant:r,size:n,onClick:s,disabled:o,loading:u,leftIcon:a,className:c(m&&"rounded-r-none"),children:t}),m&&e.jsx($e,{placement:i,disabled:x,triggerLabel:v,className:"min-w-menu py-1",trigger:e.jsx("span",{"aria-hidden":"true",className:c("inline-flex items-center justify-center rounded-md rounded-l-none","transition-colors duration-fast ease-out",Xt[r],Zt[n],x&&"cursor-not-allowed opacity-50"),children:e.jsx(P.ChevronDown,{className:"size-icon-md"})}),children:g=>e.jsx(e.Fragment,{children:l.map(b=>e.jsxs("button",{type:"button",onClick:()=>{b.onClick(),g()},className:c("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",b.variant==="destructive"?"text-danger-fg hover:bg-danger-soft":"text-text hover:bg-surface-hover"),children:[b.icon&&e.jsx("span",{className:"shrink-0",children:b.icon}),b.label]},b.id))})})]})}const Qt={sm:"size-checkbox-sm",md:"size-checkbox",lg:"size-checkbox-lg",full:"size-checkbox"},es={sm:"min-h-control-sm",md:"min-h-control-md",lg:"min-h-control-lg",full:"min-h-control-md"},ts={sm:"text-sm",md:"text-base",lg:"text-md",full:"text-base"},he=d.forwardRef(({label:t,helperText:s,error:r,size:n="md",indeterminate:a=!1,containerClassName:l,labelClassName:o,className:u,id:i,...v},x)=>{const m=d.useId(),g=i||`checkbox-${m}`,b=!!r,y=d.useRef(null),p=d.useCallback(h=>{y.current=h,typeof x=="function"?x(h):x&&typeof x=="object"&&(x.current=h)},[x]);return d.useEffect(()=>{y.current&&(y.current.indeterminate=a)},[a]),e.jsxs("div",{className:c("flex flex-col",l),children:[e.jsxs("div",{className:c("flex items-center gap-3",es[n]),children:[e.jsx("input",{ref:p,id:g,type:"checkbox","aria-invalid":b||void 0,className:c("shrink-0 rounded-xs border accent-accent","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:bg-surface-hover",Qt[n],b?"border-danger-border":"border-border-strong",u),...v}),t&&e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:g,className:c("cursor-pointer",b?"text-danger-fg":"text-text",ts[n],o),children:t}),s&&!r&&e.jsx("p",{className:"mt-0.5 text-xs text-text-subtle",children:s})]})]}),r&&e.jsx("p",{className:"mt-1 text-xs text-danger-fg",children:r})]})});he.displayName="Checkbox";const ss={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-md",xl:"text-lg"},rs={light:"font-normal",normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},ns={primary:"text-text",secondary:"text-text-muted",accent:"text-accent",success:"text-success-fg",warning:"text-warning-fg",error:"text-danger-fg",info:"text-info-fg",neutral:"text-text",current:"text-current",muted:"text-text-subtle"},as={left:"text-left",center:"text-center",right:"text-right",justify:"text-justify"},ls={tight:"leading-tight",normal:"leading-normal",relaxed:"leading-relaxed"},ce=({variant:t="body",size:s="md",weight:r="normal",color:n="current",align:a="left",truncate:l=!1,italic:o=!1,underline:u=!1,lineHeight:i="normal",as:v,className:x,children:m,...g})=>{const b=v||os(t),y=t==="caption",p=t==="label",h=t==="code",k=c("font-sans",y&&"text-xs text-text-subtle",p&&"text-xs font-semibold uppercase tracking-label text-text-subtle",h&&"font-mono text-sm rounded-sm bg-surface-hover px-1 py-0.5",!y&&!p&&!h&&ss[s],!p&&rs[r],ns[n],as[a],t==="body"&&ls[i],o&&"italic",u&&"underline",l&&"truncate",x);return e.jsx(b,{className:k,...g,children:m})};function os(t){return{body:"p",caption:"span",label:"span",code:"code"}[t]||"p"}function cs({label:t,value:s,onChange:r,maxDimension:n=256,maxBytes:a,aspect:l="square",helperText:o,disabled:u,className:i,chooseLabel:v="Choose",removeLabel:x="Remove",tooLargeLabel:m="That image is too large."}){const g=d.useRef(null),[b,y]=d.useState(null),p=async h=>{if(!h)return;y(null);const k=await ds(h,n);if(a&&is(k)>a){y(m);return}r(k)};return e.jsxs("div",{className:c("flex flex-col gap-1.5",i),children:[t&&e.jsx("span",{className:"text-sm font-medium text-text",children:t}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:c("flex items-center justify-center overflow-hidden rounded-md border border-border bg-surface-sunk",l==="square"?"h-16 w-16":"h-16 w-28"),children:s?e.jsx("img",{src:s,alt:"",className:"h-full w-full object-contain"}):e.jsx(ce,{variant:"caption",color:"muted",children:"—"})}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(te,{type:"button",variant:"secondary",disabled:u,onClick:()=>g.current?.click(),children:v}),s&&e.jsx(te,{type:"button",variant:"ghost",disabled:u,onClick:()=>{y(null),r(void 0)},children:x})]}),(b||o)&&e.jsx(ce,{variant:"caption",color:b?"error":"muted",children:b??o})]})]}),e.jsx("input",{ref:g,type:"file",accept:"image/png,image/jpeg,image/webp",className:"hidden",onChange:h=>void p(h.target.files?.[0])})]})}function is(t){const s=t.slice(t.indexOf(",")+1),r=s.endsWith("==")?2:s.endsWith("=")?1:0;return Math.floor(s.length*3/4)-r}function ds(t,s){return new Promise((r,n)=>{const a=new FileReader;a.onload=()=>{const l=new Image;l.onload=()=>{const o=Math.min(1,s/Math.max(l.width,l.height)),u=Math.round(l.width*o),i=Math.round(l.height*o),v=document.createElement("canvas");v.width=u,v.height=i;const x=v.getContext("2d");if(!x){r(a.result);return}x.drawImage(l,0,0,u,i),r(v.toDataURL("image/png"))},l.onerror=n,l.src=a.result},a.onerror=n,a.readAsDataURL(t)})}const us=()=>e.jsx(Y,{icon:P.Calendar,size:"md",color:"current"}),xs=()=>e.jsx(Y,{icon:P.ChevronLeft,size:"md",color:"current"}),ms=()=>e.jsx(Y,{icon:P.ChevronRight,size:"md",color:"current"}),Ce=d.forwardRef(({value:t,onChange:s,placeholder:r="Select date",disabled:n=!1,required:a=!1,size:l="md",className:o,minDate:u,maxDate:i,format:v="MM/dd/yyyy",withTime:x=!1},m)=>{const[g,b]=d.useState(!1),[y,p]=d.useState(()=>t||new Date),h=d.useRef(null),k=d.useRef(null),C=Ne(g,k);d.useEffect(()=>{const f=E=>{h.current&&!h.current.contains(E.target)&&b(!1)};return g&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[g]);const $=f=>{if(!f)return"";const E=f.getDate().toString().padStart(2,"0"),w=(f.getMonth()+1).toString().padStart(2,"0"),D=f.getFullYear(),j=v==="dd/MM/yyyy"?`${E}/${w}/${D}`:v==="yyyy-MM-dd"?`${D}-${w}-${E}`:`${w}/${E}/${D}`;return x?`${j} ${A(f)}`:j},A=f=>`${f.getHours().toString().padStart(2,"0")}:${f.getMinutes().toString().padStart(2,"0")}`,W=f=>{const[E,w]=f.split(":").map(Number);if(Number.isNaN(E)||Number.isNaN(w))return;const D=t?new Date(t):new Date;D.setHours(E,w,0,0),s?.(D)},K=()=>{const f=y.getFullYear(),E=y.getMonth(),w=new Date(f,E,1),D=new Date(w);D.setDate(D.getDate()-w.getDay());const j=[],H=new Date(D);for(let re=0;re<42;re++)j.push(new Date(H)),H.setDate(H.getDate()+1);return j},_=f=>{if(f.getMonth()===y.getMonth()&&!(u&&f<u)&&!(i&&f>i)){if(x){const w=new Date(f);w.setHours(t?.getHours()??0,t?.getMinutes()??0,0,0),s?.(w);return}s?.(f),b(!1)}},V=()=>{p(new Date(y.getFullYear(),y.getMonth()-1,1))},se=()=>{p(new Date(y.getFullYear(),y.getMonth()+1,1))},J=()=>{s?.(null),b(!1)},X=c("w-full border border-border-strong rounded-tile transition-colors duration-fast","bg-surface text-text","placeholder:text-text-muted","focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:bg-surface-hover disabled:text-text-disabled",{"h-control-sm px-3 text-sm":l==="sm","h-control-md px-3 text-base":l==="md","h-control-lg px-3 text-base":l==="lg","h-control-md w-full px-3 text-base":l==="full"},o),oe=K(),N=["January","February","March","April","May","June","July","August","September","October","November","December"];return e.jsxs("div",{ref:h,className:"relative",children:[e.jsxs("div",{ref:k,className:"relative",children:[e.jsx("input",{ref:m,type:"text",value:$(t??null),placeholder:r,disabled:n,required:a,readOnly:!0,onClick:()=>!n&&b(!g),className:c(X,"pr-10 cursor-pointer")}),e.jsx("button",{type:"button",onClick:()=>!n&&b(!g),disabled:n,className:"absolute inset-y-0 right-0 flex items-center pr-3 text-text-muted hover:text-text-muted",children:e.jsx(us,{})})]}),g&&e.jsxs("div",{style:C,className:"fixed z-overlay overflow-auto rounded-lg border border-border bg-surface p-4 shadow-overlay min-w-panel",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("button",{onClick:V,className:"p-1 hover:bg-surface-hover rounded",children:e.jsx(xs,{})}),e.jsxs("h3",{className:"text-sm font-medium text-text",children:[N[y.getMonth()]," ",y.getFullYear()]}),e.jsx("button",{onClick:se,className:"p-1 hover:bg-surface-hover rounded",children:e.jsx(ms,{})})]}),e.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:["Su","Mo","Tu","We","Th","Fr","Sa"].map(f=>e.jsx("div",{className:"text-xs font-medium text-text-muted text-center py-1",children:f},f))}),e.jsx("div",{className:"grid grid-cols-7 gap-1",children:oe.map((f,E)=>{const w=f.getMonth()===y.getMonth(),D=t&&f.toDateString()===t.toDateString(),j=f.toDateString()===new Date().toDateString(),H=!w||u&&f<u||i&&f>i;return e.jsx("button",{onClick:()=>!H&&_(f),disabled:H,className:c("w-8 h-8 text-sm rounded transition-colors duration-fast",{"text-text hover:bg-surface-hover":w&&!D&&!H,"bg-accent text-accent-fg":D,"bg-surface-hover text-text":j&&!D,"text-text-muted cursor-not-allowed":H}),children:f.getDate()},E)})}),x&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-border pt-3",children:[e.jsx("label",{htmlFor:"datepicker-time",className:"text-sm text-text-muted",children:"Tijd"}),e.jsx("input",{id:"datepicker-time",type:"time",value:t?A(t):"",onChange:f=>W(f.target.value),className:"h-control-sm rounded-md border border-border bg-surface-input px-2 text-sm text-text focus-visible:outline-none focus-visible:focus-ring"})]}),e.jsxs("div",{className:"flex justify-between items-center mt-4 pt-3 border-t border-border",children:[e.jsx("button",{onClick:J,className:"text-sm text-text-muted hover:text-text",children:"Clear"}),e.jsx("button",{onClick:()=>b(!1),className:"text-sm text-info-fg hover:underline",children:"Close"})]})]})]})}),fs={sm:"h-control-sm px-3 text-sm",md:"h-control-md px-3 text-sm",lg:"h-control-lg px-3 text-base",full:"h-control-md w-full px-3 text-sm"},we=Ke,ye=d.forwardRef(({label:t,helperText:s,error:r,size:n="md",fullWidth:a=!1,disabled:l=!1,options:o,placeholder:u,containerClassName:i,labelClassName:v,className:x,id:m,searchable:g,multiple:b,value:y,onChange:p,allowCreate:h,onCreateOption:k,...C},$)=>{const A=m||`select-${Math.random().toString(36).substr(2,9)}`,W=!!r,[K,_]=d.useState(!1),[V,se]=d.useState(""),J=d.useRef(null),X=d.useRef(null),oe=Ne(K,X,{matchWidth:!0}),[N,f]=d.useState(o);d.useImperativeHandle($,()=>J.current),d.useEffect(()=>{const M=S=>{J.current&&!J.current.contains(S.target)&&_(!1)};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[]);const E=d.useCallback((M,S)=>M.some(R=>we(R.value)===we(S)||we(R.label)===we(S)),[]),w=d.useCallback((M,S)=>{const R=[...M],F=q=>{const T=je(q).trim();T&&(E(R,T)||R.push({value:T,label:T}))};return Array.isArray(S)?S.forEach(F):F(S),R},[E]);d.useEffect(()=>{f(M=>{const S=[...o];return M.forEach(R=>{!E(S,R.value)&&!E(S,R.label)&&S.push(R)}),w(S,y)})},[o,y,w,E]);const D=d.useMemo(()=>Array.isArray(y)?y.map(je):y==null?void 0:je(y),[y]),j=M=>{if(b){const S=Array.isArray(D)?D:[],R=S.includes(M)?S.filter(F=>F!==M):[...S,M];p?.(R)}else p?.(M),_(!1),se("")},H=b?null:N.find(M=>M.value===D),re=b?N.filter(M=>Array.isArray(D)&&D.includes(M.value)):[],ae=g&&V?N.filter(M=>M.label.toLowerCase().includes(V.toLowerCase())):N,G=!!h&&!!g&&!!V.trim()&&!E(N,V),I=M=>{const S=M.trim();if(!S)return;const R=k?.(S)??{value:S,label:S};if(E(N,R.value)||E(N,R.label)){j(R.value),se(""),b||_(!1);return}f(F=>[...F,R]),j(R.value),se(""),b||_(!1)},O=()=>b?re.length>0?re.map(M=>M.label).join(", "):u||"Select options":H?.label||u||"Select an option";return e.jsxs("div",{ref:J,className:c("relative flex flex-col",a&&"w-full",i),...C,children:[t&&e.jsx("label",{htmlFor:A,onClick:()=>_(!K),className:c("block text-xs font-semibold uppercase tracking-label mb-1.5",W?"text-danger-fg":"text-text-muted",v),children:t}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{ref:X,type:"button",id:A,disabled:l,onClick:()=>_(!K),className:c("flex w-full items-center justify-between gap-2 rounded-tile border transition-colors duration-fast text-left","focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:bg-surface-hover disabled:text-text-disabled","bg-surface",fs[n],W?"border-danger-border text-danger-fg focus-visible:focus-ring":"border-border-strong text-text",x),children:[e.jsx("span",{className:"truncate flex-1 min-w-0",children:O()}),e.jsx(P.ChevronDownIcon,{size:16,className:c("shrink-0 opacity-60 transition-transform duration-fast",K&&"rotate-180")})]}),K&&e.jsxs("div",{style:oe,className:"fixed z-overlay flex flex-col overflow-hidden rounded-lg border border-border bg-surface shadow-overlay",children:[g&&e.jsx("div",{className:"p-2",children:e.jsx("input",{type:"text",placeholder:"Search...",value:V,onChange:M=>se(M.target.value),onKeyDown:M=>{M.key==="Enter"&&G&&(M.preventDefault(),I(V))},className:c("w-full px-3 py-2 text-sm rounded-md border","text-text border-border focus-visible:outline-none focus-visible:focus-ring")})}),G&&e.jsxs("div",{className:c("cursor-pointer px-3 py-1.5 text-sm","text-info-fg hover:bg-surface-hover"),onClick:()=>I(V),children:["+: “",V.trim(),"”"]}),e.jsxs("ul",{className:"min-h-0 flex-1 overflow-auto py-1",children:[u&&!b&&e.jsx("li",{className:"cursor-pointer px-3 py-1.5 text-sm text-text-muted hover:bg-surface-hover",onClick:()=>{p?.(""),_(!1)},children:u}),ae.map(M=>{const S=b?Array.isArray(D)&&D.includes(M.value):D===M.value;return e.jsx("li",{onClick:()=>!M.disabled&&j(M.value),className:c("cursor-pointer px-3 py-1.5 text-sm","text-text",M.disabled?"opacity-50 cursor-not-allowed":"hover:bg-surface-hover",S&&"bg-accent-soft text-accent font-semibold"),children:e.jsxs("div",{className:"flex items-center",children:[b&&e.jsx("input",{type:"checkbox",checked:S,readOnly:!0,className:"mr-3 h-4 w-4 rounded border-border [&:not(:checked)]:bg-surface-input text-accent "}),e.jsx("span",{children:M.label})]})},M.value)})]})]})]}),(r||s)&&e.jsx("p",{className:c("mt-1 text-xs",W?"text-danger-fg":"text-text-muted"),children:r||s})]})});ye.displayName="Select";const hs={sm:"h-control-sm px-3 text-sm",md:"h-control-md px-3 text-base",lg:"h-control-lg px-3 text-base",full:"h-control-md px-3 text-base"},Ye="mb-1.5 block text-sm font-medium",Je="block w-full rounded-tile border bg-surface-input text-text transition-colors duration-fast ease-out placeholder:text-text-subtle focus-visible:outline-none focus-visible:focus-ring disabled:cursor-not-allowed disabled:bg-surface-hover disabled:text-text-disabled",Xe=t=>t?"border-danger-border bg-danger-soft":"border-border-strong",pe=d.forwardRef(({label:t,helperText:s,error:r,size:n="md",fullWidth:a=!1,startIcon:l,endIcon:o,loading:u=!1,containerClassName:i,labelClassName:v,className:x,id:m,...g},b)=>{const y=d.useId(),p=m||`textfield-${y}`,h=!!r,k=r||s?`${p}-description`:void 0;return e.jsxs("div",{className:c("flex flex-col",a&&"w-full",i),children:[t&&e.jsx("label",{htmlFor:p,className:c(Ye,h?"text-danger-fg":"text-text-muted",v),children:t}),e.jsxs("div",{className:"relative",children:[l&&e.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 text-text-muted",children:l}),e.jsx("input",{ref:b,id:p,"aria-invalid":h||void 0,"aria-describedby":k,className:c(Je,hs[n],l&&"pl-9",(o||u)&&"pr-9",Xe(h),x),...g}),(o||u)&&e.jsx("span",{className:"absolute inset-y-0 right-0 flex items-center pr-3 text-text-muted",children:u?e.jsx("span",{"aria-hidden":!0,className:"size-icon-md animate-spin rounded-full border-2 border-border border-t-transparent"}):o})]}),(r||s)&&e.jsx("p",{id:k,className:c("mt-1 text-xs",h?"text-danger-fg":"text-text-subtle"),children:r||s})]})});pe.displayName="TextField";function Ze({value:t,onChange:s,onListFolders:r,disabled:n,size:a="md",placeholder:l,templatePlaceholder:o,showTemplate:u=!0}){const[i,v]=d.useState([]);d.useEffect(()=>{let m=!0;return Promise.resolve(r?.()).then(g=>{m&&g&&v(g.data??[])}).catch(()=>{}),()=>{m=!1}},[]);const x=t??{};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(ye,{size:a,fullWidth:!0,value:x.folderId??"",options:i.map(m=>({value:m.id,label:m.name})),placeholder:l??"Select a folder",onChange:m=>s?.({...x,folderId:m})}),u&&e.jsx(pe,{size:a,disabled:n??!1,value:x.pathTemplate??"",placeholder:o??"Sub-path e.g. {yyyy}/{mm}/{dd} (optional)",onChange:m=>s?.({...x,pathTemplate:m.target.value})})]})}const ge=(...t)=>t.filter(Boolean).join(" "),gs=t=>e.jsx(P.Search,{...t,strokeWidth:1.5,"aria-hidden":!0}),bs=t=>e.jsx(P.ChevronDown,{...t,strokeWidth:1.5,"aria-hidden":!0}),ps={sm:"h-control-sm px-3 text-sm",md:"h-control-md px-3 text-base",lg:"h-control-lg px-3 text-base",full:"h-control-md w-full px-3 text-base"},Te={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",full:"h-6 w-6"},Qe=d.forwardRef(({label:t,helperText:s,error:r,size:n="md",fullWidth:a=!1,startIcon:l=e.jsx(gs,{}),loading:o=!1,containerClassName:u,labelClassName:i,className:v,id:x,options:m,onRemoteSearch:g,onSelect:b,debounceTime:y=500,showAllOnOpen:p=!1,value:h,onChange:k,...C},$)=>{const A=x||`searchfield-${Math.random().toString(36).substr(2,9)}`,W=!!r,K=d.useRef(null),_=d.useRef(null),[V,se]=d.useState(h||""),[J,X]=d.useState(!1),[oe,N]=d.useState(!1),[f,E]=d.useState(!1);d.useEffect(()=>{h!==void 0&&se(h)},[h]);const w=d.useMemo(()=>{if(p&&!f||!V)return m;const I=String(V).toLowerCase();return m.filter(O=>String(O.label).toLowerCase().includes(I))},[V,m,p,f]);d.useEffect(()=>{if(!g||!V){N(!1);return}const I=setTimeout(async()=>{N(!0);try{await g(String(V))}catch(O){console.error("Remote search failed:",O)}finally{N(!1)}},y);return()=>{clearTimeout(I),N(!1)}},[V,y,g]),d.useEffect(()=>{const I=O=>{K.current&&!K.current.contains(O.target)&&X(!1)};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[]);const D=I=>{const O=I.target.value;se(O),X(!0),E(!0),k&&k(I)},j=I=>{se(I.label),X(!1),E(!1),b&&b(I.value)},H=()=>{(m.length>0||g)&&(X(!0),E(!1))},re=o||oe,ae=J&&(w.length>0||re),G=d.useMemo(()=>$||_,[$]);return e.jsxs("div",{className:ge("flex flex-col",a?"w-full":"",u||"","relative"),ref:K,children:[t&&e.jsx("label",{htmlFor:A,className:ge("block text-sm font-medium mb-1",W?"text-danger-fg":"text-text",i||""),children:t}),e.jsxs("div",{className:"relative",children:[l&&e.jsx("div",{className:"absolute left-0 pl-3 flex items-center pointer-events-none h-full",children:e.jsx("span",{className:ge("text-text-muted",Te[n]),children:l})}),e.jsx("input",{ref:G,id:A,value:V,onChange:D,onFocus:H,className:ge("block w-full rounded-tile border bg-surface-input transition-colors duration-fast ease-out","placeholder:text-text-subtle focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:bg-surface-hover disabled:text-text-disabled",ps[n],l?"pl-10":"","pr-10",W?"border-danger-border text-danger-fg focus-visible:focus-ring":"border-border-strong text-text",v||""),...C}),e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center",children:re||o?e.jsx(P.Loader2,{className:ge("animate-spin text-info-fg",Te[n]),"aria-hidden":!0}):e.jsx(bs,{className:ge("text-text-muted cursor-pointer transition-transform",Te[n],J?"rotate-180":"rotate-0"),onClick:()=>{X(I=>(I||E(!1),!I))}})})]}),ae&&e.jsx("ul",{className:"absolute z-10 mt-1 w-full bg-surface border border-border rounded-lg shadow-lg max-h-60 overflow-auto top-full",role:"listbox",children:w.length>0?w.map(I=>e.jsx("li",{className:"px-4 py-2 cursor-pointer text-text hover:bg-accent-soft hover:text-accent transition-colors",onClick:()=>j(I),role:"option","aria-selected":V===I.label,children:I.label},I.value)):e.jsx("li",{className:"px-4 py-2 text-text-muted",children:re||o?"Zoeken op afstand...":"Geen resultaten gevonden."})}),(r||s)&&e.jsx("p",{className:ge("mt-1 text-xs",W?"text-danger-fg":"text-text-muted"),children:r||s}),g&&e.jsxs("p",{className:"mt-2 text-xs text-success-fg",children:["Huidige zoekterm (niet-gedebounced): ",String(V)]})]})});Qe.displayName="SearchableTextField";const Re=d.forwardRef(({value:t,onValueChange:s,hint:r,size:n="md",clearLabel:a="Clear search",containerClassName:l,className:o,disabled:u,...i},v)=>e.jsxs("div",{className:c("flex items-center gap-2 rounded-md bg-surface-sunk px-2.5 text-text-muted","transition-colors duration-fast ease-out",n==="sm"?"h-control-sm":"h-control-md",u&&"opacity-60",l),children:[e.jsx(Y,{icon:P.Search,size:"md",color:"current",className:"shrink-0"}),e.jsx("input",{ref:v,type:"search",value:t,disabled:u,onChange:x=>s(x.target.value),className:c("min-w-0 flex-1 border-0 bg-transparent p-0 text-sm text-text shadow-none","placeholder:text-text-subtle","focus:border-0 focus:shadow-none focus:outline-none focus:ring-0","[&::-webkit-search-cancel-button]:appearance-none",o),...i}),t?e.jsx("button",{type:"button","aria-label":a,onClick:()=>s(""),className:"grid size-4 shrink-0 cursor-pointer place-items-center rounded-xs text-text-subtle transition-colors duration-fast ease-out hover:text-text focus-visible:outline-none focus-visible:focus-ring",children:e.jsx(Y,{icon:P.X,size:"sm",color:"current"})}):r&&e.jsx("span",{className:"shrink-0 text-xs text-text-subtle",children:r})]}));Re.displayName="SearchField";const et=d.forwardRef(({checked:t,onChange:s,label:r,disabled:n=!1,className:a,...l},o)=>{const u=e.jsx("span",{"aria-hidden":!0,className:c("relative inline-flex size-switch-track shrink-0 items-center rounded-full","transition-colors duration-fast ease-out",t?"bg-accent":"bg-surface-hover",n&&"opacity-50"),children:e.jsx("span",{className:c("absolute left-0.5 size-switch-knob rounded-full bg-surface shadow-overlay","transition-transform duration-fast ease-out",t&&"translate-switch")})});return e.jsxs("label",{className:c("inline-flex items-center gap-2",n?"cursor-not-allowed":"cursor-pointer",a),children:[e.jsx("input",{ref:o,type:"checkbox",role:"switch",checked:t,disabled:n,onChange:i=>s(i.target.checked),className:"peer sr-only",...l}),e.jsx("span",{className:"inline-flex rounded-full peer-focus-visible:focus-ring",children:u}),r&&e.jsx("span",{className:"text-sm text-text",children:r})]})});et.displayName="Switch";const tt=({trigger:t,options:s,value:r,onSelect:n,placement:a="bottom-start",disabled:l=!1,className:o,showCheck:u=!0,header:i})=>{const[v,x]=d.useState(!1),[m,g]=d.useState(null),[b,y]=d.useState({top:0,left:0}),p=d.useRef(null),h=d.useRef(null),k=d.useRef(null),C=d.useRef(null),$=Ne(v,h,{placement:a}),A=d.useRef(null),W=()=>Array.from(C.current?.querySelectorAll("button[data-option-value]:not(:disabled)")??[]);d.useEffect(()=>{v&&W()[0]?.focus()},[v]);const K=f=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(f.key))return;const w=W();if(w.length===0)return;f.preventDefault();const D=w.indexOf(document.activeElement),j=f.key==="Home"?0:f.key==="End"?w.length-1:f.key==="ArrowDown"?(D+1)%w.length:(D-1+w.length)%w.length;w[j]?.focus()};d.useEffect(()=>{const f=E=>{p.current&&(!p.current.contains(E.target)||k.current&&!k.current.contains(E.target))&&(x(!1),g(null),A.current&&(clearTimeout(A.current),A.current=null))};return v&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[v]),d.useEffect(()=>{const f=E=>{E.key==="Escape"&&(x(!1),g(null),h.current?.focus(),A.current&&(clearTimeout(A.current),A.current=null))};return v&&document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f)}},[v]),d.useEffect(()=>{if(m&&p.current){const f=p.current.querySelector(`[data-option-value="${m}"]`);if(f){const E=f.getBoundingClientRect();y({top:E.top,left:E.right+8})}}},[m]),d.useEffect(()=>()=>{A.current&&clearTimeout(A.current)},[]);const _=f=>{f.stopPropagation(),!l&&(x(!v),g(null),A.current&&(clearTimeout(A.current),A.current=null))},V=(f,E,w)=>{f.stopPropagation(),!E.disabled&&!E.divider&&(!E.children||E.children.length===0)&&(n?.(E.value,w),x(!1),g(null))},se=f=>{A.current&&(clearTimeout(A.current),A.current=null),f.children&&f.children.length>0?g(f.value):g(null)},J=f=>{f.children&&f.children.length>0?A.current=setTimeout(()=>{g(null)},150):g(null)},X=(f,E,w)=>{f.stopPropagation(),!E.disabled&&!E.divider&&(n?.(E.value,w),x(!1),g(null))},oe=c("fixed z-overlay min-w-menu bg-surface rounded-lg shadow-overlay border border-border","max-h-60 overflow-auto"),N=c("fixed z-overlay min-w-menu bg-surface rounded-lg shadow-overlay border border-border","max-h-60 overflow-auto");return e.jsxs("div",{ref:p,className:c("relative flex flex-row items-center justify-center rounded-lg hover:bg-surface-hover",o),children:[e.jsx("button",{ref:h,onClick:_,disabled:l,"aria-haspopup":"menu","aria-expanded":v,className:c("inline-flex items-center justify-center",{"opacity-50 cursor-not-allowed":l}),children:t}),v&&e.jsx("div",{ref:C,className:oe,style:$,onKeyDown:K,children:e.jsxs("div",{className:"p-2",role:"menu",children:[i&&(typeof i=="string"?e.jsx("div",{className:"text-xs font-medium text-text-muted uppercase tracking-label px-3 py-2",children:i}):i),s.map((f,E)=>{if(f.divider)return e.jsx("div",{className:"border-t border-border my-2"},`divider-${E}`);const w=f.children&&f.children.length>0,D=m===f.value;return e.jsxs("div",{className:"relative group",children:[e.jsxs("button",{"data-option-value":f.value,role:"menuitem","aria-haspopup":w?"menu":void 0,onClick:j=>V(j,f),onMouseEnter:()=>se(f),onMouseLeave:()=>J(f),disabled:f.disabled,className:c("flex w-full items-center justify-between rounded-md px-3 py-1.5 text-sm text-text transition-colors duration-fast ease-out hover:bg-surface-hover focus-visible:outline-none focus-visible:focus-ring",{"opacity-50 cursor-not-allowed":f.disabled,"bg-surface-hover":D&&w}),children:[e.jsxs("div",{className:"flex items-center space-x-2 min-w-0",children:[f.icon&&e.jsx("span",{className:"flex-shrink-0",children:f.icon}),e.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[e.jsx("span",{className:"font-base truncate",children:f.label}),f.description&&e.jsx("span",{className:"text-xs text-text-muted",children:f.description})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[u&&r===f.value&&e.jsx(P.Check,{className:"size-icon-md shrink-0 text-success-fg","aria-hidden":!0}),w&&e.jsx("span",{className:"text-text-muted text-xs",children:"▶"})]})]}),w&&D&&e.jsx("div",{ref:k,className:N,style:{top:`${b.top}px`,left:`${b.left}px`},onMouseEnter:()=>{A.current&&(clearTimeout(A.current),A.current=null),g(f.value)},onMouseLeave:()=>{A.current=setTimeout(()=>{g(null)},150)},children:e.jsx("div",{className:"p-2",children:f.children.map((j,H)=>{if(j.divider)return e.jsx("div",{className:"border-t border-border my-2"},`divider-${H}`);const re=typeof r=="object"&&r[f.value]&&r[f.value].includes(j.value)||r===j.value;return e.jsxs("button",{onClick:ae=>X(ae,j,f.value),disabled:j.disabled,className:c("flex w-full items-center justify-between rounded-md px-3 py-1.5 text-sm text-text transition-colors duration-fast ease-out hover:bg-surface-hover",{"opacity-50 cursor-not-allowed":j.disabled}),children:[e.jsxs("div",{className:"flex items-center space-x-2 min-w-0",children:[j.icon&&e.jsx("span",{className:"flex-shrink-0",children:j.icon}),e.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[e.jsx("span",{className:"font-base truncate",children:j.label}),j.description&&e.jsx("span",{className:"text-xs text-text-muted",children:j.description})]})]}),u&&re&&e.jsx(P.Check,{className:"size-icon-md shrink-0 text-success-fg","aria-hidden":!0})]},j.value)})})})]},f.value)}),(()=>{const f=s.reduce((E,w)=>{if(w.divider)return E;const D=w.children?w.children.filter(j=>!j.divider).length:0;return E+1+D},0);return f>1&&e.jsx("div",{className:"border-t border-border mt-2 pt-2",children:e.jsxs("div",{className:"text-xs text-text-muted px-3 py-1",children:[f," options available"]})})})()]})})]})},be=({actions:t,defaultVariant:s="secondary",className:r})=>t.length===0?null:e.jsx("div",{className:c("flex flex-wrap items-center gap-2",r),children:t.map(n=>n.render?e.jsx(d.Fragment,{children:n.render()},n.id):n.splitOptions&&n.splitOptions.length>0?e.jsx(Pe,{label:n.label,onClick:n.onClick,icon:n.icon,variant:n.variant==="primary"?"primary":"secondary",options:n.splitOptions,disabled:n.disabled},n.id):e.jsx(te,{variant:n.variant??s,onClick:a=>{a.stopPropagation(),a.target.blur(),n.onClick()},disabled:n.disabled,leftIcon:n.icon,children:n.label},n.id))}),vs={none:"p-0",sm:"p-2",md:"px-5 py-4",lg:"p-6"},js=({actions:t=[],onBack:s,backLabel:r="Back",className:n,padding:a="md",children:l})=>e.jsxs("div",{className:c("flex items-center gap-2",vs[a],n),children:[s&&e.jsx(te,{variant:"secondary",onClick:s,"aria-label":r,leftIcon:e.jsx(Y,{icon:P.ChevronLeft,size:"sm"}),iconOnly:!0}),l&&e.jsx("div",{className:"min-w-0 flex-1",children:l}),e.jsx(be,{actions:t,className:c(!l&&"ml-auto")})]}),ys=t=>s=>t(s instanceof Date?s:null),Ns=t=>s=>t(typeof s=="string"?s:""),ws=t=>s=>t(Array.isArray(s)?s:typeof s=="string"&&s?[s]:[]),ks={none:"px-0",sm:"px-2",md:"px-3.5",lg:"px-5"},Cs={sm:"h-row-lg",md:"h-row-xl",lg:"h-14"},Ss=8,He=["62%","44%","74%","52%","68%","48%","80%","56%"];function Es(t,s){if(s<=7)return Array.from({length:s},(l,o)=>o);const n=[...new Set([0,s-1,t-1,t,t+1])].filter(l=>l>=0&&l<s).sort((l,o)=>l-o),a=[];return n.forEach((l,o)=>{o>0&&l-n[o-1]>1&&a.push("gap"),a.push(l)}),a}const Ms=t=>{const s=Array.isArray(t.value)?t.value:t.value!=null&&t.value!==""&&t.value!=="all"?[t.value]:[];if(t.type==="date"){const o=t.value instanceof Date;return e.jsx(Ce,{value:t.value,onChange:u=>t.onChange(u),placeholder:t.placeholder||t.label,className:c("min-w-40",o&&"bg-info-soft text-info-fg")})}const r=o=>t.options?.find(u=>u.value===o)?.label??String(o),n=o=>Array.isArray(t.value)?t.value.includes(o):t.value===o,a=o=>{if(!t.multiSelect)return t.onChange(o);const u=Array.isArray(t.value)?t.value:[];t.onChange(u.includes(o)?u.filter(i=>i!==o):[...u,o])},l=s.length>0;return e.jsx(We,{tone:"outline",caret:!0,icon:t.icon,active:l,label:l?`${t.label}: ${s.map(r).join(", ")}`:t.label,title:t.label,onClear:()=>t.onChange(t.multiSelect?[]:"all"),menu:o=>e.jsx("div",{role:"listbox",className:"flex flex-col",children:t.options?.map(u=>e.jsx("button",{type:"button",role:"option","aria-selected":n(u.value),onClick:()=>{a(u.value),t.multiSelect||o()},className:c("flex cursor-pointer items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm","transition-colors duration-fast ease-out hover:bg-surface-hover","focus-visible:outline-none focus-visible:focus-ring",n(u.value)?"font-medium text-text":"text-text-muted"),children:u.label},u.value))})})},De=({data:t,columns:s,loading:r=!1,searchable:n=!1,searchPlaceholder:a="Search...",searchValue:l,onSearchChange:o,filters:u=[],toolbarActions:i=[],toolbarContent:v,groupBy:x,groups:m,paginated:g=!1,defaultPageSize:b=10,actions:y=[],onRowClick:p,selectable:h=!1,selectedRows:k=[],onSelectionChange:C,getRowKey:$=(oe,N)=>N,emptyContent:A,footerSummary:W,size:K="md",hoverable:_=!0,padding:V="md",className:se,rowClassName:J,headerBackground:X=!0})=>{const[oe,N]=d.useState(""),f=l!==void 0,E=f?l:oe,w=o??N,[D,j]=d.useState({column:null,direction:null}),[H,re]=d.useState({page:0,pageSize:b}),ae=d.useRef(null),G=d.useMemo(()=>{let z=t;if(n&&!f&&E.trim()){const U=s.filter(le=>le.searchable!==!1),ee=E.toLowerCase();z=z.filter(le=>U.some(Z=>{const B=typeof Z.accessor=="function"?Z.accessor(le):le[Z.accessor];return String(B||"").toLowerCase().includes(ee)}))}return z},[t,E,f,s,n]),I=d.useMemo(()=>{if(!D.column||!D.direction)return G;const z=s.find(U=>U.id===D.column);return z?[...G].sort((U,ee)=>{const le=typeof z.accessor=="function"?z.accessor(U):U[z.accessor],Z=typeof z.accessor=="function"?z.accessor(ee):ee[z.accessor];let B=0;return le<Z?B=-1:le>Z&&(B=1),D.direction==="desc"?-B:B}):G},[G,D,s]),O=d.useMemo(()=>{if(!g||x)return I;const z=H.page*H.pageSize,U=z+H.pageSize;return I.slice(z,U)},[I,H,g,x]),M=d.useCallback(z=>{s.find(ee=>ee.id===z)?.sortable&&j(ee=>ee.column!==z?{column:z,direction:"asc"}:ee.direction==="asc"?{column:z,direction:"desc"}:{column:null,direction:null})},[s]),S=d.useCallback(z=>{re(U=>({...U,page:z}))},[]),R=d.useCallback((z,U)=>{if(!C)return;const ee=$(z,0);C(U?[...k,z]:k.filter((le,Z)=>$(k[Z],Z)!==ee))},[k,C,$]),F=d.useCallback(z=>{C&&C(z?[...O]:[])},[O,C]);d.useEffect(()=>{re(z=>({...z,page:0}))},[E,D]),d.useEffect(()=>{re(z=>({...z,page:0}))},[u.map(z=>z.value).join(",")]);const q=I.length,T=Math.ceil(q/H.pageSize),L=H.page*H.pageSize+1,Q=Math.min(L+H.pageSize-1,q),ne=O.length>0&&O.every(z=>{const U=$(z,0);return k.some((ee,le)=>$(ee,le)===U)}),xe=O.some(z=>{const U=$(z,0);return k.some((ee,le)=>$(ee,le)===U)}),fe=ks[V],de=X?"bg-surface-sunk":"bg-surface",ue=c("text-text",fe),Me=n||u.length>0||i.length>0||!!v,xt=d.useMemo(()=>{const z=O.map((Z,B)=>({row:Z,index:B}));if(!x)return[{group:null,rows:z}];const U=new Map;for(const Z of z){const B=x(Z.row,Z.index),me=U.get(B);me?me.push(Z):U.set(B,[Z])}const ee=m??[];return[...ee.filter(Z=>U.has(Z.id)),...[...U.keys()].filter(Z=>!ee.some(B=>B.id===Z)).map(Z=>({id:Z}))].map(Z=>({group:Z,rows:U.get(Z.id)??[]}))},[O,x,m]),mt=s.length+(h?1:0)+(y.length>0?1:0),Oe=g&&q>0,ft=Oe||W!==void 0;return e.jsxs("div",{className:c("flex min-w-0 flex-col",se),children:[Me&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pb-3",children:[n&&e.jsx(Re,{value:E,onValueChange:w,placeholder:a,containerClassName:"w-full sm:w-66"}),u.map(z=>e.jsx(Ms,{...z},z.id)),v,i.length>0&&e.jsx(be,{actions:i,className:"ml-auto"})]}),e.jsx("div",{className:"relative w-full overflow-x-auto rounded-lg ring-1 ring-border",children:e.jsxs("table",{ref:ae,className:"min-w-full border-collapse text-base text-text",children:[e.jsx("thead",{className:c(de,"h-control-lg"),children:e.jsxs("tr",{children:[h&&e.jsx("th",{className:c(ue,"w-10"),children:e.jsx(he,{size:"sm",checked:ne,indeterminate:xe&&!ne,onChange:z=>F(z.target.checked),"aria-label":"Select all rows"})}),s.map(z=>e.jsx("th",{className:c(ue,"text-xs font-semibold uppercase tracking-label text-text-muted","group",{"text-left":z.align==="left"||!z.align,"text-center":z.align==="center","text-right":z.align==="right","cursor-pointer select-none":z.sortable,[`sticky left-0 ${de}`]:z.sticky==="left",[`sticky right-0 ${de}`]:z.sticky==="right"}),style:{width:z.width},onClick:()=>z.sortable&&M(z.id),children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[z.headerCell?z.headerCell():z.header,z.sortable&&e.jsx(Y,{icon:D.column===z.id&&D.direction==="desc"?P.ChevronDown:P.ChevronUp,size:"xs",className:c("transition-opacity duration-fast ease-out",D.column===z.id?"text-text opacity-100":"text-text-subtle opacity-0 group-hover:opacity-100")})]})},z.id)),y.length>0&&e.jsx("th",{className:c(ue,"w-10"),children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx("tbody",{children:r?Array.from({length:Ss}).map((z,U)=>e.jsxs("tr",{className:"animate-pulse border-t border-border-subtle","aria-hidden":!0,children:[h&&e.jsx("td",{className:c(ue,"h-row-lg"),children:e.jsx("span",{className:"block size-4 rounded-xs bg-surface-hover"})}),s.map((ee,le)=>e.jsx("td",{className:c(ue,"h-row-lg"),style:{width:ee.width},children:e.jsx("span",{className:"block h-3 rounded-xs bg-surface-hover",style:{width:He[(U+le)%He.length]}})},ee.id)),y.length>0&&e.jsx("td",{className:c(ue,"h-row-lg")})]},`skeleton-${U}`)):O.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:s.length+(h?1:0)+(y.length>0?1:0),className:c(ue,"border-t border-border-subtle py-10 text-center text-text-muted"),children:A||"No data available"})}):xt.flatMap(z=>[...z.group?[e.jsx("tr",{children:e.jsx("td",{colSpan:mt,className:c("border-t border-border-subtle bg-surface px-4 pb-1.5 pt-4 text-sm font-semibold",z.group.tone==="danger"?"text-danger-fg":z.group.tone==="muted"?"text-text-subtle":"text-text"),children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[z.group.title??z.group.id,e.jsx("span",{className:"rounded-full bg-surface-sunk px-1.5 py-0.5 text-xs font-medium text-text-muted tabular-nums",children:z.group.count??z.rows.length})]})})},`group-${z.group.id}`)]:[],...z.rows.map(({row:U,index:ee})=>{const le=$(U,ee),Z=k.some((B,me)=>$(B,me)===le);return e.jsxs("tr",{className:c(Cs[K],"border-t border-border-subtle",_&&"transition-colors duration-fast ease-out hover:bg-surface-hover",p&&"cursor-pointer",Z&&"bg-accent-soft",J?.(U,ee)),onClick:B=>{B.stopPropagation(),p?.(U,ee)},children:[h&&e.jsx("td",{className:ue,children:e.jsx(he,{size:"sm",checked:Z,onClick:B=>B.stopPropagation(),onChange:B=>{B.stopPropagation(),R(U,B.target.checked)},"aria-label":"Select row"})}),s.map(B=>{const me=typeof B.accessor=="function"?B.accessor(U):U[B.accessor];return e.jsx("td",{className:c(ue,{"text-left":B.align==="left"||!B.align,"text-center":B.align==="center","text-right":B.align==="right","sticky left-0 bg-surface":B.sticky==="left","sticky right-0 bg-surface":B.sticky==="right"}),children:B.cell?B.cell(me,U,ee):String(me||"")},B.id)}),y.length>0&&e.jsx("td",{className:ue,children:e.jsx(tt,{className:"rounded-md",trigger:e.jsx("span",{className:"grid size-7 place-items-center text-text-subtle",children:e.jsx(Y,{icon:P.Ellipsis,size:"md",color:"current"})}),options:y.map(B=>({value:B.id,label:B.label,icon:B.icon,disabled:B.disabled?.(U)})),onSelect:B=>{const me=y.find(ht=>ht.id===B);me&&me.onClick(U,ee)},placement:"bottom-end"})})]},le)})])})]})}),ft&&e.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-1 pt-3 text-xs text-text-muted",children:[e.jsx("span",{className:"min-w-0 flex-1",children:W??`Showing ${L}–${Q} of ${q}`}),Oe&&e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(te,{size:"xs",variant:"ghost",iconOnly:!0,"aria-label":"Previous page",onClick:()=>S(H.page-1),disabled:H.page===0,children:e.jsx(Y,{icon:P.ChevronLeft,size:"md",color:"current"})}),Es(H.page,T).map((z,U)=>z==="gap"?e.jsx("span",{className:"px-1 text-text-subtle",children:"…"},`gap-${U}`):e.jsx("button",{type:"button","aria-current":z===H.page?"page":void 0,onClick:()=>S(z),className:c("h-control-xs min-w-6 cursor-pointer rounded-sm px-1.5 tabular-nums","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",z===H.page?"bg-surface-sunk font-semibold text-text":"text-text-muted hover:bg-surface-hover hover:text-text"),children:z+1},z)),e.jsx(te,{size:"xs",variant:"ghost",iconOnly:!0,"aria-label":"Next page",onClick:()=>S(H.page+1),disabled:H.page>=T-1,children:e.jsx(Y,{icon:P.ChevronRight,size:"md",color:"current"})})]})]})]})},Ts=d.createContext(null),zs=({items:t,activeTab:s,onTabChange:r,className:n})=>{const[a,l]=d.useState(t[0]?.id||""),o=s||a,u=i=>{r?r(i):l(i)};return e.jsx("div",{className:c("border-b border-border",n),children:e.jsx("nav",{className:"-mb-px flex space-x-8",children:t.map(i=>e.jsx("button",{onClick:()=>!i.disabled&&u(i.id),disabled:i.disabled,className:c("border-b-2 py-2 px-1 text-sm font-medium transition-colors duration-fast",{"border-accent-border text-text":o===i.id,"border-transparent text-text-muted hover:text-text":o!==i.id&&!i.disabled,"border-transparent text-text-disabled cursor-not-allowed":i.disabled}),children:e.jsxs("span",{className:"flex items-center gap-2",children:[i.label,i.badge&&e.jsx("span",{className:c("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",o===i.id?"bg-accent-soft text-accent":"bg-surface-hover text-text-muted"),children:i.badge})]})},i.id))})})},st=({items:t,defaultTab:s,activeTab:r,onTabChange:n,variant:a="default",size:l="md",className:o})=>{const[u,i]=d.useState(s||r||t[0]?.id||""),v=r||u,x=p=>{n?n(p):i(p)},m={activeTab:v,setActiveTab:x},g=t.find(p=>p.id===v),b=c("flex",{"border-b border-border px-2":a==="default"||a==="underline","bg-surface-hover p-1 rounded-lg":a==="pills","space-x-1":a==="pills","space-x-8":a==="default"||a==="underline"},o),y=(p,h)=>{const k="transition-colors duration-fast font-medium",C={"text-xs px-2 py-1":l==="sm","text-sm px-3 py-2":l==="md","text-base px-4 py-3":l==="lg"},$={"border-b-2 -mb-px":a==="default","rounded-md":a==="pills","border-b-2 pb-2":a==="underline"},A={"opacity-50 cursor-not-allowed":p.disabled,"cursor-pointer":!p.disabled},W=h?{"border-accent-border text-text":a==="default"||a==="underline","bg-surface text-text shadow-none":a==="pills"}:{},K=!h&&!p.disabled?{"border-transparent text-text-muted hover:text-text":a==="default","text-text-muted hover:text-text":a==="pills","border-transparent text-text-muted hover:text-text hover:border-border":a==="underline"}:{};return c(k,C,$,A,W,K)};return e.jsx(Ts.Provider,{value:m,children:e.jsxs("div",{children:[e.jsx("div",{className:b,role:"tablist",children:t.map(p=>e.jsx("button",{type:"button",role:"tab","aria-selected":v===p.id,"aria-controls":`tabpanel-${p.id}`,disabled:p.disabled,onClick:()=>!p.disabled&&x(p.id),className:y(p,v===p.id),children:e.jsxs("span",{className:"flex items-center gap-2",children:[p.label,p.badge&&e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-surface-hover text-text-muted",children:p.badge})]})},p.id))}),g?.content&&e.jsx("div",{role:"tabpanel",id:`tabpanel-${v}`,"aria-labelledby":`tab-${v}`,className:"mt-4",children:g.content})]})})},Ds={sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-full mx-4"};function Ie({open:t,onClose:s,title:r,size:n="md",closeOnBackdropClick:a=!0,closeOnEscape:l=!0,className:o,backdropClassName:u,children:i,footer:v,showCloseButton:x=!0}){const m=d.useRef(null),g=d.useRef(null);d.useEffect(()=>{if(!t||!l)return;const y=p=>{p.key==="Escape"&&s()};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[t,l,s]),d.useEffect(()=>(t?(g.current=document.activeElement,m.current&&m.current.focus(),document.body.style.overflow="hidden"):(g.current&&g.current.focus(),document.body.style.overflow=""),()=>{document.body.style.overflow=""}),[t]);const b=y=>{a&&y.target===y.currentTarget&&s()};return t?e.jsx("div",{className:c("fixed inset-0 z-modal flex items-center justify-center p-4","bg-scrim",u),onClick:b,children:e.jsxs("div",{ref:m,className:c("relative w-full bg-surface rounded-lg shadow-modal","focus:outline-none",Ds[n],o),role:"dialog","aria-modal":"true","aria-labelledby":r?"modal-title":void 0,tabIndex:-1,children:[(r||x)&&e.jsxs("div",{className:"flex items-center justify-between p-6 pb-0",children:[r&&e.jsx("span",{id:"modal-title",className:"text-lg font-semibold text-text",children:r}),x&&e.jsx("button",{onClick:s,className:"p-1 text-text-muted hover:text-text transition-colors","aria-label":"Close modal",children:e.jsx(Y,{icon:P.X,size:"lg",color:"current"})})]}),e.jsx("div",{className:"p-6",children:i}),v&&e.jsx("div",{className:"px-6 py-4",children:v})]})}):null}const rt=({value:t,onChange:s,label:r,placeholder:n="Select or upload a file",error:a,disabled:l,accept:o,onListFiles:u,onListMounts:i,onUploadFile:v,onDownloadFile:x,onRegisterFile:m})=>{const[g,b]=d.useState(!1),[y,p]=d.useState([]),[h,k]=d.useState(null),[C,$]=d.useState("/"),[A,W]=d.useState([]),[K,_]=d.useState(!1),[V,se]=d.useState(""),[J,X]=d.useState(typeof t=="object"?t:null),[oe,N]=d.useState(!1),[f,E]=d.useState(""),w=d.useRef(null);d.useEffect(()=>{g&&D()},[g]),d.useEffect(()=>{g&&h&&j()},[g,h,C,V]);const D=async()=>{_(!0);try{const T=await i?.();T?.data&&p(T.data)}catch(T){console.error("Failed to load mounts",T)}finally{_(!1)}},j=async()=>{if(h){_(!0);try{const T=await u?.({mountId:h.id,name:V,path:C});T?.data&&W(T.data)}catch(T){console.error("Failed to load files",T)}finally{_(!1)}}},H=async T=>{const L=T.target.files?.[0];if(L){_(!0);try{const Q=await L.arrayBuffer(),ne=new Uint8Array(Q),xe={id:`local-${Date.now()}`,name:L.name,type:"file",path:"/",mimeType:L.type||"application/octet-stream",size:L.size,mountId:"local",providerKey:L.name,ownerId:"me"};X(xe),s(xe,ne),b(!1)}catch(Q){console.error("Local file selection failed",Q)}finally{_(!1)}}},re=async T=>{const L=T.target.files?.[0];if(!(!L||!h)){_(!0);try{const Q=await L.arrayBuffer(),ne=await v?.({file:new Uint8Array(Q),filename:L.name,mimeType:L.type||"application/octet-stream",mountId:h.id,path:C});if(ne?.data){const xe=ne.data;X(xe),s(xe,new Uint8Array(Q)),b(!1)}}catch(Q){console.error("Upload failed",Q)}finally{_(!1)}}},ae=async()=>{if(!(!f||!h)){_(!0);try{const T=`${C}${f}/`;m&&(await m({name:f,type:"folder",path:C,mimeType:"application/x-directory",size:0,mountId:h.id,providerKey:T,ownerId:"me"}),await j()),N(!1),E("")}catch(T){console.error("Failed to create folder",T)}finally{_(!1)}}},G=async T=>{_(!0);try{const L=await x?.(T.id);X(T),s(T,L),b(!1)}catch(L){console.error("Failed to download file",L)}finally{_(!1)}},I=T=>{T.stopPropagation(),X(null),s(null)},O=d.useMemo(()=>{const T=new Set,L=[];return A.forEach(Q=>{if(Q.type==="folder"){Q.path===C&&T.add(Q.name);return}const ne=Q.providerKey||Q.name,fe=(C?ne.substring(C.length):ne).split("/").filter(de=>de!=="");fe.length>1?T.add(fe[0]):fe.length===1&&L.push(Q)}),{folders:Array.from(T).sort(),files:L.sort((Q,ne)=>Q.name.localeCompare(ne.name))}},[A,C]),M=T=>{$(L=>`${L}${T}/`)},S=()=>{const T=C.split("/").filter(L=>L!=="");T.pop(),T.length===0?$("/"):$(`${T.join("/")}/`)},R=d.useMemo(()=>{const T=O.folders.map(L=>({id:`folder-${L}`,name:L,type:"folder"}));return O.files.forEach(L=>{T.push({...L,type:"file"})}),T},[O]),F=[{id:"name",header:"Name",accessor:"name",cell:(T,L)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{icon:L.type==="folder"?P.Folder:P.FileText,size:"sm",color:L.type==="folder"?"warning":"secondary"}),e.jsx("span",{className:c(L.type==="folder"&&"font-medium"),children:T})]})},{id:"type",header:"Type",accessor:T=>T.type==="folder"?"Folder":T.mimeType},{id:"size",header:"Size",accessor:T=>T.type==="file"?`${(T.size/1024).toFixed(1)} KB`:"-"},{id:"actions",header:"",accessor:"id",align:"right",cell:(T,L)=>e.jsx(te,{variant:"outline",onClick:Q=>{Q.stopPropagation(),L.type==="folder"?M(L.name):G(L)},loading:K&&L.type==="file"&&J?.id===L.id,children:L.type==="folder"?"Open":"Select"})}],q=[{id:"name",header:"Mount Name",accessor:"name",cell:T=>e.jsxs("div",{className:"flex items-center gap-2 font-medium",children:[e.jsx(Y,{icon:P.HardDrive,size:"sm",color:"primary"}),e.jsx("span",{children:T})]})},{id:"actions",header:"",accessor:"id",align:"right",cell:(T,L)=>e.jsx(te,{variant:"outline",onClick:()=>k(L),children:"Open"})}];return e.jsxs("div",{className:"space-y-1",children:[r&&e.jsx(ce,{variant:"label",size:"sm",weight:"medium",children:r}),e.jsxs("div",{onClick:()=>!l&&b(!0),className:c("flex items-center gap-3 px-3 py-2 border rounded-lg cursor-pointer transition-colors","hover:border-border-strong bg-surface",a?"border-danger-border":"border-border",l&&"opacity-50 cursor-not-allowed bg-surface-sunk"),children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(Y,{icon:J?P.FileText:P.HardDrive,color:J?"primary":"secondary"})}),e.jsx("div",{className:"flex-grow truncate",children:J?e.jsx("span",{className:"text-sm text-text font-medium",children:J.name}):e.jsx("span",{className:"text-sm text-text-muted",children:n})}),J&&!l&&e.jsx("button",{onClick:I,className:"p-1 hover:bg-surface-hover rounded",children:e.jsx(Y,{icon:P.X,size:"xs"})})]}),a&&e.jsx(ce,{variant:"body",size:"xs",className:"text-danger-fg",children:a}),e.jsx(Ie,{open:g,onClose:()=>{b(!1),k(null),$("/"),N(!1)},title:h?`Explorer: ${h.name}`:"Select Storage Mount",size:"lg",children:e.jsx(st,{variant:"pills",items:[{id:"remote",label:"Platform Storage",content:e.jsx("div",{className:"space-y-4",children:h?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(te,{variant:"ghost",onClick:()=>{C&&C!=="/"?S():k(null)},leftIcon:e.jsx(Y,{icon:P.ArrowLeft,size:"xs"}),children:C?"Back":"Back to Mounts"}),e.jsx("div",{className:"flex items-center gap-1 text-xs text-text-muted overflow-hidden bg-surface-hover px-2 py-1 rounded",children:e.jsx("span",{className:"truncate",children:C})}),e.jsx("div",{className:"flex-grow min-w-40",children:e.jsx(pe,{placeholder:"Search...",value:V,onChange:T=>se(T.target.value),startIcon:e.jsx(P.Search,{size:14}),fullWidth:!0})}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(te,{variant:"outline",onClick:()=>N(!0),leftIcon:e.jsx(Y,{icon:P.FolderPlus,size:"xs"}),children:"New Folder"}),e.jsx(te,{variant:"primary",onClick:()=>w.current?.click(),leftIcon:e.jsx(Y,{icon:P.Upload,size:"xs"}),loading:K,children:"Upload"}),e.jsx("input",{type:"file",className:"hidden",ref:w,onChange:re,accept:o})]})]}),oe&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-surface-sunk rounded-lg border border-border",children:[e.jsx(Y,{icon:P.Folder,size:"sm",color:"warning"}),e.jsx(pe,{placeholder:"Folder name",value:f,onChange:T=>E(T.target.value),autoFocus:!0}),e.jsx(te,{onClick:ae,loading:K,children:"Create"}),e.jsx(te,{variant:"ghost",onClick:()=>N(!1),children:"Cancel"})]}),e.jsx("div",{className:"max-h-100 overflow-auto rounded-lg border border-border",children:e.jsx(De,{data:R,columns:F,loading:K,emptyContent:"This folder is empty",onRowClick:T=>T.type==="folder"?M(T.name):G(T)})})]}):e.jsx("div",{className:"max-h-100 overflow-auto rounded-lg border border-border",children:e.jsx(De,{data:y,columns:q,loading:K,emptyContent:"No storage mounts configured",onRowClick:T=>k(T)})})})},{id:"local",label:"Local File",content:e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 border-2 border-dashed border-border rounded-xl bg-surface-sunk/50",children:[e.jsx("div",{className:"p-4 bg-accent-soft rounded-full mb-4",children:e.jsx(Y,{icon:P.FileText,size:"xl",color:"primary"})}),e.jsx(ce,{variant:"label",size:"lg",weight:"semibold",children:"Select a file from your computer"}),e.jsxs(ce,{variant:"body",size:"sm",className:"text-text-muted mt-1 mb-6 text-center max-w-xs",children:["This file will be used directly in the form and will ",e.jsx("strong",{children:"not"})," be uploaded to platform storage."]}),e.jsxs("label",{className:"cursor-pointer",children:[e.jsx(te,{variant:"primary",size:"lg",loading:K,className:"pointer-events-none",children:"Browse Local File"}),e.jsx("input",{type:"file",className:"hidden",onChange:H,accept:o,disabled:K})]})]})})}]})})]})},As={sm:"px-3 py-1.5 text-sm",md:"px-3 py-2 text-base",lg:"px-3 py-2 text-md",full:"px-3 py-2 text-md"},Se=d.forwardRef(({label:t,helperText:s,error:r,size:n="md",fullWidth:a=!1,loading:l=!1,containerClassName:o,labelClassName:u,className:i,id:v,rows:x=4,...m},g)=>{const b=d.useId(),y=v||`textarea-${b}`,p=!!r,h=r||s?`${y}-description`:void 0;return e.jsxs("div",{className:c("flex flex-col",a&&"w-full",o),children:[t&&e.jsx("label",{htmlFor:y,className:c(Ye,p?"text-danger-fg":"text-text-muted",u),children:t}),e.jsxs("div",{className:"relative",children:[e.jsx("textarea",{ref:g,id:y,rows:x,"aria-invalid":p||void 0,"aria-describedby":h,className:c(Je,"resize-y leading-relaxed",As[n],Xe(p),i),...m}),l&&e.jsx("span",{"aria-hidden":!0,className:"absolute top-2 right-3 size-icon-md animate-spin rounded-full border-2 border-border border-t-transparent"})]}),(r||s)&&e.jsx("p",{id:h,className:c("mt-1 text-xs",p?"text-danger-fg":"text-text-subtle"),children:r||s})]})});Se.displayName="TextArea";const _s=new Set(["name","given-name","family-name","additional-name","nickname","honorific-prefix","honorific-suffix","email","username","organization","organization-title","tel","tel-country-code","tel-national","tel-extension","url","photo","language","bday","sex","street-address","address-line1","address-line2","address-line3","address-level1","address-level2","country","country-name","postal-code","current-password","new-password","one-time-code"]);function Ae(t){return t&&_s.has(t)?{autoComplete:t}:{autoComplete:"off","data-1p-ignore":"true","data-lpignore":"true","data-bwignore":"true","data-form-type":"other"}}function qe(t,s){return s.split(".").reduce((r,n)=>r&&typeof r=="object"&&n in r?r[n]:void 0,t)}function Ls(t,s,r){const n=s.split("."),a=Array.isArray(t)?[...t]:{...t};let l=a;for(let o=0;o<n.length-1;o++){const u=n[o],i=l[u];l[u]=i&&typeof i=="object"?Array.isArray(i)?[...i]:{...i}:{},l=l[u]}return l[n[n.length-1]]=r,a}function $s(t,s){const r=s.split("."),n=Array.isArray(t)?[...t]:{...t};let a=n;for(let l=0;l<r.length-1;l++){const o=r[l];if(!a[o]||typeof a[o]!="object")return n;a[o]=Array.isArray(a[o])?[...a[o]]:{...a[o]},a=a[o]}return delete a[r[r.length-1]],n}function nt({title:t,description:s,className:r,children:n}){return!t&&!s?e.jsx("div",{children:n}):e.jsxs("div",{className:c("flex flex-col gap-4 py-6 sm:flex-row sm:gap-8",r),children:[e.jsxs("div",{className:"w-full shrink-0 sm:w-form-label",children:[t&&e.jsx("span",{className:"text-base font-semibold text-text",children:t}),s&&e.jsx("p",{className:"mt-1 text-sm leading-relaxed text-pretty text-text-subtle",children:s})]}),e.jsx("div",{className:"min-w-0 flex-1",children:n})]})}const Ps=({groups:t,data:s,onSubmit:r,onCancel:n,onChange:a,transform:l,validate:o,submitButton:u={label:"Submit",variant:"primary"},cancelButton:i={label:"Cancel",variant:"outline"},showButtons:v=!0,layout:x="vertical",size:m="md",loading:g=!1,className:b,ref:y,sdk:p})=>{const[h,k]=d.useState(s||{}),[C,$]=d.useState({}),[A,W]=d.useState({});d.useEffect(()=>{s&&k({...s})},[s]);const K=d.useCallback((N,f,E)=>{const w=t.flatMap(D=>D.items).find(D=>D.name===N);if(!w)return null;if(w.required&&(f==null||f===""))return`${w.label} is required`;if(w.type==="array"){if(w.required&&(!f||f.length===0))return`${w.label} cannot be empty.`;if(f&&!Array.isArray(f))return`${w.label} must be an array.`;if(Array.isArray(f)&&w.arrayFields){const D=[];let j=!1;if(f.forEach((H,re)=>{const ae={};for(const G of w.arrayFields){const I=H?.[G.name];if(G.required&&(I==null||I===""))ae[G.name]=`${G.label} is required`,j=!0;else if(G.validator){const O=G.validator(I,H);O&&(ae[G.name]=O,j=!0)}}D[re]=ae}),j)return JSON.stringify(D)}}return w.validator?w.validator(f,E):null},[t]),_=d.useCallback((N,f)=>{let E=Ls(h,N,f);t.flatMap(j=>j.items).find(j=>j.name===N)?.removeIfEmpty&&(f==null||f==="")&&(E=$s(E,N)),k(E),W(j=>({...j,[N]:!0}));const D=K(N,f,E);$(j=>({...j,[N]:D||""})),a?.(E,N)},[h,t,K,a]),V=d.useCallback(async N=>{if(N.preventDefault(),g)return;const f={},E=t.flatMap(D=>D.items);for(const D of E){if(D.hidden||D.conditional&&!D.conditional(h))continue;const j=K(D.name,qe(h,D.name),h);j&&(f[D.name]=j)}if(o){const D=o(h);D&&Object.assign(f,D)}if($(f),Object.keys(f).some(D=>f[D]))return;const w=l?l(h):h;await r?.(h,w)},[h,t,K,o,l,r,g]),se=d.useCallback(N=>{const f=qe(h,N.name),E=A[N.name]?C[N.name]:void 0,w=N.disabled||g,D={value:f||"",disabled:w,required:N.required,placeholder:N.placeholder,...N.fieldProps};switch(N.type){case"text":case"email":case"password":case"number":case"tel":case"url":case"color":return e.jsx(pe,{...D,onChange:j=>_(N.name,j.target.value),type:N.textType||N.type,...Ae(N.autocomplete),error:E,size:m});case"textarea":return e.jsx(Se,{...D,onChange:j=>_(N.name,j.target.value),rows:N.rows??4,error:E,size:m});case"select":return e.jsx(ye,{...D,onChange:j=>_(N.name,j),options:(N.options||[]).map(j=>({...j,value:String(j.value)})),searchable:N.searchable,multiple:N.multiple,allowCreate:N.allowCreate,error:E,size:m});case"segmented":return e.jsx(Ge,{"aria-label":N.label,value:f==null?"":String(f),onChange:j=>_(N.name,j),options:(N.options||[]).map(j=>({value:String(j.value),label:j.label})),size:m==="sm"?"sm":"md",className:N.disabled?"pointer-events-none opacity-50":void 0});case"checkbox":return e.jsx(he,{...D,label:N.label,checked:!!f,onChange:j=>_(N.name,j.target.checked),size:m});case"radio":return e.jsx("div",{className:"flex flex-col gap-2",children:N.options?.map(j=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-3 text-base text-text",children:[e.jsx("input",{type:"radio",name:N.name,value:j.value,checked:f===j.value,onChange:()=>_(N.name,j.value),disabled:w||j.disabled,className:"size-checkbox shrink-0 rounded-xs border border-border-strong bg-surface-input accent-accent focus-visible:outline-none focus-visible:focus-ring"}),j.label]},j.value))});case"date":return e.jsx(Ce,{...D,value:f?new Date(f):null,onChange:j=>_(N.name,j),size:m});case"file":return e.jsx(rt,{...D,value:f,onChange:j=>_(N.name,j),error:E,onListFiles:j=>p?.http.invoke({method:"POST",action:"storage.file.list",body:j}),onListMounts:()=>p?.http.invoke({method:"GET",action:"storage.mount"}),onUploadFile:j=>p?.http.invoke({method:"POST",action:"storage.file.upload",body:j}),onDownloadFile:j=>p?.http.invoke({method:"GET",action:`storage.file.${j}.download`}),onRegisterFile:j=>p?.http.invoke({method:"POST",action:"storage.file.folder",body:j})});case"folder":return e.jsx(Ze,{value:f||{},onChange:j=>_(N.name,j),onListFolders:()=>p?.http.invoke({method:"GET",action:"storage.mount"}),disabled:w,size:m,placeholder:N.placeholder});case"custom":return N.customComponent?.({value:f,onChange:j=>_(N.name,j),error:E,disabled:w});case"array":{const j=f||[];let H=[];if(typeof E=="string"&&E.startsWith("["))try{H=JSON.parse(E)}catch{}const re=()=>{_(N.name,[...j,{}])},ae=I=>{_(N.name,j.filter((O,M)=>M!==I))},G=(I,O,M)=>{const S=[...j];S[I]={...S[I],[O]:M},_(N.name,S)};return e.jsxs("div",{className:"flex flex-col gap-2",children:[j.map((I,O)=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"grid flex-1 gap-2 sm:grid-cols-2",children:N.arrayFields?.map(M=>{const S=H?.[O]?.[M.name];return e.jsxs("div",{className:"flex flex-col gap-1",children:[O===0&&e.jsxs("label",{className:"block text-xs font-semibold uppercase tracking-label text-text-subtle",children:[M.label,M.required&&e.jsx("span",{className:"ml-1 text-danger-fg",children:"*"})]}),(()=>{const R={value:I?.[M.name]||"",disabled:w,required:M.required,placeholder:M.placeholder,...M.fieldProps};switch(M.type){case"text":case"email":case"password":case"number":case"tel":case"url":return e.jsx(pe,{...R,onChange:F=>G(O,M.name,F.target.value),type:M.textType||M.type,...Ae(M.autocomplete),error:S,size:m});case"textarea":return e.jsx(Se,{...R,onChange:F=>G(O,M.name,F.target.value),rows:M.rows??4,error:S,size:m});case"select":return e.jsx(ye,{...R,onChange:F=>G(O,M.name,F),options:(M.options||[]).map(F=>({...F,value:String(F.value)})),searchable:M.searchable,multiple:M.multiple,allowCreate:M.allowCreate,error:S,size:m});case"checkbox":return e.jsx(he,{...R,checked:!!I?.[M.name],onChange:F=>G(O,M.name,F.target.checked),size:m});case"radio":return e.jsx("div",{className:"flex flex-col gap-2",children:M.options?.map(F=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-base text-text",children:[e.jsx("input",{type:"radio",name:`${N.name}.${O}.${M.name}`,value:F.value,checked:I?.[M.name]===F.value,onChange:()=>G(O,M.name,F.value),disabled:w||F.disabled,className:"size-checkbox shrink-0 rounded-xs border border-border-strong bg-surface-input accent-accent focus-visible:outline-none focus-visible:focus-ring"}),F.label]},F.value))});case"date":{const F=I?.[M.name];return e.jsx(Ce,{...R,value:F?new Date(F):null,onChange:q=>G(O,M.name,q),size:m})}case"custom":return M.customComponent?.({value:I?.[M.name],onChange:F=>G(O,M.name,F),error:S,disabled:w});default:return e.jsxs("p",{children:["Unsupported field type in array:"," ",M.type]})}})(),S&&e.jsx("p",{className:"text-xs text-danger-fg",children:S})]},M.name)})}),e.jsx(te,{type:"button",iconOnly:!0,variant:"ghost",size:"md","aria-label":`${N.label} verwijderen`,onClick:()=>ae(O),disabled:w,className:c("shrink-0",O===0&&"mt-5"),children:e.jsx(P.Trash2,{className:"size-icon-md"})})]},O)),e.jsxs(te,{type:"button",variant:"secondary",leftIcon:e.jsx(P.Plus,{className:"size-icon-sm"}),onClick:re,disabled:w,children:[N.label," toevoegen"]})]})}default:return null}},[h,A,C,g,m,_]),J=d.useCallback(N=>{if(N.conditional&&!N.conditional(h))return null;const f=N.items.filter(w=>!(w.hidden||w.conditional&&!w.conditional(h)));if(f.length===0)return null;const E=c(N.layout==="flex"?"flex flex-wrap gap-3.5":"grid gap-3.5",N.layout!=="flex"&&{"grid-cols-1":!N.columns||N.columns===1,"grid-cols-2":N.columns===2,"grid-cols-3":N.columns===3,"grid-cols-4":N.columns===4},N.className);return e.jsx(nt,{title:N.title,description:N.description,className:"not-last:border-b not-last:border-border-subtle",children:e.jsx("div",{children:e.jsx("div",{className:E,children:f.map(w=>{const D=A[w.name]?C[w.name]:void 0;return e.jsxs("div",{className:c("flex min-w-0 flex-col gap-1.5",w.type==="checkbox"&&"justify-center"),style:{width:typeof w.width=="string"?w.width:void 0,gridColumn:typeof w.width=="number"?`span ${w.width} / span ${w.width}`:void 0},children:[w.type!=="custom"&&w.type!=="checkbox"&&e.jsxs("label",{className:"block text-sm font-medium text-text-muted",children:[w.label,w.required&&e.jsx("span",{className:"ml-1 text-danger-fg",children:"*"})]}),se(w),w.help&&!D&&e.jsx("p",{className:"text-xs leading-4 text-text-subtle",children:w.help})]},w.name)})})})},N.id)},[h,A,C,se]),X=c({"max-w-settings":m==="sm","max-w-form":m==="md","max-w-6xl":m==="lg","max-w-full":m==="full"},b),oe=m==="full"?"md":m;return e.jsxs("form",{ref:y,onSubmit:V,className:X,children:[!v&&e.jsx("button",{type:"submit",className:"hidden",tabIndex:-1,"aria-hidden":!0}),e.jsx("div",{className:"flex flex-col",children:t.map(J)}),v&&e.jsx("div",{className:"flex items-center gap-2 border-t border-border-subtle py-4",children:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ml-auto"}),n&&e.jsx(te,{type:"button",variant:i.variant??"ghost",size:i.size||oe,disabled:i.disabled||g,onClick:n,className:i.className,children:i.label}),e.jsx(te,{type:"submit",variant:u.variant,size:u.size||oe,disabled:u.disabled||g,loading:g,className:u.className,children:u.label})]})})]})};function Rs({open:t,title:s,description:r,confirmLabel:n="Bevestigen",cancelLabel:a="Annuleren",tone:l="default",loading:o=!1,onConfirm:u,onCancel:i}){return e.jsx(Ie,{open:t,onClose:i,title:s,size:"sm",footer:e.jsxs("div",{className:"flex w-full items-center justify-end gap-2",children:[e.jsx(te,{variant:"ghost",onClick:i,disabled:o,children:a}),e.jsx(te,{variant:l==="danger"?"destructive":"primary",onClick:u,loading:o,children:n})]}),children:r&&e.jsx(ce,{color:"secondary",children:r})})}const Is={default:"bg-surface-hover text-text",primary:"bg-accent-soft text-accent",secondary:"bg-surface-hover text-text-muted",success:"bg-success-soft text-success-fg",warning:"bg-warning-soft text-warning-fg",error:"bg-danger-soft text-danger-fg",info:"bg-info-soft text-info-fg",note:"bg-note-soft text-note"},Fs={sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-sm",lg:"px-3 py-1.5 text-base"},Os={default:"bg-surface-hover",primary:"bg-accent",secondary:"bg-surface-hover",success:"bg-success",warning:"bg-warning",error:"bg-danger",info:"bg-info",note:"bg-note"};function at({variant:t="default",size:s="md",dot:r=!1,icon:n,dismissible:a=!1,onDismiss:l,className:o,children:u,...i}){return e.jsxs("span",{className:c("inline-flex items-center font-medium rounded-full",Is[t],Fs[s],o),...i,children:[r&&e.jsx("span",{className:c("w-2 h-2 rounded-full mr-1.5",Os[t])}),n&&e.jsx("span",{className:c("flex-shrink-0",u&&"mr-1"),children:n}),u,a&&l&&e.jsx("button",{onClick:l,className:"ml-1.5 flex-shrink-0 hover:opacity-70 transition-opacity","aria-label":"Remove badge",children:e.jsx(Y,{icon:P.X,size:"xs",color:"current"})})]})}const ie=({className:t})=>e.jsx("span",{className:c("block rounded-xs bg-surface-hover",t)});function Bs({shape:t,rows:s,columns:r}){switch(t){case"table":return e.jsxs("div",{className:"overflow-hidden rounded-lg ring-1 ring-border",children:[e.jsx("div",{className:"grid gap-2 bg-surface-hover p-3",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:Array.from({length:r}).map((n,a)=>e.jsx(ie,{className:"h-4 w-2/3 bg-border-strong"},`h-${a}`))}),Array.from({length:s}).map((n,a)=>e.jsx("div",{className:"grid gap-2 border-t border-border-subtle p-3",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:Array.from({length:r}).map((l,o)=>e.jsx(ie,{className:"h-4 w-full"},`c-${a}-${o}`))},`r-${a}`))]});case"list":return e.jsx("div",{className:"flex flex-col divide-y divide-border-subtle rounded-lg ring-1 ring-border",children:Array.from({length:s}).map((n,a)=>e.jsxs("div",{className:"flex items-center gap-3 p-3",children:[e.jsx(ie,{className:"size-avatar-sm shrink-0 rounded-full"}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[e.jsx(ie,{className:"h-3"}),e.jsx(ie,{className:"h-2.5 opacity-70"})]})]},a))});case"form":return e.jsx("div",{className:"flex flex-col gap-5",children:Array.from({length:s}).map((n,a)=>e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(ie,{className:"h-2.5 w-28"}),e.jsx(ie,{className:"h-control-md w-full rounded-md"})]},a))});case"menu":return e.jsxs("div",{className:"flex flex-col gap-px",children:[e.jsx("div",{className:"px-2.5 pb-2 pt-5",children:e.jsx(ie,{className:"h-2 w-16"})}),Array.from({length:s}).map((n,a)=>e.jsxs("div",{className:"flex h-row-md items-center gap-2.5 px-2.5",children:[e.jsx(ie,{className:"size-4 shrink-0"}),e.jsx(ie,{className:"h-2"})]},a))]});case"cards":return e.jsx("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:Array.from({length:s*r}).map((n,a)=>e.jsxs("div",{className:"flex flex-col gap-2 rounded-lg p-4 ring-1 ring-border",children:[e.jsx(ie,{className:"h-3 w-1/2"}),e.jsx(ie,{className:"h-2.5"}),e.jsx(ie,{className:"h-2.5 w-3/4 opacity-70"})]},a))});case"text":default:return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(ie,{className:"h-6 w-1/4"}),e.jsx("div",{className:"flex flex-col gap-2",children:Array.from({length:s}).map((n,a)=>e.jsx(ie,{className:"h-4"},a))})]})}}const Hs={text:2,table:8,list:6,form:5,menu:4,cards:2};function Ee({variant:t="page",shape:s,rows:r,columns:n,children:a,className:l,showTableSkeleton:o=!1,tableColumns:u,tableRows:i}){const v=s??(o?"table":"text"),x=r??i??Hs[v],m=n??u??(v==="cards"?3:6),g=e.jsx("div",{className:c("w-full animate-pulse",l),"aria-hidden":!0,children:a??e.jsx(Bs,{shape:v,rows:x,columns:m})});return t==="inline"?g:e.jsx("main",{className:"flex-1 bg-surface p-6",children:g})}const qs={neutral:"bg-surface-hover text-text-muted",success:"bg-success-soft text-success-fg"};function Vs({icon:t,tone:s="neutral",title:r,description:n,actions:a,card:l=!1,className:o,...u}){return e.jsxs("div",{className:c("flex flex-col items-center gap-2.5 text-center",l&&"rounded-lg border border-border bg-surface px-11 py-9 shadow-overlay",o),...u,children:[t!=null&&e.jsx("span",{className:c("flex size-disc items-center justify-center rounded-full text-2xl",qs[s]),children:t}),e.jsx("div",{className:"text-lg font-semibold text-text",children:r}),n&&e.jsx("div",{className:"max-w-sm text-sm leading-relaxed text-text-muted",children:n}),a&&e.jsx("div",{className:"flex gap-2 pt-1.5",children:a})]})}function Us({children:t,className:s,...r}){return e.jsx("kbd",{className:c("inline-flex items-center rounded border border-border px-1.5 py-px text-xs font-medium leading-none text-text-muted",s),...r,children:t})}const Ks={sm:"h-1",md:"h-1.5"},Ws={accent:"bg-accent",success:"bg-success"};function Gs({value:t,variant:s="accent",size:r="md",className:n,...a}){const l=Math.max(0,Math.min(100,t));return e.jsx("div",{role:"progressbar","aria-valuenow":Math.round(l),"aria-valuemin":0,"aria-valuemax":100,className:c("w-full overflow-hidden rounded-full bg-surface-hover",Ks[r],n),...a,children:e.jsx("div",{className:c("h-full rounded-full transition-[width] duration-300 ease-out",Ws[s]),style:{width:`${l}%`}})})}const Ys={xs:"h-3 w-3",sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8",xl:"h-12 w-12"},Js={primary:"text-accent",secondary:"text-text-muted",white:"text-white",current:"text-current"},Xs={xs:"text-xs",sm:"text-sm",md:"text-sm",lg:"text-base",xl:"text-lg"};function Zs({size:t="md",variant:s="primary",label:r="Loading...",showLabel:n=!1,className:a,...l}){return e.jsxs("div",{className:c("inline-flex items-center",n?"flex-col space-y-2":"",a),...l,children:[e.jsxs("svg",{className:c("animate-spin",Ys[t],Js[s]),fill:"none",viewBox:"0 0 24 24","aria-hidden":!n,role:n?"status":void 0,children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),n&&e.jsx("span",{className:c("text-text-muted",Xs[t]),children:r}),!n&&e.jsx("span",{className:"sr-only",children:r})]})}const Qs={neutral:"bg-text-disabled",accent:"bg-accent",success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",note:"bg-note","cat-1":"bg-cat-1","cat-2":"bg-cat-2","cat-3":"bg-cat-3","cat-4":"bg-cat-4","cat-5":"bg-cat-5"};function er({tone:t="neutral",shape:s="round",pulse:r=!1,label:n,className:a}){return e.jsx("span",{role:n?"img":void 0,"aria-label":n,"aria-hidden":n?void 0:!0,className:c("inline-block size-dot shrink-0",s==="round"?"rounded-full":"rounded-sm",Qs[t],r&&"animate-pulse",a)})}function tr({steps:t,current:s,variant:r="numbered",label:n,className:a}){const l=t.indexOf(s),o={role:n?"group":void 0,"aria-label":n,"aria-hidden":n?void 0:!0};return r==="dots"?e.jsx("div",{...o,className:c("flex items-center gap-1.5",a),children:t.map((u,i)=>e.jsx("span",{className:c("h-step-bar rounded-full transition-all duration-fast ease-out",i===l?"w-5 bg-accent":"w-3.5",i<l&&"bg-border-strong",i>l&&"bg-border")},u))}):e.jsx("div",{...o,className:c("flex items-center gap-2",a),children:t.map((u,i)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{"aria-current":i===l?"step":void 0,className:c("flex size-tile-sm items-center justify-center rounded-full text-xs font-medium",i===l&&"bg-accent text-accent-fg",i<l&&"bg-accent-soft text-accent",i>l&&"bg-surface-hover text-text-muted"),children:i+1}),i<t.length-1&&e.jsx("span",{className:"h-px w-8 bg-border-strong"})]},u))})}const sr=/<[a-z][\s\S]*>/i,rr=["[&_p]:my-1.5 [&_p:first-child]:mt-0 [&_p:last-child]:mb-0 [&_p]:leading-relaxed","[&_a]:text-accent [&_a]:underline [&_a]:underline-offset-2","[&_strong]:font-semibold [&_em]:italic","[&_ul]:my-1.5 [&_ul]:list-disc [&_ul]:pl-5 [&_ol]:my-1.5 [&_ol]:list-decimal [&_ol]:pl-5","[&_li]:leading-relaxed","[&_h1]:mb-1 [&_h1]:mt-2 [&_h1]:font-semibold [&_h2]:mb-1 [&_h2]:mt-2 [&_h2]:font-semibold [&_h3]:mb-1 [&_h3]:mt-2 [&_h3]:font-semibold","[&_blockquote]:my-1.5 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-text-muted","[&_hr]:my-2 [&_hr]:border-border","[&_pre]:my-1.5 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-surface-sunk [&_pre]:p-2 [&_pre]:text-xs","[&_code]:rounded-sm [&_code]:bg-surface-sunk [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-xs","[&_pre_code]:bg-transparent [&_pre_code]:p-0","[&_table]:my-1.5 [&_table]:w-full [&_table]:border-collapse [&_table]:text-xs","[&_th]:border [&_th]:border-border [&_th]:px-2 [&_th]:py-1 [&_th]:text-left [&_th]:font-semibold","[&_td]:border [&_td]:border-border [&_td]:px-2 [&_td]:py-1"].join(" "),nr={p:t=>e.jsx("p",{className:"my-1.5 leading-relaxed first:mt-0 last:mb-0",...t}),a:t=>e.jsx("a",{className:"text-accent underline underline-offset-2 hover:opacity-80",target:"_blank",rel:"noopener noreferrer",...t}),strong:t=>e.jsx("strong",{className:"font-semibold",...t}),em:t=>e.jsx("em",{className:"italic",...t}),ul:t=>e.jsx("ul",{className:"my-1.5 list-disc space-y-0.5 pl-5",...t}),ol:t=>e.jsx("ol",{className:"my-1.5 list-decimal space-y-0.5 pl-5",...t}),li:t=>e.jsx("li",{className:"leading-relaxed",...t}),h1:t=>e.jsx("h1",{className:"mb-1 mt-2 text-md font-semibold first:mt-0",...t}),h2:t=>e.jsx("h2",{className:"mb-1 mt-2 text-base font-semibold first:mt-0",...t}),h3:t=>e.jsx("h3",{className:"mb-1 mt-2 text-base font-semibold first:mt-0",...t}),blockquote:t=>e.jsx("blockquote",{className:"my-1.5 border-l-2 border-border pl-3 text-text-muted",...t}),hr:t=>e.jsx("hr",{className:"my-2 border-border",...t}),pre:t=>e.jsx("pre",{className:"my-1.5 overflow-x-auto rounded-md bg-surface-sunk p-2 text-xs",...t}),code:({className:t,children:s,...r})=>{const n=String(s??"");return/language-/.test(t??"")||n.includes(`
2
- `)?e.jsx("code",{className:"font-mono text-xs",...r,children:s}):e.jsx("code",{className:"rounded-sm bg-surface-sunk px-1 py-0.5 font-mono text-xs",...r,children:s})},table:t=>e.jsx("div",{className:"my-1.5 overflow-x-auto",children:e.jsx("table",{className:"w-full border-collapse text-xs",...t})}),th:t=>e.jsx("th",{className:"border border-border px-2 py-1 text-left font-semibold",...t}),td:t=>e.jsx("td",{className:"border border-border px-2 py-1",...t})};function ve({text:t,className:s,as:r}){const n=t??"";return(r?r==="html":sr.test(n))?e.jsx("div",{className:c("break-words",rr,s),dangerouslySetInnerHTML:{__html:bt.sanitize(n,{ADD_ATTR:["target","rel"]})}}):e.jsx("div",{className:c("break-words",s),children:e.jsx(pt,{remarkPlugins:[vt],components:nr,children:n})})}const ar={info:"text-info-fg",success:"text-success-fg",warning:"text-warning-fg",destructive:"text-danger-fg"},lr={info:"bg-info-soft border-info-border",success:"bg-success-soft border-success-border",warning:"bg-warning-soft border-warning-border",destructive:"bg-danger-soft border-danger-border"},or={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4"};function cr({block:t}){switch(t.type){case"heading":return t.level===1?e.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-text",children:t.text}):t.level===2?e.jsx("h2",{className:"pt-2 text-base font-semibold tracking-tight text-text",children:t.text}):e.jsx("h3",{className:"pt-1 text-sm font-semibold text-text",children:t.text});case"paragraph":return e.jsx(ve,{as:"markdown",text:t.text,className:"text-sm text-text"});case"quote":return e.jsx("blockquote",{className:"border-l-2 border-border pl-3.5",children:e.jsx(ve,{as:"markdown",text:t.text,className:"text-sm text-text-muted"})});case"code":return e.jsx("pre",{className:"overflow-x-auto rounded-lg bg-surface-sunk p-3 text-xs",children:e.jsx("code",{className:"font-mono",children:t.text})});case"divider":return e.jsx("hr",{className:"border-border-subtle"});case"list":{const s=t.style==="numbered"?"ol":"ul";return e.jsx(s,{className:c("flex flex-col gap-2 pl-5 text-sm text-text",t.style==="numbered"?"list-decimal":"list-disc"),children:t.items.map((r,n)=>e.jsxs("li",{className:"leading-relaxed marker:text-text-subtle",children:[r.lead&&e.jsxs("strong",{className:"font-semibold",children:[r.lead," "]}),e.jsx(ve,{as:"markdown",text:r.text,className:"inline"})]},n))})}case"table":return e.jsxs("figure",{className:"m-0",children:[e.jsx("div",{className:"overflow-x-auto rounded-lg ring-1 ring-border",children:e.jsxs("table",{className:"w-full border-collapse text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{className:"bg-surface-sunk",children:t.columns.map((s,r)=>e.jsx("th",{className:c("px-4 py-2.5 text-xs font-semibold text-text-muted",s.align==="right"?"text-right":"text-left"),children:s.label},r))})}),e.jsx("tbody",{children:t.rows.map((s,r)=>e.jsx("tr",{className:"border-t border-border-subtle",children:s.map((n,a)=>e.jsx("td",{className:c("px-4 py-2.5 tabular-nums text-text",t.columns[a]?.align==="right"?"text-right":"text-left"),children:n},a))},r))})]})}),t.caption&&e.jsx("figcaption",{className:"pt-2 text-xs italic text-text-subtle",children:t.caption})]});case"kpi":return e.jsx("div",{className:c("grid gap-3",or[t.items.length]??"grid-cols-4"),children:t.items.map((s,r)=>e.jsxs("div",{className:"rounded-lg bg-surface-sunk px-4 py-3.5",children:[e.jsx("div",{className:c("text-2xl font-semibold tracking-tight",s.tone?ar[s.tone]:"text-text"),children:s.value}),e.jsx("div",{className:"pt-0.5 text-xs text-text-muted",children:s.label})]},r))});case"callout":return e.jsxs("div",{className:c("rounded-lg border px-4 py-3",lr[t.tone]),children:[t.title&&e.jsx("div",{className:"pb-0.5 text-sm font-semibold text-text",children:t.title}),e.jsx(ve,{as:"markdown",text:t.text,className:"text-sm text-text"})]});default:return null}}function ir({blocks:t,runtime:s="inert",className:r}){return s!=="inert"?e.jsxs("div",{className:c("rounded-lg border border-warning-border bg-warning-soft px-4 py-3",r),children:[e.jsx("div",{className:"text-sm font-semibold text-text",children:"Deze versie kan hier niet getoond worden"}),e.jsxs("div",{className:"pt-0.5 text-xs text-text-muted",children:["Hij is opgeslagen als ",e.jsx("code",{className:"font-mono",children:s}),", en deze weergave tekent alleen inerte inhoud."]})]}):e.jsx("article",{className:c("flex flex-col gap-4",r),children:t.map((n,a)=>e.jsx(cr,{block:n},n.block_id??a))})}function dr({title:t,icon:s=e.jsx(P.Sparkles,{className:"size-icon-md","aria-hidden":!0}),action:r,children:n,className:a,...l}){return e.jsxs("div",{className:c("flex flex-col gap-2 rounded-xl border p-4","border-assistant-border bg-assistant-soft",a),...l,children:[e.jsxs("div",{className:"flex items-center gap-2 text-assistant",children:[e.jsx("span",{"aria-hidden":!0,children:s}),e.jsx("span",{className:"text-sm font-semibold",children:t}),r&&e.jsx("span",{className:"ml-auto",children:r})]}),n&&e.jsx("div",{className:"text-sm leading-relaxed text-text",children:n})]})}const ur={default:"bg-avatar text-avatar-fg",in:"bg-avatar-in text-avatar-in-fg",out:"bg-accent text-accent-fg",note:"bg-avatar-note text-avatar-note-fg"},xr={xs:"w-5 h-5 text-xs",sm:"w-6 h-6 text-xs",md:"w-7 h-7 text-base",lg:"w-9 h-9 text-sm"};function mr(t){if(!t)return"?";const s=t.trim().split(/[^\p{L}\p{N}]+/u).filter(Boolean);return s.length>=2?(s[0][0]+s[1][0]).toUpperCase():s.length===1?s[0].slice(0,2).toUpperCase():"?"}const lt=({name:t,src:s,tone:r="default",size:n="sm",className:a,title:l})=>{const[o,u]=d.useState(!1),i=c("inline-flex items-center justify-center rounded-full overflow-hidden shrink-0 font-semibold select-none",r==="identity"?Le(t):ur[r],xr[n],a);return s&&!o?e.jsx("img",{src:s,alt:t??"",title:l??t,className:c(i,"object-cover"),onError:()=>u(!0)}):e.jsx("span",{className:i,title:l??t,"aria-label":t,children:mr(t)})},Ve="ring-surface",fr="ring-surface-accent",hr=({people:t,max:s=4,size:r="sm",className:n})=>{if(t.length===0)return null;const a=t.slice(0,s),l=t.length-a.length;return e.jsxs("span",{className:c("inline-flex items-center",n),children:[a.map((o,u)=>e.jsx(lt,{name:o.name,src:o.src,size:r,title:o.name?o.seen===!1?`${o.name} — nog niet gelezen`:o.name:void 0,className:c(u>0&&"-ml-2",o.owner?fr:Ve,o.seen===!1&&"opacity-40")},o.id??`${o.name}-${u}`)),l>0&&e.jsxs("span",{className:c("inline-flex items-center justify-center rounded-full shrink-0 -ml-2 font-semibold bg-avatar text-avatar-fg",r==="xs"?"w-5 h-5 text-xs":r==="md"?"w-7 h-7 text-xs":r==="lg"?"w-9 h-9 text-xs":"w-6 h-6 text-xs",Ve),children:["+",l]})]})},ke={mail:{fg:"text-channel-mail-fg",bg:"bg-channel-mail-soft"},wa:{fg:"text-channel-whatsapp-fg",bg:"bg-channel-whatsapp-soft"},chat:{fg:"text-channel-chat-fg",bg:"bg-channel-chat-soft"},tel:{fg:"text-channel-phone-fg",bg:"bg-channel-phone-soft"},note:{fg:"text-channel-note-fg",bg:"bg-channel-note-soft"}},gr={sm:"size-avatar-xs rounded-sm text-xs",md:"size-avatar-sm rounded-md text-xs",lg:"size-avatar-lg rounded-md text-base"};function br({channel:t,children:s,size:r="md",className:n,title:a}){const l=t in ke?ke[t]:void 0;return e.jsx("span",{title:a,className:c("inline-flex shrink-0 items-center justify-center font-bold",gr[r],l?c(l.fg,l.bg):t?Le(t):c(ke.note.fg,ke.note.bg),n),children:s})}const pr=({src:t,alt:s,size:r="md",aspectRatio:n="auto",radius:a="md",showLoading:l=!0,showError:o=!0,fallback:u,loadingContent:i,errorContent:v,className:x,onLoad:m,onError:g,...b})=>{const[y,p]=d.useState(!0),[h,k]=d.useState(!1),[C,$]=d.useState(t),A=X=>{p(!1),k(!1),m?.(X)},W=X=>{if(p(!1),k(!0),u&&C!==u){$(u),k(!1),p(!0);return}g?.(X)},K=c("relative overflow-hidden bg-surface-hover",{"w-8 h-8":r==="xs","w-12 h-12":r==="sm","w-16 h-16":r==="md","w-24 h-24":r==="lg","w-32 h-32":r==="xl","w-full h-full":r==="full"},{"aspect-square":n==="square","aspect-video":n==="video","aspect-portrait":n==="portrait","aspect-landscape":n==="landscape"},{"rounded-none":a==="none","rounded-sm":a==="sm","rounded-md":a==="md","rounded-lg":a==="lg","rounded-xl":a==="xl","rounded-full":a==="full"},x),_=c("w-full h-full object-cover transition-opacity duration-fast",{"opacity-0":y||h,"opacity-100":!y&&!h}),V=c("absolute inset-0 flex items-center justify-center","text-text-muted"),se=e.jsx("div",{className:"animate-pulse",children:e.jsx("div",{className:"w-6 h-6 bg-surface-hover rounded"})}),J=e.jsxs("div",{className:"text-center",children:[e.jsx(Y,{icon:P.ImageOff,size:"lg",className:"mx-auto mb-1"}),e.jsx("span",{className:"text-xs",children:"Failed to load"})]});return e.jsxs("div",{className:K,children:[e.jsx("img",{...b,src:C,alt:s,className:_,onLoad:A,onError:W}),y&&l&&e.jsx("div",{className:V,children:i||se}),h&&o&&e.jsx("div",{className:V,children:v||J})]})};function vr({icon:t,onClick:s,children:r}){return e.jsxs("button",{type:"button",onClick:s,className:c("inline-flex h-control-sm shrink-0 cursor-pointer items-center gap-1.5 rounded-md px-2.5","text-sm font-medium whitespace-nowrap","transition-colors duration-fast ease-out hover:bg-white/15","focus-visible:outline-none focus-visible:focus-ring"),children:[t,r]})}function jr({items:t,getRowKey:s,variant:r="divided",leading:n,renderItem:a,trailing:l,onSelect:o,onActiveIndexChange:u,isActive:i,unread:v,dimmed:x,groupBy:m,groups:g,renderGroupHeader:b,stickyGroupHeaders:y=!1,collapsibleGroups:p=!1,hideGroupCount:h=!1,selectable:k=!1,selectedItems:C=[],onSelectionChange:$,bulkActions:A,header:W,stickyHeader:K=!1,bordered:_=!1,emptyContent:V,loading:se=!1,loadingRows:J=4,className:X,"aria-label":oe}){const[N,f]=d.useState(()=>Object.fromEntries((g??[]).filter(S=>S.defaultCollapsed).map(S=>[S.id,!0]))),E=d.useRef(null),w=S=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(S.key))return;const F=Array.from(E.current?.querySelectorAll("li[data-list-row]")??[]);if(F.length===0)return;S.preventDefault();const q=F.indexOf(document.activeElement),T=S.key==="Home"?0:S.key==="End"?F.length-1:S.key==="ArrowDown"?(q+1)%F.length:(q-1+F.length)%F.length;F[T]?.focus()},D=(S,R)=>s?s(S,R):R,j=S=>C.includes(S),H=(S,R)=>{$&&$(R?[...C,S]:C.filter(F=>F!==S))},re=S=>$?.(S?[...t]:[]),ae=c("flex flex-col",k&&C.length>0&&"min-h-full",_&&"overflow-hidden rounded-lg border border-border-subtle",X);if(se)return e.jsx("div",{className:ae,children:Array.from({length:J}).map((S,R)=>e.jsxs("div",{className:c("flex animate-pulse items-center gap-3 px-4 py-2",r==="divided"&&R>0&&"border-t border-border-subtle"),children:[e.jsx("span",{className:"size-tile-sm shrink-0 rounded-md bg-surface-hover"}),e.jsx("span",{className:"h-3 w-30 shrink-0 rounded-sm bg-surface-hover"}),e.jsx("span",{className:"h-3 flex-1 rounded-sm bg-surface-hover"}),e.jsx("span",{className:"h-3 w-8 shrink-0 rounded-sm bg-surface-hover"})]},`skeleton-${R}`))});if(t.length===0&&V)return e.jsx("div",{className:ae,children:V});const G=t.length>0&&C.length===t.length,I=C.length>0&&!G,O=(S,R,F)=>{const q=i?.(S,R)??!1,T=v?.(S,R)??!1,L=x?.(S,R)??!1,Q=k&&j(S);return e.jsxs("li",{...o?{role:"button",tabIndex:0,"data-list-row":"","aria-current":q||void 0,onClick:()=>o(S,R),onFocus:()=>u?.(R),onKeyDown:ne=>{ne.key!=="Enter"&&ne.key!==" "||(ne.preventDefault(),o(S,R))}}:{},className:c("flex items-center gap-3 text-base","transition-colors duration-fast ease-out",r==="inset"?"mx-2 rounded-lg px-3 py-2.5":"px-5 py-2.5",r==="divided"&&!F&&"border-t border-border-subtle",o&&"cursor-pointer focus-visible:outline-none focus-visible:focus-ring",q||Q?"bg-accent-soft text-text":T?c("bg-surface-unread",o&&"hover:bg-surface-unread-hover"):o&&"hover:bg-surface-hover",L&&"text-text-muted"),children:[k&&e.jsx("span",{onClick:ne=>ne.stopPropagation(),children:e.jsx(he,{checked:j(S),onChange:ne=>H(S,ne.target.checked),"aria-label":"Rij selecteren"})}),r==="bulleted"&&e.jsx("span",{"aria-hidden":!0,className:"mt-2 size-1.5 shrink-0 self-start rounded-full bg-border-strong"}),n&&e.jsx("span",{className:"shrink-0",children:n(S,R)}),e.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:a?a(S,R):String(S)}),l&&e.jsx("span",{className:"shrink-0 text-xs text-text-subtle",children:l(S,R)})]},D(S,R))},M=(()=>{if(!m)return t.map((q,T)=>O(q,T,T===0));const S=new Map;t.forEach((q,T)=>{const L=m(q,T);S.has(L)||S.set(L,[]),S.get(L).push({item:q,index:T})});const R=g??[];return[...R.filter(q=>S.has(q.id)),...[...S.keys()].filter(q=>!R.some(T=>T.id===q)).map(q=>({id:q}))].flatMap((q,T)=>{const L=S.get(q.id)??[],Q=p&&N[q.id],ne=q.title??q.id,xe=q.count??L.length,fe=e.jsx("li",{onClick:p?()=>f(de=>({...de,[q.id]:!de[q.id]})):void 0,className:c("flex items-center gap-2.5 bg-surface px-5 pb-1.5 text-base font-semibold",T>0?"pt-5":"pt-3",q.tone==="danger"?"text-danger-fg":q.tone==="muted"?"text-text-subtle":"text-text",y&&"sticky z-10",p&&"cursor-pointer select-none"),"aria-expanded":p?!Q:void 0,style:y?{top:K?28:0}:void 0,children:b?b(q,L.map(de=>de.item)):e.jsxs(e.Fragment,{children:[p&&e.jsx(P.ChevronRight,{"aria-hidden":!0,className:c("size-icon-md shrink-0 text-text-subtle transition-transform duration-fast ease-out",!Q&&"rotate-90")}),e.jsx("span",{children:ne}),!h&&e.jsx("span",{className:c("rounded-full px-2 text-xs font-normal tabular-nums",q.tone==="danger"?"bg-danger-soft text-danger-fg":"bg-surface-sunk text-text-subtle"),children:xe})]})},`group-${q.id}`);return Q?[fe]:[fe,...L.map(({item:de,index:ue},Me)=>O(de,ue,Me===0))]})})();return e.jsxs("div",{ref:E,className:ae,onKeyDown:o?w:void 0,children:[W&&e.jsxs("div",{className:c("flex h-row-sm items-end gap-3 border-b border-border bg-surface px-5 pb-2","text-xs font-semibold uppercase tracking-wider text-text-disabled",K&&"sticky top-0 z-20"),children:[k&&e.jsx("span",{className:"flex items-center",children:e.jsx(he,{checked:G,indeterminate:I,onChange:S=>re(S.target.checked),"aria-label":"Alles selecteren"})}),W]}),e.jsx("ul",{"aria-label":oe,className:"flex flex-col",children:M}),k&&C.length>0&&e.jsx("div",{className:"pointer-events-none sticky bottom-0 z-10 flex justify-center px-5 pb-4",children:e.jsxs("div",{className:"pointer-events-auto flex items-center gap-1.5 rounded-lg bg-accent py-1.5 pl-3.5 pr-1.5 text-accent-fg shadow-overlay",children:[e.jsxs("span",{className:"text-sm font-medium",children:[C.length," geselecteerd"]}),e.jsx("span",{"aria-hidden":!0,className:"mx-1.5 h-4 w-px bg-current opacity-25"}),A,e.jsx("span",{"aria-hidden":!0,className:"mx-1.5 h-4 w-px bg-current opacity-25"}),e.jsx("button",{type:"button",onClick:()=>$?.([]),"aria-label":"Selectie wissen",className:"grid size-tile-md shrink-0 cursor-pointer place-items-center rounded-md transition-colors duration-fast ease-out hover:bg-white/15 focus-visible:outline-none focus-visible:focus-ring",children:e.jsx(P.X,{className:"size-icon-lg"})})]})})]})}function yr({side:t,continued:s=!1,tone:r="default",className:n,children:a}){return e.jsx("div",{className:c("min-w-0 max-w-bubble md:max-w-bubble-md",t==="out"?"rounded-lg rounded-tr-sm":"rounded-lg rounded-tl-sm",r==="note"?"bg-note-soft":t==="out"?"bg-bubble-out-soft":"bg-surface-sunk",s&&"mt-1",n),children:a})}const Nr={default:"text-text",urgent:"text-danger-fg",success:"text-success-fg"};function wr({value:t,label:s,tone:r="default",className:n,...a}){return e.jsxs("div",{className:c("rounded-xl bg-editor px-4 py-3.5",n),...a,children:[e.jsx("div",{className:c("text-2xl font-semibold",Nr[r]),children:t}),e.jsx("div",{className:"pt-0.5 text-xs text-text-muted",children:s})]})}function kr({icon:t,label:s,unset:r,className:n}){return e.jsxs("span",{className:c("inline-flex min-w-0 items-center gap-1.5 border-b border-dashed pb-px transition-colors duration-fast ease-out",r?"border-border text-text-subtle hover:border-border-strong hover:text-text-muted":"border-border-strong text-text-muted hover:text-text",n),children:[t,e.jsx("span",{className:"truncate",children:s})]})}function Cr(){return e.jsx("span",{"aria-hidden":!0,className:"shrink-0 text-text-disabled",children:"·"})}const ot=({surface:t=!1,title:s,subtitle:r,meta:n,actions:a=[],children:l,className:o,backLabel:u="Back",backClassName:i,onBack:v,editable:x=!1,onTitleChange:m})=>{const[g,b]=d.useState(!1),[y,p]=d.useState(s),h=d.useRef(null);d.useEffect(()=>{p(s)},[s]),d.useEffect(()=>{g&&h.current&&(h.current.focus(),h.current.select())},[g]);const k=()=>{x&&b(!0)},C=()=>{b(!1),y.trim()!==""&&y!==s&&m?m(y.trim()):p(s)},$=A=>{A.key==="Enter"?h.current?.blur():A.key==="Escape"&&(p(s),b(!1))};return e.jsxs("div",{className:c("px-5 pt-4 pb-2.5",t&&"border-b border-border",o),children:[e.jsxs("div",{className:"flex flex-row sm:items-start sm:justify-between items-center gap-4",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsxs("div",{className:"flex items-start gap-4 text-text",children:[v&&e.jsx(te,{variant:"ghost",onClick:v,leftIcon:e.jsx(Y,{icon:P.ChevronLeft,size:"md"}),iconOnly:!0}),e.jsxs("div",{className:"min-w-0 flex-1",children:[g?e.jsx("input",{ref:h,type:"text",value:y,onChange:A=>p(A.target.value),onBlur:C,onKeyDown:$,className:"text-1xl font-semibold bg-transparent border-b-1 border-border rounded-lg outline-none focus:border-none px-1 -mx-1 min-w-0 w-full"}):e.jsxs("div",{className:"group flex items-baseline gap-2.5 min-w-0",children:[e.jsx("h2",{onClick:k,className:c("text-lg font-semibold tracking-title truncate",x&&"cursor-pointer"),title:x?"Click to edit":void 0,children:s}),r&&e.jsx("span",{className:"shrink-0 text-base text-text-muted truncate",children:r}),x&&e.jsx(P.Pencil,{size:15,onClick:k,className:"shrink-0 cursor-pointer text-text-muted opacity-0 group-hover:opacity-100 transition-opacity"})]}),n&&e.jsx("div",{className:c("mt-1 min-w-0 text-sm text-text-subtle",typeof n=="string"&&"truncate"),children:n})]})]})}),a.length>0&&e.jsx("div",{className:"flex flex-wrap sm:flex-nowrap gap-2 sm:gap-3",children:a.map(A=>A.render?e.jsx(d.Fragment,{children:A.render()},A.id):A.splitOptions&&A.splitOptions.length>0?e.jsx(Pe,{label:A.label,onClick:A.onClick,icon:A.icon,variant:A.variant==="primary"?"primary":"outline",options:A.splitOptions,disabled:A.disabled},A.id):e.jsx(te,{variant:A.variant??"secondary",onClick:W=>{W.stopPropagation(),W.target.blur(),A.onClick()},disabled:A.disabled,leftIcon:A.icon,children:A.label},A.id))})]}),l&&e.jsx("div",{className:"mt-4",children:l})]})},Sr={none:"",sm:"px-3 pb-3 pt-1",md:"px-5 pb-5 pt-1.5"},Er=({title:t,subtitle:s,meta:r,actions:n,onBack:a,editable:l,onTitleChange:o,surface:u=!1,headerContent:i,loading:v=!1,loadingShape:x="table",empty:m,padding:g="md",scroll:b=!0,className:y,contentClassName:p,children:h})=>{const k=v?e.jsx(Ee,{variant:"inline",shape:x}):m?e.jsx("div",{className:"flex flex-col items-center justify-center py-12",children:m}):h;return e.jsxs("div",{className:c(b?"flex h-full min-h-0 flex-col":"flex flex-col",y),children:[e.jsx(ot,{surface:u,title:t,subtitle:s,meta:r,actions:n,onBack:a,editable:l,onTitleChange:o,className:b?"shrink-0":void 0,children:i}),e.jsx("div",{className:c(b&&"min-h-0 flex-1 overflow-y-auto",Sr[g],p),children:k})]})},Mr=({label:t,meta:s,action:r,className:n})=>e.jsxs("div",{className:c("flex items-center gap-2 px-1 pb-2 pt-7 first:pt-0",n),children:[e.jsx("span",{className:"shrink-0 text-2xs font-semibold uppercase tracking-label text-text-subtle",children:t}),s&&e.jsx("span",{className:"min-w-0 flex-1 truncate text-right text-xs tabular-nums text-text-subtle",children:s}),r&&e.jsx("span",{className:"ml-auto shrink-0",children:r})]});function Tr({label:t,trailing:s,align:r="center",className:n}){const a=e.jsx("span",{className:"h-px flex-1 bg-border-subtle","aria-hidden":!0});return!t&&!s?e.jsx("div",{className:c("flex items-center py-2",n),children:a}):e.jsxs("div",{className:c("flex items-center gap-3 py-2",n),children:[r==="center"&&a,e.jsx("span",{className:"shrink-0 text-xs font-medium text-text-muted",children:t}),a,s&&e.jsx("span",{className:"shrink-0",children:s})]})}const ct=d.createContext(null),zr=ct.Provider;function it(){return d.useContext(ct)}function Dr(){const[t,s]=d.useState(null),r=d.useMemo(()=>({setTrail:(n,a)=>s(l=>a?{ownerId:n,entry:a}:l&&l.ownerId!==n?l:null)}),[]);return{trail:t?.entry??null,api:r}}const Ar={none:"",sm:"px-3 py-3",md:"px-5 py-4"},_r=({children:t,actions:s=[],secondaryActions:r=[],actionsPlacement:n="header",onBack:a,backLabel:l="Back",title:o,loading:u=!1,loadingShape:i="form",padding:v="md",className:x,contentClassName:m})=>{const g=it(),b=d.useId(),y=d.useRef(a);y.current=a;const p=!!a,h=d.useRef(s);h.current=s;const k=d.useRef(r);k.current=r;const C=n==="header",$=C&&(s.length>0||r.length>0),A=$?JSON.stringify([...r,...s].map(_=>[_.id,_.label,_.variant,_.disabled])):"",W=d.useMemo(()=>{if(!$)return;const _=V=>(se,J)=>({...se,onClick:()=>{(V==="primary"?h.current:k.current)[J]?.onClick()}});return{actions:h.current.map(_("primary")),secondaryActions:k.current.map(_("secondary"))}},[$,A]);d.useEffect(()=>{if(g&&!(!p&&!o&&!W))return g.setTrail(b,{title:o,onBack:p?()=>y.current?.():void 0,actions:W?.actions,secondaryActions:W?.secondaryActions}),()=>g.setTrail(b,null)},[g,b,o,p,W]);const K=!C&&(s.length>0||r.length>0);return e.jsxs("div",{className:c("flex min-h-full flex-col",x),children:[!g&&(p||o||$)&&e.jsxs("div",{className:"flex shrink-0 items-center gap-2 px-5 pt-4",children:[p&&e.jsx(te,{variant:"ghost",onClick:()=>y.current?.(),"aria-label":l,leftIcon:e.jsx(Y,{icon:P.ChevronLeft,size:"sm"}),iconOnly:!0}),o&&e.jsx("h2",{className:"min-w-0 truncate text-md font-semibold tracking-title text-text",children:o}),C&&e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.length>0&&e.jsx(be,{actions:r,defaultVariant:"ghost"}),s.length>0&&e.jsx(be,{actions:s})]})]}),e.jsx("div",{className:c("flex-1",Ar[v],m),children:u?e.jsx(Ee,{variant:"inline",shape:i}):t}),K&&e.jsxs("div",{className:"sticky bottom-0 z-10 flex shrink-0 items-center gap-2 border-t border-border bg-surface px-5 py-3",children:[r.length>0&&e.jsx(be,{actions:r,defaultVariant:"ghost"}),s.length>0&&e.jsx(be,{actions:s,className:"ml-auto"})]})]})};function Lr({label:t,description:s,control:r,bordered:n=!1,disabled:a=!1,className:l}){return e.jsxs("div",{className:c("flex items-center justify-between gap-4 py-2",n&&"rounded-lg border border-border px-3",a&&"opacity-50",l),children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm text-text",children:t}),s&&e.jsx("div",{className:"text-xs text-text-muted",children:s})]}),e.jsx("div",{className:"shrink-0",children:r})]})}function $r({icon:t,title:s,description:r,actions:n,children:a,className:l}){return e.jsxs("section",{className:c("flex flex-col gap-2",l),children:[e.jsxs("div",{className:"flex items-start gap-2",children:[t&&e.jsx(Y,{icon:t,size:"md",color:"secondary",className:"mt-0.5"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-text",children:s}),r&&e.jsx("p",{className:"text-xs text-text-muted",children:r})]}),n&&e.jsx("div",{className:"shrink-0",children:n})]}),e.jsx("div",{className:c("flex flex-col",t&&"pl-6"),children:a})]})}function Pr({label:t,dotColor:s,onClick:r,className:n}){return e.jsxs("button",{type:"button",onClick:r,className:c("inline-flex max-w-full items-center gap-1.5 rounded-full bg-surface-sunk px-2.5 py-1 text-xs text-text-muted transition-colors duration-fast ease-out hover:bg-surface-hover hover:text-text",n),children:[s&&e.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:s},"aria-hidden":!0}),e.jsx("span",{className:"min-w-0 truncate",children:t}),e.jsx(Y,{icon:P.ArrowUpRight,size:"xs",className:"opacity-70"})]})}function dt(t){const{id:s,header:r,accessor:n,label:a,tone:l,visible:o,width:u,sortable:i,align:v}=t;return{id:s,header:r,accessor:x=>a(n(x),x),cell:(x,m)=>{const g=n(m);return o&&!o(g,m)?null:e.jsx(at,{variant:l?l(g,m):"default",size:"sm",children:a(g,m)})},width:u,sortable:i,align:v}}function Rr(t){const{id:s,header:r,accessor:n,onLabel:a,offLabel:l,onTone:o="success",offTone:u="secondary",width:i,sortable:v}=t;return dt({id:s,header:r,accessor:x=>!!n(x),label:x=>x?a:l,tone:x=>x?o:u,width:i,sortable:v})}function Ir(t){const{id:s,header:r,accessor:n,label:a,empty:l="—",separator:o=", ",width:u,searchable:i,sortable:v}=t;return{id:s,header:r,accessor:x=>{const m=n(x),b=(m==null?[]:Array.isArray(m)?m:[m]).filter(Boolean).map(y=>a(y)??y);return b.length?b.join(o):l},width:u,searchable:i,sortable:v}}function Fr(t,s){return s.split(".").reduce((r,n)=>r&&typeof r=="object"&&n in r?r[n]:void 0,t)}const Or=({groups:t,data:s,size:r="md",className:n})=>{const a=x=>{if(!x)return"-";try{return new Date(x).toLocaleDateString("nl-NL",{year:"numeric",month:"long",day:"numeric"})}catch{return String(x)}},l=x=>x?"Ja":"Nee",o=(x,m)=>{if(!m)return String(x||"-");const g=m.find(b=>b.value===x);return g?g.label:String(x||"-")},u=d.useCallback(x=>{const m=Fr(s,x.name);if(x.type==="array"){const b=m;return!b||b.length===0?e.jsx(ce,{variant:"body",size:"sm",className:"text-text-muted",children:"Geen items"}):e.jsx("div",{className:"space-y-3",children:b.map((y,p)=>e.jsxs("div",{className:"p-4 border border-border rounded-xl space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs(ce,{variant:"label",size:"sm",weight:"medium",className:"text-text-muted",children:[x.label," ",p+1]})}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:x.arrayFields?.map(h=>{const k=y?.[h.name];let C="-";switch(h.type){case"text":case"email":case"number":case"tel":case"url":case"textarea":C=k||"-";break;case"select":case"radio":C=o(k,h.options);break;case"checkbox":C=l(k);break;case"date":C=a(k);break;case"custom":C=h.customComponent?.({value:k});break;default:C=String(k||"-")}return h.format&&(C=h.format(k,y)),e.jsxs("div",{className:"space-y-1",children:[e.jsx(ce,{variant:"label",size:"xs",className:"text-text-muted",children:h.label}),e.jsx(ce,{variant:"body",size:"sm",className:"text-text",children:C})]},h.name)})})]},p))})}if(x.type==="custom"&&x.customComponent)return x.customComponent({value:m});if(x.format){const b=x.format(m,s);return e.jsx(ce,{variant:"body",size:"sm",className:"text-text",children:b})}let g="-";switch(x.type){case"text":case"email":case"password":case"number":case"tel":case"url":g=m?String(m):"-";break;case"textarea":g=m?e.jsx("div",{className:"whitespace-pre-wrap",children:String(m||"-")}):"-";break;case"select":case"radio":g=o(m,x.options);break;case"checkbox":g=l(m);break;case"date":g=a(m);break;default:g=m?String(m):"-"}return e.jsx(ce,{variant:"body",size:"sm",className:"text-text",children:g})},[s]),i=d.useCallback(x=>{if(x.conditional&&!x.conditional(s))return null;const m=x.items.filter(b=>!(b.hidden||b.conditional&&!b.conditional(s)));if(m.length===0)return null;const g=c("space-y-4",{"grid gap-4":x.layout==="grid","flex flex-wrap gap-4":x.layout==="flex"},x.layout==="grid"&&{"grid-cols-1":!x.columns||x.columns===1,"grid-cols-2":x.columns===2,"grid-cols-3":x.columns===3,"grid-cols-4":x.columns===4},x.className);return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8 p-6 border border-border rounded-xl",children:[e.jsxs("div",{className:"md:col-span-1",children:[e.jsx(ce,{variant:"label",size:"lg",weight:"semibold",className:"text-text",children:x.title}),x.description&&e.jsx(ce,{variant:"body",size:"sm",className:"text-text-muted mt-1",children:x.description})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx("div",{className:g,children:m.map(b=>e.jsxs("div",{className:"space-y-1",style:{width:typeof b.width=="string"?b.width:void 0,gridColumn:typeof b.width=="number"?`span ${b.width} / span ${b.width}`:void 0},children:[b.type!=="custom"&&e.jsx(ce,{variant:"label",size:"sm",className:"font-medium text-text-muted",children:b.label}),u(b)]},b.name))})})]},x.id)},[s,u]),v=c("space-y-6",{"max-w-md":r==="sm","max-w-2xl":r==="md","max-w-4xl":r==="lg","max-w-full":r==="full"},n);return e.jsx("div",{className:v,children:e.jsx("div",{className:"space-y-8",children:t.map(i)})})},Br=()=>e.jsx(Ee,{variant:"inline",shape:"menu"}),ut=({item:t,isSelectedHandler:s,onClick:r,depth:n=0})=>{const a=!!(t.children&&t.children.length>0),l=s?s(t.path):!1;if(a)return e.jsxs("li",{children:[t.label&&e.jsxs("div",{className:c("flex items-center gap-2 px-2.5 pt-5 pb-2 text-2xs font-semibold uppercase tracking-label text-text-disabled"),children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.label}),t.count!==void 0&&t.count>0&&e.jsx("span",{className:"font-normal tabular-nums",children:t.count})]}),e.jsx("ul",{className:"flex flex-col gap-px",children:t.children?.map((i,v)=>e.jsx(ut,{item:i,isSelectedHandler:s,onClick:r,depth:n+1},v))})]});const o=t.action,u=o?.visibility!=="always";return e.jsx("li",{children:e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>t.path&&r?.(t.path),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),t.path&&r?.(t.path))},className:c("group/item flex h-row-md cursor-pointer items-center gap-2.5 rounded-md px-2.5 text-base no-underline","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",l?"bg-surface-hover font-medium text-text shadow-sm":"text-text-muted hover:bg-page-hover hover:text-text"),children:[t.icon&&e.jsx("span",{className:c("flex w-5 shrink-0 items-center justify-center",l?"text-text-muted":"text-text-subtle"),children:t.icon}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.label}),t.count!==void 0&&t.count>0&&e.jsx("span",{className:c("shrink-0 text-xs tabular-nums",l?"rounded-full bg-accent px-1.5 font-semibold text-accent-fg":"text-text-subtle",o&&u&&"group-hover/item:hidden group-focus-within/item:hidden"),children:t.count}),t.count===void 0&&t.meta!==void 0&&e.jsx("span",{className:c("shrink-0 text-xs text-text-subtle",o&&u&&"group-hover/item:hidden group-focus-within/item:hidden"),children:t.meta}),o&&e.jsx("button",{type:"button","aria-label":o.label,title:o.label,onClick:i=>{i.stopPropagation(),o.onClick()},onKeyDown:i=>i.stopPropagation(),className:c("flex size-5 shrink-0 items-center justify-center rounded-sm","text-text-subtle transition-colors duration-fast ease-out","hover:bg-page-hover hover:text-text","focus-visible:outline-none focus-visible:focus-ring",u&&"opacity-0 group-hover/item:opacity-100 focus-visible:opacity-100"),children:o.icon})]})})},Hr=({items:t,isSelectedHandler:s,onClick:r,preMenuItemsComponent:n,loading:a=!1})=>a?e.jsxs("nav",{className:"flex h-full min-h-0 shrink-0 flex-col",children:[n&&e.jsx("div",{className:"pb-4",children:n}),e.jsx(Br,{})]}):e.jsxs("nav",{className:"flex h-full min-h-0 shrink-0 flex-col",children:[n&&e.jsx("div",{className:"pb-4",children:n}),e.jsx("ul",{className:"flex min-h-0 flex-1 flex-col gap-px overflow-y-auto",children:t.map((l,o)=>!l.path&&!l.label&&!l.children?e.jsx("li",{"aria-hidden":!0,className:"h-4"},o):e.jsx(ut,{item:l,isSelectedHandler:s,onClick:r},o))})]}),qr={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-lg",xl:"text-xl","2xl":"text-2xl","3xl":"text-3xl","4xl":"text-3xl"},Vr={light:"font-normal",normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},Ur={primary:"text-text",secondary:"text-text-muted",accent:"text-accent",success:"text-success-fg",warning:"text-warning-fg",error:"text-danger-fg",info:"text-info-fg",neutral:"text-text",current:"text-current"},Kr={left:"text-left",center:"text-center",right:"text-right"},Wr=({level:t=1,size:s,weight:r="semibold",color:n="current",align:a="left",truncate:l=!1,className:o,children:u,...i})=>{const v=`h${t}`,x=c("font-sans text-pretty",qr[s||Gr(t)],Vr[r],Ur[n],Kr[a],l&&"truncate",o);return e.jsx(v,{className:x,...i,children:u})};function Gr(t){return{1:"2xl",2:"xl",3:"lg",4:"lg",5:"md",6:"md"}[t]||"md"}const Yr=({commands:t,isOpen:s,onClose:r,labels:n,initialCommandPath:a,initialActiveIndex:l})=>{const[o,u]=d.useState(""),[i,v]=d.useState(a||[]),[x,m]=d.useState(l||0),g=d.useRef(null),b=d.useRef(null),p=(i.length?t.find(h=>h.id===i[0])?.subCommands||[]:t).filter(h=>h.label.toLowerCase().includes(o.toLowerCase()));return d.useEffect(()=>{s||(u(""),v(a||[]),m(l||0))},[s]),d.useEffect(()=>{const h=k=>{if(s){if(k.key==="Escape")r();else if(k.key==="ArrowUp")m(C=>C>0?C-1:p.length-1);else if(k.key==="ArrowDown")m(C=>C<p.length-1?C+1:0);else if(k.key==="Enter"){const C=p[x];C&&(C.subCommands?(v([...i,C.id]),m(0)):C.action&&(C.action(),r()))}}};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s,r,p,x,i]),d.useEffect(()=>{const h=k=>{g.current&&!g.current.contains(k.target)&&r()};return s&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s,r]),d.useEffect(()=>{if(!s)return;b.current?.querySelector(`[data-index="${x}"]`)?.scrollIntoView({block:"nearest"})},[x,s]),s?e.jsx("div",{className:"fixed inset-0 z-modal flex items-center justify-center bg-scrim",children:e.jsxs("div",{className:"flex flex-col w-full max-w-lg max-h-dialog p-2 mx-auto rounded-lg border border-border shadow-modal bg-surface",ref:g,children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 flex-shrink-0",children:[e.jsx(P.Search,{className:"w-4 h-4 text-text-muted shrink-0"}),e.jsx("input",{type:"text",autoFocus:!0,placeholder:n?.searchPlaceholder||"Search commands...",value:o,onChange:h=>u(h.target.value),className:"w-full border-0 bg-transparent py-2 text-text focus:outline-none"})]}),e.jsxs("div",{ref:b,className:"mt-2 pt-2 text-sm border-t border-border max-h-dialog-list overflow-y-auto",children:[p.length===0&&e.jsx("div",{className:"text-text-muted text-center text-sm",children:n?.noCommandsFound||"No commands found"}),p.map((h,k)=>e.jsxs("div",{"data-index":k,className:`flex items-center p-2 cursor-pointer rounded-md ${k===x?"bg-accent-soft text-accent":"text-text"}`,onClick:()=>{h.subCommands?(v([...i,h.id]),m(0)):h.action&&(h.action(),r())},onMouseEnter:()=>m(k),children:[h.icon&&e.jsx("span",{className:"mr-3",children:h.icon}),e.jsx("span",{className:"flex-grow",children:h.label}),h.subCommands&&e.jsx("span",{className:"text-text-muted",children:e.jsx(P.ChevronRight,{className:"w-4 h-4"})})]},h.id))]}),e.jsxs("div",{className:"flex items-center gap-4 px-3 pt-2 mt-2 text-xs text-text-muted border-t border-border",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-5 px-1 py-0.5 rounded border border-border bg-surface-sunk text-xs font-medium not-italic",children:"↑↓"}),n?.navigate||"to navigate"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-5 px-1 py-0.5 rounded border border-border bg-surface-sunk text-xs font-medium not-italic",children:"↵"}),n?.select||"to select"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-5 px-1 py-0.5 rounded border border-border bg-surface-sunk text-xs font-medium not-italic",children:"Esc"}),n?.close||"to close"]})]})]})}):null},Jr={none:"p-0",xs:"p-1",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8","2xl":"p-12"},Xr={none:"m-0",xs:"m-1",sm:"m-2",md:"m-4",lg:"m-6",xl:"m-8","2xl":"m-12"},Zr={none:"",primary:"bg-accent text-accent-fg",secondary:"bg-surface-hover",accent:"bg-accent-soft",success:"bg-success-soft",warning:"bg-warning-soft",error:"bg-danger-soft",info:"bg-info-soft",neutral:"bg-surface-hover",white:"bg-surface",module:"bg-surface","module-subtle":"bg-surface-sunk",backdrop:"bg-page",editor:"bg-surface",input:"bg-surface-input"},Qr={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl",full:"rounded-full"},en={none:"shadow-none",sm:"shadow-none",md:"shadow-overlay",lg:"shadow-overlay",xl:"shadow-modal","2xl":"shadow-modal"},tn={none:"border-0",sm:"border",md:"border-2",lg:"border-4"},sn={primary:"border-accent-border",secondary:"border-border",accent:"border-accent-border",success:"border-success-border",warning:"border-warning-border",error:"border-danger-border",info:"border-info-border",neutral:"border-border-subtle",white:"border-border-subtle"},Fe=d.forwardRef(({padding:t,margin:s,background:r,radius:n,shadow:a,border:l,borderColor:o,className:u,children:i,...v},x)=>e.jsx("div",{ref:x,className:c(t&&Jr[t],s&&Xr[s],r&&Zr[r],n&&Qr[n],a&&en[a],l&&tn[l],o&&sn[o],u),...v,children:i}));Fe.displayName="Box";const rn=({children:t,title:s,...r})=>e.jsxs(Fe,{background:"module",radius:"lg",shadow:"none",border:"sm",borderColor:"neutral",...r,children:[s&&e.jsx("span",{className:"mb-2 block text-sm font-semibold text-text",children:s}),t]}),ze=new Map;function nn({identifier:t,resourceLoader:s,framework:r="react",fallback:n,errorFallback:a,componentProps:l,className:o}){const u=d.useRef(null),[i,v]=d.useState(null),[,x]=d.useState(0),m=d.useRef(null),g=d.useRef(s);g.current=s,d.useEffect(()=>{if(ze.has(t))return;let k=!0;return(async()=>{try{const $=await g.current();if(!k)return;ze.set(t,$),x(A=>A+1)}catch($){console.error(`[FederatedResource] Load failed: ${t}`,$),k&&v(t)}})(),()=>{k=!1}},[t]);const b=ze.get(t)??null,y=!b&&i===t,p=!b&&!y,h=b?r==="react"&&(b.component||b.default)||b:null;return d.useEffect(()=>{if(!h||r==="react")return;const k=u.current;if(k){if(r==="svelte"){const C=h.default||h,$=new C({target:k,props:l||{}});return m.current=$,()=>$.$destroy()}if(h.mount){const C=h.mount({container:k,props:l||{}});return()=>{typeof C=="function"?C():h.unmount?.(k)}}}},[h,r]),d.useEffect(()=>{r==="svelte"&&m.current&&m.current.$set?.(l)},[l,r]),e.jsxs("div",{ref:u,className:o,style:{display:"contents"},children:[p&&n,y&&a,r==="react"&&h&&e.jsx(h,{...l})]})}class an extends d.Component{constructor(){super(...arguments),this.state={hasError:!1,error:null}}static getDerivedStateFromError(s){return{hasError:!0,error:s}}componentDidCatch(s,r){console.error(`[ErrorBoundary] Error in ${this.props.name||"Component"}:`,s,r)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:e.jsxs("div",{className:"p-4 m-4 border border-danger-border bg-danger-soft rounded-lg",children:[e.jsx("h2",{className:"text-lg font-semibold text-danger-fg",children:"Something went wrong"}),e.jsx("p",{className:"text-sm text-danger-fg mt-1",children:this.props.name?`Error in ${this.props.name}`:"The component failed to render."}),e.jsx("button",{className:"mt-4 px-4 py-2 bg-danger text-danger-fg rounded hover:opacity-90 transition-opacity text-sm",onClick:()=>this.setState({hasError:!1,error:null}),children:"Try again"})]}):this.props.children}}exports.ArtifactView=ir;exports.AssistantCard=dr;exports.Avatar=lt;exports.AvatarStack=hr;exports.Badge=at;exports.Box=Fe;exports.Button=te;exports.ButtonGroup=Ft;exports.Card=rn;exports.ChannelBadge=br;exports.Checkbox=he;exports.CommandPalette=Yr;exports.ConfirmDialog=Rs;exports.ContentLoading=Ee;exports.DatePicker=Ce;exports.Dropdown=tt;exports.EmptyState=Vs;exports.ErrorBoundary=an;exports.FederatedResource=nn;exports.FilterChip=We;exports.FolderSelect=Ze;exports.Form=Ps;exports.FormSection=nt;exports.Heading=Wr;exports.IDENTITY_TONE_COUNT=Ue;exports.Icon=Y;exports.Image=pr;exports.ImageField=cs;exports.Kbd=Us;exports.KpiCard=wr;exports.Link=Yt;exports.List=jr;exports.ListBulkAction=vr;exports.MeetingGrid=_t;exports.MessageBubble=yr;exports.MetaSeparator=Cr;exports.MetaValue=kr;exports.Modal=Ie;exports.Page=Er;exports.PageHeader=ot;exports.PageToolbar=js;exports.PageToolbarActions=be;exports.ParticipantTile=Lt;exports.Popover=$e;exports.ProgressBar=Gs;exports.RichText=ve;exports.SearchField=Re;exports.SearchableTextField=Qe;exports.SectionCaption=Mr;exports.SectionDivider=Tr;exports.SegmentedToggle=Ge;exports.Select=ye;exports.SettingsFrameProvider=zr;exports.SettingsPage=_r;exports.SettingsRow=Lr;exports.SettingsSection=$r;exports.SidebarMenu=Hr;exports.SourceChip=Pr;exports.Spinner=Zs;exports.SplitButton=Pe;exports.StatusDot=er;exports.StepIndicator=tr;exports.StorageInput=rt;exports.Switch=et;exports.TabBar=zs;exports.Table=De;exports.Tabs=st;exports.Text=ce;exports.TextArea=Se;exports.TextField=pe;exports.VideoSurface=$t;exports.View=Or;exports.autofillProps=Ae;exports.badgeColumn=dt;exports.booleanBadgeColumn=Rr;exports.catTone=Mt;exports.cn=c;exports.createSizes=wt;exports.createVariants=Nt;exports.dateFilterHandler=ys;exports.identityDotClass=Et;exports.identityPlateClass=Le;exports.identityTone=_e;exports.labelsColumn=Ir;exports.multiSelectFilterHandler=ws;exports.normalizeText=Ke;exports.resolveLucideIcon=Ot;exports.selectFilterHandler=Ns;exports.text=je;exports.useAnchoredPosition=Ne;exports.useSettingsFrame=it;exports.useSettingsFrameHost=Dr;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const gt=require("clsx"),d=require("react"),e=require("react/jsx-runtime"),R=require("lucide-react"),bt=require("dompurify"),pt=require("react-markdown"),vt=require("remark-gfm");function jt(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return s.default=t,Object.freeze(s)}const yt=jt(R);function c(...t){return gt.clsx(t)}function Nt(t){return(s,r)=>t[s]?.[r]||""}function wt(t){return s=>t[s]||""}function Ne(t,s,{gap:r=6,matchWidth:n=!1,placement:a="bottom-start"}={}){const[l,o]=d.useState({});return d.useLayoutEffect(()=>{if(!t)return;const u=()=>{const i=s.current;if(!i)return;const v=i.getBoundingClientRect(),x=window.innerHeight-v.bottom,m=v.top,g=a.startsWith("top"),b=g?m<200&&x>m:x<200&&m>x,N=g!==b,p={position:"fixed"};N?(p.bottom=window.innerHeight-v.top+r,p.maxHeight=Math.max(120,m-r*2)):(p.top=v.bottom+r,p.maxHeight=Math.max(120,x-r*2)),a.endsWith("end")?p.right=window.innerWidth-v.right:p.left=v.left,n&&(p.width=v.width),o(p)};return u(),window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[t,s,r,n,a]),l}const Ue=5;function kt(t){let s=2166136261;for(let r=0;r<t.length;r++)s^=t.charCodeAt(r),s=Math.imul(s,16777619);return s>>>0}function _e(t){const s=(t??"").trim().toLowerCase();return s?kt(s)%Ue+1:1}const Ct={1:"bg-cat-1-soft text-cat-1-fg",2:"bg-cat-2-soft text-cat-2-fg",3:"bg-cat-3-soft text-cat-3-fg",4:"bg-cat-4-soft text-cat-4-fg",5:"bg-cat-5-soft text-cat-5-fg"},St={1:"bg-cat-1",2:"bg-cat-2",3:"bg-cat-3",4:"bg-cat-4",5:"bg-cat-5"};function $e(t){return Ct[_e(t)]}function Et(t){return St[_e(t)]}const Be=["cat-1","cat-2","cat-3","cat-4","cat-5"];function Mt(t){let s=0;for(let r=0;r<t.length;r++)s=s*31+t.charCodeAt(r)>>>0;return Be[s%Be.length]}const je=t=>t==null?"":String(t),Ke=t=>je(t).trim().toLowerCase(),Tt=[{upTo:1,cols:"grid-cols-1"},{upTo:2,cols:"grid-cols-1 @[22rem]:grid-cols-2"},{upTo:4,cols:"grid-cols-1 @[18rem]:grid-cols-2"},{upTo:9,cols:"grid-cols-2 @[26rem]:grid-cols-3"}],zt="grid-cols-2 @[26rem]:grid-cols-3 @[40rem]:grid-cols-4";function Dt(t){return Tt.find(s=>t<=s.upTo)?.cols??zt}function At(t,s){const r=s??t;if(t<=r)return{shown:t,hidden:0};const n=Math.max(0,r-1);return{shown:n,hidden:t-n}}function _t({tiles:t,pinned:s,maxStrip:r,className:n}){if(s){const{shown:a,hidden:l}=At(t.length,r),o=t.slice(0,a);return e.jsxs("div",{className:c("@container flex h-full min-h-0 flex-col gap-2",n),children:[e.jsx("div",{className:"min-h-0 flex-1",children:s}),t.length>0&&e.jsxs("div",{className:"flex h-[22%] min-h-14 shrink-0 gap-2 overflow-x-auto",children:[o.map((u,i)=>e.jsx("div",{className:"h-full min-w-0 shrink-0 aspect-video",children:u},i)),l>0&&e.jsxs("div",{className:"flex h-full aspect-video shrink-0 items-center justify-center rounded-lg bg-video-surface text-sm font-semibold tabular-nums text-white/80",children:["+",l]})]})]})}return e.jsx("div",{className:c("@container grid h-full min-h-0 auto-rows-fr gap-2",Dt(t.length),n),children:t.map((a,l)=>e.jsx("div",{className:"min-h-0 min-w-0",children:a},l))})}function $t({name:t,avatarUrl:s,muted:r,speaking:n,hasVideo:a,videoSlot:l,className:o,fill:u}){return e.jsxs("div",{className:c("@container relative flex min-h-0 min-w-0 items-center justify-center overflow-hidden rounded-lg bg-video-surface",u?"h-full w-full":"aspect-video",n&&"ring-2 ring-speaking",o),children:[a&&l?e.jsx("div",{className:"absolute inset-0",children:l}):e.jsx("div",{className:"flex min-h-0 min-w-0 items-center justify-center text-gray-300",children:s?e.jsx("img",{src:s,alt:t,className:"aspect-square w-[38%] max-w-16 min-w-6 rounded-full object-cover"}):e.jsx("div",{className:"flex aspect-square w-[38%] max-w-16 min-w-6 items-center justify-center rounded-full bg-video-surface-strong",children:a?e.jsx(R.VideoOff,{className:"w-1/2 h-1/2"}):e.jsx(R.User,{className:"w-1/2 h-1/2"})})}),e.jsxs("div",{className:"absolute inset-x-2 bottom-2 flex w-fit max-w-[calc(100%-1rem)] items-center gap-1.5 rounded bg-video-overlay px-1.5 py-1 text-xs text-white",children:[r?e.jsx(R.MicOff,{className:"size-3 shrink-0"}):e.jsx(R.Mic,{className:"size-3 shrink-0"}),e.jsx("span",{className:"hidden truncate @[9rem]:inline",children:t})]})]})}function Lt({attach:t,active:s=!0,mirrored:r=!1,className:n}){const a=d.useRef(null);return d.useEffect(()=>{if(!s||!a.current)return;const l=t(a.current);return()=>{typeof l=="function"&&l(),a.current&&(a.current.innerHTML="")}},[t,s]),e.jsx("div",{ref:a,className:c("w-full h-full bg-video-surface-strong overflow-hidden",r&&"[&>*]:scale-x-[-1]",n)})}const Pt={primary:"bg-accent text-accent-fg hover:bg-accent-hover disabled:bg-surface-hover",secondary:"bg-surface-sunk text-text-strong hover:bg-surface-hover disabled:bg-surface-hover",outline:"border border-border text-text-strong hover:bg-surface-hover",ghost:"text-text-muted hover:bg-surface-hover hover:text-text",destructive:"border border-danger-border bg-danger-soft text-danger-fg hover:border-danger disabled:bg-surface-hover",success:"bg-success text-text-inverse hover:opacity-90 disabled:bg-surface-hover",warning:"bg-warning text-text-inverse hover:opacity-90 disabled:bg-surface-hover","danger-solid":"bg-danger text-text-inverse hover:opacity-90 disabled:bg-surface-hover"},Rt={xs:"h-control-xs px-2 text-xs",sm:"h-control-sm px-3 text-sm",md:"h-control-md px-4 text-sm",lg:"h-control-lg px-4 text-sm",xl:"h-control-xl px-6 text-base","2xl":"h-control-2xl px-6 text-base",full:"h-control-md px-4 text-sm"},It={xs:"h-control-xs w-6",sm:"h-control-sm w-7",md:"h-control-md w-8",lg:"h-control-lg w-9",xl:"h-control-xl w-10","2xl":"h-control-2xl w-12",full:"h-control-md w-8"},se=d.forwardRef(({variant:t="primary",size:s="md",fullWidth:r=!1,loading:n=!1,leftIcon:a,rightIcon:l,iconOnly:o=!1,shape:u="default",className:i,children:v,disabled:x,...m},g)=>{const b=x||n;return e.jsxs("button",{ref:g,type:"button",className:c("inline-flex shrink-0 items-center justify-center gap-2 cursor-pointer font-medium",u==="circle"?"rounded-full":"rounded-md","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:border-border-subtle","disabled:text-text-disabled",Pt[t],o?It[s]:Rt[s],(r||s==="full")&&"w-full",n&&"cursor-wait",i),disabled:b,"aria-busy":n||void 0,...m,children:[n&&e.jsx("span",{"aria-hidden":!0,className:"size-icon-md shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent"}),!n&&a&&e.jsx("span",{className:"flex items-center justify-center shrink-0",children:a}),!o&&v,!n&&l&&e.jsx("span",{className:"flex items-center justify-center shrink-0",children:l}),o&&!n&&!a&&!l&&v]})});se.displayName="Button";const Ft=({children:t,size:s="md",orientation:r="horizontal",attached:n=!0,className:a})=>{const l=c("inline-flex",{"flex-row":r==="horizontal","flex-col":r==="vertical","[&>*:not(:first-child):not(:last-child)]:rounded-none":n,"[&>*:first-child]:rounded-r-none":n&&r==="horizontal","[&>*:last-child]:rounded-l-none":n&&r==="horizontal","[&>*:first-child]:rounded-b-none":n&&r==="vertical","[&>*:last-child]:rounded-t-none":n&&r==="vertical","[&>*:not(:first-child)]:-ml-px":n&&r==="horizontal","[&>*:not(:first-child)]:-mt-px":n&&r==="vertical","gap-1":!n&&s==="xs","gap-2":!n&&(s==="sm"||s==="md"),"gap-3":!n&&(s==="lg"||s==="xl")},a);return e.jsx("div",{className:l,role:"group",children:t})};function Ot(t){if(!t)return;const s=t.split(/[-_ ]/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(""),r=yt[s];return typeof r=="function"||typeof r=="object"&&r!==null?r:void 0}const Bt={primary:"text-text",secondary:"text-text-muted",accent:"text-accent",success:"text-success-fg",warning:"text-warning-fg",error:"text-danger-fg",info:"text-info-fg",neutral:"text-text-subtle",current:"text-current"},X=({icon:t,size:s="md",color:r="current",clickable:n=!1,onClick:a,className:l,"aria-label":o,...u})=>{const i=typeof s=="number"?s:Ht(s),v=c("inline-block shrink-0",Bt[r],n&&["cursor-pointer rounded-sm transition-opacity duration-fast ease-out hover:opacity-80","focus-visible:outline-none focus-visible:focus-ring"],l),x={size:i,strokeWidth:2,className:v,onClick:n?a:void 0,"aria-label":o,"aria-hidden":o?void 0:!0,role:n?"button":void 0,tabIndex:n?0:void 0,onKeyDown:n?m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),a?.())}:void 0,...u};return e.jsx(t,{...x})};function Ht(t){return{xs:12,sm:14,md:16,lg:20,xl:24}[t]}const Le=({trigger:t,children:s,placement:r="bottom-start",className:n,rootClassName:a,triggerClassName:l,disabled:o=!1,triggerLabel:u})=>{const[i,v]=d.useState(!1),x=d.useRef(null),m=d.useRef(null),g=Ne(i,m,{placement:r});d.useEffect(()=>{if(!i)return;const p=k=>{x.current&&!x.current.contains(k.target)&&v(!1)},f=k=>{k.key==="Escape"&&v(!1)};return document.addEventListener("mousedown",p),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",f)}},[i]);const b=p=>{p.stopPropagation(),!o&&v(f=>!f)},N=()=>v(!1);return e.jsxs("div",{ref:x,className:c("relative inline-flex",a),children:[e.jsx("button",{ref:m,type:"button",onClick:b,disabled:o,"aria-label":u,"aria-expanded":i,className:c("inline-flex items-center",o&&"cursor-not-allowed opacity-50",l),children:t}),i&&e.jsx("div",{className:c("fixed z-overlay overflow-y-auto rounded-lg border border-border bg-surface shadow-overlay",n),style:g,children:typeof s=="function"?s(N):s})]})},qt={none:"hover:bg-surface-sunk hover:text-text",default:"bg-surface-sunk text-text-muted hover:text-text",muted:"bg-surface-sunk text-text-subtle hover:text-text",outline:"text-text-muted ring-1 ring-inset ring-border-strong hover:bg-surface-hover hover:text-text",warning:"bg-warning-soft text-warning-fg",danger:"bg-danger-soft text-danger-fg"},Vt=t=>c("inline-flex cursor-pointer select-none items-center text-sm font-medium",t.size==="sm"?"h-control-sm":"h-control-md","transition-colors duration-fast ease-out",t.shape==="pill"?"rounded-full":"rounded-md",t.active?"bg-info-soft text-info-fg":qt[t.tone??"default"],t.className),Ut=t=>c("inline-flex items-center gap-1.5 pl-3",t.shape==="pill"?"rounded-full":"rounded-md",t.withClear?"pr-1.5":"pr-3","focus-visible:outline-none focus-visible:focus-ring");function We({label:t,icon:s,tone:r="default",shape:n="rect",size:a="md",active:l=!1,caret:o=!1,menu:u,menuClassName:i,onClear:v,clearLabel:x="Filter wissen",onClick:m,title:g,className:b}){const N=l&&!!v,p=n==="pill"?"rounded-full":"rounded-md",f=Vt({active:l,tone:r,shape:n,size:a,className:b}),k=e.jsxs(e.Fragment,{children:[s,t,o&&e.jsx(X,{icon:R.ChevronDown,size:"xs"})]}),E=Ut({shape:n,withClear:N}),P=N&&e.jsx("button",{type:"button","aria-label":x,onClick:v,className:c("inline-flex h-full items-center pr-3 focus-visible:outline-none focus-visible:focus-ring",p),children:e.jsx(X,{icon:R.X,size:"xs"})});return u?e.jsxs("span",{className:f,title:g,children:[e.jsx(Le,{trigger:k,rootClassName:"h-full",triggerClassName:c(E,"h-full"),className:c("min-w-menu p-1.5",i),children:u}),P]}):N?e.jsxs("span",{className:f,title:g,children:[e.jsx("button",{type:"button",onClick:m,className:E,children:k}),P]}):e.jsx("button",{type:"button",title:g,onClick:m,className:c(f,E),children:k})}const Kt={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-md",xl:"text-lg"},Wt={primary:"text-text hover:text-info-fg hover:underline",info:"text-info-fg hover:underline",secondary:"text-text-muted hover:text-text",neutral:"text-text-muted hover:text-text",accent:"text-accent hover:underline",success:"text-success-fg hover:underline",warning:"text-warning-fg hover:underline",error:"text-danger-fg hover:underline"},Gt={primary:"bg-accent-soft",accent:"bg-accent-soft",secondary:"bg-surface-hover",neutral:"bg-surface-hover",success:"bg-success-soft",warning:"bg-warning-soft",error:"bg-danger-soft",info:"bg-info-soft"},Yt=({variant:t="default",size:s="md",color:r="primary",disabled:n=!1,external:a=!1,className:l,children:o,href:u,target:i,rel:v,...x})=>{const m=a||u&&(u.startsWith("http")||u.startsWith("mailto:")),g=c("inline-flex items-center gap-1 underline-offset-2","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",Kt[s],!n&&Wt[r],t==="subtle"&&"no-underline opacity-70 hover:opacity-100",t==="underline"&&"underline decoration-1 hover:decoration-2",t==="button"&&["h-control-md rounded-md px-3 font-semibold no-underline hover:no-underline",Gt[r]],n&&"pointer-events-none cursor-not-allowed text-text-disabled opacity-50",l),b={...x,href:n?void 0:u,target:m?"_blank":i,rel:m?"noopener noreferrer":v,"aria-disabled":n||void 0};return e.jsxs("a",{className:g,...b,children:[o,m&&e.jsx(R.ExternalLink,{className:"size-icon-sm shrink-0","aria-hidden":!0})]})},Jt={sm:"h-control-sm px-3 text-sm",md:"h-control-md px-3 text-sm"};function Ge({options:t,value:s,onChange:r,size:n="sm",tone:a="sunk",fullWidth:l=!1,className:o,"aria-label":u}){return e.jsx("div",{role:"tablist","aria-label":u,className:c("gap-0.5 rounded-md p-0.5",a==="track"?"bg-surface-track":"bg-surface-sunk",l?"flex w-full":"inline-flex",o),children:t.map(i=>{const v=i.value===s;return e.jsx("button",{role:"tab","aria-selected":v,"aria-label":i.title,title:i.title,type:"button",onClick:()=>r(i.value),className:c("inline-flex cursor-pointer items-center justify-center gap-1.5 rounded-sm","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",l&&"min-w-0 flex-1",Jt[n],v?"bg-surface text-text font-medium shadow-sm":"text-text-muted hover:text-text"),children:i.label},i.value)})})}const Xt={primary:"bg-accent text-accent-fg hover:bg-accent-hover",secondary:"border border-border bg-surface text-text hover:bg-surface-hover",outline:"border border-accent-border text-accent hover:bg-accent-soft"},Zt={sm:"h-control-sm w-7",md:"h-control-md w-8"};function Pe({label:t,onClick:s,variant:r="primary",size:n="md",icon:a,options:l,disabled:o=!1,loading:u=!1,menuPlacement:i="bottom-end",menuLabel:v="More options"}){const x=o||u,m=l.length>0;return e.jsxs("div",{className:c("inline-flex items-center",r==="primary"&&"gap-px"),children:[e.jsx(se,{variant:r,size:n,onClick:s,disabled:o,loading:u,leftIcon:a,className:c(m&&"rounded-r-none"),children:t}),m&&e.jsx(Le,{placement:i,disabled:x,triggerLabel:v,className:"min-w-menu py-1",trigger:e.jsx("span",{"aria-hidden":"true",className:c("inline-flex items-center justify-center rounded-md rounded-l-none","transition-colors duration-fast ease-out",Xt[r],Zt[n],x&&"cursor-not-allowed opacity-50"),children:e.jsx(R.ChevronDown,{className:"size-icon-md"})}),children:g=>e.jsx(e.Fragment,{children:l.map(b=>e.jsxs("button",{type:"button",onClick:()=>{b.onClick(),g()},className:c("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",b.variant==="destructive"?"text-danger-fg hover:bg-danger-soft":"text-text hover:bg-surface-hover"),children:[b.icon&&e.jsx("span",{className:"shrink-0",children:b.icon}),b.label]},b.id))})})]})}const Qt={sm:"size-checkbox-sm",md:"size-checkbox",lg:"size-checkbox-lg",full:"size-checkbox"},es={sm:"min-h-control-sm",md:"min-h-control-md",lg:"min-h-control-lg",full:"min-h-control-md"},ts={sm:"text-sm",md:"text-base",lg:"text-md",full:"text-base"},he=d.forwardRef(({label:t,helperText:s,error:r,size:n="md",indeterminate:a=!1,containerClassName:l,labelClassName:o,className:u,id:i,...v},x)=>{const m=d.useId(),g=i||`checkbox-${m}`,b=!!r,N=d.useRef(null),p=d.useCallback(f=>{N.current=f,typeof x=="function"?x(f):x&&typeof x=="object"&&(x.current=f)},[x]);return d.useEffect(()=>{N.current&&(N.current.indeterminate=a)},[a]),e.jsxs("div",{className:c("flex flex-col",l),children:[e.jsxs("div",{className:c("flex items-center gap-3",es[n]),children:[e.jsx("input",{ref:p,id:g,type:"checkbox","aria-invalid":b||void 0,className:c("shrink-0 rounded-xs border accent-accent","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:bg-surface-hover",Qt[n],b?"border-danger-border":"border-border-strong",u),...v}),t&&e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:g,className:c("cursor-pointer",b?"text-danger-fg":"text-text",ts[n],o),children:t}),s&&!r&&e.jsx("p",{className:"mt-0.5 text-xs text-text-subtle",children:s})]})]}),r&&e.jsx("p",{className:"mt-1 text-xs text-danger-fg",children:r})]})});he.displayName="Checkbox";const ss={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-md",xl:"text-lg"},rs={light:"font-normal",normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},ns={primary:"text-text",secondary:"text-text-muted",accent:"text-accent",success:"text-success-fg",warning:"text-warning-fg",error:"text-danger-fg",info:"text-info-fg",neutral:"text-text",current:"text-current",muted:"text-text-subtle"},as={left:"text-left",center:"text-center",right:"text-right",justify:"text-justify"},ls={tight:"leading-tight",normal:"leading-normal",relaxed:"leading-relaxed"},oe=({variant:t="body",size:s="md",weight:r="normal",color:n="current",align:a="left",truncate:l=!1,italic:o=!1,underline:u=!1,lineHeight:i="normal",as:v,className:x,children:m,...g})=>{const b=v||os(t),N=t==="caption",p=t==="label",f=t==="code",k=c("font-sans",N&&"text-xs text-text-subtle",p&&"text-xs font-semibold uppercase tracking-label text-text-subtle",f&&"font-mono text-sm rounded-sm bg-surface-hover px-1 py-0.5",!N&&!p&&!f&&ss[s],!p&&rs[r],ns[n],as[a],t==="body"&&ls[i],o&&"italic",u&&"underline",l&&"truncate",x);return e.jsx(b,{className:k,...g,children:m})};function os(t){return{body:"p",caption:"span",label:"span",code:"code"}[t]||"p"}function cs({label:t,value:s,onChange:r,maxDimension:n=256,maxBytes:a,aspect:l="square",helperText:o,disabled:u,className:i,chooseLabel:v="Choose",removeLabel:x="Remove",tooLargeLabel:m="That image is too large."}){const g=d.useRef(null),[b,N]=d.useState(null),p=async f=>{if(!f)return;N(null);const k=await ds(f,n);if(a&&is(k)>a){N(m);return}r(k)};return e.jsxs("div",{className:c("flex flex-col gap-1.5",i),children:[t&&e.jsx("span",{className:"text-sm font-medium text-text",children:t}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:c("flex items-center justify-center overflow-hidden rounded-md border border-border bg-surface-sunk",l==="square"?"h-16 w-16":"h-16 w-28"),children:s?e.jsx("img",{src:s,alt:"",className:"h-full w-full object-contain"}):e.jsx(oe,{variant:"caption",color:"muted",children:"—"})}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(se,{type:"button",variant:"secondary",disabled:u,onClick:()=>g.current?.click(),children:v}),s&&e.jsx(se,{type:"button",variant:"ghost",disabled:u,onClick:()=>{N(null),r(void 0)},children:x})]}),(b||o)&&e.jsx(oe,{variant:"caption",color:b?"error":"muted",children:b??o})]})]}),e.jsx("input",{ref:g,type:"file",accept:"image/png,image/jpeg,image/webp",className:"hidden",onChange:f=>void p(f.target.files?.[0])})]})}function is(t){const s=t.slice(t.indexOf(",")+1),r=s.endsWith("==")?2:s.endsWith("=")?1:0;return Math.floor(s.length*3/4)-r}function ds(t,s){return new Promise((r,n)=>{const a=new FileReader;a.onload=()=>{const l=new Image;l.onload=()=>{const o=Math.min(1,s/Math.max(l.width,l.height)),u=Math.round(l.width*o),i=Math.round(l.height*o),v=document.createElement("canvas");v.width=u,v.height=i;const x=v.getContext("2d");if(!x){r(a.result);return}x.drawImage(l,0,0,u,i),r(v.toDataURL("image/png"))},l.onerror=n,l.src=a.result},a.onerror=n,a.readAsDataURL(t)})}const us=()=>e.jsx(X,{icon:R.Calendar,size:"md",color:"current"}),xs=()=>e.jsx(X,{icon:R.ChevronLeft,size:"md",color:"current"}),ms=()=>e.jsx(X,{icon:R.ChevronRight,size:"md",color:"current"}),Ce=d.forwardRef(({value:t,onChange:s,placeholder:r="Select date",disabled:n=!1,required:a=!1,size:l="md",className:o,minDate:u,maxDate:i,format:v="MM/dd/yyyy",withTime:x=!1},m)=>{const[g,b]=d.useState(!1),[N,p]=d.useState(()=>t||new Date),f=d.useRef(null),k=d.useRef(null),E=Ne(g,k);d.useEffect(()=>{const j=h=>{f.current&&!f.current.contains(h.target)&&b(!1)};return g&&document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[g]);const P=j=>{if(!j)return"";const h=j.getDate().toString().padStart(2,"0"),C=(j.getMonth()+1).toString().padStart(2,"0"),A=j.getFullYear(),S=v==="dd/MM/yyyy"?`${h}/${C}/${A}`:v==="yyyy-MM-dd"?`${A}-${C}-${h}`:`${C}/${h}/${A}`;return x?`${S} ${D(j)}`:S},D=j=>`${j.getHours().toString().padStart(2,"0")}:${j.getMinutes().toString().padStart(2,"0")}`,W=j=>{const[h,C]=j.split(":").map(Number);if(Number.isNaN(h)||Number.isNaN(C))return;const A=t?new Date(t):new Date;A.setHours(h,C,0,0),s?.(A)},U=()=>{const j=N.getFullYear(),h=N.getMonth(),C=new Date(j,h,1),A=new Date(C);A.setDate(A.getDate()-C.getDay());const S=[],_=new Date(A);for(let z=0;z<42;z++)S.push(new Date(_)),_.setDate(_.getDate()+1);return S},F=j=>{if(j.getMonth()===N.getMonth()&&!(u&&j<u)&&!(i&&j>i)){if(x){const C=new Date(j);C.setHours(t?.getHours()??0,t?.getMinutes()??0,0,0),s?.(C);return}s?.(j),b(!1)}},B=()=>{p(new Date(N.getFullYear(),N.getMonth()-1,1))},K=()=>{p(new Date(N.getFullYear(),N.getMonth()+1,1))},Z=()=>{s?.(null),b(!1)},Y=c("w-full border border-border-strong rounded-tile transition-colors duration-fast","bg-surface text-text","placeholder:text-text-muted","focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:bg-surface-hover disabled:text-text-disabled",{"h-control-sm px-3 text-sm":l==="sm","h-control-md px-3 text-base":l==="md","h-control-lg px-3 text-base":l==="lg","h-control-md w-full px-3 text-base":l==="full"},o),ce=U(),J=["January","February","March","April","May","June","July","August","September","October","November","December"];return e.jsxs("div",{ref:f,className:"relative",children:[e.jsxs("div",{ref:k,className:"relative",children:[e.jsx("input",{ref:m,type:"text",value:P(t??null),placeholder:r,disabled:n,required:a,readOnly:!0,onClick:()=>!n&&b(!g),className:c(Y,"pr-10 cursor-pointer")}),e.jsx("button",{type:"button",onClick:()=>!n&&b(!g),disabled:n,className:"absolute inset-y-0 right-0 flex items-center pr-3 text-text-muted hover:text-text-muted",children:e.jsx(us,{})})]}),g&&e.jsxs("div",{style:E,className:"fixed z-overlay overflow-auto rounded-lg border border-border bg-surface p-4 shadow-overlay min-w-panel",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("button",{onClick:B,className:"p-1 hover:bg-surface-hover rounded",children:e.jsx(xs,{})}),e.jsxs("h3",{className:"text-sm font-medium text-text",children:[J[N.getMonth()]," ",N.getFullYear()]}),e.jsx("button",{onClick:K,className:"p-1 hover:bg-surface-hover rounded",children:e.jsx(ms,{})})]}),e.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:["Su","Mo","Tu","We","Th","Fr","Sa"].map(j=>e.jsx("div",{className:"text-xs font-medium text-text-muted text-center py-1",children:j},j))}),e.jsx("div",{className:"grid grid-cols-7 gap-1",children:ce.map((j,h)=>{const C=j.getMonth()===N.getMonth(),A=t&&j.toDateString()===t.toDateString(),S=j.toDateString()===new Date().toDateString(),_=!C||u&&j<u||i&&j>i;return e.jsx("button",{onClick:()=>!_&&F(j),disabled:_,className:c("w-8 h-8 text-sm rounded transition-colors duration-fast",{"text-text hover:bg-surface-hover":C&&!A&&!_,"bg-accent text-accent-fg":A,"bg-surface-hover text-text":S&&!A,"text-text-muted cursor-not-allowed":_}),children:j.getDate()},h)})}),x&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-border pt-3",children:[e.jsx("label",{htmlFor:"datepicker-time",className:"text-sm text-text-muted",children:"Tijd"}),e.jsx("input",{id:"datepicker-time",type:"time",value:t?D(t):"",onChange:j=>W(j.target.value),className:"h-control-sm rounded-md border border-border bg-surface-input px-2 text-sm text-text focus-visible:outline-none focus-visible:focus-ring"})]}),e.jsxs("div",{className:"flex justify-between items-center mt-4 pt-3 border-t border-border",children:[e.jsx("button",{onClick:Z,className:"text-sm text-text-muted hover:text-text",children:"Clear"}),e.jsx("button",{onClick:()=>b(!1),className:"text-sm text-info-fg hover:underline",children:"Close"})]})]})]})}),fs={sm:"h-control-sm px-3 text-sm",md:"h-control-md px-3 text-sm",lg:"h-control-lg px-3 text-base",full:"h-control-md w-full px-3 text-sm"},we=Ke,ye=d.forwardRef(({label:t,helperText:s,error:r,size:n="md",fullWidth:a=!1,disabled:l=!1,options:o,placeholder:u,containerClassName:i,labelClassName:v,className:x,id:m,searchable:g,multiple:b,value:N,onChange:p,allowCreate:f,onCreateOption:k,...E},P)=>{const D=m||`select-${Math.random().toString(36).substr(2,9)}`,W=!!r,[U,F]=d.useState(!1),[B,K]=d.useState(""),Z=d.useRef(null),Y=d.useRef(null),ce=Ne(U,Y,{matchWidth:!0}),[J,j]=d.useState(o);d.useImperativeHandle(P,()=>Z.current),d.useEffect(()=>{const $=w=>{Z.current&&!Z.current.contains(w.target)&&F(!1)};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[]);const h=d.useCallback(($,w)=>$.some(M=>we(M.value)===we(w)||we(M.label)===we(w)),[]),C=d.useCallback(($,w)=>{const M=[...$],G=I=>{const y=je(I).trim();y&&(h(M,y)||M.push({value:y,label:y}))};return Array.isArray(w)?w.forEach(G):G(w),M},[h]);d.useEffect(()=>{j($=>{const w=[...o];return $.forEach(M=>{!h(w,M.value)&&!h(w,M.label)&&w.push(M)}),C(w,N)})},[o,N,C,h]);const A=d.useMemo(()=>Array.isArray(N)?N.map(je):N==null?void 0:je(N),[N]),S=$=>{if(b){const w=Array.isArray(A)?A:[],M=w.includes($)?w.filter(G=>G!==$):[...w,$];p?.(M)}else p?.($),F(!1),K("")},_=b?null:J.find($=>$.value===A),z=b?J.filter($=>Array.isArray(A)&&A.includes($.value)):[],ne=g&&B?J.filter($=>$.label.toLowerCase().includes(B.toLowerCase())):J,ae=!!f&&!!g&&!!B.trim()&&!h(J,B),q=$=>{const w=$.trim();if(!w)return;const M=k?.(w)??{value:w,label:w};if(h(J,M.value)||h(J,M.label)){S(M.value),K(""),b||F(!1);return}j(G=>[...G,M]),S(M.value),K(""),b||F(!1)},H=()=>b?z.length>0?z.map($=>$.label).join(", "):u||"Select options":_?.label||u||"Select an option";return e.jsxs("div",{ref:Z,className:c("relative flex flex-col",a&&"w-full",i),...E,children:[t&&e.jsx("label",{htmlFor:D,onClick:()=>F(!U),className:c("block text-xs font-semibold uppercase tracking-label mb-1.5",W?"text-danger-fg":"text-text-muted",v),children:t}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{ref:Y,type:"button",id:D,disabled:l,onClick:()=>F(!U),className:c("flex w-full items-center justify-between gap-2 rounded-tile border transition-colors duration-fast text-left","focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:bg-surface-hover disabled:text-text-disabled","bg-surface",fs[n],W?"border-danger-border text-danger-fg focus-visible:focus-ring":"border-border-strong text-text",x),children:[e.jsx("span",{className:"truncate flex-1 min-w-0",children:H()}),e.jsx(R.ChevronDownIcon,{size:16,className:c("shrink-0 opacity-60 transition-transform duration-fast",U&&"rotate-180")})]}),U&&e.jsxs("div",{style:ce,className:"fixed z-overlay flex flex-col overflow-hidden rounded-lg border border-border bg-surface shadow-overlay",children:[g&&e.jsx("div",{className:"p-2",children:e.jsx("input",{type:"text",placeholder:"Search...",value:B,onChange:$=>K($.target.value),onKeyDown:$=>{$.key==="Enter"&&ae&&($.preventDefault(),q(B))},className:c("w-full px-3 py-2 text-sm rounded-md border","text-text border-border focus-visible:outline-none focus-visible:focus-ring")})}),ae&&e.jsxs("div",{className:c("cursor-pointer px-3 py-1.5 text-sm","text-info-fg hover:bg-surface-hover"),onClick:()=>q(B),children:["+: “",B.trim(),"”"]}),e.jsxs("ul",{className:"min-h-0 flex-1 overflow-auto py-1",children:[u&&!b&&e.jsx("li",{className:"cursor-pointer px-3 py-1.5 text-sm text-text-muted hover:bg-surface-hover",onClick:()=>{p?.(""),F(!1)},children:u}),ne.map($=>{const w=b?Array.isArray(A)&&A.includes($.value):A===$.value;return e.jsx("li",{onClick:()=>!$.disabled&&S($.value),className:c("cursor-pointer px-3 py-1.5 text-sm","text-text",$.disabled?"opacity-50 cursor-not-allowed":"hover:bg-surface-hover",w&&"bg-accent-soft text-accent font-semibold"),children:e.jsxs("div",{className:"flex items-center",children:[b&&e.jsx("input",{type:"checkbox",checked:w,readOnly:!0,className:"mr-3 h-4 w-4 rounded border-border [&:not(:checked)]:bg-surface-input text-accent "}),e.jsx("span",{children:$.label})]})},$.value)})]})]})]}),(r||s)&&e.jsx("p",{className:c("mt-1 text-xs",W?"text-danger-fg":"text-text-muted"),children:r||s})]})});ye.displayName="Select";const hs={sm:"h-control-sm px-3 text-sm",md:"h-control-md px-3 text-base",lg:"h-control-lg px-3 text-base",full:"h-control-md px-3 text-base"},Ye="mb-1.5 block text-sm font-medium",Je="block w-full rounded-tile border bg-surface-input text-text transition-colors duration-fast ease-out placeholder:text-text-subtle focus-visible:outline-none focus-visible:focus-ring disabled:cursor-not-allowed disabled:bg-surface-hover disabled:text-text-disabled",Xe=t=>t?"border-danger-border bg-danger-soft":"border-border-strong",pe=d.forwardRef(({label:t,helperText:s,error:r,size:n="md",fullWidth:a=!1,startIcon:l,endIcon:o,loading:u=!1,containerClassName:i,labelClassName:v,className:x,id:m,...g},b)=>{const N=d.useId(),p=m||`textfield-${N}`,f=!!r,k=r||s?`${p}-description`:void 0;return e.jsxs("div",{className:c("flex flex-col",a&&"w-full",i),children:[t&&e.jsx("label",{htmlFor:p,className:c(Ye,f?"text-danger-fg":"text-text-muted",v),children:t}),e.jsxs("div",{className:"relative",children:[l&&e.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 text-text-muted",children:l}),e.jsx("input",{ref:b,id:p,"aria-invalid":f||void 0,"aria-describedby":k,className:c(Je,hs[n],l&&"pl-9",(o||u)&&"pr-9",Xe(f),x),...g}),(o||u)&&e.jsx("span",{className:"absolute inset-y-0 right-0 flex items-center pr-3 text-text-muted",children:u?e.jsx("span",{"aria-hidden":!0,className:"size-icon-md animate-spin rounded-full border-2 border-border border-t-transparent"}):o})]}),(r||s)&&e.jsx("p",{id:k,className:c("mt-1 text-xs",f?"text-danger-fg":"text-text-subtle"),children:r||s})]})});pe.displayName="TextField";function Ze({value:t,onChange:s,onListFolders:r,disabled:n,size:a="md",placeholder:l,templatePlaceholder:o,showTemplate:u=!0}){const[i,v]=d.useState([]);d.useEffect(()=>{let m=!0;return Promise.resolve(r?.()).then(g=>{m&&g&&v(g.data??[])}).catch(()=>{}),()=>{m=!1}},[]);const x=t??{};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(ye,{size:a,fullWidth:!0,value:x.folderId??"",options:i.map(m=>({value:m.id,label:m.name})),placeholder:l??"Select a folder",onChange:m=>s?.({...x,folderId:m})}),u&&e.jsx(pe,{size:a,disabled:n??!1,value:x.pathTemplate??"",placeholder:o??"Sub-path e.g. {yyyy}/{mm}/{dd} (optional)",onChange:m=>s?.({...x,pathTemplate:m.target.value})})]})}const ge=(...t)=>t.filter(Boolean).join(" "),gs=t=>e.jsx(R.Search,{...t,strokeWidth:1.5,"aria-hidden":!0}),bs=t=>e.jsx(R.ChevronDown,{...t,strokeWidth:1.5,"aria-hidden":!0}),ps={sm:"h-control-sm px-3 text-sm",md:"h-control-md px-3 text-base",lg:"h-control-lg px-3 text-base",full:"h-control-md w-full px-3 text-base"},Te={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",full:"h-6 w-6"},Qe=d.forwardRef(({label:t,helperText:s,error:r,size:n="md",fullWidth:a=!1,startIcon:l=e.jsx(gs,{}),loading:o=!1,containerClassName:u,labelClassName:i,className:v,id:x,options:m,onRemoteSearch:g,onSelect:b,debounceTime:N=500,showAllOnOpen:p=!1,value:f,onChange:k,...E},P)=>{const D=x||`searchfield-${Math.random().toString(36).substr(2,9)}`,W=!!r,U=d.useRef(null),F=d.useRef(null),[B,K]=d.useState(f||""),[Z,Y]=d.useState(!1),[ce,J]=d.useState(!1),[j,h]=d.useState(!1);d.useEffect(()=>{f!==void 0&&K(f)},[f]);const C=d.useMemo(()=>{if(p&&!j||!B)return m;const q=String(B).toLowerCase();return m.filter(H=>String(H.label).toLowerCase().includes(q))},[B,m,p,j]);d.useEffect(()=>{if(!g||!B){J(!1);return}const q=setTimeout(async()=>{J(!0);try{await g(String(B))}catch(H){console.error("Remote search failed:",H)}finally{J(!1)}},N);return()=>{clearTimeout(q),J(!1)}},[B,N,g]),d.useEffect(()=>{const q=H=>{U.current&&!U.current.contains(H.target)&&Y(!1)};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[]);const A=q=>{const H=q.target.value;K(H),Y(!0),h(!0),k&&k(q)},S=q=>{K(q.label),Y(!1),h(!1),b&&b(q.value)},_=()=>{(m.length>0||g)&&(Y(!0),h(!1))},z=o||ce,ne=Z&&(C.length>0||z),ae=d.useMemo(()=>P||F,[P]);return e.jsxs("div",{className:ge("flex flex-col",a?"w-full":"",u||"","relative"),ref:U,children:[t&&e.jsx("label",{htmlFor:D,className:ge("block text-sm font-medium mb-1",W?"text-danger-fg":"text-text",i||""),children:t}),e.jsxs("div",{className:"relative",children:[l&&e.jsx("div",{className:"absolute left-0 pl-3 flex items-center pointer-events-none h-full",children:e.jsx("span",{className:ge("text-text-muted",Te[n]),children:l})}),e.jsx("input",{ref:ae,id:D,value:B,onChange:A,onFocus:_,className:ge("block w-full rounded-tile border bg-surface-input transition-colors duration-fast ease-out","placeholder:text-text-subtle focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:bg-surface-hover disabled:text-text-disabled",ps[n],l?"pl-10":"","pr-10",W?"border-danger-border text-danger-fg focus-visible:focus-ring":"border-border-strong text-text",v||""),...E}),e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center",children:z||o?e.jsx(R.Loader2,{className:ge("animate-spin text-info-fg",Te[n]),"aria-hidden":!0}):e.jsx(bs,{className:ge("text-text-muted cursor-pointer transition-transform",Te[n],Z?"rotate-180":"rotate-0"),onClick:()=>{Y(q=>(q||h(!1),!q))}})})]}),ne&&e.jsx("ul",{className:"absolute z-10 mt-1 w-full bg-surface border border-border rounded-lg shadow-lg max-h-60 overflow-auto top-full",role:"listbox",children:C.length>0?C.map(q=>e.jsx("li",{className:"px-4 py-2 cursor-pointer text-text hover:bg-accent-soft hover:text-accent transition-colors",onClick:()=>S(q),role:"option","aria-selected":B===q.label,children:q.label},q.value)):e.jsx("li",{className:"px-4 py-2 text-text-muted",children:z||o?"Zoeken op afstand...":"Geen resultaten gevonden."})}),(r||s)&&e.jsx("p",{className:ge("mt-1 text-xs",W?"text-danger-fg":"text-text-muted"),children:r||s}),g&&e.jsxs("p",{className:"mt-2 text-xs text-success-fg",children:["Huidige zoekterm (niet-gedebounced): ",String(B)]})]})});Qe.displayName="SearchableTextField";const Re=d.forwardRef(({value:t,onValueChange:s,hint:r,size:n="md",clearLabel:a="Clear search",containerClassName:l,className:o,disabled:u,...i},v)=>e.jsxs("div",{className:c("flex items-center gap-2 rounded-md bg-surface-sunk px-2.5 text-text-muted","transition-colors duration-fast ease-out",n==="sm"?"h-control-sm":"h-control-md",u&&"opacity-60",l),children:[e.jsx(X,{icon:R.Search,size:"md",color:"current",className:"shrink-0"}),e.jsx("input",{ref:v,type:"search",value:t,disabled:u,onChange:x=>s(x.target.value),className:c("min-w-0 flex-1 border-0 bg-transparent p-0 text-sm text-text shadow-none","placeholder:text-text-subtle","focus:border-0 focus:shadow-none focus:outline-none focus:ring-0","[&::-webkit-search-cancel-button]:appearance-none",o),...i}),t?e.jsx("button",{type:"button","aria-label":a,onClick:()=>s(""),className:"grid size-4 shrink-0 cursor-pointer place-items-center rounded-xs text-text-subtle transition-colors duration-fast ease-out hover:text-text focus-visible:outline-none focus-visible:focus-ring",children:e.jsx(X,{icon:R.X,size:"sm",color:"current"})}):r&&e.jsx("span",{className:"shrink-0 text-xs text-text-subtle",children:r})]}));Re.displayName="SearchField";const et=d.forwardRef(({checked:t,onChange:s,label:r,disabled:n=!1,className:a,...l},o)=>{const u=e.jsx("span",{"aria-hidden":!0,className:c("relative inline-flex size-switch-track shrink-0 items-center rounded-full","transition-colors duration-fast ease-out",t?"bg-accent":"bg-surface-hover",n&&"opacity-50"),children:e.jsx("span",{className:c("absolute left-0.5 size-switch-knob rounded-full bg-surface shadow-overlay","transition-transform duration-fast ease-out",t&&"translate-switch")})});return e.jsxs("label",{className:c("inline-flex items-center gap-2",n?"cursor-not-allowed":"cursor-pointer",a),children:[e.jsx("input",{ref:o,type:"checkbox",role:"switch",checked:t,disabled:n,onChange:i=>s(i.target.checked),className:"peer sr-only",...l}),e.jsx("span",{className:"inline-flex rounded-full peer-focus-visible:focus-ring",children:u}),r&&e.jsx("span",{className:"text-sm text-text",children:r})]})});et.displayName="Switch";const tt=({trigger:t,options:s,value:r,onSelect:n,placement:a="bottom-start",disabled:l=!1,className:o,showCheck:u=!0,header:i})=>{const[v,x]=d.useState(!1),[m,g]=d.useState(null),[b,N]=d.useState({top:0,left:0}),p=d.useRef(null),f=d.useRef(null),k=d.useRef(null),E=d.useRef(null),P=Ne(v,f,{placement:a}),D=d.useRef(null),W=()=>Array.from(E.current?.querySelectorAll("button[data-option-value]:not(:disabled)")??[]);d.useEffect(()=>{v&&W()[0]?.focus()},[v]);const U=j=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(j.key))return;const C=W();if(C.length===0)return;j.preventDefault();const A=C.indexOf(document.activeElement),S=j.key==="Home"?0:j.key==="End"?C.length-1:j.key==="ArrowDown"?(A+1)%C.length:(A-1+C.length)%C.length;C[S]?.focus()};d.useEffect(()=>{const j=h=>{p.current&&(!p.current.contains(h.target)||k.current&&!k.current.contains(h.target))&&(x(!1),g(null),D.current&&(clearTimeout(D.current),D.current=null))};return v&&document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[v]),d.useEffect(()=>{const j=h=>{h.key==="Escape"&&(x(!1),g(null),f.current?.focus(),D.current&&(clearTimeout(D.current),D.current=null))};return v&&document.addEventListener("keydown",j),()=>{document.removeEventListener("keydown",j)}},[v]),d.useEffect(()=>{if(m&&p.current){const j=p.current.querySelector(`[data-option-value="${m}"]`);if(j){const h=j.getBoundingClientRect();N({top:h.top,left:h.right+8})}}},[m]),d.useEffect(()=>()=>{D.current&&clearTimeout(D.current)},[]);const F=j=>{j.stopPropagation(),!l&&(x(!v),g(null),D.current&&(clearTimeout(D.current),D.current=null))},B=(j,h,C)=>{j.stopPropagation(),!h.disabled&&!h.divider&&(!h.children||h.children.length===0)&&(n?.(h.value,C),x(!1),g(null))},K=j=>{D.current&&(clearTimeout(D.current),D.current=null),j.children&&j.children.length>0?g(j.value):g(null)},Z=j=>{j.children&&j.children.length>0?D.current=setTimeout(()=>{g(null)},150):g(null)},Y=(j,h,C)=>{j.stopPropagation(),!h.disabled&&!h.divider&&(n?.(h.value,C),x(!1),g(null))},ce=c("fixed z-overlay min-w-menu bg-surface rounded-lg shadow-overlay border border-border","max-h-60 overflow-auto"),J=c("fixed z-overlay min-w-menu bg-surface rounded-lg shadow-overlay border border-border","max-h-60 overflow-auto");return e.jsxs("div",{ref:p,className:c("relative flex flex-row items-center justify-center rounded-lg hover:bg-surface-hover",o),children:[e.jsx("button",{ref:f,onClick:F,disabled:l,"aria-haspopup":"menu","aria-expanded":v,className:c("inline-flex items-center justify-center",{"opacity-50 cursor-not-allowed":l}),children:t}),v&&e.jsx("div",{ref:E,className:ce,style:P,onKeyDown:U,children:e.jsxs("div",{className:"p-2",role:"menu",children:[i&&(typeof i=="string"?e.jsx("div",{className:"text-xs font-medium text-text-muted uppercase tracking-label px-3 py-2",children:i}):i),s.map((j,h)=>{if(j.divider)return e.jsx("div",{className:"border-t border-border my-2"},`divider-${h}`);const C=j.children&&j.children.length>0,A=m===j.value;return e.jsxs("div",{className:"relative group",children:[e.jsxs("button",{"data-option-value":j.value,role:"menuitem","aria-haspopup":C?"menu":void 0,onClick:S=>B(S,j),onMouseEnter:()=>K(j),onMouseLeave:()=>Z(j),disabled:j.disabled,className:c("flex w-full items-center justify-between rounded-md px-3 py-1.5 text-sm text-text transition-colors duration-fast ease-out hover:bg-surface-hover focus-visible:outline-none focus-visible:focus-ring",{"opacity-50 cursor-not-allowed":j.disabled,"bg-surface-hover":A&&C}),children:[e.jsxs("div",{className:"flex items-center space-x-2 min-w-0",children:[j.icon&&e.jsx("span",{className:"flex-shrink-0",children:j.icon}),e.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[e.jsx("span",{className:"font-base truncate",children:j.label}),j.description&&e.jsx("span",{className:"text-xs text-text-muted",children:j.description})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[u&&r===j.value&&e.jsx(R.Check,{className:"size-icon-md shrink-0 text-success-fg","aria-hidden":!0}),C&&e.jsx("span",{className:"text-text-muted text-xs",children:"▶"})]})]}),C&&A&&e.jsx("div",{ref:k,className:J,style:{top:`${b.top}px`,left:`${b.left}px`},onMouseEnter:()=>{D.current&&(clearTimeout(D.current),D.current=null),g(j.value)},onMouseLeave:()=>{D.current=setTimeout(()=>{g(null)},150)},children:e.jsx("div",{className:"p-2",children:j.children.map((S,_)=>{if(S.divider)return e.jsx("div",{className:"border-t border-border my-2"},`divider-${_}`);const z=typeof r=="object"&&r[j.value]&&r[j.value].includes(S.value)||r===S.value;return e.jsxs("button",{onClick:ne=>Y(ne,S,j.value),disabled:S.disabled,className:c("flex w-full items-center justify-between rounded-md px-3 py-1.5 text-sm text-text transition-colors duration-fast ease-out hover:bg-surface-hover",{"opacity-50 cursor-not-allowed":S.disabled}),children:[e.jsxs("div",{className:"flex items-center space-x-2 min-w-0",children:[S.icon&&e.jsx("span",{className:"flex-shrink-0",children:S.icon}),e.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[e.jsx("span",{className:"font-base truncate",children:S.label}),S.description&&e.jsx("span",{className:"text-xs text-text-muted",children:S.description})]})]}),u&&z&&e.jsx(R.Check,{className:"size-icon-md shrink-0 text-success-fg","aria-hidden":!0})]},S.value)})})})]},j.value)}),(()=>{const j=s.reduce((h,C)=>{if(C.divider)return h;const A=C.children?C.children.filter(S=>!S.divider).length:0;return h+1+A},0);return j>1&&e.jsx("div",{className:"border-t border-border mt-2 pt-2",children:e.jsxs("div",{className:"text-xs text-text-muted px-3 py-1",children:[j," options available"]})})})()]})})]})},be=({actions:t,defaultVariant:s="secondary",className:r})=>t.length===0?null:e.jsx("div",{className:c("flex flex-wrap items-center gap-2",r),children:t.map(n=>n.render?e.jsx(d.Fragment,{children:n.render()},n.id):n.splitOptions&&n.splitOptions.length>0?e.jsx(Pe,{label:n.label,onClick:n.onClick,icon:n.icon,variant:n.variant==="primary"?"primary":"secondary",options:n.splitOptions,disabled:n.disabled},n.id):e.jsx(se,{variant:n.variant??s,onClick:a=>{a.stopPropagation(),a.target.blur(),n.onClick()},disabled:n.disabled,leftIcon:n.icon,children:n.label},n.id))}),vs={none:"p-0",sm:"p-2",md:"px-5 py-4",lg:"p-6"},js=({actions:t=[],onBack:s,backLabel:r="Back",className:n,padding:a="md",children:l})=>e.jsxs("div",{className:c("flex items-center gap-2",vs[a],n),children:[s&&e.jsx(se,{variant:"secondary",onClick:s,"aria-label":r,leftIcon:e.jsx(X,{icon:R.ChevronLeft,size:"sm"}),iconOnly:!0}),l&&e.jsx("div",{className:"min-w-0 flex-1",children:l}),e.jsx(be,{actions:t,className:c(!l&&"ml-auto")})]}),ys=t=>s=>t(s instanceof Date?s:null),Ns=t=>s=>t(typeof s=="string"?s:""),ws=t=>s=>t(Array.isArray(s)?s:typeof s=="string"&&s?[s]:[]),ks={none:"px-0",sm:"px-2",md:"px-3.5",lg:"px-5"},Cs={sm:"h-row-lg",md:"h-row-xl",lg:"h-14"},Ss=8,He=["62%","44%","74%","52%","68%","48%","80%","56%"];function Es(t,s){if(s<=7)return Array.from({length:s},(l,o)=>o);const n=[...new Set([0,s-1,t-1,t,t+1])].filter(l=>l>=0&&l<s).sort((l,o)=>l-o),a=[];return n.forEach((l,o)=>{o>0&&l-n[o-1]>1&&a.push("gap"),a.push(l)}),a}const Ms=t=>{const s=Array.isArray(t.value)?t.value:t.value!=null&&t.value!==""&&t.value!=="all"?[t.value]:[];if(t.type==="date"){const o=t.value instanceof Date;return e.jsx(Ce,{value:t.value,onChange:u=>t.onChange(u),placeholder:t.placeholder||t.label,className:c("min-w-40",o&&"bg-info-soft text-info-fg")})}const r=o=>t.options?.find(u=>u.value===o)?.label??String(o),n=o=>Array.isArray(t.value)?t.value.includes(o):t.value===o,a=o=>{if(!t.multiSelect)return t.onChange(o);const u=Array.isArray(t.value)?t.value:[];t.onChange(u.includes(o)?u.filter(i=>i!==o):[...u,o])},l=s.length>0;return e.jsx(We,{tone:"outline",caret:!0,icon:t.icon,active:l,label:l?`${t.label}: ${s.map(r).join(", ")}`:t.label,title:t.label,onClear:()=>t.onChange(t.multiSelect?[]:"all"),menu:o=>e.jsx("div",{role:"listbox",className:"flex flex-col",children:t.options?.map(u=>e.jsx("button",{type:"button",role:"option","aria-selected":n(u.value),onClick:()=>{a(u.value),t.multiSelect||o()},className:c("flex cursor-pointer items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm","transition-colors duration-fast ease-out hover:bg-surface-hover","focus-visible:outline-none focus-visible:focus-ring",n(u.value)?"font-medium text-text":"text-text-muted"),children:u.label},u.value))})})},De=({data:t,columns:s,loading:r=!1,searchable:n=!1,searchPlaceholder:a="Search...",searchValue:l,onSearchChange:o,filters:u=[],toolbarActions:i=[],toolbarContent:v,groupBy:x,groups:m,paginated:g=!1,defaultPageSize:b=10,actions:N=[],onRowClick:p,selectable:f=!1,selectedRows:k=[],onSelectionChange:E,getRowKey:P=(ce,J)=>J,emptyContent:D,footerSummary:W,size:U="md",hoverable:F=!0,padding:B="md",className:K,rowClassName:Z,headerBackground:Y=!0})=>{const[ce,J]=d.useState(""),j=l!==void 0,h=j?l:ce,C=o??J,[A,S]=d.useState({column:null,direction:null}),[_,z]=d.useState({page:0,pageSize:b}),ne=d.useRef(null),ae=d.useMemo(()=>{let T=t;if(n&&!j&&h.trim()){const V=s.filter(le=>le.searchable!==!1),te=h.toLowerCase();T=T.filter(le=>V.some(Q=>{const O=typeof Q.accessor=="function"?Q.accessor(le):le[Q.accessor];return String(O||"").toLowerCase().includes(te)}))}return T},[t,h,j,s,n]),q=d.useMemo(()=>{if(!A.column||!A.direction)return ae;const T=s.find(V=>V.id===A.column);return T?[...ae].sort((V,te)=>{const le=typeof T.accessor=="function"?T.accessor(V):V[T.accessor],Q=typeof T.accessor=="function"?T.accessor(te):te[T.accessor];let O=0;return le<Q?O=-1:le>Q&&(O=1),A.direction==="desc"?-O:O}):ae},[ae,A,s]),H=d.useMemo(()=>{if(!g||x)return q;const T=_.page*_.pageSize,V=T+_.pageSize;return q.slice(T,V)},[q,_,g,x]),$=d.useCallback(T=>{s.find(te=>te.id===T)?.sortable&&S(te=>te.column!==T?{column:T,direction:"asc"}:te.direction==="asc"?{column:T,direction:"desc"}:{column:null,direction:null})},[s]),w=d.useCallback(T=>{z(V=>({...V,page:T}))},[]),M=d.useCallback((T,V)=>{if(!E)return;const te=P(T,0);E(V?[...k,T]:k.filter((le,Q)=>P(k[Q],Q)!==te))},[k,E,P]),G=d.useCallback(T=>{E&&E(T?[...H]:[])},[H,E]);d.useEffect(()=>{z(T=>({...T,page:0}))},[h,A]),d.useEffect(()=>{z(T=>({...T,page:0}))},[u.map(T=>T.value).join(",")]);const I=q.length,y=Math.ceil(I/_.pageSize),L=_.page*_.pageSize+1,ee=Math.min(L+_.pageSize-1,I),re=H.length>0&&H.every(T=>{const V=P(T,0);return k.some((te,le)=>P(te,le)===V)}),xe=H.some(T=>{const V=P(T,0);return k.some((te,le)=>P(te,le)===V)}),fe=ks[B],de=Y?"bg-surface-sunk":"bg-surface",ue=c("text-text",fe),Me=n||u.length>0||i.length>0||!!v,xt=d.useMemo(()=>{const T=H.map((Q,O)=>({row:Q,index:O}));if(!x)return[{group:null,rows:T}];const V=new Map;for(const Q of T){const O=x(Q.row,Q.index),me=V.get(O);me?me.push(Q):V.set(O,[Q])}const te=m??[];return[...te.filter(Q=>V.has(Q.id)),...[...V.keys()].filter(Q=>!te.some(O=>O.id===Q)).map(Q=>({id:Q}))].map(Q=>({group:Q,rows:V.get(Q.id)??[]}))},[H,x,m]),mt=s.length+(f?1:0)+(N.length>0?1:0),Oe=g&&I>0,ft=Oe||W!==void 0;return e.jsxs("div",{className:c("flex min-w-0 flex-col",K),children:[Me&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pb-3",children:[n&&e.jsx(Re,{value:h,onValueChange:C,placeholder:a,containerClassName:"w-full sm:w-66"}),u.map(T=>e.jsx(Ms,{...T},T.id)),v,i.length>0&&e.jsx(be,{actions:i,className:"ml-auto"})]}),e.jsx("div",{className:"relative w-full overflow-x-auto rounded-lg ring-1 ring-border",children:e.jsxs("table",{ref:ne,className:"min-w-full border-collapse text-base text-text",children:[e.jsx("thead",{className:c(de,"h-control-lg"),children:e.jsxs("tr",{children:[f&&e.jsx("th",{className:c(ue,"w-10"),children:e.jsx(he,{size:"sm",checked:re,indeterminate:xe&&!re,onChange:T=>G(T.target.checked),"aria-label":"Select all rows"})}),s.map(T=>e.jsx("th",{className:c(ue,"text-xs font-semibold uppercase tracking-label text-text-muted","group",{"text-left":T.align==="left"||!T.align,"text-center":T.align==="center","text-right":T.align==="right","cursor-pointer select-none":T.sortable,[`sticky left-0 ${de}`]:T.sticky==="left",[`sticky right-0 ${de}`]:T.sticky==="right"}),style:{width:T.width},onClick:()=>T.sortable&&$(T.id),children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[T.headerCell?T.headerCell():T.header,T.sortable&&e.jsx(X,{icon:A.column===T.id&&A.direction==="desc"?R.ChevronDown:R.ChevronUp,size:"xs",className:c("transition-opacity duration-fast ease-out",A.column===T.id?"text-text opacity-100":"text-text-subtle opacity-0 group-hover:opacity-100")})]})},T.id)),N.length>0&&e.jsx("th",{className:c(ue,"w-10"),children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx("tbody",{children:r?Array.from({length:Ss}).map((T,V)=>e.jsxs("tr",{className:"animate-pulse border-t border-border-subtle","aria-hidden":!0,children:[f&&e.jsx("td",{className:c(ue,"h-row-lg"),children:e.jsx("span",{className:"block size-4 rounded-xs bg-surface-hover"})}),s.map((te,le)=>e.jsx("td",{className:c(ue,"h-row-lg"),style:{width:te.width},children:e.jsx("span",{className:"block h-3 rounded-xs bg-surface-hover",style:{width:He[(V+le)%He.length]}})},te.id)),N.length>0&&e.jsx("td",{className:c(ue,"h-row-lg")})]},`skeleton-${V}`)):H.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:s.length+(f?1:0)+(N.length>0?1:0),className:c(ue,"border-t border-border-subtle py-10 text-center text-text-muted"),children:D||"No data available"})}):xt.flatMap(T=>[...T.group?[e.jsx("tr",{children:e.jsx("td",{colSpan:mt,className:c("border-t border-border-subtle bg-surface px-4 pb-1.5 pt-4 text-sm font-semibold",T.group.tone==="danger"?"text-danger-fg":T.group.tone==="muted"?"text-text-subtle":"text-text"),children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[T.group.title??T.group.id,e.jsx("span",{className:"rounded-full bg-surface-sunk px-1.5 py-0.5 text-xs font-medium text-text-muted tabular-nums",children:T.group.count??T.rows.length})]})})},`group-${T.group.id}`)]:[],...T.rows.map(({row:V,index:te})=>{const le=P(V,te),Q=k.some((O,me)=>P(O,me)===le);return e.jsxs("tr",{className:c(Cs[U],"border-t border-border-subtle",F&&"transition-colors duration-fast ease-out hover:bg-surface-hover",p&&"cursor-pointer",Q&&"bg-accent-soft",Z?.(V,te)),onClick:O=>{O.stopPropagation(),p?.(V,te)},children:[f&&e.jsx("td",{className:ue,children:e.jsx(he,{size:"sm",checked:Q,onClick:O=>O.stopPropagation(),onChange:O=>{O.stopPropagation(),M(V,O.target.checked)},"aria-label":"Select row"})}),s.map(O=>{const me=typeof O.accessor=="function"?O.accessor(V):V[O.accessor];return e.jsx("td",{className:c(ue,{"text-left":O.align==="left"||!O.align,"text-center":O.align==="center","text-right":O.align==="right","sticky left-0 bg-surface":O.sticky==="left","sticky right-0 bg-surface":O.sticky==="right"}),children:O.cell?O.cell(me,V,te):String(me||"")},O.id)}),N.length>0&&e.jsx("td",{className:ue,children:e.jsx(tt,{className:"rounded-md",trigger:e.jsx("span",{className:"grid size-7 place-items-center text-text-subtle",children:e.jsx(X,{icon:R.Ellipsis,size:"md",color:"current"})}),options:N.map(O=>({value:O.id,label:O.label,icon:O.icon,disabled:O.disabled?.(V)})),onSelect:O=>{const me=N.find(ht=>ht.id===O);me&&me.onClick(V,te)},placement:"bottom-end"})})]},le)})])})]})}),ft&&e.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-1 pt-3 text-xs text-text-muted",children:[e.jsx("span",{className:"min-w-0 flex-1",children:W??`Showing ${L}–${ee} of ${I}`}),Oe&&e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(se,{size:"xs",variant:"ghost",iconOnly:!0,"aria-label":"Previous page",onClick:()=>w(_.page-1),disabled:_.page===0,children:e.jsx(X,{icon:R.ChevronLeft,size:"md",color:"current"})}),Es(_.page,y).map((T,V)=>T==="gap"?e.jsx("span",{className:"px-1 text-text-subtle",children:"…"},`gap-${V}`):e.jsx("button",{type:"button","aria-current":T===_.page?"page":void 0,onClick:()=>w(T),className:c("h-control-xs min-w-6 cursor-pointer rounded-sm px-1.5 tabular-nums","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",T===_.page?"bg-surface-sunk font-semibold text-text":"text-text-muted hover:bg-surface-hover hover:text-text"),children:T+1},T)),e.jsx(se,{size:"xs",variant:"ghost",iconOnly:!0,"aria-label":"Next page",onClick:()=>w(_.page+1),disabled:_.page>=y-1,children:e.jsx(X,{icon:R.ChevronRight,size:"md",color:"current"})})]})]})]})},Ts=d.createContext(null),zs=({items:t,activeTab:s,onTabChange:r,className:n})=>{const[a,l]=d.useState(t[0]?.id||""),o=s||a,u=i=>{r?r(i):l(i)};return e.jsx("div",{className:c("border-b border-border",n),children:e.jsx("nav",{className:"-mb-px flex space-x-8",children:t.map(i=>e.jsx("button",{onClick:()=>!i.disabled&&u(i.id),disabled:i.disabled,className:c("border-b-2 py-2 px-1 text-sm font-medium transition-colors duration-fast",{"border-accent-border text-text":o===i.id,"border-transparent text-text-muted hover:text-text":o!==i.id&&!i.disabled,"border-transparent text-text-disabled cursor-not-allowed":i.disabled}),children:e.jsxs("span",{className:"flex items-center gap-2",children:[i.label,i.badge&&e.jsx("span",{className:c("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",o===i.id?"bg-accent-soft text-accent":"bg-surface-hover text-text-muted"),children:i.badge})]})},i.id))})})},st=({items:t,defaultTab:s,activeTab:r,onTabChange:n,variant:a="default",size:l="md",className:o})=>{const[u,i]=d.useState(s||r||t[0]?.id||""),v=r||u,x=p=>{n?n(p):i(p)},m={activeTab:v,setActiveTab:x},g=t.find(p=>p.id===v),b=c("flex",{"border-b border-border px-2":a==="default"||a==="underline","bg-surface-hover p-1 rounded-lg":a==="pills","space-x-1":a==="pills","space-x-8":a==="default"||a==="underline"},o),N=(p,f)=>{const k="transition-colors duration-fast font-medium",E={"text-xs px-2 py-1":l==="sm","text-sm px-3 py-2":l==="md","text-base px-4 py-3":l==="lg"},P={"border-b-2 -mb-px":a==="default","rounded-md":a==="pills","border-b-2 pb-2":a==="underline"},D={"opacity-50 cursor-not-allowed":p.disabled,"cursor-pointer":!p.disabled},W=f?{"border-accent-border text-text":a==="default"||a==="underline","bg-surface text-text shadow-none":a==="pills"}:{},U=!f&&!p.disabled?{"border-transparent text-text-muted hover:text-text":a==="default","text-text-muted hover:text-text":a==="pills","border-transparent text-text-muted hover:text-text hover:border-border":a==="underline"}:{};return c(k,E,P,D,W,U)};return e.jsx(Ts.Provider,{value:m,children:e.jsxs("div",{children:[e.jsx("div",{className:b,role:"tablist",children:t.map(p=>e.jsx("button",{type:"button",role:"tab","aria-selected":v===p.id,"aria-controls":`tabpanel-${p.id}`,disabled:p.disabled,onClick:()=>!p.disabled&&x(p.id),className:N(p,v===p.id),children:e.jsxs("span",{className:"flex items-center gap-2",children:[p.label,p.badge&&e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-surface-hover text-text-muted",children:p.badge})]})},p.id))}),g?.content&&e.jsx("div",{role:"tabpanel",id:`tabpanel-${v}`,"aria-labelledby":`tab-${v}`,className:"mt-4",children:g.content})]})})},Ds={sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-full mx-4"};function Ie({open:t,onClose:s,title:r,size:n="md",closeOnBackdropClick:a=!0,closeOnEscape:l=!0,className:o,backdropClassName:u,children:i,footer:v,showCloseButton:x=!0}){const m=d.useRef(null),g=d.useRef(null);d.useEffect(()=>{if(!t||!l)return;const N=p=>{p.key==="Escape"&&s()};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[t,l,s]),d.useEffect(()=>(t?(g.current=document.activeElement,m.current&&m.current.focus(),document.body.style.overflow="hidden"):(g.current&&g.current.focus(),document.body.style.overflow=""),()=>{document.body.style.overflow=""}),[t]);const b=N=>{a&&N.target===N.currentTarget&&s()};return t?e.jsx("div",{className:c("fixed inset-0 z-modal flex items-center justify-center p-4","bg-scrim",u),onClick:b,children:e.jsxs("div",{ref:m,className:c("relative w-full bg-surface rounded-lg shadow-modal","focus:outline-none",Ds[n],o),role:"dialog","aria-modal":"true","aria-labelledby":r?"modal-title":void 0,tabIndex:-1,children:[(r||x)&&e.jsxs("div",{className:"flex items-center justify-between p-6 pb-0",children:[r&&e.jsx("span",{id:"modal-title",className:"text-lg font-semibold text-text",children:r}),x&&e.jsx("button",{onClick:s,className:"p-1 text-text-muted hover:text-text transition-colors","aria-label":"Close modal",children:e.jsx(X,{icon:R.X,size:"lg",color:"current"})})]}),e.jsx("div",{className:"p-6",children:i}),v&&e.jsx("div",{className:"px-6 py-4",children:v})]})}):null}const rt=({value:t,onChange:s,label:r,placeholder:n="Select or upload a file",error:a,disabled:l,accept:o,onListFiles:u,onListMounts:i,onUploadFile:v,onDownloadFile:x,onRegisterFile:m})=>{const[g,b]=d.useState(!1),[N,p]=d.useState([]),[f,k]=d.useState(null),[E,P]=d.useState("/"),[D,W]=d.useState([]),[U,F]=d.useState(!1),[B,K]=d.useState(""),[Z,Y]=d.useState(typeof t=="object"?t:null),[ce,J]=d.useState(!1),[j,h]=d.useState(""),C=d.useRef(null);d.useEffect(()=>{g&&A()},[g]),d.useEffect(()=>{g&&f&&S()},[g,f,E,B]);const A=async()=>{F(!0);try{const y=await i?.();y?.data&&p(y.data)}catch(y){console.error("Failed to load mounts",y)}finally{F(!1)}},S=async()=>{if(f){F(!0);try{const y=await u?.({mountId:f.id,name:B,path:E});y?.data&&W(y.data)}catch(y){console.error("Failed to load files",y)}finally{F(!1)}}},_=async y=>{const L=y.target.files?.[0];if(L){F(!0);try{const ee=await L.arrayBuffer(),re=new Uint8Array(ee),xe={id:`local-${Date.now()}`,name:L.name,type:"file",path:"/",mimeType:L.type||"application/octet-stream",size:L.size,mountId:"local",providerKey:L.name,ownerId:"me"};Y(xe),s(xe,re),b(!1)}catch(ee){console.error("Local file selection failed",ee)}finally{F(!1)}}},z=async y=>{const L=y.target.files?.[0];if(!(!L||!f)){F(!0);try{const ee=await L.arrayBuffer(),re=await v?.({file:new Uint8Array(ee),filename:L.name,mimeType:L.type||"application/octet-stream",mountId:f.id,path:E});if(re?.data){const xe=re.data;Y(xe),s(xe,new Uint8Array(ee)),b(!1)}}catch(ee){console.error("Upload failed",ee)}finally{F(!1)}}},ne=async()=>{if(!(!j||!f)){F(!0);try{const y=`${E}${j}/`;m&&(await m({name:j,type:"folder",path:E,mimeType:"application/x-directory",size:0,mountId:f.id,providerKey:y,ownerId:"me"}),await S()),J(!1),h("")}catch(y){console.error("Failed to create folder",y)}finally{F(!1)}}},ae=async y=>{F(!0);try{const L=await x?.(y.id);Y(y),s(y,L),b(!1)}catch(L){console.error("Failed to download file",L)}finally{F(!1)}},q=y=>{y.stopPropagation(),Y(null),s(null)},H=d.useMemo(()=>{const y=new Set,L=[];return D.forEach(ee=>{if(ee.type==="folder"){ee.path===E&&y.add(ee.name);return}const re=ee.providerKey||ee.name,fe=(E?re.substring(E.length):re).split("/").filter(de=>de!=="");fe.length>1?y.add(fe[0]):fe.length===1&&L.push(ee)}),{folders:Array.from(y).sort(),files:L.sort((ee,re)=>ee.name.localeCompare(re.name))}},[D,E]),$=y=>{P(L=>`${L}${y}/`)},w=()=>{const y=E.split("/").filter(L=>L!=="");y.pop(),y.length===0?P("/"):P(`${y.join("/")}/`)},M=d.useMemo(()=>{const y=H.folders.map(L=>({id:`folder-${L}`,name:L,type:"folder"}));return H.files.forEach(L=>{y.push({...L,type:"file"})}),y},[H]),G=[{id:"name",header:"Name",accessor:"name",cell:(y,L)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(X,{icon:L.type==="folder"?R.Folder:R.FileText,size:"sm",color:L.type==="folder"?"warning":"secondary"}),e.jsx("span",{className:c(L.type==="folder"&&"font-medium"),children:y})]})},{id:"type",header:"Type",accessor:y=>y.type==="folder"?"Folder":y.mimeType},{id:"size",header:"Size",accessor:y=>y.type==="file"?`${(y.size/1024).toFixed(1)} KB`:"-"},{id:"actions",header:"",accessor:"id",align:"right",cell:(y,L)=>e.jsx(se,{variant:"outline",onClick:ee=>{ee.stopPropagation(),L.type==="folder"?$(L.name):ae(L)},loading:U&&L.type==="file"&&Z?.id===L.id,children:L.type==="folder"?"Open":"Select"})}],I=[{id:"name",header:"Mount Name",accessor:"name",cell:y=>e.jsxs("div",{className:"flex items-center gap-2 font-medium",children:[e.jsx(X,{icon:R.HardDrive,size:"sm",color:"primary"}),e.jsx("span",{children:y})]})},{id:"actions",header:"",accessor:"id",align:"right",cell:(y,L)=>e.jsx(se,{variant:"outline",onClick:()=>k(L),children:"Open"})}];return e.jsxs("div",{className:"space-y-1",children:[r&&e.jsx(oe,{variant:"label",size:"sm",weight:"medium",children:r}),e.jsxs("div",{onClick:()=>!l&&b(!0),className:c("flex items-center gap-3 px-3 py-2 border rounded-lg cursor-pointer transition-colors","hover:border-border-strong bg-surface",a?"border-danger-border":"border-border",l&&"opacity-50 cursor-not-allowed bg-surface-sunk"),children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(X,{icon:Z?R.FileText:R.HardDrive,color:Z?"primary":"secondary"})}),e.jsx("div",{className:"flex-grow truncate",children:Z?e.jsx("span",{className:"text-sm text-text font-medium",children:Z.name}):e.jsx("span",{className:"text-sm text-text-muted",children:n})}),Z&&!l&&e.jsx("button",{onClick:q,className:"p-1 hover:bg-surface-hover rounded",children:e.jsx(X,{icon:R.X,size:"xs"})})]}),a&&e.jsx(oe,{variant:"body",size:"xs",className:"text-danger-fg",children:a}),e.jsx(Ie,{open:g,onClose:()=>{b(!1),k(null),P("/"),J(!1)},title:f?`Explorer: ${f.name}`:"Select Storage Mount",size:"lg",children:e.jsx(st,{variant:"pills",items:[{id:"remote",label:"Platform Storage",content:e.jsx("div",{className:"space-y-4",children:f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(se,{variant:"ghost",onClick:()=>{E&&E!=="/"?w():k(null)},leftIcon:e.jsx(X,{icon:R.ArrowLeft,size:"xs"}),children:E?"Back":"Back to Mounts"}),e.jsx("div",{className:"flex items-center gap-1 text-xs text-text-muted overflow-hidden bg-surface-hover px-2 py-1 rounded",children:e.jsx("span",{className:"truncate",children:E})}),e.jsx("div",{className:"flex-grow min-w-40",children:e.jsx(pe,{placeholder:"Search...",value:B,onChange:y=>K(y.target.value),startIcon:e.jsx(R.Search,{size:14}),fullWidth:!0})}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(se,{variant:"outline",onClick:()=>J(!0),leftIcon:e.jsx(X,{icon:R.FolderPlus,size:"xs"}),children:"New Folder"}),e.jsx(se,{variant:"primary",onClick:()=>C.current?.click(),leftIcon:e.jsx(X,{icon:R.Upload,size:"xs"}),loading:U,children:"Upload"}),e.jsx("input",{type:"file",className:"hidden",ref:C,onChange:z,accept:o})]})]}),ce&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-surface-sunk rounded-lg border border-border",children:[e.jsx(X,{icon:R.Folder,size:"sm",color:"warning"}),e.jsx(pe,{placeholder:"Folder name",value:j,onChange:y=>h(y.target.value),autoFocus:!0}),e.jsx(se,{onClick:ne,loading:U,children:"Create"}),e.jsx(se,{variant:"ghost",onClick:()=>J(!1),children:"Cancel"})]}),e.jsx("div",{className:"max-h-100 overflow-auto rounded-lg border border-border",children:e.jsx(De,{data:M,columns:G,loading:U,emptyContent:"This folder is empty",onRowClick:y=>y.type==="folder"?$(y.name):ae(y)})})]}):e.jsx("div",{className:"max-h-100 overflow-auto rounded-lg border border-border",children:e.jsx(De,{data:N,columns:I,loading:U,emptyContent:"No storage mounts configured",onRowClick:y=>k(y)})})})},{id:"local",label:"Local File",content:e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 border-2 border-dashed border-border rounded-xl bg-surface-sunk/50",children:[e.jsx("div",{className:"p-4 bg-accent-soft rounded-full mb-4",children:e.jsx(X,{icon:R.FileText,size:"xl",color:"primary"})}),e.jsx(oe,{variant:"label",size:"lg",weight:"semibold",children:"Select a file from your computer"}),e.jsxs(oe,{variant:"body",size:"sm",className:"text-text-muted mt-1 mb-6 text-center max-w-xs",children:["This file will be used directly in the form and will ",e.jsx("strong",{children:"not"})," be uploaded to platform storage."]}),e.jsxs("label",{className:"cursor-pointer",children:[e.jsx(se,{variant:"primary",size:"lg",loading:U,className:"pointer-events-none",children:"Browse Local File"}),e.jsx("input",{type:"file",className:"hidden",onChange:_,accept:o,disabled:U})]})]})})}]})})]})},As={sm:"px-3 py-1.5 text-sm",md:"px-3 py-2 text-base",lg:"px-3 py-2 text-md",full:"px-3 py-2 text-md"},Se=d.forwardRef(({label:t,helperText:s,error:r,size:n="md",fullWidth:a=!1,loading:l=!1,containerClassName:o,labelClassName:u,className:i,id:v,rows:x=4,...m},g)=>{const b=d.useId(),N=v||`textarea-${b}`,p=!!r,f=r||s?`${N}-description`:void 0;return e.jsxs("div",{className:c("flex flex-col",a&&"w-full",o),children:[t&&e.jsx("label",{htmlFor:N,className:c(Ye,p?"text-danger-fg":"text-text-muted",u),children:t}),e.jsxs("div",{className:"relative",children:[e.jsx("textarea",{ref:g,id:N,rows:x,"aria-invalid":p||void 0,"aria-describedby":f,className:c(Je,"resize-y leading-relaxed",As[n],Xe(p),i),...m}),l&&e.jsx("span",{"aria-hidden":!0,className:"absolute top-2 right-3 size-icon-md animate-spin rounded-full border-2 border-border border-t-transparent"})]}),(r||s)&&e.jsx("p",{id:f,className:c("mt-1 text-xs",p?"text-danger-fg":"text-text-subtle"),children:r||s})]})});Se.displayName="TextArea";const _s=new Set(["name","given-name","family-name","additional-name","nickname","honorific-prefix","honorific-suffix","email","username","organization","organization-title","tel","tel-country-code","tel-national","tel-extension","url","photo","language","bday","sex","street-address","address-line1","address-line2","address-line3","address-level1","address-level2","country","country-name","postal-code","current-password","new-password","one-time-code"]);function Ae(t){return t&&_s.has(t)?{autoComplete:t}:{autoComplete:"off","data-1p-ignore":"true","data-lpignore":"true","data-bwignore":"true","data-form-type":"other"}}function qe(t,s){return s.split(".").reduce((r,n)=>r&&typeof r=="object"&&n in r?r[n]:void 0,t)}function $s(t,s,r){const n=s.split("."),a=Array.isArray(t)?[...t]:{...t};let l=a;for(let o=0;o<n.length-1;o++){const u=n[o],i=l[u];l[u]=i&&typeof i=="object"?Array.isArray(i)?[...i]:{...i}:{},l=l[u]}return l[n[n.length-1]]=r,a}function Ls(t,s){const r=s.split("."),n=Array.isArray(t)?[...t]:{...t};let a=n;for(let l=0;l<r.length-1;l++){const o=r[l];if(!a[o]||typeof a[o]!="object")return n;a[o]=Array.isArray(a[o])?[...a[o]]:{...a[o]},a=a[o]}return delete a[r[r.length-1]],n}function nt({title:t,description:s,className:r,children:n}){return!t&&!s?e.jsx("div",{children:n}):e.jsxs("div",{className:c("flex flex-col gap-4 py-6 sm:flex-row sm:gap-8",r),children:[e.jsxs("div",{className:"w-full shrink-0 sm:w-form-label",children:[t&&e.jsx("span",{className:"text-base font-semibold text-text",children:t}),s&&e.jsx("p",{className:"mt-1 text-sm leading-relaxed text-pretty text-text-subtle",children:s})]}),e.jsx("div",{className:"min-w-0 flex-1",children:n})]})}const Ps=({groups:t,data:s,onSubmit:r,onCancel:n,onChange:a,transform:l,validate:o,submitButton:u={label:"Submit",variant:"primary"},cancelButton:i={label:"Cancel",variant:"outline"},showButtons:v=!0,layout:x="vertical",size:m="md",loading:g=!1,className:b,ref:N,sdk:p})=>{const[f,k]=d.useState(s||{}),E=d.useId(),P=d.useCallback(h=>`${E}-${String(h).replace(/\./g,"-")}`,[E]),[D,W]=d.useState({}),[U,F]=d.useState({});d.useEffect(()=>{s&&k({...s})},[s]);const B=d.useCallback((h,C,A)=>{const S=t.flatMap(_=>_.items).find(_=>_.name===h);if(!S)return null;if(S.required&&(C==null||C===""))return`${S.label} is required`;if(S.type==="array"){if(S.required&&(!C||C.length===0))return`${S.label} cannot be empty.`;if(C&&!Array.isArray(C))return`${S.label} must be an array.`;if(Array.isArray(C)&&S.arrayFields){const _=[];let z=!1;if(C.forEach((ne,ae)=>{const q={};for(const H of S.arrayFields){const $=ne?.[H.name];if(H.required&&($==null||$===""))q[H.name]=`${H.label} is required`,z=!0;else if(H.validator){const w=H.validator($,ne);w&&(q[H.name]=w,z=!0)}}_[ae]=q}),z)return JSON.stringify(_)}}return S.validator?S.validator(C,A):null},[t]),K=d.useCallback((h,C)=>{let A=$s(f,h,C);t.flatMap(z=>z.items).find(z=>z.name===h)?.removeIfEmpty&&(C==null||C==="")&&(A=Ls(A,h)),k(A),F(z=>({...z,[h]:!0}));const _=B(h,C,A);W(z=>({...z,[h]:_||""})),a?.(A,h)},[f,t,B,a]),Z=d.useCallback(async h=>{if(h.preventDefault(),g)return;const C={},A=t.flatMap(_=>_.items);for(const _ of A){if(_.hidden||_.conditional&&!_.conditional(f))continue;const z=B(_.name,qe(f,_.name),f);z&&(C[_.name]=z)}if(o){const _=o(f);_&&Object.assign(C,_)}if(W(C),Object.keys(C).some(_=>C[_]))return;const S=l?l(f):f;await r?.(f,S)},[f,t,B,o,l,r,g]),Y=d.useCallback(h=>{const C=qe(f,h.name),A=U[h.name]?D[h.name]:void 0,S=h.disabled||g,_={id:P(h.name),value:C||"",disabled:S,required:h.required,placeholder:h.placeholder,...h.fieldProps};switch(h.type){case"text":case"email":case"password":case"number":case"tel":case"url":case"color":return e.jsx(pe,{..._,onChange:z=>K(h.name,z.target.value),type:h.textType||h.type,...Ae(h.autocomplete),error:A,size:m});case"textarea":return e.jsx(Se,{..._,onChange:z=>K(h.name,z.target.value),rows:h.rows??4,error:A,size:m});case"select":return e.jsx(ye,{..._,onChange:z=>K(h.name,z),options:(h.options||[]).map(z=>({...z,value:String(z.value)})),searchable:h.searchable,multiple:h.multiple,allowCreate:h.allowCreate,error:A,size:m});case"segmented":return e.jsx(Ge,{"aria-label":h.label,value:C==null?"":String(C),onChange:z=>K(h.name,z),options:(h.options||[]).map(z=>({value:String(z.value),label:z.label})),size:m==="sm"?"sm":"md",className:h.disabled?"pointer-events-none opacity-50":void 0});case"checkbox":return e.jsx(he,{..._,label:h.label,checked:!!C,onChange:z=>K(h.name,z.target.checked),size:m});case"radio":return e.jsx("div",{className:"flex flex-col gap-2",children:h.options?.map(z=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-3 text-base text-text",children:[e.jsx("input",{type:"radio",name:h.name,value:z.value,checked:C===z.value,onChange:()=>K(h.name,z.value),disabled:S||z.disabled,className:"size-checkbox shrink-0 rounded-xs border border-border-strong bg-surface-input accent-accent focus-visible:outline-none focus-visible:focus-ring"}),z.label]},z.value))});case"date":return e.jsx(Ce,{..._,value:C?new Date(C):null,onChange:z=>K(h.name,z),size:m});case"file":return e.jsx(rt,{..._,value:C,onChange:z=>K(h.name,z),error:A,onListFiles:z=>p?.http.invoke({method:"POST",action:"storage.file.list",body:z}),onListMounts:()=>p?.http.invoke({method:"GET",action:"storage.mount"}),onUploadFile:z=>p?.http.invoke({method:"POST",action:"storage.file.upload",body:z}),onDownloadFile:z=>p?.http.invoke({method:"GET",action:`storage.file.${z}.download`}),onRegisterFile:z=>p?.http.invoke({method:"POST",action:"storage.file.folder",body:z})});case"folder":return e.jsx(Ze,{value:C||{},onChange:z=>K(h.name,z),onListFolders:()=>p?.http.invoke({method:"GET",action:"storage.mount"}),disabled:S,size:m,placeholder:h.placeholder});case"custom":return h.customComponent?.({value:C,onChange:z=>K(h.name,z),error:A,disabled:S});case"array":{const z=C||[];let ne=[];if(typeof A=="string"&&A.startsWith("["))try{ne=JSON.parse(A)}catch{}const ae=()=>{K(h.name,[...z,{}])},q=$=>{K(h.name,z.filter((w,M)=>M!==$))},H=($,w,M)=>{const G=[...z];G[$]={...G[$],[w]:M},K(h.name,G)};return e.jsxs("div",{className:"flex flex-col gap-2",children:[z.map(($,w)=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"grid flex-1 gap-2 sm:grid-cols-2",children:h.arrayFields?.map(M=>{const G=ne?.[w]?.[M.name];return e.jsxs("div",{className:"flex flex-col gap-1",children:[w===0&&e.jsxs("label",{className:"block text-xs font-semibold uppercase tracking-label text-text-subtle",children:[M.label,M.required&&e.jsx("span",{className:"ml-1 text-danger-fg",children:"*"})]}),(()=>{const I={value:$?.[M.name]||"",disabled:S,required:M.required,placeholder:M.placeholder,...M.fieldProps};switch(M.type){case"text":case"email":case"password":case"number":case"tel":case"url":return e.jsx(pe,{...I,onChange:y=>H(w,M.name,y.target.value),type:M.textType||M.type,...Ae(M.autocomplete),error:G,size:m});case"textarea":return e.jsx(Se,{...I,onChange:y=>H(w,M.name,y.target.value),rows:M.rows??4,error:G,size:m});case"select":return e.jsx(ye,{...I,onChange:y=>H(w,M.name,y),options:(M.options||[]).map(y=>({...y,value:String(y.value)})),searchable:M.searchable,multiple:M.multiple,allowCreate:M.allowCreate,error:G,size:m});case"checkbox":return e.jsx(he,{...I,checked:!!$?.[M.name],onChange:y=>H(w,M.name,y.target.checked),size:m});case"radio":return e.jsx("div",{className:"flex flex-col gap-2",children:M.options?.map(y=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-base text-text",children:[e.jsx("input",{type:"radio",name:`${h.name}.${w}.${M.name}`,value:y.value,checked:$?.[M.name]===y.value,onChange:()=>H(w,M.name,y.value),disabled:S||y.disabled,className:"size-checkbox shrink-0 rounded-xs border border-border-strong bg-surface-input accent-accent focus-visible:outline-none focus-visible:focus-ring"}),y.label]},y.value))});case"date":{const y=$?.[M.name];return e.jsx(Ce,{...I,value:y?new Date(y):null,onChange:L=>H(w,M.name,L),size:m})}case"custom":return M.customComponent?.({value:$?.[M.name],onChange:y=>H(w,M.name,y),error:G,disabled:S});default:return e.jsxs("p",{children:["Unsupported field type in array:"," ",M.type]})}})(),G&&e.jsx("p",{className:"text-xs text-danger-fg",children:G})]},M.name)})}),e.jsx(se,{type:"button",iconOnly:!0,variant:"ghost",size:"md","aria-label":`${h.label} verwijderen`,onClick:()=>q(w),disabled:S,className:c("shrink-0",w===0&&"mt-5"),children:e.jsx(R.Trash2,{className:"size-icon-md"})})]},w)),e.jsxs(se,{type:"button",variant:"secondary",leftIcon:e.jsx(R.Plus,{className:"size-icon-sm"}),onClick:ae,disabled:S,children:[h.label," toevoegen"]})]})}default:return null}},[f,U,D,g,m,K]),ce=d.useCallback(h=>{if(h.conditional&&!h.conditional(f))return null;const C=h.items.filter(S=>!(S.hidden||S.conditional&&!S.conditional(f)));if(C.length===0)return null;const A=c(h.layout==="flex"?"flex flex-wrap gap-3.5":"grid gap-3.5",h.layout!=="flex"&&{"grid-cols-1":!h.columns||h.columns===1,"grid-cols-2":h.columns===2,"grid-cols-3":h.columns===3,"grid-cols-4":h.columns===4},h.className);return e.jsx(nt,{title:h.title,description:h.description,className:"not-last:border-b not-last:border-border-subtle",children:e.jsx("div",{children:e.jsx("div",{className:A,children:C.map(S=>{const _=U[S.name]?D[S.name]:void 0;return e.jsxs("div",{className:c("flex min-w-0 flex-col gap-1.5",S.type==="checkbox"&&"justify-center"),style:{width:typeof S.width=="string"?S.width:void 0,gridColumn:typeof S.width=="number"?`span ${S.width} / span ${S.width}`:void 0},children:[S.type!=="custom"&&S.type!=="checkbox"&&e.jsxs("label",{htmlFor:P(S.name),className:"block text-sm font-medium text-text-muted",children:[S.label,S.required&&e.jsx("span",{className:"ml-1 text-danger-fg",children:"*"})]}),Y(S),S.help&&!_&&e.jsx("p",{className:"text-xs leading-4 text-text-subtle",children:S.help})]},S.name)})})})},h.id)},[f,U,D,Y]),J=c({"max-w-settings":m==="sm","max-w-form":m==="md","max-w-6xl":m==="lg","max-w-full":m==="full"},b),j=m==="full"?"md":m;return e.jsxs("form",{ref:N,onSubmit:Z,className:J,children:[!v&&e.jsx("button",{type:"submit",className:"hidden",tabIndex:-1,"aria-hidden":!0}),e.jsx("div",{className:"flex flex-col",children:t.map(ce)}),v&&e.jsx("div",{className:"flex items-center gap-2 border-t border-border-subtle py-4",children:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ml-auto"}),n&&e.jsx(se,{type:"button",variant:i.variant??"ghost",size:i.size||j,disabled:i.disabled||g,onClick:n,className:i.className,children:i.label}),e.jsx(se,{type:"submit",variant:u.variant,size:u.size||j,disabled:u.disabled||g,loading:g,className:u.className,children:u.label})]})})]})};function Rs({open:t,title:s,description:r,confirmLabel:n="Bevestigen",cancelLabel:a="Annuleren",tone:l="default",loading:o=!1,onConfirm:u,onCancel:i}){return e.jsx(Ie,{open:t,onClose:i,title:s,size:"sm",footer:e.jsxs("div",{className:"flex w-full items-center justify-end gap-2",children:[e.jsx(se,{variant:"ghost",onClick:i,disabled:o,children:a}),e.jsx(se,{variant:l==="danger"?"destructive":"primary",onClick:u,loading:o,children:n})]}),children:r&&e.jsx(oe,{color:"secondary",children:r})})}const Is={default:"bg-surface-hover text-text",primary:"bg-accent-soft text-accent",secondary:"bg-surface-hover text-text-muted",success:"bg-success-soft text-success-fg",warning:"bg-warning-soft text-warning-fg",error:"bg-danger-soft text-danger-fg",info:"bg-info-soft text-info-fg",note:"bg-note-soft text-note"},Fs={sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-sm",lg:"px-3 py-1.5 text-base"},Os={default:"bg-surface-hover",primary:"bg-accent",secondary:"bg-surface-hover",success:"bg-success",warning:"bg-warning",error:"bg-danger",info:"bg-info",note:"bg-note"};function at({variant:t="default",size:s="md",dot:r=!1,icon:n,dismissible:a=!1,onDismiss:l,className:o,children:u,...i}){return e.jsxs("span",{className:c("inline-flex items-center font-medium rounded-full",Is[t],Fs[s],o),...i,children:[r&&e.jsx("span",{className:c("w-2 h-2 rounded-full mr-1.5",Os[t])}),n&&e.jsx("span",{className:c("flex-shrink-0",u&&"mr-1"),children:n}),u,a&&l&&e.jsx("button",{onClick:l,className:"ml-1.5 flex-shrink-0 hover:opacity-70 transition-opacity","aria-label":"Remove badge",children:e.jsx(X,{icon:R.X,size:"xs",color:"current"})})]})}const ie=({className:t})=>e.jsx("span",{className:c("block rounded-xs bg-surface-hover",t)});function Bs({shape:t,rows:s,columns:r}){switch(t){case"table":return e.jsxs("div",{className:"overflow-hidden rounded-lg ring-1 ring-border",children:[e.jsx("div",{className:"grid gap-2 bg-surface-hover p-3",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:Array.from({length:r}).map((n,a)=>e.jsx(ie,{className:"h-4 w-2/3 bg-border-strong"},`h-${a}`))}),Array.from({length:s}).map((n,a)=>e.jsx("div",{className:"grid gap-2 border-t border-border-subtle p-3",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:Array.from({length:r}).map((l,o)=>e.jsx(ie,{className:"h-4 w-full"},`c-${a}-${o}`))},`r-${a}`))]});case"list":return e.jsx("div",{className:"flex flex-col divide-y divide-border-subtle rounded-lg ring-1 ring-border",children:Array.from({length:s}).map((n,a)=>e.jsxs("div",{className:"flex items-center gap-3 p-3",children:[e.jsx(ie,{className:"size-avatar-sm shrink-0 rounded-full"}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[e.jsx(ie,{className:"h-3"}),e.jsx(ie,{className:"h-2.5 opacity-70"})]})]},a))});case"form":return e.jsx("div",{className:"flex flex-col gap-5",children:Array.from({length:s}).map((n,a)=>e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(ie,{className:"h-2.5 w-28"}),e.jsx(ie,{className:"h-control-md w-full rounded-md"})]},a))});case"menu":return e.jsxs("div",{className:"flex flex-col gap-px",children:[e.jsx("div",{className:"px-2.5 pb-2 pt-5",children:e.jsx(ie,{className:"h-2 w-16"})}),Array.from({length:s}).map((n,a)=>e.jsxs("div",{className:"flex h-row-md items-center gap-2.5 px-2.5",children:[e.jsx(ie,{className:"size-4 shrink-0"}),e.jsx(ie,{className:"h-2"})]},a))]});case"cards":return e.jsx("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:Array.from({length:s*r}).map((n,a)=>e.jsxs("div",{className:"flex flex-col gap-2 rounded-lg p-4 ring-1 ring-border",children:[e.jsx(ie,{className:"h-3 w-1/2"}),e.jsx(ie,{className:"h-2.5"}),e.jsx(ie,{className:"h-2.5 w-3/4 opacity-70"})]},a))});case"text":default:return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(ie,{className:"h-6 w-1/4"}),e.jsx("div",{className:"flex flex-col gap-2",children:Array.from({length:s}).map((n,a)=>e.jsx(ie,{className:"h-4"},a))})]})}}const Hs={text:2,table:8,list:6,form:5,menu:4,cards:2};function Ee({variant:t="page",shape:s,rows:r,columns:n,children:a,className:l,showTableSkeleton:o=!1,tableColumns:u,tableRows:i}){const v=s??(o?"table":"text"),x=r??i??Hs[v],m=n??u??(v==="cards"?3:6),g=e.jsx("div",{className:c("w-full animate-pulse",l),"aria-hidden":!0,children:a??e.jsx(Bs,{shape:v,rows:x,columns:m})});return t==="inline"?g:e.jsx("main",{className:"flex-1 bg-surface p-6",children:g})}const qs={neutral:"bg-surface-hover text-text-muted",success:"bg-success-soft text-success-fg"};function Vs({icon:t,tone:s="neutral",title:r,description:n,actions:a,card:l=!1,className:o,...u}){return e.jsxs("div",{className:c("flex flex-col items-center gap-2.5 text-center",l&&"rounded-lg border border-border bg-surface px-11 py-9 shadow-overlay",o),...u,children:[t!=null&&e.jsx("span",{className:c("flex size-disc items-center justify-center rounded-full text-2xl",qs[s]),children:t}),e.jsx("div",{className:"text-lg font-semibold text-text",children:r}),n&&e.jsx("div",{className:"max-w-sm text-sm leading-relaxed text-text-muted",children:n}),a&&e.jsx("div",{className:"flex gap-2 pt-1.5",children:a})]})}function Us({children:t,className:s,...r}){return e.jsx("kbd",{className:c("inline-flex items-center rounded border border-border px-1.5 py-px text-xs font-medium leading-none text-text-muted",s),...r,children:t})}const Ks={sm:"h-1",md:"h-1.5"},Ws={accent:"bg-accent",success:"bg-success"};function Gs({value:t,variant:s="accent",size:r="md",className:n,...a}){const l=Math.max(0,Math.min(100,t));return e.jsx("div",{role:"progressbar","aria-valuenow":Math.round(l),"aria-valuemin":0,"aria-valuemax":100,className:c("w-full overflow-hidden rounded-full bg-surface-hover",Ks[r],n),...a,children:e.jsx("div",{className:c("h-full rounded-full transition-[width] duration-300 ease-out",Ws[s]),style:{width:`${l}%`}})})}const Ys={xs:"h-3 w-3",sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8",xl:"h-12 w-12"},Js={primary:"text-accent",secondary:"text-text-muted",white:"text-white",current:"text-current"},Xs={xs:"text-xs",sm:"text-sm",md:"text-sm",lg:"text-base",xl:"text-lg"};function Zs({size:t="md",variant:s="primary",label:r="Loading...",showLabel:n=!1,className:a,...l}){return e.jsxs("div",{className:c("inline-flex items-center",n?"flex-col space-y-2":"",a),...l,children:[e.jsxs("svg",{className:c("animate-spin",Ys[t],Js[s]),fill:"none",viewBox:"0 0 24 24","aria-hidden":!n,role:n?"status":void 0,children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),n&&e.jsx("span",{className:c("text-text-muted",Xs[t]),children:r}),!n&&e.jsx("span",{className:"sr-only",children:r})]})}const Qs={neutral:"bg-text-disabled",accent:"bg-accent",success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",note:"bg-note","cat-1":"bg-cat-1","cat-2":"bg-cat-2","cat-3":"bg-cat-3","cat-4":"bg-cat-4","cat-5":"bg-cat-5"};function er({tone:t="neutral",shape:s="round",pulse:r=!1,label:n,className:a}){return e.jsx("span",{role:n?"img":void 0,"aria-label":n,"aria-hidden":n?void 0:!0,className:c("inline-block size-dot shrink-0",s==="round"?"rounded-full":"rounded-sm",Qs[t],r&&"animate-pulse",a)})}function tr({steps:t,current:s,variant:r="numbered",label:n,className:a}){const l=t.indexOf(s),o={role:n?"group":void 0,"aria-label":n,"aria-hidden":n?void 0:!0};return r==="dots"?e.jsx("div",{...o,className:c("flex items-center gap-1.5",a),children:t.map((u,i)=>e.jsx("span",{className:c("h-step-bar rounded-full transition-all duration-fast ease-out",i===l?"w-5 bg-accent":"w-3.5",i<l&&"bg-border-strong",i>l&&"bg-border")},u))}):e.jsx("div",{...o,className:c("flex items-center gap-2",a),children:t.map((u,i)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{"aria-current":i===l?"step":void 0,className:c("flex size-tile-sm items-center justify-center rounded-full text-xs font-medium",i===l&&"bg-accent text-accent-fg",i<l&&"bg-accent-soft text-accent",i>l&&"bg-surface-hover text-text-muted"),children:i+1}),i<t.length-1&&e.jsx("span",{className:"h-px w-8 bg-border-strong"})]},u))})}const sr=/<[a-z][\s\S]*>/i,rr=["[&_p]:my-1.5 [&_p:first-child]:mt-0 [&_p:last-child]:mb-0 [&_p]:leading-relaxed","[&_a]:text-accent [&_a]:underline [&_a]:underline-offset-2","[&_strong]:font-semibold [&_em]:italic","[&_ul]:my-1.5 [&_ul]:list-disc [&_ul]:pl-5 [&_ol]:my-1.5 [&_ol]:list-decimal [&_ol]:pl-5","[&_li]:leading-relaxed","[&_h1]:mb-1 [&_h1]:mt-2 [&_h1]:font-semibold [&_h2]:mb-1 [&_h2]:mt-2 [&_h2]:font-semibold [&_h3]:mb-1 [&_h3]:mt-2 [&_h3]:font-semibold","[&_blockquote]:my-1.5 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-text-muted","[&_hr]:my-2 [&_hr]:border-border","[&_pre]:my-1.5 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-surface-sunk [&_pre]:p-2 [&_pre]:text-xs","[&_code]:rounded-sm [&_code]:bg-surface-sunk [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-xs","[&_pre_code]:bg-transparent [&_pre_code]:p-0","[&_table]:my-1.5 [&_table]:w-full [&_table]:border-collapse [&_table]:text-xs","[&_th]:border [&_th]:border-border [&_th]:px-2 [&_th]:py-1 [&_th]:text-left [&_th]:font-semibold","[&_td]:border [&_td]:border-border [&_td]:px-2 [&_td]:py-1"].join(" "),nr={p:t=>e.jsx("p",{className:"my-1.5 leading-relaxed first:mt-0 last:mb-0",...t}),a:t=>e.jsx("a",{className:"text-accent underline underline-offset-2 hover:opacity-80",target:"_blank",rel:"noopener noreferrer",...t}),strong:t=>e.jsx("strong",{className:"font-semibold",...t}),em:t=>e.jsx("em",{className:"italic",...t}),ul:t=>e.jsx("ul",{className:"my-1.5 list-disc space-y-0.5 pl-5",...t}),ol:t=>e.jsx("ol",{className:"my-1.5 list-decimal space-y-0.5 pl-5",...t}),li:t=>e.jsx("li",{className:"leading-relaxed",...t}),h1:t=>e.jsx("h1",{className:"mb-1 mt-2 text-md font-semibold first:mt-0",...t}),h2:t=>e.jsx("h2",{className:"mb-1 mt-2 text-base font-semibold first:mt-0",...t}),h3:t=>e.jsx("h3",{className:"mb-1 mt-2 text-base font-semibold first:mt-0",...t}),blockquote:t=>e.jsx("blockquote",{className:"my-1.5 border-l-2 border-border pl-3 text-text-muted",...t}),hr:t=>e.jsx("hr",{className:"my-2 border-border",...t}),pre:t=>e.jsx("pre",{className:"my-1.5 overflow-x-auto rounded-md bg-surface-sunk p-2 text-xs",...t}),code:({className:t,children:s,...r})=>{const n=String(s??"");return/language-/.test(t??"")||n.includes(`
2
+ `)?e.jsx("code",{className:"font-mono text-xs",...r,children:s}):e.jsx("code",{className:"rounded-sm bg-surface-sunk px-1 py-0.5 font-mono text-xs",...r,children:s})},table:t=>e.jsx("div",{className:"my-1.5 overflow-x-auto",children:e.jsx("table",{className:"w-full border-collapse text-xs",...t})}),th:t=>e.jsx("th",{className:"border border-border px-2 py-1 text-left font-semibold",...t}),td:t=>e.jsx("td",{className:"border border-border px-2 py-1",...t})};function ve({text:t,className:s,as:r}){const n=t??"";return(r?r==="html":sr.test(n))?e.jsx("div",{className:c("break-words",rr,s),dangerouslySetInnerHTML:{__html:bt.sanitize(n,{ADD_ATTR:["target","rel"]})}}):e.jsx("div",{className:c("break-words",s),children:e.jsx(pt,{remarkPlugins:[vt],components:nr,children:n})})}const ar={info:"text-info-fg",success:"text-success-fg",warning:"text-warning-fg",destructive:"text-danger-fg"},lr={info:"bg-info-soft border-info-border",success:"bg-success-soft border-success-border",warning:"bg-warning-soft border-warning-border",destructive:"bg-danger-soft border-danger-border"},or={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4"};function cr({block:t}){switch(t.type){case"heading":return t.level===1?e.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-text",children:t.text}):t.level===2?e.jsx("h2",{className:"pt-2 text-base font-semibold tracking-tight text-text",children:t.text}):e.jsx("h3",{className:"pt-1 text-sm font-semibold text-text",children:t.text});case"paragraph":return e.jsx(ve,{as:"markdown",text:t.text,className:"text-sm text-text"});case"quote":return e.jsx("blockquote",{className:"border-l-2 border-border pl-3.5",children:e.jsx(ve,{as:"markdown",text:t.text,className:"text-sm text-text-muted"})});case"code":return e.jsx("pre",{className:"overflow-x-auto rounded-lg bg-surface-sunk p-3 text-xs",children:e.jsx("code",{className:"font-mono",children:t.text})});case"divider":return e.jsx("hr",{className:"border-border-subtle"});case"list":{const s=t.style==="numbered"?"ol":"ul";return e.jsx(s,{className:c("flex flex-col gap-2 pl-5 text-sm text-text",t.style==="numbered"?"list-decimal":"list-disc"),children:t.items.map((r,n)=>e.jsxs("li",{className:"leading-relaxed marker:text-text-subtle",children:[r.lead&&e.jsxs("strong",{className:"font-semibold",children:[r.lead," "]}),e.jsx(ve,{as:"markdown",text:r.text,className:"inline"})]},n))})}case"table":return e.jsxs("figure",{className:"m-0",children:[e.jsx("div",{className:"overflow-x-auto rounded-lg ring-1 ring-border",children:e.jsxs("table",{className:"w-full border-collapse text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{className:"bg-surface-sunk",children:t.columns.map((s,r)=>e.jsx("th",{className:c("px-4 py-2.5 text-xs font-semibold text-text-muted",s.align==="right"?"text-right":"text-left"),children:s.label},r))})}),e.jsx("tbody",{children:t.rows.map((s,r)=>e.jsx("tr",{className:"border-t border-border-subtle",children:s.map((n,a)=>e.jsx("td",{className:c("px-4 py-2.5 tabular-nums text-text",t.columns[a]?.align==="right"?"text-right":"text-left"),children:n},a))},r))})]})}),t.caption&&e.jsx("figcaption",{className:"pt-2 text-xs italic text-text-subtle",children:t.caption})]});case"kpi":return e.jsx("div",{className:c("grid gap-3",or[t.items.length]??"grid-cols-4"),children:t.items.map((s,r)=>e.jsxs("div",{className:"rounded-lg bg-surface-sunk px-4 py-3.5",children:[e.jsx("div",{className:c("text-2xl font-semibold tracking-tight",s.tone?ar[s.tone]:"text-text"),children:s.value}),e.jsx("div",{className:"pt-0.5 text-xs text-text-muted",children:s.label})]},r))});case"callout":return e.jsxs("div",{className:c("rounded-lg border px-4 py-3",lr[t.tone]),children:[t.title&&e.jsx("div",{className:"pb-0.5 text-sm font-semibold text-text",children:t.title}),e.jsx(ve,{as:"markdown",text:t.text,className:"text-sm text-text"})]});default:return null}}function ir({blocks:t,runtime:s="inert",className:r}){return s!=="inert"?e.jsxs("div",{className:c("rounded-lg border border-warning-border bg-warning-soft px-4 py-3",r),children:[e.jsx("div",{className:"text-sm font-semibold text-text",children:"Deze versie kan hier niet getoond worden"}),e.jsxs("div",{className:"pt-0.5 text-xs text-text-muted",children:["Hij is opgeslagen als ",e.jsx("code",{className:"font-mono",children:s}),", en deze weergave tekent alleen inerte inhoud."]})]}):e.jsx("article",{className:c("flex flex-col gap-4",r),children:t.map((n,a)=>e.jsx(cr,{block:n},n.block_id??a))})}function dr({title:t,icon:s=e.jsx(R.Sparkles,{className:"size-icon-md","aria-hidden":!0}),action:r,children:n,className:a,...l}){return e.jsxs("div",{className:c("flex flex-col gap-2 rounded-xl border p-4","border-assistant-border bg-assistant-soft",a),...l,children:[e.jsxs("div",{className:"flex items-center gap-2 text-assistant",children:[e.jsx("span",{"aria-hidden":!0,children:s}),e.jsx("span",{className:"text-sm font-semibold",children:t}),r&&e.jsx("span",{className:"ml-auto",children:r})]}),n&&e.jsx("div",{className:"text-sm leading-relaxed text-text",children:n})]})}const ur={default:"bg-avatar text-avatar-fg",in:"bg-avatar-in text-avatar-in-fg",out:"bg-accent text-accent-fg",note:"bg-avatar-note text-avatar-note-fg"},xr={xs:"w-5 h-5 text-xs",sm:"w-6 h-6 text-xs",md:"w-7 h-7 text-base",lg:"w-9 h-9 text-sm"};function mr(t){if(!t)return"?";const s=t.trim().split(/[^\p{L}\p{N}]+/u).filter(Boolean);return s.length>=2?(s[0][0]+s[1][0]).toUpperCase():s.length===1?s[0].slice(0,2).toUpperCase():"?"}const lt=({name:t,src:s,tone:r="default",size:n="sm",className:a,title:l})=>{const[o,u]=d.useState(!1),i=c("inline-flex items-center justify-center rounded-full overflow-hidden shrink-0 font-semibold select-none",r==="identity"?$e(t):ur[r],xr[n],a);return s&&!o?e.jsx("img",{src:s,alt:t??"",title:l??t,className:c(i,"object-cover"),onError:()=>u(!0)}):e.jsx("span",{className:i,title:l??t,"aria-label":t,children:mr(t)})},Ve="ring-surface",fr="ring-surface-accent",hr=({people:t,max:s=4,size:r="sm",className:n})=>{if(t.length===0)return null;const a=t.slice(0,s),l=t.length-a.length;return e.jsxs("span",{className:c("inline-flex items-center",n),children:[a.map((o,u)=>e.jsx(lt,{name:o.name,src:o.src,size:r,title:o.name?o.seen===!1?`${o.name} — nog niet gelezen`:o.name:void 0,className:c(u>0&&"-ml-2",o.owner?fr:Ve,o.seen===!1&&"opacity-40")},o.id??`${o.name}-${u}`)),l>0&&e.jsxs("span",{className:c("inline-flex items-center justify-center rounded-full shrink-0 -ml-2 font-semibold bg-avatar text-avatar-fg",r==="xs"?"w-5 h-5 text-xs":r==="md"?"w-7 h-7 text-xs":r==="lg"?"w-9 h-9 text-xs":"w-6 h-6 text-xs",Ve),children:["+",l]})]})},ke={mail:{fg:"text-channel-mail-fg",bg:"bg-channel-mail-soft"},wa:{fg:"text-channel-whatsapp-fg",bg:"bg-channel-whatsapp-soft"},chat:{fg:"text-channel-chat-fg",bg:"bg-channel-chat-soft"},tel:{fg:"text-channel-phone-fg",bg:"bg-channel-phone-soft"},note:{fg:"text-channel-note-fg",bg:"bg-channel-note-soft"}},gr={sm:"size-avatar-xs rounded-sm text-xs",md:"size-avatar-sm rounded-md text-xs",lg:"size-avatar-lg rounded-md text-base"};function br({channel:t,children:s,size:r="md",className:n,title:a}){const l=t in ke?ke[t]:void 0;return e.jsx("span",{title:a,className:c("inline-flex shrink-0 items-center justify-center font-bold",gr[r],l?c(l.fg,l.bg):t?$e(t):c(ke.note.fg,ke.note.bg),n),children:s})}const pr=({src:t,alt:s,size:r="md",aspectRatio:n="auto",radius:a="md",showLoading:l=!0,showError:o=!0,fallback:u,loadingContent:i,errorContent:v,className:x,onLoad:m,onError:g,...b})=>{const[N,p]=d.useState(!0),[f,k]=d.useState(!1),[E,P]=d.useState(t),D=Y=>{p(!1),k(!1),m?.(Y)},W=Y=>{if(p(!1),k(!0),u&&E!==u){P(u),k(!1),p(!0);return}g?.(Y)},U=c("relative overflow-hidden bg-surface-hover",{"w-8 h-8":r==="xs","w-12 h-12":r==="sm","w-16 h-16":r==="md","w-24 h-24":r==="lg","w-32 h-32":r==="xl","w-full h-full":r==="full"},{"aspect-square":n==="square","aspect-video":n==="video","aspect-portrait":n==="portrait","aspect-landscape":n==="landscape"},{"rounded-none":a==="none","rounded-sm":a==="sm","rounded-md":a==="md","rounded-lg":a==="lg","rounded-xl":a==="xl","rounded-full":a==="full"},x),F=c("w-full h-full object-cover transition-opacity duration-fast",{"opacity-0":N||f,"opacity-100":!N&&!f}),B=c("absolute inset-0 flex items-center justify-center","text-text-muted"),K=e.jsx("div",{className:"animate-pulse",children:e.jsx("div",{className:"w-6 h-6 bg-surface-hover rounded"})}),Z=e.jsxs("div",{className:"text-center",children:[e.jsx(X,{icon:R.ImageOff,size:"lg",className:"mx-auto mb-1"}),e.jsx("span",{className:"text-xs",children:"Failed to load"})]});return e.jsxs("div",{className:U,children:[e.jsx("img",{...b,src:E,alt:s,className:F,onLoad:D,onError:W}),N&&l&&e.jsx("div",{className:B,children:i||K}),f&&o&&e.jsx("div",{className:B,children:v||Z})]})};function vr({icon:t,onClick:s,children:r}){return e.jsxs("button",{type:"button",onClick:s,className:c("inline-flex h-control-sm shrink-0 cursor-pointer items-center gap-1.5 rounded-md px-2.5","text-sm font-medium whitespace-nowrap","transition-colors duration-fast ease-out hover:bg-white/15","focus-visible:outline-none focus-visible:focus-ring"),children:[t,r]})}function jr({items:t,getRowKey:s,variant:r="divided",leading:n,renderItem:a,trailing:l,onSelect:o,onActiveIndexChange:u,isActive:i,unread:v,dimmed:x,groupBy:m,groups:g,renderGroupHeader:b,stickyGroupHeaders:N=!1,collapsibleGroups:p=!1,hideGroupCount:f=!1,selectable:k=!1,selectedItems:E=[],onSelectionChange:P,bulkActions:D,header:W,stickyHeader:U=!1,bordered:F=!1,emptyContent:B,loading:K=!1,loadingRows:Z=4,className:Y,"aria-label":ce}){const[J,j]=d.useState(()=>Object.fromEntries((g??[]).filter(w=>w.defaultCollapsed).map(w=>[w.id,!0]))),h=d.useRef(null),C=w=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(w.key))return;const G=Array.from(h.current?.querySelectorAll("li[data-list-row]")??[]);if(G.length===0)return;w.preventDefault();const I=G.indexOf(document.activeElement),y=w.key==="Home"?0:w.key==="End"?G.length-1:w.key==="ArrowDown"?(I+1)%G.length:(I-1+G.length)%G.length;G[y]?.focus()},A=(w,M)=>s?s(w,M):M,S=w=>E.includes(w),_=(w,M)=>{P&&P(M?[...E,w]:E.filter(G=>G!==w))},z=w=>P?.(w?[...t]:[]),ne=c("flex flex-col",k&&E.length>0&&"min-h-full",F&&"overflow-hidden rounded-lg border border-border-subtle",Y);if(K)return e.jsx("div",{className:ne,children:Array.from({length:Z}).map((w,M)=>e.jsxs("div",{className:c("flex animate-pulse items-center gap-3 px-4 py-2",r==="divided"&&M>0&&"border-t border-border-subtle"),children:[e.jsx("span",{className:"size-tile-sm shrink-0 rounded-md bg-surface-hover"}),e.jsx("span",{className:"h-3 w-30 shrink-0 rounded-sm bg-surface-hover"}),e.jsx("span",{className:"h-3 flex-1 rounded-sm bg-surface-hover"}),e.jsx("span",{className:"h-3 w-8 shrink-0 rounded-sm bg-surface-hover"})]},`skeleton-${M}`))});if(t.length===0&&B)return e.jsx("div",{className:ne,children:B});const ae=t.length>0&&E.length===t.length,q=E.length>0&&!ae,H=(w,M,G)=>{const I=i?.(w,M)??!1,y=v?.(w,M)??!1,L=x?.(w,M)??!1,ee=k&&S(w);return e.jsxs("li",{...o?{role:"button",tabIndex:0,"data-list-row":"","aria-current":I||void 0,onClick:()=>o(w,M),onFocus:()=>u?.(M),onKeyDown:re=>{re.key!=="Enter"&&re.key!==" "||(re.preventDefault(),o(w,M))}}:{},className:c("flex items-center gap-3 text-base","transition-colors duration-fast ease-out",r==="inset"?"mx-2 rounded-lg px-3 py-2.5":"px-5 py-2.5",r==="divided"&&!G&&"border-t border-border-subtle",o&&"cursor-pointer focus-visible:outline-none focus-visible:focus-ring",I||ee?"bg-accent-soft text-text":y?c("bg-surface-unread",o&&"hover:bg-surface-unread-hover"):o&&"hover:bg-surface-hover",L&&"text-text-muted"),children:[k&&e.jsx("span",{onClick:re=>re.stopPropagation(),children:e.jsx(he,{checked:S(w),onChange:re=>_(w,re.target.checked),"aria-label":"Rij selecteren"})}),r==="bulleted"&&e.jsx("span",{"aria-hidden":!0,className:"mt-2 size-1.5 shrink-0 self-start rounded-full bg-border-strong"}),n&&e.jsx("span",{className:"shrink-0",children:n(w,M)}),e.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:a?a(w,M):String(w)}),l&&e.jsx("span",{className:"shrink-0 text-xs text-text-subtle",children:l(w,M)})]},A(w,M))},$=(()=>{if(!m)return t.map((I,y)=>H(I,y,y===0));const w=new Map;t.forEach((I,y)=>{const L=m(I,y);w.has(L)||w.set(L,[]),w.get(L).push({item:I,index:y})});const M=g??[];return[...M.filter(I=>w.has(I.id)),...[...w.keys()].filter(I=>!M.some(y=>y.id===I)).map(I=>({id:I}))].flatMap((I,y)=>{const L=w.get(I.id)??[],ee=p&&J[I.id],re=I.title??I.id,xe=I.count??L.length,fe=e.jsx("li",{onClick:p?()=>j(de=>({...de,[I.id]:!de[I.id]})):void 0,className:c("flex items-center gap-2.5 bg-surface px-5 pb-1.5 text-base font-semibold",y>0?"pt-5":"pt-3",I.tone==="danger"?"text-danger-fg":I.tone==="muted"?"text-text-subtle":"text-text",N&&"sticky z-10",p&&"cursor-pointer select-none"),"aria-expanded":p?!ee:void 0,style:N?{top:U?28:0}:void 0,children:b?b(I,L.map(de=>de.item)):e.jsxs(e.Fragment,{children:[p&&e.jsx(R.ChevronRight,{"aria-hidden":!0,className:c("size-icon-md shrink-0 text-text-subtle transition-transform duration-fast ease-out",!ee&&"rotate-90")}),e.jsx("span",{children:re}),!f&&e.jsx("span",{className:c("rounded-full px-2 text-xs font-normal tabular-nums",I.tone==="danger"?"bg-danger-soft text-danger-fg":"bg-surface-sunk text-text-subtle"),children:xe})]})},`group-${I.id}`);return ee?[fe]:[fe,...L.map(({item:de,index:ue},Me)=>H(de,ue,Me===0))]})})();return e.jsxs("div",{ref:h,className:ne,onKeyDown:o?C:void 0,children:[W&&e.jsxs("div",{className:c("flex h-row-sm items-end gap-3 border-b border-border bg-surface px-5 pb-2","text-xs font-semibold uppercase tracking-wider text-text-disabled",U&&"sticky top-0 z-20"),children:[k&&e.jsx("span",{className:"flex items-center",children:e.jsx(he,{checked:ae,indeterminate:q,onChange:w=>z(w.target.checked),"aria-label":"Alles selecteren"})}),W]}),e.jsx("ul",{"aria-label":ce,className:"flex flex-col",children:$}),k&&E.length>0&&e.jsx("div",{className:"pointer-events-none sticky bottom-0 z-10 flex justify-center px-5 pb-4",children:e.jsxs("div",{className:"pointer-events-auto flex items-center gap-1.5 rounded-lg bg-accent py-1.5 pl-3.5 pr-1.5 text-accent-fg shadow-overlay",children:[e.jsxs("span",{className:"text-sm font-medium",children:[E.length," geselecteerd"]}),e.jsx("span",{"aria-hidden":!0,className:"mx-1.5 h-4 w-px bg-current opacity-25"}),D,e.jsx("span",{"aria-hidden":!0,className:"mx-1.5 h-4 w-px bg-current opacity-25"}),e.jsx("button",{type:"button",onClick:()=>P?.([]),"aria-label":"Selectie wissen",className:"grid size-tile-md shrink-0 cursor-pointer place-items-center rounded-md transition-colors duration-fast ease-out hover:bg-white/15 focus-visible:outline-none focus-visible:focus-ring",children:e.jsx(R.X,{className:"size-icon-lg"})})]})})]})}function yr({side:t,continued:s=!1,tone:r="default",className:n,children:a}){return e.jsx("div",{className:c("min-w-0 max-w-bubble md:max-w-bubble-md",t==="out"?"rounded-lg rounded-tr-sm":"rounded-lg rounded-tl-sm",r==="note"?"bg-note-soft":t==="out"?"bg-bubble-out-soft":"bg-surface-sunk",s&&"mt-1",n),children:a})}const Nr={default:"text-text",urgent:"text-danger-fg",success:"text-success-fg"};function wr({value:t,label:s,tone:r="default",className:n,...a}){return e.jsxs("div",{className:c("rounded-xl bg-editor px-4 py-3.5",n),...a,children:[e.jsx("div",{className:c("text-2xl font-semibold",Nr[r]),children:t}),e.jsx("div",{className:"pt-0.5 text-xs text-text-muted",children:s})]})}function kr({icon:t,label:s,unset:r,className:n}){return e.jsxs("span",{className:c("inline-flex min-w-0 items-center gap-1.5 border-b border-dashed pb-px transition-colors duration-fast ease-out",r?"border-border text-text-subtle hover:border-border-strong hover:text-text-muted":"border-border-strong text-text-muted hover:text-text",n),children:[t,e.jsx("span",{className:"truncate",children:s})]})}function Cr(){return e.jsx("span",{"aria-hidden":!0,className:"shrink-0 text-text-disabled",children:"·"})}const ot=({surface:t=!1,title:s,subtitle:r,meta:n,actions:a=[],children:l,className:o,backLabel:u="Back",backClassName:i,onBack:v,editable:x=!1,onTitleChange:m})=>{const[g,b]=d.useState(!1),[N,p]=d.useState(s),f=d.useRef(null);d.useEffect(()=>{p(s)},[s]),d.useEffect(()=>{g&&f.current&&(f.current.focus(),f.current.select())},[g]);const k=()=>{x&&b(!0)},E=()=>{b(!1),N.trim()!==""&&N!==s&&m?m(N.trim()):p(s)},P=D=>{D.key==="Enter"?f.current?.blur():D.key==="Escape"&&(p(s),b(!1))};return e.jsxs("div",{className:c("px-5 pt-4 pb-2.5",t&&"border-b border-border",o),children:[e.jsxs("div",{className:"flex flex-row sm:items-start sm:justify-between items-center gap-4",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsxs("div",{className:"flex items-start gap-4 text-text",children:[v&&e.jsx(se,{variant:"ghost",onClick:v,leftIcon:e.jsx(X,{icon:R.ChevronLeft,size:"md"}),iconOnly:!0}),e.jsxs("div",{className:"min-w-0 flex-1",children:[g?e.jsx("input",{ref:f,type:"text",value:N,onChange:D=>p(D.target.value),onBlur:E,onKeyDown:P,className:"text-1xl font-semibold bg-transparent border-b-1 border-border rounded-lg outline-none focus:border-none px-1 -mx-1 min-w-0 w-full"}):e.jsxs("div",{className:"group flex items-baseline gap-2.5 min-w-0",children:[e.jsx("h2",{onClick:k,className:c("text-lg font-semibold tracking-title truncate",x&&"cursor-pointer"),title:x?"Click to edit":void 0,children:s}),r&&e.jsx("span",{className:"shrink-0 text-base text-text-muted truncate",children:r}),x&&e.jsx(R.Pencil,{size:15,onClick:k,className:"shrink-0 cursor-pointer text-text-muted opacity-0 group-hover:opacity-100 transition-opacity"})]}),n&&e.jsx("div",{className:c("mt-1 min-w-0 text-sm text-text-subtle",typeof n=="string"&&"truncate"),children:n})]})]})}),a.length>0&&e.jsx("div",{className:"flex flex-wrap sm:flex-nowrap gap-2 sm:gap-3",children:a.map(D=>D.render?e.jsx(d.Fragment,{children:D.render()},D.id):D.splitOptions&&D.splitOptions.length>0?e.jsx(Pe,{label:D.label,onClick:D.onClick,icon:D.icon,variant:D.variant==="primary"?"primary":"outline",options:D.splitOptions,disabled:D.disabled},D.id):e.jsx(se,{variant:D.variant??"secondary",onClick:W=>{W.stopPropagation(),W.target.blur(),D.onClick()},disabled:D.disabled,leftIcon:D.icon,children:D.label},D.id))})]}),l&&e.jsx("div",{className:"mt-4",children:l})]})},Sr={none:"",sm:"px-3 pb-3 pt-1",md:"px-5 pb-5 pt-1.5"},Er=({title:t,subtitle:s,meta:r,actions:n,onBack:a,editable:l,onTitleChange:o,surface:u=!1,headerContent:i,loading:v=!1,loadingShape:x="table",empty:m,padding:g="md",scroll:b=!0,className:N,contentClassName:p,children:f})=>{const k=v?e.jsx(Ee,{variant:"inline",shape:x}):m?e.jsx("div",{className:"flex flex-col items-center justify-center py-12",children:m}):f;return e.jsxs("div",{className:c(b?"flex h-full min-h-0 flex-col":"flex flex-col",N),children:[e.jsx(ot,{surface:u,title:t,subtitle:s,meta:r,actions:n,onBack:a,editable:l,onTitleChange:o,className:b?"shrink-0":void 0,children:i}),e.jsx("div",{className:c(b&&"min-h-0 flex-1 overflow-y-auto",Sr[g],p),children:k})]})},Mr=({label:t,meta:s,action:r,className:n})=>e.jsxs("div",{className:c("flex items-center gap-2 px-1 pb-2 pt-7 first:pt-0",n),children:[e.jsx("span",{className:"shrink-0 text-2xs font-semibold uppercase tracking-label text-text-subtle",children:t}),s&&e.jsx("span",{className:"min-w-0 flex-1 truncate text-right text-xs tabular-nums text-text-subtle",children:s}),r&&e.jsx("span",{className:"ml-auto shrink-0",children:r})]});function Tr({label:t,trailing:s,align:r="center",className:n}){const a=e.jsx("span",{className:"h-px flex-1 bg-border-subtle","aria-hidden":!0});return!t&&!s?e.jsx("div",{className:c("flex items-center py-2",n),children:a}):e.jsxs("div",{className:c("flex items-center gap-3 py-2",n),children:[r==="center"&&a,e.jsx("span",{className:"shrink-0 text-xs font-medium text-text-muted",children:t}),a,s&&e.jsx("span",{className:"shrink-0",children:s})]})}const ct=d.createContext(null),zr=ct.Provider;function it(){return d.useContext(ct)}function Dr(){const[t,s]=d.useState(null),r=d.useMemo(()=>({setTrail:(n,a)=>s(l=>a?{ownerId:n,entry:a}:l&&l.ownerId!==n?l:null)}),[]);return{trail:t?.entry??null,api:r}}const Ar={none:"",sm:"px-3 py-3",md:"px-5 py-4"},_r=({children:t,actions:s=[],secondaryActions:r=[],actionsPlacement:n="header",onBack:a,backLabel:l="Back",title:o,loading:u=!1,loadingShape:i="form",padding:v="md",className:x,contentClassName:m})=>{const g=it(),b=d.useId(),N=d.useRef(a);N.current=a;const p=!!a,f=d.useRef(s);f.current=s;const k=d.useRef(r);k.current=r;const E=n==="header",P=E&&(s.length>0||r.length>0),D=P?JSON.stringify([...r,...s].map(F=>[F.id,F.label,F.variant,F.disabled])):"",W=d.useMemo(()=>{if(!P)return;const F=B=>(K,Z)=>({...K,onClick:()=>{(B==="primary"?f.current:k.current)[Z]?.onClick()}});return{actions:f.current.map(F("primary")),secondaryActions:k.current.map(F("secondary"))}},[P,D]);d.useEffect(()=>{if(g&&!(!p&&!o&&!W))return g.setTrail(b,{title:o,onBack:p?()=>N.current?.():void 0,actions:W?.actions,secondaryActions:W?.secondaryActions}),()=>g.setTrail(b,null)},[g,b,o,p,W]);const U=!E&&(s.length>0||r.length>0);return e.jsxs("div",{className:c("flex min-h-full flex-col",x),children:[!g&&(p||o||P)&&e.jsxs("div",{className:"flex shrink-0 items-center gap-2 px-5 pt-4",children:[p&&e.jsx(se,{variant:"ghost",onClick:()=>N.current?.(),"aria-label":l,leftIcon:e.jsx(X,{icon:R.ChevronLeft,size:"sm"}),iconOnly:!0}),o&&e.jsx("h2",{className:"min-w-0 truncate text-md font-semibold tracking-title text-text",children:o}),E&&e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.length>0&&e.jsx(be,{actions:r,defaultVariant:"ghost"}),s.length>0&&e.jsx(be,{actions:s})]})]}),e.jsx("div",{className:c("flex-1",Ar[v],m),children:u?e.jsx(Ee,{variant:"inline",shape:i}):t}),U&&e.jsxs("div",{className:"sticky bottom-0 z-10 flex shrink-0 items-center gap-2 border-t border-border bg-surface px-5 py-3",children:[r.length>0&&e.jsx(be,{actions:r,defaultVariant:"ghost"}),s.length>0&&e.jsx(be,{actions:s,className:"ml-auto"})]})]})};function $r({label:t,description:s,control:r,bordered:n=!1,disabled:a=!1,className:l}){return e.jsxs("div",{className:c("flex items-center justify-between gap-4 py-2",n&&"rounded-lg border border-border px-3",a&&"opacity-50",l),children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm text-text",children:t}),s&&e.jsx("div",{className:"text-xs text-text-muted",children:s})]}),e.jsx("div",{className:"shrink-0",children:r})]})}function Lr({icon:t,title:s,description:r,actions:n,children:a,className:l}){return e.jsxs("section",{className:c("flex flex-col gap-2",l),children:[e.jsxs("div",{className:"flex items-start gap-2",children:[t&&e.jsx(X,{icon:t,size:"md",color:"secondary",className:"mt-0.5"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-text",children:s}),r&&e.jsx("p",{className:"text-xs text-text-muted",children:r})]}),n&&e.jsx("div",{className:"shrink-0",children:n})]}),e.jsx("div",{className:c("flex flex-col",t&&"pl-6"),children:a})]})}function Pr({label:t,dotColor:s,onClick:r,className:n}){return e.jsxs("button",{type:"button",onClick:r,className:c("inline-flex max-w-full items-center gap-1.5 rounded-full bg-surface-sunk px-2.5 py-1 text-xs text-text-muted transition-colors duration-fast ease-out hover:bg-surface-hover hover:text-text",n),children:[s&&e.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:s},"aria-hidden":!0}),e.jsx("span",{className:"min-w-0 truncate",children:t}),e.jsx(X,{icon:R.ArrowUpRight,size:"xs",className:"opacity-70"})]})}function dt(t){const{id:s,header:r,accessor:n,label:a,tone:l,visible:o,width:u,sortable:i,align:v}=t;return{id:s,header:r,accessor:x=>a(n(x),x),cell:(x,m)=>{const g=n(m);return o&&!o(g,m)?null:e.jsx(at,{variant:l?l(g,m):"default",size:"sm",children:a(g,m)})},width:u,sortable:i,align:v}}function Rr(t){const{id:s,header:r,accessor:n,onLabel:a,offLabel:l,onTone:o="success",offTone:u="secondary",width:i,sortable:v}=t;return dt({id:s,header:r,accessor:x=>!!n(x),label:x=>x?a:l,tone:x=>x?o:u,width:i,sortable:v})}function Ir(t){const{id:s,header:r,accessor:n,label:a,empty:l="—",separator:o=", ",width:u,searchable:i,sortable:v}=t;return{id:s,header:r,accessor:x=>{const m=n(x),b=(m==null?[]:Array.isArray(m)?m:[m]).filter(Boolean).map(N=>a(N)??N);return b.length?b.join(o):l},width:u,searchable:i,sortable:v}}function Fr(t,s){return s.split(".").reduce((r,n)=>r&&typeof r=="object"&&n in r?r[n]:void 0,t)}const Or=({groups:t,data:s,size:r="md",className:n})=>{const a=x=>{if(!x)return"-";try{return new Date(x).toLocaleDateString("nl-NL",{year:"numeric",month:"long",day:"numeric"})}catch{return String(x)}},l=x=>x?"Ja":"Nee",o=(x,m)=>{if(!m)return String(x||"-");const g=m.find(b=>b.value===x);return g?g.label:String(x||"-")},u=d.useCallback(x=>{const m=Fr(s,x.name);if(x.type==="array"){const b=m;return!b||b.length===0?e.jsx(oe,{variant:"body",size:"sm",className:"text-text-muted",children:"Geen items"}):e.jsx("div",{className:"space-y-3",children:b.map((N,p)=>e.jsxs("div",{className:"p-4 border border-border rounded-xl space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs(oe,{variant:"label",size:"sm",weight:"medium",className:"text-text-muted",children:[x.label," ",p+1]})}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:x.arrayFields?.map(f=>{const k=N?.[f.name];let E="-";switch(f.type){case"text":case"email":case"number":case"tel":case"url":case"textarea":E=k||"-";break;case"select":case"radio":E=o(k,f.options);break;case"checkbox":E=l(k);break;case"date":E=a(k);break;case"custom":E=f.customComponent?.({value:k});break;default:E=String(k||"-")}return f.format&&(E=f.format(k,N)),e.jsxs("div",{className:"space-y-1",children:[e.jsx(oe,{variant:"label",size:"xs",className:"text-text-muted",children:f.label}),e.jsx(oe,{variant:"body",size:"sm",className:"text-text",children:E})]},f.name)})})]},p))})}if(x.type==="custom"&&x.customComponent)return x.customComponent({value:m});if(x.format){const b=x.format(m,s);return e.jsx(oe,{variant:"body",size:"sm",className:"text-text",children:b})}let g="-";switch(x.type){case"text":case"email":case"password":case"number":case"tel":case"url":g=m?String(m):"-";break;case"textarea":g=m?e.jsx("div",{className:"whitespace-pre-wrap",children:String(m||"-")}):"-";break;case"select":case"radio":g=o(m,x.options);break;case"checkbox":g=l(m);break;case"date":g=a(m);break;default:g=m?String(m):"-"}return e.jsx(oe,{variant:"body",size:"sm",className:"text-text",children:g})},[s]),i=d.useCallback(x=>{if(x.conditional&&!x.conditional(s))return null;const m=x.items.filter(b=>!(b.hidden||b.conditional&&!b.conditional(s)));if(m.length===0)return null;const g=c("space-y-4",{"grid gap-4":x.layout==="grid","flex flex-wrap gap-4":x.layout==="flex"},x.layout==="grid"&&{"grid-cols-1":!x.columns||x.columns===1,"grid-cols-2":x.columns===2,"grid-cols-3":x.columns===3,"grid-cols-4":x.columns===4},x.className);return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8 p-6 border border-border rounded-xl",children:[e.jsxs("div",{className:"md:col-span-1",children:[e.jsx(oe,{variant:"label",size:"lg",weight:"semibold",className:"text-text",children:x.title}),x.description&&e.jsx(oe,{variant:"body",size:"sm",className:"text-text-muted mt-1",children:x.description})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx("div",{className:g,children:m.map(b=>e.jsxs("div",{className:"space-y-1",style:{width:typeof b.width=="string"?b.width:void 0,gridColumn:typeof b.width=="number"?`span ${b.width} / span ${b.width}`:void 0},children:[b.type!=="custom"&&e.jsx(oe,{variant:"label",size:"sm",className:"font-medium text-text-muted",children:b.label}),u(b)]},b.name))})})]},x.id)},[s,u]),v=c("space-y-6",{"max-w-md":r==="sm","max-w-2xl":r==="md","max-w-4xl":r==="lg","max-w-full":r==="full"},n);return e.jsx("div",{className:v,children:e.jsx("div",{className:"space-y-8",children:t.map(i)})})},Br=()=>e.jsx(Ee,{variant:"inline",shape:"menu"}),ut=({item:t,isSelectedHandler:s,onClick:r,depth:n=0})=>{const a=!!(t.children&&t.children.length>0),l=s?s(t.path):!1;if(a)return e.jsxs("li",{children:[t.label&&e.jsxs("div",{className:c("flex items-center gap-2 px-2.5 pt-5 pb-2 text-2xs font-semibold uppercase tracking-label text-text-disabled"),children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.label}),t.count!==void 0&&t.count>0&&e.jsx("span",{className:"font-normal tabular-nums",children:t.count})]}),e.jsx("ul",{className:"flex flex-col gap-px",children:t.children?.map((i,v)=>e.jsx(ut,{item:i,isSelectedHandler:s,onClick:r,depth:n+1},v))})]});const o=t.action,u=o?.visibility!=="always";return e.jsx("li",{children:e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>t.path&&r?.(t.path),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),t.path&&r?.(t.path))},className:c("group/item flex h-row-md cursor-pointer items-center gap-2.5 rounded-md px-2.5 text-base no-underline","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",l?"bg-surface-hover font-medium text-text shadow-sm":"text-text-muted hover:bg-page-hover hover:text-text"),children:[t.icon&&e.jsx("span",{className:c("flex w-5 shrink-0 items-center justify-center",l?"text-text-muted":"text-text-subtle"),children:t.icon}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.label}),t.count!==void 0&&t.count>0&&e.jsx("span",{className:c("shrink-0 text-xs tabular-nums",l?"rounded-full bg-accent px-1.5 font-semibold text-accent-fg":"text-text-subtle",o&&u&&"group-hover/item:hidden group-focus-within/item:hidden"),children:t.count}),t.count===void 0&&t.meta!==void 0&&e.jsx("span",{className:c("shrink-0 text-xs text-text-subtle",o&&u&&"group-hover/item:hidden group-focus-within/item:hidden"),children:t.meta}),o&&e.jsx("button",{type:"button","aria-label":o.label,title:o.label,onClick:i=>{i.stopPropagation(),o.onClick()},onKeyDown:i=>i.stopPropagation(),className:c("flex size-5 shrink-0 items-center justify-center rounded-sm","text-text-subtle transition-colors duration-fast ease-out","hover:bg-page-hover hover:text-text","focus-visible:outline-none focus-visible:focus-ring",u&&"opacity-0 group-hover/item:opacity-100 focus-visible:opacity-100"),children:o.icon})]})})},Hr=({items:t,isSelectedHandler:s,onClick:r,preMenuItemsComponent:n,loading:a=!1})=>a?e.jsxs("nav",{className:"flex h-full min-h-0 shrink-0 flex-col",children:[n&&e.jsx("div",{className:"pb-4",children:n}),e.jsx(Br,{})]}):e.jsxs("nav",{className:"flex h-full min-h-0 shrink-0 flex-col",children:[n&&e.jsx("div",{className:"pb-4",children:n}),e.jsx("ul",{className:"flex min-h-0 flex-1 flex-col gap-px overflow-y-auto",children:t.map((l,o)=>!l.path&&!l.label&&!l.children?e.jsx("li",{"aria-hidden":!0,className:"h-4"},o):e.jsx(ut,{item:l,isSelectedHandler:s,onClick:r},o))})]}),qr={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-lg",xl:"text-xl","2xl":"text-2xl","3xl":"text-3xl","4xl":"text-3xl"},Vr={light:"font-normal",normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},Ur={primary:"text-text",secondary:"text-text-muted",accent:"text-accent",success:"text-success-fg",warning:"text-warning-fg",error:"text-danger-fg",info:"text-info-fg",neutral:"text-text",current:"text-current"},Kr={left:"text-left",center:"text-center",right:"text-right"},Wr=({level:t=1,size:s,weight:r="semibold",color:n="current",align:a="left",truncate:l=!1,className:o,children:u,...i})=>{const v=`h${t}`,x=c("font-sans text-pretty",qr[s||Gr(t)],Vr[r],Ur[n],Kr[a],l&&"truncate",o);return e.jsx(v,{className:x,...i,children:u})};function Gr(t){return{1:"2xl",2:"xl",3:"lg",4:"lg",5:"md",6:"md"}[t]||"md"}const Yr=({commands:t,isOpen:s,onClose:r,labels:n,initialCommandPath:a,initialActiveIndex:l})=>{const[o,u]=d.useState(""),[i,v]=d.useState(a||[]),[x,m]=d.useState(l||0),g=d.useRef(null),b=d.useRef(null),p=(i.length?t.find(f=>f.id===i[0])?.subCommands||[]:t).filter(f=>f.label.toLowerCase().includes(o.toLowerCase()));return d.useEffect(()=>{s||(u(""),v(a||[]),m(l||0))},[s]),d.useEffect(()=>{const f=k=>{if(s){if(k.key==="Escape")r();else if(k.key==="ArrowUp")m(E=>E>0?E-1:p.length-1);else if(k.key==="ArrowDown")m(E=>E<p.length-1?E+1:0);else if(k.key==="Enter"){const E=p[x];E&&(E.subCommands?(v([...i,E.id]),m(0)):E.action&&(E.action(),r()))}}};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[s,r,p,x,i]),d.useEffect(()=>{const f=k=>{g.current&&!g.current.contains(k.target)&&r()};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s,r]),d.useEffect(()=>{if(!s)return;b.current?.querySelector(`[data-index="${x}"]`)?.scrollIntoView({block:"nearest"})},[x,s]),s?e.jsx("div",{className:"fixed inset-0 z-modal flex items-center justify-center bg-scrim",children:e.jsxs("div",{className:"flex flex-col w-full max-w-lg max-h-dialog p-2 mx-auto rounded-lg border border-border shadow-modal bg-surface",ref:g,children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 flex-shrink-0",children:[e.jsx(R.Search,{className:"w-4 h-4 text-text-muted shrink-0"}),e.jsx("input",{type:"text",autoFocus:!0,placeholder:n?.searchPlaceholder||"Search commands...",value:o,onChange:f=>u(f.target.value),className:"w-full border-0 bg-transparent py-2 text-text focus:outline-none"})]}),e.jsxs("div",{ref:b,className:"mt-2 pt-2 text-sm border-t border-border max-h-dialog-list overflow-y-auto",children:[p.length===0&&e.jsx("div",{className:"text-text-muted text-center text-sm",children:n?.noCommandsFound||"No commands found"}),p.map((f,k)=>e.jsxs("div",{"data-index":k,className:`flex items-center p-2 cursor-pointer rounded-md ${k===x?"bg-accent-soft text-accent":"text-text"}`,onClick:()=>{f.subCommands?(v([...i,f.id]),m(0)):f.action&&(f.action(),r())},onMouseEnter:()=>m(k),children:[f.icon&&e.jsx("span",{className:"mr-3",children:f.icon}),e.jsx("span",{className:"flex-grow",children:f.label}),f.subCommands&&e.jsx("span",{className:"text-text-muted",children:e.jsx(R.ChevronRight,{className:"w-4 h-4"})})]},f.id))]}),e.jsxs("div",{className:"flex items-center gap-4 px-3 pt-2 mt-2 text-xs text-text-muted border-t border-border",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-5 px-1 py-0.5 rounded border border-border bg-surface-sunk text-xs font-medium not-italic",children:"↑↓"}),n?.navigate||"to navigate"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-5 px-1 py-0.5 rounded border border-border bg-surface-sunk text-xs font-medium not-italic",children:"↵"}),n?.select||"to select"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-5 px-1 py-0.5 rounded border border-border bg-surface-sunk text-xs font-medium not-italic",children:"Esc"}),n?.close||"to close"]})]})]})}):null},Jr={none:"p-0",xs:"p-1",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8","2xl":"p-12"},Xr={none:"m-0",xs:"m-1",sm:"m-2",md:"m-4",lg:"m-6",xl:"m-8","2xl":"m-12"},Zr={none:"",primary:"bg-accent text-accent-fg",secondary:"bg-surface-hover",accent:"bg-accent-soft",success:"bg-success-soft",warning:"bg-warning-soft",error:"bg-danger-soft",info:"bg-info-soft",neutral:"bg-surface-hover",white:"bg-surface",module:"bg-surface","module-subtle":"bg-surface-sunk",backdrop:"bg-page",editor:"bg-surface",input:"bg-surface-input"},Qr={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl",full:"rounded-full"},en={none:"shadow-none",sm:"shadow-none",md:"shadow-overlay",lg:"shadow-overlay",xl:"shadow-modal","2xl":"shadow-modal"},tn={none:"border-0",sm:"border",md:"border-2",lg:"border-4"},sn={primary:"border-accent-border",secondary:"border-border",accent:"border-accent-border",success:"border-success-border",warning:"border-warning-border",error:"border-danger-border",info:"border-info-border",neutral:"border-border-subtle",white:"border-border-subtle"},Fe=d.forwardRef(({padding:t,margin:s,background:r,radius:n,shadow:a,border:l,borderColor:o,className:u,children:i,...v},x)=>e.jsx("div",{ref:x,className:c(t&&Jr[t],s&&Xr[s],r&&Zr[r],n&&Qr[n],a&&en[a],l&&tn[l],o&&sn[o],u),...v,children:i}));Fe.displayName="Box";const rn=({children:t,title:s,...r})=>e.jsxs(Fe,{background:"module",radius:"lg",shadow:"none",border:"sm",borderColor:"neutral",...r,children:[s&&e.jsx("span",{className:"mb-2 block text-sm font-semibold text-text",children:s}),t]}),ze=new Map;function nn({identifier:t,resourceLoader:s,framework:r="react",fallback:n,errorFallback:a,componentProps:l,className:o}){const u=d.useRef(null),[i,v]=d.useState(null),[,x]=d.useState(0),m=d.useRef(null),g=d.useRef(s);g.current=s,d.useEffect(()=>{if(ze.has(t))return;let k=!0;return(async()=>{try{const P=await g.current();if(!k)return;ze.set(t,P),x(D=>D+1)}catch(P){console.error(`[FederatedResource] Load failed: ${t}`,P),k&&v(t)}})(),()=>{k=!1}},[t]);const b=ze.get(t)??null,N=!b&&i===t,p=!b&&!N,f=b?r==="react"&&(b.component||b.default)||b:null;return d.useEffect(()=>{if(!f||r==="react")return;const k=u.current;if(k){if(r==="svelte"){const E=f.default||f,P=new E({target:k,props:l||{}});return m.current=P,()=>P.$destroy()}if(f.mount){const E=f.mount({container:k,props:l||{}});return()=>{typeof E=="function"?E():f.unmount?.(k)}}}},[f,r]),d.useEffect(()=>{r==="svelte"&&m.current&&m.current.$set?.(l)},[l,r]),e.jsxs("div",{ref:u,className:o,style:{display:"contents"},children:[p&&n,N&&a,r==="react"&&f&&e.jsx(f,{...l})]})}class an extends d.Component{constructor(){super(...arguments),this.state={hasError:!1,error:null}}static getDerivedStateFromError(s){return{hasError:!0,error:s}}componentDidCatch(s,r){console.error(`[ErrorBoundary] Error in ${this.props.name||"Component"}:`,s,r)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:e.jsxs("div",{className:"p-4 m-4 border border-danger-border bg-danger-soft rounded-lg",children:[e.jsx("h2",{className:"text-lg font-semibold text-danger-fg",children:"Something went wrong"}),e.jsx("p",{className:"text-sm text-danger-fg mt-1",children:this.props.name?`Error in ${this.props.name}`:"The component failed to render."}),e.jsx("button",{className:"mt-4 px-4 py-2 bg-danger text-danger-fg rounded hover:opacity-90 transition-opacity text-sm",onClick:()=>this.setState({hasError:!1,error:null}),children:"Try again"})]}):this.props.children}}exports.ArtifactView=ir;exports.AssistantCard=dr;exports.Avatar=lt;exports.AvatarStack=hr;exports.Badge=at;exports.Box=Fe;exports.Button=se;exports.ButtonGroup=Ft;exports.Card=rn;exports.ChannelBadge=br;exports.Checkbox=he;exports.CommandPalette=Yr;exports.ConfirmDialog=Rs;exports.ContentLoading=Ee;exports.DatePicker=Ce;exports.Dropdown=tt;exports.EmptyState=Vs;exports.ErrorBoundary=an;exports.FederatedResource=nn;exports.FilterChip=We;exports.FolderSelect=Ze;exports.Form=Ps;exports.FormSection=nt;exports.Heading=Wr;exports.IDENTITY_TONE_COUNT=Ue;exports.Icon=X;exports.Image=pr;exports.ImageField=cs;exports.Kbd=Us;exports.KpiCard=wr;exports.Link=Yt;exports.List=jr;exports.ListBulkAction=vr;exports.MeetingGrid=_t;exports.MessageBubble=yr;exports.MetaSeparator=Cr;exports.MetaValue=kr;exports.Modal=Ie;exports.Page=Er;exports.PageHeader=ot;exports.PageToolbar=js;exports.PageToolbarActions=be;exports.ParticipantTile=$t;exports.Popover=Le;exports.ProgressBar=Gs;exports.RichText=ve;exports.SearchField=Re;exports.SearchableTextField=Qe;exports.SectionCaption=Mr;exports.SectionDivider=Tr;exports.SegmentedToggle=Ge;exports.Select=ye;exports.SettingsFrameProvider=zr;exports.SettingsPage=_r;exports.SettingsRow=$r;exports.SettingsSection=Lr;exports.SidebarMenu=Hr;exports.SourceChip=Pr;exports.Spinner=Zs;exports.SplitButton=Pe;exports.StatusDot=er;exports.StepIndicator=tr;exports.StorageInput=rt;exports.Switch=et;exports.TabBar=zs;exports.Table=De;exports.Tabs=st;exports.Text=oe;exports.TextArea=Se;exports.TextField=pe;exports.VideoSurface=Lt;exports.View=Or;exports.autofillProps=Ae;exports.badgeColumn=dt;exports.booleanBadgeColumn=Rr;exports.catTone=Mt;exports.cn=c;exports.createSizes=wt;exports.createVariants=Nt;exports.dateFilterHandler=ys;exports.identityDotClass=Et;exports.identityPlateClass=$e;exports.identityTone=_e;exports.labelsColumn=Ir;exports.multiSelectFilterHandler=ws;exports.normalizeText=Ke;exports.resolveLucideIcon=Ot;exports.selectFilterHandler=Ns;exports.text=je;exports.useAnchoredPosition=Ne;exports.useSettingsFrame=it;exports.useSettingsFrameHost=Dr;
3
3
  //# sourceMappingURL=index.cjs.map