@viglet/viglet-design-system 2026.3.15 → 2026.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -242,6 +242,13 @@ Or in your entry TypeScript/JavaScript:
242
242
  import "@viglet/viglet-design-system/styles";
243
243
  ```
244
244
 
245
+ Next to your own `@import "tailwindcss"`, in either order, your utilities win
246
+ over the copies `./styles` carries for its components. The package's plain
247
+ utilities (`.hidden`, `.flex`) sit in `@layer utilities.viglet`, below yours, so
248
+ `hidden lg:block` in your app shows at `lg`. Its variant utilities (`md:flex`,
249
+ `hover:bg-accent`) sit in `@layer viglet-variants`, ordered after `utilities`, so
250
+ your plain `.hidden` does not hide the package's responsive chrome.
251
+
245
252
  The brand faces are a **separate import**, and one you probably want:
246
253
 
247
254
  ```css
@@ -589,6 +596,11 @@ and a dismiss button appears on each report once you pass `onDismiss`. A report
589
596
  is announced once, when it arrives, and not again when the dock opens or
590
597
  re-renders.
591
598
 
599
+ The assistant's own settings, such as what it reports or whether the mascot
600
+ moves, go in the dock rather than in the header. Pass `onOpenSettings`, and the
601
+ open panel's header shows a settings button that calls it. You open whatever
602
+ holds the settings: a dialog, a popover or a page.
603
+
592
604
  It pins itself to the bottom-right of the viewport; pass `inline` to render it
593
605
  in flow and place it yourself. In a bento product, pass it to `BentoShell` as
594
606
  `dock` instead. With a rail, the shell rests it at the rail's foot, where it
@@ -865,7 +877,9 @@ link sits, with the middle collapsed past four. A trail of one renders the usual
865
877
  arrow back link. `BentoTrail` is the same trail on its own, for a custom eyebrow.
866
878
 
867
879
  `BentoDataTable` is the list a curator sorts, range-selects and acts on at scale.
868
- It mounts only the rows in view, so ten thousand cost what twenty do. Pass `rows`,
880
+ It mounts only the rows in view, so ten thousand cost what twenty do. The body is
881
+ as tall as its rows up to `height` (480 px by default) and scrolls past that, so a
882
+ list of one is one row tall. Pass `rows`,
869
883
  `getRowId`, `columns` (a header, a `cell`, and a `sortValue` to make it sortable),
870
884
  and optionally `rowActions` for a per-row menu and `selectionActions` for the bar
871
885
  that appears over a selection. The arrows move between rows, Shift with an arrow
@@ -64,7 +64,7 @@ export interface BentoDataTableProps<TRow> {
64
64
  onRowOpen?: (row: TRow) => void;
65
65
  /** Pixels per row. Rows are one height, which is what lets the table mount only the visible ones. */
66
66
  rowHeight?: number;
67
- /** The scrolling body's height in pixels. */
67
+ /** The most the body grows to, in pixels. Fewer rows than fill it, and it is as tall as the rows. */
68
68
  height?: number;
69
69
  /** Shown instead of the body when there are no rows. */
70
70
  empty?: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"bento-data-table.d.ts","sourceRoot":"","sources":["../../src/bento/bento-data-table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,OAAO,EAEb,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,KAAK,aAAa,EAGlB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAaf,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE9E,MAAM,WAAW,oBAAoB,CAAC,IAAI;IACxC,2DAA2D;IAC3D,EAAE,EAAE,MAAM,CAAC;IACX,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,IAAI,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,SAAS,CAAC;IAC/B,wFAAwF;IACxF,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;IACrE,6FAA6F;IAC7F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB,CAAC,IAAI;IACxC,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,aAAa,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvC,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,mDAAmD;IACnD,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;CAClC;AAED,2FAA2F;AAC3F,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB,CAAC,IAAI;IACvC,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC;IACtB,QAAQ,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,CAAC;IAChC,OAAO,EAAE,SAAS,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC/C,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,mGAAmG;IACnG,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,CAAC;IACpC,2CAA2C;IAC3C,UAAU,CAAC,EAAE,SAAS,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IACnD,6FAA6F;IAC7F,gBAAgB,CAAC,EAAE,SAAS,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IACzD;;;;;OAKG;IACH,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC5C;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACxD,wCAAwC;IACxC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,qGAAqG;IACrG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAWD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,IAAI,SAAS,OAAO,EAAE,EACnD,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,KAAK,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,MAAM,EACN,cAAc,EACd,SAAS,EACT,SAAc,EACd,MAAY,EACZ,KAAK,GACN,EAAE,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,+BAwZrC"}
1
+ {"version":3,"file":"bento-data-table.d.ts","sourceRoot":"","sources":["../../src/bento/bento-data-table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,OAAO,EAEb,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,KAAK,aAAa,EAGlB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAaf,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE9E,MAAM,WAAW,oBAAoB,CAAC,IAAI;IACxC,2DAA2D;IAC3D,EAAE,EAAE,MAAM,CAAC;IACX,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,IAAI,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,SAAS,CAAC;IAC/B,wFAAwF;IACxF,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;IACrE,6FAA6F;IAC7F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB,CAAC,IAAI;IACxC,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,aAAa,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvC,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,mDAAmD;IACnD,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;CAClC;AAED,2FAA2F;AAC3F,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB,CAAC,IAAI;IACvC,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC;IACtB,QAAQ,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,CAAC;IAChC,OAAO,EAAE,SAAS,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC/C,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,mGAAmG;IACnG,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,CAAC;IACpC,2CAA2C;IAC3C,UAAU,CAAC,EAAE,SAAS,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IACnD,6FAA6F;IAC7F,gBAAgB,CAAC,EAAE,SAAS,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IACzD;;;;;OAKG;IACH,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC5C;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACxD,wCAAwC;IACxC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,qGAAqG;IACrG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qGAAqG;IACrG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAWD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,IAAI,SAAS,OAAO,EAAE,EACnD,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,KAAK,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,MAAM,EACN,cAAc,EACd,SAAS,EACT,SAAc,EACd,MAAY,EACZ,KAAK,GACN,EAAE,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,+BA4ZrC"}
package/dist/bento.cjs CHANGED
@@ -1,5 +1,5 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./utils-Oagwe_oa.cjs"),t=require("./badge-locale-1_BmNTro.cjs"),n=require("./user.context-uYif5Mp2.cjs"),r=require("./loading-provider-E4tIG9BM.cjs");let i=require("react"),a=require("react/jsx-runtime"),o=require("react-i18next"),s=require("@tabler/icons-react"),c=require("@iconify/react"),l=require("react-resizable-panels"),u=require("react-router-dom"),d=require("@tanstack/react-table"),f=require("@dnd-kit/core"),p=require("@dnd-kit/sortable"),m=require("@dnd-kit/utilities"),h=require("sonner");var g={default:``,destructive:`bento-item-danger`},_=new Set;function v(e){process.env.NODE_ENV===`production`||_.has(e)||(_.add(e),console.warn(`BentoActionsMenu: the action "${e}" has no id. Give it a stable name, such as "post.delete": it is rendered as data-action-id so a console verb can be matched to an agent verb, and it becomes required in the next release.`))}function y({actions:e,triggerLabel:t}){let{t:r}=(0,o.useTranslation)();if(e.length===0)return null;for(let t of e)t.id||v(t.label);return(0,a.jsxs)(n.M,{children:[(0,a.jsx)(n.K,{asChild:!0,children:(0,a.jsx)(`button`,{type:`button`,"aria-label":t??r(`forms.formActions.moreActions`,{defaultValue:`More actions`}),className:`bento-tile-clickable inline-flex h-9 w-9 items-center justify-center rounded-full border border-border/60 bg-card/60 text-muted-foreground backdrop-blur transition-colors duration-200 hover:text-foreground`,children:(0,a.jsx)(s.IconDotsVertical,{size:18})})}),(0,a.jsx)(n.P,{align:`end`,sideOffset:8,className:`bento-dropdown min-w-44 p-1.5`,children:e.map(e=>{let t=e.icon,r=g[e.tone??`default`];return(0,a.jsxs)(n.I,{"data-action-id":e.id,onSelect:e.onSelect,disabled:e.disabled,className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2 ${r}`,children:[(0,a.jsx)(t,{size:16}),e.label]},e.id??e.label)})})]})}var b={blue:`bento-tone-blue`,indigo:`bento-tone-indigo`,violet:`bento-tone-violet`,emerald:`bento-tone-emerald`,amber:`bento-tone-amber`,rose:`bento-tone-rose`,slate:`bento-tone-slate`},x=Object.keys(b);function S(e){return`bento-chip ${b[e]??b.slate}`}function C({to:e,icon:t,tone:n,label:r,count:i,span:o}){let s=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`span`,{className:`grid h-9 w-9 place-items-center rounded-2xl text-white shadow-md ${S(n)}`,children:(0,a.jsx)(t,{size:18})}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`div`,{className:`text-3xl font-semibold tabular-nums tracking-tight`,children:i}),(0,a.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground`,children:r})]})]}),c=`bento-tile bento-glass group relative flex flex-col justify-between overflow-hidden p-4 ${o}${e?` bento-tile-clickable`:``}`;return e?(0,a.jsx)(u.Link,{to:e,className:c,children:s}):(0,a.jsx)(`div`,{className:c,children:s})}var w=6,T={rowSortingFeature:d.rowSortingFeature,coreRowModel:(0,d.createCoreRowModel)(),sortedRowModel:(0,d.createSortedRowModel)()};function E({rows:t,getRowId:r,columns:c,label:l,getRowLabel:u,rowActions:f,selectionActions:p,selectedIds:m,onSelectionChange:h,selectionScope:g,layout:_,onLayoutChange:v,onRowOpen:b,rowHeight:x=44,height:S=480,empty:C}){let{t:E}=(0,o.useTranslation)(),[D,O]=(0,i.useState)([]),[k,A]=(0,i.useState)({hidden:[]}),[j,M]=(0,i.useState)(new Set),[N,P]=(0,i.useState)(null),[F,I]=(0,i.useState)(g),[L,ee]=(0,i.useState)(void 0);F!==g&&(I(g),M(new Set),ee(m),P(null));let te=(0,i.useMemo)(()=>new Set(m??[]),[m]),R=j;m!==void 0&&(R=m===L?new Set:te);let z=(0,i.useRef)(g);(0,i.useEffect)(()=>{z.current!==g&&(z.current=g,h?.([]))},[g,h]);let[B,V]=(0,i.useState)(0),[H,U]=(0,i.useState)(0),W=(0,i.useRef)(null),ne=(0,i.useRef)(new Map),re=(0,i.useRef)(!1),G=(p?.length??0)>0,ie=e=>u?.(e)??r(e),K=(0,i.useMemo)(()=>c.map(e=>({id:e.id,accessorFn:t=>e.sortValue?.(t)??null,enableSorting:e.sortValue!==void 0})),[c]),q=(0,d.useTable)({features:T,data:t,columns:K,state:{sorting:D},onSortingChange:O}).getRowModel().rows.map(e=>e.original),ae=_??k,J=c.filter(e=>e.hideable===!1||!ae.hidden.includes(e.id)),oe=[G?`2.75rem`:null,...J.map(e=>e.width??`minmax(8rem, 1fr)`),f?.length?`3.25rem`:null].filter(Boolean).join(` `),Y=q.length,se=Math.max(1,Math.floor(S/x)),ce=Math.max(0,Math.floor(H/x)-w),le=Math.min(Y,Math.ceil((H+S)/x)+w),ue=Math.min(B,Math.max(0,Y-1));(0,i.useEffect)(()=>{re.current&&(re.current=!1,ne.current.get(ue)?.focus())},[ue,ce]);function de(e){m===void 0&&M(e),h?.([...e])}function fe(e,t){let[n,i]=e<=t?[e,t]:[t,e];de(new Set(q.slice(n,i+1).map(r)))}function pe(e){let t=r(q[e]),n=new Set(R);n.has(t)?n.delete(t):n.add(t),de(n),P(e)}function X(e,t){let n=Math.max(0,Math.min(Y-1,e));if(t&&G){let e=N??ue;P(e),fe(e,n)}let r=W.current,i=n*x;if(r){let e=r.scrollTop;i<e?e=i:i+x>e+S&&(e=i+x-S),e!==r.scrollTop&&(r.scrollTop=e,U(e))}re.current=!0,V(n)}function me(e,t){if(e.target!==e.currentTarget)return;let n=e.shiftKey;switch(e.key){case`ArrowDown`:X(t+1,n);break;case`ArrowUp`:X(t-1,n);break;case`PageDown`:X(t+se,n);break;case`PageUp`:X(t-se,n);break;case`Home`:X(0,n);break;case`End`:X(Y-1,n);break;case` `:if(!G)return;pe(t);break;case`Enter`:if(!b)return;b(q[t]);break;case`Escape`:if(!G||R.size===0)return;de(new Set),P(null);break;case`a`:case`A`:if(!G||!(e.ctrlKey||e.metaKey))return;de(new Set(q.map(r)));break;default:return}e.preventDefault()}function he(e,t){if(!e.target.closest(`button, a, input, [role='checkbox']`)&&(V(t),G)){if(e.shiftKey){let e=N??ue;P(e),fe(e,t)}else e.metaKey||e.ctrlKey?pe(t):(de(new Set([r(q[t])])),P(t))}}function ge(e){let t=D.find(t=>t.id===e);t?t.desc?O([]):O([{id:e,desc:!0}]):O([{id:e,desc:!1}])}function _e(e,t){let n={hidden:t?[...ae.hidden,e]:ae.hidden.filter(t=>t!==e)};_===void 0&&A(n),v?.(n)}let ve=q.filter(e=>R.has(r(e))),Z=Y>0&&ve.length===Y,Q=c.filter(e=>e.hideable!==!1);return(0,a.jsxs)(`div`,{"data-slot":`bento-data-table`,className:`bento-glass overflow-hidden rounded-2xl`,children:[(0,a.jsxs)(`div`,{className:`flex min-h-12 flex-wrap items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,a.jsx)(`span`,{"aria-live":`polite`,className:`text-sm font-medium`,children:ve.length>0?E(`bento.table.selected`,{defaultValue:`{{count}} selected`,count:ve.length}):``}),ve.length>0&&(0,a.jsxs)(`div`,{role:`toolbar`,"aria-label":E(`bento.table.selectionActions`,{defaultValue:`Actions on the selection`}),className:`flex flex-wrap items-center gap-2`,children:[p?.map(t=>{let r=t.icon;return(0,a.jsxs)(n.J,{variant:`outline`,size:`sm`,className:e.t(`gap-1.5`,t.tone===`destructive`&&`bento-item-danger`),onClick:()=>t.onSelect(ve),children:[(0,a.jsx)(r,{size:16}),t.label]},t.id)}),(0,a.jsx)(n.J,{variant:`ghost`,size:`sm`,onClick:()=>de(new Set),children:E(`bento.table.clearSelection`,{defaultValue:`Clear selection`})})]}),Q.length>0&&(0,a.jsxs)(n.M,{children:[(0,a.jsx)(n.K,{asChild:!0,children:(0,a.jsxs)(n.J,{variant:`ghost`,size:`sm`,className:`ml-auto gap-1.5`,children:[(0,a.jsx)(s.IconColumns3,{size:16,"aria-hidden":`true`}),E(`bento.table.columns`,{defaultValue:`Columns`})]})}),(0,a.jsx)(n.P,{align:`end`,className:`bento-dropdown min-w-44 p-1.5`,children:Q.map(e=>(0,a.jsx)(n.N,{checked:!ae.hidden.includes(e.id),onCheckedChange:t=>_e(e.id,t!==!0),onSelect:e=>e.preventDefault(),children:e.header},e.id))})]})]}),(0,a.jsxs)(`div`,{role:`grid`,"aria-label":l,"aria-rowcount":Y+1,"aria-colcount":J.length+ +!!G+ +!!f?.length,"aria-multiselectable":G?`true`:void 0,children:[(0,a.jsx)(`div`,{role:`rowgroup`,children:(0,a.jsxs)(`div`,{role:`row`,"aria-rowindex":1,className:`grid items-center border-b border-border/50 px-1 text-xs font-medium text-muted-foreground`,style:{gridTemplateColumns:oe,minHeight:x},children:[G&&(0,a.jsx)(`div`,{role:`columnheader`,className:`grid place-items-center`,children:(0,a.jsx)(n.q,{"aria-label":E(`bento.table.selectAll`,{defaultValue:`Select all rows`}),checked:Z?!0:ve.length>0&&`indeterminate`,onCheckedChange:()=>de(Z?new Set:new Set(q.map(r)))})}),J.map(e=>{let t=D.find(t=>t.id===e.id),n=t?t.desc?`descending`:`ascending`:`none`;return(0,a.jsx)(`div`,{role:`columnheader`,"aria-sort":e.sortValue?n:void 0,className:`min-w-0 px-2`,children:e.sortValue?(0,a.jsxs)(`button`,{type:`button`,onClick:()=>ge(e.id),className:`inline-flex max-w-full items-center gap-1 rounded-md py-1 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,a.jsx)(`span`,{className:`truncate`,children:e.header}),n===`ascending`&&(0,a.jsx)(s.IconArrowUp,{size:14,"aria-hidden":`true`}),n===`descending`&&(0,a.jsx)(s.IconArrowDown,{size:14,"aria-hidden":`true`}),n===`none`&&(0,a.jsx)(s.IconArrowsSort,{size:14,"aria-hidden":`true`,className:`opacity-40`})]}):(0,a.jsx)(`span`,{className:`block truncate py-1`,children:e.header})},e.id)}),f?.length?(0,a.jsx)(`div`,{role:`columnheader`,className:`px-2`,children:(0,a.jsx)(`span`,{className:`sr-only`,children:E(`bento.table.actions`,{defaultValue:`Actions`})})}):null]})}),Y===0?(0,a.jsx)(`div`,{role:`rowgroup`,children:(0,a.jsx)(`div`,{role:`row`,"aria-rowindex":2,children:(0,a.jsx)(`div`,{role:`gridcell`,className:`px-4 py-10 text-center text-sm text-muted-foreground`,children:C??E(`bento.table.empty`,{defaultValue:`Nothing to show`})})})}):(0,a.jsx)(`div`,{role:`rowgroup`,ref:W,onScroll:e=>U(e.currentTarget.scrollTop),className:`relative overflow-y-auto`,style:{height:S},children:(0,a.jsx)(`div`,{style:{height:Y*x},className:`relative`,children:q.slice(ce,le).map((t,i)=>{let o=ce+i,s=r(t),c=R.has(s),l=ie(t);return(0,a.jsxs)(`div`,{ref:e=>{e?ne.current.set(o,e):ne.current.delete(o)},role:`row`,"aria-rowindex":o+2,"aria-selected":G?c?`true`:`false`:void 0,tabIndex:o===ue?0:-1,onKeyDown:e=>me(e,o),onClick:e=>he(e,o),onDoubleClick:()=>b?.(t),onFocus:e=>{e.target===e.currentTarget&&V(o)},className:e.t(`absolute inset-x-0 grid items-center border-b border-border/30 px-1 text-sm outline-none transition-colors`,`hover:bg-muted/40 focus-visible:bg-muted/60 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,c&&`bg-primary/10 hover:bg-primary/15`),style:{top:o*x,height:x,gridTemplateColumns:oe},children:[G&&(0,a.jsx)(`div`,{role:`gridcell`,className:`grid place-items-center`,children:(0,a.jsx)(n.q,{tabIndex:-1,"aria-label":E(`bento.table.selectRow`,{defaultValue:`Select {{row}}`,row:l}),checked:c,onCheckedChange:()=>pe(o)})}),J.map(e=>(0,a.jsx)(`div`,{role:`gridcell`,className:`min-w-0 truncate px-2`,children:e.cell(t)},e.id)),f?.length?(0,a.jsx)(`div`,{role:`gridcell`,className:`grid place-items-center`,children:(0,a.jsx)(y,{triggerLabel:E(`bento.table.rowActions`,{defaultValue:`Actions for {{row}}`,row:l}),actions:f.map(e=>({id:e.id,label:e.label,icon:e.icon,tone:e.tone,onSelect:()=>e.onSelect([t])}))})}):null]},s)})})})]})]})}function D({icon:t=s.IconSparkles,tone:n=`indigo`,title:r,description:i,action:o,align:c=`center`,titleLevel:l=2,className:u}){let d=S(n),f=c===`center`,p=`h${l}`;return(0,a.jsxs)(`div`,{className:e.t(`bento-tile bento-glass flex flex-col gap-3 rounded-3xl p-8`,f?`items-center text-center`:`items-start text-left`,u),children:[(0,a.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl ${d} text-white shadow-md`,children:(0,a.jsx)(t,{size:24})}),(0,a.jsx)(p,{className:`m-0 text-lg font-semibold tracking-tight`,children:r}),i&&(0,a.jsx)(`p`,{className:e.t(`max-w-md text-sm text-muted-foreground`,f&&`mx-auto`),children:i}),o&&(0,a.jsx)(`div`,{className:e.t(`mt-1`,f&&`mx-auto`),children:o})]})}var O=4;function k({steps:e}){let{t}=(0,o.useTranslation)(),n=e.length>O,r=t=>n&&t>0&&t<e.length-2;return(0,a.jsx)(`nav`,{"aria-label":t(`bento.trail.label`,{defaultValue:`Location`}),"data-slot":`bento-trail`,children:(0,a.jsx)(`ol`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:e.map((e,t)=>(0,a.jsxs)(`li`,{className:r(t)?`sr-only`:`inline-flex min-w-0 items-center gap-1`,children:[t>0&&!r(t)&&(0,a.jsx)(s.IconChevronRight,{size:12,"aria-hidden":!0,className:`shrink-0 opacity-60`}),(0,a.jsx)(u.Link,{to:e.to,className:`max-w-[16ch] truncate hover:text-foreground`,children:e.label}),n&&t===0&&(0,a.jsxs)(`span`,{"aria-hidden":!0,className:`inline-flex items-center gap-1`,children:[(0,a.jsx)(s.IconChevronRight,{size:12,className:`shrink-0 opacity-60`}),`…`]})]},`${e.to}-${t}`))})})}function A({to:e,children:t}){return(0,a.jsxs)(u.Link,{to:e,className:`inline-flex items-center gap-1 hover:text-foreground`,children:[(0,a.jsx)(s.IconArrowLeft,{size:14,"aria-hidden":!0}),t]})}function j(e,t,n){return e&&e.length>1?(0,a.jsx)(k,{steps:e}):e&&e.length===1?(0,a.jsx)(A,{to:e[0].to,children:e[0].label}):t==null?null:(0,a.jsx)(A,{to:t,children:n})}function M({eyebrow:e,backTo:t,backLabel:n,trail:r,title:i,subtitle:o,leading:s,trailing:c}){let l=e??j(r,t,n);return(0,a.jsx)(`header`,{className:`bento-shell-header mb-6 flex flex-col items-start gap-3 md:mb-10`,children:(0,a.jsxs)(`div`,{className:`flex w-full items-start gap-4`,children:[s&&(0,a.jsx)(`div`,{className:`shrink-0`,children:s}),(0,a.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1`,children:[l&&(0,a.jsx)(`span`,{className:`text-xs uppercase tracking-[0.18em] text-muted-foreground`,children:l}),(0,a.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight md:text-4xl`,children:i}),o&&(0,a.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:o})]}),c&&(0,a.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:c})]})})}function N({value:e,onChange:t,onClear:r,defaultIcon:l,tone:u,title:d,description:f,readOnly:p=!1}){let{t:m}=(0,o.useTranslation)(),[h,g]=(0,i.useState)(!1);return p?(0,a.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl ${S(u)} text-white shadow-md`,children:e?(0,a.jsx)(c.Icon,{icon:e,className:`size-6 text-white`}):(0,a.jsx)(l,{size:24})}):(0,a.jsxs)(`div`,{className:`group relative`,children:[(0,a.jsxs)(`button`,{type:`button`,onClick:()=>g(!0),"aria-label":m(`forms.iconPicker.chooseAnIcon`),className:`group/icon relative grid h-12 w-12 cursor-pointer place-items-center overflow-hidden rounded-2xl ${S(u)} text-white shadow-md outline-none transition-all duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] hover:scale-105 focus-visible:ring-2 focus-visible:ring-ring active:scale-95`,children:[e?(0,a.jsx)(c.Icon,{icon:e,className:`size-6 text-white`}):(0,a.jsx)(l,{size:24}),(0,a.jsx)(`span`,{className:`pointer-events-none absolute inset-0 grid place-items-center bg-black/40 opacity-0 transition-opacity duration-200 group-hover/icon:opacity-100`,children:(0,a.jsx)(s.IconPalette,{className:`size-5 text-white`})})]}),e&&r&&(0,a.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),r()},"aria-label":m(`forms.common.remove`),title:m(`forms.common.remove`),className:`absolute -right-1.5 -top-1.5 grid h-5 w-5 cursor-pointer place-items-center rounded-full border border-border/60 bg-card/90 text-foreground opacity-0 shadow-md backdrop-blur transition-opacity duration-200 bento-clear focus-visible:opacity-100 group-hover:opacity-100`,children:(0,a.jsx)(s.IconX,{size:12})}),(0,a.jsx)(n.j,{open:h,onOpenChange:g,value:e,onSelect:t,onClear:r,title:d,description:f})]})}function P({value:n,onSave:r,multiline:s=!1,placeholder:c,className:l,ariaLabel:u,autoFocus:d=!1,readOnly:f=!1,commitOnChange:p=!1}){let{t:m}=(0,o.useTranslation)(),[h,g]=(0,i.useState)(d),[_,v]=(0,i.useState)(n),[y,b]=(0,i.useState)(!1),x=(0,i.useRef)(null),S=(0,i.useRef)(null),C=(0,i.useRef)(!1),w=(0,i.useRef)(!1),[T,E]=(0,i.useState)(n);!h&&n!==T&&(E(n),v(n)),(0,i.useEffect)(()=>{h&&x.current?(x.current.focus(),x.current.select()):!h&&w.current&&(w.current=!1,S.current?.focus())},[h]);function D(){w.current=x.current!==null&&document.activeElement===x.current,g(!1)}async function O(){if(C.current)return;let e=_.trim();if(e===n){D();return}if(!e&&!c){v(n),D();return}C.current=!0,b(!0);try{await r(e)}catch{v(n)}finally{C.current=!1,b(!1),D()}}function k(){v(n),D()}function A(e){v(e),p&&r(e)}let j=!n;if(f)return(0,a.jsx)(`span`,{className:e.t(`block w-full`,l),"aria-label":u,children:n||(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:c??`—`})});let M=`w-full bg-transparent outline-none border-b transition-colors duration-200`,N=e.t(M,`cursor-text rounded-sm`,j?`border-dashed border-border/70 hover:border-foreground/40`:`border-transparent hover:border-border/60 focus-visible:border-border/80`),P=e.t(M,`bento-editing`);if(!h)return(0,a.jsx)(`button`,{ref:S,type:`button`,onClick:()=>g(!0),className:e.t(N,`text-left`,l),"aria-label":u??m(`forms.formActions.edit`),children:n||(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:c??`—`})});function F(e){if(e.key===`Escape`){e.preventDefault(),k();return}e.key===`Enter`&&(!s||e.metaKey||e.ctrlKey)&&(e.preventDefault(),O())}return s?(0,a.jsx)(`textarea`,{ref:x,value:_,onChange:e=>A(e.target.value),onBlur:O,onKeyDown:F,placeholder:c,"aria-label":u,"aria-busy":y||void 0,rows:3,className:e.t(P,`resize-none py-0.5 leading-snug`,l)}):(0,a.jsx)(t.a,{ref:x,value:_,onChange:e=>A(e.target.value),onBlur:O,onKeyDown:F,placeholder:c,"aria-label":u,"aria-busy":y||void 0,className:e.t(P,`h-auto px-0 py-0 shadow-none focus-visible:ring-0`,l)})}function F({titleMissing:t,dirty:n,className:r}){let{t:i}=(0,o.useTranslation)();if(!t&&!n)return null;let c=`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-medium normal-case leading-none tracking-normal`;return t?(0,a.jsxs)(`span`,{className:e.t(c,`bento-status bento-status-error`,r),children:[(0,a.jsx)(s.IconAlertTriangle,{className:`size-3`}),i(`bento.saveBar.titleRequired`,{defaultValue:`Title required`})]}):(0,a.jsxs)(`span`,{className:e.t(c,`bento-status bento-status-warn`,r),children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bento-status-dot bento-pulse`}),i(`bento.saveBar.unsaved`,{defaultValue:`Unsaved changes`})]})}function I(e){(0,i.useEffect)(()=>{let t=e.current;if(!t)return;let n=document.documentElement,r=0,i=()=>{r=0;let e=t.getBoundingClientRect().top,i=Math.max(0,Math.min(1,(160-e)/80));n.style.setProperty(`--bento-fade`,String(i)),n.classList.toggle(`bento-fade-half`,i>.5)},a=()=>{r||=requestAnimationFrame(i)};return i(),window.addEventListener(`scroll`,a,{passive:!0}),window.addEventListener(`resize`,a),()=>{r&&cancelAnimationFrame(r),window.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a),n.style.removeProperty(`--bento-fade`),n.classList.remove(`bento-fade-half`)}},[e])}function L(e,t){let n={};for(let r of Object.keys(e))Object.assign(n,{[r]:t[r]});return n}function ee({entity:e,isNew:n,headlineFallback:c,eyebrow:l,listRoute:d,trail:f,icon:p,tone:m,formId:g,feature:_,hasStatus:v=!1,hideIcon:b=!1,readOnly:x=!1,autosaveOnly:S=!1,badge:C,notice:w,onUpdate:T,onDelete:E,extraActions:D,children:O}){let{t:j}=(0,o.useTranslation)(),ee=(0,u.useNavigate)(),[te,R]=(0,i.useState)(!1),[z,B]=(0,i.useState)({isDirty:!1,isSubmitting:!1}),V=(0,i.useRef)(null);I(V);let H={title:e.title??``,description:e.description??``,icon:e.icon??null,enabled:e.enabled??1},[U,W]=(0,i.useState)(H),[ne,re]=(0,i.useState)(H);(H.title!==ne.title||H.description!==ne.description||H.icon!==ne.icon||H.enabled!==ne.enabled)&&(re(H),W(H));async function G(t){if(W(e=>({...e,...t})),n||!T)return;let r=t.title??U.title;try{await T({...e,...t}),h.toast.success(j(`forms.common.updated`,{name:r,feature:_}))}catch(e){console.error(`Failed to update entity field`,e),W(e=>({...e,...L(t,H)})),h.toast.error(j(`forms.common.notUpdated`,{name:H.title||r,feature:_}))}}async function ie(){if(E){try{await E()?(h.toast.success(j(`forms.common.deleted`,{name:U.title,feature:_})),ee(d)):h.toast.error(j(`forms.common.notDeleted`,{name:U.title,feature:_}))}catch(e){console.error(`Failed to delete entity`,e),h.toast.error(j(`forms.common.notDeleted`,{name:U.title,feature:_}))}R(!1)}}let K=U.enabled===1,q=!x,ae=!(S&&!n),J=!U.title.trim(),oe=!n&&!z.isDirty,Y=J||oe,se=[...D??[],...E&&!x?[{id:`entity.delete`,label:j(`forms.formActions.delete`),icon:s.IconTrash,tone:`destructive`,onSelect:()=>R(!0)}]:[]];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(M,{eyebrow:(0,a.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[f&&f.length>1?(0,a.jsx)(k,{steps:f}):(0,a.jsx)(A,{to:d,children:l}),!x&&(0,a.jsx)(F,{titleMissing:J,dirty:n||z.isDirty})]}),leading:(0,a.jsx)(N,{value:U.icon,onChange:e=>G({icon:e}),onClear:()=>G({icon:null}),defaultIcon:p,tone:m,title:U.title,description:U.description,readOnly:x||b}),title:(0,a.jsx)(P,{value:U.title,onSave:e=>G({title:e}),placeholder:c,className:`text-3xl font-semibold tracking-tight md:text-4xl`,ariaLabel:j(`forms.common.title`),autoFocus:n,commitOnChange:n,readOnly:x}),subtitle:(0,a.jsx)(P,{value:U.description,onSave:e=>G({description:e}),multiline:!0,placeholder:j(`forms.common.description`),className:`max-w-2xl text-sm text-muted-foreground`,ariaLabel:j(`forms.common.description`),commitOnChange:n,readOnly:x}),trailing:(0,a.jsxs)(a.Fragment,{children:[q&&(0,a.jsxs)(`div`,{className:`bento-fade-out flex shrink-0 items-center gap-2`,children:[ae&&(0,a.jsxs)(t.o,{type:`submit`,form:g,size:`sm`,loading:z.isSubmitting,"aria-disabled":Y?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),j(`forms.formActions.saveChanges`)]}),(0,a.jsxs)(t.o,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>ee(d),children:[(0,a.jsx)(s.IconX,{className:`size-4`}),j(`forms.formActions.cancel`)]})]}),C,v&&(x?(0,a.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-wider ${K?`bento-status bento-status-on`:`border-border bg-muted text-muted-foreground`}`,children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${K?`bento-status-dot bento-pulse`:`bg-muted-foreground/60`}`}),K?j(`common.active`,{defaultValue:`Active`}):j(`common.idle`,{defaultValue:`Idle`})]}):(0,a.jsxs)(`button`,{type:`button`,onClick:()=>G({enabled:+!K}),"aria-label":j(`forms.common.enabled`),title:j(K?`common.activeToggleHint`:`common.idleToggleHint`),className:`bento-tile-clickable flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-wider transition-colors duration-200 ${K?`bento-status bento-status-on`:`border-border bg-muted text-muted-foreground hover:bg-muted/80`}`,children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${K?`bento-status-dot bento-pulse`:`bg-muted-foreground/60`}`}),K?j(`common.active`,{defaultValue:`Active`}):j(`common.idle`,{defaultValue:`Idle`})]})),!n&&se.length>0&&(0,a.jsx)(y,{actions:se})]})}),(0,a.jsx)(`div`,{ref:V,"aria-hidden":!0,className:`h-px`}),w,!n&&E&&(0,a.jsx)(r.r,{feature:_,name:U.title,onDelete:ie,open:te,setOpen:R,trigger:(0,a.jsx)(`span`,{className:`hidden`,"aria-hidden":!0})}),O({staged:U,onStateChange:B})]})}var te={added:`bento-status bento-status-on`,removed:`bento-status bento-status-error`,changed:`bento-status bento-status-warn`,unchanged:!1};function R({state:t,compact:n=!1,className:r}){let{t:i}=(0,o.useTranslation)(),s={added:i(`bento.diff.added`,{defaultValue:`Added`}),removed:i(`bento.diff.removed`,{defaultValue:`Removed`}),changed:i(`bento.diff.changed`,{defaultValue:`Changed`}),unchanged:i(`bento.diff.unchanged`,{defaultValue:`Unchanged`})}[t],c=e.t(`rounded-full border px-1.5 leading-4`,n&&`font-mono`,te[t],r);if(!n)return(0,a.jsx)(`span`,{"data-slot":`bento-change-mark`,"data-state":t,className:c,children:s});let l={added:i(`bento.diff.addedLetter`,{defaultValue:`A`}),removed:i(`bento.diff.removedLetter`,{defaultValue:`D`}),changed:i(`bento.diff.changedLetter`,{defaultValue:`M`}),unchanged:i(`bento.diff.unchangedLetter`,{defaultValue:`·`})}[t];return(0,a.jsxs)(`span`,{"data-slot":`bento-change-mark`,"data-state":t,title:s,className:c,children:[(0,a.jsx)(`span`,{"aria-hidden":`true`,children:l}),(0,a.jsx)(`span`,{className:`sr-only`,children:s})]})}function z(e,t,n=!0){let r=e.length,i=t.length;if(r*i>4e5)return null;let a=Array.from({length:r+1},()=>new Uint32Array(i+1));for(let n=r-1;n>=0;n--)for(let r=i-1;r>=0;r--)a[n][r]=e[n]===t[r]?a[n+1][r+1]+1:Math.max(a[n+1][r],a[n][r+1]);let o=[],s=(e,t)=>{let r=o[o.length-1];n&&r?.op===e?r.text+=t:o.push({op:e,text:t})},c=0,l=0;for(;c<r&&l<i;)e[c]===t[l]?(s(`same`,e[c]),c++,l++):a[c+1][l]>=a[c][l+1]?s(`remove`,e[c++]):s(`add`,t[l++]);for(;c<r;)s(`remove`,e[c++]);for(;l<i;)s(`add`,t[l++]);return o}var B=e=>e.split(/(\s+)/).filter(e=>e!==``);function V(e){if(typeof DOMParser>`u`)return e.split(/<\/(?:p|h[1-6]|li|blockquote|pre|div)>/i).map(e=>e.replace(/<[^>]*>/g,``).replace(/\s+/g,` `).trim()).filter(Boolean);let t=new DOMParser().parseFromString(e,`text/html`),n=[...t.body.querySelectorAll(`p, h1, h2, h3, h4, h5, h6, li, blockquote, pre`)].filter(e=>!e.parentElement?.closest(`p, h1, h2, h3, h4, h5, h6, li, blockquote, pre`)).map(e=>(e.textContent??``).replace(/\s+/g,` `).trim()).filter(Boolean),r=(t.body.textContent??``).replace(/\s+/g,` `).trim();return n.length>0?n:r?[r]:[]}var H=e=>e==null?``:String(e);function U({before:t,after:n,fields:r,showUnchanged:c=!1,layout:l=`inline`}){let{t:u}=(0,o.useTranslation)(),[d,f]=(0,i.useState)(c),p=r.map(e=>{let r=t?.[e.id],i=n?.[e.id],a=e.kind??`text`,o=a===`rich`?V(H(r)).join(`
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./utils-Oagwe_oa.cjs"),t=require("./badge-locale-1_BmNTro.cjs"),n=require("./user.context-uYif5Mp2.cjs"),r=require("./loading-provider-E4tIG9BM.cjs");let i=require("react"),a=require("react/jsx-runtime"),o=require("react-i18next"),s=require("@tabler/icons-react"),c=require("@iconify/react"),l=require("react-resizable-panels"),u=require("react-router-dom"),d=require("@tanstack/react-table"),f=require("@dnd-kit/core"),p=require("@dnd-kit/sortable"),m=require("@dnd-kit/utilities"),h=require("sonner");var g={default:``,destructive:`bento-item-danger`},_=new Set;function v(e){process.env.NODE_ENV===`production`||_.has(e)||(_.add(e),console.warn(`BentoActionsMenu: the action "${e}" has no id. Give it a stable name, such as "post.delete": it is rendered as data-action-id so a console verb can be matched to an agent verb, and it becomes required in the next release.`))}function y({actions:e,triggerLabel:t}){let{t:r}=(0,o.useTranslation)();if(e.length===0)return null;for(let t of e)t.id||v(t.label);return(0,a.jsxs)(n.M,{children:[(0,a.jsx)(n.K,{asChild:!0,children:(0,a.jsx)(`button`,{type:`button`,"aria-label":t??r(`forms.formActions.moreActions`,{defaultValue:`More actions`}),className:`bento-tile-clickable inline-flex h-9 w-9 items-center justify-center rounded-full border border-border/60 bg-card/60 text-muted-foreground backdrop-blur transition-colors duration-200 hover:text-foreground`,children:(0,a.jsx)(s.IconDotsVertical,{size:18})})}),(0,a.jsx)(n.P,{align:`end`,sideOffset:8,className:`bento-dropdown min-w-44 p-1.5`,children:e.map(e=>{let t=e.icon,r=g[e.tone??`default`];return(0,a.jsxs)(n.I,{"data-action-id":e.id,onSelect:e.onSelect,disabled:e.disabled,className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2 ${r}`,children:[(0,a.jsx)(t,{size:16}),e.label]},e.id??e.label)})})]})}var b={blue:`bento-tone-blue`,indigo:`bento-tone-indigo`,violet:`bento-tone-violet`,emerald:`bento-tone-emerald`,amber:`bento-tone-amber`,rose:`bento-tone-rose`,slate:`bento-tone-slate`},x=Object.keys(b);function S(e){return`bento-chip ${b[e]??b.slate}`}function C({to:e,icon:t,tone:n,label:r,count:i,span:o}){let s=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`span`,{className:`grid h-9 w-9 place-items-center rounded-2xl text-white shadow-md ${S(n)}`,children:(0,a.jsx)(t,{size:18})}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`div`,{className:`text-3xl font-semibold tabular-nums tracking-tight`,children:i}),(0,a.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground`,children:r})]})]}),c=`bento-tile bento-glass group relative flex flex-col justify-between overflow-hidden p-4 ${o}${e?` bento-tile-clickable`:``}`;return e?(0,a.jsx)(u.Link,{to:e,className:c,children:s}):(0,a.jsx)(`div`,{className:c,children:s})}var w=6,T={rowSortingFeature:d.rowSortingFeature,coreRowModel:(0,d.createCoreRowModel)(),sortedRowModel:(0,d.createSortedRowModel)()};function E({rows:t,getRowId:r,columns:c,label:l,getRowLabel:u,rowActions:f,selectionActions:p,selectedIds:m,onSelectionChange:h,selectionScope:g,layout:_,onLayoutChange:v,onRowOpen:b,rowHeight:x=44,height:S=480,empty:C}){let{t:E}=(0,o.useTranslation)(),[D,O]=(0,i.useState)([]),[k,A]=(0,i.useState)({hidden:[]}),[j,M]=(0,i.useState)(new Set),[N,P]=(0,i.useState)(null),[F,I]=(0,i.useState)(g),[L,ee]=(0,i.useState)(void 0);F!==g&&(I(g),M(new Set),ee(m),P(null));let te=(0,i.useMemo)(()=>new Set(m??[]),[m]),R=j;m!==void 0&&(R=m===L?new Set:te);let z=(0,i.useRef)(g);(0,i.useEffect)(()=>{z.current!==g&&(z.current=g,h?.([]))},[g,h]);let[B,V]=(0,i.useState)(0),[H,U]=(0,i.useState)(0),W=(0,i.useRef)(null),ne=(0,i.useRef)(new Map),re=(0,i.useRef)(!1),G=(p?.length??0)>0,ie=e=>u?.(e)??r(e),K=(0,i.useMemo)(()=>c.map(e=>({id:e.id,accessorFn:t=>e.sortValue?.(t)??null,enableSorting:e.sortValue!==void 0})),[c]),q=(0,d.useTable)({features:T,data:t,columns:K,state:{sorting:D},onSortingChange:O}).getRowModel().rows.map(e=>e.original),ae=_??k,J=c.filter(e=>e.hideable===!1||!ae.hidden.includes(e.id)),oe=[G?`2.75rem`:null,...J.map(e=>e.width??`minmax(8rem, 1fr)`),f?.length?`3.25rem`:null].filter(Boolean).join(` `),Y=q.length,se=Math.min(S,Y*x),ce=Math.max(1,Math.floor(se/x)),le=Math.max(0,Math.floor(H/x)-w),ue=Math.min(Y,Math.ceil((H+se)/x)+w),de=Math.min(B,Math.max(0,Y-1));(0,i.useEffect)(()=>{re.current&&(re.current=!1,ne.current.get(de)?.focus())},[de,le]);function fe(e){m===void 0&&M(e),h?.([...e])}function pe(e,t){let[n,i]=e<=t?[e,t]:[t,e];fe(new Set(q.slice(n,i+1).map(r)))}function me(e){let t=r(q[e]),n=new Set(R);n.has(t)?n.delete(t):n.add(t),fe(n),P(e)}function X(e,t){let n=Math.max(0,Math.min(Y-1,e));if(t&&G){let e=N??de;P(e),pe(e,n)}let r=W.current,i=n*x;if(r){let e=r.scrollTop;i<e?e=i:i+x>e+se&&(e=i+x-se),e!==r.scrollTop&&(r.scrollTop=e,U(e))}re.current=!0,V(n)}function he(e,t){if(e.target!==e.currentTarget)return;let n=e.shiftKey;switch(e.key){case`ArrowDown`:X(t+1,n);break;case`ArrowUp`:X(t-1,n);break;case`PageDown`:X(t+ce,n);break;case`PageUp`:X(t-ce,n);break;case`Home`:X(0,n);break;case`End`:X(Y-1,n);break;case` `:if(!G)return;me(t);break;case`Enter`:if(!b)return;b(q[t]);break;case`Escape`:if(!G||R.size===0)return;fe(new Set),P(null);break;case`a`:case`A`:if(!G||!(e.ctrlKey||e.metaKey))return;fe(new Set(q.map(r)));break;default:return}e.preventDefault()}function ge(e,t){if(!e.target.closest(`button, a, input, [role='checkbox']`)&&(V(t),G)){if(e.shiftKey){let e=N??de;P(e),pe(e,t)}else e.metaKey||e.ctrlKey?me(t):(fe(new Set([r(q[t])])),P(t))}}function _e(e){let t=D.find(t=>t.id===e);t?t.desc?O([]):O([{id:e,desc:!0}]):O([{id:e,desc:!1}])}function ve(e,t){let n={hidden:t?[...ae.hidden,e]:ae.hidden.filter(t=>t!==e)};_===void 0&&A(n),v?.(n)}let Z=q.filter(e=>R.has(r(e))),Q=Y>0&&Z.length===Y,ye=c.filter(e=>e.hideable!==!1);return(0,a.jsxs)(`div`,{"data-slot":`bento-data-table`,className:`bento-glass overflow-hidden rounded-2xl`,children:[(0,a.jsxs)(`div`,{className:`flex min-h-12 flex-wrap items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,a.jsx)(`span`,{"aria-live":`polite`,className:`text-sm font-medium`,children:Z.length>0?E(`bento.table.selected`,{defaultValue:`{{count}} selected`,count:Z.length}):``}),Z.length>0&&(0,a.jsxs)(`div`,{role:`toolbar`,"aria-label":E(`bento.table.selectionActions`,{defaultValue:`Actions on the selection`}),className:`flex flex-wrap items-center gap-2`,children:[p?.map(t=>{let r=t.icon;return(0,a.jsxs)(n.J,{variant:`outline`,size:`sm`,className:e.t(`gap-1.5`,t.tone===`destructive`&&`bento-item-danger`),onClick:()=>t.onSelect(Z),children:[(0,a.jsx)(r,{size:16}),t.label]},t.id)}),(0,a.jsx)(n.J,{variant:`ghost`,size:`sm`,onClick:()=>fe(new Set),children:E(`bento.table.clearSelection`,{defaultValue:`Clear selection`})})]}),ye.length>0&&(0,a.jsxs)(n.M,{children:[(0,a.jsx)(n.K,{asChild:!0,children:(0,a.jsxs)(n.J,{variant:`ghost`,size:`sm`,className:`ml-auto gap-1.5`,children:[(0,a.jsx)(s.IconColumns3,{size:16,"aria-hidden":`true`}),E(`bento.table.columns`,{defaultValue:`Columns`})]})}),(0,a.jsx)(n.P,{align:`end`,className:`bento-dropdown min-w-44 p-1.5`,children:ye.map(e=>(0,a.jsx)(n.N,{checked:!ae.hidden.includes(e.id),onCheckedChange:t=>ve(e.id,t!==!0),onSelect:e=>e.preventDefault(),children:e.header},e.id))})]})]}),(0,a.jsxs)(`div`,{role:`grid`,"aria-label":l,"aria-rowcount":Y+1,"aria-colcount":J.length+ +!!G+ +!!f?.length,"aria-multiselectable":G?`true`:void 0,children:[(0,a.jsx)(`div`,{role:`rowgroup`,children:(0,a.jsxs)(`div`,{role:`row`,"aria-rowindex":1,className:`grid items-center border-b border-border/50 px-1 text-xs font-medium text-muted-foreground`,style:{gridTemplateColumns:oe,minHeight:x},children:[G&&(0,a.jsx)(`div`,{role:`columnheader`,className:`grid place-items-center`,children:(0,a.jsx)(n.q,{"aria-label":E(`bento.table.selectAll`,{defaultValue:`Select all rows`}),checked:Q?!0:Z.length>0&&`indeterminate`,onCheckedChange:()=>fe(Q?new Set:new Set(q.map(r)))})}),J.map(e=>{let t=D.find(t=>t.id===e.id),n=t?t.desc?`descending`:`ascending`:`none`;return(0,a.jsx)(`div`,{role:`columnheader`,"aria-sort":e.sortValue?n:void 0,className:`min-w-0 px-2`,children:e.sortValue?(0,a.jsxs)(`button`,{type:`button`,onClick:()=>_e(e.id),className:`inline-flex max-w-full items-center gap-1 rounded-md py-1 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,a.jsx)(`span`,{className:`truncate`,children:e.header}),n===`ascending`&&(0,a.jsx)(s.IconArrowUp,{size:14,"aria-hidden":`true`}),n===`descending`&&(0,a.jsx)(s.IconArrowDown,{size:14,"aria-hidden":`true`}),n===`none`&&(0,a.jsx)(s.IconArrowsSort,{size:14,"aria-hidden":`true`,className:`opacity-40`})]}):(0,a.jsx)(`span`,{className:`block truncate py-1`,children:e.header})},e.id)}),f?.length?(0,a.jsx)(`div`,{role:`columnheader`,className:`px-2`,children:(0,a.jsx)(`span`,{className:`sr-only`,children:E(`bento.table.actions`,{defaultValue:`Actions`})})}):null]})}),Y===0?(0,a.jsx)(`div`,{role:`rowgroup`,children:(0,a.jsx)(`div`,{role:`row`,"aria-rowindex":2,children:(0,a.jsx)(`div`,{role:`gridcell`,className:`px-4 py-10 text-center text-sm text-muted-foreground`,children:C??E(`bento.table.empty`,{defaultValue:`Nothing to show`})})})}):(0,a.jsx)(`div`,{role:`rowgroup`,ref:W,onScroll:e=>U(e.currentTarget.scrollTop),className:`relative overflow-y-auto`,style:{height:se},children:(0,a.jsx)(`div`,{style:{height:Y*x},className:`relative`,children:q.slice(le,ue).map((t,i)=>{let o=le+i,s=r(t),c=R.has(s),l=ie(t);return(0,a.jsxs)(`div`,{ref:e=>{e?ne.current.set(o,e):ne.current.delete(o)},role:`row`,"aria-rowindex":o+2,"aria-selected":G?c?`true`:`false`:void 0,tabIndex:o===de?0:-1,onKeyDown:e=>he(e,o),onClick:e=>ge(e,o),onDoubleClick:()=>b?.(t),onFocus:e=>{e.target===e.currentTarget&&V(o)},className:e.t(`absolute inset-x-0 grid items-center border-b border-border/30 px-1 text-sm outline-none transition-colors`,`hover:bg-muted/40 focus-visible:bg-muted/60 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,c&&`bg-primary/10 hover:bg-primary/15`),style:{top:o*x,height:x,gridTemplateColumns:oe},children:[G&&(0,a.jsx)(`div`,{role:`gridcell`,className:`grid place-items-center`,children:(0,a.jsx)(n.q,{tabIndex:-1,"aria-label":E(`bento.table.selectRow`,{defaultValue:`Select {{row}}`,row:l}),checked:c,onCheckedChange:()=>me(o)})}),J.map(e=>(0,a.jsx)(`div`,{role:`gridcell`,className:`min-w-0 truncate px-2`,children:e.cell(t)},e.id)),f?.length?(0,a.jsx)(`div`,{role:`gridcell`,className:`grid place-items-center`,children:(0,a.jsx)(y,{triggerLabel:E(`bento.table.rowActions`,{defaultValue:`Actions for {{row}}`,row:l}),actions:f.map(e=>({id:e.id,label:e.label,icon:e.icon,tone:e.tone,onSelect:()=>e.onSelect([t])}))})}):null]},s)})})})]})]})}function D({icon:t=s.IconSparkles,tone:n=`indigo`,title:r,description:i,action:o,align:c=`center`,titleLevel:l=2,className:u}){let d=S(n),f=c===`center`,p=`h${l}`;return(0,a.jsxs)(`div`,{className:e.t(`bento-tile bento-glass flex flex-col gap-3 rounded-3xl p-8`,f?`items-center text-center`:`items-start text-left`,u),children:[(0,a.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl ${d} text-white shadow-md`,children:(0,a.jsx)(t,{size:24})}),(0,a.jsx)(p,{className:`m-0 text-lg font-semibold tracking-tight`,children:r}),i&&(0,a.jsx)(`p`,{className:e.t(`max-w-md text-sm text-muted-foreground`,f&&`mx-auto`),children:i}),o&&(0,a.jsx)(`div`,{className:e.t(`mt-1`,f&&`mx-auto`),children:o})]})}var O=4;function k({steps:e}){let{t}=(0,o.useTranslation)(),n=e.length>O,r=t=>n&&t>0&&t<e.length-2;return(0,a.jsx)(`nav`,{"aria-label":t(`bento.trail.label`,{defaultValue:`Location`}),"data-slot":`bento-trail`,children:(0,a.jsx)(`ol`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:e.map((e,t)=>(0,a.jsxs)(`li`,{className:r(t)?`sr-only`:`inline-flex min-w-0 items-center gap-1`,children:[t>0&&!r(t)&&(0,a.jsx)(s.IconChevronRight,{size:12,"aria-hidden":!0,className:`shrink-0 opacity-60`}),(0,a.jsx)(u.Link,{to:e.to,className:`max-w-[16ch] truncate hover:text-foreground`,children:e.label}),n&&t===0&&(0,a.jsxs)(`span`,{"aria-hidden":!0,className:`inline-flex items-center gap-1`,children:[(0,a.jsx)(s.IconChevronRight,{size:12,className:`shrink-0 opacity-60`}),`…`]})]},`${e.to}-${t}`))})})}function A({to:e,children:t}){return(0,a.jsxs)(u.Link,{to:e,className:`inline-flex items-center gap-1 hover:text-foreground`,children:[(0,a.jsx)(s.IconArrowLeft,{size:14,"aria-hidden":!0}),t]})}function j(e,t,n){return e&&e.length>1?(0,a.jsx)(k,{steps:e}):e&&e.length===1?(0,a.jsx)(A,{to:e[0].to,children:e[0].label}):t==null?null:(0,a.jsx)(A,{to:t,children:n})}function M({eyebrow:e,backTo:t,backLabel:n,trail:r,title:i,subtitle:o,leading:s,trailing:c}){let l=e??j(r,t,n);return(0,a.jsx)(`header`,{className:`bento-shell-header mb-6 flex flex-col items-start gap-3 md:mb-10`,children:(0,a.jsxs)(`div`,{className:`flex w-full items-start gap-4`,children:[s&&(0,a.jsx)(`div`,{className:`shrink-0`,children:s}),(0,a.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1`,children:[l&&(0,a.jsx)(`span`,{className:`text-xs uppercase tracking-[0.18em] text-muted-foreground`,children:l}),(0,a.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight md:text-4xl`,children:i}),o&&(0,a.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:o})]}),c&&(0,a.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:c})]})})}function N({value:e,onChange:t,onClear:r,defaultIcon:l,tone:u,title:d,description:f,readOnly:p=!1}){let{t:m}=(0,o.useTranslation)(),[h,g]=(0,i.useState)(!1);return p?(0,a.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl ${S(u)} text-white shadow-md`,children:e?(0,a.jsx)(c.Icon,{icon:e,className:`size-6 text-white`}):(0,a.jsx)(l,{size:24})}):(0,a.jsxs)(`div`,{className:`group relative`,children:[(0,a.jsxs)(`button`,{type:`button`,onClick:()=>g(!0),"aria-label":m(`forms.iconPicker.chooseAnIcon`),className:`group/icon relative grid h-12 w-12 cursor-pointer place-items-center overflow-hidden rounded-2xl ${S(u)} text-white shadow-md outline-none transition-all duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] hover:scale-105 focus-visible:ring-2 focus-visible:ring-ring active:scale-95`,children:[e?(0,a.jsx)(c.Icon,{icon:e,className:`size-6 text-white`}):(0,a.jsx)(l,{size:24}),(0,a.jsx)(`span`,{className:`pointer-events-none absolute inset-0 grid place-items-center bg-black/40 opacity-0 transition-opacity duration-200 group-hover/icon:opacity-100`,children:(0,a.jsx)(s.IconPalette,{className:`size-5 text-white`})})]}),e&&r&&(0,a.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),r()},"aria-label":m(`forms.common.remove`),title:m(`forms.common.remove`),className:`absolute -right-1.5 -top-1.5 grid h-5 w-5 cursor-pointer place-items-center rounded-full border border-border/60 bg-card/90 text-foreground opacity-0 shadow-md backdrop-blur transition-opacity duration-200 bento-clear focus-visible:opacity-100 group-hover:opacity-100`,children:(0,a.jsx)(s.IconX,{size:12})}),(0,a.jsx)(n.j,{open:h,onOpenChange:g,value:e,onSelect:t,onClear:r,title:d,description:f})]})}function P({value:n,onSave:r,multiline:s=!1,placeholder:c,className:l,ariaLabel:u,autoFocus:d=!1,readOnly:f=!1,commitOnChange:p=!1}){let{t:m}=(0,o.useTranslation)(),[h,g]=(0,i.useState)(d),[_,v]=(0,i.useState)(n),[y,b]=(0,i.useState)(!1),x=(0,i.useRef)(null),S=(0,i.useRef)(null),C=(0,i.useRef)(!1),w=(0,i.useRef)(!1),[T,E]=(0,i.useState)(n);!h&&n!==T&&(E(n),v(n)),(0,i.useEffect)(()=>{h&&x.current?(x.current.focus(),x.current.select()):!h&&w.current&&(w.current=!1,S.current?.focus())},[h]);function D(){w.current=x.current!==null&&document.activeElement===x.current,g(!1)}async function O(){if(C.current)return;let e=_.trim();if(e===n){D();return}if(!e&&!c){v(n),D();return}C.current=!0,b(!0);try{await r(e)}catch{v(n)}finally{C.current=!1,b(!1),D()}}function k(){v(n),D()}function A(e){v(e),p&&r(e)}let j=!n;if(f)return(0,a.jsx)(`span`,{className:e.t(`block w-full`,l),"aria-label":u,children:n||(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:c??`—`})});let M=`w-full bg-transparent outline-none border-b transition-colors duration-200`,N=e.t(M,`cursor-text rounded-sm`,j?`border-dashed border-border/70 hover:border-foreground/40`:`border-transparent hover:border-border/60 focus-visible:border-border/80`),P=e.t(M,`bento-editing`);if(!h)return(0,a.jsx)(`button`,{ref:S,type:`button`,onClick:()=>g(!0),className:e.t(N,`text-left`,l),"aria-label":u??m(`forms.formActions.edit`),children:n||(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:c??`—`})});function F(e){if(e.key===`Escape`){e.preventDefault(),k();return}e.key===`Enter`&&(!s||e.metaKey||e.ctrlKey)&&(e.preventDefault(),O())}return s?(0,a.jsx)(`textarea`,{ref:x,value:_,onChange:e=>A(e.target.value),onBlur:O,onKeyDown:F,placeholder:c,"aria-label":u,"aria-busy":y||void 0,rows:3,className:e.t(P,`resize-none py-0.5 leading-snug`,l)}):(0,a.jsx)(t.a,{ref:x,value:_,onChange:e=>A(e.target.value),onBlur:O,onKeyDown:F,placeholder:c,"aria-label":u,"aria-busy":y||void 0,className:e.t(P,`h-auto px-0 py-0 shadow-none focus-visible:ring-0`,l)})}function F({titleMissing:t,dirty:n,className:r}){let{t:i}=(0,o.useTranslation)();if(!t&&!n)return null;let c=`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-medium normal-case leading-none tracking-normal`;return t?(0,a.jsxs)(`span`,{className:e.t(c,`bento-status bento-status-error`,r),children:[(0,a.jsx)(s.IconAlertTriangle,{className:`size-3`}),i(`bento.saveBar.titleRequired`,{defaultValue:`Title required`})]}):(0,a.jsxs)(`span`,{className:e.t(c,`bento-status bento-status-warn`,r),children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bento-status-dot bento-pulse`}),i(`bento.saveBar.unsaved`,{defaultValue:`Unsaved changes`})]})}function I(e){(0,i.useEffect)(()=>{let t=e.current;if(!t)return;let n=document.documentElement,r=0,i=()=>{r=0;let e=t.getBoundingClientRect().top,i=Math.max(0,Math.min(1,(160-e)/80));n.style.setProperty(`--bento-fade`,String(i)),n.classList.toggle(`bento-fade-half`,i>.5)},a=()=>{r||=requestAnimationFrame(i)};return i(),window.addEventListener(`scroll`,a,{passive:!0}),window.addEventListener(`resize`,a),()=>{r&&cancelAnimationFrame(r),window.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a),n.style.removeProperty(`--bento-fade`),n.classList.remove(`bento-fade-half`)}},[e])}function L(e,t){let n={};for(let r of Object.keys(e))Object.assign(n,{[r]:t[r]});return n}function ee({entity:e,isNew:n,headlineFallback:c,eyebrow:l,listRoute:d,trail:f,icon:p,tone:m,formId:g,feature:_,hasStatus:v=!1,hideIcon:b=!1,readOnly:x=!1,autosaveOnly:S=!1,badge:C,notice:w,onUpdate:T,onDelete:E,extraActions:D,children:O}){let{t:j}=(0,o.useTranslation)(),ee=(0,u.useNavigate)(),[te,R]=(0,i.useState)(!1),[z,B]=(0,i.useState)({isDirty:!1,isSubmitting:!1}),V=(0,i.useRef)(null);I(V);let H={title:e.title??``,description:e.description??``,icon:e.icon??null,enabled:e.enabled??1},[U,W]=(0,i.useState)(H),[ne,re]=(0,i.useState)(H);(H.title!==ne.title||H.description!==ne.description||H.icon!==ne.icon||H.enabled!==ne.enabled)&&(re(H),W(H));async function G(t){if(W(e=>({...e,...t})),n||!T)return;let r=t.title??U.title;try{await T({...e,...t}),h.toast.success(j(`forms.common.updated`,{name:r,feature:_}))}catch(e){console.error(`Failed to update entity field`,e),W(e=>({...e,...L(t,H)})),h.toast.error(j(`forms.common.notUpdated`,{name:H.title||r,feature:_}))}}async function ie(){if(E){try{await E()?(h.toast.success(j(`forms.common.deleted`,{name:U.title,feature:_})),ee(d)):h.toast.error(j(`forms.common.notDeleted`,{name:U.title,feature:_}))}catch(e){console.error(`Failed to delete entity`,e),h.toast.error(j(`forms.common.notDeleted`,{name:U.title,feature:_}))}R(!1)}}let K=U.enabled===1,q=!x,ae=!(S&&!n),J=!U.title.trim(),oe=!n&&!z.isDirty,Y=J||oe,se=[...D??[],...E&&!x?[{id:`entity.delete`,label:j(`forms.formActions.delete`),icon:s.IconTrash,tone:`destructive`,onSelect:()=>R(!0)}]:[]];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(M,{eyebrow:(0,a.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[f&&f.length>1?(0,a.jsx)(k,{steps:f}):(0,a.jsx)(A,{to:d,children:l}),!x&&(0,a.jsx)(F,{titleMissing:J,dirty:n||z.isDirty})]}),leading:(0,a.jsx)(N,{value:U.icon,onChange:e=>G({icon:e}),onClear:()=>G({icon:null}),defaultIcon:p,tone:m,title:U.title,description:U.description,readOnly:x||b}),title:(0,a.jsx)(P,{value:U.title,onSave:e=>G({title:e}),placeholder:c,className:`text-3xl font-semibold tracking-tight md:text-4xl`,ariaLabel:j(`forms.common.title`),autoFocus:n,commitOnChange:n,readOnly:x}),subtitle:(0,a.jsx)(P,{value:U.description,onSave:e=>G({description:e}),multiline:!0,placeholder:j(`forms.common.description`),className:`max-w-2xl text-sm text-muted-foreground`,ariaLabel:j(`forms.common.description`),commitOnChange:n,readOnly:x}),trailing:(0,a.jsxs)(a.Fragment,{children:[q&&(0,a.jsxs)(`div`,{className:`bento-fade-out flex shrink-0 items-center gap-2`,children:[ae&&(0,a.jsxs)(t.o,{type:`submit`,form:g,size:`sm`,loading:z.isSubmitting,"aria-disabled":Y?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),j(`forms.formActions.saveChanges`)]}),(0,a.jsxs)(t.o,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>ee(d),children:[(0,a.jsx)(s.IconX,{className:`size-4`}),j(`forms.formActions.cancel`)]})]}),C,v&&(x?(0,a.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-wider ${K?`bento-status bento-status-on`:`border-border bg-muted text-muted-foreground`}`,children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${K?`bento-status-dot bento-pulse`:`bg-muted-foreground/60`}`}),K?j(`common.active`,{defaultValue:`Active`}):j(`common.idle`,{defaultValue:`Idle`})]}):(0,a.jsxs)(`button`,{type:`button`,onClick:()=>G({enabled:+!K}),"aria-label":j(`forms.common.enabled`),title:j(K?`common.activeToggleHint`:`common.idleToggleHint`),className:`bento-tile-clickable flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-wider transition-colors duration-200 ${K?`bento-status bento-status-on`:`border-border bg-muted text-muted-foreground hover:bg-muted/80`}`,children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${K?`bento-status-dot bento-pulse`:`bg-muted-foreground/60`}`}),K?j(`common.active`,{defaultValue:`Active`}):j(`common.idle`,{defaultValue:`Idle`})]})),!n&&se.length>0&&(0,a.jsx)(y,{actions:se})]})}),(0,a.jsx)(`div`,{ref:V,"aria-hidden":!0,className:`h-px`}),w,!n&&E&&(0,a.jsx)(r.r,{feature:_,name:U.title,onDelete:ie,open:te,setOpen:R,trigger:(0,a.jsx)(`span`,{className:`hidden`,"aria-hidden":!0})}),O({staged:U,onStateChange:B})]})}var te={added:`bento-status bento-status-on`,removed:`bento-status bento-status-error`,changed:`bento-status bento-status-warn`,unchanged:!1};function R({state:t,compact:n=!1,className:r}){let{t:i}=(0,o.useTranslation)(),s={added:i(`bento.diff.added`,{defaultValue:`Added`}),removed:i(`bento.diff.removed`,{defaultValue:`Removed`}),changed:i(`bento.diff.changed`,{defaultValue:`Changed`}),unchanged:i(`bento.diff.unchanged`,{defaultValue:`Unchanged`})}[t],c=e.t(`rounded-full border px-1.5 leading-4`,n&&`font-mono`,te[t],r);if(!n)return(0,a.jsx)(`span`,{"data-slot":`bento-change-mark`,"data-state":t,className:c,children:s});let l={added:i(`bento.diff.addedLetter`,{defaultValue:`A`}),removed:i(`bento.diff.removedLetter`,{defaultValue:`D`}),changed:i(`bento.diff.changedLetter`,{defaultValue:`M`}),unchanged:i(`bento.diff.unchangedLetter`,{defaultValue:`·`})}[t];return(0,a.jsxs)(`span`,{"data-slot":`bento-change-mark`,"data-state":t,title:s,className:c,children:[(0,a.jsx)(`span`,{"aria-hidden":`true`,children:l}),(0,a.jsx)(`span`,{className:`sr-only`,children:s})]})}function z(e,t,n=!0){let r=e.length,i=t.length;if(r*i>4e5)return null;let a=Array.from({length:r+1},()=>new Uint32Array(i+1));for(let n=r-1;n>=0;n--)for(let r=i-1;r>=0;r--)a[n][r]=e[n]===t[r]?a[n+1][r+1]+1:Math.max(a[n+1][r],a[n][r+1]);let o=[],s=(e,t)=>{let r=o[o.length-1];n&&r?.op===e?r.text+=t:o.push({op:e,text:t})},c=0,l=0;for(;c<r&&l<i;)e[c]===t[l]?(s(`same`,e[c]),c++,l++):a[c+1][l]>=a[c][l+1]?s(`remove`,e[c++]):s(`add`,t[l++]);for(;c<r;)s(`remove`,e[c++]);for(;l<i;)s(`add`,t[l++]);return o}var B=e=>e.split(/(\s+)/).filter(e=>e!==``);function V(e){if(typeof DOMParser>`u`)return e.split(/<\/(?:p|h[1-6]|li|blockquote|pre|div)>/i).map(e=>e.replace(/<[^>]*>/g,``).replace(/\s+/g,` `).trim()).filter(Boolean);let t=new DOMParser().parseFromString(e,`text/html`),n=[...t.body.querySelectorAll(`p, h1, h2, h3, h4, h5, h6, li, blockquote, pre`)].filter(e=>!e.parentElement?.closest(`p, h1, h2, h3, h4, h5, h6, li, blockquote, pre`)).map(e=>(e.textContent??``).replace(/\s+/g,` `).trim()).filter(Boolean),r=(t.body.textContent??``).replace(/\s+/g,` `).trim();return n.length>0?n:r?[r]:[]}var H=e=>e==null?``:String(e);function U({before:t,after:n,fields:r,showUnchanged:c=!1,layout:l=`inline`}){let{t:u}=(0,o.useTranslation)(),[d,f]=(0,i.useState)(c),p=r.map(e=>{let r=t?.[e.id],i=n?.[e.id],a=e.kind??`text`,o=a===`rich`?V(H(r)).join(`
2
2
  `)===V(H(i)).join(`
3
3
  `):a===`value`?JSON.stringify(r??null)===JSON.stringify(i??null):H(r)===H(i),s=`changed`;return t===null||(r==null||r===``)&&!o?s=`added`:n===null||(i==null||i===``)&&!o?s=`removed`:o&&(s=`unchanged`),{field:e,a:r,b:i,kind:a,state:s}}),m=p.filter(e=>e.state!==`unchanged`),h=p.filter(e=>e.state===`unchanged`);return(0,a.jsxs)(`div`,{"data-slot":`bento-diff`,className:`flex flex-col gap-3`,children:[(t===null||n===null)&&(0,a.jsx)(`p`,{className:`m-0 text-sm font-medium`,children:t===null?u(`bento.diff.created`,{defaultValue:`Created in this version`}):u(`bento.diff.deleted`,{defaultValue:`Deleted in this version`})}),m.length===0&&(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:u(`bento.diff.noChanges`,{defaultValue:`No field changed`})}),(0,a.jsx)(`dl`,{className:`m-0 flex flex-col gap-3`,children:m.map(e=>(0,a.jsx)(W,{label:e.field.label,state:e.state,children:(0,a.jsx)(ne,{row:e,layout:l})},e.field.id))}),h.length>0&&(0,a.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,a.jsxs)(`button`,{type:`button`,"aria-expanded":d?`true`:`false`,onClick:()=>f(!d),className:`inline-flex items-center gap-1 self-start rounded-md text-sm text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,a.jsx)(s.IconChevronRight,{size:14,"aria-hidden":`true`,className:e.t(`transition-transform`,d&&`rotate-90`)}),u(`bento.diff.unchangedCount`,{defaultValue:`{{count}} unchanged`,count:h.length})]}),d&&(0,a.jsx)(`dl`,{className:`m-0 flex flex-col gap-3`,children:h.map(t=>(0,a.jsx)(W,{label:t.field.label,state:`unchanged`,children:(0,a.jsx)(`p`,{className:e.t(`m-0 whitespace-pre-wrap text-sm text-muted-foreground`,t.kind===`lines`&&`font-mono text-xs`),children:t.kind===`rich`?V(H(t.b)).join(`
4
4
 
5
- `):t.field.format?t.field.format(t.b):H(t.b)})},t.field.id))})]})]})}function W({label:e,state:t,children:n}){return(0,a.jsxs)(`div`,{className:`rounded-xl border border-border/60 bg-card/40 p-3`,children:[(0,a.jsxs)(`dt`,{className:`mb-1.5 flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,a.jsx)(`span`,{children:e}),(0,a.jsx)(R,{state:t})]}),(0,a.jsx)(`dd`,{className:`m-0`,children:n})]})}function ne({row:e,layout:t}){let{t:n}=(0,o.useTranslation)(),{field:r,a:i,b:s,kind:c,state:l}=e;if(c===`lines`)return(0,a.jsx)(ae,{label:r.label,before:H(i),after:H(s),layout:t});if(c===`value`){let e=e=>r.format?r.format(e):H(e);return(0,a.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[l!==`added`&&(0,a.jsx)(me,{children:e(i)}),l===`changed`&&(0,a.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),l!==`removed`&&(0,a.jsx)(X,{children:e(s)})]})}let u=c===`rich`?V(H(i)):[H(i)].filter(Boolean),d=c===`rich`?V(H(s)):[H(s)].filter(Boolean),f=z(u,d,!1)??[...u.map(e=>({op:`remove`,text:e})),...d.map(e=>({op:`add`,text:e}))],p=[];for(let e=0;e<f.length;e++){let t=f[e],n=f[e+1];if(t.op===`remove`&&n?.op===`add`){let r=z(B(t.text),B(n.text));p.push((0,a.jsx)(`p`,{className:`m-0 whitespace-pre-wrap text-sm leading-relaxed`,children:r?r.map((e,t)=>e.op===`same`?(0,a.jsx)(`span`,{children:e.text},t):e.op===`add`?(0,a.jsx)(X,{children:e.text},t):(0,a.jsx)(me,{children:e.text},t)):[(0,a.jsx)(me,{children:t.text},`r`),` `,(0,a.jsx)(X,{children:n.text},`a`)]},e)),e++}else p.push((0,a.jsx)(`p`,{className:`m-0 whitespace-pre-wrap text-sm leading-relaxed`,children:t.op===`same`?t.text:t.op===`add`?(0,a.jsx)(X,{children:t.text}):(0,a.jsx)(me,{children:t.text})},e))}return p.length===0?(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:n(`bento.diff.empty`,{defaultValue:`Empty`})}):(0,a.jsx)(`div`,{className:`flex flex-col gap-2`,children:p})}var re=3,G=e=>e===``?[]:e.replace(/\r?\n$/,``).split(/\r?\n/);function ie(e,t){let n=G(e),r=G(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;let a=0;for(;a<n.length-i&&a<r.length-i&&n[n.length-1-a]===r[r.length-1-a];)a++;let o=z(n.slice(i,n.length-a),r.slice(i,r.length-a),!1);if(o===null)return null;let s=[],c=0,l=0,u=e=>s.push({op:`same`,text:e,old:++c,new:++l});n.slice(0,i).forEach(u);let d=[],f=[],p=()=>{for(let e=0;e<Math.min(d.length,f.length);e++){let t=z(B(d[e].text),B(f[e].text));t&&(d[e].parts=t.filter(e=>e.op!==`add`),f[e].parts=t.filter(e=>e.op!==`remove`))}s.push(...d,...f),d=[],f=[]};for(let e of o)e.op===`remove`?d.push({op:`remove`,text:e.text,old:++c}):e.op===`add`?f.push({op:`add`,text:e.text,new:++l}):(p(),u(e.text));return p(),n.slice(n.length-a).forEach(u),s}function K(e){let t=[],n=0;for(;n<e.length;){if(e[n].op===`same`){t.push({left:e[n],right:e[n]}),n++;continue}let r=[],i=[];for(;n<e.length&&e[n].op!==`same`;n++)(e[n].op===`remove`?r:i).push(e[n]);for(let e=0;e<Math.max(r.length,i.length);e++)t.push({left:r[e]??null,right:i[e]??null})}return t}function q(e,t,n){let r=Array(e.length).fill(!1);e.forEach((n,i)=>{if(t(n))for(let t=Math.max(0,i-re);t<=Math.min(e.length-1,i+re);t++)r[t]=!0});let i=[],a=0;for(;a<e.length;){let t=a,o=r[a];for(;a<e.length&&r[a]===o;)a++;let s=e.slice(t,a);o||s.length===1?i.push({fold:!1,items:s}):i.push({fold:!0,key:n(s[0]),items:s})}return i}function ae({label:t,before:n,after:r,layout:c}){let{t:l}=(0,o.useTranslation)(),[u,d]=(0,i.useState)(new Set),f=ie(n,r);if(f===null)return(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:l(`bento.diff.tooLarge`,{defaultValue:`Too many lines changed to compare them here`})});if(f.length===0)return(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:l(`bento.diff.empty`,{defaultValue:`Empty`})});let p=e=>{let t=new Set(u);t.delete(e)||t.add(e),d(t)};function m(t,n,r){let i=u.has(t.key);return[(0,a.jsx)(`tr`,{children:(0,a.jsx)(`td`,{colSpan:n,className:`bg-muted/40 px-2`,children:(0,a.jsxs)(`button`,{type:`button`,"aria-expanded":i?`true`:`false`,onClick:()=>p(t.key),className:`inline-flex items-center gap-1 rounded-md font-sans text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,a.jsx)(s.IconChevronRight,{size:12,"aria-hidden":`true`,className:e.t(`transition-transform`,i&&`rotate-90`)}),l(`bento.diff.unchangedLines`,{defaultValue:`{{count}} unchanged lines`,count:t.items.length})]})})},`fold-${t.key}`),...i?t.items.map(r):[]]}let h=t=>(0,a.jsx)(`table`,{"data-layout":`inline`,className:e.t(`min-w-full border-collapse font-mono text-xs leading-5`,t),children:(0,a.jsx)(`tbody`,{children:q(f,e=>e.op!==`same`,J).map(e=>{let t=e=>(0,a.jsx)(ue,{row:e},J(e));return e.fold?m(e,4,t):e.items.map(t)})})});return(0,a.jsx)(`section`,{"aria-label":t,tabIndex:0,className:`@container/diff overflow-x-auto rounded-md border border-border/60 focus-visible:outline-2 focus-visible:outline-ring`,children:c===`split`?(0,a.jsxs)(a.Fragment,{children:[h(`@3xl/diff:hidden`),(t=>(0,a.jsxs)(`table`,{"data-layout":`split`,className:e.t(`w-full table-fixed border-collapse font-mono text-xs leading-5`,t),children:[(0,a.jsxs)(`colgroup`,{children:[(0,a.jsx)(`col`,{className:`w-14`}),(0,a.jsx)(`col`,{className:`w-5`}),(0,a.jsx)(`col`,{}),(0,a.jsx)(`col`,{className:`w-14`}),(0,a.jsx)(`col`,{className:`w-5`}),(0,a.jsx)(`col`,{})]}),(0,a.jsx)(`tbody`,{children:q(K(f),e=>e.left?.op!==`same`,oe).map(e=>{let t=e=>(0,a.jsx)(de,{pair:e},oe(e));return e.fold?m(e,6,t):e.items.map(t)})})]}))(`hidden @3xl/diff:table`)]}):h()})}var J=e=>`${e.old??``}:${e.new??``}`,oe=e=>`${e.left?.old??``}:${e.right?.new??``}`,Y=t=>e.t(t.op===`add`&&`bento-status bento-status-on`,t.op===`remove`&&`bento-status bento-status-error`);function se(e){return e.parts?e.parts.map((e,t)=>e.op===`add`?(0,a.jsx)(X,{children:e.text},t):e.op===`remove`?(0,a.jsx)(me,{children:e.text},t):(0,a.jsx)(`span`,{children:e.text},t)):e.op===`same`?e.text:(0,a.jsx)(pe,{op:e.op,children:e.text})}var ce={same:` `,add:`+`,remove:`−`},le=`select-none px-2 text-right align-top text-muted-foreground tabular-nums`;function ue({row:t}){let n=Y(t);return(0,a.jsxs)(`tr`,{"data-op":t.op,children:[(0,a.jsx)(`td`,{className:e.t(`w-px`,le,n),children:t.old}),(0,a.jsx)(`td`,{className:e.t(`w-px`,le,n),children:t.new}),(0,a.jsx)(`td`,{"aria-hidden":`true`,className:e.t(`w-px select-none pr-1`,n),children:ce[t.op]}),(0,a.jsx)(`td`,{className:e.t(`whitespace-pre pr-3`,!t.parts&&n),children:se(t)})]})}function de({pair:e}){return(0,a.jsxs)(`tr`,{"data-op":e.left?.op===`same`?`same`:`change`,children:[(0,a.jsx)(fe,{row:e.left,number:e.left?.old}),(0,a.jsx)(fe,{row:e.right,number:e.right?.new,right:!0})]})}function fe({row:t,number:n,right:r=!1}){if(t===null)return(0,a.jsx)(`td`,{colSpan:3,"data-empty":``,className:e.t(`[background-image:repeating-linear-gradient(-45deg,var(--color-border)_0_1px,transparent_0_6px)]`,r&&`border-l border-border/60`)});let i=Y(t);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`td`,{className:e.t(le,i,r&&`border-l border-border/60`),children:n}),(0,a.jsx)(`td`,{"aria-hidden":`true`,className:e.t(`select-none align-top`,i),children:ce[t.op]}),(0,a.jsx)(`td`,{className:e.t(`whitespace-pre-wrap pr-3 [overflow-wrap:anywhere]`,!t.parts&&i),children:se(t)})]})}function pe({op:e,children:t}){let{t:n}=(0,o.useTranslation)();return(0,a.jsxs)(e===`add`?`ins`:`del`,{className:`no-underline`,children:[(0,a.jsxs)(`span`,{className:`sr-only`,children:[e===`add`?n(`bento.diff.addedStart`,{defaultValue:`added:`}):n(`bento.diff.removedStart`,{defaultValue:`removed:`}),` `]}),t]})}function X({children:e}){let{t}=(0,o.useTranslation)();return(0,a.jsxs)(`ins`,{className:`bento-status bento-status-on rounded-sm px-0.5 underline decoration-2 underline-offset-2`,children:[(0,a.jsxs)(`span`,{className:`sr-only`,children:[t(`bento.diff.addedStart`,{defaultValue:`added:`}),` `]}),e]})}function me({children:e}){let{t}=(0,o.useTranslation)();return(0,a.jsxs)(`del`,{className:`bento-status bento-status-error rounded-sm px-0.5 line-through decoration-2`,children:[(0,a.jsxs)(`span`,{className:`sr-only`,children:[t(`bento.diff.removedStart`,{defaultValue:`removed:`}),` `]}),e]})}var he=[`primary`,`secondary`],ge={getItem:e=>{try{return window.localStorage.getItem(e)}catch{return null}},setItem:(e,t)=>{try{window.localStorage.setItem(e,t)}catch{}}},_e={getItem:()=>null,setItem:()=>{}};function ve({primary:t,secondary:r,primaryLabel:i,secondaryLabel:s,storageKey:c,defaultRatio:u=50,className:d}){let{t:f}=(0,o.useTranslation)(),p=n.m(),m=(0,l.useDefaultLayout)({id:c??`bento-split-page`,panelIds:he,storage:c?ge:_e});return p?(0,a.jsxs)(n.l,{"data-slot":`bento-split-page`,defaultValue:`primary`,className:e.t(`flex flex-col gap-3`,d),children:[(0,a.jsxs)(n.d,{"aria-label":f(`bento.split.switch`,{defaultValue:`Show`}),className:`self-start`,children:[(0,a.jsx)(n.f,{value:`primary`,children:i}),(0,a.jsx)(n.f,{value:`secondary`,children:s})]}),(0,a.jsx)(n.u,{value:`primary`,forceMount:!0,className:`data-[state=inactive]:hidden`,children:t}),(0,a.jsx)(n.u,{value:`secondary`,forceMount:!0,className:`data-[state=inactive]:hidden`,children:r})]}):(0,a.jsx)(`div`,{"data-slot":`bento-split-page`,className:e.t(`h-[var(--bento-split-height,calc(100dvh-12rem))] min-h-80`,d),children:(0,a.jsxs)(n.C,{orientation:`horizontal`,defaultLayout:m.defaultLayout,onLayoutChanged:m.onLayoutChanged,children:[(0,a.jsx)(n.S,{id:`primary`,defaultSize:`${u}`,minSize:`25`,children:(0,a.jsx)(`section`,{"aria-label":i,className:`h-full overflow-y-auto pr-3`,children:t})}),(0,a.jsx)(n.x,{withHandle:!0}),(0,a.jsx)(n.S,{id:`secondary`,defaultSize:`${100-u}`,minSize:`25`,children:(0,a.jsx)(`section`,{"aria-label":s,className:`h-full overflow-y-auto pl-3`,children:r})})]})})}var Z=({y:e,m:t,d:n})=>`${e}-${String(t).padStart(2,`0`)}-${String(n).padStart(2,`0`)}`,Q=({y:e,m:t,d:n})=>Date.UTC(e,t-1,n),ye=e=>{let t=new Date(e);return{y:t.getUTCFullYear(),m:t.getUTCMonth()+1,d:t.getUTCDate()}},$=(e,t)=>ye(Q(e)+t*864e5),be=(e,t)=>{let n=new Date(Date.UTC(e.y,e.m-1+t,1)),r=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return{y:n.getUTCFullYear(),m:n.getUTCMonth()+1,d:Math.min(e.d,r)}},xe=e=>new Date(Q(e)).getUTCDay();function Se(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,hourCycle:`h23`}).formatToParts(new Date(e)),r=e=>Number(n.find(t=>t.type===e)?.value);return{y:r(`year`),m:r(`month`),d:r(`day`),h:r(`hour`),mi:r(`minute`),s:r(`second`)}}function Ce(e,t,n,r,i,a){let o=Date.UTC(e.y,e.m-1,e.d,t,n,r),s=e=>{let t=Se(e,a);return Date.UTC(t.y,t.m-1,t.d,t.h,t.mi,t.s)-Math.floor(e/1e3)*1e3},c=o-s(o),l=s(c);return o-l!==c&&(c=o-l),new Date(c+i)}var we={on:`bento-status bento-status-on`,warn:`bento-status bento-status-warn`,error:`bento-status bento-status-error`};function Te({entries:t,view:n,defaultView:r=`month`,onViewChange:c,defaultDate:l,timeZone:u=Intl.DateTimeFormat().resolvedOptions().timeZone,weekStartsOn:d=0,onEntryMove:f,onEntrySelect:p,onRangeChange:m,label:h,className:g}){let{t:_,i18n:v}=(0,o.useTranslation)(),y=v?.resolvedLanguage??v?.language,b=e=>{let t=Se(new Date(e).getTime(),u);return{y:t.y,m:t.m,d:t.d}},[x,S]=(0,i.useState)(r),C=n??x,[w,T]=(0,i.useState)(()=>b(l??Date.now())),[E,D]=(0,i.useState)(null),[O,k]=(0,i.useState)(null),[A,j]=(0,i.useState)(``),M=(0,i.useRef)(new Map),N=(0,i.useRef)(!1),P=(0,i.useId)(),[F]=(0,i.useState)(()=>Z(b(Date.now()))),I=e=>$(e,-((xe(e)-d+7)%7)),L=I(C===`month`?{...w,d:1}:w),ee=C===`month`?Math.ceil((Q(be({...w,d:1},1))-Q(L))/6048e5):1,te=Array.from({length:ee},(e,t)=>Array.from({length:7},(e,n)=>$(L,t*7+n))),R=$(L,ee*7),z=`${Z(L)}/${Z(R)}`;(0,i.useEffect)(()=>{m?.({start:Ce(L,0,0,0,0,u),end:Ce(R,0,0,0,0,u)})},[z,u]),(0,i.useEffect)(()=>{N.current&&(N.current=!1,M.current.get(Z(w))?.focus())});let B=new Map;for(let e of t){let t=new Date(e.start).getTime();if(Number.isNaN(t))continue;let n=Z(b(t)),r=B.get(n)??[];r.push({entry:e,time:t}),B.set(n,r)}for(let e of B.values())e.sort((e,t)=>e.time-t.time);let V=e=>new Intl.DateTimeFormat(y,{...e,timeZone:`UTC`}),H=e=>V({dateStyle:`full`}).format(Q(e)),U=e=>new Intl.DateTimeFormat(y,{timeStyle:`short`,timeZone:u}).format(e),W=C===`month`?V({month:`long`,year:`numeric`}).format(Q({...w,d:1})):`${V({dateStyle:`medium`}).format(Q(L))} – ${V({dateStyle:`medium`}).format(Q($(R,-1)))}`;function ne(e){N.current=!0,T(e)}function re(e){n===void 0&&S(e),c?.(e)}let G=e=>C===`month`?be(w,e):$(w,7*e);function ie(e,n){let r=t.find(t=>t.id===e);if(!r||!f)return;let i=new Date(r.start).getTime(),a=Se(i,u);Z(a)!==Z(n)&&f(e,Ce(n,a.h,a.mi,a.s,i%1e3,u)),j(_(`bento.calendar.moved`,{defaultValue:`Moved {{label}} to {{day}}.`,label:r.label,day:H(n)}))}function K(e,n){let r={ArrowLeft:()=>$(n,-1),ArrowRight:()=>$(n,1),ArrowUp:()=>$(n,-7),ArrowDown:()=>$(n,7),Home:()=>I(n),End:()=>$(I(n),6),PageUp:()=>G(-1),PageDown:()=>G(1)}[e.key];if(r){e.preventDefault(),ne(r());return}if(E&&(e.key===`Enter`||e.key===` `))e.preventDefault(),ie(E,n),D(null);else if(E&&e.key===`Escape`){e.preventDefault();let n=t.find(e=>e.id===E);D(null),j(_(`bento.calendar.cancelled`,{defaultValue:`Put {{label}} back.`,label:n?.label??``}))}else e.key===`Enter`&&(e.preventDefault(),e.currentTarget.querySelector(`button`)?.focus())}function q(e,t){let n=e.currentTarget.closest(`td`),r=n?[...n.querySelectorAll(`button`)]:[],i=r.indexOf(e.currentTarget),a=f&&(e.key===` `||e.key===`Enter`&&!p);if(e.key===`ArrowDown`||e.key===`ArrowUp`)r[i+(e.key===`ArrowDown`?1:-1)]?.focus();else if(e.key===`Escape`)n?.focus();else if(a)D(t.id),j(_(`bento.calendar.picked`,{defaultValue:`Picked up {{label}}. Choose a day and press Enter.`,label:t.label})),n?.focus();else if(e.key===`Enter`&&p)p(t.id);else return;e.preventDefault(),e.stopPropagation()}function ae(e,t){let n=O??e.dataTransfer.getData(`text/plain`);k(null),n&&(e.preventDefault(),ie(n,t))}let J=f?P:void 0;return(0,a.jsxs)(`div`,{"data-slot":`bento-calendar`,className:e.t(`flex flex-col gap-3`,g),children:[(0,a.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,a.jsx)(Ee,{label:_(`bento.calendar.previous`,{defaultValue:`Previous`}),onClick:()=>T(G(-1)),children:(0,a.jsx)(s.IconChevronLeft,{size:16,"aria-hidden":`true`})}),(0,a.jsx)(Ee,{label:_(`bento.calendar.next`,{defaultValue:`Next`}),onClick:()=>T(G(1)),children:(0,a.jsx)(s.IconChevronRight,{size:16,"aria-hidden":`true`})}),(0,a.jsx)(`button`,{type:`button`,onClick:()=>T(b(Date.now())),className:`rounded-md border border-border px-2 py-1 text-sm hover:bg-muted/50 focus-visible:outline-2 focus-visible:outline-ring`,children:_(`bento.calendar.today`,{defaultValue:`Today`})}),(0,a.jsx)(`h2`,{className:`m-0 ml-2 text-base font-semibold`,"aria-live":`polite`,children:W})]}),(0,a.jsx)(`div`,{role:`group`,"aria-label":_(`bento.calendar.views`,{defaultValue:`View`}),className:`flex rounded-md border border-border p-0.5`,children:[`month`,`week`].map(t=>(0,a.jsx)(`button`,{type:`button`,"aria-pressed":C===t?`true`:`false`,onClick:()=>re(t),className:e.t(`rounded px-2 py-0.5 text-sm focus-visible:outline-2 focus-visible:outline-ring`,C===t?`bg-primary text-primary-foreground`:`hover:bg-muted/50`),children:t===`month`?_(`bento.calendar.month`,{defaultValue:`Month`}):_(`bento.calendar.week`,{defaultValue:`Week`})},t))})]}),(0,a.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:A}),J&&(0,a.jsx)(`span`,{id:J,className:`sr-only`,children:_(`bento.calendar.moveHint`,{defaultValue:`Space picks this up to move it: the arrow keys choose a day, Enter drops it and Escape cancels.`})}),(0,a.jsxs)(`table`,{role:`grid`,"aria-label":h??W,className:`w-full table-fixed border-collapse text-sm`,children:[(0,a.jsx)(`thead`,{children:(0,a.jsx)(`tr`,{children:te[0].map(e=>(0,a.jsx)(`th`,{scope:`col`,abbr:V({weekday:`long`}).format(Q(e)),className:`pb-1 text-xs font-medium text-muted-foreground`,children:V({weekday:`short`}).format(Q(e))},Z(e)))})}),(0,a.jsx)(`tbody`,{children:te.map(t=>(0,a.jsx)(`tr`,{children:t.map(t=>{let n=Z(t),r=B.get(n)??[],i=n===Z(w),o=C===`month`&&t.m!==w.m,s=r.length;return(0,a.jsxs)(`td`,{ref:e=>{e?M.current.set(n,e):M.current.delete(n)},role:`gridcell`,tabIndex:i?0:-1,"aria-label":s>0?`${H(t)}, ${_(`bento.calendar.entries`,{defaultValue:`{{count}} scheduled`,count:s})}`:H(t),"aria-current":n===F?`date`:void 0,"data-day":n,onKeyDown:e=>K(e,t),onFocus:()=>{i||T(t)},onDragOver:e=>{O&&e.preventDefault()},onDrop:e=>ae(e,t),className:e.t(`border border-border/60 p-1 align-top outline-none`,C===`month`?`h-24`:`h-48`,`focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,E&&i&&`bg-primary/10`),children:[(0,a.jsx)(`span`,{"aria-hidden":`true`,className:e.t(`mb-1 inline-grid size-6 place-items-center rounded-full text-xs`,n===F&&`bg-primary font-semibold text-primary-foreground`,n!==F&&o&&`text-muted-foreground`),children:t.d}),(0,a.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:r.map(({entry:t,time:n})=>(0,a.jsx)(`li`,{children:(0,a.jsxs)(`button`,{type:`button`,tabIndex:-1,draggable:f?!0:void 0,"aria-describedby":J,"aria-pressed":f?E===t.id?`true`:`false`:void 0,"data-entry":t.id,onKeyDown:e=>q(e,t),onClick:()=>p?.(t.id),onDragStart:e=>{e.dataTransfer.setData(`text/plain`,t.id),e.dataTransfer.effectAllowed=`move`,k(t.id)},onDragEnd:()=>k(null),className:e.t(`flex w-full min-w-0 items-baseline gap-1 rounded-md px-1 py-0.5 text-left text-xs focus-visible:outline-2 focus-visible:outline-ring`,t.tone?we[t.tone]:`bg-muted`,E===t.id&&`outline-2 outline-dashed outline-primary`),children:[(0,a.jsx)(`time`,{dateTime:new Date(n).toISOString(),className:`flex-none tabular-nums`,children:U(n)}),(0,a.jsx)(`span`,{className:`truncate`,children:t.label})]})},t.id))})]},n)})},Z(t[0])))})]})]})}function Ee({label:e,onClick:t,children:n}){return(0,a.jsx)(`button`,{type:`button`,"aria-label":e,onClick:t,className:`grid size-7 place-items-center rounded-md border border-border hover:bg-muted/50 focus-visible:outline-2 focus-visible:outline-ring`,children:n})}var De={LARGE:`col-span-2 row-span-2 md:col-span-2 md:row-span-2 lg:col-span-2 lg:row-span-2`,MEDIUM:`col-span-2 row-span-1 md:col-span-2 md:row-span-1 lg:col-span-2 lg:row-span-1`,SMALL:`col-span-1 row-span-1`},Oe={SMALL:`MEDIUM`,MEDIUM:`LARGE`,LARGE:`SMALL`};function ke(e,t,n){if(!n||n.length===0)return e.map((e,n)=>({item:e,key:t(e),emphasis:n===0?`LARGE`:`MEDIUM`}));let r=new Map,i=new Map;for(let e of n)r.set(e.itemId,e.displayOrder),i.set(e.itemId,e.emphasis);return e.map((e,n)=>({item:e,key:t(e),idx:n})).sort((e,t)=>{let n=r.has(e.key)?r.get(e.key):2**53-1,i=r.has(t.key)?r.get(t.key):2**53-1;return n===i?e.idx-t.idx:n-i}).map(({item:e,key:t})=>({item:e,key:t,emphasis:i.get(t)??`MEDIUM`}))}function Ae(e){return e.map((e,t)=>({itemId:e.key,emphasis:e.emphasis,displayOrder:t}))}function je({to:e,emphasis:t,featured:n,defaultIcon:r,icon:i,tone:s=`indigo`,title:l,description:d,meta:f,enabled:p,hasStatus:m=!1,viewTransitionName:h}){let{t:g}=(0,o.useTranslation)(),_=S(s),v=t??(n?`LARGE`:`MEDIUM`),y=v===`LARGE`,b=v===`SMALL`,x=De[v],C=p===1,w=y?`p-6 md:p-7`:b?`p-4`:`p-5`,T=y?`h-14 w-14`:b?`h-8 w-8`:`h-9 w-9`,E=y?28:b?16:18,D=y?`text-xl md:text-2xl`:b?`text-sm`:`text-base md:text-lg`;return(0,a.jsxs)(u.Link,{to:e,className:`bento-tile bento-tile-clickable bento-glass group relative flex flex-col ${y?`gap-5`:`gap-4`} overflow-hidden ${w} ${x}`,style:h?{viewTransitionName:h}:void 0,children:[y&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute -bottom-10 -right-10 h-64 w-64 rounded-full ${_} opacity-40 blur-2xl dark:opacity-50`}),(0,a.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute right-12 top-1/3 h-32 w-32 rounded-full ${_} bento-chip-tr opacity-20 blur-2xl dark:opacity-30`})]}),(0,a.jsxs)(`div`,{className:`relative z-1 flex items-center justify-between`,children:[(0,a.jsx)(`span`,{className:`grid place-items-center rounded-2xl ${_} text-white shadow-md ${T}`,children:i?(0,a.jsx)(c.Icon,{icon:i,className:y?`size-7 text-white`:`size-4.5 text-white`}):(0,a.jsx)(r,{size:E})}),m&&(0,a.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-wider ${C?`bento-status bento-status-on`:`border-border bg-muted text-muted-foreground`}`,children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${C?`bento-status-dot bento-pulse`:`bg-muted-foreground/60`}`}),C?g(`common.active`,{defaultValue:`Active`}):g(`common.idle`,{defaultValue:`Idle`})]})]}),(0,a.jsxs)(`div`,{className:`relative z-1`,children:[(0,a.jsx)(`div`,{className:`font-semibold tracking-tight ${D}`,children:l}),!b&&f&&(0,a.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:f}),!b&&d&&(0,a.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:d})]})]})}var Me={query:``,facets:{}},Ne=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Pe=e=>Array.isArray(e)?e:[];function Fe(e,t,n){let r={...e.facets};return n===void 0||Array.isArray(n)&&n.length===0||Ne(n)&&!n.from&&!n.to?delete r[t]:r[t]=n,{...e,facets:r}}function Ie({value:e,onChange:r,facets:c,queryLabel:l,queryDelay:u=300,views:d}){let{t:f}=(0,o.useTranslation)(),[p,m]=(0,i.useState)({source:e.query,text:e.query}),[h,g]=(0,i.useState)(null);p.source!==e.query&&m({source:e.query,text:e.query===h?p.text:e.query}),(0,i.useEffect)(()=>{if(p.text===e.query)return;let t=setTimeout(()=>{g(p.text),r({...e,query:p.text})},u);return()=>clearTimeout(t)},[p.text,e,r,u]);let _=[];for(let t of c){let n=e.facets[t.id];if(t.kind===`choice`)for(let r of Pe(n)){let i=t.options.find(e=>e.value===r);_.push({key:`${t.id}:${r}`,text:`${t.label}: ${i?.label??r}`,remove:()=>Fe(e,t.id,Pe(n).filter(e=>e!==r))})}else Ne(n)&&(n.from||n.to)&&_.push({key:t.id,text:`${t.label}: ${n.from??`…`} – ${n.to??`…`}`,remove:()=>Fe(e,t.id,void 0)})}let v=_.length>0||e.query!==``,y=l??f(`bento.filters.search`,{defaultValue:`Search`});return(0,a.jsxs)(`div`,{role:`search`,"aria-label":f(`bento.filters.label`,{defaultValue:`Filters`}),"data-slot":`bento-filter-bar`,className:`flex flex-col gap-2`,children:[(0,a.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,a.jsxs)(`div`,{className:`relative min-w-48 flex-1`,children:[(0,a.jsx)(s.IconSearch,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`}),(0,a.jsx)(t.a,{type:`search`,value:p.text,placeholder:y,"aria-label":y,onChange:e=>m({...p,text:e.target.value}),className:`pl-9`})]}),c.map(t=>t.kind===`choice`?(0,a.jsx)(Re,{facet:t,value:e,onChange:r},t.id):(0,a.jsx)(ze,{facet:t,value:e,onChange:r},t.id)),d]}),v&&(0,a.jsxs)(`ul`,{className:`m-0 flex list-none flex-wrap items-center gap-1.5 p-0`,"aria-label":f(`bento.filters.active`,{defaultValue:`Active filters`}),children:[_.map(e=>(0,a.jsx)(`li`,{children:(0,a.jsxs)(`button`,{type:`button`,"aria-label":f(`bento.filters.remove`,{defaultValue:`Remove filter {{filter}}`,filter:e.text}),onClick:()=>r(e.remove()),className:`bento-clear inline-flex items-center gap-1 rounded-full border border-border/60 bg-card/60 py-0.5 pl-2.5 pr-1.5 text-xs`,children:[e.text,(0,a.jsx)(s.IconX,{size:12,"aria-hidden":`true`})]})},e.key)),(0,a.jsx)(`li`,{children:(0,a.jsx)(n.J,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>{m({source:``,text:``}),r(Me)},children:f(`bento.filters.clearAll`,{defaultValue:`Clear all`})})})]})]})}function Le({label:e,count:t,...r}){return(0,a.jsxs)(n.J,{variant:`outline`,size:`sm`,className:`gap-1.5`,...r,children:[e,t>0&&(0,a.jsx)(`span`,{className:`rounded-full bg-primary px-1.5 text-[0.6875rem] leading-4 text-primary-foreground`,children:t}),(0,a.jsx)(s.IconChevronDown,{size:14,"aria-hidden":`true`})]})}function Re({facet:e,value:t,onChange:r}){let i=Pe(t.facets[e.id]);return(0,a.jsxs)(n.M,{children:[(0,a.jsx)(n.K,{asChild:!0,children:(0,a.jsx)(Le,{label:e.label,count:i.length})}),(0,a.jsx)(n.P,{align:`start`,className:`bento-dropdown min-w-44 p-1.5`,children:e.multiple?e.options.map(o=>(0,a.jsx)(n.N,{checked:i.includes(o.value),onCheckedChange:n=>r(Fe(t,e.id,n===!0?[...i,o.value]:i.filter(e=>e!==o.value))),onSelect:e=>e.preventDefault(),children:o.label},o.value)):(0,a.jsx)(n.z,{value:i[0]??``,onValueChange:n=>r(Fe(t,e.id,n===i[0]?[]:[n])),children:e.options.map(e=>(0,a.jsx)(n.B,{value:e.value,children:e.label},e.value))})})]})}function ze({facet:e,value:r,onChange:s}){let{t:c}=(0,o.useTranslation)(),l=r.facets[e.id],u=Ne(l)?l:{},[d,f]=(0,i.useState)(!1),[p,m]=(0,i.useState)(u.from??``),[h,g]=(0,i.useState)(u.to??``),_=(0,i.useId)(),v=(0,i.useId)();return(0,a.jsxs)(n.w,{open:d,onOpenChange:e=>{e&&(m(u.from??``),g(u.to??``)),f(e)},children:[(0,a.jsx)(n.A,{asChild:!0,children:(0,a.jsx)(Le,{label:e.label,count:u.from||u.to?1:0})}),(0,a.jsx)(n.E,{align:`start`,className:`bento-dropdown w-64 p-3`,children:(0,a.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:t=>{t.preventDefault(),s(Fe(r,e.id,{from:p||void 0,to:h||void 0})),f(!1)},children:[(0,a.jsx)(`label`,{htmlFor:_,className:`text-xs text-muted-foreground`,children:c(`bento.filters.from`,{defaultValue:`From`})}),(0,a.jsx)(t.a,{id:_,type:`date`,value:p,max:h||void 0,onChange:e=>m(e.target.value)}),(0,a.jsx)(`label`,{htmlFor:v,className:`text-xs text-muted-foreground`,children:c(`bento.filters.to`,{defaultValue:`To`})}),(0,a.jsx)(t.a,{id:v,type:`date`,value:h,min:p||void 0,onChange:e=>g(e.target.value)}),(0,a.jsx)(n.J,{type:`submit`,size:`sm`,className:`mt-1`,children:c(`bento.filters.apply`,{defaultValue:`Apply`})})]})})]})}var Be=E,Ve=`bento-grid grid auto-rows-[minmax(140px,auto)] grid-cols-2 gap-4 md:grid-cols-4 md:gap-5 lg:grid-cols-6`;function He({items:e,error:t,tryAgainUrl:c,listId:l,eyebrow:d,backTo:f,backLabel:p,trail:m,heroIcon:h,title:g,subtitle:_,tone:v=`indigo`,headerAction:y,newRoute:b,newLabel:x,newSubtitle:C,hideNew:w=!1,itemKey:T,columns:E,rowActions:O,onRowOpen:k,getRowLabel:A,columnLayout:j,onColumnLayoutChange:N,renderTile:P,emptyTitle:F,emptyDescription:I,layout:L}){let{t:ee}=(0,o.useTranslation)(),te=S(v),[R,z]=(0,i.useState)(!1),B=(0,i.useMemo)(()=>ke(e??[],T,L?.data?.entries),[e,T,L?.data?.entries]),V=h?(0,a.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl ${te} text-white shadow-md`,children:(0,a.jsx)(h,{size:24})}):void 0;if(!P)return(0,a.jsxs)(r.t,{checkIsNotUndefined:e,error:t??null,tryAgainUrl:c,children:[(0,a.jsx)(M,{eyebrow:d,backTo:f,backLabel:p,trail:m,leading:V,title:g,subtitle:_,trailing:w?void 0:(0,a.jsx)(n.J,{asChild:!0,className:`gap-2`,children:(0,a.jsxs)(u.Link,{to:b,children:[(0,a.jsx)(s.IconPlus,{size:16}),x]})})}),y&&(0,a.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:y}),e?.length===0?(0,a.jsx)(D,{icon:s.IconSparkles,title:F,description:I}):(0,a.jsx)(Be,{rows:e??[],getRowId:T,columns:E??[],label:g,getRowLabel:A,rowActions:O,onRowOpen:k,layout:j,onLayoutChange:N})]});let H=!!l&&!!L&&(e?.length??0)>0;return(0,a.jsxs)(r.t,{checkIsNotUndefined:e,error:t??null,tryAgainUrl:c,children:[(0,a.jsx)(M,{eyebrow:d,backTo:f,backLabel:p,trail:m,leading:V,title:g,subtitle:_}),(y||H&&!R)&&(0,a.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[y,H&&!R&&(0,a.jsxs)(n.J,{variant:`outline`,size:`sm`,onClick:()=>z(!0),className:`ml-auto gap-2`,children:[(0,a.jsx)(s.IconAdjustmentsHorizontal,{size:16}),ee(`bento.layout.customize`,{defaultValue:`Customize layout`})]})]}),R&&l&&L?(0,a.jsx)(Ge,{layout:L,resolved:B,canEditGlobal:L?.data?.canEditGlobal??!1,isCustomized:L?.data?.source===`USER`,renderTile:P,chip:te,hideNew:w,newRoute:b,newLabel:x,newSubtitle:C,onClose:()=>z(!1)}):(0,a.jsx)(We,{resolved:B,renderTile:P,chip:te,hideNew:w,newRoute:b,newLabel:x,newSubtitle:C,isEmpty:e?.length===0,emptyTitle:F,emptyDescription:I})]})}function Ue({items:e,error:t,tryAgainUrl:n,tone:i=`indigo`,newRoute:o,newLabel:s,newSubtitle:c,hideNew:l=!1,itemKey:u,renderTile:d,emptyTitle:f,emptyDescription:p}){let m=S(i);return(0,a.jsx)(r.t,{checkIsNotUndefined:e,error:t??null,tryAgainUrl:n,children:(0,a.jsxs)(`div`,{"data-slot":`bento-list-tiles`,className:Ve,children:[!l&&o&&s?(0,a.jsx)(Ye,{route:o,label:s,subtitle:c,chip:m}):null,(e??[]).map(e=>(0,a.jsx)(`span`,{className:`contents`,children:d(e)},u(e))),e?.length===0&&(0,a.jsx)(Xe,{title:f,description:p})]})})}function We({resolved:t,renderTile:n,chip:r,hideNew:i,newRoute:o,newLabel:s,newSubtitle:c,isEmpty:l,emptyTitle:u,emptyDescription:d}){let f=t.some(e=>e.emphasis===`SMALL`);return(0,a.jsxs)(`div`,{"data-slot":`bento-list-tiles`,className:e.t(Ve,f&&`grid-flow-dense`),children:[!i&&(0,a.jsx)(Ye,{route:o,label:s,subtitle:c,chip:r}),t.map(({item:e,key:t,emphasis:r})=>(0,a.jsx)(`span`,{className:`contents`,children:n(e,r)},t)),l&&(0,a.jsx)(Xe,{title:u,description:d})]})}function Ge({layout:t,resolved:r,canEditGlobal:c,isCustomized:l,renderTile:u,chip:d,hideNew:m,newRoute:h,newLabel:g,newSubtitle:_,onClose:v}){let{t:y}=(0,o.useTranslation)(),[b,x]=(0,i.useState)(r),[S,C]=(0,i.useState)(null),w=(t.saving??!1)||S!==null,T=e=>w&&S===e?{loading:!0}:{"aria-disabled":w||void 0},[E,D]=(0,i.useState)(!1),O=(e,t)=>async()=>{if(t){C(e),D(!1);try{await t(),v()}catch(e){console.error(`Failed to save the bento layout`,e),D(!0)}finally{C(null)}}},k=(0,f.useSensors)((0,f.useSensor)(f.PointerSensor,{activationConstraint:{distance:8}}),(0,f.useSensor)(f.KeyboardSensor));function A(e){let{active:t,over:n}=e;!n||t.id===n.id||x(e=>{let r=e.findIndex(e=>e.key===t.id),i=e.findIndex(e=>e.key===n.id);return r<0||i<0?e:(0,p.arrayMove)(e,r,i)})}function j(e,t){x(n=>n.map(n=>n.key===e?{...n,emphasis:t}:n))}let M=(0,i.useMemo)(()=>Ae(b),[b]),N=b.some(e=>e.emphasis===`SMALL`);return(0,a.jsxs)(`div`,{children:[(0,a.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2 rounded-2xl border border-border/60 bg-card/40 p-3 backdrop-blur-md`,children:[(0,a.jsx)(`span`,{className:`mr-auto text-sm text-muted-foreground`,children:y(`bento.layout.editHint`,{defaultValue:`Drag tiles to reorder · tap the size button to resize`})}),l&&t.onReset&&(0,a.jsxs)(n.J,{variant:`ghost`,size:`sm`,className:`gap-2`,...T(`reset`),onClick:O(`reset`,t.onReset),children:[S!==`reset`&&(0,a.jsx)(s.IconArrowBackUp,{size:16}),y(`bento.layout.reset`,{defaultValue:`Reset to default`})]}),c&&t.onSaveGlobal&&(0,a.jsxs)(n.J,{variant:`outline`,size:`sm`,className:`gap-2`,...T(`global`),onClick:O(`global`,()=>t.onSaveGlobal?.(M)),children:[S!==`global`&&(0,a.jsx)(s.IconUsers,{size:16}),y(`bento.layout.saveGlobal`,{defaultValue:`Set as default for everyone`})]}),(0,a.jsxs)(n.J,{variant:`ghost`,size:`sm`,className:`gap-2`,...T(`cancel`),onClick:v,children:[(0,a.jsx)(s.IconX,{size:16}),y(`common.cancel`,{defaultValue:`Cancel`})]}),(0,a.jsxs)(n.J,{size:`sm`,className:`gap-2`,...T(`save`),onClick:O(`save`,()=>t.onSave(M)),children:[S!==`save`&&(0,a.jsx)(s.IconDeviceFloppy,{size:16}),y(`bento.layout.save`,{defaultValue:`Save layout`})]}),E&&(0,a.jsx)(`p`,{role:`alert`,className:`w-full text-sm text-destructive`,children:y(`bento.layout.saveFailed`,{defaultValue:`The layout could not be saved. Nothing has changed — try again.`})})]}),(0,a.jsx)(f.DndContext,{sensors:k,collisionDetection:f.closestCenter,onDragEnd:A,children:(0,a.jsx)(p.SortableContext,{items:b.map(e=>e.key),strategy:p.rectSortingStrategy,children:(0,a.jsxs)(`div`,{"data-slot":`bento-list-tiles`,className:e.t(Ve,N&&`grid-flow-dense`),children:[!m&&(0,a.jsx)(Ye,{route:h,label:g,subtitle:_,chip:d}),b.map(({item:e,key:t,emphasis:n})=>(0,a.jsx)(Je,{id:t,emphasis:n,onSetEmphasis:e=>j(t,e),children:u(e,n)},t))]})})})]})}var Ke=[`SMALL`,`MEDIUM`,`LARGE`],qe={SMALL:{key:`bento.layout.size.small`,def:`Small`},MEDIUM:{key:`bento.layout.size.medium`,def:`Medium`},LARGE:{key:`bento.layout.size.large`,def:`Large`}};function Je({id:t,emphasis:n,onSetEmphasis:r,children:i}){let{t:c}=(0,o.useTranslation)(),{attributes:l,listeners:u,setNodeRef:d,transform:f,transition:h,isDragging:g}=(0,p.useSortable)({id:t}),_={transform:m.CSS.Translate.toString(f),transition:h,opacity:g?.6:1,zIndex:g?50:void 0};return(0,a.jsxs)(`div`,{ref:d,style:_,className:e.t(`relative h-full`,De[n]),children:[(0,a.jsx)(`div`,{className:`pointer-events-none h-full select-none [&>*]:h-full [&>*]:w-full`,children:i}),(0,a.jsxs)(`div`,{className:`absolute right-2 top-2 z-10 flex items-center gap-1`,children:[(0,a.jsx)(`div`,{role:`group`,"aria-label":c(`bento.layout.sizeGroup`,{defaultValue:`Tile size`}),className:`flex items-center gap-0.5 rounded-full border border-border/60 bg-background/80 p-0.5 shadow-sm backdrop-blur`,children:Ke.map(t=>{let i=t===n,o=c(qe[t].key,{defaultValue:qe[t].def});return(0,a.jsx)(`button`,{type:`button`,onClick:()=>r(t),"aria-pressed":i,"aria-label":o,title:o,className:e.t(`grid h-6 w-6 place-items-center rounded-full text-[11px] font-semibold uppercase transition-colors`,i?`bg-primary text-primary-foreground shadow`:`text-muted-foreground hover:bg-muted`),children:o.charAt(0)},t)})}),(0,a.jsx)(`button`,{type:`button`,...l,...u,"aria-label":c(`bento.layout.dragToReorder`,{defaultValue:`Drag to reorder`}),className:`grid h-7 w-7 cursor-grab place-items-center rounded-full border border-border/60 bg-background/80 shadow-sm backdrop-blur hover:bg-background active:cursor-grabbing`,children:(0,a.jsx)(s.IconGripVertical,{size:14,className:`text-muted-foreground`})})]})]})}function Ye({route:e,label:t,subtitle:n,chip:r}){let{t:i}=(0,o.useTranslation)();return(0,a.jsxs)(u.Link,{to:e,className:`bento-tile bento-tile-clickable col-span-2 row-span-1 flex flex-col gap-3 rounded-3xl border-2 border-dashed border-border/60 bg-card/30 p-5 backdrop-blur-md bento-new-tile hover:bg-card/50 md:col-span-2 md:row-span-1 lg:col-span-2 lg:row-span-1`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,a.jsx)(`span`,{className:`bento-pulse grid h-10 w-10 place-items-center rounded-2xl ${r} text-white shadow-md`,children:(0,a.jsx)(s.IconPlus,{size:20})}),(0,a.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground`,children:i(`forms.formActions.new`,{defaultValue:`New`})})]}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`div`,{className:`text-base font-semibold tracking-tight md:text-lg`,children:(0,a.jsx)(`span`,{className:`${r} bg-clip-text text-transparent`,children:t})}),n&&(0,a.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:n})]})]})}function Xe({title:e,description:t}){return(0,a.jsx)(D,{icon:s.IconSparkles,title:e,description:t,align:`start`,className:`col-span-2 row-span-2 justify-end md:col-span-4`})}function Ze({title:e,badges:n,actions:r,onCancel:i,loading:c,disabled:l,dirty:u,titleMissing:d}){let{t:f}=(0,o.useTranslation)();return(0,a.jsxs)(`div`,{className:`bento-glass flex items-center justify-between gap-4 rounded-2xl px-4 py-3 shadow-md backdrop-blur-xl`,children:[(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[e&&(0,a.jsx)(`p`,{className:`truncate text-base font-semibold tracking-tight md:text-lg`,children:e}),(0,a.jsx)(F,{titleMissing:d,dirty:u}),n&&(0,a.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:n})]}),(0,a.jsx)(`div`,{className:`flex shrink-0 gap-2`,children:r??(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(t.o,{type:`submit`,size:`sm`,loading:c,"aria-disabled":l?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),f(`forms.formActions.saveChanges`)]}),i&&(0,a.jsxs)(t.o,{type:`button`,variant:`outline`,size:`sm`,onClick:i,children:[(0,a.jsx)(s.IconX,{className:`size-4`}),f(`forms.formActions.cancel`)]})]})})]})}function Qe({children:e}){return(0,a.jsx)(`span`,{className:`rounded-full border border-border/60 bg-card/50 px-2 py-0.5 text-[10px] uppercase tracking-wider text-muted-foreground backdrop-blur`,children:e})}Ze.Badge=Qe;function $e(e){let t=(0,i.useRef)(null);return I(t),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{ref:t,"aria-hidden":!0,className:`h-px`}),(0,a.jsx)(`div`,{"aria-hidden":!0,className:`bento-save-bar-spacer`}),(0,a.jsx)(`div`,{className:`bento-fade-in fixed inset-x-0 top-20 z-20 mx-auto w-full max-w-7xl px-4 md:px-8`,children:(0,a.jsx)(Ze,{...e})})]})}function et({eyebrow:e,backTo:n,backLabel:r,trail:i,leading:c,title:l,subtitle:u,trailing:d,onCancel:f,actions:p,loading:m,dirty:h,titleMissing:g,saveDisabled:_,stickyTitle:v,stickyBadges:y}){let{t:b}=(0,o.useTranslation)(),x=_??(!!g||!h),S=j(i,n,r)??e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(M,{eyebrow:S,leading:c,title:l,subtitle:u,trailing:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{className:`bento-fade-out flex shrink-0 items-center gap-2`,children:p??(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(t.o,{type:`submit`,size:`sm`,loading:m,"aria-disabled":x?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),b(`forms.formActions.saveChanges`)]}),(0,a.jsxs)(t.o,{type:`button`,variant:`outline`,size:`sm`,onClick:f,children:[(0,a.jsx)(s.IconX,{className:`size-4`}),b(`forms.formActions.cancel`)]})]})}),d]})}),(0,a.jsx)($e,{title:v,badges:y,actions:p,onCancel:f,loading:m,disabled:x,dirty:h,titleMissing:g})]})}var tt=`bento-tile bento-glass relative flex flex-col gap-5 overflow-hidden rounded-3xl p-5 md:p-6`;function nt({icon:t,tone:n,title:r,description:i,children:o,trailing:s,as:c=`h2`,className:l}){return(0,a.jsxs)(`section`,{className:e.t(tt,l),children:[(0,a.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,a.jsx)(`span`,{className:`grid h-10 w-10 place-items-center rounded-2xl text-white shadow-md ${S(n)}`,children:(0,a.jsx)(t,{size:20})}),(0,a.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,a.jsx)(c,{className:`text-base font-semibold tracking-tight md:text-lg`,children:r}),i&&(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i})]})]}),s&&(0,a.jsx)(`div`,{className:`shrink-0`,children:s})]}),(0,a.jsx)(`div`,{className:`flex flex-col gap-5`,children:o})]})}function rt({children:t,className:n,contentClassName:r}){return(0,a.jsx)(`div`,{className:e.t(`bento-glass rounded-2xl shadow-md`,n),children:(0,a.jsx)(`div`,{className:r,children:t})})}var it=480;function at(e){return window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)}function ot(){return window.scrollY>it}function st({inline:e=!1}={}){let{t}=(0,o.useTranslation)(),r=n.o(),c=e||r,l=(0,i.useSyncExternalStore)(at,ot,()=>!1);return(0,a.jsx)(`button`,{type:`button`,"aria-label":t(`bento.backToTop`,{defaultValue:`Back to top`}),tabIndex:l?0:-1,onClick:()=>window.scrollTo({top:0,behavior:`smooth`}),className:`${c?`relative`:`fixed bottom-6 right-6 z-40`} grid h-11 w-11 place-items-center rounded-full border border-border/60 bg-card/80 text-foreground shadow-lg backdrop-blur-xl transition-all duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] hover:-translate-y-0.5 hover:shadow-xl active:scale-95 ${l?`pointer-events-auto translate-y-0 scale-100 opacity-100`:`pointer-events-none translate-y-4 scale-90 opacity-0`}`,children:(0,a.jsx)(s.IconArrowUp,{size:18})})}function ct(e){return e.bentoRoute??e.fallbackRoute}function lt({label:e,children:t}){return e?(0,a.jsxs)(`div`,{role:`group`,"aria-label":e,children:[(0,a.jsx)(`p`,{className:`px-3 pt-2 pb-1 text-xs font-medium text-muted-foreground`,children:e}),t]}):(0,a.jsx)(a.Fragment,{children:t})}function ut({index:e,active:t,icon:n,label:r,description:i,trailing:o,onActivate:c,onChoose:l}){return(0,a.jsxs)(`button`,{type:`button`,id:`bento-palette-opt-${e}`,"data-index":e,role:`option`,"aria-selected":t?`true`:`false`,onMouseEnter:c,onClick:l,className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${t?`bg-accent text-accent-foreground`:`text-foreground`}`,children:[n&&(0,a.jsx)(n,{size:18,className:`shrink-0 text-muted-foreground`}),(0,a.jsxs)(`span`,{className:`flex-1 truncate`,children:[r,i&&(0,a.jsx)(`span`,{className:`ml-2 text-muted-foreground`,children:i})]}),o??(t&&(0,a.jsx)(s.IconArrowRight,{"aria-hidden":!0,size:15,className:`shrink-0 text-muted-foreground`}))]})}function dt({open:e,onOpenChange:n,items:r,group:c,onQueryChange:l}){let{t:d}=(0,o.useTranslation)(),f=(0,u.useNavigate)(),[p,m]=(0,i.useState)(``),[h,g]=(0,i.useState)(0),_=(0,i.useRef)(null),v=(0,i.useMemo)(()=>{let e=p.trim().toLowerCase(),t=r.map(e=>({item:e,label:d(e.titleKey),description:d(e.descriptionKey)}));if(!e)return t;let n=[],i=[];for(let r of t)r.label.toLowerCase().includes(e)?n.push(r):r.description.toLowerCase().includes(e)&&i.push(r);return[...n,...i]},[r,p,d]),y=(0,i.useMemo)(()=>[...v.map(e=>({kind:`nav`,entry:e})),...(c?.items??[]).map(e=>({kind:`supplied`,item:e}))],[v,c]),b=(0,i.useRef)(l);(0,i.useEffect)(()=>{b.current=l}),(0,i.useEffect)(()=>{b.current?.(p)},[p]);let[x,S]=(0,i.useState)(e);e!==x&&(S(e),e&&(m(``),g(0)));let C=y.length===0?0:y.length-1;h>C&&g(C),(0,i.useEffect)(()=>{(_.current?.querySelector(`[data-index="${h}"]`))?.scrollIntoView({block:`nearest`})},[h]);function w(e){n(!1),e.kind===`nav`?f(ct(e.entry.item)):c?.onSelect(e.item)}function T(e){if(e.key===`ArrowDown`)e.preventDefault(),g(e=>y.length===0?0:(e+1)%y.length);else if(e.key===`ArrowUp`)e.preventDefault(),g(e=>y.length===0?0:(e-1+y.length)%y.length);else if(e.key===`Enter`){e.preventDefault();let t=y[h];t&&w(t)}}return(0,a.jsx)(t.c,{open:e,onOpenChange:n,children:(0,a.jsxs)(t.u,{showCloseButton:!1,className:`top-[15%] max-w-xl translate-y-0 gap-0 overflow-hidden p-0`,onKeyDown:T,children:[(0,a.jsx)(t.g,{className:`sr-only`,children:d(`bento.palette.title`,{defaultValue:`Command palette`})}),(0,a.jsx)(t.d,{className:`sr-only`,children:d(`bento.palette.description`,{defaultValue:`Search and jump to any area`})}),(0,a.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border/60 px-4`,children:[(0,a.jsx)(s.IconSearch,{size:18,className:`shrink-0 text-muted-foreground`}),(0,a.jsx)(`input`,{autoFocus:!0,type:`text`,role:`combobox`,"aria-expanded":`true`,"aria-controls":`bento-palette-list`,"aria-activedescendant":y[h]?`bento-palette-opt-${h}`:void 0,value:p,onChange:e=>m(e.target.value),placeholder:d(`bento.palette.placeholder`,{defaultValue:`Search areas…`}),className:`h-12 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground`})]}),(0,a.jsxs)(`div`,{ref:_,id:`bento-palette-list`,role:`listbox`,"aria-label":d(`bento.palette.title`,{defaultValue:`Command palette`}),className:`max-h-80 overflow-y-auto p-2`,children:[y.length===0&&!c?.pending&&(0,a.jsx)(`p`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:d(`bento.palette.noResults`,{defaultValue:`No matches`})}),(0,a.jsx)(lt,{label:c&&v.length>0?d(`bento.palette.areas`,{defaultValue:`Areas`}):void 0,children:v.map(({item:e,label:t},n)=>(0,a.jsx)(ut,{index:n,active:n===h,icon:e.icon,label:t,onActivate:()=>g(n),onChoose:()=>w(y[n]),trailing:e.bentoRoute?void 0:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.IconExternalLink,{"aria-hidden":!0,size:15,className:`shrink-0 text-muted-foreground/70`}),(0,a.jsx)(`span`,{className:`sr-only`,children:d(`bento.palette.opensConsole`,{defaultValue:`Opens in console`})})]})},e.id))}),c&&(0,a.jsxs)(lt,{label:c.label,children:[c.items.map((e,t)=>{let n=v.length+t;return(0,a.jsx)(ut,{index:n,active:n===h,icon:e.icon,label:e.label,description:e.description,onActivate:()=>g(n),onChoose:()=>w(y[n])},e.id)}),c.pending&&(0,a.jsx)(`p`,{className:`px-3 py-2.5 text-sm text-muted-foreground`,children:d(`bento.palette.searching`,{defaultValue:`Searching…`})})]})]})]})})}function ft({rail:t,headerStart:r,headerEnd:s,column:c=`default`,dock:l,backToTop:d=!0,children:f}){let{t:p}=(0,o.useTranslation)(),m=(0,u.useInRouterContext)(),h=(0,i.useId)(),g=(0,i.useRef)(null),_=(0,i.useRef)(null),v=c===`full`,y=r!=null||s!=null,b=n.m(),x=null;l!=null&&(x=b?y?`header`:`corner`:t==null?`corner`:`rail`);let S=d||x===`corner`,C=e=>(0,a.jsx)(n.r.Provider,{value:!0,children:(0,a.jsx)(n.i.Provider,{value:e,children:l})});return(0,a.jsxs)(`div`,{"data-slot":`bento-shell`,className:e.t(`relative w-full bg-background text-foreground`,t!=null&&`bento-rail-gutter`,v?`flex h-svh flex-col overflow-hidden`:`min-h-svh`),style:x===`rail`?{"--bento-rail-foot":`4.5rem`}:void 0,children:[(0,a.jsx)(`a`,{href:`#${h}`,onClick:e=>{e.preventDefault(),g.current?.focus()},className:`sr-only rounded-full border border-border/60 bg-card px-4 py-2 text-sm shadow-lg focus:not-sr-only focus:fixed focus:left-4 focus:top-4 focus:z-[60]`,children:p(`bento.shell.skip`,{defaultValue:`Skip to content`})}),(0,a.jsx)(`span`,{ref:_,role:`status`,"aria-live":`polite`,className:`sr-only`}),m&&(0,a.jsx)(pt,{main:g,announcer:_}),t,x===`rail`&&(0,a.jsx)(`div`,{"data-slot":`bento-shell-dock`,className:`pointer-events-none fixed bottom-4 left-[18px] z-50 flex flex-col items-start`,children:C(`rail`)}),y&&(0,a.jsxs)(`header`,{className:`bento-shell-header bento-shell-bar sticky top-0 z-30 flex shrink-0 items-center justify-between gap-3 border-b border-border/40 bg-background/55 py-3 backdrop-blur-xl backdrop-saturate-150`,children:[(0,a.jsx)(`div`,{className:`flex min-w-0 items-center gap-3`,children:r}),(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,x===`header`&&(0,a.jsx)(`div`,{"data-slot":`bento-shell-dock`,className:`relative flex`,children:C(`header`)})]})]}),(0,a.jsx)(`main`,{ref:g,id:h,tabIndex:-1,"aria-label":p(`bento.shell.main`,{defaultValue:`Main content`}),"data-column":c,className:`bento-shell-main`,children:f}),S&&(0,a.jsx)(`div`,{"data-slot":`bento-shell-corner`,className:`pointer-events-none fixed bottom-5 right-5 z-50 flex flex-col items-end gap-3`,children:(0,a.jsxs)(n.r.Provider,{value:!0,children:[d&&(0,a.jsx)(st,{}),x===`corner`&&C(`corner`)]})})]})}function pt({main:e,announcer:t}){let{pathname:n}=(0,u.useLocation)(),r=(0,i.useRef)(n);return(0,i.useEffect)(()=>{if(r.current===n)return;r.current=n;let i=0,a,o=()=>{let n=e.current?.querySelector(`h1`)??null;if(!n&&i++<20){a=setTimeout(o,50);return}n&&!n.hasAttribute(`tabindex`)&&n.setAttribute(`tabindex`,`-1`),(n??e.current)?.focus(),t.current&&(t.current.textContent=n?.textContent?.trim()||document.title)};return o(),()=>clearTimeout(a)},[n,e,t]),null}var mt=Object.freeze([{action:`palette`,key:`k`,mod:!0},{action:`palette`,key:`/`},{action:`shortcuts`,key:`?`}]);function ht(){return typeof navigator>`u`?!1:/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent||``)}function gt(e,t){let n=e.key.length===1?e.key.toUpperCase():e.key;return e.mod?[t?`⌘`:`Ctrl`,n]:[n]}function _t(e){if(!(e instanceof HTMLElement))return!1;if([`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)||e.isContentEditable)return!0;let t=e.closest(`[contenteditable]`);return t!==null&&t.getAttribute(`contenteditable`)!==`false`}function vt(e,t){if(e.defaultPrevented||e.isComposing||e.repeat)return;let n=e.key.toLowerCase();return mt.find(r=>n===r.key?r.mod?(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.altKey&&!e.shiftKey:e.metaKey||_t(e.target)?!1:e.ctrlKey===e.altKey:!1)}function yt({onPalette:e,onShortcuts:t,isMac:n=ht()}){let r=(0,i.useRef)({onPalette:e,onShortcuts:t});(0,i.useEffect)(()=>{r.current={onPalette:e,onShortcuts:t}}),(0,i.useEffect)(()=>{function e(e){let t=vt(e,n),i=t?.action===`palette`?r.current.onPalette:t&&r.current.onShortcuts;i&&(e.preventDefault(),i())}return globalThis.addEventListener(`keydown`,e),()=>globalThis.removeEventListener(`keydown`,e)},[n])}function bt({onClick:t,isMac:n=ht(),className:r}){let{t:i}=(0,o.useTranslation)(),c=mt.filter(e=>e.action===`palette`),l=c.find(e=>e.mod);return(0,a.jsxs)(`button`,{type:`button`,onClick:t,"aria-keyshortcuts":c.map(e=>e.mod?`${n?`Meta`:`Control`}+${e.key.toUpperCase()}`:e.key).join(` `),className:e.t(`bento-tile bento-tile-clickable inline-flex items-center gap-2 rounded-full border border-border/60 bg-card/60 py-1.5 pl-3 pr-2 text-sm text-muted-foreground backdrop-blur hover:text-foreground`,r),children:[(0,a.jsx)(s.IconSearch,{"aria-hidden":!0,size:16}),(0,a.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:i(`bento.palette.search`,{defaultValue:`Search`})}),l&&(0,a.jsx)(`kbd`,{"aria-hidden":!0,className:`hidden rounded border border-border/60 bg-muted px-1.5 py-0.5 text-[10px] font-medium tracking-wide sm:inline`,children:gt(l,n).join(n?``:` `)})]})}function xt({open:e,onOpenChange:n,isMac:r=ht()}){let{t:c}=(0,o.useTranslation)(),l={palette:c(`bento.palette.open`,{defaultValue:`Open command palette`}),shortcuts:c(`bento.shortcuts.openGuide`,{defaultValue:`Show keyboard shortcuts`})},u=[...new Set(mt.map(e=>e.action))],d=[{heading:c(`bento.shortcuts.global`,{defaultValue:`Global`}),rows:u.map(e=>({id:e,label:l[e],combos:mt.filter(t=>t.action===e).map(e=>gt(e,r))}))},{heading:c(`bento.shortcuts.palette`,{defaultValue:`Command palette`}),rows:[{id:`navigate`,combos:[[`↑`,`↓`]],label:c(`bento.shortcuts.navigate`,{defaultValue:`Move between results`})},{id:`open`,combos:[[`↵`]],label:c(`bento.shortcuts.openSelected`,{defaultValue:`Open the selected area`})},{id:`dismiss`,combos:[[`Esc`]],label:c(`bento.shortcuts.dismiss`,{defaultValue:`Close the palette or a dialog`})}]}];return(0,a.jsx)(t.c,{open:e,onOpenChange:n,children:(0,a.jsxs)(t.u,{className:`max-w-md`,children:[(0,a.jsxs)(t.p,{children:[(0,a.jsxs)(t.g,{className:`flex items-center gap-2`,children:[(0,a.jsx)(s.IconKeyboard,{size:20,className:`bento-accent-icon`}),c(`bento.shortcuts.title`,{defaultValue:`Keyboard shortcuts`})]}),(0,a.jsx)(t.d,{children:c(`bento.shortcuts.description`,{defaultValue:`Move around without leaving the keyboard.`})})]}),(0,a.jsx)(`div`,{className:`flex flex-col gap-5`,children:d.map(e=>(0,a.jsxs)(`section`,{children:[(0,a.jsx)(`h3`,{className:`mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e.heading}),(0,a.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:e.rows.map(e=>(0,a.jsxs)(`li`,{"data-shortcut":e.id,className:`flex items-center justify-between gap-4`,children:[(0,a.jsx)(`span`,{className:`text-sm text-foreground`,children:e.label}),(0,a.jsx)(`span`,{className:`flex shrink-0 items-center gap-1`,children:e.combos.map((e,t)=>(0,a.jsxs)(i.Fragment,{children:[t>0&&(0,a.jsx)(`span`,{className:`px-0.5 text-[11px] text-muted-foreground`,children:c(`bento.shortcuts.or`,{defaultValue:`or`})}),e.map(e=>(0,a.jsx)(`kbd`,{className:`inline-flex min-w-6 items-center justify-center rounded-md border border-border/60 bg-muted px-1.5 py-0.5 text-[11px] font-medium tracking-wide`,children:e},e))]},e.join(`+`)))})]},e.id))})]},e.heading))})]})})}var St=s.IconLayoutGrid;function Ct(e,t){return e===t||e.startsWith(`${t}/`)}function wt(e,t){return t.section.areaRoute&&Ct(e,t.section.areaRoute)?!0:t.items.some(t=>t.bentoRoute&&Ct(e,t.bentoRoute))}function Tt(e){return e.items.reduce((e,t)=>e+(t.count&&t.count>0?t.count:0),0)}function Et({groups:e,homeRoute:t,homeAliases:r,homeLabel:c}){let{t:l}=(0,o.useTranslation)(),{pathname:d}=(0,u.useLocation)(),f=(0,i.useMemo)(()=>e.filter(e=>!!e.section.areaRoute),[e]),p=d===t||(r?.includes(d)??!1);return(0,a.jsx)(n._,{delayDuration:200,children:(0,a.jsxs)(`nav`,{"aria-label":l(`bento.nav.label`,{defaultValue:`Primary`}),className:`fixed inset-y-0 left-0 z-40 hidden w-20 flex-col items-center gap-1 overflow-y-auto overflow-x-hidden border-r border-border/40 bg-background/55 pt-20 pb-[calc(1rem+var(--bento-rail-foot,0px))] backdrop-blur-xl backdrop-saturate-150 md:flex`,children:[(0,a.jsx)(Dt,{to:t,icon:s.IconHome,label:c??l(`home.title`,{defaultValue:`Home`}),shown:!0,active:p}),f.length>0&&(0,a.jsx)(`span`,{"aria-hidden":!0,className:`my-1 h-px w-6 bg-border/60`}),f.map(e=>(0,a.jsx)(Dt,{to:e.section.areaRoute,icon:e.section.icon??St,label:e.section.labelKey?l(e.section.labelKey):e.section.id,shown:!!e.section.labelKey,count:Tt(e),active:wt(d,e)},e.section.id))]})})}function Dt({to:e,icon:t,label:r,shown:i,count:s=0,active:c}){let{t:l}=(0,o.useTranslation)(),d=s>0?l(`bento.nav.count`,{count:s,defaultValue:`{{count}} waiting`}):null,f=(0,a.jsxs)(u.Link,{to:e,"aria-label":d?`${r}, ${d}`:r,"aria-current":c?`page`:void 0,className:`group flex w-full shrink-0 flex-col items-center gap-1 px-1 py-0.5 ${c?`text-primary`:`text-muted-foreground hover:text-foreground`}`,children:[(0,a.jsxs)(`span`,{className:`bento-tile-clickable relative grid h-11 w-11 place-items-center rounded-2xl border transition-colors duration-200 ${c?`bento-rail-active`:`border-transparent group-hover:border-border/60 group-hover:bg-card/60`}`,children:[(0,a.jsx)(t,{size:20}),s>0&&(0,a.jsx)(`span`,{"aria-hidden":!0,"data-slot":`bento-rail-count`,className:`absolute -right-1 -top-1 min-w-4 rounded-full bg-primary px-1 text-center text-[0.6875rem] leading-4 text-primary-foreground`,children:s>99?`99+`:s})]}),i&&(0,a.jsx)(`span`,{"aria-hidden":!0,title:r,className:`w-full truncate text-center text-[0.6875rem] leading-4`,children:r})]});return i?f:(0,a.jsxs)(n.h,{children:[(0,a.jsx)(n.v,{asChild:!0,children:f}),(0,a.jsx)(n.g,{side:`right`,children:r})]})}function Ot({accountRoute:e,logoutUrl:t,organizationsRoute:r,tenantAdminRoute:i,onOpenShortcuts:c,onReplayTour:l}){let{user:d,status:f}=n.n(),{t:p}=(0,o.useTranslation)(),m=(0,u.useNavigate)(),h=`${d.firstName??``} ${d.lastName??``}`.trim()||d.username||``;return f===`loading`?(0,a.jsx)(`div`,{className:`h-9 w-9 rounded-full bg-muted/40`,"aria-hidden":!0}):(0,a.jsxs)(n.M,{children:[(0,a.jsx)(n.K,{asChild:!0,children:(0,a.jsx)(`button`,{type:`button`,title:h||d.username,className:`bento-tile-clickable cursor-pointer rounded-full p-0.5 ring-1 ring-border/60 outline-none transition-shadow duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] bento-ring hover:ring-2 focus-visible:ring-2 focus-visible:ring-ring`,children:(0,a.jsx)(n.s,{givenName:d.firstName,familyName:d.lastName,name:h||d.username,src:d.avatarUrl||void 0,alt:d.username})})}),(0,a.jsxs)(n.P,{align:`end`,sideOffset:10,className:`bento-dropdown min-w-64 p-2`,children:[(0,a.jsx)(n.L,{className:`p-0 font-normal`,children:(0,a.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl px-2 py-2 text-left text-sm`,children:[(0,a.jsx)(`span`,{className:`rounded-full p-0.5 ring-1 ring-border/60`,children:(0,a.jsx)(n.s,{givenName:d.firstName,familyName:d.lastName,name:h||d.username,src:d.avatarUrl||void 0,alt:d.username})}),(0,a.jsxs)(`div`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[h&&(0,a.jsx)(`span`,{className:`truncate font-medium`,children:h}),d.email&&(0,a.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:d.email})]})]})}),(0,a.jsx)(n.V,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.F,{children:[(0,a.jsxs)(n.I,{onSelect:()=>m(e),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconUserCircle,{size:18}),p(`nav.account`)]}),r&&(0,a.jsxs)(n.I,{onSelect:()=>m(r),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconBuildingCommunity,{size:18}),p(`nav.organizations`,{defaultValue:`Organizations`})]}),i&&(0,a.jsxs)(n.I,{onSelect:()=>m(i),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconBuildingSkyscraper,{size:18}),p(`nav.tenantAdmin`,{defaultValue:`Tenant administration`})]})]}),(c||l)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.V,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.F,{children:[l&&(0,a.jsxs)(n.I,{onSelect:()=>l(),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconSparkles,{size:18}),p(`bento.tour.replay`,{defaultValue:`Take the tour`})]}),c&&(0,a.jsxs)(n.I,{onSelect:()=>c(),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconKeyboard,{size:18}),p(`bento.shortcuts.title`,{defaultValue:`Keyboard shortcuts`})]})]})]}),(0,a.jsx)(n.V,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.I,{onSelect:()=>{globalThis.location.href=t},className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2 bento-item-danger`,children:[(0,a.jsx)(s.IconLogout,{size:18}),p(`nav.logOut`)]})]})]})}var kt={blue:`blue`,violet:`violet`,emerald:`emerald`,amber:`amber`,rose:`rose`,slate:`slate`,cyan:`blue`,orange:`amber`};function At({variant:t=`blue`,className:r,children:o}){let s;i.Children.forEach(o,e=>{if(!(0,i.isValidElement)(e))return;let{type:t}=e;(t===n.y.Header||t===n.y.StaticHeader)&&(s??=e.props)});let c=i.Children.map(o,e=>{if(!(0,i.isValidElement)(e))return e;let{type:t}=e;return t===n.y.Header||t===n.y.StaticHeader?null:t===n.y.Content?e.props.children:e});return s?(0,a.jsx)(nt,{icon:s.icon,tone:kt[t]??`blue`,title:s.title,description:s.description,className:r,children:c}):(0,a.jsx)(`section`,{className:e.t(tt,r),children:c})}At.Header=n.y.Header,At.StaticHeader=n.y.StaticHeader,At.Content=n.y.Content;var jt=`bento-grid grid auto-rows-[minmax(140px,auto)] grid-cols-2 gap-4 md:grid-cols-4 md:gap-5 lg:grid-cols-6`;function Mt({eyebrow:e,title:t,description:n,titleHref:r,children:i,gridClassName:o=jt}){let c=(0,a.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight md:text-2xl`,children:t});return(0,a.jsxs)(`section`,{className:`mb-8 md:mb-10`,children:[(0,a.jsxs)(`header`,{className:`bento-shell-header mb-4 flex flex-col gap-0.5`,children:[e&&(0,a.jsx)(`span`,{className:`text-xs uppercase tracking-[0.18em] text-muted-foreground`,children:e}),r?(0,a.jsxs)(u.Link,{to:r,className:`group inline-flex w-fit items-center gap-1 text-foreground transition-colors hover:text-primary`,children:[c,(0,a.jsx)(s.IconChevronRight,{size:20,className:`text-muted-foreground transition-transform duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] group-hover:translate-x-1`})]}):c,n&&(0,a.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:n})]}),(0,a.jsx)(`div`,{className:o,children:i})]})}function Nt({to:t,onClick:n,disabled:r=!1,disabledHint:i,icon:o,tone:c,eyebrow:l,title:d,span:f,featured:p=!1,children:m}){let h=!r&&!!(t||n),g=p?`h-14 w-14 rounded-2xl`:`h-9 w-9 rounded-2xl`,_=p?28:18,v=p?`text-xl font-semibold tracking-tight md:text-2xl`:`text-base font-semibold tracking-tight md:text-lg`,y=(0,a.jsxs)(a.Fragment,{children:[p&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute -bottom-10 -right-10 h-64 w-64 rounded-full ${S(c)} opacity-40 blur-2xl dark:opacity-50`}),(0,a.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute right-12 top-1/3 h-32 w-32 rounded-full ${S(c)} bento-chip-tr opacity-20 blur-2xl dark:opacity-30`})]}),(0,a.jsxs)(`div`,{className:`relative z-1 flex items-center justify-between`,children:[(0,a.jsx)(`span`,{className:`grid place-items-center ${S(c)} text-white shadow-md ${g}`,children:(0,a.jsx)(o,{size:_})}),h&&(0,a.jsx)(s.IconChevronRight,{size:p?18:16,className:`text-muted-foreground transition-transform duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] group-hover:translate-x-1`})]}),(0,a.jsxs)(`div`,{className:`relative z-1`,children:[(0,a.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground`,children:l}),(0,a.jsx)(`div`,{className:`mt-0.5 ${v}`,children:d}),m&&(0,a.jsx)(`div`,{className:`mt-2`,children:m})]})]}),b=`bento-tile bento-glass group relative flex flex-col ${p?`gap-5`:`gap-4`} overflow-hidden text-left ${p?`p-6 md:p-7`:`p-5`} ${f}${h?` bento-tile-clickable`:``}${r?` cursor-not-allowed opacity-60`:``}`;return r?(0,a.jsx)(`div`,{className:b,"aria-disabled":`true`,title:i,children:y}):t?(0,a.jsx)(u.Link,{to:t,className:b,children:y}):n?(0,a.jsx)(`button`,{type:`button`,onClick:n,className:e.t(`w-full`,b),children:y}):(0,a.jsx)(`div`,{className:b,children:y})}function Pt({versions:t,selected:n,onSelect:r,label:c}){let{t:l,i18n:u}=(0,o.useTranslation)(),[d,f]=(0,i.useState)(0),[p,m]=(0,i.useState)([]),h=(0,i.useRef)(new Map),g=e=>[...e].sort((e,n)=>t.findIndex(e=>e.id===n)-t.findIndex(t=>t.id===e));function _(e){if(n.includes(e)){m(p.filter(t=>t!==e)),r(n.filter(t=>t!==e));return}let t=[...n.filter(e=>!p.includes(e)),...p.filter(e=>n.includes(e))],i=t.length>=2?t.slice(t.length-1):t;m([...i,e]),r(g([...i,e]))}function v(e){let n=Math.max(0,Math.min(t.length-1,e));f(n),h.current.get(n)?.focus()}function y(e,n){switch(e.key){case`ArrowDown`:v(n+1);break;case`ArrowUp`:v(n-1);break;case`Home`:v(0);break;case`End`:v(t.length-1);break;case` `:case`Enter`:_(t[n].id);break;default:return}e.preventDefault()}let b=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?{iso:void 0,text:String(e)}:{iso:t.toISOString(),text:new Intl.DateTimeFormat(u?.resolvedLanguage,{dateStyle:`medium`,timeStyle:`short`}).format(t)}};return(0,a.jsx)(`ul`,{role:`listbox`,"aria-label":c??l(`bento.versions.label`,{defaultValue:`Versions`}),"aria-multiselectable":`true`,"data-slot":`bento-version-rail`,className:`m-0 flex list-none flex-col gap-1 p-0`,children:t.map((r,i)=>{let o=n.includes(r.id),c=b(r.at),u=r.actor===`agent`?s.IconRobot:s.IconUser,p=o?`text-foreground/80`:`text-muted-foreground`;return(0,a.jsxs)(`li`,{ref:e=>{e?h.current.set(i,e):h.current.delete(i)},role:`option`,"aria-selected":o?`true`:`false`,tabIndex:i===Math.min(d,t.length-1)?0:-1,onKeyDown:e=>y(e,i),onClick:()=>{f(i),_(r.id)},className:e.t(`flex cursor-pointer flex-col gap-0.5 rounded-xl border px-3 py-2 text-sm outline-none transition-colors`,`focus-visible:ring-2 focus-visible:ring-ring`,o?`border-primary/50 bg-primary/10`:`border-transparent hover:bg-muted/50`),children:[(0,a.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,a.jsx)(u,{size:14,"aria-hidden":`true`}),r.author,(0,a.jsx)(`span`,{className:e.t(`text-xs font-normal`,p),children:r.actor===`agent`?l(`bento.versions.agent`,{defaultValue:`Agent`}):l(`bento.versions.human`,{defaultValue:`Person`})})]}),(0,a.jsx)(`time`,{dateTime:c.iso,className:e.t(`text-xs`,p),children:c.text}),r.summary&&(0,a.jsx)(`span`,{className:`text-xs`,children:r.summary})]},r.id)})})}exports.AdaptiveSectionCard=At,exports.BENTO_EMPHASIS_NEXT=Oe,exports.BENTO_EMPHASIS_SPAN=De,exports.BENTO_SHELL_SHORTCUTS=mt,exports.BENTO_TONES=x,exports.BENTO_TONE_CLASS=b,exports.BentoActionsMenu=y,exports.BentoBackLink=A,exports.BentoBackToTop=st,exports.BentoCalendar=Te,exports.BentoChangeMark=R,exports.BentoCommandPalette=dt,exports.BentoCountTile=C,exports.BentoDataTable=E,exports.BentoDiff=U,exports.BentoEmptyState=D,exports.BentoEntityShell=ee,exports.BentoEntityTile=je,exports.BentoFilterBar=Ie,exports.BentoFormHero=et,exports.BentoFormSection=nt,exports.BentoHero=M,exports.BentoHeroIconPicker=N,exports.BentoInlineEdit=P,exports.BentoListPage=He,exports.BentoNavRail=Et,exports.BentoPaletteTrigger=bt,exports.BentoPanel=rt,exports.BentoSaveBar=Ze,exports.BentoScrollSaveBar=$e,exports.BentoSection=Mt,exports.BentoShell=ft,exports.BentoShortcutsDialog=xt,exports.BentoSplitPage=ve,exports.BentoStatusMarker=F,exports.BentoTile=Nt,exports.BentoTileGrid=Ue,exports.BentoTrail=k,exports.BentoUserMenu=Ot,exports.BentoVersionRail=Pt,exports.EMPTY_FILTERS=Me,exports.bentoChipClass=S,exports.bentoNavTarget=ct,exports.resolveBentoLayout=ke,exports.toBentoLayoutEntries=Ae,exports.useBentoScrollFade=I,exports.useBentoShellShortcuts=yt;
5
+ `):t.field.format?t.field.format(t.b):H(t.b)})},t.field.id))})]})]})}function W({label:e,state:t,children:n}){return(0,a.jsxs)(`div`,{className:`rounded-xl border border-border/60 bg-card/40 p-3`,children:[(0,a.jsxs)(`dt`,{className:`mb-1.5 flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,a.jsx)(`span`,{children:e}),(0,a.jsx)(R,{state:t})]}),(0,a.jsx)(`dd`,{className:`m-0`,children:n})]})}function ne({row:e,layout:t}){let{t:n}=(0,o.useTranslation)(),{field:r,a:i,b:s,kind:c,state:l}=e;if(c===`lines`)return(0,a.jsx)(ae,{label:r.label,before:H(i),after:H(s),layout:t});if(c===`value`){let e=e=>r.format?r.format(e):H(e);return(0,a.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[l!==`added`&&(0,a.jsx)(X,{children:e(i)}),l===`changed`&&(0,a.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),l!==`removed`&&(0,a.jsx)(me,{children:e(s)})]})}let u=c===`rich`?V(H(i)):[H(i)].filter(Boolean),d=c===`rich`?V(H(s)):[H(s)].filter(Boolean),f=z(u,d,!1)??[...u.map(e=>({op:`remove`,text:e})),...d.map(e=>({op:`add`,text:e}))],p=[];for(let e=0;e<f.length;e++){let t=f[e],n=f[e+1];if(t.op===`remove`&&n?.op===`add`){let r=z(B(t.text),B(n.text));p.push((0,a.jsx)(`p`,{className:`m-0 whitespace-pre-wrap text-sm leading-relaxed`,children:r?r.map((e,t)=>e.op===`same`?(0,a.jsx)(`span`,{children:e.text},t):e.op===`add`?(0,a.jsx)(me,{children:e.text},t):(0,a.jsx)(X,{children:e.text},t)):[(0,a.jsx)(X,{children:t.text},`r`),` `,(0,a.jsx)(me,{children:n.text},`a`)]},e)),e++}else p.push((0,a.jsx)(`p`,{className:`m-0 whitespace-pre-wrap text-sm leading-relaxed`,children:t.op===`same`?t.text:t.op===`add`?(0,a.jsx)(me,{children:t.text}):(0,a.jsx)(X,{children:t.text})},e))}return p.length===0?(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:n(`bento.diff.empty`,{defaultValue:`Empty`})}):(0,a.jsx)(`div`,{className:`flex flex-col gap-2`,children:p})}var re=3,G=e=>e===``?[]:e.replace(/\r?\n$/,``).split(/\r?\n/);function ie(e,t){let n=G(e),r=G(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;let a=0;for(;a<n.length-i&&a<r.length-i&&n[n.length-1-a]===r[r.length-1-a];)a++;let o=z(n.slice(i,n.length-a),r.slice(i,r.length-a),!1);if(o===null)return null;let s=[],c=0,l=0,u=e=>s.push({op:`same`,text:e,old:++c,new:++l});n.slice(0,i).forEach(u);let d=[],f=[],p=()=>{for(let e=0;e<Math.min(d.length,f.length);e++){let t=z(B(d[e].text),B(f[e].text));t&&(d[e].parts=t.filter(e=>e.op!==`add`),f[e].parts=t.filter(e=>e.op!==`remove`))}s.push(...d,...f),d=[],f=[]};for(let e of o)e.op===`remove`?d.push({op:`remove`,text:e.text,old:++c}):e.op===`add`?f.push({op:`add`,text:e.text,new:++l}):(p(),u(e.text));return p(),n.slice(n.length-a).forEach(u),s}function K(e){let t=[],n=0;for(;n<e.length;){if(e[n].op===`same`){t.push({left:e[n],right:e[n]}),n++;continue}let r=[],i=[];for(;n<e.length&&e[n].op!==`same`;n++)(e[n].op===`remove`?r:i).push(e[n]);for(let e=0;e<Math.max(r.length,i.length);e++)t.push({left:r[e]??null,right:i[e]??null})}return t}function q(e,t,n){let r=Array(e.length).fill(!1);e.forEach((n,i)=>{if(t(n))for(let t=Math.max(0,i-re);t<=Math.min(e.length-1,i+re);t++)r[t]=!0});let i=[],a=0;for(;a<e.length;){let t=a,o=r[a];for(;a<e.length&&r[a]===o;)a++;let s=e.slice(t,a);o||s.length===1?i.push({fold:!1,items:s}):i.push({fold:!0,key:n(s[0]),items:s})}return i}function ae({label:t,before:n,after:r,layout:c}){let{t:l}=(0,o.useTranslation)(),[u,d]=(0,i.useState)(new Set),f=ie(n,r);if(f===null)return(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:l(`bento.diff.tooLarge`,{defaultValue:`Too many lines changed to compare them here`})});if(f.length===0)return(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:l(`bento.diff.empty`,{defaultValue:`Empty`})});let p=e=>{let t=new Set(u);t.delete(e)||t.add(e),d(t)};function m(t,n,r){let i=u.has(t.key);return[(0,a.jsx)(`tr`,{children:(0,a.jsx)(`td`,{colSpan:n,className:`bg-muted/40 px-2`,children:(0,a.jsxs)(`button`,{type:`button`,"aria-expanded":i?`true`:`false`,onClick:()=>p(t.key),className:`inline-flex items-center gap-1 rounded-md font-sans text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,a.jsx)(s.IconChevronRight,{size:12,"aria-hidden":`true`,className:e.t(`transition-transform`,i&&`rotate-90`)}),l(`bento.diff.unchangedLines`,{defaultValue:`{{count}} unchanged lines`,count:t.items.length})]})})},`fold-${t.key}`),...i?t.items.map(r):[]]}let h=t=>(0,a.jsx)(`table`,{"data-layout":`inline`,className:e.t(`min-w-full border-collapse font-mono text-xs leading-5`,t),children:(0,a.jsx)(`tbody`,{children:q(f,e=>e.op!==`same`,J).map(e=>{let t=e=>(0,a.jsx)(ue,{row:e},J(e));return e.fold?m(e,4,t):e.items.map(t)})})});return(0,a.jsx)(`section`,{"aria-label":t,tabIndex:0,className:`@container/diff overflow-x-auto rounded-md border border-border/60 focus-visible:outline-2 focus-visible:outline-ring`,children:c===`split`?(0,a.jsxs)(a.Fragment,{children:[h(`@3xl/diff:hidden`),(t=>(0,a.jsxs)(`table`,{"data-layout":`split`,className:e.t(`w-full table-fixed border-collapse font-mono text-xs leading-5`,t),children:[(0,a.jsxs)(`colgroup`,{children:[(0,a.jsx)(`col`,{className:`w-14`}),(0,a.jsx)(`col`,{className:`w-5`}),(0,a.jsx)(`col`,{}),(0,a.jsx)(`col`,{className:`w-14`}),(0,a.jsx)(`col`,{className:`w-5`}),(0,a.jsx)(`col`,{})]}),(0,a.jsx)(`tbody`,{children:q(K(f),e=>e.left?.op!==`same`,oe).map(e=>{let t=e=>(0,a.jsx)(de,{pair:e},oe(e));return e.fold?m(e,6,t):e.items.map(t)})})]}))(`hidden @3xl/diff:table`)]}):h()})}var J=e=>`${e.old??``}:${e.new??``}`,oe=e=>`${e.left?.old??``}:${e.right?.new??``}`,Y=t=>e.t(t.op===`add`&&`bento-status bento-status-on`,t.op===`remove`&&`bento-status bento-status-error`);function se(e){return e.parts?e.parts.map((e,t)=>e.op===`add`?(0,a.jsx)(me,{children:e.text},t):e.op===`remove`?(0,a.jsx)(X,{children:e.text},t):(0,a.jsx)(`span`,{children:e.text},t)):e.op===`same`?e.text:(0,a.jsx)(pe,{op:e.op,children:e.text})}var ce={same:` `,add:`+`,remove:`−`},le=`select-none px-2 text-right align-top text-muted-foreground tabular-nums`;function ue({row:t}){let n=Y(t);return(0,a.jsxs)(`tr`,{"data-op":t.op,children:[(0,a.jsx)(`td`,{className:e.t(`w-px`,le,n),children:t.old}),(0,a.jsx)(`td`,{className:e.t(`w-px`,le,n),children:t.new}),(0,a.jsx)(`td`,{"aria-hidden":`true`,className:e.t(`w-px select-none pr-1`,n),children:ce[t.op]}),(0,a.jsx)(`td`,{className:e.t(`whitespace-pre pr-3`,!t.parts&&n),children:se(t)})]})}function de({pair:e}){return(0,a.jsxs)(`tr`,{"data-op":e.left?.op===`same`?`same`:`change`,children:[(0,a.jsx)(fe,{row:e.left,number:e.left?.old}),(0,a.jsx)(fe,{row:e.right,number:e.right?.new,right:!0})]})}function fe({row:t,number:n,right:r=!1}){if(t===null)return(0,a.jsx)(`td`,{colSpan:3,"data-empty":``,className:e.t(`[background-image:repeating-linear-gradient(-45deg,var(--color-border)_0_1px,transparent_0_6px)]`,r&&`border-l border-border/60`)});let i=Y(t);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`td`,{className:e.t(le,i,r&&`border-l border-border/60`),children:n}),(0,a.jsx)(`td`,{"aria-hidden":`true`,className:e.t(`select-none align-top`,i),children:ce[t.op]}),(0,a.jsx)(`td`,{className:e.t(`whitespace-pre-wrap pr-3 [overflow-wrap:anywhere]`,!t.parts&&i),children:se(t)})]})}function pe({op:e,children:t}){let{t:n}=(0,o.useTranslation)();return(0,a.jsxs)(e===`add`?`ins`:`del`,{className:`no-underline`,children:[(0,a.jsxs)(`span`,{className:`sr-only`,children:[e===`add`?n(`bento.diff.addedStart`,{defaultValue:`added:`}):n(`bento.diff.removedStart`,{defaultValue:`removed:`}),` `]}),t]})}function me({children:e}){let{t}=(0,o.useTranslation)();return(0,a.jsxs)(`ins`,{className:`bento-status bento-status-on rounded-sm px-0.5 underline decoration-2 underline-offset-2`,children:[(0,a.jsxs)(`span`,{className:`sr-only`,children:[t(`bento.diff.addedStart`,{defaultValue:`added:`}),` `]}),e]})}function X({children:e}){let{t}=(0,o.useTranslation)();return(0,a.jsxs)(`del`,{className:`bento-status bento-status-error rounded-sm px-0.5 line-through decoration-2`,children:[(0,a.jsxs)(`span`,{className:`sr-only`,children:[t(`bento.diff.removedStart`,{defaultValue:`removed:`}),` `]}),e]})}var he=[`primary`,`secondary`],ge={getItem:e=>{try{return window.localStorage.getItem(e)}catch{return null}},setItem:(e,t)=>{try{window.localStorage.setItem(e,t)}catch{}}},_e={getItem:()=>null,setItem:()=>{}};function ve({primary:t,secondary:r,primaryLabel:i,secondaryLabel:s,storageKey:c,defaultRatio:u=50,className:d}){let{t:f}=(0,o.useTranslation)(),p=n.m(),m=(0,l.useDefaultLayout)({id:c??`bento-split-page`,panelIds:he,storage:c?ge:_e});return p?(0,a.jsxs)(n.l,{"data-slot":`bento-split-page`,defaultValue:`primary`,className:e.t(`flex flex-col gap-3`,d),children:[(0,a.jsxs)(n.d,{"aria-label":f(`bento.split.switch`,{defaultValue:`Show`}),className:`self-start`,children:[(0,a.jsx)(n.f,{value:`primary`,children:i}),(0,a.jsx)(n.f,{value:`secondary`,children:s})]}),(0,a.jsx)(n.u,{value:`primary`,forceMount:!0,className:`data-[state=inactive]:hidden`,children:t}),(0,a.jsx)(n.u,{value:`secondary`,forceMount:!0,className:`data-[state=inactive]:hidden`,children:r})]}):(0,a.jsx)(`div`,{"data-slot":`bento-split-page`,className:e.t(`h-[var(--bento-split-height,calc(100dvh-12rem))] min-h-80`,d),children:(0,a.jsxs)(n.C,{orientation:`horizontal`,defaultLayout:m.defaultLayout,onLayoutChanged:m.onLayoutChanged,children:[(0,a.jsx)(n.S,{id:`primary`,defaultSize:`${u}`,minSize:`25`,children:(0,a.jsx)(`section`,{"aria-label":i,className:`h-full overflow-y-auto pr-3`,children:t})}),(0,a.jsx)(n.x,{withHandle:!0}),(0,a.jsx)(n.S,{id:`secondary`,defaultSize:`${100-u}`,minSize:`25`,children:(0,a.jsx)(`section`,{"aria-label":s,className:`h-full overflow-y-auto pl-3`,children:r})})]})})}var Z=({y:e,m:t,d:n})=>`${e}-${String(t).padStart(2,`0`)}-${String(n).padStart(2,`0`)}`,Q=({y:e,m:t,d:n})=>Date.UTC(e,t-1,n),ye=e=>{let t=new Date(e);return{y:t.getUTCFullYear(),m:t.getUTCMonth()+1,d:t.getUTCDate()}},$=(e,t)=>ye(Q(e)+t*864e5),be=(e,t)=>{let n=new Date(Date.UTC(e.y,e.m-1+t,1)),r=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return{y:n.getUTCFullYear(),m:n.getUTCMonth()+1,d:Math.min(e.d,r)}},xe=e=>new Date(Q(e)).getUTCDay();function Se(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,hourCycle:`h23`}).formatToParts(new Date(e)),r=e=>Number(n.find(t=>t.type===e)?.value);return{y:r(`year`),m:r(`month`),d:r(`day`),h:r(`hour`),mi:r(`minute`),s:r(`second`)}}function Ce(e,t,n,r,i,a){let o=Date.UTC(e.y,e.m-1,e.d,t,n,r),s=e=>{let t=Se(e,a);return Date.UTC(t.y,t.m-1,t.d,t.h,t.mi,t.s)-Math.floor(e/1e3)*1e3},c=o-s(o),l=s(c);return o-l!==c&&(c=o-l),new Date(c+i)}var we={on:`bento-status bento-status-on`,warn:`bento-status bento-status-warn`,error:`bento-status bento-status-error`};function Te({entries:t,view:n,defaultView:r=`month`,onViewChange:c,defaultDate:l,timeZone:u=Intl.DateTimeFormat().resolvedOptions().timeZone,weekStartsOn:d=0,onEntryMove:f,onEntrySelect:p,onRangeChange:m,label:h,className:g}){let{t:_,i18n:v}=(0,o.useTranslation)(),y=v?.resolvedLanguage??v?.language,b=e=>{let t=Se(new Date(e).getTime(),u);return{y:t.y,m:t.m,d:t.d}},[x,S]=(0,i.useState)(r),C=n??x,[w,T]=(0,i.useState)(()=>b(l??Date.now())),[E,D]=(0,i.useState)(null),[O,k]=(0,i.useState)(null),[A,j]=(0,i.useState)(``),M=(0,i.useRef)(new Map),N=(0,i.useRef)(!1),P=(0,i.useId)(),[F]=(0,i.useState)(()=>Z(b(Date.now()))),I=e=>$(e,-((xe(e)-d+7)%7)),L=I(C===`month`?{...w,d:1}:w),ee=C===`month`?Math.ceil((Q(be({...w,d:1},1))-Q(L))/6048e5):1,te=Array.from({length:ee},(e,t)=>Array.from({length:7},(e,n)=>$(L,t*7+n))),R=$(L,ee*7),z=`${Z(L)}/${Z(R)}`;(0,i.useEffect)(()=>{m?.({start:Ce(L,0,0,0,0,u),end:Ce(R,0,0,0,0,u)})},[z,u]),(0,i.useEffect)(()=>{N.current&&(N.current=!1,M.current.get(Z(w))?.focus())});let B=new Map;for(let e of t){let t=new Date(e.start).getTime();if(Number.isNaN(t))continue;let n=Z(b(t)),r=B.get(n)??[];r.push({entry:e,time:t}),B.set(n,r)}for(let e of B.values())e.sort((e,t)=>e.time-t.time);let V=e=>new Intl.DateTimeFormat(y,{...e,timeZone:`UTC`}),H=e=>V({dateStyle:`full`}).format(Q(e)),U=e=>new Intl.DateTimeFormat(y,{timeStyle:`short`,timeZone:u}).format(e),W=C===`month`?V({month:`long`,year:`numeric`}).format(Q({...w,d:1})):`${V({dateStyle:`medium`}).format(Q(L))} – ${V({dateStyle:`medium`}).format(Q($(R,-1)))}`;function ne(e){N.current=!0,T(e)}function re(e){n===void 0&&S(e),c?.(e)}let G=e=>C===`month`?be(w,e):$(w,7*e);function ie(e,n){let r=t.find(t=>t.id===e);if(!r||!f)return;let i=new Date(r.start).getTime(),a=Se(i,u);Z(a)!==Z(n)&&f(e,Ce(n,a.h,a.mi,a.s,i%1e3,u)),j(_(`bento.calendar.moved`,{defaultValue:`Moved {{label}} to {{day}}.`,label:r.label,day:H(n)}))}function K(e,n){let r={ArrowLeft:()=>$(n,-1),ArrowRight:()=>$(n,1),ArrowUp:()=>$(n,-7),ArrowDown:()=>$(n,7),Home:()=>I(n),End:()=>$(I(n),6),PageUp:()=>G(-1),PageDown:()=>G(1)}[e.key];if(r){e.preventDefault(),ne(r());return}if(E&&(e.key===`Enter`||e.key===` `))e.preventDefault(),ie(E,n),D(null);else if(E&&e.key===`Escape`){e.preventDefault();let n=t.find(e=>e.id===E);D(null),j(_(`bento.calendar.cancelled`,{defaultValue:`Put {{label}} back.`,label:n?.label??``}))}else e.key===`Enter`&&(e.preventDefault(),e.currentTarget.querySelector(`button`)?.focus())}function q(e,t){let n=e.currentTarget.closest(`td`),r=n?[...n.querySelectorAll(`button`)]:[],i=r.indexOf(e.currentTarget),a=f&&(e.key===` `||e.key===`Enter`&&!p);if(e.key===`ArrowDown`||e.key===`ArrowUp`)r[i+(e.key===`ArrowDown`?1:-1)]?.focus();else if(e.key===`Escape`)n?.focus();else if(a)D(t.id),j(_(`bento.calendar.picked`,{defaultValue:`Picked up {{label}}. Choose a day and press Enter.`,label:t.label})),n?.focus();else if(e.key===`Enter`&&p)p(t.id);else return;e.preventDefault(),e.stopPropagation()}function ae(e,t){let n=O??e.dataTransfer.getData(`text/plain`);k(null),n&&(e.preventDefault(),ie(n,t))}let J=f?P:void 0;return(0,a.jsxs)(`div`,{"data-slot":`bento-calendar`,className:e.t(`flex flex-col gap-3`,g),children:[(0,a.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,a.jsx)(Ee,{label:_(`bento.calendar.previous`,{defaultValue:`Previous`}),onClick:()=>T(G(-1)),children:(0,a.jsx)(s.IconChevronLeft,{size:16,"aria-hidden":`true`})}),(0,a.jsx)(Ee,{label:_(`bento.calendar.next`,{defaultValue:`Next`}),onClick:()=>T(G(1)),children:(0,a.jsx)(s.IconChevronRight,{size:16,"aria-hidden":`true`})}),(0,a.jsx)(`button`,{type:`button`,onClick:()=>T(b(Date.now())),className:`rounded-md border border-border px-2 py-1 text-sm hover:bg-muted/50 focus-visible:outline-2 focus-visible:outline-ring`,children:_(`bento.calendar.today`,{defaultValue:`Today`})}),(0,a.jsx)(`h2`,{className:`m-0 ml-2 text-base font-semibold`,"aria-live":`polite`,children:W})]}),(0,a.jsx)(`div`,{role:`group`,"aria-label":_(`bento.calendar.views`,{defaultValue:`View`}),className:`flex rounded-md border border-border p-0.5`,children:[`month`,`week`].map(t=>(0,a.jsx)(`button`,{type:`button`,"aria-pressed":C===t?`true`:`false`,onClick:()=>re(t),className:e.t(`rounded px-2 py-0.5 text-sm focus-visible:outline-2 focus-visible:outline-ring`,C===t?`bg-primary text-primary-foreground`:`hover:bg-muted/50`),children:t===`month`?_(`bento.calendar.month`,{defaultValue:`Month`}):_(`bento.calendar.week`,{defaultValue:`Week`})},t))})]}),(0,a.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:A}),J&&(0,a.jsx)(`span`,{id:J,className:`sr-only`,children:_(`bento.calendar.moveHint`,{defaultValue:`Space picks this up to move it: the arrow keys choose a day, Enter drops it and Escape cancels.`})}),(0,a.jsxs)(`table`,{role:`grid`,"aria-label":h??W,className:`w-full table-fixed border-collapse text-sm`,children:[(0,a.jsx)(`thead`,{children:(0,a.jsx)(`tr`,{children:te[0].map(e=>(0,a.jsx)(`th`,{scope:`col`,abbr:V({weekday:`long`}).format(Q(e)),className:`pb-1 text-xs font-medium text-muted-foreground`,children:V({weekday:`short`}).format(Q(e))},Z(e)))})}),(0,a.jsx)(`tbody`,{children:te.map(t=>(0,a.jsx)(`tr`,{children:t.map(t=>{let n=Z(t),r=B.get(n)??[],i=n===Z(w),o=C===`month`&&t.m!==w.m,s=r.length;return(0,a.jsxs)(`td`,{ref:e=>{e?M.current.set(n,e):M.current.delete(n)},role:`gridcell`,tabIndex:i?0:-1,"aria-label":s>0?`${H(t)}, ${_(`bento.calendar.entries`,{defaultValue:`{{count}} scheduled`,count:s})}`:H(t),"aria-current":n===F?`date`:void 0,"data-day":n,onKeyDown:e=>K(e,t),onFocus:()=>{i||T(t)},onDragOver:e=>{O&&e.preventDefault()},onDrop:e=>ae(e,t),className:e.t(`border border-border/60 p-1 align-top outline-none`,C===`month`?`h-24`:`h-48`,`focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,E&&i&&`bg-primary/10`),children:[(0,a.jsx)(`span`,{"aria-hidden":`true`,className:e.t(`mb-1 inline-grid size-6 place-items-center rounded-full text-xs`,n===F&&`bg-primary font-semibold text-primary-foreground`,n!==F&&o&&`text-muted-foreground`),children:t.d}),(0,a.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:r.map(({entry:t,time:n})=>(0,a.jsx)(`li`,{children:(0,a.jsxs)(`button`,{type:`button`,tabIndex:-1,draggable:f?!0:void 0,"aria-describedby":J,"aria-pressed":f?E===t.id?`true`:`false`:void 0,"data-entry":t.id,onKeyDown:e=>q(e,t),onClick:()=>p?.(t.id),onDragStart:e=>{e.dataTransfer.setData(`text/plain`,t.id),e.dataTransfer.effectAllowed=`move`,k(t.id)},onDragEnd:()=>k(null),className:e.t(`flex w-full min-w-0 items-baseline gap-1 rounded-md px-1 py-0.5 text-left text-xs focus-visible:outline-2 focus-visible:outline-ring`,t.tone?we[t.tone]:`bg-muted`,E===t.id&&`outline-2 outline-dashed outline-primary`),children:[(0,a.jsx)(`time`,{dateTime:new Date(n).toISOString(),className:`flex-none tabular-nums`,children:U(n)}),(0,a.jsx)(`span`,{className:`truncate`,children:t.label})]})},t.id))})]},n)})},Z(t[0])))})]})]})}function Ee({label:e,onClick:t,children:n}){return(0,a.jsx)(`button`,{type:`button`,"aria-label":e,onClick:t,className:`grid size-7 place-items-center rounded-md border border-border hover:bg-muted/50 focus-visible:outline-2 focus-visible:outline-ring`,children:n})}var De={LARGE:`col-span-2 row-span-2 md:col-span-2 md:row-span-2 lg:col-span-2 lg:row-span-2`,MEDIUM:`col-span-2 row-span-1 md:col-span-2 md:row-span-1 lg:col-span-2 lg:row-span-1`,SMALL:`col-span-1 row-span-1`},Oe={SMALL:`MEDIUM`,MEDIUM:`LARGE`,LARGE:`SMALL`};function ke(e,t,n){if(!n||n.length===0)return e.map((e,n)=>({item:e,key:t(e),emphasis:n===0?`LARGE`:`MEDIUM`}));let r=new Map,i=new Map;for(let e of n)r.set(e.itemId,e.displayOrder),i.set(e.itemId,e.emphasis);return e.map((e,n)=>({item:e,key:t(e),idx:n})).sort((e,t)=>{let n=r.has(e.key)?r.get(e.key):2**53-1,i=r.has(t.key)?r.get(t.key):2**53-1;return n===i?e.idx-t.idx:n-i}).map(({item:e,key:t})=>({item:e,key:t,emphasis:i.get(t)??`MEDIUM`}))}function Ae(e){return e.map((e,t)=>({itemId:e.key,emphasis:e.emphasis,displayOrder:t}))}function je({to:e,emphasis:t,featured:n,defaultIcon:r,icon:i,tone:s=`indigo`,title:l,description:d,meta:f,enabled:p,hasStatus:m=!1,viewTransitionName:h}){let{t:g}=(0,o.useTranslation)(),_=S(s),v=t??(n?`LARGE`:`MEDIUM`),y=v===`LARGE`,b=v===`SMALL`,x=De[v],C=p===1,w=y?`p-6 md:p-7`:b?`p-4`:`p-5`,T=y?`h-14 w-14`:b?`h-8 w-8`:`h-9 w-9`,E=y?28:b?16:18,D=y?`text-xl md:text-2xl`:b?`text-sm`:`text-base md:text-lg`;return(0,a.jsxs)(u.Link,{to:e,className:`bento-tile bento-tile-clickable bento-glass group relative flex flex-col ${y?`gap-5`:`gap-4`} overflow-hidden ${w} ${x}`,style:h?{viewTransitionName:h}:void 0,children:[y&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute -bottom-10 -right-10 h-64 w-64 rounded-full ${_} opacity-40 blur-2xl dark:opacity-50`}),(0,a.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute right-12 top-1/3 h-32 w-32 rounded-full ${_} bento-chip-tr opacity-20 blur-2xl dark:opacity-30`})]}),(0,a.jsxs)(`div`,{className:`relative z-1 flex items-center justify-between`,children:[(0,a.jsx)(`span`,{className:`grid place-items-center rounded-2xl ${_} text-white shadow-md ${T}`,children:i?(0,a.jsx)(c.Icon,{icon:i,className:y?`size-7 text-white`:`size-4.5 text-white`}):(0,a.jsx)(r,{size:E})}),m&&(0,a.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-wider ${C?`bento-status bento-status-on`:`border-border bg-muted text-muted-foreground`}`,children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${C?`bento-status-dot bento-pulse`:`bg-muted-foreground/60`}`}),C?g(`common.active`,{defaultValue:`Active`}):g(`common.idle`,{defaultValue:`Idle`})]})]}),(0,a.jsxs)(`div`,{className:`relative z-1`,children:[(0,a.jsx)(`div`,{className:`font-semibold tracking-tight ${D}`,children:l}),!b&&f&&(0,a.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:f}),!b&&d&&(0,a.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:d})]})]})}var Me={query:``,facets:{}},Ne=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Pe=e=>Array.isArray(e)?e:[];function Fe(e,t,n){let r={...e.facets};return n===void 0||Array.isArray(n)&&n.length===0||Ne(n)&&!n.from&&!n.to?delete r[t]:r[t]=n,{...e,facets:r}}function Ie({value:e,onChange:r,facets:c,queryLabel:l,queryDelay:u=300,views:d}){let{t:f}=(0,o.useTranslation)(),[p,m]=(0,i.useState)({source:e.query,text:e.query}),[h,g]=(0,i.useState)(null);p.source!==e.query&&m({source:e.query,text:e.query===h?p.text:e.query}),(0,i.useEffect)(()=>{if(p.text===e.query)return;let t=setTimeout(()=>{g(p.text),r({...e,query:p.text})},u);return()=>clearTimeout(t)},[p.text,e,r,u]);let _=[];for(let t of c){let n=e.facets[t.id];if(t.kind===`choice`)for(let r of Pe(n)){let i=t.options.find(e=>e.value===r);_.push({key:`${t.id}:${r}`,text:`${t.label}: ${i?.label??r}`,remove:()=>Fe(e,t.id,Pe(n).filter(e=>e!==r))})}else Ne(n)&&(n.from||n.to)&&_.push({key:t.id,text:`${t.label}: ${n.from??`…`} – ${n.to??`…`}`,remove:()=>Fe(e,t.id,void 0)})}let v=_.length>0||e.query!==``,y=l??f(`bento.filters.search`,{defaultValue:`Search`});return(0,a.jsxs)(`div`,{role:`search`,"aria-label":f(`bento.filters.label`,{defaultValue:`Filters`}),"data-slot":`bento-filter-bar`,className:`flex flex-col gap-2`,children:[(0,a.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,a.jsxs)(`div`,{className:`relative min-w-48 flex-1`,children:[(0,a.jsx)(s.IconSearch,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`}),(0,a.jsx)(t.a,{type:`search`,value:p.text,placeholder:y,"aria-label":y,onChange:e=>m({...p,text:e.target.value}),className:`pl-9`})]}),c.map(t=>t.kind===`choice`?(0,a.jsx)(Re,{facet:t,value:e,onChange:r},t.id):(0,a.jsx)(ze,{facet:t,value:e,onChange:r},t.id)),d]}),v&&(0,a.jsxs)(`ul`,{className:`m-0 flex list-none flex-wrap items-center gap-1.5 p-0`,"aria-label":f(`bento.filters.active`,{defaultValue:`Active filters`}),children:[_.map(e=>(0,a.jsx)(`li`,{children:(0,a.jsxs)(`button`,{type:`button`,"aria-label":f(`bento.filters.remove`,{defaultValue:`Remove filter {{filter}}`,filter:e.text}),onClick:()=>r(e.remove()),className:`bento-clear inline-flex items-center gap-1 rounded-full border border-border/60 bg-card/60 py-0.5 pl-2.5 pr-1.5 text-xs`,children:[e.text,(0,a.jsx)(s.IconX,{size:12,"aria-hidden":`true`})]})},e.key)),(0,a.jsx)(`li`,{children:(0,a.jsx)(n.J,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>{m({source:``,text:``}),r(Me)},children:f(`bento.filters.clearAll`,{defaultValue:`Clear all`})})})]})]})}function Le({label:e,count:t,...r}){return(0,a.jsxs)(n.J,{variant:`outline`,size:`sm`,className:`gap-1.5`,...r,children:[e,t>0&&(0,a.jsx)(`span`,{className:`rounded-full bg-primary px-1.5 text-[0.6875rem] leading-4 text-primary-foreground`,children:t}),(0,a.jsx)(s.IconChevronDown,{size:14,"aria-hidden":`true`})]})}function Re({facet:e,value:t,onChange:r}){let i=Pe(t.facets[e.id]);return(0,a.jsxs)(n.M,{children:[(0,a.jsx)(n.K,{asChild:!0,children:(0,a.jsx)(Le,{label:e.label,count:i.length})}),(0,a.jsx)(n.P,{align:`start`,className:`bento-dropdown min-w-44 p-1.5`,children:e.multiple?e.options.map(o=>(0,a.jsx)(n.N,{checked:i.includes(o.value),onCheckedChange:n=>r(Fe(t,e.id,n===!0?[...i,o.value]:i.filter(e=>e!==o.value))),onSelect:e=>e.preventDefault(),children:o.label},o.value)):(0,a.jsx)(n.z,{value:i[0]??``,onValueChange:n=>r(Fe(t,e.id,n===i[0]?[]:[n])),children:e.options.map(e=>(0,a.jsx)(n.B,{value:e.value,children:e.label},e.value))})})]})}function ze({facet:e,value:r,onChange:s}){let{t:c}=(0,o.useTranslation)(),l=r.facets[e.id],u=Ne(l)?l:{},[d,f]=(0,i.useState)(!1),[p,m]=(0,i.useState)(u.from??``),[h,g]=(0,i.useState)(u.to??``),_=(0,i.useId)(),v=(0,i.useId)();return(0,a.jsxs)(n.w,{open:d,onOpenChange:e=>{e&&(m(u.from??``),g(u.to??``)),f(e)},children:[(0,a.jsx)(n.A,{asChild:!0,children:(0,a.jsx)(Le,{label:e.label,count:u.from||u.to?1:0})}),(0,a.jsx)(n.E,{align:`start`,className:`bento-dropdown w-64 p-3`,children:(0,a.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:t=>{t.preventDefault(),s(Fe(r,e.id,{from:p||void 0,to:h||void 0})),f(!1)},children:[(0,a.jsx)(`label`,{htmlFor:_,className:`text-xs text-muted-foreground`,children:c(`bento.filters.from`,{defaultValue:`From`})}),(0,a.jsx)(t.a,{id:_,type:`date`,value:p,max:h||void 0,onChange:e=>m(e.target.value)}),(0,a.jsx)(`label`,{htmlFor:v,className:`text-xs text-muted-foreground`,children:c(`bento.filters.to`,{defaultValue:`To`})}),(0,a.jsx)(t.a,{id:v,type:`date`,value:h,min:p||void 0,onChange:e=>g(e.target.value)}),(0,a.jsx)(n.J,{type:`submit`,size:`sm`,className:`mt-1`,children:c(`bento.filters.apply`,{defaultValue:`Apply`})})]})})]})}var Be=E,Ve=`bento-grid grid auto-rows-[minmax(140px,auto)] grid-cols-2 gap-4 md:grid-cols-4 md:gap-5 lg:grid-cols-6`;function He({items:e,error:t,tryAgainUrl:c,listId:l,eyebrow:d,backTo:f,backLabel:p,trail:m,heroIcon:h,title:g,subtitle:_,tone:v=`indigo`,headerAction:y,newRoute:b,newLabel:x,newSubtitle:C,hideNew:w=!1,itemKey:T,columns:E,rowActions:O,onRowOpen:k,getRowLabel:A,columnLayout:j,onColumnLayoutChange:N,renderTile:P,emptyTitle:F,emptyDescription:I,layout:L}){let{t:ee}=(0,o.useTranslation)(),te=S(v),[R,z]=(0,i.useState)(!1),B=(0,i.useMemo)(()=>ke(e??[],T,L?.data?.entries),[e,T,L?.data?.entries]),V=h?(0,a.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl ${te} text-white shadow-md`,children:(0,a.jsx)(h,{size:24})}):void 0;if(!P)return(0,a.jsxs)(r.t,{checkIsNotUndefined:e,error:t??null,tryAgainUrl:c,children:[(0,a.jsx)(M,{eyebrow:d,backTo:f,backLabel:p,trail:m,leading:V,title:g,subtitle:_,trailing:w?void 0:(0,a.jsx)(n.J,{asChild:!0,className:`gap-2`,children:(0,a.jsxs)(u.Link,{to:b,children:[(0,a.jsx)(s.IconPlus,{size:16}),x]})})}),y&&(0,a.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:y}),e?.length===0?(0,a.jsx)(D,{icon:s.IconSparkles,title:F,description:I}):(0,a.jsx)(Be,{rows:e??[],getRowId:T,columns:E??[],label:g,getRowLabel:A,rowActions:O,onRowOpen:k,layout:j,onLayoutChange:N})]});let H=!!l&&!!L&&(e?.length??0)>0;return(0,a.jsxs)(r.t,{checkIsNotUndefined:e,error:t??null,tryAgainUrl:c,children:[(0,a.jsx)(M,{eyebrow:d,backTo:f,backLabel:p,trail:m,leading:V,title:g,subtitle:_}),(y||H&&!R)&&(0,a.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[y,H&&!R&&(0,a.jsxs)(n.J,{variant:`outline`,size:`sm`,onClick:()=>z(!0),className:`ml-auto gap-2`,children:[(0,a.jsx)(s.IconAdjustmentsHorizontal,{size:16}),ee(`bento.layout.customize`,{defaultValue:`Customize layout`})]})]}),R&&l&&L?(0,a.jsx)(Ge,{layout:L,resolved:B,canEditGlobal:L?.data?.canEditGlobal??!1,isCustomized:L?.data?.source===`USER`,renderTile:P,chip:te,hideNew:w,newRoute:b,newLabel:x,newSubtitle:C,onClose:()=>z(!1)}):(0,a.jsx)(We,{resolved:B,renderTile:P,chip:te,hideNew:w,newRoute:b,newLabel:x,newSubtitle:C,isEmpty:e?.length===0,emptyTitle:F,emptyDescription:I})]})}function Ue({items:e,error:t,tryAgainUrl:n,tone:i=`indigo`,newRoute:o,newLabel:s,newSubtitle:c,hideNew:l=!1,itemKey:u,renderTile:d,emptyTitle:f,emptyDescription:p}){let m=S(i);return(0,a.jsx)(r.t,{checkIsNotUndefined:e,error:t??null,tryAgainUrl:n,children:(0,a.jsxs)(`div`,{"data-slot":`bento-list-tiles`,className:Ve,children:[!l&&o&&s?(0,a.jsx)(Ye,{route:o,label:s,subtitle:c,chip:m}):null,(e??[]).map(e=>(0,a.jsx)(`span`,{className:`contents`,children:d(e)},u(e))),e?.length===0&&(0,a.jsx)(Xe,{title:f,description:p})]})})}function We({resolved:t,renderTile:n,chip:r,hideNew:i,newRoute:o,newLabel:s,newSubtitle:c,isEmpty:l,emptyTitle:u,emptyDescription:d}){let f=t.some(e=>e.emphasis===`SMALL`);return(0,a.jsxs)(`div`,{"data-slot":`bento-list-tiles`,className:e.t(Ve,f&&`grid-flow-dense`),children:[!i&&(0,a.jsx)(Ye,{route:o,label:s,subtitle:c,chip:r}),t.map(({item:e,key:t,emphasis:r})=>(0,a.jsx)(`span`,{className:`contents`,children:n(e,r)},t)),l&&(0,a.jsx)(Xe,{title:u,description:d})]})}function Ge({layout:t,resolved:r,canEditGlobal:c,isCustomized:l,renderTile:u,chip:d,hideNew:m,newRoute:h,newLabel:g,newSubtitle:_,onClose:v}){let{t:y}=(0,o.useTranslation)(),[b,x]=(0,i.useState)(r),[S,C]=(0,i.useState)(null),w=(t.saving??!1)||S!==null,T=e=>w&&S===e?{loading:!0}:{"aria-disabled":w||void 0},[E,D]=(0,i.useState)(!1),O=(e,t)=>async()=>{if(t){C(e),D(!1);try{await t(),v()}catch(e){console.error(`Failed to save the bento layout`,e),D(!0)}finally{C(null)}}},k=(0,f.useSensors)((0,f.useSensor)(f.PointerSensor,{activationConstraint:{distance:8}}),(0,f.useSensor)(f.KeyboardSensor));function A(e){let{active:t,over:n}=e;!n||t.id===n.id||x(e=>{let r=e.findIndex(e=>e.key===t.id),i=e.findIndex(e=>e.key===n.id);return r<0||i<0?e:(0,p.arrayMove)(e,r,i)})}function j(e,t){x(n=>n.map(n=>n.key===e?{...n,emphasis:t}:n))}let M=(0,i.useMemo)(()=>Ae(b),[b]),N=b.some(e=>e.emphasis===`SMALL`);return(0,a.jsxs)(`div`,{children:[(0,a.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2 rounded-2xl border border-border/60 bg-card/40 p-3 backdrop-blur-md`,children:[(0,a.jsx)(`span`,{className:`mr-auto text-sm text-muted-foreground`,children:y(`bento.layout.editHint`,{defaultValue:`Drag tiles to reorder · tap the size button to resize`})}),l&&t.onReset&&(0,a.jsxs)(n.J,{variant:`ghost`,size:`sm`,className:`gap-2`,...T(`reset`),onClick:O(`reset`,t.onReset),children:[S!==`reset`&&(0,a.jsx)(s.IconArrowBackUp,{size:16}),y(`bento.layout.reset`,{defaultValue:`Reset to default`})]}),c&&t.onSaveGlobal&&(0,a.jsxs)(n.J,{variant:`outline`,size:`sm`,className:`gap-2`,...T(`global`),onClick:O(`global`,()=>t.onSaveGlobal?.(M)),children:[S!==`global`&&(0,a.jsx)(s.IconUsers,{size:16}),y(`bento.layout.saveGlobal`,{defaultValue:`Set as default for everyone`})]}),(0,a.jsxs)(n.J,{variant:`ghost`,size:`sm`,className:`gap-2`,...T(`cancel`),onClick:v,children:[(0,a.jsx)(s.IconX,{size:16}),y(`common.cancel`,{defaultValue:`Cancel`})]}),(0,a.jsxs)(n.J,{size:`sm`,className:`gap-2`,...T(`save`),onClick:O(`save`,()=>t.onSave(M)),children:[S!==`save`&&(0,a.jsx)(s.IconDeviceFloppy,{size:16}),y(`bento.layout.save`,{defaultValue:`Save layout`})]}),E&&(0,a.jsx)(`p`,{role:`alert`,className:`w-full text-sm text-destructive`,children:y(`bento.layout.saveFailed`,{defaultValue:`The layout could not be saved. Nothing has changed — try again.`})})]}),(0,a.jsx)(f.DndContext,{sensors:k,collisionDetection:f.closestCenter,onDragEnd:A,children:(0,a.jsx)(p.SortableContext,{items:b.map(e=>e.key),strategy:p.rectSortingStrategy,children:(0,a.jsxs)(`div`,{"data-slot":`bento-list-tiles`,className:e.t(Ve,N&&`grid-flow-dense`),children:[!m&&(0,a.jsx)(Ye,{route:h,label:g,subtitle:_,chip:d}),b.map(({item:e,key:t,emphasis:n})=>(0,a.jsx)(Je,{id:t,emphasis:n,onSetEmphasis:e=>j(t,e),children:u(e,n)},t))]})})})]})}var Ke=[`SMALL`,`MEDIUM`,`LARGE`],qe={SMALL:{key:`bento.layout.size.small`,def:`Small`},MEDIUM:{key:`bento.layout.size.medium`,def:`Medium`},LARGE:{key:`bento.layout.size.large`,def:`Large`}};function Je({id:t,emphasis:n,onSetEmphasis:r,children:i}){let{t:c}=(0,o.useTranslation)(),{attributes:l,listeners:u,setNodeRef:d,transform:f,transition:h,isDragging:g}=(0,p.useSortable)({id:t}),_={transform:m.CSS.Translate.toString(f),transition:h,opacity:g?.6:1,zIndex:g?50:void 0};return(0,a.jsxs)(`div`,{ref:d,style:_,className:e.t(`relative h-full`,De[n]),children:[(0,a.jsx)(`div`,{className:`pointer-events-none h-full select-none [&>*]:h-full [&>*]:w-full`,children:i}),(0,a.jsxs)(`div`,{className:`absolute right-2 top-2 z-10 flex items-center gap-1`,children:[(0,a.jsx)(`div`,{role:`group`,"aria-label":c(`bento.layout.sizeGroup`,{defaultValue:`Tile size`}),className:`flex items-center gap-0.5 rounded-full border border-border/60 bg-background/80 p-0.5 shadow-sm backdrop-blur`,children:Ke.map(t=>{let i=t===n,o=c(qe[t].key,{defaultValue:qe[t].def});return(0,a.jsx)(`button`,{type:`button`,onClick:()=>r(t),"aria-pressed":i,"aria-label":o,title:o,className:e.t(`grid h-6 w-6 place-items-center rounded-full text-[11px] font-semibold uppercase transition-colors`,i?`bg-primary text-primary-foreground shadow`:`text-muted-foreground hover:bg-muted`),children:o.charAt(0)},t)})}),(0,a.jsx)(`button`,{type:`button`,...l,...u,"aria-label":c(`bento.layout.dragToReorder`,{defaultValue:`Drag to reorder`}),className:`grid h-7 w-7 cursor-grab place-items-center rounded-full border border-border/60 bg-background/80 shadow-sm backdrop-blur hover:bg-background active:cursor-grabbing`,children:(0,a.jsx)(s.IconGripVertical,{size:14,className:`text-muted-foreground`})})]})]})}function Ye({route:e,label:t,subtitle:n,chip:r}){let{t:i}=(0,o.useTranslation)();return(0,a.jsxs)(u.Link,{to:e,className:`bento-tile bento-tile-clickable col-span-2 row-span-1 flex flex-col gap-3 rounded-3xl border-2 border-dashed border-border/60 bg-card/30 p-5 backdrop-blur-md bento-new-tile hover:bg-card/50 md:col-span-2 md:row-span-1 lg:col-span-2 lg:row-span-1`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,a.jsx)(`span`,{className:`bento-pulse grid h-10 w-10 place-items-center rounded-2xl ${r} text-white shadow-md`,children:(0,a.jsx)(s.IconPlus,{size:20})}),(0,a.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground`,children:i(`forms.formActions.new`,{defaultValue:`New`})})]}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`div`,{className:`text-base font-semibold tracking-tight md:text-lg`,children:(0,a.jsx)(`span`,{className:`${r} bg-clip-text text-transparent`,children:t})}),n&&(0,a.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:n})]})]})}function Xe({title:e,description:t}){return(0,a.jsx)(D,{icon:s.IconSparkles,title:e,description:t,align:`start`,className:`col-span-2 row-span-2 justify-end md:col-span-4`})}function Ze({title:e,badges:n,actions:r,onCancel:i,loading:c,disabled:l,dirty:u,titleMissing:d}){let{t:f}=(0,o.useTranslation)();return(0,a.jsxs)(`div`,{className:`bento-glass flex items-center justify-between gap-4 rounded-2xl px-4 py-3 shadow-md backdrop-blur-xl`,children:[(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[e&&(0,a.jsx)(`p`,{className:`truncate text-base font-semibold tracking-tight md:text-lg`,children:e}),(0,a.jsx)(F,{titleMissing:d,dirty:u}),n&&(0,a.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:n})]}),(0,a.jsx)(`div`,{className:`flex shrink-0 gap-2`,children:r??(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(t.o,{type:`submit`,size:`sm`,loading:c,"aria-disabled":l?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),f(`forms.formActions.saveChanges`)]}),i&&(0,a.jsxs)(t.o,{type:`button`,variant:`outline`,size:`sm`,onClick:i,children:[(0,a.jsx)(s.IconX,{className:`size-4`}),f(`forms.formActions.cancel`)]})]})})]})}function Qe({children:e}){return(0,a.jsx)(`span`,{className:`rounded-full border border-border/60 bg-card/50 px-2 py-0.5 text-[10px] uppercase tracking-wider text-muted-foreground backdrop-blur`,children:e})}Ze.Badge=Qe;function $e(e){let t=(0,i.useRef)(null);return I(t),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{ref:t,"aria-hidden":!0,className:`h-px`}),(0,a.jsx)(`div`,{"aria-hidden":!0,className:`bento-save-bar-spacer`}),(0,a.jsx)(`div`,{className:`bento-fade-in fixed inset-x-0 top-20 z-20 mx-auto w-full max-w-7xl px-4 md:px-8`,children:(0,a.jsx)(Ze,{...e})})]})}function et({eyebrow:e,backTo:n,backLabel:r,trail:i,leading:c,title:l,subtitle:u,trailing:d,onCancel:f,actions:p,loading:m,dirty:h,titleMissing:g,saveDisabled:_,stickyTitle:v,stickyBadges:y}){let{t:b}=(0,o.useTranslation)(),x=_??(!!g||!h),S=j(i,n,r)??e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(M,{eyebrow:S,leading:c,title:l,subtitle:u,trailing:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{className:`bento-fade-out flex shrink-0 items-center gap-2`,children:p??(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(t.o,{type:`submit`,size:`sm`,loading:m,"aria-disabled":x?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),b(`forms.formActions.saveChanges`)]}),(0,a.jsxs)(t.o,{type:`button`,variant:`outline`,size:`sm`,onClick:f,children:[(0,a.jsx)(s.IconX,{className:`size-4`}),b(`forms.formActions.cancel`)]})]})}),d]})}),(0,a.jsx)($e,{title:v,badges:y,actions:p,onCancel:f,loading:m,disabled:x,dirty:h,titleMissing:g})]})}var tt=`bento-tile bento-glass relative flex flex-col gap-5 overflow-hidden rounded-3xl p-5 md:p-6`;function nt({icon:t,tone:n,title:r,description:i,children:o,trailing:s,as:c=`h2`,className:l}){return(0,a.jsxs)(`section`,{className:e.t(tt,l),children:[(0,a.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,a.jsx)(`span`,{className:`grid h-10 w-10 place-items-center rounded-2xl text-white shadow-md ${S(n)}`,children:(0,a.jsx)(t,{size:20})}),(0,a.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,a.jsx)(c,{className:`text-base font-semibold tracking-tight md:text-lg`,children:r}),i&&(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i})]})]}),s&&(0,a.jsx)(`div`,{className:`shrink-0`,children:s})]}),(0,a.jsx)(`div`,{className:`flex flex-col gap-5`,children:o})]})}function rt({children:t,className:n,contentClassName:r}){return(0,a.jsx)(`div`,{className:e.t(`bento-glass rounded-2xl shadow-md`,n),children:(0,a.jsx)(`div`,{className:r,children:t})})}var it=480;function at(e){return window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)}function ot(){return window.scrollY>it}function st({inline:e=!1}={}){let{t}=(0,o.useTranslation)(),r=n.o(),c=e||r,l=(0,i.useSyncExternalStore)(at,ot,()=>!1);return(0,a.jsx)(`button`,{type:`button`,"aria-label":t(`bento.backToTop`,{defaultValue:`Back to top`}),tabIndex:l?0:-1,onClick:()=>window.scrollTo({top:0,behavior:`smooth`}),className:`${c?`relative`:`fixed bottom-6 right-6 z-40`} grid h-11 w-11 place-items-center rounded-full border border-border/60 bg-card/80 text-foreground shadow-lg backdrop-blur-xl transition-all duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] hover:-translate-y-0.5 hover:shadow-xl active:scale-95 ${l?`pointer-events-auto translate-y-0 scale-100 opacity-100`:`pointer-events-none translate-y-4 scale-90 opacity-0`}`,children:(0,a.jsx)(s.IconArrowUp,{size:18})})}function ct(e){return e.bentoRoute??e.fallbackRoute}function lt({label:e,children:t}){return e?(0,a.jsxs)(`div`,{role:`group`,"aria-label":e,children:[(0,a.jsx)(`p`,{className:`px-3 pt-2 pb-1 text-xs font-medium text-muted-foreground`,children:e}),t]}):(0,a.jsx)(a.Fragment,{children:t})}function ut({index:e,active:t,icon:n,label:r,description:i,trailing:o,onActivate:c,onChoose:l}){return(0,a.jsxs)(`button`,{type:`button`,id:`bento-palette-opt-${e}`,"data-index":e,role:`option`,"aria-selected":t?`true`:`false`,onMouseEnter:c,onClick:l,className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${t?`bg-accent text-accent-foreground`:`text-foreground`}`,children:[n&&(0,a.jsx)(n,{size:18,className:`shrink-0 text-muted-foreground`}),(0,a.jsxs)(`span`,{className:`flex-1 truncate`,children:[r,i&&(0,a.jsx)(`span`,{className:`ml-2 text-muted-foreground`,children:i})]}),o??(t&&(0,a.jsx)(s.IconArrowRight,{"aria-hidden":!0,size:15,className:`shrink-0 text-muted-foreground`}))]})}function dt({open:e,onOpenChange:n,items:r,group:c,onQueryChange:l}){let{t:d}=(0,o.useTranslation)(),f=(0,u.useNavigate)(),[p,m]=(0,i.useState)(``),[h,g]=(0,i.useState)(0),_=(0,i.useRef)(null),v=(0,i.useMemo)(()=>{let e=p.trim().toLowerCase(),t=r.map(e=>({item:e,label:d(e.titleKey),description:d(e.descriptionKey)}));if(!e)return t;let n=[],i=[];for(let r of t)r.label.toLowerCase().includes(e)?n.push(r):r.description.toLowerCase().includes(e)&&i.push(r);return[...n,...i]},[r,p,d]),y=(0,i.useMemo)(()=>[...v.map(e=>({kind:`nav`,entry:e})),...(c?.items??[]).map(e=>({kind:`supplied`,item:e}))],[v,c]),b=(0,i.useRef)(l);(0,i.useEffect)(()=>{b.current=l}),(0,i.useEffect)(()=>{b.current?.(p)},[p]);let[x,S]=(0,i.useState)(e);e!==x&&(S(e),e&&(m(``),g(0)));let C=y.length===0?0:y.length-1;h>C&&g(C),(0,i.useEffect)(()=>{(_.current?.querySelector(`[data-index="${h}"]`))?.scrollIntoView({block:`nearest`})},[h]);function w(e){n(!1),e.kind===`nav`?f(ct(e.entry.item)):c?.onSelect(e.item)}function T(e){if(e.key===`ArrowDown`)e.preventDefault(),g(e=>y.length===0?0:(e+1)%y.length);else if(e.key===`ArrowUp`)e.preventDefault(),g(e=>y.length===0?0:(e-1+y.length)%y.length);else if(e.key===`Enter`){e.preventDefault();let t=y[h];t&&w(t)}}return(0,a.jsx)(t.c,{open:e,onOpenChange:n,children:(0,a.jsxs)(t.u,{showCloseButton:!1,className:`top-[15%] max-w-xl translate-y-0 gap-0 overflow-hidden p-0`,onKeyDown:T,children:[(0,a.jsx)(t.g,{className:`sr-only`,children:d(`bento.palette.title`,{defaultValue:`Command palette`})}),(0,a.jsx)(t.d,{className:`sr-only`,children:d(`bento.palette.description`,{defaultValue:`Search and jump to any area`})}),(0,a.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border/60 px-4`,children:[(0,a.jsx)(s.IconSearch,{size:18,className:`shrink-0 text-muted-foreground`}),(0,a.jsx)(`input`,{autoFocus:!0,type:`text`,role:`combobox`,"aria-expanded":`true`,"aria-controls":`bento-palette-list`,"aria-activedescendant":y[h]?`bento-palette-opt-${h}`:void 0,value:p,onChange:e=>m(e.target.value),placeholder:d(`bento.palette.placeholder`,{defaultValue:`Search areas…`}),className:`h-12 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground`})]}),(0,a.jsxs)(`div`,{ref:_,id:`bento-palette-list`,role:`listbox`,"aria-label":d(`bento.palette.title`,{defaultValue:`Command palette`}),className:`max-h-80 overflow-y-auto p-2`,children:[y.length===0&&!c?.pending&&(0,a.jsx)(`p`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:d(`bento.palette.noResults`,{defaultValue:`No matches`})}),(0,a.jsx)(lt,{label:c&&v.length>0?d(`bento.palette.areas`,{defaultValue:`Areas`}):void 0,children:v.map(({item:e,label:t},n)=>(0,a.jsx)(ut,{index:n,active:n===h,icon:e.icon,label:t,onActivate:()=>g(n),onChoose:()=>w(y[n]),trailing:e.bentoRoute?void 0:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.IconExternalLink,{"aria-hidden":!0,size:15,className:`shrink-0 text-muted-foreground/70`}),(0,a.jsx)(`span`,{className:`sr-only`,children:d(`bento.palette.opensConsole`,{defaultValue:`Opens in console`})})]})},e.id))}),c&&(0,a.jsxs)(lt,{label:c.label,children:[c.items.map((e,t)=>{let n=v.length+t;return(0,a.jsx)(ut,{index:n,active:n===h,icon:e.icon,label:e.label,description:e.description,onActivate:()=>g(n),onChoose:()=>w(y[n])},e.id)}),c.pending&&(0,a.jsx)(`p`,{className:`px-3 py-2.5 text-sm text-muted-foreground`,children:d(`bento.palette.searching`,{defaultValue:`Searching…`})})]})]})]})})}function ft({rail:t,headerStart:r,headerEnd:s,column:c=`default`,dock:l,backToTop:d=!0,children:f}){let{t:p}=(0,o.useTranslation)(),m=(0,u.useInRouterContext)(),h=(0,i.useId)(),g=(0,i.useRef)(null),_=(0,i.useRef)(null),v=c===`full`,y=r!=null||s!=null,b=n.m(),x=null;l!=null&&(x=b?y?`header`:`corner`:t==null?`corner`:`rail`);let S=d||x===`corner`,C=e=>(0,a.jsx)(n.r.Provider,{value:!0,children:(0,a.jsx)(n.i.Provider,{value:e,children:l})});return(0,a.jsxs)(`div`,{"data-slot":`bento-shell`,className:e.t(`relative w-full bg-background text-foreground`,t!=null&&`bento-rail-gutter`,v?`flex h-svh flex-col overflow-hidden`:`min-h-svh`),style:x===`rail`?{"--bento-rail-foot":`4.5rem`}:void 0,children:[(0,a.jsx)(`a`,{href:`#${h}`,onClick:e=>{e.preventDefault(),g.current?.focus()},className:`sr-only rounded-full border border-border/60 bg-card px-4 py-2 text-sm shadow-lg focus:not-sr-only focus:fixed focus:left-4 focus:top-4 focus:z-[60]`,children:p(`bento.shell.skip`,{defaultValue:`Skip to content`})}),(0,a.jsx)(`span`,{ref:_,role:`status`,"aria-live":`polite`,className:`sr-only`}),m&&(0,a.jsx)(pt,{main:g,announcer:_}),t,x===`rail`&&(0,a.jsx)(`div`,{"data-slot":`bento-shell-dock`,className:`pointer-events-none fixed bottom-4 left-[18px] z-50 flex flex-col items-start`,children:C(`rail`)}),y&&(0,a.jsxs)(`header`,{className:`bento-shell-header bento-shell-bar sticky top-0 z-30 flex shrink-0 items-center justify-between gap-3 border-b border-border/40 bg-background/55 py-3 backdrop-blur-xl backdrop-saturate-150`,children:[(0,a.jsx)(`div`,{className:`flex min-w-0 items-center gap-3`,children:r}),(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,x===`header`&&(0,a.jsx)(`div`,{"data-slot":`bento-shell-dock`,className:`relative flex`,children:C(`header`)})]})]}),(0,a.jsx)(`main`,{ref:g,id:h,tabIndex:-1,"aria-label":p(`bento.shell.main`,{defaultValue:`Main content`}),"data-column":c,className:`bento-shell-main`,children:f}),S&&(0,a.jsx)(`div`,{"data-slot":`bento-shell-corner`,className:`pointer-events-none fixed bottom-5 right-5 z-50 flex flex-col items-end gap-3`,children:(0,a.jsxs)(n.r.Provider,{value:!0,children:[d&&(0,a.jsx)(st,{}),x===`corner`&&C(`corner`)]})})]})}function pt({main:e,announcer:t}){let{pathname:n}=(0,u.useLocation)(),r=(0,i.useRef)(n);return(0,i.useEffect)(()=>{if(r.current===n)return;r.current=n;let i=0,a,o=()=>{let n=e.current?.querySelector(`h1`)??null;if(!n&&i++<20){a=setTimeout(o,50);return}n&&!n.hasAttribute(`tabindex`)&&n.setAttribute(`tabindex`,`-1`),(n??e.current)?.focus(),t.current&&(t.current.textContent=n?.textContent?.trim()||document.title)};return o(),()=>clearTimeout(a)},[n,e,t]),null}var mt=Object.freeze([{action:`palette`,key:`k`,mod:!0},{action:`palette`,key:`/`},{action:`shortcuts`,key:`?`}]);function ht(){return typeof navigator>`u`?!1:/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent||``)}function gt(e,t){let n=e.key.length===1?e.key.toUpperCase():e.key;return e.mod?[t?`⌘`:`Ctrl`,n]:[n]}function _t(e){if(!(e instanceof HTMLElement))return!1;if([`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)||e.isContentEditable)return!0;let t=e.closest(`[contenteditable]`);return t!==null&&t.getAttribute(`contenteditable`)!==`false`}function vt(e,t){if(e.defaultPrevented||e.isComposing||e.repeat)return;let n=e.key.toLowerCase();return mt.find(r=>n===r.key?r.mod?(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.altKey&&!e.shiftKey:e.metaKey||_t(e.target)?!1:e.ctrlKey===e.altKey:!1)}function yt({onPalette:e,onShortcuts:t,isMac:n=ht()}){let r=(0,i.useRef)({onPalette:e,onShortcuts:t});(0,i.useEffect)(()=>{r.current={onPalette:e,onShortcuts:t}}),(0,i.useEffect)(()=>{function e(e){let t=vt(e,n),i=t?.action===`palette`?r.current.onPalette:t&&r.current.onShortcuts;i&&(e.preventDefault(),i())}return globalThis.addEventListener(`keydown`,e),()=>globalThis.removeEventListener(`keydown`,e)},[n])}function bt({onClick:t,isMac:n=ht(),className:r}){let{t:i}=(0,o.useTranslation)(),c=mt.filter(e=>e.action===`palette`),l=c.find(e=>e.mod);return(0,a.jsxs)(`button`,{type:`button`,onClick:t,"aria-keyshortcuts":c.map(e=>e.mod?`${n?`Meta`:`Control`}+${e.key.toUpperCase()}`:e.key).join(` `),className:e.t(`bento-tile bento-tile-clickable inline-flex items-center gap-2 rounded-full border border-border/60 bg-card/60 py-1.5 pl-3 pr-2 text-sm text-muted-foreground backdrop-blur hover:text-foreground`,r),children:[(0,a.jsx)(s.IconSearch,{"aria-hidden":!0,size:16}),(0,a.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:i(`bento.palette.search`,{defaultValue:`Search`})}),l&&(0,a.jsx)(`kbd`,{"aria-hidden":!0,className:`hidden rounded border border-border/60 bg-muted px-1.5 py-0.5 text-[10px] font-medium tracking-wide sm:inline`,children:gt(l,n).join(n?``:` `)})]})}function xt({open:e,onOpenChange:n,isMac:r=ht()}){let{t:c}=(0,o.useTranslation)(),l={palette:c(`bento.palette.open`,{defaultValue:`Open command palette`}),shortcuts:c(`bento.shortcuts.openGuide`,{defaultValue:`Show keyboard shortcuts`})},u=[...new Set(mt.map(e=>e.action))],d=[{heading:c(`bento.shortcuts.global`,{defaultValue:`Global`}),rows:u.map(e=>({id:e,label:l[e],combos:mt.filter(t=>t.action===e).map(e=>gt(e,r))}))},{heading:c(`bento.shortcuts.palette`,{defaultValue:`Command palette`}),rows:[{id:`navigate`,combos:[[`↑`,`↓`]],label:c(`bento.shortcuts.navigate`,{defaultValue:`Move between results`})},{id:`open`,combos:[[`↵`]],label:c(`bento.shortcuts.openSelected`,{defaultValue:`Open the selected area`})},{id:`dismiss`,combos:[[`Esc`]],label:c(`bento.shortcuts.dismiss`,{defaultValue:`Close the palette or a dialog`})}]}];return(0,a.jsx)(t.c,{open:e,onOpenChange:n,children:(0,a.jsxs)(t.u,{className:`max-w-md`,children:[(0,a.jsxs)(t.p,{children:[(0,a.jsxs)(t.g,{className:`flex items-center gap-2`,children:[(0,a.jsx)(s.IconKeyboard,{size:20,className:`bento-accent-icon`}),c(`bento.shortcuts.title`,{defaultValue:`Keyboard shortcuts`})]}),(0,a.jsx)(t.d,{children:c(`bento.shortcuts.description`,{defaultValue:`Move around without leaving the keyboard.`})})]}),(0,a.jsx)(`div`,{className:`flex flex-col gap-5`,children:d.map(e=>(0,a.jsxs)(`section`,{children:[(0,a.jsx)(`h3`,{className:`mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e.heading}),(0,a.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:e.rows.map(e=>(0,a.jsxs)(`li`,{"data-shortcut":e.id,className:`flex items-center justify-between gap-4`,children:[(0,a.jsx)(`span`,{className:`text-sm text-foreground`,children:e.label}),(0,a.jsx)(`span`,{className:`flex shrink-0 items-center gap-1`,children:e.combos.map((e,t)=>(0,a.jsxs)(i.Fragment,{children:[t>0&&(0,a.jsx)(`span`,{className:`px-0.5 text-[11px] text-muted-foreground`,children:c(`bento.shortcuts.or`,{defaultValue:`or`})}),e.map(e=>(0,a.jsx)(`kbd`,{className:`inline-flex min-w-6 items-center justify-center rounded-md border border-border/60 bg-muted px-1.5 py-0.5 text-[11px] font-medium tracking-wide`,children:e},e))]},e.join(`+`)))})]},e.id))})]},e.heading))})]})})}var St=s.IconLayoutGrid;function Ct(e,t){return e===t||e.startsWith(`${t}/`)}function wt(e,t){return t.section.areaRoute&&Ct(e,t.section.areaRoute)?!0:t.items.some(t=>t.bentoRoute&&Ct(e,t.bentoRoute))}function Tt(e){return e.items.reduce((e,t)=>e+(t.count&&t.count>0?t.count:0),0)}function Et({groups:e,homeRoute:t,homeAliases:r,homeLabel:c}){let{t:l}=(0,o.useTranslation)(),{pathname:d}=(0,u.useLocation)(),f=(0,i.useMemo)(()=>e.filter(e=>!!e.section.areaRoute),[e]),p=d===t||(r?.includes(d)??!1);return(0,a.jsx)(n._,{delayDuration:200,children:(0,a.jsxs)(`nav`,{"aria-label":l(`bento.nav.label`,{defaultValue:`Primary`}),className:`fixed inset-y-0 left-0 z-40 hidden w-20 flex-col items-center gap-1 overflow-y-auto overflow-x-hidden border-r border-border/40 bg-background/55 pt-20 pb-[calc(1rem+var(--bento-rail-foot,0px))] backdrop-blur-xl backdrop-saturate-150 md:flex`,children:[(0,a.jsx)(Dt,{to:t,icon:s.IconHome,label:c??l(`home.title`,{defaultValue:`Home`}),shown:!0,active:p}),f.length>0&&(0,a.jsx)(`span`,{"aria-hidden":!0,className:`my-1 h-px w-6 bg-border/60`}),f.map(e=>(0,a.jsx)(Dt,{to:e.section.areaRoute,icon:e.section.icon??St,label:e.section.labelKey?l(e.section.labelKey):e.section.id,shown:!!e.section.labelKey,count:Tt(e),active:wt(d,e)},e.section.id))]})})}function Dt({to:e,icon:t,label:r,shown:i,count:s=0,active:c}){let{t:l}=(0,o.useTranslation)(),d=s>0?l(`bento.nav.count`,{count:s,defaultValue:`{{count}} waiting`}):null,f=(0,a.jsxs)(u.Link,{to:e,"aria-label":d?`${r}, ${d}`:r,"aria-current":c?`page`:void 0,className:`group flex w-full shrink-0 flex-col items-center gap-1 px-1 py-0.5 ${c?`text-primary`:`text-muted-foreground hover:text-foreground`}`,children:[(0,a.jsxs)(`span`,{className:`bento-tile-clickable relative grid h-11 w-11 place-items-center rounded-2xl border transition-colors duration-200 ${c?`bento-rail-active`:`border-transparent group-hover:border-border/60 group-hover:bg-card/60`}`,children:[(0,a.jsx)(t,{size:20}),s>0&&(0,a.jsx)(`span`,{"aria-hidden":!0,"data-slot":`bento-rail-count`,className:`absolute -right-1 -top-1 min-w-4 rounded-full bg-primary px-1 text-center text-[0.6875rem] leading-4 text-primary-foreground`,children:s>99?`99+`:s})]}),i&&(0,a.jsx)(`span`,{"aria-hidden":!0,title:r,className:`w-full truncate text-center text-[0.6875rem] leading-4`,children:r})]});return i?f:(0,a.jsxs)(n.h,{children:[(0,a.jsx)(n.v,{asChild:!0,children:f}),(0,a.jsx)(n.g,{side:`right`,children:r})]})}function Ot({accountRoute:e,logoutUrl:t,organizationsRoute:r,tenantAdminRoute:i,onOpenShortcuts:c,onReplayTour:l}){let{user:d,status:f}=n.n(),{t:p}=(0,o.useTranslation)(),m=(0,u.useNavigate)(),h=`${d.firstName??``} ${d.lastName??``}`.trim()||d.username||``;return f===`loading`?(0,a.jsx)(`div`,{className:`h-9 w-9 rounded-full bg-muted/40`,"aria-hidden":!0}):(0,a.jsxs)(n.M,{children:[(0,a.jsx)(n.K,{asChild:!0,children:(0,a.jsx)(`button`,{type:`button`,title:h||d.username,className:`bento-tile-clickable cursor-pointer rounded-full p-0.5 ring-1 ring-border/60 outline-none transition-shadow duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] bento-ring hover:ring-2 focus-visible:ring-2 focus-visible:ring-ring`,children:(0,a.jsx)(n.s,{givenName:d.firstName,familyName:d.lastName,name:h||d.username,src:d.avatarUrl||void 0,alt:d.username})})}),(0,a.jsxs)(n.P,{align:`end`,sideOffset:10,className:`bento-dropdown min-w-64 p-2`,children:[(0,a.jsx)(n.L,{className:`p-0 font-normal`,children:(0,a.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl px-2 py-2 text-left text-sm`,children:[(0,a.jsx)(`span`,{className:`rounded-full p-0.5 ring-1 ring-border/60`,children:(0,a.jsx)(n.s,{givenName:d.firstName,familyName:d.lastName,name:h||d.username,src:d.avatarUrl||void 0,alt:d.username})}),(0,a.jsxs)(`div`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[h&&(0,a.jsx)(`span`,{className:`truncate font-medium`,children:h}),d.email&&(0,a.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:d.email})]})]})}),(0,a.jsx)(n.V,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.F,{children:[(0,a.jsxs)(n.I,{onSelect:()=>m(e),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconUserCircle,{size:18}),p(`nav.account`)]}),r&&(0,a.jsxs)(n.I,{onSelect:()=>m(r),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconBuildingCommunity,{size:18}),p(`nav.organizations`,{defaultValue:`Organizations`})]}),i&&(0,a.jsxs)(n.I,{onSelect:()=>m(i),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconBuildingSkyscraper,{size:18}),p(`nav.tenantAdmin`,{defaultValue:`Tenant administration`})]})]}),(c||l)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.V,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.F,{children:[l&&(0,a.jsxs)(n.I,{onSelect:()=>l(),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconSparkles,{size:18}),p(`bento.tour.replay`,{defaultValue:`Take the tour`})]}),c&&(0,a.jsxs)(n.I,{onSelect:()=>c(),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconKeyboard,{size:18}),p(`bento.shortcuts.title`,{defaultValue:`Keyboard shortcuts`})]})]})]}),(0,a.jsx)(n.V,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.I,{onSelect:()=>{globalThis.location.href=t},className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2 bento-item-danger`,children:[(0,a.jsx)(s.IconLogout,{size:18}),p(`nav.logOut`)]})]})]})}var kt={blue:`blue`,violet:`violet`,emerald:`emerald`,amber:`amber`,rose:`rose`,slate:`slate`,cyan:`blue`,orange:`amber`};function At({variant:t=`blue`,className:r,children:o}){let s;i.Children.forEach(o,e=>{if(!(0,i.isValidElement)(e))return;let{type:t}=e;(t===n.y.Header||t===n.y.StaticHeader)&&(s??=e.props)});let c=i.Children.map(o,e=>{if(!(0,i.isValidElement)(e))return e;let{type:t}=e;return t===n.y.Header||t===n.y.StaticHeader?null:t===n.y.Content?e.props.children:e});return s?(0,a.jsx)(nt,{icon:s.icon,tone:kt[t]??`blue`,title:s.title,description:s.description,className:r,children:c}):(0,a.jsx)(`section`,{className:e.t(tt,r),children:c})}At.Header=n.y.Header,At.StaticHeader=n.y.StaticHeader,At.Content=n.y.Content;var jt=`bento-grid grid auto-rows-[minmax(140px,auto)] grid-cols-2 gap-4 md:grid-cols-4 md:gap-5 lg:grid-cols-6`;function Mt({eyebrow:e,title:t,description:n,titleHref:r,children:i,gridClassName:o=jt}){let c=(0,a.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight md:text-2xl`,children:t});return(0,a.jsxs)(`section`,{className:`mb-8 md:mb-10`,children:[(0,a.jsxs)(`header`,{className:`bento-shell-header mb-4 flex flex-col gap-0.5`,children:[e&&(0,a.jsx)(`span`,{className:`text-xs uppercase tracking-[0.18em] text-muted-foreground`,children:e}),r?(0,a.jsxs)(u.Link,{to:r,className:`group inline-flex w-fit items-center gap-1 text-foreground transition-colors hover:text-primary`,children:[c,(0,a.jsx)(s.IconChevronRight,{size:20,className:`text-muted-foreground transition-transform duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] group-hover:translate-x-1`})]}):c,n&&(0,a.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:n})]}),(0,a.jsx)(`div`,{className:o,children:i})]})}function Nt({to:t,onClick:n,disabled:r=!1,disabledHint:i,icon:o,tone:c,eyebrow:l,title:d,span:f,featured:p=!1,children:m}){let h=!r&&!!(t||n),g=p?`h-14 w-14 rounded-2xl`:`h-9 w-9 rounded-2xl`,_=p?28:18,v=p?`text-xl font-semibold tracking-tight md:text-2xl`:`text-base font-semibold tracking-tight md:text-lg`,y=(0,a.jsxs)(a.Fragment,{children:[p&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute -bottom-10 -right-10 h-64 w-64 rounded-full ${S(c)} opacity-40 blur-2xl dark:opacity-50`}),(0,a.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute right-12 top-1/3 h-32 w-32 rounded-full ${S(c)} bento-chip-tr opacity-20 blur-2xl dark:opacity-30`})]}),(0,a.jsxs)(`div`,{className:`relative z-1 flex items-center justify-between`,children:[(0,a.jsx)(`span`,{className:`grid place-items-center ${S(c)} text-white shadow-md ${g}`,children:(0,a.jsx)(o,{size:_})}),h&&(0,a.jsx)(s.IconChevronRight,{size:p?18:16,className:`text-muted-foreground transition-transform duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] group-hover:translate-x-1`})]}),(0,a.jsxs)(`div`,{className:`relative z-1`,children:[(0,a.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground`,children:l}),(0,a.jsx)(`div`,{className:`mt-0.5 ${v}`,children:d}),m&&(0,a.jsx)(`div`,{className:`mt-2`,children:m})]})]}),b=`bento-tile bento-glass group relative flex flex-col ${p?`gap-5`:`gap-4`} overflow-hidden text-left ${p?`p-6 md:p-7`:`p-5`} ${f}${h?` bento-tile-clickable`:``}${r?` cursor-not-allowed opacity-60`:``}`;return r?(0,a.jsx)(`div`,{className:b,"aria-disabled":`true`,title:i,children:y}):t?(0,a.jsx)(u.Link,{to:t,className:b,children:y}):n?(0,a.jsx)(`button`,{type:`button`,onClick:n,className:e.t(`w-full`,b),children:y}):(0,a.jsx)(`div`,{className:b,children:y})}function Pt({versions:t,selected:n,onSelect:r,label:c}){let{t:l,i18n:u}=(0,o.useTranslation)(),[d,f]=(0,i.useState)(0),[p,m]=(0,i.useState)([]),h=(0,i.useRef)(new Map),g=e=>[...e].sort((e,n)=>t.findIndex(e=>e.id===n)-t.findIndex(t=>t.id===e));function _(e){if(n.includes(e)){m(p.filter(t=>t!==e)),r(n.filter(t=>t!==e));return}let t=[...n.filter(e=>!p.includes(e)),...p.filter(e=>n.includes(e))],i=t.length>=2?t.slice(t.length-1):t;m([...i,e]),r(g([...i,e]))}function v(e){let n=Math.max(0,Math.min(t.length-1,e));f(n),h.current.get(n)?.focus()}function y(e,n){switch(e.key){case`ArrowDown`:v(n+1);break;case`ArrowUp`:v(n-1);break;case`Home`:v(0);break;case`End`:v(t.length-1);break;case` `:case`Enter`:_(t[n].id);break;default:return}e.preventDefault()}let b=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?{iso:void 0,text:String(e)}:{iso:t.toISOString(),text:new Intl.DateTimeFormat(u?.resolvedLanguage,{dateStyle:`medium`,timeStyle:`short`}).format(t)}};return(0,a.jsx)(`ul`,{role:`listbox`,"aria-label":c??l(`bento.versions.label`,{defaultValue:`Versions`}),"aria-multiselectable":`true`,"data-slot":`bento-version-rail`,className:`m-0 flex list-none flex-col gap-1 p-0`,children:t.map((r,i)=>{let o=n.includes(r.id),c=b(r.at),u=r.actor===`agent`?s.IconRobot:s.IconUser,p=o?`text-foreground/80`:`text-muted-foreground`;return(0,a.jsxs)(`li`,{ref:e=>{e?h.current.set(i,e):h.current.delete(i)},role:`option`,"aria-selected":o?`true`:`false`,tabIndex:i===Math.min(d,t.length-1)?0:-1,onKeyDown:e=>y(e,i),onClick:()=>{f(i),_(r.id)},className:e.t(`flex cursor-pointer flex-col gap-0.5 rounded-xl border px-3 py-2 text-sm outline-none transition-colors`,`focus-visible:ring-2 focus-visible:ring-ring`,o?`border-primary/50 bg-primary/10`:`border-transparent hover:bg-muted/50`),children:[(0,a.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,a.jsx)(u,{size:14,"aria-hidden":`true`}),r.author,(0,a.jsx)(`span`,{className:e.t(`text-xs font-normal`,p),children:r.actor===`agent`?l(`bento.versions.agent`,{defaultValue:`Agent`}):l(`bento.versions.human`,{defaultValue:`Person`})})]}),(0,a.jsx)(`time`,{dateTime:c.iso,className:e.t(`text-xs`,p),children:c.text}),r.summary&&(0,a.jsx)(`span`,{className:`text-xs`,children:r.summary})]},r.id)})})}exports.AdaptiveSectionCard=At,exports.BENTO_EMPHASIS_NEXT=Oe,exports.BENTO_EMPHASIS_SPAN=De,exports.BENTO_SHELL_SHORTCUTS=mt,exports.BENTO_TONES=x,exports.BENTO_TONE_CLASS=b,exports.BentoActionsMenu=y,exports.BentoBackLink=A,exports.BentoBackToTop=st,exports.BentoCalendar=Te,exports.BentoChangeMark=R,exports.BentoCommandPalette=dt,exports.BentoCountTile=C,exports.BentoDataTable=E,exports.BentoDiff=U,exports.BentoEmptyState=D,exports.BentoEntityShell=ee,exports.BentoEntityTile=je,exports.BentoFilterBar=Ie,exports.BentoFormHero=et,exports.BentoFormSection=nt,exports.BentoHero=M,exports.BentoHeroIconPicker=N,exports.BentoInlineEdit=P,exports.BentoListPage=He,exports.BentoNavRail=Et,exports.BentoPaletteTrigger=bt,exports.BentoPanel=rt,exports.BentoSaveBar=Ze,exports.BentoScrollSaveBar=$e,exports.BentoSection=Mt,exports.BentoShell=ft,exports.BentoShortcutsDialog=xt,exports.BentoSplitPage=ve,exports.BentoStatusMarker=F,exports.BentoTile=Nt,exports.BentoTileGrid=Ue,exports.BentoTrail=k,exports.BentoUserMenu=Ot,exports.BentoVersionRail=Pt,exports.EMPTY_FILTERS=Me,exports.bentoChipClass=S,exports.bentoNavTarget=ct,exports.resolveBentoLayout=ke,exports.toBentoLayoutEntries=Ae,exports.useBentoScrollFade=I,exports.useBentoShellShortcuts=yt;