@viglet/viglet-design-system 2026.3.12 → 2026.3.13
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 +39 -10
- package/dist/bento/bento-calendar.d.ts +52 -0
- package/dist/bento/bento-calendar.d.ts.map +1 -0
- package/dist/bento/bento-change-mark.d.ts +21 -0
- package/dist/bento/bento-change-mark.d.ts.map +1 -0
- package/dist/bento/bento-data-table.d.ts +8 -1
- package/dist/bento/bento-data-table.d.ts.map +1 -1
- package/dist/bento/bento-diff.d.ts +10 -1
- package/dist/bento/bento-diff.d.ts.map +1 -1
- package/dist/bento/bento-split-page.d.ts +31 -0
- package/dist/bento/bento-split-page.d.ts.map +1 -0
- package/dist/bento/bento-version-rail.d.ts.map +1 -1
- package/dist/bento/index.d.ts +4 -1
- package/dist/bento/index.d.ts.map +1 -1
- package/dist/bento.cjs +4 -4
- package/dist/bento.es.js +1430 -787
- package/dist/catalogue.json +189 -1
- package/dist/components/ui/viglet-assistant.d.ts +7 -1
- package/dist/components/ui/viglet-assistant.d.ts.map +1 -1
- package/dist/exports.json +14 -1
- package/dist/i18n/index.d.ts +44 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/locales/en/bento.json.d.ts +22 -0
- package/dist/i18n/locales/pt/bento.json.d.ts +22 -0
- package/dist/i18n.cjs +1 -1
- package/dist/i18n.es.js +40 -0
- package/dist/index.cjs +1 -1
- package/dist/index.es.js +971 -1083
- package/dist/preset.css +1 -1
- package/dist/{user.context-BXQ7lgg5.js → user.context-D3kmD3_y.js} +285 -169
- package/dist/user.context-gQvBxcwr.cjs +1 -0
- package/dist/viglet-design-system.css +1 -1
- package/docs/BENTO-AUTHORING.md +13 -2
- package/docs/reference/README.md +2 -1
- package/docs/reference/canvas.json +10 -1
- package/docs/reference/split.dc.html +164 -0
- package/package.json +1 -1
- package/scripts/lib/contrast.mjs +29 -3
- package/scripts/page-reference.mjs +3 -3
- package/dist/user.context-D01CI8gq.cjs +0 -1
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-D01CI8gq.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-router-dom"),u=require("@tanstack/react-table"),d=require("@dnd-kit/core"),f=require("@dnd-kit/sortable"),p=require("@dnd-kit/utilities"),m=require("sonner");var h={default:``,destructive:`bento-item-danger`},g=new Set;function _(e){process.env.NODE_ENV===`production`||g.has(e)||(g.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 v({actions:e,triggerLabel:t}){let{t:r}=(0,o.useTranslation)();if(e.length===0)return null;for(let t of e)t.id||_(t.label);return(0,a.jsxs)(n.S,{children:[(0,a.jsx)(n.I,{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.w,{align:`end`,sideOffset:8,className:`bento-dropdown min-w-44 p-1.5`,children:e.map(e=>{let t=e.icon,r=h[e.tone??`default`];return(0,a.jsxs)(n.E,{"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 y={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`},b=Object.keys(y);function x(e){return`bento-chip ${y[e]??y.slate}`}function S({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 ${x(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)(l.Link,{to:e,className:c,children:s}):(0,a.jsx)(`div`,{className:c,children:s})}var C=6,w={rowSortingFeature:u.rowSortingFeature,coreRowModel:(0,u.createCoreRowModel)(),sortedRowModel:(0,u.createSortedRowModel)()};function T({rows:t,getRowId:r,columns:c,label:l,getRowLabel:d,rowActions:f,selectionActions:p,onSelectionChange:m,selectionScope:h,layout:g,onLayoutChange:_,onRowOpen:y,rowHeight:b=44,height:x=480,empty:S}){let{t:T}=(0,o.useTranslation)(),[E,D]=(0,i.useState)([]),[O,k]=(0,i.useState)({hidden:[]}),[A,j]=(0,i.useState)(new Set),[M,N]=(0,i.useState)(null),[P,F]=(0,i.useState)(h);P!==h&&(F(h),j(new Set),N(null));let I=(0,i.useRef)(h);(0,i.useEffect)(()=>{I.current!==h&&(I.current=h,m?.([]))},[h,m]);let[L,R]=(0,i.useState)(0),[z,ee]=(0,i.useState)(0),te=(0,i.useRef)(null),B=(0,i.useRef)(new Map),V=(0,i.useRef)(!1),H=(p?.length??0)>0,U=e=>d?.(e)??r(e),ne=(0,i.useMemo)(()=>c.map(e=>({id:e.id,accessorFn:t=>e.sortValue?.(t)??null,enableSorting:e.sortValue!==void 0})),[c]),W=(0,u.useTable)({features:w,data:t,columns:ne,state:{sorting:E},onSortingChange:D}).getRowModel().rows.map(e=>e.original),G=g??O,K=c.filter(e=>e.hideable===!1||!G.hidden.includes(e.id)),q=[H?`2.75rem`:null,...K.map(e=>e.width??`minmax(8rem, 1fr)`),f?.length?`3.25rem`:null].filter(Boolean).join(` `),J=W.length,Y=Math.max(1,Math.floor(x/b)),re=Math.max(0,Math.floor(z/b)-C),ie=Math.min(J,Math.ceil((z+x)/b)+C),X=Math.min(L,Math.max(0,J-1));(0,i.useEffect)(()=>{V.current&&(V.current=!1,B.current.get(X)?.focus())},[X,re]);function Z(e){j(e),m?.([...e])}function ae(e,t){let[n,i]=e<=t?[e,t]:[t,e];Z(new Set(W.slice(n,i+1).map(r)))}function oe(e){let t=r(W[e]),n=new Set(A);n.has(t)?n.delete(t):n.add(t),Z(n),N(e)}function Q(e,t){let n=Math.max(0,Math.min(J-1,e));if(t&&H){let e=M??X;N(e),ae(e,n)}let r=te.current,i=n*b;if(r){let e=r.scrollTop;i<e?e=i:i+b>e+x&&(e=i+b-x),e!==r.scrollTop&&(r.scrollTop=e,ee(e))}V.current=!0,R(n)}function se(e,t){if(e.target!==e.currentTarget)return;let n=e.shiftKey;switch(e.key){case`ArrowDown`:Q(t+1,n);break;case`ArrowUp`:Q(t-1,n);break;case`PageDown`:Q(t+Y,n);break;case`PageUp`:Q(t-Y,n);break;case`Home`:Q(0,n);break;case`End`:Q(J-1,n);break;case` `:if(!H)return;oe(t);break;case`Enter`:if(!y)return;y(W[t]);break;case`Escape`:if(!H||A.size===0)return;Z(new Set),N(null);break;case`a`:case`A`:if(!H||!(e.ctrlKey||e.metaKey))return;Z(new Set(W.map(r)));break;default:return}e.preventDefault()}function ce(e,t){if(!e.target.closest(`button, a, input, [role='checkbox']`)&&(R(t),H)){if(e.shiftKey){let e=M??X;N(e),ae(e,t)}else e.metaKey||e.ctrlKey?oe(t):(Z(new Set([r(W[t])])),N(t))}}function le(e){let t=E.find(t=>t.id===e);t?t.desc?D([]):D([{id:e,desc:!0}]):D([{id:e,desc:!1}])}function ue(e,t){let n={hidden:t?[...G.hidden,e]:G.hidden.filter(t=>t!==e)};g===void 0&&k(n),_?.(n)}let $=W.filter(e=>A.has(r(e))),de=J>0&&$.length===J,fe=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:$.length>0?T(`bento.table.selected`,{defaultValue:`{{count}} selected`,count:$.length}):``}),$.length>0&&(0,a.jsxs)(`div`,{role:`toolbar`,"aria-label":T(`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.R,{variant:`outline`,size:`sm`,className:e.t(`gap-1.5`,t.tone===`destructive`&&`bento-item-danger`),onClick:()=>t.onSelect($),children:[(0,a.jsx)(r,{size:16}),t.label]},t.id)}),(0,a.jsx)(n.R,{variant:`ghost`,size:`sm`,onClick:()=>Z(new Set),children:T(`bento.table.clearSelection`,{defaultValue:`Clear selection`})})]}),fe.length>0&&(0,a.jsxs)(n.S,{children:[(0,a.jsx)(n.I,{asChild:!0,children:(0,a.jsxs)(n.R,{variant:`ghost`,size:`sm`,className:`ml-auto gap-1.5`,children:[(0,a.jsx)(s.IconColumns3,{size:16,"aria-hidden":`true`}),T(`bento.table.columns`,{defaultValue:`Columns`})]})}),(0,a.jsx)(n.w,{align:`end`,className:`bento-dropdown min-w-44 p-1.5`,children:fe.map(e=>(0,a.jsx)(n.C,{checked:!G.hidden.includes(e.id),onCheckedChange:t=>ue(e.id,t!==!0),onSelect:e=>e.preventDefault(),children:e.header},e.id))})]})]}),(0,a.jsxs)(`div`,{role:`grid`,"aria-label":l,"aria-rowcount":J+1,"aria-colcount":K.length+ +!!H+ +!!f?.length,"aria-multiselectable":H?`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:q,minHeight:b},children:[H&&(0,a.jsx)(`div`,{role:`columnheader`,className:`grid place-items-center`,children:(0,a.jsx)(n.L,{"aria-label":T(`bento.table.selectAll`,{defaultValue:`Select all rows`}),checked:de?!0:$.length>0&&`indeterminate`,onCheckedChange:()=>Z(de?new Set:new Set(W.map(r)))})}),K.map(e=>{let t=E.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:()=>le(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:T(`bento.table.actions`,{defaultValue:`Actions`})})}):null]})}),J===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:S??T(`bento.table.empty`,{defaultValue:`Nothing to show`})})})}):(0,a.jsx)(`div`,{role:`rowgroup`,ref:te,onScroll:e=>ee(e.currentTarget.scrollTop),className:`relative overflow-y-auto`,style:{height:x},children:(0,a.jsx)(`div`,{style:{height:J*b},className:`relative`,children:W.slice(re,ie).map((t,i)=>{let o=re+i,s=r(t),c=A.has(s),l=U(t);return(0,a.jsxs)(`div`,{ref:e=>{e?B.current.set(o,e):B.current.delete(o)},role:`row`,"aria-rowindex":o+2,"aria-selected":H?c?`true`:`false`:void 0,tabIndex:o===X?0:-1,onKeyDown:e=>se(e,o),onClick:e=>ce(e,o),onDoubleClick:()=>y?.(t),onFocus:e=>{e.target===e.currentTarget&&R(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*b,height:b,gridTemplateColumns:q},children:[H&&(0,a.jsx)(`div`,{role:`gridcell`,className:`grid place-items-center`,children:(0,a.jsx)(n.L,{tabIndex:-1,"aria-label":T(`bento.table.selectRow`,{defaultValue:`Select {{row}}`,row:l}),checked:c,onCheckedChange:()=>oe(o)})}),K.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)(v,{triggerLabel:T(`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 E({icon:t=s.IconSparkles,tone:n=`indigo`,title:r,description:i,action:o,align:c=`center`,titleLevel:l=2,className:u}){let d=x(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})]})}function D({to:e,children:t}){return(0,a.jsxs)(l.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 O({eyebrow:e,backTo:t,backLabel:n,title:r,subtitle:i,leading:o,trailing:s}){let c=e??(t==null?null:(0,a.jsx)(D,{to:t,children: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:[o&&(0,a.jsx)(`div`,{className:`shrink-0`,children:o}),(0,a.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1`,children:[c&&(0,a.jsx)(`span`,{className:`text-xs uppercase tracking-[0.18em] text-muted-foreground`,children:c}),(0,a.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight md:text-4xl`,children:r}),i&&(0,a.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:i})]}),s&&(0,a.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:s})]})})}function k({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 ${x(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 ${x(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.x,{open:h,onOpenChange:g,value:e,onSelect:t,onClear:r,title:d,description:f})]})}function A({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/80`,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/80`,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 j({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 M(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 N(e,t){let n={};for(let r of Object.keys(e))Object.assign(n,{[r]:t[r]});return n}function P({entity:e,isNew:n,headlineFallback:c,eyebrow:u,listRoute:d,icon:f,tone:p,formId:h,feature:g,hasStatus:_=!1,hideIcon:y=!1,readOnly:b=!1,autosaveOnly:x=!1,badge:S,notice:C,onUpdate:w,onDelete:T,extraActions:E,children:P}){let{t:F}=(0,o.useTranslation)(),I=(0,l.useNavigate)(),[L,R]=(0,i.useState)(!1),[z,ee]=(0,i.useState)({isDirty:!1,isSubmitting:!1}),te=(0,i.useRef)(null);M(te);let B={title:e.title??``,description:e.description??``,icon:e.icon??null,enabled:e.enabled??1},[V,H]=(0,i.useState)(B),[U,ne]=(0,i.useState)(B);(B.title!==U.title||B.description!==U.description||B.icon!==U.icon||B.enabled!==U.enabled)&&(ne(B),H(B));async function W(t){if(H(e=>({...e,...t})),n||!w)return;let r=t.title??V.title;try{await w({...e,...t}),m.toast.success(F(`forms.common.updated`,{name:r,feature:g}))}catch(e){console.error(`Failed to update entity field`,e),H(e=>({...e,...N(t,B)})),m.toast.error(F(`forms.common.notUpdated`,{name:B.title||r,feature:g}))}}async function G(){if(T){try{await T()?(m.toast.success(F(`forms.common.deleted`,{name:V.title,feature:g})),I(d)):m.toast.error(F(`forms.common.notDeleted`,{name:V.title,feature:g}))}catch(e){console.error(`Failed to delete entity`,e),m.toast.error(F(`forms.common.notDeleted`,{name:V.title,feature:g}))}R(!1)}}let K=V.enabled===1,q=!b,J=!(x&&!n),Y=!V.title.trim(),re=!n&&!z.isDirty,ie=Y||re,X=[...E??[],...T&&!b?[{id:`entity.delete`,label:F(`forms.formActions.delete`),icon:s.IconTrash,tone:`destructive`,onSelect:()=>R(!0)}]:[]];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(O,{eyebrow:(0,a.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,a.jsx)(D,{to:d,children:u}),!b&&(0,a.jsx)(j,{titleMissing:Y,dirty:n||z.isDirty})]}),leading:(0,a.jsx)(k,{value:V.icon,onChange:e=>W({icon:e}),onClear:()=>W({icon:null}),defaultIcon:f,tone:p,title:V.title,description:V.description,readOnly:b||y}),title:(0,a.jsx)(A,{value:V.title,onSave:e=>W({title:e}),placeholder:c,className:`text-3xl font-semibold tracking-tight md:text-4xl`,ariaLabel:F(`forms.common.title`),autoFocus:n,commitOnChange:n,readOnly:b}),subtitle:(0,a.jsx)(A,{value:V.description,onSave:e=>W({description:e}),multiline:!0,placeholder:F(`forms.common.description`),className:`max-w-2xl text-sm text-muted-foreground`,ariaLabel:F(`forms.common.description`),commitOnChange:n,readOnly:b}),trailing:(0,a.jsxs)(a.Fragment,{children:[q&&(0,a.jsxs)(`div`,{className:`bento-fade-out flex shrink-0 items-center gap-2`,children:[J&&(0,a.jsxs)(t.o,{type:`submit`,form:h,size:`sm`,loading:z.isSubmitting,"aria-disabled":ie?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),F(`forms.formActions.saveChanges`)]}),(0,a.jsxs)(t.o,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>I(d),children:[(0,a.jsx)(s.IconX,{className:`size-4`}),F(`forms.formActions.cancel`)]})]}),S,_&&(b?(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?F(`common.active`,{defaultValue:`Active`}):F(`common.idle`,{defaultValue:`Idle`})]}):(0,a.jsxs)(`button`,{type:`button`,onClick:()=>W({enabled:+!K}),"aria-label":F(`forms.common.enabled`),title:F(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?F(`common.active`,{defaultValue:`Active`}):F(`common.idle`,{defaultValue:`Idle`})]})),!n&&X.length>0&&(0,a.jsx)(v,{actions:X})]})}),(0,a.jsx)(`div`,{ref:te,"aria-hidden":!0,className:`h-px`}),C,!n&&T&&(0,a.jsx)(r.r,{feature:g,name:V.title,onDelete:G,open:L,setOpen:R,trigger:(0,a.jsx)(`span`,{className:`hidden`,"aria-hidden":!0})}),P({staged:V,onStateChange:ee})]})}function F(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 I=e=>e.split(/(\s+)/).filter(e=>e!==``);function L(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 R=e=>e==null?``:String(e);function z({before:t,after:n,fields:r,showUnchanged:c=!1}){let{t:l}=(0,o.useTranslation)(),[u,d]=(0,i.useState)(c),f=r.map(e=>{let r=t?.[e.id],i=n?.[e.id],a=e.kind??`text`,o=a===`rich`?L(R(r)).join(`
|
|
2
|
-
`)===
|
|
3
|
-
`):a===`value`?JSON.stringify(r??null)===JSON.stringify(i??null):
|
|
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-gQvBxcwr.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.A,{children:[(0,a.jsx)(n.W,{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.M,{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.P,{"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,ee]=(0,i.useState)(g),[I,L]=(0,i.useState)(void 0);F!==g&&(ee(g),M(new Set),L(m),P(null));let R=(0,i.useMemo)(()=>new Set(m??[]),[m]),z=j;m!==void 0&&(z=m===I?new Set:R);let B=(0,i.useRef)(g);(0,i.useEffect)(()=>{B.current!==g&&(B.current=g,h?.([]))},[g,h]);let[V,H]=(0,i.useState)(0),[U,W]=(0,i.useState)(0),te=(0,i.useRef)(null),G=(0,i.useRef)(new Map),ne=(0,i.useRef)(!1),K=(p?.length??0)>0,re=e=>u?.(e)??r(e),ie=(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:ie,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=[K?`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(U/x)-w),le=Math.min(Y,Math.ceil((U+S)/x)+w),ue=Math.min(V,Math.max(0,Y-1));(0,i.useEffect)(()=>{ne.current&&(ne.current=!1,G.current.get(ue)?.focus())},[ue,ce]);function X(e){m===void 0&&M(e),h?.([...e])}function de(e,t){let[n,i]=e<=t?[e,t]:[t,e];X(new Set(q.slice(n,i+1).map(r)))}function fe(e){let t=r(q[e]),n=new Set(z);n.has(t)?n.delete(t):n.add(t),X(n),P(e)}function pe(e,t){let n=Math.max(0,Math.min(Y-1,e));if(t&&K){let e=N??ue;P(e),de(e,n)}let r=te.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,W(e))}ne.current=!0,H(n)}function me(e,t){if(e.target!==e.currentTarget)return;let n=e.shiftKey;switch(e.key){case`ArrowDown`:pe(t+1,n);break;case`ArrowUp`:pe(t-1,n);break;case`PageDown`:pe(t+se,n);break;case`PageUp`:pe(t-se,n);break;case`Home`:pe(0,n);break;case`End`:pe(Y-1,n);break;case` `:if(!K)return;fe(t);break;case`Enter`:if(!b)return;b(q[t]);break;case`Escape`:if(!K||z.size===0)return;X(new Set),P(null);break;case`a`:case`A`:if(!K||!(e.ctrlKey||e.metaKey))return;X(new Set(q.map(r)));break;default:return}e.preventDefault()}function he(e,t){if(!e.target.closest(`button, a, input, [role='checkbox']`)&&(H(t),K)){if(e.shiftKey){let e=N??ue;P(e),de(e,t)}else e.metaKey||e.ctrlKey?fe(t):(X(new Set([r(q[t])])),P(t))}}function Z(e){let t=D.find(t=>t.id===e);t?t.desc?O([]):O([{id:e,desc:!0}]):O([{id:e,desc:!1}])}function Q(e,t){let n={hidden:t?[...ae.hidden,e]:ae.hidden.filter(t=>t!==e)};_===void 0&&A(n),v?.(n)}let ge=q.filter(e=>z.has(r(e))),$=Y>0&&ge.length===Y,_e=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:ge.length>0?E(`bento.table.selected`,{defaultValue:`{{count}} selected`,count:ge.length}):``}),ge.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.K,{variant:`outline`,size:`sm`,className:e.t(`gap-1.5`,t.tone===`destructive`&&`bento-item-danger`),onClick:()=>t.onSelect(ge),children:[(0,a.jsx)(r,{size:16}),t.label]},t.id)}),(0,a.jsx)(n.K,{variant:`ghost`,size:`sm`,onClick:()=>X(new Set),children:E(`bento.table.clearSelection`,{defaultValue:`Clear selection`})})]}),_e.length>0&&(0,a.jsxs)(n.A,{children:[(0,a.jsx)(n.W,{asChild:!0,children:(0,a.jsxs)(n.K,{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.M,{align:`end`,className:`bento-dropdown min-w-44 p-1.5`,children:_e.map(e=>(0,a.jsx)(n.j,{checked:!ae.hidden.includes(e.id),onCheckedChange:t=>Q(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+ +!!K+ +!!f?.length,"aria-multiselectable":K?`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:[K&&(0,a.jsx)(`div`,{role:`columnheader`,className:`grid place-items-center`,children:(0,a.jsx)(n.G,{"aria-label":E(`bento.table.selectAll`,{defaultValue:`Select all rows`}),checked:$?!0:ge.length>0&&`indeterminate`,onCheckedChange:()=>X($?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:()=>Z(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:te,onScroll:e=>W(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=z.has(s),l=re(t);return(0,a.jsxs)(`div`,{ref:e=>{e?G.current.set(o,e):G.current.delete(o)},role:`row`,"aria-rowindex":o+2,"aria-selected":K?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&&H(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:[K&&(0,a.jsx)(`div`,{role:`gridcell`,className:`grid place-items-center`,children:(0,a.jsx)(n.G,{tabIndex:-1,"aria-label":E(`bento.table.selectRow`,{defaultValue:`Select {{row}}`,row:l}),checked:c,onCheckedChange:()=>fe(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})]})}function O({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 k({eyebrow:e,backTo:t,backLabel:n,title:r,subtitle:i,leading:o,trailing:s}){let c=e??(t==null?null:(0,a.jsx)(O,{to:t,children: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:[o&&(0,a.jsx)(`div`,{className:`shrink-0`,children:o}),(0,a.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1`,children:[c&&(0,a.jsx)(`span`,{className:`text-xs uppercase tracking-[0.18em] text-muted-foreground`,children:c}),(0,a.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight md:text-4xl`,children:r}),i&&(0,a.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:i})]}),s&&(0,a.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:s})]})})}function A({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.k,{open:h,onOpenChange:g,value:e,onSelect:t,onClear:r,title:d,description:f})]})}function j({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 M({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 N(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 P(e,t){let n={};for(let r of Object.keys(e))Object.assign(n,{[r]:t[r]});return n}function F({entity:e,isNew:n,headlineFallback:c,eyebrow:l,listRoute:d,icon:f,tone:p,formId:m,feature:g,hasStatus:_=!1,hideIcon:v=!1,readOnly:b=!1,autosaveOnly:x=!1,badge:S,notice:C,onUpdate:w,onDelete:T,extraActions:E,children:D}){let{t:F}=(0,o.useTranslation)(),ee=(0,u.useNavigate)(),[I,L]=(0,i.useState)(!1),[R,z]=(0,i.useState)({isDirty:!1,isSubmitting:!1}),B=(0,i.useRef)(null);N(B);let V={title:e.title??``,description:e.description??``,icon:e.icon??null,enabled:e.enabled??1},[H,U]=(0,i.useState)(V),[W,te]=(0,i.useState)(V);(V.title!==W.title||V.description!==W.description||V.icon!==W.icon||V.enabled!==W.enabled)&&(te(V),U(V));async function G(t){if(U(e=>({...e,...t})),n||!w)return;let r=t.title??H.title;try{await w({...e,...t}),h.toast.success(F(`forms.common.updated`,{name:r,feature:g}))}catch(e){console.error(`Failed to update entity field`,e),U(e=>({...e,...P(t,V)})),h.toast.error(F(`forms.common.notUpdated`,{name:V.title||r,feature:g}))}}async function ne(){if(T){try{await T()?(h.toast.success(F(`forms.common.deleted`,{name:H.title,feature:g})),ee(d)):h.toast.error(F(`forms.common.notDeleted`,{name:H.title,feature:g}))}catch(e){console.error(`Failed to delete entity`,e),h.toast.error(F(`forms.common.notDeleted`,{name:H.title,feature:g}))}L(!1)}}let K=H.enabled===1,re=!b,ie=!(x&&!n),q=!H.title.trim(),ae=!n&&!R.isDirty,J=q||ae,oe=[...E??[],...T&&!b?[{id:`entity.delete`,label:F(`forms.formActions.delete`),icon:s.IconTrash,tone:`destructive`,onSelect:()=>L(!0)}]:[]];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(k,{eyebrow:(0,a.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,a.jsx)(O,{to:d,children:l}),!b&&(0,a.jsx)(M,{titleMissing:q,dirty:n||R.isDirty})]}),leading:(0,a.jsx)(A,{value:H.icon,onChange:e=>G({icon:e}),onClear:()=>G({icon:null}),defaultIcon:f,tone:p,title:H.title,description:H.description,readOnly:b||v}),title:(0,a.jsx)(j,{value:H.title,onSave:e=>G({title:e}),placeholder:c,className:`text-3xl font-semibold tracking-tight md:text-4xl`,ariaLabel:F(`forms.common.title`),autoFocus:n,commitOnChange:n,readOnly:b}),subtitle:(0,a.jsx)(j,{value:H.description,onSave:e=>G({description:e}),multiline:!0,placeholder:F(`forms.common.description`),className:`max-w-2xl text-sm text-muted-foreground`,ariaLabel:F(`forms.common.description`),commitOnChange:n,readOnly:b}),trailing:(0,a.jsxs)(a.Fragment,{children:[re&&(0,a.jsxs)(`div`,{className:`bento-fade-out flex shrink-0 items-center gap-2`,children:[ie&&(0,a.jsxs)(t.o,{type:`submit`,form:m,size:`sm`,loading:R.isSubmitting,"aria-disabled":J?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),F(`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`}),F(`forms.formActions.cancel`)]})]}),S,_&&(b?(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?F(`common.active`,{defaultValue:`Active`}):F(`common.idle`,{defaultValue:`Idle`})]}):(0,a.jsxs)(`button`,{type:`button`,onClick:()=>G({enabled:+!K}),"aria-label":F(`forms.common.enabled`),title:F(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?F(`common.active`,{defaultValue:`Active`}):F(`common.idle`,{defaultValue:`Idle`})]})),!n&&oe.length>0&&(0,a.jsx)(y,{actions:oe})]})}),(0,a.jsx)(`div`,{ref:B,"aria-hidden":!0,className:`h-px`}),C,!n&&T&&(0,a.jsx)(r.r,{feature:g,name:H.title,onDelete:ne,open:I,setOpen:L,trigger:(0,a.jsx)(`span`,{className:`hidden`,"aria-hidden":!0})}),D({staged:H,onStateChange:z})]})}var ee={added:`bento-status bento-status-on`,removed:`bento-status bento-status-error`,changed:`bento-status bento-status-warn`,unchanged:!1};function I({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`,ee[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 L(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 R=e=>e.split(/(\s+)/).filter(e=>e!==``);function z(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 B=e=>e==null?``:String(e);function V({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`?z(B(r)).join(`
|
|
2
|
+
`)===z(B(i)).join(`
|
|
3
|
+
`):a===`value`?JSON.stringify(r??null)===JSON.stringify(i??null):B(r)===B(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)(H,{label:e.field.label,state:e.state,children:(0,a.jsx)(U,{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)(H,{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`?z(B(t.b)).join(`
|
|
4
4
|
|
|
5
|
-
`):e.field.format?e.field.format(e.b):R(e.b)})},e.field.id))})]})]})}function ee({label:t,status:n,state:r,children:i}){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:t}),(0,a.jsx)(`span`,{className:e.t(`rounded-full border px-1.5 leading-4`,r===`added`&&`bento-status bento-status-on`,r===`removed`&&`bento-status bento-status-error`,r===`changed`&&`bento-status bento-status-warn`),children:n})]}),(0,a.jsx)(`dd`,{className:`m-0`,children:i})]})}function te({row:e}){let{t}=(0,o.useTranslation)(),{field:n,a:r,b:i,kind:s,state:c}=e;if(s===`value`){let e=e=>n.format?n.format(e):R(e);return(0,a.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[c!==`added`&&(0,a.jsx)(V,{children:e(r)}),c===`changed`&&(0,a.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),c!==`removed`&&(0,a.jsx)(B,{children:e(i)})]})}let l=s===`rich`?L(R(r)):[R(r)].filter(Boolean),u=s===`rich`?L(R(i)):[R(i)].filter(Boolean),d=F(l,u,!1)??[...l.map(e=>({op:`remove`,text:e})),...u.map(e=>({op:`add`,text:e}))],f=[];for(let e=0;e<d.length;e++){let t=d[e],n=d[e+1];if(t.op===`remove`&&n?.op===`add`){let r=F(I(t.text),I(n.text));f.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)(B,{children:e.text},t):(0,a.jsx)(V,{children:e.text},t)):[(0,a.jsx)(V,{children:t.text},`r`),` `,(0,a.jsx)(B,{children:n.text},`a`)]},e)),e++}else f.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)(B,{children:t.text}):(0,a.jsx)(V,{children:t.text})},e))}return f.length===0?(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:t(`bento.diff.empty`,{defaultValue:`Empty`})}):(0,a.jsx)(`div`,{className:`flex flex-col gap-2`,children:f})}function B({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 V({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 H={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`},U={SMALL:`MEDIUM`,MEDIUM:`LARGE`,LARGE:`SMALL`};function ne(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 W(e){return e.map((e,t)=>({itemId:e.key,emphasis:e.emphasis,displayOrder:t}))}function G({to:e,emphasis:t,featured:n,defaultIcon:r,icon:i,tone:s=`indigo`,title:u,description:d,meta:f,enabled:p,hasStatus:m=!1,viewTransitionName:h}){let{t:g}=(0,o.useTranslation)(),_=x(s),v=t??(n?`LARGE`:`MEDIUM`),y=v===`LARGE`,b=v===`SMALL`,S=H[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)(l.Link,{to:e,className:`bento-tile bento-tile-clickable bento-glass group relative flex flex-col ${y?`gap-5`:`gap-4`} overflow-hidden ${w} ${S}`,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:u}),!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 K={query:``,facets:{}},q=e=>typeof e==`object`&&!!e&&!Array.isArray(e),J=e=>Array.isArray(e)?e:[];function Y(e,t,n){let r={...e.facets};return n===void 0||Array.isArray(n)&&n.length===0||q(n)&&!n.from&&!n.to?delete r[t]:r[t]=n,{...e,facets:r}}function re({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 J(n)){let i=t.options.find(e=>e.value===r);_.push({key:`${t.id}:${r}`,text:`${t.label}: ${i?.label??r}`,remove:()=>Y(e,t.id,J(n).filter(e=>e!==r))})}else q(n)&&(n.from||n.to)&&_.push({key:t.id,text:`${t.label}: ${n.from??`…`} – ${n.to??`…`}`,remove:()=>Y(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)(X,{facet:t,value:e,onChange:r},t.id):(0,a.jsx)(Z,{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.R,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>{m({source:``,text:``}),r(K)},children:f(`bento.filters.clearAll`,{defaultValue:`Clear all`})})})]})]})}function ie({label:e,count:t,...r}){return(0,a.jsxs)(n.R,{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 X({facet:e,value:t,onChange:r}){let i=J(t.facets[e.id]);return(0,a.jsxs)(n.S,{children:[(0,a.jsx)(n.I,{asChild:!0,children:(0,a.jsx)(ie,{label:e.label,count:i.length})}),(0,a.jsx)(n.w,{align:`start`,className:`bento-dropdown min-w-44 p-1.5`,children:e.multiple?e.options.map(o=>(0,a.jsx)(n.C,{checked:i.includes(o.value),onCheckedChange:n=>r(Y(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.k,{value:i[0]??``,onValueChange:n=>r(Y(t,e.id,n===i[0]?[]:[n])),children:e.options.map(e=>(0,a.jsx)(n.A,{value:e.value,children:e.label},e.value))})})]})}function Z({facet:e,value:r,onChange:s}){let{t:c}=(0,o.useTranslation)(),l=r.facets[e.id],u=q(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.m,{open:d,onOpenChange:e=>{e&&(m(u.from??``),g(u.to??``)),f(e)},children:[(0,a.jsx)(n.b,{asChild:!0,children:(0,a.jsx)(ie,{label:e.label,count:u.from||u.to?1:0})}),(0,a.jsx)(n.g,{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(Y(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.R,{type:`submit`,size:`sm`,className:`mt-1`,children:c(`bento.filters.apply`,{defaultValue:`Apply`})})]})})]})}var ae=`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 oe({items:e,error:t,tryAgainUrl:c,listId:l,eyebrow:u,backTo:d,backLabel:f,heroIcon:p,title:m,subtitle:h,tone:g=`indigo`,headerAction:_,newRoute:v,newLabel:y,newSubtitle:b,hideNew:S=!1,itemKey:C,renderTile:w,emptyTitle:T,emptyDescription:E,layout:D}){let{t:k}=(0,o.useTranslation)(),A=x(g),[j,M]=(0,i.useState)(!1),N=(0,i.useMemo)(()=>ne(e??[],C,D?.data?.entries),[e,C,D?.data?.entries]),P=!!l&&!!D&&(e?.length??0)>0;return(0,a.jsxs)(r.t,{checkIsNotUndefined:e,error:t??null,tryAgainUrl:c,children:[(0,a.jsx)(O,{eyebrow:u,backTo:d,backLabel:f,leading:(0,a.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl ${A} text-white shadow-md`,children:(0,a.jsx)(p,{size:24})}),title:m,subtitle:h}),(_||P&&!j)&&(0,a.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[_,P&&!j&&(0,a.jsxs)(n.R,{variant:`outline`,size:`sm`,onClick:()=>M(!0),className:`ml-auto gap-2`,children:[(0,a.jsx)(s.IconAdjustmentsHorizontal,{size:16}),k(`bento.layout.customize`,{defaultValue:`Customize layout`})]})]}),j&&l&&D?(0,a.jsx)(ce,{layout:D,resolved:N,canEditGlobal:D?.data?.canEditGlobal??!1,isCustomized:D?.data?.source===`USER`,renderTile:w,chip:A,hideNew:S,newRoute:v,newLabel:y,newSubtitle:b,onClose:()=>M(!1)}):(0,a.jsx)(se,{resolved:N,renderTile:w,chip:A,hideNew:S,newRoute:v,newLabel:y,newSubtitle:b,isEmpty:e?.length===0,emptyTitle:T,emptyDescription:E})]})}function Q({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=x(i);return(0,a.jsx)(r.t,{checkIsNotUndefined:e,error:t??null,tryAgainUrl:n,children:(0,a.jsxs)(`div`,{className:ae,children:[!l&&o&&s?(0,a.jsx)(de,{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)(fe,{title:f,description:p})]})})}function se({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`,{className:e.t(ae,f&&`grid-flow-dense`),children:[!i&&(0,a.jsx)(de,{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)(fe,{title:u,description:d})]})}function ce({layout:t,resolved:r,canEditGlobal:c,isCustomized:l,renderTile:u,chip:p,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,d.useSensors)((0,d.useSensor)(d.PointerSensor,{activationConstraint:{distance:8}}),(0,d.useSensor)(d.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,f.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)(()=>W(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.R,{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.R,{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.R,{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.R,{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)(d.DndContext,{sensors:k,collisionDetection:d.closestCenter,onDragEnd:A,children:(0,a.jsx)(f.SortableContext,{items:b.map(e=>e.key),strategy:f.rectSortingStrategy,children:(0,a.jsxs)(`div`,{className:e.t(ae,N&&`grid-flow-dense`),children:[!m&&(0,a.jsx)(de,{route:h,label:g,subtitle:_,chip:p}),b.map(({item:e,key:t,emphasis:n})=>(0,a.jsx)($,{id:t,emphasis:n,onSetEmphasis:e=>j(t,e),children:u(e,n)},t))]})})})]})}var le=[`SMALL`,`MEDIUM`,`LARGE`],ue={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 $({id:t,emphasis:n,onSetEmphasis:r,children:i}){let{t:c}=(0,o.useTranslation)(),{attributes:l,listeners:u,setNodeRef:d,transform:m,transition:h,isDragging:g}=(0,f.useSortable)({id:t}),_={transform:p.CSS.Translate.toString(m),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`,H[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:le.map(t=>{let i=t===n,o=c(ue[t].key,{defaultValue:ue[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 de({route:e,label:t,subtitle:n,chip:r}){let{t:i}=(0,o.useTranslation)();return(0,a.jsxs)(l.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 fe({title:e,description:t}){return(0,a.jsx)(E,{icon:s.IconSparkles,title:e,description:t,align:`start`,className:`col-span-2 row-span-2 justify-end md:col-span-4`})}function pe({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)(j,{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 me({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})}pe.Badge=me;function he(e){let t=(0,i.useRef)(null);return M(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)(pe,{...e})})]})}function ge({eyebrow:e,backTo:n,backLabel:r,leading:i,title:c,subtitle:l,trailing:u,onCancel:d,actions:f,loading:p,dirty:m,titleMissing:h,saveDisabled:g,stickyTitle:_,stickyBadges:v}){let{t:y}=(0,o.useTranslation)(),b=g??(!!h||!m);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(O,{eyebrow:n===void 0?e:(0,a.jsx)(D,{to:n,children:r}),leading:i,title:c,subtitle:l,trailing:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{className:`bento-fade-out flex shrink-0 items-center gap-2`,children:f??(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(t.o,{type:`submit`,size:`sm`,loading:p,"aria-disabled":b?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),y(`forms.formActions.saveChanges`)]}),(0,a.jsxs)(t.o,{type:`button`,variant:`outline`,size:`sm`,onClick:d,children:[(0,a.jsx)(s.IconX,{className:`size-4`}),y(`forms.formActions.cancel`)]})]})}),u]})}),(0,a.jsx)(he,{title:_,badges:v,actions:f,onCancel:d,loading:p,disabled:b,dirty:m,titleMissing:h})]})}var _e=`bento-tile bento-glass relative flex flex-col gap-5 overflow-hidden rounded-3xl p-5 md:p-6`;function ve({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(_e,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 ${x(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 ye({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 be=480;function xe(e){return window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)}function Se(){return window.scrollY>be}function Ce({inline:e=!1}={}){let{t}=(0,o.useTranslation)(),r=n.i(),c=e||r,l=(0,i.useSyncExternalStore)(xe,Se,()=>!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 we(e){return e.bentoRoute??e.fallbackRoute}function Te({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 Ee({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 De({open:e,onOpenChange:n,items:r,group:c,onQueryChange:u}){let{t:d}=(0,o.useTranslation)(),f=(0,l.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)(u);(0,i.useEffect)(()=>{b.current=u}),(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(we(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)(Te,{label:c&&v.length>0?d(`bento.palette.areas`,{defaultValue:`Areas`}):void 0,children:v.map(({item:e,label:t},n)=>(0,a.jsx)(Ee,{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)(Te,{label:c.label,children:[c.items.map((e,t)=>{let n=v.length+t;return(0,a.jsx)(Ee,{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 Oe({rail:t,headerStart:r,headerEnd:s,column:c=`default`,dock:u,backToTop:d=!0,children:f}){let{t:p}=(0,o.useTranslation)(),m=(0,l.useInRouterContext)(),h=(0,i.useId)(),g=(0,i.useRef)(null),_=(0,i.useRef)(null),v=c===`full`,y=r!=null||s!=null,b=d||u!=null;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`),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)(ke,{main:g,announcer:_}),t,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.jsx)(`div`,{className:`flex items-center gap-2`,children:s})]}),(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}),b&&(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)(Ce,{}),u]})})]})}function ke({main:e,announcer:t}){let{pathname:n}=(0,l.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 Ae=Object.freeze([{action:`palette`,key:`k`,mod:!0},{action:`palette`,key:`/`},{action:`shortcuts`,key:`?`}]);function je(){return typeof navigator>`u`?!1:/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent||``)}function Me(e,t){let n=e.key.length===1?e.key.toUpperCase():e.key;return e.mod?[t?`⌘`:`Ctrl`,n]:[n]}function Ne(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 Pe(e,t){if(e.defaultPrevented||e.isComposing||e.repeat)return;let n=e.key.toLowerCase();return Ae.find(r=>n===r.key?r.mod?(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.altKey&&!e.shiftKey:e.metaKey||Ne(e.target)?!1:e.ctrlKey===e.altKey:!1)}function Fe({onPalette:e,onShortcuts:t,isMac:n=je()}){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=Pe(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 Ie({onClick:t,isMac:n=je(),className:r}){let{t:i}=(0,o.useTranslation)(),c=Ae.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:Me(l,n).join(n?``:` `)})]})}function Le({open:e,onOpenChange:n,isMac:r=je()}){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(Ae.map(e=>e.action))],d=[{heading:c(`bento.shortcuts.global`,{defaultValue:`Global`}),rows:u.map(e=>({id:e,label:l[e],combos:Ae.filter(t=>t.action===e).map(e=>Me(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 Re=s.IconLayoutGrid;function ze(e,t){return e===t||e.startsWith(`${t}/`)}function Be(e,t){return t.section.areaRoute&&ze(e,t.section.areaRoute)?!0:t.items.some(t=>t.bentoRoute&&ze(e,t.bentoRoute))}function Ve({groups:e,homeRoute:t,homeAliases:r,homeLabel:c}){let{t:u}=(0,o.useTranslation)(),{pathname:d}=(0,l.useLocation)(),f=(0,i.useMemo)(()=>e.filter(e=>!!e.section.areaRoute),[e]),p=d===t||(r?.includes(d)??!1);return(0,a.jsx)(n.u,{delayDuration:200,children:(0,a.jsxs)(`nav`,{"aria-label":u(`bento.nav.label`,{defaultValue:`Primary`}),className:`fixed inset-y-0 left-0 z-40 hidden w-16 flex-col items-center gap-1 overflow-y-auto overflow-x-hidden border-r border-border/40 bg-background/55 pt-20 pb-4 backdrop-blur-xl backdrop-saturate-150 md:flex`,children:[(0,a.jsx)(He,{to:t,icon:s.IconHome,label:c??u(`home.title`,{defaultValue:`Home`}),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)(He,{to:e.section.areaRoute,icon:e.section.icon??Re,label:e.section.labelKey?u(e.section.labelKey):e.section.id,active:Be(d,e)},e.section.id))]})})}function He({to:e,icon:t,label:r,active:i}){return(0,a.jsxs)(n.c,{children:[(0,a.jsx)(n.d,{asChild:!0,children:(0,a.jsx)(l.Link,{to:e,"aria-label":r,"aria-current":i?`page`:void 0,className:`bento-tile-clickable grid h-11 w-11 shrink-0 place-items-center rounded-2xl border transition-colors duration-200 ${i?`bento-rail-active`:`border-transparent text-muted-foreground hover:border-border/60 hover:bg-card/60 hover:text-foreground`}`,children:(0,a.jsx)(t,{size:20})})}),(0,a.jsx)(n.l,{side:`right`,children:r})]})}function Ue({accountRoute:e,logoutUrl:t,organizationsRoute:r,tenantAdminRoute:i,onOpenShortcuts:c,onReplayTour:u}){let{user:d,status:f}=n.n(),{t:p}=(0,o.useTranslation)(),m=(0,l.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.S,{children:[(0,a.jsx)(n.I,{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.a,{givenName:d.firstName,familyName:d.lastName,name:h||d.username,src:d.avatarUrl||void 0,alt:d.username})})}),(0,a.jsxs)(n.w,{align:`end`,sideOffset:10,className:`bento-dropdown min-w-64 p-2`,children:[(0,a.jsx)(n.D,{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.a,{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.j,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.T,{children:[(0,a.jsxs)(n.E,{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.E,{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.E,{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||u)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.j,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.T,{children:[u&&(0,a.jsxs)(n.E,{onSelect:()=>u(),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.E,{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.j,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.E,{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 We={blue:`blue`,violet:`violet`,emerald:`emerald`,amber:`amber`,rose:`rose`,slate:`slate`,cyan:`blue`,orange:`amber`};function Ge({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.f.Header||t===n.f.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.f.Header||t===n.f.StaticHeader?null:t===n.f.Content?e.props.children:e});return s?(0,a.jsx)(ve,{icon:s.icon,tone:We[t]??`blue`,title:s.title,description:s.description,className:r,children:c}):(0,a.jsx)(`section`,{className:e.t(_e,r),children:c})}Ge.Header=n.f.Header,Ge.StaticHeader=n.f.StaticHeader,Ge.Content=n.f.Content;var Ke=`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 qe({eyebrow:e,title:t,description:n,titleHref:r,children:i,gridClassName:o=Ke}){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)(l.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 Je({to:t,onClick:n,disabled:r=!1,disabledHint:i,icon:o,tone:c,eyebrow:u,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 ${x(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 ${x(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 ${x(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:u}),(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)(l.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 Ye({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;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:`text-xs font-normal text-muted-foreground`,children:r.actor===`agent`?l(`bento.versions.agent`,{defaultValue:`Agent`}):l(`bento.versions.human`,{defaultValue:`Person`})})]}),(0,a.jsx)(`time`,{dateTime:c.iso,className:`text-xs text-muted-foreground`,children:c.text}),r.summary&&(0,a.jsx)(`span`,{className:`text-xs`,children:r.summary})]},r.id)})})}exports.AdaptiveSectionCard=Ge,exports.BENTO_EMPHASIS_NEXT=U,exports.BENTO_EMPHASIS_SPAN=H,exports.BENTO_SHELL_SHORTCUTS=Ae,exports.BENTO_TONES=b,exports.BENTO_TONE_CLASS=y,exports.BentoActionsMenu=v,exports.BentoBackLink=D,exports.BentoBackToTop=Ce,exports.BentoCommandPalette=De,exports.BentoCountTile=S,exports.BentoDataTable=T,exports.BentoDiff=z,exports.BentoEmptyState=E,exports.BentoEntityShell=P,exports.BentoEntityTile=G,exports.BentoFilterBar=re,exports.BentoFormHero=ge,exports.BentoFormSection=ve,exports.BentoHero=O,exports.BentoHeroIconPicker=k,exports.BentoInlineEdit=A,exports.BentoListPage=oe,exports.BentoNavRail=Ve,exports.BentoPaletteTrigger=Ie,exports.BentoPanel=ye,exports.BentoSaveBar=pe,exports.BentoScrollSaveBar=he,exports.BentoSection=qe,exports.BentoShell=Oe,exports.BentoShortcutsDialog=Le,exports.BentoStatusMarker=j,exports.BentoTile=Je,exports.BentoTileGrid=Q,exports.BentoUserMenu=Ue,exports.BentoVersionRail=Ye,exports.EMPTY_FILTERS=K,exports.bentoChipClass=x,exports.bentoNavTarget=we,exports.resolveBentoLayout=ne,exports.toBentoLayoutEntries=W,exports.useBentoScrollFade=M,exports.useBentoShellShortcuts=Fe;
|
|
5
|
+
`):t.field.format?t.field.format(t.b):B(t.b)})},t.field.id))})]})]})}function H({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)(I,{state:t})]}),(0,a.jsx)(`dd`,{className:`m-0`,children:n})]})}function U({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)(re,{label:r.label,before:B(i),after:B(s),layout:t});if(c===`value`){let e=e=>r.format?r.format(e):B(e);return(0,a.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[l!==`added`&&(0,a.jsx)(de,{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`?z(B(i)):[B(i)].filter(Boolean),d=c===`rich`?z(B(s)):[B(s)].filter(Boolean),f=L(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=L(R(t.text),R(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)(de,{children:e.text},t)):[(0,a.jsx)(de,{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)(de,{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 W=3,te=e=>e===``?[]:e.replace(/\r?\n$/,``).split(/\r?\n/);function G(e,t){let n=te(e),r=te(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=L(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=L(R(d[e].text),R(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 ne(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 K(e,t,n){let r=Array(e.length).fill(!1);e.forEach((n,i)=>{if(t(n))for(let t=Math.max(0,i-W);t<=Math.min(e.length-1,i+W);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 re({label:t,before:n,after:r,layout:c}){let{t:l}=(0,o.useTranslation)(),[u,d]=(0,i.useState)(new Set),f=G(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:K(f,e=>e.op!==`same`,ie).map(e=>{let t=e=>(0,a.jsx)(se,{row:e},ie(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:K(ne(f),e=>e.left?.op!==`same`,q).map(e=>{let t=e=>(0,a.jsx)(ce,{pair:e},q(e));return e.fold?m(e,6,t):e.items.map(t)})})]}))(`hidden @3xl/diff:table`)]}):h()})}var ie=e=>`${e.old??``}:${e.new??``}`,q=e=>`${e.left?.old??``}:${e.right?.new??``}`,ae=t=>e.t(t.op===`add`&&`bento-status bento-status-on`,t.op===`remove`&&`bento-status bento-status-error`);function J(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)(de,{children:e.text},t):(0,a.jsx)(`span`,{children:e.text},t)):e.op===`same`?e.text:(0,a.jsx)(ue,{op:e.op,children:e.text})}var oe={same:` `,add:`+`,remove:`−`},Y=`select-none px-2 text-right align-top text-muted-foreground tabular-nums`;function se({row:t}){let n=ae(t);return(0,a.jsxs)(`tr`,{"data-op":t.op,children:[(0,a.jsx)(`td`,{className:e.t(`w-px`,Y,n),children:t.old}),(0,a.jsx)(`td`,{className:e.t(`w-px`,Y,n),children:t.new}),(0,a.jsx)(`td`,{"aria-hidden":`true`,className:e.t(`w-px select-none pr-1`,n),children:oe[t.op]}),(0,a.jsx)(`td`,{className:e.t(`whitespace-pre pr-3`,!t.parts&&n),children:J(t)})]})}function ce({pair:e}){return(0,a.jsxs)(`tr`,{"data-op":e.left?.op===`same`?`same`:`change`,children:[(0,a.jsx)(le,{row:e.left,number:e.left?.old}),(0,a.jsx)(le,{row:e.right,number:e.right?.new,right:!0})]})}function le({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=ae(t);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`td`,{className:e.t(Y,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:oe[t.op]}),(0,a.jsx)(`td`,{className:e.t(`whitespace-pre-wrap pr-3 [overflow-wrap:anywhere]`,!t.parts&&i),children:J(t)})]})}function ue({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 de({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 fe=[`primary`,`secondary`],pe={getItem:e=>{try{return window.localStorage.getItem(e)}catch{return null}},setItem:(e,t)=>{try{window.localStorage.setItem(e,t)}catch{}}},me={getItem:()=>null,setItem:()=>{}};function he({primary:t,secondary:r,primaryLabel:i,secondaryLabel:s,storageKey:c,defaultRatio:u=50,className:d}){let{t:f}=(0,o.useTranslation)(),p=n.f(),m=(0,l.useDefaultLayout)({id:c??`bento-split-page`,panelIds:fe,storage:c?pe:me});return p?(0,a.jsxs)(n.s,{"data-slot":`bento-split-page`,defaultValue:`primary`,className:e.t(`flex flex-col gap-3`,d),children:[(0,a.jsxs)(n.l,{"aria-label":f(`bento.split.switch`,{defaultValue:`Show`}),className:`self-start`,children:[(0,a.jsx)(n.u,{value:`primary`,children:i}),(0,a.jsx)(n.u,{value:`secondary`,children:s})]}),(0,a.jsx)(n.c,{value:`primary`,forceMount:!0,className:`data-[state=inactive]:hidden`,children:t}),(0,a.jsx)(n.c,{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.x,{orientation:`horizontal`,defaultLayout:m.defaultLayout,onLayoutChanged:m.onLayoutChanged,children:[(0,a.jsx)(n.b,{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.y,{withHandle:!0}),(0,a.jsx)(n.b,{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),ge=e=>{let t=new Date(e);return{y:t.getUTCFullYear(),m:t.getUTCMonth()+1,d:t.getUTCDate()}},$=(e,t)=>ge(Q(e)+t*864e5),_e=(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)}},ve=e=>new Date(Q(e)).getUTCDay();function ye(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 be(e,t,n,r,i,a){let o=Date.UTC(e.y,e.m-1,e.d,t,n,r),s=e=>{let t=ye(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 xe={on:`bento-status bento-status-on`,warn:`bento-status bento-status-warn`,error:`bento-status bento-status-error`};function Se({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=ye(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()))),ee=e=>$(e,-((ve(e)-d+7)%7)),I=ee(C===`month`?{...w,d:1}:w),L=C===`month`?Math.ceil((Q(_e({...w,d:1},1))-Q(I))/6048e5):1,R=Array.from({length:L},(e,t)=>Array.from({length:7},(e,n)=>$(I,t*7+n))),z=$(I,L*7),B=`${Z(I)}/${Z(z)}`;(0,i.useEffect)(()=>{m?.({start:be(I,0,0,0,0,u),end:be(z,0,0,0,0,u)})},[B,u]),(0,i.useEffect)(()=>{N.current&&(N.current=!1,M.current.get(Z(w))?.focus())});let V=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=V.get(n)??[];r.push({entry:e,time:t}),V.set(n,r)}for(let e of V.values())e.sort((e,t)=>e.time-t.time);let H=e=>new Intl.DateTimeFormat(y,{...e,timeZone:`UTC`}),U=e=>H({dateStyle:`full`}).format(Q(e)),W=e=>new Intl.DateTimeFormat(y,{timeStyle:`short`,timeZone:u}).format(e),te=C===`month`?H({month:`long`,year:`numeric`}).format(Q({...w,d:1})):`${H({dateStyle:`medium`}).format(Q(I))} – ${H({dateStyle:`medium`}).format(Q($(z,-1)))}`;function G(e){N.current=!0,T(e)}function ne(e){n===void 0&&S(e),c?.(e)}let K=e=>C===`month`?_e(w,e):$(w,7*e);function re(e,n){let r=t.find(t=>t.id===e);if(!r||!f)return;let i=new Date(r.start).getTime(),a=ye(i,u);Z(a)!==Z(n)&&f(e,be(n,a.h,a.mi,a.s,i%1e3,u)),j(_(`bento.calendar.moved`,{defaultValue:`Moved {{label}} to {{day}}.`,label:r.label,day:U(n)}))}function ie(e,n){let r={ArrowLeft:()=>$(n,-1),ArrowRight:()=>$(n,1),ArrowUp:()=>$(n,-7),ArrowDown:()=>$(n,7),Home:()=>ee(n),End:()=>$(ee(n),6),PageUp:()=>K(-1),PageDown:()=>K(1)}[e.key];if(r){e.preventDefault(),G(r());return}if(E&&(e.key===`Enter`||e.key===` `))e.preventDefault(),re(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(),re(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)(Ce,{label:_(`bento.calendar.previous`,{defaultValue:`Previous`}),onClick:()=>T(K(-1)),children:(0,a.jsx)(s.IconChevronLeft,{size:16,"aria-hidden":`true`})}),(0,a.jsx)(Ce,{label:_(`bento.calendar.next`,{defaultValue:`Next`}),onClick:()=>T(K(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:te})]}),(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:()=>ne(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??te,className:`w-full table-fixed border-collapse text-sm`,children:[(0,a.jsx)(`thead`,{children:(0,a.jsx)(`tr`,{children:R[0].map(e=>(0,a.jsx)(`th`,{scope:`col`,abbr:H({weekday:`long`}).format(Q(e)),className:`pb-1 text-xs font-medium text-muted-foreground`,children:H({weekday:`short`}).format(Q(e))},Z(e)))})}),(0,a.jsx)(`tbody`,{children:R.map(t=>(0,a.jsx)(`tr`,{children:t.map(t=>{let n=Z(t),r=V.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?`${U(t)}, ${_(`bento.calendar.entries`,{defaultValue:`{{count}} scheduled`,count:s})}`:U(t),"aria-current":n===F?`date`:void 0,"data-day":n,onKeyDown:e=>ie(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?xe[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:W(n)}),(0,a.jsx)(`span`,{className:`truncate`,children:t.label})]})},t.id))})]},n)})},Z(t[0])))})]})]})}function Ce({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 we={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`},Te={SMALL:`MEDIUM`,MEDIUM:`LARGE`,LARGE:`SMALL`};function Ee(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 De(e){return e.map((e,t)=>({itemId:e.key,emphasis:e.emphasis,displayOrder:t}))}function Oe({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=we[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 ke={query:``,facets:{}},Ae=e=>typeof e==`object`&&!!e&&!Array.isArray(e),je=e=>Array.isArray(e)?e:[];function Me(e,t,n){let r={...e.facets};return n===void 0||Array.isArray(n)&&n.length===0||Ae(n)&&!n.from&&!n.to?delete r[t]:r[t]=n,{...e,facets:r}}function Ne({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 je(n)){let i=t.options.find(e=>e.value===r);_.push({key:`${t.id}:${r}`,text:`${t.label}: ${i?.label??r}`,remove:()=>Me(e,t.id,je(n).filter(e=>e!==r))})}else Ae(n)&&(n.from||n.to)&&_.push({key:t.id,text:`${t.label}: ${n.from??`…`} – ${n.to??`…`}`,remove:()=>Me(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)(Fe,{facet:t,value:e,onChange:r},t.id):(0,a.jsx)(Ie,{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.K,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>{m({source:``,text:``}),r(ke)},children:f(`bento.filters.clearAll`,{defaultValue:`Clear all`})})})]})]})}function Pe({label:e,count:t,...r}){return(0,a.jsxs)(n.K,{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 Fe({facet:e,value:t,onChange:r}){let i=je(t.facets[e.id]);return(0,a.jsxs)(n.A,{children:[(0,a.jsx)(n.W,{asChild:!0,children:(0,a.jsx)(Pe,{label:e.label,count:i.length})}),(0,a.jsx)(n.M,{align:`start`,className:`bento-dropdown min-w-44 p-1.5`,children:e.multiple?e.options.map(o=>(0,a.jsx)(n.j,{checked:i.includes(o.value),onCheckedChange:n=>r(Me(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.L,{value:i[0]??``,onValueChange:n=>r(Me(t,e.id,n===i[0]?[]:[n])),children:e.options.map(e=>(0,a.jsx)(n.R,{value:e.value,children:e.label},e.value))})})]})}function Ie({facet:e,value:r,onChange:s}){let{t:c}=(0,o.useTranslation)(),l=r.facets[e.id],u=Ae(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.S,{open:d,onOpenChange:e=>{e&&(m(u.from??``),g(u.to??``)),f(e)},children:[(0,a.jsx)(n.O,{asChild:!0,children:(0,a.jsx)(Pe,{label:e.label,count:u.from||u.to?1:0})}),(0,a.jsx)(n.w,{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(Me(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.K,{type:`submit`,size:`sm`,className:`mt-1`,children:c(`bento.filters.apply`,{defaultValue:`Apply`})})]})})]})}var Le=`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 Re({items:e,error:t,tryAgainUrl:c,listId:l,eyebrow:u,backTo:d,backLabel:f,heroIcon:p,title:m,subtitle:h,tone:g=`indigo`,headerAction:_,newRoute:v,newLabel:y,newSubtitle:b,hideNew:x=!1,itemKey:C,renderTile:w,emptyTitle:T,emptyDescription:E,layout:D}){let{t:O}=(0,o.useTranslation)(),A=S(g),[j,M]=(0,i.useState)(!1),N=(0,i.useMemo)(()=>Ee(e??[],C,D?.data?.entries),[e,C,D?.data?.entries]),P=!!l&&!!D&&(e?.length??0)>0;return(0,a.jsxs)(r.t,{checkIsNotUndefined:e,error:t??null,tryAgainUrl:c,children:[(0,a.jsx)(k,{eyebrow:u,backTo:d,backLabel:f,leading:(0,a.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl ${A} text-white shadow-md`,children:(0,a.jsx)(p,{size:24})}),title:m,subtitle:h}),(_||P&&!j)&&(0,a.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[_,P&&!j&&(0,a.jsxs)(n.K,{variant:`outline`,size:`sm`,onClick:()=>M(!0),className:`ml-auto gap-2`,children:[(0,a.jsx)(s.IconAdjustmentsHorizontal,{size:16}),O(`bento.layout.customize`,{defaultValue:`Customize layout`})]})]}),j&&l&&D?(0,a.jsx)(Ve,{layout:D,resolved:N,canEditGlobal:D?.data?.canEditGlobal??!1,isCustomized:D?.data?.source===`USER`,renderTile:w,chip:A,hideNew:x,newRoute:v,newLabel:y,newSubtitle:b,onClose:()=>M(!1)}):(0,a.jsx)(Be,{resolved:N,renderTile:w,chip:A,hideNew:x,newRoute:v,newLabel:y,newSubtitle:b,isEmpty:e?.length===0,emptyTitle:T,emptyDescription:E})]})}function ze({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`,{className:Le,children:[!l&&o&&s?(0,a.jsx)(Ge,{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)(Ke,{title:f,description:p})]})})}function Be({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`,{className:e.t(Le,f&&`grid-flow-dense`),children:[!i&&(0,a.jsx)(Ge,{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)(Ke,{title:u,description:d})]})}function Ve({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)(()=>De(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.K,{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.K,{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.K,{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.K,{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`,{className:e.t(Le,N&&`grid-flow-dense`),children:[!m&&(0,a.jsx)(Ge,{route:h,label:g,subtitle:_,chip:d}),b.map(({item:e,key:t,emphasis:n})=>(0,a.jsx)(We,{id:t,emphasis:n,onSetEmphasis:e=>j(t,e),children:u(e,n)},t))]})})})]})}var He=[`SMALL`,`MEDIUM`,`LARGE`],Ue={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 We({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`,we[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:He.map(t=>{let i=t===n,o=c(Ue[t].key,{defaultValue:Ue[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 Ge({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 Ke({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 qe({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)(M,{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 Je({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})}qe.Badge=Je;function Ye(e){let t=(0,i.useRef)(null);return N(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)(qe,{...e})})]})}function Xe({eyebrow:e,backTo:n,backLabel:r,leading:i,title:c,subtitle:l,trailing:u,onCancel:d,actions:f,loading:p,dirty:m,titleMissing:h,saveDisabled:g,stickyTitle:_,stickyBadges:v}){let{t:y}=(0,o.useTranslation)(),b=g??(!!h||!m);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(k,{eyebrow:n===void 0?e:(0,a.jsx)(O,{to:n,children:r}),leading:i,title:c,subtitle:l,trailing:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{className:`bento-fade-out flex shrink-0 items-center gap-2`,children:f??(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(t.o,{type:`submit`,size:`sm`,loading:p,"aria-disabled":b?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),y(`forms.formActions.saveChanges`)]}),(0,a.jsxs)(t.o,{type:`button`,variant:`outline`,size:`sm`,onClick:d,children:[(0,a.jsx)(s.IconX,{className:`size-4`}),y(`forms.formActions.cancel`)]})]})}),u]})}),(0,a.jsx)(Ye,{title:_,badges:v,actions:f,onCancel:d,loading:p,disabled:b,dirty:m,titleMissing:h})]})}var Ze=`bento-tile bento-glass relative flex flex-col gap-5 overflow-hidden rounded-3xl p-5 md:p-6`;function Qe({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(Ze,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 $e({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 et=480;function tt(e){return window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)}function nt(){return window.scrollY>et}function rt({inline:e=!1}={}){let{t}=(0,o.useTranslation)(),r=n.i(),c=e||r,l=(0,i.useSyncExternalStore)(tt,nt,()=>!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 it(e){return e.bentoRoute??e.fallbackRoute}function at({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 ot({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 st({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(it(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)(at,{label:c&&v.length>0?d(`bento.palette.areas`,{defaultValue:`Areas`}):void 0,children:v.map(({item:e,label:t},n)=>(0,a.jsx)(ot,{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)(at,{label:c.label,children:[c.items.map((e,t)=>{let n=v.length+t;return(0,a.jsx)(ot,{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 ct({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=d||l!=null;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`),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)(lt,{main:g,announcer:_}),t,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.jsx)(`div`,{className:`flex items-center gap-2`,children:s})]}),(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}),b&&(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)(rt,{}),l]})})]})}function lt({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 ut=Object.freeze([{action:`palette`,key:`k`,mod:!0},{action:`palette`,key:`/`},{action:`shortcuts`,key:`?`}]);function dt(){return typeof navigator>`u`?!1:/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent||``)}function ft(e,t){let n=e.key.length===1?e.key.toUpperCase():e.key;return e.mod?[t?`⌘`:`Ctrl`,n]:[n]}function pt(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 mt(e,t){if(e.defaultPrevented||e.isComposing||e.repeat)return;let n=e.key.toLowerCase();return ut.find(r=>n===r.key?r.mod?(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.altKey&&!e.shiftKey:e.metaKey||pt(e.target)?!1:e.ctrlKey===e.altKey:!1)}function ht({onPalette:e,onShortcuts:t,isMac:n=dt()}){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=mt(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 gt({onClick:t,isMac:n=dt(),className:r}){let{t:i}=(0,o.useTranslation)(),c=ut.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:ft(l,n).join(n?``:` `)})]})}function _t({open:e,onOpenChange:n,isMac:r=dt()}){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(ut.map(e=>e.action))],d=[{heading:c(`bento.shortcuts.global`,{defaultValue:`Global`}),rows:u.map(e=>({id:e,label:l[e],combos:ut.filter(t=>t.action===e).map(e=>ft(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 vt=s.IconLayoutGrid;function yt(e,t){return e===t||e.startsWith(`${t}/`)}function bt(e,t){return t.section.areaRoute&&yt(e,t.section.areaRoute)?!0:t.items.some(t=>t.bentoRoute&&yt(e,t.bentoRoute))}function xt({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.h,{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-16 flex-col items-center gap-1 overflow-y-auto overflow-x-hidden border-r border-border/40 bg-background/55 pt-20 pb-4 backdrop-blur-xl backdrop-saturate-150 md:flex`,children:[(0,a.jsx)(St,{to:t,icon:s.IconHome,label:c??l(`home.title`,{defaultValue:`Home`}),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)(St,{to:e.section.areaRoute,icon:e.section.icon??vt,label:e.section.labelKey?l(e.section.labelKey):e.section.id,active:bt(d,e)},e.section.id))]})})}function St({to:e,icon:t,label:r,active:i}){return(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.g,{asChild:!0,children:(0,a.jsx)(u.Link,{to:e,"aria-label":r,"aria-current":i?`page`:void 0,className:`bento-tile-clickable grid h-11 w-11 shrink-0 place-items-center rounded-2xl border transition-colors duration-200 ${i?`bento-rail-active`:`border-transparent text-muted-foreground hover:border-border/60 hover:bg-card/60 hover:text-foreground`}`,children:(0,a.jsx)(t,{size:20})})}),(0,a.jsx)(n.m,{side:`right`,children:r})]})}function Ct({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.A,{children:[(0,a.jsx)(n.W,{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.a,{givenName:d.firstName,familyName:d.lastName,name:h||d.username,src:d.avatarUrl||void 0,alt:d.username})})}),(0,a.jsxs)(n.M,{align:`end`,sideOffset:10,className:`bento-dropdown min-w-64 p-2`,children:[(0,a.jsx)(n.F,{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.a,{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.z,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.N,{children:[(0,a.jsxs)(n.P,{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.P,{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.P,{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.z,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.N,{children:[l&&(0,a.jsxs)(n.P,{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.P,{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.z,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.P,{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 wt={blue:`blue`,violet:`violet`,emerald:`emerald`,amber:`amber`,rose:`rose`,slate:`slate`,cyan:`blue`,orange:`amber`};function Tt({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._.Header||t===n._.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._.Header||t===n._.StaticHeader?null:t===n._.Content?e.props.children:e});return s?(0,a.jsx)(Qe,{icon:s.icon,tone:wt[t]??`blue`,title:s.title,description:s.description,className:r,children:c}):(0,a.jsx)(`section`,{className:e.t(Ze,r),children:c})}Tt.Header=n._.Header,Tt.StaticHeader=n._.StaticHeader,Tt.Content=n._.Content;var Et=`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 Dt({eyebrow:e,title:t,description:n,titleHref:r,children:i,gridClassName:o=Et}){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 Ot({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 kt({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=Tt,exports.BENTO_EMPHASIS_NEXT=Te,exports.BENTO_EMPHASIS_SPAN=we,exports.BENTO_SHELL_SHORTCUTS=ut,exports.BENTO_TONES=x,exports.BENTO_TONE_CLASS=b,exports.BentoActionsMenu=y,exports.BentoBackLink=O,exports.BentoBackToTop=rt,exports.BentoCalendar=Se,exports.BentoChangeMark=I,exports.BentoCommandPalette=st,exports.BentoCountTile=C,exports.BentoDataTable=E,exports.BentoDiff=V,exports.BentoEmptyState=D,exports.BentoEntityShell=F,exports.BentoEntityTile=Oe,exports.BentoFilterBar=Ne,exports.BentoFormHero=Xe,exports.BentoFormSection=Qe,exports.BentoHero=k,exports.BentoHeroIconPicker=A,exports.BentoInlineEdit=j,exports.BentoListPage=Re,exports.BentoNavRail=xt,exports.BentoPaletteTrigger=gt,exports.BentoPanel=$e,exports.BentoSaveBar=qe,exports.BentoScrollSaveBar=Ye,exports.BentoSection=Dt,exports.BentoShell=ct,exports.BentoShortcutsDialog=_t,exports.BentoSplitPage=he,exports.BentoStatusMarker=M,exports.BentoTile=Ot,exports.BentoTileGrid=ze,exports.BentoUserMenu=Ct,exports.BentoVersionRail=kt,exports.EMPTY_FILTERS=ke,exports.bentoChipClass=S,exports.bentoNavTarget=it,exports.resolveBentoLayout=Ee,exports.toBentoLayoutEntries=De,exports.useBentoScrollFade=N,exports.useBentoShellShortcuts=ht;
|