@object-ui/components 17.1.0 → 17.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,19 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@object-ui/core"),require("clsx"),require("tailwind-merge"),require("@object-ui/react"),require("react"),require("react/jsx-runtime"),require("@radix-ui/react-accordion"),require("lucide-react"),require("@radix-ui/react-alert-dialog"),require("@radix-ui/react-slot"),require("class-variance-authority"),require("@radix-ui/react-aspect-ratio"),require("@radix-ui/react-avatar"),require("react-day-picker"),require("embla-carousel-react"),require("recharts"),require("@radix-ui/react-checkbox"),require("@radix-ui/react-collapsible"),require("cmdk"),require("@radix-ui/react-dialog"),require("@radix-ui/react-context-menu"),require("vaul"),require("@radix-ui/react-dropdown-menu"),require("react-hook-form"),require("@radix-ui/react-label"),require("@radix-ui/react-hover-card"),require("input-otp"),require("@radix-ui/react-menubar"),require("@radix-ui/react-navigation-menu"),require("@radix-ui/react-popover"),require("@radix-ui/react-progress"),require("@radix-ui/react-radio-group"),require("@radix-ui/react-scroll-area"),require("@radix-ui/react-select"),require("@radix-ui/react-separator"),require("@radix-ui/react-tooltip"),require("@radix-ui/react-slider"),require("next-themes"),require("sonner"),require("@radix-ui/react-switch"),require("@radix-ui/react-tabs"),require("@radix-ui/react-toggle-group"),require("@radix-ui/react-toggle"),require("@object-ui/i18n"),require("lucide-react/dynamic.mjs"),require("react-resizable-panels"),require("date-fns"),require("@object-ui/sdui-parser"),require("@object-ui/types")):typeof define==`function`&&define.amd?define(`exports,@object-ui/core,clsx,tailwind-merge,@object-ui/react,react,react/jsx-runtime,@radix-ui/react-accordion,lucide-react,@radix-ui/react-alert-dialog,@radix-ui/react-slot,class-variance-authority,@radix-ui/react-aspect-ratio,@radix-ui/react-avatar,react-day-picker,embla-carousel-react,recharts,@radix-ui/react-checkbox,@radix-ui/react-collapsible,cmdk,@radix-ui/react-dialog,@radix-ui/react-context-menu,vaul,@radix-ui/react-dropdown-menu,react-hook-form,@radix-ui/react-label,@radix-ui/react-hover-card,input-otp,@radix-ui/react-menubar,@radix-ui/react-navigation-menu,@radix-ui/react-popover,@radix-ui/react-progress,@radix-ui/react-radio-group,@radix-ui/react-scroll-area,@radix-ui/react-select,@radix-ui/react-separator,@radix-ui/react-tooltip,@radix-ui/react-slider,next-themes,sonner,@radix-ui/react-switch,@radix-ui/react-tabs,@radix-ui/react-toggle-group,@radix-ui/react-toggle,@object-ui/i18n,lucide-react/dynamic.mjs,react-resizable-panels,date-fns,@object-ui/sdui-parser,@object-ui/types`.split(`,`),t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIComponents={},e.ObjectUICore,e.clsx,e.tailwind_merge,e.ObjectUIReact,e.React,e.react_jsx_runtime,e._radix_ui_react_accordion,e.lucide_react,e._radix_ui_react_alert_dialog,e._radix_ui_react_slot,e.class_variance_authority,e._radix_ui_react_aspect_ratio,e._radix_ui_react_avatar,e.react_day_picker,e.embla_carousel_react,e.recharts,e._radix_ui_react_checkbox,e._radix_ui_react_collapsible,e.cmdk,e._radix_ui_react_dialog,e._radix_ui_react_context_menu,e.vaul,e._radix_ui_react_dropdown_menu,e.react_hook_form,e._radix_ui_react_label,e._radix_ui_react_hover_card,e.input_otp,e._radix_ui_react_menubar,e._radix_ui_react_navigation_menu,e._radix_ui_react_popover,e._radix_ui_react_progress,e._radix_ui_react_radio_group,e._radix_ui_react_scroll_area,e._radix_ui_react_select,e._radix_ui_react_separator,e._radix_ui_react_tooltip,e._radix_ui_react_slider,e.next_themes,e.sonner,e._radix_ui_react_switch,e._radix_ui_react_tabs,e._radix_ui_react_toggle_group,e._radix_ui_react_toggle,e._object_ui_i18n,e.lucide_react_dynamic_mjs,e.react_resizable_panels,e.date_fns,e._object_ui_sdui_parser,e._object_ui_types))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,P,F,I,ee,te,ne,L,R,z,re,B,ie,V,ae,oe,se){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var ce=Object.create,le=Object.defineProperty,ue=Object.getOwnPropertyDescriptor,de=Object.getOwnPropertyNames,fe=Object.getPrototypeOf,pe=Object.prototype.hasOwnProperty,me=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=de(t),a=0,o=i.length,s;a<o;a++)s=i[a],!pe.call(e,s)&&s!==n&&le(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=ue(t,s))||r.enumerable});return e},H=(e,t,n)=>(n=e==null?{}:ce(fe(e)),me(t||!e||!e.__esModule?le(n,`default`,{value:e,enumerable:!0}):n,e));a=H(a,1),s=H(s,1),l=H(l,1),f=H(f,1),p=H(p,1),h=H(h,1),g=H(g,1),_=H(_,1),v=H(v,1),b=H(b,1),x=H(x,1),C=H(C,1),T=H(T,1),E=H(E,1),O=H(O,1),k=H(k,1),A=H(A,1),j=H(j,1),M=H(M,1),N=H(N,1),P=H(P,1),F=H(F,1),I=H(I,1),ee=H(ee,1),L=H(L,1),R=H(R,1),z=H(z,1),re=H(re,1);function U(...e){return(0,r.twMerge)((0,n.clsx)(e))}function W(e){return e?typeof e==`string`||typeof e==`number`?e:Array.isArray(e)?e.length===0?null:e.length===1?(0,o.jsx)(i.SchemaRenderer,{schema:e[0]}):e.map((e,t)=>(0,o.jsx)(i.SchemaRenderer,{schema:e},e.id||t)):(0,o.jsx)(i.SchemaRenderer,{schema:e}):null}var he=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{process.env.NODE_ENV!==`production`&&console.warn(`[ObjectUI] The "div" component is deprecated. Please use Shadcn components instead:
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@object-ui/core"),require("clsx"),require("tailwind-merge"),require("@object-ui/react"),require("react"),require("react/jsx-runtime"),require("@radix-ui/react-accordion"),require("lucide-react"),require("@radix-ui/react-alert-dialog"),require("@radix-ui/react-slot"),require("class-variance-authority"),require("@radix-ui/react-aspect-ratio"),require("@radix-ui/react-avatar"),require("react-day-picker"),require("embla-carousel-react"),require("recharts"),require("@radix-ui/react-checkbox"),require("@radix-ui/react-collapsible"),require("cmdk"),require("@radix-ui/react-dialog"),require("@object-ui/i18n"),require("@radix-ui/react-context-menu"),require("vaul"),require("@radix-ui/react-dropdown-menu"),require("react-hook-form"),require("@radix-ui/react-label"),require("@radix-ui/react-hover-card"),require("input-otp"),require("@radix-ui/react-menubar"),require("@radix-ui/react-navigation-menu"),require("@radix-ui/react-popover"),require("@radix-ui/react-progress"),require("@radix-ui/react-radio-group"),require("@radix-ui/react-scroll-area"),require("@radix-ui/react-select"),require("@radix-ui/react-separator"),require("@radix-ui/react-tooltip"),require("@radix-ui/react-slider"),require("next-themes"),require("sonner"),require("@radix-ui/react-switch"),require("@radix-ui/react-tabs"),require("@radix-ui/react-toggle-group"),require("@radix-ui/react-toggle"),require("lucide-react/dynamic.mjs"),require("react-resizable-panels"),require("date-fns"),require("@object-ui/sdui-parser"),require("@object-ui/types")):typeof define==`function`&&define.amd?define(`exports,@object-ui/core,clsx,tailwind-merge,@object-ui/react,react,react/jsx-runtime,@radix-ui/react-accordion,lucide-react,@radix-ui/react-alert-dialog,@radix-ui/react-slot,class-variance-authority,@radix-ui/react-aspect-ratio,@radix-ui/react-avatar,react-day-picker,embla-carousel-react,recharts,@radix-ui/react-checkbox,@radix-ui/react-collapsible,cmdk,@radix-ui/react-dialog,@object-ui/i18n,@radix-ui/react-context-menu,vaul,@radix-ui/react-dropdown-menu,react-hook-form,@radix-ui/react-label,@radix-ui/react-hover-card,input-otp,@radix-ui/react-menubar,@radix-ui/react-navigation-menu,@radix-ui/react-popover,@radix-ui/react-progress,@radix-ui/react-radio-group,@radix-ui/react-scroll-area,@radix-ui/react-select,@radix-ui/react-separator,@radix-ui/react-tooltip,@radix-ui/react-slider,next-themes,sonner,@radix-ui/react-switch,@radix-ui/react-tabs,@radix-ui/react-toggle-group,@radix-ui/react-toggle,lucide-react/dynamic.mjs,react-resizable-panels,date-fns,@object-ui/sdui-parser,@object-ui/types`.split(`,`),t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIComponents={},e.ObjectUICore,e.clsx,e.tailwind_merge,e.ObjectUIReact,e.React,e.react_jsx_runtime,e._radix_ui_react_accordion,e.lucide_react,e._radix_ui_react_alert_dialog,e._radix_ui_react_slot,e.class_variance_authority,e._radix_ui_react_aspect_ratio,e._radix_ui_react_avatar,e.react_day_picker,e.embla_carousel_react,e.recharts,e._radix_ui_react_checkbox,e._radix_ui_react_collapsible,e.cmdk,e._radix_ui_react_dialog,e._object_ui_i18n,e._radix_ui_react_context_menu,e.vaul,e._radix_ui_react_dropdown_menu,e.react_hook_form,e._radix_ui_react_label,e._radix_ui_react_hover_card,e.input_otp,e._radix_ui_react_menubar,e._radix_ui_react_navigation_menu,e._radix_ui_react_popover,e._radix_ui_react_progress,e._radix_ui_react_radio_group,e._radix_ui_react_scroll_area,e._radix_ui_react_select,e._radix_ui_react_separator,e._radix_ui_react_tooltip,e._radix_ui_react_slider,e.next_themes,e.sonner,e._radix_ui_react_switch,e._radix_ui_react_tabs,e._radix_ui_react_toggle_group,e._radix_ui_react_toggle,e.lucide_react_dynamic_mjs,e.react_resizable_panels,e.date_fns,e._object_ui_sdui_parser,e._object_ui_types))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,P,F,ee,te,I,ne,L,re,R,z,B,ie,ae,oe,V,H){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var se=Object.create,ce=Object.defineProperty,le=Object.getOwnPropertyDescriptor,ue=Object.getOwnPropertyNames,de=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty,pe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ue(t),a=0,o=i.length,s;a<o;a++)s=i[a],!fe.call(e,s)&&s!==n&&ce(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=le(t,s))||r.enumerable});return e},U=(e,t,n)=>(n=e==null?{}:se(de(e)),pe(t||!e||!e.__esModule||!fe.call(e,`default`)?ce(n,`default`,{value:e,enumerable:!0}):n,e));a=U(a,1),s=U(s,1),l=U(l,1),f=U(f,1),p=U(p,1),h=U(h,1),g=U(g,1),_=U(_,1),v=U(v,1),b=U(b,1),S=U(S,1),w=U(w,1),E=U(E,1),D=U(D,1),k=U(k,1),A=U(A,1),j=U(j,1),M=U(M,1),N=U(N,1),P=U(P,1),F=U(F,1),ee=U(ee,1),te=U(te,1),I=U(I,1),re=U(re,1),R=U(R,1),z=U(z,1),B=U(B,1);function W(...e){return(0,r.twMerge)((0,n.clsx)(e))}function G(e){return e?typeof e==`string`||typeof e==`number`?e:Array.isArray(e)?e.length===0?null:e.length===1?(0,o.jsx)(i.SchemaRenderer,{schema:e[0]}):e.map((e,t)=>(0,o.jsx)(i.SchemaRenderer,{schema:e},e.id||t)):(0,o.jsx)(i.SchemaRenderer,{schema:e}):null}var me=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{process.env.NODE_ENV!==`production`&&console.warn(`[ObjectUI] The "div" component is deprecated. Please use Shadcn components instead:
2
2
  - For containers: use "card", "flex", or semantic layout components
3
3
  - For simple wrappers: use layout components like "container", "stack", or "grid"
4
- See documentation at https://www.objectui.org/docs/components for alternatives.`);let{"data-obj-id":i,"data-obj-type":a,style:s,...c}=n;return(0,o.jsx)(`div`,{ref:r,className:t,...c,"data-obj-id":i,"data-obj-type":a,style:s,children:W(e.children||e.body)})});t.ComponentRegistry.register(`div`,he,{namespace:`ui`,label:`Container (Deprecated)`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{className:`p-2 sm:p-4 border border-dashed border-gray-300 rounded min-h-[100px]`}}),t.ComponentRegistry.register(`text`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return n||e.className||a.className?(0,o.jsx)(`span`,{"data-obj-id":n,"data-obj-type":r,style:i,className:e.className||a.className,...a,children:e.content||e.value}):(0,o.jsx)(o.Fragment,{children:e.content||e.value})},{namespace:`ui`,label:`Text`,inputs:[{name:`content`,type:`string`,label:`Content`,required:!0}],defaultProps:{content:`Text content`}});var ge=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{process.env.NODE_ENV!==`production`&&console.warn(`[ObjectUI] The "span" component is deprecated. Please use Shadcn components instead:
4
+ See documentation at https://www.objectui.org/docs/components for alternatives.`);let{"data-obj-id":i,"data-obj-type":a,style:s,...c}=n;return(0,o.jsx)(`div`,{ref:r,className:t,...c,"data-obj-id":i,"data-obj-type":a,style:s,children:G(e.children||e.body)})});t.ComponentRegistry.register(`div`,me,{namespace:`ui`,label:`Container (Deprecated)`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{className:`p-2 sm:p-4 border border-dashed border-gray-300 rounded min-h-[100px]`}}),t.ComponentRegistry.register(`text`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return n||e.className||a.className?(0,o.jsx)(`span`,{"data-obj-id":n,"data-obj-type":r,style:i,className:e.className||a.className,...a,children:e.content||e.value}):(0,o.jsx)(o.Fragment,{children:e.content||e.value})},{namespace:`ui`,label:`Text`,inputs:[{name:`content`,type:`string`,label:`Content`,required:!0}],defaultProps:{content:`Text content`}});var he=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{process.env.NODE_ENV!==`production`&&console.warn(`[ObjectUI] The "span" component is deprecated. Please use Shadcn components instead:
5
5
  - For badges/labels: use "badge" component
6
6
  - For inline text emphasis: use "text" component with appropriate className
7
- See documentation at https://www.objectui.org/docs/components for alternatives.`);let{"data-obj-id":i,"data-obj-type":a,style:s,...c}=n;return(0,o.jsx)(`span`,{ref:r,className:t,...c,"data-obj-id":i,"data-obj-type":a,style:s,children:W(e.body)})});t.ComponentRegistry.register(`span`,ge,{namespace:`ui`,label:`Inline Container (Deprecated)`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{className:`px-1.5 py-0.5 sm:px-2 sm:py-1`},defaultChildren:[{type:`text`,content:`Inline text`}]});var _e=s.Root,ve=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(s.Item,{ref:n,className:U(`border-b`,e),...t}));ve.displayName=`AccordionItem`;var G=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsx)(s.Header,{className:`flex`,children:(0,o.jsxs)(s.Trigger,{ref:r,className:U(`flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180`,e),...n,children:[t,(0,o.jsx)(c.ChevronDown,{className:`h-4 w-4 shrink-0 transition-transform duration-200`})]})}));G.displayName=s.Trigger.displayName;var ye=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsx)(s.Content,{ref:r,className:`overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`,...n,children:(0,o.jsx)(`div`,{className:U(`pb-4 pt-0`,e),children:t})}));ye.displayName=s.Content.displayName;var K=(0,d.cva)(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-input bg-background hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-10 px-4 py-2`,sm:`h-9 rounded-md px-3`,lg:`h-11 rounded-md px-8`,icon:`h-10 w-10`}},defaultVariants:{variant:`default`,size:`default`}}),q=a.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,o.jsx)(r?u.Slot:`button`,{className:U(K({variant:t,size:n,className:e})),ref:a,...i}));q.displayName=`Button`;var be=l.Root,xe=l.Trigger,Se=l.Portal,Ce=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(l.Overlay,{className:U(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));Ce.displayName=l.Overlay.displayName;var we=a.forwardRef(({className:e,...t},n)=>(0,o.jsxs)(Se,{children:[(0,o.jsx)(Ce,{}),(0,o.jsx)(l.Content,{ref:n,className:U(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...t})]}));we.displayName=l.Content.displayName;var Te=({className:e,...t})=>(0,o.jsx)(`div`,{className:U(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});Te.displayName=`AlertDialogHeader`;var Ee=({className:e,...t})=>(0,o.jsx)(`div`,{className:U(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Ee.displayName=`AlertDialogFooter`;var De=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(l.Title,{ref:n,className:U(`text-lg font-semibold`,e),...t}));De.displayName=l.Title.displayName;var Oe=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(l.Description,{ref:n,className:U(`text-sm text-muted-foreground`,e),...t}));Oe.displayName=l.Description.displayName;var ke=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(l.Action,{ref:n,className:U(K(),e),...t}));ke.displayName=l.Action.displayName;var Ae=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(l.Cancel,{ref:n,className:U(K({variant:`outline`}),`mt-2 sm:mt-0`,e),...t}));Ae.displayName=l.Cancel.displayName;var je=(0,d.cva)(`relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground`,{variants:{variant:{default:`bg-background text-foreground`,destructive:`border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive`}},defaultVariants:{variant:`default`}}),Me=a.forwardRef(({className:e,variant:t,...n},r)=>(0,o.jsx)(`div`,{ref:r,role:`alert`,className:U(je({variant:t}),e),...n}));Me.displayName=`Alert`;var Ne=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`h5`,{ref:n,className:U(`mb-1 font-medium leading-none tracking-tight`,e),...t}));Ne.displayName=`AlertTitle`;var Pe=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:U(`text-sm [&_p]:leading-relaxed`,e),...t}));Pe.displayName=`AlertDescription`;var Fe=f.Root,Ie=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(p.Root,{ref:n,className:U(`relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full`,e),...t}));Ie.displayName=p.Root.displayName;var Le=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(p.Image,{ref:n,className:U(`aspect-square h-full w-full`,e),...t}));Le.displayName=p.Image.displayName;var Re=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(p.Fallback,{ref:n,className:U(`flex h-full w-full items-center justify-center rounded-full bg-muted`,e),...t}));Re.displayName=p.Fallback.displayName;var ze=(0,d.cva)(`inline-flex items-center whitespace-nowrap rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function Be({className:e,variant:t,...n}){return(0,o.jsx)(`div`,{className:U(ze({variant:t}),e),...n})}var Ve=a.forwardRef(({...e},t)=>(0,o.jsx)(`nav`,{ref:t,"aria-label":`breadcrumb`,...e}));Ve.displayName=`Breadcrumb`;var He=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`ol`,{ref:n,className:U(`flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5`,e),...t}));He.displayName=`BreadcrumbList`;var Ue=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`li`,{ref:n,className:U(`inline-flex items-center gap-1.5`,e),...t}));Ue.displayName=`BreadcrumbItem`;var We=a.forwardRef(({asChild:e,className:t,...n},r)=>(0,o.jsx)(e?u.Slot:`a`,{ref:r,className:U(`transition-colors hover:text-foreground`,t),...n}));We.displayName=`BreadcrumbLink`;var Ge=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`span`,{ref:n,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:U(`font-normal text-foreground`,e),...t}));Ge.displayName=`BreadcrumbPage`;var Ke=({children:e,className:t,...n})=>(0,o.jsx)(`li`,{role:`presentation`,"aria-hidden":`true`,className:U(`[&>svg]:w-3.5 [&>svg]:h-3.5`,t),...n,children:e??(0,o.jsx)(c.ChevronRight,{})});Ke.displayName=`BreadcrumbSeparator`;var qe=({className:e,...t})=>(0,o.jsxs)(`span`,{role:`presentation`,"aria-hidden":`true`,className:U(`flex h-9 w-9 items-center justify-center`,e),...t,children:[(0,o.jsx)(c.MoreHorizontal,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`More`})]});qe.displayName=`BreadcrumbElipssis`;function Je({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:r=`label`,buttonVariant:i=`ghost`,formatters:a,components:s,...l}){let u=(0,m.getDefaultClassNames)();return(0,o.jsx)(m.DayPicker,{showOutsideDays:n,className:U(`bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent`,String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:r,formatters:{formatMonthDropdown:e=>e.toLocaleString(`default`,{month:`short`}),...a},classNames:{root:U(`w-fit`,u.root),months:U(`relative flex flex-col gap-4 md:flex-row`,u.months),month:U(`flex w-full flex-col gap-4`,u.month),nav:U(`absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1`,u.nav),button_previous:U(K({variant:i}),`h-(--cell-size) w-(--cell-size) select-none p-0 aria-disabled:opacity-50`,u.button_previous),button_next:U(K({variant:i}),`h-(--cell-size) w-(--cell-size) select-none p-0 aria-disabled:opacity-50`,u.button_next),month_caption:U(`flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)`,u.month_caption),dropdowns:U(`flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium`,u.dropdowns),dropdown_root:U(`has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border`,u.dropdown_root),dropdown:U(`bg-popover absolute inset-0 opacity-0`,u.dropdown),caption_label:U(`select-none font-medium`,r===`label`?`text-sm`:`[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5`,u.caption_label),weekdays:U(`flex`,u.weekdays),weekday:U(`text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal`,u.weekday),week:U(`mt-2 flex w-full`,u.week),week_number_header:U(`w-(--cell-size) select-none`,u.week_number_header),week_number:U(`text-muted-foreground select-none text-[0.8rem]`,u.week_number),day:U(`group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md`,u.day),range_start:U(`bg-accent rounded-l-md`,u.range_start),range_middle:U(`rounded-none`,u.range_middle),range_end:U(`bg-accent rounded-r-md`,u.range_end),today:U(`bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none`,u.today),outside:U(`text-muted-foreground aria-selected:text-muted-foreground`,u.outside),disabled:U(`text-muted-foreground opacity-50`,u.disabled),hidden:U(`invisible`,u.hidden),...t},components:{Root:({className:e,rootRef:t,...n})=>(0,o.jsx)(`div`,{"data-slot":`calendar`,ref:t,className:U(e),...n}),Chevron:({className:e,orientation:t,...n})=>t===`left`?(0,o.jsx)(c.ChevronLeftIcon,{className:U(`size-4`,e),...n}):t===`right`?(0,o.jsx)(c.ChevronRightIcon,{className:U(`size-4`,e),...n}):(0,o.jsx)(c.ChevronDownIcon,{className:U(`size-4`,e),...n}),DayButton:Ye,WeekNumber:({children:e,...t})=>(0,o.jsx)(`td`,{...t,children:(0,o.jsx)(`div`,{className:`flex size-(--cell-size) items-center justify-center text-center`,children:e})}),...s},...l})}function Ye({className:e,day:t,modifiers:n,...r}){let i=(0,m.getDefaultClassNames)(),s=a.useRef(null);return a.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),(0,o.jsx)(q,{ref:s,variant:`ghost`,size:`icon`,"data-day":t.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:U(`data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-(--cell-size) flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70`,i.day,e),...r})}var Xe=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:U(`rounded-lg border bg-card text-card-foreground shadow-sm`,e),...t}));Xe.displayName=`Card`;var Ze=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:U(`flex flex-col space-y-1.5 p-6`,e),...t}));Ze.displayName=`CardHeader`;var Qe=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:U(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));Qe.displayName=`CardTitle`;var $e=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:U(`text-sm text-muted-foreground`,e),...t}));$e.displayName=`CardDescription`;var et=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:U(`p-6 pt-0`,e),...t}));et.displayName=`CardContent`;var J=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:U(`flex items-center p-6 pt-0`,e),...t}));J.displayName=`CardFooter`;var tt=a.createContext(null);function nt(){let e=a.useContext(tt);if(!e)throw Error(`useCarousel must be used within a <Carousel />`);return e}var rt=a.forwardRef(({orientation:e=`horizontal`,opts:t,setApi:n,plugins:r,className:i,children:s,...c},l)=>{let[u,d]=(0,h.default)({...t,axis:e===`horizontal`?`x`:`y`},r),[f,p]=a.useState(!1),[m,g]=a.useState(!1),_=a.useCallback(e=>{e&&(p(e.canScrollPrev()),g(e.canScrollNext()))},[]),v=a.useCallback(()=>{d?.scrollPrev()},[d]),y=a.useCallback(()=>{d?.scrollNext()},[d]),b=a.useCallback(e=>{e.key===`ArrowLeft`?(e.preventDefault(),v()):e.key===`ArrowRight`&&(e.preventDefault(),y())},[v,y]);return a.useEffect(()=>{!d||!n||n(d)},[d,n]),a.useEffect(()=>{if(d)return _(d),d.on(`reInit`,_),d.on(`select`,_),()=>{d?.off(`select`,_)}},[d,_]),(0,o.jsx)(tt.Provider,{value:{carouselRef:u,api:d,opts:t,orientation:e||(t?.axis===`y`?`vertical`:`horizontal`),scrollPrev:v,scrollNext:y,canScrollPrev:f,canScrollNext:m},children:(0,o.jsx)(`div`,{ref:l,onKeyDownCapture:b,className:U(`relative`,i),role:`region`,"aria-roledescription":`carousel`,...c,children:s})})});rt.displayName=`Carousel`;var it=a.forwardRef(({className:e,...t},n)=>{let{carouselRef:r,orientation:i}=nt();return(0,o.jsx)(`div`,{ref:r,className:`overflow-hidden`,children:(0,o.jsx)(`div`,{ref:n,className:U(`flex`,i===`horizontal`?`-ml-4`:`-mt-4 flex-col`,e),...t})})});it.displayName=`CarouselContent`;var at=a.forwardRef(({className:e,...t},n)=>{let{orientation:r}=nt();return(0,o.jsx)(`div`,{ref:n,role:`group`,"aria-roledescription":`slide`,className:U(`min-w-0 shrink-0 grow-0 basis-full`,r===`horizontal`?`pl-4`:`pt-4`,e),...t})});at.displayName=`CarouselItem`;var ot=a.forwardRef(({className:e,variant:t=`outline`,size:n=`icon`,...r},i)=>{let{orientation:a,scrollPrev:s,canScrollPrev:l}=nt();return(0,o.jsxs)(q,{ref:i,variant:t,size:n,className:U(`absolute h-8 w-8 rounded-full`,a===`horizontal`?`-left-12 top-1/2 -translate-y-1/2`:`-top-12 left-1/2 -translate-x-1/2 rotate-90`,e),disabled:!l,onClick:s,...r,children:[(0,o.jsx)(c.ArrowLeft,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Previous slide`})]})});ot.displayName=`CarouselPrevious`;var st=a.forwardRef(({className:e,variant:t=`outline`,size:n=`icon`,...r},i)=>{let{orientation:a,scrollNext:s,canScrollNext:l}=nt();return(0,o.jsxs)(q,{ref:i,variant:t,size:n,className:U(`absolute h-8 w-8 rounded-full`,a===`horizontal`?`-right-12 top-1/2 -translate-y-1/2`:`-bottom-12 left-1/2 -translate-x-1/2 rotate-90`,e),disabled:!l,onClick:s,...r,children:[(0,o.jsx)(c.ArrowRight,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Next slide`})]})});st.displayName=`CarouselNext`;var ct={light:``,dark:`.dark`},lt=a.createContext(null);function ut(){let e=a.useContext(lt);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}var dt=a.forwardRef(({id:e,className:t,children:n,config:r,...i},s)=>{let c=a.useId(),l=`chart-${e||c.replace(/:/g,``)}`;return(0,o.jsx)(lt.Provider,{value:{config:r},children:(0,o.jsxs)(`div`,{"data-chart":l,ref:s,className:U(`block aspect-video w-full text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none`,t),...i,children:[(0,o.jsx)(ft,{id:l,config:r}),(0,o.jsx)(g.ResponsiveContainer,{children:n})]})})});dt.displayName=`Chart`;var ft=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme||e.color);return n.length?(0,o.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(ct).map(([t,r])=>`
7
+ See documentation at https://www.objectui.org/docs/components for alternatives.`);let{"data-obj-id":i,"data-obj-type":a,style:s,...c}=n;return(0,o.jsx)(`span`,{ref:r,className:t,...c,"data-obj-id":i,"data-obj-type":a,style:s,children:G(e.body)})});t.ComponentRegistry.register(`span`,he,{namespace:`ui`,label:`Inline Container (Deprecated)`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{className:`px-1.5 py-0.5 sm:px-2 sm:py-1`},defaultChildren:[{type:`text`,content:`Inline text`}]});var ge=s.Root,_e=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(s.Item,{ref:n,className:W(`border-b`,e),...t}));_e.displayName=`AccordionItem`;var ve=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsx)(s.Header,{className:`flex`,children:(0,o.jsxs)(s.Trigger,{ref:r,className:W(`flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180`,e),...n,children:[t,(0,o.jsx)(c.ChevronDown,{className:`h-4 w-4 shrink-0 transition-transform duration-200`})]})}));ve.displayName=s.Trigger.displayName;var ye=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsx)(s.Content,{ref:r,className:`overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`,...n,children:(0,o.jsx)(`div`,{className:W(`pb-4 pt-0`,e),children:t})}));ye.displayName=s.Content.displayName;var be=(0,d.cva)(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-input bg-background hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-10 px-4 py-2`,sm:`h-9 rounded-md px-3`,lg:`h-11 rounded-md px-8`,icon:`h-10 w-10`}},defaultVariants:{variant:`default`,size:`default`}}),K=a.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,o.jsx)(r?u.Slot:`button`,{className:W(be({variant:t,size:n,className:e})),ref:a,...i}));K.displayName=`Button`;var q=l.Root,xe=l.Trigger,J=l.Portal,Se=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(l.Overlay,{className:W(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));Se.displayName=l.Overlay.displayName;var Ce=a.forwardRef(({className:e,...t},n)=>(0,o.jsxs)(J,{children:[(0,o.jsx)(Se,{}),(0,o.jsx)(l.Content,{ref:n,className:W(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...t})]}));Ce.displayName=l.Content.displayName;var we=({className:e,...t})=>(0,o.jsx)(`div`,{className:W(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});we.displayName=`AlertDialogHeader`;var Te=({className:e,...t})=>(0,o.jsx)(`div`,{className:W(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Te.displayName=`AlertDialogFooter`;var Ee=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(l.Title,{ref:n,className:W(`text-lg font-semibold`,e),...t}));Ee.displayName=l.Title.displayName;var De=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(l.Description,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));De.displayName=l.Description.displayName;var Oe=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(l.Action,{ref:n,className:W(be(),e),...t}));Oe.displayName=l.Action.displayName;var ke=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(l.Cancel,{ref:n,className:W(be({variant:`outline`}),`mt-2 sm:mt-0`,e),...t}));ke.displayName=l.Cancel.displayName;var Ae=(0,d.cva)(`relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground`,{variants:{variant:{default:`bg-background text-foreground`,destructive:`border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive`}},defaultVariants:{variant:`default`}}),je=a.forwardRef(({className:e,variant:t,...n},r)=>(0,o.jsx)(`div`,{ref:r,role:`alert`,className:W(Ae({variant:t}),e),...n}));je.displayName=`Alert`;var Me=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`h5`,{ref:n,className:W(`mb-1 font-medium leading-none tracking-tight`,e),...t}));Me.displayName=`AlertTitle`;var Y=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:W(`text-sm [&_p]:leading-relaxed`,e),...t}));Y.displayName=`AlertDescription`;var Ne=f.Root,Pe=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(p.Root,{ref:n,className:W(`relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full`,e),...t}));Pe.displayName=p.Root.displayName;var Fe=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(p.Image,{ref:n,className:W(`aspect-square h-full w-full`,e),...t}));Fe.displayName=p.Image.displayName;var Ie=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(p.Fallback,{ref:n,className:W(`flex h-full w-full items-center justify-center rounded-full bg-muted`,e),...t}));Ie.displayName=p.Fallback.displayName;var Le=(0,d.cva)(`inline-flex items-center whitespace-nowrap rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function Re({className:e,variant:t,...n}){return(0,o.jsx)(`div`,{className:W(Le({variant:t}),e),...n})}var ze=a.forwardRef(({...e},t)=>(0,o.jsx)(`nav`,{ref:t,"aria-label":`breadcrumb`,...e}));ze.displayName=`Breadcrumb`;var Be=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`ol`,{ref:n,className:W(`flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5`,e),...t}));Be.displayName=`BreadcrumbList`;var Ve=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`li`,{ref:n,className:W(`inline-flex items-center gap-1.5`,e),...t}));Ve.displayName=`BreadcrumbItem`;var He=a.forwardRef(({asChild:e,className:t,...n},r)=>(0,o.jsx)(e?u.Slot:`a`,{ref:r,className:W(`transition-colors hover:text-foreground`,t),...n}));He.displayName=`BreadcrumbLink`;var Ue=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`span`,{ref:n,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:W(`font-normal text-foreground`,e),...t}));Ue.displayName=`BreadcrumbPage`;var We=({children:e,className:t,...n})=>(0,o.jsx)(`li`,{role:`presentation`,"aria-hidden":`true`,className:W(`[&>svg]:w-3.5 [&>svg]:h-3.5`,t),...n,children:e??(0,o.jsx)(c.ChevronRight,{})});We.displayName=`BreadcrumbSeparator`;var Ge=({className:e,...t})=>(0,o.jsxs)(`span`,{role:`presentation`,"aria-hidden":`true`,className:W(`flex h-9 w-9 items-center justify-center`,e),...t,children:[(0,o.jsx)(c.MoreHorizontal,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`More`})]});Ge.displayName=`BreadcrumbElipssis`;function Ke({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:r=`label`,buttonVariant:i=`ghost`,formatters:a,components:s,...l}){let u=(0,m.getDefaultClassNames)();return(0,o.jsx)(m.DayPicker,{showOutsideDays:n,className:W(`bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent`,String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:r,formatters:{formatMonthDropdown:e=>e.toLocaleString(`default`,{month:`short`}),...a},classNames:{root:W(`w-fit`,u.root),months:W(`relative flex flex-col gap-4 md:flex-row`,u.months),month:W(`flex w-full flex-col gap-4`,u.month),nav:W(`absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1`,u.nav),button_previous:W(be({variant:i}),`h-(--cell-size) w-(--cell-size) select-none p-0 aria-disabled:opacity-50`,u.button_previous),button_next:W(be({variant:i}),`h-(--cell-size) w-(--cell-size) select-none p-0 aria-disabled:opacity-50`,u.button_next),month_caption:W(`flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)`,u.month_caption),dropdowns:W(`flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium`,u.dropdowns),dropdown_root:W(`has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border`,u.dropdown_root),dropdown:W(`bg-popover absolute inset-0 opacity-0`,u.dropdown),caption_label:W(`select-none font-medium`,r===`label`?`text-sm`:`[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5`,u.caption_label),weekdays:W(`flex`,u.weekdays),weekday:W(`text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal`,u.weekday),week:W(`mt-2 flex w-full`,u.week),week_number_header:W(`w-(--cell-size) select-none`,u.week_number_header),week_number:W(`text-muted-foreground select-none text-[0.8rem]`,u.week_number),day:W(`group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md`,u.day),range_start:W(`bg-accent rounded-l-md`,u.range_start),range_middle:W(`rounded-none`,u.range_middle),range_end:W(`bg-accent rounded-r-md`,u.range_end),today:W(`bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none`,u.today),outside:W(`text-muted-foreground aria-selected:text-muted-foreground`,u.outside),disabled:W(`text-muted-foreground opacity-50`,u.disabled),hidden:W(`invisible`,u.hidden),...t},components:{Root:({className:e,rootRef:t,...n})=>(0,o.jsx)(`div`,{"data-slot":`calendar`,ref:t,className:W(e),...n}),Chevron:({className:e,orientation:t,...n})=>t===`left`?(0,o.jsx)(c.ChevronLeftIcon,{className:W(`size-4`,e),...n}):t===`right`?(0,o.jsx)(c.ChevronRightIcon,{className:W(`size-4`,e),...n}):(0,o.jsx)(c.ChevronDownIcon,{className:W(`size-4`,e),...n}),DayButton:qe,WeekNumber:({children:e,...t})=>(0,o.jsx)(`td`,{...t,children:(0,o.jsx)(`div`,{className:`flex size-(--cell-size) items-center justify-center text-center`,children:e})}),...s},...l})}function qe({className:e,day:t,modifiers:n,...r}){let i=(0,m.getDefaultClassNames)(),s=a.useRef(null);return a.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),(0,o.jsx)(K,{ref:s,variant:`ghost`,size:`icon`,"data-day":t.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:W(`data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-(--cell-size) flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70`,i.day,e),...r})}var Je=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:W(`rounded-lg border bg-card text-card-foreground shadow-sm`,e),...t}));Je.displayName=`Card`;var Ye=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:W(`flex flex-col space-y-1.5 p-6`,e),...t}));Ye.displayName=`CardHeader`;var Xe=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:W(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));Xe.displayName=`CardTitle`;var Ze=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));Ze.displayName=`CardDescription`;var Qe=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:W(`p-6 pt-0`,e),...t}));Qe.displayName=`CardContent`;var $e=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:W(`flex items-center p-6 pt-0`,e),...t}));$e.displayName=`CardFooter`;var et=a.createContext(null);function tt(){let e=a.useContext(et);if(!e)throw Error(`useCarousel must be used within a <Carousel />`);return e}var nt=a.forwardRef(({orientation:e=`horizontal`,opts:t,setApi:n,plugins:r,className:i,children:s,...c},l)=>{let[u,d]=(0,h.default)({...t,axis:e===`horizontal`?`x`:`y`},r),[f,p]=a.useState(!1),[m,g]=a.useState(!1),_=a.useCallback(e=>{e&&(p(e.canScrollPrev()),g(e.canScrollNext()))},[]),v=a.useCallback(()=>{d?.scrollPrev()},[d]),y=a.useCallback(()=>{d?.scrollNext()},[d]),b=a.useCallback(e=>{e.key===`ArrowLeft`?(e.preventDefault(),v()):e.key===`ArrowRight`&&(e.preventDefault(),y())},[v,y]);return a.useEffect(()=>{!d||!n||n(d)},[d,n]),a.useEffect(()=>{if(d)return _(d),d.on(`reInit`,_),d.on(`select`,_),()=>{d?.off(`select`,_)}},[d,_]),(0,o.jsx)(et.Provider,{value:{carouselRef:u,api:d,opts:t,orientation:e||(t?.axis===`y`?`vertical`:`horizontal`),scrollPrev:v,scrollNext:y,canScrollPrev:f,canScrollNext:m},children:(0,o.jsx)(`div`,{ref:l,onKeyDownCapture:b,className:W(`relative`,i),role:`region`,"aria-roledescription":`carousel`,...c,children:s})})});nt.displayName=`Carousel`;var rt=a.forwardRef(({className:e,...t},n)=>{let{carouselRef:r,orientation:i}=tt();return(0,o.jsx)(`div`,{ref:r,className:`overflow-hidden`,children:(0,o.jsx)(`div`,{ref:n,className:W(`flex`,i===`horizontal`?`-ml-4`:`-mt-4 flex-col`,e),...t})})});rt.displayName=`CarouselContent`;var it=a.forwardRef(({className:e,...t},n)=>{let{orientation:r}=tt();return(0,o.jsx)(`div`,{ref:n,role:`group`,"aria-roledescription":`slide`,className:W(`min-w-0 shrink-0 grow-0 basis-full`,r===`horizontal`?`pl-4`:`pt-4`,e),...t})});it.displayName=`CarouselItem`;var at=a.forwardRef(({className:e,variant:t=`outline`,size:n=`icon`,...r},i)=>{let{orientation:a,scrollPrev:s,canScrollPrev:l}=tt();return(0,o.jsxs)(K,{ref:i,variant:t,size:n,className:W(`absolute h-8 w-8 rounded-full`,a===`horizontal`?`-left-12 top-1/2 -translate-y-1/2`:`-top-12 left-1/2 -translate-x-1/2 rotate-90`,e),disabled:!l,onClick:s,...r,children:[(0,o.jsx)(c.ArrowLeft,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Previous slide`})]})});at.displayName=`CarouselPrevious`;var ot=a.forwardRef(({className:e,variant:t=`outline`,size:n=`icon`,...r},i)=>{let{orientation:a,scrollNext:s,canScrollNext:l}=tt();return(0,o.jsxs)(K,{ref:i,variant:t,size:n,className:W(`absolute h-8 w-8 rounded-full`,a===`horizontal`?`-right-12 top-1/2 -translate-y-1/2`:`-bottom-12 left-1/2 -translate-x-1/2 rotate-90`,e),disabled:!l,onClick:s,...r,children:[(0,o.jsx)(c.ArrowRight,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Next slide`})]})});ot.displayName=`CarouselNext`;var st={light:``,dark:`.dark`},ct=a.createContext(null);function lt(){let e=a.useContext(ct);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}var ut=a.forwardRef(({id:e,className:t,children:n,config:r,...i},s)=>{let c=a.useId(),l=`chart-${e||c.replace(/:/g,``)}`;return(0,o.jsx)(ct.Provider,{value:{config:r},children:(0,o.jsxs)(`div`,{"data-chart":l,ref:s,className:W(`block aspect-video w-full text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none`,t),...i,children:[(0,o.jsx)(dt,{id:l,config:r}),(0,o.jsx)(g.ResponsiveContainer,{children:n})]})})});ut.displayName=`Chart`;var dt=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme||e.color);return n.length?(0,o.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(st).map(([t,r])=>`
8
8
  ${r} [data-chart=${e}] {
9
9
  ${n.map(([e,n])=>{let r=n.theme?.[t]||n.color;return r?` --color-${e}: ${r};`:null}).join(`
10
10
  `)}
11
11
  }
12
12
  `).join(`
13
- `)}}):null},pt=g.Tooltip,mt=a.forwardRef(({active:e,payload:t,className:n,indicator:r=`dot`,hideLabel:i=!1,hideIndicator:s=!1,label:c,labelFormatter:l,labelClassName:u,formatter:d,color:f,nameKey:p,labelKey:m},h)=>{let{config:g}=ut(),_=a.useMemo(()=>{if(i||!t?.length)return null;let[e]=t,n=`${m||e?.dataKey||e?.name||`value`}`,r=_t(g,e,n),a=!m&&typeof c==`string`?g[c]?.label||c:r?.label;return l?(0,o.jsx)(`div`,{className:U(`font-medium`,u),children:l(a,t)}):a?(0,o.jsx)(`div`,{className:U(`font-medium`,u),children:a}):null},[c,l,t,i,u,g,m]);if(!e||!t?.length)return null;let v=t.length===1&&r!==`dot`;return(0,o.jsxs)(`div`,{ref:h,className:U(`grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl`,n),children:[v?null:_,(0,o.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let n=`${p||e.name||e.dataKey||`value`}`,i=_t(g,e,n),a=f||e.payload.fill||e.color;return(0,o.jsx)(`div`,{className:U(`flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground`,r===`dot`&&`items-center`),children:d&&e?.value!==void 0&&e.name?d(e.value,e.name,e,t,e.payload):(0,o.jsxs)(o.Fragment,{children:[i?.icon?(0,o.jsx)(i.icon,{}):!s&&(0,o.jsx)(`div`,{className:U(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,{"h-2.5 w-2.5":r===`dot`,"w-1":r===`line`,"w-0 border-[1.5px] border-dashed bg-transparent":r===`dashed`,"my-0.5":v&&r===`dashed`}),style:{"--color-bg":a,"--color-border":a}}),(0,o.jsxs)(`div`,{className:U(`flex flex-1 justify-between leading-none`,v?`items-end`:`items-center`),children:[(0,o.jsxs)(`div`,{className:`grid gap-1.5`,children:[v?_:null,(0,o.jsx)(`span`,{className:`text-muted-foreground`,children:i?.label||e.name})]}),e.value&&(0,o.jsx)(`span`,{className:`font-mono font-medium tabular-nums text-foreground`,children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})});mt.displayName=`ChartTooltip`;var ht=g.Legend,gt=a.forwardRef(({className:e,hideIcon:t=!1,payload:n,verticalAlign:r=`bottom`,nameKey:i},a)=>{let{config:s}=ut();return n?.length?(0,o.jsx)(`div`,{ref:a,className:U(`flex items-center justify-center gap-4`,r===`top`?`pb-3`:`pt-3`,e),children:n.filter(e=>e.type!==`none`).map(e=>{let n=`${i||e.dataKey||`value`}`,r=_t(s,e,n);return(0,o.jsxs)(`div`,{className:U(`flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground`),children:[r?.icon&&!t?(0,o.jsx)(r.icon,{}):(0,o.jsx)(`div`,{className:`h-2 w-2 shrink-0 rounded-[2px]`,style:{backgroundColor:e.color}}),r?.label]},e.value)})}):null});gt.displayName=`ChartLegend`;function _t(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}var vt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(_.Root,{ref:n,className:U(`grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,e),...t,children:(0,o.jsx)(_.Indicator,{className:U(`grid place-content-center text-current`),children:(0,o.jsx)(c.Check,{className:`h-4 w-4`})})}));vt.displayName=_.Root.displayName;var yt=v.Root,bt=v.CollapsibleTrigger,xt=v.CollapsibleContent,St=b.Root,Ct=b.Trigger,wt=b.Portal,Tt=b.Close,Et=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(b.Overlay,{ref:n,className:U(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));Et.displayName=b.Overlay.displayName;var Dt=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(wt,{children:[(0,o.jsx)(Et,{}),(0,o.jsxs)(b.Content,{ref:r,className:U(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...n,children:[t,(0,o.jsxs)(b.Close,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,o.jsx)(c.X,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Dt.displayName=b.Content.displayName;var Ot=({className:e,...t})=>(0,o.jsx)(`div`,{className:U(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});Ot.displayName=`DialogHeader`;var kt=({className:e,...t})=>(0,o.jsx)(`div`,{className:U(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});kt.displayName=`DialogFooter`;var At=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(b.Title,{ref:n,className:U(`text-lg font-semibold leading-none tracking-tight`,e),...t}));At.displayName=b.Title.displayName;var jt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(b.Description,{ref:n,className:U(`text-sm text-muted-foreground`,e),...t}));jt.displayName=b.Description.displayName;var Mt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(y.Command,{ref:n,className:U(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t}));Mt.displayName=y.Command.displayName;var Nt=({children:e,contentProps:t,title:n=`Command Palette`,description:r,...i})=>{let{className:a,...s}=t??{};return(0,o.jsx)(St,{...i,children:(0,o.jsxs)(Dt,{className:U(`overflow-hidden p-0 shadow-lg`,a),...s,children:[(0,o.jsx)(At,{className:`sr-only`,children:n}),r?(0,o.jsx)(jt,{className:`sr-only`,children:r}):null,(0,o.jsx)(Mt,{className:`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:e})]})})},Pt=a.forwardRef(({className:e,...t},n)=>(0,o.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[(0,o.jsx)(c.Search,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),(0,o.jsx)(y.Command.Input,{ref:n,className:U(`flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]}));Pt.displayName=y.Command.Input.displayName;var Ft=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(y.Command.List,{ref:n,className:U(`max-h-[300px] overflow-y-auto overflow-x-hidden`,e),...t}));Ft.displayName=y.Command.List.displayName;var It=a.forwardRef((e,t)=>(0,o.jsx)(y.Command.Empty,{ref:t,className:`py-6 text-center text-sm`,...e}));It.displayName=y.Command.Empty.displayName;var Lt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(y.Command.Group,{ref:n,className:U(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t}));Lt.displayName=y.Command.Group.displayName;var Rt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(y.Command.Separator,{ref:n,className:U(`-mx-1 h-px bg-border`,e),...t}));Rt.displayName=y.Command.Separator.displayName;var zt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(y.Command.Item,{ref:n,className:U(`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,e),...t}));zt.displayName=y.Command.Item.displayName;var Bt=({className:e,...t})=>(0,o.jsx)(`span`,{className:U(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});Bt.displayName=`CommandShortcut`;var Vt=x.Root,Ht=x.Trigger,Ut=x.Group,Wt=x.Portal,Gt=x.Sub,Kt=x.RadioGroup,qt=a.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,o.jsxs)(x.SubTrigger,{ref:i,className:U(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground`,t&&`pl-8`,e),...r,children:[n,(0,o.jsx)(c.ChevronRight,{className:`ml-auto h-4 w-4`})]}));qt.displayName=x.SubTrigger.displayName;var Jt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(x.SubContent,{ref:n,className:U(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-context-menu-content-transform-origin)`,e),...t}));Jt.displayName=x.SubContent.displayName;var Yt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(x.Portal,{children:(0,o.jsx)(x.Content,{ref:n,className:U(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-context-menu-content-transform-origin)`,e),...t})}));Yt.displayName=x.Content.displayName;var Xt=a.forwardRef(({className:e,inset:t,...n},r)=>(0,o.jsx)(x.Item,{ref:r,className:U(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,t&&`pl-8`,e),...n}));Xt.displayName=x.Item.displayName;var Zt=a.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,o.jsxs)(x.CheckboxItem,{ref:i,className:U(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,o.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,o.jsx)(x.ItemIndicator,{children:(0,o.jsx)(c.Check,{className:`h-4 w-4`})})}),t]}));Zt.displayName=x.CheckboxItem.displayName;var Qt=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(x.RadioItem,{ref:r,className:U(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,o.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,o.jsx)(x.ItemIndicator,{children:(0,o.jsx)(c.Circle,{className:`h-2 w-2 fill-current`})})}),t]}));Qt.displayName=x.RadioItem.displayName;var $t=a.forwardRef(({className:e,inset:t,...n},r)=>(0,o.jsx)(x.Label,{ref:r,className:U(`px-2 py-1.5 text-sm font-semibold text-foreground`,t&&`pl-8`,e),...n}));$t.displayName=x.Label.displayName;var en=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(x.Separator,{ref:n,className:U(`-mx-1 my-1 h-px bg-border`,e),...t}));en.displayName=x.Separator.displayName;var tn=({className:e,...t})=>(0,o.jsx)(`span`,{className:U(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});tn.displayName=`ContextMenuShortcut`;var nn=({shouldScaleBackground:e=!0,...t})=>(0,o.jsx)(S.Drawer.Root,{shouldScaleBackground:e,...t});nn.displayName=`Drawer`;var rn=S.Drawer.Trigger,an=S.Drawer.Portal,on=S.Drawer.Close,sn=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(S.Drawer.Overlay,{ref:n,className:U(`fixed inset-0 z-50 bg-black/80`,e),...t}));sn.displayName=S.Drawer.Overlay.displayName;var cn=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(an,{children:[(0,o.jsx)(sn,{}),(0,o.jsxs)(S.Drawer.Content,{ref:r,className:U(`fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background`,e),...n,children:[(0,o.jsx)(`div`,{className:`mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted`}),t]})]}));cn.displayName=`DrawerContent`;var ln=({className:e,...t})=>(0,o.jsx)(`div`,{className:U(`grid gap-1.5 p-4 text-center sm:text-left`,e),...t});ln.displayName=`DrawerHeader`;var un=({className:e,...t})=>(0,o.jsx)(`div`,{className:U(`mt-auto flex flex-col gap-2 p-4`,e),...t});un.displayName=`DrawerFooter`;var dn=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(S.Drawer.Title,{ref:n,className:U(`text-lg font-semibold leading-none tracking-tight`,e),...t}));dn.displayName=S.Drawer.Title.displayName;var fn=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(S.Drawer.Description,{ref:n,className:U(`text-sm text-muted-foreground`,e),...t}));fn.displayName=S.Drawer.Description.displayName;var pn=C.Root,mn=C.Trigger,hn=C.Group,gn=C.Portal,_n=C.Sub,vn=C.RadioGroup,yn=a.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,o.jsxs)(C.SubTrigger,{ref:i,className:U(`flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...r,children:[n,(0,o.jsx)(c.ChevronRight,{className:`ml-auto`})]}));yn.displayName=C.SubTrigger.displayName;var bn=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(C.SubContent,{ref:n,className:U(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-dropdown-menu-content-transform-origin)`,e),...t}));bn.displayName=C.SubContent.displayName;var xn=a.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,o.jsx)(C.Portal,{children:(0,o.jsx)(C.Content,{ref:r,sideOffset:t,className:U(`z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-dropdown-menu-content-transform-origin)`,e),...n})}));xn.displayName=C.Content.displayName;var Sn=a.forwardRef(({className:e,inset:t,...n},r)=>(0,o.jsx)(C.Item,{ref:r,className:U(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...n}));Sn.displayName=C.Item.displayName;var Cn=a.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,o.jsxs)(C.CheckboxItem,{ref:i,className:U(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,o.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,o.jsx)(C.ItemIndicator,{children:(0,o.jsx)(c.Check,{className:`h-4 w-4`})})}),t]}));Cn.displayName=C.CheckboxItem.displayName;var wn=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(C.RadioItem,{ref:r,className:U(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,o.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,o.jsx)(C.ItemIndicator,{children:(0,o.jsx)(c.Circle,{className:`h-2 w-2 fill-current`})})}),t]}));wn.displayName=C.RadioItem.displayName;var Tn=a.forwardRef(({className:e,inset:t,...n},r)=>(0,o.jsx)(C.Label,{ref:r,className:U(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));Tn.displayName=C.Label.displayName;var En=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(C.Separator,{ref:n,className:U(`-mx-1 my-1 h-px bg-muted`,e),...t}));En.displayName=C.Separator.displayName;var Dn=({className:e,...t})=>(0,o.jsx)(`span`,{className:U(`ml-auto text-xs tracking-widest opacity-60`,e),...t});Dn.displayName=`DropdownMenuShortcut`;var On=(0,d.cva)(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),Y=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(T.Root,{ref:n,className:U(On(),e),...t}));Y.displayName=T.Root.displayName;var kn=w.FormProvider,An=a.createContext(null),jn=({...e})=>(0,o.jsx)(An.Provider,{value:{name:e.name},children:(0,o.jsx)(w.Controller,{...e})}),Mn=()=>{let e=a.useContext(An),t=a.useContext(Nn),{getFieldState:n,formState:r}=(0,w.useFormContext)();if(!e)throw Error(`useFormField should be used within <FormField>`);if(!t)throw Error(`useFormField should be used within <FormItem>`);let i=n(e.name,r),{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...i}},Nn=a.createContext(null),Pn=a.forwardRef(({className:e,...t},n)=>{let r=a.useId();return(0,o.jsx)(Nn.Provider,{value:{id:r},children:(0,o.jsx)(`div`,{ref:n,className:U(`space-y-2`,e),...t})})});Pn.displayName=`FormItem`;var Fn=a.forwardRef(({className:e,...t},n)=>{let{error:r,formItemId:i}=Mn();return(0,o.jsx)(Y,{ref:n,className:U(r&&`text-destructive`,e),htmlFor:i,...t})});Fn.displayName=`FormLabel`;var In=a.forwardRef(({...e},t)=>{let{error:n,formItemId:r,formDescriptionId:i,formMessageId:a}=Mn();return(0,o.jsx)(u.Slot,{ref:t,id:r,"aria-describedby":n?`${i} ${a}`:`${i}`,"aria-invalid":!!n,...e})});In.displayName=`FormControl`;var Ln=a.forwardRef(({className:e,...t},n)=>{let{formDescriptionId:r}=Mn();return(0,o.jsx)(`p`,{ref:n,id:r,className:U(`text-sm text-muted-foreground`,e),...t})});Ln.displayName=`FormDescription`;var Rn=a.forwardRef(({className:e,children:t,...n},r)=>{let{error:i,formMessageId:a}=Mn(),s=i?String(i?.message??``):t;return s?(0,o.jsx)(`p`,{ref:r,id:a,className:U(`text-sm font-medium text-destructive`,e),...n,children:s}):null});Rn.displayName=`FormMessage`;var zn=E.Root,Bn=E.Trigger,Vn=a.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...r},i)=>(0,o.jsx)(E.Content,{ref:i,align:t,sideOffset:n,className:U(`z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-hover-card-content-transform-origin)`,e),...r}));Vn.displayName=E.Content.displayName;var Hn=a.forwardRef(({className:e,containerClassName:t,...n},r)=>(0,o.jsx)(D.OTPInput,{ref:r,containerClassName:U(`flex items-center gap-2 has-[:disabled]:opacity-50`,t),className:U(`disabled:cursor-not-allowed`,e),...n}));Hn.displayName=`InputOTP`;var Un=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:U(`flex items-center`,e),...t}));Un.displayName=`InputOTPGroup`;var Wn=a.forwardRef(({index:e,className:t,...n},r)=>{let{char:i,hasFakeCaret:s,isActive:c}=a.useContext(D.OTPInputContext).slots[e];return(0,o.jsxs)(`div`,{ref:r,className:U(`relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md`,c&&`z-10 ring-2 ring-ring ring-offset-background`,t),...n,children:[i,s&&(0,o.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,o.jsx)(`div`,{className:`h-4 w-px animate-caret-blink bg-foreground duration-1000`})})]})});Wn.displayName=`InputOTPSlot`;var Gn=a.forwardRef(({...e},t)=>(0,o.jsx)(`div`,{ref:t,role:`separator`,...e,children:(0,o.jsx)(c.Dot,{})}));Gn.displayName=`InputOTPSeparator`;var X=a.forwardRef(({className:e,type:t,...n},r)=>(0,o.jsx)(`input`,{type:t,className:U(`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,e),ref:r,...n}));X.displayName=`Input`;function Kn({...e}){return(0,o.jsx)(O.Menu,{...e})}function qn({...e}){return(0,o.jsx)(O.Group,{...e})}function Jn({...e}){return(0,o.jsx)(O.Portal,{...e})}function Yn({...e}){return(0,o.jsx)(O.RadioGroup,{...e})}function Xn({...e}){return(0,o.jsx)(O.Sub,{"data-slot":`menubar-sub`,...e})}var Zn=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(O.Root,{ref:n,className:U(`flex h-10 items-center space-x-1 rounded-md border bg-background p-1`,e),...t}));Zn.displayName=O.Root.displayName;var Qn=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(O.Trigger,{ref:n,className:U(`flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground`,e),...t}));Qn.displayName=O.Trigger.displayName;var $n=a.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,o.jsxs)(O.SubTrigger,{ref:i,className:U(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground`,t&&`pl-8`,e),...r,children:[n,(0,o.jsx)(c.ChevronRight,{className:`ml-auto h-4 w-4`})]}));$n.displayName=O.SubTrigger.displayName;var er=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(O.SubContent,{ref:n,className:U(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-menubar-content-transform-origin)`,e),...t}));er.displayName=O.SubContent.displayName;var tr=a.forwardRef(({className:e,align:t=`start`,alignOffset:n=-4,sideOffset:r=8,...i},a)=>(0,o.jsx)(O.Portal,{children:(0,o.jsx)(O.Content,{ref:a,align:t,alignOffset:n,sideOffset:r,className:U(`z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-menubar-content-transform-origin)`,e),...i})}));tr.displayName=O.Content.displayName;var nr=a.forwardRef(({className:e,inset:t,...n},r)=>(0,o.jsx)(O.Item,{ref:r,className:U(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,t&&`pl-8`,e),...n}));nr.displayName=O.Item.displayName;var rr=a.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,o.jsxs)(O.CheckboxItem,{ref:i,className:U(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,o.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,o.jsx)(O.ItemIndicator,{children:(0,o.jsx)(c.Check,{className:`h-4 w-4`})})}),t]}));rr.displayName=O.CheckboxItem.displayName;var ir=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(O.RadioItem,{ref:r,className:U(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,o.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,o.jsx)(O.ItemIndicator,{children:(0,o.jsx)(c.Circle,{className:`h-2 w-2 fill-current`})})}),t]}));ir.displayName=O.RadioItem.displayName;var ar=a.forwardRef(({className:e,inset:t,...n},r)=>(0,o.jsx)(O.Label,{ref:r,className:U(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));ar.displayName=O.Label.displayName;var or=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(O.Separator,{ref:n,className:U(`-mx-1 my-1 h-px bg-muted`,e),...t}));or.displayName=O.Separator.displayName;var sr=({className:e,...t})=>(0,o.jsx)(`span`,{className:U(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});sr.displayname=`MenubarShortcut`;var cr=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(k.Root,{ref:r,className:U(`relative z-10 flex max-w-max flex-1 items-center justify-center`,e),...n,children:[t,(0,o.jsx)(hr,{})]}));cr.displayName=k.Root.displayName;var lr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(k.List,{ref:n,className:U(`group flex flex-1 list-none items-center justify-center space-x-1`,e),...t}));lr.displayName=k.List.displayName;var ur=k.Item,dr=(0,d.cva)(`group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=open]:text-accent-foreground data-[state=open]:bg-accent/50 data-[state=open]:hover:bg-accent data-[state=open]:focus:bg-accent`),fr=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(k.Trigger,{ref:r,className:U(dr(),`group`,e),...n,children:[t,` `,(0,o.jsx)(c.ChevronDown,{className:`relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180`,"aria-hidden":`true`})]}));fr.displayName=k.Trigger.displayName;var pr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(k.Content,{ref:n,className:U(`left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto `,e),...t}));pr.displayName=k.Content.displayName;var mr=k.Link,hr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{className:U(`absolute left-0 top-full flex justify-center`),children:(0,o.jsx)(k.Viewport,{className:U(`origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]`,e),ref:n,...t})}));hr.displayName=k.Viewport.displayName;var gr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(k.Indicator,{ref:n,className:U(`top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in`,e),...t,children:(0,o.jsx)(`div`,{className:`relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md`})}));gr.displayName=k.Indicator.displayName;var _r=({className:e,...t})=>(0,o.jsx)(`nav`,{role:`navigation`,"aria-label":`pagination`,className:U(`mx-auto flex w-full justify-center`,e),...t});_r.displayName=`Pagination`;var vr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`ul`,{ref:n,className:U(`flex flex-row items-center gap-1`,e),...t}));vr.displayName=`PaginationContent`;var yr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`li`,{ref:n,className:U(``,e),...t}));yr.displayName=`PaginationItem`;var br=({className:e,isActive:t,size:n=`icon`,...r})=>(0,o.jsx)(`a`,{"aria-current":t?`page`:void 0,className:U(K({variant:t?`outline`:`ghost`,size:n}),e),...r});br.displayName=`PaginationLink`;var xr=({className:e,...t})=>(0,o.jsxs)(br,{"aria-label":`Go to previous page`,size:`default`,className:U(`gap-1 pl-2.5`,e),...t,children:[(0,o.jsx)(c.ChevronLeft,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:`Previous`})]});xr.displayName=`PaginationPrevious`;var Sr=({className:e,...t})=>(0,o.jsxs)(br,{"aria-label":`Go to next page`,size:`default`,className:U(`gap-1 pr-2.5`,e),...t,children:[(0,o.jsx)(`span`,{children:`Next`}),(0,o.jsx)(c.ChevronRight,{className:`h-4 w-4`})]});Sr.displayName=`PaginationNext`;var Cr=({className:e,...t})=>(0,o.jsxs)(`span`,{"aria-hidden":!0,className:U(`flex h-9 w-9 items-center justify-center`,e),...t,children:[(0,o.jsx)(c.MoreHorizontal,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`More pages`})]});Cr.displayName=`PaginationEllipsis`;var wr=A.Root,Tr=A.Trigger,Er=a.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...r},i)=>(0,o.jsx)(A.Portal,{children:(0,o.jsx)(A.Content,{ref:i,align:t,sideOffset:n,className:U(`z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-popover-content-transform-origin)`,e),...r})}));Er.displayName=A.Content.displayName;var Dr=a.forwardRef(({className:e,value:t,...n},r)=>(0,o.jsx)(j.Root,{ref:r,className:U(`relative h-4 w-full overflow-hidden rounded-full bg-secondary`,e),...n,children:(0,o.jsx)(j.Indicator,{className:`h-full w-full flex-1 bg-primary transition-all`,style:{transform:`translateX(-${100-(t||0)}%)`}})}));Dr.displayName=j.Root.displayName;var Or=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(M.Root,{className:U(`grid gap-2`,e),...t,ref:n}));Or.displayName=M.Root.displayName;var kr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(M.Item,{ref:n,className:U(`aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,o.jsx)(M.Indicator,{className:`flex items-center justify-center`,children:(0,o.jsx)(c.Circle,{className:`h-2.5 w-2.5 fill-current text-current`})})}));kr.displayName=M.Item.displayName;var Ar=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(N.Root,{ref:r,className:U(`relative overflow-hidden`,e),...n,children:[(0,o.jsx)(N.Viewport,{className:`h-full w-full rounded-[inherit]`,children:t}),(0,o.jsx)(jr,{}),(0,o.jsx)(N.Corner,{})]}));Ar.displayName=N.Root.displayName;var jr=a.forwardRef(({className:e,orientation:t=`vertical`,...n},r)=>(0,o.jsx)(N.ScrollAreaScrollbar,{ref:r,orientation:t,className:U(`flex touch-none select-none transition-colors`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent p-[1px]`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent p-[1px]`,e),...n,children:(0,o.jsx)(N.ScrollAreaThumb,{className:`relative flex-1 rounded-full bg-border`})}));jr.displayName=N.ScrollAreaScrollbar.displayName;var Mr=({onValueChange:e,...t})=>{let n=a.useCallback(t=>{t!==``&&e?.(t)},[e]);return(0,o.jsx)(P.Root,{...t,onValueChange:n})};Mr.displayName=P.Root.displayName;var Nr=P.Group,Pr=P.Value,Fr=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(P.Trigger,{ref:r,className:U(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,o.jsx)(P.Icon,{asChild:!0,children:(0,o.jsx)(c.ChevronDown,{className:`h-4 w-4 opacity-50`})})]}));Fr.displayName=P.Trigger.displayName;var Ir=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(P.ScrollUpButton,{ref:n,className:U(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,o.jsx)(c.ChevronUp,{className:`h-4 w-4`})}));Ir.displayName=P.ScrollUpButton.displayName;var Lr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(P.ScrollDownButton,{ref:n,className:U(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,o.jsx)(c.ChevronDown,{className:`h-4 w-4`})}));Lr.displayName=P.ScrollDownButton.displayName;var Rr=a.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,o.jsx)(P.Portal,{children:(0,o.jsxs)(P.Content,{ref:i,className:U(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-select-content-transform-origin)`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,o.jsx)(Ir,{}),(0,o.jsx)(P.Viewport,{className:U(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,o.jsx)(Lr,{})]})}));Rr.displayName=P.Content.displayName;var zr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(P.Label,{ref:n,className:U(`py-1.5 pl-8 pr-2 text-sm font-semibold`,e),...t}));zr.displayName=P.Label.displayName;var Z=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(P.Item,{ref:r,className:U(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,o.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,o.jsx)(P.ItemIndicator,{children:(0,o.jsx)(c.Check,{className:`h-4 w-4`})})}),(0,o.jsx)(P.ItemText,{children:t})]}));Z.displayName=P.Item.displayName;var Br=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(P.Separator,{ref:n,className:U(`-mx-1 my-1 h-px bg-muted`,e),...t}));Br.displayName=P.Separator.displayName;var Vr=a.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,o.jsx)(F.Root,{ref:i,decorative:n,orientation:t,className:U(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));Vr.displayName=F.Root.displayName;var Hr=b.Root,Ur=b.Trigger,Wr=b.Close,Gr=b.Portal,Kr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(b.Overlay,{className:U(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));Kr.displayName=b.Overlay.displayName;var qr=(0,d.cva)(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),Jr=a.forwardRef(({side:e=`right`,className:t,children:n,hideOverlay:r,...i},a)=>(0,o.jsxs)(Gr,{children:[!r&&(0,o.jsx)(Kr,{}),(0,o.jsxs)(b.Content,{ref:a,className:U(qr({side:e}),t),...i,children:[n,(0,o.jsxs)(b.Close,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,o.jsx)(c.X,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Jr.displayName=b.Content.displayName;var Yr=({className:e,...t})=>(0,o.jsx)(`div`,{className:U(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});Yr.displayName=`SheetHeader`;var Xr=({className:e,...t})=>(0,o.jsx)(`div`,{className:U(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Xr.displayName=`SheetFooter`;var Zr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(b.Title,{ref:n,className:U(`text-lg font-semibold text-foreground`,e),...t}));Zr.displayName=b.Title.displayName;var Qr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(b.Description,{ref:n,className:U(`text-sm text-muted-foreground`,e),...t}));Qr.displayName=b.Description.displayName;var $r=768;function ei(){let[e,t]=a.useState(void 0);return a.useEffect(()=>{let e=window.matchMedia(`(max-width: ${$r-1}px)`),n=()=>{t(window.innerWidth<$r)};return e.addEventListener(`change`,n),t(window.innerWidth<$r),()=>e.removeEventListener(`change`,n)},[]),!!e}function Q({className:e,...t}){return(0,o.jsx)(`div`,{className:U(`animate-pulse rounded-md bg-muted`,e),...t})}var ti=I.Provider,ni=I.Root,ri=I.Trigger,ii=a.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,o.jsx)(I.Content,{ref:r,sideOffset:t,className:U(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-tooltip-content-transform-origin)`,e),...n}));ii.displayName=I.Content.displayName;var ai=`sidebar_state`,oi=3600*24*7,si=`16rem`,ci=`18rem`,li=`3rem`,ui=`b`,di=a.createContext(null);function fi(){let e=a.useContext(di);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}var pi=a.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:s,...c},l)=>{let u=ei(),[d,f]=a.useState(!1),[p,m]=a.useState(e),h=t??p,g=a.useCallback(e=>{let t=typeof e==`function`?e(h):e;n?n(t):m(t),document.cookie=`${ai}=${t}; path=/; max-age=${oi}`},[n,h]),_=a.useCallback(()=>u?f(e=>!e):g(e=>!e),[u,g,f]);a.useEffect(()=>{let e=e=>{e.key===ui&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),_())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[_]);let v=h?`expanded`:`collapsed`,y=a.useMemo(()=>({state:v,open:h,setOpen:g,isMobile:u,openMobile:d,setOpenMobile:f,toggleSidebar:_}),[v,h,g,u,d,f,_]);return(0,o.jsx)(di.Provider,{value:y,children:(0,o.jsx)(ti,{delayDuration:0,children:(0,o.jsx)(`div`,{style:{"--sidebar-width":si,"--sidebar-width-icon":li,...i},className:U(`group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar`,r),ref:l,...c,children:s})})})});pi.displayName=`SidebarProvider`;var mi=a.forwardRef(({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,...a},s)=>{let{isMobile:c,state:l,openMobile:u,setOpenMobile:d}=fi();return n===`none`?(0,o.jsx)(`div`,{className:U(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),ref:s,...a,children:i}):c?(0,o.jsx)(Hr,{open:u,onOpenChange:d,...a,children:(0,o.jsxs)(Jr,{"data-sidebar":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden data-[state=open]:duration-300 data-[state=open]:ease-out`,style:{"--sidebar-width":ci},side:e,children:[(0,o.jsxs)(Yr,{className:`sr-only`,children:[(0,o.jsx)(Zr,{children:`Sidebar`}),(0,o.jsx)(Qr,{children:`Displays the mobile sidebar.`})]}),(0,o.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,o.jsxs)(`div`,{ref:s,className:`group peer hidden text-sidebar-foreground md:block`,"data-state":l,"data-collapsible":n,"data-variant":t,"data-side":e,children:[(0,o.jsx)(`div`,{className:U(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[state=collapsed]:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_1rem)]`:`group-data-[state=collapsed]:group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,o.jsx)(`div`,{className:U(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex`,e===`left`?`left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]`:`right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,t===`floating`||t===`inset`?`p-2 group-data-[state=collapsed]:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_1rem_+_2px)]`:`group-data-[state=collapsed]:group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...a,children:(0,o.jsx)(`div`,{"data-sidebar":`sidebar`,className:`flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow`,children:i})})]})});mi.displayName=`Sidebar`;var hi=a.forwardRef(({className:e,onClick:t,...n},r)=>{let{toggleSidebar:i}=fi();return(0,o.jsxs)(q,{ref:r,"data-sidebar":`trigger`,variant:`ghost`,size:`icon`,className:U(`h-7 w-7`,e),onClick:e=>{t?.(e),i()},...n,children:[(0,o.jsx)(c.PanelLeft,{}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})});hi.displayName=`SidebarTrigger`;var gi=a.forwardRef(({className:e,...t},n)=>{let{toggleSidebar:r}=fi();return(0,o.jsx)(`button`,{ref:n,"data-sidebar":`rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onClick:r,title:`Toggle Sidebar`,className:U(`absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex`,`[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,e),...t})});gi.displayName=`SidebarRail`;var _i=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`main`,{ref:n,className:U(`relative flex w-full flex-1 flex-col bg-background`,`md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow`,e),...t}));_i.displayName=`SidebarInset`;var vi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(X,{ref:n,"data-sidebar":`input`,className:U(`h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring`,e),...t}));vi.displayName=`SidebarInput`;var yi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,"data-sidebar":`header`,className:U(`flex flex-col gap-2 p-2`,e),...t}));yi.displayName=`SidebarHeader`;var bi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,"data-sidebar":`footer`,className:U(`flex flex-col gap-2 p-2`,e),...t}));bi.displayName=`SidebarFooter`;var xi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(Vr,{ref:n,"data-sidebar":`separator`,className:U(`mx-2 w-auto bg-sidebar-border`,e),...t}));xi.displayName=`SidebarSeparator`;var Si=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,"data-sidebar":`content`,className:U(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[state=collapsed]:group-data-[collapsible=icon]:overflow-hidden`,e),...t}));Si.displayName=`SidebarContent`;var Ci=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,"data-sidebar":`group`,className:U(`relative flex w-full min-w-0 flex-col p-2`,e),...t}));Ci.displayName=`SidebarGroup`;var wi=a.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,o.jsx)(t?u.Slot:`div`,{ref:r,"data-sidebar":`group-label`,className:U(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`group-data-[state=collapsed]:group-data-[collapsible=icon]:-mt-8 group-data-[state=collapsed]:group-data-[collapsible=icon]:opacity-0`,e),...n}));wi.displayName=`SidebarGroupLabel`;var Ti=a.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,o.jsx)(t?u.Slot:`button`,{ref:r,"data-sidebar":`group-action`,className:U(`absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`group-data-[state=collapsed]:group-data-[collapsible=icon]:hidden`,e),...n}));Ti.displayName=`SidebarGroupAction`;var Ei=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,"data-sidebar":`group-content`,className:U(`w-full text-sm`,e),...t}));Ei.displayName=`SidebarGroupContent`;var Di=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`ul`,{ref:n,"data-sidebar":`menu`,className:U(`flex w-full min-w-0 flex-col gap-1`,e),...t}));Di.displayName=`SidebarMenu`;var Oi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`li`,{ref:n,"data-sidebar":`menu-item`,className:U(`group/menu-item relative`,e),...t}));Oi.displayName=`SidebarMenuItem`;var ki=(0,d.cva)(`peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding,color,background-color] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground sidebar-menu-button-icon-mode [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm sidebar-menu-button-icon-mode-lg`}},defaultVariants:{variant:`default`,size:`default`}}),Ai=a.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...s},c)=>{let l=e?u.Slot:`button`,{isMobile:d,state:f}=fi(),p=(0,o.jsx)(l,{ref:c,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:U(ki({variant:n,size:r}),a),...s});return i?(typeof i==`string`&&(i={children:i}),(0,o.jsxs)(ni,{children:[(0,o.jsx)(ri,{asChild:!0,children:p}),(0,o.jsx)(ii,{side:`right`,align:`center`,hidden:f!==`collapsed`||d,...i})]})):p});Ai.displayName=`SidebarMenuButton`;var ji=a.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>(0,o.jsx)(t?u.Slot:`button`,{ref:i,"data-sidebar":`menu-action`,className:U(`absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[state=collapsed]:group-data-[collapsible=icon]:hidden`,n&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0`,e),...r}));ji.displayName=`SidebarMenuAction`;var Mi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,"data-sidebar":`menu-badge`,className:U(`pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground`,`peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[state=collapsed]:group-data-[collapsible=icon]:hidden`,e),...t}));Mi.displayName=`SidebarMenuBadge`;var Ni=a.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{let i=a.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return(0,o.jsxs)(`div`,{ref:r,"data-sidebar":`menu-skeleton`,className:U(`flex h-8 items-center gap-2 rounded-md px-2`,e),...n,children:[t&&(0,o.jsx)(Q,{className:`size-4 rounded-md`,"data-sidebar":`menu-skeleton-icon`}),(0,o.jsx)(Q,{className:`h-4 max-w-(--skeleton-width) flex-1`,"data-sidebar":`menu-skeleton-text`,style:{"--skeleton-width":i}})]})});Ni.displayName=`SidebarMenuSkeleton`;var Pi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`ul`,{ref:n,"data-sidebar":`menu-sub`,className:U(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5`,`group-data-[state=collapsed]:group-data-[collapsible=icon]:hidden`,e),...t}));Pi.displayName=`SidebarMenuSub`;var Fi=a.forwardRef(({...e},t)=>(0,o.jsx)(`li`,{ref:t,...e}));Fi.displayName=`SidebarMenuSubItem`;var Ii=a.forwardRef(({asChild:e=!1,size:t=`md`,isActive:n,className:r,...i},a)=>(0,o.jsx)(e?u.Slot:`a`,{ref:a,"data-sidebar":`menu-sub-button`,"data-size":t,"data-active":n,className:U(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,`data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground`,t===`sm`&&`text-xs`,t===`md`&&`text-sm`,`group-data-[state=collapsed]:group-data-[collapsible=icon]:hidden`,r),...i}));Ii.displayName=`SidebarMenuSubButton`;var Li=a.forwardRef(({className:e,...t},n)=>(0,o.jsxs)(ee.Root,{ref:n,className:U(`relative flex w-full touch-none select-none items-center`,e),...t,children:[(0,o.jsx)(ee.Track,{className:`relative h-2 w-full grow overflow-hidden rounded-full bg-secondary`,children:(0,o.jsx)(ee.Range,{className:`absolute h-full bg-primary`})}),(0,o.jsx)(ee.Thumb,{className:`block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,"aria-label":t[`aria-label`]})]}));Li.displayName=ee.Root.displayName;var Ri=({...e})=>{let{theme:t=`system`}=(0,te.useTheme)();return(0,o.jsx)(ne.Toaster,{theme:t,className:`toaster group`,icons:{success:(0,o.jsx)(c.CircleCheck,{className:`h-4 w-4`}),info:(0,o.jsx)(c.Info,{className:`h-4 w-4`}),warning:(0,o.jsx)(c.TriangleAlert,{className:`h-4 w-4`}),error:(0,o.jsx)(c.OctagonX,{className:`h-4 w-4`}),loading:(0,o.jsx)(c.LoaderCircle,{className:`h-4 w-4 animate-spin`})},toastOptions:{classNames:{toast:`group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg`,description:`group-[.toast]:text-muted-foreground`,actionButton:`group-[.toast]:bg-primary group-[.toast]:text-primary-foreground`,cancelButton:`group-[.toast]:bg-muted group-[.toast]:text-muted-foreground`}},...e})},zi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(L.Root,{className:U(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...t,ref:n,children:(0,o.jsx)(L.Thumb,{className:U(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)})}));zi.displayName=L.Root.displayName;var Bi=a.forwardRef(({className:e,containerClassName:t,...n},r)=>(0,o.jsx)(`div`,{className:U(`relative w-full overflow-auto`,t),children:(0,o.jsx)(`table`,{ref:r,className:U(`w-full caption-bottom text-sm`,e),...n})}));Bi.displayName=`Table`;var Vi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`thead`,{ref:n,className:U(`[&_tr]:border-b`,e),...t}));Vi.displayName=`TableHeader`;var Hi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`tbody`,{ref:n,className:U(`[&_tr:last-child]:border-0`,e),...t}));Hi.displayName=`TableBody`;var Ui=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`tfoot`,{ref:n,className:U(`border-t bg-muted/50 font-medium [&>tr]:last:border-b-0`,e),...t}));Ui.displayName=`TableFooter`;var Wi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`tr`,{ref:n,className:U(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,e),...t}));Wi.displayName=`TableRow`;var Gi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`th`,{ref:n,className:U(`h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0`,e),...t}));Gi.displayName=`TableHead`;var Ki=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`td`,{ref:n,className:U(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,e),...t}));Ki.displayName=`TableCell`;var qi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`caption`,{ref:n,className:U(`mt-4 text-sm text-muted-foreground`,e),...t}));qi.displayName=`TableCaption`;var Ji=R.Root,Yi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(R.List,{ref:n,className:U(`inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground`,e),...t}));Yi.displayName=R.List.displayName;var Xi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(R.Trigger,{ref:n,className:U(`inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm`,e),...t}));Xi.displayName=R.Trigger.displayName;var Zi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(R.Content,{ref:n,className:U(`mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,e),...t}));Zi.displayName=R.Content.displayName;var Qi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`textarea`,{className:U(`flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,e),ref:n,...t}));Qi.displayName=`Textarea`;var $i=(0,d.cva)(`inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 gap-2`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-accent hover:text-accent-foreground`},size:{default:`h-10 px-3 min-w-10`,sm:`h-9 px-2.5 min-w-9`,lg:`h-11 px-5 min-w-11`}},defaultVariants:{variant:`default`,size:`default`}}),ea=a.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,o.jsx)(re.Root,{ref:i,className:U($i({variant:t,size:n,className:e})),...r}));ea.displayName=re.Root.displayName;var ta=a.createContext({size:`default`,variant:`default`}),na=a.forwardRef(({className:e,variant:t,size:n,children:r,...i},a)=>(0,o.jsx)(z.Root,{ref:a,className:U(`flex items-center justify-center gap-1`,e),...i,children:(0,o.jsx)(ta.Provider,{value:{variant:t,size:n},children:r})}));na.displayName=z.Root.displayName;var ra=a.forwardRef(({className:e,children:t,variant:n,size:r,...i},s)=>{let c=a.useContext(ta);return(0,o.jsx)(z.Item,{ref:s,className:U($i({variant:c.variant||n,size:c.size||r}),e),...i,children:t})});ra.displayName=z.Item.displayName;var ia=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`h1`,{ref:n,className:U(`scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl`,e),...t}));ia.displayName=`TypographyH1`;var aa=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`h2`,{ref:n,className:U(`scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0`,e),...t}));aa.displayName=`TypographyH2`;var oa=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`h3`,{ref:n,className:U(`scroll-m-20 text-2xl font-semibold tracking-tight`,e),...t}));oa.displayName=`TypographyH3`;var sa=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`h4`,{ref:n,className:U(`scroll-m-20 text-xl font-semibold tracking-tight`,e),...t}));sa.displayName=`TypographyH4`;var ca=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`p`,{ref:n,className:U(`leading-7 [&:not(:first-child)]:mt-6`,e),...t}));ca.displayName=`TypographyP`;var la=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`blockquote`,{ref:n,className:U(`mt-6 border-l-2 pl-6 italic`,e),...t}));la.displayName=`TypographyBlockquote`;var ua=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`ul`,{ref:n,className:U(`my-6 ml-6 list-disc [&>li]:mt-2`,e),...t}));ua.displayName=`TypographyList`;var da=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`code`,{ref:n,className:U(`relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold`,e),...t}));da.displayName=`TypographyInlineCode`;var fa=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`p`,{ref:n,className:U(`text-xl text-muted-foreground`,e),...t}));fa.displayName=`TypographyLead`;var pa=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:U(`text-lg font-semibold`,e),...t}));pa.displayName=`TypographyLarge`;var ma=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`small`,{ref:n,className:U(`text-sm font-medium leading-none`,e),...t}));ma.displayName=`TypographySmall`;var ha=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`p`,{ref:n,className:U(`text-sm text-muted-foreground`,e),...t}));ha.displayName=`TypographyMuted`;var ga=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let{"data-obj-id":i,"data-obj-type":a,style:s,...c}=n;return(0,o.jsx)(Vr,{ref:r,orientation:e.orientation,className:t,...c,"data-obj-id":i,"data-obj-type":a,style:s})});t.ComponentRegistry.register(`separator`,ga,{namespace:`ui`,label:`Separator`,inputs:[{name:`orientation`,type:`enum`,enum:[`horizontal`,`vertical`],defaultValue:`horizontal`,label:`Orientation`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{orientation:`horizontal`,className:`my-2 sm:my-4`}}),t.ComponentRegistry.register(`image`,({schema:e,className:t,...n})=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=n;return(0,o.jsx)(`img`,{src:e.src,alt:e.alt||``,className:t,...s,"data-obj-id":r,"data-obj-type":i,style:a})},{namespace:`ui`,label:`Image`,icon:`image`,category:`basic`,inputs:[{name:`src`,type:`string`,label:`Source URL`},{name:`alt`,type:`string`,label:`Alt Text`},{name:`className`,type:`string`,label:`Classes`}],defaultProps:{className:`max-w-full h-auto`}});function _a(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}var va={Home:`House`},ya=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let{"data-obj-id":i,"data-obj-type":a,style:s,...l}=n,u=_a(e.name),d=va[u]||u,f=c.icons[d];if(!f)return console.warn(`Icon "${e.name}" (lookup: "${u}"${d===u?``:` -> "${d}"`}) not found in lucide-react`),null;let p=e.size?{width:e.size,height:e.size}:void 0;return(0,o.jsx)(f,{ref:r,className:U(e.color,e.className,t),style:{...p,...s},...l,"data-obj-id":i,"data-obj-type":a})});ya.displayName=`IconRenderer`,t.ComponentRegistry.register(`icon`,ya,{namespace:`ui`,label:`Icon`,icon:`smile`,category:`basic`,inputs:[{name:`name`,type:`string`,label:`Icon Name`,defaultValue:`smile`},{name:`size`,type:`number`,label:`Size (px)`},{name:`color`,type:`string`,label:`Color Class`},{name:`className`,type:`string`,label:`CSS Class`}]}),t.ComponentRegistry.register(`html`,({schema:e,className:t,...n})=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=n;return(0,o.jsx)(`div`,{className:U(`prose prose-sm max-w-none dark:prose-invert`,t),dangerouslySetInnerHTML:{__html:e.html},...s,"data-obj-id":r,"data-obj-type":i,style:a})},{namespace:`ui`,label:`HTML Content`,inputs:[{name:`html`,type:`string`,label:`HTML`,description:`Raw HTML content`}]});var ba=new Set([`img`,`hr`,`br`]),xa=`h1.h2.h3.h4.h5.h6.p.a.blockquote.pre.strong.em.b.i.u.small.mark.sub.sup.del.ins.abbr.ul.ol.li.dl.dt.dd.figure.figcaption.img.hr.br.time.address.cite.kbd.q`.split(`.`),Sa={a:[{name:`href`,type:`string`,label:`Link URL`},{name:`target`,type:`string`,label:`Target`},{name:`rel`,type:`string`,label:`Rel`},{name:`title`,type:`string`,label:`Title`}],img:[{name:`src`,type:`string`,label:`Image URL`},{name:`alt`,type:`string`,label:`Alt text`},{name:`width`,type:`number`,label:`Width`},{name:`height`,type:`number`,label:`Height`},{name:`title`,type:`string`,label:`Title`}],time:[{name:`dateTime`,type:`string`,label:`Datetime`}],abbr:[{name:`title`,type:`string`,label:`Title`}],q:[{name:`cite`,type:`string`,label:`Cite`}],blockquote:[{name:`cite`,type:`string`,label:`Cite`}]};function Ca(e){if(typeof e!=`string`)return;let t=e.trim();if(!/^(javascript|data|vbscript):/i.test(t))return t}function wa(e){if(typeof e!=`string`||e.trim().length===0)return null;let t=e.trim();if(/^[a-z][a-z0-9+.-]*:/i.test(t)||t.startsWith(`//`)||t.startsWith(`#`))return null;try{let e=new URL(t,`https://internal.invalid/`);return e.pathname+e.search+e.hash}catch{return null}}for(let e of xa){let n=ba.has(e),r=(0,a.forwardRef)(({schema:t,className:r,...o},s)=>{let{"data-obj-id":c,"data-obj-type":l,style:u,dangerouslySetInnerHTML:d,children:f,...p}=o,m={};for(let[e,t]of Object.entries(p))/^on[A-Z]/.test(e)||(m[e]=t);e===`a`&&`href`in m&&(m.href=Ca(m.href));let h=(0,a.useContext)(i.ActionCtxReact),g;if(e===`a`&&h){let e=wa(m.href),t=typeof m.target==`string`?m.target:``;e&&(!t||t===`_self`)&&(g=t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),h.runner.execute({type:`url`,target:e,toast:{showOnSuccess:!1}}).then(e=>{e?.success&&e.redirect&&window.location.assign(e.redirect)}))})}return(0,a.createElement)(e,{ref:s,className:r,...m,...g?{onClick:g}:{},"data-obj-id":c,"data-obj-type":l,style:u},n?void 0:W(t?.children??t?.body))});r.displayName=`Html${e.charAt(0).toUpperCase()}${e.slice(1)}`,t.ComponentRegistry.register(e,r,{namespace:`ui`,label:e.toUpperCase(),category:`basic`,inputs:[{name:`className`,type:`string`,label:`CSS Class`},...Sa[e]??[]]})}t.ComponentRegistry.register(`button-group`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(`div`,{className:U(`flex flex-wrap sm:inline-flex rounded-md shadow-sm`,e.className),role:`group`,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:e.buttons?.map((t,n)=>(0,o.jsx)(q,{variant:t.variant||e.variant,size:t.size||e.size,className:U(`rounded-none`,n===0&&`rounded-l-md`,n===(e.buttons?.length||0)-1&&`rounded-r-md`,n>0&&`-ml-px`,t.className),children:t.label},n))})},{namespace:`ui`,label:`Button Group`,inputs:[{name:`variant`,type:`enum`,enum:[`default`,`destructive`,`outline`,`secondary`,`ghost`,`link`],defaultValue:`default`,label:`Variant`},{name:`size`,type:`enum`,enum:[`default`,`sm`,`lg`,`icon`],defaultValue:`default`,label:`Size`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{variant:`default`,size:`default`,buttons:[{label:`Left`},{label:`Middle`},{label:`Right`}]}}),t.ComponentRegistry.register(`pagination`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,onPageChange:a,...s}=t,c=e.currentPage||e.page||1,l=e.totalPages||1,u=(e,t)=>{t.preventDefault(),e!==c&&(e<1||e>l||a&&a(e))},d=()=>l<=7?Array.from({length:l},(e,t)=>t+1):c<=3?[1,2,3,4,5,-1,l]:c>=l-2?[1,-1,l-4,l-3,l-2,l-1,l]:[1,-1,c-1,c,c+1,-1,l];return(0,o.jsx)(_r,{className:e.className,...s,"data-obj-id":n,"data-obj-type":r,style:i,children:(0,o.jsxs)(vr,{children:[(0,o.jsx)(yr,{children:(0,o.jsx)(xr,{href:`#`,onClick:e=>u(c-1,e),className:c<=1?`pointer-events-none opacity-50`:`cursor-pointer`,"aria-disabled":c<=1})}),d().map((e,t)=>(0,o.jsx)(yr,{children:e===-1?(0,o.jsx)(Cr,{}):(0,o.jsx)(br,{href:`#`,isActive:e===c,onClick:t=>u(e,t),className:`cursor-pointer`,children:e})},t)),(0,o.jsx)(yr,{children:(0,o.jsx)(Sr,{href:`#`,onClick:e=>u(c+1,e),className:c>=l?`pointer-events-none opacity-50`:`cursor-pointer`,"aria-disabled":c>=l})})]})})},{namespace:`ui`,label:`Pagination`,inputs:[{name:`currentPage`,type:`number`,label:`Current Page`,defaultValue:1},{name:`totalPages`,type:`number`,label:`Total Pages`,defaultValue:10},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{currentPage:1,totalPages:10}}),t.ComponentRegistry.register(`navigation-menu`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(cr,{className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:(0,o.jsx)(lr,{children:e.items?.map((e,t)=>(0,o.jsx)(ur,{children:e.children?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(fr,{children:e.label}),(0,o.jsx)(pr,{children:(0,o.jsx)(`ul`,{className:`grid w-full gap-3 p-4 sm:w-[400px] md:w-[500px] md:grid-cols-2 lg:w-[600px]`,children:e.children.map((e,t)=>(0,o.jsx)(`li`,{children:(0,o.jsx)(mr,{asChild:!0,children:(0,o.jsxs)(`a`,{className:U(`block select-none space-y-1 rounded-md p-3 leading-none no-underline outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground`),href:e.href,children:[(0,o.jsx)(`div`,{className:`text-sm font-medium leading-none`,children:e.label}),e.description&&(0,o.jsx)(`p`,{className:`line-clamp-2 text-sm leading-snug text-muted-foreground`,children:e.description})]})})},t))})})]}):(0,o.jsx)(mr,{href:e.href,children:e.label})},t))})})},{namespace:`ui`,label:`Navigation Menu`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{items:[{label:`Home`,href:`/`},{label:`About`,href:`/about`}]}});function Ta(e){return e.includes(`-`)?e.toLowerCase():e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1-$2`).toLowerCase()}var Ea=new Set(ie.iconNames);function Da(e){return Ea.has(e)}function Oa(e){return!!e&&Da(Ta(e))}var ka=new Map;function Aa(e){if(!e)return c.Database;let t=ka.get(e);if(t)return t;let n=Ta(e);if(!Da(n))return ka.set(e,c.Database),c.Database;let r=e=>a.default.createElement(ie.DynamicIcon,{name:n,fallback:c.Database,...e});return r.displayName=`LucideIcon(${e})`,ka.set(e,r),r}var ja=({name:e,...t})=>{if(!e)return a.default.createElement(c.Database,t);let n=Ta(e);return Da(n)?a.default.createElement(ie.DynamicIcon,{name:n,fallback:c.Database,...t}):a.default.createElement(c.Database,t)};function Ma(e){let t=e?.properties??{};return{...e?.props??{},...t}}function Na(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n.startsWith(`aria-`)||n===`role`?n:`aria-${n}`]=String(r));return t}var Pa={left:`text-left`,center:`text-center`,right:`text-right`},Fa={heading:`text-2xl font-semibold tracking-tight`,subheading:`text-lg font-medium text-foreground`,body:`text-sm text-foreground`,caption:`text-xs text-muted-foreground`};function Ia({schema:e}){let t=Ma(e),{language:n}=(0,B.useObjectTranslation)(),r=t.variant??`body`,i=t.align??`left`;return(0,o.jsx)(r===`heading`?`h2`:r===`subheading`?`h3`:`p`,{className:U(Fa[r]??Fa.body,Pa[i],e?.className),...Na(t.aria),children:(0,B.pickLocalized)(t.content,n)})}t.ComponentRegistry.register(`text`,Ia,{namespace:`element`,skipFallback:!0,label:`Text`,category:`content`,inputs:[{name:`content`,type:`string`,label:`Content`,required:!0,description:`Accepts an inline translation map ({ en, "zh-CN", … })`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`heading`,`subheading`,`body`,`caption`],defaultValue:`body`},{name:`align`,type:`enum`,label:`Align`,enum:[`left`,`center`,`right`],defaultValue:`left`}]});function La({schema:e}){return(0,o.jsx)(Vr,{className:U(`my-4`,e?.className)})}t.ComponentRegistry.register(`divider`,La,{namespace:`element`,skipFallback:!0,label:`Divider`,category:`content`});var Ra={cover:`object-cover`,contain:`object-contain`,fill:`object-fill`};function za({schema:e}){let t=Ma(e),n=t.fit??`cover`;return t.src?(0,o.jsx)(`img`,{src:t.src,alt:t.alt??``,className:U(`w-full rounded-md`,Ra[n]??Ra.cover,e?.className),style:t.height?{height:t.height}:void 0,...Na(t.aria)}):(0,o.jsx)(`div`,{className:U(`flex items-center justify-center rounded-md border border-dashed bg-muted/30 text-xs text-muted-foreground`,e?.className),style:{height:t.height??120},children:`no image source`})}t.ComponentRegistry.register(`image`,za,{namespace:`element`,skipFallback:!0,label:`Image`,category:`content`});var Ba={primary:`default`,secondary:`secondary`,danger:`destructive`,ghost:`ghost`,link:`link`},Va={small:`sm`,medium:`default`,large:`lg`};function Ha({schema:e}){let t=Ma(e),n=Ba[t.variant??`primary`]??`default`,r=Va[t.size??`medium`]??`default`,{language:s}=(0,B.useObjectTranslation)(),c=(0,B.pickLocalized)(t.label,s),l=t.iconPosition??`left`,u=t.icon?(0,o.jsx)(ja,{name:t.icon,className:`h-4 w-4`}):null,{execute:d}=(0,i.useAction)(),[f,p]=a.useState(!1),m=t.action,h=a.useCallback(async()=>{if(!(!m||f)){p(!0);try{let e=Array.isArray(m.params)?{actionParams:m.params}:{params:m.params};await d({type:m.actionType||m.type,name:m.name,label:m.label,description:m.description,target:m.target,openIn:m.openIn,endpoint:m.endpoint,method:m.method,navigate:m.navigate,to:m.to,opensInNewTab:m.opensInNewTab,confirmText:m.confirmText,successMessage:m.successMessage,errorMessage:m.errorMessage,refreshAfter:m.refreshAfter,...e})}finally{p(!1)}}},[m,d,f]);return(0,o.jsxs)(q,{type:`button`,variant:n,size:r,disabled:t.disabled||f,className:U(e?.className),onClick:m?h:void 0,...Na(t.aria),children:[l===`left`&&u,c,l===`right`&&u]})}t.ComponentRegistry.register(`button`,Ha,{namespace:`element`,skipFallback:!0,label:`Button`,category:`action`,inputs:[{name:`label`,type:`string`,label:`Label`,required:!0,description:`Accepts an inline translation map ({ en, "zh-CN", … })`},{name:`action`,type:`object`,label:`Action`,description:`Inline ActionDef executed on click (url / navigation / api / script / modal / flow); omitted → renders inert`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`primary`,`secondary`,`danger`,`ghost`,`link`],defaultValue:`primary`},{name:`size`,type:`enum`,label:`Size`,enum:[`small`,`medium`,`large`],defaultValue:`medium`},{name:`icon`,type:`string`,label:`Icon`,description:`Lucide icon name`},{name:`iconPosition`,type:`enum`,label:`Icon Position`,enum:[`left`,`right`],defaultValue:`left`},{name:`disabled`,type:`boolean`,label:`Disabled`}]});var Ua={number:{},currency:{style:`currency`,currency:`USD`},percent:{style:`percent`,maximumFractionDigits:1}};function Wa(e,t,n,r,i,a){if(e==null||Number.isNaN(e))return`—`;let o=Ua[t??`number`]??Ua.number;t===`currency`&&(o=i?{...Ua.currency,currency:i}:Ua.number);let s=new Intl.NumberFormat(a,o).format(e);return`${n??``}${s}${r??``}`}function Ga({schema:e}){let t=Ma(e),n=(0,i.useAdapter)(),{currency:r,locale:s}=(0,B.useLocalization)(),[c,l]=a.useState(null),[u,d]=a.useState(!0),[f,p]=a.useState(null),m=a.useMemo(()=>t.filter?JSON.stringify(t.filter):``,[t.filter]);return a.useEffect(()=>{let e=!1;if(!n||!t.object||!t.aggregate){d(!1);return}return d(!0),p(null),(async()=>{try{if(typeof n.aggregate==`function`){let r=await n.aggregate(t.object,{field:t.field,function:t.aggregate,groupBy:`_all`,filter:t.filter}),i=Array.isArray(r)?r[0]:r,a=t.aggregate===`count`?`count`:`${t.field??``}_${t.aggregate}`,o=i?.[a]??i?.[t.field??``]??i?.value??(typeof i==`number`?i:null);e||l(typeof o==`number`?o:o==null?null:Number(o))}else if(typeof n.find==`function`){let r=await n.find(t.object,t.filter?{$filter:t.filter}:void 0),i=r?.data??r?.records??(Array.isArray(r)?r:[]),a=null;if(t.aggregate===`count`)a=i.length;else if(t.field){let e=i.map(e=>Number(e?.[t.field])).filter(e=>!Number.isNaN(e));e.length&&(t.aggregate===`sum`?a=e.reduce((e,t)=>e+t,0):t.aggregate===`avg`?a=e.reduce((e,t)=>e+t,0)/e.length:t.aggregate===`min`?a=Math.min(...e):t.aggregate===`max`&&(a=Math.max(...e)))}e||l(a)}}catch(t){e||p(t?.message??`aggregate failed`)}finally{e||d(!1)}})(),()=>{e=!0}},[n,t.object,t.field,t.aggregate,m]),(0,o.jsxs)(`div`,{className:U(`flex flex-col gap-1`,e?.className),...Na(t.aria),children:[(0,o.jsx)(`div`,{className:`text-3xl font-semibold tracking-tight tabular-nums`,children:u?`…`:Wa(c,t.format,t.prefix,t.suffix,r,s)}),f&&(0,o.jsx)(`div`,{className:`text-xs text-destructive`,children:f})]})}t.ComponentRegistry.register(`number`,Ga,{namespace:`element`,skipFallback:!0,label:`Number`,category:`content`,inputs:[{name:`object`,type:`string`,label:`Object`,required:!0,description:`Object the aggregate runs over`},{name:`aggregate`,type:`enum`,label:`Aggregate`,enum:[`count`,`sum`,`avg`,`min`,`max`],required:!0},{name:`field`,type:`string`,label:`Field`,description:`Measure field (required for every aggregate except count)`},{name:`filter`,type:`array`,label:`Filter`},{name:`format`,type:`enum`,label:`Format`,enum:[`number`,`currency`,`percent`],defaultValue:`number`},{name:`prefix`,type:`string`,label:`Prefix`},{name:`suffix`,type:`string`,label:`Suffix`}]});function Ka(e){let t=e?.properties??{};return{...e?.props??{},...t}}function qa(e,t){if(!e||!t)return;let n=e.fields;if(n)return Array.isArray(n)?n.find(e=>e?.name===t):n[t]}function Ja({hint:e,icon:t,title:n,subtitle:r,children:i}){return(0,o.jsxs)(`div`,{className:`rounded-lg border bg-card text-card-foreground shadow-sm overflow-hidden`,children:[(0,o.jsxs)(`div`,{className:`flex items-start gap-2.5 border-b bg-muted/40 px-3.5 py-2.5`,children:[(0,o.jsx)(t,{className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground`}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,o.jsx)(`span`,{className:`text-sm font-semibold leading-tight`,children:n}),(0,o.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-muted-foreground`,children:e})]}),r&&(0,o.jsx)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:r})]})]}),(0,o.jsx)(`div`,{className:`p-3.5`,children:i})]})}function Ya({tone:e=`muted`,children:t}){return(0,o.jsxs)(`div`,{className:U(`flex items-center gap-2 rounded-md border border-dashed px-3 py-2.5 text-xs`,e===`warn`?`border-amber-300 bg-amber-50 text-amber-800 dark:border-amber-900 dark:bg-amber-950/30 dark:text-amber-300`:`bg-muted/30 text-muted-foreground`),children:[e===`warn`&&(0,o.jsx)(c.AlertTriangle,{className:`h-3.5 w-3.5 shrink-0`}),t]})}function Xa({object:e,name:t}){let{item:n,loading:r,error:s}=(0,i.useMetadataItem)(`object`,e??null),l=a.useMemo(()=>{let e=n?.validations??n?.validationRules??[];if(Array.isArray(e))return e.find(e=>e?.type===`state_machine`&&(!t||e?.name===t))},[n,t]);if(!e)return(0,o.jsxs)(Ya,{tone:`warn`,children:[`Missing `,(0,o.jsx)(`code`,{className:`font-mono`,children:`object`}),` for the state machine.`]});if(r)return(0,o.jsxs)(Ya,{children:[`Loading `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),`…`]});if(s)return(0,o.jsxs)(Ya,{tone:`warn`,children:[`Failed to load object `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),`: `,s.message]});if(!n)return(0,o.jsxs)(Ya,{tone:`warn`,children:[`Object `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),` not found.`]});if(!l)return(0,o.jsxs)(Ya,{tone:`warn`,children:[`No state machine`,t?` named “${t}”`:``,` on `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),`.`]});let u=l.transitions&&typeof l.transitions==`object`&&!Array.isArray(l.transitions)?l.transitions:{},d=qa(n,l.field),f=Array.isArray(d?.options)?d.options:[],p=new Map(f.map(e=>[e.value,e])),m=e=>p.get(e)?.label??e,h=e=>p.get(e)?.color,g=f.find(e=>e.default)?.value,_=new Set;g&&_.add(g);for(let e of f)_.add(e.value);for(let[e,t]of Object.entries(u)){_.add(e);for(let e of t)_.add(e)}let v=[..._],y=({value:e})=>(0,o.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border bg-background px-2 py-0.5 text-xs font-medium`,children:[(0,o.jsx)(`span`,{className:`h-2 w-2 rounded-full`,style:{backgroundColor:h(e)??`var(--muted-foreground)`}}),m(e)]});return(0,o.jsx)(Ja,{hint:`state machine`,icon:c.Workflow,title:l.label??l.name??`State machine`,subtitle:(0,o.jsxs)(o.Fragment,{children:[`Lifecycle of `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),l.field?(0,o.jsxs)(o.Fragment,{children:[` · field `,(0,o.jsx)(`code`,{className:`font-mono`,children:l.field})]}):null]}),children:(0,o.jsx)(`ol`,{className:`space-y-1.5`,children:v.map(e=>{let t=u[e]??[],n=e===g,r=t.length===0;return(0,o.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1.5 rounded-md border bg-muted/20 px-2.5 py-2`,children:[(0,o.jsx)(y,{value:e}),n&&(0,o.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-emerald-100 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-emerald-700 dark:bg-emerald-950/50 dark:text-emerald-400`,children:[(0,o.jsx)(c.CircleDot,{className:`h-3 w-3`}),` initial`]}),r?(0,o.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:[(0,o.jsx)(c.Flag,{className:`h-3 w-3`}),` final`]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(c.ArrowRight,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,o.jsx)(`span`,{className:`flex flex-wrap gap-1.5`,children:t.map(e=>(0,o.jsx)(y,{value:e},e))})]})]},e)})})})}var Za=new Set([`script`,`http_request`,`connector_action`,`assignment`,`get_record`,`create_record`,`update_record`,`delete_record`,`boundary_event`]);function Qa({name:e,detail:t}){let{item:n,loading:r,error:a}=(0,i.useMetadataItem)(`flow`,e??null);if(!e)return(0,o.jsxs)(Ya,{tone:`warn`,children:[`Missing `,(0,o.jsx)(`code`,{className:`font-mono`,children:`name`}),` for the flow.`]});if(r)return(0,o.jsxs)(Ya,{children:[`Loading flow `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),`…`]});if(a)return(0,o.jsxs)(Ya,{tone:`warn`,children:[`Failed to load flow `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),`: `,a.message]});if(!n)return(0,o.jsxs)(Ya,{tone:`warn`,children:[`Flow `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),` not found.`]});let s=Array.isArray(n.nodes)?n.nodes:[],l=(t??`business`)===`business`,u=l?s.filter(e=>!Za.has(e?.type)):s,d=s.length-u.length;return(0,o.jsxs)(Ja,{hint:`flow`,icon:c.GitBranch,title:n.label??n.name??e,subtitle:n.description??(0,o.jsxs)(o.Fragment,{children:[`Process with `,s.length,` step`,s.length===1?``:`s`]}),children:[u.length===0?(0,o.jsx)(Ya,{children:`No steps to show.`}):(0,o.jsx)(`ol`,{className:`space-y-1.5`,children:u.map((e,t)=>(0,o.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-md border bg-muted/20 px-2.5 py-2`,children:[(0,o.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary/10 text-[11px] font-semibold text-primary`,children:t+1}),(0,o.jsx)(`span`,{className:`text-sm`,children:e?.label??e?.id??`(step)`}),e?.type&&(0,o.jsx)(`span`,{className:`ml-auto rounded border bg-background px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:e.type})]},e?.id??t))}),l&&d>0&&(0,o.jsxs)(`div`,{className:`mt-2 text-[11px] text-muted-foreground`,children:[d,` technical step`,d===1?``:`s`,` hidden · set `,(0,o.jsx)(`code`,{className:`font-mono`,children:`detail: technical`}),` to show all`]})]})}var $a=[{key:`allowCreate`,label:`C`},{key:`allowRead`,label:`R`},{key:`allowEdit`,label:`U`},{key:`allowDelete`,label:`D`}];function eo({name:e}){let{item:t,loading:n,error:r}=(0,i.useMetadataItem)(`permission`,e??null);if(!e)return(0,o.jsxs)(Ya,{tone:`warn`,children:[`Missing `,(0,o.jsx)(`code`,{className:`font-mono`,children:`name`}),` for the permission set.`]});if(n)return(0,o.jsxs)(Ya,{children:[`Loading permission set `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),`…`]});if(r)return(0,o.jsxs)(Ya,{tone:`warn`,children:[`Failed to load permission `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),`: `,r.message]});if(!t)return(0,o.jsxs)(Ya,{tone:`warn`,children:[`Permission set `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),` not found.`]});let a=t.objects&&typeof t.objects==`object`?t.objects:{},s=Object.entries(a);return(0,o.jsx)(Ja,{hint:`permission`,icon:c.ShieldCheck,title:t.label??t.name??e,subtitle:(0,o.jsxs)(o.Fragment,{children:[`Object access · `,s.length,` object`,s.length===1?``:`s`]}),children:s.length===0?(0,o.jsx)(Ya,{children:`No object permissions declared.`}):(0,o.jsxs)(`table`,{className:`w-full border-separate border-spacing-0 text-xs`,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{className:`text-muted-foreground`,children:[(0,o.jsx)(`th`,{className:`border-b px-2 py-1.5 text-left font-medium`,children:`Object`}),$a.map(e=>(0,o.jsx)(`th`,{className:`border-b px-2 py-1.5 text-center font-mono font-medium`,title:e.key,children:e.label},e.key))]})}),(0,o.jsx)(`tbody`,{children:s.map(([e,t])=>(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{className:`border-b px-2 py-1.5 font-mono`,children:e}),$a.map(e=>(0,o.jsx)(`td`,{className:`border-b px-2 py-1.5 text-center`,children:t?.[e.key]?(0,o.jsx)(c.Check,{className:`mx-auto h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400`}):(0,o.jsx)(c.Minus,{className:`mx-auto h-3.5 w-3.5 text-muted-foreground/40`})},e.key))]},e))})]})})}function to({schema:e}){let t=Ka(e);switch(t.type){case`state_machine`:return(0,o.jsx)(Xa,{...t});case`flow`:return(0,o.jsx)(Qa,{...t});case`permission`:return(0,o.jsx)(eo,{...t});default:return(0,o.jsxs)(Ya,{tone:`warn`,children:[`Unknown metadata view type`,t.type?` “${t.type}”`:``,`. Expected`,` `,(0,o.jsx)(`code`,{className:`font-mono`,children:`state_machine`}),`, `,(0,o.jsx)(`code`,{className:`font-mono`,children:`flow`}),`, or`,` `,(0,o.jsx)(`code`,{className:`font-mono`,children:`permission`}),`.`]})}}t.ComponentRegistry.register(`metadata_viewer`,to,{namespace:`element`,skipFallback:!0,label:`Metadata Viewer`,category:`content`});function no(e){let t=e?.properties??{};return{...e?.props??{},...t}}function ro(e){return e==null||e===``?`—`:typeof e==`object`?JSON.stringify(e):String(e)}function io({schema:e}){let t=no(e),n=Array.isArray(t.items)?t.items:[],r=t.columns===2?`sm:grid-cols-2`:`grid-cols-1`;return n.length===0?(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No details`}):(0,o.jsx)(`dl`,{className:U(`grid gap-x-6 gap-y-3`,r,e?.className,t.className),"data-testid":`definition-list`,children:n.map((e,n)=>(0,o.jsxs)(`div`,{className:U(t.inline?`flex items-baseline justify-between gap-3`:`flex flex-col gap-0.5`),children:[(0,o.jsx)(`dt`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:e.term}),(0,o.jsx)(`dd`,{className:`text-sm text-foreground`,children:ro(e.description)})]},n))})}t.ComponentRegistry.register(`definition-list`,io,{namespace:`element`,skipFallback:!0,label:`Definition List`,category:`content`,inputs:[{name:`items`,type:`array`,label:`Items`,required:!0,description:`Term/description pairs [{ term, description }]`},{name:`columns`,type:`enum`,label:`Columns`,enum:[`1`,`2`],defaultValue:`1`},{name:`inline`,type:`boolean`,label:`Inline`,description:`Term and description on one baseline-aligned row`}]});function ao({schema:e}){let t=no(e),n=(0,i.useAdapter)(),[r,s]=a.useState([]),[c,l]=a.useState(!0),[u,d]=a.useState(null),f=a.useMemo(()=>t.filter?JSON.stringify(t.filter):``,[t.filter]),p=a.useMemo(()=>(t.fields??[]).map(e=>typeof e==`string`?{field:e}:e),[t.fields]);return a.useEffect(()=>{let e=!1;if(!n||!t.object||typeof n.find!=`function`){l(!1);return}return l(!0),d(null),(async()=>{try{let r={};t.filter&&(r.$filter=t.filter),t.sort&&(r.$orderby=t.sort),t.limit&&(r.$top=t.limit);let i=await n.find(t.object,r),a=i?.data??i?.records??(Array.isArray(i)?i:[]);e||s(a)}catch(t){e||d(t?.message??`Failed to load`)}finally{e||l(!1)}})(),()=>{e=!0}},[n,t.object,f,t.limit]),c?(0,o.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`Loading…`}):u?(0,o.jsx)(`p`,{className:`py-2 text-sm text-destructive`,children:u}):r.length===0?(0,o.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:t.emptyText??`No records`}):(0,o.jsx)(`ul`,{className:U(t.divided!==!1&&`divide-y divide-border`,e?.className,t.className),"data-testid":`repeater`,children:r.map((e,n)=>(0,o.jsxs)(`li`,{className:`flex items-baseline gap-3 py-2`,children:[t.titleField&&(0,o.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:ro(e[t.titleField])}),p.map(t=>(0,o.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:ro(e[t.field])},t.field))]},e?.id??n))})}t.ComponentRegistry.register(`repeater`,ao,{namespace:`element`,skipFallback:!0,label:`Repeater`,category:`content`,inputs:[{name:`object`,type:`string`,label:`Object`,required:!0,description:`Object whose records the list repeats over`},{name:`titleField`,type:`string`,label:`Title Field`},{name:`fields`,type:`array`,label:`Fields`,description:`Columns per row — bare names or { field, label? }`},{name:`filter`,type:`array`,label:`Filter`},{name:`sort`,type:`array`,label:`Sort`},{name:`limit`,type:`number`,label:`Limit`},{name:`emptyText`,type:`string`,label:`Empty Text`},{name:`divided`,type:`boolean`,label:`Divided`,description:`Separator between rows`}]});function oo(e){let t=e?.properties??{};return{...e?.props??{},...t}}function so(e){if(e==null)return``;if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(typeof e==`object`){let t=e;return String(t.label??t.name??t.title??t.en??``)}return String(e)}function co({schema:e}){let t=oo(e),n=e?.dataSource??{},r=n.object??t.object,s=n.filter??t.filter,c=n.sort??t.sort,l=n.limit??t.limit??50,u=t.labelField??`name`,d=t.valueField??`id`,f=(0,i.useAdapter)(),p=(0,i.usePageVariableBinding)(e?.id),[m,h]=a.useState([]),[g,_]=a.useState(!0),[v,y]=a.useState(null),b=a.useMemo(()=>s?JSON.stringify(s):``,[s]);a.useEffect(()=>{let e=!1;if(!f||!r||typeof f.find!=`function`){_(!1);return}return _(!0),y(null),(async()=>{try{let t={};s&&(t.$filter=s),c&&(t.$orderby=c),l&&(t.$top=l);let n=await f.find(r,t),i=n?.data??n?.records??(Array.isArray(n)?n:[]);e||h(i)}catch(t){e||y(t?.message??`Failed to load`)}finally{e||_(!1)}})(),()=>{e=!0}},[f,r,b,l]);let x=p?.value,S=p?String(x??``):void 0,C=a.useCallback(e=>{p?.setValue(e)},[p]),w=so(t.label),T=t.placeholder??`Select a record…`;return(0,o.jsxs)(`div`,{className:U(`space-y-1.5`,e?.className),"data-testid":`record-picker`,"data-picker-id":e?.id,children:[w&&(0,o.jsx)(`label`,{className:`text-sm font-medium text-foreground`,children:w}),(0,o.jsxs)(Mr,{value:S,onValueChange:C,disabled:g||!!v||!r,children:[(0,o.jsx)(Fr,{className:`w-full max-w-xs`,"data-testid":`record-picker-trigger`,children:(0,o.jsx)(Pr,{placeholder:g?`Loading…`:v?`Failed to load`:T})}),(0,o.jsx)(Rr,{children:m.map((e,t)=>{let n=e?.[d],r=String(n??t);return(0,o.jsx)(Z,{value:r,children:so(e?.[u])||r},r)})})]}),!g&&!v&&m.length===0&&(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.emptyText??`No records`})]})}t.ComponentRegistry.register(`record_picker`,co,{namespace:`element`,skipFallback:!0,label:`Record Picker`,category:`input`,inputs:[{name:`object`,type:`string`,label:`Object`},{name:`labelField`,type:`string`,label:`Label Field`},{name:`valueField`,type:`string`,label:`Value Field`},{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`label`,type:`string`,label:`Label`}]});function lo(e){let t=e?.properties??{};return{...e?.props??{},...t}}var uo=[`text`,`email`,`number`,`tel`,`url`,`password`];function fo({schema:e}){let t=lo(e),n=uo.includes(t.inputType)?t.inputType:`text`,{language:r}=(0,B.useObjectTranslation)(),s=(0,i.usePageVariableBinding)(e?.id),c=a.useRef(!1);a.useEffect(()=>{c.current||(c.current=!0,s&&t.defaultValue!==void 0&&(s.value==null||s.value===``)&&s.setValue(t.defaultValue))},[]);let l=s?.value,u=s?l==null?``:String(l):void 0,d=a.useCallback(e=>{if(!s)return;let t=e.target.value;s.setValue(n===`number`?t===``?``:Number(t):t)},[s,n]),f=(0,B.pickLocalized)(t.label,r),p=(0,B.pickLocalized)(t.placeholder,r),m=(0,B.pickLocalized)(t.description,r);return(0,o.jsxs)(`div`,{className:U(`grid w-full max-w-sm items-center gap-1.5`,e?.className),"data-testid":`text-input`,"data-input-id":e?.id,children:[f&&(0,o.jsx)(Y,{htmlFor:e?.id,className:U(t.required&&`after:ml-0.5 after:text-destructive after:content-['*']`),children:f}),(0,o.jsx)(X,{id:e?.id,type:n,placeholder:p||void 0,value:u,defaultValue:u===void 0?t.defaultValue:void 0,required:t.required,disabled:t.disabled,onChange:d}),m&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:m})]})}t.ComponentRegistry.register(`text_input`,fo,{namespace:`element`,skipFallback:!0,label:`Text Input`,category:`input`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`inputType`,type:`enum`,label:`Type`,enum:[`text`,`email`,`number`,`tel`,`url`,`password`],defaultValue:`text`},{name:`required`,type:`boolean`,label:`Required`},{name:`disabled`,type:`boolean`,label:`Disabled`},{name:`description`,type:`string`,label:`Description`}]});function po(e){return e==null?void 0:String(e)}function mo(e,t){let n=e?.find(e=>String(e.value)===t);return n?n.value:t}var ho=({className:e,...t})=>(0,o.jsx)(V.Group,{className:U(`flex h-full w-full`,e),...t}),go=V.Panel,_o=({withHandle:e,className:t,...n})=>(0,o.jsx)(V.Separator,{className:U(`relative flex w-px items-center justify-center bg-border`,`after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1`,`aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full`,`aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full`,`aria-[orientation=horizontal]:after:-translate-y-1/2 aria-[orientation=horizontal]:after:translate-x-0`,`[&[aria-orientation=horizontal]>div]:rotate-90`,t),...n,children:e&&(0,o.jsx)(`div`,{className:`z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border`,children:(0,o.jsx)(c.GripVertical,{className:`h-2.5 w-2.5`})})});function vo({label:e,description:t,collapsible:n,collapsed:r,onToggle:i,className:a}){return!e&&!t?null:(0,o.jsxs)(`div`,{className:U(`col-span-full pt-4 pb-1 border-b border-border`,n&&`cursor-pointer select-none`,a),onClick:n?i:void 0,role:n?`button`:void 0,"aria-expanded":n?!r:void 0,children:[e&&(0,o.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[n&&(r?(0,o.jsx)(c.ChevronRight,{className:`h-3.5 w-3.5 text-muted-foreground`}):(0,o.jsx)(c.ChevronDown,{className:`h-3.5 w-3.5 text-muted-foreground`})),(0,o.jsx)(`span`,{className:`text-sm font-semibold text-foreground`,children:e})]}),t&&(0,o.jsx)(`p`,{className:`mt-0.5 text-sm text-muted-foreground`,children:t})]})}function yo(e){let t=new Map;for(let n of e)n?.name&&!t.has(n.name)&&t.set(n.name,n);return t}function bo(e,t){let n=new Set;for(let t of e)for(let e of t.fields)n.add(e.name);return t.filter(e=>e?.name&&!n.has(e.name))}var xo=e=>typeof e==`number`&&Number.isFinite(e)?String(e):void 0,So=(0,B.createSafeTranslation)({"common.selectOption":`Select an option`,"validation.required":`{{field}} is required`,"validation.minLength":`{{field}} must be at least {{min}} characters`,"validation.maxLength":`{{field}} must be at most {{max}} characters`,"validation.min":`{{field}} must be at least {{min}}`,"validation.max":`{{field}} must be at most {{max}}`,"validation.pattern":`{{field}} format is invalid`,"validation.email":`Please enter a valid email address`,"validation.url":`Please enter a valid URL`,"validation.formInvalid":`Please check the highlighted fields: {{fields}}`,"errors.forbidden":`Access denied.`,"form.noPermissionToSave":`You don't have permission to save this record.`,"form.submitFailed":`Could not save. Please try again.`},`common.selectOption`),Co=e=>e==null||e===``||Array.isArray(e)&&e.length===0,wo=(e,t)=>{if(Co(e)&&Co(t))return!0;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},To=(e,t)=>Object.prototype.hasOwnProperty.call(e??{},t),Eo=(e,t)=>{let n=new Set([...Object.keys(e??{}),...Object.keys(t??{})]);for(let r of n)if(!wo(e?.[r],t?.[r]))return!0;return!1},Do=new Set([`input`,`textarea`,`checkbox`,`switch`,`select`]),Oo=new Set([`lookup`,`master_detail`,`tree`,`capability-multiselect`,`object-ref`,`filter-condition`,`recipient-picker`]),ko=new Set([`select`,`radio`,`multiselect`,`checkboxes`]);function Ao(e){let{dataSource:t,inputType:n,options:r,field:i,schema:a,showActions:o,fieldContainerClass:s,mobileStickyActions:c,mobile_fullscreen:l,fullscreen:u,dependentValues:d,dependsOn:f,emptyHint:p,...m}=e;return m}function jo(e){if(e==null)return`null`;let t=typeof e;return t===`string`?JSON.stringify(e):t===`number`||t===`boolean`?String(e):Array.isArray(e)?`[${e.map(jo).join(`, `)}]`:JSON.stringify(String(e))}function Mo(e){if(!e||!e.field)return null;let t=`record[${JSON.stringify(e.field)}]`,n=[];return e.equals!==void 0&&n.push(`${t} == ${jo(e.equals)}`),e.notEquals!==void 0&&n.push(`${t} != ${jo(e.notEquals)}`),Array.isArray(e.in)&&n.push(`${t} in ${jo(e.in)}`),n.length>0?n.join(` && `):null}function No(e){return e.startsWith(`field:`)?e.slice(6):e}function Po(e,t){let{dataSource:n,inputType:r,showActions:i,fieldContainerClass:a,mobileStickyActions:o,mobile_fullscreen:s,fullscreen:c,dependentValues:l,emptyHint:u,schema:d,...f}=t,p=No(e);return{...f,...Oo.has(p)?{dataSource:n,dependentValues:l}:{},...ko.has(p)?{dependentValues:l}:{}}}function Fo({value:e,onChange:t,placeholder:n,className:r,label:i,...s}){let[l,u]=a.default.useState(!1),[d,f]=a.default.useState(e??``),p=e=>t&&t(e),m=()=>{f(e??``),u(!0)},h=()=>{p(d),u(!1)};return(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(Qi,{placeholder:n,className:U(`pr-10`,r),value:e??``,onChange:e=>p(e.target.value),...s}),(0,o.jsx)(`button`,{type:`button`,onClick:m,className:`absolute top-1.5 right-1.5 inline-flex items-center justify-center size-7 rounded-md bg-background/80 text-muted-foreground hover:text-foreground hover:bg-background border shadow-sm`,"aria-label":`Edit ${i??`text`} fullscreen`,"data-testid":`form-textarea-fullscreen-toggle`,children:(0,o.jsx)(c.Maximize2,{className:`size-3.5`})}),(0,o.jsx)(St,{open:l,onOpenChange:u,children:(0,o.jsxs)(Dt,{className:`sm:max-w-3xl h-[100dvh] sm:h-[80vh] max-h-[100dvh] sm:max-h-[80vh] flex flex-col p-0 gap-0`,"data-testid":`form-textarea-fullscreen-dialog`,children:[(0,o.jsxs)(Ot,{className:`p-4 border-b`,children:[(0,o.jsx)(At,{className:`text-base`,children:i??`Edit text`}),(0,o.jsx)(jt,{className:`sr-only`,children:`Edit the full text value, then save or cancel your changes.`})]}),(0,o.jsx)(`div`,{className:`flex-1 min-h-0 p-4`,children:(0,o.jsx)(Qi,{autoFocus:!0,value:d,onChange:e=>f(e.target.value),placeholder:n,className:`h-full min-h-full resize-none text-base`,"data-testid":`form-textarea-fullscreen-input`})}),(0,o.jsxs)(kt,{className:`p-3 border-t flex-row justify-end gap-2`,children:[(0,o.jsxs)(q,{type:`button`,variant:`ghost`,onClick:()=>u(!1),children:[(0,o.jsx)(c.X,{className:`size-4 mr-1`}),` Cancel`]}),(0,o.jsxs)(q,{type:`button`,onClick:h,"data-testid":`form-textarea-fullscreen-save`,children:[(0,o.jsx)(c.Check,{className:`size-4 mr-1`}),` Done`]})]})]})})]})}t.ComponentRegistry.register(`form`,({schema:e,className:n,onAction:r,...s})=>{let{t:l}=So(),{defaultValues:u={},fields:d=[],submitLabel:f=`Submit`,cancelLabel:p=`Cancel`,showCancel:m=!1,showSubmit:h=!0,layout:g=`vertical`,columns:_=1,onSubmit:v,onChange:y,onDirtyChange:b,onCancel:x,resetOnSubmit:S=!1,validationMode:C=`onSubmit`,disabled:T=!1}=e,E=a.default.useMemo(()=>d.filter(e=>e&&typeof e.field==`string`&&typeof e.name!=`string`),[d]),D=a.default.useMemo(()=>E.length===0?d:d.filter(e=>!E.includes(e)),[d,E]);a.default.useEffect(()=>{for(let e of E)console.error(`[object-ui] form field { field: '${e.field}' } was NOT rendered: \`field\` is the spec form-view vocabulary (a reference to an object field), and a standalone form has no object schema to resolve it against. Rename the key to \`name\` (the form data path) — or use an object-bound form (objectName + sections), whose section fields accept the spec shape.`);for(let e of d)e&&typeof e.field==`string`&&typeof e.name==`string`&&console.warn(`[object-ui] form field '${e.name}' mixes vocabularies: it also carries { field: '${e.field}' } (spec form-view key), which this standalone renderer ignores. Drop one of the two.`)},[d,E]);let O=(0,w.useForm)({defaultValues:u,mode:C,shouldFocusError:!1}),k=a.default.useRef(null),[A,j]=a.default.useState(!1),[M,N]=a.default.useState(null),[P,F]=a.default.useState(void 0),[I,ee]=a.default.useState([]),te=O.watch(),L=a.default.useMemo(()=>{let e={};for(let t of D)t?.name&&(e[t.name]=null);for(let t of Object.keys(te))te[t]!==void 0&&(e[t]=te[t]);return e},[D,JSON.stringify(te)]);a.default.useEffect(()=>{let e=O.formState.errors;if(!(!e||Object.keys(e).length===0))for(let n of D){let r=n?.name;if(!r||!e[r])continue;let i=(0,t.resolveFieldRuleState)({visibleWhen:n.visibleWhen,readonlyWhen:n.readonlyWhen,requiredWhen:n.requiredWhen},L,{required:!!n.required,readonly:n.readonly===!0}),a=n.visibleOn==null||(0,t.evalFieldPredicate)(n.visibleOn,L,!0),o=e[r]?.type;(!i.visible||!a||!i.required&&o===`required`)&&O.clearErrors(r)}},[L]);let R=a.default.useContext(i.SchemaRendererContext)?.dataSource??null,z=(0,i.usePredicateScope)(),re=a.default.useMemo(()=>{let e={};for(let t of D)t?.name&&(e[t.name]=t.label||t.name);return e},[D]),B=a.default.useMemo(()=>{let t=e.fieldTabs;if(e.children||!Array.isArray(t))return null;let n=t.filter(e=>e&&typeof e.key==`string`);return n.length>1?n:null},[e.fieldTabs,e.children]),ie=a.default.useMemo(()=>{let e=new Map;for(let t of B??[])for(let n of t.fields??[])e.has(n)||e.set(n,t.key);return e},[B]),V=a.default.useMemo(()=>{if(!B?.length)return;let t=B.map(e=>e.key);return P&&t.includes(P)?P:e.defaultFieldTab&&t.includes(e.defaultFieldTab)?e.defaultFieldTab:t[0]},[B,P,e.defaultFieldTab]),ae=a.default.useMemo(()=>{if(!B)return null;let e=yo(D);return B.map(t=>({key:t.key,label:t.label||t.key,description:t.description,containerClass:t.containerClass,fields:(t.fields??[]).map(t=>e.get(t)).filter(e=>!!e)}))},[B,D]),oe=a.default.useMemo(()=>ae?bo(ae,D):[],[ae,D]),se=a.default.useMemo(()=>{let t=e.fieldPanes;if(e.children||B||!Array.isArray(t))return null;let n=t.filter(e=>e&&typeof e.key==`string`);return n.length>1?n:null},[e.fieldPanes,e.children,B]),ce=a.default.useMemo(()=>{if(!se)return null;let e=yo(D);return se.map(t=>({key:t.key,defaultSize:xo(t.defaultSize),minSize:xo(t.minSize)??`20`,containerClass:t.containerClass,fields:(t.fields??[]).map(t=>e.get(t)).filter(e=>!!e)}))},[se,D]),le=a.default.useMemo(()=>ce?bo(ce,D):[],[ce,D]),ue=a.default.useMemo(()=>{let e=new Set;if(!B)return e;for(let t of I){let n=ie.get(t);n&&e.add(n)}return e},[B,ie,I]);a.default.useEffect(()=>{for(let e of D){let n=e?.name;if(!n)continue;let r=e.widget||e.type;if(r!==`select`&&r!==`radio`&&r!==`multiselect`&&r!==`checkboxes`)continue;let i=e.options;if(!i||i.length===0)continue;let a=e.dependsOn;if(!i.some(e=>e?.visibleWhen!=null)&&!a)continue;let o=O.getValues(n);if(o==null||o===``)continue;let{options:s}=(0,t.resolveCascadingOptions)(i,L,a,z);(0,t.isValueStillOffered)(o,s)||O.setValue(n,Array.isArray(o)?[]:void 0,{shouldValidate:!1,shouldDirty:!0})}},[L,z]);let de=a.default.useRef(void 0),fe=a.default.useRef(u??{});a.default.useLayoutEffect(()=>{let e;try{e=JSON.stringify(u??{})}catch{e=String(Date.now())}if(de.current===e)return;de.current=e;let t=u??{},n=fe.current,r=Object.entries(O.getValues()).filter(([e,r])=>!To(t,e)&&!To(n,e)&&!wo(n[e],r));fe.current=t,O.reset(u);for(let[e,t]of r)O.setValue(e,t,{shouldValidate:!1,shouldDirty:!0});ee([]),b?.(r.length>0)},[u]),a.default.useLayoutEffect(()=>{if(r){let e=O.watch(e=>{r({type:`form_change`,data:e,formData:e})});return()=>e.unsubscribe()}},[O,r]),a.default.useLayoutEffect(()=>{let e=O.watch(e=>{b?.(Eo(fe.current,e))});return()=>e.unsubscribe()},[O,b]);let pe=e=>{let t=k.current??document,n=typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`),r=t.querySelector(`[data-field="${n}"]`);r&&(r.scrollIntoView?.({behavior:`smooth`,block:`center`}),r.querySelector(`input:not([type="hidden"]), select, textarea, button, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]`)?.focus?.({preventScroll:!0}))},me=e=>{if(e.length===0)return;ee(e);let t=e.map(e=>re[e]||e),n=t.slice(0,3).join(`、`)+(t.length>3?`…`:``);ne.toast.error(l(`validation.formInvalid`,{fields:n}));let r=new Set(e),i=D.map(e=>e?.name).find(e=>!!e&&r.has(e))??e[0],a=ie.get(i);if(a&&a!==V){F(a),typeof requestAnimationFrame==`function`?requestAnimationFrame(()=>pe(i)):setTimeout(()=>pe(i),0);return}pe(i)},H=O.handleSubmit(async e=>{j(!0),N(null),ee([]);let t=e;if(e&&(e.nativeEvent||typeof e.preventDefault==`function`||typeof e.stopPropagation==`function`||e.target||e.bubbles))t=O.getValues();else if(!t||Object.keys(t).length===0){let e=O.getValues();e&&Object.keys(e).length>0&&(t=e)}try{if(r){let e=await r({type:`form_submit`,data:t,formData:t});if(e?.error){N(e.error),ne.toast.error(e.error);return}}v&&typeof v==`function`&&await v(t),S&&O.reset()}catch(e){let t=(0,i.extractFieldErrors)(e);if(t){let n=t.filter(e=>D.some(t=>t?.name===e.field));for(let t of n)O.setError(t.field,{type:`server`,message:t.message||(0,i.extractWriteErrorMessage)(e)||l(`form.submitFailed`)});if(n.length>0&&n.length===t.length){me(n.map(e=>e.field));return}}let n=(0,i.isPermissionError)(e)?l(`form.noPermissionToSave`):(0,i.extractWriteErrorMessage)(e)??l(`form.submitFailed`);(0,i.isPermissionError)(e)&&typeof console<`u`&&console.warn(`[form] write denied:`,e),N(n),ne.toast.error(n),typeof process<`u`&&process.env.NODE_ENV===`development`&&console.error(`Form submission error:`,e)}finally{j(!1)}},e=>{me(Object.keys(e||{}))}),he=()=>{O.reset(),x&&typeof x==`function`&&x(),r&&r({type:`form_cancel`,data:O.getValues()})},ge=_>1?U(`grid gap-4`,_===1?``:_===2?`md:grid-cols-2`:_===3?`md:grid-cols-2 lg:grid-cols-3`:`md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`):`space-y-4`,_e=e.fieldContainerClass||ge,ve=e.fieldTabsPosition||`top`,G=ve===`left`||ve===`right`,ye=n=>{let{name:r,label:i,description:a,type:s=`input`,required:c=!1,disabled:u=!1,validation:d={},condition:f,colSpan:p,hidden:m,widget:h,visibleOn:g,readonly:_,visibleWhen:v,readonlyWhen:y,requiredWhen:b,...x}=n;if(m)return null;let S=Mo(f);if(S&&!(0,t.evalFieldPredicate)(S,L,!0))return null;let C=(0,t.resolveFieldRuleState)({visibleWhen:v,readonlyWhen:y,requiredWhen:b},L,{required:c,readonly:_===!0});if(!C.visible||g!=null&&!(0,t.evalFieldPredicate)(g,L,!0))return null;let w=C.required,E=C.readonly;if(s===`section-divider`){let e=x;return(0,o.jsx)(vo,{label:i,description:a,collapsible:e.collapsible,collapsed:e.collapsed,onToggle:e.onToggle,className:e.className},r)}let D={...d};w&&(D.required=typeof d.required==`string`?d.required:l(`validation.required`,{field:i||r}));let k=(e,t)=>e&&typeof e==`object`&&e.message==null&&typeof e.messageKey==`string`?{...e,message:l(e.messageKey,{field:i||r,...t?.(e)})}:e;D.minLength&&=k(D.minLength,e=>({min:e.value})),D.maxLength&&=k(D.maxLength,e=>({max:e.value})),D.min&&=k(D.min,e=>({min:e.value})),D.max&&=k(D.max,e=>({max:e.value})),D.pattern&&=k(D.pattern);let j=n.id??r,M=h||x.field?.widget||s,N=M===`select`||M===`radio`||M===`multiselect`||M===`checkboxes`,P=x.options,F=N?(0,t.resolveCascadingOptions)(P,L,n.dependsOn,z):null,I=F?.gated??!1,ee=F?.dependsOnFields??[],te=F?F.options:P,ne=I?`Select ${ee.map(e=>re[e]||e).join(` / `)} first`:void 0,B=e.fieldContainerClass||ge,ie=e=>{let t=Array.from(B.matchAll(/(@)?(sm|md|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl):grid-cols-(\d+)/g)).map(e=>({at:e[1]||``,bp:e[2],cols:Number(e[3])}));if(!t.length)return e===2?`col-span-2`:e===3?`col-span-3`:`col-span-4`;let n=t.find(t=>t.cols>=e)||t[t.length-1];return{"@sm:2":`@sm:col-span-2`,"@md:2":`@md:col-span-2`,"@lg:2":`@lg:col-span-2`,"@xl:2":`@xl:col-span-2`,"@2xl:2":`@2xl:col-span-2`,"@sm:3":`@sm:col-span-3`,"@md:3":`@md:col-span-3`,"@lg:3":`@lg:col-span-3`,"@xl:3":`@xl:col-span-3`,"@2xl:3":`@2xl:col-span-3`,"@4xl:3":`@4xl:col-span-3`,"@sm:4":`@sm:col-span-4`,"@md:4":`@md:col-span-4`,"@lg:4":`@lg:col-span-4`,"@xl:4":`@xl:col-span-4`,"@2xl:4":`@2xl:col-span-4`,"@4xl:4":`@4xl:col-span-4`,"sm:2":`sm:col-span-2`,"md:2":`md:col-span-2`,"lg:2":`lg:col-span-2`,"xl:2":`xl:col-span-2`,"sm:3":`sm:col-span-3`,"md:3":`md:col-span-3`,"lg:3":`lg:col-span-3`,"xl:3":`xl:col-span-3`,"sm:4":`sm:col-span-4`,"md:4":`md:col-span-4`,"lg:4":`lg:col-span-4`,"xl:4":`xl:col-span-4`}[`${n.at}${n.bp}:${e}`]||(e===2?`col-span-2`:e===3?`col-span-3`:`col-span-4`)},V=p&&p>1?p===2?ie(2):p===3?ie(3):p>=4?ie(4):``:``,ae=`field:${e.objectName?`${e.objectName}.`:``}${r}`;return(0,o.jsx)(jn,{control:O.control,name:r,rules:D,render:({field:e})=>(0,o.jsxs)(Pn,{className:V||void 0,"data-testid":ae,"data-field":r,children:[i&&(0,o.jsxs)(Fn,{className:`text-xs font-normal text-muted-foreground`,children:[i,w&&(0,o.jsx)(`span`,{className:`text-destructive ml-1`,"aria-label":`required`,children:`*`})]}),(0,o.jsx)(In,{children:Ro(M,{...x,field:n.field||n,...e,inputType:x.inputType,options:N?te:x.options,placeholder:x.placeholder??(M===`select`?l(`common.selectOption`):void 0),disabled:T||u||A||I,readonly:E,emptyHint:ne,dataSource:R,dependentValues:L})}),a&&(0,o.jsx)(Ln,{children:a}),(0,o.jsx)(Rn,{})]})},j)},{"data-obj-id":K,"data-obj-type":be,style:xe,onSubmit:Se,onChange:Ce,submitLabel:we,cancelLabel:Te,showSubmit:Ee,showCancel:De,resetOnSubmit:Oe,defaultValues:ke,inputType:Ae,dataSource:je,showActions:Ne,fieldContainerClass:Fe,mobileStickyActions:Ie,objectName:Le,onDirtyChange:Re,onCancel:ze,fields:Be,layout:Ve,columns:He,validationMode:Ue,disabled:We,fieldTabs:Ge,defaultFieldTab:Ke,fieldTabsPosition:qe,fieldPanes:Je,fieldPanesOrientation:Ye,fieldPanesResizable:Xe,...Ze}=s;return(0,o.jsx)(kn,{...O,children:(0,o.jsxs)(`form`,{ref:k,onSubmit:H,className:n,...Ze,"data-obj-id":K,"data-obj-type":be,style:xe,children:[M&&(0,o.jsxs)(Me,{variant:`destructive`,className:`mb-4`,children:[(0,o.jsx)(c.AlertCircle,{className:`h-4 w-4`}),(0,o.jsx)(Pe,{children:M})]}),E.length>0&&(0,o.jsxs)(Me,{variant:`destructive`,className:`mb-4`,"data-testid":`form-spec-vocabulary-error`,children:[(0,o.jsx)(c.AlertCircle,{className:`h-4 w-4`}),(0,o.jsx)(Pe,{children:`Not rendered — spec form-view vocabulary ({ field: … }) in a standalone form: `+E.map(e=>e.field).join(`, `)+`. Use { name: … }, or an object-bound form with sections.`})]}),e.children?(0,o.jsx)(`div`,{className:e.fieldContainerClass||`space-y-4`,children:W(e.children)}):ae?(0,o.jsxs)(o.Fragment,{children:[oe.length>0&&(0,o.jsx)(`div`,{className:U(_e,`mb-4`),children:oe.map(ye)}),(0,o.jsxs)(Ji,{value:V,onValueChange:F,orientation:G?`vertical`:`horizontal`,className:U(`flex w-full`,G?`gap-4`:`flex-col`),children:[(0,o.jsx)(Yi,{className:U(`self-start`,G?U(`h-auto flex-col`,ve===`right`&&`order-last`):ve===`bottom`?`order-last mt-4`:`mb-4`),children:ae.map(e=>(0,o.jsxs)(Xi,{value:e.key,"data-testid":`form-tab:${e.key}`,"data-error":ue.has(e.key)||void 0,className:U(G&&`w-full justify-start`,ue.has(e.key)&&`text-destructive data-[state=active]:text-destructive`),children:[e.label,ue.has(e.key)&&(0,o.jsx)(`span`,{"aria-hidden":`true`,className:`ml-1.5 size-1.5 rounded-full bg-destructive`})]},e.key))}),(0,o.jsx)(`div`,{className:`min-w-0 flex-1`,children:ae.map(e=>(0,o.jsxs)(Zi,{value:e.key,forceMount:!0,className:`mt-0 data-[state=inactive]:hidden`,"data-testid":`form-tab-panel:${e.key}`,children:[e.description&&(0,o.jsx)(`p`,{className:`mb-3 text-sm text-muted-foreground`,children:e.description}),(0,o.jsx)(`div`,{className:e.containerClass||_e,children:e.fields.map(ye)})]},e.key))})]})]}):ce?(0,o.jsxs)(o.Fragment,{children:[le.length>0&&(0,o.jsx)(`div`,{className:U(_e,`mb-4`),children:le.map(ye)}),(0,o.jsx)(ho,{orientation:e.fieldPanesOrientation===`vertical`?`vertical`:`horizontal`,className:`min-h-[300px] rounded-lg border`,children:ce.map((t,n)=>(0,o.jsxs)(a.default.Fragment,{children:[n>0&&(0,o.jsx)(_o,{withHandle:e.fieldPanesResizable!==!1,disabled:e.fieldPanesResizable===!1}),(0,o.jsx)(go,{defaultSize:t.defaultSize,minSize:t.minSize,children:(0,o.jsx)(`div`,{className:U(`@container p-4`,t.containerClass||_e),"data-testid":`form-pane:${t.key}`,children:t.fields.map(ye)})})]},t.key))})]}):(0,o.jsx)(`div`,{className:_e,children:D.map(ye)}),e.showActions!==!1&&(0,o.jsxs)(`div`,{className:U(`flex flex-col sm:flex-row gap-2 ${g===`horizontal`?`sm:justify-end`:`sm:justify-start`} mt-6`,e.mobileStickyActions&&`sticky bottom-0 z-10 -mx-4 px-4 py-3 bg-background/95 supports-[backdrop-filter]:bg-background/80 backdrop-blur border-t md:static md:mx-0 md:px-0 md:py-0 md:bg-transparent md:border-0 md:backdrop-blur-none`),"data-testid":e.mobileStickyActions?`form-mobile-sticky-actions`:void 0,children:[m&&(0,o.jsx)(q,{type:`button`,variant:`outline`,onClick:he,disabled:A||T,className:`w-full sm:w-auto`,children:p}),h&&(0,o.jsxs)(q,{type:`submit`,disabled:A||T,className:`w-full sm:w-auto`,children:[A&&(0,o.jsx)(c.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),f]})]})]})})},{namespace:`ui`,label:`Form`,inputs:[{name:`fields`,type:`array`,label:`Fields`,description:`Array of field configurations with name, label, type, validation, etc.`},{name:`defaultValues`,type:`object`,label:`Default Values`,description:`Object with default values for form fields`},{name:`submitLabel`,type:`string`,label:`Submit Button Label`,defaultValue:`Submit`},{name:`cancelLabel`,type:`string`,label:`Cancel Button Label`,defaultValue:`Cancel`},{name:`showCancel`,type:`boolean`,label:`Show Cancel Button`,defaultValue:!1},{name:`layout`,type:`enum`,enum:[`vertical`,`horizontal`],label:`Layout`,defaultValue:`vertical`},{name:`columns`,type:`number`,label:`Number of Columns`,defaultValue:1,description:`For multi-column layouts (1-4)`},{name:`validationMode`,type:`enum`,enum:[`onSubmit`,`onBlur`,`onChange`,`onTouched`,`all`],label:`Validation Mode`,defaultValue:`onSubmit`},{name:`resetOnSubmit`,type:`boolean`,label:`Reset After Submit`,defaultValue:!1},{name:`disabled`,type:`boolean`,label:`Disabled`,defaultValue:!1},{name:`className`,type:`string`,label:`CSS Class`},{name:`fieldContainerClass`,type:`string`,label:`Field Container CSS Class`}],defaultProps:{submitLabel:`Submit`,cancelLabel:`Cancel`,showCancel:!1,layout:`vertical`,columns:1,validationMode:`onSubmit`,resetOnSubmit:!1,disabled:!1,fields:[{name:`name`,label:`Name`,type:`input`,required:!0,placeholder:`Enter your name`},{name:`email`,label:`Email`,type:`input`,inputType:`email`,required:!0,placeholder:`Enter your email`}]}});var Io=new Set([`date`,`datetime-local`,`time`,`month`,`week`]);function Lo(e){if(!(!e||!Io.has(e)))return e=>{let t=e.currentTarget;if(!(t.disabled||t.readOnly))try{t.showPicker?.()}catch{}}}function Ro(e,n){let r=Do.has(e)?void 0:!e.includes(`:`)&&t.ComponentRegistry.get(`field:${e}`)||t.ComponentRegistry.get(e);if(r){let t=Po(e,n);return(0,o.jsx)(r,{schema:n.field||n.schema||n,...t})}let{inputType:i,options:a=[],placeholder:s,readonly:c,emptyHint:l,...u}=n,d=Ao(u),f=c&&`bg-muted/40 cursor-default focus-visible:ring-0`;switch(e){case`input`:if(i===`file`){let{value:e,...t}=d;return(0,o.jsx)(X,{type:`file`,placeholder:s,className:`min-h-[44px] sm:min-h-0`,...t})}return(0,o.jsx)(X,{type:i||`text`,placeholder:s,className:U(`min-h-[44px] sm:min-h-0`,f),...d,onClick:e=>{Lo(i)?.(e),d.onClick?.(e)},readOnly:c,value:d.value??``});case`textarea`:{let{mobile_fullscreen:e,fullscreen:t,label:n}=u,{label:r,...i}=Ao(u);return e||t?(0,o.jsx)(Fo,{placeholder:s,label:n,className:`min-h-[44px] sm:min-h-0`,...i,value:i.value??``}):(0,o.jsx)(Qi,{placeholder:s,className:U(`min-h-[44px] sm:min-h-0`,f),...i,readOnly:c,value:i.value??``})}case`checkbox`:{let{value:e,onChange:t,disabled:n,...r}=d;return(0,o.jsx)(vt,{checked:e,onCheckedChange:t,disabled:n||c,className:`min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0`,...r})}case`switch`:{let{value:e,onChange:t,disabled:n,...r}=d;return(0,o.jsx)(zi,{checked:e,onCheckedChange:t,disabled:n||c,className:`min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0`,...r})}case`select`:{let{value:e,onChange:t,disabled:n,...r}=d;return!a||a.length===0?(0,o.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:l||`No options available`}):(0,o.jsxs)(Mr,{value:po(e),onValueChange:e=>t?.(mo(a,e)),disabled:n||c,...r,children:[(0,o.jsx)(Fr,{className:`min-h-[44px] sm:min-h-0`,children:(0,o.jsx)(Pr,{placeholder:s||`Select an option`})}),(0,o.jsx)(Rr,{children:a.map(e=>(0,o.jsx)(Z,{value:String(e.value),children:e.label},String(e.value)))})]})}default:return(0,o.jsx)(X,{type:i||`text`,placeholder:s,className:U(f),...d,onClick:e=>{Lo(i)?.(e),d.onClick?.(e)},readOnly:c})}}function zo(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}var Bo={Home:`House`},Vo=(0,a.forwardRef)(({schema:e,...t},n)=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=t,l=null;if(e.icon){let t=zo(e.icon);l=c.icons[Bo[t]||t]}let u=e.loading||t.loading,d=e.disabled||t.disabled||u;return(0,o.jsxs)(q,{ref:n,type:e.buttonType||`button`,variant:e.variant,size:e.size,className:e.className,disabled:d,...s,"data-obj-id":r,"data-obj-type":i,style:a,children:[u&&(0,o.jsx)(c.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),!u&&l&&e.iconPosition!==`right`&&(0,o.jsx)(l,{className:`mr-2 h-4 w-4`}),e.label||W(e.body||e.children),!u&&l&&e.iconPosition===`right`&&(0,o.jsx)(l,{className:`ml-2 h-4 w-4`})]})});Vo.displayName=`ButtonRenderer`,t.ComponentRegistry.register(`button`,Vo,{namespace:`ui`,label:`Button`,inputs:[{name:`label`,type:`string`,label:`Label`,defaultValue:`Button`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`default`,`secondary`,`destructive`,`outline`,`ghost`,`link`],defaultValue:`default`},{name:`size`,type:`enum`,label:`Size`,enum:[`default`,`sm`,`lg`,`icon`],defaultValue:`default`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{label:`Button`,variant:`default`,size:`default`}}),t.ComponentRegistry.register(`label`,({schema:e,className:t,...n})=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=n;return(0,o.jsx)(Y,{className:t,...s,"data-obj-id":r,"data-obj-type":i,style:a,children:e.text||e.label||e.content})},{namespace:`ui`,label:`Label`,inputs:[{name:`text`,type:`string`,label:`Text`,required:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{text:`Label Text`}});var Ho=({schema:e,className:t,onChange:n,value:r,...i})=>{let a=e=>{n&&n(e.target.value)},{"data-obj-id":s,"data-obj-type":c,style:l,...u}=i;return(0,o.jsxs)(`div`,{className:U(`grid w-full items-center gap-1.5`,e.wrapperClass),"data-obj-id":s,"data-obj-type":c,style:l,children:[e.label&&(0,o.jsx)(Y,{htmlFor:e.id,className:U(e.required&&`text-destructive after:content-['*'] after:ml-0.5`),children:e.label}),(0,o.jsx)(X,{type:e.inputType||`text`,id:e.id,name:e.name,placeholder:e.placeholder,className:t,required:e.required,disabled:e.disabled,readOnly:e.readOnly,value:r??e.value??``,defaultValue:r===void 0?e.defaultValue:void 0,onChange:a,min:e.min,max:e.max,step:e.step,maxLength:e.maxLength,pattern:e.pattern,...u}),e.description&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description}),e.error&&(0,o.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:e.error})]})};t.ComponentRegistry.register(`input`,Ho,{namespace:`ui`,label:`Input Field`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`name`,type:`string`,label:`Field Name`},{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`inputType`,type:`enum`,label:`Type`,enum:[`text`,`email`,`password`,`number`,`tel`,`url`,`date`,`time`,`datetime-local`],defaultValue:`text`},{name:`required`,type:`boolean`,label:`Required`},{name:`disabled`,type:`boolean`,label:`Disabled`},{name:`description`,type:`string`,label:`Description`}],defaultProps:{inputType:`text`}}),t.ComponentRegistry.register(`email`,e=>(0,o.jsx)(Ho,{...e,schema:{...e.schema,inputType:`email`}}),{namespace:`ui`,label:`Email Input`,icon:`mail`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`name`,type:`string`,label:`Field Name`},{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`required`,type:`boolean`,label:`Required`},{name:`disabled`,type:`boolean`,label:`Disabled`},{name:`description`,type:`string`,label:`Description`}]}),t.ComponentRegistry.register(`password`,e=>(0,o.jsx)(Ho,{...e,schema:{...e.schema,inputType:`password`}}),{namespace:`ui`,label:`Password Input`,icon:`lock`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`name`,type:`string`,label:`Field Name`},{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`required`,type:`boolean`,label:`Required`},{name:`disabled`,type:`boolean`,label:`Disabled`},{name:`description`,type:`string`,label:`Description`}]}),t.ComponentRegistry.register(`textarea`,({schema:e,className:t,onChange:n,value:r,...i})=>{let a=e=>{n&&n(e.target.value)},{"data-obj-id":s,"data-obj-type":c,style:l,...u}=i;return(0,o.jsxs)(`div`,{className:U(`grid w-full gap-1.5`,e.wrapperClass),"data-obj-id":s,"data-obj-type":c,style:l,children:[e.label&&(0,o.jsx)(Y,{htmlFor:e.id,className:U(e.required&&`text-destructive after:content-['*'] after:ml-0.5`),children:e.label}),(0,o.jsx)(Qi,{id:e.id,name:e.name,placeholder:e.placeholder,className:t,disabled:e.disabled,readOnly:e.readOnly,required:e.required,rows:e.rows,value:r??e.value??``,defaultValue:r===void 0?e.defaultValue:void 0,onChange:a,...u})]})},{namespace:`ui`,label:`Textarea`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`rows`,type:`number`,label:`Rows`},{name:`required`,type:`boolean`,label:`Required`},{name:`disabled`,type:`boolean`,label:`Disabled`},{name:`id`,type:`string`,label:`ID`,required:!0}],defaultProps:{label:`Textarea label`,placeholder:`Enter text here...`,rows:3,id:`textarea-field`}}),t.ComponentRegistry.register(`checkbox`,({schema:e,className:t,onChange:n,value:r,...i})=>{let{"data-obj-id":a,"data-obj-type":s,style:c,...l}=i;return(0,o.jsxs)(`div`,{className:U(`flex items-center space-x-2`,e.wrapperClass),"data-obj-id":a,"data-obj-type":s,style:c,children:[(0,o.jsx)(vt,{id:e.id,className:t,checked:r??e.checked??!1,defaultChecked:r===void 0?e.defaultChecked:void 0,onCheckedChange:e=>{n&&n(e)},disabled:e.disabled,required:e.required,name:e.name,...l}),(0,o.jsx)(Y,{htmlFor:e.id,className:U(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,e.required&&`text-destructive after:content-['*'] after:ml-0.5`),children:e.label})]})},{namespace:`ui`,label:`Checkbox`,inputs:[{name:`label`,type:`string`,label:`Label`,required:!0},{name:`id`,type:`string`,label:`ID`,required:!0},{name:`checked`,type:`boolean`,label:`Checked`},{name:`required`,type:`boolean`,label:`Required`},{name:`disabled`,type:`boolean`,label:`Disabled`}],defaultProps:{label:`Checkbox label`,id:`checkbox-field`}}),t.ComponentRegistry.register(`switch`,({schema:e,className:t,...n})=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=n;return(0,o.jsxs)(`div`,{className:`flex items-center space-x-2 ${e.wrapperClass||``}`,"data-obj-id":r,"data-obj-type":i,style:a,children:[(0,o.jsx)(zi,{id:e.id,className:t,...s}),(0,o.jsx)(Y,{htmlFor:e.id,children:e.label})]})},{namespace:`ui`,label:`Switch`,inputs:[{name:`label`,type:`string`,label:`Label`,required:!0},{name:`id`,type:`string`,label:`ID`,required:!0},{name:`checked`,type:`boolean`,label:`Checked`}],defaultProps:{label:`Switch label`,id:`switch-field`}}),t.ComponentRegistry.register(`select`,({schema:e,className:t,onChange:n,value:r,...i})=>{let{"data-obj-id":a,"data-obj-type":s,style:c,...l}=i;return(0,o.jsxs)(`div`,{className:U(`grid w-full items-center gap-1.5`,e.wrapperClass),"data-obj-id":a,"data-obj-type":s,style:c,children:[e.label&&(0,o.jsx)(Y,{className:U(e.required&&`text-destructive after:content-['*'] after:ml-0.5`),children:e.label}),(0,o.jsxs)(Mr,{defaultValue:r===void 0?po(e.defaultValue):void 0,value:po(r??e.value),onValueChange:t=>{n&&n(mo(e.options,t))},disabled:e.disabled,required:e.required,name:e.name,...l,children:[(0,o.jsx)(Fr,{className:t,children:(0,o.jsx)(Pr,{placeholder:e.placeholder})}),(0,o.jsx)(Rr,{children:e.options?.map(e=>(0,o.jsx)(Z,{value:String(e.value),disabled:e.disabled,children:e.label},String(e.value)))})]})]})},{namespace:`ui`,label:`Select`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`defaultValue`,type:`string`,label:`Default Value`},{name:`required`,type:`boolean`,label:`Required`},{name:`disabled`,type:`boolean`,label:`Disabled`},{name:`options`,type:`array`,label:`Options`,description:`Array of {label, value} objects`}],defaultProps:{label:`Select an option`,placeholder:`Choose...`,options:[{label:`Option 1`,value:`option1`},{label:`Option 2`,value:`option2`},{label:`Option 3`,value:`option3`}]}}),t.ComponentRegistry.register(`radio-group`,({schema:e,className:t,...n})=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=n;return(0,o.jsx)(Or,{defaultValue:po(e.defaultValue),className:t,...s,"data-obj-id":r,"data-obj-type":i,style:a,children:e.options?.map(t=>(0,o.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,o.jsx)(kr,{value:String(t.value),id:`${e.id}-${String(t.value)}`}),(0,o.jsx)(Y,{htmlFor:`${e.id}-${String(t.value)}`,children:t.label})]},String(t.value)))})},{namespace:`ui`,label:`Radio Group`,inputs:[{name:`defaultValue`,type:`string`,label:`Default Value`},{name:`id`,type:`string`,label:`Group ID`,required:!0},{name:`options`,type:`array`,label:`Options`,description:`Array of {label, value} objects`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{id:`radio-group`,options:[{label:`Option 1`,value:`option1`},{label:`Option 2`,value:`option2`},{label:`Option 3`,value:`option3`}]}}),t.ComponentRegistry.register(`slider`,({schema:e,className:t,...n})=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=n;return(0,o.jsx)(Li,{defaultValue:Array.isArray(e.defaultValue)?e.defaultValue:e.defaultValue===void 0?void 0:[e.defaultValue],max:e.max,min:e.min,step:e.step,className:t,...s,"data-obj-id":r,"data-obj-type":i,style:a})},{namespace:`ui`,label:`Slider`,inputs:[{name:`defaultValue`,type:`array`,label:`Default Value`,defaultValue:[50]},{name:`max`,type:`number`,label:`Max`,defaultValue:100},{name:`min`,type:`number`,label:`Min`,defaultValue:0},{name:`step`,type:`number`,label:`Step`,defaultValue:1},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{defaultValue:[50],max:100,min:0,step:1,className:`w-full`}}),t.ComponentRegistry.register(`toggle`,({schema:e,...t})=>(0,o.jsx)(ea,{variant:e.variant,size:e.size,pressed:e.pressed,"aria-label":e.ariaLabel,...t,children:e.label||W(e.children)}),{namespace:`ui`,label:`Toggle`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`pressed`,type:`boolean`,label:`Pressed`},{name:`variant`,type:`enum`,enum:[`default`,`outline`],defaultValue:`default`,label:`Variant`},{name:`size`,type:`enum`,enum:[`default`,`sm`,`lg`],defaultValue:`default`,label:`Size`},{name:`ariaLabel`,type:`string`,label:`Aria Label`}],defaultProps:{label:`Toggle`,variant:`default`,size:`default`}}),t.ComponentRegistry.register(`input-otp`,({schema:e,className:t,onChange:n,value:r,...i})=>{let a=e.maxLength||6,s=Array.from({length:a});return(0,o.jsx)(Hn,{maxLength:a,className:t,value:r??e.value,onChange:e=>{n&&n(e)},...i,children:(0,o.jsx)(Un,{children:s.map((e,t)=>(0,o.jsx)(Wn,{index:t},t))})})},{namespace:`ui`,label:`Input OTP`,inputs:[{name:`maxLength`,type:`number`,label:`Max Length`,defaultValue:6},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{maxLength:6}}),t.ComponentRegistry.register(`calendar`,({schema:e,className:t,...n})=>(0,o.jsx)(Je,{mode:e.mode||`single`,selected:e.value||e.defaultValue,className:t,...n}),{namespace:`ui`,skipFallback:!0,label:`Calendar`,inputs:[{name:`mode`,type:`enum`,enum:[`default`,`single`,`multiple`,`range`],defaultValue:`single`,label:`Mode`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{mode:`single`,className:`rounded-md border`}}),t.ComponentRegistry.register(`date-picker`,({schema:e,className:t,value:n,onChange:r,...i})=>{let a=e=>{r&&r(e)},{"data-obj-id":s,"data-obj-type":l,style:u,...d}=i;return(0,o.jsxs)(`div`,{className:`grid w-full max-w-sm items-center gap-1.5 ${e.wrapperClass||``}`,"data-obj-id":s,"data-obj-type":l,style:u,children:[e.label&&(0,o.jsx)(Y,{htmlFor:e.id,children:e.label}),(0,o.jsxs)(wr,{children:[(0,o.jsx)(Tr,{asChild:!0,children:(0,o.jsxs)(q,{id:e.id,variant:`outline`,className:U(`w-full justify-start text-left font-normal`,!n&&`text-muted-foreground`,t),...d,children:[(0,o.jsx)(c.CalendarIcon,{className:`mr-2 h-4 w-4`}),n?(0,ae.format)(n,e.format||`PPP`):(0,o.jsx)(`span`,{children:e.placeholder||`Pick a date`})]})}),(0,o.jsx)(Er,{className:`w-auto p-0`,children:(0,o.jsx)(Je,{mode:`single`,selected:n,onSelect:a,autoFocus:!0})})]})]})},{namespace:`ui`,label:`Date Picker`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`format`,type:`string`,label:`Date Format`,description:`date-fns format string (e.g., "PPP", "yyyy-MM-dd")`},{name:`id`,type:`string`,label:`ID`,required:!0}],defaultProps:{label:`Date`,placeholder:`Pick a date`,format:`PPP`,id:`date-picker-field`}}),t.ComponentRegistry.register(`file-upload`,({schema:e,className:t,value:n,onChange:r,...i})=>{let[s,l]=(0,a.useState)(n||[]),[u,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(0),m=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(u){let e=setInterval(()=>{p(t=>t>=100?(clearInterval(e),d(!1),0):t+5)},50);return()=>clearInterval(e)}},[u]);let h=t=>{let n=Array.from(t.target.files||[]);if(n.length>0){d(!0),p(0);let t=e.multiple?[...s,...n]:n;setTimeout(()=>{l(t),r&&r(t)},1e3)}},g=e=>{let t=s.filter((t,n)=>n!==e);l(t),r&&r(t)},_=()=>{m.current?.click()},{"data-obj-id":v,"data-obj-type":y,style:b,...x}=i;return(0,o.jsxs)(`div`,{className:`grid w-full max-w-sm items-center gap-2 ${e.wrapperClass||``}`,"data-obj-id":v,"data-obj-type":y,style:b,children:[e.label&&(0,o.jsx)(Y,{htmlFor:e.id,children:e.label}),(0,o.jsxs)(`div`,{className:U(`relative flex flex-col gap-3 group/upload`,t),children:[(0,o.jsx)(`input`,{ref:m,type:`file`,id:e.id,className:`hidden`,accept:e.accept,multiple:e.multiple,onChange:h,...x}),(0,o.jsxs)(`div`,{onClick:_,className:U(`relative overflow-hidden cursor-pointer rounded-lg border-2 border-dashed transition-all duration-300 min-h-[120px] flex flex-col items-center justify-center p-4 sm:p-6 gap-3`,u?`border-cyan-400 bg-cyan-950/30`:`border-slate-700 bg-slate-900/50 hover:bg-slate-900 hover:border-cyan-500/50 hover:shadow-[0_0_20px_-5px_rgba(6,182,212,0.3)]`),children:[(0,o.jsx)(`div`,{className:`absolute inset-0 bg-[url('https://grainy-gradients.vercel.app/noise.svg')] opacity-5 pointer-events-none`}),(0,o.jsx)(`div`,{className:`absolute inset-0 bg-[linear-gradient(to_right,#80808012_1px,transparent_1px),linear-gradient(to_bottom,#80808012_1px,transparent_1px)] bg-[size:14px_24px] pointer-events-none`}),(0,o.jsx)(`div`,{className:U(`relative z-10 p-3 rounded-full bg-slate-800 border border-slate-700 transition-all duration-500`,u?`scale-110 shadow-[0_0_30px_cyan] border-cyan-400 animate-bounce`:`group-hover/upload:scale-110 group-hover/upload:shadow-lg group-hover/upload:border-cyan-500`),children:u?(0,o.jsx)(c.Rocket,{className:`w-8 h-8 text-cyan-300 animate-pulse`}):(0,o.jsx)(c.Upload,{className:`w-6 h-6 text-slate-400 group-hover/upload:text-cyan-400`})}),(0,o.jsx)(`div`,{className:`relative z-10 text-center`,children:(0,o.jsx)(`p`,{className:U(`text-xs font-mono uppercase tracking-widest transition-colors`,u?`text-cyan-300`:`text-slate-500 group-hover/upload:text-cyan-200`),children:u?`INITIATING LAUNCH SEQUENCE...`:e.buttonText||`DROP PAYLOAD OR CLICK TO UPLOAD`})}),u&&(0,o.jsx)(`div`,{className:`absolute bottom-0 left-0 h-1 bg-cyan-500 shadow-[0_0_10px_cyan] transition-all duration-75 ease-out`,style:{width:`${f}%`}})]}),s.length>0&&(0,o.jsx)(`div`,{className:`flex flex-col gap-2 mt-1 perspective-1000`,children:s.map((e,t)=>(0,o.jsxs)(`div`,{className:`relative group/file overflow-hidden flex items-center justify-between p-3 border border-border bg-card/80 rounded-sm text-sm transition-all hover:border-primary/30 hover:shadow-lg hover:shadow-primary/10 animate-in slide-in-from-bottom-2 fade-in`,children:[(0,o.jsx)(`div`,{className:`absolute left-0 top-0 bottom-0 w-[2px] bg-primary/50 group-hover/file:bg-primary group-hover/file:shadow-[0_0_8px_hsl(var(--primary))]`}),(0,o.jsxs)(`div`,{className:`flex items-center gap-3 z-10`,children:[(0,o.jsx)(c.CheckCircle2,{className:`w-4 h-4 text-emerald-500 rounded-full`}),(0,o.jsx)(`span`,{className:`truncate max-w-[150px] sm:max-w-[200px] md:max-w-[300px] text-muted-foreground group-hover/file:text-foreground font-mono text-xs transition-colors`,children:e.name})]}),(0,o.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-destructive/10 hover:text-destructive`,onClick:()=>g(t),children:(0,o.jsx)(c.X,{className:`h-3 w-3`})}),(0,o.jsx)(`div`,{className:`absolute inset-0 bg-gradient-to-r from-transparent via-primary/5 to-transparent -translate-x-full group-hover/file:animate-[shimmer_1s_infinite] pointer-events-none`})]},t))})]})]})},{namespace:`ui`,label:`File Upload`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`buttonText`,type:`string`,label:`Button Text`},{name:`accept`,type:`string`,label:`Accepted File Types`,description:`MIME types (e.g., "image/*,application/pdf")`},{name:`multiple`,type:`boolean`,label:`Allow Multiple Files`},{name:`id`,type:`string`,label:`ID`,required:!0}],defaultProps:{label:`Upload files`,buttonText:`Choose files`,multiple:!0,id:`file-upload-field`}});var Uo=(0,d.cva)(`flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none`}},defaultVariants:{orientation:`horizontal`}});function Wo({className:e,orientation:t,...n}){return(0,o.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:U(Uo({orientation:t}),e),...n})}function Go({className:e,asChild:t=!1,...n}){return(0,o.jsx)(t?u.Slot:`div`,{className:U(`bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e),...n})}function Ko({className:e,orientation:t=`vertical`,...n}){return(0,o.jsx)(Vr,{"data-slot":`button-group-separator`,orientation:t,className:U(`bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto`,e),...n})}function qo({options:e,value:t,onValueChange:n,placeholder:r=`Select option...`,searchPlaceholder:i=`Search...`,emptyText:s=`No option found.`,className:l,disabled:u}){let[d,f]=a.useState(!1);return(0,o.jsxs)(wr,{open:d,onOpenChange:f,children:[(0,o.jsx)(Tr,{asChild:!0,children:(0,o.jsxs)(q,{variant:`outline`,role:`combobox`,"aria-expanded":d,className:U(`w-[200px] min-w-0 justify-between`,l),disabled:u,children:[(0,o.jsx)(`span`,{className:`truncate`,children:t?e.find(e=>e.value===t)?.label:r}),(0,o.jsx)(c.ChevronsUpDown,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})}),(0,o.jsx)(Er,{className:`w-[var(--radix-popover-trigger-width)] min-w-[200px] p-0`,children:(0,o.jsxs)(Mt,{children:[(0,o.jsx)(Pt,{placeholder:i}),(0,o.jsxs)(Ft,{children:[(0,o.jsx)(It,{children:s}),(0,o.jsx)(Lt,{children:e.map(e=>(0,o.jsxs)(zt,{value:e.value,onSelect:e=>{n?.(e===t?``:e),f(!1)},children:[(0,o.jsx)(c.Check,{className:U(`mr-2 h-4 w-4`,t===e.value?`opacity-100`:`opacity-0`)}),e.label]},e.value))})]})]})})]})}function Jo({label:e,value:t,onClick:n,children:r,className:i}){return(0,o.jsxs)(n?`button`:`div`,{className:U(`flex items-center justify-between py-1.5 min-h-[32px] w-full text-left`,n&&`cursor-pointer hover:bg-accent/50 rounded-sm -mx-1 px-1`,i),onClick:n,type:n?`button`:void 0,children:[(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0 max-w-[45%] truncate`,title:e,children:e}),r||(0,o.jsx)(`span`,{className:`text-xs text-foreground truncate ml-4 text-right max-w-[55%]`,title:t,children:t})]})}var Yo=[{value:`equals`,label:`Equals`},{value:`notEquals`,label:`Does not equal`},{value:`contains`,label:`Contains`},{value:`notContains`,label:`Does not contain`},{value:`isEmpty`,label:`Is empty`},{value:`isNotEmpty`,label:`Is not empty`},{value:`greaterThan`,label:`Greater than`},{value:`lessThan`,label:`Less than`},{value:`greaterOrEqual`,label:`Greater than or equal`},{value:`lessOrEqual`,label:`Less than or equal`},{value:`before`,label:`Before`},{value:`after`,label:`After`},{value:`between`,label:`Between`},{value:`in`,label:`In`},{value:`notIn`,label:`Not in`},{value:`startsWith`,label:`Starts with`},{value:`endsWith`,label:`Ends with`},{value:`isNull`,label:`Is null`},{value:`isNotNull`,label:`Is not null`},{value:`exists`,label:`Is set`},{value:`notExists`,label:`Is not set`}],Xo=Yo.map(e=>e.value),Zo=(0,B.createSafeTranslation)({"filterBuilder.where":`Where`,"filterBuilder.and":`AND`,"filterBuilder.or":`OR`,"filterBuilder.clearAll":`Clear all`,"filterBuilder.selectField":`Select field`,"filterBuilder.operator":`Operator`,"filterBuilder.selectValue":`Select value`,"filterBuilder.value":`Value`,"filterBuilder.addFilter":`Add filter`,"filterBuilder.removeCondition":`Remove condition`,"filterBuilder.trueLabel":`True`,"filterBuilder.falseLabel":`False`,"filterBuilder.noResults":`No results`,"filterBuilder.searchField":`Search {{label}}…`,"filterBuilder.enterId":`Enter {{label}} id`,"filterBuilder.operators.equals":`Equals`,"filterBuilder.operators.notEquals":`Does not equal`,"filterBuilder.operators.contains":`Contains`,"filterBuilder.operators.notContains":`Does not contain`,"filterBuilder.operators.isEmpty":`Is empty`,"filterBuilder.operators.isNotEmpty":`Is not empty`,"filterBuilder.operators.greaterThan":`Greater than`,"filterBuilder.operators.lessThan":`Less than`,"filterBuilder.operators.greaterOrEqual":`Greater than or equal`,"filterBuilder.operators.lessOrEqual":`Less than or equal`,"filterBuilder.operators.before":`Before`,"filterBuilder.operators.after":`After`,"filterBuilder.operators.between":`Between`,"filterBuilder.operators.in":`In`,"filterBuilder.operators.notIn":`Not in`,"filterBuilder.operators.startsWith":`Starts with`,"filterBuilder.operators.endsWith":`Ends with`,"filterBuilder.operators.isNull":`Is null`,"filterBuilder.operators.isNotNull":`Is not null`,"filterBuilder.operators.exists":`Is set`,"filterBuilder.operators.notExists":`Is not set`},`filterBuilder.where`),Qo=[`isNull`,`isNotNull`,`exists`,`notExists`],$o=[`equals`,`notEquals`,`contains`,`notContains`,`startsWith`,`endsWith`,`isEmpty`,`isNotEmpty`,...Qo],es=[`equals`,`notEquals`,`greaterThan`,`lessThan`,`greaterOrEqual`,`lessOrEqual`,`isEmpty`,`isNotEmpty`,...Qo],ts=[`equals`,`notEquals`],ns=[`equals`,`notEquals`,`before`,`after`,`between`,`isEmpty`,`isNotEmpty`,...Qo],rs=[`equals`,`notEquals`,`in`,`notIn`,`isEmpty`,`isNotEmpty`,...Qo],is=[`equals`,`notEquals`,`in`,`notIn`,`isEmpty`,`isNotEmpty`,...Qo],as=[`number`,`currency`,`percent`,`rating`],os=[`date`,`datetime`,`time`],ss=[`select`,`status`],cs=[`lookup`,`master_detail`,`user`,`owner`];function ls(e){return Array.isArray(e)?e:e!=null&&e!==``?[e]:[]}function us(e){return!!e&&typeof e==`object`&&Array.isArray(e.conditions)&&(e.logic===`and`||e.logic===`or`)}var ds={id:`root`,logic:`and`,conditions:[]};function fs({fields:e=[],value:t,onChange:n,className:r,showClearAll:i=!0}){let{t:s}=Zo(),[l,u]=a.useState(us(t)?t:ds);a.useEffect(()=>{us(t)&&JSON.stringify(t)!==JSON.stringify(l)&&u(t)},[t]);let d=e=>{u(e),n?.(e)},f=()=>{let t={id:crypto.randomUUID(),field:e[0]?.value||``,operator:`equals`,value:``};d({...l,conditions:[...l.conditions,t]})},p=e=>{d({...l,conditions:l.conditions.filter(t=>t.id!==e)})},m=()=>{d({...l,conditions:[]})},h=(e,t)=>{d({...l,conditions:l.conditions.map(n=>n.id===e?{...n,...t}:n)})},g=()=>{d({...l,logic:l.logic===`and`?`or`:`and`})},_=t=>{let n=e.find(e=>e.value===t)?.type||`text`;return as.includes(n)?Yo.filter(e=>es.includes(e.value)):n===`boolean`?Yo.filter(e=>ts.includes(e.value)):os.includes(n)?Yo.filter(e=>ns.includes(e.value)):ss.includes(n)?Yo.filter(e=>rs.includes(e.value)):cs.includes(n)?Yo.filter(e=>is.includes(e.value)):Yo.filter(e=>$o.includes(e.value))},v=e=>![`isEmpty`,`isNotEmpty`,`isNull`,`isNotNull`,`exists`,`notExists`].includes(e),y=t=>{let n=e.find(e=>e.value===t)?.type||`text`;return as.includes(n)?`number`:n===`date`?`date`:n===`datetime`?`datetime-local`:n===`time`?`time`:`text`},b=t=>{let n=e.find(e=>e.value===t.field),r=[`in`,`notIn`].includes(t.operator);if(cs.includes(n?.type||``)&&!n?.options&&(n?.referenceTo||n?.type===`user`||n?.type===`owner`))return(0,o.jsx)(ps,{field:n,value:t.value,multiple:r,onChange:e=>h(t.id,{value:e})});if(n?.options&&r){let e=ls(t.value);return(0,o.jsx)(`div`,{className:`max-h-40 overflow-y-auto space-y-0.5 border rounded-md p-2`,children:n.options.map(n=>{let r=e.map(String).includes(String(n.value));return(0,o.jsxs)(`label`,{className:U(`flex items-center gap-2 text-sm py-1 px-1.5 rounded cursor-pointer`,r?`bg-primary/5 text-primary`:`hover:bg-muted`),children:[(0,o.jsx)(vt,{checked:r,onCheckedChange:r=>{let i=r?[...e,n.value]:e.filter(e=>String(e)!==String(n.value));h(t.id,{value:i})}}),(0,o.jsx)(`span`,{className:`truncate`,children:n.label})]},n.value)})})}if(n?.options&&(ss.includes(n.type||``)||cs.includes(n.type||``)))return(0,o.jsxs)(Mr,{value:String(t.value||``),onValueChange:e=>h(t.id,{value:e}),children:[(0,o.jsx)(Fr,{className:`h-9 text-sm`,children:(0,o.jsx)(Pr,{placeholder:s(`filterBuilder.selectValue`)})}),(0,o.jsx)(Rr,{children:n.options.map(e=>(0,o.jsx)(Z,{value:e.value,children:e.label},e.value))})]});if(n?.type===`boolean`)return(0,o.jsxs)(Mr,{value:String(t.value||``),onValueChange:e=>h(t.id,{value:e===`true`}),children:[(0,o.jsx)(Fr,{className:`h-9 text-sm`,children:(0,o.jsx)(Pr,{placeholder:s(`filterBuilder.selectValue`)})}),(0,o.jsxs)(Rr,{children:[(0,o.jsx)(Z,{value:`true`,children:s(`filterBuilder.trueLabel`)}),(0,o.jsx)(Z,{value:`false`,children:s(`filterBuilder.falseLabel`)})]})]});let i=y(t.field),a=()=>t.value?i===`date`&&typeof t.value==`string`?t.value.split(`T`)[0]:String(t.value):``,c=e=>{let r=e;as.includes(n?.type||``)&&e!==``?r=parseFloat(e)||0:os.includes(n?.type||``)&&(r=e),h(t.id,{value:r})};return(0,o.jsx)(X,{type:i,className:`h-9 text-sm`,placeholder:s(`filterBuilder.value`),value:a(),onChange:e=>c(e.target.value)})};return(0,o.jsxs)(`div`,{className:U(`space-y-3`,r),children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(`span`,{className:`text-sm font-medium`,children:s(`filterBuilder.where`)}),l.conditions.length>1&&(0,o.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:g,className:`h-7 text-xs`,children:l.logic===`or`?s(`filterBuilder.or`):s(`filterBuilder.and`)})]}),i&&l.conditions.length>0&&(0,o.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:m,className:`h-7 text-xs text-muted-foreground hover:text-destructive`,children:[(0,o.jsx)(c.Trash2,{className:`h-3 w-3 mr-1`}),s(`filterBuilder.clearAll`)]})]}),(0,o.jsx)(`div`,{className:`space-y-2`,children:l.conditions.map(t=>(0,o.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,o.jsxs)(`div`,{className:`flex-1 grid grid-cols-12 gap-2`,children:[(0,o.jsx)(`div`,{className:`col-span-4`,children:(0,o.jsxs)(Mr,{value:t.field,onValueChange:e=>h(t.id,{field:e}),children:[(0,o.jsx)(Fr,{className:`h-9 text-sm`,children:(0,o.jsx)(Pr,{placeholder:s(`filterBuilder.selectField`)})}),(0,o.jsx)(Rr,{children:e.map(e=>(0,o.jsx)(Z,{value:e.value,children:e.label},e.value))})]})}),(0,o.jsx)(`div`,{className:`col-span-4`,children:(0,o.jsxs)(Mr,{value:t.operator,onValueChange:e=>h(t.id,{operator:e}),children:[(0,o.jsx)(Fr,{className:`h-9 text-sm`,children:(0,o.jsx)(Pr,{placeholder:s(`filterBuilder.operator`)})}),(0,o.jsx)(Rr,{children:_(t.field).map(e=>(0,o.jsx)(Z,{value:e.value,children:s(`filterBuilder.operators.${e.value}`)},e.value))})]})}),v(t.operator)&&(0,o.jsx)(`div`,{className:`col-span-4`,children:b(t)})]}),(0,o.jsxs)(q,{type:`button`,variant:`ghost`,size:`icon`,className:`h-9 w-9 shrink-0`,onClick:()=>p(t.id),children:[(0,o.jsx)(c.X,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:s(`filterBuilder.removeCondition`)})]})]},t.id))}),(0,o.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:f,className:`h-8`,disabled:e.length===0,children:[(0,o.jsx)(c.Plus,{className:`h-3 w-3`}),s(`filterBuilder.addFilter`)]})]})}fs.displayName=`FilterBuilder`;function ps({field:e,value:t,multiple:n,onChange:r}){let{t:s}=Zo(),l=a.useContext(i.SchemaRendererContext)?.dataSource??null,u=e.referenceTo||(e.type===`user`||e.type===`owner`?`users`:void 0),d=e.displayField||`name`,f=e.idField||`id`,[p,m]=a.useState(!1),[h,g]=a.useState(``),[_,v]=a.useState([]),[y,b]=a.useState(!1),[x,S]=a.useState(null),[C,w]=a.useState({}),T=a.useRef(null),E=a.useMemo(()=>n?ls(t).map(e=>String(e)):t==null||t===``?[]:[String(t)],[t,n]),D=l!=null&&typeof l.find==`function`&&!!u,O=a.useCallback(e=>{let t=e?.[f]??e?.id??e?._id,n=e?.[d]??e?.label??e?.name??String(t);return{value:t,label:String(n)}},[d,f]),k=a.useCallback(async e=>{if(D){b(!0),S(null);try{let t={$top:50};e&&e.trim()&&(t.$search=e.trim());let n=await l.find(u,t),r=(n?.data??n??[]).map(O);v(r),r.length>0&&w(e=>{let t={...e};for(let e of r)t[String(e.value)]=e.label;return t})}catch(e){S(e instanceof Error?e.message:String(e)),v([])}finally{b(!1)}}},[l,u,D,O]);a.useEffect(()=>{if(!D||E.length===0)return;let e=E.filter(e=>!(e in C));if(e.length===0)return;let t=!1;return(async()=>{try{let n=await l.find(u,{$top:e.length,$filter:{[f]:{$in:e}}}),r=n?.data??n??[];if(t)return;w(e=>{let t={...e};for(let e of r){let n=O(e);t[String(n.value)]=n.label}return t})}catch{}})(),()=>{t=!0}},[E,D,l,u,f,O,C]),a.useEffect(()=>{p&&D&&_.length===0&&k()},[p]);let A=e=>{g(e),D&&(T.current&&clearTimeout(T.current),T.current=setTimeout(()=>k(e||void 0),300))},j=e=>{if(n){let n=ls(t);r(n.map(String).includes(String(e))?n.filter(t=>String(t)!==String(e)):[...n,e])}else r(e),m(!1)};return D?(0,o.jsxs)(wr,{open:p,onOpenChange:m,children:[(0,o.jsx)(Tr,{asChild:!0,children:(0,o.jsxs)(`button`,{type:`button`,className:U(`inline-flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 text-sm`,`hover:bg-accent hover:text-accent-foreground`,`focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1`),"data-testid":`lookup-picker-${e.value}`,children:[E.length===0?(0,o.jsx)(`span`,{className:`text-muted-foreground truncate`,children:s(`filterBuilder.searchField`,{label:e.label})}):n?(0,o.jsx)(`span`,{className:`truncate`,children:E.length===1?C[E[0]]||E[0]:`${E.length} selected`}):(0,o.jsx)(`span`,{className:`truncate`,children:C[E[0]]||E[0]}),(0,o.jsxs)(`span`,{className:`flex items-center gap-1 shrink-0`,children:[E.length>0&&(0,o.jsx)(c.X,{className:`h-3.5 w-3.5 opacity-60 hover:opacity-100`,onClick:e=>{e.stopPropagation(),r(n?[]:``)}}),(0,o.jsx)(c.ChevronDown,{className:`h-3.5 w-3.5 opacity-60`})]})]})}),(0,o.jsxs)(Er,{align:`start`,className:`w-72 p-0`,children:[(0,o.jsxs)(`div`,{className:`flex items-center border-b px-3`,children:[(0,o.jsx)(c.Search,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,o.jsx)(`input`,{autoFocus:!0,value:h,onChange:e=>A(e.target.value),placeholder:s(`filterBuilder.searchField`,{label:e.label}),className:`flex h-9 w-full bg-transparent px-2 py-1 text-sm outline-none placeholder:text-muted-foreground`,"data-testid":`lookup-search-${e.value}`}),y&&(0,o.jsx)(c.Loader2,{className:`h-3.5 w-3.5 animate-spin text-muted-foreground`})]}),(0,o.jsxs)(`div`,{className:`max-h-64 overflow-y-auto p-1`,"data-testid":`lookup-options-${e.value}`,children:[x&&(0,o.jsx)(`div`,{className:`px-3 py-2 text-xs text-destructive`,children:x}),!x&&!y&&_.length===0&&(0,o.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:s(`filterBuilder.noResults`)}),_.map(e=>{let t=E.includes(String(e.value));return(0,o.jsxs)(`label`,{className:U(`flex items-center gap-2 px-2 py-1.5 rounded text-sm cursor-pointer`,t?`bg-primary/5 text-primary`:`hover:bg-muted`),children:[n?(0,o.jsx)(vt,{checked:t,onCheckedChange:()=>j(e.value)}):(0,o.jsx)(`input`,{type:`radio`,checked:t,onChange:()=>j(e.value),className:`rounded-full border-input`}),(0,o.jsx)(`span`,{className:`truncate flex-1`,children:e.label})]},String(e.value))})]})]})]}):(0,o.jsx)(X,{className:`h-9 text-sm`,placeholder:s(`filterBuilder.enterId`,{label:e.label}),value:E[0]??``,onChange:e=>r(e.target.value)})}var ms=(0,B.createSafeTranslation)({"sortBuilder.sortBy":`Sort by`,"sortBuilder.thenBy":`Then by`,"sortBuilder.selectField":`Select field`,"sortBuilder.ascending":`A → Z`,"sortBuilder.descending":`Z → A`,"sortBuilder.addSort":`Add sort`,"sortBuilder.removeSort":`Remove sort`},`sortBuilder.sortBy`);function hs({fields:e=[],value:t=[],onChange:n,className:r}){let{t:i}=ms(),s=a.useCallback(e=>(e||[]).map((e,t)=>({id:e?.id??(typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`sort-${t}-${e?.field??``}`),field:e?.field??``,order:e?.order??e?.sortOrder??`asc`})),[]),[l,u]=a.useState(()=>s(t));a.useEffect(()=>{let e=s(t),n=e=>e.map(({id:e,...t})=>t);JSON.stringify(n(e))!==JSON.stringify(n(l))&&u(e)},[t,l,s]);let d=e=>{u(e),n?.(e)},f=()=>{let t={id:crypto.randomUUID(),field:e[0]?.value||``,order:`asc`};d([...l,t])},p=(e,t)=>{d(l.map(n=>n.id===e?{...n,...t}:n))},m=e=>{d(l.filter(t=>t.id!==e))};return(0,o.jsxs)(`div`,{className:U(`space-y-3`,r),children:[(0,o.jsx)(`div`,{className:`space-y-2`,children:l.map((t,n)=>(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(`span`,{className:`text-sm font-medium w-16 text-muted-foreground`,children:i(n===0?`sortBuilder.sortBy`:`sortBuilder.thenBy`)}),(0,o.jsx)(`div`,{className:`flex-1`,children:(0,o.jsxs)(Mr,{value:t.field,onValueChange:e=>p(t.id,{field:e}),children:[(0,o.jsx)(Fr,{className:`h-9`,children:(0,o.jsx)(Pr,{placeholder:i(`sortBuilder.selectField`)})}),(0,o.jsx)(Rr,{children:e.map(e=>(0,o.jsx)(Z,{value:e.value,children:e.label},e.value))})]})}),(0,o.jsx)(`div`,{className:`w-28`,children:(0,o.jsxs)(Mr,{value:t.order,onValueChange:e=>p(t.id,{order:e}),children:[(0,o.jsx)(Fr,{className:`h-9`,children:(0,o.jsx)(Pr,{})}),(0,o.jsxs)(Rr,{children:[(0,o.jsx)(Z,{value:`asc`,children:i(`sortBuilder.ascending`)}),(0,o.jsx)(Z,{value:`desc`,children:i(`sortBuilder.descending`)})]})]})}),(0,o.jsx)(q,{variant:`ghost`,size:`icon`,className:`h-9 w-9 shrink-0`,onClick:()=>m(t.id),children:(0,o.jsx)(c.X,{className:`h-4 w-4`})})]},t.id))}),(0,o.jsxs)(q,{variant:`outline`,size:`sm`,onClick:f,className:`h-8`,disabled:e.length===0,children:[(0,o.jsx)(c.Plus,{className:`h-3 w-3 mr-2`}),i(`sortBuilder.addSort`)]})]})}function gs({field:e,value:t,onChange:n,draft:r,objectDef:i}){if(e.visibleWhen&&!e.visibleWhen(r))return null;let a=e.disabled||(e.disabledWhen?e.disabledWhen(r):!1),s=t??e.defaultValue,l=null;switch(e.type){case`input`:l=(0,o.jsx)(Jo,{label:e.label,children:(0,o.jsx)(X,{"data-testid":`config-field-${e.key}`,className:`h-7 w-32 text-xs`,value:s??``,placeholder:e.placeholder,disabled:a,onChange:e=>n(e.target.value)})});break;case`textarea`:l=(0,o.jsx)(Jo,{label:e.label,className:`flex-col items-stretch gap-1`,children:(0,o.jsx)(Qi,{"data-testid":`config-field-${e.key}`,className:`min-h-[60px] w-full text-xs`,value:s??``,placeholder:e.placeholder,disabled:a,rows:3,onChange:e=>n(e.target.value)})});break;case`switch`:l=(0,o.jsx)(Jo,{label:e.label,children:(0,o.jsx)(zi,{"data-testid":`config-field-${e.key}`,checked:!!s,disabled:a,onCheckedChange:e=>n(e),className:`scale-75`})});break;case`checkbox`:l=(0,o.jsx)(Jo,{label:e.label,children:(0,o.jsx)(vt,{"data-testid":`config-field-${e.key}`,checked:!!s,disabled:a,onCheckedChange:e=>n(e)})});break;case`select`:l=(0,o.jsx)(Jo,{label:e.label,children:(0,o.jsxs)(Mr,{value:String(s??``),onValueChange:e=>n(e),disabled:a,children:[(0,o.jsx)(Fr,{"data-testid":`config-field-${e.key}`,className:`h-7 w-32 text-xs`,children:(0,o.jsx)(Pr,{placeholder:e.placeholder??`Select…`})}),(0,o.jsx)(Rr,{children:(e.options??[]).map(e=>(0,o.jsx)(Z,{value:e.value,children:e.label},e.value))})]})});break;case`slider`:l=(0,o.jsx)(Jo,{label:e.label,children:(0,o.jsxs)(`div`,{className:`flex items-center gap-2 w-32`,children:[(0,o.jsx)(Li,{"data-testid":`config-field-${e.key}`,value:[Number(s??e.min??0)],min:e.min??0,max:e.max??100,step:e.step??1,disabled:a,onValueChange:e=>n(e[0]),"aria-label":e.label}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground w-6 text-right`,children:s??e.min??0})]})});break;case`color`:l=(0,o.jsx)(Jo,{label:e.label,children:(0,o.jsx)(`input`,{"data-testid":`config-field-${e.key}`,type:`color`,className:`h-7 w-10 rounded border cursor-pointer`,value:s??`#000000`,disabled:a,onChange:e=>n(e.target.value)})});break;case`icon-group`:l=(0,o.jsx)(Jo,{label:e.label,children:(0,o.jsx)(`div`,{className:`flex items-center gap-0.5`,"data-testid":`config-field-${e.key}`,children:(e.options??[]).map(e=>(0,o.jsx)(q,{type:`button`,size:`sm`,variant:s===e.value?`default`:`ghost`,className:U(`h-7 w-7 p-0`,s===e.value&&`ring-1 ring-primary`),disabled:a,onClick:()=>n(e.value),title:e.label,children:e.icon??(0,o.jsx)(`span`,{className:`text-[10px]`,children:e.label.charAt(0)})},e.value))})});break;case`field-picker`:l=(0,o.jsx)(Jo,{label:e.label,value:s??e.placeholder??`Select field…`,onClick:a?void 0:()=>{}});break;case`filter`:l=(0,o.jsxs)(`div`,{"data-testid":`config-field-${e.key}`,children:[(0,o.jsx)(Jo,{label:e.label}),(0,o.jsx)(fs,{fields:e.fields,value:s,onChange:n,className:`px-1 pb-2`})]});break;case`sort`:l=(0,o.jsxs)(`div`,{"data-testid":`config-field-${e.key}`,children:[(0,o.jsx)(Jo,{label:e.label}),(0,o.jsx)(hs,{fields:e.fields,value:s,onChange:n,className:`px-1 pb-2`})]});break;case`custom`:e.render&&(l=(0,o.jsx)(o.Fragment,{children:e.render(s,n,r)}));break;case`summary`:l=(0,o.jsx)(Jo,{label:e.label,onClick:e.onSummaryClick,children:(0,o.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(`span`,{className:`text-xs text-foreground truncate max-w-[120px]`,"data-testid":`config-field-${e.key}-text`,children:e.summaryText??s??``}),e.onSummaryClick&&(0,o.jsx)(c.Settings,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`,"aria-hidden":`true`,"data-testid":`config-field-${e.key}-gear`})]})});break;default:break}return l?e.helpText?(0,o.jsxs)(`div`,{children:[l,(0,o.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5 mb-1`,children:e.helpText})]}):(0,o.jsx)(o.Fragment,{children:l}):null}function _s({title:e,icon:t,collapsible:n,collapsed:r,onToggle:i,testId:a,className:s}){let l=(0,o.jsxs)(`h3`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider flex items-center gap-1.5`,children:[t&&(0,o.jsx)(`span`,{className:`text-muted-foreground shrink-0`,"aria-hidden":`true`,children:t}),e]});return n?(0,o.jsxs)(`button`,{"data-testid":a,className:U(`flex items-center justify-between pt-4 pb-1.5 first:pt-0 w-full text-left`,s),onClick:i,type:`button`,"aria-expanded":!r,children:[l,r?(0,o.jsx)(c.ChevronRight,{className:`h-3 w-3 text-muted-foreground`}):(0,o.jsx)(c.ChevronDown,{className:`h-3 w-3 text-muted-foreground`})]}):(0,o.jsx)(`div`,{className:U(`pt-4 pb-1.5 first:pt-0`,s),"data-testid":a,children:l})}function vs({open:e,onClose:t,schema:n,draft:r,isDirty:i,onFieldChange:s,onSave:l,onDiscard:u,headerExtra:d,objectDef:f,className:p,style:m,saveLabel:h=`Save`,discardLabel:g=`Discard`,panelRef:_,role:v,ariaLabel:y,tabIndex:b,testId:x,closeTitle:S,footerTestId:C,saveTestId:w,discardTestId:T,expandedSections:E,onUndo:D,onRedo:O,canUndo:k,canRedo:A,undoLabel:j=`Undo`,redoLabel:M=`Redo`}){let[N,P]=(0,a.useState)({});if(!e)return null;let F=(e,t)=>{P(n=>({...n,[e]:!(n[e]??t??!1)}))},I=(e,t)=>E&&E.includes(e)?!1:N[e]??t??!1;return(0,o.jsxs)(`div`,{ref:_,"data-testid":x??`config-panel`,role:v,"aria-label":y,tabIndex:b,style:m,className:U(`absolute inset-y-0 right-0 w-full sm:w-[var(--config-panel-width,280px)] sm:relative border-l bg-background flex flex-col shrink-0 z-20`,p),children:[(0,o.jsxs)(`div`,{className:`px-4 py-3 border-b flex items-center justify-between shrink-0`,children:[(0,o.jsx)(`nav`,{"aria-label":`breadcrumb`,children:(0,o.jsx)(`ol`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:n.breadcrumb.map((e,t)=>(0,o.jsxs)(a.Fragment,{children:[t>0&&(0,o.jsx)(c.ChevronRight,{className:`h-3 w-3`}),(0,o.jsx)(`li`,{className:U(t===n.breadcrumb.length-1&&`text-foreground font-medium`),children:e})]},t))})}),(0,o.jsxs)(`div`,{className:`flex items-center gap-1`,children:[D&&(0,o.jsx)(q,{size:`sm`,variant:`ghost`,onClick:D,disabled:!k,className:`h-7 w-7 p-0`,"data-testid":`config-panel-undo`,title:j,children:(0,o.jsx)(c.Undo2,{className:`h-3.5 w-3.5`})}),O&&(0,o.jsx)(q,{size:`sm`,variant:`ghost`,onClick:O,disabled:!A,className:`h-7 w-7 p-0`,"data-testid":`config-panel-redo`,title:M,children:(0,o.jsx)(c.Redo2,{className:`h-3.5 w-3.5`})}),d,(0,o.jsx)(q,{size:`sm`,variant:`ghost`,onClick:t,className:`h-7 w-7 p-0`,"data-testid":`config-panel-close`,title:S,children:(0,o.jsx)(c.X,{className:`h-3.5 w-3.5`})})]})]}),(0,o.jsx)(`div`,{className:`flex-1 overflow-auto px-4 pb-4`,children:n.sections.map((e,t)=>{if(e.visibleWhen&&!e.visibleWhen(r))return null;let n=I(e.key,e.defaultCollapsed);return(0,o.jsxs)(`div`,{"data-testid":`config-section-${e.key}`,children:[t>0&&(0,o.jsx)(Vr,{className:`my-3`}),(0,o.jsx)(_s,{title:e.title,icon:e.icon,collapsible:e.collapsible,collapsed:n,onToggle:()=>F(e.key,e.defaultCollapsed),testId:`section-header-${e.key}`}),e.hint&&(0,o.jsx)(`p`,{className:`text-[10px] text-muted-foreground mb-1`,children:e.hint}),!n&&(0,o.jsxs)(`div`,{className:`space-y-1`,children:[e.fields.map(e=>(0,o.jsx)(gs,{field:e,value:r[e.key],onChange:t=>s(e.key,t),draft:r,objectDef:f},e.key)),e.subsections?.map(e=>{if(e.visibleWhen&&!e.visibleWhen(r))return null;let t=I(e.key,e.defaultCollapsed);return(0,o.jsxs)(`div`,{"data-testid":`config-subsection-${e.key}`,className:`ml-1`,role:`group`,"aria-label":e.title,children:[(0,o.jsx)(_s,{title:e.title,icon:e.icon,collapsible:e.collapsible,collapsed:t,onToggle:()=>F(e.key,e.defaultCollapsed),testId:`section-header-${e.key}`,className:`pt-2 pb-1`}),!t&&(0,o.jsx)(`div`,{className:`space-y-1`,children:e.fields.map(e=>(0,o.jsx)(gs,{field:e,value:r[e.key],onChange:t=>s(e.key,t),draft:r,objectDef:f},e.key))})]},e.key)})]})]},e.key)})}),i&&(0,o.jsxs)(`div`,{className:`px-4 py-2 border-t flex gap-2 shrink-0`,"data-testid":C??`config-panel-footer`,children:[(0,o.jsxs)(q,{size:`sm`,onClick:l,"data-testid":w??`config-panel-save`,children:[(0,o.jsx)(c.Save,{className:`h-3.5 w-3.5 mr-1`}),h]}),(0,o.jsxs)(q,{size:`sm`,variant:`ghost`,onClick:u,"data-testid":T??`config-panel-discard`,children:[(0,o.jsx)(c.RotateCcw,{className:`h-3.5 w-3.5 mr-1`}),g]})]})]})}function ys({date:e,onDateChange:t,placeholder:n=`Pick a date`,className:r,disabled:i}){return(0,o.jsxs)(wr,{children:[(0,o.jsx)(Tr,{asChild:!0,children:(0,o.jsxs)(q,{variant:`outline`,className:U(`w-[280px] justify-start text-left font-normal`,!e&&`text-muted-foreground`,r),disabled:i,children:[(0,o.jsx)(c.CalendarIcon,{className:`mr-2 h-4 w-4`}),e?(0,ae.format)(e,`PPP`):(0,o.jsx)(`span`,{children:n})]})}),(0,o.jsx)(Er,{className:`w-auto p-0`,children:(0,o.jsx)(Je,{mode:`single`,selected:e,onSelect:t,autoFocus:!0})})]})}function bs(){let{t:e}=(0,B.useObjectTranslation)(),t=e(`detail.noValue`);return!t||t===`detail.noValue`?`No value`:t}function xs({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`empty`,className:U(`flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12`,e),...t})}function Ss({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`empty-header`,className:U(`flex max-w-sm flex-col items-center gap-2 text-center`,e),...t})}var Cs=(0,d.cva)(`flex shrink-0 items-center justify-center mb-2 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6`}},defaultVariants:{variant:`default`}});function ws({className:e,variant:t=`default`,...n}){return(0,o.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":t,className:U(Cs({variant:t,className:e})),...n})}function Ts({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`empty-title`,className:U(`text-lg font-medium tracking-tight`,e),...t})}function Es({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`empty-description`,className:U(`text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4`,e),...t})}function Ds({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`empty-content`,className:U(`flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance`,e),...t})}function Os({className:e,glyph:t=`—`,...n}){return(0,o.jsx)(`span`,{"data-slot":`empty-value`,"aria-label":bs(),className:U(`select-none text-muted-foreground/50 no-underline pointer-events-none`,e),...n,children:t})}var ks=(0,d.cva)(`space-y-2`),As=a.forwardRef(({className:e,label:t,description:n,error:r,required:i,htmlFor:s,children:c,...l},d)=>{let f=a.useId(),p=s||f,m=`${p}-description`,h=`${p}-error`;return(0,o.jsxs)(`div`,{ref:d,className:U(ks(),e),...l,children:[t&&(0,o.jsx)(Y,{htmlFor:p,className:U(r&&`text-destructive`,i&&`after:content-['*'] after:ml-0.5 after:text-destructive`),children:t}),(0,o.jsx)(u.Slot,{id:p,"aria-describedby":[n&&m,r&&h].filter(Boolean).join(` `)||void 0,"aria-invalid":!!r,children:c}),n&&!r&&(0,o.jsx)(`p`,{id:m,className:`text-[0.8rem] text-muted-foreground`,children:n}),r&&(0,o.jsx)(`p`,{id:h,className:`text-[0.8rem] font-medium text-destructive`,children:r})]})});As.displayName=`Field`;var js=a.forwardRef(({className:e,startContent:t,endContent:n,children:r,...i},a)=>(0,o.jsxs)(`div`,{ref:a,className:U(`flex w-full items-center rounded-md border border-input bg-transparent ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2`,`has-[[data-invalid]]:border-destructive`,e),...i,children:[t&&(0,o.jsx)(`div`,{className:`flex items-center px-3 text-muted-foreground bg-muted/50 border-r h-full self-stretch rounded-l-md`,children:t}),(0,o.jsx)(`div`,{className:`flex-1 relative [&_input]:border-0 [&_input]:shadow-none [&_input]:focus-visible:ring-0 [&_input]:bg-transparent`,children:r}),n&&(0,o.jsx)(`div`,{className:`flex items-center px-3 text-muted-foreground bg-muted/50 border-l h-full self-stretch rounded-r-md`,children:n})]}));js.displayName=`InputGroup`;function Ms({className:e,...t}){return(0,o.jsx)(`div`,{role:`list`,"data-slot":`item-group`,className:U(`group/item-group flex flex-col`,e),...t})}function Ns({className:e,...t}){return(0,o.jsx)(Vr,{"data-slot":`item-separator`,orientation:`horizontal`,className:U(`my-0`,e),...t})}var Ps=(0,d.cva)(`group/item flex items-center border border-transparent text-sm rounded-md transition-colors [a]:hover:bg-accent/50 [a]:transition-colors duration-100 flex-wrap outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]`,{variants:{variant:{default:`bg-transparent`,outline:`border-border`,muted:`bg-muted/50`},size:{default:`p-4 gap-4 `,sm:`py-3 px-4 gap-2.5`}},defaultVariants:{variant:`default`,size:`default`}});function Fs({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){return(0,o.jsx)(r?u.Slot:`div`,{"data-slot":`item`,"data-variant":t,"data-size":n,className:U(Ps({variant:t,size:n,className:e})),...i})}var Is=(0,d.cva)(`flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5`,{variants:{variant:{default:`bg-transparent`,icon:`size-8 border rounded-sm bg-muted [&_svg:not([class*='size-'])]:size-4`,image:`size-10 rounded-sm overflow-hidden [&_img]:size-full [&_img]:object-cover`}},defaultVariants:{variant:`default`}});function Ls({className:e,variant:t=`default`,...n}){return(0,o.jsx)(`div`,{"data-slot":`item-media`,"data-variant":t,className:U(Is({variant:t,className:e})),...n})}function Rs({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`item-content`,className:U(`flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none`,e),...t})}function zs({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`item-title`,className:U(`flex w-fit items-center gap-2 text-sm leading-snug font-medium`,e),...t})}function Bs({className:e,...t}){return(0,o.jsx)(`p`,{"data-slot":`item-description`,className:U(`text-muted-foreground line-clamp-2 text-sm leading-normal font-normal text-balance`,`[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4`,e),...t})}function Vs({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`item-actions`,className:U(`flex items-center gap-2`,e),...t})}function Hs({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`item-header`,className:U(`flex basis-full items-center justify-between gap-2`,e),...t})}function Us({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`item-footer`,className:U(`flex basis-full items-center justify-between gap-2`,e),...t})}function Ws({className:e,...t}){return(0,o.jsx)(`kbd`,{"data-slot":`kbd`,className:U(`bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none`,`[&_svg:not([class*='size-'])]:size-3`,`[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10`,e),...t})}function Gs({className:e,...t}){return(0,o.jsx)(`kbd`,{"data-slot":`kbd-group`,className:U(`inline-flex items-center gap-1`,e),...t})}var Ks=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsx)(`select`,{className:U(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n,children:t}));Ks.displayName=`NativeSelect`;var qs=`[data-radix-popper-content-wrapper],[data-radix-select-content],[data-radix-select-viewport]`;function Js(e){return!!e?.closest?.(qs)}function Ys(e){let t=a.useRef(!1);return a.useEffect(()=>{let e=e=>{let n=e.target;t.current=!!document.querySelector(qs)||!!n?.closest?.(`[role="dialog"]`)};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[]),a.useCallback(n=>{let r=n.detail?.originalEvent,i=r?.target??null;if(Js(i)||i?.closest?.(`[role="dialog"]`)){n.preventDefault();return}if(r?.type===`pointerdown`&&t.current){n.preventDefault();return}e?.(n)},[e])}var Xs=a.forwardRef(({className:e,children:t,onInteractOutside:n,...r},i)=>{let a=Ys(n);return(0,o.jsxs)(wt,{children:[(0,o.jsx)(Et,{}),(0,o.jsxs)(b.Content,{ref:i,onInteractOutside:a,className:U(`fixed inset-0 z-50 w-full bg-background p-4 shadow-lg duration-200`,`h-[100dvh]`,`sm:inset-auto sm:left-[50%] sm:top-[50%] sm:translate-x-[-50%] sm:translate-y-[-50%]`,`sm:max-w-lg sm:h-auto sm:max-h-[90vh] sm:rounded-lg sm:border sm:p-6`,`data-[state=open]:animate-in data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,`data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,`data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]`,`data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]`,e),...r,children:[t,(0,o.jsxs)(b.Close,{className:U(`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity`,`hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,`disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,`min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 flex items-center justify-center`),children:[(0,o.jsx)(c.X,{className:`h-5 w-5 sm:h-4 sm:w-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})});Xs.displayName=`MobileDialogContent`;function Zs(e){if(e!=null)return typeof e==`number`?`${e}px`:e}function Qs(e){let t=Zs(e);return t?{"--ov-w":t}:{}}var $s=360,ec=.95;function tc(e){let[t,n]=a.default.useState(null),r=a.default.useRef(!1);return a.default.useEffect(()=>{if(!(!e||typeof window>`u`))try{let t=window.localStorage.getItem(`ov:${e}`);if(!t)return;let r=Number(t);Number.isFinite(r)&&r>=$s&&n(r)}catch{}},[e]),{width:t,handleMouseDown:a.default.useCallback(t=>{if(!e||typeof window>`u`)return;t.preventDefault(),r.current=!0;let i=Math.floor(window.innerWidth*ec);document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let a=e=>{if(!r.current)return;let t=Math.min(i,Math.max($s,window.innerWidth-e.clientX));n(t)},o=()=>{r.current=!1,document.body.style.cursor=``,document.body.style.userSelect=``,window.removeEventListener(`mousemove`,a),window.removeEventListener(`mouseup`,o),n(t=>{if(t!=null)try{window.localStorage.setItem(`ov:${e}`,String(t))}catch{}return t})};window.addEventListener(`mousemove`,a),window.addEventListener(`mouseup`,o)},[e]),handleDoubleClick:a.default.useCallback(()=>{if(!(!e||typeof window>`u`)){n(null);try{window.localStorage.removeItem(`ov:${e}`)}catch{}}},[e]),enabled:!!e}}var nc=({isOpen:e,selectedRecord:t,mode:n,close:r,setIsOpen:i,width:a,view:s,title:l,description:u,className:d,children:f,renderView:p,mainContent:m,popoverTrigger:h,onExpand:g,expandLabel:_=`Open as full page`,storageKey:v})=>{let y=Qs(a),b=l||`Record Detail`,x=tc(n===`drawer`?v:void 0),S=Ys();if(n===`page`||n===`new_window`||n===`none`||!t)return null;let C=Zs(a)??`42rem`,w=x.width==null?{"--ov-w":`max(${C}, min(60vw, 880px))`}:{"--ov-w":`${x.width}px`},T=e=>p&&s?p(e,s):f(e);if(n===`drawer`)return(0,o.jsx)(Hr,{open:e,onOpenChange:i,children:(0,o.jsxs)(Jr,{side:`right`,onInteractOutside:S,className:U(`w-screen max-w-none sm:w-full sm:max-w-[var(--ov-w,42rem)] p-0 flex flex-col gap-0 overflow-hidden`,`[&>button:last-of-type]:hidden`,d),style:w,children:[x.enabled&&(0,o.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize drawer`,onMouseDown:x.handleMouseDown,onDoubleClick:x.handleDoubleClick,className:`hidden sm:block absolute left-0 top-0 bottom-0 z-30 w-1 cursor-col-resize touch-none bg-transparent hover:bg-primary/40 active:bg-primary/60 transition-colors`}),(0,o.jsxs)(Yr,{className:`shrink-0 flex-row items-center justify-between gap-2 space-y-0 px-4 py-2 border-b bg-muted/30`,children:[(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(Zr,{className:`truncate text-xs font-medium tracking-wide text-muted-foreground`,children:b}),u?(0,o.jsx)(Qr,{className:`truncate text-xs`,children:u}):(0,o.jsxs)(Qr,{className:`sr-only`,children:[`Record detail overlay for `,b,`.`]})]}),(0,o.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[g&&(0,o.jsx)(`button`,{type:`button`,onClick:g,"aria-label":_,title:_,className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,o.jsx)(c.Maximize2,{className:`h-3.5 w-3.5`})}),(0,o.jsx)(Wr,{asChild:!0,children:(0,o.jsx)(`button`,{type:`button`,"aria-label":`Close`,title:`Close`,className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,o.jsx)(c.X,{className:`h-3.5 w-3.5`})})})]})]}),(0,o.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:T(t)})]})});if(n===`modal`)return(0,o.jsx)(St,{open:e,onOpenChange:i,children:(0,o.jsxs)(Dt,{onInteractOutside:S,className:U(`w-[calc(100vw-1rem)] max-w-none sm:max-w-[var(--ov-w,42rem)] max-h-[90vh] overflow-y-auto`,d),style:y,children:[g&&(0,o.jsx)(`button`,{type:`button`,onClick:g,"aria-label":_,title:_,className:`absolute right-12 top-4 z-10 inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors`,children:(0,o.jsx)(c.Maximize2,{className:`h-4 w-4`})}),(0,o.jsxs)(Ot,{children:[(0,o.jsx)(At,{children:b}),u?(0,o.jsx)(jt,{children:u}):(0,o.jsxs)(jt,{className:`sr-only`,children:[`Record detail overlay for `,b,`.`]})]}),(0,o.jsx)(`div`,{className:`mt-4`,children:T(t)})]})});if(n===`split`){if(!e||!m)return null;let n=a&&typeof a==`number`?Math.min(70,Math.max(20,a/1200*100)):40,i=100-n;return(0,o.jsxs)(ho,{orientation:`horizontal`,className:U(`h-full`,d),children:[(0,o.jsx)(go,{defaultSize:i,minSize:30,children:m}),(0,o.jsx)(_o,{withHandle:!0}),(0,o.jsx)(go,{defaultSize:n,minSize:20,children:(0,o.jsxs)(`div`,{className:`h-full overflow-y-auto p-4`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,o.jsx)(`h3`,{className:`text-lg font-semibold`,children:b}),(0,o.jsx)(`button`,{onClick:r,className:`rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,"aria-label":`Close panel`,children:(0,o.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,o.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,o.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),u&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:u}),T(t)]})})]})}return n===`popover`?h?(0,o.jsxs)(wr,{open:e,onOpenChange:i,children:[h&&(0,o.jsx)(Tr,{asChild:!0,children:h}),(0,o.jsx)(Er,{className:U(`w-96 max-h-[400px] overflow-y-auto p-4`,d),style:y,children:(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsx)(`h4`,{className:`text-sm font-semibold`,children:b}),u&&(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u}),T(t)]})})]}):e?(0,o.jsx)(St,{open:e,onOpenChange:i,children:(0,o.jsxs)(Dt,{className:U(`w-96 max-h-[80vh] overflow-y-auto p-4`,d),style:y,children:[(0,o.jsxs)(Ot,{children:[(0,o.jsx)(At,{className:`text-sm`,children:b}),u?(0,o.jsx)(jt,{className:`text-xs`,children:u}):(0,o.jsxs)(jt,{className:`sr-only`,children:[`Record detail overlay for `,b,`.`]})]}),(0,o.jsx)(`div`,{className:`mt-2`,children:T(t)})]})}):null:null};nc.displayName=`NavigationOverlay`;function rc({className:e,...t}){return(0,o.jsx)(`div`,{role:`status`,"aria-label":`Loading`,className:U(`flex items-center justify-center`,e),...t,children:(0,o.jsx)(c.Loader2,{className:`animate-spin text-muted-foreground w-full h-full min-w-4 min-h-4`})})}var ic={addGroup:`Add group field`,collapseTitle:`Collapsed by default`,removeTitle:`Remove`,ascendingTitle:`Ascending`,descendingTitle:`Descending`};function ac({value:e,onChange:t,fieldOptions:n,maxLevels:r=3,className:i,labels:a}){let s={...ic,...a||{}},l=e?.fields??[],u=new Set(l.map(e=>e.field)),d=e=>{t(e.length?{fields:e}:void 0)};return(0,o.jsxs)(`div`,{"data-testid":`grouping-editor`,className:U(`flex flex-col gap-1.5 w-full`,i),children:[l.map((e,t)=>(0,o.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(`select`,{"data-testid":`grouping-field-${t}`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground flex-1 min-w-0`,value:e.field,onChange:n=>{let r=[...l];r[t]={...e,field:n.target.value},d(r)},children:n.filter(t=>t.value===e.field||!u.has(t.value)).map(e=>(0,o.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,o.jsx)(`button`,{type:`button`,title:e.order===`asc`?s.ascendingTitle:s.descendingTitle,"data-testid":`grouping-order-${t}`,className:`flex h-7 w-7 items-center justify-center rounded-md border border-input bg-background text-foreground hover:bg-muted`,onClick:()=>{let n=[...l];n[t]={...e,order:e.order===`asc`?`desc`:`asc`},d(n)},children:e.order===`asc`?(0,o.jsx)(c.ArrowUp,{className:`h-3 w-3`}):(0,o.jsx)(c.ArrowDown,{className:`h-3 w-3`})}),(0,o.jsx)(`label`,{title:s.collapseTitle,className:`flex items-center text-xs text-muted-foreground`,children:(0,o.jsx)(`input`,{type:`checkbox`,"data-testid":`grouping-collapsed-${t}`,className:`h-3 w-3`,checked:e.collapsed,onChange:n=>{let r=[...l];r[t]={...e,collapsed:n.target.checked},d(r)}})}),(0,o.jsx)(`button`,{type:`button`,title:s.removeTitle,"data-testid":`grouping-remove-${t}`,className:`flex h-7 w-7 items-center justify-center rounded-md border border-input bg-background text-muted-foreground hover:bg-muted hover:text-destructive`,onClick:()=>{let e=l.filter((e,n)=>n!==t);d(e)},children:(0,o.jsx)(c.X,{className:`h-3 w-3`})})]},t)),l.length<r&&(()=>{let e=n.filter(e=>!u.has(e.value));return e.length===0?null:(0,o.jsxs)(`button`,{type:`button`,"data-testid":`grouping-add`,className:`flex h-7 items-center gap-1 self-start rounded-md border border-dashed border-input bg-background px-2 text-xs text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:()=>{let t=[...l,{field:e[0].value,order:`asc`,collapsed:!1}];d(t)},children:[(0,o.jsx)(c.Plus,{className:`h-3 w-3`}),s.addGroup]})})()]})}var oc=({params:e,open:t,onSubmit:n,onCancel:r,title:i=`Action Parameters`,description:s=`Please provide the required parameters.`})=>{let[c,l]=(0,a.useState)(()=>{let t={};return e.forEach(e=>{e.defaultValue===void 0?t[e.name]=e.type!==`boolean`&&``:t[e.name]=e.defaultValue}),t}),[u,d]=(0,a.useState)({}),f=(0,a.useCallback)((e,t)=>{l(n=>({...n,[e]:t})),d(t=>{let n={...t};return delete n[e],n})},[]),p=(0,a.useCallback)(()=>{let t={};if(e.forEach(e=>{if(e.required){let n=c[e.name];(n==null||n===``)&&(t[e.name]=`${e.label} is required`)}}),Object.keys(t).length>0){d(t);return}n(c)},[e,c,n]);return(0,o.jsx)(St,{open:t,onOpenChange:e=>{e||r()},children:(0,o.jsxs)(Dt,{className:`sm:max-w-[425px]`,children:[(0,o.jsxs)(Ot,{children:[(0,o.jsx)(At,{children:i}),(0,o.jsx)(jt,{children:s})]}),(0,o.jsx)(`div`,{className:`space-y-4 py-4`,children:e.map(e=>{let t=c[e.name],n=u[e.name];switch(e.type){case`textarea`:return(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(Y,{htmlFor:e.name,children:[e.label,e.required&&(0,o.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),(0,o.jsx)(Qi,{id:e.name,value:t||``,onChange:t=>f(e.name,t.target.value),placeholder:e.placeholder}),e.helpText&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.helpText}),n&&(0,o.jsx)(`p`,{className:`text-sm text-destructive`,children:n})]},e.name);case`number`:return(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(Y,{htmlFor:e.name,children:[e.label,e.required&&(0,o.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),(0,o.jsx)(X,{id:e.name,type:`number`,value:t??``,onChange:t=>f(e.name,Number.isNaN(t.target.valueAsNumber)?``:t.target.valueAsNumber),placeholder:e.placeholder}),e.helpText&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.helpText}),n&&(0,o.jsx)(`p`,{className:`text-sm text-destructive`,children:n})]},e.name);case`boolean`:return(0,o.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,o.jsx)(vt,{id:e.name,checked:!!t,onCheckedChange:t=>f(e.name,!!t)}),(0,o.jsx)(Y,{htmlFor:e.name,children:e.label}),e.helpText&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground ml-2`,children:e.helpText})]},e.name);case`select`:return(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(Y,{htmlFor:e.name,children:[e.label,e.required&&(0,o.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),(0,o.jsxs)(Mr,{value:t||``,onValueChange:t=>f(e.name,t),children:[(0,o.jsx)(Fr,{children:(0,o.jsx)(Pr,{placeholder:e.placeholder||`Select...`})}),(0,o.jsx)(Rr,{children:e.options?.map(e=>(0,o.jsx)(Z,{value:e.value,children:e.label},e.value))})]}),e.helpText&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.helpText}),n&&(0,o.jsx)(`p`,{className:`text-sm text-destructive`,children:n})]},e.name);case`date`:return(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(Y,{htmlFor:e.name,children:[e.label,e.required&&(0,o.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),(0,o.jsx)(X,{id:e.name,type:`date`,value:t||``,onChange:t=>f(e.name,t.target.value)}),e.helpText&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.helpText}),n&&(0,o.jsx)(`p`,{className:`text-sm text-destructive`,children:n})]},e.name);default:return(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(Y,{htmlFor:e.name,children:[e.label,e.required&&(0,o.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),(0,o.jsx)(X,{id:e.name,type:`text`,value:t||``,onChange:t=>f(e.name,t.target.value),placeholder:e.placeholder}),e.helpText&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.helpText}),n&&(0,o.jsx)(`p`,{className:`text-sm text-destructive`,children:n})]},e.name)}})}),(0,o.jsxs)(kt,{children:[(0,o.jsx)(q,{variant:`outline`,onClick:r,children:`Cancel`}),(0,o.jsx)(q,{onClick:p,children:`Continue`})]})]})})};oc.displayName=`ActionParamDialog`;function sc({rows:e=5,columns:t=4,className:n,...r}){return(0,o.jsxs)(`div`,{"data-slot":`grid-skeleton`,className:U(`w-full space-y-2`,n),...r,children:[(0,o.jsx)(`div`,{className:`flex gap-4 px-4 py-2`,children:Array.from({length:t}).map((e,t)=>(0,o.jsx)(Q,{className:`h-4 flex-1 rounded`},t))}),Array.from({length:e}).map((e,n)=>(0,o.jsx)(`div`,{className:`flex gap-4 rounded-md border px-4 py-3`,children:Array.from({length:t}).map((e,t)=>(0,o.jsx)(Q,{className:U(`h-4 flex-1 rounded`,t===0&&`max-w-[40%]`)},t))},n))]})}function cc({columns:e=3,cardsPerColumn:t=3,className:n,...r}){return(0,o.jsx)(`div`,{"data-slot":`kanban-skeleton`,className:U(`flex gap-4 overflow-x-auto`,n),...r,children:Array.from({length:e}).map((e,n)=>(0,o.jsxs)(`div`,{className:`flex w-72 shrink-0 flex-col gap-3 rounded-lg border bg-muted/30 p-3`,children:[(0,o.jsx)(Q,{className:`h-5 w-24 rounded`}),Array.from({length:t}).map((e,t)=>(0,o.jsxs)(`div`,{className:`space-y-2 rounded-md border bg-background p-3`,children:[(0,o.jsx)(Q,{className:`h-4 w-3/4 rounded`}),(0,o.jsx)(Q,{className:`h-3 w-1/2 rounded`})]},t))]},n))})}function lc({rows:e=4,className:t,...n}){return(0,o.jsxs)(`div`,{"data-slot":`form-skeleton`,className:U(`w-full max-w-lg space-y-6`,t),...n,children:[Array.from({length:e}).map((e,t)=>(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsx)(Q,{className:`h-4 w-28 rounded`}),(0,o.jsx)(Q,{className:`h-9 w-full rounded-md`})]},t)),(0,o.jsx)(Q,{className:`h-9 w-24 rounded-md`})]})}function uc({rows:e=5,className:t,...n}){return(0,o.jsx)(`div`,{"data-slot":`list-skeleton`,className:U(`w-full space-y-3`,t),...n,children:Array.from({length:e}).map((e,t)=>(0,o.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border px-4 py-3`,children:[(0,o.jsx)(Q,{className:`size-8 shrink-0 rounded-full`}),(0,o.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,o.jsx)(Q,{className:`h-4 w-3/5 rounded`}),(0,o.jsx)(Q,{className:`h-3 w-2/5 rounded`})]})]},t))})}function dc({className:e,...t}){return(0,o.jsxs)(`div`,{"data-slot":`chart-skeleton`,className:U(`w-full space-y-4`,e),...t,children:[(0,o.jsx)(Q,{className:`h-5 w-40 rounded`}),(0,o.jsx)(`div`,{className:`flex h-48 items-end gap-2 rounded-md border p-4`,children:[`h-2/5`,`h-3/5`,`h-1/3`,`h-4/5`,`h-1/2`,`h-3/4`,`h-2/5`].map((e,t)=>(0,o.jsx)(Q,{className:U(`flex-1 rounded-t`,e)},t))}),(0,o.jsxs)(`div`,{className:`flex gap-4`,children:[(0,o.jsx)(Q,{className:`h-3 w-16 rounded`}),(0,o.jsx)(Q,{className:`h-3 w-16 rounded`}),(0,o.jsx)(Q,{className:`h-3 w-16 rounded`})]})]})}function fc({variant:e,...t}){switch(e){case`grid`:return(0,o.jsx)(sc,{...t});case`kanban`:return(0,o.jsx)(cc,{...t});case`form`:return(0,o.jsx)(lc,{...t});case`list`:return(0,o.jsx)(uc,{...t});case`chart`:return(0,o.jsx)(dc,{...t})}}function pc({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`shimmer-skeleton`,className:U(`rounded-md bg-muted`,`motion-safe:bg-[linear-gradient(90deg,hsl(var(--muted))_0%,hsl(var(--muted-foreground)/0.12)_50%,hsl(var(--muted))_100%)]`,`motion-safe:bg-[length:200%_100%] motion-safe:animate-shimmer`,e),...t})}var mc=({title:e,icon:t,objectLabel:n,resourceId:r,showStar:i=!0,showCopyId:s=!0,isFavorite:l,onToggleFavorite:u,className:d,inlineExtras:f})=>{let{t:p}=(0,B.useObjectTranslation)(),[m,h]=a.default.useState(!1),[g,_]=a.default.useState(!1),v=l??m,y=a.default.useCallback(()=>{let e=!v;u&&u(e),l===void 0&&h(e)},[v,l,u]),b=a.default.useCallback(()=>{if(r)try{typeof navigator<`u`&&navigator.clipboard&&navigator.clipboard.writeText(r),_(!0),setTimeout(()=>_(!1),1500)}catch{}},[r]),x=p(v?`detail.removeFromFavorites`:`detail.addToFavorites`),S=p(g?`detail.copied`:`detail.copyRecordId`);return(0,o.jsx)(ti,{children:(0,o.jsx)(`div`,{className:U(`flex flex-col min-w-0`,d),children:(0,o.jsxs)(`div`,{className:`flex items-baseline gap-2 flex-wrap`,children:[t&&(0,o.jsx)(`span`,{className:`text-muted-foreground shrink-0 self-center`,"aria-hidden":!0,children:t}),(0,o.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold truncate`,children:e}),n&&(0,o.jsx)(`span`,{className:`text-xs font-medium tracking-wide text-muted-foreground/70 shrink-0`,children:n}),s&&r&&(0,o.jsxs)(ni,{children:[(0,o.jsx)(ri,{asChild:!0,children:(0,o.jsx)(q,{variant:`ghost`,size:`icon`,className:`h-5 w-5 shrink-0 text-muted-foreground/50 hover:text-foreground`,onClick:b,"aria-label":S,children:g?(0,o.jsx)(c.Check,{className:`h-3 w-3 text-green-600`}):(0,o.jsx)(c.Copy,{className:`h-3 w-3`})})}),(0,o.jsx)(ii,{children:S})]}),i&&(0,o.jsxs)(ni,{children:[(0,o.jsx)(ri,{asChild:!0,children:(0,o.jsx)(q,{variant:`ghost`,size:`icon`,className:`h-6 w-6 shrink-0`,onClick:y,"aria-label":x,"aria-pressed":v,children:(0,o.jsx)(c.Star,{className:U(`h-4 w-4`,v?`fill-yellow-400 text-yellow-400`:`text-muted-foreground`)})})}),(0,o.jsx)(ii,{children:x})]}),f]})})})},hc=!1;function gc(){if(hc||typeof document>`u`)return;let e=`objui-refresh-indicator-kf`;if(document.getElementById(e)){hc=!0;return}let t=document.createElement(`style`);t.id=e,t.textContent=`
13
+ `)}}):null},ft=g.Tooltip,pt=a.forwardRef(({active:e,payload:t,className:n,indicator:r=`dot`,hideLabel:i=!1,hideIndicator:s=!1,label:c,labelFormatter:l,labelClassName:u,formatter:d,color:f,nameKey:p,labelKey:m},h)=>{let{config:g}=lt(),_=a.useMemo(()=>{if(i||!t?.length)return null;let[e]=t,n=`${m||e?.dataKey||e?.name||`value`}`,r=gt(g,e,n),a=!m&&typeof c==`string`?g[c]?.label||c:r?.label;return l?(0,o.jsx)(`div`,{className:W(`font-medium`,u),children:l(a,t)}):a?(0,o.jsx)(`div`,{className:W(`font-medium`,u),children:a}):null},[c,l,t,i,u,g,m]);if(!e||!t?.length)return null;let v=t.length===1&&r!==`dot`;return(0,o.jsxs)(`div`,{ref:h,className:W(`grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl`,n),children:[v?null:_,(0,o.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let n=`${p||e.name||e.dataKey||`value`}`,i=gt(g,e,n),a=f||e.payload.fill||e.color;return(0,o.jsx)(`div`,{className:W(`flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground`,r===`dot`&&`items-center`),children:d&&e?.value!==void 0&&e.name?d(e.value,e.name,e,t,e.payload):(0,o.jsxs)(o.Fragment,{children:[i?.icon?(0,o.jsx)(i.icon,{}):!s&&(0,o.jsx)(`div`,{className:W(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,{"h-2.5 w-2.5":r===`dot`,"w-1":r===`line`,"w-0 border-[1.5px] border-dashed bg-transparent":r===`dashed`,"my-0.5":v&&r===`dashed`}),style:{"--color-bg":a,"--color-border":a}}),(0,o.jsxs)(`div`,{className:W(`flex flex-1 justify-between leading-none`,v?`items-end`:`items-center`),children:[(0,o.jsxs)(`div`,{className:`grid gap-1.5`,children:[v?_:null,(0,o.jsx)(`span`,{className:`text-muted-foreground`,children:i?.label||e.name})]}),e.value&&(0,o.jsx)(`span`,{className:`font-mono font-medium tabular-nums text-foreground`,children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})});pt.displayName=`ChartTooltip`;var mt=g.Legend,ht=a.forwardRef(({className:e,hideIcon:t=!1,payload:n,verticalAlign:r=`bottom`,nameKey:i},a)=>{let{config:s}=lt();return n?.length?(0,o.jsx)(`div`,{ref:a,className:W(`flex items-center justify-center gap-4`,r===`top`?`pb-3`:`pt-3`,e),children:n.filter(e=>e.type!==`none`).map(e=>{let n=`${i||e.dataKey||`value`}`,r=gt(s,e,n);return(0,o.jsxs)(`div`,{className:W(`flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground`),children:[r?.icon&&!t?(0,o.jsx)(r.icon,{}):(0,o.jsx)(`div`,{className:`h-2 w-2 shrink-0 rounded-[2px]`,style:{backgroundColor:e.color}}),r?.label]},e.value)})}):null});ht.displayName=`ChartLegend`;function gt(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}var _t=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(_.Root,{ref:n,className:W(`grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,e),...t,children:(0,o.jsx)(_.Indicator,{className:W(`grid place-content-center text-current`),children:(0,o.jsx)(c.Check,{className:`h-4 w-4`})})}));_t.displayName=_.Root.displayName;var vt=v.Root,yt=v.CollapsibleTrigger,bt=v.CollapsibleContent,xt=(0,x.createSafeTranslation)({"common.close":`Close`},`common.close`);function St(){let{t:e}=xt();return(0,o.jsx)(`span`,{className:`sr-only`,children:e(`common.close`)})}var Ct=b.Root,wt=b.Trigger,Tt=b.Portal,Et=b.Close,Dt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(b.Overlay,{ref:n,className:W(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));Dt.displayName=b.Overlay.displayName;var Ot=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(Tt,{children:[(0,o.jsx)(Dt,{}),(0,o.jsxs)(b.Content,{ref:r,className:W(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...n,children:[t,(0,o.jsxs)(b.Close,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,o.jsx)(c.X,{className:`h-4 w-4`}),(0,o.jsx)(St,{})]})]})]}));Ot.displayName=b.Content.displayName;var kt=({className:e,...t})=>(0,o.jsx)(`div`,{className:W(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});kt.displayName=`DialogHeader`;var At=({className:e,...t})=>(0,o.jsx)(`div`,{className:W(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});At.displayName=`DialogFooter`;var jt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(b.Title,{ref:n,className:W(`text-lg font-semibold leading-none tracking-tight`,e),...t}));jt.displayName=b.Title.displayName;var Mt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(b.Description,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));Mt.displayName=b.Description.displayName;var Nt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(y.Command,{ref:n,className:W(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t}));Nt.displayName=y.Command.displayName;var Pt=({children:e,contentProps:t,title:n=`Command Palette`,description:r,...i})=>{let{className:a,...s}=t??{};return(0,o.jsx)(Ct,{...i,children:(0,o.jsxs)(Ot,{className:W(`overflow-hidden p-0 shadow-lg`,a),...s,children:[(0,o.jsx)(jt,{className:`sr-only`,children:n}),r?(0,o.jsx)(Mt,{className:`sr-only`,children:r}):null,(0,o.jsx)(Nt,{className:`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:e})]})})},Ft=a.forwardRef(({className:e,...t},n)=>(0,o.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[(0,o.jsx)(c.Search,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),(0,o.jsx)(y.Command.Input,{ref:n,className:W(`flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]}));Ft.displayName=y.Command.Input.displayName;var It=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(y.Command.List,{ref:n,className:W(`max-h-[300px] overflow-y-auto overflow-x-hidden`,e),...t}));It.displayName=y.Command.List.displayName;var Lt=a.forwardRef((e,t)=>(0,o.jsx)(y.Command.Empty,{ref:t,className:`py-6 text-center text-sm`,...e}));Lt.displayName=y.Command.Empty.displayName;var Rt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(y.Command.Group,{ref:n,className:W(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t}));Rt.displayName=y.Command.Group.displayName;var zt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(y.Command.Separator,{ref:n,className:W(`-mx-1 h-px bg-border`,e),...t}));zt.displayName=y.Command.Separator.displayName;var Bt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(y.Command.Item,{ref:n,className:W(`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,e),...t}));Bt.displayName=y.Command.Item.displayName;var Vt=({className:e,...t})=>(0,o.jsx)(`span`,{className:W(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});Vt.displayName=`CommandShortcut`;var Ht=S.Root,Ut=S.Trigger,Wt=S.Group,Gt=S.Portal,Kt=S.Sub,qt=S.RadioGroup,Jt=a.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,o.jsxs)(S.SubTrigger,{ref:i,className:W(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground`,t&&`pl-8`,e),...r,children:[n,(0,o.jsx)(c.ChevronRight,{className:`ml-auto h-4 w-4`})]}));Jt.displayName=S.SubTrigger.displayName;var Yt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(S.SubContent,{ref:n,className:W(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-context-menu-content-transform-origin)`,e),...t}));Yt.displayName=S.SubContent.displayName;var Xt=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(S.Portal,{children:(0,o.jsx)(S.Content,{ref:n,className:W(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-context-menu-content-transform-origin)`,e),...t})}));Xt.displayName=S.Content.displayName;var Zt=a.forwardRef(({className:e,inset:t,...n},r)=>(0,o.jsx)(S.Item,{ref:r,className:W(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,t&&`pl-8`,e),...n}));Zt.displayName=S.Item.displayName;var Qt=a.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,o.jsxs)(S.CheckboxItem,{ref:i,className:W(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,o.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,o.jsx)(S.ItemIndicator,{children:(0,o.jsx)(c.Check,{className:`h-4 w-4`})})}),t]}));Qt.displayName=S.CheckboxItem.displayName;var $t=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(S.RadioItem,{ref:r,className:W(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,o.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,o.jsx)(S.ItemIndicator,{children:(0,o.jsx)(c.Circle,{className:`h-2 w-2 fill-current`})})}),t]}));$t.displayName=S.RadioItem.displayName;var en=a.forwardRef(({className:e,inset:t,...n},r)=>(0,o.jsx)(S.Label,{ref:r,className:W(`px-2 py-1.5 text-sm font-semibold text-foreground`,t&&`pl-8`,e),...n}));en.displayName=S.Label.displayName;var tn=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(S.Separator,{ref:n,className:W(`-mx-1 my-1 h-px bg-border`,e),...t}));tn.displayName=S.Separator.displayName;var nn=({className:e,...t})=>(0,o.jsx)(`span`,{className:W(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});nn.displayName=`ContextMenuShortcut`;var rn=({shouldScaleBackground:e=!0,...t})=>(0,o.jsx)(C.Drawer.Root,{shouldScaleBackground:e,...t});rn.displayName=`Drawer`;var an=C.Drawer.Trigger,on=C.Drawer.Portal,sn=C.Drawer.Close,cn=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(C.Drawer.Overlay,{ref:n,className:W(`fixed inset-0 z-50 bg-black/80`,e),...t}));cn.displayName=C.Drawer.Overlay.displayName;var ln=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(on,{children:[(0,o.jsx)(cn,{}),(0,o.jsxs)(C.Drawer.Content,{ref:r,className:W(`fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background`,e),...n,children:[(0,o.jsx)(`div`,{className:`mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted`}),t]})]}));ln.displayName=`DrawerContent`;var un=({className:e,...t})=>(0,o.jsx)(`div`,{className:W(`grid gap-1.5 p-4 text-center sm:text-left`,e),...t});un.displayName=`DrawerHeader`;var dn=({className:e,...t})=>(0,o.jsx)(`div`,{className:W(`mt-auto flex flex-col gap-2 p-4`,e),...t});dn.displayName=`DrawerFooter`;var fn=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(C.Drawer.Title,{ref:n,className:W(`text-lg font-semibold leading-none tracking-tight`,e),...t}));fn.displayName=C.Drawer.Title.displayName;var pn=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(C.Drawer.Description,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));pn.displayName=C.Drawer.Description.displayName;var mn=w.Root,hn=w.Trigger,gn=w.Group,_n=w.Portal,vn=w.Sub,yn=w.RadioGroup,bn=a.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,o.jsxs)(w.SubTrigger,{ref:i,className:W(`flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...r,children:[n,(0,o.jsx)(c.ChevronRight,{className:`ml-auto`})]}));bn.displayName=w.SubTrigger.displayName;var xn=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(w.SubContent,{ref:n,className:W(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-dropdown-menu-content-transform-origin)`,e),...t}));xn.displayName=w.SubContent.displayName;var Sn=a.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,o.jsx)(w.Portal,{children:(0,o.jsx)(w.Content,{ref:r,sideOffset:t,className:W(`z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-dropdown-menu-content-transform-origin)`,e),...n})}));Sn.displayName=w.Content.displayName;var Cn=a.forwardRef(({className:e,inset:t,...n},r)=>(0,o.jsx)(w.Item,{ref:r,className:W(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...n}));Cn.displayName=w.Item.displayName;var wn=a.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,o.jsxs)(w.CheckboxItem,{ref:i,className:W(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,o.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,o.jsx)(w.ItemIndicator,{children:(0,o.jsx)(c.Check,{className:`h-4 w-4`})})}),t]}));wn.displayName=w.CheckboxItem.displayName;var Tn=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(w.RadioItem,{ref:r,className:W(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,o.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,o.jsx)(w.ItemIndicator,{children:(0,o.jsx)(c.Circle,{className:`h-2 w-2 fill-current`})})}),t]}));Tn.displayName=w.RadioItem.displayName;var En=a.forwardRef(({className:e,inset:t,...n},r)=>(0,o.jsx)(w.Label,{ref:r,className:W(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));En.displayName=w.Label.displayName;var Dn=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(w.Separator,{ref:n,className:W(`-mx-1 my-1 h-px bg-muted`,e),...t}));Dn.displayName=w.Separator.displayName;var On=({className:e,...t})=>(0,o.jsx)(`span`,{className:W(`ml-auto text-xs tracking-widest opacity-60`,e),...t});On.displayName=`DropdownMenuShortcut`;var kn=(0,d.cva)(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),X=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(E.Root,{ref:n,className:W(kn(),e),...t}));X.displayName=E.Root.displayName;var An=T.FormProvider,jn=a.createContext(null),Mn=({...e})=>(0,o.jsx)(jn.Provider,{value:{name:e.name},children:(0,o.jsx)(T.Controller,{...e})}),Nn=()=>{let e=a.useContext(jn),t=a.useContext(Pn),{getFieldState:n,formState:r}=(0,T.useFormContext)();if(!e)throw Error(`useFormField should be used within <FormField>`);if(!t)throw Error(`useFormField should be used within <FormItem>`);let i=n(e.name,r),{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...i}},Pn=a.createContext(null),Fn=a.forwardRef(({className:e,...t},n)=>{let r=a.useId();return(0,o.jsx)(Pn.Provider,{value:{id:r},children:(0,o.jsx)(`div`,{ref:n,className:W(`space-y-2`,e),...t})})});Fn.displayName=`FormItem`;var In=a.forwardRef(({className:e,...t},n)=>{let{error:r,formItemId:i}=Nn();return(0,o.jsx)(X,{ref:n,className:W(r&&`text-destructive`,e),htmlFor:i,...t})});In.displayName=`FormLabel`;var Ln=a.forwardRef(({...e},t)=>{let{error:n,formItemId:r,formDescriptionId:i,formMessageId:a}=Nn();return(0,o.jsx)(u.Slot,{ref:t,id:r,"aria-describedby":n?`${i} ${a}`:`${i}`,"aria-invalid":!!n,...e})});Ln.displayName=`FormControl`;var Rn=a.forwardRef(({className:e,...t},n)=>{let{formDescriptionId:r}=Nn();return(0,o.jsx)(`p`,{ref:n,id:r,className:W(`text-sm text-muted-foreground`,e),...t})});Rn.displayName=`FormDescription`;var zn=a.forwardRef(({className:e,children:t,...n},r)=>{let{error:i,formMessageId:a}=Nn(),s=i?String(i?.message??``):t;return s?(0,o.jsx)(`p`,{ref:r,id:a,className:W(`text-sm font-medium text-destructive`,e),...n,children:s}):null});zn.displayName=`FormMessage`;var Bn=D.Root,Vn=D.Trigger,Hn=a.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...r},i)=>(0,o.jsx)(D.Content,{ref:i,align:t,sideOffset:n,className:W(`z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-hover-card-content-transform-origin)`,e),...r}));Hn.displayName=D.Content.displayName;var Un=a.forwardRef(({className:e,containerClassName:t,...n},r)=>(0,o.jsx)(O.OTPInput,{ref:r,containerClassName:W(`flex items-center gap-2 has-[:disabled]:opacity-50`,t),className:W(`disabled:cursor-not-allowed`,e),...n}));Un.displayName=`InputOTP`;var Wn=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:W(`flex items-center`,e),...t}));Wn.displayName=`InputOTPGroup`;var Gn=a.forwardRef(({index:e,className:t,...n},r)=>{let{char:i,hasFakeCaret:s,isActive:c}=a.useContext(O.OTPInputContext).slots[e];return(0,o.jsxs)(`div`,{ref:r,className:W(`relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md`,c&&`z-10 ring-2 ring-ring ring-offset-background`,t),...n,children:[i,s&&(0,o.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,o.jsx)(`div`,{className:`h-4 w-px animate-caret-blink bg-foreground duration-1000`})})]})});Gn.displayName=`InputOTPSlot`;var Kn=a.forwardRef(({...e},t)=>(0,o.jsx)(`div`,{ref:t,role:`separator`,...e,children:(0,o.jsx)(c.Dot,{})}));Kn.displayName=`InputOTPSeparator`;var Z=a.forwardRef(({className:e,type:t,...n},r)=>(0,o.jsx)(`input`,{type:t,className:W(`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,e),ref:r,...n}));Z.displayName=`Input`;function qn({...e}){return(0,o.jsx)(k.Menu,{...e})}function Jn({...e}){return(0,o.jsx)(k.Group,{...e})}function Yn({...e}){return(0,o.jsx)(k.Portal,{...e})}function Xn({...e}){return(0,o.jsx)(k.RadioGroup,{...e})}function Zn({...e}){return(0,o.jsx)(k.Sub,{"data-slot":`menubar-sub`,...e})}var Qn=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(k.Root,{ref:n,className:W(`flex h-10 items-center space-x-1 rounded-md border bg-background p-1`,e),...t}));Qn.displayName=k.Root.displayName;var $n=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(k.Trigger,{ref:n,className:W(`flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground`,e),...t}));$n.displayName=k.Trigger.displayName;var er=a.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,o.jsxs)(k.SubTrigger,{ref:i,className:W(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground`,t&&`pl-8`,e),...r,children:[n,(0,o.jsx)(c.ChevronRight,{className:`ml-auto h-4 w-4`})]}));er.displayName=k.SubTrigger.displayName;var tr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(k.SubContent,{ref:n,className:W(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-menubar-content-transform-origin)`,e),...t}));tr.displayName=k.SubContent.displayName;var nr=a.forwardRef(({className:e,align:t=`start`,alignOffset:n=-4,sideOffset:r=8,...i},a)=>(0,o.jsx)(k.Portal,{children:(0,o.jsx)(k.Content,{ref:a,align:t,alignOffset:n,sideOffset:r,className:W(`z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-menubar-content-transform-origin)`,e),...i})}));nr.displayName=k.Content.displayName;var rr=a.forwardRef(({className:e,inset:t,...n},r)=>(0,o.jsx)(k.Item,{ref:r,className:W(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,t&&`pl-8`,e),...n}));rr.displayName=k.Item.displayName;var ir=a.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,o.jsxs)(k.CheckboxItem,{ref:i,className:W(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,o.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,o.jsx)(k.ItemIndicator,{children:(0,o.jsx)(c.Check,{className:`h-4 w-4`})})}),t]}));ir.displayName=k.CheckboxItem.displayName;var ar=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(k.RadioItem,{ref:r,className:W(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,o.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,o.jsx)(k.ItemIndicator,{children:(0,o.jsx)(c.Circle,{className:`h-2 w-2 fill-current`})})}),t]}));ar.displayName=k.RadioItem.displayName;var or=a.forwardRef(({className:e,inset:t,...n},r)=>(0,o.jsx)(k.Label,{ref:r,className:W(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));or.displayName=k.Label.displayName;var sr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(k.Separator,{ref:n,className:W(`-mx-1 my-1 h-px bg-muted`,e),...t}));sr.displayName=k.Separator.displayName;var cr=({className:e,...t})=>(0,o.jsx)(`span`,{className:W(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});cr.displayname=`MenubarShortcut`;var lr=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(A.Root,{ref:r,className:W(`relative z-10 flex max-w-max flex-1 items-center justify-center`,e),...n,children:[t,(0,o.jsx)(gr,{})]}));lr.displayName=A.Root.displayName;var ur=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(A.List,{ref:n,className:W(`group flex flex-1 list-none items-center justify-center space-x-1`,e),...t}));ur.displayName=A.List.displayName;var dr=A.Item,fr=(0,d.cva)(`group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=open]:text-accent-foreground data-[state=open]:bg-accent/50 data-[state=open]:hover:bg-accent data-[state=open]:focus:bg-accent`),pr=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(A.Trigger,{ref:r,className:W(fr(),`group`,e),...n,children:[t,` `,(0,o.jsx)(c.ChevronDown,{className:`relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180`,"aria-hidden":`true`})]}));pr.displayName=A.Trigger.displayName;var mr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(A.Content,{ref:n,className:W(`left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto `,e),...t}));mr.displayName=A.Content.displayName;var hr=A.Link,gr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{className:W(`absolute left-0 top-full flex justify-center`),children:(0,o.jsx)(A.Viewport,{className:W(`origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]`,e),ref:n,...t})}));gr.displayName=A.Viewport.displayName;var _r=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(A.Indicator,{ref:n,className:W(`top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in`,e),...t,children:(0,o.jsx)(`div`,{className:`relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md`})}));_r.displayName=A.Indicator.displayName;var vr=({className:e,...t})=>(0,o.jsx)(`nav`,{role:`navigation`,"aria-label":`pagination`,className:W(`mx-auto flex w-full justify-center`,e),...t});vr.displayName=`Pagination`;var yr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`ul`,{ref:n,className:W(`flex flex-row items-center gap-1`,e),...t}));yr.displayName=`PaginationContent`;var br=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`li`,{ref:n,className:W(``,e),...t}));br.displayName=`PaginationItem`;var xr=({className:e,isActive:t,size:n=`icon`,...r})=>(0,o.jsx)(`a`,{"aria-current":t?`page`:void 0,className:W(be({variant:t?`outline`:`ghost`,size:n}),e),...r});xr.displayName=`PaginationLink`;var Sr=({className:e,...t})=>(0,o.jsxs)(xr,{"aria-label":`Go to previous page`,size:`default`,className:W(`gap-1 pl-2.5`,e),...t,children:[(0,o.jsx)(c.ChevronLeft,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:`Previous`})]});Sr.displayName=`PaginationPrevious`;var Cr=({className:e,...t})=>(0,o.jsxs)(xr,{"aria-label":`Go to next page`,size:`default`,className:W(`gap-1 pr-2.5`,e),...t,children:[(0,o.jsx)(`span`,{children:`Next`}),(0,o.jsx)(c.ChevronRight,{className:`h-4 w-4`})]});Cr.displayName=`PaginationNext`;var wr=({className:e,...t})=>(0,o.jsxs)(`span`,{"aria-hidden":!0,className:W(`flex h-9 w-9 items-center justify-center`,e),...t,children:[(0,o.jsx)(c.MoreHorizontal,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`More pages`})]});wr.displayName=`PaginationEllipsis`;var Tr=j.Root,Er=j.Trigger,Dr=a.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...r},i)=>(0,o.jsx)(j.Portal,{children:(0,o.jsx)(j.Content,{ref:i,align:t,sideOffset:n,className:W(`z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-popover-content-transform-origin)`,e),...r})}));Dr.displayName=j.Content.displayName;var Or=a.forwardRef(({className:e,value:t,...n},r)=>(0,o.jsx)(M.Root,{ref:r,className:W(`relative h-4 w-full overflow-hidden rounded-full bg-secondary`,e),...n,children:(0,o.jsx)(M.Indicator,{className:`h-full w-full flex-1 bg-primary transition-all`,style:{transform:`translateX(-${100-(t||0)}%)`}})}));Or.displayName=M.Root.displayName;var kr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(N.Root,{className:W(`grid gap-2`,e),...t,ref:n}));kr.displayName=N.Root.displayName;var Ar=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(N.Item,{ref:n,className:W(`aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,o.jsx)(N.Indicator,{className:`flex items-center justify-center`,children:(0,o.jsx)(c.Circle,{className:`h-2.5 w-2.5 fill-current text-current`})})}));Ar.displayName=N.Item.displayName;var jr=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(P.Root,{ref:r,className:W(`relative overflow-hidden`,e),...n,children:[(0,o.jsx)(P.Viewport,{className:`h-full w-full rounded-[inherit]`,children:t}),(0,o.jsx)(Mr,{}),(0,o.jsx)(P.Corner,{})]}));jr.displayName=P.Root.displayName;var Mr=a.forwardRef(({className:e,orientation:t=`vertical`,...n},r)=>(0,o.jsx)(P.ScrollAreaScrollbar,{ref:r,orientation:t,className:W(`flex touch-none select-none transition-colors`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent p-[1px]`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent p-[1px]`,e),...n,children:(0,o.jsx)(P.ScrollAreaThumb,{className:`relative flex-1 rounded-full bg-border`})}));Mr.displayName=P.ScrollAreaScrollbar.displayName;var Nr=({onValueChange:e,...t})=>{let n=a.useCallback(t=>{t!==``&&e?.(t)},[e]);return(0,o.jsx)(F.Root,{...t,onValueChange:n})};Nr.displayName=F.Root.displayName;var Pr=F.Group,Fr=F.Value,Ir=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(F.Trigger,{ref:r,className:W(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,o.jsx)(F.Icon,{asChild:!0,children:(0,o.jsx)(c.ChevronDown,{className:`h-4 w-4 opacity-50`})})]}));Ir.displayName=F.Trigger.displayName;var Lr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(F.ScrollUpButton,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,o.jsx)(c.ChevronUp,{className:`h-4 w-4`})}));Lr.displayName=F.ScrollUpButton.displayName;var Rr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(F.ScrollDownButton,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,o.jsx)(c.ChevronDown,{className:`h-4 w-4`})}));Rr.displayName=F.ScrollDownButton.displayName;var zr=a.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,o.jsx)(F.Portal,{children:(0,o.jsxs)(F.Content,{ref:i,className:W(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-select-content-transform-origin)`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,o.jsx)(Lr,{}),(0,o.jsx)(F.Viewport,{className:W(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,o.jsx)(Rr,{})]})}));zr.displayName=F.Content.displayName;var Br=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(F.Label,{ref:n,className:W(`py-1.5 pl-8 pr-2 text-sm font-semibold`,e),...t}));Br.displayName=F.Label.displayName;var Vr=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(F.Item,{ref:r,className:W(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,o.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,o.jsx)(F.ItemIndicator,{children:(0,o.jsx)(c.Check,{className:`h-4 w-4`})})}),(0,o.jsx)(F.ItemText,{children:t})]}));Vr.displayName=F.Item.displayName;var Hr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(F.Separator,{ref:n,className:W(`-mx-1 my-1 h-px bg-muted`,e),...t}));Hr.displayName=F.Separator.displayName;var Ur=a.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,o.jsx)(ee.Root,{ref:i,decorative:n,orientation:t,className:W(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));Ur.displayName=ee.Root.displayName;var Wr=b.Root,Gr=b.Trigger,Kr=b.Close,qr=b.Portal,Jr=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(b.Overlay,{className:W(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));Jr.displayName=b.Overlay.displayName;var Yr=(0,d.cva)(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),Xr=a.forwardRef(({side:e=`right`,className:t,children:n,hideOverlay:r,...i},a)=>(0,o.jsxs)(qr,{children:[!r&&(0,o.jsx)(Jr,{}),(0,o.jsxs)(b.Content,{ref:a,className:W(Yr({side:e}),t),...i,children:[n,(0,o.jsxs)(b.Close,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,o.jsx)(c.X,{className:`h-4 w-4`}),(0,o.jsx)(St,{})]})]})]}));Xr.displayName=b.Content.displayName;var Zr=({className:e,...t})=>(0,o.jsx)(`div`,{className:W(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});Zr.displayName=`SheetHeader`;var Qr=({className:e,...t})=>(0,o.jsx)(`div`,{className:W(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Qr.displayName=`SheetFooter`;var $r=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(b.Title,{ref:n,className:W(`text-lg font-semibold text-foreground`,e),...t}));$r.displayName=b.Title.displayName;var ei=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(b.Description,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));ei.displayName=b.Description.displayName;var ti=768;function ni(){let[e,t]=a.useState(void 0);return a.useEffect(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=()=>{t(window.innerWidth<ti)};return e.addEventListener(`change`,n),t(window.innerWidth<ti),()=>e.removeEventListener(`change`,n)},[]),!!e}function Q({className:e,...t}){return(0,o.jsx)(`div`,{className:W(`animate-pulse rounded-md bg-muted`,e),...t})}var ri=te.Provider,ii=te.Root,ai=te.Trigger,oi=a.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,o.jsx)(te.Content,{ref:r,sideOffset:t,className:W(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-tooltip-content-transform-origin)`,e),...n}));oi.displayName=te.Content.displayName;var si=`sidebar_state`,ci=604800,li=`16rem`,ui=`18rem`,di=`3rem`,fi=`b`,pi=a.createContext(null);function mi(){let e=a.useContext(pi);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}var hi=a.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:s,...c},l)=>{let u=ni(),[d,f]=a.useState(!1),[p,m]=a.useState(e),h=t??p,g=a.useCallback(e=>{let t=typeof e==`function`?e(h):e;n?n(t):m(t),document.cookie=`${si}=${t}; path=/; max-age=${ci}`},[n,h]),_=a.useCallback(()=>u?f(e=>!e):g(e=>!e),[u,g,f]);a.useEffect(()=>{let e=e=>{e.key===fi&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),_())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[_]);let v=h?`expanded`:`collapsed`,y=a.useMemo(()=>({state:v,open:h,setOpen:g,isMobile:u,openMobile:d,setOpenMobile:f,toggleSidebar:_}),[v,h,g,u,d,f,_]);return(0,o.jsx)(pi.Provider,{value:y,children:(0,o.jsx)(ri,{delayDuration:0,children:(0,o.jsx)(`div`,{style:{"--sidebar-width":li,"--sidebar-width-icon":di,...i},className:W(`group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar`,r),ref:l,...c,children:s})})})});hi.displayName=`SidebarProvider`;var gi=a.forwardRef(({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,...a},s)=>{let{isMobile:c,state:l,openMobile:u,setOpenMobile:d}=mi();return n===`none`?(0,o.jsx)(`div`,{className:W(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),ref:s,...a,children:i}):c?(0,o.jsx)(Wr,{open:u,onOpenChange:d,...a,children:(0,o.jsxs)(Xr,{"data-sidebar":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden data-[state=open]:duration-300 data-[state=open]:ease-out`,style:{"--sidebar-width":ui},side:e,children:[(0,o.jsxs)(Zr,{className:`sr-only`,children:[(0,o.jsx)($r,{children:`Sidebar`}),(0,o.jsx)(ei,{children:`Displays the mobile sidebar.`})]}),(0,o.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,o.jsxs)(`div`,{ref:s,className:`group peer hidden text-sidebar-foreground md:block`,"data-state":l,"data-collapsible":n,"data-variant":t,"data-side":e,children:[(0,o.jsx)(`div`,{className:W(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[state=collapsed]:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_1rem)]`:`group-data-[state=collapsed]:group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,o.jsx)(`div`,{className:W(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex`,e===`left`?`left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]`:`right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,t===`floating`||t===`inset`?`p-2 group-data-[state=collapsed]:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_1rem_+_2px)]`:`group-data-[state=collapsed]:group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...a,children:(0,o.jsx)(`div`,{"data-sidebar":`sidebar`,className:`flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow`,children:i})})]})});gi.displayName=`Sidebar`;var _i=a.forwardRef(({className:e,onClick:t,...n},r)=>{let{toggleSidebar:i}=mi();return(0,o.jsxs)(K,{ref:r,"data-sidebar":`trigger`,variant:`ghost`,size:`icon`,className:W(`h-7 w-7`,e),onClick:e=>{t?.(e),i()},...n,children:[(0,o.jsx)(c.PanelLeft,{}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})});_i.displayName=`SidebarTrigger`;var vi=a.forwardRef(({className:e,...t},n)=>{let{toggleSidebar:r}=mi();return(0,o.jsx)(`button`,{ref:n,"data-sidebar":`rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onClick:r,title:`Toggle Sidebar`,className:W(`absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex`,`[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,e),...t})});vi.displayName=`SidebarRail`;var yi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`main`,{ref:n,className:W(`relative flex w-full flex-1 flex-col bg-background`,`md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow`,e),...t}));yi.displayName=`SidebarInset`;var bi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(Z,{ref:n,"data-sidebar":`input`,className:W(`h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring`,e),...t}));bi.displayName=`SidebarInput`;var xi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,"data-sidebar":`header`,className:W(`flex flex-col gap-2 p-2`,e),...t}));xi.displayName=`SidebarHeader`;var Si=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,"data-sidebar":`footer`,className:W(`flex flex-col gap-2 p-2`,e),...t}));Si.displayName=`SidebarFooter`;var Ci=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(Ur,{ref:n,"data-sidebar":`separator`,className:W(`mx-2 w-auto bg-sidebar-border`,e),...t}));Ci.displayName=`SidebarSeparator`;var wi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,"data-sidebar":`content`,className:W(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[state=collapsed]:group-data-[collapsible=icon]:overflow-hidden`,e),...t}));wi.displayName=`SidebarContent`;var Ti=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,"data-sidebar":`group`,className:W(`relative flex w-full min-w-0 flex-col p-2`,e),...t}));Ti.displayName=`SidebarGroup`;var Ei=a.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,o.jsx)(t?u.Slot:`div`,{ref:r,"data-sidebar":`group-label`,className:W(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`group-data-[state=collapsed]:group-data-[collapsible=icon]:-mt-8 group-data-[state=collapsed]:group-data-[collapsible=icon]:opacity-0`,e),...n}));Ei.displayName=`SidebarGroupLabel`;var Di=a.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,o.jsx)(t?u.Slot:`button`,{ref:r,"data-sidebar":`group-action`,className:W(`absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`group-data-[state=collapsed]:group-data-[collapsible=icon]:hidden`,e),...n}));Di.displayName=`SidebarGroupAction`;var Oi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,"data-sidebar":`group-content`,className:W(`w-full text-sm`,e),...t}));Oi.displayName=`SidebarGroupContent`;var ki=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`ul`,{ref:n,"data-sidebar":`menu`,className:W(`flex w-full min-w-0 flex-col gap-1`,e),...t}));ki.displayName=`SidebarMenu`;var Ai=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`li`,{ref:n,"data-sidebar":`menu-item`,className:W(`group/menu-item relative`,e),...t}));Ai.displayName=`SidebarMenuItem`;var ji=(0,d.cva)(`peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding,color,background-color] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground sidebar-menu-button-icon-mode [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm sidebar-menu-button-icon-mode-lg`}},defaultVariants:{variant:`default`,size:`default`}}),Mi=a.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...s},c)=>{let l=e?u.Slot:`button`,{isMobile:d,state:f}=mi(),p=(0,o.jsx)(l,{ref:c,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:W(ji({variant:n,size:r}),a),...s});return i?(typeof i==`string`&&(i={children:i}),(0,o.jsxs)(ii,{children:[(0,o.jsx)(ai,{asChild:!0,children:p}),(0,o.jsx)(oi,{side:`right`,align:`center`,hidden:f!==`collapsed`||d,...i})]})):p});Mi.displayName=`SidebarMenuButton`;var Ni=a.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>(0,o.jsx)(t?u.Slot:`button`,{ref:i,"data-sidebar":`menu-action`,className:W(`absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[state=collapsed]:group-data-[collapsible=icon]:hidden`,n&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0`,e),...r}));Ni.displayName=`SidebarMenuAction`;var Pi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,"data-sidebar":`menu-badge`,className:W(`pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground`,`peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[state=collapsed]:group-data-[collapsible=icon]:hidden`,e),...t}));Pi.displayName=`SidebarMenuBadge`;var Fi=a.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{let i=a.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return(0,o.jsxs)(`div`,{ref:r,"data-sidebar":`menu-skeleton`,className:W(`flex h-8 items-center gap-2 rounded-md px-2`,e),...n,children:[t&&(0,o.jsx)(Q,{className:`size-4 rounded-md`,"data-sidebar":`menu-skeleton-icon`}),(0,o.jsx)(Q,{className:`h-4 max-w-(--skeleton-width) flex-1`,"data-sidebar":`menu-skeleton-text`,style:{"--skeleton-width":i}})]})});Fi.displayName=`SidebarMenuSkeleton`;var Ii=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`ul`,{ref:n,"data-sidebar":`menu-sub`,className:W(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5`,`group-data-[state=collapsed]:group-data-[collapsible=icon]:hidden`,e),...t}));Ii.displayName=`SidebarMenuSub`;var Li=a.forwardRef(({...e},t)=>(0,o.jsx)(`li`,{ref:t,...e}));Li.displayName=`SidebarMenuSubItem`;var Ri=a.forwardRef(({asChild:e=!1,size:t=`md`,isActive:n,className:r,...i},a)=>(0,o.jsx)(e?u.Slot:`a`,{ref:a,"data-sidebar":`menu-sub-button`,"data-size":t,"data-active":n,className:W(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,`data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground`,t===`sm`&&`text-xs`,t===`md`&&`text-sm`,`group-data-[state=collapsed]:group-data-[collapsible=icon]:hidden`,r),...i}));Ri.displayName=`SidebarMenuSubButton`;var zi=a.forwardRef(({className:e,...t},n)=>(0,o.jsxs)(I.Root,{ref:n,className:W(`relative flex w-full touch-none select-none items-center`,e),...t,children:[(0,o.jsx)(I.Track,{className:`relative h-2 w-full grow overflow-hidden rounded-full bg-secondary`,children:(0,o.jsx)(I.Range,{className:`absolute h-full bg-primary`})}),(0,o.jsx)(I.Thumb,{className:`block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,"aria-label":t[`aria-label`]})]}));zi.displayName=I.Root.displayName;var Bi=({...e})=>{let{theme:t=`system`}=(0,ne.useTheme)();return(0,o.jsx)(L.Toaster,{theme:t,className:`toaster group`,icons:{success:(0,o.jsx)(c.CircleCheck,{className:`h-4 w-4`}),info:(0,o.jsx)(c.Info,{className:`h-4 w-4`}),warning:(0,o.jsx)(c.TriangleAlert,{className:`h-4 w-4`}),error:(0,o.jsx)(c.OctagonX,{className:`h-4 w-4`}),loading:(0,o.jsx)(c.LoaderCircle,{className:`h-4 w-4 animate-spin`})},toastOptions:{classNames:{toast:`group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg`,description:`group-[.toast]:text-muted-foreground`,actionButton:`group-[.toast]:bg-primary group-[.toast]:text-primary-foreground`,cancelButton:`group-[.toast]:bg-muted group-[.toast]:text-muted-foreground`}},...e})},Vi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(re.Root,{className:W(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...t,ref:n,children:(0,o.jsx)(re.Thumb,{className:W(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)})}));Vi.displayName=re.Root.displayName;var Hi=a.forwardRef(({className:e,containerClassName:t,...n},r)=>(0,o.jsx)(`div`,{className:W(`relative w-full overflow-auto`,t),children:(0,o.jsx)(`table`,{ref:r,className:W(`w-full caption-bottom text-sm`,e),...n})}));Hi.displayName=`Table`;var Ui=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`thead`,{ref:n,className:W(`[&_tr]:border-b`,e),...t}));Ui.displayName=`TableHeader`;var Wi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`tbody`,{ref:n,className:W(`[&_tr:last-child]:border-0`,e),...t}));Wi.displayName=`TableBody`;var Gi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`tfoot`,{ref:n,className:W(`border-t bg-muted/50 font-medium [&>tr]:last:border-b-0`,e),...t}));Gi.displayName=`TableFooter`;var Ki=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`tr`,{ref:n,className:W(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,e),...t}));Ki.displayName=`TableRow`;var qi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`th`,{ref:n,className:W(`h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0`,e),...t}));qi.displayName=`TableHead`;var Ji=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`td`,{ref:n,className:W(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,e),...t}));Ji.displayName=`TableCell`;var Yi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`caption`,{ref:n,className:W(`mt-4 text-sm text-muted-foreground`,e),...t}));Yi.displayName=`TableCaption`;var Xi=R.Root,Zi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(R.List,{ref:n,className:W(`inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground`,e),...t}));Zi.displayName=R.List.displayName;var Qi=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(R.Trigger,{ref:n,className:W(`inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm`,e),...t}));Qi.displayName=R.Trigger.displayName;var $i=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(R.Content,{ref:n,className:W(`mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,e),...t}));$i.displayName=R.Content.displayName;var ea=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`textarea`,{className:W(`flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,e),ref:n,...t}));ea.displayName=`Textarea`;var ta=(0,d.cva)(`inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 gap-2`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-accent hover:text-accent-foreground`},size:{default:`h-10 px-3 min-w-10`,sm:`h-9 px-2.5 min-w-9`,lg:`h-11 px-5 min-w-11`}},defaultVariants:{variant:`default`,size:`default`}}),na=a.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,o.jsx)(B.Root,{ref:i,className:W(ta({variant:t,size:n,className:e})),...r}));na.displayName=B.Root.displayName;var ra=a.createContext({size:`default`,variant:`default`}),ia=a.forwardRef(({className:e,variant:t,size:n,children:r,...i},a)=>(0,o.jsx)(z.Root,{ref:a,className:W(`flex items-center justify-center gap-1`,e),...i,children:(0,o.jsx)(ra.Provider,{value:{variant:t,size:n},children:r})}));ia.displayName=z.Root.displayName;var aa=a.forwardRef(({className:e,children:t,variant:n,size:r,...i},s)=>{let c=a.useContext(ra);return(0,o.jsx)(z.Item,{ref:s,className:W(ta({variant:c.variant||n,size:c.size||r}),e),...i,children:t})});aa.displayName=z.Item.displayName;var oa=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`h1`,{ref:n,className:W(`scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl`,e),...t}));oa.displayName=`TypographyH1`;var sa=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`h2`,{ref:n,className:W(`scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0`,e),...t}));sa.displayName=`TypographyH2`;var ca=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`h3`,{ref:n,className:W(`scroll-m-20 text-2xl font-semibold tracking-tight`,e),...t}));ca.displayName=`TypographyH3`;var la=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`h4`,{ref:n,className:W(`scroll-m-20 text-xl font-semibold tracking-tight`,e),...t}));la.displayName=`TypographyH4`;var ua=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`p`,{ref:n,className:W(`leading-7 [&:not(:first-child)]:mt-6`,e),...t}));ua.displayName=`TypographyP`;var da=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`blockquote`,{ref:n,className:W(`mt-6 border-l-2 pl-6 italic`,e),...t}));da.displayName=`TypographyBlockquote`;var fa=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`ul`,{ref:n,className:W(`my-6 ml-6 list-disc [&>li]:mt-2`,e),...t}));fa.displayName=`TypographyList`;var pa=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`code`,{ref:n,className:W(`relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold`,e),...t}));pa.displayName=`TypographyInlineCode`;var ma=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`p`,{ref:n,className:W(`text-xl text-muted-foreground`,e),...t}));ma.displayName=`TypographyLead`;var ha=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`div`,{ref:n,className:W(`text-lg font-semibold`,e),...t}));ha.displayName=`TypographyLarge`;var ga=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`small`,{ref:n,className:W(`text-sm font-medium leading-none`,e),...t}));ga.displayName=`TypographySmall`;var _a=a.forwardRef(({className:e,...t},n)=>(0,o.jsx)(`p`,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));_a.displayName=`TypographyMuted`;var va=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let{"data-obj-id":i,"data-obj-type":a,style:s,...c}=n;return(0,o.jsx)(Ur,{ref:r,orientation:e.orientation,className:t,...c,"data-obj-id":i,"data-obj-type":a,style:s})});t.ComponentRegistry.register(`separator`,va,{namespace:`ui`,label:`Separator`,inputs:[{name:`orientation`,type:`enum`,enum:[`horizontal`,`vertical`],defaultValue:`horizontal`,label:`Orientation`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{orientation:`horizontal`,className:`my-2 sm:my-4`}}),t.ComponentRegistry.register(`image`,({schema:e,className:t,...n})=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=n;return(0,o.jsx)(`img`,{src:e.src,alt:e.alt||``,className:t,...s,"data-obj-id":r,"data-obj-type":i,style:a})},{namespace:`ui`,label:`Image`,icon:`image`,category:`basic`,inputs:[{name:`src`,type:`string`,label:`Source URL`},{name:`alt`,type:`string`,label:`Alt Text`},{name:`className`,type:`string`,label:`Classes`}],defaultProps:{className:`max-w-full h-auto`}});function ya(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}var ba={Home:`House`},xa=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let{"data-obj-id":i,"data-obj-type":a,style:s,...l}=n,u=ya(e.name),d=ba[u]||u,f=c.icons[d];if(!f)return console.warn(`Icon "${e.name}" (lookup: "${u}"${d===u?``:` -> "${d}"`}) not found in lucide-react`),null;let p=e.size?{width:e.size,height:e.size}:void 0,m=W(e.color,e.className,t);return(0,o.jsx)(f,{ref:r,className:m,style:{...p,...s},...l,"data-obj-id":i,"data-obj-type":a})});xa.displayName=`IconRenderer`,t.ComponentRegistry.register(`icon`,xa,{namespace:`ui`,label:`Icon`,icon:`smile`,category:`basic`,inputs:[{name:`name`,type:`string`,label:`Icon Name`,defaultValue:`smile`},{name:`size`,type:`number`,label:`Size (px)`},{name:`color`,type:`string`,label:`Color Class`},{name:`className`,type:`string`,label:`CSS Class`}]}),t.ComponentRegistry.register(`html`,({schema:e,className:t,...n})=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=n;return(0,o.jsx)(`div`,{className:W(`prose prose-sm max-w-none dark:prose-invert`,t),dangerouslySetInnerHTML:{__html:e.html},...s,"data-obj-id":r,"data-obj-type":i,style:a})},{namespace:`ui`,label:`HTML Content`,inputs:[{name:`html`,type:`string`,label:`HTML`,description:`Raw HTML content`}]});var Sa=new Set([`img`,`hr`,`br`]),Ca=`h1.h2.h3.h4.h5.h6.p.a.blockquote.pre.strong.em.b.i.u.small.mark.sub.sup.del.ins.abbr.ul.ol.li.dl.dt.dd.figure.figcaption.img.hr.br.time.address.cite.kbd.q`.split(`.`),wa={a:[{name:`href`,type:`string`,label:`Link URL`},{name:`target`,type:`string`,label:`Target`},{name:`rel`,type:`string`,label:`Rel`},{name:`title`,type:`string`,label:`Title`}],img:[{name:`src`,type:`string`,label:`Image URL`},{name:`alt`,type:`string`,label:`Alt text`},{name:`width`,type:`number`,label:`Width`},{name:`height`,type:`number`,label:`Height`},{name:`title`,type:`string`,label:`Title`}],time:[{name:`dateTime`,type:`string`,label:`Datetime`}],abbr:[{name:`title`,type:`string`,label:`Title`}],q:[{name:`cite`,type:`string`,label:`Cite`}],blockquote:[{name:`cite`,type:`string`,label:`Cite`}]};function Ta(e){if(typeof e!=`string`)return;let t=e.trim();if(!/^(javascript|data|vbscript):/i.test(t))return t}function Ea(e){if(typeof e!=`string`||e.trim().length===0)return null;let t=e.trim();if(/^[a-z][a-z0-9+.-]*:/i.test(t)||t.startsWith(`//`)||t.startsWith(`#`))return null;try{let e=new URL(t,`https://internal.invalid/`);return e.pathname+e.search+e.hash}catch{return null}}for(let e of Ca){let n=Sa.has(e),r=(0,a.forwardRef)(({schema:t,className:r,...o},s)=>{let{"data-obj-id":c,"data-obj-type":l,style:u,dangerouslySetInnerHTML:d,children:f,...p}=o,m={};for(let[e,t]of Object.entries(p))/^on[A-Z]/.test(e)||(m[e]=t);e===`a`&&`href`in m&&(m.href=Ta(m.href));let h=(0,a.useContext)(i.ActionCtxReact),g;if(e===`a`&&h){let e=Ea(m.href),t=typeof m.target==`string`?m.target:``;e&&(!t||t===`_self`)&&(g=t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),h.runner.execute({type:`url`,target:e,toast:{showOnSuccess:!1}}).then(e=>{e?.success&&e.redirect&&window.location.assign(e.redirect)}))})}return(0,a.createElement)(e,{ref:s,className:r,...m,...g?{onClick:g}:{},"data-obj-id":c,"data-obj-type":l,style:u},n?void 0:G(t?.children??t?.body))});r.displayName=`Html${e.charAt(0).toUpperCase()}${e.slice(1)}`,t.ComponentRegistry.register(e,r,{namespace:`ui`,label:e.toUpperCase(),category:`basic`,inputs:[{name:`className`,type:`string`,label:`CSS Class`},...wa[e]??[]]})}t.ComponentRegistry.register(`button-group`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(`div`,{className:W(`flex flex-wrap sm:inline-flex rounded-md shadow-sm`,e.className),role:`group`,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:e.buttons?.map((t,n)=>(0,o.jsx)(K,{variant:t.variant||e.variant,size:t.size||e.size,className:W(`rounded-none`,n===0&&`rounded-l-md`,n===(e.buttons?.length||0)-1&&`rounded-r-md`,n>0&&`-ml-px`,t.className),children:t.label},n))})},{namespace:`ui`,label:`Button Group`,inputs:[{name:`variant`,type:`enum`,enum:[`default`,`destructive`,`outline`,`secondary`,`ghost`,`link`],defaultValue:`default`,label:`Variant`},{name:`size`,type:`enum`,enum:[`default`,`sm`,`lg`,`icon`],defaultValue:`default`,label:`Size`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{variant:`default`,size:`default`,buttons:[{label:`Left`},{label:`Middle`},{label:`Right`}]}}),t.ComponentRegistry.register(`pagination`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,onPageChange:a,...s}=t,c=e.currentPage||e.page||1,l=e.totalPages||1,u=(e,t)=>{t.preventDefault(),e!==c&&(e<1||e>l||a&&a(e))},d=()=>l<=7?Array.from({length:l},(e,t)=>t+1):c<=3?[1,2,3,4,5,-1,l]:c>=l-2?[1,-1,l-4,l-3,l-2,l-1,l]:[1,-1,c-1,c,c+1,-1,l];return(0,o.jsx)(vr,{className:e.className,...s,"data-obj-id":n,"data-obj-type":r,style:i,children:(0,o.jsxs)(yr,{children:[(0,o.jsx)(br,{children:(0,o.jsx)(Sr,{href:`#`,onClick:e=>u(c-1,e),className:c<=1?`pointer-events-none opacity-50`:`cursor-pointer`,"aria-disabled":c<=1})}),d().map((e,t)=>(0,o.jsx)(br,{children:e===-1?(0,o.jsx)(wr,{}):(0,o.jsx)(xr,{href:`#`,isActive:e===c,onClick:t=>u(e,t),className:`cursor-pointer`,children:e})},t)),(0,o.jsx)(br,{children:(0,o.jsx)(Cr,{href:`#`,onClick:e=>u(c+1,e),className:c>=l?`pointer-events-none opacity-50`:`cursor-pointer`,"aria-disabled":c>=l})})]})})},{namespace:`ui`,label:`Pagination`,inputs:[{name:`currentPage`,type:`number`,label:`Current Page`,defaultValue:1},{name:`totalPages`,type:`number`,label:`Total Pages`,defaultValue:10},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{currentPage:1,totalPages:10}}),t.ComponentRegistry.register(`navigation-menu`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(lr,{className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:(0,o.jsx)(ur,{children:e.items?.map((e,t)=>(0,o.jsx)(dr,{children:e.children?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(pr,{children:e.label}),(0,o.jsx)(mr,{children:(0,o.jsx)(`ul`,{className:`grid w-full gap-3 p-4 sm:w-[400px] md:w-[500px] md:grid-cols-2 lg:w-[600px]`,children:e.children.map((e,t)=>(0,o.jsx)(`li`,{children:(0,o.jsx)(hr,{asChild:!0,children:(0,o.jsxs)(`a`,{className:W(`block select-none space-y-1 rounded-md p-3 leading-none no-underline outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground`),href:e.href,children:[(0,o.jsx)(`div`,{className:`text-sm font-medium leading-none`,children:e.label}),e.description&&(0,o.jsx)(`p`,{className:`line-clamp-2 text-sm leading-snug text-muted-foreground`,children:e.description})]})})},t))})})]}):(0,o.jsx)(hr,{href:e.href,children:e.label})},t))})})},{namespace:`ui`,label:`Navigation Menu`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{items:[{label:`Home`,href:`/`},{label:`About`,href:`/about`}]}});function Da(e){return e.includes(`-`)?e.toLowerCase():e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1-$2`).toLowerCase()}var Oa=new Set(ie.iconNames);function ka(e){return Oa.has(e)}function Aa(e){return!!e&&ka(Da(e))}var ja=new Map;function Ma(e){if(!e)return c.Database;let t=ja.get(e);if(t)return t;let n=Da(e);if(!ka(n))return ja.set(e,c.Database),c.Database;let r=e=>a.default.createElement(ie.DynamicIcon,{name:n,fallback:c.Database,...e});return r.displayName=`LucideIcon(${e})`,ja.set(e,r),r}var Na=({name:e,...t})=>{if(!e)return a.default.createElement(c.Database,t);let n=Da(e);return ka(n)?a.default.createElement(ie.DynamicIcon,{name:n,fallback:c.Database,...t}):a.default.createElement(c.Database,t)};function Pa(e){let t=e?.properties??{};return{...e?.props??{},...t}}function Fa(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n.startsWith(`aria-`)||n===`role`?n:`aria-${n}`]=String(r));return t}var Ia={left:`text-left`,center:`text-center`,right:`text-right`},La={heading:`text-2xl font-semibold tracking-tight`,subheading:`text-lg font-medium text-foreground`,body:`text-sm text-foreground`,caption:`text-xs text-muted-foreground`};function Ra({schema:e}){let t=Pa(e),{language:n}=(0,x.useObjectTranslation)(),r=t.variant??`body`,i=t.align??`left`;return(0,o.jsx)(r===`heading`?`h2`:r===`subheading`?`h3`:`p`,{className:W(La[r]??La.body,Ia[i],e?.className),...Fa(t.aria),children:(0,x.pickLocalized)(t.content,n)})}t.ComponentRegistry.register(`text`,Ra,{namespace:`element`,skipFallback:!0,label:`Text`,category:`content`,inputs:[{name:`content`,type:`string`,label:`Content`,required:!0,description:`Accepts an inline translation map ({ en, "zh-CN", … })`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`heading`,`subheading`,`body`,`caption`],defaultValue:`body`},{name:`align`,type:`enum`,label:`Align`,enum:[`left`,`center`,`right`],defaultValue:`left`}]});function za({schema:e}){return(0,o.jsx)(Ur,{className:W(`my-4`,e?.className)})}t.ComponentRegistry.register(`divider`,za,{namespace:`element`,skipFallback:!0,label:`Divider`,category:`content`});var Ba={cover:`object-cover`,contain:`object-contain`,fill:`object-fill`};function Va({schema:e}){let t=Pa(e),n=t.fit??`cover`;return t.src?(0,o.jsx)(`img`,{src:t.src,alt:t.alt??``,className:W(`w-full rounded-md`,Ba[n]??Ba.cover,e?.className),style:t.height?{height:t.height}:void 0,...Fa(t.aria)}):(0,o.jsx)(`div`,{className:W(`flex items-center justify-center rounded-md border border-dashed bg-muted/30 text-xs text-muted-foreground`,e?.className),style:{height:t.height??120},children:`no image source`})}t.ComponentRegistry.register(`image`,Va,{namespace:`element`,skipFallback:!0,label:`Image`,category:`content`});var Ha={primary:`default`,secondary:`secondary`,danger:`destructive`,ghost:`ghost`,link:`link`},Ua={small:`sm`,medium:`default`,large:`lg`};function Wa({schema:e}){let t=Pa(e),n=Ha[t.variant??`primary`]??`default`,r=Ua[t.size??`medium`]??`default`,{language:s}=(0,x.useObjectTranslation)(),c=(0,x.pickLocalized)(t.label,s),l=t.iconPosition??`left`,u=t.icon?(0,o.jsx)(Na,{name:t.icon,className:`h-4 w-4`}):null,{execute:d}=(0,i.useAction)(),[f,p]=a.useState(!1),m=t.action,h=a.useCallback(async()=>{if(!(!m||f)){p(!0);try{let e=Array.isArray(m.params)?{actionParams:m.params}:{params:m.params};await d({type:m.actionType||m.type,name:m.name,label:m.label,description:m.description,target:m.target,openIn:m.openIn,endpoint:m.endpoint,method:m.method,navigate:m.navigate,to:m.to,opensInNewTab:m.opensInNewTab,confirmText:m.confirmText,successMessage:m.successMessage,errorMessage:m.errorMessage,refreshAfter:m.refreshAfter,...e})}finally{p(!1)}}},[m,d,f]);return(0,o.jsxs)(K,{type:`button`,variant:n,size:r,disabled:t.disabled||f,className:W(e?.className),onClick:m?h:void 0,...Fa(t.aria),children:[l===`left`&&u,c,l===`right`&&u]})}t.ComponentRegistry.register(`button`,Wa,{namespace:`element`,skipFallback:!0,label:`Button`,category:`action`,inputs:[{name:`label`,type:`string`,label:`Label`,required:!0,description:`Accepts an inline translation map ({ en, "zh-CN", … })`},{name:`action`,type:`object`,label:`Action`,description:`Inline ActionDef executed on click (url / navigation / api / script / modal / flow); omitted → renders inert`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`primary`,`secondary`,`danger`,`ghost`,`link`],defaultValue:`primary`},{name:`size`,type:`enum`,label:`Size`,enum:[`small`,`medium`,`large`],defaultValue:`medium`},{name:`icon`,type:`string`,label:`Icon`,description:`Lucide icon name`},{name:`iconPosition`,type:`enum`,label:`Icon Position`,enum:[`left`,`right`],defaultValue:`left`},{name:`disabled`,type:`boolean`,label:`Disabled`}]});var Ga={number:{},currency:{style:`currency`,currency:`USD`},percent:{style:`percent`,maximumFractionDigits:1}};function Ka(e,t,n,r,i,a){if(e==null||Number.isNaN(e))return`—`;let o=Ga[t??`number`]??Ga.number;t===`currency`&&(o=i?{...Ga.currency,currency:i}:Ga.number);let s=new Intl.NumberFormat(a,o).format(e);return`${n??``}${s}${r??``}`}function qa({schema:e}){let t=Pa(e),n=(0,i.useAdapter)(),{currency:r,locale:s}=(0,x.useLocalization)(),[c,l]=a.useState(null),[u,d]=a.useState(!0),[f,p]=a.useState(null),m=a.useMemo(()=>t.filter?JSON.stringify(t.filter):``,[t.filter]);return a.useEffect(()=>{let e=!1;if(!n||!t.object||!t.aggregate){d(!1);return}return d(!0),p(null),(async()=>{try{if(typeof n.aggregate==`function`){let r=await n.aggregate(t.object,{field:t.field,function:t.aggregate,groupBy:`_all`,filter:t.filter}),i=Array.isArray(r)?r[0]:r,a=t.aggregate===`count`?`count`:`${t.field??``}_${t.aggregate}`,o=i?.[a]??i?.[t.field??``]??i?.value??(typeof i==`number`?i:null);e||l(typeof o==`number`?o:o==null?null:Number(o))}else if(typeof n.find==`function`){let r=await n.find(t.object,t.filter?{$filter:t.filter}:void 0),i=r?.data??r?.records??(Array.isArray(r)?r:[]),a=null;if(t.aggregate===`count`)a=i.length;else if(t.field){let e=i.map(e=>Number(e?.[t.field])).filter(e=>!Number.isNaN(e));e.length&&(t.aggregate===`sum`?a=e.reduce((e,t)=>e+t,0):t.aggregate===`avg`?a=e.reduce((e,t)=>e+t,0)/e.length:t.aggregate===`min`?a=Math.min(...e):t.aggregate===`max`&&(a=Math.max(...e)))}e||l(a)}}catch(t){e||p(t?.message??`aggregate failed`)}finally{e||d(!1)}})(),()=>{e=!0}},[n,t.object,t.field,t.aggregate,m]),(0,o.jsxs)(`div`,{className:W(`flex flex-col gap-1`,e?.className),...Fa(t.aria),children:[(0,o.jsx)(`div`,{className:`text-3xl font-semibold tracking-tight tabular-nums`,children:u?`…`:Ka(c,t.format,t.prefix,t.suffix,r,s)}),f&&(0,o.jsx)(`div`,{className:`text-xs text-destructive`,children:f})]})}t.ComponentRegistry.register(`number`,qa,{namespace:`element`,skipFallback:!0,label:`Number`,category:`content`,inputs:[{name:`object`,type:`string`,label:`Object`,required:!0,description:`Object the aggregate runs over`},{name:`aggregate`,type:`enum`,label:`Aggregate`,enum:[`count`,`sum`,`avg`,`min`,`max`],required:!0},{name:`field`,type:`string`,label:`Field`,description:`Measure field (required for every aggregate except count)`},{name:`filter`,type:`array`,label:`Filter`},{name:`format`,type:`enum`,label:`Format`,enum:[`number`,`currency`,`percent`],defaultValue:`number`},{name:`prefix`,type:`string`,label:`Prefix`},{name:`suffix`,type:`string`,label:`Suffix`}]});function Ja(e){let t=e?.properties??{};return{...e?.props??{},...t}}function Ya(e,t){if(!e||!t)return;let n=e.fields;if(n)return Array.isArray(n)?n.find(e=>e?.name===t):n[t]}function Xa({hint:e,icon:t,title:n,subtitle:r,children:i}){return(0,o.jsxs)(`div`,{className:`rounded-lg border bg-card text-card-foreground shadow-sm overflow-hidden`,children:[(0,o.jsxs)(`div`,{className:`flex items-start gap-2.5 border-b bg-muted/40 px-3.5 py-2.5`,children:[(0,o.jsx)(t,{className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground`}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,o.jsx)(`span`,{className:`text-sm font-semibold leading-tight`,children:n}),(0,o.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-muted-foreground`,children:e})]}),r&&(0,o.jsx)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:r})]})]}),(0,o.jsx)(`div`,{className:`p-3.5`,children:i})]})}function Za({tone:e=`muted`,children:t}){return(0,o.jsxs)(`div`,{className:W(`flex items-center gap-2 rounded-md border border-dashed px-3 py-2.5 text-xs`,e===`warn`?`border-amber-300 bg-amber-50 text-amber-800 dark:border-amber-900 dark:bg-amber-950/30 dark:text-amber-300`:`bg-muted/30 text-muted-foreground`),children:[e===`warn`&&(0,o.jsx)(c.AlertTriangle,{className:`h-3.5 w-3.5 shrink-0`}),t]})}function Qa({object:e,name:t}){let{item:n,loading:r,error:s}=(0,i.useMetadataItem)(`object`,e??null),l=a.useMemo(()=>{let e=n?.validations??n?.validationRules??[];if(Array.isArray(e))return e.find(e=>e?.type===`state_machine`&&(!t||e?.name===t))},[n,t]);if(!e)return(0,o.jsxs)(Za,{tone:`warn`,children:[`Missing `,(0,o.jsx)(`code`,{className:`font-mono`,children:`object`}),` for the state machine.`]});if(r)return(0,o.jsxs)(Za,{children:[`Loading `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),`…`]});if(s)return(0,o.jsxs)(Za,{tone:`warn`,children:[`Failed to load object `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),`: `,s.message]});if(!n)return(0,o.jsxs)(Za,{tone:`warn`,children:[`Object `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),` not found.`]});if(!l)return(0,o.jsxs)(Za,{tone:`warn`,children:[`No state machine`,t?` named “${t}”`:``,` on `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),`.`]});let u=l.transitions&&typeof l.transitions==`object`&&!Array.isArray(l.transitions)?l.transitions:{},d=Ya(n,l.field),f=Array.isArray(d?.options)?d.options:[],p=new Map(f.map(e=>[e.value,e])),m=e=>p.get(e)?.label??e,h=e=>p.get(e)?.color,g=f.find(e=>e.default)?.value,_=new Set;g&&_.add(g);for(let e of f)_.add(e.value);for(let[e,t]of Object.entries(u)){_.add(e);for(let e of t)_.add(e)}let v=[..._],y=({value:e})=>{let t=h(e);return(0,o.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border bg-background px-2 py-0.5 text-xs font-medium`,children:[(0,o.jsx)(`span`,{className:`h-2 w-2 rounded-full`,style:{backgroundColor:t??`var(--muted-foreground)`}}),m(e)]})};return(0,o.jsx)(Xa,{hint:`state machine`,icon:c.Workflow,title:l.label??l.name??`State machine`,subtitle:(0,o.jsxs)(o.Fragment,{children:[`Lifecycle of `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),l.field?(0,o.jsxs)(o.Fragment,{children:[` · field `,(0,o.jsx)(`code`,{className:`font-mono`,children:l.field})]}):null]}),children:(0,o.jsx)(`ol`,{className:`space-y-1.5`,children:v.map(e=>{let t=u[e]??[],n=e===g,r=t.length===0;return(0,o.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1.5 rounded-md border bg-muted/20 px-2.5 py-2`,children:[(0,o.jsx)(y,{value:e}),n&&(0,o.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-emerald-100 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-emerald-700 dark:bg-emerald-950/50 dark:text-emerald-400`,children:[(0,o.jsx)(c.CircleDot,{className:`h-3 w-3`}),` initial`]}),r?(0,o.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:[(0,o.jsx)(c.Flag,{className:`h-3 w-3`}),` final`]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(c.ArrowRight,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,o.jsx)(`span`,{className:`flex flex-wrap gap-1.5`,children:t.map(e=>(0,o.jsx)(y,{value:e},e))})]})]},e)})})})}var $a=new Set([`script`,`http_request`,`connector_action`,`assignment`,`get_record`,`create_record`,`update_record`,`delete_record`,`boundary_event`]);function eo({name:e,detail:t}){let{item:n,loading:r,error:a}=(0,i.useMetadataItem)(`flow`,e??null);if(!e)return(0,o.jsxs)(Za,{tone:`warn`,children:[`Missing `,(0,o.jsx)(`code`,{className:`font-mono`,children:`name`}),` for the flow.`]});if(r)return(0,o.jsxs)(Za,{children:[`Loading flow `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),`…`]});if(a)return(0,o.jsxs)(Za,{tone:`warn`,children:[`Failed to load flow `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),`: `,a.message]});if(!n)return(0,o.jsxs)(Za,{tone:`warn`,children:[`Flow `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),` not found.`]});let s=Array.isArray(n.nodes)?n.nodes:[],l=(t??`business`)===`business`,u=l?s.filter(e=>!$a.has(e?.type)):s,d=s.length-u.length;return(0,o.jsxs)(Xa,{hint:`flow`,icon:c.GitBranch,title:n.label??n.name??e,subtitle:n.description??(0,o.jsxs)(o.Fragment,{children:[`Process with `,s.length,` step`,s.length===1?``:`s`]}),children:[u.length===0?(0,o.jsx)(Za,{children:`No steps to show.`}):(0,o.jsx)(`ol`,{className:`space-y-1.5`,children:u.map((e,t)=>(0,o.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-md border bg-muted/20 px-2.5 py-2`,children:[(0,o.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary/10 text-[11px] font-semibold text-primary`,children:t+1}),(0,o.jsx)(`span`,{className:`text-sm`,children:e?.label??e?.id??`(step)`}),e?.type&&(0,o.jsx)(`span`,{className:`ml-auto rounded border bg-background px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:e.type})]},e?.id??t))}),l&&d>0&&(0,o.jsxs)(`div`,{className:`mt-2 text-[11px] text-muted-foreground`,children:[d,` technical step`,d===1?``:`s`,` hidden · set `,(0,o.jsx)(`code`,{className:`font-mono`,children:`detail: technical`}),` to show all`]})]})}var to=[{key:`allowCreate`,label:`C`},{key:`allowRead`,label:`R`},{key:`allowEdit`,label:`U`},{key:`allowDelete`,label:`D`}];function no({name:e}){let{item:t,loading:n,error:r}=(0,i.useMetadataItem)(`permission`,e??null);if(!e)return(0,o.jsxs)(Za,{tone:`warn`,children:[`Missing `,(0,o.jsx)(`code`,{className:`font-mono`,children:`name`}),` for the permission set.`]});if(n)return(0,o.jsxs)(Za,{children:[`Loading permission set `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),`…`]});if(r)return(0,o.jsxs)(Za,{tone:`warn`,children:[`Failed to load permission `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),`: `,r.message]});if(!t)return(0,o.jsxs)(Za,{tone:`warn`,children:[`Permission set `,(0,o.jsx)(`code`,{className:`font-mono`,children:e}),` not found.`]});let a=t.objects&&typeof t.objects==`object`?t.objects:{},s=Object.entries(a);return(0,o.jsx)(Xa,{hint:`permission`,icon:c.ShieldCheck,title:t.label??t.name??e,subtitle:(0,o.jsxs)(o.Fragment,{children:[`Object access · `,s.length,` object`,s.length===1?``:`s`]}),children:s.length===0?(0,o.jsx)(Za,{children:`No object permissions declared.`}):(0,o.jsxs)(`table`,{className:`w-full border-separate border-spacing-0 text-xs`,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{className:`text-muted-foreground`,children:[(0,o.jsx)(`th`,{className:`border-b px-2 py-1.5 text-left font-medium`,children:`Object`}),to.map(e=>(0,o.jsx)(`th`,{className:`border-b px-2 py-1.5 text-center font-mono font-medium`,title:e.key,children:e.label},e.key))]})}),(0,o.jsx)(`tbody`,{children:s.map(([e,t])=>(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{className:`border-b px-2 py-1.5 font-mono`,children:e}),to.map(e=>(0,o.jsx)(`td`,{className:`border-b px-2 py-1.5 text-center`,children:t?.[e.key]?(0,o.jsx)(c.Check,{className:`mx-auto h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400`}):(0,o.jsx)(c.Minus,{className:`mx-auto h-3.5 w-3.5 text-muted-foreground/40`})},e.key))]},e))})]})})}function ro({schema:e}){let t=Ja(e);switch(t.type){case`state_machine`:return(0,o.jsx)(Qa,{...t});case`flow`:return(0,o.jsx)(eo,{...t});case`permission`:return(0,o.jsx)(no,{...t});default:return(0,o.jsxs)(Za,{tone:`warn`,children:[`Unknown metadata view type`,t.type?` “${t.type}”`:``,`. Expected`,` `,(0,o.jsx)(`code`,{className:`font-mono`,children:`state_machine`}),`, `,(0,o.jsx)(`code`,{className:`font-mono`,children:`flow`}),`, or`,` `,(0,o.jsx)(`code`,{className:`font-mono`,children:`permission`}),`.`]})}}t.ComponentRegistry.register(`metadata_viewer`,ro,{namespace:`element`,skipFallback:!0,label:`Metadata Viewer`,category:`content`});function io(e){let t=e?.properties??{};return{...e?.props??{},...t}}function ao(e){return e==null||e===``?`—`:typeof e==`object`?JSON.stringify(e):String(e)}function oo({schema:e}){let t=io(e),n=Array.isArray(t.items)?t.items:[],r=t.columns===2?`sm:grid-cols-2`:`grid-cols-1`;return n.length===0?(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No details`}):(0,o.jsx)(`dl`,{className:W(`grid gap-x-6 gap-y-3`,r,e?.className,t.className),"data-testid":`definition-list`,children:n.map((e,n)=>(0,o.jsxs)(`div`,{className:W(t.inline?`flex items-baseline justify-between gap-3`:`flex flex-col gap-0.5`),children:[(0,o.jsx)(`dt`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:e.term}),(0,o.jsx)(`dd`,{className:`text-sm text-foreground`,children:ao(e.description)})]},n))})}t.ComponentRegistry.register(`definition-list`,oo,{namespace:`element`,skipFallback:!0,label:`Definition List`,category:`content`,inputs:[{name:`items`,type:`array`,label:`Items`,required:!0,description:`Term/description pairs [{ term, description }]`},{name:`columns`,type:`enum`,label:`Columns`,enum:[`1`,`2`],defaultValue:`1`},{name:`inline`,type:`boolean`,label:`Inline`,description:`Term and description on one baseline-aligned row`}]});function so({schema:e}){let t=io(e),n=(0,i.useAdapter)(),[r,s]=a.useState([]),[c,l]=a.useState(!0),[u,d]=a.useState(null),f=a.useMemo(()=>t.filter?JSON.stringify(t.filter):``,[t.filter]),p=a.useMemo(()=>(t.fields??[]).map(e=>typeof e==`string`?{field:e}:e),[t.fields]);return a.useEffect(()=>{let e=!1;if(!n||!t.object||typeof n.find!=`function`){l(!1);return}return l(!0),d(null),(async()=>{try{let r={};t.filter&&(r.$filter=t.filter),t.sort&&(r.$orderby=t.sort),t.limit&&(r.$top=t.limit);let i=await n.find(t.object,r),a=i?.data??i?.records??(Array.isArray(i)?i:[]);e||s(a)}catch(t){e||d(t?.message??`Failed to load`)}finally{e||l(!1)}})(),()=>{e=!0}},[n,t.object,f,t.limit]),c?(0,o.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`Loading…`}):u?(0,o.jsx)(`p`,{className:`py-2 text-sm text-destructive`,children:u}):r.length===0?(0,o.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:t.emptyText??`No records`}):(0,o.jsx)(`ul`,{className:W(t.divided!==!1&&`divide-y divide-border`,e?.className,t.className),"data-testid":`repeater`,children:r.map((e,n)=>(0,o.jsxs)(`li`,{className:`flex items-baseline gap-3 py-2`,children:[t.titleField&&(0,o.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:ao(e[t.titleField])}),p.map(t=>(0,o.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:ao(e[t.field])},t.field))]},e?.id??n))})}t.ComponentRegistry.register(`repeater`,so,{namespace:`element`,skipFallback:!0,label:`Repeater`,category:`content`,inputs:[{name:`object`,type:`string`,label:`Object`,required:!0,description:`Object whose records the list repeats over`},{name:`titleField`,type:`string`,label:`Title Field`},{name:`fields`,type:`array`,label:`Fields`,description:`Columns per row — bare names or { field, label? }`},{name:`filter`,type:`array`,label:`Filter`},{name:`sort`,type:`array`,label:`Sort`},{name:`limit`,type:`number`,label:`Limit`},{name:`emptyText`,type:`string`,label:`Empty Text`},{name:`divided`,type:`boolean`,label:`Divided`,description:`Separator between rows`}]});function co(e){let t=e?.properties??{};return{...e?.props??{},...t}}function lo(e){if(e==null)return``;if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(typeof e==`object`){let t=e;return String(t.label??t.name??t.title??t.en??``)}return String(e)}function uo({schema:e}){let t=co(e),n=e?.dataSource??{},r=n.object??t.object,s=n.filter??t.filter,c=n.sort??t.sort,l=n.limit??t.limit??50,u=t.labelField??`name`,d=t.valueField??`id`,f=(0,i.useAdapter)(),p=(0,i.usePageVariableBinding)(e?.id),[m,h]=a.useState([]),[g,_]=a.useState(!0),[v,y]=a.useState(null),b=a.useMemo(()=>s?JSON.stringify(s):``,[s]);a.useEffect(()=>{let e=!1;if(!f||!r||typeof f.find!=`function`){_(!1);return}return _(!0),y(null),(async()=>{try{let t={};s&&(t.$filter=s),c&&(t.$orderby=c),l&&(t.$top=l);let n=await f.find(r,t),i=n?.data??n?.records??(Array.isArray(n)?n:[]);e||h(i)}catch(t){e||y(t?.message??`Failed to load`)}finally{e||_(!1)}})(),()=>{e=!0}},[f,r,b,l]);let x=p?.value,S=p?String(x??``):void 0,C=a.useCallback(e=>{p?.setValue(e)},[p]),w=lo(t.label),T=t.placeholder??`Select a record…`;return(0,o.jsxs)(`div`,{className:W(`space-y-1.5`,e?.className),"data-testid":`record-picker`,"data-picker-id":e?.id,children:[w&&(0,o.jsx)(`label`,{className:`text-sm font-medium text-foreground`,children:w}),(0,o.jsxs)(Nr,{value:S,onValueChange:C,disabled:g||!!v||!r,children:[(0,o.jsx)(Ir,{className:`w-full max-w-xs`,"data-testid":`record-picker-trigger`,children:(0,o.jsx)(Fr,{placeholder:g?`Loading…`:v?`Failed to load`:T})}),(0,o.jsx)(zr,{children:m.map((e,t)=>{let n=e?.[d],r=String(n??t);return(0,o.jsx)(Vr,{value:r,children:lo(e?.[u])||r},r)})})]}),!g&&!v&&m.length===0&&(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.emptyText??`No records`})]})}t.ComponentRegistry.register(`record_picker`,uo,{namespace:`element`,skipFallback:!0,label:`Record Picker`,category:`input`,inputs:[{name:`object`,type:`string`,label:`Object`},{name:`labelField`,type:`string`,label:`Label Field`},{name:`valueField`,type:`string`,label:`Value Field`},{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`label`,type:`string`,label:`Label`}]});function fo(e){let t=e?.properties??{};return{...e?.props??{},...t}}var po=[`text`,`email`,`number`,`tel`,`url`,`password`];function mo({schema:e}){let t=fo(e),n=po.includes(t.inputType)?t.inputType:`text`,{language:r}=(0,x.useObjectTranslation)(),s=(0,i.usePageVariableBinding)(e?.id),c=a.useRef(!1);a.useEffect(()=>{c.current||(c.current=!0,s&&t.defaultValue!==void 0&&(s.value==null||s.value===``)&&s.setValue(t.defaultValue))},[]);let l=s?.value,u=s?l==null?``:String(l):void 0,d=a.useCallback(e=>{if(!s)return;let t=e.target.value;s.setValue(n===`number`?t===``?``:Number(t):t)},[s,n]),f=(0,x.pickLocalized)(t.label,r),p=(0,x.pickLocalized)(t.placeholder,r),m=(0,x.pickLocalized)(t.description,r);return(0,o.jsxs)(`div`,{className:W(`grid w-full max-w-sm items-center gap-1.5`,e?.className),"data-testid":`text-input`,"data-input-id":e?.id,children:[f&&(0,o.jsx)(X,{htmlFor:e?.id,className:W(t.required&&`after:ml-0.5 after:text-destructive after:content-['*']`),children:f}),(0,o.jsx)(Z,{id:e?.id,type:n,placeholder:p||void 0,value:u,defaultValue:u===void 0?t.defaultValue:void 0,required:t.required,disabled:t.disabled,onChange:d}),m&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:m})]})}t.ComponentRegistry.register(`text_input`,mo,{namespace:`element`,skipFallback:!0,label:`Text Input`,category:`input`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`inputType`,type:`enum`,label:`Type`,enum:[`text`,`email`,`number`,`tel`,`url`,`password`],defaultValue:`text`},{name:`required`,type:`boolean`,label:`Required`},{name:`disabled`,type:`boolean`,label:`Disabled`},{name:`description`,type:`string`,label:`Description`}]});function ho(e){return e==null?void 0:String(e)}function go(e,t){let n=e?.find(e=>String(e.value)===t);return n?n.value:t}var _o=({className:e,...t})=>(0,o.jsx)(ae.Group,{className:W(`flex h-full w-full`,e),...t}),vo=ae.Panel,yo=({withHandle:e,className:t,...n})=>(0,o.jsx)(ae.Separator,{className:W(`relative flex w-px items-center justify-center bg-border`,`after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1`,`aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full`,`aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full`,`aria-[orientation=horizontal]:after:-translate-y-1/2 aria-[orientation=horizontal]:after:translate-x-0`,`[&[aria-orientation=horizontal]>div]:rotate-90`,t),...n,children:e&&(0,o.jsx)(`div`,{className:`z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border`,children:(0,o.jsx)(c.GripVertical,{className:`h-2.5 w-2.5`})})});function bo({label:e,description:t,collapsible:n,collapsed:r,onToggle:i,className:a}){return!e&&!t?null:(0,o.jsxs)(`div`,{className:W(`col-span-full pt-4 pb-1 border-b border-border`,n&&`cursor-pointer select-none`,a),onClick:n?i:void 0,role:n?`button`:void 0,"aria-expanded":n?!r:void 0,children:[e&&(0,o.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[n&&(r?(0,o.jsx)(c.ChevronRight,{className:`h-3.5 w-3.5 text-muted-foreground`}):(0,o.jsx)(c.ChevronDown,{className:`h-3.5 w-3.5 text-muted-foreground`})),(0,o.jsx)(`span`,{className:`text-sm font-semibold text-foreground`,children:e})]}),t&&(0,o.jsx)(`p`,{className:`mt-0.5 text-sm text-muted-foreground`,children:t})]})}function xo(e){let t=new Map;for(let n of e)n?.name&&!t.has(n.name)&&t.set(n.name,n);return t}function So(e,t){let n=new Set;for(let t of e)for(let e of t.fields)n.add(e.name);return t.filter(e=>e?.name&&!n.has(e.name))}var Co=e=>typeof e==`number`&&Number.isFinite(e)?String(e):void 0,wo=(0,x.createSafeTranslation)({"common.selectOption":`Select an option`,"common.submit":`Submit`,"common.cancel":`Cancel`,"form.fullscreen.title":`Edit text`,"form.fullscreen.description":`Edit the full text value, then save or cancel your changes.`,"form.fullscreen.done":`Done`,"form.fullscreen.toggle":`Edit {{label}} fullscreen`,"form.fullscreen.textFallback":`text`,"fields.options.selectFirst":`Select {{fields}} first`,"fields.options.empty":`No options available`,"validation.required":`{{field}} is required`,"validation.minLength":`{{field}} must be at least {{min}} characters`,"validation.maxLength":`{{field}} must be at most {{max}} characters`,"validation.min":`{{field}} must be at least {{min}}`,"validation.max":`{{field}} must be at most {{max}}`,"validation.pattern":`{{field}} format is invalid`,"validation.email":`Please enter a valid email address`,"validation.url":`Please enter a valid URL`,"validation.formInvalid":`Please check the highlighted fields: {{fields}}`,"validation.formInvalidJoiner":`, `,"errors.forbidden":`Access denied.`,"form.noPermissionToSave":`You don't have permission to save this record.`,"form.submitFailed":`Could not save. Please try again.`},`common.selectOption`),To=e=>e==null||e===``||Array.isArray(e)&&e.length===0,Eo=(e,t)=>{if(To(e)&&To(t))return!0;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},Do=(e,t)=>Object.prototype.hasOwnProperty.call(e??{},t),Oo=(e,t)=>{let n=new Set([...Object.keys(e??{}),...Object.keys(t??{})]);for(let r of n)if(!Eo(e?.[r],t?.[r]))return!0;return!1},ko=new Set([`checkbox`,`switch`,`boolean`,`toggle`,`field:boolean`,`field:switch`,`field:checkbox`]),Ao=e=>e?.widget||e?.field?.widget||e?.type,jo=new Set([`input`,`textarea`,`checkbox`,`switch`,`select`]),Mo=new Set([`lookup`,`master_detail`,`tree`,`capability-multiselect`,`object-ref`,`filter-condition`,`recipient-picker`]),No=new Set([`select`,`radio`,`multiselect`,`checkboxes`]);function Po(e){let{dataSource:t,inputType:n,options:r,field:i,schema:a,showActions:o,fieldContainerClass:s,mobileStickyActions:c,mobile_fullscreen:l,dependentValues:u,dependsOn:d,dependsOnLabels:f,emptyHint:p,label:m,error:h,...g}=e;return g}function Fo(e){if(e==null)return`null`;let t=typeof e;return t===`string`?JSON.stringify(e):t===`number`||t===`boolean`?String(e):Array.isArray(e)?`[${e.map(Fo).join(`, `)}]`:JSON.stringify(String(e))}function Io(e){if(!e||!e.field)return null;let t=`record[${JSON.stringify(e.field)}]`,n=[];return e.equals!==void 0&&n.push(`${t} == ${Fo(e.equals)}`),e.notEquals!==void 0&&n.push(`${t} != ${Fo(e.notEquals)}`),Array.isArray(e.in)&&n.push(`${t} in ${Fo(e.in)}`),n.length>0?n.join(` && `):null}function Lo(e){return e.startsWith(`field:`)?e.slice(6):e}function Ro(e,t){let{dataSource:n,inputType:r,showActions:i,fieldContainerClass:a,mobileStickyActions:o,mobile_fullscreen:s,dependentValues:c,dependsOnLabels:l,emptyHint:u,label:d,schema:f,...p}=t,m=Lo(e);return{...p,...Mo.has(m)?{dataSource:n,dependentValues:c,dependsOnLabels:l}:{},...No.has(m)?{dependentValues:c,emptyHint:u}:{}}}function zo({value:e,onChange:t,placeholder:n,className:r,label:i,readOnly:s,disabled:l,...u}){let{t:d}=wo(),[f,p]=a.default.useState(!1),[m,h]=a.default.useState(e??``),g=s===!0||l===!0,_=e=>{g||t?.(e)},v=()=>{g||(h(e??``),p(!0))},y=()=>{_(m),p(!1)};return(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(ea,{placeholder:n,className:W(!s&&`pr-10`,r),value:e??``,onChange:e=>_(e.target.value),...u,readOnly:s,disabled:l}),!s&&(0,o.jsx)(`button`,{type:`button`,onClick:v,disabled:l,className:`absolute top-1.5 right-1.5 inline-flex items-center justify-center size-7 rounded-md bg-background/80 text-muted-foreground hover:text-foreground hover:bg-background border shadow-sm disabled:opacity-50 disabled:pointer-events-none`,"aria-label":d(`form.fullscreen.toggle`,{label:i??d(`form.fullscreen.textFallback`)}),"data-testid":`form-textarea-fullscreen-toggle`,children:(0,o.jsx)(c.Maximize2,{className:`size-3.5`})}),(0,o.jsx)(Ct,{open:f,onOpenChange:p,children:(0,o.jsxs)(Ot,{className:`sm:max-w-3xl h-[100dvh] sm:h-[80vh] max-h-[100dvh] sm:max-h-[80vh] flex flex-col p-0 gap-0`,"data-testid":`form-textarea-fullscreen-dialog`,children:[(0,o.jsxs)(kt,{className:`p-4 border-b`,children:[(0,o.jsx)(jt,{className:`text-base`,children:i??d(`form.fullscreen.title`)}),(0,o.jsx)(Mt,{className:`sr-only`,children:d(`form.fullscreen.description`)})]}),(0,o.jsx)(`div`,{className:`flex-1 min-h-0 p-4`,children:(0,o.jsx)(ea,{autoFocus:!0,value:m,onChange:e=>h(e.target.value),placeholder:n,className:`h-full min-h-full resize-none text-base`,readOnly:s,disabled:l,"data-testid":`form-textarea-fullscreen-input`})}),(0,o.jsxs)(At,{className:`p-3 border-t flex-row justify-end gap-2`,children:[(0,o.jsxs)(K,{type:`button`,variant:`ghost`,onClick:()=>p(!1),children:[(0,o.jsx)(c.X,{className:`size-4 mr-1`}),` `,d(`common.cancel`)]}),(0,o.jsxs)(K,{type:`button`,onClick:y,disabled:g,"data-testid":`form-textarea-fullscreen-save`,children:[(0,o.jsx)(c.Check,{className:`size-4 mr-1`}),` `,d(`form.fullscreen.done`)]})]})]})})]})}t.ComponentRegistry.register(`form`,({schema:e,className:n,onAction:r,...s})=>{let{t:l}=wo(),{defaultValues:u={},previousValues:d,fields:f=[],submitLabel:p,cancelLabel:m,showCancel:h=!1,showSubmit:g=!0,layout:_=`vertical`,columns:v=1,onSubmit:y,onChange:b,onDirtyChange:x,onCancel:S,resetOnSubmit:C=!1,validationMode:w=`onSubmit`,disabled:E=!1}=e,D=a.default.useMemo(()=>f.filter(e=>e&&typeof e.field==`string`&&typeof e.name!=`string`),[f]),O=a.default.useMemo(()=>D.length===0?f:f.filter(e=>!D.includes(e)),[f,D]);a.default.useEffect(()=>{for(let e of D)console.error(`[object-ui] form field { field: '${e.field}' } was NOT rendered: \`field\` is the spec form-view vocabulary (a reference to an object field), and a standalone form has no object schema to resolve it against. Rename the key to \`name\` (the form data path) — or use an object-bound form (objectName + sections), whose section fields accept the spec shape.`);for(let e of f)e&&typeof e.field==`string`&&typeof e.name==`string`&&console.warn(`[object-ui] form field '${e.name}' mixes vocabularies: it also carries { field: '${e.field}' } (spec form-view key), which this standalone renderer ignores. Drop one of the two.`)},[f,D]);let k=a.default.useMemo(()=>{let e={...u},t=!1;for(let n of O)typeof n?.name==`string`&&(Do(e,n.name)||ko.has(Ao(n))&&(e[n.name]=!1,t=!0));return t?e:u},[u,O]),A=(0,T.useForm)({defaultValues:k,mode:w,shouldFocusError:!1}),j=a.default.useRef(null),[M,N]=a.default.useState(!1),[P,F]=a.default.useState(null),[ee,te]=a.default.useState(void 0),[I,ne]=a.default.useState([]),re=A.watch(),R=a.default.useMemo(()=>{if(!d||typeof d!=`object`)return;let e={};for(let t of O)t?.name&&(e[t.name]=null);for(let t of Object.keys(d))d[t]!==void 0&&(e[t]=d[t]);return e},[O,d]),z=a.default.useMemo(()=>{let e={};for(let t of O)t?.name&&(e[t.name]=null);if(R)for(let t of Object.keys(R))e[t]=R[t];for(let t of Object.keys(re))re[t]!==void 0&&(e[t]=re[t]);return e},[O,R,JSON.stringify(re)]),B=a.default.useMemo(()=>{let e=new Set;if(!R)return e;for(let n of O){let r=n?.name;r&&(0,t.resolveFieldRuleState)({visibleWhen:n.visibleWhen,readonlyWhen:n.readonlyWhen,requiredWhen:n.requiredWhen},z,{required:!!n.required,readonly:n.readonly===!0},R,void 0,`field '${r}'`).readonly&&e.add(r)}return e},[O,z,R]);a.default.useEffect(()=>{let e=A.formState.errors;if(!(!e||Object.keys(e).length===0))for(let n of O){let r=n?.name;if(!r||!e[r])continue;let i=(0,t.resolveFieldRuleState)({visibleWhen:n.visibleWhen,readonlyWhen:n.readonlyWhen,requiredWhen:n.requiredWhen},z,{required:!!n.required,readonly:n.readonly===!0},R,void 0,`field '${r}'`),a=n.visibleOn==null||(0,t.evalFieldPredicate)(n.visibleOn,z,!0,R,void 0,{context:`visibleOn of field '${r}'`}),o=e[r]?.type;(!i.visible||!a||!i.required&&o===`required`)&&A.clearErrors(r)}},[z]);let ie=a.default.useContext(i.SchemaRendererContext)?.dataSource??null,ae=(0,i.usePredicateScope)(),oe=a.default.useMemo(()=>{let e={};for(let t of O)t?.name&&(e[t.name]=t.label||t.name);return e},[O]),V=a.default.useMemo(()=>{let t=e.fieldTabs;if(e.children||!Array.isArray(t))return null;let n=t.filter(e=>e&&typeof e.key==`string`);return n.length>1?n:null},[e.fieldTabs,e.children]),H=a.default.useMemo(()=>{let e=new Map;for(let t of V??[])for(let n of t.fields??[])e.has(n)||e.set(n,t.key);return e},[V]),se=a.default.useMemo(()=>{if(!V?.length)return;let t=V.map(e=>e.key);return ee&&t.includes(ee)?ee:e.defaultFieldTab&&t.includes(e.defaultFieldTab)?e.defaultFieldTab:t[0]},[V,ee,e.defaultFieldTab]),ce=a.default.useMemo(()=>{if(!V)return null;let e=xo(O);return V.map(t=>({key:t.key,label:t.label||t.key,description:t.description,containerClass:t.containerClass,fields:(t.fields??[]).map(t=>e.get(t)).filter(e=>!!e)}))},[V,O]),le=a.default.useMemo(()=>ce?So(ce,O):[],[ce,O]),ue=a.default.useMemo(()=>{let t=e.fieldPanes;if(e.children||V||!Array.isArray(t))return null;let n=t.filter(e=>e&&typeof e.key==`string`);return n.length>1?n:null},[e.fieldPanes,e.children,V]),de=a.default.useMemo(()=>{if(!ue)return null;let e=xo(O);return ue.map(t=>({key:t.key,defaultSize:Co(t.defaultSize),minSize:Co(t.minSize)??`20`,containerClass:t.containerClass,fields:(t.fields??[]).map(t=>e.get(t)).filter(e=>!!e)}))},[ue,O]),fe=a.default.useMemo(()=>de?So(de,O):[],[de,O]),pe=a.default.useMemo(()=>{let e=new Set;if(!V)return e;for(let t of I){let n=H.get(t);n&&e.add(n)}return e},[V,H,I]);a.default.useEffect(()=>{for(let e of O){let n=e?.name;if(!n)continue;let r=e.widget||e.type;if(r!==`select`&&r!==`radio`&&r!==`multiselect`&&r!==`checkboxes`)continue;let i=e.options;if(!i||i.length===0)continue;let a=e.dependsOn;if(!i.some(e=>e?.visibleWhen!=null)&&!a)continue;let o=A.getValues(n);if(o==null||o===``)continue;let{options:s}=(0,t.resolveCascadingOptions)(i,z,a,ae);(0,t.isValueStillOffered)(o,s)||A.setValue(n,Array.isArray(o)?[]:void 0,{shouldValidate:!1,shouldDirty:!0})}},[z,ae]);let U=a.default.useRef(void 0),me=a.default.useRef(k??{});a.default.useLayoutEffect(()=>{let e;try{e=JSON.stringify(k??{})}catch{e=String(Date.now())}if(U.current===e)return;U.current=e;let t=k??{},n=me.current,r=Object.entries(A.getValues()).filter(([e,r])=>!Do(t,e)&&!Do(n,e)&&!Eo(n[e],r));me.current=t,A.reset(k);for(let[e,t]of r)A.setValue(e,t,{shouldValidate:!1,shouldDirty:!0});ne([]),x?.(r.length>0)},[k]),a.default.useLayoutEffect(()=>{if(r){let e=A.watch(e=>{r({type:`form_change`,data:e,formData:e})});return()=>e.unsubscribe()}},[A,r]),a.default.useLayoutEffect(()=>{let e=A.watch(e=>{x?.(Oo(me.current,e))});return()=>e.unsubscribe()},[A,x]);let he=e=>{let t=j.current??document,n=typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`),r=t.querySelector(`[data-field="${n}"]`);r&&(r.scrollIntoView?.({behavior:`smooth`,block:`center`}),r.querySelector(`input:not([type="hidden"]), select, textarea, button, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]`)?.focus?.({preventScroll:!0}))},ge=e=>{if(e.length===0)return;ne(e);let t=e.map(e=>oe[e]||e),n=t.slice(0,3).join(l(`validation.formInvalidJoiner`))+(t.length>3?`…`:``);L.toast.error(l(`validation.formInvalid`,{fields:n}));let r=new Set(e),i=O.map(e=>e?.name).find(e=>!!e&&r.has(e))??e[0],a=H.get(i);if(a&&a!==se){te(a),typeof requestAnimationFrame==`function`?requestAnimationFrame(()=>he(i)):setTimeout(()=>he(i),0);return}he(i)},_e=A.handleSubmit(async e=>{N(!0),F(null),ne([]);let t=e;if(e&&(e.nativeEvent||typeof e.preventDefault==`function`||typeof e.stopPropagation==`function`||e.target||e.bubbles))t=A.getValues();else if(!t||Object.keys(t).length===0){let e=A.getValues();e&&Object.keys(e).length>0&&(t=e)}if(B.size>0&&t&&typeof t==`object`){let e={};for(let n of Object.keys(t))B.has(n)||(e[n]=t[n]);t=e}try{if(r){let e=await r({type:`form_submit`,data:t,formData:t});if(e?.error){F(e.error),L.toast.error(e.error);return}}y&&typeof y==`function`&&await y(t),C&&A.reset()}catch(e){let t=(0,i.extractFieldErrors)(e);if(t){let n=t.filter(e=>O.some(t=>t?.name===e.field));for(let t of n)A.setError(t.field,{type:`server`,message:t.message||(0,i.extractWriteErrorMessage)(e)||l(`form.submitFailed`)});if(n.length>0&&n.length===t.length){ge(n.map(e=>e.field));return}}let n=(0,i.isPermissionError)(e)?l(`form.noPermissionToSave`):(0,i.extractWriteErrorMessage)(e)??l(`form.submitFailed`);(0,i.isPermissionError)(e)&&typeof console<`u`&&console.warn(`[form] write denied:`,e),F(n),L.toast.error(n),typeof process<`u`&&process.env.NODE_ENV===`development`&&console.error(`Form submission error:`,e)}finally{N(!1)}},e=>{ge(Object.keys(e||{}))}),ve=()=>{A.reset(),S&&typeof S==`function`&&S(),r&&r({type:`form_cancel`,data:A.getValues()})},ye=v>1?W(`grid gap-4`,v===1?``:v===2?`md:grid-cols-2`:v===3?`md:grid-cols-2 lg:grid-cols-3`:`md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`):`space-y-4`,be=e.fieldContainerClass||ye,q=e.fieldTabsPosition||`top`,xe=q===`left`||q===`right`,J=n=>{let{name:r,label:i,description:a,type:s=`input`,required:c=!1,disabled:u=!1,validation:d={},condition:f,colSpan:p,hidden:m,widget:h,visibleOn:g,readonly:_,visibleWhen:v,readonlyWhen:y,requiredWhen:b,...x}=n;if(m)return null;let S=Io(f);if(S&&!(0,t.evalFieldPredicate)(S,z,!0,void 0,void 0,{context:`condition of field '${r}'`}))return null;let C=(0,t.resolveFieldRuleState)({visibleWhen:v,readonlyWhen:y,requiredWhen:b},z,{required:c,readonly:_===!0},R,void 0,`field '${r}'`);if(!C.visible||g!=null&&!(0,t.evalFieldPredicate)(g,z,!0,R,void 0,{context:`visibleOn of field '${r}'`}))return null;let w=C.required,T=C.readonly;if(s===`section-divider`){let e=x;return(0,o.jsx)(bo,{label:i,description:a,collapsible:e.collapsible,collapsed:e.collapsed,onToggle:e.onToggle,className:e.className},r)}let D={...d};if(delete D.required,w){let e=typeof d.required==`string`?d.required:l(`validation.required`,{field:i||r}),n=D.validate;D.validate={...typeof n==`function`?{validate:n}:n??{},required:n=>!(0,t.isMissingForRequired)(n)||e}}let O=(e,t)=>e&&typeof e==`object`&&e.message==null&&typeof e.messageKey==`string`?{...e,message:l(e.messageKey,{field:i||r,...t?.(e)})}:e;D.minLength&&=O(D.minLength,e=>({min:e.value})),D.maxLength&&=O(D.maxLength,e=>({max:e.value})),D.min&&=O(D.min,e=>({min:e.value})),D.max&&=O(D.max,e=>({max:e.value})),D.pattern&&=O(D.pattern);let k=n.id??r,j=h||x.field?.widget||s,N=No.has(Lo(j)),P=x.options,F=N?(0,t.resolveCascadingOptions)(P,z,n.dependsOn,ae):null,ee=F?.gated??!1,te=F?.dependsOnFields??[],I=F?F.options:P,ne=ee?l(`fields.options.selectFirst`,{fields:te.map(e=>oe[e]||e).join(` / `)}):void 0,L=e.fieldContainerClass||ye,re=e=>{let t=Array.from(L.matchAll(/(@)?(sm|md|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl):grid-cols-(\d+)/g)).map(e=>({at:e[1]||``,bp:e[2],cols:Number(e[3])}));if(!t.length)return e===2?`col-span-2`:e===3?`col-span-3`:`col-span-4`;let n=t.find(t=>t.cols>=e)||t[t.length-1];return{"@sm:2":`@sm:col-span-2`,"@md:2":`@md:col-span-2`,"@lg:2":`@lg:col-span-2`,"@xl:2":`@xl:col-span-2`,"@2xl:2":`@2xl:col-span-2`,"@sm:3":`@sm:col-span-3`,"@md:3":`@md:col-span-3`,"@lg:3":`@lg:col-span-3`,"@xl:3":`@xl:col-span-3`,"@2xl:3":`@2xl:col-span-3`,"@4xl:3":`@4xl:col-span-3`,"@sm:4":`@sm:col-span-4`,"@md:4":`@md:col-span-4`,"@lg:4":`@lg:col-span-4`,"@xl:4":`@xl:col-span-4`,"@2xl:4":`@2xl:col-span-4`,"@4xl:4":`@4xl:col-span-4`,"sm:2":`sm:col-span-2`,"md:2":`md:col-span-2`,"lg:2":`lg:col-span-2`,"xl:2":`xl:col-span-2`,"sm:3":`sm:col-span-3`,"md:3":`md:col-span-3`,"lg:3":`lg:col-span-3`,"xl:3":`xl:col-span-3`,"sm:4":`sm:col-span-4`,"md:4":`md:col-span-4`,"lg:4":`lg:col-span-4`,"xl:4":`xl:col-span-4`}[`${n.at}${n.bp}:${e}`]||(e===2?`col-span-2`:e===3?`col-span-3`:`col-span-4`)},B=p&&p>1?p===2?re(2):p===3?re(3):p>=4?re(4):``:``,V=`field:${e.objectName?`${e.objectName}.`:``}${r}`;return(0,o.jsx)(Mn,{control:A.control,name:r,rules:D,render:({field:e,fieldState:t})=>(0,o.jsxs)(Fn,{className:B||void 0,"data-testid":V,"data-field":r,children:[i&&(0,o.jsxs)(In,{className:`text-xs font-normal text-muted-foreground`,children:[i,w&&(0,o.jsx)(`span`,{className:`text-destructive ml-1`,"data-required-marker":`true`,"aria-hidden":`true`,children:`*`})]}),(0,o.jsx)(Ln,{children:Uo(j,{...x,field:n.field||n,...e,inputType:x.inputType,label:i,options:N?I:x.options,placeholder:x.placeholder??(j===`select`?l(`common.selectOption`):void 0),disabled:E||u||M||ee,readonly:T,emptyHint:ne,dataSource:ie,dependentValues:z,dependsOnLabels:oe,error:t.error?.message,"aria-required":w||void 0})}),a&&(0,o.jsx)(Rn,{children:a}),(0,o.jsx)(zn,{})]})},k)},{"data-obj-id":Se,"data-obj-type":Ce,style:we,onSubmit:Te,onChange:Ee,submitLabel:De,cancelLabel:Oe,showSubmit:ke,showCancel:Ae,resetOnSubmit:Me,defaultValues:Ne,inputType:Pe,dataSource:Fe,showActions:Ie,fieldContainerClass:Le,mobileStickyActions:Re,objectName:ze,onDirtyChange:Be,onCancel:Ve,fields:He,layout:Ue,columns:We,validationMode:Ge,disabled:Ke,fieldTabs:qe,defaultFieldTab:Je,fieldTabsPosition:Ye,fieldPanes:Xe,fieldPanesOrientation:Ze,fieldPanesResizable:Qe,...$e}=s;return(0,o.jsx)(An,{...A,children:(0,o.jsxs)(`form`,{ref:j,onSubmit:_e,className:n,...$e,"data-obj-id":Se,"data-obj-type":Ce,style:we,children:[P&&(0,o.jsxs)(je,{variant:`destructive`,className:`mb-4`,children:[(0,o.jsx)(c.AlertCircle,{className:`h-4 w-4`}),(0,o.jsx)(Y,{children:P})]}),D.length>0&&(0,o.jsxs)(je,{variant:`destructive`,className:`mb-4`,"data-testid":`form-spec-vocabulary-error`,children:[(0,o.jsx)(c.AlertCircle,{className:`h-4 w-4`}),(0,o.jsx)(Y,{children:`Not rendered — spec form-view vocabulary ({ field: … }) in a standalone form: `+D.map(e=>e.field).join(`, `)+`. Use { name: … }, or an object-bound form with sections.`})]}),e.children?(0,o.jsx)(`div`,{className:e.fieldContainerClass||`space-y-4`,children:G(e.children)}):ce?(0,o.jsxs)(o.Fragment,{children:[le.length>0&&(0,o.jsx)(`div`,{className:W(be,`mb-4`),children:le.map(J)}),(0,o.jsxs)(Xi,{value:se,onValueChange:te,orientation:xe?`vertical`:`horizontal`,className:W(`flex w-full`,xe?`gap-4`:`flex-col`),children:[(0,o.jsx)(Zi,{className:W(`self-start`,xe?W(`h-auto flex-col`,q===`right`&&`order-last`):q===`bottom`?`order-last mt-4`:`mb-4`),children:ce.map(e=>(0,o.jsxs)(Qi,{value:e.key,"data-testid":`form-tab:${e.key}`,"data-error":pe.has(e.key)||void 0,className:W(xe&&`w-full justify-start`,pe.has(e.key)&&`text-destructive data-[state=active]:text-destructive`),children:[e.label,pe.has(e.key)&&(0,o.jsx)(`span`,{"aria-hidden":`true`,className:`ml-1.5 size-1.5 rounded-full bg-destructive`})]},e.key))}),(0,o.jsx)(`div`,{className:`min-w-0 flex-1`,children:ce.map(e=>(0,o.jsxs)($i,{value:e.key,forceMount:!0,className:`mt-0 data-[state=inactive]:hidden`,"data-testid":`form-tab-panel:${e.key}`,children:[e.description&&(0,o.jsx)(`p`,{className:`mb-3 text-sm text-muted-foreground`,children:e.description}),(0,o.jsx)(`div`,{className:e.containerClass||be,children:e.fields.map(J)})]},e.key))})]})]}):de?(0,o.jsxs)(o.Fragment,{children:[fe.length>0&&(0,o.jsx)(`div`,{className:W(be,`mb-4`),children:fe.map(J)}),(0,o.jsx)(_o,{orientation:e.fieldPanesOrientation===`vertical`?`vertical`:`horizontal`,className:`min-h-[300px] rounded-lg border`,children:de.map((t,n)=>(0,o.jsxs)(a.default.Fragment,{children:[n>0&&(0,o.jsx)(yo,{withHandle:e.fieldPanesResizable!==!1,disabled:e.fieldPanesResizable===!1}),(0,o.jsx)(vo,{defaultSize:t.defaultSize,minSize:t.minSize,children:(0,o.jsx)(`div`,{className:W(`@container p-4`,t.containerClass||be),"data-testid":`form-pane:${t.key}`,children:t.fields.map(J)})})]},t.key))})]}):(0,o.jsx)(`div`,{className:be,children:O.map(J)}),e.showActions!==!1&&(0,o.jsxs)(`div`,{className:W(`flex flex-col sm:flex-row gap-2 ${_===`horizontal`?`sm:justify-end`:`sm:justify-start`} mt-6`,e.mobileStickyActions&&`sticky bottom-0 z-10 -mx-4 px-4 py-3 bg-background/95 supports-[backdrop-filter]:bg-background/80 backdrop-blur border-t md:static md:mx-0 md:px-0 md:py-0 md:bg-transparent md:border-0 md:backdrop-blur-none`),"data-testid":e.mobileStickyActions?`form-mobile-sticky-actions`:void 0,children:[h&&(0,o.jsx)(K,{type:`button`,variant:`outline`,onClick:ve,disabled:M||E,className:`w-full sm:w-auto`,children:m??l(`common.cancel`)}),g&&(0,o.jsxs)(K,{type:`submit`,disabled:M||E,className:`w-full sm:w-auto`,children:[M&&(0,o.jsx)(c.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),p??l(`common.submit`)]})]})]})})},{namespace:`ui`,label:`Form`,inputs:[{name:`fields`,type:`array`,label:`Fields`,description:`Array of field configurations with name, label, type, validation, etc.`},{name:`defaultValues`,type:`object`,label:`Default Values`,description:`Object with default values for form fields`},{name:`submitLabel`,type:`string`,label:`Submit Button Label`,defaultValue:`Submit`},{name:`cancelLabel`,type:`string`,label:`Cancel Button Label`,defaultValue:`Cancel`},{name:`showCancel`,type:`boolean`,label:`Show Cancel Button`,defaultValue:!1},{name:`layout`,type:`enum`,enum:[`vertical`,`horizontal`],label:`Layout`,defaultValue:`vertical`},{name:`columns`,type:`number`,label:`Number of Columns`,defaultValue:1,description:`For multi-column layouts (1-4)`},{name:`validationMode`,type:`enum`,enum:[`onSubmit`,`onBlur`,`onChange`,`onTouched`,`all`],label:`Validation Mode`,defaultValue:`onSubmit`},{name:`resetOnSubmit`,type:`boolean`,label:`Reset After Submit`,defaultValue:!1},{name:`disabled`,type:`boolean`,label:`Disabled`,defaultValue:!1},{name:`className`,type:`string`,label:`CSS Class`},{name:`fieldContainerClass`,type:`string`,label:`Field Container CSS Class`}],defaultProps:{submitLabel:`Submit`,cancelLabel:`Cancel`,showCancel:!1,layout:`vertical`,columns:1,validationMode:`onSubmit`,resetOnSubmit:!1,disabled:!1,fields:[{name:`name`,label:`Name`,type:`input`,required:!0,placeholder:`Enter your name`},{name:`email`,label:`Email`,type:`input`,inputType:`email`,required:!0,placeholder:`Enter your email`}]}});var Bo=new Set([`date`,`datetime-local`,`time`,`month`,`week`]);function Vo(e){if(!(!e||!Bo.has(e)))return e=>{let t=e.currentTarget;if(!(t.disabled||t.readOnly))try{t.showPicker?.()}catch{}}}function Ho({emptyHint:e,className:t,...n}){let{t:r}=wo();return(0,o.jsx)(`div`,{className:W(`text-sm text-muted-foreground`,t),...n,children:e||r(`fields.options.empty`)})}function Uo(e,n){let r=!jo.has(e)&&!e.includes(`:`)?t.ComponentRegistry.get(`field:${e}`):void 0,i=jo.has(e)?void 0:r||t.ComponentRegistry.get(e),a=!!r||e.startsWith(`field:`);if(i){let t=Ro(e,n);if(a)return(0,o.jsx)(i,{...t});let r=n.field||n.schema||n;return(0,o.jsx)(i,{schema:r,...t})}let{inputType:s,options:c=[],placeholder:l,readonly:u,emptyHint:d,...f}=n,p=Po(f),m=u&&`bg-muted/40 cursor-default focus-visible:ring-0`;switch(e){case`input`:if(s===`file`){let{value:e,...t}=p;return(0,o.jsx)(Z,{type:`file`,placeholder:l,className:`min-h-[44px] sm:min-h-0`,...t})}return(0,o.jsx)(Z,{type:s||`text`,placeholder:l,className:W(`min-h-[44px] sm:min-h-0`,m),...p,onClick:e=>{Vo(s)?.(e),p.onClick?.(e)},readOnly:u,value:p.value??``});case`textarea`:{let{mobile_fullscreen:e,label:t}=f,n=Po(f);return e?(0,o.jsx)(zo,{placeholder:l,label:t,className:W(`min-h-[44px] sm:min-h-0`,m),...n,readOnly:u,value:n.value??``}):(0,o.jsx)(ea,{placeholder:l,className:W(`min-h-[44px] sm:min-h-0`,m),...n,readOnly:u,value:n.value??``})}case`checkbox`:{let{value:e,onChange:t,disabled:n,...r}=p;return(0,o.jsx)(_t,{checked:e,onCheckedChange:t,disabled:n||u,className:`min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0`,...r})}case`switch`:{let{value:e,onChange:t,disabled:n,...r}=p;return(0,o.jsx)(Vi,{checked:e,onCheckedChange:t,disabled:n||u,className:`min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0`,...r})}case`select`:{let{value:e,onChange:t,disabled:n,...r}=p;return!c||c.length===0?(0,o.jsx)(Ho,{emptyHint:d}):(0,o.jsxs)(Nr,{value:ho(e),onValueChange:e=>t?.(go(c,e)),disabled:n||u,...r,children:[(0,o.jsx)(Ir,{className:`min-h-[44px] sm:min-h-0`,children:(0,o.jsx)(Fr,{placeholder:l})}),(0,o.jsx)(zr,{children:c.map(e=>(0,o.jsx)(Vr,{value:String(e.value),children:e.label},String(e.value)))})]})}default:return(0,o.jsx)(Z,{type:s||`text`,placeholder:l,className:W(m),...p,onClick:e=>{Vo(s)?.(e),p.onClick?.(e)},readOnly:u})}}function Wo(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}var Go={Home:`House`},Ko=(0,a.forwardRef)(({schema:e,...t},n)=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=t,l=null;if(e.icon){let t=Wo(e.icon),n=Go[t]||t;l=c.icons[n]}let u=e.loading||t.loading,d=e.disabled||t.disabled||u;return(0,o.jsxs)(K,{ref:n,type:e.buttonType||`button`,variant:e.variant,size:e.size,className:e.className,disabled:d,...s,"data-obj-id":r,"data-obj-type":i,style:a,children:[u&&(0,o.jsx)(c.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),!u&&l&&e.iconPosition!==`right`&&(0,o.jsx)(l,{className:`mr-2 h-4 w-4`}),e.label||G(e.body||e.children),!u&&l&&e.iconPosition===`right`&&(0,o.jsx)(l,{className:`ml-2 h-4 w-4`})]})});Ko.displayName=`ButtonRenderer`,t.ComponentRegistry.register(`button`,Ko,{namespace:`ui`,label:`Button`,inputs:[{name:`label`,type:`string`,label:`Label`,defaultValue:`Button`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`default`,`secondary`,`destructive`,`outline`,`ghost`,`link`],defaultValue:`default`},{name:`size`,type:`enum`,label:`Size`,enum:[`default`,`sm`,`lg`,`icon`],defaultValue:`default`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{label:`Button`,variant:`default`,size:`default`}}),t.ComponentRegistry.register(`label`,({schema:e,className:t,...n})=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=n;return(0,o.jsx)(X,{className:t,...s,"data-obj-id":r,"data-obj-type":i,style:a,children:e.text||e.label||e.content})},{namespace:`ui`,label:`Label`,inputs:[{name:`text`,type:`string`,label:`Text`,required:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{text:`Label Text`}});var qo=({schema:e,className:t,onChange:n,value:r,...i})=>{let a=e=>{n&&n(e.target.value)},{"data-obj-id":s,"data-obj-type":c,style:l,...u}=i;return(0,o.jsxs)(`div`,{className:W(`grid w-full items-center gap-1.5`,e.wrapperClass),"data-obj-id":s,"data-obj-type":c,style:l,children:[e.label&&(0,o.jsx)(X,{htmlFor:e.id,className:W(e.required&&`text-destructive after:content-['*'] after:ml-0.5`),children:e.label}),(0,o.jsx)(Z,{type:e.inputType||`text`,id:e.id,name:e.name,placeholder:e.placeholder,className:t,required:e.required,disabled:e.disabled,readOnly:e.readOnly,value:r??e.value??``,defaultValue:r===void 0?e.defaultValue:void 0,onChange:a,min:e.min,max:e.max,step:e.step,maxLength:e.maxLength,pattern:e.pattern,...u}),e.description&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description}),e.error&&(0,o.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:e.error})]})};t.ComponentRegistry.register(`input`,qo,{namespace:`ui`,label:`Input Field`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`name`,type:`string`,label:`Field Name`},{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`inputType`,type:`enum`,label:`Type`,enum:[`text`,`email`,`password`,`number`,`tel`,`url`,`date`,`time`,`datetime-local`],defaultValue:`text`},{name:`required`,type:`boolean`,label:`Required`},{name:`disabled`,type:`boolean`,label:`Disabled`},{name:`description`,type:`string`,label:`Description`}],defaultProps:{inputType:`text`}}),t.ComponentRegistry.register(`email`,e=>(0,o.jsx)(qo,{...e,schema:{...e.schema,inputType:`email`}}),{namespace:`ui`,label:`Email Input`,icon:`mail`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`name`,type:`string`,label:`Field Name`},{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`required`,type:`boolean`,label:`Required`},{name:`disabled`,type:`boolean`,label:`Disabled`},{name:`description`,type:`string`,label:`Description`}]}),t.ComponentRegistry.register(`password`,e=>(0,o.jsx)(qo,{...e,schema:{...e.schema,inputType:`password`}}),{namespace:`ui`,label:`Password Input`,icon:`lock`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`name`,type:`string`,label:`Field Name`},{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`required`,type:`boolean`,label:`Required`},{name:`disabled`,type:`boolean`,label:`Disabled`},{name:`description`,type:`string`,label:`Description`}]}),t.ComponentRegistry.register(`textarea`,({schema:e,className:t,onChange:n,value:r,...i})=>{let a=e=>{n&&n(e.target.value)},{"data-obj-id":s,"data-obj-type":c,style:l,...u}=i;return(0,o.jsxs)(`div`,{className:W(`grid w-full gap-1.5`,e.wrapperClass),"data-obj-id":s,"data-obj-type":c,style:l,children:[e.label&&(0,o.jsx)(X,{htmlFor:e.id,className:W(e.required&&`text-destructive after:content-['*'] after:ml-0.5`),children:e.label}),(0,o.jsx)(ea,{id:e.id,name:e.name,placeholder:e.placeholder,className:t,disabled:e.disabled,readOnly:e.readOnly,required:e.required,rows:e.rows,value:r??e.value??``,defaultValue:r===void 0?e.defaultValue:void 0,onChange:a,...u})]})},{namespace:`ui`,label:`Textarea`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`rows`,type:`number`,label:`Rows`},{name:`required`,type:`boolean`,label:`Required`},{name:`disabled`,type:`boolean`,label:`Disabled`},{name:`id`,type:`string`,label:`ID`,required:!0}],defaultProps:{label:`Textarea label`,placeholder:`Enter text here...`,rows:3,id:`textarea-field`}}),t.ComponentRegistry.register(`checkbox`,({schema:e,className:t,onChange:n,value:r,...i})=>{let{"data-obj-id":a,"data-obj-type":s,style:c,...l}=i;return(0,o.jsxs)(`div`,{className:W(`flex items-center space-x-2`,e.wrapperClass),"data-obj-id":a,"data-obj-type":s,style:c,children:[(0,o.jsx)(_t,{id:e.id,className:t,checked:r??e.checked??!1,defaultChecked:r===void 0?e.defaultChecked:void 0,onCheckedChange:e=>{n&&n(e)},disabled:e.disabled,required:e.required,name:e.name,...l}),(0,o.jsx)(X,{htmlFor:e.id,className:W(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,e.required&&`text-destructive after:content-['*'] after:ml-0.5`),children:e.label})]})},{namespace:`ui`,label:`Checkbox`,inputs:[{name:`label`,type:`string`,label:`Label`,required:!0},{name:`id`,type:`string`,label:`ID`,required:!0},{name:`checked`,type:`boolean`,label:`Checked`},{name:`required`,type:`boolean`,label:`Required`},{name:`disabled`,type:`boolean`,label:`Disabled`}],defaultProps:{label:`Checkbox label`,id:`checkbox-field`}}),t.ComponentRegistry.register(`switch`,({schema:e,className:t,...n})=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=n;return(0,o.jsxs)(`div`,{className:`flex items-center space-x-2 ${e.wrapperClass||``}`,"data-obj-id":r,"data-obj-type":i,style:a,children:[(0,o.jsx)(Vi,{id:e.id,className:t,...s}),(0,o.jsx)(X,{htmlFor:e.id,children:e.label})]})},{namespace:`ui`,label:`Switch`,inputs:[{name:`label`,type:`string`,label:`Label`,required:!0},{name:`id`,type:`string`,label:`ID`,required:!0},{name:`checked`,type:`boolean`,label:`Checked`}],defaultProps:{label:`Switch label`,id:`switch-field`}}),t.ComponentRegistry.register(`select`,({schema:e,className:t,onChange:n,value:r,...i})=>{let{"data-obj-id":a,"data-obj-type":s,style:c,...l}=i;return(0,o.jsxs)(`div`,{className:W(`grid w-full items-center gap-1.5`,e.wrapperClass),"data-obj-id":a,"data-obj-type":s,style:c,children:[e.label&&(0,o.jsx)(X,{className:W(e.required&&`text-destructive after:content-['*'] after:ml-0.5`),children:e.label}),(0,o.jsxs)(Nr,{defaultValue:r===void 0?ho(e.defaultValue):void 0,value:ho(r??e.value),onValueChange:t=>{n&&n(go(e.options,t))},disabled:e.disabled,required:e.required,name:e.name,...l,children:[(0,o.jsx)(Ir,{className:t,children:(0,o.jsx)(Fr,{placeholder:e.placeholder})}),(0,o.jsx)(zr,{children:e.options?.map(e=>(0,o.jsx)(Vr,{value:String(e.value),disabled:e.disabled,children:e.label},String(e.value)))})]})]})},{namespace:`ui`,label:`Select`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`defaultValue`,type:`string`,label:`Default Value`},{name:`required`,type:`boolean`,label:`Required`},{name:`disabled`,type:`boolean`,label:`Disabled`},{name:`options`,type:`array`,label:`Options`,description:`Array of {label, value} objects`}],defaultProps:{label:`Select an option`,placeholder:`Choose...`,options:[{label:`Option 1`,value:`option1`},{label:`Option 2`,value:`option2`},{label:`Option 3`,value:`option3`}]}}),t.ComponentRegistry.register(`radio-group`,({schema:e,className:t,...n})=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=n;return(0,o.jsx)(kr,{defaultValue:ho(e.defaultValue),className:t,...s,"data-obj-id":r,"data-obj-type":i,style:a,children:e.options?.map(t=>(0,o.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,o.jsx)(Ar,{value:String(t.value),id:`${e.id}-${String(t.value)}`}),(0,o.jsx)(X,{htmlFor:`${e.id}-${String(t.value)}`,children:t.label})]},String(t.value)))})},{namespace:`ui`,label:`Radio Group`,inputs:[{name:`defaultValue`,type:`string`,label:`Default Value`},{name:`id`,type:`string`,label:`Group ID`,required:!0},{name:`options`,type:`array`,label:`Options`,description:`Array of {label, value} objects`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{id:`radio-group`,options:[{label:`Option 1`,value:`option1`},{label:`Option 2`,value:`option2`},{label:`Option 3`,value:`option3`}]}}),t.ComponentRegistry.register(`slider`,({schema:e,className:t,...n})=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=n,c=Array.isArray(e.defaultValue)?e.defaultValue:e.defaultValue===void 0?void 0:[e.defaultValue];return(0,o.jsx)(zi,{defaultValue:c,max:e.max,min:e.min,step:e.step,className:t,...s,"data-obj-id":r,"data-obj-type":i,style:a})},{namespace:`ui`,label:`Slider`,inputs:[{name:`defaultValue`,type:`array`,label:`Default Value`,defaultValue:[50]},{name:`max`,type:`number`,label:`Max`,defaultValue:100},{name:`min`,type:`number`,label:`Min`,defaultValue:0},{name:`step`,type:`number`,label:`Step`,defaultValue:1},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{defaultValue:[50],max:100,min:0,step:1,className:`w-full`}}),t.ComponentRegistry.register(`toggle`,({schema:e,...t})=>(0,o.jsx)(na,{variant:e.variant,size:e.size,pressed:e.pressed,"aria-label":e.ariaLabel,...t,children:e.label||G(e.children)}),{namespace:`ui`,label:`Toggle`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`pressed`,type:`boolean`,label:`Pressed`},{name:`variant`,type:`enum`,enum:[`default`,`outline`],defaultValue:`default`,label:`Variant`},{name:`size`,type:`enum`,enum:[`default`,`sm`,`lg`],defaultValue:`default`,label:`Size`},{name:`ariaLabel`,type:`string`,label:`Aria Label`}],defaultProps:{label:`Toggle`,variant:`default`,size:`default`}}),t.ComponentRegistry.register(`input-otp`,({schema:e,className:t,onChange:n,value:r,...i})=>{let a=e.maxLength||6,s=Array.from({length:a});return(0,o.jsx)(Un,{maxLength:a,className:t,value:r??e.value,onChange:e=>{n&&n(e)},...i,children:(0,o.jsx)(Wn,{children:s.map((e,t)=>(0,o.jsx)(Gn,{index:t},t))})})},{namespace:`ui`,label:`Input OTP`,inputs:[{name:`maxLength`,type:`number`,label:`Max Length`,defaultValue:6},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{maxLength:6}}),t.ComponentRegistry.register(`calendar`,({schema:e,className:t,...n})=>(0,o.jsx)(Ke,{mode:e.mode||`single`,selected:e.value||e.defaultValue,className:t,...n}),{namespace:`ui`,skipFallback:!0,label:`Calendar`,inputs:[{name:`mode`,type:`enum`,enum:[`default`,`single`,`multiple`,`range`],defaultValue:`single`,label:`Mode`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{mode:`single`,className:`rounded-md border`}}),t.ComponentRegistry.register(`date-picker`,({schema:e,className:t,value:n,onChange:r,...i})=>{let a=e=>{r&&r(e)},{"data-obj-id":s,"data-obj-type":l,style:u,...d}=i;return(0,o.jsxs)(`div`,{className:`grid w-full max-w-sm items-center gap-1.5 ${e.wrapperClass||``}`,"data-obj-id":s,"data-obj-type":l,style:u,children:[e.label&&(0,o.jsx)(X,{htmlFor:e.id,children:e.label}),(0,o.jsxs)(Tr,{children:[(0,o.jsx)(Er,{asChild:!0,children:(0,o.jsxs)(K,{id:e.id,variant:`outline`,className:W(`w-full justify-start text-left font-normal`,!n&&`text-muted-foreground`,t),...d,children:[(0,o.jsx)(c.CalendarIcon,{className:`mr-2 h-4 w-4`}),n?(0,oe.format)(n,e.format||`PPP`):(0,o.jsx)(`span`,{children:e.placeholder||`Pick a date`})]})}),(0,o.jsx)(Dr,{className:`w-auto p-0`,children:(0,o.jsx)(Ke,{mode:`single`,selected:n,onSelect:a,autoFocus:!0})})]})]})},{namespace:`ui`,label:`Date Picker`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`format`,type:`string`,label:`Date Format`,description:`date-fns format string (e.g., "PPP", "yyyy-MM-dd")`},{name:`id`,type:`string`,label:`ID`,required:!0}],defaultProps:{label:`Date`,placeholder:`Pick a date`,format:`PPP`,id:`date-picker-field`}}),t.ComponentRegistry.register(`file-upload`,({schema:e,className:t,value:n,onChange:r,...i})=>{let[s,l]=(0,a.useState)(n||[]),[u,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(0),m=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(u){let e=setInterval(()=>{p(t=>t>=100?(clearInterval(e),d(!1),0):t+5)},50);return()=>clearInterval(e)}},[u]);let h=t=>{let n=Array.from(t.target.files||[]);if(n.length>0){d(!0),p(0);let t=e.multiple?[...s,...n]:n;setTimeout(()=>{l(t),r&&r(t)},1e3)}},g=e=>{let t=s.filter((t,n)=>n!==e);l(t),r&&r(t)},_=()=>{m.current?.click()},{"data-obj-id":v,"data-obj-type":y,style:b,...x}=i;return(0,o.jsxs)(`div`,{className:`grid w-full max-w-sm items-center gap-2 ${e.wrapperClass||``}`,"data-obj-id":v,"data-obj-type":y,style:b,children:[e.label&&(0,o.jsx)(X,{htmlFor:e.id,children:e.label}),(0,o.jsxs)(`div`,{className:W(`relative flex flex-col gap-3 group/upload`,t),children:[(0,o.jsx)(`input`,{ref:m,type:`file`,id:e.id,className:`hidden`,accept:e.accept,multiple:e.multiple,onChange:h,...x}),(0,o.jsxs)(`div`,{onClick:_,className:W(`relative overflow-hidden cursor-pointer rounded-lg border-2 border-dashed transition-all duration-300 min-h-[120px] flex flex-col items-center justify-center p-4 sm:p-6 gap-3`,u?`border-cyan-400 bg-cyan-950/30`:`border-slate-700 bg-slate-900/50 hover:bg-slate-900 hover:border-cyan-500/50 hover:shadow-[0_0_20px_-5px_rgba(6,182,212,0.3)]`),children:[(0,o.jsx)(`div`,{className:`absolute inset-0 bg-[url('https://grainy-gradients.vercel.app/noise.svg')] opacity-5 pointer-events-none`}),(0,o.jsx)(`div`,{className:`absolute inset-0 bg-[linear-gradient(to_right,#80808012_1px,transparent_1px),linear-gradient(to_bottom,#80808012_1px,transparent_1px)] bg-[size:14px_24px] pointer-events-none`}),(0,o.jsx)(`div`,{className:W(`relative z-10 p-3 rounded-full bg-slate-800 border border-slate-700 transition-all duration-500`,u?`scale-110 shadow-[0_0_30px_cyan] border-cyan-400 animate-bounce`:`group-hover/upload:scale-110 group-hover/upload:shadow-lg group-hover/upload:border-cyan-500`),children:u?(0,o.jsx)(c.Rocket,{className:`w-8 h-8 text-cyan-300 animate-pulse`}):(0,o.jsx)(c.Upload,{className:`w-6 h-6 text-slate-400 group-hover/upload:text-cyan-400`})}),(0,o.jsx)(`div`,{className:`relative z-10 text-center`,children:(0,o.jsx)(`p`,{className:W(`text-xs font-mono uppercase tracking-widest transition-colors`,u?`text-cyan-300`:`text-slate-500 group-hover/upload:text-cyan-200`),children:u?`INITIATING LAUNCH SEQUENCE...`:e.buttonText||`DROP PAYLOAD OR CLICK TO UPLOAD`})}),u&&(0,o.jsx)(`div`,{className:`absolute bottom-0 left-0 h-1 bg-cyan-500 shadow-[0_0_10px_cyan] transition-all duration-75 ease-out`,style:{width:`${f}%`}})]}),s.length>0&&(0,o.jsx)(`div`,{className:`flex flex-col gap-2 mt-1 perspective-1000`,children:s.map((e,t)=>(0,o.jsxs)(`div`,{className:`relative group/file overflow-hidden flex items-center justify-between p-3 border border-border bg-card/80 rounded-sm text-sm transition-all hover:border-primary/30 hover:shadow-lg hover:shadow-primary/10 animate-in slide-in-from-bottom-2 fade-in`,children:[(0,o.jsx)(`div`,{className:`absolute left-0 top-0 bottom-0 w-[2px] bg-primary/50 group-hover/file:bg-primary group-hover/file:shadow-[0_0_8px_hsl(var(--primary))]`}),(0,o.jsxs)(`div`,{className:`flex items-center gap-3 z-10`,children:[(0,o.jsx)(c.CheckCircle2,{className:`w-4 h-4 text-emerald-500 rounded-full`}),(0,o.jsx)(`span`,{className:`truncate max-w-[150px] sm:max-w-[200px] md:max-w-[300px] text-muted-foreground group-hover/file:text-foreground font-mono text-xs transition-colors`,children:e.name})]}),(0,o.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 hover:bg-destructive/10 hover:text-destructive`,onClick:()=>g(t),children:(0,o.jsx)(c.X,{className:`h-3 w-3`})}),(0,o.jsx)(`div`,{className:`absolute inset-0 bg-gradient-to-r from-transparent via-primary/5 to-transparent -translate-x-full group-hover/file:animate-[shimmer_1s_infinite] pointer-events-none`})]},t))})]})]})},{namespace:`ui`,label:`File Upload`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`buttonText`,type:`string`,label:`Button Text`},{name:`accept`,type:`string`,label:`Accepted File Types`,description:`MIME types (e.g., "image/*,application/pdf")`},{name:`multiple`,type:`boolean`,label:`Allow Multiple Files`},{name:`id`,type:`string`,label:`ID`,required:!0}],defaultProps:{label:`Upload files`,buttonText:`Choose files`,multiple:!0,id:`file-upload-field`}});var Jo=(0,d.cva)(`flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none`}},defaultVariants:{orientation:`horizontal`}});function Yo({className:e,orientation:t,...n}){return(0,o.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:W(Jo({orientation:t}),e),...n})}function Xo({className:e,asChild:t=!1,...n}){return(0,o.jsx)(t?u.Slot:`div`,{className:W(`bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e),...n})}function Zo({className:e,orientation:t=`vertical`,...n}){return(0,o.jsx)(Ur,{"data-slot":`button-group-separator`,orientation:t,className:W(`bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto`,e),...n})}function Qo({options:e,value:t,onValueChange:n,placeholder:r=`Select option...`,searchPlaceholder:i=`Search...`,emptyText:s=`No option found.`,className:l,disabled:u,...d}){let[f,p]=a.useState(!1);return(0,o.jsxs)(Tr,{open:f,onOpenChange:p,children:[(0,o.jsx)(Er,{asChild:!0,children:(0,o.jsxs)(K,{type:`button`,...d,variant:`outline`,role:`combobox`,"aria-expanded":f,className:W(`w-[200px] min-w-0 justify-between`,l),disabled:u,children:[(0,o.jsx)(`span`,{className:`truncate`,children:t?e.find(e=>e.value===t)?.label:r}),(0,o.jsx)(c.ChevronsUpDown,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})}),(0,o.jsx)(Dr,{className:`w-[var(--radix-popover-trigger-width)] min-w-[200px] p-0`,children:(0,o.jsxs)(Nt,{children:[(0,o.jsx)(Ft,{placeholder:i}),(0,o.jsxs)(It,{children:[(0,o.jsx)(Lt,{children:s}),(0,o.jsx)(Rt,{children:e.map(e=>(0,o.jsxs)(Bt,{value:e.value,onSelect:e=>{n?.(e===t?``:e),p(!1)},children:[(0,o.jsx)(c.Check,{className:W(`mr-2 h-4 w-4`,t===e.value?`opacity-100`:`opacity-0`)}),e.label]},e.value))})]})]})})]})}function $o({label:e,value:t,onClick:n,children:r,className:i}){return(0,o.jsxs)(n?`button`:`div`,{className:W(`flex items-center justify-between py-1.5 min-h-[32px] w-full text-left`,n&&`cursor-pointer hover:bg-accent/50 rounded-sm -mx-1 px-1`,i),onClick:n,type:n?`button`:void 0,children:[(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0 max-w-[45%] truncate`,title:e,children:e}),r||(0,o.jsx)(`span`,{className:`text-xs text-foreground truncate ml-4 text-right max-w-[55%]`,title:t,children:t})]})}var es=[{value:`equals`,label:`Equals`},{value:`notEquals`,label:`Does not equal`},{value:`contains`,label:`Contains`},{value:`notContains`,label:`Does not contain`},{value:`isEmpty`,label:`Is empty`},{value:`isNotEmpty`,label:`Is not empty`},{value:`greaterThan`,label:`Greater than`},{value:`lessThan`,label:`Less than`},{value:`greaterOrEqual`,label:`Greater than or equal`},{value:`lessOrEqual`,label:`Less than or equal`},{value:`before`,label:`Before`},{value:`after`,label:`After`},{value:`between`,label:`Between`},{value:`in`,label:`In`},{value:`notIn`,label:`Not in`},{value:`startsWith`,label:`Starts with`},{value:`endsWith`,label:`Ends with`},{value:`isNull`,label:`Is null`},{value:`isNotNull`,label:`Is not null`},{value:`exists`,label:`Is set`},{value:`notExists`,label:`Is not set`}],ts=es.map(e=>e.value),ns=(0,x.createSafeTranslation)({"filterBuilder.where":`Where`,"filterBuilder.and":`AND`,"filterBuilder.or":`OR`,"filterBuilder.clearAll":`Clear all`,"filterBuilder.selectField":`Select field`,"filterBuilder.operator":`Operator`,"filterBuilder.selectValue":`Select value`,"filterBuilder.value":`Value`,"filterBuilder.addFilter":`Add filter`,"filterBuilder.removeCondition":`Remove condition`,"filterBuilder.trueLabel":`True`,"filterBuilder.falseLabel":`False`,"filterBuilder.noResults":`No results`,"filterBuilder.searchField":`Search {{label}}…`,"filterBuilder.enterId":`Enter {{label}} id`,"filterBuilder.operators.equals":`Equals`,"filterBuilder.operators.notEquals":`Does not equal`,"filterBuilder.operators.contains":`Contains`,"filterBuilder.operators.notContains":`Does not contain`,"filterBuilder.operators.isEmpty":`Is empty`,"filterBuilder.operators.isNotEmpty":`Is not empty`,"filterBuilder.operators.greaterThan":`Greater than`,"filterBuilder.operators.lessThan":`Less than`,"filterBuilder.operators.greaterOrEqual":`Greater than or equal`,"filterBuilder.operators.lessOrEqual":`Less than or equal`,"filterBuilder.operators.before":`Before`,"filterBuilder.operators.after":`After`,"filterBuilder.operators.between":`Between`,"filterBuilder.operators.in":`In`,"filterBuilder.operators.notIn":`Not in`,"filterBuilder.operators.startsWith":`Starts with`,"filterBuilder.operators.endsWith":`Ends with`,"filterBuilder.operators.isNull":`Is null`,"filterBuilder.operators.isNotNull":`Is not null`,"filterBuilder.operators.exists":`Is set`,"filterBuilder.operators.notExists":`Is not set`},`filterBuilder.where`),rs=[`isNull`,`isNotNull`,`exists`,`notExists`],is=[`equals`,`notEquals`,`contains`,`notContains`,`startsWith`,`endsWith`,`isEmpty`,`isNotEmpty`,...rs],as=[`equals`,`notEquals`,`greaterThan`,`lessThan`,`greaterOrEqual`,`lessOrEqual`,`isEmpty`,`isNotEmpty`,...rs],os=[`equals`,`notEquals`],ss=[`equals`,`notEquals`,`before`,`after`,`between`,`isEmpty`,`isNotEmpty`,...rs],cs=[`equals`,`notEquals`,`in`,`notIn`,`isEmpty`,`isNotEmpty`,...rs],ls=[`equals`,`notEquals`,`in`,`notIn`,`isEmpty`,`isNotEmpty`,...rs],us=[`number`,`currency`,`percent`,`rating`],ds=[`date`,`datetime`,`time`],fs=[`select`,`status`],ps=[`lookup`,`master_detail`,`user`,`owner`];function ms(e){return Array.isArray(e)?e:e!=null&&e!==``?[e]:[]}function hs(e){return!!e&&typeof e==`object`&&Array.isArray(e.conditions)&&(e.logic===`and`||e.logic===`or`)}var gs={id:`root`,logic:`and`,conditions:[]};function _s({fields:e=[],value:t,onChange:n,className:r,showClearAll:i=!0}){let{t:s}=ns(),[l,u]=a.useState(hs(t)?t:gs);a.useEffect(()=>{hs(t)&&JSON.stringify(t)!==JSON.stringify(l)&&u(t)},[t]);let d=e=>{u(e),n?.(e)},f=()=>{let t={id:crypto.randomUUID(),field:e[0]?.value||``,operator:`equals`,value:``};d({...l,conditions:[...l.conditions,t]})},p=e=>{d({...l,conditions:l.conditions.filter(t=>t.id!==e)})},m=()=>{d({...l,conditions:[]})},h=(e,t)=>{d({...l,conditions:l.conditions.map(n=>n.id===e?{...n,...t}:n)})},g=()=>{d({...l,logic:l.logic===`and`?`or`:`and`})},_=t=>{let n=e.find(e=>e.value===t)?.type||`text`;return us.includes(n)?es.filter(e=>as.includes(e.value)):n===`boolean`?es.filter(e=>os.includes(e.value)):ds.includes(n)?es.filter(e=>ss.includes(e.value)):fs.includes(n)?es.filter(e=>cs.includes(e.value)):ps.includes(n)?es.filter(e=>ls.includes(e.value)):es.filter(e=>is.includes(e.value))},v=e=>![`isEmpty`,`isNotEmpty`,`isNull`,`isNotNull`,`exists`,`notExists`].includes(e),y=t=>{let n=e.find(e=>e.value===t)?.type||`text`;return us.includes(n)?`number`:n===`date`?`date`:n===`datetime`?`datetime-local`:n===`time`?`time`:`text`},b=t=>{let n=e.find(e=>e.value===t.field),r=[`in`,`notIn`].includes(t.operator);if(ps.includes(n?.type||``)&&!n?.options&&(n?.referenceTo||n?.type===`user`||n?.type===`owner`))return(0,o.jsx)(vs,{field:n,value:t.value,multiple:r,onChange:e=>h(t.id,{value:e})});if(n?.options&&r){let e=ms(t.value);return(0,o.jsx)(`div`,{className:`max-h-40 overflow-y-auto space-y-0.5 border rounded-md p-2`,children:n.options.map(n=>{let r=e.map(String).includes(String(n.value));return(0,o.jsxs)(`label`,{className:W(`flex items-center gap-2 text-sm py-1 px-1.5 rounded cursor-pointer`,r?`bg-primary/5 text-primary`:`hover:bg-muted`),children:[(0,o.jsx)(_t,{checked:r,onCheckedChange:r=>{let i=r?[...e,n.value]:e.filter(e=>String(e)!==String(n.value));h(t.id,{value:i})}}),(0,o.jsx)(`span`,{className:`truncate`,children:n.label})]},n.value)})})}if(n?.options&&(fs.includes(n.type||``)||ps.includes(n.type||``)))return(0,o.jsxs)(Nr,{value:String(t.value||``),onValueChange:e=>h(t.id,{value:e}),children:[(0,o.jsx)(Ir,{className:`h-9 text-sm`,children:(0,o.jsx)(Fr,{placeholder:s(`filterBuilder.selectValue`)})}),(0,o.jsx)(zr,{children:n.options.map(e=>(0,o.jsx)(Vr,{value:e.value,children:e.label},e.value))})]});if(n?.type===`boolean`)return(0,o.jsxs)(Nr,{value:String(t.value||``),onValueChange:e=>h(t.id,{value:e===`true`}),children:[(0,o.jsx)(Ir,{className:`h-9 text-sm`,children:(0,o.jsx)(Fr,{placeholder:s(`filterBuilder.selectValue`)})}),(0,o.jsxs)(zr,{children:[(0,o.jsx)(Vr,{value:`true`,children:s(`filterBuilder.trueLabel`)}),(0,o.jsx)(Vr,{value:`false`,children:s(`filterBuilder.falseLabel`)})]})]});let i=y(t.field),a=()=>t.value?i===`date`&&typeof t.value==`string`?t.value.split(`T`)[0]:String(t.value):``,c=e=>{let r=e;us.includes(n?.type||``)&&e!==``?r=parseFloat(e)||0:ds.includes(n?.type||``)&&(r=e),h(t.id,{value:r})};return(0,o.jsx)(Z,{type:i,className:`h-9 text-sm`,placeholder:s(`filterBuilder.value`),value:a(),onChange:e=>c(e.target.value)})};return(0,o.jsxs)(`div`,{className:W(`space-y-3`,r),children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(`span`,{className:`text-sm font-medium`,children:s(`filterBuilder.where`)}),l.conditions.length>1&&(0,o.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,onClick:g,className:`h-7 text-xs`,children:l.logic===`or`?s(`filterBuilder.or`):s(`filterBuilder.and`)})]}),i&&l.conditions.length>0&&(0,o.jsxs)(K,{type:`button`,variant:`ghost`,size:`sm`,onClick:m,className:`h-7 text-xs text-muted-foreground hover:text-destructive`,children:[(0,o.jsx)(c.Trash2,{className:`h-3 w-3 mr-1`}),s(`filterBuilder.clearAll`)]})]}),(0,o.jsx)(`div`,{className:`space-y-2`,children:l.conditions.map(t=>(0,o.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,o.jsxs)(`div`,{className:`flex-1 grid grid-cols-12 gap-2`,children:[(0,o.jsx)(`div`,{className:`col-span-4`,children:(0,o.jsxs)(Nr,{value:t.field,onValueChange:e=>h(t.id,{field:e}),children:[(0,o.jsx)(Ir,{className:`h-9 text-sm`,children:(0,o.jsx)(Fr,{placeholder:s(`filterBuilder.selectField`)})}),(0,o.jsx)(zr,{children:e.map(e=>(0,o.jsx)(Vr,{value:e.value,children:e.label},e.value))})]})}),(0,o.jsx)(`div`,{className:`col-span-4`,children:(0,o.jsxs)(Nr,{value:t.operator,onValueChange:e=>h(t.id,{operator:e}),children:[(0,o.jsx)(Ir,{className:`h-9 text-sm`,children:(0,o.jsx)(Fr,{placeholder:s(`filterBuilder.operator`)})}),(0,o.jsx)(zr,{children:_(t.field).map(e=>(0,o.jsx)(Vr,{value:e.value,children:s(`filterBuilder.operators.${e.value}`)},e.value))})]})}),v(t.operator)&&(0,o.jsx)(`div`,{className:`col-span-4`,children:b(t)})]}),(0,o.jsxs)(K,{type:`button`,variant:`ghost`,size:`icon`,className:`h-9 w-9 shrink-0`,onClick:()=>p(t.id),children:[(0,o.jsx)(c.X,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:s(`filterBuilder.removeCondition`)})]})]},t.id))}),(0,o.jsxs)(K,{type:`button`,variant:`outline`,size:`sm`,onClick:f,className:`h-8`,disabled:e.length===0,children:[(0,o.jsx)(c.Plus,{className:`h-3 w-3`}),s(`filterBuilder.addFilter`)]})]})}_s.displayName=`FilterBuilder`;function vs({field:e,value:t,multiple:n,onChange:r}){let{t:s}=ns(),l=a.useContext(i.SchemaRendererContext)?.dataSource??null,u=e.referenceTo||(e.type===`user`||e.type===`owner`?`users`:void 0),d=e.displayField||`name`,f=e.idField||`id`,[p,m]=a.useState(!1),[h,g]=a.useState(``),[_,v]=a.useState([]),[y,b]=a.useState(!1),[x,S]=a.useState(null),[C,w]=a.useState({}),T=a.useRef(null),E=a.useMemo(()=>n?ms(t).map(e=>String(e)):t==null||t===``?[]:[String(t)],[t,n]),D=l!=null&&typeof l.find==`function`&&!!u,O=a.useCallback(e=>{let t=e?.[f]??e?.id??e?._id,n=e?.[d]??e?.label??e?.name??String(t);return{value:t,label:String(n)}},[d,f]),k=a.useCallback(async e=>{if(D){b(!0),S(null);try{let t={$top:50};e&&e.trim()&&(t.$search=e.trim());let n=await l.find(u,t),r=(n?.data??n??[]).map(O);v(r),r.length>0&&w(e=>{let t={...e};for(let e of r)t[String(e.value)]=e.label;return t})}catch(e){S(e instanceof Error?e.message:String(e)),v([])}finally{b(!1)}}},[l,u,D,O]);a.useEffect(()=>{if(!D||E.length===0)return;let e=E.filter(e=>!(e in C));if(e.length===0)return;let t=!1;return(async()=>{try{let n=await l.find(u,{$top:e.length,$filter:{[f]:{$in:e}}}),r=n?.data??n??[];if(t)return;w(e=>{let t={...e};for(let e of r){let n=O(e);t[String(n.value)]=n.label}return t})}catch{}})(),()=>{t=!0}},[E,D,l,u,f,O,C]),a.useEffect(()=>{p&&D&&_.length===0&&k()},[p]);let A=e=>{g(e),D&&(T.current&&clearTimeout(T.current),T.current=setTimeout(()=>k(e||void 0),300))},j=e=>{if(n){let n=ms(t);r(n.map(String).includes(String(e))?n.filter(t=>String(t)!==String(e)):[...n,e])}else r(e),m(!1)};return D?(0,o.jsxs)(Tr,{open:p,onOpenChange:m,children:[(0,o.jsx)(Er,{asChild:!0,children:(0,o.jsxs)(`button`,{type:`button`,className:W(`inline-flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 text-sm`,`hover:bg-accent hover:text-accent-foreground`,`focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1`),"data-testid":`lookup-picker-${e.value}`,children:[E.length===0?(0,o.jsx)(`span`,{className:`text-muted-foreground truncate`,children:s(`filterBuilder.searchField`,{label:e.label})}):n?(0,o.jsx)(`span`,{className:`truncate`,children:E.length===1?C[E[0]]||E[0]:`${E.length} selected`}):(0,o.jsx)(`span`,{className:`truncate`,children:C[E[0]]||E[0]}),(0,o.jsxs)(`span`,{className:`flex items-center gap-1 shrink-0`,children:[E.length>0&&(0,o.jsx)(c.X,{className:`h-3.5 w-3.5 opacity-60 hover:opacity-100`,onClick:e=>{e.stopPropagation(),r(n?[]:``)}}),(0,o.jsx)(c.ChevronDown,{className:`h-3.5 w-3.5 opacity-60`})]})]})}),(0,o.jsxs)(Dr,{align:`start`,className:`w-72 p-0`,children:[(0,o.jsxs)(`div`,{className:`flex items-center border-b px-3`,children:[(0,o.jsx)(c.Search,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,o.jsx)(`input`,{autoFocus:!0,value:h,onChange:e=>A(e.target.value),placeholder:s(`filterBuilder.searchField`,{label:e.label}),className:`flex h-9 w-full bg-transparent px-2 py-1 text-sm outline-none placeholder:text-muted-foreground`,"data-testid":`lookup-search-${e.value}`}),y&&(0,o.jsx)(c.Loader2,{className:`h-3.5 w-3.5 animate-spin text-muted-foreground`})]}),(0,o.jsxs)(`div`,{className:`max-h-64 overflow-y-auto p-1`,"data-testid":`lookup-options-${e.value}`,children:[x&&(0,o.jsx)(`div`,{className:`px-3 py-2 text-xs text-destructive`,children:x}),!x&&!y&&_.length===0&&(0,o.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:s(`filterBuilder.noResults`)}),_.map(e=>{let t=E.includes(String(e.value));return(0,o.jsxs)(`label`,{className:W(`flex items-center gap-2 px-2 py-1.5 rounded text-sm cursor-pointer`,t?`bg-primary/5 text-primary`:`hover:bg-muted`),children:[n?(0,o.jsx)(_t,{checked:t,onCheckedChange:()=>j(e.value)}):(0,o.jsx)(`input`,{type:`radio`,checked:t,onChange:()=>j(e.value),className:`rounded-full border-input`}),(0,o.jsx)(`span`,{className:`truncate flex-1`,children:e.label})]},String(e.value))})]})]})]}):(0,o.jsx)(Z,{className:`h-9 text-sm`,placeholder:s(`filterBuilder.enterId`,{label:e.label}),value:E[0]??``,onChange:e=>r(e.target.value)})}var ys=(0,x.createSafeTranslation)({"sortBuilder.sortBy":`Sort by`,"sortBuilder.thenBy":`Then by`,"sortBuilder.selectField":`Select field`,"sortBuilder.ascending":`A → Z`,"sortBuilder.descending":`Z → A`,"sortBuilder.addSort":`Add sort`,"sortBuilder.removeSort":`Remove sort`},`sortBuilder.sortBy`);function bs({fields:e=[],value:t=[],onChange:n,className:r}){let{t:i}=ys(),s=a.useCallback(e=>(e||[]).map((e,t)=>({id:e?.id??(typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`sort-${t}-${e?.field??``}`),field:e?.field??``,order:e?.order??e?.sortOrder??`asc`})),[]),[l,u]=a.useState(()=>s(t));a.useEffect(()=>{let e=s(t),n=e=>e.map(({id:e,...t})=>t);JSON.stringify(n(e))!==JSON.stringify(n(l))&&u(e)},[t,l,s]);let d=e=>{u(e),n?.(e)},f=()=>{let t={id:crypto.randomUUID(),field:e[0]?.value||``,order:`asc`};d([...l,t])},p=(e,t)=>{d(l.map(n=>n.id===e?{...n,...t}:n))},m=e=>{d(l.filter(t=>t.id!==e))};return(0,o.jsxs)(`div`,{className:W(`space-y-3`,r),children:[(0,o.jsx)(`div`,{className:`space-y-2`,children:l.map((t,n)=>(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(`span`,{className:`text-sm font-medium w-16 text-muted-foreground`,children:i(n===0?`sortBuilder.sortBy`:`sortBuilder.thenBy`)}),(0,o.jsx)(`div`,{className:`flex-1`,children:(0,o.jsxs)(Nr,{value:t.field,onValueChange:e=>p(t.id,{field:e}),children:[(0,o.jsx)(Ir,{className:`h-9`,children:(0,o.jsx)(Fr,{placeholder:i(`sortBuilder.selectField`)})}),(0,o.jsx)(zr,{children:e.map(e=>(0,o.jsx)(Vr,{value:e.value,children:e.label},e.value))})]})}),(0,o.jsx)(`div`,{className:`w-28`,children:(0,o.jsxs)(Nr,{value:t.order,onValueChange:e=>p(t.id,{order:e}),children:[(0,o.jsx)(Ir,{className:`h-9`,children:(0,o.jsx)(Fr,{})}),(0,o.jsxs)(zr,{children:[(0,o.jsx)(Vr,{value:`asc`,children:i(`sortBuilder.ascending`)}),(0,o.jsx)(Vr,{value:`desc`,children:i(`sortBuilder.descending`)})]})]})}),(0,o.jsx)(K,{variant:`ghost`,size:`icon`,className:`h-9 w-9 shrink-0`,onClick:()=>m(t.id),children:(0,o.jsx)(c.X,{className:`h-4 w-4`})})]},t.id))}),(0,o.jsxs)(K,{variant:`outline`,size:`sm`,onClick:f,className:`h-8`,disabled:e.length===0,children:[(0,o.jsx)(c.Plus,{className:`h-3 w-3 mr-2`}),i(`sortBuilder.addSort`)]})]})}function xs({field:e,value:t,onChange:n,draft:r,objectDef:i}){if(e.visibleWhen&&!e.visibleWhen(r))return null;let a=e.disabled||(e.disabledWhen?e.disabledWhen(r):!1),s=t??e.defaultValue,l=null;switch(e.type){case`input`:l=(0,o.jsx)($o,{label:e.label,children:(0,o.jsx)(Z,{"data-testid":`config-field-${e.key}`,className:`h-7 w-32 text-xs`,value:s??``,placeholder:e.placeholder,disabled:a,onChange:e=>n(e.target.value)})});break;case`textarea`:l=(0,o.jsx)($o,{label:e.label,className:`flex-col items-stretch gap-1`,children:(0,o.jsx)(ea,{"data-testid":`config-field-${e.key}`,className:`min-h-[60px] w-full text-xs`,value:s??``,placeholder:e.placeholder,disabled:a,rows:3,onChange:e=>n(e.target.value)})});break;case`switch`:l=(0,o.jsx)($o,{label:e.label,children:(0,o.jsx)(Vi,{"data-testid":`config-field-${e.key}`,checked:!!s,disabled:a,onCheckedChange:e=>n(e),className:`scale-75`})});break;case`checkbox`:l=(0,o.jsx)($o,{label:e.label,children:(0,o.jsx)(_t,{"data-testid":`config-field-${e.key}`,checked:!!s,disabled:a,onCheckedChange:e=>n(e)})});break;case`select`:l=(0,o.jsx)($o,{label:e.label,children:(0,o.jsxs)(Nr,{value:String(s??``),onValueChange:e=>n(e),disabled:a,children:[(0,o.jsx)(Ir,{"data-testid":`config-field-${e.key}`,className:`h-7 w-32 text-xs`,children:(0,o.jsx)(Fr,{placeholder:e.placeholder??`Select…`})}),(0,o.jsx)(zr,{children:(e.options??[]).map(e=>(0,o.jsx)(Vr,{value:e.value,children:e.label},e.value))})]})});break;case`slider`:l=(0,o.jsx)($o,{label:e.label,children:(0,o.jsxs)(`div`,{className:`flex items-center gap-2 w-32`,children:[(0,o.jsx)(zi,{"data-testid":`config-field-${e.key}`,value:[Number(s??e.min??0)],min:e.min??0,max:e.max??100,step:e.step??1,disabled:a,onValueChange:e=>n(e[0]),"aria-label":e.label}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground w-6 text-right`,children:s??e.min??0})]})});break;case`color`:l=(0,o.jsx)($o,{label:e.label,children:(0,o.jsx)(`input`,{"data-testid":`config-field-${e.key}`,type:`color`,className:`h-7 w-10 rounded border cursor-pointer`,value:s??`#000000`,disabled:a,onChange:e=>n(e.target.value)})});break;case`icon-group`:l=(0,o.jsx)($o,{label:e.label,children:(0,o.jsx)(`div`,{className:`flex items-center gap-0.5`,"data-testid":`config-field-${e.key}`,children:(e.options??[]).map(e=>(0,o.jsx)(K,{type:`button`,size:`sm`,variant:s===e.value?`default`:`ghost`,className:W(`h-7 w-7 p-0`,s===e.value&&`ring-1 ring-primary`),disabled:a,onClick:()=>n(e.value),title:e.label,children:e.icon??(0,o.jsx)(`span`,{className:`text-[10px]`,children:e.label.charAt(0)})},e.value))})});break;case`field-picker`:l=(0,o.jsx)($o,{label:e.label,value:s??e.placeholder??`Select field…`,onClick:a?void 0:()=>{}});break;case`filter`:l=(0,o.jsxs)(`div`,{"data-testid":`config-field-${e.key}`,children:[(0,o.jsx)($o,{label:e.label}),(0,o.jsx)(_s,{fields:e.fields,value:s,onChange:n,className:`px-1 pb-2`})]});break;case`sort`:l=(0,o.jsxs)(`div`,{"data-testid":`config-field-${e.key}`,children:[(0,o.jsx)($o,{label:e.label}),(0,o.jsx)(bs,{fields:e.fields,value:s,onChange:n,className:`px-1 pb-2`})]});break;case`custom`:e.render&&(l=(0,o.jsx)(o.Fragment,{children:e.render(s,n,r)}));break;case`summary`:l=(0,o.jsx)($o,{label:e.label,onClick:e.onSummaryClick,children:(0,o.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(`span`,{className:`text-xs text-foreground truncate max-w-[120px]`,"data-testid":`config-field-${e.key}-text`,children:e.summaryText??s??``}),e.onSummaryClick&&(0,o.jsx)(c.Settings,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`,"aria-hidden":`true`,"data-testid":`config-field-${e.key}-gear`})]})})}return l?e.helpText?(0,o.jsxs)(`div`,{children:[l,(0,o.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5 mb-1`,children:e.helpText})]}):(0,o.jsx)(o.Fragment,{children:l}):null}function Ss({title:e,icon:t,collapsible:n,collapsed:r,onToggle:i,testId:a,className:s}){let l=(0,o.jsxs)(`h3`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider flex items-center gap-1.5`,children:[t&&(0,o.jsx)(`span`,{className:`text-muted-foreground shrink-0`,"aria-hidden":`true`,children:t}),e]});return n?(0,o.jsxs)(`button`,{"data-testid":a,className:W(`flex items-center justify-between pt-4 pb-1.5 first:pt-0 w-full text-left`,s),onClick:i,type:`button`,"aria-expanded":!r,children:[l,r?(0,o.jsx)(c.ChevronRight,{className:`h-3 w-3 text-muted-foreground`}):(0,o.jsx)(c.ChevronDown,{className:`h-3 w-3 text-muted-foreground`})]}):(0,o.jsx)(`div`,{className:W(`pt-4 pb-1.5 first:pt-0`,s),"data-testid":a,children:l})}function Cs({open:e,onClose:t,schema:n,draft:r,isDirty:i,onFieldChange:s,onSave:l,onDiscard:u,headerExtra:d,objectDef:f,className:p,style:m,saveLabel:h=`Save`,discardLabel:g=`Discard`,panelRef:_,role:v,ariaLabel:y,tabIndex:b,testId:x,closeTitle:S,footerTestId:C,saveTestId:w,discardTestId:T,expandedSections:E,onUndo:D,onRedo:O,canUndo:k,canRedo:A,undoLabel:j=`Undo`,redoLabel:M=`Redo`}){let[N,P]=(0,a.useState)({});if(!e)return null;let F=(e,t)=>{P(n=>({...n,[e]:!(n[e]??t??!1)}))},ee=(e,t)=>E&&E.includes(e)?!1:N[e]??t??!1;return(0,o.jsxs)(`div`,{ref:_,"data-testid":x??`config-panel`,role:v,"aria-label":y,tabIndex:b,style:m,className:W(`absolute inset-y-0 right-0 w-full sm:w-[var(--config-panel-width,280px)] sm:relative border-l bg-background flex flex-col shrink-0 z-20`,p),children:[(0,o.jsxs)(`div`,{className:`px-4 py-3 border-b flex items-center justify-between shrink-0`,children:[(0,o.jsx)(`nav`,{"aria-label":`breadcrumb`,children:(0,o.jsx)(`ol`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:n.breadcrumb.map((e,t)=>(0,o.jsxs)(a.Fragment,{children:[t>0&&(0,o.jsx)(c.ChevronRight,{className:`h-3 w-3`}),(0,o.jsx)(`li`,{className:W(t===n.breadcrumb.length-1&&`text-foreground font-medium`),children:e})]},t))})}),(0,o.jsxs)(`div`,{className:`flex items-center gap-1`,children:[D&&(0,o.jsx)(K,{size:`sm`,variant:`ghost`,onClick:D,disabled:!k,className:`h-7 w-7 p-0`,"data-testid":`config-panel-undo`,title:j,children:(0,o.jsx)(c.Undo2,{className:`h-3.5 w-3.5`})}),O&&(0,o.jsx)(K,{size:`sm`,variant:`ghost`,onClick:O,disabled:!A,className:`h-7 w-7 p-0`,"data-testid":`config-panel-redo`,title:M,children:(0,o.jsx)(c.Redo2,{className:`h-3.5 w-3.5`})}),d,(0,o.jsx)(K,{size:`sm`,variant:`ghost`,onClick:t,className:`h-7 w-7 p-0`,"data-testid":`config-panel-close`,title:S,children:(0,o.jsx)(c.X,{className:`h-3.5 w-3.5`})})]})]}),(0,o.jsx)(`div`,{className:`flex-1 overflow-auto px-4 pb-4`,children:n.sections.map((e,t)=>{if(e.visibleWhen&&!e.visibleWhen(r))return null;let n=ee(e.key,e.defaultCollapsed);return(0,o.jsxs)(`div`,{"data-testid":`config-section-${e.key}`,children:[t>0&&(0,o.jsx)(Ur,{className:`my-3`}),(0,o.jsx)(Ss,{title:e.title,icon:e.icon,collapsible:e.collapsible,collapsed:n,onToggle:()=>F(e.key,e.defaultCollapsed),testId:`section-header-${e.key}`}),e.hint&&(0,o.jsx)(`p`,{className:`text-[10px] text-muted-foreground mb-1`,children:e.hint}),!n&&(0,o.jsxs)(`div`,{className:`space-y-1`,children:[e.fields.map(e=>(0,o.jsx)(xs,{field:e,value:r[e.key],onChange:t=>s(e.key,t),draft:r,objectDef:f},e.key)),e.subsections?.map(e=>{if(e.visibleWhen&&!e.visibleWhen(r))return null;let t=ee(e.key,e.defaultCollapsed);return(0,o.jsxs)(`div`,{"data-testid":`config-subsection-${e.key}`,className:`ml-1`,role:`group`,"aria-label":e.title,children:[(0,o.jsx)(Ss,{title:e.title,icon:e.icon,collapsible:e.collapsible,collapsed:t,onToggle:()=>F(e.key,e.defaultCollapsed),testId:`section-header-${e.key}`,className:`pt-2 pb-1`}),!t&&(0,o.jsx)(`div`,{className:`space-y-1`,children:e.fields.map(e=>(0,o.jsx)(xs,{field:e,value:r[e.key],onChange:t=>s(e.key,t),draft:r,objectDef:f},e.key))})]},e.key)})]})]},e.key)})}),i&&(0,o.jsxs)(`div`,{className:`px-4 py-2 border-t flex gap-2 shrink-0`,"data-testid":C??`config-panel-footer`,children:[(0,o.jsxs)(K,{size:`sm`,onClick:l,"data-testid":w??`config-panel-save`,children:[(0,o.jsx)(c.Save,{className:`h-3.5 w-3.5 mr-1`}),h]}),(0,o.jsxs)(K,{size:`sm`,variant:`ghost`,onClick:u,"data-testid":T??`config-panel-discard`,children:[(0,o.jsx)(c.RotateCcw,{className:`h-3.5 w-3.5 mr-1`}),g]})]})]})}function ws({date:e,onDateChange:t,placeholder:n=`Pick a date`,className:r,disabled:i}){return(0,o.jsxs)(Tr,{children:[(0,o.jsx)(Er,{asChild:!0,children:(0,o.jsxs)(K,{variant:`outline`,className:W(`w-[280px] justify-start text-left font-normal`,!e&&`text-muted-foreground`,r),disabled:i,children:[(0,o.jsx)(c.CalendarIcon,{className:`mr-2 h-4 w-4`}),e?(0,oe.format)(e,`PPP`):(0,o.jsx)(`span`,{children:n})]})}),(0,o.jsx)(Dr,{className:`w-auto p-0`,children:(0,o.jsx)(Ke,{mode:`single`,selected:e,onSelect:t,autoFocus:!0})})]})}function Ts(){let{t:e}=(0,x.useObjectTranslation)(),t=e(`detail.noValue`);return!t||t===`detail.noValue`?`No value`:t}function Es({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`empty`,className:W(`flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12`,e),...t})}function Ds({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`empty-header`,className:W(`flex max-w-sm flex-col items-center gap-2 text-center`,e),...t})}var Os=(0,d.cva)(`flex shrink-0 items-center justify-center mb-2 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6`}},defaultVariants:{variant:`default`}});function ks({className:e,variant:t=`default`,...n}){return(0,o.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":t,className:W(Os({variant:t,className:e})),...n})}function As({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`empty-title`,className:W(`text-lg font-medium tracking-tight`,e),...t})}function js({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`empty-description`,className:W(`text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4`,e),...t})}function Ms({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`empty-content`,className:W(`flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance`,e),...t})}function Ns({className:e,glyph:t=`—`,...n}){let r=Ts();return(0,o.jsx)(`span`,{"data-slot":`empty-value`,"aria-label":r,className:W(`select-none text-muted-foreground/50 no-underline pointer-events-none`,e),...n,children:t})}var Ps=(0,d.cva)(`space-y-2`),Fs=a.forwardRef(({className:e,label:t,description:n,error:r,required:i,htmlFor:s,children:c,...l},d)=>{let f=a.useId(),p=s||f,m=`${p}-description`,h=`${p}-error`;return(0,o.jsxs)(`div`,{ref:d,className:W(Ps(),e),...l,children:[t&&(0,o.jsx)(X,{htmlFor:p,className:W(r&&`text-destructive`,i&&`after:content-['*'] after:ml-0.5 after:text-destructive`),children:t}),(0,o.jsx)(u.Slot,{id:p,"aria-describedby":[n&&m,r&&h].filter(Boolean).join(` `)||void 0,"aria-invalid":!!r,"aria-required":i||void 0,children:c}),n&&!r&&(0,o.jsx)(`p`,{id:m,className:`text-[0.8rem] text-muted-foreground`,children:n}),r&&(0,o.jsx)(`p`,{id:h,className:`text-[0.8rem] font-medium text-destructive`,children:r})]})});Fs.displayName=`FieldContainer`;var Is=a.forwardRef(({className:e,startContent:t,endContent:n,children:r,...i},a)=>(0,o.jsxs)(`div`,{ref:a,className:W(`flex w-full items-center rounded-md border border-input bg-transparent ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2`,`has-[[data-invalid]]:border-destructive`,e),...i,children:[t&&(0,o.jsx)(`div`,{className:`flex items-center px-3 text-muted-foreground bg-muted/50 border-r h-full self-stretch rounded-l-md`,children:t}),(0,o.jsx)(`div`,{className:`flex-1 relative [&_input]:border-0 [&_input]:shadow-none [&_input]:focus-visible:ring-0 [&_input]:bg-transparent`,children:r}),n&&(0,o.jsx)(`div`,{className:`flex items-center px-3 text-muted-foreground bg-muted/50 border-l h-full self-stretch rounded-r-md`,children:n})]}));Is.displayName=`InputGroup`;function Ls({className:e,...t}){return(0,o.jsx)(`div`,{role:`list`,"data-slot":`item-group`,className:W(`group/item-group flex flex-col`,e),...t})}function Rs({className:e,...t}){return(0,o.jsx)(Ur,{"data-slot":`item-separator`,orientation:`horizontal`,className:W(`my-0`,e),...t})}var zs=(0,d.cva)(`group/item flex items-center border border-transparent text-sm rounded-md transition-colors [a]:hover:bg-accent/50 [a]:transition-colors duration-100 flex-wrap outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]`,{variants:{variant:{default:`bg-transparent`,outline:`border-border`,muted:`bg-muted/50`},size:{default:`p-4 gap-4 `,sm:`py-3 px-4 gap-2.5`}},defaultVariants:{variant:`default`,size:`default`}});function Bs({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){return(0,o.jsx)(r?u.Slot:`div`,{"data-slot":`item`,"data-variant":t,"data-size":n,className:W(zs({variant:t,size:n,className:e})),...i})}var Vs=(0,d.cva)(`flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5`,{variants:{variant:{default:`bg-transparent`,icon:`size-8 border rounded-sm bg-muted [&_svg:not([class*='size-'])]:size-4`,image:`size-10 rounded-sm overflow-hidden [&_img]:size-full [&_img]:object-cover`}},defaultVariants:{variant:`default`}});function Hs({className:e,variant:t=`default`,...n}){return(0,o.jsx)(`div`,{"data-slot":`item-media`,"data-variant":t,className:W(Vs({variant:t,className:e})),...n})}function Us({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`item-content`,className:W(`flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none`,e),...t})}function Ws({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`item-title`,className:W(`flex w-fit items-center gap-2 text-sm leading-snug font-medium`,e),...t})}function Gs({className:e,...t}){return(0,o.jsx)(`p`,{"data-slot":`item-description`,className:W(`text-muted-foreground line-clamp-2 text-sm leading-normal font-normal text-balance`,`[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4`,e),...t})}function Ks({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`item-actions`,className:W(`flex items-center gap-2`,e),...t})}function qs({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`item-header`,className:W(`flex basis-full items-center justify-between gap-2`,e),...t})}function Js({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`item-footer`,className:W(`flex basis-full items-center justify-between gap-2`,e),...t})}function Ys({className:e,...t}){return(0,o.jsx)(`kbd`,{"data-slot":`kbd`,className:W(`bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none`,`[&_svg:not([class*='size-'])]:size-3`,`[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10`,e),...t})}function Xs({className:e,...t}){return(0,o.jsx)(`kbd`,{"data-slot":`kbd-group`,className:W(`inline-flex items-center gap-1`,e),...t})}var Zs=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsx)(`select`,{className:W(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n,children:t}));Zs.displayName=`NativeSelect`;var Qs=`[data-radix-popper-content-wrapper],[data-radix-select-content],[data-radix-select-viewport]`;function $s(e){return!!e?.closest?.(Qs)}function ec(e){let t=a.useRef(!1);return a.useEffect(()=>{let e=e=>{let n=e.target;t.current=!!document.querySelector(Qs)||!!n?.closest?.(`[role="dialog"]`)};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[]),a.useCallback(n=>{let r=n.detail?.originalEvent,i=r?.target??null;if($s(i)||i?.closest?.(`[role="dialog"]`)){n.preventDefault();return}if(r?.type===`pointerdown`&&t.current){n.preventDefault();return}e?.(n)},[e])}var tc=a.forwardRef(({className:e,children:t,onInteractOutside:n,...r},i)=>{let a=ec(n);return(0,o.jsxs)(Tt,{children:[(0,o.jsx)(Dt,{}),(0,o.jsxs)(b.Content,{ref:i,onInteractOutside:a,className:W(`fixed inset-0 z-50 w-full bg-background p-4 shadow-lg duration-200`,`h-[100dvh]`,`sm:inset-auto sm:left-[50%] sm:top-[50%] sm:translate-x-[-50%] sm:translate-y-[-50%]`,`sm:max-w-lg sm:h-auto sm:max-h-[90vh] sm:rounded-lg sm:border sm:p-6`,`data-[state=open]:animate-in data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,`data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,`data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]`,`data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]`,e),...r,children:[t,(0,o.jsxs)(b.Close,{className:W(`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity`,`hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,`disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,`min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 flex items-center justify-center`),children:[(0,o.jsx)(c.X,{className:`h-5 w-5 sm:h-4 sm:w-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})});tc.displayName=`MobileDialogContent`;var nc=(0,x.createSafeTranslation)({"common.close":`Close`,"common.closePanel":`Close panel`,"common.resizeDrawer":`Resize drawer`,"detail.openAsFullPage":`Open as full page`,"detail.recordDetail":`Record Detail`,"detail.recordDetailOverlay":`Record detail overlay for {{title}}.`},`common.close`);function rc(e){if(e!=null)return typeof e==`number`?`${e}px`:e}function ic(e){let t=rc(e);return t?{"--ov-w":t}:{}}var ac=360,oc=.95;function sc(e){let[t,n]=a.default.useState(null),r=a.default.useRef(!1);return a.default.useEffect(()=>{if(!(!e||typeof window>`u`))try{let t=window.localStorage.getItem(`ov:${e}`);if(!t)return;let r=Number(t);Number.isFinite(r)&&r>=ac&&n(r)}catch{}},[e]),{width:t,handleMouseDown:a.default.useCallback(t=>{if(!e||typeof window>`u`)return;t.preventDefault(),r.current=!0;let i=Math.floor(window.innerWidth*oc);document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let a=e=>{if(!r.current)return;let t=Math.min(i,Math.max(ac,window.innerWidth-e.clientX));n(t)},o=()=>{r.current=!1,document.body.style.cursor=``,document.body.style.userSelect=``,window.removeEventListener(`mousemove`,a),window.removeEventListener(`mouseup`,o),n(t=>{if(t!=null)try{window.localStorage.setItem(`ov:${e}`,String(t))}catch{}return t})};window.addEventListener(`mousemove`,a),window.addEventListener(`mouseup`,o)},[e]),handleDoubleClick:a.default.useCallback(()=>{if(!(!e||typeof window>`u`)){n(null);try{window.localStorage.removeItem(`ov:${e}`)}catch{}}},[e]),enabled:!!e}}var cc=({isOpen:e,selectedRecord:t,mode:n,close:r,setIsOpen:i,width:a,view:s,title:l,description:u,className:d,children:f,renderView:p,mainContent:m,popoverTrigger:h,onExpand:g,expandLabel:_,storageKey:v})=>{let y=ic(a),{t:b}=nc(),x=l||b(`detail.recordDetail`),S=_??b(`detail.openAsFullPage`),C=b(`detail.recordDetailOverlay`,{title:x}),w=sc(n===`drawer`?v:void 0),T=ec();if(n===`page`||n===`new_window`||n===`none`||!t)return null;let E=rc(a)??`42rem`,D=w.width==null?{"--ov-w":`max(${E}, min(60vw, 880px))`}:{"--ov-w":`${w.width}px`},O=e=>p&&s?p(e,s):f(e);if(n===`drawer`)return(0,o.jsx)(Wr,{open:e,onOpenChange:i,children:(0,o.jsxs)(Xr,{side:`right`,onInteractOutside:T,className:W(`w-screen max-w-none sm:w-full sm:max-w-[var(--ov-w,42rem)] p-0 flex flex-col gap-0 overflow-hidden`,`[&>button:last-of-type]:hidden`,d),style:D,children:[w.enabled&&(0,o.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":b(`common.resizeDrawer`),onMouseDown:w.handleMouseDown,onDoubleClick:w.handleDoubleClick,className:`hidden sm:block absolute left-0 top-0 bottom-0 z-30 w-1 cursor-col-resize touch-none bg-transparent hover:bg-primary/40 active:bg-primary/60 transition-colors`}),(0,o.jsxs)(Zr,{className:`shrink-0 flex-row items-center justify-between gap-2 space-y-0 px-4 py-2 border-b bg-muted/30`,children:[(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)($r,{className:`truncate text-xs font-medium tracking-wide text-muted-foreground`,children:x}),u?(0,o.jsx)(ei,{className:`truncate text-xs`,children:u}):(0,o.jsx)(ei,{className:`sr-only`,children:C})]}),(0,o.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[g&&(0,o.jsx)(`button`,{type:`button`,onClick:g,"aria-label":S,title:S,className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,o.jsx)(c.Maximize2,{className:`h-3.5 w-3.5`})}),(0,o.jsx)(Kr,{asChild:!0,children:(0,o.jsx)(`button`,{type:`button`,"aria-label":b(`common.close`),title:b(`common.close`),className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,o.jsx)(c.X,{className:`h-3.5 w-3.5`})})})]})]}),(0,o.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:O(t)})]})});if(n===`modal`)return(0,o.jsx)(Ct,{open:e,onOpenChange:i,children:(0,o.jsxs)(Ot,{onInteractOutside:T,className:W(`w-[calc(100vw-1rem)] max-w-none sm:max-w-[var(--ov-w,42rem)] max-h-[90vh] overflow-y-auto`,d),style:y,children:[g&&(0,o.jsx)(`button`,{type:`button`,onClick:g,"aria-label":S,title:S,className:`absolute right-12 top-4 z-10 inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors`,children:(0,o.jsx)(c.Maximize2,{className:`h-4 w-4`})}),(0,o.jsxs)(kt,{children:[(0,o.jsx)(jt,{children:x}),u?(0,o.jsx)(Mt,{children:u}):(0,o.jsx)(Mt,{className:`sr-only`,children:C})]}),(0,o.jsx)(`div`,{className:`mt-4`,children:O(t)})]})});if(n===`split`){if(!e||!m)return null;let n=a&&typeof a==`number`?Math.min(70,Math.max(20,a/1200*100)):40,i=100-n;return(0,o.jsxs)(_o,{orientation:`horizontal`,className:W(`h-full`,d),children:[(0,o.jsx)(vo,{defaultSize:i,minSize:30,children:m}),(0,o.jsx)(yo,{withHandle:!0}),(0,o.jsx)(vo,{defaultSize:n,minSize:20,children:(0,o.jsxs)(`div`,{className:`h-full overflow-y-auto p-4`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,o.jsx)(`h3`,{className:`text-lg font-semibold`,children:x}),(0,o.jsx)(`button`,{onClick:r,className:`rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,"aria-label":b(`common.closePanel`),children:(0,o.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,o.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,o.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),u&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:u}),O(t)]})})]})}return n===`popover`?h?(0,o.jsxs)(Tr,{open:e,onOpenChange:i,children:[h&&(0,o.jsx)(Er,{asChild:!0,children:h}),(0,o.jsx)(Dr,{className:W(`w-96 max-h-[400px] overflow-y-auto p-4`,d),style:y,children:(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsx)(`h4`,{className:`text-sm font-semibold`,children:x}),u&&(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u}),O(t)]})})]}):e?(0,o.jsx)(Ct,{open:e,onOpenChange:i,children:(0,o.jsxs)(Ot,{className:W(`w-96 max-h-[80vh] overflow-y-auto p-4`,d),style:y,children:[(0,o.jsxs)(kt,{children:[(0,o.jsx)(jt,{className:`text-sm`,children:x}),u?(0,o.jsx)(Mt,{className:`text-xs`,children:u}):(0,o.jsx)(Mt,{className:`sr-only`,children:C})]}),(0,o.jsx)(`div`,{className:`mt-2`,children:O(t)})]})}):null:null};cc.displayName=`NavigationOverlay`;function lc({className:e,...t}){return(0,o.jsx)(`div`,{role:`status`,"aria-label":`Loading`,className:W(`flex items-center justify-center`,e),...t,children:(0,o.jsx)(c.Loader2,{className:`animate-spin text-muted-foreground w-full h-full min-w-4 min-h-4`})})}var uc={addGroup:`Add group field`,collapseTitle:`Collapsed by default`,removeTitle:`Remove`,ascendingTitle:`Ascending`,descendingTitle:`Descending`};function dc({value:e,onChange:t,fieldOptions:n,maxLevels:r=3,className:i,labels:a}){let s={...uc,...a||{}},l=e?.fields??[],u=new Set(l.map(e=>e.field)),d=e=>{t(e.length?{fields:e}:void 0)};return(0,o.jsxs)(`div`,{"data-testid":`grouping-editor`,className:W(`flex flex-col gap-1.5 w-full`,i),children:[l.map((e,t)=>(0,o.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(`select`,{"data-testid":`grouping-field-${t}`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground flex-1 min-w-0`,value:e.field,onChange:n=>{let r=[...l];r[t]={...e,field:n.target.value},d(r)},children:n.filter(t=>t.value===e.field||!u.has(t.value)).map(e=>(0,o.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,o.jsx)(`button`,{type:`button`,title:e.order===`asc`?s.ascendingTitle:s.descendingTitle,"data-testid":`grouping-order-${t}`,className:`flex h-7 w-7 items-center justify-center rounded-md border border-input bg-background text-foreground hover:bg-muted`,onClick:()=>{let n=[...l];n[t]={...e,order:e.order===`asc`?`desc`:`asc`},d(n)},children:e.order===`asc`?(0,o.jsx)(c.ArrowUp,{className:`h-3 w-3`}):(0,o.jsx)(c.ArrowDown,{className:`h-3 w-3`})}),(0,o.jsx)(`label`,{title:s.collapseTitle,className:`flex items-center text-xs text-muted-foreground`,children:(0,o.jsx)(`input`,{type:`checkbox`,"data-testid":`grouping-collapsed-${t}`,className:`h-3 w-3`,checked:e.collapsed,onChange:n=>{let r=[...l];r[t]={...e,collapsed:n.target.checked},d(r)}})}),(0,o.jsx)(`button`,{type:`button`,title:s.removeTitle,"data-testid":`grouping-remove-${t}`,className:`flex h-7 w-7 items-center justify-center rounded-md border border-input bg-background text-muted-foreground hover:bg-muted hover:text-destructive`,onClick:()=>{let e=l.filter((e,n)=>n!==t);d(e)},children:(0,o.jsx)(c.X,{className:`h-3 w-3`})})]},t)),l.length<r&&(()=>{let e=n.filter(e=>!u.has(e.value));return e.length===0?null:(0,o.jsxs)(`button`,{type:`button`,"data-testid":`grouping-add`,className:`flex h-7 items-center gap-1 self-start rounded-md border border-dashed border-input bg-background px-2 text-xs text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:()=>{let t=[...l,{field:e[0].value,order:`asc`,collapsed:!1}];d(t)},children:[(0,o.jsx)(c.Plus,{className:`h-3 w-3`}),s.addGroup]})})()]})}var fc=({params:e,open:t,onSubmit:n,onCancel:r,title:i=`Action Parameters`,description:s=`Please provide the required parameters.`})=>{let[c,l]=(0,a.useState)(()=>{let t={};return e.forEach(e=>{e.defaultValue===void 0?t[e.name]=e.type!==`boolean`&&``:t[e.name]=e.defaultValue}),t}),[u,d]=(0,a.useState)({}),f=(0,a.useCallback)((e,t)=>{l(n=>({...n,[e]:t})),d(t=>{let n={...t};return delete n[e],n})},[]),p=(0,a.useCallback)(()=>{let t={};if(e.forEach(e=>{if(e.required){let n=c[e.name];(n==null||n===``)&&(t[e.name]=`${e.label} is required`)}}),Object.keys(t).length>0){d(t);return}n(c)},[e,c,n]);return(0,o.jsx)(Ct,{open:t,onOpenChange:e=>{e||r()},children:(0,o.jsxs)(Ot,{className:`sm:max-w-[425px]`,children:[(0,o.jsxs)(kt,{children:[(0,o.jsx)(jt,{children:i}),(0,o.jsx)(Mt,{children:s})]}),(0,o.jsx)(`div`,{className:`space-y-4 py-4`,children:e.map(e=>{let t=c[e.name],n=u[e.name],r=e.required||void 0;switch(e.type){case`textarea`:return(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(X,{htmlFor:e.name,children:[e.label,e.required&&(0,o.jsx)(`span`,{className:`text-destructive ml-1`,"aria-hidden":`true`,children:`*`})]}),(0,o.jsx)(ea,{id:e.name,"aria-required":r,value:t||``,onChange:t=>f(e.name,t.target.value),placeholder:e.placeholder}),e.helpText&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.helpText}),n&&(0,o.jsx)(`p`,{className:`text-sm text-destructive`,children:n})]},e.name);case`number`:return(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(X,{htmlFor:e.name,children:[e.label,e.required&&(0,o.jsx)(`span`,{className:`text-destructive ml-1`,"aria-hidden":`true`,children:`*`})]}),(0,o.jsx)(Z,{id:e.name,"aria-required":r,type:`number`,value:t??``,onChange:t=>f(e.name,Number.isNaN(t.target.valueAsNumber)?``:t.target.valueAsNumber),placeholder:e.placeholder}),e.helpText&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.helpText}),n&&(0,o.jsx)(`p`,{className:`text-sm text-destructive`,children:n})]},e.name);case`boolean`:return(0,o.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,o.jsx)(_t,{id:e.name,checked:!!t,onCheckedChange:t=>f(e.name,!!t)}),(0,o.jsx)(X,{htmlFor:e.name,children:e.label}),e.helpText&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground ml-2`,children:e.helpText})]},e.name);case`select`:return(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(X,{htmlFor:e.name,children:[e.label,e.required&&(0,o.jsx)(`span`,{className:`text-destructive ml-1`,"aria-hidden":`true`,children:`*`})]}),(0,o.jsxs)(Nr,{value:t||``,onValueChange:t=>f(e.name,t),children:[(0,o.jsx)(Ir,{id:e.name,"aria-required":r,children:(0,o.jsx)(Fr,{placeholder:e.placeholder||`Select...`})}),(0,o.jsx)(zr,{children:e.options?.map(e=>(0,o.jsx)(Vr,{value:e.value,children:e.label},e.value))})]}),e.helpText&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.helpText}),n&&(0,o.jsx)(`p`,{className:`text-sm text-destructive`,children:n})]},e.name);case`date`:return(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(X,{htmlFor:e.name,children:[e.label,e.required&&(0,o.jsx)(`span`,{className:`text-destructive ml-1`,"aria-hidden":`true`,children:`*`})]}),(0,o.jsx)(Z,{id:e.name,"aria-required":r,type:`date`,value:t||``,onChange:t=>f(e.name,t.target.value)}),e.helpText&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.helpText}),n&&(0,o.jsx)(`p`,{className:`text-sm text-destructive`,children:n})]},e.name);default:return(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(X,{htmlFor:e.name,children:[e.label,e.required&&(0,o.jsx)(`span`,{className:`text-destructive ml-1`,"aria-hidden":`true`,children:`*`})]}),(0,o.jsx)(Z,{id:e.name,"aria-required":r,type:`text`,value:t||``,onChange:t=>f(e.name,t.target.value),placeholder:e.placeholder}),e.helpText&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.helpText}),n&&(0,o.jsx)(`p`,{className:`text-sm text-destructive`,children:n})]},e.name)}})}),(0,o.jsxs)(At,{children:[(0,o.jsx)(K,{variant:`outline`,onClick:r,children:`Cancel`}),(0,o.jsx)(K,{onClick:p,children:`Continue`})]})]})})};fc.displayName=`ActionParamDialog`;function pc({rows:e=5,columns:t=4,className:n,...r}){return(0,o.jsxs)(`div`,{"data-slot":`grid-skeleton`,className:W(`w-full space-y-2`,n),...r,children:[(0,o.jsx)(`div`,{className:`flex gap-4 px-4 py-2`,children:Array.from({length:t}).map((e,t)=>(0,o.jsx)(Q,{className:`h-4 flex-1 rounded`},t))}),Array.from({length:e}).map((e,n)=>(0,o.jsx)(`div`,{className:`flex gap-4 rounded-md border px-4 py-3`,children:Array.from({length:t}).map((e,t)=>(0,o.jsx)(Q,{className:W(`h-4 flex-1 rounded`,t===0&&`max-w-[40%]`)},t))},n))]})}function mc({columns:e=3,cardsPerColumn:t=3,className:n,...r}){return(0,o.jsx)(`div`,{"data-slot":`kanban-skeleton`,className:W(`flex gap-4 overflow-x-auto`,n),...r,children:Array.from({length:e}).map((e,n)=>(0,o.jsxs)(`div`,{className:`flex w-72 shrink-0 flex-col gap-3 rounded-lg border bg-muted/30 p-3`,children:[(0,o.jsx)(Q,{className:`h-5 w-24 rounded`}),Array.from({length:t}).map((e,t)=>(0,o.jsxs)(`div`,{className:`space-y-2 rounded-md border bg-background p-3`,children:[(0,o.jsx)(Q,{className:`h-4 w-3/4 rounded`}),(0,o.jsx)(Q,{className:`h-3 w-1/2 rounded`})]},t))]},n))})}function hc({rows:e=4,className:t,...n}){return(0,o.jsxs)(`div`,{"data-slot":`form-skeleton`,className:W(`w-full max-w-lg space-y-6`,t),...n,children:[Array.from({length:e}).map((e,t)=>(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsx)(Q,{className:`h-4 w-28 rounded`}),(0,o.jsx)(Q,{className:`h-9 w-full rounded-md`})]},t)),(0,o.jsx)(Q,{className:`h-9 w-24 rounded-md`})]})}function gc({rows:e=5,className:t,...n}){return(0,o.jsx)(`div`,{"data-slot":`list-skeleton`,className:W(`w-full space-y-3`,t),...n,children:Array.from({length:e}).map((e,t)=>(0,o.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border px-4 py-3`,children:[(0,o.jsx)(Q,{className:`size-8 shrink-0 rounded-full`}),(0,o.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,o.jsx)(Q,{className:`h-4 w-3/5 rounded`}),(0,o.jsx)(Q,{className:`h-3 w-2/5 rounded`})]})]},t))})}function _c({className:e,...t}){return(0,o.jsxs)(`div`,{"data-slot":`chart-skeleton`,className:W(`w-full space-y-4`,e),...t,children:[(0,o.jsx)(Q,{className:`h-5 w-40 rounded`}),(0,o.jsx)(`div`,{className:`flex h-48 items-end gap-2 rounded-md border p-4`,children:[`h-2/5`,`h-3/5`,`h-1/3`,`h-4/5`,`h-1/2`,`h-3/4`,`h-2/5`].map((e,t)=>(0,o.jsx)(Q,{className:W(`flex-1 rounded-t`,e)},t))}),(0,o.jsxs)(`div`,{className:`flex gap-4`,children:[(0,o.jsx)(Q,{className:`h-3 w-16 rounded`}),(0,o.jsx)(Q,{className:`h-3 w-16 rounded`}),(0,o.jsx)(Q,{className:`h-3 w-16 rounded`})]})]})}function vc({variant:e,...t}){switch(e){case`grid`:return(0,o.jsx)(pc,{...t});case`kanban`:return(0,o.jsx)(mc,{...t});case`form`:return(0,o.jsx)(hc,{...t});case`list`:return(0,o.jsx)(gc,{...t});case`chart`:return(0,o.jsx)(_c,{...t})}}function yc({className:e,...t}){return(0,o.jsx)(`div`,{"data-slot":`shimmer-skeleton`,className:W(`rounded-md bg-muted`,`motion-safe:bg-[linear-gradient(90deg,hsl(var(--muted))_0%,hsl(var(--muted-foreground)/0.12)_50%,hsl(var(--muted))_100%)]`,`motion-safe:bg-[length:200%_100%] motion-safe:animate-shimmer`,e),...t})}var bc=({title:e,icon:t,objectLabel:n,resourceId:r,showStar:i=!0,showCopyId:s=!0,isFavorite:l,onToggleFavorite:u,className:d,inlineExtras:f})=>{let{t:p}=(0,x.useObjectTranslation)(),[m,h]=a.default.useState(!1),[g,_]=a.default.useState(!1),v=l??m,y=a.default.useCallback(()=>{let e=!v;u&&u(e),l===void 0&&h(e)},[v,l,u]),b=a.default.useCallback(()=>{if(r)try{typeof navigator<`u`&&navigator.clipboard&&navigator.clipboard.writeText(r),_(!0),setTimeout(()=>_(!1),1500)}catch{}},[r]),S=p(v?`detail.removeFromFavorites`:`detail.addToFavorites`),C=p(g?`detail.copied`:`detail.copyRecordId`);return(0,o.jsx)(ri,{children:(0,o.jsx)(`div`,{className:W(`flex flex-col min-w-0`,d),children:(0,o.jsxs)(`div`,{className:`flex items-baseline gap-2 flex-wrap`,children:[t&&(0,o.jsx)(`span`,{className:`text-muted-foreground shrink-0 self-center`,"aria-hidden":!0,children:t}),(0,o.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold truncate`,children:e}),n&&(0,o.jsx)(`span`,{className:`text-xs font-medium tracking-wide text-muted-foreground/70 shrink-0`,children:n}),s&&r&&(0,o.jsxs)(ii,{children:[(0,o.jsx)(ai,{asChild:!0,children:(0,o.jsx)(K,{variant:`ghost`,size:`icon`,className:`h-5 w-5 shrink-0 text-muted-foreground/50 hover:text-foreground`,onClick:b,"aria-label":C,children:g?(0,o.jsx)(c.Check,{className:`h-3 w-3 text-green-600`}):(0,o.jsx)(c.Copy,{className:`h-3 w-3`})})}),(0,o.jsx)(oi,{children:C})]}),i&&(0,o.jsxs)(ii,{children:[(0,o.jsx)(ai,{asChild:!0,children:(0,o.jsx)(K,{variant:`ghost`,size:`icon`,className:`h-6 w-6 shrink-0`,onClick:y,"aria-label":S,"aria-pressed":v,children:(0,o.jsx)(c.Star,{className:W(`h-4 w-4`,v?`fill-yellow-400 text-yellow-400`:`text-muted-foreground`)})})}),(0,o.jsx)(oi,{children:S})]}),f]})})})},xc=!1;function Sc(){if(xc||typeof document>`u`)return;let e=`objui-refresh-indicator-kf`;if(document.getElementById(e)){xc=!0;return}let t=document.createElement(`style`);t.id=e,t.textContent=`
14
14
  @keyframes objui-refresh-bar {
15
15
  0% { transform: translateX(-100%); }
16
16
  100% { transform: translateX(400%); }
17
17
  }
18
- `,document.head.appendChild(t),hc=!0}var _c=({active:e,ariaLabel:t=`Refreshing`,className:n,...r})=>(a.useEffect(()=>{e&&gc()},[e]),e?(0,o.jsx)(`div`,{className:U(`pointer-events-none absolute inset-x-0 top-0 z-20 h-0.5 overflow-hidden`,n),role:`progressbar`,"aria-busy":`true`,"aria-label":t,"data-testid":`refresh-indicator`,...r,children:(0,o.jsx)(`div`,{className:`h-full w-1/4 rounded-full bg-primary/70`,style:{animation:`objui-refresh-bar 1.1s ease-in-out infinite`}})}):null);_c.displayName=`RefreshIndicator`;function vc({className:e,message:t=`Loading…`,...n}){return(0,o.jsxs)(`div`,{role:`status`,"aria-label":t,"data-slot":`data-loading-state`,className:U(`flex flex-col items-center justify-center gap-3 p-6 text-center`,e),...n,children:[(0,o.jsx)(c.Loader2,{className:`size-6 animate-spin text-muted-foreground`}),t&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]})}function yc({className:e,icon:t,illustration:n,showIcon:r=!0,iconWrapperClassName:i,title:a=`No data`,description:s,action:l,children:u,...d}){let f=r&&(t!=null||!n);return(0,o.jsxs)(`div`,{"data-slot":`data-empty-state`,className:U(`flex flex-col items-center justify-center gap-3 p-6 text-center`,e),...d,children:[n&&(0,o.jsx)(`div`,{"data-slot":`data-empty-state-illustration`,className:`motion-safe:animate-in motion-safe:fade-in-0 motion-safe:zoom-in-95 motion-safe:duration-300 [&_svg]:max-h-40 [&_svg]:w-auto`,"aria-hidden":!0,children:n}),f&&(0,o.jsx)(`div`,{"data-slot":`data-empty-state-icon`,className:U(i??`flex size-10 items-center justify-center rounded-lg bg-muted`),children:t??(0,o.jsx)(c.InboxIcon,{className:`size-5 text-muted-foreground`})}),a&&(0,o.jsx)(`h3`,{className:`text-sm font-medium`,children:a}),s&&(0,o.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:s}),l,u]})}function bc({className:e,title:t=`Something went wrong`,message:n,onRetry:r,retryLabel:i=`Retry`,children:a,...s}){return(0,o.jsxs)(`div`,{role:`alert`,"data-slot":`data-error-state`,className:U(`flex flex-col items-center justify-center gap-3 p-6 text-center`,e),...s,children:[(0,o.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-lg bg-destructive/10`,children:(0,o.jsx)(c.AlertCircle,{className:`size-5 text-destructive`})}),t&&(0,o.jsx)(`h3`,{className:`text-sm font-medium`,children:t}),n&&(0,o.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:n}),r&&(0,o.jsx)(q,{variant:`outline`,size:`sm`,onClick:r,children:i}),a]})}function xc(e){return!e&&e!==0?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function Sc({open:e,onOpenChange:t,job:n,title:r,description:i,filename:s,allowCloseWhileRunning:l=!0,className:u,onAfterDownload:d,closeAfterDownloadMs:f}){let{progress:p,error:m,isRunning:h,cancel:g,download:_,reset:v}=n,y=p?.status,b=typeof p?.percentComplete==`number`?Math.max(0,Math.min(100,p.percentComplete)):void 0,x=y===`completed`,S=y===`failed`||y===`expired`,C=y===`cancelled`,w=a.useCallback(async()=>{await _(s)&&(d?.(),f&&f>0&&setTimeout(()=>t(!1),f))},[_,s,d,f,t]),T=a.useCallback(e=>{!e&&h&&!l||(t(e),!e&&!h&&setTimeout(v,0))},[h,l,t,v]),E=r??(x?`Export ready`:S?`Export failed`:C?`Export cancelled`:`Exporting…`),D=i??(x?`Your export is ready to download.`:S?`The export job did not complete.`:C?`The export was cancelled.`:`Your export is being prepared on the server. You can close this window — the job will continue in the background.`);return(0,o.jsx)(St,{open:e,onOpenChange:T,children:(0,o.jsxs)(Dt,{"data-testid":`export-progress-dialog`,className:U(`sm:max-w-md`,u),children:[(0,o.jsxs)(Ot,{children:[(0,o.jsxs)(At,{className:`flex items-center gap-2`,children:[x?(0,o.jsx)(c.CheckCircle2,{className:`h-5 w-5 text-green-600`,"aria-hidden":`true`}):S?(0,o.jsx)(c.AlertCircle,{className:`h-5 w-5 text-destructive`,"aria-hidden":`true`}):(0,o.jsx)(c.Loader2,{className:U(`h-5 w-5 text-muted-foreground`,h&&`animate-spin`),"aria-hidden":`true`}),E]}),(0,o.jsx)(jt,{children:D})]}),(0,o.jsxs)(`div`,{className:`py-2 space-y-3`,children:[(h||x)&&(0,o.jsx)(`div`,{"data-testid":`export-progress-bar`,children:b===void 0?(0,o.jsx)(Dr,{value:void 0,"aria-label":`Export progress (indeterminate)`}):(0,o.jsx)(Dr,{value:b,"aria-label":`Export progress`})}),(0,o.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,o.jsx)(`span`,{"data-testid":`export-progress-counts`,children:p?.processedRecords==null?h?`Starting…`:``:`${p.processedRecords.toLocaleString()}${p.totalRecords==null?``:` / ${p.totalRecords.toLocaleString()}`} records`}),(0,o.jsx)(`span`,{"data-testid":`export-progress-percent`,children:b===void 0?``:`${b.toFixed(0)}%`})]}),p?.fileSize?(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:xc(p.fileSize)}):null,(m||p?.error)&&(0,o.jsx)(`div`,{"data-testid":`export-progress-error`,className:`text-xs text-destructive bg-destructive/10 border border-destructive/30 rounded-md px-2 py-1`,children:m?.message||p?.error?.message})]}),(0,o.jsxs)(kt,{className:`gap-2 sm:gap-2`,children:[h&&(0,o.jsxs)(q,{type:`button`,variant:`ghost`,onClick:()=>g(),"data-testid":`export-progress-cancel`,children:[(0,o.jsx)(c.X,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:`ml-1`,children:`Cancel`})]}),x&&(0,o.jsxs)(q,{type:`button`,variant:`default`,onClick:w,"data-testid":`export-progress-download`,children:[(0,o.jsx)(c.Download,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:`ml-1`,children:`Download`})]}),!h&&(0,o.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>T(!1),"data-testid":`export-progress-close`,children:`Close`})]})]})})}t.ComponentRegistry.register(`combobox`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(qo,{options:e.options||[],placeholder:e.placeholder,value:e.value,disabled:e.disabled,className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i})},{namespace:`ui`,label:`Combobox`,inputs:[{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`value`,type:`string`,label:`Value`},{name:`disabled`,type:`boolean`,label:`Disabled`,defaultValue:!1},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{placeholder:`Select option...`,options:[]}}),t.ComponentRegistry.register(`command`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsxs)(Mt,{className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:[(0,o.jsx)(Pt,{placeholder:e.placeholder||`Type a command or search...`}),(0,o.jsxs)(Ft,{children:[(0,o.jsx)(It,{children:e.emptyText||`No results found.`}),e.groups?.map((e,t)=>(0,o.jsx)(Lt,{heading:e.heading,children:e.items?.map((e,t)=>(0,o.jsx)(zt,{value:e.value,children:e.label},t))},t))]})]})},{namespace:`ui`,label:`Command`,inputs:[{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`emptyText`,type:`string`,label:`Empty Text`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{placeholder:`Type a command or search...`,emptyText:`No results found.`,groups:[]}});var Cc=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let{"data-obj-id":i,"data-obj-type":a,style:s,...c}=n,l=e.clickable||!!n.onClick;return(0,o.jsxs)(Xe,{ref:r,className:U(t,(e.hoverable||l)&&`transition-colors hover:bg-muted/50`,l&&`cursor-pointer active:bg-muted`),...c,"data-obj-id":i,"data-obj-type":a,style:s,children:[(e.title||e.description||e.header)&&(0,o.jsxs)(Ze,{children:[e.title&&(0,o.jsx)(Qe,{children:e.title}),e.description&&(0,o.jsx)($e,{children:e.description}),e.header&&W(e.header)]}),(e.children||e.body)&&(0,o.jsx)(et,{children:W(e.children||e.body)}),e.footer&&(0,o.jsx)(J,{className:`flex justify-between`,children:W(e.footer)})]})});t.ComponentRegistry.register(`card`,Cc,{namespace:`ui`,label:`Card`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Card Title`,description:`Card description goes here`,className:`w-full`},isContainer:!0,resizable:!0,resizeConstraints:{width:!0,height:!0,minWidth:200,minHeight:100}}),t.ComponentRegistry.register(`tabs`,({schema:e,className:t,onChange:n,value:r,...i})=>{let{"data-obj-id":a,"data-obj-type":s,style:c,...l}=i,u=e=>{n&&n(e)},d=e.orientation===`vertical`;return(0,o.jsxs)(Ji,{defaultValue:r===void 0?e.defaultValue:void 0,value:r??e.value,onValueChange:u,orientation:e.orientation||`horizontal`,className:U(t,d&&`flex gap-2`),...l,"data-obj-id":a,"data-obj-type":s,style:c,children:[(0,o.jsx)(Yi,{className:U(d&&`flex-col h-auto items-stretch bg-muted/50 p-1`),children:e.items?.map(e=>(0,o.jsx)(Xi,{value:e.value,disabled:e.disabled,className:U(d&&`justify-start`),children:e.label},e.value))}),e.items?.map(e=>(0,o.jsx)(Zi,{value:e.value,className:U(`mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,d&&`mt-0 flex-1`),children:W(e.content||e.body)},e.value))]})},{namespace:`ui`,label:`Tabs`,inputs:[{name:`defaultValue`,type:`string`,label:`Default Value`,required:!0},{name:`className`,type:`string`,label:`CSS Class`},{name:`items`,type:`array`,label:`Items`}],defaultProps:{defaultValue:`tab1`,items:[{label:`Tab 1`,value:`tab1`,body:[{type:`text`,content:`Content for Tab 1`}]},{label:`Tab 2`,value:`tab2`,body:[{type:`text`,content:`Content for Tab 2`}]},{label:`Tab 3`,value:`tab3`,body:[{type:`text`,content:`Content for Tab 3`}]}],className:`w-full`}});var wc={1:`grid-cols-1`,2:`grid-cols-2`,3:`grid-cols-3`,4:`grid-cols-4`,5:`grid-cols-5`,6:`grid-cols-6`,7:`grid-cols-7`,8:`grid-cols-8`,9:`grid-cols-9`,10:`grid-cols-10`,11:`grid-cols-11`,12:`grid-cols-12`},Tc={1:`sm:grid-cols-1`,2:`sm:grid-cols-2`,3:`sm:grid-cols-3`,4:`sm:grid-cols-4`,5:`sm:grid-cols-5`,6:`sm:grid-cols-6`,7:`sm:grid-cols-7`,8:`sm:grid-cols-8`,9:`sm:grid-cols-9`,10:`sm:grid-cols-10`,11:`sm:grid-cols-11`,12:`sm:grid-cols-12`},Ec={1:`md:grid-cols-1`,2:`md:grid-cols-2`,3:`md:grid-cols-3`,4:`md:grid-cols-4`,5:`md:grid-cols-5`,6:`md:grid-cols-6`,7:`md:grid-cols-7`,8:`md:grid-cols-8`,9:`md:grid-cols-9`,10:`md:grid-cols-10`,11:`md:grid-cols-11`,12:`md:grid-cols-12`},Dc={1:`lg:grid-cols-1`,2:`lg:grid-cols-2`,3:`lg:grid-cols-3`,4:`lg:grid-cols-4`,5:`lg:grid-cols-5`,6:`lg:grid-cols-6`,7:`lg:grid-cols-7`,8:`lg:grid-cols-8`,9:`lg:grid-cols-9`,10:`lg:grid-cols-10`,11:`lg:grid-cols-11`,12:`lg:grid-cols-12`},Oc={1:`xl:grid-cols-1`,2:`xl:grid-cols-2`,3:`xl:grid-cols-3`,4:`xl:grid-cols-4`,5:`xl:grid-cols-5`,6:`xl:grid-cols-6`,7:`xl:grid-cols-7`,8:`xl:grid-cols-8`,9:`xl:grid-cols-9`,10:`xl:grid-cols-10`,11:`xl:grid-cols-11`,12:`xl:grid-cols-12`},kc={0:`gap-0`,1:`gap-1`,2:`gap-2`,3:`gap-3`,4:`gap-4`,5:`gap-5`,6:`gap-6`,8:`gap-8`,10:`gap-10`,12:`gap-12`};t.ComponentRegistry.register(`grid`,({schema:e,className:t,...n})=>{let r=2,i,a,s,c;typeof e.columns==`number`?r=e.columns:typeof e.columns==`object`&&e.columns!==null&&(r=e.columns.xs??1,i=e.columns.sm,a=e.columns.md,s=e.columns.lg,c=e.columns.xl),e.smColumns&&(i=e.smColumns),e.mdColumns&&(a=e.mdColumns),e.lgColumns&&(s=e.lgColumns),e.xlColumns&&(c=e.xlColumns),typeof e.columns==`number`&&r>1&&i===void 0&&a===void 0&&s===void 0&&c===void 0&&(a=r,i=Math.min(2,r),r=1);let l=e.gap??4,u=U(`grid`,wc[r]||`grid-cols-2`,i&&Tc[i],a&&Ec[a],s&&Dc[s],c&&Oc[c],kc[l]||`gap-[${l*.25}rem]`,t),{"data-obj-id":d,"data-obj-type":f,style:p,...m}=n;return(0,o.jsx)(`div`,{className:u,...m,"data-obj-id":d,"data-obj-type":f,style:p,children:e.children&&W(e.children)})},{namespace:`ui`,label:`Grid Layout`,inputs:[{name:`columns`,type:`number`,label:`Base Columns (Mobile)`,defaultValue:2,description:`Number of columns on mobile devices`},{name:`smColumns`,type:`number`,label:`SM Columns (Tablet)`,description:`Columns at sm breakpoint (>640px)`},{name:`mdColumns`,type:`number`,label:`MD Columns (Laptop)`,description:`Columns at md breakpoint (>768px)`},{name:`lgColumns`,type:`number`,label:`LG Columns (Desktop)`,description:`Columns at lg breakpoint (>1024px)`},{name:`xlColumns`,type:`number`,label:`XL Columns (Wide)`,description:`Columns at xl breakpoint (>1280px)`},{name:`gap`,type:`number`,label:`Gap`,defaultValue:4,description:`Gap between items (0-12)`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{columns:1,mdColumns:2,lgColumns:4,gap:4,children:[{type:`card`,title:`Card 1`,description:`First card`},{type:`card`,title:`Card 2`,description:`Second card`},{type:`card`,title:`Card 3`,description:`Third card`},{type:`card`,title:`Card 4`,description:`Fourth card`}]},isContainer:!0,resizable:!0,resizeConstraints:{width:!0,height:!0,minWidth:200,minHeight:100}}),t.ComponentRegistry.register(`flex`,({schema:e,className:t,...n})=>{let r=e.direction||`row`,i=e.justify||`start`,a=e.align||`start`,s=e.gap||2,c=e.wrap||!1,l=U(`flex`,r===`row`&&`flex-row`,r===`col`&&`flex-col`,r===`row-reverse`&&`flex-row-reverse`,r===`col-reverse`&&`flex-col-reverse`,i===`start`&&`justify-start`,i===`end`&&`justify-end`,i===`center`&&`justify-center`,i===`between`&&`justify-between`,i===`around`&&`justify-around`,i===`evenly`&&`justify-evenly`,a===`start`&&`items-start`,a===`end`&&`items-end`,a===`center`&&`items-center`,a===`baseline`&&`items-baseline`,a===`stretch`&&`items-stretch`,s===0&&`gap-0`,s===1&&`gap-1`,s===2&&`gap-1.5 sm:gap-2`,s===3&&`gap-2 sm:gap-3`,s===4&&`gap-2 sm:gap-3 md:gap-4`,s===5&&`gap-3 sm:gap-4 md:gap-5`,s===6&&`gap-3 sm:gap-4 md:gap-6`,s===7&&`gap-4 sm:gap-5 md:gap-7`,s===8&&`gap-4 sm:gap-6 md:gap-8`,c&&`flex-wrap`,t),{"data-obj-id":u,"data-obj-type":d,style:f,...p}=n;return(0,o.jsx)(`div`,{className:l,...p,"data-obj-id":u,"data-obj-type":d,style:f,children:e.children&&W(e.children)})},{namespace:`ui`,label:`Flex Layout`,inputs:[{name:`direction`,type:`enum`,enum:[`row`,`col`,`row-reverse`,`col-reverse`],label:`Direction`,defaultValue:`row`},{name:`justify`,type:`enum`,enum:[`start`,`end`,`center`,`between`,`around`,`evenly`],label:`Justify Content`,defaultValue:`start`},{name:`align`,type:`enum`,enum:[`start`,`end`,`center`,`baseline`,`stretch`],label:`Align Items`,defaultValue:`start`},{name:`gap`,type:`number`,label:`Gap`,defaultValue:2,description:`Gap between items (0-8)`},{name:`wrap`,type:`boolean`,label:`Wrap`,defaultValue:!1,description:`Allow flex items to wrap`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{direction:`row`,justify:`start`,align:`center`,gap:2,wrap:!1,children:[{type:`button`,label:`Button 1`},{type:`button`,label:`Button 2`},{type:`button`,label:`Button 3`}]}});var Ac=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let i=e.direction||`col`,a=e.justify||`start`,s=e.align||`stretch`,c=e.gap??e.spacing??2,l=e.wrap||!1,u=U(`flex`,i===`row`&&`flex-row`,i===`col`&&`flex-col`,i===`row-reverse`&&`flex-row-reverse`,i===`col-reverse`&&`flex-col-reverse`,a===`start`&&`justify-start`,a===`end`&&`justify-end`,a===`center`&&`justify-center`,a===`between`&&`justify-between`,a===`around`&&`justify-around`,a===`evenly`&&`justify-evenly`,s===`start`&&`items-start`,s===`end`&&`items-end`,s===`center`&&`items-center`,s===`baseline`&&`items-baseline`,s===`stretch`&&`items-stretch`,c===0&&`gap-0`,c===1&&`gap-1`,c===2&&`gap-1.5 sm:gap-2`,c===3&&`gap-2 sm:gap-3`,c===4&&`gap-2 sm:gap-3 md:gap-4`,c===5&&`gap-3 sm:gap-4 md:gap-5`,c===6&&`gap-3 sm:gap-4 md:gap-6`,c===8&&`gap-4 sm:gap-6 md:gap-8`,c===10&&`gap-5 sm:gap-7 md:gap-10`,l&&`flex-wrap`,t),{"data-obj-id":d,"data-obj-type":f,style:p,...m}=n;return(0,o.jsx)(`div`,{ref:r,className:u,...m,"data-obj-id":d,"data-obj-type":f,style:p,children:e.children&&W(e.children)})});t.ComponentRegistry.register(`stack`,Ac,{namespace:`ui`,label:`Stack`,inputs:[{name:`direction`,type:`enum`,label:`Direction`,enum:[`col`,`row`,`col-reverse`,`row-reverse`],defaultValue:`col`},{name:`gap`,type:`number`,label:`Gap`,defaultValue:2},{name:`align`,type:`enum`,label:`Align Items`,enum:[`start`,`end`,`center`,`stretch`,`baseline`],defaultValue:`stretch`},{name:`justify`,type:`enum`,label:`Justify Content`,enum:[`start`,`end`,`center`,`between`,`around`,`evenly`],defaultValue:`start`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{direction:`col`,gap:2,align:`stretch`,children:[]},isContainer:!0,resizable:!0,resizeConstraints:{width:!0,height:!0,minWidth:100,minHeight:50}});var jc=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let i=e.maxWidth||`xl`,a=e.padding||4,s=e.centered!==!1,c=U(`w-full`,i===`sm`&&`max-w-sm`,i===`md`&&`max-w-md`,i===`lg`&&`max-w-lg`,i===`xl`&&`max-w-xl`,i===`2xl`&&`max-w-2xl`,i===`3xl`&&`max-w-3xl`,i===`4xl`&&`max-w-4xl`,i===`5xl`&&`max-w-5xl`,i===`6xl`&&`max-w-6xl`,i===`7xl`&&`max-w-7xl`,i===`full`&&`max-w-full`,i===`screen`&&`max-w-screen-2xl`,s&&`mx-auto`,a===0&&`p-0`,a===1&&`p-0.5 sm:p-1`,a===2&&`p-1 sm:p-2`,a===3&&`p-2 sm:p-3`,a===4&&`p-2 sm:p-3 md:p-4`,a===5&&`p-3 sm:p-4 md:p-5`,a===6&&`p-3 sm:p-4 md:p-6`,a===7&&`p-4 sm:p-5 md:p-7`,a===8&&`p-4 sm:p-6 md:p-8`,a===10&&`p-5 sm:p-7 md:p-10`,a===12&&`p-6 sm:p-8 md:p-12`,a===16&&`p-8 sm:p-10 md:p-16`,t),{"data-obj-id":l,"data-obj-type":u,style:d,...f}=n;return(0,o.jsx)(`div`,{ref:r,className:c,...f,"data-obj-id":l,"data-obj-type":u,style:d,children:e.children&&W(e.children)})});t.ComponentRegistry.register(`container`,jc,{namespace:`ui`,label:`Container`,inputs:[{name:`maxWidth`,type:`enum`,enum:[`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`,`7xl`,`full`,`screen`],label:`Max Width`,defaultValue:`xl`},{name:`padding`,type:`number`,label:`Padding`,defaultValue:4,description:`Padding value (0, 1-8, 10, 12, 16)`},{name:`centered`,type:`boolean`,label:`Center Horizontally`,defaultValue:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{maxWidth:`xl`,padding:4,centered:!0,children:[{type:`text`,content:`Container content goes here`}]},isContainer:!0,resizable:!0,resizeConstraints:{width:!0,height:!0,minWidth:200,minHeight:100}});function Mc(e){return e.split(/[-_:]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}function Nc(e){let n={},r=new Set;for(let o of t.ComponentRegistry.getPublicConfigs()){let t=o.type;if(!t||o.isContainer)continue;let s=Mc(t);if(r.has(s))continue;r.add(s);let c=({children:n,...r})=>{let o=typeof r.type==`string`&&r.type!==t?r.type:void 0;return a.createElement(i.SchemaRenderer,{schema:{dataSource:e,...r,...o?{specType:o}:{},type:t}})};c.displayName=s,n[s]=c}let o=({type:t,children:n,...r})=>a.createElement(i.SchemaRenderer,{schema:{type:t,dataSource:e,...r}});return o.displayName=`Block`,n.Block=o,n}var Pc={};function Fc(){return(0,o.jsxs)(`div`,{className:`m-4 rounded-md border border-amber-400/40 bg-amber-50 p-4 text-sm text-amber-900 dark:bg-amber-950/30 dark:text-amber-200`,children:[(0,o.jsx)(`div`,{className:`font-semibold`,children:`React pages are disabled on this deployment`}),(0,o.jsxs)(`p`,{className:`mt-1 leading-relaxed`,children:[(0,o.jsx)(`code`,{children:`kind:'react'`}),` pages execute author JavaScript directly in the application. This deployment has turned the capability off (`,(0,o.jsx)(`code`,{children:`OS_PAGE_REACT=off`}),` / `,(0,o.jsx)(`code`,{children:`disableCapability('react-pages')`}),`). It is ON by default; re-enable it if your page authors are trusted.`]})]})}var Ic=({schema:e})=>{let n=typeof e?.source==`string`?e.source:``,r=(0,i.useAdapter)(),s=(0,t.isCapabilityEnabled)(t.CAP_REACT_PAGES),[c,l]=a.useState(null),[u,d]=a.useState(null);a.useEffect(()=>{if(!s)return;let e=!0;return import(`@object-ui/react-runtime`).then(t=>e&&l(t)).catch(t=>e&&d(t)),()=>{e=!1}},[s]);let f=a.useMemo(()=>({...Nc(r),useAdapter:i.useAdapter,data:e?.data??e?.variables??{},variables:e?.variables??{},page:e??{}}),[e,r]);if(!s)return(0,o.jsx)(Fc,{});if(u)return(0,o.jsxs)(`div`,{className:`m-4 rounded-md border border-destructive/40 bg-destructive/10 p-4 text-sm text-destructive`,children:[(0,o.jsx)(`div`,{className:`font-semibold`,children:`Failed to load the react runtime`}),(0,o.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap`,children:String(u)})]});if(!n.trim())return(0,o.jsxs)(`div`,{className:`m-4 rounded-md border border-destructive/40 bg-destructive/10 p-4 text-sm text-destructive`,children:[`A `,(0,o.jsx)(`code`,{children:`kind:'react'`}),` page requires a non-empty `,(0,o.jsx)(`code`,{children:`source`}),`.`]});if(!c)return(0,o.jsx)(`div`,{className:`m-4 text-sm text-muted-foreground`,children:`Loading react runtime…`});let{ReactRunner:p}=c;return(0,o.jsx)(i.SchemaRendererProvider,{dataSource:r??Pc,children:(0,o.jsx)(p,{code:n,scope:f,fallback:e=>(0,o.jsxs)(`div`,{className:`m-4 rounded-md border border-destructive/40 bg-destructive/10 p-4 text-sm text-destructive`,children:[(0,o.jsx)(`div`,{className:`font-semibold`,children:`React page error`}),(0,o.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap`,children:String(e)})]})})})};function Lc(e){switch(e){case`small`:return`w-64`;case`medium`:return`w-80`;case`large`:return`w-96`;case`full`:return`w-full`;default:return e||`w-full`}}function Rc(e){switch(e){case`small`:return`w-full md:w-64`;case`medium`:return`w-full md:w-80`;case`large`:return`w-full md:w-96`;default:return`w-full`}}function zc(e){switch(e){case`utility`:return`max-w-4xl`;case`home`:return`max-w-screen-2xl`;case`app`:return`max-w-screen-xl`;default:return`max-w-7xl`}}function Bc(e,t){return e?.find(e=>e.name?.toLowerCase()===t.toLowerCase())}function Vc(e,t){if(!e)return[];let n=new Set(t.map(e=>e.toLowerCase()));return e.filter(e=>!n.has(e.name?.toLowerCase()??``))}var $=({region:e,className:t})=>{let n=e.components||[];return n.length===0?null:(0,o.jsx)(`div`,{className:U(`space-y-4`,e.className,t),"data-region":e.name,children:n.map((t,n)=>(0,o.jsx)(i.SchemaRenderer,{schema:t},t?.id||`${e.name}-${n}`))})},Hc=({regions:e,pageType:t,className:n})=>{let r=Bc(e,`header`),i=Bc(e,`sidebar`),a=Bc(e,`main`),s=Bc(e,`aside`),c=Bc(e,`footer`),l=Vc(e,[`header`,`sidebar`,`main`,`aside`,`footer`]);return r||i||a||s||c?(0,o.jsxs)(`div`,{className:U(`flex flex-col gap-6`,n),"data-page-layout":t,children:[r&&(0,o.jsx)($,{region:r,className:U(Lc(r.width))}),(0,o.jsxs)(`div`,{className:`flex flex-col md:flex-row flex-1 gap-6`,children:[i&&(0,o.jsx)(`aside`,{className:U(`md:shrink-0`,Rc(i.width||`small`)),children:(0,o.jsx)($,{region:i})}),(0,o.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-6`,children:[a&&(0,o.jsx)($,{region:a}),l.map((e,t)=>(0,o.jsx)($,{region:e},e.name||`extra-${t}`))]}),s&&(0,o.jsx)(`aside`,{className:U(`md:shrink-0`,Rc(s.width||`small`),s.className),children:(0,o.jsx)($,{region:s})})]}),c&&(0,o.jsx)($,{region:c,className:U(Lc(c.width))})]}):(0,o.jsx)(`div`,{className:U(`space-y-6`,n),"data-page-layout":t,children:e.map((e,t)=>(0,o.jsx)($,{region:e},e.name||t))})},Uc=({schema:e})=>{let t=e.body||e.children,n=Array.isArray(t)?t:t?[t]:[];return n.length===0?null:(0,o.jsx)(`div`,{className:`space-y-6`,children:n.map((e,t)=>(0,o.jsx)(i.SchemaRenderer,{schema:e},e?.id||t))})},Wc=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)(Hc,{regions:e.regions,pageType:e.pageType}):(0,o.jsx)(Uc,{schema:e}),Gc={default:Wc,"full-width":Wc,"header-sidebar-main":({schema:e})=>{let t=e.regions||[];if(t.length===0)return(0,o.jsx)(Uc,{schema:e});let n=Bc(t,`header`),r=Bc(t,`sidebar`),i=Bc(t,`main`),a=Vc(t,[`header`,`sidebar`,`main`]);return(0,o.jsxs)(`div`,{className:`flex flex-col gap-6`,"data-template":`header-sidebar-main`,children:[n&&(0,o.jsx)($,{region:n}),(0,o.jsxs)(`div`,{className:`flex flex-col md:flex-row flex-1 gap-6`,children:[r&&(0,o.jsx)(`aside`,{className:U(`md:shrink-0`,Rc(r.width||`medium`)),children:(0,o.jsx)($,{region:r})}),(0,o.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-6`,children:[i&&(0,o.jsx)($,{region:i}),a.map((e,t)=>(0,o.jsx)($,{region:e},e.name||`extra-${t}`))]})]})]})},"three-column":({schema:e})=>{let t=e.regions||[];if(t.length===0)return(0,o.jsx)(Uc,{schema:e});let n=Bc(t,`header`),r=Bc(t,`sidebar`),i=Bc(t,`main`),a=Bc(t,`aside`),s=Bc(t,`footer`),c=Vc(t,[`header`,`sidebar`,`main`,`aside`,`footer`]);return(0,o.jsxs)(`div`,{className:`flex flex-col gap-6`,"data-template":`three-column`,children:[n&&(0,o.jsx)($,{region:n}),(0,o.jsxs)(`div`,{className:`flex flex-col md:flex-row flex-1 gap-6`,children:[r&&(0,o.jsx)(`aside`,{className:U(`md:shrink-0`,Rc(r.width||`small`)),children:(0,o.jsx)($,{region:r})}),(0,o.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-6`,children:[i&&(0,o.jsx)($,{region:i}),c.map((e,t)=>(0,o.jsx)($,{region:e},e.name||`extra-${t}`))]}),a&&(0,o.jsx)(`aside`,{className:U(`md:shrink-0`,Rc(a.width||`small`),a.className),children:(0,o.jsx)($,{region:a})})]}),s&&(0,o.jsx)($,{region:s})]})},dashboard:({schema:e})=>{let t=e.regions||[];if(t.length===0)return(0,o.jsx)(Uc,{schema:e});let n=Bc(t,`header`),r=Bc(t,`footer`),i=Vc(t,[`header`,`footer`]);return(0,o.jsxs)(`div`,{className:`flex flex-col gap-6`,"data-template":`dashboard`,children:[n&&(0,o.jsx)($,{region:n}),(0,o.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:i.map((e,t)=>(0,o.jsx)($,{region:e},e.name||`region-${t}`))}),r&&(0,o.jsx)($,{region:r})]})}};function Kc(e){return e.template&&Gc[e.template]||null}var qc=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)(Hc,{regions:e.regions,pageType:`record`}):(0,o.jsx)(Uc,{schema:e}),Jc=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)(Hc,{regions:e.regions,pageType:`home`}):(0,o.jsx)(Uc,{schema:e}),Yc=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)(Hc,{regions:e.regions,pageType:`app`}):(0,o.jsx)(Uc,{schema:e}),Xc=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)(Hc,{regions:e.regions,pageType:`utility`}):(0,o.jsx)(Uc,{schema:e}),Zc=-1,Qc=null;function $c(){let e=t.ComponentRegistry.getVersion();return(Qc===null||Zc!==e)&&(Qc=(0,oe.manifestFromConfigs)(t.ComponentRegistry.getKnownTypes().map(e=>{let n=t.ComponentRegistry.getMeta(e);return{type:e,namespace:n?.namespace,isContainer:n?.isContainer,inputs:n?.inputs}})),Zc=e),Qc}var el=({schema:e,className:n,...r})=>{let s=e.pageType||`record`,[c,l]=a.default.useReducer(e=>e+1,0);a.default.useEffect(()=>t.ComponentRegistry.subscribe(l),[]);let u=e.title??e.label,{"data-obj-id":d,"data-obj-type":f,style:p,pageType:m,schema:h,regions:g,template:_,title:v,icon:y,description:b,object:x,variables:S,body:C,isDefault:w,assignedProfiles:T,aria:E,recordOverride:D,permissions:O,requiredPermissions:k,enforceFieldSecurity:A,redactFields:j,children:M,...N}=r,P=Object.fromEntries(Object.entries(N).filter(([e])=>!e.startsWith(`_`))),F=(0,a.useMemo)(()=>{let t=e.kind;if(t===`react`)return(0,o.jsx)(Ic,{schema:e});if(t===`html`||t===`jsx`){let{tree:t,diagnostics:n}=(0,oe.compile)(e.source??``,$c()),r=n.filter(e=>e.severity===`error`);return r.length?(0,o.jsxs)(`div`,{className:`m-4 rounded-md border border-destructive/40 bg-destructive/10 p-4 text-sm text-destructive`,children:[(0,o.jsxs)(`div`,{className:`font-semibold`,children:[`HTML page failed to compile (`,r.length,`)`]}),(0,o.jsx)(`ul`,{className:`mt-1 list-disc space-y-0.5 pl-5`,children:r.slice(0,8).map((e,t)=>(0,o.jsx)(`li`,{children:e.message},t))})]}):t?(0,o.jsx)(i.SchemaRenderer,{schema:t}):null}let n=Kc(e);if(n)return(0,o.jsx)(n,{schema:e});switch(s){case`home`:return(0,o.jsx)(Jc,{schema:e});case`app`:return(0,o.jsx)(Yc,{schema:e});case`utility`:return(0,o.jsx)(Xc,{schema:e});default:return(0,o.jsx)(qc,{schema:e})}},[e,s,c]),I=(e.regions??[]).some(e=>e.name?.toLowerCase()===`main`&&e.width===`full`),ee=I?`max-w-none`:zc(s),te=(0,o.jsx)(`div`,{className:U(`min-h-full w-full bg-background p-3 md:p-4 lg:p-6`,n),"data-page-type":s,"data-obj-id":d,"data-obj-type":f,style:p,...P,children:(0,o.jsxs)(`div`,{className:U(I?`space-y-6`:`mx-auto space-y-6`,ee),children:[s!==`record`&&(u||e.description)&&(0,o.jsxs)(`div`,{className:`space-y-2`,children:[u&&(0,o.jsx)(`h1`,{className:`text-3xl font-bold tracking-tight text-foreground`,children:u}),e.description&&(0,o.jsx)(`p`,{className:`text-muted-foreground`,children:e.description})]}),F]})});return e.variables&&e.variables.length>0?(0,o.jsxs)(i.PageVariablesProvider,{definitions:e.variables,children:[(0,o.jsx)(i.PageVariableActionBridge,{}),te]}):te},tl={namespace:`ui`,label:`Page`,icon:`Layout`,category:`layout`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`pageType`,type:`string`,label:`Page Type`},{name:`object`,type:`string`,label:`Object Name`},{name:`template`,type:`string`,label:`Template`},{name:`regions`,type:`array`,label:`Regions`,itemType:`object`},{name:`variables`,type:`array`,label:`Variables`,itemType:`object`},{name:`body`,type:`array`,label:`Content (Legacy)`,itemType:`component`}]};t.ComponentRegistry.register(`page`,el,tl),t.ComponentRegistry.register(`app`,el,{...tl,label:`App Page`}),t.ComponentRegistry.register(`utility`,el,{...tl,label:`Utility Page`}),t.ComponentRegistry.register(`home`,el,{...tl,label:`Home Page`}),t.ComponentRegistry.register(`record`,el,{...tl,label:`Record Page`});var nl=new Map,rl=new Map,il=new Set,al=0;function ol(e,t,n){return`${e}::${t??``}::${n??``}`}function sl(){al+=1;for(let e of il)e()}function cl(e,t,n){return nl.get(ol(e,t,n))}function ll(e,t,n,r){let i=ol(e,t,n);nl.get(i)!==r&&(nl.set(i,r),sl())}async function ul(e,t,n,r){let i=ol(t,n,r),a=nl.get(i);if(a!==void 0)return a;let o=rl.get(i);if(o)return o;let s=(async()=>{let a={};if(n){if(!r)return 0;a[n]=r}try{let i=await e(t,{$filter:a,$top:1,$count:!0}),o=typeof i?.total==`number`?i.total:typeof i?.count==`number`?i.count:Array.isArray(i?.records)?i.records.length:Array.isArray(i?.data)?i.data.length:Array.isArray(i)?i.length:0,s=typeof o==`number`?o:0;return ll(t,n,r,s),s}catch{return 0}finally{rl.delete(i)}})();return rl.set(i,s),s}function dl(e,t){let n=!1,r=`${e}::`;for(let e of nl.keys())e.startsWith(r)&&(t!==void 0&&!e.endsWith(`::${t}`)||(nl.delete(e),n=!0));n&&sl()}function fl(){nl.size!==0&&(nl.clear(),sl())}function pl(e){return il.add(e),()=>{il.delete(e)}}function ml(){return al}function hl(e,t,n){if((0,a.useSyncExternalStore)(pl,ml,ml),e)return cl(e,t,n)}function gl(){return(0,a.useSyncExternalStore)(pl,ml,ml)}var _l={get:cl,set:ll,fetch:ul,invalidate:dl,invalidateAll:fl,_reset:()=>{nl.clear(),rl.clear(),sl()}};(0,i.subscribeDataChanges)(e=>{e.objectName===`*`?_l.invalidateAll():_l.invalidate(e.objectName)});var vl=e=>{let{"data-obj-id":t,"data-obj-type":n,style:r,...i}=e||{};return{designer:{"data-obj-id":t,"data-obj-type":n,style:r},rest:i}},yl=e=>e==null?``:typeof e==`string`?e:typeof e==`object`?e.default||e.value||``:String(e),bl={"zh-CN":{Details:`详情`,Related:`相关`,Activity:`活动`,History:`历史`,Notes:`备注`,Files:`文件`,Tasks:`任务`,"Open Tasks":`待办任务`,"Closed Tasks":`已完成任务`,Events:`日程`,Attachments:`附件`,Chatter:`讨论`,Discussion:`讨论`,Comments:`评论`,Overview:`概览`,Summary:`摘要`,Quotes:`报价单`,Products:`产品`,Contacts:`联系人`,Accounts:`客户`,Leads:`线索`,Opportunities:`商机`,Cases:`服务案例`,Campaigns:`营销活动`,Approvals:`审批`,Documents:`文档`,Emails:`邮件`,Calls:`通话`,Meetings:`会议`},"zh-TW":{Details:`詳情`,Related:`相關`,Activity:`活動`,History:`歷史`,Notes:`備註`,Files:`檔案`,Tasks:`任務`,"Open Tasks":`待辦任務`,"Closed Tasks":`已完成任務`,Events:`行程`,Attachments:`附件`,Chatter:`討論`,Discussion:`討論`,Comments:`評論`,Overview:`概覽`,Summary:`摘要`,Quotes:`報價單`,Products:`產品`,Contacts:`聯絡人`,Accounts:`客戶`,Leads:`線索`,Opportunities:`商機`,Cases:`服務案例`,Campaigns:`行銷活動`,Approvals:`審批`,Documents:`文件`,Emails:`郵件`,Calls:`通話`,Meetings:`會議`}},xl=(e,t)=>{if(!e)return e;let n=bl[t],r=t.split(`-`)[0]===`zh`?bl[`zh-CN`]:void 0,i=n||r;if(!i)return e;if(i[e]!==void 0)return i[e];let a=/\s*(?:&|and|和)\s*/i;if(a.test(e)){let n=e.split(a);if(n.every(e=>i[e.trim()]!==void 0)){let e=t.startsWith(`zh`)?`与`:` & `;return n.map(e=>i[e.trim()]).join(e)}}return e},Sl=(e,t,n,r,i)=>!e||typeof e!=`string`?e||``:e.includes(`{`)?e.replace(/\{([a-zA-Z0-9_.]+)\}/g,(e,a)=>{let o=a.split(`.`).reduce((e,t)=>e==null?e:e[t],t);if(o==null||typeof o==`object`)return``;let s=String(o);if(n?.fields&&r&&i&&!a.includes(`.`)){let e=(Array.isArray(n.fields)?n.fields.find(e=>e?.name===a):n.fields[a])?.options;if(Array.isArray(e)){let t=e.find(e=>String(e?.value??e)===s);return r(i,a,s,t?.label?String(t.label):s)}}return s}).replace(/\s+/g,` `).trim():e,Cl=e=>{let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t>=1e4?`${Math.round(t/1e3)}k`:t>=1e3?`${(t/1e3).toFixed(1).replace(/\.0$/,``)}k`:String(t):String(e)},wl=(e,t=[])=>{if(!e)return t;let n=Array.isArray(e)?e:[e];for(let e of n){if(!e||typeof e!=`object`)continue;if(e.type===`record:related_list`||e.type===`record_related_list`){t.push(e);continue}let n=[e.children,e.properties?.children,e.properties?.items,e.body,e.items];for(let e of n)e&&wl(e,t)}return t},Tl=e=>{if(!e)return!1;let t=Array.isArray(e)?e:[e];for(let e of t){if(!e||typeof e!=`object`)continue;if(e.type===`record:attachments`)return!0;let t=[e.children,e.properties?.children,e.properties?.items,e.body,e.items];for(let e of t)if(e&&Tl(e))return!0}return!1};t.ComponentRegistry.register(`tabs`,({schema:e,className:n,...r})=>{let{designer:s}=vl(r),{language:c}=(0,B.useObjectTranslation)(),l=e?.items||[],u=e?.properties?.type||e?.tabStyle||`line`,d=(e?.position||`top`)===`left`,f=(0,i.useRecordContext)(),p=f?.data?.id,m=f?.dataSource,h=(0,i.usePredicateScope)(),{variables:g}=(0,i.usePageVariables)(),_=f?.data,v=l.map(e=>e?.visibleWhen===void 0||e?.visibleWhen===null||new t.ExpressionEvaluator({..._&&typeof _==`object`?_:{},...h,current_user:h?.user,record:_,data:_,page:g}).evaluateCondition(e.visibleWhen)),y=v.join(`,`),b=a.default.useMemo(()=>l.filter((e,t)=>v[t]),[l,y]),x=gl(),S=f?.objectName,C=a.default.useMemo(()=>{let e=new Map;return b.forEach((t,n)=>{if(t.count!==void 0&&t.count!==null&&t.count!==``)return;let r=wl(t.children),i=[];for(let e of r){let t=e?.properties?.objectName||e?.objectName;if(!t)continue;let n=e?.properties?.relationshipField||e?.relationshipField;i.push({objectName:t,relationshipField:n})}S&&Tl(t.children)&&i.push({objectName:`sys_attachment`,relationshipField:`attachments:${S}`,attachments:!0}),i.length>0&&e.set(n,i)}),e},[b,S]);a.default.useEffect(()=>{if(!m||typeof m.find!=`function`||C.size===0)return;let e=!1;for(let t of C.values())for(let n of t){let t=n.attachments?(e,t)=>m.find(e,{...t,$filter:{parent_object:S,parent_id:p}}):(e,t)=>m.find(e,t);if(_l.fetch(t,n.objectName,n.relationshipField,p).catch(()=>0),e)return}return()=>{e=!0}},[m,C,p,x]);let w=e=>{let t=C.get(e);if(!t||t.length===0)return;let n=0,r=!1;for(let e of t){let t=_l.get(e.objectName,e.relationshipField,p);t!==void 0&&(n+=t,r=!0)}return r?n:void 0},T=b.map((e,t)=>({...e,value:typeof e.value==`string`&&e.value!==``?e.value:`tab-${t}`,labelStr:xl((0,B.pickLocalized)(e.label,c),c),count:e.count!==void 0&&e.count!==null&&e.count!==``?e.count:w(t)})),E=e?.defaultTab,D=(E&&T.some(e=>e.value===E)?E:void 0)??T[0]?.value,O=e?.onTabChange,[k,A]=a.default.useState(D),j=(k&&T.some(e=>e.value===k)?k:void 0)??T[0]?.value??``,M=U(d&&`flex-col h-auto items-stretch p-1`,u===`card`&&`bg-transparent gap-1`,u===`pill`&&`bg-muted rounded-full p-1 gap-1`,u===`line`&&!d&&`h-auto rounded-none bg-transparent p-0 gap-4 border-b border-border w-full justify-start`,!d&&`sticky top-0 z-20 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`),N=()=>U(d&&`justify-start`,u===`card`&&`data-[state=active]:bg-background data-[state=active]:border data-[state=active]:shadow-sm rounded-md`,u===`pill`&&`rounded-full data-[state=active]:bg-background`,u===`line`&&!d&&`rounded-none border-b-2 border-transparent bg-transparent px-1 pb-2.5 -mb-px shadow-none data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:shadow-none data-[state=active]:text-foreground`);return(0,o.jsxs)(Ji,{value:j,onValueChange:e=>{A(e),O?.(e)},orientation:d?`vertical`:`horizontal`,className:U(n,d&&`flex gap-4 w-full`),...s,children:[(T.length>1||e?.properties?.alwaysShowStrip===!0)&&(0,o.jsx)(Yi,{className:M,children:T.map(e=>(0,o.jsxs)(Xi,{value:e.value,className:N(),children:[e.icon&&(0,o.jsx)(ja,{name:e.icon,className:`mr-1.5 h-3.5 w-3.5 shrink-0 opacity-70`,"aria-hidden":!0}),(0,o.jsx)(`span`,{children:e.labelStr}),e.count!==void 0&&e.count!==null&&e.count!==``&&Number(e.count)>0&&(0,o.jsx)(`span`,{className:`ml-1.5 inline-flex h-4 min-w-[1rem] items-center justify-center rounded-full bg-muted px-1 text-[10px] font-medium leading-none text-muted-foreground`,"aria-label":`${Cl(e.count)} items`,children:Cl(e.count)})]},e.value))}),T.map(e=>(0,o.jsx)(Zi,{value:e.value,className:U(T.length>1?`mt-3`:`mt-0`,d&&`mt-0 flex-1`),children:W(e.children)},e.value))]})},{namespace:`page`,skipFallback:!0,label:`Page Tabs`,category:`layout`,isContainer:!0,inputs:[{name:`items`,type:`array`,label:`Tabs`,required:!0,description:`Tab definitions [{ label, value?, icon?, count?, visibleWhen?, children }] — value is the stable ?tab= URL token, count auto-derives from record:related_list descendants when omitted`},{name:`tabStyle`,type:`enum`,label:`Style`,enum:[`line`,`card`,`pill`],defaultValue:`line`},{name:`position`,type:`enum`,label:`Position`,enum:[`top`,`left`],defaultValue:`top`}]}),t.ComponentRegistry.register(`card`,({schema:e,className:t,...n})=>{let{designer:r}=vl(n),{language:i}=(0,B.useObjectTranslation)(),a=(0,B.pickLocalized)(e?.title,i),s=e?.bordered!==!1,c=e?.body??e?.children,l=e?.footer;return(0,o.jsxs)(Xe,{className:U(t,!s&&`border-0 shadow-none bg-transparent`),...r,children:[a&&(0,o.jsx)(Ze,{children:(0,o.jsx)(Qe,{children:a})}),c&&(0,o.jsx)(et,{children:W(c)}),l&&(0,o.jsx)(J,{className:`flex justify-between`,children:W(l)})]})},{namespace:`page`,skipFallback:!0,label:`Page Card`,category:`layout`,isContainer:!0,inputs:[{name:`title`,type:`string`,label:`Title`,description:`Accepts an inline translation map ({ en, "zh-CN", … })`},{name:`bordered`,type:`boolean`,label:`Bordered`,defaultValue:!0},{name:`body`,type:`slot`,label:`Body`,description:"Card content; plain `children` also render here"},{name:`footer`,type:`slot`,label:`Footer`}]}),t.ComponentRegistry.register(`accordion`,({schema:e,className:t,...n})=>{let{designer:r}=vl(n),{language:i}=(0,B.useObjectTranslation)(),a=e?.items||[],s=!!e?.allowMultiple,c=(e?.variant??e?.properties?.variant??`flush`)===`flush`?`border-b last:border-b-0`:void 0,l=a.map((e,t)=>({...e,value:`panel-${t}`,labelStr:xl((0,B.pickLocalized)(e.label,i),i)})),u=l.filter(e=>e.collapsed===!1).map(e=>e.value),d=l.map(e=>(0,o.jsxs)(ve,{value:e.value,className:c,children:[(0,o.jsx)(G,{className:`text-sm font-semibold tracking-tight hover:no-underline`,children:e.labelStr}),(0,o.jsx)(ye,{children:W(e.children)})]},e.value));return s?(0,o.jsx)(_e,{type:`multiple`,defaultValue:u,className:t,...r,children:d}):(0,o.jsx)(_e,{type:`single`,collapsible:!0,defaultValue:u[0],className:t,...r,children:d})},{namespace:`page`,skipFallback:!0,label:`Page Accordion`,category:`layout`,isContainer:!0,inputs:[{name:`items`,type:`array`,label:`Panels`,required:!0,description:`Panel definitions [{ label, collapsed?, children }] — collapsed: false opens a panel by default`},{name:`allowMultiple`,type:`boolean`,label:`Allow Multiple Open`,defaultValue:!1},{name:`variant`,type:`enum`,label:`Variant`,enum:[`flush`,`card`],defaultValue:`flush`}]}),t.ComponentRegistry.register(`section`,({schema:e,className:t,...n})=>{let{designer:r}=vl(n);return(0,o.jsx)(`section`,{className:U(`space-y-4`,t),...r,children:W(e?.children||e?.body)})},{namespace:`page`,skipFallback:!0,label:`Page Section`,category:`layout`,isContainer:!0});function El(e){if(!e)return e;let t=e;for(let e=0;e<4;e+=1){let e=t.replace(/[\s\u00A0]*[-·:|/–—][\s\u00A0]*$/u,``).trimEnd();if(e===t)break;t=e}for(let e=0;e<4;e+=1){let e=t.replace(/^[\s\u00A0]*[-·:|/–—][\s\u00A0]*/u,``).trimStart();if(e===t)break;t=e}return t=t.replace(/([-·:|/–—])[\s\u00A0]*\1/gu,`$1`),t=t.replace(/[\s\u00A0]+/g,` `).trim(),t}var Dl=new Set;function Ol(e,t,n){let r=`throw::${String(e)}::${t}`;if(Dl.has(r))return;Dl.add(r);let i=n instanceof Error?n.message:String(n);console.warn(`[page:header] action "${String(e)}" hidden: its predicate threw — ${i}. Predicate: ${t}. Header-action predicates evaluate against { record, user, os.user, ctx.user, app, features, <record fields> }.`)}function kl(e,t,n){if(!n||typeof n!=`object`||Object.keys(n).length===0)return;let r=/\brecord\.([A-Za-z_][A-Za-z0-9_]*)/g,i=[];for(let e=r.exec(t);e;e=r.exec(t))!(e[1]in n)&&!i.includes(e[1])&&i.push(e[1]);if(i.length===0)return;let a=`missing::${String(e)}::${t}`;Dl.has(a)||(Dl.add(a),console.warn(`[page:header] action "${String(e)}" predicate references record field(s) not present in the record payload: ${i.join(`, `)}. Predicate: ${t}. Hidden (hidden: true) fields are stripped from detail payloads server-side, so a predicate gating on one may evaluate to a hide-by-default verdict.`))}t.ComponentRegistry.register(`header`,({schema:e,className:n,...r})=>{let{designer:s}=vl(r),l=(0,i.useRecordContext)(),u=!!(0,i.useInlineEdit)()?.editing,d=(0,i.usePredicateScope)(),{execute:f}=(0,i.useAction)(),p=(0,i.useCapabilityGate)(),m=ei(),{objectLabel:h,actionLabel:g}=(0,B.useObjectLabel)(),{fieldOptionLabel:_}=(0,B.useSafeFieldLabel)(),{language:v}=(0,B.useObjectTranslation)(),y=e?.title??e?.properties?.title,b=e?.subtitle??e?.properties?.subtitle,x=l?.objectSchema,S=l?.objectName||x?.name,C=Sl((0,B.pickLocalized)(y,v),l?.data,x,_,S),w=Sl((0,B.pickLocalized)(b,v),l?.data,x,_,S),T=(e?.breadcrumb??e?.properties?.breadcrumb)!==!1,E=e?.recordChrome===!1||e?.properties?.recordChrome===!1,D=e?.showStar!==!1&&e?.properties?.showStar!==!1,O=e?.showCopyId!==!1&&e?.properties?.showCopyId!==!1,k=e?.actions??e?.properties?.actions,A=l?.headerSystemActions,j=a.default.useMemo(()=>{let e=l?.data,n=d?.user,r=new t.ExpressionEvaluator({...e&&typeof e==`object`?e:{},record:e,data:e,user:n,os:d?.os??{user:n},ctx:{user:n,record:e,data:e,app:d?.app,features:d?.features}}),i=(e,t)=>{try{return r.evaluateExpression(e)}catch(n){Ol(t,e,n);return}},a=t=>{if(!p(t?.requiredPermissions)||Array.isArray(t?.locations)&&t.locations.length>0&&!t.locations.includes(`record_header`)&&!t.locations.includes(`record_more`))return!1;let n=t?.visible;if(n!=null)if(typeof n==`boolean`){if(!n)return!1}else{let r=typeof n==`string`?n:n&&typeof n==`object`&&typeof n.source==`string`?n.source:null;if(r&&(kl(t?.name,r,e),!i(r,t?.name)))return!1}let r=t?.hidden;if(r!=null)if(typeof r==`boolean`){if(r)return!1}else{let n=typeof r==`string`?r:r&&typeof r==`object`&&typeof r.source==`string`?r.source:null;if(n&&(kl(t?.name,n,e),i(n,t?.name)))return!1}return!0},o=Array.isArray(k)?k.filter(a):[],s=Array.isArray(A)?A.filter(a):[],c=new Set,u=[];for(let e of[...o,...s]){let t=e?.name||e?.id||``;t&&c.has(t)||(t&&c.add(t),u.push(e))}return u.some(e=>e?.order!==void 0||e?.variant===`primary`)?[...u].sort((e,t)=>{let n=(e?.order??0)-(t?.order??0);return n===0?(e?.variant===`primary`?0:1)-(t?.variant===`primary`?0:1):n}):u},[k,A,l?.data,d]),M=()=>{if(j.length===0)return null;let n=(e,t)=>{let n=e?.name||e?.id,r=e?.label||n||`Action ${t+1}`;return n?g(l?.objectName,n,r):r},r=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0?Math.floor(e):void 0,i=m?r(e?.mobileMaxVisible??e?.properties?.mobileMaxVisible)??1:r(e?.maxVisible??e?.properties?.maxVisible)??3,a=e=>Array.isArray(e?.locations)&&e.locations.length>0&&e.locations.includes(`record_more`)&&!e.locations.includes(`record_header`),s=j.filter(a),p=j.filter(e=>!a(e)&&e?.component===`action:menu`),h=j.filter(e=>!a(e)&&e?.component!==`action:menu`),_=h.slice(0,i),v=[...h.slice(i),...p,...s],y=v.length>0,b=l?.data,x=d?.user,S=new t.ExpressionEvaluator({...b&&typeof b==`object`?b:{},record:b,data:b,user:x,os:d?.os??{user:x},ctx:{user:x,record:b,data:b,app:d?.app,features:d?.features}}),C=e=>{if(e==null)return!1;if(typeof e==`boolean`)return e;let t=typeof e==`string`?e:e&&typeof e==`object`&&typeof e.source==`string`?e.source:void 0;if(!t)return!1;try{return!!S.evaluateExpression(t)}catch{return!1}},w=e=>u&&e?.disableDuringInlineEdit===!0||C(e?.disabled);return(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 shrink-0`,role:`toolbar`,"aria-label":`Page header actions`,children:[_.map((e,t)=>{let r=n(e,t),i=e.variant===`primary`?`default`:e.variant||`default`,a=e.size||`sm`,s=w(e),c=typeof e.icon==`string`?e.icon:null;return(0,o.jsxs)(q,{variant:i,size:a,disabled:s,className:`gap-2`,onClick:()=>{if(typeof e.onClick==`function`){e.onClick();return}f(e)},children:[c&&(0,o.jsx)(ja,{name:c,className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:r})]},e.name||e.id||`header-action-${t}`)}),y&&(0,o.jsxs)(pn,{children:[(0,o.jsx)(mn,{asChild:!0,children:(0,o.jsx)(q,{variant:`outline`,size:`sm`,className:`gap-1 px-2`,"aria-label":`More actions`,children:(0,o.jsx)(c.MoreHorizontal,{className:`h-4 w-4`})})}),(0,o.jsx)(xn,{align:`end`,className:`w-44`,children:v.map((e,t)=>{let r=n(e,t+_.length),i=w(e),a=typeof e.icon==`string`?e.icon:null;return(0,o.jsxs)(Sn,{disabled:i,onSelect:t=>{if(t.preventDefault(),typeof e.onClick==`function`){e.onClick();return}f(e)},className:U(`gap-2`,(e.variant===`destructive`||e.name===`sys_delete`)&&`text-destructive focus:text-destructive focus:bg-destructive/10`),children:[a&&(0,o.jsx)(ja,{name:a,className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:r})]},e.name||e.id||`overflow-action-${t}`)})})]})]})};if(l?.data&&l?.objectSchema&&!E){let e=l.data,r=l.objectSchema,i=l.objectName||r?.name,a=yl(r?.label)||r?.name||l.objectName||``,c=i?h({name:i,label:a}):a||void 0,u=r?.primaryField,d=r?.titleFormat,f=typeof d==`string`?d:d&&typeof d==`object`&&typeof d.source==`string`?d.source:void 0,p=f?El(Sl(f,e,r,_,i).trim()):``,m=e?.id??e?._id,g=(()=>{let n=(0,t.getRecordDisplayName)(r,e,{deriveFromRecordKeys:!1});return n===`Untitled`||m!=null&&n===`Record #${m}`?``:n})(),v=C||u&&e?.[u]||(p&&!p.includes(`{`)?p:``)||g||e?.name||e?.full_name||e?.title||e?.subject||e?.display_name||e?.label||(c&&e?.id?`${c} ${String(e.id).slice(0,8)}`:``)||c||``;return(0,o.jsxs)(`header`,{className:U(`flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 sm:gap-4 pb-4 border-b`,n),...s,children:[(0,o.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[T&&(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,"data-page-breadcrumb-slot":!0}),(0,o.jsx)(mc,{title:v,objectLabel:c,resourceId:e?.id?String(e.id):void 0,showStar:D,showCopyId:O,isFavorite:l?.isFavorite,onToggleFavorite:l?.onToggleFavorite?()=>l.onToggleFavorite():void 0}),w&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:w})]}),M()??(0,o.jsx)(`div`,{"data-page-actions-slot":!0,className:`shrink-0`})]})}return(0,o.jsxs)(`header`,{className:U(`flex flex-col gap-2 pb-4 border-b`,n),...s,children:[T&&(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,"data-page-breadcrumb-slot":!0}),(0,o.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,o.jsxs)(`div`,{className:`flex flex-col`,children:[C&&(0,o.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:C}),w&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:w})]}),M()??(0,o.jsx)(`div`,{"data-page-actions-slot":!0})]})]})},{namespace:`page`,skipFallback:!0,label:`Page Header`,category:`layout`,inputs:[{name:`title`,type:`string`,label:`Title`,description:`Supports {field} interpolation and inline translation maps; falls back to the record title`},{name:`subtitle`,type:`string`,label:`Subtitle`,description:`Same interpolation as Title`},{name:`actions`,type:`array`,label:`Actions`,description:`Action buttons rendered in the header, before any host-injected system actions`},{name:`breadcrumb`,type:`boolean`,label:`Breadcrumb`,defaultValue:!0},{name:`recordChrome`,type:`boolean`,label:`Record Chrome`,defaultValue:!0,description:`Set false for the bare h1 header on non-record pages`},{name:`showStar`,type:`boolean`,label:`Show Follow Star`,defaultValue:!0},{name:`showCopyId`,type:`boolean`,label:`Show Copy-ID`,defaultValue:!0}]}),t.ComponentRegistry.register(`footer`,({schema:e,className:t,...n})=>{let{designer:r}=vl(n);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Vr,{className:`my-4`}),(0,o.jsx)(`footer`,{className:U(`flex items-center justify-between text-sm text-muted-foreground`,t),...r,children:W(e?.children||e?.body)})]})},{namespace:`page`,skipFallback:!0,label:`Page Footer`,category:`layout`,isContainer:!0}),t.ComponentRegistry.register(`sidebar`,({schema:e,className:t,...n})=>{let{designer:r}=vl(n);return(0,o.jsx)(`aside`,{className:U(`flex flex-col gap-4 w-full md:w-80 shrink-0`,t),...r,children:W(e?.children||e?.body)})},{namespace:`page`,skipFallback:!0,label:`Page Sidebar`,category:`layout`,isContainer:!0}),[`aside`,`main`,`header`,`nav`,`footer`,`section`,`article`].forEach(e=>{let n=(0,a.forwardRef)(({schema:t,className:n,...r},i)=>{let{"data-obj-id":a,"data-obj-type":s,style:c,...l}=r;return(0,o.jsx)(e,{ref:i,className:n,...l,"data-obj-id":a,"data-obj-type":s,style:c,children:W(t.children||t.body)})});n.displayName=`Semantic${e.charAt(0).toUpperCase()+e.slice(1)}`,t.ComponentRegistry.register(e,n,{namespace:`ui`,label:e.charAt(0).toUpperCase()+e.slice(1),category:`layout`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}]})}),t.ComponentRegistry.register(`aspect-ratio`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(Fe,{ratio:e.ratio||16/9,className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:e.image?(0,o.jsx)(`img`,{src:e.image,alt:e.alt||``,loading:`lazy`,className:`rounded-md object-cover w-full h-full`}):W(e.children||e.body)})},{namespace:`ui`,label:`Aspect Ratio`,inputs:[{name:`ratio`,type:`number`,label:`Ratio`,defaultValue:16/9},{name:`image`,type:`string`,label:`Image URL`},{name:`alt`,type:`string`,label:`Alt Text`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{ratio:16/9}}),t.ComponentRegistry.register(`sidebar-provider`,({schema:e,...t})=>(0,o.jsx)(pi,{...t,children:W(e.body)}),{namespace:`ui`,label:`Sidebar Provider`,inputs:[{name:`defaultOpen`,type:`boolean`,label:`Default Open`,defaultValue:!0}],defaultProps:{defaultOpen:!0},defaultChildren:[{type:`sidebar`},{type:`sidebar-inset`}]}),t.ComponentRegistry.register(`sidebar`,({schema:e,...t})=>(0,o.jsx)(mi,{...t,children:W(e.body)}),{namespace:`ui`,label:`Sidebar`,inputs:[{name:`collapsible`,type:`enum`,enum:[`offcanvas`,`icon`,`none`],defaultValue:`icon`,label:`Collapsible`},{name:`side`,type:`enum`,enum:[`left`,`right`],defaultValue:`left`,label:`Side`},{name:`variant`,type:`enum`,enum:[`sidebar`,`floating`,`inset`],defaultValue:`sidebar`,label:`Variant`}],defaultProps:{collapsible:`icon`,side:`left`,variant:`sidebar`},defaultChildren:[{type:`sidebar-header`},{type:`sidebar-content`},{type:`sidebar-footer`}]}),t.ComponentRegistry.register(`sidebar-header`,({schema:e,...t})=>(0,o.jsx)(yi,{...t,children:W(e.body)}),{namespace:`ui`,label:`Sidebar Header`,defaultChildren:[{type:`text`,content:`Sidebar Header`}]}),t.ComponentRegistry.register(`sidebar-content`,({schema:e,...t})=>(0,o.jsx)(Si,{...t,children:W(e.body)}),{namespace:`ui`,label:`Sidebar Content`,defaultChildren:[{type:`sidebar-group`}]}),t.ComponentRegistry.register(`sidebar-group`,({schema:e,...t})=>(0,o.jsxs)(Ci,{...t,children:[e.label&&(0,o.jsx)(wi,{children:e.label}),(0,o.jsx)(Ei,{children:W(e.body)})]}),{namespace:`ui`,label:`Sidebar Group`,inputs:[{name:`label`,type:`string`,label:`Label`}],defaultProps:{label:`Menu`},defaultChildren:[{type:`sidebar-menu`}]}),t.ComponentRegistry.register(`sidebar-menu`,({schema:e,...t})=>(0,o.jsx)(Di,{...t,children:W(e.body)}),{namespace:`ui`,label:`Sidebar Menu`,defaultChildren:[{type:`sidebar-menu-item`},{type:`sidebar-menu-item`}]}),t.ComponentRegistry.register(`sidebar-menu-item`,({schema:e,...t})=>(0,o.jsx)(Oi,{...t,children:W(e.body)}),{namespace:`ui`,label:`Sidebar Menu Item`,defaultChildren:[{type:`sidebar-menu-button`}]}),t.ComponentRegistry.register(`sidebar-menu-button`,({schema:e,...t})=>(0,o.jsx)(Ai,{isActive:e.active,...t,children:W(e.body)}),{namespace:`ui`,label:`Sidebar Menu Button`,inputs:[{name:`active`,type:`boolean`,label:`Active`,defaultValue:!1},{name:`size`,type:`enum`,enum:[`default`,`sm`,`lg`],defaultValue:`default`,label:`Size`},{name:`tooltip`,type:`string`,label:`Tooltip`}],defaultProps:{size:`default`},defaultChildren:[{type:`text`,content:`Menu Item`}]}),t.ComponentRegistry.register(`sidebar-footer`,({schema:e,...t})=>(0,o.jsx)(bi,{...t,children:W(e.body)}),{namespace:`ui`,label:`Sidebar Footer`,defaultChildren:[{type:`text`,content:`Footer`}]}),t.ComponentRegistry.register(`sidebar-inset`,({schema:e,...t})=>(0,o.jsx)(_i,{...t,children:W(e.body)}),{namespace:`ui`,label:`Sidebar Inset`,defaultChildren:[{type:`div`,className:`p-4`,body:[{type:`text`,content:`Main content area`}]}]}),t.ComponentRegistry.register(`sidebar-trigger`,({className:e,...t})=>(0,o.jsx)(hi,{className:e,...t}),{namespace:`ui`,label:`Sidebar Trigger`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}]});function Al({crumb:e,isLast:t}){let n=(0,i.resolveI18nLabel)(e.label)??``;return e.siblings&&e.siblings.length>0?(0,o.jsxs)(pn,{children:[(0,o.jsxs)(mn,{className:`flex items-center gap-1`,children:[t?(0,o.jsx)(`span`,{className:`font-semibold`,children:n}):(0,o.jsx)(`span`,{children:n}),(0,o.jsx)(c.ChevronDown,{className:`h-3 w-3`})]}),(0,o.jsx)(xn,{align:`start`,children:e.siblings.map((e,t)=>(0,o.jsx)(Sn,{asChild:!0,children:(0,o.jsx)(`a`,{href:e.href,children:e.label})},t))})]}):t?(0,o.jsx)(Ge,{children:n}):(0,o.jsx)(We,{href:e.href||`#`,children:n})}t.ComponentRegistry.register(`header-bar`,({schema:e})=>(0,o.jsxs)(`header`,{className:`flex h-14 sm:h-16 shrink-0 items-center gap-2 border-b px-3 sm:px-4`,children:[(0,o.jsx)(hi,{}),(0,o.jsx)(Vr,{orientation:`vertical`,className:`mr-2 h-4`}),(0,o.jsx)(Ve,{children:(0,o.jsx)(He,{children:e.crumbs?.map((t,n)=>(0,o.jsxs)(a.default.Fragment,{children:[(0,o.jsx)(Ue,{children:(0,o.jsx)(Al,{crumb:t,isLast:n===e.crumbs.length-1})}),n<e.crumbs.length-1&&(0,o.jsx)(Ke,{})]},n))})}),(0,o.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[e.search?.enabled&&(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(c.Search,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground`}),(0,o.jsx)(X,{type:`search`,placeholder:e.search.placeholder,className:`pl-8 w-[200px] lg:w-[300px]`}),e.search.shortcut&&(0,o.jsx)(`kbd`,{className:`pointer-events-none absolute right-2 top-2 hidden h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 sm:flex`,children:e.search.shortcut})]}),e.actions?.map((e,t)=>(0,o.jsx)(i.SchemaRenderer,{schema:e},t)),e.rightContent&&(0,o.jsx)(i.SchemaRenderer,{schema:e.rightContent})]})]}),{namespace:`ui`,label:`Header Bar`,inputs:[{name:`crumbs`,type:`array`,label:`Breadcrumbs`},{name:`search`,type:`object`,label:`Search Configuration`},{name:`actions`,type:`array`,label:`Action Slots`},{name:`rightContent`,type:`object`,label:`Right Content`}],defaultProps:{crumbs:[{label:`Home`,href:`#`},{label:`Current Page`}]}}),t.ComponentRegistry.register(`badge`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(Be,{variant:e.variant,className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:e.label||W(e.body)})},{namespace:`ui`,label:`Badge`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`variant`,type:`enum`,enum:[`default`,`secondary`,`destructive`,`outline`],defaultValue:`default`,label:`Variant`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{label:`Badge`,variant:`default`}}),t.ComponentRegistry.register(`avatar`,({schema:e,className:t,...n})=>(0,o.jsxs)(Ie,{className:t,...n,children:[(0,o.jsx)(Le,{src:e.src,alt:e.alt}),(0,o.jsx)(Re,{children:e.fallback})]}),{namespace:`ui`,label:`Avatar`,inputs:[{name:`src`,type:`string`,label:`Image URL`},{name:`alt`,type:`string`,label:`Alt Text`},{name:`fallback`,type:`string`,label:`Fallback Initials`,defaultValue:`CN`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{fallback:`CN`,alt:`Avatar`}}),t.ComponentRegistry.register(`alert`,({schema:e,className:t,...n})=>(0,o.jsxs)(Me,{variant:e.variant,className:t,...n,children:[(0,o.jsx)(Ne,{children:e.title}),(0,o.jsx)(Pe,{children:e.description||W(e.body)})]}),{namespace:`ui`,label:`Alert`,inputs:[{name:`title`,type:`string`,label:`Title`,required:!0},{name:`description`,type:`string`,label:`Description`},{name:`variant`,type:`enum`,enum:[`default`,`destructive`],defaultValue:`default`,label:`Variant`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Alert Title`,description:`This is an alert message.`,variant:`default`}}),t.ComponentRegistry.register(`list`,({schema:e,className:t,...n})=>{let r=(0,i.useDataScope)(e.bind),a=Array.isArray(r)?r:Array.isArray(e.items)?e.items:[],s=e.ordered?`ol`:`ul`,c=e.ordered?`list-decimal`:`list-disc`;return(0,o.jsxs)(`div`,{className:U(`space-y-2`,e.wrapperClass),children:[e.title&&(0,o.jsx)(`h3`,{className:`text-lg font-semibold tracking-tight`,children:e.title}),(0,o.jsx)(s,{className:U(`ml-6 [&>li]:mt-2`,c,t),...n,children:a.map((e,t)=>(0,o.jsx)(`li`,{className:U(typeof e==`object`&&e.className),children:typeof e==`string`?e:e.content||W(e.body)},t))})]})},{namespace:`ui`,label:`List`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`ordered`,type:`boolean`,label:`Ordered List (numbered)`,defaultValue:!1},{name:`items`,type:`array`,label:`List Items`,description:`Array of strings or objects with content/body`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{ordered:!1,items:[`First item`,`Second item`,`Third item`],className:`text-sm`}});var jl=({node:e,onNodeClick:t})=>{let[n,r]=(0,a.useState)(!1),i=e.children&&e.children.length>0;return(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsxs)(`div`,{className:U(`group flex items-center py-1.5 px-2 rounded-sm cursor-pointer transition-colors`,`hover:bg-accent hover:text-accent-foreground`,n&&i&&`bg-accent/50`),onClick:()=>{t&&t(e)},children:[i?(0,o.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r(!n)},className:`mr-2 p-0.5 h-5 w-5 flex items-center justify-center rounded-sm hover:bg-muted text-muted-foreground transition-colors`,children:n?(0,o.jsx)(c.ChevronDown,{className:`h-4 w-4`}):(0,o.jsx)(c.ChevronRight,{className:`h-4 w-4`})}):(0,o.jsx)(`span`,{className:`mr-2 w-5 flex justify-center`,children:(0,o.jsx)(`div`,{className:`w-1 h-1 rounded-full bg-muted-foreground/50`})}),e.icon===`folder`||i?n?(0,o.jsx)(c.FolderOpen,{className:`h-4 w-4 mr-2 text-primary`}):(0,o.jsx)(c.Folder,{className:`h-4 w-4 mr-2 text-muted-foreground group-hover:text-primary transition-colors`}):(0,o.jsx)(c.File,{className:`h-4 w-4 mr-2 text-muted-foreground group-hover:text-primary transition-colors`}),(0,o.jsx)(`span`,{className:U(`text-sm transition-colors`,n?`font-medium text-foreground`:`text-muted-foreground group-hover:text-foreground`),children:e.label})]}),i&&n&&(0,o.jsx)(`div`,{className:`relative ml-[11px] pl-3 border-l border-border animate-in slide-in-from-left-2 fade-in duration-200`,children:e.children.map(e=>(0,o.jsx)(jl,{node:e,onNodeClick:t},e.id))})]})};t.ComponentRegistry.register(`tree-view`,({schema:e,className:t,...n})=>{let r=t=>{e.onNodeClick&&e.onNodeClick(t)},a=(0,i.useDataScope)(e.bind)||e.nodes||e.data||[],s=Array.isArray(a)?a:[];return(0,o.jsxs)(`div`,{className:U(`relative border rounded-lg p-3 bg-card text-card-foreground`,t),...n,children:[e.title&&(0,o.jsx)(`div`,{className:`flex items-center gap-2 mb-3 pb-2 border-b`,children:(0,o.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.title})}),(0,o.jsx)(`div`,{className:`space-y-1`,children:s.map(e=>(0,o.jsx)(jl,{node:e,onNodeClick:r},e.id))})]})},{namespace:`ui`,label:`Tree View`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`nodes`,type:`array`,label:`Tree Nodes`,description:`Array of { id, label, icon, children, data }`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`File Explorer`,nodes:[{id:`1`,label:`Documents`,icon:`folder`,children:[{id:`1-1`,label:`Resume.pdf`,icon:`file`},{id:`1-2`,label:`Cover Letter.docx`,icon:`file`}]},{id:`2`,label:`Photos`,icon:`folder`,children:[{id:`2-1`,label:`Vacation`,icon:`folder`,children:[{id:`2-1-1`,label:`Beach.jpg`,icon:`file`}]},{id:`2-2`,label:`Family.jpg`,icon:`file`}]},{id:`3`,label:`README.md`,icon:`file`}]}});var Ml=e=>e?Aa(e):null;t.ComponentRegistry.register(`statistic`,({schema:e})=>{let t=e.icon?Ml(e.icon):null;return(0,o.jsxs)(`div`,{className:U(`group relative flex flex-col p-4 sm:p-5 md:p-6 rounded-xl border bg-card text-card-foreground shadow-sm`,e.className),children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[e.label&&(0,o.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:e.label}),t&&(0,o.jsx)(t,{className:`h-4 w-4 text-muted-foreground`})]}),(0,o.jsx)(`div`,{className:`flex items-baseline gap-2`,children:(0,o.jsx)(`h3`,{className:`text-2xl font-bold tracking-tight`,children:e.value})}),(e.trend||e.description)&&(0,o.jsxs)(`div`,{className:`mt-1 flex items-center text-xs text-muted-foreground`,children:[e.trend===`up`&&(0,o.jsx)(c.TrendingUp,{className:`mr-1 h-3 w-3 text-emerald-500`}),e.trend===`down`&&(0,o.jsx)(c.TrendingDown,{className:`mr-1 h-3 w-3 text-rose-500`}),e.trend===`neutral`&&(0,o.jsx)(c.Minus,{className:`mr-1 h-3 w-3`}),(0,o.jsx)(`span`,{className:U(e.trend===`up`&&`text-emerald-500 font-medium`,e.trend===`down`&&`text-rose-500 font-medium`),children:e.description})]})]})},{namespace:`ui`,label:`Statistic`,category:`data-display`,icon:`Activity`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`value`,type:`string`,label:`Value`},{name:`description`,type:`string`,label:`Description`},{name:`trend`,type:`enum`,enum:[{label:`Up`,value:`up`},{label:`Down`,value:`down`},{label:`Neutral`,value:`neutral`}],label:`Trend`}],defaultProps:{label:`Total Revenue`,value:`$45,231.89`,trend:`up`,description:`+20.1% from last month`}}),t.ComponentRegistry.register(`breadcrumb`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:a,...s}=t;return(0,o.jsx)(Ve,{className:e.className,...s,"data-obj-id":n,"data-obj-type":r,style:a,children:(0,o.jsx)(He,{children:e.items?.map((t,n)=>(0,o.jsxs)(`div`,{className:`flex items-center`,children:[(0,o.jsx)(Ue,{children:n===(e.items?.length||0)-1?(0,o.jsx)(Ge,{children:(0,i.resolveI18nLabel)(t.label)??``}):(0,o.jsx)(We,{href:t.href,children:(0,i.resolveI18nLabel)(t.label)??``})}),n<(e.items?.length||0)-1&&(0,o.jsx)(Ke,{})]},n))})})},{namespace:`ui`,label:`Breadcrumb`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{items:[{label:`Home`,href:`/`},{label:`Products`,href:`/products`},{label:`Product`}]}}),t.ComponentRegistry.register(`kbd`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t,s=Array.isArray(e.keys)?e.keys:[e.keys||e.label||`K`];return(0,o.jsx)(`div`,{className:U(`inline-flex flex-wrap gap-1`,e.className),children:s.map((e,t)=>(0,o.jsx)(`kbd`,{className:`pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100`,...a,...t===0?{"data-obj-id":n,"data-obj-type":r,style:i}:{},children:e},t))})},{namespace:`ui`,label:`Keyboard Key`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{label:`K`}}),t.ComponentRegistry.register(`table`,({schema:e,className:t})=>{let n=(0,i.useDataScope)(e.bind)||e.data||e.props?.data||[],r=Array.isArray(e.columns)?e.columns:Array.isArray(e.props?.columns)?e.props.columns:[];if(n&&!Array.isArray(n))return(0,o.jsx)(`div`,{className:`text-red-500 p-2 border border-red-200 bg-red-50 rounded text-sm`,children:`Table data must be an array`});let a=Array.isArray(n)?n:[];return(0,o.jsx)(`div`,{className:U(`rounded-md border`,t),children:(0,o.jsxs)(Bi,{children:[(0,o.jsx)(Vi,{children:(0,o.jsx)(Wi,{children:r.map((e,t)=>(0,o.jsx)(Gi,{children:e.label||e.header},e.key||e.accessorKey||t))})}),(0,o.jsx)(Hi,{children:a.length===0?(0,o.jsx)(Wi,{children:(0,o.jsx)(Ki,{colSpan:r.length,className:`h-24 text-center`,children:`No results.`})}):a.map((e,t)=>(0,o.jsx)(Wi,{children:r.map((t,n)=>{let r=t.key||t.accessorKey||``,i=r?e[r]:``;return(0,o.jsx)(Ki,{children:typeof i==`object`&&i?String(i):i},t.key||t.accessorKey||n)})},e.id||t))})]})})},{namespace:`ui`}),t.ComponentRegistry.register(`progress`,({schema:e,className:t,...n})=>(0,o.jsx)(Dr,{value:e.value,className:t,...n}),{namespace:`ui`,label:`Progress`,inputs:[{name:`value`,type:`number`,label:`Value`,defaultValue:0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{value:50,className:`w-full`}}),t.ComponentRegistry.register(`skeleton`,({schema:e,className:t,...n})=>(0,o.jsx)(Q,{className:t,...n,style:{width:e.width,height:e.height}}),{namespace:`ui`,label:`Skeleton`,inputs:[{name:`width`,type:`string`,label:`Width`},{name:`height`,type:`string`,label:`Height`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{width:`100%`,height:`20px`,className:`rounded-md`}});var Nl={top_left:`top-left`,top_center:`top-center`,top_right:`top-right`,bottom_left:`bottom-left`,bottom_center:`bottom-center`,bottom_right:`bottom-right`,"top-left":`top-left`,"top-center":`top-center`,"top-right":`top-right`,"bottom-left":`bottom-left`,"bottom-center":`bottom-center`,"bottom-right":`bottom-right`};t.ComponentRegistry.register(`toaster`,({schema:e})=>{let t=e?.position?Nl[e.position]:void 0,n=typeof e?.limit==`number`&&e.limit>0?e.limit:void 0;return(0,o.jsx)(Ri,{...t?{position:t}:{},...n?{visibleToasts:n}:{}})},{namespace:`ui`,label:`Toaster`,inputs:[{name:`position`,type:`enum`,enum:[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],defaultValue:`bottom-right`,label:`Position`},{name:`limit`,type:`number`,label:`Max visible toasts`}],defaultProps:{}}),t.ComponentRegistry.register(`loading`,({schema:e,className:t,...n})=>{let r=e.size||`md`,i=e.fullscreen||!1,a=(0,o.jsxs)(`div`,{className:U(`flex flex-col items-center justify-center gap-2`,t),children:[(0,o.jsx)(rc,{className:U(r===`sm`&&`h-4 w-4`,r===`md`&&`h-8 w-8`,r===`lg`&&`h-12 w-12`,r===`xl`&&`h-16 w-16`)}),e.text&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.text})]});return i?(0,o.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,...n,children:a}):(0,o.jsx)(`div`,{className:`flex items-center justify-center p-8`,...n,children:a})},{namespace:`ui`,label:`Loading`,inputs:[{name:`text`,type:`string`,label:`Loading Text`},{name:`size`,type:`enum`,enum:[`sm`,`md`,`lg`,`xl`],label:`Size`,defaultValue:`md`},{name:`fullscreen`,type:`boolean`,label:`Fullscreen Overlay`,defaultValue:!1},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{text:`Loading...`,size:`md`,fullscreen:!1}}),t.ComponentRegistry.register(`toast`,({schema:e})=>(0,o.jsx)(q,{onClick:()=>{(e.variant===`success`?ne.toast.success:e.variant===`error`?ne.toast.error:e.variant===`warning`?ne.toast.warning:e.variant===`info`?ne.toast.info:ne.toast)(e.title||`Notification`,{description:e.description,duration:e.duration})},variant:e.buttonVariant,className:e.className,children:e.buttonLabel||`Show Toast`}),{namespace:`ui`,label:`Toast`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`variant`,type:`enum`,enum:[`default`,`success`,`warning`,`error`,`info`],defaultValue:`default`,label:`Variant`},{name:`duration`,type:`number`,label:`Duration (ms)`},{name:`buttonLabel`,type:`string`,label:`Button Label`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Notification`,buttonLabel:`Show Toast`,variant:`default`,duration:5e3}}),t.ComponentRegistry.register(`spinner`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(c.Loader2,{className:U(`animate-spin`,{sm:`h-4 w-4`,md:`h-6 w-6`,lg:`h-8 w-8`,xl:`h-12 w-12`}[e.size||`md`],e.className),...a,"data-obj-id":n,"data-obj-type":r,style:i})},{namespace:`ui`,label:`Spinner`,inputs:[{name:`size`,type:`enum`,enum:[`sm`,`md`,`lg`,`xl`],defaultValue:`md`,label:`Size`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{size:`md`}}),t.ComponentRegistry.register(`empty`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:a,action:s,icon:c,...l}=t,u=e.action,d=u&&typeof u==`object`?(0,o.jsx)(i.SchemaRenderer,{schema:u}):void 0;return(0,o.jsx)(yc,{title:e.title||`No data`,description:e.description,className:e.className,action:d,...l,"data-obj-id":n,"data-obj-type":r,style:a})},{namespace:`ui`,label:`Empty`,inputs:[{name:`title`,type:`string`,label:`Title`,defaultValue:`No data`},{name:`description`,type:`string`,label:`Description`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`No data`}}),t.ComponentRegistry.register(`sonner`,({schema:e,...t})=>(0,o.jsx)(q,{onClick:()=>{(e.variant===`success`?ne.toast.success:e.variant===`error`?ne.toast.error:e.variant===`warning`?ne.toast.warning:e.variant===`info`?ne.toast.info:ne.toast)(e.message||e.title||`Notification`,{description:e.description})},variant:e.buttonVariant,className:e.className,...t,children:e.buttonLabel||`Show Toast`}),{namespace:`ui`,label:`Sonner Toast`,inputs:[{name:`message`,type:`string`,label:`Message`},{name:`description`,type:`string`,label:`Description`},{name:`variant`,type:`enum`,enum:[`default`,`success`,`error`,`warning`,`info`],defaultValue:`default`,label:`Variant`},{name:`buttonLabel`,type:`string`,label:`Button Label`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{message:`Notification`,buttonLabel:`Show Toast`,variant:`default`}}),t.ComponentRegistry.register(`dialog`,({schema:e,className:t,...n})=>(0,o.jsxs)(St,{modal:e.modal,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(Ct,{asChild:!0,children:W(e.trigger)}),(0,o.jsxs)(Dt,{className:t,children:[(0,o.jsxs)(Ot,{children:[e.title&&(0,o.jsx)(At,{children:e.title}),e.description&&(0,o.jsx)(jt,{children:e.description})]}),W(e.content),e.footer&&(0,o.jsx)(kt,{children:W(e.footer)})]})]}),{namespace:`ui`,label:`Dialog`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`modal`,type:`boolean`,label:`Modal`,defaultValue:!0},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`trigger`,type:`slot`,label:`Trigger`,description:`Element that opens the dialog`},{name:`content`,type:`slot`,label:`Content`,description:`Main content of the dialog`},{name:`footer`,type:`slot`,label:`Footer`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{title:`Dialog Title`,description:`Dialog description goes here`,modal:!0,trigger:[{type:`button`,label:`Open Dialog`}],content:[{type:`text`,content:`Dialog content goes here`}]}}),t.ComponentRegistry.register(`sheet`,({schema:e,className:t,...n})=>(0,o.jsxs)(Hr,{modal:e.modal,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(Ur,{asChild:!0,children:W(e.trigger)}),(0,o.jsxs)(Jr,{side:e.side||`right`,className:t,children:[(0,o.jsxs)(Yr,{children:[e.title&&(0,o.jsx)(Zr,{children:e.title}),e.description&&(0,o.jsx)(Qr,{children:e.description})]}),W(e.content),e.footer&&(0,o.jsx)(Xr,{children:W(e.footer)})]})]}),{namespace:`ui`,label:`Sheet`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],defaultValue:`right`,label:`Side`},{name:`modal`,type:`boolean`,label:`Modal`,defaultValue:!0},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`footer`,type:`slot`,label:`Footer`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{title:`Sheet Title`,description:`Sheet description`,side:`right`,modal:!0,trigger:[{type:`button`,label:`Open Sheet`}],content:[{type:`text`,content:`Sheet content goes here`}]}}),t.ComponentRegistry.register(`popover`,({schema:e,className:t,...n})=>(0,o.jsxs)(wr,{modal:e.modal,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(Tr,{asChild:!0,children:W(e.trigger)}),(0,o.jsx)(Er,{align:e.align,side:e.side,className:t,children:W(e.content)})]}),{namespace:`ui`,label:`Popover`,inputs:[{name:`modal`,type:`boolean`,label:`Modal`},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`],label:`Align`},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],label:`Side`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Open Popover`,variant:`outline`}],content:[{type:`text`,content:`Popover content goes here`}],align:`center`,side:`bottom`}}),t.ComponentRegistry.register(`tooltip`,({schema:e,className:t,...n})=>(0,o.jsx)(ti,{delayDuration:e.delayDuration,children:(0,o.jsxs)(ni,{...n,children:[(0,o.jsx)(ri,{asChild:!0,children:W(e.trigger)}),(0,o.jsx)(ii,{side:e.side,align:e.align,className:t,children:e.content||W(e.body)})]})}),{namespace:`ui`,label:`Tooltip`,inputs:[{name:`delayDuration`,type:`number`,label:`Delay Duration`,defaultValue:700},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],label:`Side`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`],label:`Align`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`string`,label:`Content Text`},{name:`body`,type:`slot`,label:`Rich Content`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Hover me`,variant:`outline`}],content:`Tooltip content`,delayDuration:700,side:`top`}}),t.ComponentRegistry.register(`alert-dialog`,({schema:e,className:t,...n})=>(0,o.jsxs)(be,{defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(xe,{asChild:!0,children:W(e.trigger)}),(0,o.jsxs)(we,{className:t,children:[(0,o.jsxs)(Te,{children:[e.title&&(0,o.jsx)(De,{children:e.title}),e.description&&(0,o.jsx)(Oe,{children:e.description})]}),W(e.content),(0,o.jsxs)(Ee,{children:[e.cancelText&&(0,o.jsx)(Ae,{children:e.cancelText}),e.actionText&&(0,o.jsx)(ke,{onClick:e.onAction,children:e.actionText})]})]})]}),{namespace:`ui`,label:`Alert Dialog`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`cancelText`,type:`string`,label:`Cancel Text`,defaultValue:`Cancel`},{name:`actionText`,type:`string`,label:`Action Text`,defaultValue:`Continue`},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content/Body`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{title:`Are you sure?`,description:`This action cannot be undone.`,cancelText:`Cancel`,actionText:`Continue`,trigger:[{type:`button`,label:`Open Alert`,variant:`destructive`}]}}),t.ComponentRegistry.register(`drawer`,({schema:e,className:t,...n})=>(0,o.jsxs)(nn,{shouldScaleBackground:e.shouldScaleBackground,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(rn,{asChild:!0,children:W(e.trigger)}),(0,o.jsxs)(cn,{className:t,children:[(0,o.jsxs)(ln,{children:[e.title&&(0,o.jsx)(dn,{children:e.title}),e.description&&(0,o.jsx)(fn,{children:e.description})]}),W(e.content),e.footer&&(0,o.jsxs)(un,{children:[W(e.footer),e.showClose&&(0,o.jsx)(on,{asChild:!0,children:(0,o.jsx)(`button`,{children:`Close`})})]})]})]}),{namespace:`ui`,label:`Drawer`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`shouldScaleBackground`,type:`boolean`,label:`Scale Background`},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`showClose`,type:`boolean`,label:`Show Close Button in Footer`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`footer`,type:`slot`,label:`Footer`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{title:`Drawer Title`,description:`Drawer description`,trigger:[{type:`button`,label:`Open Drawer`}],content:[{type:`text`,content:`Drawer content goes here`}]}}),t.ComponentRegistry.register(`hover-card`,({schema:e,className:t,...n})=>(0,o.jsxs)(zn,{openDelay:e.openDelay,closeDelay:e.closeDelay,...n,children:[(0,o.jsx)(Bn,{asChild:!0,children:W(e.trigger)}),(0,o.jsx)(Vn,{align:e.align,side:e.side,className:t,children:W(e.content)})]}),{namespace:`ui`,label:`Hover Card`,inputs:[{name:`openDelay`,type:`number`,label:`Open Delay`},{name:`closeDelay`,type:`number`,label:`Close Delay`},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],label:`Side`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`],label:`Align`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Hover me`,variant:`link`}],content:[{type:`text`,content:`Hover card content appears on hover`}],side:`top`}});var Pl=e=>e?e.map((e,t)=>e.type===`separator`?(0,o.jsx)(En,{},t):e.type===`label`?(0,o.jsx)(Tn,{children:e.label},t):e.children?(0,o.jsxs)(_n,{children:[(0,o.jsxs)(yn,{inset:e.inset,children:[e.icon&&(0,o.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}),(0,o.jsx)(bn,{children:Pl(e.children)})]},t):(0,o.jsxs)(Sn,{disabled:e.disabled,inset:e.inset,onSelect:e.onSelect,children:[e.icon&&(0,o.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label,e.shortcut&&(0,o.jsx)(`span`,{className:`ml-auto text-xs tracking-widest opacity-60`,children:e.shortcut})]},t)):null;t.ComponentRegistry.register(`dropdown-menu`,({schema:e,className:t,...n})=>(0,o.jsxs)(pn,{modal:e.modal,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(mn,{asChild:!0,children:W(e.trigger)}),(0,o.jsxs)(xn,{align:e.align,side:e.side,className:t,children:[e.label&&(0,o.jsx)(Tn,{children:e.label}),e.label&&(0,o.jsx)(En,{}),Pl(e.items)]})]}),{namespace:`ui`,label:`Dropdown Menu`,inputs:[{name:`label`,type:`string`,label:`Menu Label`},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],label:`Side`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`],label:`Align`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`items`,type:`array`,label:`Items`,description:`Recursive structure: { type?: "separator"|"label", label, icon, shortcut, disabled, children: [] }`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Menu`,variant:`outline`}],items:[{label:`Item 1`},{label:`Item 2`},{type:`separator`},{label:`Item 3`}],align:`start`,side:`bottom`}});var Fl=e=>e?e.map((e,t)=>e.type===`separator`?(0,o.jsx)(en,{},t):e.type===`label`?(0,o.jsx)($t,{children:e.label},t):e.children?(0,o.jsxs)(Gt,{children:[(0,o.jsx)(qt,{inset:e.inset,children:e.label}),(0,o.jsx)(Jt,{children:Fl(e.children)})]},t):(0,o.jsxs)(Xt,{disabled:e.disabled,inset:e.inset,onSelect:e.onSelect,children:[e.label,e.shortcut&&(0,o.jsx)(tn,{children:e.shortcut})]},t)):null;t.ComponentRegistry.register(`context-menu`,({schema:e,className:t,...n})=>{let r=e.triggerClassName||t||e.className||`h-[120px] w-full sm:h-[150px] sm:w-[300px] border border-dashed text-sm flex items-center justify-center`,i=e.contentClassName;return(0,o.jsxs)(Vt,{modal:e.modal,...n,children:[(0,o.jsx)(Ht,{asChild:!0,children:(0,o.jsx)(`div`,{className:r,children:W(e.trigger||{type:`text`,value:`Right click here`})})}),(0,o.jsx)(Yt,{className:i,children:Fl(e.items)})]})},{namespace:`ui`,label:`Context Menu`,inputs:[{name:`trigger`,type:`slot`,label:`Trigger Area`},{name:`triggerClassName`,type:`string`,label:`Trigger Area Class`},{name:`items`,type:`array`,label:`Items`,description:`Recursive structure: { type?: "separator"|"label", label, shortcut, children }`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{items:[{label:`Action 1`},{label:`Action 2`},{type:`separator`},{label:`Action 3`}],trigger:[{type:`text`,content:`Right click here`}]}}),t.ComponentRegistry.register(`menubar`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(Zn,{className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:e.menus?.map((e,t)=>(0,o.jsxs)(Kn,{children:[(0,o.jsx)(Qn,{children:e.label}),(0,o.jsx)(tr,{children:e.items?.map((e,t)=>e.separator?(0,o.jsx)(or,{},t):e.children?(0,o.jsxs)(Xn,{children:[(0,o.jsx)($n,{children:e.label}),(0,o.jsx)(er,{children:e.children.map((e,t)=>(0,o.jsx)(nr,{children:e.label},t))})]},t):(0,o.jsx)(nr,{disabled:e.disabled,children:e.label},t))})]},t))})},{namespace:`ui`,label:`Menubar`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{menus:[{label:`File`,items:[{label:`New`},{label:`Open`},{separator:!0},{label:`Exit`}]}]}}),t.ComponentRegistry.register(`accordion`,({schema:e,className:t,...n})=>(0,o.jsx)(_e,{type:e.accordionType||`single`,collapsible:e.collapsible,className:t,...n,children:e.items?.map((e,t)=>(0,o.jsxs)(ve,{value:e.value||`item-${t}`,children:[(0,o.jsx)(G,{children:e.title}),(0,o.jsx)(ye,{children:W(e.content)})]},e.value||t))}),{namespace:`ui`,label:`Accordion`,inputs:[{name:`accordionType`,type:`enum`,enum:[`single`,`multiple`],defaultValue:`single`,label:`Type`},{name:`collapsible`,type:`boolean`,label:`Collapsible (for single type)`},{name:`items`,type:`array`,label:`Items`,description:`Array of { trigger, content, value }`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{accordionType:`single`,collapsible:!0,items:[{label:`Item 1`,value:`item-1`,content:[{type:`text`,content:`Content for item 1`}]},{label:`Item 2`,value:`item-2`,content:[{type:`text`,content:`Content for item 2`}]},{label:`Item 3`,value:`item-3`,content:[{type:`text`,content:`Content for item 3`}]}],className:`w-full`}}),t.ComponentRegistry.register(`collapsible`,({schema:e,className:t,...n})=>(0,o.jsxs)(yt,{defaultOpen:e.defaultOpen,disabled:e.disabled,className:t,...n,children:[(0,o.jsx)(bt,{asChild:!0,children:W(e.trigger)}),(0,o.jsx)(xt,{children:W(e.content)})]}),{namespace:`ui`,label:`Collapsible`,inputs:[{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`disabled`,type:`boolean`,label:`Disabled`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Toggle`,variant:`outline`}],content:[{type:`text`,content:`Collapsible content goes here`}],className:`w-full`}}),t.ComponentRegistry.register(`toggle-group`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,type:a,...s}=t;return(0,o.jsx)(na,{type:e.selectionType||`single`,variant:e.variant,size:e.size,value:e.value,className:e.className,...s,"data-obj-id":n,"data-obj-type":r,style:i,children:e.items?.map((e,t)=>(0,o.jsx)(ra,{value:e.value,"aria-label":e.label,children:e.label},t))})},{namespace:`ui`,label:`Toggle Group`,inputs:[{name:`selectionType`,type:`enum`,enum:[`single`,`multiple`],defaultValue:`single`,label:`Selection Type`},{name:`variant`,type:`enum`,enum:[`default`,`outline`],defaultValue:`default`,label:`Variant`},{name:`size`,type:`enum`,enum:[`default`,`sm`,`lg`],defaultValue:`default`,label:`Size`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{selectionType:`single`,variant:`default`,size:`default`,items:[{value:`bold`,label:`Bold`},{value:`italic`,label:`Italic`},{value:`underline`,label:`Underline`}]}}),t.ComponentRegistry.register(`carousel`,({schema:e,className:t,...n})=>(0,o.jsxs)(rt,{opts:e.opts,orientation:e.orientation||`horizontal`,className:t,...n,children:[(0,o.jsx)(it,{children:e.items?.map((t,n)=>(0,o.jsx)(at,{className:e.itemClassName,children:W(t)},n))}),e.showArrows&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ot,{}),(0,o.jsx)(st,{})]})]}),{namespace:`ui`,label:`Carousel`,inputs:[{name:`orientation`,type:`enum`,enum:[`horizontal`,`vertical`],defaultValue:`horizontal`,label:`Orientation`},{name:`showArrows`,type:`boolean`,label:`Show Arrows`,defaultValue:!0},{name:`items`,type:`array`,label:`Items`,description:`Array of content schemas`},{name:`itemClassName`,type:`string`,label:`Item CSS Class`},{name:`className`,type:`string`,label:`Container CSS Class`}],defaultProps:{orientation:`horizontal`,showArrows:!0,items:[[{type:`div`,className:`p-4 sm:p-6 md:p-8 border rounded bg-slate-50`,body:[{type:`text`,content:`Slide 1`}]}],[{type:`div`,className:`p-4 sm:p-6 md:p-8 border rounded bg-slate-50`,body:[{type:`text`,content:`Slide 2`}]}],[{type:`div`,className:`p-4 sm:p-6 md:p-8 border rounded bg-slate-50`,body:[{type:`text`,content:`Slide 3`}]}]],className:`w-full max-w-xs`}}),t.ComponentRegistry.register(`filter-builder`,({schema:e,className:t,onChange:n,...r})=>(0,o.jsxs)(`div`,{className:e.wrapperClass||``,children:[e.label&&(0,o.jsx)(`label`,{className:`text-sm font-medium mb-2 block`,children:e.label}),(0,o.jsx)(fs,{fields:e.fields||[],value:e.value||r.value,onChange:t=>{n&&n({target:{name:e.name,value:t}})},className:t,...r})]}),{namespace:`ui`,label:`Filter Builder`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`name`,type:`string`,label:`Name`,required:!0},{name:`fields`,type:`array`,label:`Fields`,description:`Array of { value: string, label: string, type?: string } objects`,required:!0},{name:`value`,type:`object`,label:`Initial Value`,description:`FilterGroup object with conditions`}],defaultProps:{label:`Filters`,name:`filters`,fields:[{value:`name`,label:`Name`,type:`text`},{value:`email`,label:`Email`,type:`text`},{value:`age`,label:`Age`,type:`number`},{value:`status`,label:`Status`,type:`text`}],value:{id:`root`,logic:`and`,conditions:[]}}}),t.ComponentRegistry.register(`scroll-area`,({schema:e,className:t,...n})=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=n,c=e.orientation||`vertical`;return(0,o.jsxs)(Ar,{className:t,style:{height:e.height,width:e.width,...a},...s,"data-obj-id":r,"data-obj-type":i,children:[W(e.children),(c===`horizontal`||c===`both`)&&(0,o.jsx)(jr,{orientation:`horizontal`}),(c===`vertical`||c===`both`)&&(0,o.jsx)(jr,{orientation:`vertical`})]})},{namespace:`ui`,label:`Scroll Area`,inputs:[{name:`height`,type:`string`,label:`Height (e.g. 200px)`},{name:`width`,type:`string`,label:`Width`},{name:`orientation`,type:`enum`,enum:[`vertical`,`horizontal`,`both`],defaultValue:`vertical`,label:`Orientation`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{height:`200px`,width:`100%`,orientation:`vertical`,children:[{type:`div`,className:`p-4`,body:[{type:`text`,content:`Scrollable content goes here. Add more content to see scrolling behavior.`}]}],className:`rounded-md border`}}),t.ComponentRegistry.register(`resizable`,({schema:e,className:t,...n})=>{let r=Array.isArray(e.panels)?e.panels:[];return(0,o.jsx)(ho,{orientation:e.direction||`horizontal`,className:t,...n,style:{minHeight:e.minHeight||`200px`},children:r.map((t,n)=>(0,o.jsxs)(a.default.Fragment,{children:[(0,o.jsx)(go,{defaultSize:t.defaultSize,minSize:t.minSize,maxSize:t.maxSize,children:W(t.content)}),n<r.length-1&&(0,o.jsx)(_o,{withHandle:e.withHandle})]},n))})},{namespace:`ui`,label:`Resizable Panel Group`,inputs:[{name:`direction`,type:`enum`,enum:[`horizontal`,`vertical`],defaultValue:`horizontal`,label:`Direction`},{name:`minHeight`,type:`string`,label:`Min Height`},{name:`withHandle`,type:`boolean`,label:`Show Handle Icon`,defaultValue:!0},{name:`panels`,type:`array`,label:`Panels`,description:`Array of { defaultSize, minSize, maxSize, content }`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{direction:`horizontal`,minHeight:`200px`,withHandle:!0,panels:[{defaultSize:50,content:[{type:`div`,className:`p-4`,body:[{type:`text`,content:`Panel 1`}]}]},{defaultSize:50,content:[{type:`div`,className:`p-4`,body:[{type:`text`,content:`Panel 2`}]}]}],className:`rounded-lg border`}}),t.ComponentRegistry.register(`table`,({schema:e,className:t,...n})=>(0,o.jsxs)(Bi,{className:t,...n,children:[e.caption&&(0,o.jsx)(qi,{children:e.caption}),(0,o.jsx)(Vi,{children:(0,o.jsx)(Wi,{children:e.columns?.map((e,t)=>(0,o.jsx)(Gi,{className:e.className,style:{width:e.width},children:e.header||e.label},t))})}),(0,o.jsx)(Hi,{children:e.data?.map((t,n)=>(0,o.jsx)(Wi,{children:e.columns?.map((e,n)=>(0,o.jsx)(Ki,{className:e.cellClassName,children:t[e.accessorKey||e.name]},n))},n))}),e.footer&&(0,o.jsx)(Ui,{children:(0,o.jsx)(Wi,{children:(0,o.jsx)(Ki,{colSpan:e.columns?.length,children:typeof e.footer==`string`?e.footer:W(e.footer)})})})]}),{namespace:`ui`,label:`Table`,inputs:[{name:`caption`,type:`string`,label:`Caption`},{name:`footer`,type:`string`,label:`Footer Content`},{name:`columns`,type:`array`,label:`Columns`,description:`Array of { header, accessorKey, className, width }`},{name:`data`,type:`array`,label:`Data`,description:`Array of objects`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{caption:`Table Caption`,columns:[{header:`Column 1`,accessorKey:`col1`},{header:`Column 2`,accessorKey:`col2`},{header:`Column 3`,accessorKey:`col3`}],data:[{col1:`Row 1, Col 1`,col2:`Row 1, Col 2`,col3:`Row 1, Col 3`},{col1:`Row 2, Col 1`,col2:`Row 2, Col 2`,col3:`Row 2, Col 3`},{col1:`Row 3, Col 1`,col2:`Row 3, Col 2`,col3:`Row 3, Col 3`}]}});function Il(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}var Ll={Home:`House`};function Rl(e){if(!e)return null;let t=Il(e);return c.icons[Ll[t]||t]??null}var zl=a.default.createContext(null);function Bl({value:e,children:t}){return(0,o.jsx)(zl.Provider,{value:e,children:t})}function Vl(){return a.default.useContext(zl)}function Hl(e){return String(e).padStart(2,`0`)}function Ul(e){if(e==null||e===``)return``;if(typeof e==`string`){let t=e.match(/^(\d{4}-\d{2}-\d{2})/);if(t)return t[1]}let t=e instanceof Date?e:new Date(String(e));return Number.isNaN(t.getTime())?``:`${t.getFullYear()}-${Hl(t.getMonth()+1)}-${Hl(t.getDate())}`}function Wl(e){if(e==null||e===``)return``;let t=e instanceof Date?e:new Date(String(e));return Number.isNaN(t.getTime())?``:`${t.getFullYear()}-${Hl(t.getMonth()+1)}-${Hl(t.getDate())}T${Hl(t.getHours())}:${Hl(t.getMinutes())}`}var Gl=new Set([`number`,`currency`,`percent`,`int`,`integer`,`float`,`double`]);function Kl(e){if(e==null)return``;if(Array.isArray(e))return e.map(e=>typeof e==`object`&&e?Kl(e):String(e)).filter(Boolean).join(`, `);if(typeof e==`object`){let t=e;return String(t.name??t.label??t.externalId??t.id??t._id??``)}return String(e)}var ql=(0,B.createSafeTranslation)({"table.rowsPerPage":`Rows per page`,"table.pageInfo":`Page {{current}} of {{total}}`,"table.totalRecords":`{{count}} total`,"table.noResults":`No results found`,"table.noResultsHint":`Try adjusting your filters or search query.`,"table.sortAsc":`Sort ascending`,"table.sortDesc":`Sort descending`,"table.hideColumn":`Hide column`,"table.cancelAll":`Cancel All`,"table.saveAll":`Save All ({{count}})`,"table.exportCSV":`Export CSV`,"table.addRecord":`Add record`,"table.open":`Open`,"table.search":`Search...`,"table.modified":`{{count}} row modified`,"table.saveFailed":`Save failed`,"table.selected":`{{count}} selected`,"table.edit":`Edit`,"table.delete":`Delete`,"common.actions":`Actions`},`table.rowsPerPage`);function Jl(e){if(e&&typeof e==`object`){let t=e,n=t.details&&(t.details.message??t.details.error);if(typeof n==`string`&&n.trim())return n.trim();if(typeof t.message==`string`&&t.message.trim())return t.message.trim()}return typeof e==`string`&&e.trim()?e.trim():`Unknown error`}var Yl=({action:e,row:t,onActionDef:n})=>{let r=e.visible,a=(0,i.useRowPredicate)(r,t,{fallback:!1,warnOnError:!0,label:e.name}),s=(0,i.useRowPredicate)(e.disabled,t,{fallback:!1,warnOnError:!0,label:`${e.name}:disabled`});if(r&&!a)return null;let c=Rl(e.icon);return(0,o.jsxs)(Sn,{disabled:s,onClick:()=>{s||n?.(e,t)},"data-testid":`row-action-${e.name}`,className:U(e.variant===`danger`&&`text-destructive focus:text-destructive`),children:[c&&(0,o.jsx)(c,{className:`mr-2 h-4 w-4`}),e.label||e.name]})},Xl=({name:e,predicates:t,row:n,icon:r,label:a,className:s,onSelect:c})=>{let l=(0,i.useRowPredicate)(t?.visibleWhen,n,{fallback:!1,warnOnError:!0,label:`builtin:${e}:visibleWhen`}),u=(0,i.useRowPredicate)(t?.disabledWhen,n,{fallback:!1,warnOnError:!0,label:`builtin:${e}:disabledWhen`});if(t?.visibleWhen!=null&&!l)return null;let d=t?.disabledWhen!=null&&u;return(0,o.jsxs)(Sn,{disabled:d,onClick:()=>{d||c(n)},"data-testid":`row-action-builtin-${e}`,className:s,children:[r,a]})};function Zl(e){return e===`single`?`single`:e===`none`||!e?`none`:`multiple`}t.ComponentRegistry.register(`data-table`,({schema:e})=>{let{caption:n,columns:r=[],data:i=[],pagination:s=!0,pageSize:l=10,pageSizeOptions:u,manualPagination:d=!1,rowCount:f,page:p,onPageChange:m,onPageSizeChange:h,manualSorting:g=!1,sort:_,onSortChange:v,searchable:y=!0,selectable:b=!1,showSelectionCount:x=!0,selectionResetKey:S,sortable:C=!0,exportable:w=!1,rowActions:T=!1,resizableColumns:E=!0,reorderableColumns:D=!0,editable:O=!1,singleClickEdit:k=!1,selectionStyle:A=`always`,rowClassName:j,rowStyle:M,className:N,cellClassName:P,frozenColumns:F=0,showRowNumbers:I=!1,showAddRow:ee=!1,borderless:te=!1,disableInnerScroll:ne=!1}=e,L=Zl(b),R=L!==`none`,z=Vl(),re=!!z?.onAddColumn,B=!!z?.onEditColumn,ie=D||!!z?.onReorderFields,{t:V,language:ae}=ql(),oe=/^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,se=a.default.useCallback(e=>{if(typeof e!=`string`||e.length<8||!oe.test(e))return e;let t=Date.parse(e);if(Number.isNaN(t))return e;let n=e.includes(`T`);try{return new Intl.DateTimeFormat(ae,n?{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}:{year:`numeric`,month:`short`,day:`numeric`}).format(new Date(t))}catch{return e}},[ae]),ce=Array.isArray(i)?i:[],le=(0,a.useMemo)(()=>r.map(e=>({...e,header:e.header||e.label,accessorKey:e.accessorKey||e.name})),[r]),ue=(0,a.useMemo)(()=>{let e={},t=r.map(e=>({header:e.header||e.label,accessorKey:e.accessorKey||e.name,width:e.width,fitContent:e.fitContent}));for(let n of t){if(n.width||n.fitContent)continue;let t=(n.header||``).length,r=ce.slice(0,50);for(let e of r){let r=e[n.accessorKey],i=r==null?0:String(r).length;i>t&&(t=i)}e[n.accessorKey]=Math.min(400,Math.max(80,t*8+48))}return e},[r,ce]),[de,fe]=(0,a.useState)(``),[pe,me]=(0,a.useState)(null),[H,W]=(0,a.useState)(null),[he,ge]=(0,a.useState)(new Set),[_e,ve]=(0,a.useState)(1),[G,ye]=(0,a.useState)(l),[K,be]=(0,a.useState)(le),[xe,Se]=(0,a.useState)({}),Ce=(0,a.useRef)(null),[we,Te]=(0,a.useState)(null),Ee=F>0?+!!R+ +!!I+Math.min(F,K.length):0;(0,a.useLayoutEffect)(()=>{let e=Ce.current;if(Ee===0||!e){Te(null);return}let t=()=>{let t=Array.from(e.children).slice(0,Ee),n=0,r=t.map(e=>{let t=n;return n+=e.getBoundingClientRect().width,t});Te(e=>e&&e.length===r.length&&e.every((e,t)=>Math.abs(e-r[t])<.5)?e:r)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return Array.from(e.children).slice(0,Ee).forEach(e=>n.observe(e)),()=>n.disconnect()},[Ee,K]);let[De,Oe]=(0,a.useState)(null),[ke,Ae]=(0,a.useState)(null),[je,Me]=(0,a.useState)(null),Ne=(0,a.useRef)(null),[Pe,Fe]=(0,a.useState)(``),[Ie,Le]=(0,a.useState)(new Map),[Re,ze]=(0,a.useState)(!1),[Be,Ve]=(0,a.useState)(null),[He,Ue]=(0,a.useState)(new Set),[We,Ge]=(0,a.useState)(null),Ke=(0,a.useRef)(null),qe=(0,a.useRef)(0),Je=(0,a.useRef)(0),Ye=(0,a.useRef)(null),Xe=(0,a.useRef)(!1),Ze=(0,a.useRef)(null),Qe=(0,a.useRef)(null);(0,a.useEffect)(()=>{be(le)},[le]),(0,a.useEffect)(()=>{S!==void 0&&ge(new Set)},[S]);let $e=(0,a.useMemo)(()=>de?ce.filter(e=>K.some(t=>e[t.accessorKey]?.toString().toLowerCase().includes(de.toLowerCase()))):ce,[ce,de,K]),et=(0,a.useMemo)(()=>{if(g||!pe||!H)return $e;let e=$e.map(e=>({row:e,key:(0,t.getSortValue)(e[pe])}));return e.sort((e,n)=>{let r=(0,t.compareSortValues)(e.key,n.key);return H===`asc`?r:-r}),e.map(e=>e.row)},[$e,pe,H,g]),J=d?Math.max(1,p??1):_e,tt=d?Math.max(1,Math.ceil((f??et.length)/G)):Math.ceil(et.length/G),nt=s&&!d?et.slice((_e-1)*G,_e*G):et,rt=e=>{let t=Math.min(tt,Math.max(1,e));d?m?.(t):ve(t)},it=e=>{ye(e),d?(h?.(e),m?.(1)):ve(1)},at=a.default.useMemo(()=>{let e=u&&u.length>0?u:[5,10,20,50,100];return Array.from(new Set([...e,G])).filter(e=>Number.isFinite(e)&&e>0).sort((e,t)=>e-t)},[u,G]),ot=(e,t)=>e.id===void 0?`row-${t}`:e.id,st=g?_??[]:pe&&H?[{field:pe,order:H}]:[],ct=C&&(!g||!!v),lt=(e,t)=>{if(g){v?.([{field:e,order:t}]);return}me(e),W(t)},ut=e=>{if(ct){if(g){let t=st.find(t=>t.field===e);lt(e,t?.order===`asc`?`desc`:`asc`);return}pe===e?H===`asc`?W(`desc`):H===`desc`&&(W(null),me(null)):(me(e),W(`asc`))}},dt=(e,t)=>{e.preventDefault(),Ge({x:e.clientX,y:e.clientY,columnKey:t})},ft=e=>{be(t=>t.filter(t=>t.accessorKey!==e)),Ge(null)};(0,a.useEffect)(()=>{if(!We)return;let e=()=>Ge(null);return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[We]);let pt=t=>{let n=new Set;if(t&&nt.forEach((e,t)=>{let r=(J-1)*G+t,i=ot(e,r);n.add(i)}),ge(n),e.onSelectionChange){let t=et.filter((e,t)=>{let r=ot(e,t);return n.has(r)});e.onSelectionChange(t)}},mt=(t,n)=>{let r=new Set(L===`single`?[]:he);if(n?r.add(t):r.delete(t),ge(r),e.onSelectionChange){let t=et.filter((e,t)=>{let n=ot(e,t);return r.has(n)});e.onSelectionChange(t)}},ht=()=>{let e=[K.map(e=>e.header).join(`,`),...et.map(e=>K.map(t=>JSON.stringify(e[t.accessorKey]||``)).join(`,`))].join(`
19
- `),t=new Blob([e],{type:`text/csv`}),n=window.URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`table-export.csv`,r.click(),window.URL.revokeObjectURL(n)},gt=e=>{let t=st.findIndex(t=>t.field===e);return t===-1?(0,o.jsx)(c.ChevronsUpDown,{className:`h-3 w-3 ml-0.5 opacity-0 group-hover:opacity-50 transition-opacity`}):(0,o.jsxs)(`span`,{className:`inline-flex items-center shrink-0`,children:[(0,o.jsx)(st[t].order===`asc`?c.ChevronUp:c.ChevronDown,{className:`h-3 w-3 ml-0.5 text-primary`}),st.length>1&&(0,o.jsx)(`span`,{className:`text-[10px] font-medium text-primary tabular-nums leading-none`,children:t+1})]})},_t=(e,t)=>{if(!E)return;e.preventDefault(),e.stopPropagation(),Ke.current=t,qe.current=e.clientX;let n=e.target.closest(`th`);n&&(Je.current=n.offsetWidth),document.addEventListener(`mousemove`,yt),document.addEventListener(`mouseup`,bt)},yt=e=>{if(!Ke.current)return;let t=e.clientX-qe.current,n=Math.max(50,Je.current+t);Se(e=>({...e,[Ke.current]:n}))},bt=()=>{Ke.current=null,document.removeEventListener(`mousemove`,yt),document.removeEventListener(`mouseup`,bt)},xt=(e,t)=>{ie&&(Oe(t),e.dataTransfer.effectAllowed=`move`)},St=(e,t)=>{ie&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,Ae(t))},Ct=(t,n)=>{if(!ie||De===null)return;if(t.preventDefault(),De===n){Oe(null),Ae(null);return}let r=[...K],[i]=r.splice(De,1);r.splice(n,0,i),be(r),Oe(null),Ae(null),e.onColumnsReorder&&e.onColumnsReorder(r),z?.onReorderFields?.(r.map(e=>e.accessorKey))},wt=()=>{Oe(null),Ae(null)},Tt=(e,t)=>{if(!O)return;let n=Ne.current;if(n?.rowIndex===e&&n?.columnKey===t||K.find(e=>e.accessorKey===t)?.editable===!1)return;Ne.current={rowIndex:e,columnKey:t},Me({rowIndex:e,columnKey:t});let r=Ie.get(e),i=nt[e][t],a=r?.[t]??i??``;Fe(a),Qe.current=r&&t in r?{had:!0,value:r[t]}:{had:!1,value:void 0}},Et=(t=!1,n)=>{if(!je||!t&&je===null)return;let{rowIndex:r,columnKey:i}=je,a=(J-1)*G+r,o=et[d?r:a],s=n===void 0?Pe:n,c=new Map(Ie),l=c.get(r)||{};l[i]=s,c.set(r,l),Le(c),e.onCellChange&&e.onCellChange(a,i,s,o),Qe.current=null,Ne.current=null,Me(null),Fe(``)},Dt=(0,a.useRef)(Et);(0,a.useEffect)(()=>{Dt.current=Et});let Ot=e=>{let t=Ne.current,n=Qe.current;if(Qe.current=null,e&&t&&n){let{rowIndex:e,columnKey:r}=t;Le(t=>{let i=t.get(e);if(!(i&&r in i)&&!n.had)return t;let a=new Map(t),o={...i||{}};return n.had?o[r]=n.value:delete o[r],Object.keys(o).length>0?a.set(e,o):a.delete(e),a})}Ne.current=null,Me(null),Fe(``)},kt=()=>{Xe.current=!0,Ot(!0)},At=e=>{if(!je)return;let{rowIndex:t,columnKey:n}=je;Fe(e),Le(r=>{let i=new Map(r),a={...i.get(t)||{}};return a[n]=e,i.set(t,a),i})},jt=()=>{if(Xe.current){Xe.current=!1;return}Et(!0)},Mt=async t=>{let n=(J-1)*G+t,r=et[d?t:n],i=Ie.get(t);if(!(!i||Object.keys(i).length===0)){ze(!0);try{e.onRowSave&&await e.onRowSave(n,i,r);let a=new Map(Ie);a.delete(t),Le(a),je?.rowIndex===t&&(Ne.current=null,Me(null),Fe(``)),Ue(e=>{if(!e.has(t))return e;let n=new Set(e);return n.delete(t),n.size===0&&Ve(null),n})}catch(e){console.error(`Failed to save row:`,e),Ve(Jl(e)),Ue(e=>new Set(e).add(t))}finally{ze(!1)}}},Nt=e=>{let t=new Map(Ie);t.delete(e),Le(t),Ue(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n.size===0&&Ve(null),n})},Pt=async()=>{if(Ie.size!==0){ze(!0);try{let t=Array.from(Ie.entries()).map(([e,t])=>{let n=(J-1)*G+e;return{rowIndex:n,changes:t,row:et[d?e:n]}});e.onBatchSave&&await e.onBatchSave(t),Le(new Map),Ne.current=null,Me(null),Fe(``),Ue(new Set),Ve(null)}catch(e){console.error(`Failed to save batch:`,e),Ve(Jl(e)),Ue(new Set(Ie.keys()))}finally{ze(!1)}}},Ft=()=>{Le(new Map),Ue(new Set),Ve(null)},It=(e,t,n)=>{if((e.ctrlKey||e.metaKey)&&e.key===`c`&&!je){e.preventDefault();let r=(J-1)*G+t,i=et[d?t:r];if(i){let e=i[n],t=e==null?``:String(e);navigator.clipboard.writeText(t).catch(()=>{})}return}O&&K.find(e=>e.accessorKey===n)?.editable!==!1&&e.key===`Enter`&&!je&&(e.preventDefault(),Tt(t,n))},Lt=e=>{e.key===`Enter`?(e.preventDefault(),Xe.current=!0,Et(!0)):e.key===`Escape`&&(e.preventDefault(),kt())};(0,a.useEffect)(()=>{je&&Ye.current&&(Ye.current.focus(),Ye.current.select())},[je]),(0,a.useEffect)(()=>{if(!je)return;let e=e=>{let t=Ze.current;if(!t)return;let n=e.target;if(!(!n||t.contains(n))){if(n instanceof Element){let e=n.closest(`[data-radix-popper-content-wrapper]`);if(e&&!e.contains(t))return;let r=n.closest(`[role="dialog"],[role="alertdialog"]`);if(r&&!r.contains(t))return}Dt.current(!0)}};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[je]),(0,a.useEffect)(()=>()=>{document.removeEventListener(`mousemove`,yt),document.removeEventListener(`mouseup`,bt)},[]);let Rt=nt.length>0&&nt.every((e,t)=>{let n=(J-1)*G+t,r=ot(e,n);return he.has(r)}),zt=nt.some((e,t)=>{let n=(J-1)*G+t,r=ot(e,n);return he.has(r)})&&!Rt,Bt=Ie.size>0,Vt=y||w||x&&R&&he.size>0||Bt;return(0,o.jsxs)(`div`,{className:`flex flex-col h-full gap-2 sm:gap-4 ${N||``}`,children:[Vt&&(0,o.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-2 sm:gap-4 flex-none`,children:[(0,o.jsx)(`div`,{className:`flex items-center gap-2 flex-1`,children:y&&(0,o.jsxs)(`div`,{className:`relative w-full sm:max-w-sm flex-1`,children:[(0,o.jsx)(c.Search,{className:`absolute left-2 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,o.jsx)(X,{placeholder:V(`table.search`),value:de,onChange:e=>{fe(e.target.value),ve(1)},className:`pl-8`})]})}),(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Bt&&(0,o.jsxs)(o.Fragment,{children:[Be&&(0,o.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-1.5 text-sm text-destructive max-w-[16rem] sm:max-w-sm`,children:[(0,o.jsx)(c.AlertCircle,{className:`h-4 w-4 flex-none`}),(0,o.jsxs)(`span`,{className:`truncate`,title:`${V(`table.saveFailed`)}: ${Be}`,children:[V(`table.saveFailed`),`: `,Be]})]}),(0,o.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:V(`table.modified`,{count:Ie.size})}),(0,o.jsxs)(q,{variant:`outline`,size:`sm`,onClick:Ft,disabled:Re,children:[(0,o.jsx)(c.X,{className:`h-4 w-4 mr-2`}),V(`table.cancelAll`)]}),(0,o.jsxs)(q,{variant:`default`,size:`sm`,onClick:Pt,disabled:Re,children:[(0,o.jsx)(c.Save,{className:`h-4 w-4 mr-2`}),V(`table.saveAll`,{count:Ie.size})]})]}),w&&(0,o.jsxs)(q,{variant:`outline`,size:`sm`,onClick:ht,disabled:et.length===0,children:[(0,o.jsx)(c.Download,{className:`h-4 w-4 mr-2`}),V(`table.exportCSV`)]}),x&&R&&he.size>0&&(0,o.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:V(`table.selected`,{count:he.size})})]})]}),(0,o.jsx)(`div`,{className:U(`relative bg-background`,ne?`overflow-visible`:`flex-1 min-h-0 overflow-auto [-webkit-overflow-scrolling:touch]`,!te&&`rounded-md border shadow-[inset_-8px_0_8px_-8px_rgba(0,0,0,0.08)]`),children:(0,o.jsxs)(Bi,{containerClassName:`overflow-visible`,children:[n&&(0,o.jsx)(qi,{children:n}),(0,o.jsx)(Vi,{className:`sticky top-0 bg-background z-10`,children:(0,o.jsxs)(Wi,{ref:Ce,children:[R&&(0,o.jsx)(Gi,{className:U(`w-10 bg-background px-3`,F>0&&`sticky left-0 z-20`),children:L===`multiple`&&(0,o.jsx)(vt,{checked:Rt?!0:zt?`indeterminate`:!1,onCheckedChange:pt})}),I&&(0,o.jsx)(Gi,{className:U(`w-10 bg-background text-center px-3`,F>0&&`sticky z-20`),style:F>0?{left:we?.[+!!R]??(R?40:0)}:void 0,children:(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`#`})}),K.map((e,t)=>{let n=e.fitContent===!0&&!xe[e.accessorKey]&&!e.width,r=n?`1%`:xe[e.accessorKey]||e.width||ue[e.accessorKey],i=De===t,a=ke===t,s=F>0&&t<F,l=typeof e.className==`string`&&/\bsticky\b/.test(e.className)&&/\bright-0\b/.test(e.className),u=s?we?.[+!!R+ +!!I+t]??K.slice(0,t).reduce((e,t,n)=>{if(n<F){let n=xe[t.accessorKey]||t.width||ue[t.accessorKey];return e+(typeof n==`number`?n:n&&parseInt(String(n),10)||150)}return e},(R?40:0)+(I?40:0)):void 0;return(0,o.jsx)(Gi,{className:U(e.className,ct&&e.sortable!==!1&&`cursor-pointer select-none`,i&&`opacity-50`,a&&`border-l-2 border-primary`,e.align===`right`&&`text-right`,e.align===`center`&&`text-center`,n&&`whitespace-nowrap`,`group bg-background`,!l&&`relative`,l&&`sticky right-0 z-20`,s&&`sticky z-20`,s&&t===F-1&&`border-r-2 border-border shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]`),style:{width:r,minWidth:r,...s&&{left:u}},draggable:ie,onDragStart:e=>xt(e,t),onDragOver:e=>St(e,t),onDrop:e=>Ct(e,t),onDragEnd:wt,onClick:()=>ct&&e.sortable!==!1&&ut(e.accessorKey),onContextMenu:t=>dt(t,e.accessorKey),children:(0,o.jsxs)(`div`,{className:U(`flex items-center`,e.align===`right`?`justify-end`:`justify-between`),children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-1`,children:[ie&&(0,o.jsx)(c.GripVertical,{className:`h-4 w-4 opacity-0 group-hover:opacity-50 cursor-grab active:cursor-grabbing shrink-0`}),e.headerIcon&&(0,o.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:e.headerIcon}),(0,o.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground whitespace-nowrap truncate`,children:e.header}),ct&&e.sortable!==!1&&gt(e.accessorKey),B&&(0,o.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),z.onEditColumn(e.accessorKey)},title:z.editColumnLabel??`Edit field`,"aria-label":z.editColumnLabel??`Edit field`,"data-testid":`grid-edit-column-${e.accessorKey}`,className:`ml-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground/50 opacity-0 transition-opacity hover:bg-muted hover:text-foreground group-hover:opacity-100`,children:(0,o.jsx)(c.Edit,{className:`h-3 w-3`})})]}),E&&e.resizable!==!1&&(0,o.jsx)(`div`,{className:`absolute right-0 top-0 h-full w-1 cursor-col-resize hover:bg-primary opacity-0 hover:opacity-100 transition-opacity`,onMouseDown:t=>_t(t,e.accessorKey),onClick:e=>e.stopPropagation()})]})},e.accessorKey)}),T&&(0,o.jsx)(Gi,{className:`w-24 text-right bg-background`,children:V(`common.actions`)}),re&&(0,o.jsx)(Gi,{className:`w-10 bg-background px-1 text-center`,children:(0,o.jsx)(`button`,{type:`button`,onClick:z.onAddColumn,title:z.addColumnLabel??`Add field`,"aria-label":z.addColumnLabel??`Add field`,"data-testid":`grid-add-column`,className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,o.jsx)(c.Plus,{className:`h-4 w-4`})})})]})}),(0,o.jsx)(Hi,{children:nt.length===0?(0,o.jsx)(Wi,{className:`hover:bg-transparent`,children:(0,o.jsx)(Ki,{colSpan:K.length+ +!!R+ +!!I+ +!!T+ +!!re,className:`h-48 text-center text-muted-foreground border-0`,children:(0,o.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3`,children:[(0,o.jsx)(c.Search,{className:`h-8 w-8 text-muted-foreground/50`}),(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(`p`,{children:V(`table.noResults`)}),(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground/50`,children:V(`table.noResultsHint`)})]}),e.emptyAction&&(()=>{let n=e.emptyAction,r=n?.type?t.ComponentRegistry.get(n.type):null;return r?(0,o.jsx)(r,{schema:n}):null})()]})})}):(0,o.jsxs)(o.Fragment,{children:[nt.map((t,n)=>{let r=(J-1)*G+n,i=ot(t,r),a=he.has(i),s=Ie.has(n),l=Ie.get(n)||{};return(0,o.jsxs)(Wi,{"data-state":a?`selected`:void 0,className:U(`bg-background border-b border-border/60 group/row transition-colors`,`hover:bg-muted/40`,`data-[state=selected]:bg-primary/5 data-[state=selected]:hover:bg-primary/10`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset`,e.onRowClick&&`cursor-pointer`,s&&!He.has(n)&&`bg-amber-50 dark:bg-amber-950/20`,He.has(n)&&`bg-destructive/10 dark:bg-destructive/15 ring-1 ring-inset ring-destructive/40`,j&&j(t,n)),style:M?M(t,n):void 0,onClick:n=>{if(e.onRowClick&&!n.defaultPrevented){let r=n.target;if(r.closest(`button`)||r.closest(`a`)||r.closest(`input, select, textarea, label`)||r.closest(`[role="checkbox"]`)||r.closest(`[role="menu"]`)||r.closest(`[role="menuitem"]`)||r.closest(`[role="menuitemcheckbox"]`)||r.closest(`[role="menuitemradio"]`)||r.closest(`[role="dialog"]`)||r.closest(`[role="alertdialog"]`)||r.closest(`[role="listbox"]`)||r.closest(`[role="option"]`)||r.closest(`[role="tab"]`)||r.closest(`[data-radix-popper-content-wrapper]`))return;e.onRowClick(t)}},children:[R&&(0,o.jsx)(Ki,{className:U(P,`px-3`,F>0&&`sticky left-0 z-10 bg-background`,A===`hover`&&`relative`),children:A===`hover`?(0,o.jsx)(`div`,{className:U(`transition-opacity`,a?`opacity-100`:`opacity-0 group-hover/row:opacity-100`),children:(0,o.jsx)(vt,{checked:a,onCheckedChange:e=>mt(i,e)})}):(0,o.jsx)(vt,{checked:a,onCheckedChange:e=>mt(i,e)})}),I&&(0,o.jsxs)(Ki,{className:U(`text-center w-10 relative`,P,F>0&&`sticky z-10 bg-background`),style:F>0?{left:we?.[+!!R]??(R?40:0)}:void 0,children:[(0,o.jsx)(`span`,{className:U(`text-xs text-muted-foreground tabular-nums select-none`,!R&&e.onRowClick&&`group-hover/row:invisible`),children:r+1}),!R&&e.onRowClick&&(0,o.jsxs)(`button`,{type:`button`,className:`absolute inset-0 hidden group-hover/row:flex items-center justify-center gap-0.5 text-xs font-medium text-primary hover:text-primary/80`,"data-testid":`row-expand-button`,onClick:n=>{n.stopPropagation(),e.onRowClick?.(t)},title:`Open record`,children:[(0,o.jsx)(`span`,{children:V(`table.open`)}),(0,o.jsx)(c.ChevronRight,{className:`h-3 w-3`})]})]}),K.map((r,i)=>{let a=r.fitContent===!0&&!xe[r.accessorKey]&&!r.width,s=a?`1%`:xe[r.accessorKey]||r.width||ue[r.accessorKey],c=t[r.accessorKey],u=l[r.accessorKey]!==void 0,d=u?l[r.accessorKey]:c,f=je?.rowIndex===n&&je?.columnKey===r.accessorKey,p=O&&r.editable!==!1,m=F>0&&i<F,h=m?we?.[+!!R+ +!!I+i]??K.slice(0,i).reduce((e,t,n)=>{if(n<F){let n=xe[t.accessorKey]||t.width||ue[t.accessorKey];return e+(typeof n==`number`?n:n&&parseInt(String(n),10)||150)}return e},(R?40:0)+(I?40:0)):void 0;return(0,o.jsx)(Ki,{className:U(r.cellClassName,r.align===`right`&&`text-right`,r.align===`center`&&`text-center`,a?`whitespace-nowrap`:`overflow-hidden`,p&&!f&&`cursor-text hover:bg-muted/50`,u&&`font-semibold text-amber-700 dark:text-amber-400`,m&&`sticky z-10 bg-background`,m&&i===F-1&&`border-r-2 border-border shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]`),style:{width:s,minWidth:a?void 0:s,maxWidth:a?void 0:s,...m&&{left:h}},onDoubleClick:e=>{p&&!k&&(e.stopPropagation(),Tt(n,r.accessorKey))},onClick:e=>{p&&k&&(e.stopPropagation(),Tt(n,r.accessorKey))},onKeyDown:e=>It(e,n,r.accessorKey),tabIndex:0,children:f?(()=>{let n=r.type,i=e.renderCellEditor;if(typeof i==`function`){let e=i({column:r,row:t,value:Pe,stage:At,commit:e=>Et(!0,e),cancel:kt});if(e!=null)return(0,o.jsx)(`div`,{ref:e=>{Ze.current=e},className:`w-full`,onKeyDown:e=>{e.currentTarget.contains(e.target)&&(e.key===`Enter`&&e.target.tagName===`INPUT`?(e.preventDefault(),Et(!0)):e.key===`Escape`&&(e.preventDefault(),Ot(!0)))},children:e})}return n===`date`?(0,o.jsx)(X,{ref:Ye,type:`date`,value:Ul(Pe),onChange:e=>Fe(e.target.value),onKeyDown:Lt,onBlur:jt,className:`h-8 px-2 py-1`}):n===`datetime`||n===`datetime-local`?(0,o.jsx)(X,{ref:Ye,type:`datetime-local`,value:Wl(Pe),onChange:e=>{let t=e.target.value,n=t?new Date(t):null;Fe(n&&!Number.isNaN(n.getTime())?n.toISOString():t)},onKeyDown:Lt,onBlur:jt,className:`h-8 px-2 py-1`}):n&&Gl.has(n)?(0,o.jsx)(X,{ref:Ye,type:`number`,value:Pe??``,onChange:e=>Fe(e.target.value),onKeyDown:Lt,onBlur:jt,className:`h-8 px-2 py-1`}):typeof Pe==`object`&&Pe?(0,o.jsx)(X,{ref:Ye,value:Kl(Pe),readOnly:!0,onKeyDown:Lt,onBlur:kt,className:`h-8 px-2 py-1 text-muted-foreground cursor-default`,title:Kl(Pe)}):(0,o.jsx)(X,{ref:Ye,value:Pe,onChange:e=>Fe(e.target.value),onKeyDown:Lt,onBlur:jt,className:`h-8 px-2 py-1`})})():(0,o.jsx)(`div`,{className:a?`w-full whitespace-nowrap`:`truncate w-full`,title:!a&&d!=null&&typeof d!=`object`?String(d):void 0,children:typeof r.cell==`function`?r.cell(d,t):typeof d==`object`&&d?String(d):se(d)})},i)}),T&&(0,o.jsx)(Ki,{className:U(`text-right`,P),children:(0,o.jsx)(`div`,{className:`flex items-center justify-end gap-1`,children:s&&(e.onRowSave||e.onBatchSave)?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(q,{variant:`ghost`,size:`icon`,onClick:()=>Nt(n),disabled:Re,title:`Cancel changes`,children:(0,o.jsx)(c.X,{className:`h-4 w-4`})}),(0,o.jsx)(q,{variant:`ghost`,size:`icon`,onClick:()=>Mt(n),disabled:Re,title:`Save row`,children:(0,o.jsx)(c.Save,{className:`h-4 w-4 text-green-600`})})]}):(()=>{let n=Array.isArray(e.rowActionDefs)&&e.onRowActionDef?e.rowActionDefs:[];return!e.onRowEdit&&!e.onRowDelete&&n.length===0?null:(0,o.jsxs)(pn,{children:[(0,o.jsx)(mn,{asChild:!0,children:(0,o.jsx)(q,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:e=>e.stopPropagation(),"aria-label":`Row actions`,children:(0,o.jsx)(c.MoreHorizontal,{className:`h-4 w-4`})})}),(0,o.jsxs)(xn,{align:`end`,onClick:e=>e.stopPropagation(),children:[e.onRowEdit&&(0,o.jsx)(Xl,{name:`edit`,predicates:e.rowEditPredicates,row:t,icon:(0,o.jsx)(c.Edit,{className:`mr-2 h-4 w-4`}),label:V(`table.edit`),onSelect:t=>e.onRowEdit?.(t)}),n.length>0&&e.onRowEdit&&(0,o.jsx)(En,{}),n.map(n=>(0,o.jsx)(Yl,{action:n,row:t,onActionDef:e.onRowActionDef},n.name)),e.onRowDelete&&(e.onRowEdit||n.length>0)&&(0,o.jsx)(En,{}),e.onRowDelete&&(0,o.jsx)(Xl,{name:`delete`,predicates:e.rowDeletePredicates,row:t,icon:(0,o.jsx)(c.Trash2,{className:`mr-2 h-4 w-4`}),label:V(`table.delete`),className:`text-destructive focus:text-destructive`,onSelect:t=>e.onRowDelete?.(t)})]})]})})()})}),re&&(0,o.jsx)(Ki,{"aria-hidden":!0,className:`w-10`})]},i)}),ee&&(0,o.jsx)(Wi,{className:`hover:bg-muted/30 cursor-pointer border-b border-border`,"data-testid":`add-record-row`,onClick:()=>e.onAddRecord?.(),children:(0,o.jsx)(Ki,{colSpan:K.length+ +!!R+ +!!I+ +!!T+ +!!re,className:`h-9 px-3 py-1.5`,children:(0,o.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground text-sm hover:text-foreground transition-colors`,children:[(0,o.jsx)(c.Plus,{className:`h-3.5 w-3.5`}),V(`table.addRecord`)]})})})]})})]})}),s&&et.length>0&&tt>1&&(0,o.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-center justify-between gap-2 px-3 sm:px-4 py-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsxs)(`span`,{className:`text-xs sm:text-sm text-muted-foreground`,children:[V(`table.rowsPerPage`),`:`]}),(0,o.jsxs)(Mr,{value:G.toString(),onValueChange:e=>it(Number(e)),children:[(0,o.jsx)(Fr,{className:`w-20`,children:(0,o.jsx)(Pr,{})}),(0,o.jsx)(Rr,{children:at.map(e=>(0,o.jsx)(Z,{value:e.toString(),children:e},e))})]})]}),(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(`span`,{className:`text-xs sm:text-sm text-muted-foreground`,children:V(`table.pageInfo`,{current:J,total:tt})}),(0,o.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,o.jsx)(q,{variant:`outline`,size:`icon`,onClick:()=>rt(1),disabled:J===1,children:(0,o.jsx)(c.ChevronsLeft,{className:`h-4 w-4`})}),(0,o.jsx)(q,{variant:`outline`,size:`icon`,onClick:()=>rt(J-1),disabled:J===1,children:(0,o.jsx)(c.ChevronLeft,{className:`h-4 w-4`})}),(0,o.jsx)(q,{variant:`outline`,size:`icon`,onClick:()=>rt(J+1),disabled:J===tt,children:(0,o.jsx)(c.ChevronRight,{className:`h-4 w-4`})}),(0,o.jsx)(q,{variant:`outline`,size:`icon`,onClick:()=>rt(tt),disabled:J===tt,children:(0,o.jsx)(c.ChevronsRight,{className:`h-4 w-4`})})]})]})]}),We&&(0,o.jsxs)(`div`,{className:`fixed z-50 min-w-[160px] rounded-md border bg-popover p-1 shadow-md`,style:{left:We.x,top:We.y},"data-testid":`column-context-menu`,onClick:e=>e.stopPropagation(),children:[ct&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground cursor-pointer`,onClick:()=>{lt(We.columnKey,`asc`),Ge(null)},children:[(0,o.jsx)(c.ChevronUp,{className:`h-3.5 w-3.5`}),V(`table.sortAsc`)]}),(0,o.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground cursor-pointer`,onClick:()=>{lt(We.columnKey,`desc`),Ge(null)},children:[(0,o.jsx)(c.ChevronDown,{className:`h-3.5 w-3.5`}),V(`table.sortDesc`)]}),(0,o.jsx)(`div`,{className:`my-1 h-px bg-border`})]}),(0,o.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground cursor-pointer`,onClick:()=>ft(We.columnKey),children:[(0,o.jsx)(c.X,{className:`h-3.5 w-3.5`}),V(`table.hideColumn`)]})]})]})},{namespace:`ui`,label:`Data Table`,icon:`table`,inputs:[{name:`caption`,type:`string`,label:`Caption`},{name:`columns`,type:`array`,label:`Columns`,description:`Array of { header, accessorKey, className, width, sortable, filterable, resizable }`,required:!0},{name:`data`,type:`array`,label:`Data`,description:`Array of data objects`,required:!0},{name:`pagination`,type:`boolean`,label:`Enable Pagination`,defaultValue:!0},{name:`pageSize`,type:`number`,label:`Page Size`,defaultValue:10},{name:`searchable`,type:`boolean`,label:`Enable Search`,defaultValue:!0},{name:`selectable`,type:`boolean`,label:`Enable Row Selection`,defaultValue:!1},{name:`sortable`,type:`boolean`,label:`Enable Sorting`,defaultValue:!0},{name:`exportable`,type:`boolean`,label:`Enable Export`,defaultValue:!1},{name:`rowActions`,type:`boolean`,label:`Show Row Actions`,defaultValue:!1},{name:`resizableColumns`,type:`boolean`,label:`Enable Column Resizing`,defaultValue:!0},{name:`reorderableColumns`,type:`boolean`,label:`Enable Column Reordering`,defaultValue:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{caption:`Enterprise Data Table`,pagination:!0,pageSize:10,searchable:!0,selectable:!0,sortable:!0,exportable:!0,rowActions:!0,resizableColumns:!0,reorderableColumns:!0,columns:[{header:`ID`,accessorKey:`id`,width:`80px`},{header:`Name`,accessorKey:`name`},{header:`Email`,accessorKey:`email`},{header:`Status`,accessorKey:`status`},{header:`Role`,accessorKey:`role`}],data:[{id:1,name:`John Doe`,email:`john@example.com`,status:`Active`,role:`Admin`},{id:2,name:`Jane Smith`,email:`jane@example.com`,status:`Active`,role:`User`},{id:3,name:`Bob Johnson`,email:`bob@example.com`,status:`Inactive`,role:`User`},{id:4,name:`Alice Williams`,email:`alice@example.com`,status:`Active`,role:`Manager`},{id:5,name:`Charlie Brown`,email:`charlie@example.com`,status:`Active`,role:`User`},{id:6,name:`Diana Prince`,email:`diana@example.com`,status:`Active`,role:`Admin`},{id:7,name:`Ethan Hunt`,email:`ethan@example.com`,status:`Inactive`,role:`User`},{id:8,name:`Fiona Gallagher`,email:`fiona@example.com`,status:`Active`,role:`User`},{id:9,name:`George Wilson`,email:`george@example.com`,status:`Active`,role:`Manager`},{id:10,name:`Hannah Montana`,email:`hannah@example.com`,status:`Active`,role:`User`},{id:11,name:`Ivan Drago`,email:`ivan@example.com`,status:`Inactive`,role:`User`},{id:12,name:`Julia Roberts`,email:`julia@example.com`,status:`Active`,role:`Admin`}]}});var Ql=(0,a.forwardRef)(({schema:e,className:t,context:n,...r},s)=>{let{"data-obj-id":l,"data-obj-type":u,style:d,data:f,...p}=r,{execute:m}=(0,i.useAction)(),[h,g]=(0,a.useState)(!1),_=typeof f==`object`&&f?f:{},v=(0,i.useCondition)((0,i.toPredicateInput)(e.visible),_,{throwOnError:!0,label:`action "${e.name??e.label??`action:button`}" (visible)`}),y=(0,i.useCondition)((0,i.toPredicateInput)(e.disabled),_),b=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled),_),x=Rl(e.icon),S=e.variant===`primary`?`default`:e.variant||`default`,C=e.size===`md`?`default`:e.size||`default`,w=(0,a.useCallback)(async()=>{if(!h){g(!0);try{let t=Array.isArray(e.params)?{actionParams:e.params}:{params:e.params};await m({type:e.actionType||e.type,name:e.name,label:e.label,description:e.description,target:e.target,openIn:e.openIn,endpoint:e.endpoint,method:e.method,...t,confirmText:e.confirmText,successMessage:e.successMessage,errorMessage:e.errorMessage,refreshAfter:e.refreshAfter,undoable:e.undoable,recordIdField:e.recordIdField,locations:e.locations,toast:e.toast,resultDialog:e.resultDialog,...n})}finally{g(!1)}}},[e,m,h,n]),T=(0,a.useRef)(!1),E=e.autoTrigger===!0;return(0,a.useEffect)(()=>{!E||T.current||(T.current=!0,w())},[E,w]),e.visible&&!v?null:(0,o.jsxs)(q,{ref:s,type:`button`,variant:S,size:C,className:U(e.className,t),disabled:(e.disabled==null?e.enabled!=null&&!b:y)||h,onClick:w,...p,"data-obj-id":l,"data-obj-type":u,style:d,children:[h&&(0,o.jsx)(c.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),!h&&x&&(0,o.jsx)(x,{className:U(`h-4 w-4`,e.label&&`mr-2`)}),e.label]})});Ql.displayName=`ActionButtonRenderer`,t.ComponentRegistry.register(`button`,Ql,{namespace:`action`,skipFallback:!0,label:`Action Button`,inputs:[{name:`name`,type:`string`,label:`Action Name`},{name:`label`,type:`string`,label:`Label`,defaultValue:`Action`},{name:`icon`,type:`string`,label:`Icon`},{name:`type`,type:`enum`,label:`Action Type`,enum:[`script`,`url`,`modal`,`flow`,`api`],defaultValue:`script`},{name:`target`,type:`string`,label:`Target`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`default`,`primary`,`secondary`,`destructive`,`outline`,`ghost`],defaultValue:`default`},{name:`size`,type:`enum`,label:`Size`,enum:[`sm`,`md`,`lg`],defaultValue:`md`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{label:`Action`,type:`script`,variant:`default`,size:`md`}});var $l=(0,a.forwardRef)(({schema:e,className:t,context:n,...r},s)=>{let{"data-obj-id":l,"data-obj-type":u,style:d,...f}=r,{execute:p}=(0,i.useAction)(),[m,h]=(0,a.useState)(!1),g=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),_=(0,i.useCondition)((0,i.toPredicateInput)(e.disabled)),v=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled)),y=Rl(e.icon),b=e.variant===`primary`?`default`:e.variant||`ghost`,x=(0,a.useCallback)(async()=>{if(!m){h(!0);try{await p({type:e.type,name:e.name,target:e.target,openIn:e.openIn,endpoint:e.endpoint,method:e.method,params:e.params,confirmText:e.confirmText,successMessage:e.successMessage,errorMessage:e.errorMessage,refreshAfter:e.refreshAfter,locations:e.locations,toast:e.toast,...n})}finally{h(!1)}}},[e,p,m,n]);if(e.visible&&!g)return null;let S=(0,o.jsx)(q,{ref:s,type:`button`,variant:b,size:`icon`,className:U(`h-8 w-8`,e.className,t),disabled:(e.disabled==null?e.enabled!=null&&!v:_)||m,onClick:x,"aria-label":e.label||e.name,...f,"data-obj-id":l,"data-obj-type":u,style:d,children:m?(0,o.jsx)(c.Loader2,{className:`h-4 w-4 animate-spin`}):y?(0,o.jsx)(y,{className:`h-4 w-4`}):(0,o.jsx)(`span`,{className:`text-xs`,children:e.label?.charAt(0)||`?`})});return e.label||e.description?(0,o.jsx)(ti,{delayDuration:300,children:(0,o.jsxs)(ni,{children:[(0,o.jsx)(ri,{asChild:!0,children:S}),(0,o.jsx)(ii,{children:(0,o.jsx)(`p`,{children:e.label||e.description})})]})}):S});$l.displayName=`ActionIconRenderer`,t.ComponentRegistry.register(`icon`,$l,{namespace:`action`,skipFallback:!0,label:`Action Icon`,inputs:[{name:`name`,type:`string`,label:`Action Name`},{name:`label`,type:`string`,label:`Tooltip Label`},{name:`icon`,type:`string`,label:`Icon`},{name:`type`,type:`enum`,label:`Action Type`,enum:[`script`,`url`,`modal`,`flow`,`api`],defaultValue:`script`},{name:`target`,type:`string`,label:`Target`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`default`,`secondary`,`destructive`,`outline`,`ghost`],defaultValue:`ghost`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{icon:`play`,type:`script`,variant:`ghost`}});function eu(){let{t:e}=(0,B.useObjectTranslation)(),t=e(`detail.moreActions`);return!t||t===`detail.moreActions`?`More actions`:t}var tu=({action:e,onExecute:t})=>{let n=(0,i.useCondition)((0,i.toPredicateInput)(e.visible),void 0,{throwOnError:!0,label:`action "${e.name??e.label??`action:menu item`}" (visible)`}),r=(0,i.useCondition)((0,i.toPredicateInput)(e.disabled)),s=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled)),c=(0,a.useMemo)(()=>{let t=Rl(e.icon);return t?(0,o.jsx)(t,{className:`mr-2 h-4 w-4`}):null},[e.icon]);return e.visible&&!n?null:(0,o.jsxs)(Sn,{disabled:e.disabled==null?e.enabled!=null&&!s:r,onSelect:n=>{n.preventDefault(),t(e)},className:U(e.variant===`destructive`&&`text-destructive focus:text-destructive`,e.className),children:[c,(0,o.jsx)(`span`,{children:e.label||e.name})]})};tu.displayName=`ActionMenuItem`;var nu=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let{"data-obj-id":s,"data-obj-type":l,style:u,...d}=n,{execute:f}=(0,i.useAction)(),[p,m]=(0,a.useState)(!1),h=eu(),g=(0,i.useCondition)((0,i.toPredicateInput)(e.visible),void 0,{throwOnError:!0,label:`action:menu "${e.label??e.icon??`menu`}" (visible)`}),_=Rl(e.icon)||c.MoreHorizontal,v=e.variant||`ghost`,y=e.size||`icon`,b=(0,a.useCallback)(async e=>{m(!0);try{if(typeof e.onClick==`function`){await e.onClick();return}await f({type:e.type,name:e.name,target:e.target,openIn:e.openIn,endpoint:e.endpoint,method:e.method,params:e.params,confirmText:e.confirmText,successMessage:e.successMessage,errorMessage:e.errorMessage,refreshAfter:e.refreshAfter,locations:e.locations,toast:e.toast,resultDialog:e.resultDialog})}finally{m(!1)}},[f]);if(e.visible&&!g)return null;let x=e.actions||[];return x.length===0?null:(0,o.jsxs)(pn,{children:[(0,o.jsx)(mn,{asChild:!0,children:(0,o.jsx)(q,{ref:r,type:`button`,variant:v,size:y,className:U(y===`icon`&&`h-8 w-8`,e.className,t),disabled:p,"aria-label":e.label||h,...d,"data-obj-id":s,"data-obj-type":l,style:u,children:p?(0,o.jsx)(c.Loader2,{className:`h-4 w-4 animate-spin`}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(_,{className:U(`h-4 w-4`,e.label&&`mr-2`)}),e.label&&(0,o.jsx)(`span`,{children:e.label})]})})}),(0,o.jsx)(xn,{align:`end`,children:x.map((e,t)=>{let n=e.tags?.includes(`separator-before`)&&t>0;return(0,o.jsxs)(a.default.Fragment,{children:[n&&(0,o.jsx)(En,{}),(0,o.jsx)(tu,{action:e,onExecute:b})]},e.name||t)})})]})});nu.displayName=`ActionMenuRenderer`,t.ComponentRegistry.register(`menu`,nu,{namespace:`action`,skipFallback:!0,label:`Action Menu`,inputs:[{name:`label`,type:`string`,label:`Trigger Label`},{name:`icon`,type:`string`,label:`Trigger Icon`},{name:`actions`,type:`object`,label:`Actions`},{name:`variant`,type:`enum`,label:`Trigger Variant`,enum:[`default`,`secondary`,`outline`,`ghost`],defaultValue:`ghost`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{variant:`ghost`,actions:[]}});var ru=({action:e,variant:t,size:n,onExecute:r})=>{let[s,l]=(0,a.useState)(!1),u=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),d=(0,i.useCondition)((0,i.toPredicateInput)(e.disabled)),f=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled)),p=Rl(e.icon),m=e.variant===`primary`?`default`:e.variant||t||`outline`,h=e.size===`md`?`default`:e.size||n||`sm`,g=(0,a.useCallback)(async()=>{if(!s){l(!0);try{await r(e)}finally{l(!1)}}},[e,r,s]);return e.visible&&!u?null:(0,o.jsxs)(q,{type:`button`,variant:m,size:h,className:e.className,disabled:(e.disabled==null?e.enabled!=null&&!f:d)||s,onClick:g,children:[s&&(0,o.jsx)(c.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),!s&&p&&(0,o.jsx)(p,{className:U(`h-4 w-4`,e.label&&`mr-2`)}),e.label]})};ru.displayName=`InlineActionButton`;var iu=({action:e,index:t,onSelect:n})=>{let r=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),a=(0,i.useCondition)((0,i.toPredicateInput)(e.disabled)),s=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled));if(e.visible&&!r)return null;let c=Rl(e.icon),l=e.disabled==null?e.enabled!=null&&!s:a;return(0,o.jsxs)(o.Fragment,{children:[e.tags?.includes(`separator-before`)&&t>0&&(0,o.jsx)(En,{}),(0,o.jsxs)(Sn,{disabled:l,onSelect:async t=>{t.preventDefault(),!l&&await n(e)},className:U(e.variant===`destructive`&&`text-destructive focus:text-destructive`,e.className),children:[c&&(0,o.jsx)(c,{className:`mr-2 h-4 w-4`}),(0,o.jsx)(`span`,{children:e.label||e.name})]})]})};iu.displayName=`DropdownActionItem`;var au=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let{"data-obj-id":s,"data-obj-type":l,style:u,...d}=n,{execute:f}=(0,i.useAction)(),[p,m]=(0,a.useState)(!1),h=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),g=e.actions||[];e.location&&(g=g.filter(t=>!t.locations||t.locations.includes(e.location)));let _=(0,a.useCallback)(async e=>{await f({type:e.type,name:e.name,target:e.target,openIn:e.openIn,endpoint:e.endpoint,method:e.method,params:e.params,confirmText:e.confirmText,successMessage:e.successMessage,errorMessage:e.errorMessage,refreshAfter:e.refreshAfter,locations:e.locations,toast:e.toast})},[f]),v=(0,a.useCallback)(async e=>{m(!0);try{await _(e)}finally{m(!1)}},[_]);if(e.visible&&!h||g.length===0)return null;if((e.display||`inline`)===`dropdown`){let n=Rl(e.icon);return(0,o.jsxs)(pn,{children:[(0,o.jsx)(mn,{asChild:!0,children:(0,o.jsxs)(q,{type:`button`,variant:e.variant||`outline`,size:e.size===`md`?`default`:e.size||`default`,className:U(e.className,t),disabled:p,"data-obj-id":s,"data-obj-type":l,style:u,children:[p&&(0,o.jsx)(c.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),!p&&n&&(0,o.jsx)(n,{className:`mr-2 h-4 w-4`}),e.label||`Actions`,(0,o.jsx)(c.ChevronDown,{className:`ml-2 h-3 w-3 opacity-50`})]})}),(0,o.jsx)(xn,{align:`end`,children:g.map((e,t)=>(0,o.jsx)(iu,{action:e,index:t,onSelect:v},e.name||t))})]})}return(0,o.jsx)(`div`,{ref:r,className:U(`flex items-center gap-2`,e.className,t),...d,"data-obj-id":s,"data-obj-type":l,style:u,children:g.map(t=>(0,o.jsx)(ru,{action:t,variant:e.variant,size:e.size,onExecute:_},t.name))})});au.displayName=`ActionGroupRenderer`,t.ComponentRegistry.register(`group`,au,{namespace:`action`,skipFallback:!0,label:`Action Group`,inputs:[{name:`name`,type:`string`,label:`Group Name`},{name:`label`,type:`string`,label:`Label`},{name:`icon`,type:`string`,label:`Icon`},{name:`actions`,type:`object`,label:`Actions`},{name:`display`,type:`enum`,label:`Display Mode`,enum:[`inline`,`dropdown`],defaultValue:`inline`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`default`,`secondary`,`outline`,`ghost`],defaultValue:`outline`},{name:`size`,type:`enum`,label:`Size`,enum:[`sm`,`md`,`lg`],defaultValue:`sm`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{display:`inline`,variant:`outline`,size:`sm`,actions:[]}});function ou(){let{t:e}=(0,B.useObjectTranslation)(),t=e(`common.actions`);return!t||t===`common.actions`?`Actions`:t}var su=(0,a.forwardRef)(({schema:e,className:n,...r},s)=>{let c=ou(),{"data-obj-id":l,"data-obj-type":u,style:d,data:f,actions:p,systemActions:m,location:h,maxVisible:g,mobileMaxVisible:_,direction:v,gap:y,variant:b,size:x,visible:S,...C}=r,w=(0,i.useCondition)((0,i.toPredicateInput)(e.visible),void 0,{throwOnError:!0,label:`action:bar${e.location?` (${e.location})`:``} (visible)`}),T=ei(),E=(0,i.useCapabilityGate)(),D=(0,a.useMemo)(()=>{let t=(e.actions||[]).filter(e=>E(e?.requiredPermissions)),n=e.location?t.filter(t=>!t.locations||t.locations.length===0||t.locations.includes(e.location)):t,r=new Set,i=n.filter(e=>e.name?r.has(e.name)?!1:(r.add(e.name),!0):!0);return i.some(e=>e.order!==void 0||e.variant===`primary`)?[...i].sort((e,t)=>{let n=(e.order??0)-(t.order??0);return n===0?(e.variant===`primary`?0:1)-(t.variant===`primary`?0:1):n}):i},[e.actions,e.location,E]),O=(0,a.useMemo)(()=>{let t=e.systemActions||[],n=new Set;return t.filter(e=>E(e?.requiredPermissions)?e.name?n.has(e.name)?!1:(n.add(e.name),!0):!0:!1)},[e.systemActions,E]),k=T?e.mobileMaxVisible??1:e.maxVisible??3,{inlineActions:A,overflowActions:j}=(0,a.useMemo)(()=>D.length<=k?{inlineActions:D,overflowActions:[]}:{inlineActions:D.slice(0,k),overflowActions:D.slice(k)},[D,k]),M=(0,a.useMemo)(()=>{if(O.length===0)return j;if(j.length===0)return O;let[e,...t]=O,n={...e,tags:[...e.tags||[],`separator-before`]};return[...j,n,...t]},[j,O]);if(e.visible&&!w||D.length===0&&O.length===0)return null;let N=e.direction||`horizontal`,P=e.gap||`gap-2`,F=M.length>0?t.ComponentRegistry.get(`action:menu`):null,I=F?(0,o.jsx)(F,{schema:{type:`action:menu`,actions:M,variant:e.variant||`ghost`,size:e.size||`sm`}}):null;return(0,o.jsxs)(`div`,{ref:s,className:U(`flex items-center`,N===`vertical`?`flex-col items-stretch`:`flex-row flex-wrap`,P,e.className,n),role:`toolbar`,"aria-label":c,...C,"data-obj-id":l,"data-obj-type":u,style:d,children:[A.map(n=>{let r=n.component||`action:button`,i=t.ComponentRegistry.get(r);return i?(0,o.jsx)(i,{schema:{...n,type:r,actionType:n.type,variant:n.variant||e.variant,size:n.size||e.size},data:f},n.name):null}),M.length>0&&I]})});su.displayName=`ActionBarRenderer`,t.ComponentRegistry.register(`bar`,su,{namespace:`action`,skipFallback:!0,label:`Action Bar`,inputs:[{name:`actions`,type:`object`,label:`Actions`},{name:`systemActions`,type:`object`,label:`System Actions (always in overflow)`},{name:`location`,type:`enum`,label:`Location`,enum:[...se.ACTION_LOCATIONS]},{name:`maxVisible`,type:`number`,label:`Max Visible Actions`,defaultValue:3},{name:`direction`,type:`enum`,label:`Direction`,enum:[`horizontal`,`vertical`],defaultValue:`horizontal`},{name:`variant`,type:`enum`,label:`Default Variant`,enum:[`default`,`secondary`,`outline`,`ghost`],defaultValue:`outline`},{name:`size`,type:`enum`,label:`Default Size`,enum:[`sm`,`md`,`lg`],defaultValue:`sm`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{maxVisible:3,direction:`horizontal`,variant:`outline`,size:`sm`,actions:[]}});var cu=({schema:e,className:t})=>{let n=e.type,r=n.startsWith(`view:`),i=n.startsWith(`widget:`),a=n.startsWith(`field:`);return(0,o.jsxs)(`div`,{className:U(`flex flex-col items-center justify-center p-6 border-2 border-dashed rounded-lg bg-muted/30 transition-colors hover:bg-muted/50`,r&&`border-blue-300 bg-blue-50/50 min-h-[200px]`,i&&`border-purple-300 bg-purple-50/50 min-h-[150px]`,a&&`border-yellow-300 bg-yellow-50/50 p-2 min-h-[40px] flex-row gap-2 justify-start`,t),children:[(0,o.jsxs)(`div`,{className:U(`flex items-center gap-2 text-muted-foreground`,a&&`text-sm`),children:[a?(0,o.jsx)(c.Box,{className:`h-4 w-4`}):(0,o.jsx)(c.FileQuestion,{className:`h-8 w-8 mb-2 opacity-50`}),(0,o.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,o.jsx)(`span`,{className:`font-mono font-medium text-foreground`,children:n}),!a&&(0,o.jsx)(`span`,{className:`text-xs`,children:`Component Placeholder`})]})]}),e.props&&!a&&(0,o.jsxs)(`div`,{className:`mt-4 w-full text-xs text-muted-foreground bg-background/50 p-2 rounded overflow-hidden`,children:[(0,o.jsx)(`div`,{className:`opacity-70`,children:`Properties:`}),(0,o.jsx)(`pre`,{className:`mt-1 truncate`,children:JSON.stringify(e.props,null,0)})]})]})},lu=`view:grid.view:kanban.view:map.view:calendar.view:gantt.view:timeline.view:gallery.view:simple.view:wizard.view:tabbed.view:drawer.view:modal.view:split.field:text.field:textarea.field:password.field:email.field:url.field:phone.field:markdown.field:html.field:code.field:number.field:currency.field:percent.field:slider.field:boolean.field:checkboxes.field:select.field:multiselect.field:radio.field:date.field:datetime.field:time.field:duration.field:lookup.field:master_detail.field:tree.field:image.field:file.field:video.field:audio.field:avatar.field:color.field:rating.field:signature.field:qrcode.field:progress.field:json.field:address.field:location.page:header.page-header.page:footer.page:tabs.page:accordion.page:card.page:sidebar.record:details.record:highlights.record:related_list.record:activity.record:chatter.record:path.app:launcher.nav:menu.nav:breadcrumb.global:search.global:notifications.user:profile.widget:metric.widget:bar.widget:line.widget:pie.widget:funnel.widget:radar.widget:scatter.widget:heatmap.widget:pivot.widget:table.widget:text.widget:image.ai:input.ai:suggestion.ai:feedback`.split(`.`),uu=[`nav:menu`,`nav:breadcrumb`,`global:search`,`ai:suggestion`];function du(e){t.ComponentRegistry.get(e)||t.ComponentRegistry.register(e,cu,{namespace:`protocol-placeholder`})}function fu(){lu.forEach(du)}uu.forEach(du);var pu={info:{Icon:c.Info,tone:`border-border bg-muted/50 text-foreground`,iconTone:`text-muted-foreground`},success:{Icon:c.CheckCircle2,tone:`border-emerald-300/70 bg-emerald-50 text-emerald-900 dark:border-emerald-700/60 dark:bg-emerald-950/40 dark:text-emerald-200`,iconTone:`text-emerald-600 dark:text-emerald-400`},warning:{Icon:c.AlertTriangle,tone:`border-amber-300/70 bg-amber-50 text-amber-900 dark:border-amber-700/60 dark:bg-amber-950/40 dark:text-amber-200`,iconTone:`text-amber-600 dark:text-amber-400`},error:{Icon:c.XCircle,tone:`border-destructive/50 bg-destructive/10 text-destructive dark:text-destructive-foreground`,iconTone:`text-destructive`}};function mu(e){return pu[e??`info`]??pu.info}function hu(e){return Oa(e.icon)?Aa(e.icon):mu(e.severity).Icon}var gu={primary:`default`,secondary:`secondary`,link:`link`};function _u(e){return gu[e??`primary`]??gu.primary}var vu={top_left:`top-4 left-4`,top_center:`top-4 left-1/2 -translate-x-1/2`,top_right:`top-4 right-4`,bottom_left:`bottom-4 left-4`,bottom_center:`bottom-4 left-1/2 -translate-x-1/2`,bottom_right:`bottom-4 right-4`,"top-left":`top-4 left-4`,"top-center":`top-4 left-1/2 -translate-x-1/2`,"top-right":`top-4 right-4`,"bottom-left":`bottom-4 left-4`,"bottom-center":`bottom-4 left-1/2 -translate-x-1/2`,"bottom-right":`bottom-4 right-4`};function yu({className:e}){let t=(0,i.useNotificationsByPresentation)(`banner`),{dismiss:n,config:r}=(0,i.useNotifications)();if(t.length===0)return null;let a=(0,i.visibleNotificationStack)(t,r);return(0,o.jsx)(`div`,{className:U(`flex w-full flex-col`,e),"data-notification-surface":`banner`,children:a.map(e=>{let{tone:t}=mu(e.severity),r=hu(e);return(0,o.jsxs)(`div`,{role:`status`,"data-severity":e.severity,className:U(`flex w-full items-center gap-3 border-b px-4 py-2.5 text-sm`,t),children:[(0,o.jsx)(r,{className:`h-4 w-4 shrink-0`,"aria-hidden":`true`}),(0,o.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,o.jsx)(`span`,{className:`font-medium`,children:e.title}),e.message?(0,o.jsx)(`span`,{className:`min-w-0 opacity-90`,children:e.message}):null]}),e.actions?.map(e=>(0,o.jsx)(q,{size:`sm`,variant:_u(e.variant),className:`h-7 shrink-0`,onClick:e.onClick,children:e.label},e.label)),e.dismissible===!1?null:(0,o.jsx)(q,{size:`icon`,variant:`ghost`,className:`h-7 w-7 shrink-0`,"aria-label":`Dismiss ${e.title}`,onClick:()=>n(e.id),children:(0,o.jsx)(c.X,{className:`h-4 w-4`,"aria-hidden":`true`})})]},e.id)})})}yu.displayName=`NotificationBanners`;function bu({className:e}){let t=(0,i.useNotificationsByPresentation)(`snackbar`),{dismiss:n,config:r,pauseAutoDismiss:a,resumeAutoDismiss:s}=(0,i.useNotifications)(),l=t[0];if(!l)return null;let{iconTone:u}=mu(l.severity),d=hu(l),f=l.actions?.[0],p=(0,i.resolveNotificationPosition)(l,r);return(0,o.jsxs)(`div`,{className:U(`fixed z-50 flex w-[min(28rem,calc(100vw-2rem))]`,p?vu[p]:`bottom-4 left-1/2 -translate-x-1/2`,`items-center gap-3 rounded-md border bg-popover px-4 py-3 text-sm text-popover-foreground shadow-lg`,`motion-safe:animate-in motion-safe:fade-in`,p?.startsWith(`top`)?`motion-safe:slide-in-from-top-4`:`motion-safe:slide-in-from-bottom-4`,e),role:`status`,"aria-live":`polite`,"data-notification-surface":`snackbar`,"data-severity":l.severity,"data-position":p,onPointerEnter:r.pauseOnHover?()=>a(l.id):void 0,onPointerLeave:r.pauseOnHover?()=>s(l.id):void 0,children:[(0,o.jsx)(d,{className:U(`h-4 w-4 shrink-0`,u),"aria-hidden":`true`}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(`div`,{className:`truncate font-medium`,children:l.title}),l.message?(0,o.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:l.message}):null]}),f?(0,o.jsx)(q,{size:`sm`,variant:_u(f.variant),className:`h-7 shrink-0 font-semibold uppercase tracking-wide`,onClick:()=>{f.onClick(),n(l.id)},children:f.label}):null,l.dismissible===!1?null:(0,o.jsx)(q,{size:`icon`,variant:`ghost`,className:`h-7 w-7 shrink-0`,"aria-label":`Dismiss ${l.title}`,onClick:()=>n(l.id),children:(0,o.jsx)(c.X,{className:`h-4 w-4`,"aria-hidden":`true`})})]})}bu.displayName=`NotificationSnackbar`;var xu={default:void 0,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,link:`bg-transparent text-primary underline-offset-4 hover:bg-transparent hover:underline`};function Su({className:e,acknowledgeLabel:t=`OK`}){let n=(0,i.useNotificationsByPresentation)(`alert`),{dismiss:r}=(0,i.useNotifications)(),a=n[n.length-1];if(!a)return null;let{iconTone:s}=mu(a.severity),c=hu(a),l=()=>r(a.id),u=a.dismissible===!1;return(0,o.jsx)(be,{open:!0,onOpenChange:e=>{!e&&!u&&l()},children:(0,o.jsxs)(we,{className:e,"data-notification-surface":`alert`,"data-severity":a.severity,onEscapeKeyDown:e=>{u&&e.preventDefault()},children:[(0,o.jsxs)(Te,{children:[(0,o.jsxs)(De,{className:`flex items-center gap-2`,children:[(0,o.jsx)(c,{className:U(`h-5 w-5 shrink-0`,s),"aria-hidden":`true`}),a.title]}),a.message?(0,o.jsx)(Oe,{children:a.message}):null]}),(0,o.jsxs)(Ee,{children:[a.actions?.map(e=>(0,o.jsx)(ke,{className:U(xu[_u(e.variant)]),onClick:()=>{e.onClick(),l()},children:e.label},e.label)),(0,o.jsx)(ke,{className:U(a.actions?.length?xu.secondary:void 0),onClick:l,children:t})]})]})})}Su.displayName=`NotificationAlerts`;function Cu({scope:e,className:t}){let n=(0,i.useNotificationsByPresentation)(`inline`,e),{dismiss:r,config:a}=(0,i.useNotifications)();if(n.length===0)return null;let s=(0,i.visibleNotificationStack)(n,a);return(0,o.jsx)(`div`,{className:U(`flex w-full flex-col gap-2`,t),"data-notification-surface":`inline`,"data-scope":e,children:s.map(e=>{let{tone:t}=mu(e.severity),n=hu(e);return(0,o.jsxs)(`div`,{role:`status`,"data-severity":e.severity,className:U(`flex items-start gap-3 rounded-md border px-3 py-2 text-sm`,t),children:[(0,o.jsx)(n,{className:`mt-0.5 h-4 w-4 shrink-0`,"aria-hidden":`true`}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(`div`,{className:`font-medium`,children:e.title}),e.message?(0,o.jsx)(`div`,{className:`opacity-90`,children:e.message}):null,e.actions?.length?(0,o.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:e.actions.map(e=>(0,o.jsx)(q,{size:`sm`,variant:_u(e.variant),className:`h-7`,onClick:e.onClick,children:e.label},e.label))}):null]}),e.dismissible===!1?null:(0,o.jsx)(q,{size:`icon`,variant:`ghost`,className:`-mr-1 h-6 w-6 shrink-0`,"aria-label":`Dismiss ${e.title}`,onClick:()=>r(e.id),children:(0,o.jsx)(c.X,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})]},e.id)})})}Cu.displayName=`NotificationInline`;function wu(e,t){let n=t?.maxHistory??50,[r,i]=(0,a.useState)({...e}),[o,s]=(0,a.useState)(t?.mode===`create`),c=(0,a.useRef)([]),l=(0,a.useRef)([]),[,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{i({...e}),s(t?.mode===`create`),c.current=[],l.current=[]},[e]);let d=(0,a.useCallback)((e,r)=>{i(t=>(c.current=[...c.current.slice(-(n-1)),t],l.current=[],{...t,[e]:r})),s(!0),u(e=>e+1),t?.onUpdate?.(e,r)},[t?.onUpdate,n]),f=(0,a.useCallback)(()=>{c.current.length!==0&&(i(e=>{let t=[...c.current],n=t.pop();return c.current=t,l.current=[e,...l.current],n}),u(e=>e+1))},[]),p=(0,a.useCallback)(()=>{l.current.length!==0&&(i(e=>{let t=[...l.current],n=t.shift();return l.current=t,c.current=[...c.current,e],n}),u(e=>e+1))},[]);return{draft:r,isDirty:o,updateField:d,discard:(0,a.useCallback)(()=>{i({...e}),s(!1),c.current=[],l.current=[],u(e=>e+1)},[e]),setDraft:i,undo:f,redo:p,canUndo:c.current.length>0,canRedo:l.current.length>0}}function Tu(e){let[t,n]=a.useState({width:0,height:0});return a.useEffect(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let r=t.getBoundingClientRect();n(e=>e.width===r.width&&e.height===r.height?e:{width:r.width,height:r.height});let i=new ResizeObserver(e=>{let t=e[0];if(!t)return;let r,i=t.borderBoxSize?.[0];r=i?{width:i.inlineSize,height:i.blockSize}:{width:t.contentRect.width,height:t.contentRect.height},n(e=>e.width===r.width&&e.height===r.height?e:r)});return i.observe(t),()=>i.disconnect()},[e]),t}var Eu=[`completed`,`failed`,`cancelled`,`expired`];function Du(e){return!!e&&Eu.includes(e)}function Ou(e={}){let{dataSource:t,pollIntervalMs:n=1500,maxAttempts:r=600,onComplete:i,onError:o}=e,[s,c]=(0,a.useState)(null),[l,u]=(0,a.useState)(null),[d,f]=(0,a.useState)(!1),p=(0,a.useRef)(null),m=(0,a.useRef)(null),h=(0,a.useRef)(0),g=(0,a.useRef)(!1),_=(0,a.useRef)({onComplete:i,onError:o});_.current={onComplete:i,onError:o};let v=!!t?.createExportJob&&!!t?.getExportJobProgress,y=(0,a.useCallback)(()=>{m.current&&=(clearTimeout(m.current),null)},[]),b=(0,a.useCallback)(()=>{y(),p.current=null,g.current=!1,h.current=0,c(null),u(null),f(!1)},[y]);(0,a.useEffect)(()=>()=>y(),[y]);let x=(0,a.useCallback)(async()=>{if(t?.getExportJobProgress&&!(!p.current||g.current)){if(h.current+=1,h.current>r){let e=Error(`Export job timed out (max attempts exceeded)`);u(e),f(!1),_.current.onError?.(e,s??void 0);return}try{let e=await t.getExportJobProgress(p.current);if(g.current)return;if(c(e),Du(e.status)){if(f(!1),e.status===`completed`)_.current.onComplete?.(e);else{let t=e.error?.message??`Export ${e.status}`,n=Error(t);u(n),_.current.onError?.(n,e)}return}m.current=setTimeout(x,n)}catch(e){if(g.current)return;let t=e instanceof Error?e:Error(String(e));u(t),f(!1),_.current.onError?.(t,s??void 0)}}},[t,r,n,s]),S=(0,a.useCallback)(async(e,r)=>{if(!t?.createExportJob){let e=Error(`DataSource does not implement createExportJob — cannot start async export.`);return u(e),_.current.onError?.(e),null}y(),g.current=!1,h.current=0,u(null),c(null),f(!0);try{let i=await t.createExportJob(e,r);if(p.current=i.jobId,c({jobId:i.jobId,status:i.status,processedRecords:0,totalRecords:i.estimatedRecords,percentComplete:0}),Du(i.status)){if(f(!1),i.status===`completed`&&t.getExportJobProgress)try{let e=await t.getExportJobProgress(i.jobId);c(e),_.current.onComplete?.(e)}catch{}return i.jobId}return m.current=setTimeout(x,n),i.jobId}catch(e){let t=e instanceof Error?e:Error(String(e));return u(t),f(!1),_.current.onError?.(t),null}},[t,y,x,n]),C=(0,a.useCallback)(async()=>{if(p.current){if(g.current=!0,y(),f(!1),t?.cancelExportJob)try{await t.cancelExportJob(p.current)}catch{}c(e=>e&&{...e,status:`cancelled`})}},[t,y]),w=(0,a.useCallback)(async()=>{if(!p.current)return null;if(t?.getExportJobDownloadUrl)try{return await t.getExportJobDownloadUrl(p.current)}catch{}return s?.downloadUrl??null},[t,s]);return{isRunning:d,progress:s,error:l,isSupported:v,start:S,cancel:C,getDownloadUrl:w,download:(0,a.useCallback)(async e=>{let t=await w();if(!t)return!1;let n=document.createElement(`a`);return n.href=t,e&&(n.download=e),n.rel=`noopener`,document.body.appendChild(n),n.click(),n.remove(),!0},[w]),reset:b}}function ku({schema:e}){return e?(0,o.jsx)(`pre`,{className:`text-[11px] leading-relaxed font-mono overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:JSON.stringify(e,null,2)}):(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No schema available`})}function Au({dataContext:e}){return e?(0,o.jsx)(`pre`,{className:`text-[11px] leading-relaxed font-mono overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:JSON.stringify(e,null,2)}):(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No data context available`})}function ju(){let e=(0,a.useMemo)(()=>{try{return t.ComponentRegistry.getAllTypes()}catch{return[]}},[]);return e.length===0?(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No registered components`}):(0,o.jsxs)(`div`,{className:`space-y-1 max-h-[60vh] overflow-auto`,children:[e.map(e=>(0,o.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 rounded text-xs font-mono bg-muted/30`,children:[(0,o.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full bg-green-500 shrink-0`}),e]},e)),(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:[e.length,` component`,e.length===1?``:`s`,` registered`]})]})}function Mu({flags:e}){return e?(0,o.jsx)(`pre`,{className:`text-[11px] leading-relaxed font-mono overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:JSON.stringify(e,null,2)}):(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No debug flags`})}function Nu(e){let n=t.DebugCollector.getInstance(),[r,i]=(0,a.useState)(()=>n.getEntries(e));return a.default.useEffect(()=>(i(n.getEntries(e)),n.subscribe(()=>{i(n.getEntries(e))})),[n,e]),r}function Pu(){let e=Nu(`perf`).map(e=>e.data);return e.length===0?(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No performance data collected yet`}):(0,o.jsxs)(`div`,{className:`space-y-1 max-h-[60vh] overflow-auto`,children:[e.map((e,t)=>(0,o.jsxs)(`div`,{className:U(`flex items-center justify-between px-2 py-1 rounded text-xs font-mono`,e.durationMs>16?`bg-red-50 text-red-700`:`bg-muted/30`),children:[(0,o.jsxs)(`span`,{className:`truncate mr-2`,children:[e.type,e.id?`:${e.id}`:``]}),(0,o.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[e.durationMs.toFixed(2),`ms`]})]},t)),(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:[e.length,` render`,e.length===1?``:`s`,` tracked`]})]})}function Fu(){let e=Nu(`expr`).map(e=>e.data);return e.length===0?(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No expression evaluations tracked yet`}):(0,o.jsxs)(`div`,{className:`space-y-1.5 max-h-[60vh] overflow-auto`,children:[e.map((e,t)=>(0,o.jsxs)(`div`,{className:`px-2 py-1.5 rounded bg-muted/30 text-xs font-mono`,children:[(0,o.jsx)(`div`,{className:`text-muted-foreground truncate`,children:e.expression}),(0,o.jsxs)(`div`,{className:`mt-0.5`,children:[`→ `,JSON.stringify(e.result)]})]},t)),(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:[e.length,` evaluation`,e.length===1?``:`s`,` tracked`]})]})}function Iu(){let e=Nu(`event`).map(e=>e.data);return e.length===0?(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No events captured yet`}):(0,o.jsxs)(`div`,{className:`space-y-1.5 max-h-[60vh] overflow-auto`,children:[e.map((e,t)=>(0,o.jsxs)(`div`,{className:`px-2 py-1.5 rounded bg-muted/30 text-xs font-mono`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,o.jsx)(`span`,{className:`font-semibold`,children:e.action}),(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:new Date(e.timestamp).toLocaleTimeString()})]}),e.payload!==void 0&&(0,o.jsx)(`pre`,{className:`mt-0.5 text-[10px] text-muted-foreground truncate`,children:JSON.stringify(e.payload)})]},t)),(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:[e.length,` event`,e.length===1?``:`s`,` captured`]})]})}function Lu({open:e,onClose:t,flags:n,schema:r,dataContext:i,extraTabs:s=[],className:c}){let l=(0,a.useMemo)(()=>[{id:`schema`,label:`Schema`,render:()=>(0,o.jsx)(ku,{schema:r})},{id:`data`,label:`Data`,render:()=>(0,o.jsx)(Au,{dataContext:i})},{id:`perf`,label:`Perf`,render:()=>(0,o.jsx)(Pu,{})},{id:`expr`,label:`Expr`,render:()=>(0,o.jsx)(Fu,{})},{id:`events`,label:`Events`,render:()=>(0,o.jsx)(Iu,{})},{id:`registry`,label:`Registry`,render:()=>(0,o.jsx)(ju,{})},{id:`flags`,label:`Flags`,render:()=>(0,o.jsx)(Mu,{flags:n})}],[r,i,n]),u=(0,a.useMemo)(()=>[...l,...s],[l,s]),[d,f]=(0,a.useState)(u[0]?.id??`schema`),p=u.find(e=>e.id===d)??u[0],m=(0,a.useCallback)(e=>{f(e)},[]);return e?(0,o.jsxs)(`div`,{className:U(`fixed bottom-4 right-4 z-[9999] w-[420px] max-w-[95vw] rounded-lg border bg-background shadow-2xl`,`flex flex-col overflow-hidden`,c),"data-testid":`debug-panel`,role:`dialog`,"aria-label":`Developer Debug Panel`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b bg-muted/30`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`🛠 Debug Panel`}),(0,o.jsx)(`button`,{onClick:t,className:`text-muted-foreground hover:text-foreground text-sm leading-none px-1`,"aria-label":`Close debug panel`,"data-testid":`debug-panel-close`,children:`✕`})]}),(0,o.jsx)(`div`,{className:`flex border-b overflow-x-auto`,role:`tablist`,children:u.map(e=>(0,o.jsxs)(`button`,{role:`tab`,"aria-selected":e.id===p?.id,onClick:()=>m(e.id),className:U(`px-3 py-1.5 text-xs font-medium whitespace-nowrap transition-colors`,e.id===p?.id?`border-b-2 border-primary text-foreground`:`text-muted-foreground hover:text-foreground`),"data-testid":`debug-tab-${e.id}`,children:[e.icon&&(0,o.jsx)(`span`,{className:`mr-1`,children:e.icon}),e.label]},e.id))}),(0,o.jsx)(`div`,{className:`p-3 overflow-auto max-h-[50vh]`,"data-testid":`debug-panel-content`,children:p?.render()})]}):null}var Ru={permission:`view`,audience:`link_only`,expiresInDays:7,password:``,label:``},zu=[{label:`1 day`,value:1},{label:`7 days`,value:7},{label:`30 days`,value:30},{label:`90 days`,value:90},{label:`Never`,value:null}],Bu=[{value:`link_only`,label:`Anyone with the link`,help:`No sign-in required`},{value:`signed_in`,label:`Signed-in users`,help:`Must be logged in to view`}];function Vu(e,t){return`${(e??(typeof window<`u`?`${window.location.origin}/s`:`/s`)).replace(/\/+$/,``)}/${t}`}async function Hu(e){try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document<`u`){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`absolute`,t.style.left=`-9999px`,document.body.appendChild(t),t.select();try{return document.execCommand(`copy`),document.body.removeChild(t),!0}catch{document.body.removeChild(t)}}return!1}function Uu({open:e,onOpenChange:t,objectName:n,recordId:r,recordLabel:i,apiBase:s,publicBaseUrl:l,fetchHeaders:u}){let[d,f]=(0,a.useState)([]),[p,m]=(0,a.useState)(!1),[h,g]=(0,a.useState)(!1),[_,v]=(0,a.useState)(null),[y,b]=(0,a.useState)(Ru),[x,S]=(0,a.useState)(null),C=(0,a.useCallback)(async()=>{let e={"Content-Type":`application/json`};if(!u)return e;let t=await u();return{...e,...t}},[u]),w=(0,a.useMemo)(()=>`${s.replace(/\/+$/,``)}/v1/share-links?object=${encodeURIComponent(n)}&recordId=${encodeURIComponent(r)}`,[s,n,r]),T=(0,a.useCallback)(async()=>{m(!0),v(null);try{let e=await C(),t=await fetch(w,{headers:e,credentials:`include`});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();f(n.links??n.data??[])}catch(e){v(e?.message??`Failed to load share links`)}finally{m(!1)}},[w,C]);(0,a.useEffect)(()=>{e&&(T(),b(Ru))},[e,T]);let E=(0,a.useCallback)(async()=>{g(!0),v(null);try{let e=y.expiresInDays==null?void 0:new Date(Date.now()+y.expiresInDays*24*60*60*1e3).toISOString(),t=await C(),i=await fetch(`${s.replace(/\/+$/,``)}/v1/share-links`,{method:`POST`,headers:t,credentials:`include`,body:JSON.stringify({object:n,recordId:r,permission:y.permission,audience:y.audience,expiresAt:e,password:y.password.trim()||void 0,label:y.label.trim()||void 0})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e?.error?.message||`HTTP ${i.status}`)}let a=await i.json(),o=a.link??a.data;if(!o)throw Error(`Share link create response missing link payload`);f(e=>[o,...e]),await Hu(Vu(l,o.token))&&(S(o.id),setTimeout(()=>S(null),1500)),b(Ru)}catch(e){v(e?.message??`Failed to create share link`)}finally{g(!1)}},[s,C,n,r,y,l]),D=(0,a.useCallback)(async e=>{try{let t=await C(),n=await fetch(`${s.replace(/\/+$/,``)}/v1/share-links/${encodeURIComponent(e.id)}`,{method:`DELETE`,headers:t,credentials:`include`});if(!n.ok&&n.status!==204)throw Error(`HTTP ${n.status}`);f(t=>t.map(t=>t.id===e.id?{...t,revoked_at:new Date().toISOString()}:t))}catch(e){v(e?.message??`Failed to revoke link`)}},[s,C]),O=(0,a.useCallback)(async e=>{await Hu(Vu(l,e.token))&&(S(e.id),setTimeout(()=>S(null),1500))},[l]),k=d.filter(e=>!e.revoked_at),A=d.filter(e=>e.revoked_at);return(0,o.jsx)(St,{open:e,onOpenChange:t,children:(0,o.jsxs)(Dt,{className:`max-w-xl`,"data-testid":`share-dialog`,children:[(0,o.jsxs)(Ot,{children:[(0,o.jsxs)(At,{className:`flex items-center gap-2`,children:[(0,o.jsx)(c.Link2,{className:`h-4 w-4`}),`Share `,i??`this record`]}),(0,o.jsx)(jt,{children:`Generate a link anyone (or selected people) can use to open this record. Links can be revoked at any time.`})]}),_&&(0,o.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,"data-testid":`share-dialog-error`,children:_}),(0,o.jsxs)(`section`,{className:`space-y-3 rounded-lg border bg-muted/30 p-3`,children:[(0,o.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(Y,{className:`text-xs`,children:`Who can access`}),(0,o.jsxs)(Mr,{value:y.audience,onValueChange:e=>b(t=>({...t,audience:e})),children:[(0,o.jsx)(Fr,{className:`h-8 text-xs`,"data-testid":`share-audience`,children:(0,o.jsx)(Pr,{})}),(0,o.jsx)(Rr,{children:Bu.map(e=>(0,o.jsx)(Z,{value:e.value,className:`text-xs`,children:(0,o.jsxs)(`div`,{className:`flex flex-col`,children:[(0,o.jsx)(`span`,{children:e.label}),(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.help})]})},e.value))})]})]}),(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(Y,{className:`text-xs`,children:`Expires in`}),(0,o.jsxs)(Mr,{value:y.expiresInDays==null?`never`:String(y.expiresInDays),onValueChange:e=>b(t=>({...t,expiresInDays:e===`never`?null:Number(e)})),children:[(0,o.jsx)(Fr,{className:`h-8 text-xs`,"data-testid":`share-expiry`,children:(0,o.jsx)(Pr,{})}),(0,o.jsx)(Rr,{children:zu.map(e=>(0,o.jsx)(Z,{value:e.value==null?`never`:String(e.value),className:`text-xs`,children:e.label},String(e.value)))})]})]}),(0,o.jsxs)(`div`,{className:`space-y-1 sm:col-span-2`,children:[(0,o.jsx)(Y,{className:`text-xs`,children:`Password (optional)`}),(0,o.jsx)(X,{type:`password`,value:y.password,onChange:e=>b(t=>({...t,password:e.target.value})),placeholder:`Require a password to open`,className:`h-8 text-xs`,"data-testid":`share-password`})]}),(0,o.jsxs)(`div`,{className:`space-y-1 sm:col-span-2`,children:[(0,o.jsx)(Y,{className:`text-xs`,children:`Label (only you see this)`}),(0,o.jsx)(X,{value:y.label,onChange:e=>b(t=>({...t,label:e.target.value})),placeholder:`e.g. Sent to design review`,className:`h-8 text-xs`,"data-testid":`share-label`})]})]}),(0,o.jsx)(`div`,{className:`flex justify-end`,children:(0,o.jsxs)(q,{size:`sm`,onClick:E,disabled:h,"data-testid":`share-create`,children:[h?(0,o.jsx)(c.Loader2,{className:`mr-1 h-3 w-3 animate-spin`}):(0,o.jsx)(c.Link2,{className:`mr-1 h-3 w-3`}),`Create link`]})})]}),(0,o.jsxs)(`section`,{className:`space-y-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,o.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground`,children:[`Existing links`,k.length?` (${k.length})`:``]}),p&&(0,o.jsx)(c.Loader2,{className:`h-3 w-3 animate-spin text-muted-foreground`})]}),!p&&k.length===0&&A.length===0&&(0,o.jsx)(`p`,{className:`rounded-md border border-dashed px-3 py-4 text-center text-xs text-muted-foreground`,children:`No share links yet. Create one above.`}),(0,o.jsxs)(`ul`,{className:`space-y-2`,children:[k.map(e=>(0,o.jsx)(Wu,{link:e,copied:x===e.id,onCopy:()=>O(e),onRevoke:()=>D(e),publicBaseUrl:l},e.id)),A.length>0&&(0,o.jsx)(`li`,{className:`pt-2 text-[10px] uppercase tracking-wide text-muted-foreground`,children:`Revoked`}),A.map(e=>(0,o.jsx)(Wu,{link:e,copied:!1,onCopy:()=>O(e),onRevoke:()=>D(e),publicBaseUrl:l,disabled:!0},e.id))]})]}),(0,o.jsx)(kt,{children:(0,o.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>t(!1),children:`Done`})})]})})}function Wu({link:e,copied:t,onCopy:n,onRevoke:r,publicBaseUrl:i,disabled:a}){let s=Vu(i,e.token);return(0,o.jsxs)(`li`,{className:U(`flex items-center gap-2 rounded-md border bg-card px-2 py-2 text-xs`,a&&`opacity-60`),"data-testid":`share-link-row`,children:[(0,o.jsx)(Be,{variant:`secondary`,className:`text-[10px] capitalize`,children:e.audience.replace(`_`,` `)}),(0,o.jsx)(Be,{variant:`outline`,className:`text-[10px] capitalize`,children:e.permission}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(`div`,{className:`truncate font-mono text-[11px]`,title:s,children:s}),e.label&&(0,o.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:e.label})]}),!a&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(q,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-xs`,onClick:n,"data-testid":`share-link-copy`,children:[(0,o.jsx)(c.Copy,{className:`mr-1 h-3 w-3`}),t?`Copied!`:`Copy`]}),(0,o.jsx)(q,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-xs text-destructive hover:text-destructive`,onClick:r,"data-testid":`share-link-revoke`,title:`Revoke`,children:(0,o.jsx)(c.Trash2,{className:`h-3 w-3`})})]}),a&&(0,o.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,o.jsx)(c.ShieldOff,{className:`h-3 w-3`}),`revoked`]})]})}function Gu(){return!0}e.Accordion=_e,e.AccordionContent=ye,e.AccordionItem=ve,e.AccordionTrigger=G,e.ActionParamDialog=oc,e.Alert=Me,e.AlertDescription=Pe,e.AlertDialog=be,e.AlertDialogAction=ke,e.AlertDialogCancel=Ae,e.AlertDialogContent=we,e.AlertDialogDescription=Oe,e.AlertDialogFooter=Ee,e.AlertDialogHeader=Te,e.AlertDialogOverlay=Ce,e.AlertDialogPortal=Se,e.AlertDialogTitle=De,e.AlertDialogTrigger=xe,e.AlertTitle=Ne,e.AspectRatio=Fe,e.Avatar=Ie,e.AvatarFallback=Re,e.AvatarImage=Le,e.Badge=Be,e.Breadcrumb=Ve,e.BreadcrumbEllipsis=qe,e.BreadcrumbItem=Ue,e.BreadcrumbLink=We,e.BreadcrumbList=He,e.BreadcrumbPage=Ge,e.BreadcrumbSeparator=Ke,e.Button=q,e.ButtonGroup=Wo,e.ButtonGroupSeparator=Ko,e.ButtonGroupText=Go,e.Calendar=Je,e.CalendarDayButton=Ye,e.Card=Xe,e.CardContent=et,e.CardDescription=$e,e.CardFooter=J,e.CardHeader=Ze,e.CardTitle=Qe,e.Carousel=rt,e.CarouselContent=it,e.CarouselItem=at,e.CarouselNext=st,e.CarouselPrevious=ot,e.ChartContainer=dt,e.ChartLegend=ht,e.ChartLegendContent=gt,e.ChartSkeleton=dc,e.ChartStyle=ft,e.ChartTooltip=pt,e.ChartTooltipContent=mt,e.Checkbox=vt,e.Collapsible=yt,e.CollapsibleContent=xt,e.CollapsibleTrigger=bt,e.Combobox=qo,e.Command=Mt,e.CommandDialog=Nt,e.CommandEmpty=It,e.CommandGroup=Lt,e.CommandInput=Pt,e.CommandItem=zt,e.CommandList=Ft,e.CommandSeparator=Rt,e.CommandShortcut=Bt,e.ConfigFieldRenderer=gs,e.ConfigPanelRenderer=vs,e.ConfigRow=Jo,e.ContextMenu=Vt,e.ContextMenuCheckboxItem=Zt,e.ContextMenuContent=Yt,e.ContextMenuGroup=Ut,e.ContextMenuItem=Xt,e.ContextMenuLabel=$t,e.ContextMenuPortal=Wt,e.ContextMenuRadioGroup=Kt,e.ContextMenuRadioItem=Qt,e.ContextMenuSeparator=en,e.ContextMenuShortcut=tn,e.ContextMenuSub=Gt,e.ContextMenuSubContent=Jt,e.ContextMenuSubTrigger=qt,e.ContextMenuTrigger=Ht,e.DataEmptyState=yc,e.EmptyState=yc,e.DataErrorState=bc,e.DataLoadingState=vc,e.DatePicker=ys,e.DebugPanel=Lu,e.Dialog=St,e.DialogClose=Tt,e.DialogContent=Dt,e.DialogDescription=jt,e.DialogFooter=kt,e.DialogHeader=Ot,e.DialogOverlay=Et,e.DialogPortal=wt,e.DialogTitle=At,e.DialogTrigger=Ct,e.Drawer=nn,e.DrawerClose=on,e.DrawerContent=cn,e.DrawerDescription=fn,e.DrawerFooter=un,e.DrawerHeader=ln,e.DrawerOverlay=sn,e.DrawerPortal=an,e.DrawerTitle=dn,e.DrawerTrigger=rn,e.DropdownMenu=pn,e.DropdownMenuCheckboxItem=Cn,e.DropdownMenuContent=xn,e.DropdownMenuGroup=hn,e.DropdownMenuItem=Sn,e.DropdownMenuLabel=Tn,e.DropdownMenuPortal=gn,e.DropdownMenuRadioGroup=vn,e.DropdownMenuRadioItem=wn,e.DropdownMenuSeparator=En,e.DropdownMenuShortcut=Dn,e.DropdownMenuSub=_n,e.DropdownMenuSubContent=bn,e.DropdownMenuSubTrigger=yn,e.DropdownMenuTrigger=mn,e.Empty=xs,e.EmptyContent=Ds,e.EmptyDescription=Es,e.EmptyHeader=Ss,e.EmptyMedia=ws,e.EmptyTitle=Ts,e.EmptyValue=Os,e.ExportProgressDialog=Sc,e.FILTER_BUILDER_OPERATORS=Xo,e.Field=As,e.FilterBuilder=fs,e.Form=kn,e.FormControl=In,e.FormDescription=Ln,e.FormField=jn,e.FormItem=Pn,e.FormLabel=Fn,e.FormMessage=Rn,e.FormSkeleton=lc,e.GridFieldAuthoringProvider=Bl,e.GridSkeleton=sc,e.GroupingEditor=ac,e.HoverCard=zn,e.HoverCardContent=Vn,e.HoverCardTrigger=Bn,e.Input=X,e.InputGroup=js,e.InputOTP=Hn,e.InputOTPGroup=Un,e.InputOTPSeparator=Gn,e.InputOTPSlot=Wn,e.Item=Fs,e.ItemActions=Vs,e.ItemContent=Rs,e.ItemDescription=Bs,e.ItemFooter=Us,e.ItemGroup=Ms,e.ItemHeader=Hs,e.ItemMedia=Ls,e.ItemSeparator=Ns,e.ItemTitle=zs,e.KanbanSkeleton=cc,e.Kbd=Ws,e.KbdGroup=Gs,e.Label=Y,e.LazyIcon=ja,e.ListSkeleton=uc,e.LookupValuePicker=ps,e.Menubar=Zn,e.MenubarCheckboxItem=rr,e.MenubarContent=tr,e.MenubarGroup=qn,e.MenubarItem=nr,e.MenubarLabel=ar,e.MenubarMenu=Kn,e.MenubarPortal=Jn,e.MenubarRadioGroup=Yn,e.MenubarRadioItem=ir,e.MenubarSeparator=or,e.MenubarShortcut=sr,e.MenubarSub=Xn,e.MenubarSubContent=er,e.MenubarSubTrigger=$n,e.MenubarTrigger=Qn,e.MobileDialogContent=Xs,e.NOTIFICATION_ACTION_BUTTON_VARIANTS=gu,e.NOTIFICATION_POSITION_CLASSES=vu,e.NOTIFICATION_SEVERITY_STYLES=pu,e.NativeSelect=Ks,e.NavigationMenu=cr,e.NavigationMenuContent=pr,e.NavigationMenuIndicator=gr,e.NavigationMenuItem=ur,e.NavigationMenuLink=mr,e.NavigationMenuList=lr,e.NavigationMenuTrigger=fr,e.NavigationMenuViewport=hr,e.NavigationOverlay=nc,e.NotificationAlerts=Su,e.NotificationBanners=yu,e.NotificationInline=Cu,e.NotificationSnackbar=bu,e.Pagination=_r,e.PaginationContent=vr,e.PaginationEllipsis=Cr,e.PaginationItem=yr,e.PaginationLink=br,e.PaginationNext=Sr,e.PaginationPrevious=xr,e.Popover=wr,e.PopoverContent=Er,e.PopoverTrigger=Tr,e.Progress=Dr,e.RadioGroup=Or,e.RadioGroupItem=kr,e.RecordTitleChip=mc,e.RefreshIndicator=_c,e.RelatedCountStore=_l,e.ResizableHandle=_o,e.ResizablePanel=go,e.ResizablePanelGroup=ho,e.ScrollArea=Ar,e.ScrollBar=jr,e.SectionHeader=_s,e.Select=Mr,e.SelectContent=Rr,e.SelectGroup=Nr,e.SelectItem=Z,e.SelectLabel=zr,e.SelectScrollDownButton=Lr,e.SelectScrollUpButton=Ir,e.SelectSeparator=Br,e.SelectTrigger=Fr,e.SelectValue=Pr,e.Separator=Vr,e.ShareDialog=Uu,e.Sheet=Hr,e.SheetClose=Wr,e.SheetContent=Jr,e.SheetDescription=Qr,e.SheetFooter=Xr,e.SheetHeader=Yr,e.SheetOverlay=Kr,e.SheetPortal=Gr,e.SheetTitle=Zr,e.SheetTrigger=Ur,e.ShimmerSkeleton=pc,e.Sidebar=mi,e.SidebarContent=Si,e.SidebarFooter=bi,e.SidebarGroup=Ci,e.SidebarGroupAction=Ti,e.SidebarGroupContent=Ei,e.SidebarGroupLabel=wi,e.SidebarHeader=yi,e.SidebarInput=vi,e.SidebarInset=_i,e.SidebarMenu=Di,e.SidebarMenuAction=ji,e.SidebarMenuBadge=Mi,e.SidebarMenuButton=Ai,e.SidebarMenuItem=Oi,e.SidebarMenuSkeleton=Ni,e.SidebarMenuSub=Pi,e.SidebarMenuSubButton=Ii,e.SidebarMenuSubItem=Fi,e.SidebarProvider=pi,e.SidebarRail=gi,e.SidebarSeparator=xi,e.SidebarTrigger=hi,e.Skeleton=Q,e.Slider=Li,e.SortBuilder=hs,e.Spinner=rc,e.Switch=zi,e.TOASTER_POSITIONS=Nl,e.Table=Bi,e.TableBody=Hi,e.TableCaption=qi,e.TableCell=Ki,e.TableFooter=Ui,e.TableHead=Gi,e.TableHeader=Vi,e.TableRow=Wi,e.Tabs=Ji,e.TabsContent=Zi,e.TabsList=Yi,e.TabsTrigger=Xi,e.Textarea=Qi,e.Toaster=Ri,e.Toggle=ea,e.ToggleGroup=na,e.ToggleGroupItem=ra,e.Tooltip=ni,e.TooltipContent=ii,e.TooltipProvider=ti,e.TooltipTrigger=ri,e.TypographyBlockquote=la,e.TypographyH1=ia,e.TypographyH2=aa,e.TypographyH3=oa,e.TypographyH4=sa,e.TypographyInlineCode=da,e.TypographyLarge=pa,e.TypographyLead=fa,e.TypographyList=ua,e.TypographyMuted=ha,e.TypographyP=ca,e.TypographySmall=ma,e.ViewSkeleton=fc,e.badgeVariants=ze,e.buttonGroupVariants=Uo,e.buttonVariants=K,e.cn=U,Object.defineProperty(e,"cva",{enumerable:!0,get:function(){return d.cva}}),e.getLazyIcon=Aa,e.initializeComponents=Gu,e.isInsidePopperLayer=Js,e.isLucideIconName=Oa,e.navigationMenuTriggerStyle=dr,e.notificationActionVariant=_u,e.notificationIcon=hu,e.notificationSeverityStyle=mu,e.registerPlaceholders=fu,e.renderChildren=W,e.toKebabIconName=Ta,e.toast=ne.toast,e.toggleVariants=$i,e.useConfigDraft=wu,e.useExportJob=Ou,e.useFormField=Mn,e.useGridFieldAuthoring=Vl,e.useIsMobile=ei,e.usePopperAwareInteractOutside=Ys,e.useRelatedCount=hl,e.useRelatedCountVersion=gl,e.useResizeObserver=Tu,e.useSidebar=fi});
18
+ `,document.head.appendChild(t),xc=!0}var Cc=({active:e,ariaLabel:t=`Refreshing`,className:n,...r})=>(a.useEffect(()=>{e&&Sc()},[e]),e?(0,o.jsx)(`div`,{className:W(`pointer-events-none absolute inset-x-0 top-0 z-20 h-0.5 overflow-hidden`,n),role:`progressbar`,"aria-busy":`true`,"aria-label":t,"data-testid":`refresh-indicator`,...r,children:(0,o.jsx)(`div`,{className:`h-full w-1/4 rounded-full bg-primary/70`,style:{animation:`objui-refresh-bar 1.1s ease-in-out infinite`}})}):null);Cc.displayName=`RefreshIndicator`;function wc({className:e,message:t=`Loading…`,...n}){return(0,o.jsxs)(`div`,{role:`status`,"aria-label":t,"data-slot":`data-loading-state`,className:W(`flex flex-col items-center justify-center gap-3 p-6 text-center`,e),...n,children:[(0,o.jsx)(c.Loader2,{className:`size-6 animate-spin text-muted-foreground`}),t&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]})}function Tc({className:e,icon:t,illustration:n,showIcon:r=!0,iconWrapperClassName:i,title:a=`No data`,description:s,action:l,children:u,...d}){let f=r&&(t!=null||!n);return(0,o.jsxs)(`div`,{"data-slot":`data-empty-state`,className:W(`flex flex-col items-center justify-center gap-3 p-6 text-center`,e),...d,children:[n&&(0,o.jsx)(`div`,{"data-slot":`data-empty-state-illustration`,className:`motion-safe:animate-in motion-safe:fade-in-0 motion-safe:zoom-in-95 motion-safe:duration-300 [&_svg]:max-h-40 [&_svg]:w-auto`,"aria-hidden":!0,children:n}),f&&(0,o.jsx)(`div`,{"data-slot":`data-empty-state-icon`,className:W(i??`flex size-10 items-center justify-center rounded-lg bg-muted`),children:t??(0,o.jsx)(c.InboxIcon,{className:`size-5 text-muted-foreground`})}),a&&(0,o.jsx)(`h3`,{className:`text-sm font-medium`,children:a}),s&&(0,o.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:s}),l,u]})}function Ec({className:e,title:t=`Something went wrong`,message:n,onRetry:r,retryLabel:i=`Retry`,children:a,...s}){return(0,o.jsxs)(`div`,{role:`alert`,"data-slot":`data-error-state`,className:W(`flex flex-col items-center justify-center gap-3 p-6 text-center`,e),...s,children:[(0,o.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-lg bg-destructive/10`,children:(0,o.jsx)(c.AlertCircle,{className:`size-5 text-destructive`})}),t&&(0,o.jsx)(`h3`,{className:`text-sm font-medium`,children:t}),n&&(0,o.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:n}),r&&(0,o.jsx)(K,{variant:`outline`,size:`sm`,onClick:r,children:i}),a]})}function Dc(e){return!e&&e!==0?``:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(2)} GB`}function Oc({open:e,onOpenChange:t,job:n,title:r,description:i,filename:s,allowCloseWhileRunning:l=!0,className:u,onAfterDownload:d,closeAfterDownloadMs:f}){let{progress:p,error:m,isRunning:h,cancel:g,download:_,reset:v}=n,y=p?.status,b=typeof p?.percentComplete==`number`?Math.max(0,Math.min(100,p.percentComplete)):void 0,x=y===`completed`,S=y===`failed`||y===`expired`,C=y===`cancelled`,w=a.useCallback(async()=>{await _(s)&&(d?.(),f&&f>0&&setTimeout(()=>t(!1),f))},[_,s,d,f,t]),T=a.useCallback(e=>{!e&&h&&!l||(t(e),!e&&!h&&setTimeout(v,0))},[h,l,t,v]),E=r??(x?`Export ready`:S?`Export failed`:C?`Export cancelled`:`Exporting…`),D=i??(x?`Your export is ready to download.`:S?`The export job did not complete.`:C?`The export was cancelled.`:`Your export is being prepared on the server. You can close this window — the job will continue in the background.`);return(0,o.jsx)(Ct,{open:e,onOpenChange:T,children:(0,o.jsxs)(Ot,{"data-testid":`export-progress-dialog`,className:W(`sm:max-w-md`,u),children:[(0,o.jsxs)(kt,{children:[(0,o.jsxs)(jt,{className:`flex items-center gap-2`,children:[x?(0,o.jsx)(c.CheckCircle2,{className:`h-5 w-5 text-green-600`,"aria-hidden":`true`}):S?(0,o.jsx)(c.AlertCircle,{className:`h-5 w-5 text-destructive`,"aria-hidden":`true`}):(0,o.jsx)(c.Loader2,{className:W(`h-5 w-5 text-muted-foreground`,h&&`animate-spin`),"aria-hidden":`true`}),E]}),(0,o.jsx)(Mt,{children:D})]}),(0,o.jsxs)(`div`,{className:`py-2 space-y-3`,children:[(h||x)&&(0,o.jsx)(`div`,{"data-testid":`export-progress-bar`,children:b===void 0?(0,o.jsx)(Or,{value:void 0,"aria-label":`Export progress (indeterminate)`}):(0,o.jsx)(Or,{value:b,"aria-label":`Export progress`})}),(0,o.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,o.jsx)(`span`,{"data-testid":`export-progress-counts`,children:p?.processedRecords==null?h?`Starting…`:``:`${p.processedRecords.toLocaleString()}${p.totalRecords==null?``:` / ${p.totalRecords.toLocaleString()}`} records`}),(0,o.jsx)(`span`,{"data-testid":`export-progress-percent`,children:b===void 0?``:`${b.toFixed(0)}%`})]}),p?.fileSize?(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:Dc(p.fileSize)}):null,(m||p?.error)&&(0,o.jsx)(`div`,{"data-testid":`export-progress-error`,className:`text-xs text-destructive bg-destructive/10 border border-destructive/30 rounded-md px-2 py-1`,children:m?.message||p?.error?.message})]}),(0,o.jsxs)(At,{className:`gap-2 sm:gap-2`,children:[h&&(0,o.jsxs)(K,{type:`button`,variant:`ghost`,onClick:()=>g(),"data-testid":`export-progress-cancel`,children:[(0,o.jsx)(c.X,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:`ml-1`,children:`Cancel`})]}),x&&(0,o.jsxs)(K,{type:`button`,variant:`default`,onClick:w,"data-testid":`export-progress-download`,children:[(0,o.jsx)(c.Download,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:`ml-1`,children:`Download`})]}),!h&&(0,o.jsx)(K,{type:`button`,variant:`outline`,onClick:()=>T(!1),"data-testid":`export-progress-close`,children:`Close`})]})]})})}t.ComponentRegistry.register(`combobox`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(Qo,{options:e.options||[],placeholder:e.placeholder,value:e.value,disabled:e.disabled,className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i})},{namespace:`ui`,label:`Combobox`,inputs:[{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`value`,type:`string`,label:`Value`},{name:`disabled`,type:`boolean`,label:`Disabled`,defaultValue:!1},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{placeholder:`Select option...`,options:[]}}),t.ComponentRegistry.register(`command`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsxs)(Nt,{className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:[(0,o.jsx)(Ft,{placeholder:e.placeholder||`Type a command or search...`}),(0,o.jsxs)(It,{children:[(0,o.jsx)(Lt,{children:e.emptyText||`No results found.`}),e.groups?.map((e,t)=>(0,o.jsx)(Rt,{heading:e.heading,children:e.items?.map((e,t)=>(0,o.jsx)(Bt,{value:e.value,children:e.label},t))},t))]})]})},{namespace:`ui`,label:`Command`,inputs:[{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`emptyText`,type:`string`,label:`Empty Text`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{placeholder:`Type a command or search...`,emptyText:`No results found.`,groups:[]}});var kc=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let{"data-obj-id":i,"data-obj-type":a,style:s,...c}=n,l=e.clickable||!!n.onClick,u=e.hoverable||l;return(0,o.jsxs)(Je,{ref:r,className:W(t,u&&`transition-colors hover:bg-muted/50`,l&&`cursor-pointer active:bg-muted`),...c,"data-obj-id":i,"data-obj-type":a,style:s,children:[(e.title||e.description||e.header)&&(0,o.jsxs)(Ye,{children:[e.title&&(0,o.jsx)(Xe,{children:e.title}),e.description&&(0,o.jsx)(Ze,{children:e.description}),e.header&&G(e.header)]}),(e.children||e.body)&&(0,o.jsx)(Qe,{children:G(e.children||e.body)}),e.footer&&(0,o.jsx)($e,{className:`flex justify-between`,children:G(e.footer)})]})});t.ComponentRegistry.register(`card`,kc,{namespace:`ui`,label:`Card`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Card Title`,description:`Card description goes here`,className:`w-full`},isContainer:!0,resizable:!0,resizeConstraints:{width:!0,height:!0,minWidth:200,minHeight:100}}),t.ComponentRegistry.register(`tabs`,({schema:e,className:t,onChange:n,value:r,...i})=>{let{"data-obj-id":a,"data-obj-type":s,style:c,...l}=i,u=e=>{n&&n(e)},d=e.orientation===`vertical`;return(0,o.jsxs)(Xi,{defaultValue:r===void 0?e.defaultValue:void 0,value:r??e.value,onValueChange:u,orientation:e.orientation||`horizontal`,className:W(t,d&&`flex gap-2`),...l,"data-obj-id":a,"data-obj-type":s,style:c,children:[(0,o.jsx)(Zi,{className:W(d&&`flex-col h-auto items-stretch bg-muted/50 p-1`),children:e.items?.map(e=>(0,o.jsx)(Qi,{value:e.value,disabled:e.disabled,className:W(d&&`justify-start`),children:e.label},e.value))}),e.items?.map(e=>(0,o.jsx)($i,{value:e.value,className:W(`mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,d&&`mt-0 flex-1`),children:G(e.content||e.body)},e.value))]})},{namespace:`ui`,label:`Tabs`,inputs:[{name:`defaultValue`,type:`string`,label:`Default Value`,required:!0},{name:`className`,type:`string`,label:`CSS Class`},{name:`items`,type:`array`,label:`Items`}],defaultProps:{defaultValue:`tab1`,items:[{label:`Tab 1`,value:`tab1`,body:[{type:`text`,content:`Content for Tab 1`}]},{label:`Tab 2`,value:`tab2`,body:[{type:`text`,content:`Content for Tab 2`}]},{label:`Tab 3`,value:`tab3`,body:[{type:`text`,content:`Content for Tab 3`}]}],className:`w-full`}});var Ac={1:`grid-cols-1`,2:`grid-cols-2`,3:`grid-cols-3`,4:`grid-cols-4`,5:`grid-cols-5`,6:`grid-cols-6`,7:`grid-cols-7`,8:`grid-cols-8`,9:`grid-cols-9`,10:`grid-cols-10`,11:`grid-cols-11`,12:`grid-cols-12`},jc={1:`sm:grid-cols-1`,2:`sm:grid-cols-2`,3:`sm:grid-cols-3`,4:`sm:grid-cols-4`,5:`sm:grid-cols-5`,6:`sm:grid-cols-6`,7:`sm:grid-cols-7`,8:`sm:grid-cols-8`,9:`sm:grid-cols-9`,10:`sm:grid-cols-10`,11:`sm:grid-cols-11`,12:`sm:grid-cols-12`},Mc={1:`md:grid-cols-1`,2:`md:grid-cols-2`,3:`md:grid-cols-3`,4:`md:grid-cols-4`,5:`md:grid-cols-5`,6:`md:grid-cols-6`,7:`md:grid-cols-7`,8:`md:grid-cols-8`,9:`md:grid-cols-9`,10:`md:grid-cols-10`,11:`md:grid-cols-11`,12:`md:grid-cols-12`},Nc={1:`lg:grid-cols-1`,2:`lg:grid-cols-2`,3:`lg:grid-cols-3`,4:`lg:grid-cols-4`,5:`lg:grid-cols-5`,6:`lg:grid-cols-6`,7:`lg:grid-cols-7`,8:`lg:grid-cols-8`,9:`lg:grid-cols-9`,10:`lg:grid-cols-10`,11:`lg:grid-cols-11`,12:`lg:grid-cols-12`},Pc={1:`xl:grid-cols-1`,2:`xl:grid-cols-2`,3:`xl:grid-cols-3`,4:`xl:grid-cols-4`,5:`xl:grid-cols-5`,6:`xl:grid-cols-6`,7:`xl:grid-cols-7`,8:`xl:grid-cols-8`,9:`xl:grid-cols-9`,10:`xl:grid-cols-10`,11:`xl:grid-cols-11`,12:`xl:grid-cols-12`},Fc={0:`gap-0`,1:`gap-1`,2:`gap-2`,3:`gap-3`,4:`gap-4`,5:`gap-5`,6:`gap-6`,8:`gap-8`,10:`gap-10`,12:`gap-12`};t.ComponentRegistry.register(`grid`,({schema:e,className:t,...n})=>{let r=2,i,a,s,c;typeof e.columns==`number`?r=e.columns:typeof e.columns==`object`&&e.columns!==null&&(r=e.columns.xs??1,i=e.columns.sm,a=e.columns.md,s=e.columns.lg,c=e.columns.xl),e.smColumns&&(i=e.smColumns),e.mdColumns&&(a=e.mdColumns),e.lgColumns&&(s=e.lgColumns),e.xlColumns&&(c=e.xlColumns),typeof e.columns==`number`&&r>1&&i===void 0&&a===void 0&&s===void 0&&c===void 0&&(a=r,i=Math.min(2,r),r=1);let l=e.gap??4,u=W(`grid`,Ac[r]||`grid-cols-2`,i&&jc[i],a&&Mc[a],s&&Nc[s],c&&Pc[c],Fc[l]||`gap-[${l*.25}rem]`,t),{"data-obj-id":d,"data-obj-type":f,style:p,...m}=n;return(0,o.jsx)(`div`,{className:u,...m,"data-obj-id":d,"data-obj-type":f,style:p,children:e.children&&G(e.children)})},{namespace:`ui`,label:`Grid Layout`,inputs:[{name:`columns`,type:`number`,label:`Base Columns (Mobile)`,defaultValue:2,description:`Number of columns on mobile devices`},{name:`smColumns`,type:`number`,label:`SM Columns (Tablet)`,description:`Columns at sm breakpoint (>640px)`},{name:`mdColumns`,type:`number`,label:`MD Columns (Laptop)`,description:`Columns at md breakpoint (>768px)`},{name:`lgColumns`,type:`number`,label:`LG Columns (Desktop)`,description:`Columns at lg breakpoint (>1024px)`},{name:`xlColumns`,type:`number`,label:`XL Columns (Wide)`,description:`Columns at xl breakpoint (>1280px)`},{name:`gap`,type:`number`,label:`Gap`,defaultValue:4,description:`Gap between items (0-12)`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{columns:1,mdColumns:2,lgColumns:4,gap:4,children:[{type:`card`,title:`Card 1`,description:`First card`},{type:`card`,title:`Card 2`,description:`Second card`},{type:`card`,title:`Card 3`,description:`Third card`},{type:`card`,title:`Card 4`,description:`Fourth card`}]},isContainer:!0,resizable:!0,resizeConstraints:{width:!0,height:!0,minWidth:200,minHeight:100}}),t.ComponentRegistry.register(`flex`,({schema:e,className:t,...n})=>{let r=e.direction||`row`,i=e.justify||`start`,a=e.align||`start`,s=e.gap||2,c=e.wrap||!1,l=W(`flex`,r===`row`&&`flex-row`,r===`col`&&`flex-col`,r===`row-reverse`&&`flex-row-reverse`,r===`col-reverse`&&`flex-col-reverse`,i===`start`&&`justify-start`,i===`end`&&`justify-end`,i===`center`&&`justify-center`,i===`between`&&`justify-between`,i===`around`&&`justify-around`,i===`evenly`&&`justify-evenly`,a===`start`&&`items-start`,a===`end`&&`items-end`,a===`center`&&`items-center`,a===`baseline`&&`items-baseline`,a===`stretch`&&`items-stretch`,s===0&&`gap-0`,s===1&&`gap-1`,s===2&&`gap-1.5 sm:gap-2`,s===3&&`gap-2 sm:gap-3`,s===4&&`gap-2 sm:gap-3 md:gap-4`,s===5&&`gap-3 sm:gap-4 md:gap-5`,s===6&&`gap-3 sm:gap-4 md:gap-6`,s===7&&`gap-4 sm:gap-5 md:gap-7`,s===8&&`gap-4 sm:gap-6 md:gap-8`,c&&`flex-wrap`,t),{"data-obj-id":u,"data-obj-type":d,style:f,...p}=n;return(0,o.jsx)(`div`,{className:l,...p,"data-obj-id":u,"data-obj-type":d,style:f,children:e.children&&G(e.children)})},{namespace:`ui`,label:`Flex Layout`,inputs:[{name:`direction`,type:`enum`,enum:[`row`,`col`,`row-reverse`,`col-reverse`],label:`Direction`,defaultValue:`row`},{name:`justify`,type:`enum`,enum:[`start`,`end`,`center`,`between`,`around`,`evenly`],label:`Justify Content`,defaultValue:`start`},{name:`align`,type:`enum`,enum:[`start`,`end`,`center`,`baseline`,`stretch`],label:`Align Items`,defaultValue:`start`},{name:`gap`,type:`number`,label:`Gap`,defaultValue:2,description:`Gap between items (0-8)`},{name:`wrap`,type:`boolean`,label:`Wrap`,defaultValue:!1,description:`Allow flex items to wrap`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{direction:`row`,justify:`start`,align:`center`,gap:2,wrap:!1,children:[{type:`button`,label:`Button 1`},{type:`button`,label:`Button 2`},{type:`button`,label:`Button 3`}]}});var Ic=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let i=e.direction||`col`,a=e.justify||`start`,s=e.align||`stretch`,c=e.gap??e.spacing??2,l=e.wrap||!1,u=W(`flex`,i===`row`&&`flex-row`,i===`col`&&`flex-col`,i===`row-reverse`&&`flex-row-reverse`,i===`col-reverse`&&`flex-col-reverse`,a===`start`&&`justify-start`,a===`end`&&`justify-end`,a===`center`&&`justify-center`,a===`between`&&`justify-between`,a===`around`&&`justify-around`,a===`evenly`&&`justify-evenly`,s===`start`&&`items-start`,s===`end`&&`items-end`,s===`center`&&`items-center`,s===`baseline`&&`items-baseline`,s===`stretch`&&`items-stretch`,c===0&&`gap-0`,c===1&&`gap-1`,c===2&&`gap-1.5 sm:gap-2`,c===3&&`gap-2 sm:gap-3`,c===4&&`gap-2 sm:gap-3 md:gap-4`,c===5&&`gap-3 sm:gap-4 md:gap-5`,c===6&&`gap-3 sm:gap-4 md:gap-6`,c===8&&`gap-4 sm:gap-6 md:gap-8`,c===10&&`gap-5 sm:gap-7 md:gap-10`,l&&`flex-wrap`,t),{"data-obj-id":d,"data-obj-type":f,style:p,...m}=n;return(0,o.jsx)(`div`,{ref:r,className:u,...m,"data-obj-id":d,"data-obj-type":f,style:p,children:e.children&&G(e.children)})});t.ComponentRegistry.register(`stack`,Ic,{namespace:`ui`,label:`Stack`,inputs:[{name:`direction`,type:`enum`,label:`Direction`,enum:[`col`,`row`,`col-reverse`,`row-reverse`],defaultValue:`col`},{name:`gap`,type:`number`,label:`Gap`,defaultValue:2},{name:`align`,type:`enum`,label:`Align Items`,enum:[`start`,`end`,`center`,`stretch`,`baseline`],defaultValue:`stretch`},{name:`justify`,type:`enum`,label:`Justify Content`,enum:[`start`,`end`,`center`,`between`,`around`,`evenly`],defaultValue:`start`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{direction:`col`,gap:2,align:`stretch`,children:[]},isContainer:!0,resizable:!0,resizeConstraints:{width:!0,height:!0,minWidth:100,minHeight:50}});var Lc=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let i=e.maxWidth||`xl`,a=e.padding||4,s=e.centered!==!1,c=W(`w-full`,i===`sm`&&`max-w-sm`,i===`md`&&`max-w-md`,i===`lg`&&`max-w-lg`,i===`xl`&&`max-w-xl`,i===`2xl`&&`max-w-2xl`,i===`3xl`&&`max-w-3xl`,i===`4xl`&&`max-w-4xl`,i===`5xl`&&`max-w-5xl`,i===`6xl`&&`max-w-6xl`,i===`7xl`&&`max-w-7xl`,i===`full`&&`max-w-full`,i===`screen`&&`max-w-screen-2xl`,s&&`mx-auto`,a===0&&`p-0`,a===1&&`p-0.5 sm:p-1`,a===2&&`p-1 sm:p-2`,a===3&&`p-2 sm:p-3`,a===4&&`p-2 sm:p-3 md:p-4`,a===5&&`p-3 sm:p-4 md:p-5`,a===6&&`p-3 sm:p-4 md:p-6`,a===7&&`p-4 sm:p-5 md:p-7`,a===8&&`p-4 sm:p-6 md:p-8`,a===10&&`p-5 sm:p-7 md:p-10`,a===12&&`p-6 sm:p-8 md:p-12`,a===16&&`p-8 sm:p-10 md:p-16`,t),{"data-obj-id":l,"data-obj-type":u,style:d,...f}=n;return(0,o.jsx)(`div`,{ref:r,className:c,...f,"data-obj-id":l,"data-obj-type":u,style:d,children:e.children&&G(e.children)})});t.ComponentRegistry.register(`container`,Lc,{namespace:`ui`,label:`Container`,inputs:[{name:`maxWidth`,type:`enum`,enum:[`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`,`7xl`,`full`,`screen`],label:`Max Width`,defaultValue:`xl`},{name:`padding`,type:`number`,label:`Padding`,defaultValue:4,description:`Padding value (0, 1-8, 10, 12, 16)`},{name:`centered`,type:`boolean`,label:`Center Horizontally`,defaultValue:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{maxWidth:`xl`,padding:4,centered:!0,children:[{type:`text`,content:`Container content goes here`}]},isContainer:!0,resizable:!0,resizeConstraints:{width:!0,height:!0,minWidth:200,minHeight:100}});function Rc(e){return e.split(/[-_:]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}function zc(e){let n={},r=new Set;for(let o of t.ComponentRegistry.getPublicConfigs()){let t=o.type;if(!t||o.isContainer)continue;let s=Rc(t);if(r.has(s))continue;r.add(s);let c=({children:n,...r})=>{let o=typeof r.type==`string`&&r.type!==t?r.type:void 0;return a.createElement(i.SchemaRenderer,{schema:{dataSource:e,...r,...o?{specType:o}:{},type:t}})};c.displayName=s,n[s]=c}let o=({type:t,children:n,...r})=>a.createElement(i.SchemaRenderer,{schema:{type:t,dataSource:e,...r}});return o.displayName=`Block`,n.Block=o,n}var Bc={};function Vc(){return(0,o.jsxs)(`div`,{className:`m-4 rounded-md border border-amber-400/40 bg-amber-50 p-4 text-sm text-amber-900 dark:bg-amber-950/30 dark:text-amber-200`,children:[(0,o.jsx)(`div`,{className:`font-semibold`,children:`React pages are disabled on this deployment`}),(0,o.jsxs)(`p`,{className:`mt-1 leading-relaxed`,children:[(0,o.jsx)(`code`,{children:`kind:'react'`}),` pages execute author JavaScript directly in the application. This deployment has turned the capability off (`,(0,o.jsx)(`code`,{children:`OS_PAGE_REACT=off`}),` / `,(0,o.jsx)(`code`,{children:`disableCapability('react-pages')`}),`). It is ON by default; re-enable it if your page authors are trusted.`]})]})}var Hc=({schema:e})=>{let n=typeof e?.source==`string`?e.source:``,r=(0,i.useAdapter)(),s=(0,t.isCapabilityEnabled)(t.CAP_REACT_PAGES),[c,l]=a.useState(null),[u,d]=a.useState(null);a.useEffect(()=>{if(!s)return;let e=!0;return import(`@object-ui/react-runtime`).then(t=>e&&l(t)).catch(t=>e&&d(t)),()=>{e=!1}},[s]);let f=a.useMemo(()=>({...zc(r),useAdapter:i.useAdapter,data:e?.data??e?.variables??{},variables:e?.variables??{},page:e??{}}),[e,r]);if(!s)return(0,o.jsx)(Vc,{});if(u)return(0,o.jsxs)(`div`,{className:`m-4 rounded-md border border-destructive/40 bg-destructive/10 p-4 text-sm text-destructive`,children:[(0,o.jsx)(`div`,{className:`font-semibold`,children:`Failed to load the react runtime`}),(0,o.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap`,children:String(u)})]});if(!n.trim())return(0,o.jsxs)(`div`,{className:`m-4 rounded-md border border-destructive/40 bg-destructive/10 p-4 text-sm text-destructive`,children:[`A `,(0,o.jsx)(`code`,{children:`kind:'react'`}),` page requires a non-empty `,(0,o.jsx)(`code`,{children:`source`}),`.`]});if(!c)return(0,o.jsx)(`div`,{className:`m-4 text-sm text-muted-foreground`,children:`Loading react runtime…`});let{ReactRunner:p}=c;return(0,o.jsx)(i.SchemaRendererProvider,{dataSource:r??Bc,children:(0,o.jsx)(p,{code:n,scope:f,fallback:e=>(0,o.jsxs)(`div`,{className:`m-4 rounded-md border border-destructive/40 bg-destructive/10 p-4 text-sm text-destructive`,children:[(0,o.jsx)(`div`,{className:`font-semibold`,children:`React page error`}),(0,o.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap`,children:String(e)})]})})})};function Uc(e){switch(e){case`small`:return`w-64`;case`medium`:return`w-80`;case`large`:return`w-96`;case`full`:return`w-full`;default:return e||`w-full`}}function Wc(e){switch(e){case`small`:return`w-full md:w-64`;case`medium`:return`w-full md:w-80`;case`large`:return`w-full md:w-96`;default:return`w-full`}}function Gc(e){switch(e){case`utility`:return`max-w-4xl`;case`home`:return`max-w-screen-2xl`;case`app`:return`max-w-screen-xl`;default:return`max-w-7xl`}}function Kc(e,t){return e?.find(e=>e.name?.toLowerCase()===t.toLowerCase())}function qc(e,t){if(!e)return[];let n=new Set(t.map(e=>e.toLowerCase()));return e.filter(e=>!n.has(e.name?.toLowerCase()??``))}var Jc=`page:header`;function Yc(e){return e==null?``:typeof e==`string`?e.replace(/\{[a-zA-Z0-9_.]+\}/g,``).replace(/\s+/g,` `).trim():typeof e==`object`?Object.values(e).map(e=>Yc(e)).find(e=>e!==``)??``:String(e)}function Xc(e){return e?.type===Jc&&Yc(e?.title??e?.properties?.title)!==``}function Zc(e,t=0){return!Array.isArray(e)||t>6?!1:e.some(e=>!!e&&typeof e==`object`&&(Xc(e)||Zc(e.components,t+1)||Zc(e.children,t+1)||Zc(e.body,t+1)))}function Qc(e){return Zc((e.regions??[]).flatMap(e=>e?.components??[]))||Zc(e.body)||Zc(e.children)}var $=({region:e,className:t})=>{let n=e.components||[];return n.length===0?null:(0,o.jsx)(`div`,{className:W(`space-y-4`,e.className,t),"data-region":e.name,children:n.map((t,n)=>(0,o.jsx)(i.SchemaRenderer,{schema:t},t?.id||`${e.name}-${n}`))})},$c=({regions:e,pageType:t,className:n})=>{let r=Kc(e,`header`),i=Kc(e,`sidebar`),a=Kc(e,`main`),s=Kc(e,`aside`),c=Kc(e,`footer`),l=qc(e,[`header`,`sidebar`,`main`,`aside`,`footer`]);return r||i||a||s||c?(0,o.jsxs)(`div`,{className:W(`flex flex-col gap-6`,n),"data-page-layout":t,children:[r&&(0,o.jsx)($,{region:r,className:W(Uc(r.width))}),(0,o.jsxs)(`div`,{className:`flex flex-col md:flex-row flex-1 gap-6`,children:[i&&(0,o.jsx)(`aside`,{className:W(`md:shrink-0`,Wc(i.width||`small`)),children:(0,o.jsx)($,{region:i})}),(0,o.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-6`,children:[a&&(0,o.jsx)($,{region:a}),l.map((e,t)=>(0,o.jsx)($,{region:e},e.name||`extra-${t}`))]}),s&&(0,o.jsx)(`aside`,{className:W(`md:shrink-0`,Wc(s.width||`small`),s.className),children:(0,o.jsx)($,{region:s})})]}),c&&(0,o.jsx)($,{region:c,className:W(Uc(c.width))})]}):(0,o.jsx)(`div`,{className:W(`space-y-6`,n),"data-page-layout":t,children:e.map((e,t)=>(0,o.jsx)($,{region:e},e.name||t))})},el=({schema:e})=>{let t=e.body||e.children,n=Array.isArray(t)?t:t?[t]:[];return n.length===0?null:(0,o.jsx)(`div`,{className:`space-y-6`,children:n.map((e,t)=>(0,o.jsx)(i.SchemaRenderer,{schema:e},e?.id||t))})},tl=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)($c,{regions:e.regions,pageType:e.pageType}):(0,o.jsx)(el,{schema:e}),nl={default:tl,"full-width":tl,"header-sidebar-main":({schema:e})=>{let t=e.regions||[];if(t.length===0)return(0,o.jsx)(el,{schema:e});let n=Kc(t,`header`),r=Kc(t,`sidebar`),i=Kc(t,`main`),a=qc(t,[`header`,`sidebar`,`main`]);return(0,o.jsxs)(`div`,{className:`flex flex-col gap-6`,"data-template":`header-sidebar-main`,children:[n&&(0,o.jsx)($,{region:n}),(0,o.jsxs)(`div`,{className:`flex flex-col md:flex-row flex-1 gap-6`,children:[r&&(0,o.jsx)(`aside`,{className:W(`md:shrink-0`,Wc(r.width||`medium`)),children:(0,o.jsx)($,{region:r})}),(0,o.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-6`,children:[i&&(0,o.jsx)($,{region:i}),a.map((e,t)=>(0,o.jsx)($,{region:e},e.name||`extra-${t}`))]})]})]})},"three-column":({schema:e})=>{let t=e.regions||[];if(t.length===0)return(0,o.jsx)(el,{schema:e});let n=Kc(t,`header`),r=Kc(t,`sidebar`),i=Kc(t,`main`),a=Kc(t,`aside`),s=Kc(t,`footer`),c=qc(t,[`header`,`sidebar`,`main`,`aside`,`footer`]);return(0,o.jsxs)(`div`,{className:`flex flex-col gap-6`,"data-template":`three-column`,children:[n&&(0,o.jsx)($,{region:n}),(0,o.jsxs)(`div`,{className:`flex flex-col md:flex-row flex-1 gap-6`,children:[r&&(0,o.jsx)(`aside`,{className:W(`md:shrink-0`,Wc(r.width||`small`)),children:(0,o.jsx)($,{region:r})}),(0,o.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-6`,children:[i&&(0,o.jsx)($,{region:i}),c.map((e,t)=>(0,o.jsx)($,{region:e},e.name||`extra-${t}`))]}),a&&(0,o.jsx)(`aside`,{className:W(`md:shrink-0`,Wc(a.width||`small`),a.className),children:(0,o.jsx)($,{region:a})})]}),s&&(0,o.jsx)($,{region:s})]})},dashboard:({schema:e})=>{let t=e.regions||[];if(t.length===0)return(0,o.jsx)(el,{schema:e});let n=Kc(t,`header`),r=Kc(t,`footer`),i=qc(t,[`header`,`footer`]);return(0,o.jsxs)(`div`,{className:`flex flex-col gap-6`,"data-template":`dashboard`,children:[n&&(0,o.jsx)($,{region:n}),(0,o.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:i.map((e,t)=>(0,o.jsx)($,{region:e},e.name||`region-${t}`))}),r&&(0,o.jsx)($,{region:r})]})}};function rl(e){return e.template&&nl[e.template]||null}var il=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)($c,{regions:e.regions,pageType:`record`}):(0,o.jsx)(el,{schema:e}),al=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)($c,{regions:e.regions,pageType:`home`}):(0,o.jsx)(el,{schema:e}),ol=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)($c,{regions:e.regions,pageType:`app`}):(0,o.jsx)(el,{schema:e}),sl=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)($c,{regions:e.regions,pageType:`utility`}):(0,o.jsx)(el,{schema:e}),cl=-1,ll=null;function ul(){let e=t.ComponentRegistry.getVersion();if(ll===null||cl!==e){let n=t.ComponentRegistry.getKnownTypes().map(e=>{let n=t.ComponentRegistry.getMeta(e);return{type:e,namespace:n?.namespace,isContainer:n?.isContainer,inputs:n?.inputs}});ll=(0,V.manifestFromConfigs)(n),cl=e}return ll}var dl=({schema:e,className:n,...r})=>{let s=e.pageType||`record`,[c,l]=a.default.useReducer(e=>e+1,0);a.default.useEffect(()=>t.ComponentRegistry.subscribe(l),[]);let u=e.title??e.label,{"data-obj-id":d,"data-obj-type":f,style:p,pageType:m,schema:h,regions:g,template:_,title:v,icon:y,description:b,object:x,variables:S,body:C,isDefault:w,assignedProfiles:T,aria:E,recordOverride:D,permissions:O,requiredPermissions:k,enforceFieldSecurity:A,redactFields:j,children:M,...N}=r,P=Object.fromEntries(Object.entries(N).filter(([e])=>!e.startsWith(`_`))),F=(0,a.useMemo)(()=>{let t=e.kind;if(t===`react`)return(0,o.jsx)(Hc,{schema:e});if(t===`html`||t===`jsx`){let t=e.source??``,{tree:n,diagnostics:r}=(0,V.compile)(t,ul()),a=r.filter(e=>e.severity===`error`);return a.length?(0,o.jsxs)(`div`,{className:`m-4 rounded-md border border-destructive/40 bg-destructive/10 p-4 text-sm text-destructive`,children:[(0,o.jsxs)(`div`,{className:`font-semibold`,children:[`HTML page failed to compile (`,a.length,`)`]}),(0,o.jsx)(`ul`,{className:`mt-1 list-disc space-y-0.5 pl-5`,children:a.slice(0,8).map((e,t)=>(0,o.jsx)(`li`,{children:e.message},t))})]}):n?(0,o.jsx)(i.SchemaRenderer,{schema:n}):null}let n=rl(e);if(n)return(0,o.jsx)(n,{schema:e});switch(s){case`home`:return(0,o.jsx)(al,{schema:e});case`app`:return(0,o.jsx)(ol,{schema:e});case`utility`:return(0,o.jsx)(sl,{schema:e});default:return(0,o.jsx)(il,{schema:e})}},[e,s,c]),ee=(e.regions??[]).some(e=>e.name?.toLowerCase()===`main`&&e.width===`full`),te=ee?`max-w-none`:Gc(s),I=a.default.useMemo(()=>s===`record`||Qc(e),[e,s]),ne=!!u&&!I,L=!!e.description&&s!==`record`,re=(0,o.jsx)(`div`,{className:W(`min-h-full w-full bg-background p-3 md:p-4 lg:p-6`,n),"data-page-type":s,"data-obj-id":d,"data-obj-type":f,style:p,...P,children:(0,o.jsxs)(`div`,{className:W(ee?`space-y-6`:`mx-auto space-y-6`,te),children:[(ne||L)&&(0,o.jsxs)(`div`,{className:`space-y-2`,children:[ne&&(0,o.jsx)(`h1`,{className:`text-3xl font-bold tracking-tight text-foreground`,children:u}),L&&(0,o.jsx)(`p`,{className:`text-muted-foreground`,children:e.description})]}),F]})});return e.variables&&e.variables.length>0?(0,o.jsxs)(i.PageVariablesProvider,{definitions:e.variables,children:[(0,o.jsx)(i.PageVariableActionBridge,{}),re]}):re},fl={namespace:`ui`,label:`Page`,icon:`Layout`,category:`layout`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`pageType`,type:`string`,label:`Page Type`},{name:`object`,type:`string`,label:`Object Name`},{name:`template`,type:`string`,label:`Template`},{name:`regions`,type:`array`,label:`Regions`,itemType:`object`},{name:`variables`,type:`array`,label:`Variables`,itemType:`object`},{name:`body`,type:`array`,label:`Content (Legacy)`,itemType:`component`}]};t.ComponentRegistry.register(`page`,dl,fl),t.ComponentRegistry.register(`app`,dl,{...fl,label:`App Page`}),t.ComponentRegistry.register(`utility`,dl,{...fl,label:`Utility Page`}),t.ComponentRegistry.register(`home`,dl,{...fl,label:`Home Page`}),t.ComponentRegistry.register(`record`,dl,{...fl,label:`Record Page`});var pl=new Map,ml=new Map,hl=new Set,gl=0;function _l(e,t,n){return`${e}::${t??``}::${n??``}`}function vl(){gl+=1;for(let e of hl)e()}function yl(e,t,n){return pl.get(_l(e,t,n))}function bl(e,t,n,r){let i=_l(e,t,n);pl.get(i)!==r&&(pl.set(i,r),vl())}async function xl(e,t,n,r){let i=_l(t,n,r),a=pl.get(i);if(a!==void 0)return a;let o=ml.get(i);if(o)return o;let s=(async()=>{let a={};if(n){if(!r)return 0;a[n]=r}try{let i=await e(t,{$filter:a,$top:1,$count:!0}),o=typeof i?.total==`number`?i.total:typeof i?.count==`number`?i.count:Array.isArray(i?.records)?i.records.length:Array.isArray(i?.data)?i.data.length:Array.isArray(i)?i.length:0,s=typeof o==`number`?o:0;return bl(t,n,r,s),s}catch{return 0}finally{ml.delete(i)}})();return ml.set(i,s),s}function Sl(e,t){let n=!1,r=`${e}::`;for(let e of pl.keys())e.startsWith(r)&&(t!==void 0&&!e.endsWith(`::${t}`)||(pl.delete(e),n=!0));n&&vl()}function Cl(){pl.size!==0&&(pl.clear(),vl())}function wl(e){return hl.add(e),()=>{hl.delete(e)}}function Tl(){return gl}function El(e,t,n){if((0,a.useSyncExternalStore)(wl,Tl,Tl),e)return yl(e,t,n)}function Dl(){return(0,a.useSyncExternalStore)(wl,Tl,Tl)}var Ol={get:yl,set:bl,fetch:xl,invalidate:Sl,invalidateAll:Cl,_reset:()=>{pl.clear(),ml.clear(),vl()}};(0,i.subscribeDataChanges)(e=>{e.objectName===`*`?Ol.invalidateAll():Ol.invalidate(e.objectName)});var kl=(0,x.createSafeTranslation)({"common.itemCount":`{{count}} items`,"common.itemCountOne":`{{count}} item`},`common.itemCount`),Al=e=>{let{"data-obj-id":t,"data-obj-type":n,style:r,...i}=e||{};return{designer:{"data-obj-id":t,"data-obj-type":n,style:r},rest:i}},jl=e=>e==null?``:typeof e==`string`?e:typeof e==`object`?e.default||e.value||``:String(e),Ml={"zh-CN":{Details:`详情`,Related:`相关`,Activity:`活动`,History:`历史`,Notes:`备注`,Files:`文件`,Tasks:`任务`,"Open Tasks":`待办任务`,"Closed Tasks":`已完成任务`,Events:`日程`,Attachments:`附件`,Chatter:`讨论`,Discussion:`讨论`,Comments:`评论`,Overview:`概览`,Summary:`摘要`,Quotes:`报价单`,Products:`产品`,Contacts:`联系人`,Accounts:`客户`,Leads:`线索`,Opportunities:`商机`,Cases:`服务案例`,Campaigns:`营销活动`,Approvals:`审批`,Documents:`文档`,Emails:`邮件`,Calls:`通话`,Meetings:`会议`},"zh-TW":{Details:`詳情`,Related:`相關`,Activity:`活動`,History:`歷史`,Notes:`備註`,Files:`檔案`,Tasks:`任務`,"Open Tasks":`待辦任務`,"Closed Tasks":`已完成任務`,Events:`行程`,Attachments:`附件`,Chatter:`討論`,Discussion:`討論`,Comments:`評論`,Overview:`概覽`,Summary:`摘要`,Quotes:`報價單`,Products:`產品`,Contacts:`聯絡人`,Accounts:`客戶`,Leads:`線索`,Opportunities:`商機`,Cases:`服務案例`,Campaigns:`行銷活動`,Approvals:`審批`,Documents:`文件`,Emails:`郵件`,Calls:`通話`,Meetings:`會議`}},Nl=(e,t)=>{if(!e)return e;let n=Ml[t],r=t.split(`-`)[0]===`zh`?Ml[`zh-CN`]:void 0,i=n||r;if(!i)return e;if(i[e]!==void 0)return i[e];let a=/\s*(?:&|and|和)\s*/i;if(a.test(e)){let n=e.split(a);if(n.every(e=>i[e.trim()]!==void 0)){let e=t.startsWith(`zh`)?`与`:` & `;return n.map(e=>i[e.trim()]).join(e)}}return e},Pl=(e,t,n,r,i)=>!e||typeof e!=`string`?e||``:e.includes(`{`)?e.replace(/\{([a-zA-Z0-9_.]+)\}/g,(e,a)=>{let o=a.split(`.`).reduce((e,t)=>e==null?e:e[t],t);if(o==null||typeof o==`object`)return``;let s=String(o);if(n?.fields&&r&&i&&!a.includes(`.`)){let e=(Array.isArray(n.fields)?n.fields.find(e=>e?.name===a):n.fields[a])?.options;if(Array.isArray(e)){let t=e.find(e=>String(e?.value??e)===s);return r(i,a,s,t?.label?String(t.label):s)}}return s}).replace(/\s+/g,` `).trim():e,Fl=e=>{let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t>=1e4?`${Math.round(t/1e3)}k`:t>=1e3?`${(t/1e3).toFixed(1).replace(/\.0$/,``)}k`:String(t):String(e)},Il=(e,t=[])=>{if(!e)return t;let n=Array.isArray(e)?e:[e];for(let e of n){if(!e||typeof e!=`object`)continue;if(e.type===`record:related_list`||e.type===`record_related_list`){t.push(e);continue}let n=[e.children,e.properties?.children,e.properties?.items,e.body,e.items];for(let e of n)e&&Il(e,t)}return t},Ll=e=>{if(!e)return!1;let t=Array.isArray(e)?e:[e];for(let e of t){if(!e||typeof e!=`object`)continue;if(e.type===`record:attachments`)return!0;let t=[e.children,e.properties?.children,e.properties?.items,e.body,e.items];for(let e of t)if(e&&Ll(e))return!0}return!1};t.ComponentRegistry.register(`tabs`,({schema:e,className:n,...r})=>{let{designer:s}=Al(r),{t:c,language:l}=kl(),u=e?.items||[],d=e?.properties?.type||e?.tabStyle||`line`,f=(e?.position||`top`)===`left`,p=(0,i.useRecordContext)(),m=p?.data?.id,h=p?.dataSource,g=(0,i.usePredicateScope)(),{variables:_}=(0,i.usePageVariables)(),v=p?.data,y=u.map(e=>e?.visibleWhen===void 0||e?.visibleWhen===null||new t.ExpressionEvaluator({...v&&typeof v==`object`?v:{},...g,current_user:g?.user,record:v,data:v,page:_}).evaluateCondition(e.visibleWhen)),b=y.join(`,`),S=a.default.useMemo(()=>u.filter((e,t)=>y[t]),[u,b]),C=Dl(),w=p?.objectName,T=a.default.useMemo(()=>{let e=new Map;return S.forEach((t,n)=>{if(t.count!==void 0&&t.count!==null&&t.count!==``)return;let r=Il(t.children),i=[];for(let e of r){let t=e?.properties?.objectName||e?.objectName;if(!t)continue;let n=e?.properties?.relationshipField||e?.relationshipField;i.push({objectName:t,relationshipField:n})}w&&Ll(t.children)&&i.push({objectName:`sys_attachment`,relationshipField:`attachments:${w}`,attachments:!0}),i.length>0&&e.set(n,i)}),e},[S,w]);a.default.useEffect(()=>{if(!h||typeof h.find!=`function`||T.size===0)return;let e=!1;for(let t of T.values())for(let n of t){let t=n.attachments?(e,t)=>h.find(e,{...t,$filter:{parent_object:w,parent_id:m}}):(e,t)=>h.find(e,t);if(Ol.fetch(t,n.objectName,n.relationshipField,m).catch(()=>0),e)return}return()=>{e=!0}},[h,T,m,C]);let E=e=>{let t=T.get(e);if(!t||t.length===0)return;let n=0,r=!1;for(let e of t){let t=Ol.get(e.objectName,e.relationshipField,m);t!==void 0&&(n+=t,r=!0)}return r?n:void 0},D=S.map((e,t)=>({...e,value:typeof e.value==`string`&&e.value!==``?e.value:`tab-${t}`,labelStr:Nl((0,x.pickLocalized)(e.label,l),l),count:e.count!==void 0&&e.count!==null&&e.count!==``?e.count:E(t)})),O=e?.defaultTab,k=(O&&D.some(e=>e.value===O)?O:void 0)??D[0]?.value,A=e?.onTabChange,[j,M]=a.default.useState(k),N=(j&&D.some(e=>e.value===j)?j:void 0)??D[0]?.value??``,P=W(f&&`flex-col h-auto items-stretch p-1`,d===`card`&&`bg-transparent gap-1`,d===`pill`&&`bg-muted rounded-full p-1 gap-1`,d===`line`&&!f&&`h-auto rounded-none bg-transparent p-0 gap-4 border-b border-border w-full justify-start`,!f&&`sticky top-0 z-20 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`),F=()=>W(f&&`justify-start`,d===`card`&&`data-[state=active]:bg-background data-[state=active]:border data-[state=active]:shadow-sm rounded-md`,d===`pill`&&`rounded-full data-[state=active]:bg-background`,d===`line`&&!f&&`rounded-none border-b-2 border-transparent bg-transparent px-1 pb-2.5 -mb-px shadow-none data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:shadow-none data-[state=active]:text-foreground`);return(0,o.jsxs)(Xi,{value:N,onValueChange:e=>{M(e),A?.(e)},orientation:f?`vertical`:`horizontal`,className:W(n,f&&`flex gap-4 w-full`),...s,children:[(D.length>1||e?.properties?.alwaysShowStrip===!0)&&(0,o.jsx)(Zi,{className:P,children:D.map(e=>(0,o.jsxs)(Qi,{value:e.value,className:F(),children:[e.icon&&(0,o.jsx)(Na,{name:e.icon,className:`mr-1.5 h-3.5 w-3.5 shrink-0 opacity-70`,"aria-hidden":!0}),(0,o.jsx)(`span`,{children:e.labelStr}),e.count!==void 0&&e.count!==null&&e.count!==``&&Number(e.count)>0&&(0,o.jsx)(`span`,{className:`ml-1.5 inline-flex h-4 min-w-[1rem] items-center justify-center rounded-full bg-muted px-1 text-[10px] font-medium leading-none text-muted-foreground`,"aria-label":c(Number(e.count)===1?`common.itemCountOne`:`common.itemCount`,{count:Fl(e.count)}),children:Fl(e.count)})]},e.value))}),D.map(e=>(0,o.jsx)($i,{value:e.value,className:W(D.length>1?`mt-3`:`mt-0`,f&&`mt-0 flex-1`),children:G(e.children)},e.value))]})},{namespace:`page`,skipFallback:!0,label:`Page Tabs`,category:`layout`,isContainer:!0,inputs:[{name:`items`,type:`array`,label:`Tabs`,required:!0,description:`Tab definitions [{ label, value?, icon?, count?, visibleWhen?, children }] — value is the stable ?tab= URL token, count auto-derives from record:related_list descendants when omitted`},{name:`tabStyle`,type:`enum`,label:`Style`,enum:[`line`,`card`,`pill`],defaultValue:`line`},{name:`position`,type:`enum`,label:`Position`,enum:[`top`,`left`],defaultValue:`top`}]}),t.ComponentRegistry.register(`card`,({schema:e,className:t,...n})=>{let{designer:r}=Al(n),{language:i}=(0,x.useObjectTranslation)(),a=(0,x.pickLocalized)(e?.title,i),s=e?.bordered!==!1,c=e?.body??e?.children,l=e?.footer;return(0,o.jsxs)(Je,{className:W(t,!s&&`border-0 shadow-none bg-transparent`),...r,children:[a&&(0,o.jsx)(Ye,{children:(0,o.jsx)(Xe,{children:a})}),c&&(0,o.jsx)(Qe,{children:G(c)}),l&&(0,o.jsx)($e,{className:`flex justify-between`,children:G(l)})]})},{namespace:`page`,skipFallback:!0,label:`Page Card`,category:`layout`,isContainer:!0,inputs:[{name:`title`,type:`string`,label:`Title`,description:`Accepts an inline translation map ({ en, "zh-CN", … })`},{name:`bordered`,type:`boolean`,label:`Bordered`,defaultValue:!0},{name:`body`,type:`slot`,label:`Body`,description:"Card content; plain `children` also render here"},{name:`footer`,type:`slot`,label:`Footer`}]}),t.ComponentRegistry.register(`accordion`,({schema:e,className:t,...n})=>{let{designer:r}=Al(n),{language:i}=(0,x.useObjectTranslation)(),a=e?.items||[],s=!!e?.allowMultiple,c=(e?.variant??e?.properties?.variant??`flush`)===`flush`?`border-b last:border-b-0`:void 0,l=a.map((e,t)=>({...e,value:`panel-${t}`,labelStr:Nl((0,x.pickLocalized)(e.label,i),i)})),u=l.filter(e=>e.collapsed===!1).map(e=>e.value),d=l.map(e=>(0,o.jsxs)(_e,{value:e.value,className:c,children:[(0,o.jsx)(ve,{className:`text-sm font-semibold tracking-tight hover:no-underline`,children:e.labelStr}),(0,o.jsx)(ye,{children:G(e.children)})]},e.value));return s?(0,o.jsx)(ge,{type:`multiple`,defaultValue:u,className:t,...r,children:d}):(0,o.jsx)(ge,{type:`single`,collapsible:!0,defaultValue:u[0],className:t,...r,children:d})},{namespace:`page`,skipFallback:!0,label:`Page Accordion`,category:`layout`,isContainer:!0,inputs:[{name:`items`,type:`array`,label:`Panels`,required:!0,description:`Panel definitions [{ label, collapsed?, children }] — collapsed: false opens a panel by default`},{name:`allowMultiple`,type:`boolean`,label:`Allow Multiple Open`,defaultValue:!1},{name:`variant`,type:`enum`,label:`Variant`,enum:[`flush`,`card`],defaultValue:`flush`}]}),t.ComponentRegistry.register(`section`,({schema:e,className:t,...n})=>{let{designer:r}=Al(n);return(0,o.jsx)(`section`,{className:W(`space-y-4`,t),...r,children:G(e?.children||e?.body)})},{namespace:`page`,skipFallback:!0,label:`Page Section`,category:`layout`,isContainer:!0});function Rl(e){if(!e)return e;let t=e;for(let e=0;e<4;e+=1){let e=t.replace(/[\s\u00A0]*[-·:|/–—][\s\u00A0]*$/u,``).trimEnd();if(e===t)break;t=e}for(let e=0;e<4;e+=1){let e=t.replace(/^[\s\u00A0]*[-·:|/–—][\s\u00A0]*/u,``).trimStart();if(e===t)break;t=e}return t=t.replace(/([-·:|/–—])[\s\u00A0]*\1/gu,`$1`),t=t.replace(/[\s\u00A0]+/g,` `).trim(),t}var zl=new Set;function Bl(e,t,n){let r=`throw::${String(e)}::${t}`;if(zl.has(r))return;zl.add(r);let i=n instanceof Error?n.message:String(n);console.warn(`[page:header] action "${String(e)}" hidden: its predicate threw — ${i}. Predicate: ${t}. Header-action predicates evaluate against { record, user, os.user, ctx.user, app, features, <record fields> }.`)}function Vl(e,t,n){if(!n||typeof n!=`object`||Object.keys(n).length===0)return;let r=/\brecord\.([A-Za-z_][A-Za-z0-9_]*)/g,i=[];for(let e=r.exec(t);e;e=r.exec(t))!(e[1]in n)&&!i.includes(e[1])&&i.push(e[1]);if(i.length===0)return;let a=`missing::${String(e)}::${t}`;zl.has(a)||(zl.add(a),console.warn(`[page:header] action "${String(e)}" predicate references record field(s) not present in the record payload: ${i.join(`, `)}. Predicate: ${t}. Hidden (hidden: true) fields are stripped from detail payloads server-side, so a predicate gating on one may evaluate to a hide-by-default verdict.`))}t.ComponentRegistry.register(`header`,({schema:e,className:n,...r})=>{let{designer:s}=Al(r),l=(0,i.useRecordContext)(),u=!!(0,i.useInlineEdit)()?.editing,d=(0,i.usePredicateScope)(),{execute:f}=(0,i.useAction)(),p=(0,i.useCapabilityGate)(),m=ni(),{objectLabel:h,actionLabel:g}=(0,x.useObjectLabel)(),{fieldOptionLabel:_}=(0,x.useSafeFieldLabel)(),{language:v}=(0,x.useObjectTranslation)(),y=(0,x.useSafeTranslate)(),b=e?.title??e?.properties?.title,S=e?.subtitle??e?.properties?.subtitle,C=l?.objectSchema,w=l?.objectName||C?.name,T=Pl((0,x.pickLocalized)(b,v),l?.data,C,_,w),E=Pl((0,x.pickLocalized)(S,v),l?.data,C,_,w),D=(e?.breadcrumb??e?.properties?.breadcrumb)!==!1,O=e?.recordChrome===!1||e?.properties?.recordChrome===!1,k=e?.showStar!==!1&&e?.properties?.showStar!==!1,A=e?.showCopyId!==!1&&e?.properties?.showCopyId!==!1,j=e?.actions??e?.properties?.actions,M=l?.headerSystemActions,N=a.default.useMemo(()=>{let e=l?.data,n=d?.user,r=(0,t.toPredicateRecord)(e,C?.fields),i={...r,record:r,data:r,user:n,os:d?.os??{user:n},ctx:{user:n,record:r,data:r,app:d?.app,features:d?.features}},a=new t.ExpressionEvaluator(i),o=(e,t)=>{try{return a.evaluateExpression(e)}catch(n){Bl(t,e,n);return}},s=t=>{if(!p(t?.requiredPermissions))return!1;let n=t?.visible;if(n!=null)if(typeof n==`boolean`){if(!n)return!1}else{let r=typeof n==`string`?n:n&&typeof n==`object`&&typeof n.source==`string`?n.source:null;if(r&&(Vl(t?.name,r,e),!o(r,t?.name)))return!1}let r=t?.hidden;if(r!=null)if(typeof r==`boolean`){if(r)return!1}else{let n=typeof r==`string`?r:r&&typeof r==`object`&&typeof r.source==`string`?r.source:null;if(n&&(Vl(t?.name,n,e),o(n,t?.name)))return!1}return!0},c=e=>(0,H.actionRendersAt)(e,`record_header`)||(0,H.actionRendersAt)(e,`record_more`),u=Array.isArray(j)?j.filter(e=>c(e)&&s(e)):[],f=Array.isArray(M)?M.filter(s):[],m=new Set,h=[];for(let e of[...u,...f]){let t=e?.name||e?.id||``;t&&m.has(t)||(t&&m.add(t),h.push(e))}return h.some(e=>e?.order!==void 0||e?.variant===`primary`)?[...h].sort((e,t)=>{let n=(e?.order??0)-(t?.order??0);return n===0?(e?.variant===`primary`?0:1)-(t?.variant===`primary`?0:1):n}):h},[j,M,l?.data,d]),P=l?.data,F=a.default.useCallback(e=>{if(!P||typeof P!=`object`){f(e);return}let{params:t,...n}=e??{},r={...n};Array.isArray(t)?(!r.actionParams&&t.length>0&&(r.actionParams=t),r.params={_rowRecord:P}):r.params={...t||{},_rowRecord:P},f(r)},[P,f]),ee=()=>{if(N.length===0)return null;let n=(e,t)=>{let n=e?.name||e?.id,r=e?.label||n||`Action ${t+1}`;return n?g(l?.objectName,n,r):r},r=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0?Math.floor(e):void 0,i=m?r(e?.mobileMaxVisible??e?.properties?.mobileMaxVisible)??1:r(e?.maxVisible??e?.properties?.maxVisible)??3,a=e=>Array.isArray(e?.locations)&&e.locations.length>0&&e.locations.includes(`record_more`)&&!e.locations.includes(`record_header`),s=N.filter(a),f=N.filter(e=>!a(e)&&e?.component===`action:menu`),p=N.filter(e=>!a(e)&&e?.component!==`action:menu`),h=p.slice(0,i),_=[...p.slice(i),...f,...s],v=_.length>0,b=(0,t.toPredicateRecord)(l?.data,C?.fields),x=d?.user,S=new t.ExpressionEvaluator({...b&&typeof b==`object`?b:{},record:b,data:b,user:x,os:d?.os??{user:x},ctx:{user:x,record:b,data:b,app:d?.app,features:d?.features}}),w=e=>{if(e==null)return!1;if(typeof e==`boolean`)return e;let t=typeof e==`string`?e:e&&typeof e==`object`&&typeof e.source==`string`?e.source:void 0;if(!t)return!1;try{return!!S.evaluateExpression(t)}catch{return!1}},T=e=>u&&e?.disableDuringInlineEdit===!0||w(e?.disabled);return(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 shrink-0`,role:`toolbar`,"aria-label":y(`detail.pageHeaderActions`,`Page header actions`),children:[h.map((e,t)=>{let r=n(e,t),i=e.variant===`primary`?`default`:e.variant||`default`,a=e.size||`sm`,s=T(e),c=typeof e.icon==`string`?e.icon:null;return(0,o.jsxs)(K,{variant:i,size:a,disabled:s,className:`gap-2`,onClick:()=>{if(typeof e.onClick==`function`){e.onClick();return}F(e)},children:[c&&(0,o.jsx)(Na,{name:c,className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:r})]},e.name||e.id||`header-action-${t}`)}),v&&(0,o.jsxs)(mn,{children:[(0,o.jsx)(hn,{asChild:!0,children:(0,o.jsx)(K,{variant:`outline`,size:`sm`,className:`gap-1 px-2`,"aria-label":y(`detail.moreActions`,`More actions`),children:(0,o.jsx)(c.MoreHorizontal,{className:`h-4 w-4`})})}),(0,o.jsx)(Sn,{align:`end`,className:`w-44`,children:_.map((e,t)=>{let r=n(e,t+h.length),i=T(e),a=typeof e.icon==`string`?e.icon:null,s=e.variant===`destructive`||e.name===`sys_delete`;return(0,o.jsxs)(Cn,{disabled:i,onSelect:t=>{if(t.preventDefault(),typeof e.onClick==`function`){e.onClick();return}F(e)},className:W(`gap-2`,s&&`text-destructive focus:text-destructive focus:bg-destructive/10`),children:[a&&(0,o.jsx)(Na,{name:a,className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:r})]},e.name||e.id||`overflow-action-${t}`)})})]})]})};if(l?.data&&l?.objectSchema&&!O){let e=l.data,r=l.objectSchema,i=l.objectName||r?.name,a=jl(r?.label)||r?.name||l.objectName||``,c=i?h({name:i,label:a}):a||void 0,u=r?.primaryField,d=r?.titleFormat,f=typeof d==`string`?d:d&&typeof d==`object`&&typeof d.source==`string`?d.source:void 0,p=f?Rl(Pl(f,e,r,_,i).trim()):``,m=e?.id??e?._id,g=(()=>{let n=(0,t.getRecordDisplayName)(r,e,{deriveFromRecordKeys:!1});return n===`Untitled`||m!=null&&n===`Record #${m}`?``:n})(),v=T||u&&e?.[u]||(p&&!p.includes(`{`)?p:``)||g||e?.name||e?.full_name||e?.title||e?.subject||e?.display_name||e?.label||(c&&e?.id?`${c} ${String(e.id).slice(0,8)}`:``)||c||``;return(0,o.jsxs)(`header`,{className:W(`flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 sm:gap-4 pb-4 border-b`,n),...s,children:[(0,o.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[D&&(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,"data-page-breadcrumb-slot":!0}),(0,o.jsx)(bc,{title:v,objectLabel:c,resourceId:e?.id?String(e.id):void 0,showStar:k,showCopyId:A,isFavorite:l?.isFavorite,onToggleFavorite:l?.onToggleFavorite?()=>l.onToggleFavorite():void 0}),E&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:E})]}),ee()??(0,o.jsx)(`div`,{"data-page-actions-slot":!0,className:`shrink-0`})]})}return(0,o.jsxs)(`header`,{className:W(`flex flex-col gap-2 pb-4 border-b`,n),...s,children:[D&&(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,"data-page-breadcrumb-slot":!0}),(0,o.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,o.jsxs)(`div`,{className:`flex flex-col`,children:[T&&(0,o.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:T}),E&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:E})]}),ee()??(0,o.jsx)(`div`,{"data-page-actions-slot":!0})]})]})},{namespace:`page`,skipFallback:!0,label:`Page Header`,category:`layout`,inputs:[{name:`title`,type:`string`,label:`Title`,description:`Supports {field} interpolation and inline translation maps; falls back to the record title`},{name:`subtitle`,type:`string`,label:`Subtitle`,description:`Same interpolation as Title`},{name:`actions`,type:`array`,label:`Actions`,description:`Action buttons rendered in the header, before any host-injected system actions`},{name:`breadcrumb`,type:`boolean`,label:`Breadcrumb`,defaultValue:!0},{name:`recordChrome`,type:`boolean`,label:`Record Chrome`,defaultValue:!0,description:`Set false for the bare h1 header on non-record pages`},{name:`showStar`,type:`boolean`,label:`Show Follow Star`,defaultValue:!0},{name:`showCopyId`,type:`boolean`,label:`Show Copy-ID`,defaultValue:!0}]}),t.ComponentRegistry.register(`footer`,({schema:e,className:t,...n})=>{let{designer:r}=Al(n);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Ur,{className:`my-4`}),(0,o.jsx)(`footer`,{className:W(`flex items-center justify-between text-sm text-muted-foreground`,t),...r,children:G(e?.children||e?.body)})]})},{namespace:`page`,skipFallback:!0,label:`Page Footer`,category:`layout`,isContainer:!0}),t.ComponentRegistry.register(`sidebar`,({schema:e,className:t,...n})=>{let{designer:r}=Al(n);return(0,o.jsx)(`aside`,{className:W(`flex flex-col gap-4 w-full md:w-80 shrink-0`,t),...r,children:G(e?.children||e?.body)})},{namespace:`page`,skipFallback:!0,label:`Page Sidebar`,category:`layout`,isContainer:!0}),[`aside`,`main`,`header`,`nav`,`footer`,`section`,`article`].forEach(e=>{let n=(0,a.forwardRef)(({schema:t,className:n,...r},i)=>{let{"data-obj-id":a,"data-obj-type":s,style:c,...l}=r;return(0,o.jsx)(e,{ref:i,className:n,...l,"data-obj-id":a,"data-obj-type":s,style:c,children:G(t.children||t.body)})});n.displayName=`Semantic${e.charAt(0).toUpperCase()+e.slice(1)}`,t.ComponentRegistry.register(e,n,{namespace:`ui`,label:e.charAt(0).toUpperCase()+e.slice(1),category:`layout`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}]})}),t.ComponentRegistry.register(`aspect-ratio`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(Ne,{ratio:e.ratio||16/9,className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:e.image?(0,o.jsx)(`img`,{src:e.image,alt:e.alt||``,loading:`lazy`,className:`rounded-md object-cover w-full h-full`}):G(e.children||e.body)})},{namespace:`ui`,label:`Aspect Ratio`,inputs:[{name:`ratio`,type:`number`,label:`Ratio`,defaultValue:16/9},{name:`image`,type:`string`,label:`Image URL`},{name:`alt`,type:`string`,label:`Alt Text`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{ratio:16/9}}),t.ComponentRegistry.register(`sidebar-provider`,({schema:e,...t})=>(0,o.jsx)(hi,{...t,children:G(e.body)}),{namespace:`ui`,label:`Sidebar Provider`,inputs:[{name:`defaultOpen`,type:`boolean`,label:`Default Open`,defaultValue:!0}],defaultProps:{defaultOpen:!0},defaultChildren:[{type:`sidebar`},{type:`sidebar-inset`}]}),t.ComponentRegistry.register(`sidebar`,({schema:e,...t})=>(0,o.jsx)(gi,{...t,children:G(e.body)}),{namespace:`ui`,label:`Sidebar`,inputs:[{name:`collapsible`,type:`enum`,enum:[`offcanvas`,`icon`,`none`],defaultValue:`icon`,label:`Collapsible`},{name:`side`,type:`enum`,enum:[`left`,`right`],defaultValue:`left`,label:`Side`},{name:`variant`,type:`enum`,enum:[`sidebar`,`floating`,`inset`],defaultValue:`sidebar`,label:`Variant`}],defaultProps:{collapsible:`icon`,side:`left`,variant:`sidebar`},defaultChildren:[{type:`sidebar-header`},{type:`sidebar-content`},{type:`sidebar-footer`}]}),t.ComponentRegistry.register(`sidebar-header`,({schema:e,...t})=>(0,o.jsx)(xi,{...t,children:G(e.body)}),{namespace:`ui`,label:`Sidebar Header`,defaultChildren:[{type:`text`,content:`Sidebar Header`}]}),t.ComponentRegistry.register(`sidebar-content`,({schema:e,...t})=>(0,o.jsx)(wi,{...t,children:G(e.body)}),{namespace:`ui`,label:`Sidebar Content`,defaultChildren:[{type:`sidebar-group`}]}),t.ComponentRegistry.register(`sidebar-group`,({schema:e,...t})=>(0,o.jsxs)(Ti,{...t,children:[e.label&&(0,o.jsx)(Ei,{children:e.label}),(0,o.jsx)(Oi,{children:G(e.body)})]}),{namespace:`ui`,label:`Sidebar Group`,inputs:[{name:`label`,type:`string`,label:`Label`}],defaultProps:{label:`Menu`},defaultChildren:[{type:`sidebar-menu`}]}),t.ComponentRegistry.register(`sidebar-menu`,({schema:e,...t})=>(0,o.jsx)(ki,{...t,children:G(e.body)}),{namespace:`ui`,label:`Sidebar Menu`,defaultChildren:[{type:`sidebar-menu-item`},{type:`sidebar-menu-item`}]}),t.ComponentRegistry.register(`sidebar-menu-item`,({schema:e,...t})=>(0,o.jsx)(Ai,{...t,children:G(e.body)}),{namespace:`ui`,label:`Sidebar Menu Item`,defaultChildren:[{type:`sidebar-menu-button`}]}),t.ComponentRegistry.register(`sidebar-menu-button`,({schema:e,...t})=>(0,o.jsx)(Mi,{isActive:e.active,...t,children:G(e.body)}),{namespace:`ui`,label:`Sidebar Menu Button`,inputs:[{name:`active`,type:`boolean`,label:`Active`,defaultValue:!1},{name:`size`,type:`enum`,enum:[`default`,`sm`,`lg`],defaultValue:`default`,label:`Size`},{name:`tooltip`,type:`string`,label:`Tooltip`}],defaultProps:{size:`default`},defaultChildren:[{type:`text`,content:`Menu Item`}]}),t.ComponentRegistry.register(`sidebar-footer`,({schema:e,...t})=>(0,o.jsx)(Si,{...t,children:G(e.body)}),{namespace:`ui`,label:`Sidebar Footer`,defaultChildren:[{type:`text`,content:`Footer`}]}),t.ComponentRegistry.register(`sidebar-inset`,({schema:e,...t})=>(0,o.jsx)(yi,{...t,children:G(e.body)}),{namespace:`ui`,label:`Sidebar Inset`,defaultChildren:[{type:`div`,className:`p-4`,body:[{type:`text`,content:`Main content area`}]}]}),t.ComponentRegistry.register(`sidebar-trigger`,({className:e,...t})=>(0,o.jsx)(_i,{className:e,...t}),{namespace:`ui`,label:`Sidebar Trigger`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}]});function Hl({crumb:e,isLast:t}){let n=(0,i.resolveI18nLabel)(e.label)??``;return e.siblings&&e.siblings.length>0?(0,o.jsxs)(mn,{children:[(0,o.jsxs)(hn,{className:`flex items-center gap-1`,children:[t?(0,o.jsx)(`span`,{className:`font-semibold`,children:n}):(0,o.jsx)(`span`,{children:n}),(0,o.jsx)(c.ChevronDown,{className:`h-3 w-3`})]}),(0,o.jsx)(Sn,{align:`start`,children:e.siblings.map((e,t)=>(0,o.jsx)(Cn,{asChild:!0,children:(0,o.jsx)(`a`,{href:e.href,children:e.label})},t))})]}):t?(0,o.jsx)(Ue,{children:n}):(0,o.jsx)(He,{href:e.href||`#`,children:n})}t.ComponentRegistry.register(`header-bar`,({schema:e})=>(0,o.jsxs)(`header`,{className:`flex h-14 sm:h-16 shrink-0 items-center gap-2 border-b px-3 sm:px-4`,children:[(0,o.jsx)(_i,{}),(0,o.jsx)(Ur,{orientation:`vertical`,className:`mr-2 h-4`}),(0,o.jsx)(ze,{children:(0,o.jsx)(Be,{children:e.crumbs?.map((t,n)=>(0,o.jsxs)(a.default.Fragment,{children:[(0,o.jsx)(Ve,{children:(0,o.jsx)(Hl,{crumb:t,isLast:n===e.crumbs.length-1})}),n<e.crumbs.length-1&&(0,o.jsx)(We,{})]},n))})}),(0,o.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[e.search?.enabled&&(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(c.Search,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground`}),(0,o.jsx)(Z,{type:`search`,placeholder:e.search.placeholder,className:`pl-8 w-[200px] lg:w-[300px]`}),e.search.shortcut&&(0,o.jsx)(`kbd`,{className:`pointer-events-none absolute right-2 top-2 hidden h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 sm:flex`,children:e.search.shortcut})]}),e.actions?.map((e,t)=>(0,o.jsx)(i.SchemaRenderer,{schema:e},t)),e.rightContent&&(0,o.jsx)(i.SchemaRenderer,{schema:e.rightContent})]})]}),{namespace:`ui`,label:`Header Bar`,inputs:[{name:`crumbs`,type:`array`,label:`Breadcrumbs`},{name:`search`,type:`object`,label:`Search Configuration`},{name:`actions`,type:`array`,label:`Action Slots`},{name:`rightContent`,type:`object`,label:`Right Content`}],defaultProps:{crumbs:[{label:`Home`,href:`#`},{label:`Current Page`}]}}),t.ComponentRegistry.register(`badge`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(Re,{variant:e.variant,className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:e.label||G(e.body)})},{namespace:`ui`,label:`Badge`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`variant`,type:`enum`,enum:[`default`,`secondary`,`destructive`,`outline`],defaultValue:`default`,label:`Variant`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{label:`Badge`,variant:`default`}}),t.ComponentRegistry.register(`avatar`,({schema:e,className:t,...n})=>(0,o.jsxs)(Pe,{className:t,...n,children:[(0,o.jsx)(Fe,{src:e.src,alt:e.alt}),(0,o.jsx)(Ie,{children:e.fallback})]}),{namespace:`ui`,label:`Avatar`,inputs:[{name:`src`,type:`string`,label:`Image URL`},{name:`alt`,type:`string`,label:`Alt Text`},{name:`fallback`,type:`string`,label:`Fallback Initials`,defaultValue:`CN`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{fallback:`CN`,alt:`Avatar`}}),t.ComponentRegistry.register(`alert`,({schema:e,className:t,...n})=>(0,o.jsxs)(je,{variant:e.variant,className:t,...n,children:[(0,o.jsx)(Me,{children:e.title}),(0,o.jsx)(Y,{children:e.description||G(e.body)})]}),{namespace:`ui`,label:`Alert`,inputs:[{name:`title`,type:`string`,label:`Title`,required:!0},{name:`description`,type:`string`,label:`Description`},{name:`variant`,type:`enum`,enum:[`default`,`destructive`],defaultValue:`default`,label:`Variant`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Alert Title`,description:`This is an alert message.`,variant:`default`}}),t.ComponentRegistry.register(`list`,({schema:e,className:t,...n})=>{let r=(0,i.useDataScope)(e.bind),a=Array.isArray(r)?r:Array.isArray(e.items)?e.items:[],s=e.ordered?`ol`:`ul`,c=e.ordered?`list-decimal`:`list-disc`;return(0,o.jsxs)(`div`,{className:W(`space-y-2`,e.wrapperClass),children:[e.title&&(0,o.jsx)(`h3`,{className:`text-lg font-semibold tracking-tight`,children:e.title}),(0,o.jsx)(s,{className:W(`ml-6 [&>li]:mt-2`,c,t),...n,children:a.map((e,t)=>(0,o.jsx)(`li`,{className:W(typeof e==`object`&&e.className),children:typeof e==`string`?e:e.content||G(e.body)},t))})]})},{namespace:`ui`,label:`List`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`ordered`,type:`boolean`,label:`Ordered List (numbered)`,defaultValue:!1},{name:`items`,type:`array`,label:`List Items`,description:`Array of strings or objects with content/body`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{ordered:!1,items:[`First item`,`Second item`,`Third item`],className:`text-sm`}});var Ul=({node:e,onNodeClick:t})=>{let[n,r]=(0,a.useState)(!1),i=e.children&&e.children.length>0;return(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsxs)(`div`,{className:W(`group flex items-center py-1.5 px-2 rounded-sm cursor-pointer transition-colors`,`hover:bg-accent hover:text-accent-foreground`,n&&i&&`bg-accent/50`),onClick:()=>{t&&t(e)},children:[i?(0,o.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r(!n)},className:`mr-2 p-0.5 h-5 w-5 flex items-center justify-center rounded-sm hover:bg-muted text-muted-foreground transition-colors`,children:n?(0,o.jsx)(c.ChevronDown,{className:`h-4 w-4`}):(0,o.jsx)(c.ChevronRight,{className:`h-4 w-4`})}):(0,o.jsx)(`span`,{className:`mr-2 w-5 flex justify-center`,children:(0,o.jsx)(`div`,{className:`w-1 h-1 rounded-full bg-muted-foreground/50`})}),e.icon===`folder`||i?n?(0,o.jsx)(c.FolderOpen,{className:`h-4 w-4 mr-2 text-primary`}):(0,o.jsx)(c.Folder,{className:`h-4 w-4 mr-2 text-muted-foreground group-hover:text-primary transition-colors`}):(0,o.jsx)(c.File,{className:`h-4 w-4 mr-2 text-muted-foreground group-hover:text-primary transition-colors`}),(0,o.jsx)(`span`,{className:W(`text-sm transition-colors`,n?`font-medium text-foreground`:`text-muted-foreground group-hover:text-foreground`),children:e.label})]}),i&&n&&(0,o.jsx)(`div`,{className:`relative ml-[11px] pl-3 border-l border-border animate-in slide-in-from-left-2 fade-in duration-200`,children:e.children.map(e=>(0,o.jsx)(Ul,{node:e,onNodeClick:t},e.id))})]})};t.ComponentRegistry.register(`tree-view`,({schema:e,className:t,...n})=>{let r=t=>{e.onNodeClick&&e.onNodeClick(t)},a=(0,i.useDataScope)(e.bind)||e.nodes||e.data||[],s=Array.isArray(a)?a:[];return(0,o.jsxs)(`div`,{className:W(`relative border rounded-lg p-3 bg-card text-card-foreground`,t),...n,children:[e.title&&(0,o.jsx)(`div`,{className:`flex items-center gap-2 mb-3 pb-2 border-b`,children:(0,o.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.title})}),(0,o.jsx)(`div`,{className:`space-y-1`,children:s.map(e=>(0,o.jsx)(Ul,{node:e,onNodeClick:r},e.id))})]})},{namespace:`ui`,label:`Tree View`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`nodes`,type:`array`,label:`Tree Nodes`,description:`Array of { id, label, icon, children, data }`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`File Explorer`,nodes:[{id:`1`,label:`Documents`,icon:`folder`,children:[{id:`1-1`,label:`Resume.pdf`,icon:`file`},{id:`1-2`,label:`Cover Letter.docx`,icon:`file`}]},{id:`2`,label:`Photos`,icon:`folder`,children:[{id:`2-1`,label:`Vacation`,icon:`folder`,children:[{id:`2-1-1`,label:`Beach.jpg`,icon:`file`}]},{id:`2-2`,label:`Family.jpg`,icon:`file`}]},{id:`3`,label:`README.md`,icon:`file`}]}});var Wl=e=>e?Ma(e):null;t.ComponentRegistry.register(`statistic`,({schema:e})=>{let t=e.icon?Wl(e.icon):null;return(0,o.jsxs)(`div`,{className:W(`group relative flex flex-col p-4 sm:p-5 md:p-6 rounded-xl border bg-card text-card-foreground shadow-sm`,e.className),children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[e.label&&(0,o.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:e.label}),t&&(0,o.jsx)(t,{className:`h-4 w-4 text-muted-foreground`})]}),(0,o.jsx)(`div`,{className:`flex items-baseline gap-2`,children:(0,o.jsx)(`h3`,{className:`text-2xl font-bold tracking-tight`,children:e.value})}),(e.trend||e.description)&&(0,o.jsxs)(`div`,{className:`mt-1 flex items-center text-xs text-muted-foreground`,children:[e.trend===`up`&&(0,o.jsx)(c.TrendingUp,{className:`mr-1 h-3 w-3 text-emerald-500`}),e.trend===`down`&&(0,o.jsx)(c.TrendingDown,{className:`mr-1 h-3 w-3 text-rose-500`}),e.trend===`neutral`&&(0,o.jsx)(c.Minus,{className:`mr-1 h-3 w-3`}),(0,o.jsx)(`span`,{className:W(e.trend===`up`&&`text-emerald-500 font-medium`,e.trend===`down`&&`text-rose-500 font-medium`),children:e.description})]})]})},{namespace:`ui`,label:`Statistic`,category:`data-display`,icon:`Activity`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`value`,type:`string`,label:`Value`},{name:`description`,type:`string`,label:`Description`},{name:`trend`,type:`enum`,enum:[{label:`Up`,value:`up`},{label:`Down`,value:`down`},{label:`Neutral`,value:`neutral`}],label:`Trend`}],defaultProps:{label:`Total Revenue`,value:`$45,231.89`,trend:`up`,description:`+20.1% from last month`}}),t.ComponentRegistry.register(`breadcrumb`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:a,...s}=t;return(0,o.jsx)(ze,{className:e.className,...s,"data-obj-id":n,"data-obj-type":r,style:a,children:(0,o.jsx)(Be,{children:e.items?.map((t,n)=>(0,o.jsxs)(`div`,{className:`flex items-center`,children:[(0,o.jsx)(Ve,{children:n===(e.items?.length||0)-1?(0,o.jsx)(Ue,{children:(0,i.resolveI18nLabel)(t.label)??``}):(0,o.jsx)(He,{href:t.href,children:(0,i.resolveI18nLabel)(t.label)??``})}),n<(e.items?.length||0)-1&&(0,o.jsx)(We,{})]},n))})})},{namespace:`ui`,label:`Breadcrumb`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{items:[{label:`Home`,href:`/`},{label:`Products`,href:`/products`},{label:`Product`}]}}),t.ComponentRegistry.register(`kbd`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t,s=Array.isArray(e.keys)?e.keys:[e.keys||e.label||`K`];return(0,o.jsx)(`div`,{className:W(`inline-flex flex-wrap gap-1`,e.className),children:s.map((e,t)=>(0,o.jsx)(`kbd`,{className:`pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100`,...a,...t===0?{"data-obj-id":n,"data-obj-type":r,style:i}:{},children:e},t))})},{namespace:`ui`,label:`Keyboard Key`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{label:`K`}}),t.ComponentRegistry.register(`table`,({schema:e,className:t})=>{let n=(0,i.useDataScope)(e.bind)||e.data||e.props?.data||[],r=Array.isArray(e.columns)?e.columns:Array.isArray(e.props?.columns)?e.props.columns:[];if(n&&!Array.isArray(n))return(0,o.jsx)(`div`,{className:`text-red-500 p-2 border border-red-200 bg-red-50 rounded text-sm`,children:`Table data must be an array`});let a=Array.isArray(n)?n:[];return(0,o.jsx)(`div`,{className:W(`rounded-md border`,t),children:(0,o.jsxs)(Hi,{children:[(0,o.jsx)(Ui,{children:(0,o.jsx)(Ki,{children:r.map((e,t)=>(0,o.jsx)(qi,{children:e.label||e.header},e.key||e.accessorKey||t))})}),(0,o.jsx)(Wi,{children:a.length===0?(0,o.jsx)(Ki,{children:(0,o.jsx)(Ji,{colSpan:r.length,className:`h-24 text-center`,children:`No results.`})}):a.map((e,t)=>(0,o.jsx)(Ki,{children:r.map((t,n)=>{let r=t.key||t.accessorKey||``,i=r?e[r]:``;return(0,o.jsx)(Ji,{children:typeof i==`object`&&i?String(i):i},t.key||t.accessorKey||n)})},e.id||t))})]})})},{namespace:`ui`}),t.ComponentRegistry.register(`progress`,({schema:e,className:t,...n})=>(0,o.jsx)(Or,{value:e.value,className:t,...n}),{namespace:`ui`,label:`Progress`,inputs:[{name:`value`,type:`number`,label:`Value`,defaultValue:0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{value:50,className:`w-full`}}),t.ComponentRegistry.register(`skeleton`,({schema:e,className:t,...n})=>(0,o.jsx)(Q,{className:t,...n,style:{width:e.width,height:e.height}}),{namespace:`ui`,label:`Skeleton`,inputs:[{name:`width`,type:`string`,label:`Width`},{name:`height`,type:`string`,label:`Height`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{width:`100%`,height:`20px`,className:`rounded-md`}});var Gl={top_left:`top-left`,top_center:`top-center`,top_right:`top-right`,bottom_left:`bottom-left`,bottom_center:`bottom-center`,bottom_right:`bottom-right`,"top-left":`top-left`,"top-center":`top-center`,"top-right":`top-right`,"bottom-left":`bottom-left`,"bottom-center":`bottom-center`,"bottom-right":`bottom-right`};t.ComponentRegistry.register(`toaster`,({schema:e})=>{let t=e?.position?Gl[e.position]:void 0,n=typeof e?.limit==`number`&&e.limit>0?e.limit:void 0;return(0,o.jsx)(Bi,{...t?{position:t}:{},...n?{visibleToasts:n}:{}})},{namespace:`ui`,label:`Toaster`,inputs:[{name:`position`,type:`enum`,enum:[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],defaultValue:`bottom-right`,label:`Position`},{name:`limit`,type:`number`,label:`Max visible toasts`}],defaultProps:{}}),t.ComponentRegistry.register(`loading`,({schema:e,className:t,...n})=>{let r=e.size||`md`,i=e.fullscreen||!1,a=(0,o.jsxs)(`div`,{className:W(`flex flex-col items-center justify-center gap-2`,t),children:[(0,o.jsx)(lc,{className:W(r===`sm`&&`h-4 w-4`,r===`md`&&`h-8 w-8`,r===`lg`&&`h-12 w-12`,r===`xl`&&`h-16 w-16`)}),e.text&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.text})]});return i?(0,o.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,...n,children:a}):(0,o.jsx)(`div`,{className:`flex items-center justify-center p-8`,...n,children:a})},{namespace:`ui`,label:`Loading`,inputs:[{name:`text`,type:`string`,label:`Loading Text`},{name:`size`,type:`enum`,enum:[`sm`,`md`,`lg`,`xl`],label:`Size`,defaultValue:`md`},{name:`fullscreen`,type:`boolean`,label:`Fullscreen Overlay`,defaultValue:!1},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{text:`Loading...`,size:`md`,fullscreen:!1}}),t.ComponentRegistry.register(`toast`,({schema:e})=>(0,o.jsx)(K,{onClick:()=>{(e.variant===`success`?L.toast.success:e.variant===`error`?L.toast.error:e.variant===`warning`?L.toast.warning:e.variant===`info`?L.toast.info:L.toast)(e.title||`Notification`,{description:e.description,duration:e.duration})},variant:e.buttonVariant,className:e.className,children:e.buttonLabel||`Show Toast`}),{namespace:`ui`,label:`Toast`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`variant`,type:`enum`,enum:[`default`,`success`,`warning`,`error`,`info`],defaultValue:`default`,label:`Variant`},{name:`duration`,type:`number`,label:`Duration (ms)`},{name:`buttonLabel`,type:`string`,label:`Button Label`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Notification`,buttonLabel:`Show Toast`,variant:`default`,duration:5e3}}),t.ComponentRegistry.register(`spinner`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(c.Loader2,{className:W(`animate-spin`,{sm:`h-4 w-4`,md:`h-6 w-6`,lg:`h-8 w-8`,xl:`h-12 w-12`}[e.size||`md`],e.className),...a,"data-obj-id":n,"data-obj-type":r,style:i})},{namespace:`ui`,label:`Spinner`,inputs:[{name:`size`,type:`enum`,enum:[`sm`,`md`,`lg`,`xl`],defaultValue:`md`,label:`Size`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{size:`md`}}),t.ComponentRegistry.register(`empty`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:a,action:s,icon:c,...l}=t,u=e.action,d=u&&typeof u==`object`?(0,o.jsx)(i.SchemaRenderer,{schema:u}):void 0;return(0,o.jsx)(Tc,{title:e.title||`No data`,description:e.description,className:e.className,action:d,...l,"data-obj-id":n,"data-obj-type":r,style:a})},{namespace:`ui`,label:`Empty`,inputs:[{name:`title`,type:`string`,label:`Title`,defaultValue:`No data`},{name:`description`,type:`string`,label:`Description`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`No data`}}),t.ComponentRegistry.register(`sonner`,({schema:e,...t})=>(0,o.jsx)(K,{onClick:()=>{(e.variant===`success`?L.toast.success:e.variant===`error`?L.toast.error:e.variant===`warning`?L.toast.warning:e.variant===`info`?L.toast.info:L.toast)(e.message||e.title||`Notification`,{description:e.description})},variant:e.buttonVariant,className:e.className,...t,children:e.buttonLabel||`Show Toast`}),{namespace:`ui`,label:`Sonner Toast`,inputs:[{name:`message`,type:`string`,label:`Message`},{name:`description`,type:`string`,label:`Description`},{name:`variant`,type:`enum`,enum:[`default`,`success`,`error`,`warning`,`info`],defaultValue:`default`,label:`Variant`},{name:`buttonLabel`,type:`string`,label:`Button Label`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{message:`Notification`,buttonLabel:`Show Toast`,variant:`default`}}),t.ComponentRegistry.register(`dialog`,({schema:e,className:t,...n})=>(0,o.jsxs)(Ct,{modal:e.modal,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(wt,{asChild:!0,children:G(e.trigger)}),(0,o.jsxs)(Ot,{className:t,children:[(0,o.jsxs)(kt,{children:[e.title&&(0,o.jsx)(jt,{children:e.title}),e.description&&(0,o.jsx)(Mt,{children:e.description})]}),G(e.content),e.footer&&(0,o.jsx)(At,{children:G(e.footer)})]})]}),{namespace:`ui`,label:`Dialog`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`modal`,type:`boolean`,label:`Modal`,defaultValue:!0},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`trigger`,type:`slot`,label:`Trigger`,description:`Element that opens the dialog`},{name:`content`,type:`slot`,label:`Content`,description:`Main content of the dialog`},{name:`footer`,type:`slot`,label:`Footer`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{title:`Dialog Title`,description:`Dialog description goes here`,modal:!0,trigger:[{type:`button`,label:`Open Dialog`}],content:[{type:`text`,content:`Dialog content goes here`}]}}),t.ComponentRegistry.register(`sheet`,({schema:e,className:t,...n})=>(0,o.jsxs)(Wr,{modal:e.modal,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(Gr,{asChild:!0,children:G(e.trigger)}),(0,o.jsxs)(Xr,{side:e.side||`right`,className:t,children:[(0,o.jsxs)(Zr,{children:[e.title&&(0,o.jsx)($r,{children:e.title}),e.description&&(0,o.jsx)(ei,{children:e.description})]}),G(e.content),e.footer&&(0,o.jsx)(Qr,{children:G(e.footer)})]})]}),{namespace:`ui`,label:`Sheet`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],defaultValue:`right`,label:`Side`},{name:`modal`,type:`boolean`,label:`Modal`,defaultValue:!0},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`footer`,type:`slot`,label:`Footer`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{title:`Sheet Title`,description:`Sheet description`,side:`right`,modal:!0,trigger:[{type:`button`,label:`Open Sheet`}],content:[{type:`text`,content:`Sheet content goes here`}]}}),t.ComponentRegistry.register(`popover`,({schema:e,className:t,...n})=>(0,o.jsxs)(Tr,{modal:e.modal,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(Er,{asChild:!0,children:G(e.trigger)}),(0,o.jsx)(Dr,{align:e.align,side:e.side,className:t,children:G(e.content)})]}),{namespace:`ui`,label:`Popover`,inputs:[{name:`modal`,type:`boolean`,label:`Modal`},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`],label:`Align`},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],label:`Side`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Open Popover`,variant:`outline`}],content:[{type:`text`,content:`Popover content goes here`}],align:`center`,side:`bottom`}}),t.ComponentRegistry.register(`tooltip`,({schema:e,className:t,...n})=>(0,o.jsx)(ri,{delayDuration:e.delayDuration,children:(0,o.jsxs)(ii,{...n,children:[(0,o.jsx)(ai,{asChild:!0,children:G(e.trigger)}),(0,o.jsx)(oi,{side:e.side,align:e.align,className:t,children:e.content||G(e.body)})]})}),{namespace:`ui`,label:`Tooltip`,inputs:[{name:`delayDuration`,type:`number`,label:`Delay Duration`,defaultValue:700},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],label:`Side`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`],label:`Align`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`string`,label:`Content Text`},{name:`body`,type:`slot`,label:`Rich Content`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Hover me`,variant:`outline`}],content:`Tooltip content`,delayDuration:700,side:`top`}}),t.ComponentRegistry.register(`alert-dialog`,({schema:e,className:t,...n})=>(0,o.jsxs)(q,{defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(xe,{asChild:!0,children:G(e.trigger)}),(0,o.jsxs)(Ce,{className:t,children:[(0,o.jsxs)(we,{children:[e.title&&(0,o.jsx)(Ee,{children:e.title}),e.description&&(0,o.jsx)(De,{children:e.description})]}),G(e.content),(0,o.jsxs)(Te,{children:[e.cancelText&&(0,o.jsx)(ke,{children:e.cancelText}),e.actionText&&(0,o.jsx)(Oe,{onClick:e.onAction,children:e.actionText})]})]})]}),{namespace:`ui`,label:`Alert Dialog`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`cancelText`,type:`string`,label:`Cancel Text`,defaultValue:`Cancel`},{name:`actionText`,type:`string`,label:`Action Text`,defaultValue:`Continue`},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content/Body`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{title:`Are you sure?`,description:`This action cannot be undone.`,cancelText:`Cancel`,actionText:`Continue`,trigger:[{type:`button`,label:`Open Alert`,variant:`destructive`}]}}),t.ComponentRegistry.register(`drawer`,({schema:e,className:t,...n})=>(0,o.jsxs)(rn,{shouldScaleBackground:e.shouldScaleBackground,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(an,{asChild:!0,children:G(e.trigger)}),(0,o.jsxs)(ln,{className:t,children:[(0,o.jsxs)(un,{children:[e.title&&(0,o.jsx)(fn,{children:e.title}),e.description&&(0,o.jsx)(pn,{children:e.description})]}),G(e.content),e.footer&&(0,o.jsxs)(dn,{children:[G(e.footer),e.showClose&&(0,o.jsx)(sn,{asChild:!0,children:(0,o.jsx)(`button`,{children:`Close`})})]})]})]}),{namespace:`ui`,label:`Drawer`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`shouldScaleBackground`,type:`boolean`,label:`Scale Background`},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`showClose`,type:`boolean`,label:`Show Close Button in Footer`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`footer`,type:`slot`,label:`Footer`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{title:`Drawer Title`,description:`Drawer description`,trigger:[{type:`button`,label:`Open Drawer`}],content:[{type:`text`,content:`Drawer content goes here`}]}}),t.ComponentRegistry.register(`hover-card`,({schema:e,className:t,...n})=>(0,o.jsxs)(Bn,{openDelay:e.openDelay,closeDelay:e.closeDelay,...n,children:[(0,o.jsx)(Vn,{asChild:!0,children:G(e.trigger)}),(0,o.jsx)(Hn,{align:e.align,side:e.side,className:t,children:G(e.content)})]}),{namespace:`ui`,label:`Hover Card`,inputs:[{name:`openDelay`,type:`number`,label:`Open Delay`},{name:`closeDelay`,type:`number`,label:`Close Delay`},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],label:`Side`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`],label:`Align`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Hover me`,variant:`link`}],content:[{type:`text`,content:`Hover card content appears on hover`}],side:`top`}});var Kl=e=>e?e.map((e,t)=>e.type===`separator`?(0,o.jsx)(Dn,{},t):e.type===`label`?(0,o.jsx)(En,{children:e.label},t):e.children?(0,o.jsxs)(vn,{children:[(0,o.jsxs)(bn,{inset:e.inset,children:[e.icon&&(0,o.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}),(0,o.jsx)(xn,{children:Kl(e.children)})]},t):(0,o.jsxs)(Cn,{disabled:e.disabled,inset:e.inset,onSelect:e.onSelect,children:[e.icon&&(0,o.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label,e.shortcut&&(0,o.jsx)(`span`,{className:`ml-auto text-xs tracking-widest opacity-60`,children:e.shortcut})]},t)):null;t.ComponentRegistry.register(`dropdown-menu`,({schema:e,className:t,...n})=>(0,o.jsxs)(mn,{modal:e.modal,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(hn,{asChild:!0,children:G(e.trigger)}),(0,o.jsxs)(Sn,{align:e.align,side:e.side,className:t,children:[e.label&&(0,o.jsx)(En,{children:e.label}),e.label&&(0,o.jsx)(Dn,{}),Kl(e.items)]})]}),{namespace:`ui`,label:`Dropdown Menu`,inputs:[{name:`label`,type:`string`,label:`Menu Label`},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],label:`Side`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`],label:`Align`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`items`,type:`array`,label:`Items`,description:`Recursive structure: { type?: "separator"|"label", label, icon, shortcut, disabled, children: [] }`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Menu`,variant:`outline`}],items:[{label:`Item 1`},{label:`Item 2`},{type:`separator`},{label:`Item 3`}],align:`start`,side:`bottom`}});var ql=e=>e?e.map((e,t)=>e.type===`separator`?(0,o.jsx)(tn,{},t):e.type===`label`?(0,o.jsx)(en,{children:e.label},t):e.children?(0,o.jsxs)(Kt,{children:[(0,o.jsx)(Jt,{inset:e.inset,children:e.label}),(0,o.jsx)(Yt,{children:ql(e.children)})]},t):(0,o.jsxs)(Zt,{disabled:e.disabled,inset:e.inset,onSelect:e.onSelect,children:[e.label,e.shortcut&&(0,o.jsx)(nn,{children:e.shortcut})]},t)):null;t.ComponentRegistry.register(`context-menu`,({schema:e,className:t,...n})=>{let r=e.triggerClassName||t||e.className||`h-[120px] w-full sm:h-[150px] sm:w-[300px] border border-dashed text-sm flex items-center justify-center`,i=e.contentClassName;return(0,o.jsxs)(Ht,{modal:e.modal,...n,children:[(0,o.jsx)(Ut,{asChild:!0,children:(0,o.jsx)(`div`,{className:r,children:G(e.trigger||{type:`text`,value:`Right click here`})})}),(0,o.jsx)(Xt,{className:i,children:ql(e.items)})]})},{namespace:`ui`,label:`Context Menu`,inputs:[{name:`trigger`,type:`slot`,label:`Trigger Area`},{name:`triggerClassName`,type:`string`,label:`Trigger Area Class`},{name:`items`,type:`array`,label:`Items`,description:`Recursive structure: { type?: "separator"|"label", label, shortcut, children }`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{items:[{label:`Action 1`},{label:`Action 2`},{type:`separator`},{label:`Action 3`}],trigger:[{type:`text`,content:`Right click here`}]}}),t.ComponentRegistry.register(`menubar`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(Qn,{className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:e.menus?.map((e,t)=>(0,o.jsxs)(qn,{children:[(0,o.jsx)($n,{children:e.label}),(0,o.jsx)(nr,{children:e.items?.map((e,t)=>e.separator?(0,o.jsx)(sr,{},t):e.children?(0,o.jsxs)(Zn,{children:[(0,o.jsx)(er,{children:e.label}),(0,o.jsx)(tr,{children:e.children.map((e,t)=>(0,o.jsx)(rr,{children:e.label},t))})]},t):(0,o.jsx)(rr,{disabled:e.disabled,children:e.label},t))})]},t))})},{namespace:`ui`,label:`Menubar`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{menus:[{label:`File`,items:[{label:`New`},{label:`Open`},{separator:!0},{label:`Exit`}]}]}}),t.ComponentRegistry.register(`accordion`,({schema:e,className:t,...n})=>(0,o.jsx)(ge,{type:e.accordionType||`single`,collapsible:e.collapsible,className:t,...n,children:e.items?.map((e,t)=>(0,o.jsxs)(_e,{value:e.value||`item-${t}`,children:[(0,o.jsx)(ve,{children:e.title}),(0,o.jsx)(ye,{children:G(e.content)})]},e.value||t))}),{namespace:`ui`,label:`Accordion`,inputs:[{name:`accordionType`,type:`enum`,enum:[`single`,`multiple`],defaultValue:`single`,label:`Type`},{name:`collapsible`,type:`boolean`,label:`Collapsible (for single type)`},{name:`items`,type:`array`,label:`Items`,description:`Array of { trigger, content, value }`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{accordionType:`single`,collapsible:!0,items:[{label:`Item 1`,value:`item-1`,content:[{type:`text`,content:`Content for item 1`}]},{label:`Item 2`,value:`item-2`,content:[{type:`text`,content:`Content for item 2`}]},{label:`Item 3`,value:`item-3`,content:[{type:`text`,content:`Content for item 3`}]}],className:`w-full`}}),t.ComponentRegistry.register(`collapsible`,({schema:e,className:t,...n})=>(0,o.jsxs)(vt,{defaultOpen:e.defaultOpen,disabled:e.disabled,className:t,...n,children:[(0,o.jsx)(yt,{asChild:!0,children:G(e.trigger)}),(0,o.jsx)(bt,{children:G(e.content)})]}),{namespace:`ui`,label:`Collapsible`,inputs:[{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`disabled`,type:`boolean`,label:`Disabled`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Toggle`,variant:`outline`}],content:[{type:`text`,content:`Collapsible content goes here`}],className:`w-full`}}),t.ComponentRegistry.register(`toggle-group`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,type:a,...s}=t;return(0,o.jsx)(ia,{type:e.selectionType||`single`,variant:e.variant,size:e.size,value:e.value,className:e.className,...s,"data-obj-id":n,"data-obj-type":r,style:i,children:e.items?.map((e,t)=>(0,o.jsx)(aa,{value:e.value,"aria-label":e.label,children:e.label},t))})},{namespace:`ui`,label:`Toggle Group`,inputs:[{name:`selectionType`,type:`enum`,enum:[`single`,`multiple`],defaultValue:`single`,label:`Selection Type`},{name:`variant`,type:`enum`,enum:[`default`,`outline`],defaultValue:`default`,label:`Variant`},{name:`size`,type:`enum`,enum:[`default`,`sm`,`lg`],defaultValue:`default`,label:`Size`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{selectionType:`single`,variant:`default`,size:`default`,items:[{value:`bold`,label:`Bold`},{value:`italic`,label:`Italic`},{value:`underline`,label:`Underline`}]}}),t.ComponentRegistry.register(`carousel`,({schema:e,className:t,...n})=>(0,o.jsxs)(nt,{opts:e.opts,orientation:e.orientation||`horizontal`,className:t,...n,children:[(0,o.jsx)(rt,{children:e.items?.map((t,n)=>(0,o.jsx)(it,{className:e.itemClassName,children:G(t)},n))}),e.showArrows&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(at,{}),(0,o.jsx)(ot,{})]})]}),{namespace:`ui`,label:`Carousel`,inputs:[{name:`orientation`,type:`enum`,enum:[`horizontal`,`vertical`],defaultValue:`horizontal`,label:`Orientation`},{name:`showArrows`,type:`boolean`,label:`Show Arrows`,defaultValue:!0},{name:`items`,type:`array`,label:`Items`,description:`Array of content schemas`},{name:`itemClassName`,type:`string`,label:`Item CSS Class`},{name:`className`,type:`string`,label:`Container CSS Class`}],defaultProps:{orientation:`horizontal`,showArrows:!0,items:[[{type:`div`,className:`p-4 sm:p-6 md:p-8 border rounded bg-slate-50`,body:[{type:`text`,content:`Slide 1`}]}],[{type:`div`,className:`p-4 sm:p-6 md:p-8 border rounded bg-slate-50`,body:[{type:`text`,content:`Slide 2`}]}],[{type:`div`,className:`p-4 sm:p-6 md:p-8 border rounded bg-slate-50`,body:[{type:`text`,content:`Slide 3`}]}]],className:`w-full max-w-xs`}}),t.ComponentRegistry.register(`filter-builder`,({schema:e,className:t,onChange:n,...r})=>(0,o.jsxs)(`div`,{className:e.wrapperClass||``,children:[e.label&&(0,o.jsx)(`label`,{className:`text-sm font-medium mb-2 block`,children:e.label}),(0,o.jsx)(_s,{fields:e.fields||[],value:e.value||r.value,onChange:t=>{n&&n({target:{name:e.name,value:t}})},className:t,...r})]}),{namespace:`ui`,label:`Filter Builder`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`name`,type:`string`,label:`Name`,required:!0},{name:`fields`,type:`array`,label:`Fields`,description:`Array of { value: string, label: string, type?: string } objects`,required:!0},{name:`value`,type:`object`,label:`Initial Value`,description:`FilterGroup object with conditions`}],defaultProps:{label:`Filters`,name:`filters`,fields:[{value:`name`,label:`Name`,type:`text`},{value:`email`,label:`Email`,type:`text`},{value:`age`,label:`Age`,type:`number`},{value:`status`,label:`Status`,type:`text`}],value:{id:`root`,logic:`and`,conditions:[]}}}),t.ComponentRegistry.register(`scroll-area`,({schema:e,className:t,...n})=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=n,c=e.orientation||`vertical`;return(0,o.jsxs)(jr,{className:t,style:{height:e.height,width:e.width,...a},...s,"data-obj-id":r,"data-obj-type":i,children:[G(e.children),(c===`horizontal`||c===`both`)&&(0,o.jsx)(Mr,{orientation:`horizontal`}),(c===`vertical`||c===`both`)&&(0,o.jsx)(Mr,{orientation:`vertical`})]})},{namespace:`ui`,label:`Scroll Area`,inputs:[{name:`height`,type:`string`,label:`Height (e.g. 200px)`},{name:`width`,type:`string`,label:`Width`},{name:`orientation`,type:`enum`,enum:[`vertical`,`horizontal`,`both`],defaultValue:`vertical`,label:`Orientation`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{height:`200px`,width:`100%`,orientation:`vertical`,children:[{type:`div`,className:`p-4`,body:[{type:`text`,content:`Scrollable content goes here. Add more content to see scrolling behavior.`}]}],className:`rounded-md border`}}),t.ComponentRegistry.register(`resizable`,({schema:e,className:t,...n})=>{let r=Array.isArray(e.panels)?e.panels:[];return(0,o.jsx)(_o,{orientation:e.direction||`horizontal`,className:t,...n,style:{minHeight:e.minHeight||`200px`},children:r.map((t,n)=>(0,o.jsxs)(a.default.Fragment,{children:[(0,o.jsx)(vo,{defaultSize:t.defaultSize,minSize:t.minSize,maxSize:t.maxSize,children:G(t.content)}),n<r.length-1&&(0,o.jsx)(yo,{withHandle:e.withHandle})]},n))})},{namespace:`ui`,label:`Resizable Panel Group`,inputs:[{name:`direction`,type:`enum`,enum:[`horizontal`,`vertical`],defaultValue:`horizontal`,label:`Direction`},{name:`minHeight`,type:`string`,label:`Min Height`},{name:`withHandle`,type:`boolean`,label:`Show Handle Icon`,defaultValue:!0},{name:`panels`,type:`array`,label:`Panels`,description:`Array of { defaultSize, minSize, maxSize, content }`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{direction:`horizontal`,minHeight:`200px`,withHandle:!0,panels:[{defaultSize:50,content:[{type:`div`,className:`p-4`,body:[{type:`text`,content:`Panel 1`}]}]},{defaultSize:50,content:[{type:`div`,className:`p-4`,body:[{type:`text`,content:`Panel 2`}]}]}],className:`rounded-lg border`}}),t.ComponentRegistry.register(`table`,({schema:e,className:t,...n})=>(0,o.jsxs)(Hi,{className:t,...n,children:[e.caption&&(0,o.jsx)(Yi,{children:e.caption}),(0,o.jsx)(Ui,{children:(0,o.jsx)(Ki,{children:e.columns?.map((e,t)=>(0,o.jsx)(qi,{className:e.className,style:{width:e.width},children:e.header||e.label},t))})}),(0,o.jsx)(Wi,{children:e.data?.map((t,n)=>(0,o.jsx)(Ki,{children:e.columns?.map((e,n)=>(0,o.jsx)(Ji,{className:e.cellClassName,children:t[e.accessorKey||e.name]},n))},n))}),e.footer&&(0,o.jsx)(Gi,{children:(0,o.jsx)(Ki,{children:(0,o.jsx)(Ji,{colSpan:e.columns?.length,children:typeof e.footer==`string`?e.footer:G(e.footer)})})})]}),{namespace:`ui`,label:`Table`,inputs:[{name:`caption`,type:`string`,label:`Caption`},{name:`footer`,type:`string`,label:`Footer Content`},{name:`columns`,type:`array`,label:`Columns`,description:`Array of { header, accessorKey, className, width }`},{name:`data`,type:`array`,label:`Data`,description:`Array of objects`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{caption:`Table Caption`,columns:[{header:`Column 1`,accessorKey:`col1`},{header:`Column 2`,accessorKey:`col2`},{header:`Column 3`,accessorKey:`col3`}],data:[{col1:`Row 1, Col 1`,col2:`Row 1, Col 2`,col3:`Row 1, Col 3`},{col1:`Row 2, Col 1`,col2:`Row 2, Col 2`,col3:`Row 2, Col 3`},{col1:`Row 3, Col 1`,col2:`Row 3, Col 2`,col3:`Row 3, Col 3`}]}});function Jl(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}var Yl={Home:`House`};function Xl(e){if(!e)return null;let t=Jl(e),n=Yl[t]||t;return c.icons[n]??null}var Zl=a.default.createContext(null);function Ql({value:e,children:t}){return(0,o.jsx)(Zl.Provider,{value:e,children:t})}function $l(){return a.default.useContext(Zl)}function eu(e){return String(e).padStart(2,`0`)}function tu(e){if(e==null||e===``)return``;if(typeof e==`string`){let t=e.match(/^(\d{4}-\d{2}-\d{2})/);if(t)return t[1]}let t=e instanceof Date?e:new Date(String(e));return Number.isNaN(t.getTime())?``:`${t.getFullYear()}-${eu(t.getMonth()+1)}-${eu(t.getDate())}`}function nu(e){if(e==null||e===``)return``;let t=e instanceof Date?e:new Date(String(e));return Number.isNaN(t.getTime())?``:`${t.getFullYear()}-${eu(t.getMonth()+1)}-${eu(t.getDate())}T${eu(t.getHours())}:${eu(t.getMinutes())}`}var ru=new Set([`number`,`currency`,`percent`,`int`,`integer`,`float`,`double`]);function iu(e){if(e==null)return``;if(Array.isArray(e))return e.map(e=>typeof e==`object`&&e?iu(e):String(e)).filter(Boolean).join(`, `);if(typeof e==`object`){let t=e;return String(t.name??t.label??t.externalId??t.id??t._id??``)}return String(e)}var au=(0,x.createSafeTranslation)({"table.rowsPerPage":`Rows per page`,"table.pageInfo":`Page {{current}} of {{total}}`,"table.totalRecords":`{{count}} total`,"table.noResults":`No results found`,"table.noResultsHint":`Try adjusting your filters or search query.`,"table.sortAsc":`Sort ascending`,"table.sortDesc":`Sort descending`,"table.hideColumn":`Hide column`,"table.cancelAll":`Cancel All`,"table.saveAll":`Save All ({{count}})`,"table.exportCSV":`Export CSV`,"table.addRecord":`Add record`,"table.open":`Open`,"table.search":`Search...`,"table.modified":`{{count}} row modified`,"table.saveFailed":`Save failed`,"table.selected":`{{count}} selected`,"table.edit":`Edit`,"table.delete":`Delete`,"common.actions":`Actions`},`table.rowsPerPage`);function ou(e){if(e&&typeof e==`object`){let t=e,n=t.details&&(t.details.message??t.details.error);if(typeof n==`string`&&n.trim())return n.trim();if(typeof t.message==`string`&&t.message.trim())return t.message.trim()}return typeof e==`string`&&e.trim()?e.trim():`Unknown error`}var su=({action:e,row:t,onActionDef:n})=>{let r=e.visible,a=(0,i.useRowPredicate)(r,t,{fallback:!1,warnOnError:!0,label:e.name}),s=(0,i.useRowPredicate)(e.disabled,t,{fallback:!1,warnOnError:!0,label:`${e.name}:disabled`});if(r&&!a)return null;let c=Xl(e.icon);return(0,o.jsxs)(Cn,{disabled:s,onClick:()=>{s||n?.(e,t)},"data-testid":`row-action-${e.name}`,className:W(e.variant===`danger`&&`text-destructive focus:text-destructive`),children:[c&&(0,o.jsx)(c,{className:`mr-2 h-4 w-4`}),e.label||e.name]})},cu=({name:e,predicates:t,row:n,icon:r,label:a,className:s,onSelect:c})=>{let l=(0,i.useRowPredicate)(t?.visibleWhen,n,{fallback:!1,warnOnError:!0,label:`builtin:${e}:visibleWhen`}),u=(0,i.useRowPredicate)(t?.disabledWhen,n,{fallback:!1,warnOnError:!0,label:`builtin:${e}:disabledWhen`});if(t?.visibleWhen!=null&&!l)return null;let d=t?.disabledWhen!=null&&u;return(0,o.jsxs)(Cn,{disabled:d,onClick:()=>{d||c(n)},"data-testid":`row-action-builtin-${e}`,className:s,children:[r,a]})};function lu(e){return e===`single`?`single`:e===`none`||!e?`none`:`multiple`}t.ComponentRegistry.register(`data-table`,({schema:e})=>{let{caption:n,columns:r=[],data:i=[],pagination:s=!0,pageSize:l=10,pageSizeOptions:u,manualPagination:d=!1,rowCount:f,page:p,onPageChange:m,onPageSizeChange:h,manualSorting:g=!1,sort:_,onSortChange:v,searchable:y=!0,manualSearch:b=!1,search:x,onSearchChange:S,selectable:C=!1,showSelectionCount:w=!0,selectionResetKey:T,sortable:E=!0,exportable:D=!1,rowActions:O=!1,resizableColumns:k=!0,reorderableColumns:A=!0,editable:j=!1,singleClickEdit:M=!1,selectionStyle:N=`always`,rowClassName:P,rowStyle:F,className:ee,cellClassName:te,frozenColumns:I=0,showRowNumbers:ne=!1,showAddRow:L=!1,borderless:re=!1,disableInnerScroll:R=!1}=e,z=lu(C),B=z!==`none`,ie=$l(),ae=!!ie?.onAddColumn,oe=!!ie?.onEditColumn,V=A||!!ie?.onReorderFields,{t:H,language:se}=au(),ce=/^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,le=a.default.useCallback(e=>{if(typeof e!=`string`||e.length<8||!ce.test(e))return e;let t=Date.parse(e);if(Number.isNaN(t))return e;let n=e.includes(`T`);try{return new Intl.DateTimeFormat(se,n?{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}:{year:`numeric`,month:`short`,day:`numeric`}).format(new Date(t))}catch{return e}},[se]),ue=Array.isArray(i)?i:[],de=(0,a.useMemo)(()=>r.map(e=>({...e,header:e.header||e.label,accessorKey:e.accessorKey||e.name})),[r]),fe=(0,a.useMemo)(()=>{let e={},t=r.map(e=>({header:e.header||e.label,accessorKey:e.accessorKey||e.name,width:e.width,fitContent:e.fitContent}));for(let n of t){if(n.width||n.fitContent)continue;let t=(n.header||``).length,r=ue.slice(0,50);for(let e of r){let r=e[n.accessorKey],i=r==null?0:String(r).length;i>t&&(t=i)}e[n.accessorKey]=Math.min(400,Math.max(80,t*8+48))}return e},[r,ue]),[pe,U]=(0,a.useState)(``),[G,me]=(0,a.useState)(null),[he,ge]=(0,a.useState)(null),[_e,ve]=(0,a.useState)(new Set),[ye,be]=(0,a.useState)(1),[q,xe]=(0,a.useState)(l),[J,Se]=(0,a.useState)(de),[Ce,we]=(0,a.useState)({}),Te=(0,a.useRef)(null),[Ee,De]=(0,a.useState)(null),Oe=I>0?+!!B+ +!!ne+Math.min(I,J.length):0;(0,a.useLayoutEffect)(()=>{let e=Te.current;if(Oe===0||!e){De(null);return}let t=()=>{let t=Array.from(e.children).slice(0,Oe),n=0,r=t.map(e=>{let t=n;return n+=e.getBoundingClientRect().width,t});De(e=>e&&e.length===r.length&&e.every((e,t)=>Math.abs(e-r[t])<.5)?e:r)};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return Array.from(e.children).slice(0,Oe).forEach(e=>n.observe(e)),()=>n.disconnect()},[Oe,J]);let[ke,Ae]=(0,a.useState)(null),[je,Me]=(0,a.useState)(null),[Y,Ne]=(0,a.useState)(null),Pe=(0,a.useRef)(null),[Fe,Ie]=(0,a.useState)(``),[Le,Re]=(0,a.useState)(new Map),[ze,Be]=(0,a.useState)(!1),[Ve,He]=(0,a.useState)(null),[Ue,We]=(0,a.useState)(new Set),[Ge,Ke]=(0,a.useState)(null),qe=(0,a.useRef)(null),Je=(0,a.useRef)(0),Ye=(0,a.useRef)(0),Xe=(0,a.useRef)(null),Ze=(0,a.useRef)(!1),Qe=(0,a.useRef)(null),$e=(0,a.useRef)(null);(0,a.useEffect)(()=>{Se(de)},[de]),(0,a.useEffect)(()=>{T!==void 0&&ve(new Set)},[T]);let et=(0,a.useMemo)(()=>b||!pe?ue:ue.filter(e=>J.some(t=>e[t.accessorKey]?.toString().toLowerCase().includes(pe.toLowerCase()))),[ue,pe,J,b]),tt=(0,a.useMemo)(()=>{if(g||!G||!he)return et;let e=et.map(e=>({row:e,key:(0,t.getSortValue)(e[G])}));return e.sort((e,n)=>{let r=(0,t.compareSortValues)(e.key,n.key);return he===`asc`?r:-r}),e.map(e=>e.row)},[et,G,he,g]),nt=d?Math.max(1,p??1):ye,rt=d?Math.max(1,Math.ceil((f??tt.length)/q)):Math.ceil(tt.length/q),it=s&&!d?tt.slice((ye-1)*q,ye*q):tt,at=e=>{let t=Math.min(rt,Math.max(1,e));d?m?.(t):be(t)},ot=e=>{xe(e),d?(h?.(e),m?.(1)):be(1)},st=a.default.useMemo(()=>{let e=u&&u.length>0?u:[5,10,20,50,100];return Array.from(new Set([...e,q])).filter(e=>Number.isFinite(e)&&e>0).sort((e,t)=>e-t)},[u,q]),ct=(e,t)=>e.id===void 0?`row-${t}`:e.id,lt=g?_??[]:G&&he?[{field:G,order:he}]:[],ut=E&&(!g||!!v),dt=b?x??``:pe,ft=y&&(!b||!!S),pt=e=>{if(b){S?.(e);return}U(e),be(1)},mt=(e,t)=>{if(g){v?.([{field:e,order:t}]);return}me(e),ge(t)},ht=e=>{if(ut){if(g){let t=lt.find(t=>t.field===e);mt(e,t?.order===`asc`?`desc`:`asc`);return}G===e?he===`asc`?ge(`desc`):he===`desc`&&(ge(null),me(null)):(me(e),ge(`asc`))}},gt=(e,t)=>{e.preventDefault(),Ke({x:e.clientX,y:e.clientY,columnKey:t})},vt=e=>{Se(t=>t.filter(t=>t.accessorKey!==e)),Ke(null)};(0,a.useEffect)(()=>{if(!Ge)return;let e=()=>Ke(null);return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[Ge]);let yt=t=>{let n=new Set;if(t&&it.forEach((e,t)=>{let r=(nt-1)*q+t,i=ct(e,r);n.add(i)}),ve(n),e.onSelectionChange){let t=tt.filter((e,t)=>{let r=ct(e,t);return n.has(r)});e.onSelectionChange(t)}},bt=(t,n)=>{let r=new Set(z===`single`?[]:_e);if(n?r.add(t):r.delete(t),ve(r),e.onSelectionChange){let t=tt.filter((e,t)=>{let n=ct(e,t);return r.has(n)});e.onSelectionChange(t)}},xt=()=>{let e=[J.map(e=>e.header).join(`,`),...tt.map(e=>J.map(t=>JSON.stringify(e[t.accessorKey]||``)).join(`,`))].join(`
19
+ `),t=new Blob([e],{type:`text/csv`}),n=window.URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`table-export.csv`,r.click(),window.URL.revokeObjectURL(n)},St=e=>{let t=lt.findIndex(t=>t.field===e);if(t===-1)return(0,o.jsx)(c.ChevronsUpDown,{className:`h-3 w-3 ml-0.5 opacity-0 group-hover:opacity-50 transition-opacity`});let n=lt[t].order===`asc`?c.ChevronUp:c.ChevronDown;return(0,o.jsxs)(`span`,{className:`inline-flex items-center shrink-0`,children:[(0,o.jsx)(n,{className:`h-3 w-3 ml-0.5 text-primary`}),lt.length>1&&(0,o.jsx)(`span`,{className:`text-[10px] font-medium text-primary tabular-nums leading-none`,children:t+1})]})},Ct=(e,t)=>{if(!k)return;e.preventDefault(),e.stopPropagation(),qe.current=t,Je.current=e.clientX;let n=e.target.closest(`th`);n&&(Ye.current=n.offsetWidth),document.addEventListener(`mousemove`,wt),document.addEventListener(`mouseup`,Tt)},wt=e=>{if(!qe.current)return;let t=e.clientX-Je.current,n=Math.max(50,Ye.current+t);we(e=>({...e,[qe.current]:n}))},Tt=()=>{qe.current=null,document.removeEventListener(`mousemove`,wt),document.removeEventListener(`mouseup`,Tt)},Et=(e,t)=>{V&&(Ae(t),e.dataTransfer.effectAllowed=`move`)},Dt=(e,t)=>{V&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,Me(t))},Ot=(t,n)=>{if(!V||ke===null)return;if(t.preventDefault(),ke===n){Ae(null),Me(null);return}let r=[...J],[i]=r.splice(ke,1);r.splice(n,0,i),Se(r),Ae(null),Me(null),e.onColumnsReorder&&e.onColumnsReorder(r),ie?.onReorderFields?.(r.map(e=>e.accessorKey))},kt=()=>{Ae(null),Me(null)},At=(e,t)=>{if(!j)return;let n=Pe.current;if(n?.rowIndex===e&&n?.columnKey===t||J.find(e=>e.accessorKey===t)?.editable===!1)return;Pe.current={rowIndex:e,columnKey:t},Ne({rowIndex:e,columnKey:t});let r=Le.get(e),i=it[e][t],a=r?.[t]??i??``;Ie(a),$e.current=r&&t in r?{had:!0,value:r[t]}:{had:!1,value:void 0}},jt=(t=!1,n)=>{if(!Y||!t&&Y===null)return;let{rowIndex:r,columnKey:i}=Y,a=(nt-1)*q+r,o=tt[d?r:a],s=n===void 0?Fe:n,c=new Map(Le),l=c.get(r)||{};l[i]=s,c.set(r,l),Re(c),e.onCellChange&&e.onCellChange(a,i,s,o),$e.current=null,Pe.current=null,Ne(null),Ie(``)},Mt=(0,a.useRef)(jt);(0,a.useEffect)(()=>{Mt.current=jt});let Nt=e=>{let t=Pe.current,n=$e.current;if($e.current=null,e&&t&&n){let{rowIndex:e,columnKey:r}=t;Re(t=>{let i=t.get(e);if(!(i&&r in i)&&!n.had)return t;let a=new Map(t),o={...i||{}};return n.had?o[r]=n.value:delete o[r],Object.keys(o).length>0?a.set(e,o):a.delete(e),a})}Pe.current=null,Ne(null),Ie(``)},Pt=()=>{Ze.current=!0,Nt(!0)},Ft=e=>{if(!Y)return;let{rowIndex:t,columnKey:n}=Y;Ie(e),Re(r=>{let i=new Map(r),a={...i.get(t)||{}};return a[n]=e,i.set(t,a),i})},It=()=>{if(Ze.current){Ze.current=!1;return}jt(!0)},Lt=async t=>{let n=(nt-1)*q+t,r=tt[d?t:n],i=Le.get(t);if(!(!i||Object.keys(i).length===0)){Be(!0);try{e.onRowSave&&await e.onRowSave(n,i,r);let a=new Map(Le);a.delete(t),Re(a),Y?.rowIndex===t&&(Pe.current=null,Ne(null),Ie(``)),We(e=>{if(!e.has(t))return e;let n=new Set(e);return n.delete(t),n.size===0&&He(null),n})}catch(e){console.error(`Failed to save row:`,e),He(ou(e)),We(e=>new Set(e).add(t))}finally{Be(!1)}}},Rt=e=>{let t=new Map(Le);t.delete(e),Re(t),We(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n.size===0&&He(null),n})},zt=async()=>{if(Le.size!==0){Be(!0);try{let t=Array.from(Le.entries()).map(([e,t])=>{let n=(nt-1)*q+e;return{rowIndex:n,changes:t,row:tt[d?e:n]}});e.onBatchSave&&await e.onBatchSave(t),Re(new Map),Pe.current=null,Ne(null),Ie(``),We(new Set),He(null)}catch(e){console.error(`Failed to save batch:`,e),He(ou(e)),We(new Set(Le.keys()))}finally{Be(!1)}}},Bt=()=>{Re(new Map),We(new Set),He(null)},Vt=(e,t,n)=>{if((e.ctrlKey||e.metaKey)&&e.key===`c`&&!Y){e.preventDefault();let r=(nt-1)*q+t,i=tt[d?t:r];if(i){let e=i[n],t=e==null?``:String(e);navigator.clipboard.writeText(t).catch(()=>{})}return}j&&J.find(e=>e.accessorKey===n)?.editable!==!1&&e.key===`Enter`&&!Y&&(e.preventDefault(),At(t,n))},Ht=e=>{e.key===`Enter`?(e.preventDefault(),Ze.current=!0,jt(!0)):e.key===`Escape`&&(e.preventDefault(),Pt())};(0,a.useEffect)(()=>{Y&&Xe.current&&(Xe.current.focus(),Xe.current.select())},[Y]),(0,a.useEffect)(()=>{if(!Y)return;let e=e=>{let t=Qe.current;if(!t)return;let n=e.target;if(!(!n||t.contains(n))){if(n instanceof Element){let e=n.closest(`[data-radix-popper-content-wrapper]`);if(e&&!e.contains(t))return;let r=n.closest(`[role="dialog"],[role="alertdialog"]`);if(r&&!r.contains(t))return}Mt.current(!0)}};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[Y]),(0,a.useEffect)(()=>()=>{document.removeEventListener(`mousemove`,wt),document.removeEventListener(`mouseup`,Tt)},[]);let Ut=it.length>0&&it.every((e,t)=>{let n=(nt-1)*q+t,r=ct(e,n);return _e.has(r)}),Wt=it.some((e,t)=>{let n=(nt-1)*q+t,r=ct(e,n);return _e.has(r)})&&!Ut,Gt=Le.size>0,Kt=ft||D||w&&B&&_e.size>0||Gt;return(0,o.jsxs)(`div`,{className:`flex flex-col h-full gap-2 sm:gap-4 ${ee||``}`,children:[Kt&&(0,o.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-2 sm:gap-4 flex-none`,children:[(0,o.jsx)(`div`,{className:`flex items-center gap-2 flex-1`,children:ft&&(0,o.jsxs)(`div`,{className:`relative w-full sm:max-w-sm flex-1`,children:[(0,o.jsx)(c.Search,{className:`absolute left-2 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,o.jsx)(Z,{placeholder:H(`table.search`),value:dt,onChange:e=>pt(e.target.value),className:`pl-8`})]})}),(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Gt&&(0,o.jsxs)(o.Fragment,{children:[Ve&&(0,o.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-1.5 text-sm text-destructive max-w-[16rem] sm:max-w-sm`,children:[(0,o.jsx)(c.AlertCircle,{className:`h-4 w-4 flex-none`}),(0,o.jsxs)(`span`,{className:`truncate`,title:`${H(`table.saveFailed`)}: ${Ve}`,children:[H(`table.saveFailed`),`: `,Ve]})]}),(0,o.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:H(`table.modified`,{count:Le.size})}),(0,o.jsxs)(K,{variant:`outline`,size:`sm`,onClick:Bt,disabled:ze,children:[(0,o.jsx)(c.X,{className:`h-4 w-4 mr-2`}),H(`table.cancelAll`)]}),(0,o.jsxs)(K,{variant:`default`,size:`sm`,onClick:zt,disabled:ze,children:[(0,o.jsx)(c.Save,{className:`h-4 w-4 mr-2`}),H(`table.saveAll`,{count:Le.size})]})]}),D&&(0,o.jsxs)(K,{variant:`outline`,size:`sm`,onClick:xt,disabled:tt.length===0,children:[(0,o.jsx)(c.Download,{className:`h-4 w-4 mr-2`}),H(`table.exportCSV`)]}),w&&B&&_e.size>0&&(0,o.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:H(`table.selected`,{count:_e.size})})]})]}),(0,o.jsx)(`div`,{className:W(`relative bg-background`,R?`overflow-visible`:`flex-1 min-h-0 overflow-auto [-webkit-overflow-scrolling:touch]`,!re&&`rounded-md border shadow-[inset_-8px_0_8px_-8px_rgba(0,0,0,0.08)]`),children:(0,o.jsxs)(Hi,{containerClassName:`overflow-visible`,children:[n&&(0,o.jsx)(Yi,{children:n}),(0,o.jsx)(Ui,{className:`sticky top-0 bg-background z-10`,children:(0,o.jsxs)(Ki,{ref:Te,children:[B&&(0,o.jsx)(qi,{className:W(`w-10 bg-background px-3`,I>0&&`sticky left-0 z-20`),children:z===`multiple`&&(0,o.jsx)(_t,{checked:Ut?!0:Wt?`indeterminate`:!1,onCheckedChange:yt})}),ne&&(0,o.jsx)(qi,{className:W(`w-10 bg-background text-center px-3`,I>0&&`sticky z-20`),style:I>0?{left:Ee?.[+!!B]??(B?40:0)}:void 0,children:(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`#`})}),J.map((e,t)=>{let n=e.fitContent===!0&&!Ce[e.accessorKey]&&!e.width,r=n?`1%`:Ce[e.accessorKey]||e.width||fe[e.accessorKey],i=ke===t,a=je===t,s=I>0&&t<I,l=typeof e.className==`string`&&/\bsticky\b/.test(e.className)&&/\bright-0\b/.test(e.className),u=s?Ee?.[+!!B+ +!!ne+t]??J.slice(0,t).reduce((e,t,n)=>{if(n<I){let n=Ce[t.accessorKey]||t.width||fe[t.accessorKey];return e+(typeof n==`number`?n:n&&parseInt(String(n),10)||150)}return e},(B?40:0)+(ne?40:0)):void 0;return(0,o.jsx)(qi,{className:W(e.className,ut&&e.sortable!==!1&&`cursor-pointer select-none`,i&&`opacity-50`,a&&`border-l-2 border-primary`,e.align===`right`&&`text-right`,e.align===`center`&&`text-center`,n&&`whitespace-nowrap`,`group bg-background`,!l&&`relative`,l&&`sticky right-0 z-20`,s&&`sticky z-20`,s&&t===I-1&&`border-r-2 border-border shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]`),style:{width:r,minWidth:r,...s&&{left:u}},draggable:V,onDragStart:e=>Et(e,t),onDragOver:e=>Dt(e,t),onDrop:e=>Ot(e,t),onDragEnd:kt,onClick:()=>ut&&e.sortable!==!1&&ht(e.accessorKey),onContextMenu:t=>gt(t,e.accessorKey),children:(0,o.jsxs)(`div`,{className:W(`flex items-center`,e.align===`right`?`justify-end`:`justify-between`),children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-1`,children:[V&&(0,o.jsx)(c.GripVertical,{className:`h-4 w-4 opacity-0 group-hover:opacity-50 cursor-grab active:cursor-grabbing shrink-0`}),e.headerIcon&&(0,o.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:e.headerIcon}),(0,o.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground whitespace-nowrap truncate`,children:e.header}),ut&&e.sortable!==!1&&St(e.accessorKey),oe&&(0,o.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),ie.onEditColumn(e.accessorKey)},title:ie.editColumnLabel??`Edit field`,"aria-label":ie.editColumnLabel??`Edit field`,"data-testid":`grid-edit-column-${e.accessorKey}`,className:`ml-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground/50 opacity-0 transition-opacity hover:bg-muted hover:text-foreground group-hover:opacity-100`,children:(0,o.jsx)(c.Edit,{className:`h-3 w-3`})})]}),k&&e.resizable!==!1&&(0,o.jsx)(`div`,{className:`absolute right-0 top-0 h-full w-1 cursor-col-resize hover:bg-primary opacity-0 hover:opacity-100 transition-opacity`,onMouseDown:t=>Ct(t,e.accessorKey),onClick:e=>e.stopPropagation()})]})},e.accessorKey)}),O&&(0,o.jsx)(qi,{className:`w-24 text-right bg-background`,children:H(`common.actions`)}),ae&&(0,o.jsx)(qi,{className:`w-10 bg-background px-1 text-center`,children:(0,o.jsx)(`button`,{type:`button`,onClick:ie.onAddColumn,title:ie.addColumnLabel??`Add field`,"aria-label":ie.addColumnLabel??`Add field`,"data-testid":`grid-add-column`,className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,o.jsx)(c.Plus,{className:`h-4 w-4`})})})]})}),(0,o.jsx)(Wi,{children:it.length===0?(0,o.jsx)(Ki,{className:`hover:bg-transparent`,children:(0,o.jsx)(Ji,{colSpan:J.length+ +!!B+ +!!ne+ +!!O+ +!!ae,className:`h-48 text-center text-muted-foreground border-0`,children:(0,o.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3`,children:[(0,o.jsx)(c.Search,{className:`h-8 w-8 text-muted-foreground/50`}),(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(`p`,{children:H(`table.noResults`)}),(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground/50`,children:H(`table.noResultsHint`)})]}),e.emptyAction&&(()=>{let n=e.emptyAction,r=n?.type?t.ComponentRegistry.get(n.type):null;return r?(0,o.jsx)(r,{schema:n}):null})()]})})}):(0,o.jsxs)(o.Fragment,{children:[it.map((t,n)=>{let r=(nt-1)*q+n,i=ct(t,r),a=_e.has(i),s=Le.has(n),l=Le.get(n)||{};return(0,o.jsxs)(Ki,{"data-state":a?`selected`:void 0,className:W(`bg-background border-b border-border/60 group/row transition-colors`,`hover:bg-muted/40`,`data-[state=selected]:bg-primary/5 data-[state=selected]:hover:bg-primary/10`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset`,e.onRowClick&&`cursor-pointer`,s&&!Ue.has(n)&&`bg-amber-50 dark:bg-amber-950/20`,Ue.has(n)&&`bg-destructive/10 dark:bg-destructive/15 ring-1 ring-inset ring-destructive/40`,P&&P(t,n)),style:F?F(t,n):void 0,onClick:n=>{if(e.onRowClick&&!n.defaultPrevented){let r=n.target;if(r.closest(`button`)||r.closest(`a`)||r.closest(`input, select, textarea, label`)||r.closest(`[role="checkbox"]`)||r.closest(`[role="menu"]`)||r.closest(`[role="menuitem"]`)||r.closest(`[role="menuitemcheckbox"]`)||r.closest(`[role="menuitemradio"]`)||r.closest(`[role="dialog"]`)||r.closest(`[role="alertdialog"]`)||r.closest(`[role="listbox"]`)||r.closest(`[role="option"]`)||r.closest(`[role="tab"]`)||r.closest(`[data-radix-popper-content-wrapper]`))return;e.onRowClick(t)}},children:[B&&(0,o.jsx)(Ji,{className:W(te,`px-3`,I>0&&`sticky left-0 z-10 bg-background`,N===`hover`&&`relative`),children:N===`hover`?(0,o.jsx)(`div`,{className:W(`transition-opacity`,a?`opacity-100`:`opacity-0 group-hover/row:opacity-100`),children:(0,o.jsx)(_t,{checked:a,onCheckedChange:e=>bt(i,e)})}):(0,o.jsx)(_t,{checked:a,onCheckedChange:e=>bt(i,e)})}),ne&&(0,o.jsxs)(Ji,{className:W(`text-center w-10 relative`,te,I>0&&`sticky z-10 bg-background`),style:I>0?{left:Ee?.[+!!B]??(B?40:0)}:void 0,children:[(0,o.jsx)(`span`,{className:W(`text-xs text-muted-foreground tabular-nums select-none`,!B&&e.onRowClick&&`group-hover/row:invisible`),children:r+1}),!B&&e.onRowClick&&(0,o.jsxs)(`button`,{type:`button`,className:`absolute inset-0 hidden group-hover/row:flex items-center justify-center gap-0.5 text-xs font-medium text-primary hover:text-primary/80`,"data-testid":`row-expand-button`,onClick:n=>{n.stopPropagation(),e.onRowClick?.(t)},title:`Open record`,children:[(0,o.jsx)(`span`,{children:H(`table.open`)}),(0,o.jsx)(c.ChevronRight,{className:`h-3 w-3`})]})]}),J.map((r,i)=>{let a=r.fitContent===!0&&!Ce[r.accessorKey]&&!r.width,s=a?`1%`:Ce[r.accessorKey]||r.width||fe[r.accessorKey],c=t[r.accessorKey],u=l[r.accessorKey]!==void 0,d=u?l[r.accessorKey]:c,f=Y?.rowIndex===n&&Y?.columnKey===r.accessorKey,p=j&&r.editable!==!1,m=I>0&&i<I,h=m?Ee?.[+!!B+ +!!ne+i]??J.slice(0,i).reduce((e,t,n)=>{if(n<I){let n=Ce[t.accessorKey]||t.width||fe[t.accessorKey];return e+(typeof n==`number`?n:n&&parseInt(String(n),10)||150)}return e},(B?40:0)+(ne?40:0)):void 0;return(0,o.jsx)(Ji,{className:W(r.cellClassName,r.align===`right`&&`text-right`,r.align===`center`&&`text-center`,a?`whitespace-nowrap`:`overflow-hidden`,p&&!f&&`cursor-text hover:bg-muted/50`,u&&`font-semibold text-amber-700 dark:text-amber-400`,m&&`sticky z-10 bg-background`,m&&i===I-1&&`border-r-2 border-border shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]`),style:{width:s,minWidth:a?void 0:s,maxWidth:a?void 0:s,...m&&{left:h}},onDoubleClick:e=>{p&&!M&&(e.stopPropagation(),At(n,r.accessorKey))},onClick:e=>{p&&M&&(e.stopPropagation(),At(n,r.accessorKey))},onKeyDown:e=>Vt(e,n,r.accessorKey),tabIndex:0,children:f?(()=>{let n=r.type,i=e.renderCellEditor;if(typeof i==`function`){let e=i({column:r,row:t,value:Fe,stage:Ft,commit:e=>jt(!0,e),cancel:Pt});if(e!=null)return(0,o.jsx)(`div`,{ref:e=>{Qe.current=e},className:`w-full`,onKeyDown:e=>{e.currentTarget.contains(e.target)&&(e.key===`Enter`&&e.target.tagName===`INPUT`?(e.preventDefault(),jt(!0)):e.key===`Escape`&&(e.preventDefault(),Nt(!0)))},children:e})}return n===`date`?(0,o.jsx)(Z,{ref:Xe,type:`date`,value:tu(Fe),onChange:e=>Ie(e.target.value),onKeyDown:Ht,onBlur:It,className:`h-8 px-2 py-1`}):n===`datetime`||n===`datetime-local`?(0,o.jsx)(Z,{ref:Xe,type:`datetime-local`,value:nu(Fe),onChange:e=>{let t=e.target.value,n=t?new Date(t):null;Ie(n&&!Number.isNaN(n.getTime())?n.toISOString():t)},onKeyDown:Ht,onBlur:It,className:`h-8 px-2 py-1`}):n&&ru.has(n)?(0,o.jsx)(Z,{ref:Xe,type:`number`,value:Fe??``,onChange:e=>Ie(e.target.value),onKeyDown:Ht,onBlur:It,className:`h-8 px-2 py-1`}):typeof Fe==`object`&&Fe?(0,o.jsx)(Z,{ref:Xe,value:iu(Fe),readOnly:!0,onKeyDown:Ht,onBlur:Pt,className:`h-8 px-2 py-1 text-muted-foreground cursor-default`,title:iu(Fe)}):(0,o.jsx)(Z,{ref:Xe,value:Fe,onChange:e=>Ie(e.target.value),onKeyDown:Ht,onBlur:It,className:`h-8 px-2 py-1`})})():(0,o.jsx)(`div`,{className:a?`w-full whitespace-nowrap`:`truncate w-full`,title:!a&&d!=null&&typeof d!=`object`?String(d):void 0,children:typeof r.cell==`function`?r.cell(d,t):typeof d==`object`&&d?String(d):le(d)})},i)}),O&&(0,o.jsx)(Ji,{className:W(`text-right`,te),children:(0,o.jsx)(`div`,{className:`flex items-center justify-end gap-1`,children:s&&(e.onRowSave||e.onBatchSave)?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(K,{variant:`ghost`,size:`icon`,onClick:()=>Rt(n),disabled:ze,title:`Cancel changes`,children:(0,o.jsx)(c.X,{className:`h-4 w-4`})}),(0,o.jsx)(K,{variant:`ghost`,size:`icon`,onClick:()=>Lt(n),disabled:ze,title:`Save row`,children:(0,o.jsx)(c.Save,{className:`h-4 w-4 text-green-600`})})]}):(()=>{let n=Array.isArray(e.rowActionDefs)&&e.onRowActionDef?e.rowActionDefs:[];return!e.onRowEdit&&!e.onRowDelete&&n.length===0?null:(0,o.jsxs)(mn,{children:[(0,o.jsx)(hn,{asChild:!0,children:(0,o.jsx)(K,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:e=>e.stopPropagation(),"aria-label":`Row actions`,children:(0,o.jsx)(c.MoreHorizontal,{className:`h-4 w-4`})})}),(0,o.jsxs)(Sn,{align:`end`,onClick:e=>e.stopPropagation(),children:[e.onRowEdit&&(0,o.jsx)(cu,{name:`edit`,predicates:e.rowEditPredicates,row:t,icon:(0,o.jsx)(c.Edit,{className:`mr-2 h-4 w-4`}),label:H(`table.edit`),onSelect:t=>e.onRowEdit?.(t)}),n.length>0&&e.onRowEdit&&(0,o.jsx)(Dn,{}),n.map(n=>(0,o.jsx)(su,{action:n,row:t,onActionDef:e.onRowActionDef},n.name)),e.onRowDelete&&(e.onRowEdit||n.length>0)&&(0,o.jsx)(Dn,{}),e.onRowDelete&&(0,o.jsx)(cu,{name:`delete`,predicates:e.rowDeletePredicates,row:t,icon:(0,o.jsx)(c.Trash2,{className:`mr-2 h-4 w-4`}),label:H(`table.delete`),className:`text-destructive focus:text-destructive`,onSelect:t=>e.onRowDelete?.(t)})]})]})})()})}),ae&&(0,o.jsx)(Ji,{"aria-hidden":!0,className:`w-10`})]},i)}),L&&(0,o.jsx)(Ki,{className:`hover:bg-muted/30 cursor-pointer border-b border-border`,"data-testid":`add-record-row`,onClick:()=>e.onAddRecord?.(),children:(0,o.jsx)(Ji,{colSpan:J.length+ +!!B+ +!!ne+ +!!O+ +!!ae,className:`h-9 px-3 py-1.5`,children:(0,o.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground text-sm hover:text-foreground transition-colors`,children:[(0,o.jsx)(c.Plus,{className:`h-3.5 w-3.5`}),H(`table.addRecord`)]})})})]})})]})}),s&&tt.length>0&&rt>1&&(0,o.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-center justify-between gap-2 px-3 sm:px-4 py-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsxs)(`span`,{className:`text-xs sm:text-sm text-muted-foreground`,children:[H(`table.rowsPerPage`),`:`]}),(0,o.jsxs)(Nr,{value:q.toString(),onValueChange:e=>ot(Number(e)),children:[(0,o.jsx)(Ir,{className:`w-20`,children:(0,o.jsx)(Fr,{})}),(0,o.jsx)(zr,{children:st.map(e=>(0,o.jsx)(Vr,{value:e.toString(),children:e},e))})]})]}),(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(`span`,{className:`text-xs sm:text-sm text-muted-foreground`,children:H(`table.pageInfo`,{current:nt,total:rt})}),(0,o.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,o.jsx)(K,{variant:`outline`,size:`icon`,onClick:()=>at(1),disabled:nt===1,children:(0,o.jsx)(c.ChevronsLeft,{className:`h-4 w-4`})}),(0,o.jsx)(K,{variant:`outline`,size:`icon`,onClick:()=>at(nt-1),disabled:nt===1,children:(0,o.jsx)(c.ChevronLeft,{className:`h-4 w-4`})}),(0,o.jsx)(K,{variant:`outline`,size:`icon`,onClick:()=>at(nt+1),disabled:nt===rt,children:(0,o.jsx)(c.ChevronRight,{className:`h-4 w-4`})}),(0,o.jsx)(K,{variant:`outline`,size:`icon`,onClick:()=>at(rt),disabled:nt===rt,children:(0,o.jsx)(c.ChevronsRight,{className:`h-4 w-4`})})]})]})]}),Ge&&(0,o.jsxs)(`div`,{className:`fixed z-50 min-w-[160px] rounded-md border bg-popover p-1 shadow-md`,style:{left:Ge.x,top:Ge.y},"data-testid":`column-context-menu`,onClick:e=>e.stopPropagation(),children:[ut&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground cursor-pointer`,onClick:()=>{mt(Ge.columnKey,`asc`),Ke(null)},children:[(0,o.jsx)(c.ChevronUp,{className:`h-3.5 w-3.5`}),H(`table.sortAsc`)]}),(0,o.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground cursor-pointer`,onClick:()=>{mt(Ge.columnKey,`desc`),Ke(null)},children:[(0,o.jsx)(c.ChevronDown,{className:`h-3.5 w-3.5`}),H(`table.sortDesc`)]}),(0,o.jsx)(`div`,{className:`my-1 h-px bg-border`})]}),(0,o.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground cursor-pointer`,onClick:()=>vt(Ge.columnKey),children:[(0,o.jsx)(c.X,{className:`h-3.5 w-3.5`}),H(`table.hideColumn`)]})]})]})},{namespace:`ui`,label:`Data Table`,icon:`table`,inputs:[{name:`caption`,type:`string`,label:`Caption`},{name:`columns`,type:`array`,label:`Columns`,description:`Array of { header, accessorKey, className, width, sortable, filterable, resizable }`,required:!0},{name:`data`,type:`array`,label:`Data`,description:`Array of data objects`,required:!0},{name:`pagination`,type:`boolean`,label:`Enable Pagination`,defaultValue:!0},{name:`pageSize`,type:`number`,label:`Page Size`,defaultValue:10},{name:`searchable`,type:`boolean`,label:`Enable Search`,defaultValue:!0},{name:`selectable`,type:`boolean`,label:`Enable Row Selection`,defaultValue:!1},{name:`sortable`,type:`boolean`,label:`Enable Sorting`,defaultValue:!0},{name:`exportable`,type:`boolean`,label:`Enable Export`,defaultValue:!1},{name:`rowActions`,type:`boolean`,label:`Show Row Actions`,defaultValue:!1},{name:`resizableColumns`,type:`boolean`,label:`Enable Column Resizing`,defaultValue:!0},{name:`reorderableColumns`,type:`boolean`,label:`Enable Column Reordering`,defaultValue:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{caption:`Enterprise Data Table`,pagination:!0,pageSize:10,searchable:!0,selectable:!0,sortable:!0,exportable:!0,rowActions:!0,resizableColumns:!0,reorderableColumns:!0,columns:[{header:`ID`,accessorKey:`id`,width:`80px`},{header:`Name`,accessorKey:`name`},{header:`Email`,accessorKey:`email`},{header:`Status`,accessorKey:`status`},{header:`Role`,accessorKey:`role`}],data:[{id:1,name:`John Doe`,email:`john@example.com`,status:`Active`,role:`Admin`},{id:2,name:`Jane Smith`,email:`jane@example.com`,status:`Active`,role:`User`},{id:3,name:`Bob Johnson`,email:`bob@example.com`,status:`Inactive`,role:`User`},{id:4,name:`Alice Williams`,email:`alice@example.com`,status:`Active`,role:`Manager`},{id:5,name:`Charlie Brown`,email:`charlie@example.com`,status:`Active`,role:`User`},{id:6,name:`Diana Prince`,email:`diana@example.com`,status:`Active`,role:`Admin`},{id:7,name:`Ethan Hunt`,email:`ethan@example.com`,status:`Inactive`,role:`User`},{id:8,name:`Fiona Gallagher`,email:`fiona@example.com`,status:`Active`,role:`User`},{id:9,name:`George Wilson`,email:`george@example.com`,status:`Active`,role:`Manager`},{id:10,name:`Hannah Montana`,email:`hannah@example.com`,status:`Active`,role:`User`},{id:11,name:`Ivan Drago`,email:`ivan@example.com`,status:`Inactive`,role:`User`},{id:12,name:`Julia Roberts`,email:`julia@example.com`,status:`Active`,role:`Admin`}]}});var uu=(0,a.forwardRef)(({schema:e,className:t,context:n,...r},s)=>{let{"data-obj-id":l,"data-obj-type":u,style:d,data:f,...p}=r,{execute:m}=(0,i.useAction)(),[h,g]=(0,a.useState)(!1),_=typeof f==`object`&&f?f:{},v=(0,i.useCondition)((0,i.toPredicateInput)(e.visible),_,{throwOnError:!0,label:`action "${e.name??e.label??`action:button`}" (visible)`}),y=(0,i.useCondition)((0,i.toPredicateInput)(e.disabled),_),b=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled),_),x=Xl(e.icon),S=e.variant===`primary`?`default`:e.variant||`default`,C=e.size===`md`?`default`:e.size||`default`,w=(0,a.useCallback)(async()=>{if(!h){g(!0);try{let t=Array.isArray(e.params)?{actionParams:e.params}:{params:e.params};await m({type:e.actionType||e.type,name:e.name,label:e.label,description:e.description,target:e.target,openIn:e.openIn,endpoint:e.endpoint,method:e.method,...t,confirmText:e.confirmText,successMessage:e.successMessage,errorMessage:e.errorMessage,refreshAfter:e.refreshAfter,undoable:e.undoable,recordIdField:e.recordIdField,locations:e.locations,toast:e.toast,resultDialog:e.resultDialog,...n})}finally{g(!1)}}},[e,m,h,n]),T=(0,a.useRef)(!1),E=e.autoTrigger===!0;return(0,a.useEffect)(()=>{!E||T.current||(T.current=!0,w())},[E,w]),e.visible&&!v?null:(0,o.jsxs)(K,{ref:s,type:`button`,variant:S,size:C,className:W(e.className,t),disabled:(e.disabled==null?e.enabled!=null&&!b:y)||h,onClick:w,...p,"data-obj-id":l,"data-obj-type":u,style:d,children:[h&&(0,o.jsx)(c.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),!h&&x&&(0,o.jsx)(x,{className:W(`h-4 w-4`,e.label&&`mr-2`)}),e.label]})});uu.displayName=`ActionButtonRenderer`,t.ComponentRegistry.register(`button`,uu,{namespace:`action`,skipFallback:!0,label:`Action Button`,inputs:[{name:`name`,type:`string`,label:`Action Name`},{name:`label`,type:`string`,label:`Label`,defaultValue:`Action`},{name:`icon`,type:`string`,label:`Icon`},{name:`type`,type:`enum`,label:`Action Type`,enum:[`script`,`url`,`modal`,`flow`,`api`],defaultValue:`script`},{name:`target`,type:`string`,label:`Target`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`default`,`primary`,`secondary`,`destructive`,`outline`,`ghost`],defaultValue:`default`},{name:`size`,type:`enum`,label:`Size`,enum:[`sm`,`md`,`lg`],defaultValue:`md`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{label:`Action`,type:`script`,variant:`default`,size:`md`}});var du=(0,a.forwardRef)(({schema:e,className:t,context:n,...r},s)=>{let{"data-obj-id":l,"data-obj-type":u,style:d,...f}=r,{execute:p}=(0,i.useAction)(),[m,h]=(0,a.useState)(!1),g=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),_=(0,i.useCondition)((0,i.toPredicateInput)(e.disabled)),v=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled)),y=Xl(e.icon),b=e.variant===`primary`?`default`:e.variant||`ghost`,x=(0,a.useCallback)(async()=>{if(!m){h(!0);try{await p({type:e.type,name:e.name,target:e.target,openIn:e.openIn,endpoint:e.endpoint,method:e.method,params:e.params,confirmText:e.confirmText,successMessage:e.successMessage,errorMessage:e.errorMessage,refreshAfter:e.refreshAfter,locations:e.locations,toast:e.toast,...n})}finally{h(!1)}}},[e,p,m,n]);if(e.visible&&!g)return null;let S=(0,o.jsx)(K,{ref:s,type:`button`,variant:b,size:`icon`,className:W(`h-8 w-8`,e.className,t),disabled:(e.disabled==null?e.enabled!=null&&!v:_)||m,onClick:x,"aria-label":e.label||e.name,...f,"data-obj-id":l,"data-obj-type":u,style:d,children:m?(0,o.jsx)(c.Loader2,{className:`h-4 w-4 animate-spin`}):y?(0,o.jsx)(y,{className:`h-4 w-4`}):(0,o.jsx)(`span`,{className:`text-xs`,children:e.label?.charAt(0)||`?`})});return e.label||e.description?(0,o.jsx)(ri,{delayDuration:300,children:(0,o.jsxs)(ii,{children:[(0,o.jsx)(ai,{asChild:!0,children:S}),(0,o.jsx)(oi,{children:(0,o.jsx)(`p`,{children:e.label||e.description})})]})}):S});du.displayName=`ActionIconRenderer`,t.ComponentRegistry.register(`icon`,du,{namespace:`action`,skipFallback:!0,label:`Action Icon`,inputs:[{name:`name`,type:`string`,label:`Action Name`},{name:`label`,type:`string`,label:`Tooltip Label`},{name:`icon`,type:`string`,label:`Icon`},{name:`type`,type:`enum`,label:`Action Type`,enum:[`script`,`url`,`modal`,`flow`,`api`],defaultValue:`script`},{name:`target`,type:`string`,label:`Target`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`default`,`secondary`,`destructive`,`outline`,`ghost`],defaultValue:`ghost`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{icon:`play`,type:`script`,variant:`ghost`}});function fu(){let{t:e}=(0,x.useObjectTranslation)(),t=e(`detail.moreActions`);return!t||t===`detail.moreActions`?`More actions`:t}var pu=({action:e,onExecute:t})=>{let n=(0,i.useCondition)((0,i.toPredicateInput)(e.visible),void 0,{throwOnError:!0,label:`action "${e.name??e.label??`action:menu item`}" (visible)`}),r=(0,i.useCondition)((0,i.toPredicateInput)(e.disabled)),s=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled)),c=(0,a.useMemo)(()=>{let t=Xl(e.icon);return t?(0,o.jsx)(t,{className:`mr-2 h-4 w-4`}):null},[e.icon]);return e.visible&&!n?null:(0,o.jsxs)(Cn,{disabled:e.disabled==null?e.enabled!=null&&!s:r,onSelect:n=>{n.preventDefault(),t(e)},className:W(e.variant===`destructive`&&`text-destructive focus:text-destructive`,e.className),children:[c,(0,o.jsx)(`span`,{children:e.label||e.name})]})};pu.displayName=`ActionMenuItem`;var mu=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let{"data-obj-id":s,"data-obj-type":l,style:u,...d}=n,{execute:f}=(0,i.useAction)(),[p,m]=(0,a.useState)(!1),h=fu(),g=(0,i.useCondition)((0,i.toPredicateInput)(e.visible),void 0,{throwOnError:!0,label:`action:menu "${e.label??e.icon??`menu`}" (visible)`}),_=Xl(e.icon)||c.MoreHorizontal,v=e.variant||`ghost`,y=e.size||`icon`,b=(0,a.useCallback)(async e=>{m(!0);try{if(typeof e.onClick==`function`){await e.onClick();return}await f({type:e.type,name:e.name,target:e.target,openIn:e.openIn,endpoint:e.endpoint,method:e.method,params:e.params,confirmText:e.confirmText,successMessage:e.successMessage,errorMessage:e.errorMessage,refreshAfter:e.refreshAfter,locations:e.locations,toast:e.toast,resultDialog:e.resultDialog})}finally{m(!1)}},[f]);if(e.visible&&!g)return null;let x=e.actions||[];return x.length===0?null:(0,o.jsxs)(mn,{children:[(0,o.jsx)(hn,{asChild:!0,children:(0,o.jsx)(K,{ref:r,type:`button`,variant:v,size:y,className:W(y===`icon`&&`h-8 w-8`,e.className,t),disabled:p,"aria-label":e.label||h,...d,"data-obj-id":s,"data-obj-type":l,style:u,children:p?(0,o.jsx)(c.Loader2,{className:`h-4 w-4 animate-spin`}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(_,{className:W(`h-4 w-4`,e.label&&`mr-2`)}),e.label&&(0,o.jsx)(`span`,{children:e.label})]})})}),(0,o.jsx)(Sn,{align:`end`,children:x.map((e,t)=>{let n=e.tags?.includes(`separator-before`)&&t>0;return(0,o.jsxs)(a.default.Fragment,{children:[n&&(0,o.jsx)(Dn,{}),(0,o.jsx)(pu,{action:e,onExecute:b})]},e.name||t)})})]})});mu.displayName=`ActionMenuRenderer`,t.ComponentRegistry.register(`menu`,mu,{namespace:`action`,skipFallback:!0,label:`Action Menu`,inputs:[{name:`label`,type:`string`,label:`Trigger Label`},{name:`icon`,type:`string`,label:`Trigger Icon`},{name:`actions`,type:`object`,label:`Actions`},{name:`variant`,type:`enum`,label:`Trigger Variant`,enum:[`default`,`secondary`,`outline`,`ghost`],defaultValue:`ghost`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{variant:`ghost`,actions:[]}});var hu=({action:e,variant:t,size:n,onExecute:r})=>{let[s,l]=(0,a.useState)(!1),u=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),d=(0,i.useCondition)((0,i.toPredicateInput)(e.disabled)),f=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled)),p=Xl(e.icon),m=e.variant===`primary`?`default`:e.variant||t||`outline`,h=e.size===`md`?`default`:e.size||n||`sm`,g=(0,a.useCallback)(async()=>{if(!s){l(!0);try{await r(e)}finally{l(!1)}}},[e,r,s]);return e.visible&&!u?null:(0,o.jsxs)(K,{type:`button`,variant:m,size:h,className:e.className,disabled:(e.disabled==null?e.enabled!=null&&!f:d)||s,onClick:g,children:[s&&(0,o.jsx)(c.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),!s&&p&&(0,o.jsx)(p,{className:W(`h-4 w-4`,e.label&&`mr-2`)}),e.label]})};hu.displayName=`InlineActionButton`;var gu=({action:e,index:t,onSelect:n})=>{let r=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),a=(0,i.useCondition)((0,i.toPredicateInput)(e.disabled)),s=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled));if(e.visible&&!r)return null;let c=Xl(e.icon),l=e.disabled==null?e.enabled!=null&&!s:a,u=e.tags?.includes(`separator-before`)&&t>0;return(0,o.jsxs)(o.Fragment,{children:[u&&(0,o.jsx)(Dn,{}),(0,o.jsxs)(Cn,{disabled:l,onSelect:async t=>{t.preventDefault(),!l&&await n(e)},className:W(e.variant===`destructive`&&`text-destructive focus:text-destructive`,e.className),children:[c&&(0,o.jsx)(c,{className:`mr-2 h-4 w-4`}),(0,o.jsx)(`span`,{children:e.label||e.name})]})]})};gu.displayName=`DropdownActionItem`;var _u=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let{"data-obj-id":s,"data-obj-type":l,style:u,...d}=n,{execute:f}=(0,i.useAction)(),[p,m]=(0,a.useState)(!1),h=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),g=(e.actions||[]).filter(t=>(0,H.actionRendersAt)(t,e.location)),_=(0,a.useCallback)(async e=>{await f({type:e.type,name:e.name,target:e.target,openIn:e.openIn,endpoint:e.endpoint,method:e.method,params:e.params,confirmText:e.confirmText,successMessage:e.successMessage,errorMessage:e.errorMessage,refreshAfter:e.refreshAfter,locations:e.locations,toast:e.toast})},[f]),v=(0,a.useCallback)(async e=>{m(!0);try{await _(e)}finally{m(!1)}},[_]);if(e.visible&&!h||g.length===0)return null;if((e.display||`inline`)===`dropdown`){let n=Xl(e.icon);return(0,o.jsxs)(mn,{children:[(0,o.jsx)(hn,{asChild:!0,children:(0,o.jsxs)(K,{type:`button`,variant:e.variant||`outline`,size:e.size===`md`?`default`:e.size||`default`,className:W(e.className,t),disabled:p,"data-obj-id":s,"data-obj-type":l,style:u,children:[p&&(0,o.jsx)(c.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),!p&&n&&(0,o.jsx)(n,{className:`mr-2 h-4 w-4`}),e.label||`Actions`,(0,o.jsx)(c.ChevronDown,{className:`ml-2 h-3 w-3 opacity-50`})]})}),(0,o.jsx)(Sn,{align:`end`,children:g.map((e,t)=>(0,o.jsx)(gu,{action:e,index:t,onSelect:v},e.name||t))})]})}return(0,o.jsx)(`div`,{ref:r,className:W(`flex items-center gap-2`,e.className,t),...d,"data-obj-id":s,"data-obj-type":l,style:u,children:g.map(t=>(0,o.jsx)(hu,{action:t,variant:e.variant,size:e.size,onExecute:_},t.name))})});_u.displayName=`ActionGroupRenderer`,t.ComponentRegistry.register(`group`,_u,{namespace:`action`,skipFallback:!0,label:`Action Group`,inputs:[{name:`name`,type:`string`,label:`Group Name`},{name:`label`,type:`string`,label:`Label`},{name:`icon`,type:`string`,label:`Icon`},{name:`actions`,type:`object`,label:`Actions`},{name:`display`,type:`enum`,label:`Display Mode`,enum:[`inline`,`dropdown`],defaultValue:`inline`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`default`,`secondary`,`outline`,`ghost`],defaultValue:`outline`},{name:`size`,type:`enum`,label:`Size`,enum:[`sm`,`md`,`lg`],defaultValue:`sm`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{display:`inline`,variant:`outline`,size:`sm`,actions:[]}});function vu(){let{t:e}=(0,x.useObjectTranslation)(),t=e(`common.actions`);return!t||t===`common.actions`?`Actions`:t}var yu=(0,a.forwardRef)(({schema:e,className:n,...r},s)=>{let c=vu(),{"data-obj-id":l,"data-obj-type":u,style:d,data:f,actions:p,systemActions:m,location:h,maxVisible:g,mobileMaxVisible:_,direction:v,gap:y,variant:b,size:x,visible:S,...C}=r,w=(0,i.useCondition)((0,i.toPredicateInput)(e.visible),void 0,{throwOnError:!0,label:`action:bar${e.location?` (${e.location})`:``} (visible)`}),T=ni(),E=(0,i.useCapabilityGate)(),D=(0,a.useMemo)(()=>{let t=(e.actions||[]).filter(e=>E(e?.requiredPermissions)).filter(t=>(0,H.actionRendersAt)(t,e.location)),n=new Set,r=t.filter(e=>!e.name||!n.has(e.name)&&(n.add(e.name),!0));return r.some(e=>e.order!==void 0||e.variant===`primary`)?[...r].sort((e,t)=>{let n=(e.order??0)-(t.order??0);return n===0?(e.variant===`primary`?0:1)-(t.variant===`primary`?0:1):n}):r},[e.actions,e.location,E]),O=(0,a.useMemo)(()=>{let t=e.systemActions||[],n=new Set;return t.filter(e=>E(e?.requiredPermissions)?!e.name||!n.has(e.name)&&(n.add(e.name),!0):!1)},[e.systemActions,E]),k=T?e.mobileMaxVisible??1:e.maxVisible??3,{inlineActions:A,overflowActions:j}=(0,a.useMemo)(()=>D.length<=k?{inlineActions:D,overflowActions:[]}:{inlineActions:D.slice(0,k),overflowActions:D.slice(k)},[D,k]),M=(0,a.useMemo)(()=>{if(O.length===0)return j;if(j.length===0)return O;let[e,...t]=O,n={...e,tags:[...e.tags||[],`separator-before`]};return[...j,n,...t]},[j,O]);if(e.visible&&!w||D.length===0&&O.length===0)return null;let N=e.direction||`horizontal`,P=e.gap||`gap-2`,F=M.length>0?t.ComponentRegistry.get(`action:menu`):null,ee=F?(0,o.jsx)(F,{schema:{type:`action:menu`,actions:M,variant:e.variant||`ghost`,size:e.size||`sm`}}):null;return(0,o.jsxs)(`div`,{ref:s,className:W(`flex items-center`,N===`vertical`?`flex-col items-stretch`:`flex-row flex-wrap`,P,e.className,n),role:`toolbar`,"aria-label":c,...C,"data-obj-id":l,"data-obj-type":u,style:d,children:[A.map(n=>{let r=n.component||`action:button`,i=t.ComponentRegistry.get(r);return i?(0,o.jsx)(i,{schema:{...n,type:r,actionType:n.type,variant:n.variant||e.variant,size:n.size||e.size},data:f},n.name):null}),M.length>0&&ee]})});yu.displayName=`ActionBarRenderer`,t.ComponentRegistry.register(`bar`,yu,{namespace:`action`,skipFallback:!0,label:`Action Bar`,inputs:[{name:`actions`,type:`object`,label:`Actions`},{name:`systemActions`,type:`object`,label:`System Actions (always in overflow)`},{name:`location`,type:`enum`,label:`Location`,enum:[...H.ACTION_LOCATIONS]},{name:`maxVisible`,type:`number`,label:`Max Visible Actions`,defaultValue:3},{name:`direction`,type:`enum`,label:`Direction`,enum:[`horizontal`,`vertical`],defaultValue:`horizontal`},{name:`variant`,type:`enum`,label:`Default Variant`,enum:[`default`,`secondary`,`outline`,`ghost`],defaultValue:`outline`},{name:`size`,type:`enum`,label:`Default Size`,enum:[`sm`,`md`,`lg`],defaultValue:`sm`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{maxVisible:3,direction:`horizontal`,variant:`outline`,size:`sm`,actions:[]}});var bu=({schema:e,className:t})=>{let n=e.type,r=n.startsWith(`view:`),i=n.startsWith(`widget:`),a=n.startsWith(`field:`);return(0,o.jsxs)(`div`,{className:W(`flex flex-col items-center justify-center p-6 border-2 border-dashed rounded-lg bg-muted/30 transition-colors hover:bg-muted/50`,r&&`border-blue-300 bg-blue-50/50 min-h-[200px]`,i&&`border-purple-300 bg-purple-50/50 min-h-[150px]`,a&&`border-yellow-300 bg-yellow-50/50 p-2 min-h-[40px] flex-row gap-2 justify-start`,t),children:[(0,o.jsxs)(`div`,{className:W(`flex items-center gap-2 text-muted-foreground`,a&&`text-sm`),children:[a?(0,o.jsx)(c.Box,{className:`h-4 w-4`}):(0,o.jsx)(c.FileQuestion,{className:`h-8 w-8 mb-2 opacity-50`}),(0,o.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,o.jsx)(`span`,{className:`font-mono font-medium text-foreground`,children:n}),!a&&(0,o.jsx)(`span`,{className:`text-xs`,children:`Component Placeholder`})]})]}),e.props&&!a&&(0,o.jsxs)(`div`,{className:`mt-4 w-full text-xs text-muted-foreground bg-background/50 p-2 rounded overflow-hidden`,children:[(0,o.jsx)(`div`,{className:`opacity-70`,children:`Properties:`}),(0,o.jsx)(`pre`,{className:`mt-1 truncate`,children:JSON.stringify(e.props,null,0)})]})]})},xu=`view:grid.view:kanban.view:map.view:calendar.view:gantt.view:timeline.view:gallery.view:simple.view:wizard.view:tabbed.view:drawer.view:modal.view:split.field:text.field:textarea.field:password.field:email.field:url.field:phone.field:markdown.field:html.field:code.field:number.field:currency.field:percent.field:slider.field:boolean.field:checkboxes.field:select.field:multiselect.field:radio.field:date.field:datetime.field:time.field:duration.field:lookup.field:master_detail.field:tree.field:image.field:file.field:video.field:audio.field:avatar.field:color.field:rating.field:signature.field:qrcode.field:progress.field:json.field:address.field:location.page:header.page-header.page:footer.page:tabs.page:accordion.page:card.page:sidebar.record:details.record:highlights.record:related_list.record:activity.record:chatter.record:path.app:launcher.nav:menu.nav:breadcrumb.global:search.global:notifications.user:profile.widget:metric.widget:bar.widget:line.widget:pie.widget:funnel.widget:radar.widget:scatter.widget:heatmap.widget:pivot.widget:table.widget:text.widget:image.ai:input.ai:suggestion.ai:feedback`.split(`.`),Su=[`nav:menu`,`nav:breadcrumb`,`global:search`,`ai:suggestion`];function Cu(e){t.ComponentRegistry.get(e)||t.ComponentRegistry.register(e,bu,{namespace:`protocol-placeholder`})}function wu(){xu.forEach(Cu)}Su.forEach(Cu);var Tu={info:{Icon:c.Info,tone:`border-border bg-muted/50 text-foreground`,iconTone:`text-muted-foreground`},success:{Icon:c.CheckCircle2,tone:`border-emerald-300/70 bg-emerald-50 text-emerald-900 dark:border-emerald-700/60 dark:bg-emerald-950/40 dark:text-emerald-200`,iconTone:`text-emerald-600 dark:text-emerald-400`},warning:{Icon:c.AlertTriangle,tone:`border-amber-300/70 bg-amber-50 text-amber-900 dark:border-amber-700/60 dark:bg-amber-950/40 dark:text-amber-200`,iconTone:`text-amber-600 dark:text-amber-400`},error:{Icon:c.XCircle,tone:`border-destructive/50 bg-destructive/10 text-destructive dark:text-destructive-foreground`,iconTone:`text-destructive`}};function Eu(e){return Tu[e??`info`]??Tu.info}function Du(e){return Aa(e.icon)?Ma(e.icon):Eu(e.severity).Icon}var Ou={primary:`default`,secondary:`secondary`,link:`link`};function ku(e){return Ou[e??`primary`]??Ou.primary}var Au={top_left:`top-4 left-4`,top_center:`top-4 left-1/2 -translate-x-1/2`,top_right:`top-4 right-4`,bottom_left:`bottom-4 left-4`,bottom_center:`bottom-4 left-1/2 -translate-x-1/2`,bottom_right:`bottom-4 right-4`,"top-left":`top-4 left-4`,"top-center":`top-4 left-1/2 -translate-x-1/2`,"top-right":`top-4 right-4`,"bottom-left":`bottom-4 left-4`,"bottom-center":`bottom-4 left-1/2 -translate-x-1/2`,"bottom-right":`bottom-4 right-4`};function ju({className:e}){let t=(0,i.useNotificationsByPresentation)(`banner`),{dismiss:n,config:r}=(0,i.useNotifications)();if(t.length===0)return null;let a=(0,i.visibleNotificationStack)(t,r);return(0,o.jsx)(`div`,{className:W(`flex w-full flex-col`,e),"data-notification-surface":`banner`,children:a.map(e=>{let{tone:t}=Eu(e.severity),r=Du(e);return(0,o.jsxs)(`div`,{role:`status`,"data-severity":e.severity,className:W(`flex w-full items-center gap-3 border-b px-4 py-2.5 text-sm`,t),children:[(0,o.jsx)(r,{className:`h-4 w-4 shrink-0`,"aria-hidden":`true`}),(0,o.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,o.jsx)(`span`,{className:`font-medium`,children:e.title}),e.message?(0,o.jsx)(`span`,{className:`min-w-0 opacity-90`,children:e.message}):null]}),e.actions?.map(e=>(0,o.jsx)(K,{size:`sm`,variant:ku(e.variant),className:`h-7 shrink-0`,onClick:e.onClick,children:e.label},e.label)),e.dismissible===!1?null:(0,o.jsx)(K,{size:`icon`,variant:`ghost`,className:`h-7 w-7 shrink-0`,"aria-label":`Dismiss ${e.title}`,onClick:()=>n(e.id),children:(0,o.jsx)(c.X,{className:`h-4 w-4`,"aria-hidden":`true`})})]},e.id)})})}ju.displayName=`NotificationBanners`;function Mu({className:e}){let t=(0,i.useNotificationsByPresentation)(`snackbar`),{dismiss:n,config:r,pauseAutoDismiss:a,resumeAutoDismiss:s}=(0,i.useNotifications)(),l=t[0];if(!l)return null;let{iconTone:u}=Eu(l.severity),d=Du(l),f=l.actions?.[0],p=(0,i.resolveNotificationPosition)(l,r),m=p?Au[p]:`bottom-4 left-1/2 -translate-x-1/2`,h=p?.startsWith(`top`)?`motion-safe:slide-in-from-top-4`:`motion-safe:slide-in-from-bottom-4`;return(0,o.jsxs)(`div`,{className:W(`fixed z-50 flex w-[min(28rem,calc(100vw-2rem))]`,m,`items-center gap-3 rounded-md border bg-popover px-4 py-3 text-sm text-popover-foreground shadow-lg`,`motion-safe:animate-in motion-safe:fade-in`,h,e),role:`status`,"aria-live":`polite`,"data-notification-surface":`snackbar`,"data-severity":l.severity,"data-position":p,onPointerEnter:r.pauseOnHover?()=>a(l.id):void 0,onPointerLeave:r.pauseOnHover?()=>s(l.id):void 0,children:[(0,o.jsx)(d,{className:W(`h-4 w-4 shrink-0`,u),"aria-hidden":`true`}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(`div`,{className:`truncate font-medium`,children:l.title}),l.message?(0,o.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:l.message}):null]}),f?(0,o.jsx)(K,{size:`sm`,variant:ku(f.variant),className:`h-7 shrink-0 font-semibold uppercase tracking-wide`,onClick:()=>{f.onClick(),n(l.id)},children:f.label}):null,l.dismissible===!1?null:(0,o.jsx)(K,{size:`icon`,variant:`ghost`,className:`h-7 w-7 shrink-0`,"aria-label":`Dismiss ${l.title}`,onClick:()=>n(l.id),children:(0,o.jsx)(c.X,{className:`h-4 w-4`,"aria-hidden":`true`})})]})}Mu.displayName=`NotificationSnackbar`;var Nu={default:void 0,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,link:`bg-transparent text-primary underline-offset-4 hover:bg-transparent hover:underline`};function Pu({className:e,acknowledgeLabel:t=`OK`}){let n=(0,i.useNotificationsByPresentation)(`alert`),{dismiss:r}=(0,i.useNotifications)(),a=n[n.length-1];if(!a)return null;let{iconTone:s}=Eu(a.severity),c=Du(a),l=()=>r(a.id),u=a.dismissible===!1;return(0,o.jsx)(q,{open:!0,onOpenChange:e=>{!e&&!u&&l()},children:(0,o.jsxs)(Ce,{className:e,"data-notification-surface":`alert`,"data-severity":a.severity,onEscapeKeyDown:e=>{u&&e.preventDefault()},children:[(0,o.jsxs)(we,{children:[(0,o.jsxs)(Ee,{className:`flex items-center gap-2`,children:[(0,o.jsx)(c,{className:W(`h-5 w-5 shrink-0`,s),"aria-hidden":`true`}),a.title]}),a.message?(0,o.jsx)(De,{children:a.message}):null]}),(0,o.jsxs)(Te,{children:[a.actions?.map(e=>(0,o.jsx)(Oe,{className:W(Nu[ku(e.variant)]),onClick:()=>{e.onClick(),l()},children:e.label},e.label)),(0,o.jsx)(Oe,{className:W(a.actions?.length?Nu.secondary:void 0),onClick:l,children:t})]})]})})}Pu.displayName=`NotificationAlerts`;function Fu({scope:e,className:t}){let n=(0,i.useNotificationsByPresentation)(`inline`,e),{dismiss:r,config:a}=(0,i.useNotifications)();if(n.length===0)return null;let s=(0,i.visibleNotificationStack)(n,a);return(0,o.jsx)(`div`,{className:W(`flex w-full flex-col gap-2`,t),"data-notification-surface":`inline`,"data-scope":e,children:s.map(e=>{let{tone:t}=Eu(e.severity),n=Du(e);return(0,o.jsxs)(`div`,{role:`status`,"data-severity":e.severity,className:W(`flex items-start gap-3 rounded-md border px-3 py-2 text-sm`,t),children:[(0,o.jsx)(n,{className:`mt-0.5 h-4 w-4 shrink-0`,"aria-hidden":`true`}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(`div`,{className:`font-medium`,children:e.title}),e.message?(0,o.jsx)(`div`,{className:`opacity-90`,children:e.message}):null,e.actions?.length?(0,o.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:e.actions.map(e=>(0,o.jsx)(K,{size:`sm`,variant:ku(e.variant),className:`h-7`,onClick:e.onClick,children:e.label},e.label))}):null]}),e.dismissible===!1?null:(0,o.jsx)(K,{size:`icon`,variant:`ghost`,className:`-mr-1 h-6 w-6 shrink-0`,"aria-label":`Dismiss ${e.title}`,onClick:()=>r(e.id),children:(0,o.jsx)(c.X,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})]},e.id)})})}Fu.displayName=`NotificationInline`;function Iu(e,t){let n=t?.maxHistory??50,[r,i]=(0,a.useState)({...e}),[o,s]=(0,a.useState)(t?.mode===`create`),c=(0,a.useRef)([]),l=(0,a.useRef)([]),[,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{i({...e}),s(t?.mode===`create`),c.current=[],l.current=[]},[e]);let d=(0,a.useCallback)((e,r)=>{i(t=>(c.current=[...c.current.slice(-(n-1)),t],l.current=[],{...t,[e]:r})),s(!0),u(e=>e+1),t?.onUpdate?.(e,r)},[t?.onUpdate,n]),f=(0,a.useCallback)(()=>{c.current.length!==0&&(i(e=>{let t=[...c.current],n=t.pop();return c.current=t,l.current=[e,...l.current],n}),u(e=>e+1))},[]),p=(0,a.useCallback)(()=>{l.current.length!==0&&(i(e=>{let t=[...l.current],n=t.shift();return l.current=t,c.current=[...c.current,e],n}),u(e=>e+1))},[]);return{draft:r,isDirty:o,updateField:d,discard:(0,a.useCallback)(()=>{i({...e}),s(!1),c.current=[],l.current=[],u(e=>e+1)},[e]),setDraft:i,undo:f,redo:p,canUndo:c.current.length>0,canRedo:l.current.length>0}}function Lu(e){let[t,n]=a.useState({width:0,height:0});return a.useEffect(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let r=t.getBoundingClientRect();n(e=>e.width===r.width&&e.height===r.height?e:{width:r.width,height:r.height});let i=new ResizeObserver(e=>{let t=e[0];if(!t)return;let r,i=t.borderBoxSize?.[0];r=i?{width:i.inlineSize,height:i.blockSize}:{width:t.contentRect.width,height:t.contentRect.height},n(e=>e.width===r.width&&e.height===r.height?e:r)});return i.observe(t),()=>i.disconnect()},[e]),t}var Ru=[`completed`,`failed`,`cancelled`,`expired`];function zu(e){return!!e&&Ru.includes(e)}function Bu(e={}){let{dataSource:t,pollIntervalMs:n=1500,maxAttempts:r=600,onComplete:i,onError:o}=e,[s,c]=(0,a.useState)(null),[l,u]=(0,a.useState)(null),[d,f]=(0,a.useState)(!1),p=(0,a.useRef)(null),m=(0,a.useRef)(null),h=(0,a.useRef)(0),g=(0,a.useRef)(!1),_=(0,a.useRef)({onComplete:i,onError:o});_.current={onComplete:i,onError:o};let v=!!t?.createExportJob&&!!t?.getExportJobProgress,y=(0,a.useCallback)(()=>{m.current&&=(clearTimeout(m.current),null)},[]),b=(0,a.useCallback)(()=>{y(),p.current=null,g.current=!1,h.current=0,c(null),u(null),f(!1)},[y]);(0,a.useEffect)(()=>()=>y(),[y]);let x=(0,a.useCallback)(async()=>{if(t?.getExportJobProgress&&!(!p.current||g.current)){if(h.current+=1,h.current>r){let e=Error(`Export job timed out (max attempts exceeded)`);u(e),f(!1),_.current.onError?.(e,s??void 0);return}try{let e=await t.getExportJobProgress(p.current);if(g.current)return;if(c(e),zu(e.status)){if(f(!1),e.status===`completed`)_.current.onComplete?.(e);else{let t=e.error?.message??`Export ${e.status}`,n=Error(t);u(n),_.current.onError?.(n,e)}return}m.current=setTimeout(x,n)}catch(e){if(g.current)return;let t=e instanceof Error?e:Error(String(e));u(t),f(!1),_.current.onError?.(t,s??void 0)}}},[t,r,n,s]),S=(0,a.useCallback)(async(e,r)=>{if(!t?.createExportJob){let e=Error(`DataSource does not implement createExportJob — cannot start async export.`);return u(e),_.current.onError?.(e),null}y(),g.current=!1,h.current=0,u(null),c(null),f(!0);try{let i=await t.createExportJob(e,r);if(p.current=i.jobId,c({jobId:i.jobId,status:i.status,processedRecords:0,totalRecords:i.estimatedRecords,percentComplete:0}),zu(i.status)){if(f(!1),i.status===`completed`&&t.getExportJobProgress)try{let e=await t.getExportJobProgress(i.jobId);c(e),_.current.onComplete?.(e)}catch{}return i.jobId}return m.current=setTimeout(x,n),i.jobId}catch(e){let t=e instanceof Error?e:Error(String(e));return u(t),f(!1),_.current.onError?.(t),null}},[t,y,x,n]),C=(0,a.useCallback)(async()=>{if(p.current){if(g.current=!0,y(),f(!1),t?.cancelExportJob)try{await t.cancelExportJob(p.current)}catch{}c(e=>e&&{...e,status:`cancelled`})}},[t,y]),w=(0,a.useCallback)(async()=>{if(!p.current)return null;if(t?.getExportJobDownloadUrl)try{return await t.getExportJobDownloadUrl(p.current)}catch{}return s?.downloadUrl??null},[t,s]);return{isRunning:d,progress:s,error:l,isSupported:v,start:S,cancel:C,getDownloadUrl:w,download:(0,a.useCallback)(async e=>{let t=await w();if(!t)return!1;let n=document.createElement(`a`);return n.href=t,e&&(n.download=e),n.rel=`noopener`,document.body.appendChild(n),n.click(),n.remove(),!0},[w]),reset:b}}function Vu({schema:e}){return e?(0,o.jsx)(`pre`,{className:`text-[11px] leading-relaxed font-mono overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:JSON.stringify(e,null,2)}):(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No schema available`})}function Hu({dataContext:e}){return e?(0,o.jsx)(`pre`,{className:`text-[11px] leading-relaxed font-mono overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:JSON.stringify(e,null,2)}):(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No data context available`})}function Uu(){let e=(0,a.useMemo)(()=>{try{return t.ComponentRegistry.getAllTypes()}catch{return[]}},[]);return e.length===0?(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No registered components`}):(0,o.jsxs)(`div`,{className:`space-y-1 max-h-[60vh] overflow-auto`,children:[e.map(e=>(0,o.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 rounded text-xs font-mono bg-muted/30`,children:[(0,o.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full bg-green-500 shrink-0`}),e]},e)),(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:[e.length,` component`,e.length===1?``:`s`,` registered`]})]})}function Wu({flags:e}){return e?(0,o.jsx)(`pre`,{className:`text-[11px] leading-relaxed font-mono overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:JSON.stringify(e,null,2)}):(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No debug flags`})}function Gu(e){let n=t.DebugCollector.getInstance(),[r,i]=(0,a.useState)(()=>n.getEntries(e));return a.default.useEffect(()=>(i(n.getEntries(e)),n.subscribe(()=>{i(n.getEntries(e))})),[n,e]),r}function Ku(){let e=Gu(`perf`).map(e=>e.data);return e.length===0?(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No performance data collected yet`}):(0,o.jsxs)(`div`,{className:`space-y-1 max-h-[60vh] overflow-auto`,children:[e.map((e,t)=>(0,o.jsxs)(`div`,{className:W(`flex items-center justify-between px-2 py-1 rounded text-xs font-mono`,e.durationMs>16?`bg-red-50 text-red-700`:`bg-muted/30`),children:[(0,o.jsxs)(`span`,{className:`truncate mr-2`,children:[e.type,e.id?`:${e.id}`:``]}),(0,o.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[e.durationMs.toFixed(2),`ms`]})]},t)),(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:[e.length,` render`,e.length===1?``:`s`,` tracked`]})]})}function qu(){let e=Gu(`expr`).map(e=>e.data);return e.length===0?(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No expression evaluations tracked yet`}):(0,o.jsxs)(`div`,{className:`space-y-1.5 max-h-[60vh] overflow-auto`,children:[e.map((e,t)=>(0,o.jsxs)(`div`,{className:`px-2 py-1.5 rounded bg-muted/30 text-xs font-mono`,children:[(0,o.jsx)(`div`,{className:`text-muted-foreground truncate`,children:e.expression}),(0,o.jsxs)(`div`,{className:`mt-0.5`,children:[`→ `,JSON.stringify(e.result)]})]},t)),(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:[e.length,` evaluation`,e.length===1?``:`s`,` tracked`]})]})}function Ju(){let e=Gu(`event`).map(e=>e.data);return e.length===0?(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No events captured yet`}):(0,o.jsxs)(`div`,{className:`space-y-1.5 max-h-[60vh] overflow-auto`,children:[e.map((e,t)=>(0,o.jsxs)(`div`,{className:`px-2 py-1.5 rounded bg-muted/30 text-xs font-mono`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,o.jsx)(`span`,{className:`font-semibold`,children:e.action}),(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:new Date(e.timestamp).toLocaleTimeString()})]}),e.payload!==void 0&&(0,o.jsx)(`pre`,{className:`mt-0.5 text-[10px] text-muted-foreground truncate`,children:JSON.stringify(e.payload)})]},t)),(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:[e.length,` event`,e.length===1?``:`s`,` captured`]})]})}function Yu({open:e,onClose:t,flags:n,schema:r,dataContext:i,extraTabs:s=[],className:c}){let l=(0,a.useMemo)(()=>[{id:`schema`,label:`Schema`,render:()=>(0,o.jsx)(Vu,{schema:r})},{id:`data`,label:`Data`,render:()=>(0,o.jsx)(Hu,{dataContext:i})},{id:`perf`,label:`Perf`,render:()=>(0,o.jsx)(Ku,{})},{id:`expr`,label:`Expr`,render:()=>(0,o.jsx)(qu,{})},{id:`events`,label:`Events`,render:()=>(0,o.jsx)(Ju,{})},{id:`registry`,label:`Registry`,render:()=>(0,o.jsx)(Uu,{})},{id:`flags`,label:`Flags`,render:()=>(0,o.jsx)(Wu,{flags:n})}],[r,i,n]),u=(0,a.useMemo)(()=>[...l,...s],[l,s]),[d,f]=(0,a.useState)(u[0]?.id??`schema`),p=u.find(e=>e.id===d)??u[0],m=(0,a.useCallback)(e=>{f(e)},[]);return e?(0,o.jsxs)(`div`,{className:W(`fixed bottom-4 right-4 z-[9999] w-[420px] max-w-[95vw] rounded-lg border bg-background shadow-2xl`,`flex flex-col overflow-hidden`,c),"data-testid":`debug-panel`,role:`dialog`,"aria-label":`Developer Debug Panel`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b bg-muted/30`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`🛠 Debug Panel`}),(0,o.jsx)(`button`,{onClick:t,className:`text-muted-foreground hover:text-foreground text-sm leading-none px-1`,"aria-label":`Close debug panel`,"data-testid":`debug-panel-close`,children:`✕`})]}),(0,o.jsx)(`div`,{className:`flex border-b overflow-x-auto`,role:`tablist`,children:u.map(e=>(0,o.jsxs)(`button`,{role:`tab`,"aria-selected":e.id===p?.id,onClick:()=>m(e.id),className:W(`px-3 py-1.5 text-xs font-medium whitespace-nowrap transition-colors`,e.id===p?.id?`border-b-2 border-primary text-foreground`:`text-muted-foreground hover:text-foreground`),"data-testid":`debug-tab-${e.id}`,children:[e.icon&&(0,o.jsx)(`span`,{className:`mr-1`,children:e.icon}),e.label]},e.id))}),(0,o.jsx)(`div`,{className:`p-3 overflow-auto max-h-[50vh]`,"data-testid":`debug-panel-content`,children:p?.render()})]}):null}var Xu={permission:`view`,audience:`link_only`,expiresInDays:7,password:``,label:``},Zu=[{label:`1 day`,value:1},{label:`7 days`,value:7},{label:`30 days`,value:30},{label:`90 days`,value:90},{label:`Never`,value:null}],Qu=[{value:`link_only`,label:`Anyone with the link`,help:`No sign-in required`},{value:`signed_in`,label:`Signed-in users`,help:`Must be logged in to view`}];function $u(e,t){return`${(e??(typeof window<`u`?`${window.location.origin}/s`:`/s`)).replace(/\/+$/,``)}/${t}`}async function ed(e){try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document<`u`){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`absolute`,t.style.left=`-9999px`,document.body.appendChild(t),t.select();try{return document.execCommand(`copy`),document.body.removeChild(t),!0}catch{document.body.removeChild(t)}}return!1}function td({open:e,onOpenChange:t,objectName:n,recordId:r,recordLabel:i,apiBase:s,publicBaseUrl:l,fetchHeaders:u}){let[d,f]=(0,a.useState)([]),[p,m]=(0,a.useState)(!1),[h,g]=(0,a.useState)(!1),[_,v]=(0,a.useState)(null),[y,b]=(0,a.useState)(Xu),[x,S]=(0,a.useState)(null),C=(0,a.useCallback)(async()=>{let e={"Content-Type":`application/json`};if(!u)return e;let t=await u();return{...e,...t}},[u]),w=(0,a.useMemo)(()=>`${s.replace(/\/+$/,``)}/v1/share-links?object=${encodeURIComponent(n)}&recordId=${encodeURIComponent(r)}`,[s,n,r]),T=(0,a.useCallback)(async()=>{m(!0),v(null);try{let e=await C(),t=await fetch(w,{headers:e,credentials:`include`});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();f(n.links??n.data??[])}catch(e){v(e?.message??`Failed to load share links`)}finally{m(!1)}},[w,C]);(0,a.useEffect)(()=>{e&&(T(),b(Xu))},[e,T]);let E=(0,a.useCallback)(async()=>{g(!0),v(null);try{let e=y.expiresInDays==null?void 0:new Date(Date.now()+y.expiresInDays*24*60*60*1e3).toISOString(),t=await C(),i=await fetch(`${s.replace(/\/+$/,``)}/v1/share-links`,{method:`POST`,headers:t,credentials:`include`,body:JSON.stringify({object:n,recordId:r,permission:y.permission,audience:y.audience,expiresAt:e,password:y.password.trim()||void 0,label:y.label.trim()||void 0})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e?.error?.message||`HTTP ${i.status}`)}let a=await i.json(),o=a.link??a.data;if(!o)throw Error(`Share link create response missing link payload`);f(e=>[o,...e]),await ed($u(l,o.token))&&(S(o.id),setTimeout(()=>S(null),1500)),b(Xu)}catch(e){v(e?.message??`Failed to create share link`)}finally{g(!1)}},[s,C,n,r,y,l]),D=(0,a.useCallback)(async e=>{try{let t=await C(),n=await fetch(`${s.replace(/\/+$/,``)}/v1/share-links/${encodeURIComponent(e.id)}`,{method:`DELETE`,headers:t,credentials:`include`});if(!n.ok&&n.status!==204)throw Error(`HTTP ${n.status}`);f(t=>t.map(t=>t.id===e.id?{...t,revoked_at:new Date().toISOString()}:t))}catch(e){v(e?.message??`Failed to revoke link`)}},[s,C]),O=(0,a.useCallback)(async e=>{await ed($u(l,e.token))&&(S(e.id),setTimeout(()=>S(null),1500))},[l]),k=d.filter(e=>!e.revoked_at),A=d.filter(e=>e.revoked_at);return(0,o.jsx)(Ct,{open:e,onOpenChange:t,children:(0,o.jsxs)(Ot,{className:`max-w-xl`,"data-testid":`share-dialog`,children:[(0,o.jsxs)(kt,{children:[(0,o.jsxs)(jt,{className:`flex items-center gap-2`,children:[(0,o.jsx)(c.Link2,{className:`h-4 w-4`}),`Share `,i??`this record`]}),(0,o.jsx)(Mt,{children:`Generate a link anyone (or selected people) can use to open this record. Links can be revoked at any time.`})]}),_&&(0,o.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,"data-testid":`share-dialog-error`,children:_}),(0,o.jsxs)(`section`,{className:`space-y-3 rounded-lg border bg-muted/30 p-3`,children:[(0,o.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(X,{className:`text-xs`,children:`Who can access`}),(0,o.jsxs)(Nr,{value:y.audience,onValueChange:e=>b(t=>({...t,audience:e})),children:[(0,o.jsx)(Ir,{className:`h-8 text-xs`,"data-testid":`share-audience`,children:(0,o.jsx)(Fr,{})}),(0,o.jsx)(zr,{children:Qu.map(e=>(0,o.jsx)(Vr,{value:e.value,className:`text-xs`,children:(0,o.jsxs)(`div`,{className:`flex flex-col`,children:[(0,o.jsx)(`span`,{children:e.label}),(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.help})]})},e.value))})]})]}),(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(X,{className:`text-xs`,children:`Expires in`}),(0,o.jsxs)(Nr,{value:y.expiresInDays==null?`never`:String(y.expiresInDays),onValueChange:e=>b(t=>({...t,expiresInDays:e===`never`?null:Number(e)})),children:[(0,o.jsx)(Ir,{className:`h-8 text-xs`,"data-testid":`share-expiry`,children:(0,o.jsx)(Fr,{})}),(0,o.jsx)(zr,{children:Zu.map(e=>(0,o.jsx)(Vr,{value:e.value==null?`never`:String(e.value),className:`text-xs`,children:e.label},String(e.value)))})]})]}),(0,o.jsxs)(`div`,{className:`space-y-1 sm:col-span-2`,children:[(0,o.jsx)(X,{className:`text-xs`,children:`Password (optional)`}),(0,o.jsx)(Z,{type:`password`,value:y.password,onChange:e=>b(t=>({...t,password:e.target.value})),placeholder:`Require a password to open`,className:`h-8 text-xs`,"data-testid":`share-password`})]}),(0,o.jsxs)(`div`,{className:`space-y-1 sm:col-span-2`,children:[(0,o.jsx)(X,{className:`text-xs`,children:`Label (only you see this)`}),(0,o.jsx)(Z,{value:y.label,onChange:e=>b(t=>({...t,label:e.target.value})),placeholder:`e.g. Sent to design review`,className:`h-8 text-xs`,"data-testid":`share-label`})]})]}),(0,o.jsx)(`div`,{className:`flex justify-end`,children:(0,o.jsxs)(K,{size:`sm`,onClick:E,disabled:h,"data-testid":`share-create`,children:[h?(0,o.jsx)(c.Loader2,{className:`mr-1 h-3 w-3 animate-spin`}):(0,o.jsx)(c.Link2,{className:`mr-1 h-3 w-3`}),`Create link`]})})]}),(0,o.jsxs)(`section`,{className:`space-y-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,o.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground`,children:[`Existing links`,k.length?` (${k.length})`:``]}),p&&(0,o.jsx)(c.Loader2,{className:`h-3 w-3 animate-spin text-muted-foreground`})]}),!p&&k.length===0&&A.length===0&&(0,o.jsx)(`p`,{className:`rounded-md border border-dashed px-3 py-4 text-center text-xs text-muted-foreground`,children:`No share links yet. Create one above.`}),(0,o.jsxs)(`ul`,{className:`space-y-2`,children:[k.map(e=>(0,o.jsx)(nd,{link:e,copied:x===e.id,onCopy:()=>O(e),onRevoke:()=>D(e),publicBaseUrl:l},e.id)),A.length>0&&(0,o.jsx)(`li`,{className:`pt-2 text-[10px] uppercase tracking-wide text-muted-foreground`,children:`Revoked`}),A.map(e=>(0,o.jsx)(nd,{link:e,copied:!1,onCopy:()=>O(e),onRevoke:()=>D(e),publicBaseUrl:l,disabled:!0},e.id))]})]}),(0,o.jsx)(At,{children:(0,o.jsx)(K,{variant:`ghost`,size:`sm`,onClick:()=>t(!1),children:`Done`})})]})})}function nd({link:e,copied:t,onCopy:n,onRevoke:r,publicBaseUrl:i,disabled:a}){let s=$u(i,e.token);return(0,o.jsxs)(`li`,{className:W(`flex items-center gap-2 rounded-md border bg-card px-2 py-2 text-xs`,a&&`opacity-60`),"data-testid":`share-link-row`,children:[(0,o.jsx)(Re,{variant:`secondary`,className:`text-[10px] capitalize`,children:e.audience.replace(`_`,` `)}),(0,o.jsx)(Re,{variant:`outline`,className:`text-[10px] capitalize`,children:e.permission}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(`div`,{className:`truncate font-mono text-[11px]`,title:s,children:s}),e.label&&(0,o.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:e.label})]}),!a&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(K,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-xs`,onClick:n,"data-testid":`share-link-copy`,children:[(0,o.jsx)(c.Copy,{className:`mr-1 h-3 w-3`}),t?`Copied!`:`Copy`]}),(0,o.jsx)(K,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-xs text-destructive hover:text-destructive`,onClick:r,"data-testid":`share-link-revoke`,title:`Revoke`,children:(0,o.jsx)(c.Trash2,{className:`h-3 w-3`})})]}),a&&(0,o.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,o.jsx)(c.ShieldOff,{className:`h-3 w-3`}),`revoked`]})]})}function rd(){return!0}e.Accordion=ge,e.AccordionContent=ye,e.AccordionItem=_e,e.AccordionTrigger=ve,e.ActionParamDialog=fc,e.Alert=je,e.AlertDescription=Y,e.AlertDialog=q,e.AlertDialogAction=Oe,e.AlertDialogCancel=ke,e.AlertDialogContent=Ce,e.AlertDialogDescription=De,e.AlertDialogFooter=Te,e.AlertDialogHeader=we,e.AlertDialogOverlay=Se,e.AlertDialogPortal=J,e.AlertDialogTitle=Ee,e.AlertDialogTrigger=xe,e.AlertTitle=Me,e.AspectRatio=Ne,e.Avatar=Pe,e.AvatarFallback=Ie,e.AvatarImage=Fe,e.Badge=Re,e.Breadcrumb=ze,e.BreadcrumbEllipsis=Ge,e.BreadcrumbItem=Ve,e.BreadcrumbLink=He,e.BreadcrumbList=Be,e.BreadcrumbPage=Ue,e.BreadcrumbSeparator=We,e.Button=K,e.ButtonGroup=Yo,e.ButtonGroupSeparator=Zo,e.ButtonGroupText=Xo,e.Calendar=Ke,e.CalendarDayButton=qe,e.Card=Je,e.CardContent=Qe,e.CardDescription=Ze,e.CardFooter=$e,e.CardHeader=Ye,e.CardTitle=Xe,e.Carousel=nt,e.CarouselContent=rt,e.CarouselItem=it,e.CarouselNext=ot,e.CarouselPrevious=at,e.ChartContainer=ut,e.ChartLegend=mt,e.ChartLegendContent=ht,e.ChartSkeleton=_c,e.ChartStyle=dt,e.ChartTooltip=ft,e.ChartTooltipContent=pt,e.Checkbox=_t,e.Collapsible=vt,e.CollapsibleContent=bt,e.CollapsibleTrigger=yt,e.Combobox=Qo,e.Command=Nt,e.CommandDialog=Pt,e.CommandEmpty=Lt,e.CommandGroup=Rt,e.CommandInput=Ft,e.CommandItem=Bt,e.CommandList=It,e.CommandSeparator=zt,e.CommandShortcut=Vt,e.ConfigFieldRenderer=xs,e.ConfigPanelRenderer=Cs,e.ConfigRow=$o,e.ContextMenu=Ht,e.ContextMenuCheckboxItem=Qt,e.ContextMenuContent=Xt,e.ContextMenuGroup=Wt,e.ContextMenuItem=Zt,e.ContextMenuLabel=en,e.ContextMenuPortal=Gt,e.ContextMenuRadioGroup=qt,e.ContextMenuRadioItem=$t,e.ContextMenuSeparator=tn,e.ContextMenuShortcut=nn,e.ContextMenuSub=Kt,e.ContextMenuSubContent=Yt,e.ContextMenuSubTrigger=Jt,e.ContextMenuTrigger=Ut,e.DataEmptyState=Tc,e.EmptyState=Tc,e.DataErrorState=Ec,e.DataLoadingState=wc,e.DatePicker=ws,e.DebugPanel=Yu,e.Dialog=Ct,e.DialogClose=Et,e.DialogContent=Ot,e.DialogDescription=Mt,e.DialogFooter=At,e.DialogHeader=kt,e.DialogOverlay=Dt,e.DialogPortal=Tt,e.DialogTitle=jt,e.DialogTrigger=wt,e.Drawer=rn,e.DrawerClose=sn,e.DrawerContent=ln,e.DrawerDescription=pn,e.DrawerFooter=dn,e.DrawerHeader=un,e.DrawerOverlay=cn,e.DrawerPortal=on,e.DrawerTitle=fn,e.DrawerTrigger=an,e.DropdownMenu=mn,e.DropdownMenuCheckboxItem=wn,e.DropdownMenuContent=Sn,e.DropdownMenuGroup=gn,e.DropdownMenuItem=Cn,e.DropdownMenuLabel=En,e.DropdownMenuPortal=_n,e.DropdownMenuRadioGroup=yn,e.DropdownMenuRadioItem=Tn,e.DropdownMenuSeparator=Dn,e.DropdownMenuShortcut=On,e.DropdownMenuSub=vn,e.DropdownMenuSubContent=xn,e.DropdownMenuSubTrigger=bn,e.DropdownMenuTrigger=hn,e.Empty=Es,e.EmptyContent=Ms,e.EmptyDescription=js,e.EmptyHeader=Ds,e.EmptyMedia=ks,e.EmptyTitle=As,e.EmptyValue=Ns,e.ExportProgressDialog=Oc,e.FILTER_BUILDER_OPERATORS=ts,e.FieldContainer=Fs,e.FilterBuilder=_s,e.Form=An,e.FormControl=Ln,e.FormDescription=Rn,e.FormField=Mn,e.FormItem=Fn,e.FormLabel=In,e.FormMessage=zn,e.FormSkeleton=hc,e.GridFieldAuthoringProvider=Ql,e.GridSkeleton=pc,e.GroupingEditor=dc,e.HoverCard=Bn,e.HoverCardContent=Hn,e.HoverCardTrigger=Vn,e.Input=Z,e.InputGroup=Is,e.InputOTP=Un,e.InputOTPGroup=Wn,e.InputOTPSeparator=Kn,e.InputOTPSlot=Gn,e.Item=Bs,e.ItemActions=Ks,e.ItemContent=Us,e.ItemDescription=Gs,e.ItemFooter=Js,e.ItemGroup=Ls,e.ItemHeader=qs,e.ItemMedia=Hs,e.ItemSeparator=Rs,e.ItemTitle=Ws,e.KanbanSkeleton=mc,e.Kbd=Ys,e.KbdGroup=Xs,e.Label=X,e.LazyIcon=Na,e.ListSkeleton=gc,e.LookupValuePicker=vs,e.Menubar=Qn,e.MenubarCheckboxItem=ir,e.MenubarContent=nr,e.MenubarGroup=Jn,e.MenubarItem=rr,e.MenubarLabel=or,e.MenubarMenu=qn,e.MenubarPortal=Yn,e.MenubarRadioGroup=Xn,e.MenubarRadioItem=ar,e.MenubarSeparator=sr,e.MenubarShortcut=cr,e.MenubarSub=Zn,e.MenubarSubContent=tr,e.MenubarSubTrigger=er,e.MenubarTrigger=$n,e.MobileDialogContent=tc,e.NOTIFICATION_ACTION_BUTTON_VARIANTS=Ou,e.NOTIFICATION_POSITION_CLASSES=Au,e.NOTIFICATION_SEVERITY_STYLES=Tu,e.NativeSelect=Zs,e.NavigationMenu=lr,e.NavigationMenuContent=mr,e.NavigationMenuIndicator=_r,e.NavigationMenuItem=dr,e.NavigationMenuLink=hr,e.NavigationMenuList=ur,e.NavigationMenuTrigger=pr,e.NavigationMenuViewport=gr,e.NavigationOverlay=cc,e.NotificationAlerts=Pu,e.NotificationBanners=ju,e.NotificationInline=Fu,e.NotificationSnackbar=Mu,e.Pagination=vr,e.PaginationContent=yr,e.PaginationEllipsis=wr,e.PaginationItem=br,e.PaginationLink=xr,e.PaginationNext=Cr,e.PaginationPrevious=Sr,e.Popover=Tr,e.PopoverContent=Dr,e.PopoverTrigger=Er,e.Progress=Or,e.RadioGroup=kr,e.RadioGroupItem=Ar,e.RecordTitleChip=bc,e.RefreshIndicator=Cc,e.RelatedCountStore=Ol,e.ResizableHandle=yo,e.ResizablePanel=vo,e.ResizablePanelGroup=_o,e.ScrollArea=jr,e.ScrollBar=Mr,e.SectionHeader=Ss,e.Select=Nr,e.SelectContent=zr,e.SelectGroup=Pr,e.SelectItem=Vr,e.SelectLabel=Br,e.SelectScrollDownButton=Rr,e.SelectScrollUpButton=Lr,e.SelectSeparator=Hr,e.SelectTrigger=Ir,e.SelectValue=Fr,e.Separator=Ur,e.ShareDialog=td,e.Sheet=Wr,e.SheetClose=Kr,e.SheetContent=Xr,e.SheetDescription=ei,e.SheetFooter=Qr,e.SheetHeader=Zr,e.SheetOverlay=Jr,e.SheetPortal=qr,e.SheetTitle=$r,e.SheetTrigger=Gr,e.ShimmerSkeleton=yc,e.Sidebar=gi,e.SidebarContent=wi,e.SidebarFooter=Si,e.SidebarGroup=Ti,e.SidebarGroupAction=Di,e.SidebarGroupContent=Oi,e.SidebarGroupLabel=Ei,e.SidebarHeader=xi,e.SidebarInput=bi,e.SidebarInset=yi,e.SidebarMenu=ki,e.SidebarMenuAction=Ni,e.SidebarMenuBadge=Pi,e.SidebarMenuButton=Mi,e.SidebarMenuItem=Ai,e.SidebarMenuSkeleton=Fi,e.SidebarMenuSub=Ii,e.SidebarMenuSubButton=Ri,e.SidebarMenuSubItem=Li,e.SidebarProvider=hi,e.SidebarRail=vi,e.SidebarSeparator=Ci,e.SidebarTrigger=_i,e.Skeleton=Q,e.Slider=zi,e.SortBuilder=bs,e.Spinner=lc,e.Switch=Vi,e.TOASTER_POSITIONS=Gl,e.Table=Hi,e.TableBody=Wi,e.TableCaption=Yi,e.TableCell=Ji,e.TableFooter=Gi,e.TableHead=qi,e.TableHeader=Ui,e.TableRow=Ki,e.Tabs=Xi,e.TabsContent=$i,e.TabsList=Zi,e.TabsTrigger=Qi,e.Textarea=ea,e.Toaster=Bi,e.Toggle=na,e.ToggleGroup=ia,e.ToggleGroupItem=aa,e.Tooltip=ii,e.TooltipContent=oi,e.TooltipProvider=ri,e.TooltipTrigger=ai,e.TypographyBlockquote=da,e.TypographyH1=oa,e.TypographyH2=sa,e.TypographyH3=ca,e.TypographyH4=la,e.TypographyInlineCode=pa,e.TypographyLarge=ha,e.TypographyLead=ma,e.TypographyList=fa,e.TypographyMuted=_a,e.TypographyP=ua,e.TypographySmall=ga,e.ViewSkeleton=vc,e.badgeVariants=Le,e.buttonGroupVariants=Jo,e.buttonVariants=be,e.cn=W,Object.defineProperty(e,"cva",{enumerable:!0,get:function(){return d.cva}}),e.getLazyIcon=Ma,e.initializeComponents=rd,e.isInsidePopperLayer=$s,e.isLucideIconName=Aa,e.navigationMenuTriggerStyle=fr,e.notificationActionVariant=ku,e.notificationIcon=Du,e.notificationSeverityStyle=Eu,e.registerPlaceholders=wu,e.renderChildren=G,e.toKebabIconName=Da,e.toast=L.toast,e.toggleVariants=ta,e.useConfigDraft=Iu,e.useExportJob=Bu,e.useFormField=Nn,e.useGridFieldAuthoring=$l,e.useIsMobile=ni,e.usePopperAwareInteractOutside=ec,e.useRelatedCount=El,e.useRelatedCountVersion=Dl,e.useResizeObserver=Lu,e.useSidebar=mi});