dabi-lib 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,8 @@
1
1
  import { ColumnDef } from '../components/DataTable';
2
2
  import { SheetSide } from '../components/Sheet';
3
3
  type DestinationType = "screen" | "dialog" | "bottomSheet" | "sheet" | "list";
4
- export type Guard = (params?: any) => boolean | Promise<boolean>;
4
+ type ImperativeNavigate = (path: string, params?: any) => void;
5
+ export type Guard = (params?: any, navigate?: ImperativeNavigate) => boolean | Promise<boolean>;
5
6
  export interface RouteConfig {
6
7
  path: string;
7
8
  component?: React.ComponentType<any>;
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const m=require("react"),se=require("lucide-react"),C=require("clsx"),qt=require("class-variance-authority"),$n=require("tailwind-merge"),Pe=require("react-dom");function Jt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const k=Jt(m),Bn=Jt(Pe);var Ve={exports:{}},De={};var _t;function Fn(){if(_t)return De;_t=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,a){var l=null;if(a!==void 0&&(l=""+a),s.key!==void 0&&(l=""+s.key),"key"in s){a={};for(var u in s)u!=="key"&&(a[u]=s[u])}else a=s;return s=a.ref,{$$typeof:e,type:r,key:l,ref:s!==void 0?s:null,props:a}}return De.Fragment=t,De.jsx=n,De.jsxs=n,De}var _e={};var Pt;function zn(){return Pt||(Pt=1,process.env.NODE_ENV!=="production"&&(function(){function e(y){if(y==null)return null;if(typeof y=="function")return y.$$typeof===Z?null:y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case v:return"Fragment";case w:return"Profiler";case h:return"StrictMode";case R:return"Suspense";case M:return"SuspenseList";case B:return"Activity"}if(typeof y=="object")switch(typeof y.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),y.$$typeof){case b:return"Portal";case S:return y.displayName||"Context";case j:return(y._context.displayName||"Context")+".Consumer";case E:var A=y.render;return y=y.displayName,y||(y=A.displayName||A.name||"",y=y!==""?"ForwardRef("+y+")":"ForwardRef"),y;case _:return A=y.displayName||null,A!==null?A:e(y.type)||"Memo";case I:A=y._payload,y=y._init;try{return e(y(A))}catch{}}return null}function t(y){return""+y}function n(y){try{t(y);var A=!1}catch{A=!0}if(A){A=console;var N=A.error,O=typeof Symbol=="function"&&Symbol.toStringTag&&y[Symbol.toStringTag]||y.constructor.name||"Object";return N.call(A,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",O),t(y)}}function r(y){if(y===v)return"<>";if(typeof y=="object"&&y!==null&&y.$$typeof===I)return"<...>";try{var A=e(y);return A?"<"+A+">":"<...>"}catch{return"<...>"}}function s(){var y=Q.A;return y===null?null:y.getOwner()}function a(){return Error("react-stack-top-frame")}function l(y){if(Y.call(y,"key")){var A=Object.getOwnPropertyDescriptor(y,"key").get;if(A&&A.isReactWarning)return!1}return y.key!==void 0}function u(y,A){function N(){T||(T=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",A))}N.isReactWarning=!0,Object.defineProperty(y,"key",{get:N,configurable:!0})}function p(){var y=e(this.type);return L[y]||(L[y]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),y=this.props.ref,y!==void 0?y:null}function f(y,A,N,O,F,K){var z=N.ref;return y={$$typeof:g,type:y,key:A,props:N,_owner:O},(z!==void 0?z:null)!==null?Object.defineProperty(y,"ref",{enumerable:!1,get:p}):Object.defineProperty(y,"ref",{enumerable:!1,value:null}),y._store={},Object.defineProperty(y._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(y,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(y,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:F}),Object.defineProperty(y,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.freeze&&(Object.freeze(y.props),Object.freeze(y)),y}function x(y,A,N,O,F,K){var z=A.children;if(z!==void 0)if(O)if(W(z)){for(O=0;O<z.length;O++)o(z[O]);Object.freeze&&Object.freeze(z)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else o(z);if(Y.call(A,"key")){z=e(y);var $=Object.keys(A).filter(function(Ee){return Ee!=="key"});O=0<$.length?"{key: someKey, "+$.join(": ..., ")+": ...}":"{key: someKey}",H[z+O]||($=0<$.length?"{"+$.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const f=require("react"),se=require("lucide-react"),C=require("clsx"),qt=require("class-variance-authority"),$n=require("tailwind-merge"),Pe=require("react-dom");function Jt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const k=Jt(f),Bn=Jt(Pe);var Ve={exports:{}},De={};var _t;function Fn(){if(_t)return De;_t=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,i){var c=null;if(i!==void 0&&(c=""+i),s.key!==void 0&&(c=""+s.key),"key"in s){i={};for(var u in s)u!=="key"&&(i[u]=s[u])}else i=s;return s=i.ref,{$$typeof:e,type:r,key:c,ref:s!==void 0?s:null,props:i}}return De.Fragment=t,De.jsx=n,De.jsxs=n,De}var _e={};var Pt;function zn(){return Pt||(Pt=1,process.env.NODE_ENV!=="production"&&(function(){function e(y){if(y==null)return null;if(typeof y=="function")return y.$$typeof===Z?null:y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case x:return"Fragment";case w:return"Profiler";case m:return"StrictMode";case S:return"Suspense";case I:return"SuspenseList";case B:return"Activity"}if(typeof y=="object")switch(typeof y.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),y.$$typeof){case b:return"Portal";case R:return y.displayName||"Context";case j:return(y._context.displayName||"Context")+".Consumer";case E:var A=y.render;return y=y.displayName,y||(y=A.displayName||A.name||"",y=y!==""?"ForwardRef("+y+")":"ForwardRef"),y;case _:return A=y.displayName||null,A!==null?A:e(y.type)||"Memo";case M:A=y._payload,y=y._init;try{return e(y(A))}catch{}}return null}function t(y){return""+y}function n(y){try{t(y);var A=!1}catch{A=!0}if(A){A=console;var N=A.error,O=typeof Symbol=="function"&&Symbol.toStringTag&&y[Symbol.toStringTag]||y.constructor.name||"Object";return N.call(A,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",O),t(y)}}function r(y){if(y===x)return"<>";if(typeof y=="object"&&y!==null&&y.$$typeof===M)return"<...>";try{var A=e(y);return A?"<"+A+">":"<...>"}catch{return"<...>"}}function s(){var y=Q.A;return y===null?null:y.getOwner()}function i(){return Error("react-stack-top-frame")}function c(y){if(Y.call(y,"key")){var A=Object.getOwnPropertyDescriptor(y,"key").get;if(A&&A.isReactWarning)return!1}return y.key!==void 0}function u(y,A){function N(){T||(T=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",A))}N.isReactWarning=!0,Object.defineProperty(y,"key",{get:N,configurable:!0})}function p(){var y=e(this.type);return L[y]||(L[y]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),y=this.props.ref,y!==void 0?y:null}function d(y,A,N,O,F,K){var z=N.ref;return y={$$typeof:g,type:y,key:A,props:N,_owner:O},(z!==void 0?z:null)!==null?Object.defineProperty(y,"ref",{enumerable:!1,get:p}):Object.defineProperty(y,"ref",{enumerable:!1,value:null}),y._store={},Object.defineProperty(y._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(y,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(y,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:F}),Object.defineProperty(y,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.freeze&&(Object.freeze(y.props),Object.freeze(y)),y}function h(y,A,N,O,F,K){var z=A.children;if(z!==void 0)if(O)if(W(z)){for(O=0;O<z.length;O++)o(z[O]);Object.freeze&&Object.freeze(z)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else o(z);if(Y.call(A,"key")){z=e(y);var $=Object.keys(A).filter(function(Ee){return Ee!=="key"});O=0<$.length?"{key: someKey, "+$.join(": ..., ")+": ...}":"{key: someKey}",H[z+O]||($=0<$.length?"{"+$.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,O,z,$,z),H[z+O]=!0)}if(z=null,N!==void 0&&(n(N),z=""+N),l(A)&&(n(A.key),z=""+A.key),"key"in A){N={};for(var ce in A)ce!=="key"&&(N[ce]=A[ce])}else N=A;return z&&u(N,typeof y=="function"?y.displayName||y.name||"Unknown":y),f(y,z,N,s(),F,K)}function o(y){c(y)?y._store&&(y._store.validated=1):typeof y=="object"&&y!==null&&y.$$typeof===I&&(y._payload.status==="fulfilled"?c(y._payload.value)&&y._payload.value._store&&(y._payload.value._store.validated=1):y._store&&(y._store.validated=1))}function c(y){return typeof y=="object"&&y!==null&&y.$$typeof===g}var d=m,g=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),S=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),Z=Symbol.for("react.client.reference"),Q=d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,W=Array.isArray,X=console.createTask?console.createTask:function(){return null};d={react_stack_bottom_frame:function(y){return y()}};var T,L={},P=d.react_stack_bottom_frame.bind(d,a)(),V=X(r(a)),H={};_e.Fragment=v,_e.jsx=function(y,A,N){var O=1e4>Q.recentlyCreatedOwnerStacks++;return x(y,A,N,!1,O?Error("react-stack-top-frame"):P,O?X(r(y)):V)},_e.jsxs=function(y,A,N){var O=1e4>Q.recentlyCreatedOwnerStacks++;return x(y,A,N,!0,O?Error("react-stack-top-frame"):P,O?X(r(y)):V)}})()),_e}var It;function Vn(){return It||(It=1,process.env.NODE_ENV==="production"?Ve.exports=Fn():Ve.exports=zn()),Ve.exports}var i=Vn();const Qt=m.createContext(null),Zt=()=>{const e=m.useContext(Qt);if(!e)throw new Error("useAccordion must be used within an Accordion");return e},Hn=m.forwardRef((e,t)=>{const{type:n="multiple",value:r,defaultValue:s,onValueChange:a,children:l,className:u,...p}=e,f=e.type==="single"&&e.collapsible,[x,o]=m.useState(s),c=r!==void 0,d=c?r:x,g=m.useCallback(v=>{let h;if(n==="single")h=d===v&&f?void 0:v,a&&a(h);else{const w=d||[];h=w.includes(v)?w.filter(j=>j!==v):[...w,v],a&&a(h)}c||o(h)},[n,d,f,c,a]),b={value:Array.isArray(d)?d:d?[d]:[],onItemClick:g};return i.jsx(Qt.Provider,{value:b,children:i.jsx("div",{ref:t,className:C.clsx("overflow-hidden rounded-lg border border-outline",u),...p,children:l})})}),en=m.createContext(null),tn=()=>{const e=m.useContext(en);if(!e)throw new Error("useAccordionItem must be used within an AccordionItem");return e},Yn=m.forwardRef(({children:e,className:t,value:n,...r},s)=>i.jsx(en.Provider,{value:{value:n},children:i.jsx("div",{ref:s,className:C.clsx("border-b last-of-type:border-b-0 border-outline",t),...r,children:e})})),Wn=m.forwardRef(({children:e,className:t,...n},r)=>{const{onItemClick:s,value:a}=Zt(),{value:l}=tn(),u=a.includes(l);return i.jsxs("button",{ref:r,className:C.clsx("flex w-full items-center justify-between p-4 font-medium transition-all hover:bg-surface-variant [&[data-state=open]>svg]:rotate-180",t),onClick:()=>s(l),...n,children:[e,i.jsx(se.ChevronDown,{className:C.clsx("h-4 w-4 shrink-0 transition-transform duration-150",u&&"rotate-180")})]})}),Un=m.forwardRef(({children:e,className:t,...n},r)=>{const{value:s}=Zt(),{value:a}=tn();if(s.includes(a))return i.jsx("div",{ref:r,className:C.clsx("overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",t),...n,children:i.jsx("div",{className:"pb-4 pl-4 pr-4",children:e})})});function xt({open:e,onClose:t,children:n,classNameOverlay:r}){const[s,a]=m.useState(!1),[l,u]=m.useState(!1);return m.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),m.useEffect(()=>{const p=f=>{f.key==="Escape"&&t()};return e&&document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p)}},[e,t]),m.useEffect(()=>{if(e)a(!0);else{const p=setTimeout(()=>a(!1),200);return()=>clearTimeout(p)}},[e]),m.useEffect(()=>{s&&e?requestAnimationFrame(()=>{u(!0)}):s&&!e&&u(!1)},[s,e]),s?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:C("fixed inset-0 bg-black/50 bg-opacity-50 backdrop-blur-sm z-40 transition-opacity duration-200",l?"opacity-100":"opacity-0",r)}),i.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-50 p-4",onClick:t,children:i.jsx("div",{className:C("bg-surface border border-outline rounded-lg shadow-lg max-w-lg w-full p-6 relative transition-all duration-200 ease-out",l?"opacity-100 translate-y-0":"opacity-0 translate-y-12"),onClick:p=>p.stopPropagation(),children:n})})]}):null}const bt=qt.cva("group cursor-pointer inline-flex items-center justify-center font-medium rounded-[3rem] active:rounded-[0.5rem] transition-all duration-150 disabled:opacity-50 disabled:!pointer-events-none",{variants:{variant:{filled:"bg-primary text-on-primary hover:bg-primary-dark",outlined:"border border-primary text-primary hover:bg-primary/10 dark:hover:bg-primary/20",tonal:"bg-primary/20 text-primary hover:bg-primary/30 dark:hover:bg-primary/40",ghost:"bg-transparent text-primary hover:bg-primary/10 dark:hover:bg-primary/20",link:"text-primary underline-offset-4 hover:underline !bg-transparent !p-0 !h-auto"},size:{sm:"h-10 md:h-9 px-4 text-sm",md:"h-12 md:h-10 px-6 text-base",lg:"h-14 md:h-11 px-8 text-lg",icon:"!size-10 md:!size-9 flex items-center justify-center"}},defaultVariants:{variant:"filled",size:"md"}});function Ie({variant:e,size:t,children:n,className:r,...s}){return i.jsx("div",{className:C(bt({variant:e,size:t}),r),children:i.jsx("button",{...s,className:C("w-full h-full cursor-pointer transition-all duration-150 flex flex-row items-center justify-center focus:outline-none"),children:n})})}function nn({open:e,onClose:t,title:n,message:r,confirmText:s="OK"}){return i.jsx(xt,{open:e,onClose:t,children:i.jsxs("div",{className:"text-center",children:[i.jsx("h2",{className:"text-xl font-semibold mb-2",children:n}),i.jsx("p",{className:"mb-4 text-on-surface-variant",children:r}),i.jsx("div",{className:"flex justify-end gap-2",children:i.jsx(Ie,{onClick:t,children:s})})]})})}function Je(...e){return $n.twMerge(C.clsx(e))}function rn({orientation:e="horizontal",className:t}){return i.jsx("div",{role:"separator",className:C("shrink-0 bg-outline",e==="horizontal"?"h-px w-full":"w-px h-full",t)})}const Gn=qt.cva("flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});function Xn({className:e,orientation:t,...n}){return i.jsx("div",{role:"group","data-slot":"button-group","data-orientation":t,className:Je(Gn({orientation:t}),e),...n})}function Kn({className:e,...t}){return i.jsx("div",{className:Je("bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",e),...t})}function qn({className:e,orientation:t="vertical",...n}){return i.jsx(rn,{"data-slot":"button-group-separator",orientation:t,className:Je("bg-input relative m-0! self-stretch data-[orientation=vertical]:h-auto",e),...n})}const on=m.forwardRef(({variant:e="filled",children:t,className:n,...r},s)=>{const u=C("rounded-lg p-4",{elevated:"shadow shadow-md",filled:"bg-surface-variant",outlined:"border border-outline"}[e],n);return i.jsx("div",{ref:s,className:u,...r,children:t})});function sn({checked:e,onChange:t,label:n,disabled:r=!1,className:s=""}){return i.jsxs("label",{className:C("flex items-center gap-2 cursor-pointer",r&&"pointer-events-none opacity-50",s),children:[i.jsx("input",{type:"checkbox",checked:e,onChange:a=>t(a.target.checked),disabled:r,className:"sr-only peer"}),i.jsx("div",{className:C("w-5 h-5 border-2 rounded-md flex items-center justify-center transition-colors duration-150",e?"bg-primary border-primary":"border-outline"),children:e&&i.jsx("svg",{className:"w-3 h-3 text-on-primary",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("polyline",{points:"20 6 9 17 4 12"})})}),n&&i.jsx("span",{className:"select-none text-base font-medium",children:n})]})}const vt=({variant:e="assist",label:t,icon:n,avatar:r,onDelete:s,onClick:a,selected:l,colors:u})=>{const[p,f]=m.useState(!1),c=C("text-on-surface inline-flex items-center justify-center rounded-lg border border-outline-variant px-2 py-1 text-sm text-on-surface transition-colors duration-150",{assist:"hover:bg-primary/10 dark:hover:bg-primary/20",filter:l?"border-transparent bg-primary-container text-on-primary-container cursor-pointer":" hover:bg-gray-50 cursor-pointer",input:"",suggestion:"hover:bg-primary/10 dark:hover:bg-primary/20"}[e]),d=C({[u?.backgroundColorClass??""]:!l&&!p,[u?.textColorClass??""]:!l,[u?.borderColorClass??""]:!l,[u?.hoverBackgroundColorClass??""]:!l&&p,[u?.selectedBackgroundColorClass??""]:l&&!p,[u?.selectedTextColorClass??""]:l,[u?.selectedBorderColorClass??""]:l,[u?.selectedHoverBackgroundColorClass??""]:l&&p,"cursor-pointer":a});return i.jsxs("div",{className:C(c,d),onClick:a,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:[r,n&&i.jsx("span",{className:"me-2",children:n}),i.jsx("span",{children:t}),s&&i.jsx("button",{onClick:s,className:"ms-2 p-[0.2rem] rounded-lg hover:bg-primary/10 dark:hover:bg-primary/20 transition-colors duration-150",children:i.jsx(se.X,{className:"size-4"})})]})};function an({open:e,onClose:t,onConfirm:n,title:r,message:s,confirmText:a="Confirm",cancelText:l="Cancel"}){return i.jsx(xt,{open:e,onClose:t,children:i.jsxs("div",{className:"text-center",children:[i.jsx("h2",{className:"text-xl font-semibold mb-2",children:r}),i.jsx("p",{className:"mb-4 text-on-surface-variant",children:s}),i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx(Ie,{variant:"outlined",onClick:t,children:l}),i.jsx(Ie,{onClick:n,children:a})]})]})})}function Jn({text:e,label:t,labelCopied:n,variant:r="ghost",size:s="md",successulCallback:a}){const[l,u]=m.useState(!1),p={sm:"size-4",md:"size-6"},f={sm:"size-4",md:"size-5"},x={sm:"rounded-[0.8rem]",md:"rounded-lg"},o={sm:"text-sm",md:"text-base"},c={outlined:"border border-primary text-primary hover:bg-primary/10 dark:hover:bg-primary/20",ghost:"bg-transparent text-primary hover:bg-primary/10 dark:hover:bg-primary/20"},d=async()=>{try{await navigator.clipboard.writeText(e),u(!0),a?.(),setTimeout(()=>u(!1),2e3)}catch(g){console.error("Copy failed",g)}};return i.jsxs("button",{onClick:d,className:C(x[s],"cursor-pointer inline-flex items-center justify-center p-2 transition duration-150",c[r]),"aria-label":"Copy to clipboard",children:[i.jsxs("span",{className:C(p[s],"relative flex items-center justify-center"),children:[i.jsx(se.Clipboard,{className:`${f[s]} absolute inset-0 left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 transition-transform duration-200 ${l?"scale-0 opacity-0":"scale-100 opacity-100"}`}),i.jsx(se.Check,{className:`${f[s]} absolute inset-0 left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 transition-transform duration-200 ${l?"scale-100 opacity-100":"scale-0 opacity-0"} text-success`})]}),t&&i.jsx("span",{className:C(o[s],"ml-2 me-1"),children:l&&n||t})]})}const Se={LEFT:"left",CENTER:"center",RIGHT:"right"};function ln(e){const t=new Set;e.forEach(r=>{Object.keys(r).forEach(s=>{r[s]&&typeof r[s]=="object"&&!Array.isArray(r[s])?Object.keys(r[s]).forEach(a=>{t.add(`${s}.${a}`)}):t.add(s)})});const n={};return t.forEach(r=>{const[s,a]=r.split(".");a?(n[s]||(n[s]=[]),n[s].push(a)):n[r]||(n[r]=[])}),Object.entries(n).map(([r,s])=>({parent:r,children:s}))}function Qn(e){const t={};for(const n of e){const r=n.accessorKey,[s,a]=r.split(".");a?(t[s]||(t[s]=[]),t[s].push(a)):t[s]||(t[s]=[])}return Object.entries(t).map(([n,r])=>({parent:n,children:r}))}function Mt(e,t){return t.split(".").reduce((n,r)=>n?n[r]:void 0,e)}function cn({data:e,columns:t,headerAlignment:n=Se.CENTER,cellAlignment:r=Se.LEFT}){const s=u=>{switch(u){case Se.LEFT:return"text-left";case Se.CENTER:return"text-center";case Se.RIGHT:return"text-right";default:return"text-left"}};if(!e||e.length===0)return i.jsx("div",{className:"text-center py-8 text-on-surface-variant",children:"Keine Daten vorhanden."});const a=()=>{const u=ln(e),p=u.flatMap(o=>o.children.length>0?o.children.map(c=>`${o.parent}.${c}`):[o.parent]),f=0,x=u.length-1;return i.jsxs("table",{className:"min-w-full border-separate border-spacing-0 rounded-lg",children:[i.jsxs("thead",{children:[i.jsx("tr",{children:u.map((o,c)=>{const d=c===f&&c===x?"rounded-tl-lg rounded-tr-lg":c===f?"rounded-tl-lg":c===x?"rounded-tr-lg":"",b=!(c===x);return o.children.length>0?i.jsx("th",{colSpan:o.children.length,className:`font-medium px-4 py-3 border-b ${b?"border-r":""} ${s(n)} bg-surface-variant text-on-surface border-outline ${d}`,children:(()=>{if(!t)return o.parent;const v=t.find(w=>w.accessorKey===o.parent||w.accessorKey===`${o.parent}.${o.children[0]}`);if(!v)return o.parent;const h=v.header;return typeof h=="function"?h({column:v}):h??o.parent})()},o.parent):i.jsx("th",{rowSpan:2,className:`font-medium px-4 py-3 border-b ${b?"border-r":""} ${s(n)} align-middle bg-surface-variant text-on-surface border-outline ${d}`,children:(()=>{if(!t)return o.parent;const v=t.find(w=>w.accessorKey===o.parent);if(!v)return o.parent;const h=v.header;return typeof h=="function"?h({column:v}):h??o.parent})()},o.parent)})}),i.jsx("tr",{children:u.map(o=>o.children.length>0?o.children.map((c,d,g)=>{const b=d===g.length-1,v=u.indexOf(o)===u.length-1,h=!(b&&v);return i.jsx("th",{className:`font-normal px-4 py-2 border-b ${h?"border-r":""} ${s(n)} bg-surface text-on-surface border-outline-variant`,children:c},`${o.parent}.${c}`)}):null)})]}),i.jsx("tbody",{children:e.map((o,c)=>i.jsx("tr",{className:"transition-colors hover:bg-hover",children:p.map((d,g)=>{const b=Mt(o,d),v=c===e.length-1,w=!(g===p.length-1);return i.jsx("td",{className:`px-4 py-3 ${w?"border-r":""} ${s(r)} text-on-surface border-outline-variant ${v?"":"border-b"}`,children:b!=null?b.toString():""},d)})},c))})]})},l=()=>{const u=Qn(t),p=u.flatMap(f=>f.children.length>0?f.children.map(x=>`${f.parent}.${x}`):[f.parent]);return i.jsxs("table",{className:"min-w-full border-separate border-spacing-0 rounded-lg",children:[i.jsxs("thead",{children:[i.jsx("tr",{children:u.map((f,x)=>{const c=!(x===u.length-1),d=0,g=u.length-1,b=x===d&&x===g?"rounded-tl-lg rounded-tr-lg":x===d?"rounded-tl-lg":x===g?"rounded-tr-lg":"";return f.children.length>0?i.jsx("th",{colSpan:f.children.length,className:`font-medium px-4 py-3 border-b ${c?"border-r":""} ${s(n)} bg-surface-variant text-on-surface border-outline ${b}`,children:(()=>{const v=t.find(h=>h.accessorKey===f.parent)?.header;return typeof v=="function"?v({column:t.find(h=>h.accessorKey===f.parent)}):v??f.parent})()},f.parent):i.jsx("th",{rowSpan:2,className:`font-medium px-4 py-3 border-b ${c?"border-r":""} ${s(n)} align-middle bg-surface-variant text-on-surface border-outline ${b}`,children:(()=>{const v=t.find(w=>w.accessorKey===f.parent);if(!v)return f.parent;const h=v.header;return typeof h=="function"?h({column:t.find(w=>w.accessorKey===f.parent)}):h??f.parent})()},f.parent)})}),i.jsx("tr",{children:u.map(f=>f.children.length>0?f.children.map((x,o,c)=>{const g=!(o===c.length-1);return i.jsx("th",{className:`font-normal px-4 py-2 border-b ${g?"border-r":""} ${s(n)} bg-surface text-on-surface border-outline-variant`,children:(()=>{const b=t.find(v=>v.accessorKey===`${f.parent}.${x}`)?.header;return typeof b=="function"?b({column:t.find(v=>v.accessorKey===`${f.parent}.${x}`)}):b??x})()},`${f.parent}.${x}`)}):null)})]}),i.jsx("tbody",{children:e.map((f,x)=>i.jsx("tr",{className:"transition-colors hover:bg-hover",children:p.map((o,c)=>{const d=t.find(w=>w.accessorKey===o),g=x===e.length-1,v=!(c===p.length-1);let h=d?.cell?d.cell({row:f}):Mt(f,o);return typeof h=="object"&&h!==null&&!m.isValidElement(h)&&(h=JSON.stringify(h)),i.jsx("td",{className:`px-4 py-3 ${v?"border-r":""} ${s(r)} text-on-surface border-outline-variant ${g?"":"border-b"}`,children:h},o)})},x))})]})};return i.jsx("div",{className:"overflow-x-auto rounded-lg shadow-sm bg-surface",children:t?l():a()})}const Zn=({icon:e,label:t,extended:n=!1,onClick:r,className:s})=>i.jsx("button",{className:C("inline-flex items-center justify-center font-medium transition-all duration-150 ease-in-out cursor-pointer","h-14","bg-primary text-on-primary shadow-md hover:shadow-lg",n?"w-auto px-6 rounded-2xl":"w-auto px-4 rounded-2xl",s),onClick:r,children:n?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:C("flex items-center justify-center w-6 h-6 transition-all duration-150 ease-in-out",t&&"mr-3"),children:e}),i.jsx("span",{className:C("whitespace-nowrap transition-all duration-150 ease-in-out","opacity-100 translate-x-0"),children:t})]}):i.jsx("span",{className:C("flex items-center justify-center w-6 h-6 transition-all duration-150 ease-in-out"),children:e})}),Qe=m.forwardRef(({label:e,className:t,variant:n="default",...r},s)=>{const a="w-full rounded-lg transition duration-150 disabled:opacity-50 disabled:pointer-events-none",l="h-12 md:h-10 px-3 py-1 text-base",u={default:"border border-outline-variant outline-none focus-visible:ring-primary/50 focus-visible:ring-[3px]",ghost:"border-none outline-none focus-visible:ring-none"};return i.jsxs("div",{children:[e&&i.jsx("label",{htmlFor:r.id,className:"block text-sm font-medium text-on-surface",children:e}),i.jsx("input",{ref:s,className:C(a,l,u[n],t),...r})]})});function er({label:e,description:t,leadingContent:n,trailingContent:r,clickable:s=!1,disabled:a=!1,onClick:l,variant:u="rounded"}){const p=C("flex items-center gap-4 min-h-12 md:min-h-10 py-2 px-6 w-full","transition-all duration-150 bg-surface-variant",{"rounded-t-lg":u==="first","rounded-b-lg":u==="last","rounded-none":u==="none","rounded-lg":u==="rounded","cursor-pointer active:bg-primary-container sm:hover:bg-primary-container":s&&!a,"hover:rounded-lg":s&&!a&&(u==="none"||u==="first"||u==="last"),"hover:mb-1":s&&!a&&u==="first","hover:my-1":s&&!a&&u==="none","hover:mt-1":s&&!a&&u==="last","opacity-50 cursor-not-allowed":a});return i.jsxs("div",{className:p,onClick:!a&&s?l:void 0,children:[n&&i.jsx("span",{className:"text-primary",children:n}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:" text-primary",children:e}),t&&i.jsx("p",{className:"text-xs text-primary/75",children:t})]}),r&&i.jsx("span",{className:"text-xl text-primary",children:r})]})}function tr({className:e,...t}){return i.jsx("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:C("mx-auto flex w-full justify-center",e),...t})}function nr({className:e,...t}){return i.jsx("ul",{"data-slot":"pagination-content",className:C("flex flex-row items-center gap-1",e),...t})}function rr({...e}){return i.jsx("li",{"data-slot":"pagination-item",...e})}function yt({className:e,isActive:t,size:n="icon",...r}){return i.jsx("a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:C(bt({variant:t?"outlined":"ghost",size:n}),e),...r})}function or({className:e,...t}){return i.jsxs(yt,{"aria-label":"Go to previous page",className:C("gap-1 px-2.5 sm:pl-2.5",e),size:"md",...t,children:[i.jsx(se.ChevronLeftIcon,{}),i.jsx("span",{className:"hidden sm:block",children:"Previous"})]})}function sr({className:e,...t}){return i.jsxs(yt,{"aria-label":"Go to next page",className:C("gap-1 px-2.5 sm:pr-2.5",e),size:"md",...t,children:[i.jsx("span",{className:"hidden sm:block",children:"Next"}),i.jsx(se.ChevronRightIcon,{})]})}function ar({className:e,...t}){return i.jsxs("span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:C("flex size-9 items-center justify-center",e),...t,children:[i.jsx(se.MoreHorizontalIcon,{className:"size-4"}),i.jsx("span",{className:"sr-only",children:"More pages"})]})}function Ze(){return typeof window<"u"}function Ae(e){return un(e)?(e.nodeName||"").toLowerCase():"#document"}function re(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function me(e){var t;return(t=(un(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function un(e){return Ze()?e instanceof Node||e instanceof re(e).Node:!1}function J(e){return Ze()?e instanceof Element||e instanceof re(e).Element:!1}function fe(e){return Ze()?e instanceof HTMLElement||e instanceof re(e).HTMLElement:!1}function Lt(e){return!Ze()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof re(e).ShadowRoot}const ir=new Set(["inline","contents"]);function Le(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=le(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!ir.has(s)}const lr=new Set(["table","td","th"]);function cr(e){return lr.has(Ae(e))}const ur=[":popover-open",":modal"];function et(e){return ur.some(t=>{try{return e.matches(t)}catch{return!1}})}const dr=["transform","translate","scale","rotate","perspective"],fr=["transform","translate","scale","rotate","perspective","filter"],mr=["paint","layout","strict","content"];function wt(e){const t=Et(),n=J(e)?le(e):e;return dr.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||fr.some(r=>(n.willChange||"").includes(r))||mr.some(r=>(n.contain||"").includes(r))}function pr(e){let t=xe(e);for(;fe(t)&&!Te(t);){if(wt(t))return t;if(et(t))return null;t=xe(t)}return null}function Et(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const hr=new Set(["html","body","#document"]);function Te(e){return hr.has(Ae(e))}function le(e){return re(e).getComputedStyle(e)}function tt(e){return J(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xe(e){if(Ae(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Lt(e)&&e.host||me(e);return Lt(t)?t.host:t}function dn(e){const t=xe(e);return Te(t)?e.ownerDocument?e.ownerDocument.body:e.body:fe(t)&&Le(t)?t:dn(t)}function Me(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=dn(e),a=s===((r=e.ownerDocument)==null?void 0:r.body),l=re(s);if(a){const u=ft(l);return t.concat(l,l.visualViewport||[],Le(s)?s:[],u&&n?Me(u):[])}return t.concat(s,Me(s,[],n))}function ft(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Ue=Math.min,ve=Math.max,Ge=Math.round,He=Math.floor,de=e=>({x:e,y:e}),gr={left:"right",right:"left",bottom:"top",top:"bottom"},xr={start:"end",end:"start"};function $t(e,t,n){return ve(e,Ue(t,n))}function nt(e,t){return typeof e=="function"?e(t):e}function ye(e){return e.split("-")[0]}function rt(e){return e.split("-")[1]}function fn(e){return e==="x"?"y":"x"}function mn(e){return e==="y"?"height":"width"}const br=new Set(["top","bottom"]);function ge(e){return br.has(ye(e))?"y":"x"}function pn(e){return fn(ge(e))}function vr(e,t,n){n===void 0&&(n=!1);const r=rt(e),s=pn(e),a=mn(s);let l=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(l=Xe(l)),[l,Xe(l)]}function yr(e){const t=Xe(e);return[mt(e),t,mt(t)]}function mt(e){return e.replace(/start|end/g,t=>xr[t])}const Bt=["left","right"],Ft=["right","left"],wr=["top","bottom"],Er=["bottom","top"];function jr(e,t,n){switch(e){case"top":case"bottom":return n?t?Ft:Bt:t?Bt:Ft;case"left":case"right":return t?wr:Er;default:return[]}}function Nr(e,t,n,r){const s=rt(e);let a=jr(ye(e),n==="start",r);return s&&(a=a.map(l=>l+"-"+s),t&&(a=a.concat(a.map(mt)))),a}function Xe(e){return e.replace(/left|right|bottom|top/g,t=>gr[t])}function Cr(e){return{top:0,right:0,bottom:0,left:0,...e}}function Rr(e){return typeof e!="number"?Cr(e):{top:e,right:e,bottom:e,left:e}}function Ke(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}var Sr=typeof document<"u",kr=function(){},pt=Sr?m.useLayoutEffect:kr;const Tr={...k},Ar=Tr.useInsertionEffect,Or=Ar||(e=>e());function Dr(e){const t=k.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Or(()=>{t.current=e}),k.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function zt(e,t,n){let{reference:r,floating:s}=e;const a=ge(t),l=pn(t),u=mn(l),p=ye(t),f=a==="y",x=r.x+r.width/2-s.width/2,o=r.y+r.height/2-s.height/2,c=r[u]/2-s[u]/2;let d;switch(p){case"top":d={x,y:r.y-s.height};break;case"bottom":d={x,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:o};break;case"left":d={x:r.x-s.width,y:o};break;default:d={x:r.x,y:r.y}}switch(rt(t)){case"start":d[l]-=c*(n&&f?-1:1);break;case"end":d[l]+=c*(n&&f?-1:1);break}return d}const _r=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:a=[],platform:l}=n,u=a.filter(Boolean),p=await(l.isRTL==null?void 0:l.isRTL(t));let f=await l.getElementRects({reference:e,floating:t,strategy:s}),{x,y:o}=zt(f,r,p),c=r,d={},g=0;for(let b=0;b<u.length;b++){const{name:v,fn:h}=u[b],{x:w,y:j,data:S,reset:E}=await h({x,y:o,initialPlacement:r,placement:c,strategy:s,middlewareData:d,rects:f,platform:l,elements:{reference:e,floating:t}});x=w??x,o=j??o,d={...d,[v]:{...d[v],...S}},E&&g<=50&&(g++,typeof E=="object"&&(E.placement&&(c=E.placement),E.rects&&(f=E.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:s}):E.rects),{x,y:o}=zt(f,c,p)),b=-1)}return{x,y:o,placement:c,strategy:s,middlewareData:d}};async function hn(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:a,rects:l,elements:u,strategy:p}=e,{boundary:f="clippingAncestors",rootBoundary:x="viewport",elementContext:o="floating",altBoundary:c=!1,padding:d=0}=nt(t,e),g=Rr(d),v=u[c?o==="floating"?"reference":"floating":o],h=Ke(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(v)))==null||n?v:v.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(u.floating)),boundary:f,rootBoundary:x,strategy:p})),w=o==="floating"?{x:r,y:s,width:l.floating.width,height:l.floating.height}:l.reference,j=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u.floating)),S=await(a.isElement==null?void 0:a.isElement(j))?await(a.getScale==null?void 0:a.getScale(j))||{x:1,y:1}:{x:1,y:1},E=Ke(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:w,offsetParent:j,strategy:p}):w);return{top:(h.top-E.top+g.top)/S.y,bottom:(E.bottom-h.bottom+g.bottom)/S.y,left:(h.left-E.left+g.left)/S.x,right:(E.right-h.right+g.right)/S.x}}const Pr=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:a,rects:l,initialPlacement:u,platform:p,elements:f}=t,{mainAxis:x=!0,crossAxis:o=!0,fallbackPlacements:c,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...v}=nt(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const h=ye(s),w=ge(u),j=ye(u)===u,S=await(p.isRTL==null?void 0:p.isRTL(f.floating)),E=c||(j||!b?[Xe(u)]:yr(u)),R=g!=="none";!c&&R&&E.push(...Nr(u,b,g,S));const M=[u,...E],_=await hn(t,v),I=[];let B=((r=a.flip)==null?void 0:r.overflows)||[];if(x&&I.push(_[h]),o){const W=vr(s,l,S);I.push(_[W[0]],_[W[1]])}if(B=[...B,{placement:s,overflows:I}],!I.every(W=>W<=0)){var Z,Q;const W=(((Z=a.flip)==null?void 0:Z.index)||0)+1,X=M[W];if(X&&(!(o==="alignment"?w!==ge(X):!1)||B.every(P=>ge(P.placement)===w?P.overflows[0]>0:!0)))return{data:{index:W,overflows:B},reset:{placement:X}};let T=(Q=B.filter(L=>L.overflows[0]<=0).sort((L,P)=>L.overflows[1]-P.overflows[1])[0])==null?void 0:Q.placement;if(!T)switch(d){case"bestFit":{var Y;const L=(Y=B.filter(P=>{if(R){const V=ge(P.placement);return V===w||V==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(V=>V>0).reduce((V,H)=>V+H,0)]).sort((P,V)=>P[1]-V[1])[0])==null?void 0:Y[0];L&&(T=L);break}case"initialPlacement":T=u;break}if(s!==T)return{reset:{placement:T}}}return{}}}},Ir=new Set(["left","top"]);async function Mr(e,t){const{placement:n,platform:r,elements:s}=e,a=await(r.isRTL==null?void 0:r.isRTL(s.floating)),l=ye(n),u=rt(n),p=ge(n)==="y",f=Ir.has(l)?-1:1,x=a&&p?-1:1,o=nt(t,e);let{mainAxis:c,crossAxis:d,alignmentAxis:g}=typeof o=="number"?{mainAxis:o,crossAxis:0,alignmentAxis:null}:{mainAxis:o.mainAxis||0,crossAxis:o.crossAxis||0,alignmentAxis:o.alignmentAxis};return u&&typeof g=="number"&&(d=u==="end"?g*-1:g),p?{x:d*x,y:c*f}:{x:c*f,y:d*x}}const Lr=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:a,placement:l,middlewareData:u}=t,p=await Mr(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:s+p.x,y:a+p.y,data:{...p,placement:l}}}}},$r=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:u={fn:v=>{let{x:h,y:w}=v;return{x:h,y:w}}},...p}=nt(e,t),f={x:n,y:r},x=await hn(t,p),o=ge(ye(s)),c=fn(o);let d=f[c],g=f[o];if(a){const v=c==="y"?"top":"left",h=c==="y"?"bottom":"right",w=d+x[v],j=d-x[h];d=$t(w,d,j)}if(l){const v=o==="y"?"top":"left",h=o==="y"?"bottom":"right",w=g+x[v],j=g-x[h];g=$t(w,g,j)}const b=u.fn({...t,[c]:d,[o]:g});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[c]:a,[o]:l}}}}}};function gn(e){const t=le(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=fe(e),a=s?e.offsetWidth:n,l=s?e.offsetHeight:r,u=Ge(n)!==a||Ge(r)!==l;return u&&(n=a,r=l),{width:n,height:r,$:u}}function jt(e){return J(e)?e:e.contextElement}function ke(e){const t=jt(e);if(!fe(t))return de(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:a}=gn(t);let l=(a?Ge(n.width):n.width)/r,u=(a?Ge(n.height):n.height)/s;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const Br=de(0);function xn(e){const t=re(e);return!Et()||!t.visualViewport?Br:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Fr(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==re(e)?!1:t}function we(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),a=jt(e);let l=de(1);t&&(r?J(r)&&(l=ke(r)):l=ke(e));const u=Fr(a,n,r)?xn(a):de(0);let p=(s.left+u.x)/l.x,f=(s.top+u.y)/l.y,x=s.width/l.x,o=s.height/l.y;if(a){const c=re(a),d=r&&J(r)?re(r):r;let g=c,b=ft(g);for(;b&&r&&d!==g;){const v=ke(b),h=b.getBoundingClientRect(),w=le(b),j=h.left+(b.clientLeft+parseFloat(w.paddingLeft))*v.x,S=h.top+(b.clientTop+parseFloat(w.paddingTop))*v.y;p*=v.x,f*=v.y,x*=v.x,o*=v.y,p+=j,f+=S,g=re(b),b=ft(g)}}return Ke({width:x,height:o,x:p,y:f})}function ot(e,t){const n=tt(e).scrollLeft;return t?t.left+n:we(me(e)).left+n}function bn(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ot(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function zr(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const a=s==="fixed",l=me(r),u=t?et(t.floating):!1;if(r===l||u&&a)return n;let p={scrollLeft:0,scrollTop:0},f=de(1);const x=de(0),o=fe(r);if((o||!o&&!a)&&((Ae(r)!=="body"||Le(l))&&(p=tt(r)),fe(r))){const d=we(r);f=ke(r),x.x=d.x+r.clientLeft,x.y=d.y+r.clientTop}const c=l&&!o&&!a?bn(l,p):de(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-p.scrollLeft*f.x+x.x+c.x,y:n.y*f.y-p.scrollTop*f.y+x.y+c.y}}function Vr(e){return Array.from(e.getClientRects())}function Hr(e){const t=me(e),n=tt(e),r=e.ownerDocument.body,s=ve(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=ve(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+ot(e);const u=-n.scrollTop;return le(r).direction==="rtl"&&(l+=ve(t.clientWidth,r.clientWidth)-s),{width:s,height:a,x:l,y:u}}const Vt=25;function Yr(e,t){const n=re(e),r=me(e),s=n.visualViewport;let a=r.clientWidth,l=r.clientHeight,u=0,p=0;if(s){a=s.width,l=s.height;const x=Et();(!x||x&&t==="fixed")&&(u=s.offsetLeft,p=s.offsetTop)}const f=ot(r);if(f<=0){const x=r.ownerDocument,o=x.body,c=getComputedStyle(o),d=x.compatMode==="CSS1Compat"&&parseFloat(c.marginLeft)+parseFloat(c.marginRight)||0,g=Math.abs(r.clientWidth-o.clientWidth-d);g<=Vt&&(a-=g)}else f<=Vt&&(a+=f);return{width:a,height:l,x:u,y:p}}const Wr=new Set(["absolute","fixed"]);function Ur(e,t){const n=we(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,a=fe(e)?ke(e):de(1),l=e.clientWidth*a.x,u=e.clientHeight*a.y,p=s*a.x,f=r*a.y;return{width:l,height:u,x:p,y:f}}function Ht(e,t,n){let r;if(t==="viewport")r=Yr(e,n);else if(t==="document")r=Hr(me(e));else if(J(t))r=Ur(t,n);else{const s=xn(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Ke(r)}function vn(e,t){const n=xe(e);return n===t||!J(n)||Te(n)?!1:le(n).position==="fixed"||vn(n,t)}function Gr(e,t){const n=t.get(e);if(n)return n;let r=Me(e,[],!1).filter(u=>J(u)&&Ae(u)!=="body"),s=null;const a=le(e).position==="fixed";let l=a?xe(e):e;for(;J(l)&&!Te(l);){const u=le(l),p=wt(l);!p&&u.position==="fixed"&&(s=null),(a?!p&&!s:!p&&u.position==="static"&&!!s&&Wr.has(s.position)||Le(l)&&!p&&vn(e,l))?r=r.filter(x=>x!==l):s=u,l=xe(l)}return t.set(e,r),r}function Xr(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const l=[...n==="clippingAncestors"?et(t)?[]:Gr(t,this._c):[].concat(n),r],u=l[0],p=l.reduce((f,x)=>{const o=Ht(t,x,s);return f.top=ve(o.top,f.top),f.right=Ue(o.right,f.right),f.bottom=Ue(o.bottom,f.bottom),f.left=ve(o.left,f.left),f},Ht(t,u,s));return{width:p.right-p.left,height:p.bottom-p.top,x:p.left,y:p.top}}function Kr(e){const{width:t,height:n}=gn(e);return{width:t,height:n}}function qr(e,t,n){const r=fe(t),s=me(t),a=n==="fixed",l=we(e,!0,a,t);let u={scrollLeft:0,scrollTop:0};const p=de(0);function f(){p.x=ot(s)}if(r||!r&&!a)if((Ae(t)!=="body"||Le(s))&&(u=tt(t)),r){const d=we(t,!0,a,t);p.x=d.x+t.clientLeft,p.y=d.y+t.clientTop}else s&&f();a&&!r&&s&&f();const x=s&&!r&&!a?bn(s,u):de(0),o=l.left+u.scrollLeft-p.x-x.x,c=l.top+u.scrollTop-p.y-x.y;return{x:o,y:c,width:l.width,height:l.height}}function ut(e){return le(e).position==="static"}function Yt(e,t){if(!fe(e)||le(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return me(e)===n&&(n=n.ownerDocument.body),n}function yn(e,t){const n=re(e);if(et(e))return n;if(!fe(e)){let s=xe(e);for(;s&&!Te(s);){if(J(s)&&!ut(s))return s;s=xe(s)}return n}let r=Yt(e,t);for(;r&&cr(r)&&ut(r);)r=Yt(r,t);return r&&Te(r)&&ut(r)&&!wt(r)?n:r||pr(e)||n}const Jr=async function(e){const t=this.getOffsetParent||yn,n=this.getDimensions,r=await n(e.floating);return{reference:qr(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Qr(e){return le(e).direction==="rtl"}const Zr={convertOffsetParentRelativeRectToViewportRelativeRect:zr,getDocumentElement:me,getClippingRect:Xr,getOffsetParent:yn,getElementRects:Jr,getClientRects:Vr,getDimensions:Kr,getScale:ke,isElement:J,isRTL:Qr};function wn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function eo(e,t){let n=null,r;const s=me(e);function a(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function l(u,p){u===void 0&&(u=!1),p===void 0&&(p=1),a();const f=e.getBoundingClientRect(),{left:x,top:o,width:c,height:d}=f;if(u||t(),!c||!d)return;const g=He(o),b=He(s.clientWidth-(x+c)),v=He(s.clientHeight-(o+d)),h=He(x),j={rootMargin:-g+"px "+-b+"px "+-v+"px "+-h+"px",threshold:ve(0,Ue(1,p))||1};let S=!0;function E(R){const M=R[0].intersectionRatio;if(M!==p){if(!S)return l();M?l(!1,M):r=setTimeout(()=>{l(!1,1e-7)},1e3)}M===1&&!wn(f,e.getBoundingClientRect())&&l(),S=!1}try{n=new IntersectionObserver(E,{...j,root:s.ownerDocument})}catch{n=new IntersectionObserver(E,j)}n.observe(e)}return l(!0),a}function to(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:p=!1}=r,f=jt(e),x=s||a?[...f?Me(f):[],...Me(t)]:[];x.forEach(h=>{s&&h.addEventListener("scroll",n,{passive:!0}),a&&h.addEventListener("resize",n)});const o=f&&u?eo(f,n):null;let c=-1,d=null;l&&(d=new ResizeObserver(h=>{let[w]=h;w&&w.target===f&&d&&(d.unobserve(t),cancelAnimationFrame(c),c=requestAnimationFrame(()=>{var j;(j=d)==null||j.observe(t)})),n()}),f&&!p&&d.observe(f),d.observe(t));let g,b=p?we(e):null;p&&v();function v(){const h=we(e);b&&!wn(b,h)&&n(),b=h,g=requestAnimationFrame(v)}return n(),()=>{var h;x.forEach(w=>{s&&w.removeEventListener("scroll",n),a&&w.removeEventListener("resize",n)}),o?.(),(h=d)==null||h.disconnect(),d=null,p&&cancelAnimationFrame(g)}}const no=Lr,ro=$r,oo=Pr,so=(e,t,n)=>{const r=new Map,s={platform:Zr,...n},a={...s.platform,_c:r};return _r(e,t,{...s,platform:a})};var ao=typeof document<"u",io=function(){},We=ao?m.useLayoutEffect:io;function qe(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!qe(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(!(a==="_owner"&&e.$$typeof)&&!qe(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function En(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Wt(e,t){const n=En(e);return Math.round(t*n)/n}function dt(e){const t=k.useRef(e);return We(()=>{t.current=e}),t}function lo(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:a,floating:l}={},transform:u=!0,whileElementsMounted:p,open:f}=e,[x,o]=k.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[c,d]=k.useState(r);qe(c,r)||d(r);const[g,b]=k.useState(null),[v,h]=k.useState(null),w=k.useCallback(P=>{P!==R.current&&(R.current=P,b(P))},[]),j=k.useCallback(P=>{P!==M.current&&(M.current=P,h(P))},[]),S=a||g,E=l||v,R=k.useRef(null),M=k.useRef(null),_=k.useRef(x),I=p!=null,B=dt(p),Z=dt(s),Q=dt(f),Y=k.useCallback(()=>{if(!R.current||!M.current)return;const P={placement:t,strategy:n,middleware:c};Z.current&&(P.platform=Z.current),so(R.current,M.current,P).then(V=>{const H={...V,isPositioned:Q.current!==!1};W.current&&!qe(_.current,H)&&(_.current=H,Bn.flushSync(()=>{o(H)}))})},[c,t,n,Z,Q]);We(()=>{f===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,o(P=>({...P,isPositioned:!1})))},[f]);const W=k.useRef(!1);We(()=>(W.current=!0,()=>{W.current=!1}),[]),We(()=>{if(S&&(R.current=S),E&&(M.current=E),S&&E){if(B.current)return B.current(S,E,Y);Y()}},[S,E,Y,B,I]);const X=k.useMemo(()=>({reference:R,floating:M,setReference:w,setFloating:j}),[w,j]),T=k.useMemo(()=>({reference:S,floating:E}),[S,E]),L=k.useMemo(()=>{const P={position:n,left:0,top:0};if(!T.floating)return P;const V=Wt(T.floating,x.x),H=Wt(T.floating,x.y);return u?{...P,transform:"translate("+V+"px, "+H+"px)",...En(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:H}},[n,u,T.floating,x.x,x.y]);return k.useMemo(()=>({...x,update:Y,refs:X,elements:T,floatingStyles:L}),[x,Y,X,T,L])}const co=(e,t)=>({...no(e),options:[e,t]}),uo=(e,t)=>({...ro(e),options:[e,t]}),fo=(e,t)=>({...oo(e),options:[e,t]}),mo={...k};let Ut=!1,po=0;const Gt=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+po++;function ho(){const[e,t]=k.useState(()=>Ut?Gt():void 0);return pt(()=>{e==null&&t(Gt())},[]),k.useEffect(()=>{Ut=!0},[]),e}const go=mo.useId,xo=go||ho;let ht;process.env.NODE_ENV!=="production"&&(ht=new Set);function bo(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const s="Floating UI: "+n.join(" ");if(!((e=ht)!=null&&e.has(s))){var a;(a=ht)==null||a.add(s),console.error(s)}}function vo(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(s=>s(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const yo=k.createContext(null),wo=k.createContext(null),Eo=()=>{var e;return((e=k.useContext(yo))==null?void 0:e.id)||null},jo=()=>k.useContext(wo);function No(e){const{open:t=!1,onOpenChange:n,elements:r}=e,s=xo(),a=k.useRef({}),[l]=k.useState(()=>vo()),u=Eo()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!J(d)&&bo("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[p,f]=k.useState(r.reference),x=Dr((d,g,b)=>{a.current.openEvent=d?g:void 0,l.emit("openchange",{open:d,event:g,reason:b,nested:u}),n?.(d,g,b)}),o=k.useMemo(()=>({setPositionReference:f}),[]),c=k.useMemo(()=>({reference:p||r.reference||null,floating:r.floating||null,domReference:r.reference}),[p,r.reference,r.floating]);return k.useMemo(()=>({dataRef:a,open:t,onOpenChange:x,elements:c,events:l,floatingId:s,refs:o}),[t,x,c,l,s,o])}function Co(e){e===void 0&&(e={});const{nodeId:t}=e,n=No({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,s=r.elements,[a,l]=k.useState(null),[u,p]=k.useState(null),x=s?.domReference||a,o=k.useRef(null),c=jo();pt(()=>{x&&(o.current=x)},[x]);const d=lo({...e,elements:{...s,...u&&{reference:u}}}),g=k.useCallback(j=>{const S=J(j)?{getBoundingClientRect:()=>j.getBoundingClientRect(),getClientRects:()=>j.getClientRects(),contextElement:j}:j;p(S),d.refs.setReference(S)},[d.refs]),b=k.useCallback(j=>{(J(j)||j===null)&&(o.current=j,l(j)),(J(d.refs.reference.current)||d.refs.reference.current===null||j!==null&&!J(j))&&d.refs.setReference(j)},[d.refs]),v=k.useMemo(()=>({...d.refs,setReference:b,setPositionReference:g,domReference:o}),[d.refs,b,g]),h=k.useMemo(()=>({...d.elements,domReference:x}),[d.elements,x]),w=k.useMemo(()=>({...d,...r,refs:v,elements:h,nodeId:t}),[d,v,h,t,r]);return pt(()=>{r.dataRef.current.floatingContext=w;const j=c?.nodesRef.current.find(S=>S.id===t);j&&(j.context=w)}),k.useMemo(()=>({...d,context:w,refs:v,elements:h}),[d,v,h,w])}function st({trigger:e,content:t,onHover:n=!1,className:r,placement:s="bottom",open:a,onOpenChange:l,fullWidth:u=!1}){const[p,f]=m.useState(!1),x=a??p,o=l??f,c=m.useRef(null),{refs:d,floatingStyles:g,update:b}=Co({placement:s,middleware:[co(8),fo(),uo()],whileElementsMounted:to,open:x,onOpenChange:o}),v=()=>{c.current&&window.clearTimeout(c.current),o(!0)},h=()=>{c.current=window.setTimeout(()=>o(!1),100)};m.useEffect(()=>{if(!n&&x){const j=S=>{d.reference.current instanceof Node&&d.floating.current instanceof Node&&!d.reference.current.contains(S.target)&&!d.floating.current.contains(S.target)&&o(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)}},[x,n,d,o]);const w=n?{onMouseEnter:v,onMouseLeave:h}:{onClick:()=>{o(!x),b()}};return i.jsxs("div",{className:C("relative",u?"w-full":"inline-block"),children:[i.jsx("div",{ref:d.setReference,className:C("cursor-pointer",u?"w-full":"inline-block"),...w,children:e}),i.jsx("div",{ref:d.setFloating,style:g,className:C("z-10 w-64 rounded-lg bg-surface border border-outline p-2 shadow-lg transition-all transform duration-200 ease-out",x?"opacity-100 scale-100 pointer-events-auto":"opacity-0 scale-95 pointer-events-none",r),onMouseEnter:n?v:void 0,onMouseLeave:n?h:void 0,children:t})]})}const at=m.forwardRef(({children:e,onSelect:t,isActive:n},r)=>i.jsx("li",{ref:r,onClick:t,className:C("flex items-center gap-2 p-2 rounded-lg cursor-pointer",{"bg-primary-container text-on-primary-container":n,"hover:bg-hover":!n}),children:e}));function Ro({options:e=[],value:t,onChange:n,multiple:r=!1,placeholder:s="Select...",className:a,disabled:l=!1,withSearch:u=!1}){const[p,f]=m.useState(!1),[x,o]=m.useState(0),c=m.useRef([]),[d,g]=m.useState(""),b=m.useRef(null),v=m.useCallback(E=>{if(r&&Array.isArray(t)){const R=t.includes(E)?t.filter(M=>M!==E):[...t,E];n(R)}else n(E),f(!1)},[r,t,n,f]),h=e.filter(E=>E.label.toLowerCase().includes(d.toLowerCase()));m.useEffect(()=>{if(p){const E=R=>{R.key==="ArrowDown"?(R.preventDefault(),o(M=>(M+1)%h.length)):R.key==="ArrowUp"?(R.preventDefault(),o(M=>(M-1+h.length)%h.length)):R.key==="Enter"?(R.preventDefault(),h[x]&&v(h[x].value)):R.key==="Escape"&&f(!1)};return document.addEventListener("keydown",E),()=>{document.removeEventListener("keydown",E)}}},[p,h,x,v]),m.useEffect(()=>{p&&c.current[x]&&c.current[x]?.scrollIntoView({block:"nearest"})},[p,x]),m.useEffect(()=>{if(p){const E=e.findIndex(R=>!r&&R.value===t);o(E!==-1?E:0),g(""),u&&setTimeout(()=>b.current?.focus(),0)}},[p,u,e,t,r]);const w=E=>e.find(R=>R.value===E)?.label||String(E),j=()=>r&&Array.isArray(t)&&t.length>0?i.jsx("div",{className:"h-fit flex flex-wrap gap-1",children:t&&t.map(E=>i.jsx(vt,{variant:"input",onDelete:R=>{R.preventDefault(),R.stopPropagation(),v(E)},label:w(E)},String(E)))}):!r&&t!==void 0&&!Array.isArray(t)?w(t):i.jsx("span",{className:"text-on-surface-variant",children:s}),S=i.jsxs("div",{className:"flex flex-col",children:[u&&i.jsx(Qe,{ref:b,placeholder:"Search...",value:d,onChange:E=>g(E.target.value)}),i.jsx("ul",{className:"py-1 max-h-60 overflow-auto",children:h&&h.map((E,R)=>i.jsx(at,{ref:M=>{c.current[R]=M},isActive:x===R,onSelect:()=>v(E.value),children:r&&Array.isArray(t)?i.jsx(sn,{checked:t.includes(E.value),onChange:()=>v(E.value),label:E.label}):i.jsxs("div",{className:"flex items-center justify-between w-full",children:[i.jsx("span",{children:E.label}),t===E.value&&i.jsx(se.Check,{className:"h-4 w-4"})]})},String(E.value)))})]});return i.jsx(st,{fullWidth:!0,open:p,onOpenChange:f,className:C("w-full",a),placement:"bottom-start",trigger:i.jsxs("div",{className:C("flex items-center justify-between w-full rounded-lg transition duration-150 border border-outline-variant outline-none focus-visible:ring-primary/50 focus-visible:ring-[3px] px-1 py-1 min-h-10",l?"opacity-50 pointer-events-none":"cursor-pointer"),children:[i.jsx("div",{className:"grow w-full",children:j()}),i.jsx(se.ChevronDown,{className:C("w-5 h-5 text-on-surface-variant transition-transform duration-200",p&&"rotate-180")})]}),content:S})}function jn({isOpen:e,onClose:t,side:n="right",children:r,title:s,description:a,className:l}){const[u,p]=k.useState(e),[f,x]=k.useState(n);k.useEffect(()=>{e&&(p(!0),x(n))},[e,n]),k.useEffect(()=>{const d=g=>{g.key==="Escape"&&e&&t()};return e&&document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}},[e,t]);const o=d=>{!e&&d.animationName.toLowerCase().includes("sheetout")&&p(!1)};if(!u)return null;const c={top:"top-[1rem] inset-x-[1rem] border-b border-outline-variant animate-sheet-in-top data-[state=closed]:animate-sheet-out-top h-auto max-h-[80%]",bottom:"bottom-[1rem] inset-x-[1rem] border-t border-outline-variant animate-sheet-in-bottom data-[state=closed]:animate-sheet-out-bottom h-auto max-h-[80%]",left:"left-[1rem] inset-y-[1rem] border-r border-outline-variant animate-sheet-in-left data-[state=closed]:animate-sheet-out-left w-full sm:max-w-sm ml-0",right:"right-[1rem] inset-y-[1rem] border-l border-outline-variant animate-sheet-in-right data-[state=closed]:animate-sheet-out-right w-full sm:max-w-sm mr-0"};return Pe.createPortal(i.jsxs("div",{className:"fixed inset-0 z-50 overflow-hidden",children:[i.jsx("div",{className:C("absolute inset-0 bg-black/40 transition-opacity",e?"animate-overlay-in":"animate-overlay-out"),onClick:t,"aria-hidden":"true"}),i.jsx("div",{role:"dialog","aria-modal":"true","data-state":e?"open":"closed",onAnimationEnd:o,className:C("rounded-[1rem] absolute bg-surface p-6 shadow-2xl transition ease-in-out focus:outline-none",c[f],l),children:i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{className:"grow",children:[s&&i.jsx("h2",{className:"text-lg font-semibold text-on-surface leading-none mb-1",children:s}),a&&i.jsx("p",{className:"text-sm text-on-surface-variant font-normal",children:a})]}),i.jsx(Ie,{onClick:t,variant:"ghost",size:"icon","aria-label":"Close",children:i.jsx(se.X,{className:"h-5 w-5"})})]}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:r})]})})]}),document.body)}function So({children:e,className:t}){return i.jsx("div",{className:C("flex flex-col space-y-2 mb-4",t),children:e})}function ko({children:e,className:t}){return i.jsx("div",{className:C("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 mt-4",t),children:e})}function To({children:e,className:t}){return i.jsx("h2",{className:C("text-lg font-semibold text-on-surface",t),children:e})}function Ao({children:e,className:t}){return i.jsx("p",{className:C("text-sm text-on-surface-variant",t),children:e})}function Oo({delay:e=0,className:t,...n}){const r=Math.floor(Math.random()*e);return i.jsx("div",{className:C("bg-primary animate-pulse rounded-lg",t),style:{animationDelay:`${r}ms`},...n})}function Do({className:e,...t}){return i.jsx(se.Loader2Icon,{role:"status","aria-label":"Loading",className:C("size-4 animate-spin",e),...t})}function _o({variant:e="online",text:t,ping:n=!1}){const r="flex flex-row gap-1 text-on-surface inline-flex items-center justify-center rounded-lg border border-outline-variant px-2 py-1 text-sm text-on-surface font-medium",s={online:"bg-green-500",offline:"bg-red-500",maintenance:"bg-blue-500",degraded:"bg-orange-500"};return i.jsx(i.Fragment,{children:t?i.jsxs("div",{className:C(r),children:[i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:C(s[e],"size-2 rounded-full")}),n&&i.jsx("div",{className:C(s[e],"size-2 rounded-full absolute left-0 top-0 animate-ping")})]}),i.jsx("span",{children:t})]}):i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:C(s[e],"size-2 rounded-full")}),n&&i.jsx("div",{className:C(s[e],"size-2 rounded-full absolute left-0 top-0 animate-ping")})]})})}const Po=({tags:e,setTags:t,placeholder:n,suggestions:r=[]})=>{const[s,a]=m.useState(""),[l,u]=m.useState(!1),[p,f]=m.useState(0),x=m.useRef([]),o=h=>{a(h.target.value),h.target.value&&r.length>0?u(!0):u(!1)},c=h=>{h.key==="Enter"?(h.preventDefault(),b.length>0&&p>=0?g(b[p]):s.trim()!==""&&g(s.trim())):h.key==="Backspace"&&s===""&&e.length>0?t(e.slice(0,-1)):h.key==="ArrowDown"?(h.preventDefault(),f(w=>(w+1)%b.length)):h.key==="ArrowUp"&&(h.preventDefault(),f(w=>(w-1+b.length)%b.length))},d=h=>{t(e.filter(w=>w!==h))},g=h=>{t([...e,h]),a(""),u(!1),f(0)},b=m.useMemo(()=>r.filter(h=>h.toLowerCase().includes(s.toLowerCase())&&!e.includes(h)),[s,r,e]);m.useEffect(()=>{l&&x.current[p]&&x.current[p]?.scrollIntoView({block:"nearest"})},[l,p]);const v=i.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:b.map((h,w)=>i.jsx(at,{ref:j=>{x.current[w]=j},isActive:p===w,onSelect:()=>g(h),children:h},h))});return i.jsx(st,{open:l&&b.length>0,onOpenChange:u,className:"max-h-96 overflow-y-auto",trigger:i.jsxs("div",{className:"px-1 flex flex-wrap items-center gap-1 rounded-lg transition duration-150 disabled:opacity-50 disabled:pointer-events-none border border-outline-variant outline-none focus-visible:ring-primary/50 focus-visible:ring-[3px]",children:[i.jsx("div",{className:"h-fit flex flex-wrap gap-1",children:e.map(h=>i.jsx(vt,{variant:"input",onDelete:w=>{w.preventDefault(),w.stopPropagation(),d(h)},label:h},h))}),i.jsx(Qe,{type:"text",variant:"ghost",value:s,onChange:o,onKeyDown:c,placeholder:n||"Add a tag",style:{border:"none",outline:"none",flex:1,minWidth:"100px"}})]}),content:v})},Io=m.forwardRef(({label:e,className:t,variant:n="default",...r},s)=>{const a="w-full rounded-lg transition duration-150 disabled:opacity-50 disabled:pointer-events-none",l="p-3 text-base",u={default:"border border-outline-variant outline-none focus-visible:ring-primary/50 focus-visible:ring-[3px]",ghost:"border-none outline-none focus-visible:ring-0"};return i.jsxs("div",{children:[e&&i.jsx("label",{htmlFor:r.id,className:"block text-sm font-medium text-on-surface",children:e}),i.jsx("textarea",{ref:s,className:C(a,l,u[n],t),...r})]})});function Mo(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const Lo=e=>{switch(e){case"success":return Fo;case"info":return Vo;case"warning":return zo;case"error":return Ho;default:return null}},$o=Array(12).fill(0),Bo=({visible:e,className:t})=>m.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},m.createElement("div",{className:"sonner-spinner"},$o.map((n,r)=>m.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Fo=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),zo=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Vo=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Ho=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Yo=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},m.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Wo=()=>{const[e,t]=m.useState(document.hidden);return m.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let gt=1;class Uo{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...s}=t,a=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:gt++,l=this.toasts.find(p=>p.id===a),u=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),l?this.toasts=this.toasts.map(p=>p.id===a?(this.publish({...p,...t,id:a,title:r}),{...p,...t,id:a,dismissible:u,title:r}):p):this.addToast({title:r,...s,dismissible:u,id:a}),a},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let a=r!==void 0,l;const u=s.then(async f=>{if(l=["resolve",f],m.isValidElement(f))a=!1,this.create({id:r,type:"default",message:f});else if(Xo(f)&&!f.ok){a=!1;const o=typeof n.error=="function"?await n.error(`HTTP error! status: ${f.status}`):n.error,c=typeof n.description=="function"?await n.description(`HTTP error! status: ${f.status}`):n.description,g=typeof o=="object"&&!m.isValidElement(o)?o:{message:o};this.create({id:r,type:"error",description:c,...g})}else if(f instanceof Error){a=!1;const o=typeof n.error=="function"?await n.error(f):n.error,c=typeof n.description=="function"?await n.description(f):n.description,g=typeof o=="object"&&!m.isValidElement(o)?o:{message:o};this.create({id:r,type:"error",description:c,...g})}else if(n.success!==void 0){a=!1;const o=typeof n.success=="function"?await n.success(f):n.success,c=typeof n.description=="function"?await n.description(f):n.description,g=typeof o=="object"&&!m.isValidElement(o)?o:{message:o};this.create({id:r,type:"success",description:c,...g})}}).catch(async f=>{if(l=["reject",f],n.error!==void 0){a=!1;const x=typeof n.error=="function"?await n.error(f):n.error,o=typeof n.description=="function"?await n.description(f):n.description,d=typeof x=="object"&&!m.isValidElement(x)?x:{message:x};this.create({id:r,type:"error",description:o,...d})}}).finally(()=>{a&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),p=()=>new Promise((f,x)=>u.then(()=>l[0]==="reject"?x(l[1]):f(l[1])).catch(x));return typeof r!="string"&&typeof r!="number"?{unwrap:p}:Object.assign(r,{unwrap:p})},this.custom=(t,n)=>{const r=n?.id||gt++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const ee=new Uo,Go=(e,t)=>{const n=t?.id||gt++;return ee.addToast({title:e,...t,id:n}),n},Xo=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Ko=Go,qo=()=>ee.toasts,Jo=()=>ee.getActiveToasts(),Qo=Object.assign(Ko,{success:ee.success,info:ee.info,warning:ee.warning,error:ee.error,custom:ee.custom,message:ee.message,promise:ee.promise,dismiss:ee.dismiss,loading:ee.loading},{getHistory:qo,getToasts:Jo});Mo("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Ye(e){return e.label!==void 0}const Zo=3,es="24px",ts="16px",Xt=4e3,ns=356,rs=14,os=45,ss=200;function ue(...e){return e.filter(Boolean).join(" ")}function as(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const is=e=>{var t,n,r,s,a,l,u,p,f;const{invert:x,toast:o,unstyled:c,interacting:d,setHeights:g,visibleToasts:b,heights:v,index:h,toasts:w,expanded:j,removeToast:S,defaultRichColors:E,closeButton:R,style:M,cancelButtonStyle:_,actionButtonStyle:I,className:B="",descriptionClassName:Z="",duration:Q,position:Y,gap:W,expandByDefault:X,classNames:T,icons:L,closeButtonAriaLabel:P="Close toast"}=e,[V,H]=m.useState(null),[y,A]=m.useState(null),[N,O]=m.useState(!1),[F,K]=m.useState(!1),[z,$]=m.useState(!1),[ce,Ee]=m.useState(!1),[$e,je]=m.useState(!1),[Rn,it]=m.useState(0),[Sn,Nt]=m.useState(0),Oe=m.useRef(o.duration||Q||Xt),Ct=m.useRef(null),pe=m.useRef(null),kn=h===0,Tn=h+1<=b,te=o.type,Ne=o.dismissible!==!1,An=o.className||"",On=o.descriptionClassName||"",Be=m.useMemo(()=>v.findIndex(D=>D.toastId===o.id)||0,[v,o.id]),Dn=m.useMemo(()=>{var D;return(D=o.closeButton)!=null?D:R},[o.closeButton,R]),Rt=m.useMemo(()=>o.duration||Q||Xt,[o.duration,Q]),lt=m.useRef(0),Ce=m.useRef(0),St=m.useRef(0),Re=m.useRef(null),[_n,Pn]=Y.split("-"),kt=m.useMemo(()=>v.reduce((D,U,q)=>q>=Be?D:D+U.height,0),[v,Be]),Tt=Wo(),In=o.invert||x,ct=te==="loading";Ce.current=m.useMemo(()=>Be*W+kt,[Be,kt]),m.useEffect(()=>{Oe.current=Rt},[Rt]),m.useEffect(()=>{O(!0)},[]),m.useEffect(()=>{const D=pe.current;if(D){const U=D.getBoundingClientRect().height;return Nt(U),g(q=>[{toastId:o.id,height:U,position:o.position},...q]),()=>g(q=>q.filter(ne=>ne.toastId!==o.id))}},[g,o.id]),m.useLayoutEffect(()=>{if(!N)return;const D=pe.current,U=D.style.height;D.style.height="auto";const q=D.getBoundingClientRect().height;D.style.height=U,Nt(q),g(ne=>ne.find(G=>G.toastId===o.id)?ne.map(G=>G.toastId===o.id?{...G,height:q}:G):[{toastId:o.id,height:q,position:o.position},...ne])},[N,o.title,o.description,g,o.id,o.jsx,o.action,o.cancel]);const he=m.useCallback(()=>{K(!0),it(Ce.current),g(D=>D.filter(U=>U.toastId!==o.id)),setTimeout(()=>{S(o)},ss)},[o,S,g,Ce]);m.useEffect(()=>{if(o.promise&&te==="loading"||o.duration===1/0||o.type==="loading")return;let D;return j||d||Tt?(()=>{if(St.current<lt.current){const ne=new Date().getTime()-lt.current;Oe.current=Oe.current-ne}St.current=new Date().getTime()})():Oe.current!==1/0&&(lt.current=new Date().getTime(),D=setTimeout(()=>{o.onAutoClose==null||o.onAutoClose.call(o,o),he()},Oe.current)),()=>clearTimeout(D)},[j,d,o,te,Tt,he]),m.useEffect(()=>{o.delete&&(he(),o.onDismiss==null||o.onDismiss.call(o,o))},[he,o.delete]);function Mn(){var D;if(L?.loading){var U;return m.createElement("div",{className:ue(T?.loader,o==null||(U=o.classNames)==null?void 0:U.loader,"sonner-loader"),"data-visible":te==="loading"},L.loading)}return m.createElement(Bo,{className:ue(T?.loader,o==null||(D=o.classNames)==null?void 0:D.loader),visible:te==="loading"})}const Ln=o.icon||L?.[te]||Lo(te);var At,Ot;return m.createElement("li",{tabIndex:0,ref:pe,className:ue(B,An,T?.toast,o==null||(t=o.classNames)==null?void 0:t.toast,T?.default,T?.[te],o==null||(n=o.classNames)==null?void 0:n[te]),"data-sonner-toast":"","data-rich-colors":(At=o.richColors)!=null?At:E,"data-styled":!(o.jsx||o.unstyled||c),"data-mounted":N,"data-promise":!!o.promise,"data-swiped":$e,"data-removed":F,"data-visible":Tn,"data-y-position":_n,"data-x-position":Pn,"data-index":h,"data-front":kn,"data-swiping":z,"data-dismissible":Ne,"data-type":te,"data-invert":In,"data-swipe-out":ce,"data-swipe-direction":y,"data-expanded":!!(j||X&&N),"data-testid":o.testId,style:{"--index":h,"--toasts-before":h,"--z-index":w.length-h,"--offset":`${F?Rn:Ce.current}px`,"--initial-height":X?"auto":`${Sn}px`,...M,...o.style},onDragEnd:()=>{$(!1),H(null),Re.current=null},onPointerDown:D=>{D.button!==2&&(ct||!Ne||(Ct.current=new Date,it(Ce.current),D.target.setPointerCapture(D.pointerId),D.target.tagName!=="BUTTON"&&($(!0),Re.current={x:D.clientX,y:D.clientY})))},onPointerUp:()=>{var D,U,q;if(ce||!Ne)return;Re.current=null;const ne=Number(((D=pe.current)==null?void 0:D.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Fe=Number(((U=pe.current)==null?void 0:U.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),G=new Date().getTime()-((q=Ct.current)==null?void 0:q.getTime()),oe=V==="x"?ne:Fe,ze=Math.abs(oe)/G;if(Math.abs(oe)>=os||ze>.11){it(Ce.current),o.onDismiss==null||o.onDismiss.call(o,o),A(V==="x"?ne>0?"right":"left":Fe>0?"down":"up"),he(),Ee(!0);return}else{var ae,ie;(ae=pe.current)==null||ae.style.setProperty("--swipe-amount-x","0px"),(ie=pe.current)==null||ie.style.setProperty("--swipe-amount-y","0px")}je(!1),$(!1),H(null)},onPointerMove:D=>{var U,q,ne;if(!Re.current||!Ne||((U=window.getSelection())==null?void 0:U.toString().length)>0)return;const G=D.clientY-Re.current.y,oe=D.clientX-Re.current.x;var ze;const ae=(ze=e.swipeDirections)!=null?ze:as(Y);!V&&(Math.abs(oe)>1||Math.abs(G)>1)&&H(Math.abs(oe)>Math.abs(G)?"x":"y");let ie={x:0,y:0};const Dt=be=>1/(1.5+Math.abs(be)/20);if(V==="y"){if(ae.includes("top")||ae.includes("bottom"))if(ae.includes("top")&&G<0||ae.includes("bottom")&&G>0)ie.y=G;else{const be=G*Dt(G);ie.y=Math.abs(be)<Math.abs(G)?be:G}}else if(V==="x"&&(ae.includes("left")||ae.includes("right")))if(ae.includes("left")&&oe<0||ae.includes("right")&&oe>0)ie.x=oe;else{const be=oe*Dt(oe);ie.x=Math.abs(be)<Math.abs(oe)?be:oe}(Math.abs(ie.x)>0||Math.abs(ie.y)>0)&&je(!0),(q=pe.current)==null||q.style.setProperty("--swipe-amount-x",`${ie.x}px`),(ne=pe.current)==null||ne.style.setProperty("--swipe-amount-y",`${ie.y}px`)}},Dn&&!o.jsx&&te!=="loading"?m.createElement("button",{"aria-label":P,"data-disabled":ct,"data-close-button":!0,onClick:ct||!Ne?()=>{}:()=>{he(),o.onDismiss==null||o.onDismiss.call(o,o)},className:ue(T?.closeButton,o==null||(r=o.classNames)==null?void 0:r.closeButton)},(Ot=L?.close)!=null?Ot:Yo):null,(te||o.icon||o.promise)&&o.icon!==null&&(L?.[te]!==null||o.icon)?m.createElement("div",{"data-icon":"",className:ue(T?.icon,o==null||(s=o.classNames)==null?void 0:s.icon)},o.promise||o.type==="loading"&&!o.icon?o.icon||Mn():null,o.type!=="loading"?Ln:null):null,m.createElement("div",{"data-content":"",className:ue(T?.content,o==null||(a=o.classNames)==null?void 0:a.content)},m.createElement("div",{"data-title":"",className:ue(T?.title,o==null||(l=o.classNames)==null?void 0:l.title)},o.jsx?o.jsx:typeof o.title=="function"?o.title():o.title),o.description?m.createElement("div",{"data-description":"",className:ue(Z,On,T?.description,o==null||(u=o.classNames)==null?void 0:u.description)},typeof o.description=="function"?o.description():o.description):null),m.isValidElement(o.cancel)?o.cancel:o.cancel&&Ye(o.cancel)?m.createElement("button",{"data-button":!0,"data-cancel":!0,style:o.cancelButtonStyle||_,onClick:D=>{Ye(o.cancel)&&Ne&&(o.cancel.onClick==null||o.cancel.onClick.call(o.cancel,D),he())},className:ue(T?.cancelButton,o==null||(p=o.classNames)==null?void 0:p.cancelButton)},o.cancel.label):null,m.isValidElement(o.action)?o.action:o.action&&Ye(o.action)?m.createElement("button",{"data-button":!0,"data-action":!0,style:o.actionButtonStyle||I,onClick:D=>{Ye(o.action)&&(o.action.onClick==null||o.action.onClick.call(o.action,D),!D.defaultPrevented&&he())},className:ue(T?.actionButton,o==null||(f=o.classNames)==null?void 0:f.actionButton)},o.action.label):null)};function Kt(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function ls(e,t){const n={};return[e,t].forEach((r,s)=>{const a=s===1,l=a?"--mobile-offset":"--offset",u=a?ts:es;function p(f){["top","right","bottom","left"].forEach(x=>{n[`${l}-${x}`]=typeof f=="number"?`${f}px`:f})}typeof r=="number"||typeof r=="string"?p(r):typeof r=="object"?["top","right","bottom","left"].forEach(f=>{r[f]===void 0?n[`${l}-${f}`]=u:n[`${l}-${f}`]=typeof r[f]=="number"?`${r[f]}px`:r[f]}):p(u)}),n}const cs=m.forwardRef(function(t,n){const{id:r,invert:s,position:a="bottom-right",hotkey:l=["altKey","KeyT"],expand:u,closeButton:p,className:f,offset:x,mobileOffset:o,theme:c="light",richColors:d,duration:g,style:b,visibleToasts:v=Zo,toastOptions:h,dir:w=Kt(),gap:j=rs,icons:S,containerAriaLabel:E="Notifications"}=t,[R,M]=m.useState([]),_=m.useMemo(()=>r?R.filter(N=>N.toasterId===r):R.filter(N=>!N.toasterId),[R,r]),I=m.useMemo(()=>Array.from(new Set([a].concat(_.filter(N=>N.position).map(N=>N.position)))),[_,a]),[B,Z]=m.useState([]),[Q,Y]=m.useState(!1),[W,X]=m.useState(!1),[T,L]=m.useState(c!=="system"?c:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),P=m.useRef(null),V=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),H=m.useRef(null),y=m.useRef(!1),A=m.useCallback(N=>{M(O=>{var F;return(F=O.find(K=>K.id===N.id))!=null&&F.delete||ee.dismiss(N.id),O.filter(({id:K})=>K!==N.id)})},[]);return m.useEffect(()=>ee.subscribe(N=>{if(N.dismiss){requestAnimationFrame(()=>{M(O=>O.map(F=>F.id===N.id?{...F,delete:!0}:F))});return}setTimeout(()=>{Pe.flushSync(()=>{M(O=>{const F=O.findIndex(K=>K.id===N.id);return F!==-1?[...O.slice(0,F),{...O[F],...N},...O.slice(F+1)]:[N,...O]})})})}),[R]),m.useEffect(()=>{if(c!=="system"){L(c);return}if(c==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?L("dark"):L("light")),typeof window>"u")return;const N=window.matchMedia("(prefers-color-scheme: dark)");try{N.addEventListener("change",({matches:O})=>{L(O?"dark":"light")})}catch{N.addListener(({matches:F})=>{try{L(F?"dark":"light")}catch(K){console.error(K)}})}},[c]),m.useEffect(()=>{R.length<=1&&Y(!1)},[R]),m.useEffect(()=>{const N=O=>{var F;if(l.every($=>O[$]||O.code===$)){var z;Y(!0),(z=P.current)==null||z.focus()}O.code==="Escape"&&(document.activeElement===P.current||(F=P.current)!=null&&F.contains(document.activeElement))&&Y(!1)};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l]),m.useEffect(()=>{if(P.current)return()=>{H.current&&(H.current.focus({preventScroll:!0}),H.current=null,y.current=!1)}},[P.current]),m.createElement("section",{ref:n,"aria-label":`${E} ${V}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},I.map((N,O)=>{var F;const[K,z]=N.split("-");return _.length?m.createElement("ol",{key:N,dir:w==="auto"?Kt():w,tabIndex:-1,ref:P,className:f,"data-sonner-toaster":!0,"data-sonner-theme":T,"data-y-position":K,"data-x-position":z,style:{"--front-toast-height":`${((F=B[0])==null?void 0:F.height)||0}px`,"--width":`${ns}px`,"--gap":`${j}px`,...b,...ls(x,o)},onBlur:$=>{y.current&&!$.currentTarget.contains($.relatedTarget)&&(y.current=!1,H.current&&(H.current.focus({preventScroll:!0}),H.current=null))},onFocus:$=>{$.target instanceof HTMLElement&&$.target.dataset.dismissible==="false"||y.current||(y.current=!0,H.current=$.relatedTarget)},onMouseEnter:()=>Y(!0),onMouseMove:()=>Y(!0),onMouseLeave:()=>{W||Y(!1)},onDragEnd:()=>Y(!1),onPointerDown:$=>{$.target instanceof HTMLElement&&$.target.dataset.dismissible==="false"||X(!0)},onPointerUp:()=>X(!1)},_.filter($=>!$.position&&O===0||$.position===N).map(($,ce)=>{var Ee,$e;return m.createElement(is,{key:$.id,icons:S,index:ce,toast:$,defaultRichColors:d,duration:(Ee=h?.duration)!=null?Ee:g,className:h?.className,descriptionClassName:h?.descriptionClassName,invert:s,visibleToasts:v,closeButton:($e=h?.closeButton)!=null?$e:p,interacting:W,position:N,style:h?.style,unstyled:h?.unstyled,classNames:h?.classNames,cancelButtonStyle:h?.cancelButtonStyle,actionButtonStyle:h?.actionButtonStyle,closeButtonAriaLabel:h?.closeButtonAriaLabel,removeToast:A,toasts:_.filter(je=>je.position==$.position),heights:B.filter(je=>je.position==$.position),setHeights:Z,expandByDefault:u,gap:j,expanded:Q,swipeDirections:t.swipeDirections})})):null}))});function us(){return i.jsx(cs,{richColors:!0,position:"bottom-right"})}function ds({children:e,content:t,className:n,placement:r="bottom"}){return i.jsx(st,{trigger:e,content:t,onHover:!0,placement:r,className:C("px-2 py-1 text-sm pointer-events-none",n)})}function fs({groups:e,items:t,open:n,onOpenChange:r}){const[s,a]=m.useState(!1),l=n!==void 0?n:s,u=r!==void 0?r:a,[p,f]=m.useState(!1),[x,o]=m.useState(!1),[c,d]=m.useState(""),[g,b]=m.useState(0),v=m.useRef([]),h=m.useRef(null),w=m.useMemo(()=>e||(t?[{id:"default",heading:"",items:t}]:[]),[e,t]),j=m.useMemo(()=>c?w.map(_=>({..._,items:_.items.filter(I=>I.title.toLowerCase().includes(c.toLowerCase()))})).filter(_=>_.items.length>0):w,[c,w]),S=m.useMemo(()=>j.flatMap(_=>_.items),[j]),E=m.useCallback(()=>{o(!1),setTimeout(()=>{u(!1),f(!1)},200)},[u]),R=m.useCallback(_=>{_.onSelect(),E()},[E]);if(m.useEffect(()=>{const _=I=>{if(I.key==="k"&&(I.metaKey||I.ctrlKey)&&(I.preventDefault(),l?E():u(!0)),l){if(I.key==="Escape")E();else if(I.key==="ArrowDown")I.preventDefault(),b(B=>(B+1)%S.length);else if(I.key==="ArrowUp")I.preventDefault(),b(B=>(B-1+S.length)%S.length);else if(I.key==="Enter"){I.preventDefault();const B=S[g];B&&R(B)}}};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[l,g,S,E,R,u]),m.useEffect(()=>{l&&f(!0)},[l]),m.useEffect(()=>{p&&(requestAnimationFrame(()=>{o(!0),h.current?.focus()}),b(0),d(""))},[p]),m.useEffect(()=>{b(0)},[c]),m.useEffect(()=>(p?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[p]),m.useEffect(()=>{p&&v.current[g]&&v.current[g]?.scrollIntoView({block:"nearest"})},[p,g]),!p)return null;let M=-1;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:C("fixed inset-0 bg-black/50 bg-opacity-50 backdrop-blur-sm z-40 transition-opacity duration-200",x?"opacity-100":"opacity-0"),onClick:E}),i.jsx("div",{className:"fixed inset-0 flex items-start justify-center z-50 p-4 pt-24",onClick:E,children:i.jsxs("div",{className:C("bg-surface border border-outline rounded-lg shadow-lg max-w-lg w-full relative transition-all duration-200 ease-out",x?"opacity-100 translate-y-0":"opacity-0 translate-y-12"),onClick:_=>_.stopPropagation(),children:[i.jsxs("div",{className:"relative p-4",children:[i.jsx(se.Search,{className:"absolute left-7 top-1/2 -translate-y-1/2 w-4 h-4 text-on-surface/50"}),i.jsx(Qe,{ref:h,placeholder:"Search...",className:"pl-9 w-full",value:c,onChange:_=>d(_.target.value)})]}),i.jsx("div",{className:"p-4 pt-0 max-h-[400px] overflow-y-auto",children:S.length>0?i.jsx("ul",{children:j.map(_=>i.jsxs("li",{children:[_.heading&&i.jsx("p",{className:"text-sm text-on-surface/75 px-2 pb-2 pt-4",children:_.heading}),i.jsx("ul",{children:_.items.map(I=>{M++;const B=M;return i.jsx(at,{ref:Z=>{v.current[B]=Z},isActive:g===B,onSelect:()=>R(I),children:i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx("p",{children:I.title}),I.description&&i.jsx("p",{className:"text-xs opacity-75",children:I.description})]})},I.id)})})]},_.id))}):i.jsx("p",{className:"text-center text-sm text-on-surface/75 py-4",children:"No results found."})})]})})]})}const Nn=m.createContext(null),ms=()=>{const e=m.useContext(Nn);if(!e)throw new Error("useNavigation must be used within a NavHost");return e};class Cn{routes={};screen(t,n,r){this.routes[t]={path:t,component:n,type:"screen",...r}}dialog(t,n,r){this.routes[t]={path:t,component:n,type:"dialog",...r}}bottomSheet(t,n,r){this.routes[t]={path:t,component:n,type:"bottomSheet",...r}}sheet(t,n,r){this.routes[t]={path:t,component:n,type:"sheet",side:r?.side||"right",title:r?.title,description:r?.description,className:r?.className,canActivate:r?.canActivate,canDeactivate:r?.canDeactivate}}list(t,n){this.routes[t]={path:t,type:"list",title:n.title,description:n.description,listOptions:{columns:n.columns,data:n.data},canActivate:n.canActivate,canDeactivate:n.canDeactivate}}}const ps=({startDestination:e,builder:t})=>{const n=m.useMemo(()=>{const c=new Cn;return t(c),c.routes},[t]),r=c=>{const d=window.location.pathname.slice(1);return c[d]?d:null},s=()=>{const c=new URLSearchParams(window.location.search),d={};return c.forEach((g,b)=>{g&&!isNaN(Number(g))&&!g.startsWith("0")?d[b]=Number(g):g==="true"?d[b]=!0:g==="false"?d[b]=!1:d[b]=g}),d},a=(c,d)=>{const g=new URL(window.location.href);g.pathname=`/${c}`,g.search="",d&&Object.entries(d).forEach(([b,v])=>{v!=null&&g.searchParams.set(b,String(v))}),window.location.pathname+window.location.search!==g.pathname+g.search&&window.history.pushState({path:c,params:d},"",g.toString())},[l,u]=m.useState(()=>{const c=r(n)||e,d=s();return[{id:"root",path:c,params:d,config:n[c]}]});m.useEffect(()=>{const c=async()=>{const d=r(n)||e,g=s(),b=l[l.length-1];if((b.path!==d||JSON.stringify(b.params)!==JSON.stringify(g))&&b.config.canDeactivate){for(const v of b.config.canDeactivate)if(!await v(b.params)){a(b.path,b.params);return}}u(v=>{const h=v[v.length-1];if(h.path===d&&JSON.stringify(h.params)===JSON.stringify(g))return v;let w=-1;for(let j=v.length-1;j>=0;j--)if(v[j].path===d&&JSON.stringify(v[j].params)===JSON.stringify(g)){w=j;break}if(w!==-1){if(w===v.length-2){const j=v[v.length-1],S=[...v];return S[v.length-1]={...j,isExiting:!0},setTimeout(()=>{u(E=>E.filter(R=>R.id!==j.id))},350),S}return v.slice(0,w+1)}return[...v,{id:Date.now().toString(),path:d,params:g,config:n[d]}]})};return window.addEventListener("popstate",c),()=>window.removeEventListener("popstate",c)},[n,e,l]);const p=async(c,d)=>{const g=n[c];if(!g){console.warn(`Route ${c} not found`);return}if(g.canActivate){for(const b of g.canActivate)if(!await b(d))return}(g.type==="screen"||g.type==="list")&&a(c,d),u(b=>[...b,{id:Date.now().toString(),path:c,params:d,config:g}])},f=async()=>{const c=l[l.length-1];if(!(!c||c.isExiting||l.length<=1)){if(c.config.canDeactivate){for(const d of c.config.canDeactivate)if(!await d(c.params))return}c.config.type==="screen"||c.config.type==="list"?window.history.back():(u(d=>{const g=[...d],b=g.findIndex(v=>v.id===c.id);return b!==-1&&(g[b]={...g[b],isExiting:!0}),g}),setTimeout(()=>{u(d=>d.filter(g=>g.id!==c.id))},350))}},x=m.useMemo(()=>{let c=0;for(let b=l.length-1;b>=0;b--)if((l[b].config.type==="screen"||l[b].config.type==="list")&&!l[b].isExiting){c=b;break}let d=-1;for(let b=c-1;b>=0;b--)if(l[b].config.type==="screen"||l[b].config.type==="list"){d=b;break}const g=d!==-1?d:c;return l.slice(Math.max(0,g))},[l]),o=c=>c.isExiting?"animate-page-out":c.id===l[0].id?"":"animate-page-in";return i.jsx(Nn.Provider,{value:{navigate:p,popBackStack:f,currentRoute:l[l.length-1].path},children:i.jsx("div",{style:{position:"relative",width:"100%",height:"100vh",overflow:"clip"},children:x.map((c,d)=>{const g=c.config.component;return c.config.type==="list"&&c.config.listOptions?i.jsx("div",{className:`screen-wrapper shadow-2xl ${o(c)}`,style:{position:"absolute",inset:0,background:"var(--color-surface)",overflowY:"auto"},children:i.jsxs("div",{className:"p-8 max-w-7xl mx-auto space-y-6",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-3xl font-bold text-on-surface",children:c.config.title}),c.config.description&&i.jsx("p",{className:"mt-2 text-on-surface-variant",children:c.config.description})]}),i.jsx(cn,{columns:c.config.listOptions.columns,data:c.config.listOptions.data})]})},c.id):g?c.config.type==="screen"?i.jsx("div",{className:`screen-wrapper shadow-2xl ${o(c)}`,style:{position:"absolute",inset:0,background:"var(--color-surface)",overflowY:"auto"},children:i.jsx(g,{...c.params})},c.id):c.config.type==="dialog"?Pe.createPortal(i.jsxs("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:100+d},children:[i.jsx("div",{className:c.isExiting?"animate-overlay-out":"animate-overlay-in",style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"},onClick:f}),i.jsx(on,{className:`max-w-2xl w-full mx-4 shadow-2xl ${c.isExiting?"animate-dialog-out":"animate-dialog-in"}`,children:i.jsx(g,{...c.params})})]},c.id),document.body):c.config.type==="bottomSheet"?Pe.createPortal(i.jsxs("div",{style:{position:"fixed",inset:0,zIndex:100+d},children:[i.jsx("div",{className:c.isExiting?"animate-overlay-out":"animate-overlay-in",style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"},onClick:f}),i.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,background:"var(--color-surface)",padding:20,borderTopLeftRadius:16,borderTopRightRadius:16,boxShadow:"0 -4px 16px rgba(0,0,0,0.1)"},className:c.isExiting?"animate-dialog-out":"animate-dialog-in",children:i.jsx(g,{...c.params})})]},c.id),document.body):c.config.type==="sheet"?i.jsx(jn,{isOpen:!c.isExiting,onClose:f,side:c.config.side,title:c.params?.title||c.config.title,description:c.params?.description||c.config.description,className:d>0?`z-[${d*10+50}] ${c.config.className||""}`:c.config.className,children:i.jsx(g,{...c.params})},c.id):null:null})})})},hs=()=>{const[e,t]=m.useState(null),[n,r]=m.useState(null),[s,a]=m.useState(!1),l=m.useCallback(f=>new Promise(x=>{t(f),a(!0),r(()=>x)}),[]),u=m.useCallback(()=>{a(!1),setTimeout(()=>{n&&n(),t(null)},200)},[n]),p=m.useCallback(()=>e?i.jsx(nn,{open:s,onClose:u,...e}):null,[e,s,u]);return{alert:l,AlertDialog:p}},gs=()=>{const[e,t]=m.useState(null),[n,r]=m.useState(null),[s,a]=m.useState(!1),l=m.useCallback(x=>new Promise(o=>{t(x),a(!0),r(()=>o)}),[]),u=m.useCallback(()=>{a(!1),setTimeout(()=>{n&&n(!1),t(null)},200)},[n]),p=m.useCallback(()=>{a(!1),setTimeout(()=>{n&&n(!0),t(null)},200)},[n]),f=m.useCallback(()=>e?i.jsx(an,{open:s,onClose:u,onConfirm:p,...e}):null,[e,s,u,p]);return{confirm:l,ConfirmationDialog:f}};function xs(){return{toast:Qo}}exports.Accordion=Hn;exports.AccordionContent=Un;exports.AccordionItem=Yn;exports.AccordionTrigger=Wn;exports.Alert=nn;exports.Alignment=Se;exports.Button=Ie;exports.ButtonGroup=Xn;exports.ButtonGroupSeparator=qn;exports.ButtonGroupText=Kn;exports.Card=on;exports.Checkbox=sn;exports.Chip=vt;exports.CommandMenu=fs;exports.CommandMenuItem=at;exports.Confirm=an;exports.CopyButton=Jn;exports.DataTable=cn;exports.Dialog=xt;exports.FloatingActionButton=Zn;exports.Input=Qe;exports.Item=er;exports.NavHost=ps;exports.Pagination=tr;exports.PaginationContent=nr;exports.PaginationEllipsis=ar;exports.PaginationItem=rr;exports.PaginationLink=yt;exports.PaginationNext=sr;exports.PaginationPrevious=or;exports.Popover=st;exports.RouteBuilder=Cn;exports.Select=Ro;exports.Separator=rn;exports.Sheet=jn;exports.SheetDescription=Ao;exports.SheetFooter=ko;exports.SheetHeader=So;exports.SheetTitle=To;exports.Skeleton=Oo;exports.Spinner=Do;exports.Status=_o;exports.TagInput=Po;exports.Textarea=Io;exports.Toaster=us;exports.Tooltip=ds;exports.buttonVariants=bt;exports.cn=Je;exports.getHeaderGroups=ln;exports.useAlert=hs;exports.useConfirm=gs;exports.useNavigation=ms;exports.useToast=xs;
6
+ <%s key={someKey} {...props} />`,O,z,$,z),H[z+O]=!0)}if(z=null,N!==void 0&&(n(N),z=""+N),c(A)&&(n(A.key),z=""+A.key),"key"in A){N={};for(var ce in A)ce!=="key"&&(N[ce]=A[ce])}else N=A;return z&&u(N,typeof y=="function"?y.displayName||y.name||"Unknown":y),d(y,z,N,s(),F,K)}function o(y){v(y)?y._store&&(y._store.validated=1):typeof y=="object"&&y!==null&&y.$$typeof===M&&(y._payload.status==="fulfilled"?v(y._payload.value)&&y._payload.value._store&&(y._payload.value._store.validated=1):y._store&&(y._store.validated=1))}function v(y){return typeof y=="object"&&y!==null&&y.$$typeof===g}var a=f,g=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),m=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),R=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),Z=Symbol.for("react.client.reference"),Q=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,W=Array.isArray,X=console.createTask?console.createTask:function(){return null};a={react_stack_bottom_frame:function(y){return y()}};var T,L={},P=a.react_stack_bottom_frame.bind(a,i)(),V=X(r(i)),H={};_e.Fragment=x,_e.jsx=function(y,A,N){var O=1e4>Q.recentlyCreatedOwnerStacks++;return h(y,A,N,!1,O?Error("react-stack-top-frame"):P,O?X(r(y)):V)},_e.jsxs=function(y,A,N){var O=1e4>Q.recentlyCreatedOwnerStacks++;return h(y,A,N,!0,O?Error("react-stack-top-frame"):P,O?X(r(y)):V)}})()),_e}var It;function Vn(){return It||(It=1,process.env.NODE_ENV==="production"?Ve.exports=Fn():Ve.exports=zn()),Ve.exports}var l=Vn();const Qt=f.createContext(null),Zt=()=>{const e=f.useContext(Qt);if(!e)throw new Error("useAccordion must be used within an Accordion");return e},Hn=f.forwardRef((e,t)=>{const{type:n="multiple",value:r,defaultValue:s,onValueChange:i,children:c,className:u,...p}=e,d=e.type==="single"&&e.collapsible,[h,o]=f.useState(s),v=r!==void 0,a=v?r:h,g=f.useCallback(x=>{let m;if(n==="single")m=a===x&&d?void 0:x,i&&i(m);else{const w=a||[];m=w.includes(x)?w.filter(j=>j!==x):[...w,x],i&&i(m)}v||o(m)},[n,a,d,v,i]),b={value:Array.isArray(a)?a:a?[a]:[],onItemClick:g};return l.jsx(Qt.Provider,{value:b,children:l.jsx("div",{ref:t,className:C.clsx("overflow-hidden rounded-lg border border-outline",u),...p,children:c})})}),en=f.createContext(null),tn=()=>{const e=f.useContext(en);if(!e)throw new Error("useAccordionItem must be used within an AccordionItem");return e},Yn=f.forwardRef(({children:e,className:t,value:n,...r},s)=>l.jsx(en.Provider,{value:{value:n},children:l.jsx("div",{ref:s,className:C.clsx("border-b last-of-type:border-b-0 border-outline",t),...r,children:e})})),Wn=f.forwardRef(({children:e,className:t,...n},r)=>{const{onItemClick:s,value:i}=Zt(),{value:c}=tn(),u=i.includes(c);return l.jsxs("button",{ref:r,className:C.clsx("flex w-full items-center justify-between p-4 font-medium transition-all hover:bg-surface-variant [&[data-state=open]>svg]:rotate-180",t),onClick:()=>s(c),...n,children:[e,l.jsx(se.ChevronDown,{className:C.clsx("h-4 w-4 shrink-0 transition-transform duration-150",u&&"rotate-180")})]})}),Un=f.forwardRef(({children:e,className:t,...n},r)=>{const{value:s}=Zt(),{value:i}=tn();if(s.includes(i))return l.jsx("div",{ref:r,className:C.clsx("overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",t),...n,children:l.jsx("div",{className:"pb-4 pl-4 pr-4",children:e})})});function xt({open:e,onClose:t,children:n,classNameOverlay:r}){const[s,i]=f.useState(!1),[c,u]=f.useState(!1);return f.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),f.useEffect(()=>{const p=d=>{d.key==="Escape"&&t()};return e&&document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p)}},[e,t]),f.useEffect(()=>{if(e)i(!0);else{const p=setTimeout(()=>i(!1),200);return()=>clearTimeout(p)}},[e]),f.useEffect(()=>{s&&e?requestAnimationFrame(()=>{u(!0)}):s&&!e&&u(!1)},[s,e]),s?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:C("fixed inset-0 bg-black/50 bg-opacity-50 backdrop-blur-sm z-40 transition-opacity duration-200",c?"opacity-100":"opacity-0",r)}),l.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-50 p-4",onClick:t,children:l.jsx("div",{className:C("bg-surface border border-outline rounded-lg shadow-lg max-w-lg w-full p-6 relative transition-all duration-200 ease-out",c?"opacity-100 translate-y-0":"opacity-0 translate-y-12"),onClick:p=>p.stopPropagation(),children:n})})]}):null}const bt=qt.cva("group cursor-pointer inline-flex items-center justify-center font-medium rounded-[3rem] active:rounded-[0.5rem] transition-all duration-150 disabled:opacity-50 disabled:!pointer-events-none",{variants:{variant:{filled:"bg-primary text-on-primary hover:bg-primary-dark",outlined:"border border-primary text-primary hover:bg-primary/10 dark:hover:bg-primary/20",tonal:"bg-primary/20 text-primary hover:bg-primary/30 dark:hover:bg-primary/40",ghost:"bg-transparent text-primary hover:bg-primary/10 dark:hover:bg-primary/20",link:"text-primary underline-offset-4 hover:underline !bg-transparent !p-0 !h-auto"},size:{sm:"h-10 md:h-9 px-4 text-sm",md:"h-12 md:h-10 px-6 text-base",lg:"h-14 md:h-11 px-8 text-lg",icon:"!size-10 md:!size-9 flex items-center justify-center"}},defaultVariants:{variant:"filled",size:"md"}});function Ie({variant:e,size:t,children:n,className:r,...s}){return l.jsx("div",{className:C(bt({variant:e,size:t}),r),children:l.jsx("button",{...s,className:C("w-full h-full cursor-pointer transition-all duration-150 flex flex-row items-center justify-center focus:outline-none"),children:n})})}function nn({open:e,onClose:t,title:n,message:r,confirmText:s="OK"}){return l.jsx(xt,{open:e,onClose:t,children:l.jsxs("div",{className:"text-center",children:[l.jsx("h2",{className:"text-xl font-semibold mb-2",children:n}),l.jsx("p",{className:"mb-4 text-on-surface-variant",children:r}),l.jsx("div",{className:"flex justify-end gap-2",children:l.jsx(Ie,{onClick:t,children:s})})]})})}function Je(...e){return $n.twMerge(C.clsx(e))}function rn({orientation:e="horizontal",className:t}){return l.jsx("div",{role:"separator",className:C("shrink-0 bg-outline",e==="horizontal"?"h-px w-full":"w-px h-full",t)})}const Gn=qt.cva("flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});function Xn({className:e,orientation:t,...n}){return l.jsx("div",{role:"group","data-slot":"button-group","data-orientation":t,className:Je(Gn({orientation:t}),e),...n})}function Kn({className:e,...t}){return l.jsx("div",{className:Je("bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",e),...t})}function qn({className:e,orientation:t="vertical",...n}){return l.jsx(rn,{"data-slot":"button-group-separator",orientation:t,className:Je("bg-input relative m-0! self-stretch data-[orientation=vertical]:h-auto",e),...n})}const on=f.forwardRef(({variant:e="filled",children:t,className:n,...r},s)=>{const u=C("rounded-lg p-4",{elevated:"shadow shadow-md",filled:"bg-surface-variant",outlined:"border border-outline"}[e],n);return l.jsx("div",{ref:s,className:u,...r,children:t})});function sn({checked:e,onChange:t,label:n,disabled:r=!1,className:s=""}){return l.jsxs("label",{className:C("flex items-center gap-2 cursor-pointer",r&&"pointer-events-none opacity-50",s),children:[l.jsx("input",{type:"checkbox",checked:e,onChange:i=>t(i.target.checked),disabled:r,className:"sr-only peer"}),l.jsx("div",{className:C("w-5 h-5 border-2 rounded-md flex items-center justify-center transition-colors duration-150",e?"bg-primary border-primary":"border-outline"),children:e&&l.jsx("svg",{className:"w-3 h-3 text-on-primary",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("polyline",{points:"20 6 9 17 4 12"})})}),n&&l.jsx("span",{className:"select-none text-base font-medium",children:n})]})}const vt=({variant:e="assist",label:t,icon:n,avatar:r,onDelete:s,onClick:i,selected:c,colors:u})=>{const[p,d]=f.useState(!1),v=C("text-on-surface inline-flex items-center justify-center rounded-lg border border-outline-variant px-2 py-1 text-sm text-on-surface transition-colors duration-150",{assist:"hover:bg-primary/10 dark:hover:bg-primary/20",filter:c?"border-transparent bg-primary-container text-on-primary-container cursor-pointer":" hover:bg-gray-50 cursor-pointer",input:"",suggestion:"hover:bg-primary/10 dark:hover:bg-primary/20"}[e]),a=C({[u?.backgroundColorClass??""]:!c&&!p,[u?.textColorClass??""]:!c,[u?.borderColorClass??""]:!c,[u?.hoverBackgroundColorClass??""]:!c&&p,[u?.selectedBackgroundColorClass??""]:c&&!p,[u?.selectedTextColorClass??""]:c,[u?.selectedBorderColorClass??""]:c,[u?.selectedHoverBackgroundColorClass??""]:c&&p,"cursor-pointer":i});return l.jsxs("div",{className:C(v,a),onClick:i,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[r,n&&l.jsx("span",{className:"me-2",children:n}),l.jsx("span",{children:t}),s&&l.jsx("button",{onClick:s,className:"ms-2 p-[0.2rem] rounded-lg hover:bg-primary/10 dark:hover:bg-primary/20 transition-colors duration-150",children:l.jsx(se.X,{className:"size-4"})})]})};function an({open:e,onClose:t,onConfirm:n,title:r,message:s,confirmText:i="Confirm",cancelText:c="Cancel"}){return l.jsx(xt,{open:e,onClose:t,children:l.jsxs("div",{className:"text-center",children:[l.jsx("h2",{className:"text-xl font-semibold mb-2",children:r}),l.jsx("p",{className:"mb-4 text-on-surface-variant",children:s}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Ie,{variant:"outlined",onClick:t,children:c}),l.jsx(Ie,{onClick:n,children:i})]})]})})}function Jn({text:e,label:t,labelCopied:n,variant:r="ghost",size:s="md",successulCallback:i}){const[c,u]=f.useState(!1),p={sm:"size-4",md:"size-6"},d={sm:"size-4",md:"size-5"},h={sm:"rounded-[0.8rem]",md:"rounded-lg"},o={sm:"text-sm",md:"text-base"},v={outlined:"border border-primary text-primary hover:bg-primary/10 dark:hover:bg-primary/20",ghost:"bg-transparent text-primary hover:bg-primary/10 dark:hover:bg-primary/20"},a=async()=>{try{await navigator.clipboard.writeText(e),u(!0),i?.(),setTimeout(()=>u(!1),2e3)}catch(g){console.error("Copy failed",g)}};return l.jsxs("button",{onClick:a,className:C(h[s],"cursor-pointer inline-flex items-center justify-center p-2 transition duration-150",v[r]),"aria-label":"Copy to clipboard",children:[l.jsxs("span",{className:C(p[s],"relative flex items-center justify-center"),children:[l.jsx(se.Clipboard,{className:`${d[s]} absolute inset-0 left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 transition-transform duration-200 ${c?"scale-0 opacity-0":"scale-100 opacity-100"}`}),l.jsx(se.Check,{className:`${d[s]} absolute inset-0 left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 transition-transform duration-200 ${c?"scale-100 opacity-100":"scale-0 opacity-0"} text-success`})]}),t&&l.jsx("span",{className:C(o[s],"ml-2 me-1"),children:c&&n||t})]})}const Se={LEFT:"left",CENTER:"center",RIGHT:"right"};function ln(e){const t=new Set;e.forEach(r=>{Object.keys(r).forEach(s=>{r[s]&&typeof r[s]=="object"&&!Array.isArray(r[s])?Object.keys(r[s]).forEach(i=>{t.add(`${s}.${i}`)}):t.add(s)})});const n={};return t.forEach(r=>{const[s,i]=r.split(".");i?(n[s]||(n[s]=[]),n[s].push(i)):n[r]||(n[r]=[])}),Object.entries(n).map(([r,s])=>({parent:r,children:s}))}function Qn(e){const t={};for(const n of e){const r=n.accessorKey,[s,i]=r.split(".");i?(t[s]||(t[s]=[]),t[s].push(i)):t[s]||(t[s]=[])}return Object.entries(t).map(([n,r])=>({parent:n,children:r}))}function Mt(e,t){return t.split(".").reduce((n,r)=>n?n[r]:void 0,e)}function cn({data:e,columns:t,headerAlignment:n=Se.CENTER,cellAlignment:r=Se.LEFT}){const s=u=>{switch(u){case Se.LEFT:return"text-left";case Se.CENTER:return"text-center";case Se.RIGHT:return"text-right";default:return"text-left"}};if(!e||e.length===0)return l.jsx("div",{className:"text-center py-8 text-on-surface-variant",children:"Keine Daten vorhanden."});const i=()=>{const u=ln(e),p=u.flatMap(o=>o.children.length>0?o.children.map(v=>`${o.parent}.${v}`):[o.parent]),d=0,h=u.length-1;return l.jsxs("table",{className:"min-w-full border-separate border-spacing-0 rounded-lg",children:[l.jsxs("thead",{children:[l.jsx("tr",{children:u.map((o,v)=>{const a=v===d&&v===h?"rounded-tl-lg rounded-tr-lg":v===d?"rounded-tl-lg":v===h?"rounded-tr-lg":"",b=!(v===h);return o.children.length>0?l.jsx("th",{colSpan:o.children.length,className:`font-medium px-4 py-3 border-b ${b?"border-r":""} ${s(n)} bg-surface-variant text-on-surface border-outline ${a}`,children:(()=>{if(!t)return o.parent;const x=t.find(w=>w.accessorKey===o.parent||w.accessorKey===`${o.parent}.${o.children[0]}`);if(!x)return o.parent;const m=x.header;return typeof m=="function"?m({column:x}):m??o.parent})()},o.parent):l.jsx("th",{rowSpan:2,className:`font-medium px-4 py-3 border-b ${b?"border-r":""} ${s(n)} align-middle bg-surface-variant text-on-surface border-outline ${a}`,children:(()=>{if(!t)return o.parent;const x=t.find(w=>w.accessorKey===o.parent);if(!x)return o.parent;const m=x.header;return typeof m=="function"?m({column:x}):m??o.parent})()},o.parent)})}),l.jsx("tr",{children:u.map(o=>o.children.length>0?o.children.map((v,a,g)=>{const b=a===g.length-1,x=u.indexOf(o)===u.length-1,m=!(b&&x);return l.jsx("th",{className:`font-normal px-4 py-2 border-b ${m?"border-r":""} ${s(n)} bg-surface text-on-surface border-outline-variant`,children:v},`${o.parent}.${v}`)}):null)})]}),l.jsx("tbody",{children:e.map((o,v)=>l.jsx("tr",{className:"transition-colors hover:bg-hover",children:p.map((a,g)=>{const b=Mt(o,a),x=v===e.length-1,w=!(g===p.length-1);return l.jsx("td",{className:`px-4 py-3 ${w?"border-r":""} ${s(r)} text-on-surface border-outline-variant ${x?"":"border-b"}`,children:b!=null?b.toString():""},a)})},v))})]})},c=()=>{const u=Qn(t),p=u.flatMap(d=>d.children.length>0?d.children.map(h=>`${d.parent}.${h}`):[d.parent]);return l.jsxs("table",{className:"min-w-full border-separate border-spacing-0 rounded-lg",children:[l.jsxs("thead",{children:[l.jsx("tr",{children:u.map((d,h)=>{const v=!(h===u.length-1),a=0,g=u.length-1,b=h===a&&h===g?"rounded-tl-lg rounded-tr-lg":h===a?"rounded-tl-lg":h===g?"rounded-tr-lg":"";return d.children.length>0?l.jsx("th",{colSpan:d.children.length,className:`font-medium px-4 py-3 border-b ${v?"border-r":""} ${s(n)} bg-surface-variant text-on-surface border-outline ${b}`,children:(()=>{const x=t.find(m=>m.accessorKey===d.parent)?.header;return typeof x=="function"?x({column:t.find(m=>m.accessorKey===d.parent)}):x??d.parent})()},d.parent):l.jsx("th",{rowSpan:2,className:`font-medium px-4 py-3 border-b ${v?"border-r":""} ${s(n)} align-middle bg-surface-variant text-on-surface border-outline ${b}`,children:(()=>{const x=t.find(w=>w.accessorKey===d.parent);if(!x)return d.parent;const m=x.header;return typeof m=="function"?m({column:t.find(w=>w.accessorKey===d.parent)}):m??d.parent})()},d.parent)})}),l.jsx("tr",{children:u.map(d=>d.children.length>0?d.children.map((h,o,v)=>{const g=!(o===v.length-1);return l.jsx("th",{className:`font-normal px-4 py-2 border-b ${g?"border-r":""} ${s(n)} bg-surface text-on-surface border-outline-variant`,children:(()=>{const b=t.find(x=>x.accessorKey===`${d.parent}.${h}`)?.header;return typeof b=="function"?b({column:t.find(x=>x.accessorKey===`${d.parent}.${h}`)}):b??h})()},`${d.parent}.${h}`)}):null)})]}),l.jsx("tbody",{children:e.map((d,h)=>l.jsx("tr",{className:"transition-colors hover:bg-hover",children:p.map((o,v)=>{const a=t.find(w=>w.accessorKey===o),g=h===e.length-1,x=!(v===p.length-1);let m=a?.cell?a.cell({row:d}):Mt(d,o);return typeof m=="object"&&m!==null&&!f.isValidElement(m)&&(m=JSON.stringify(m)),l.jsx("td",{className:`px-4 py-3 ${x?"border-r":""} ${s(r)} text-on-surface border-outline-variant ${g?"":"border-b"}`,children:m},o)})},h))})]})};return l.jsx("div",{className:"overflow-x-auto rounded-lg shadow-sm bg-surface",children:t?c():i()})}const Zn=({icon:e,label:t,extended:n=!1,onClick:r,className:s})=>l.jsx("button",{className:C("inline-flex items-center justify-center font-medium transition-all duration-150 ease-in-out cursor-pointer","h-14","bg-primary text-on-primary shadow-md hover:shadow-lg",n?"w-auto px-6 rounded-2xl":"w-auto px-4 rounded-2xl",s),onClick:r,children:n?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:C("flex items-center justify-center w-6 h-6 transition-all duration-150 ease-in-out",t&&"mr-3"),children:e}),l.jsx("span",{className:C("whitespace-nowrap transition-all duration-150 ease-in-out","opacity-100 translate-x-0"),children:t})]}):l.jsx("span",{className:C("flex items-center justify-center w-6 h-6 transition-all duration-150 ease-in-out"),children:e})}),Qe=f.forwardRef(({label:e,className:t,variant:n="default",...r},s)=>{const i="w-full rounded-lg transition duration-150 disabled:opacity-50 disabled:pointer-events-none",c="h-12 md:h-10 px-3 py-1 text-base",u={default:"border border-outline-variant outline-none focus-visible:ring-primary/50 focus-visible:ring-[3px]",ghost:"border-none outline-none focus-visible:ring-none"};return l.jsxs("div",{children:[e&&l.jsx("label",{htmlFor:r.id,className:"block text-sm font-medium text-on-surface",children:e}),l.jsx("input",{ref:s,className:C(i,c,u[n],t),...r})]})});function er({label:e,description:t,leadingContent:n,trailingContent:r,clickable:s=!1,disabled:i=!1,onClick:c,variant:u="rounded"}){const p=C("flex items-center gap-4 min-h-12 md:min-h-10 py-2 px-6 w-full","transition-all duration-150 bg-surface-variant",{"rounded-t-lg":u==="first","rounded-b-lg":u==="last","rounded-none":u==="none","rounded-lg":u==="rounded","cursor-pointer active:bg-primary-container sm:hover:bg-primary-container":s&&!i,"hover:rounded-lg":s&&!i&&(u==="none"||u==="first"||u==="last"),"hover:mb-1":s&&!i&&u==="first","hover:my-1":s&&!i&&u==="none","hover:mt-1":s&&!i&&u==="last","opacity-50 cursor-not-allowed":i});return l.jsxs("div",{className:p,onClick:!i&&s?c:void 0,children:[n&&l.jsx("span",{className:"text-primary",children:n}),l.jsxs("div",{className:"flex-1",children:[l.jsx("p",{className:" text-primary",children:e}),t&&l.jsx("p",{className:"text-xs text-primary/75",children:t})]}),r&&l.jsx("span",{className:"text-xl text-primary",children:r})]})}function tr({className:e,...t}){return l.jsx("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:C("mx-auto flex w-full justify-center",e),...t})}function nr({className:e,...t}){return l.jsx("ul",{"data-slot":"pagination-content",className:C("flex flex-row items-center gap-1",e),...t})}function rr({...e}){return l.jsx("li",{"data-slot":"pagination-item",...e})}function yt({className:e,isActive:t,size:n="icon",...r}){return l.jsx("a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:C(bt({variant:t?"outlined":"ghost",size:n}),e),...r})}function or({className:e,...t}){return l.jsxs(yt,{"aria-label":"Go to previous page",className:C("gap-1 px-2.5 sm:pl-2.5",e),size:"md",...t,children:[l.jsx(se.ChevronLeftIcon,{}),l.jsx("span",{className:"hidden sm:block",children:"Previous"})]})}function sr({className:e,...t}){return l.jsxs(yt,{"aria-label":"Go to next page",className:C("gap-1 px-2.5 sm:pr-2.5",e),size:"md",...t,children:[l.jsx("span",{className:"hidden sm:block",children:"Next"}),l.jsx(se.ChevronRightIcon,{})]})}function ar({className:e,...t}){return l.jsxs("span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:C("flex size-9 items-center justify-center",e),...t,children:[l.jsx(se.MoreHorizontalIcon,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"More pages"})]})}function Ze(){return typeof window<"u"}function Ae(e){return un(e)?(e.nodeName||"").toLowerCase():"#document"}function re(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function me(e){var t;return(t=(un(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function un(e){return Ze()?e instanceof Node||e instanceof re(e).Node:!1}function J(e){return Ze()?e instanceof Element||e instanceof re(e).Element:!1}function fe(e){return Ze()?e instanceof HTMLElement||e instanceof re(e).HTMLElement:!1}function Lt(e){return!Ze()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof re(e).ShadowRoot}const ir=new Set(["inline","contents"]);function Le(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=le(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!ir.has(s)}const lr=new Set(["table","td","th"]);function cr(e){return lr.has(Ae(e))}const ur=[":popover-open",":modal"];function et(e){return ur.some(t=>{try{return e.matches(t)}catch{return!1}})}const dr=["transform","translate","scale","rotate","perspective"],fr=["transform","translate","scale","rotate","perspective","filter"],mr=["paint","layout","strict","content"];function wt(e){const t=Et(),n=J(e)?le(e):e;return dr.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||fr.some(r=>(n.willChange||"").includes(r))||mr.some(r=>(n.contain||"").includes(r))}function pr(e){let t=xe(e);for(;fe(t)&&!Te(t);){if(wt(t))return t;if(et(t))return null;t=xe(t)}return null}function Et(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const hr=new Set(["html","body","#document"]);function Te(e){return hr.has(Ae(e))}function le(e){return re(e).getComputedStyle(e)}function tt(e){return J(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xe(e){if(Ae(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Lt(e)&&e.host||me(e);return Lt(t)?t.host:t}function dn(e){const t=xe(e);return Te(t)?e.ownerDocument?e.ownerDocument.body:e.body:fe(t)&&Le(t)?t:dn(t)}function Me(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=dn(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),c=re(s);if(i){const u=ft(c);return t.concat(c,c.visualViewport||[],Le(s)?s:[],u&&n?Me(u):[])}return t.concat(s,Me(s,[],n))}function ft(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Ue=Math.min,ve=Math.max,Ge=Math.round,He=Math.floor,de=e=>({x:e,y:e}),gr={left:"right",right:"left",bottom:"top",top:"bottom"},xr={start:"end",end:"start"};function $t(e,t,n){return ve(e,Ue(t,n))}function nt(e,t){return typeof e=="function"?e(t):e}function ye(e){return e.split("-")[0]}function rt(e){return e.split("-")[1]}function fn(e){return e==="x"?"y":"x"}function mn(e){return e==="y"?"height":"width"}const br=new Set(["top","bottom"]);function ge(e){return br.has(ye(e))?"y":"x"}function pn(e){return fn(ge(e))}function vr(e,t,n){n===void 0&&(n=!1);const r=rt(e),s=pn(e),i=mn(s);let c=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(c=Xe(c)),[c,Xe(c)]}function yr(e){const t=Xe(e);return[mt(e),t,mt(t)]}function mt(e){return e.replace(/start|end/g,t=>xr[t])}const Bt=["left","right"],Ft=["right","left"],wr=["top","bottom"],Er=["bottom","top"];function jr(e,t,n){switch(e){case"top":case"bottom":return n?t?Ft:Bt:t?Bt:Ft;case"left":case"right":return t?wr:Er;default:return[]}}function Nr(e,t,n,r){const s=rt(e);let i=jr(ye(e),n==="start",r);return s&&(i=i.map(c=>c+"-"+s),t&&(i=i.concat(i.map(mt)))),i}function Xe(e){return e.replace(/left|right|bottom|top/g,t=>gr[t])}function Cr(e){return{top:0,right:0,bottom:0,left:0,...e}}function Rr(e){return typeof e!="number"?Cr(e):{top:e,right:e,bottom:e,left:e}}function Ke(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}var Sr=typeof document<"u",kr=function(){},pt=Sr?f.useLayoutEffect:kr;const Tr={...k},Ar=Tr.useInsertionEffect,Or=Ar||(e=>e());function Dr(e){const t=k.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Or(()=>{t.current=e}),k.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function zt(e,t,n){let{reference:r,floating:s}=e;const i=ge(t),c=pn(t),u=mn(c),p=ye(t),d=i==="y",h=r.x+r.width/2-s.width/2,o=r.y+r.height/2-s.height/2,v=r[u]/2-s[u]/2;let a;switch(p){case"top":a={x:h,y:r.y-s.height};break;case"bottom":a={x:h,y:r.y+r.height};break;case"right":a={x:r.x+r.width,y:o};break;case"left":a={x:r.x-s.width,y:o};break;default:a={x:r.x,y:r.y}}switch(rt(t)){case"start":a[c]-=v*(n&&d?-1:1);break;case"end":a[c]+=v*(n&&d?-1:1);break}return a}const _r=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:c}=n,u=i.filter(Boolean),p=await(c.isRTL==null?void 0:c.isRTL(t));let d=await c.getElementRects({reference:e,floating:t,strategy:s}),{x:h,y:o}=zt(d,r,p),v=r,a={},g=0;for(let b=0;b<u.length;b++){const{name:x,fn:m}=u[b],{x:w,y:j,data:R,reset:E}=await m({x:h,y:o,initialPlacement:r,placement:v,strategy:s,middlewareData:a,rects:d,platform:c,elements:{reference:e,floating:t}});h=w??h,o=j??o,a={...a,[x]:{...a[x],...R}},E&&g<=50&&(g++,typeof E=="object"&&(E.placement&&(v=E.placement),E.rects&&(d=E.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:s}):E.rects),{x:h,y:o}=zt(d,v,p)),b=-1)}return{x:h,y:o,placement:v,strategy:s,middlewareData:a}};async function hn(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:c,elements:u,strategy:p}=e,{boundary:d="clippingAncestors",rootBoundary:h="viewport",elementContext:o="floating",altBoundary:v=!1,padding:a=0}=nt(t,e),g=Rr(a),x=u[v?o==="floating"?"reference":"floating":o],m=Ke(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(u.floating)),boundary:d,rootBoundary:h,strategy:p})),w=o==="floating"?{x:r,y:s,width:c.floating.width,height:c.floating.height}:c.reference,j=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),R=await(i.isElement==null?void 0:i.isElement(j))?await(i.getScale==null?void 0:i.getScale(j))||{x:1,y:1}:{x:1,y:1},E=Ke(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:w,offsetParent:j,strategy:p}):w);return{top:(m.top-E.top+g.top)/R.y,bottom:(E.bottom-m.bottom+g.bottom)/R.y,left:(m.left-E.left+g.left)/R.x,right:(E.right-m.right+g.right)/R.x}}const Pr=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:c,initialPlacement:u,platform:p,elements:d}=t,{mainAxis:h=!0,crossAxis:o=!0,fallbackPlacements:v,fallbackStrategy:a="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...x}=nt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const m=ye(s),w=ge(u),j=ye(u)===u,R=await(p.isRTL==null?void 0:p.isRTL(d.floating)),E=v||(j||!b?[Xe(u)]:yr(u)),S=g!=="none";!v&&S&&E.push(...Nr(u,b,g,R));const I=[u,...E],_=await hn(t,x),M=[];let B=((r=i.flip)==null?void 0:r.overflows)||[];if(h&&M.push(_[m]),o){const W=vr(s,c,R);M.push(_[W[0]],_[W[1]])}if(B=[...B,{placement:s,overflows:M}],!M.every(W=>W<=0)){var Z,Q;const W=(((Z=i.flip)==null?void 0:Z.index)||0)+1,X=I[W];if(X&&(!(o==="alignment"?w!==ge(X):!1)||B.every(P=>ge(P.placement)===w?P.overflows[0]>0:!0)))return{data:{index:W,overflows:B},reset:{placement:X}};let T=(Q=B.filter(L=>L.overflows[0]<=0).sort((L,P)=>L.overflows[1]-P.overflows[1])[0])==null?void 0:Q.placement;if(!T)switch(a){case"bestFit":{var Y;const L=(Y=B.filter(P=>{if(S){const V=ge(P.placement);return V===w||V==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(V=>V>0).reduce((V,H)=>V+H,0)]).sort((P,V)=>P[1]-V[1])[0])==null?void 0:Y[0];L&&(T=L);break}case"initialPlacement":T=u;break}if(s!==T)return{reset:{placement:T}}}return{}}}},Ir=new Set(["left","top"]);async function Mr(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),c=ye(n),u=rt(n),p=ge(n)==="y",d=Ir.has(c)?-1:1,h=i&&p?-1:1,o=nt(t,e);let{mainAxis:v,crossAxis:a,alignmentAxis:g}=typeof o=="number"?{mainAxis:o,crossAxis:0,alignmentAxis:null}:{mainAxis:o.mainAxis||0,crossAxis:o.crossAxis||0,alignmentAxis:o.alignmentAxis};return u&&typeof g=="number"&&(a=u==="end"?g*-1:g),p?{x:a*h,y:v*d}:{x:v*d,y:a*h}}const Lr=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:c,middlewareData:u}=t,p=await Mr(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:s+p.x,y:i+p.y,data:{...p,placement:c}}}}},$r=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:u={fn:x=>{let{x:m,y:w}=x;return{x:m,y:w}}},...p}=nt(e,t),d={x:n,y:r},h=await hn(t,p),o=ge(ye(s)),v=fn(o);let a=d[v],g=d[o];if(i){const x=v==="y"?"top":"left",m=v==="y"?"bottom":"right",w=a+h[x],j=a-h[m];a=$t(w,a,j)}if(c){const x=o==="y"?"top":"left",m=o==="y"?"bottom":"right",w=g+h[x],j=g-h[m];g=$t(w,g,j)}const b=u.fn({...t,[v]:a,[o]:g});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[v]:i,[o]:c}}}}}};function gn(e){const t=le(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=fe(e),i=s?e.offsetWidth:n,c=s?e.offsetHeight:r,u=Ge(n)!==i||Ge(r)!==c;return u&&(n=i,r=c),{width:n,height:r,$:u}}function jt(e){return J(e)?e:e.contextElement}function ke(e){const t=jt(e);if(!fe(t))return de(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=gn(t);let c=(i?Ge(n.width):n.width)/r,u=(i?Ge(n.height):n.height)/s;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const Br=de(0);function xn(e){const t=re(e);return!Et()||!t.visualViewport?Br:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Fr(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==re(e)?!1:t}function we(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=jt(e);let c=de(1);t&&(r?J(r)&&(c=ke(r)):c=ke(e));const u=Fr(i,n,r)?xn(i):de(0);let p=(s.left+u.x)/c.x,d=(s.top+u.y)/c.y,h=s.width/c.x,o=s.height/c.y;if(i){const v=re(i),a=r&&J(r)?re(r):r;let g=v,b=ft(g);for(;b&&r&&a!==g;){const x=ke(b),m=b.getBoundingClientRect(),w=le(b),j=m.left+(b.clientLeft+parseFloat(w.paddingLeft))*x.x,R=m.top+(b.clientTop+parseFloat(w.paddingTop))*x.y;p*=x.x,d*=x.y,h*=x.x,o*=x.y,p+=j,d+=R,g=re(b),b=ft(g)}}return Ke({width:h,height:o,x:p,y:d})}function ot(e,t){const n=tt(e).scrollLeft;return t?t.left+n:we(me(e)).left+n}function bn(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ot(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function zr(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",c=me(r),u=t?et(t.floating):!1;if(r===c||u&&i)return n;let p={scrollLeft:0,scrollTop:0},d=de(1);const h=de(0),o=fe(r);if((o||!o&&!i)&&((Ae(r)!=="body"||Le(c))&&(p=tt(r)),fe(r))){const a=we(r);d=ke(r),h.x=a.x+r.clientLeft,h.y=a.y+r.clientTop}const v=c&&!o&&!i?bn(c,p):de(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-p.scrollLeft*d.x+h.x+v.x,y:n.y*d.y-p.scrollTop*d.y+h.y+v.y}}function Vr(e){return Array.from(e.getClientRects())}function Hr(e){const t=me(e),n=tt(e),r=e.ownerDocument.body,s=ve(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ve(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+ot(e);const u=-n.scrollTop;return le(r).direction==="rtl"&&(c+=ve(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:c,y:u}}const Vt=25;function Yr(e,t){const n=re(e),r=me(e),s=n.visualViewport;let i=r.clientWidth,c=r.clientHeight,u=0,p=0;if(s){i=s.width,c=s.height;const h=Et();(!h||h&&t==="fixed")&&(u=s.offsetLeft,p=s.offsetTop)}const d=ot(r);if(d<=0){const h=r.ownerDocument,o=h.body,v=getComputedStyle(o),a=h.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,g=Math.abs(r.clientWidth-o.clientWidth-a);g<=Vt&&(i-=g)}else d<=Vt&&(i+=d);return{width:i,height:c,x:u,y:p}}const Wr=new Set(["absolute","fixed"]);function Ur(e,t){const n=we(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=fe(e)?ke(e):de(1),c=e.clientWidth*i.x,u=e.clientHeight*i.y,p=s*i.x,d=r*i.y;return{width:c,height:u,x:p,y:d}}function Ht(e,t,n){let r;if(t==="viewport")r=Yr(e,n);else if(t==="document")r=Hr(me(e));else if(J(t))r=Ur(t,n);else{const s=xn(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Ke(r)}function vn(e,t){const n=xe(e);return n===t||!J(n)||Te(n)?!1:le(n).position==="fixed"||vn(n,t)}function Gr(e,t){const n=t.get(e);if(n)return n;let r=Me(e,[],!1).filter(u=>J(u)&&Ae(u)!=="body"),s=null;const i=le(e).position==="fixed";let c=i?xe(e):e;for(;J(c)&&!Te(c);){const u=le(c),p=wt(c);!p&&u.position==="fixed"&&(s=null),(i?!p&&!s:!p&&u.position==="static"&&!!s&&Wr.has(s.position)||Le(c)&&!p&&vn(e,c))?r=r.filter(h=>h!==c):s=u,c=xe(c)}return t.set(e,r),r}function Xr(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const c=[...n==="clippingAncestors"?et(t)?[]:Gr(t,this._c):[].concat(n),r],u=c[0],p=c.reduce((d,h)=>{const o=Ht(t,h,s);return d.top=ve(o.top,d.top),d.right=Ue(o.right,d.right),d.bottom=Ue(o.bottom,d.bottom),d.left=ve(o.left,d.left),d},Ht(t,u,s));return{width:p.right-p.left,height:p.bottom-p.top,x:p.left,y:p.top}}function Kr(e){const{width:t,height:n}=gn(e);return{width:t,height:n}}function qr(e,t,n){const r=fe(t),s=me(t),i=n==="fixed",c=we(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const p=de(0);function d(){p.x=ot(s)}if(r||!r&&!i)if((Ae(t)!=="body"||Le(s))&&(u=tt(t)),r){const a=we(t,!0,i,t);p.x=a.x+t.clientLeft,p.y=a.y+t.clientTop}else s&&d();i&&!r&&s&&d();const h=s&&!r&&!i?bn(s,u):de(0),o=c.left+u.scrollLeft-p.x-h.x,v=c.top+u.scrollTop-p.y-h.y;return{x:o,y:v,width:c.width,height:c.height}}function ut(e){return le(e).position==="static"}function Yt(e,t){if(!fe(e)||le(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return me(e)===n&&(n=n.ownerDocument.body),n}function yn(e,t){const n=re(e);if(et(e))return n;if(!fe(e)){let s=xe(e);for(;s&&!Te(s);){if(J(s)&&!ut(s))return s;s=xe(s)}return n}let r=Yt(e,t);for(;r&&cr(r)&&ut(r);)r=Yt(r,t);return r&&Te(r)&&ut(r)&&!wt(r)?n:r||pr(e)||n}const Jr=async function(e){const t=this.getOffsetParent||yn,n=this.getDimensions,r=await n(e.floating);return{reference:qr(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Qr(e){return le(e).direction==="rtl"}const Zr={convertOffsetParentRelativeRectToViewportRelativeRect:zr,getDocumentElement:me,getClippingRect:Xr,getOffsetParent:yn,getElementRects:Jr,getClientRects:Vr,getDimensions:Kr,getScale:ke,isElement:J,isRTL:Qr};function wn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function eo(e,t){let n=null,r;const s=me(e);function i(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function c(u,p){u===void 0&&(u=!1),p===void 0&&(p=1),i();const d=e.getBoundingClientRect(),{left:h,top:o,width:v,height:a}=d;if(u||t(),!v||!a)return;const g=He(o),b=He(s.clientWidth-(h+v)),x=He(s.clientHeight-(o+a)),m=He(h),j={rootMargin:-g+"px "+-b+"px "+-x+"px "+-m+"px",threshold:ve(0,Ue(1,p))||1};let R=!0;function E(S){const I=S[0].intersectionRatio;if(I!==p){if(!R)return c();I?c(!1,I):r=setTimeout(()=>{c(!1,1e-7)},1e3)}I===1&&!wn(d,e.getBoundingClientRect())&&c(),R=!1}try{n=new IntersectionObserver(E,{...j,root:s.ownerDocument})}catch{n=new IntersectionObserver(E,j)}n.observe(e)}return c(!0),i}function to(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:p=!1}=r,d=jt(e),h=s||i?[...d?Me(d):[],...Me(t)]:[];h.forEach(m=>{s&&m.addEventListener("scroll",n,{passive:!0}),i&&m.addEventListener("resize",n)});const o=d&&u?eo(d,n):null;let v=-1,a=null;c&&(a=new ResizeObserver(m=>{let[w]=m;w&&w.target===d&&a&&(a.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var j;(j=a)==null||j.observe(t)})),n()}),d&&!p&&a.observe(d),a.observe(t));let g,b=p?we(e):null;p&&x();function x(){const m=we(e);b&&!wn(b,m)&&n(),b=m,g=requestAnimationFrame(x)}return n(),()=>{var m;h.forEach(w=>{s&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),o?.(),(m=a)==null||m.disconnect(),a=null,p&&cancelAnimationFrame(g)}}const no=Lr,ro=$r,oo=Pr,so=(e,t,n)=>{const r=new Map,s={platform:Zr,...n},i={...s.platform,_c:r};return _r(e,t,{...s,platform:i})};var ao=typeof document<"u",io=function(){},We=ao?f.useLayoutEffect:io;function qe(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!qe(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!qe(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function En(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Wt(e,t){const n=En(e);return Math.round(t*n)/n}function dt(e){const t=k.useRef(e);return We(()=>{t.current=e}),t}function lo(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:c}={},transform:u=!0,whileElementsMounted:p,open:d}=e,[h,o]=k.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,a]=k.useState(r);qe(v,r)||a(r);const[g,b]=k.useState(null),[x,m]=k.useState(null),w=k.useCallback(P=>{P!==S.current&&(S.current=P,b(P))},[]),j=k.useCallback(P=>{P!==I.current&&(I.current=P,m(P))},[]),R=i||g,E=c||x,S=k.useRef(null),I=k.useRef(null),_=k.useRef(h),M=p!=null,B=dt(p),Z=dt(s),Q=dt(d),Y=k.useCallback(()=>{if(!S.current||!I.current)return;const P={placement:t,strategy:n,middleware:v};Z.current&&(P.platform=Z.current),so(S.current,I.current,P).then(V=>{const H={...V,isPositioned:Q.current!==!1};W.current&&!qe(_.current,H)&&(_.current=H,Bn.flushSync(()=>{o(H)}))})},[v,t,n,Z,Q]);We(()=>{d===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,o(P=>({...P,isPositioned:!1})))},[d]);const W=k.useRef(!1);We(()=>(W.current=!0,()=>{W.current=!1}),[]),We(()=>{if(R&&(S.current=R),E&&(I.current=E),R&&E){if(B.current)return B.current(R,E,Y);Y()}},[R,E,Y,B,M]);const X=k.useMemo(()=>({reference:S,floating:I,setReference:w,setFloating:j}),[w,j]),T=k.useMemo(()=>({reference:R,floating:E}),[R,E]),L=k.useMemo(()=>{const P={position:n,left:0,top:0};if(!T.floating)return P;const V=Wt(T.floating,h.x),H=Wt(T.floating,h.y);return u?{...P,transform:"translate("+V+"px, "+H+"px)",...En(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:H}},[n,u,T.floating,h.x,h.y]);return k.useMemo(()=>({...h,update:Y,refs:X,elements:T,floatingStyles:L}),[h,Y,X,T,L])}const co=(e,t)=>({...no(e),options:[e,t]}),uo=(e,t)=>({...ro(e),options:[e,t]}),fo=(e,t)=>({...oo(e),options:[e,t]}),mo={...k};let Ut=!1,po=0;const Gt=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+po++;function ho(){const[e,t]=k.useState(()=>Ut?Gt():void 0);return pt(()=>{e==null&&t(Gt())},[]),k.useEffect(()=>{Ut=!0},[]),e}const go=mo.useId,xo=go||ho;let ht;process.env.NODE_ENV!=="production"&&(ht=new Set);function bo(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const s="Floating UI: "+n.join(" ");if(!((e=ht)!=null&&e.has(s))){var i;(i=ht)==null||i.add(s),console.error(s)}}function vo(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(s=>s(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const yo=k.createContext(null),wo=k.createContext(null),Eo=()=>{var e;return((e=k.useContext(yo))==null?void 0:e.id)||null},jo=()=>k.useContext(wo);function No(e){const{open:t=!1,onOpenChange:n,elements:r}=e,s=xo(),i=k.useRef({}),[c]=k.useState(()=>vo()),u=Eo()!=null;if(process.env.NODE_ENV!=="production"){const a=r.reference;a&&!J(a)&&bo("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[p,d]=k.useState(r.reference),h=Dr((a,g,b)=>{i.current.openEvent=a?g:void 0,c.emit("openchange",{open:a,event:g,reason:b,nested:u}),n?.(a,g,b)}),o=k.useMemo(()=>({setPositionReference:d}),[]),v=k.useMemo(()=>({reference:p||r.reference||null,floating:r.floating||null,domReference:r.reference}),[p,r.reference,r.floating]);return k.useMemo(()=>({dataRef:i,open:t,onOpenChange:h,elements:v,events:c,floatingId:s,refs:o}),[t,h,v,c,s,o])}function Co(e){e===void 0&&(e={});const{nodeId:t}=e,n=No({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,s=r.elements,[i,c]=k.useState(null),[u,p]=k.useState(null),h=s?.domReference||i,o=k.useRef(null),v=jo();pt(()=>{h&&(o.current=h)},[h]);const a=lo({...e,elements:{...s,...u&&{reference:u}}}),g=k.useCallback(j=>{const R=J(j)?{getBoundingClientRect:()=>j.getBoundingClientRect(),getClientRects:()=>j.getClientRects(),contextElement:j}:j;p(R),a.refs.setReference(R)},[a.refs]),b=k.useCallback(j=>{(J(j)||j===null)&&(o.current=j,c(j)),(J(a.refs.reference.current)||a.refs.reference.current===null||j!==null&&!J(j))&&a.refs.setReference(j)},[a.refs]),x=k.useMemo(()=>({...a.refs,setReference:b,setPositionReference:g,domReference:o}),[a.refs,b,g]),m=k.useMemo(()=>({...a.elements,domReference:h}),[a.elements,h]),w=k.useMemo(()=>({...a,...r,refs:x,elements:m,nodeId:t}),[a,x,m,t,r]);return pt(()=>{r.dataRef.current.floatingContext=w;const j=v?.nodesRef.current.find(R=>R.id===t);j&&(j.context=w)}),k.useMemo(()=>({...a,context:w,refs:x,elements:m}),[a,x,m,w])}function st({trigger:e,content:t,onHover:n=!1,className:r,placement:s="bottom",open:i,onOpenChange:c,fullWidth:u=!1}){const[p,d]=f.useState(!1),h=i??p,o=c??d,v=f.useRef(null),{refs:a,floatingStyles:g,update:b}=Co({placement:s,middleware:[co(8),fo(),uo()],whileElementsMounted:to,open:h,onOpenChange:o}),x=()=>{v.current&&window.clearTimeout(v.current),o(!0)},m=()=>{v.current=window.setTimeout(()=>o(!1),100)};f.useEffect(()=>{if(!n&&h){const j=R=>{a.reference.current instanceof Node&&a.floating.current instanceof Node&&!a.reference.current.contains(R.target)&&!a.floating.current.contains(R.target)&&o(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)}},[h,n,a,o]);const w=n?{onMouseEnter:x,onMouseLeave:m}:{onClick:()=>{o(!h),b()}};return l.jsxs("div",{className:C("relative",u?"w-full":"inline-block"),children:[l.jsx("div",{ref:a.setReference,className:C("cursor-pointer",u?"w-full":"inline-block"),...w,children:e}),l.jsx("div",{ref:a.setFloating,style:g,className:C("z-10 w-64 rounded-lg bg-surface border border-outline p-2 shadow-lg transition-all transform duration-200 ease-out",h?"opacity-100 scale-100 pointer-events-auto":"opacity-0 scale-95 pointer-events-none",r),onMouseEnter:n?x:void 0,onMouseLeave:n?m:void 0,children:t})]})}const at=f.forwardRef(({children:e,onSelect:t,isActive:n},r)=>l.jsx("li",{ref:r,onClick:t,className:C("flex items-center gap-2 p-2 rounded-lg cursor-pointer",{"bg-primary-container text-on-primary-container":n,"hover:bg-hover":!n}),children:e}));function Ro({options:e=[],value:t,onChange:n,multiple:r=!1,placeholder:s="Select...",className:i,disabled:c=!1,withSearch:u=!1}){const[p,d]=f.useState(!1),[h,o]=f.useState(0),v=f.useRef([]),[a,g]=f.useState(""),b=f.useRef(null),x=f.useCallback(E=>{if(r&&Array.isArray(t)){const S=t.includes(E)?t.filter(I=>I!==E):[...t,E];n(S)}else n(E),d(!1)},[r,t,n,d]),m=e.filter(E=>E.label.toLowerCase().includes(a.toLowerCase()));f.useEffect(()=>{if(p){const E=S=>{S.key==="ArrowDown"?(S.preventDefault(),o(I=>(I+1)%m.length)):S.key==="ArrowUp"?(S.preventDefault(),o(I=>(I-1+m.length)%m.length)):S.key==="Enter"?(S.preventDefault(),m[h]&&x(m[h].value)):S.key==="Escape"&&d(!1)};return document.addEventListener("keydown",E),()=>{document.removeEventListener("keydown",E)}}},[p,m,h,x]),f.useEffect(()=>{p&&v.current[h]&&v.current[h]?.scrollIntoView({block:"nearest"})},[p,h]),f.useEffect(()=>{if(p){const E=e.findIndex(S=>!r&&S.value===t);o(E!==-1?E:0),g(""),u&&setTimeout(()=>b.current?.focus(),0)}},[p,u,e,t,r]);const w=E=>e.find(S=>S.value===E)?.label||String(E),j=()=>r&&Array.isArray(t)&&t.length>0?l.jsx("div",{className:"h-fit flex flex-wrap gap-1",children:t&&t.map(E=>l.jsx(vt,{variant:"input",onDelete:S=>{S.preventDefault(),S.stopPropagation(),x(E)},label:w(E)},String(E)))}):!r&&t!==void 0&&!Array.isArray(t)?w(t):l.jsx("span",{className:"text-on-surface-variant",children:s}),R=l.jsxs("div",{className:"flex flex-col",children:[u&&l.jsx(Qe,{ref:b,placeholder:"Search...",value:a,onChange:E=>g(E.target.value)}),l.jsx("ul",{className:"py-1 max-h-60 overflow-auto",children:m&&m.map((E,S)=>l.jsx(at,{ref:I=>{v.current[S]=I},isActive:h===S,onSelect:()=>x(E.value),children:r&&Array.isArray(t)?l.jsx(sn,{checked:t.includes(E.value),onChange:()=>x(E.value),label:E.label}):l.jsxs("div",{className:"flex items-center justify-between w-full",children:[l.jsx("span",{children:E.label}),t===E.value&&l.jsx(se.Check,{className:"h-4 w-4"})]})},String(E.value)))})]});return l.jsx(st,{fullWidth:!0,open:p,onOpenChange:d,className:C("w-full",i),placement:"bottom-start",trigger:l.jsxs("div",{className:C("flex items-center justify-between w-full rounded-lg transition duration-150 border border-outline-variant outline-none focus-visible:ring-primary/50 focus-visible:ring-[3px] px-1 py-1 min-h-10",c?"opacity-50 pointer-events-none":"cursor-pointer"),children:[l.jsx("div",{className:"grow w-full",children:j()}),l.jsx(se.ChevronDown,{className:C("w-5 h-5 text-on-surface-variant transition-transform duration-200",p&&"rotate-180")})]}),content:R})}function jn({isOpen:e,onClose:t,side:n="right",children:r,title:s,description:i,className:c}){const[u,p]=k.useState(e),[d,h]=k.useState(n);k.useEffect(()=>{e&&(p(!0),h(n))},[e,n]),k.useEffect(()=>{const a=g=>{g.key==="Escape"&&e&&t()};return e&&document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a)}},[e,t]);const o=a=>{!e&&a.animationName.toLowerCase().includes("sheetout")&&p(!1)};if(!u)return null;const v={top:"top-[1rem] inset-x-[1rem] border-b border-outline-variant animate-sheet-in-top data-[state=closed]:animate-sheet-out-top h-auto max-h-[80%]",bottom:"bottom-[1rem] inset-x-[1rem] border-t border-outline-variant animate-sheet-in-bottom data-[state=closed]:animate-sheet-out-bottom h-auto max-h-[80%]",left:"left-[1rem] inset-y-[1rem] border-r border-outline-variant animate-sheet-in-left data-[state=closed]:animate-sheet-out-left w-full sm:max-w-sm ml-0",right:"right-[1rem] inset-y-[1rem] border-l border-outline-variant animate-sheet-in-right data-[state=closed]:animate-sheet-out-right w-full sm:max-w-sm mr-0"};return Pe.createPortal(l.jsxs("div",{className:"fixed inset-0 z-50 overflow-hidden",children:[l.jsx("div",{className:C("absolute inset-0 bg-black/40 transition-opacity",e?"animate-overlay-in":"animate-overlay-out"),onClick:t,"aria-hidden":"true"}),l.jsx("div",{role:"dialog","aria-modal":"true","data-state":e?"open":"closed",onAnimationEnd:o,className:C("rounded-[1rem] absolute bg-surface p-6 shadow-2xl transition ease-in-out focus:outline-none",v[d],c),children:l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{className:"grow",children:[s&&l.jsx("h2",{className:"text-lg font-semibold text-on-surface leading-none mb-1",children:s}),i&&l.jsx("p",{className:"text-sm text-on-surface-variant font-normal",children:i})]}),l.jsx(Ie,{onClick:t,variant:"ghost",size:"icon","aria-label":"Close",children:l.jsx(se.X,{className:"h-5 w-5"})})]}),l.jsx("div",{className:"flex-1 overflow-y-auto",children:r})]})})]}),document.body)}function So({children:e,className:t}){return l.jsx("div",{className:C("flex flex-col space-y-2 mb-4",t),children:e})}function ko({children:e,className:t}){return l.jsx("div",{className:C("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 mt-4",t),children:e})}function To({children:e,className:t}){return l.jsx("h2",{className:C("text-lg font-semibold text-on-surface",t),children:e})}function Ao({children:e,className:t}){return l.jsx("p",{className:C("text-sm text-on-surface-variant",t),children:e})}function Oo({delay:e=0,className:t,...n}){const r=Math.floor(Math.random()*e);return l.jsx("div",{className:C("bg-primary animate-pulse rounded-lg",t),style:{animationDelay:`${r}ms`},...n})}function Do({className:e,...t}){return l.jsx(se.Loader2Icon,{role:"status","aria-label":"Loading",className:C("size-4 animate-spin",e),...t})}function _o({variant:e="online",text:t,ping:n=!1}){const r="flex flex-row gap-1 text-on-surface inline-flex items-center justify-center rounded-lg border border-outline-variant px-2 py-1 text-sm text-on-surface font-medium",s={online:"bg-green-500",offline:"bg-red-500",maintenance:"bg-blue-500",degraded:"bg-orange-500"};return l.jsx(l.Fragment,{children:t?l.jsxs("div",{className:C(r),children:[l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:C(s[e],"size-2 rounded-full")}),n&&l.jsx("div",{className:C(s[e],"size-2 rounded-full absolute left-0 top-0 animate-ping")})]}),l.jsx("span",{children:t})]}):l.jsxs("div",{className:"relative",children:[l.jsx("div",{className:C(s[e],"size-2 rounded-full")}),n&&l.jsx("div",{className:C(s[e],"size-2 rounded-full absolute left-0 top-0 animate-ping")})]})})}const Po=({tags:e,setTags:t,placeholder:n,suggestions:r=[]})=>{const[s,i]=f.useState(""),[c,u]=f.useState(!1),[p,d]=f.useState(0),h=f.useRef([]),o=m=>{i(m.target.value),m.target.value&&r.length>0?u(!0):u(!1)},v=m=>{m.key==="Enter"?(m.preventDefault(),b.length>0&&p>=0?g(b[p]):s.trim()!==""&&g(s.trim())):m.key==="Backspace"&&s===""&&e.length>0?t(e.slice(0,-1)):m.key==="ArrowDown"?(m.preventDefault(),d(w=>(w+1)%b.length)):m.key==="ArrowUp"&&(m.preventDefault(),d(w=>(w-1+b.length)%b.length))},a=m=>{t(e.filter(w=>w!==m))},g=m=>{t([...e,m]),i(""),u(!1),d(0)},b=f.useMemo(()=>r.filter(m=>m.toLowerCase().includes(s.toLowerCase())&&!e.includes(m)),[s,r,e]);f.useEffect(()=>{c&&h.current[p]&&h.current[p]?.scrollIntoView({block:"nearest"})},[c,p]);const x=l.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:b.map((m,w)=>l.jsx(at,{ref:j=>{h.current[w]=j},isActive:p===w,onSelect:()=>g(m),children:m},m))});return l.jsx(st,{open:c&&b.length>0,onOpenChange:u,className:"max-h-96 overflow-y-auto",trigger:l.jsxs("div",{className:"px-1 flex flex-wrap items-center gap-1 rounded-lg transition duration-150 disabled:opacity-50 disabled:pointer-events-none border border-outline-variant outline-none focus-visible:ring-primary/50 focus-visible:ring-[3px]",children:[l.jsx("div",{className:"h-fit flex flex-wrap gap-1",children:e.map(m=>l.jsx(vt,{variant:"input",onDelete:w=>{w.preventDefault(),w.stopPropagation(),a(m)},label:m},m))}),l.jsx(Qe,{type:"text",variant:"ghost",value:s,onChange:o,onKeyDown:v,placeholder:n||"Add a tag",style:{border:"none",outline:"none",flex:1,minWidth:"100px"}})]}),content:x})},Io=f.forwardRef(({label:e,className:t,variant:n="default",...r},s)=>{const i="w-full rounded-lg transition duration-150 disabled:opacity-50 disabled:pointer-events-none",c="p-3 text-base",u={default:"border border-outline-variant outline-none focus-visible:ring-primary/50 focus-visible:ring-[3px]",ghost:"border-none outline-none focus-visible:ring-0"};return l.jsxs("div",{children:[e&&l.jsx("label",{htmlFor:r.id,className:"block text-sm font-medium text-on-surface",children:e}),l.jsx("textarea",{ref:s,className:C(i,c,u[n],t),...r})]})});function Mo(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const Lo=e=>{switch(e){case"success":return Fo;case"info":return Vo;case"warning":return zo;case"error":return Ho;default:return null}},$o=Array(12).fill(0),Bo=({visible:e,className:t})=>f.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},f.createElement("div",{className:"sonner-spinner"},$o.map((n,r)=>f.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Fo=f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},f.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),zo=f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},f.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Vo=f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},f.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Ho=f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},f.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Yo=f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},f.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),f.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Wo=()=>{const[e,t]=f.useState(document.hidden);return f.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let gt=1;class Uo{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...s}=t,i=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:gt++,c=this.toasts.find(p=>p.id===i),u=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),c?this.toasts=this.toasts.map(p=>p.id===i?(this.publish({...p,...t,id:i,title:r}),{...p,...t,id:i,dismissible:u,title:r}):p):this.addToast({title:r,...s,dismissible:u,id:i}),i},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let i=r!==void 0,c;const u=s.then(async d=>{if(c=["resolve",d],f.isValidElement(d))i=!1,this.create({id:r,type:"default",message:d});else if(Xo(d)&&!d.ok){i=!1;const o=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,v=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,g=typeof o=="object"&&!f.isValidElement(o)?o:{message:o};this.create({id:r,type:"error",description:v,...g})}else if(d instanceof Error){i=!1;const o=typeof n.error=="function"?await n.error(d):n.error,v=typeof n.description=="function"?await n.description(d):n.description,g=typeof o=="object"&&!f.isValidElement(o)?o:{message:o};this.create({id:r,type:"error",description:v,...g})}else if(n.success!==void 0){i=!1;const o=typeof n.success=="function"?await n.success(d):n.success,v=typeof n.description=="function"?await n.description(d):n.description,g=typeof o=="object"&&!f.isValidElement(o)?o:{message:o};this.create({id:r,type:"success",description:v,...g})}}).catch(async d=>{if(c=["reject",d],n.error!==void 0){i=!1;const h=typeof n.error=="function"?await n.error(d):n.error,o=typeof n.description=="function"?await n.description(d):n.description,a=typeof h=="object"&&!f.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:o,...a})}}).finally(()=>{i&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),p=()=>new Promise((d,h)=>u.then(()=>c[0]==="reject"?h(c[1]):d(c[1])).catch(h));return typeof r!="string"&&typeof r!="number"?{unwrap:p}:Object.assign(r,{unwrap:p})},this.custom=(t,n)=>{const r=n?.id||gt++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const ee=new Uo,Go=(e,t)=>{const n=t?.id||gt++;return ee.addToast({title:e,...t,id:n}),n},Xo=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Ko=Go,qo=()=>ee.toasts,Jo=()=>ee.getActiveToasts(),Qo=Object.assign(Ko,{success:ee.success,info:ee.info,warning:ee.warning,error:ee.error,custom:ee.custom,message:ee.message,promise:ee.promise,dismiss:ee.dismiss,loading:ee.loading},{getHistory:qo,getToasts:Jo});Mo("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Ye(e){return e.label!==void 0}const Zo=3,es="24px",ts="16px",Xt=4e3,ns=356,rs=14,os=45,ss=200;function ue(...e){return e.filter(Boolean).join(" ")}function as(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const is=e=>{var t,n,r,s,i,c,u,p,d;const{invert:h,toast:o,unstyled:v,interacting:a,setHeights:g,visibleToasts:b,heights:x,index:m,toasts:w,expanded:j,removeToast:R,defaultRichColors:E,closeButton:S,style:I,cancelButtonStyle:_,actionButtonStyle:M,className:B="",descriptionClassName:Z="",duration:Q,position:Y,gap:W,expandByDefault:X,classNames:T,icons:L,closeButtonAriaLabel:P="Close toast"}=e,[V,H]=f.useState(null),[y,A]=f.useState(null),[N,O]=f.useState(!1),[F,K]=f.useState(!1),[z,$]=f.useState(!1),[ce,Ee]=f.useState(!1),[$e,je]=f.useState(!1),[Rn,it]=f.useState(0),[Sn,Nt]=f.useState(0),Oe=f.useRef(o.duration||Q||Xt),Ct=f.useRef(null),pe=f.useRef(null),kn=m===0,Tn=m+1<=b,te=o.type,Ne=o.dismissible!==!1,An=o.className||"",On=o.descriptionClassName||"",Be=f.useMemo(()=>x.findIndex(D=>D.toastId===o.id)||0,[x,o.id]),Dn=f.useMemo(()=>{var D;return(D=o.closeButton)!=null?D:S},[o.closeButton,S]),Rt=f.useMemo(()=>o.duration||Q||Xt,[o.duration,Q]),lt=f.useRef(0),Ce=f.useRef(0),St=f.useRef(0),Re=f.useRef(null),[_n,Pn]=Y.split("-"),kt=f.useMemo(()=>x.reduce((D,U,q)=>q>=Be?D:D+U.height,0),[x,Be]),Tt=Wo(),In=o.invert||h,ct=te==="loading";Ce.current=f.useMemo(()=>Be*W+kt,[Be,kt]),f.useEffect(()=>{Oe.current=Rt},[Rt]),f.useEffect(()=>{O(!0)},[]),f.useEffect(()=>{const D=pe.current;if(D){const U=D.getBoundingClientRect().height;return Nt(U),g(q=>[{toastId:o.id,height:U,position:o.position},...q]),()=>g(q=>q.filter(ne=>ne.toastId!==o.id))}},[g,o.id]),f.useLayoutEffect(()=>{if(!N)return;const D=pe.current,U=D.style.height;D.style.height="auto";const q=D.getBoundingClientRect().height;D.style.height=U,Nt(q),g(ne=>ne.find(G=>G.toastId===o.id)?ne.map(G=>G.toastId===o.id?{...G,height:q}:G):[{toastId:o.id,height:q,position:o.position},...ne])},[N,o.title,o.description,g,o.id,o.jsx,o.action,o.cancel]);const he=f.useCallback(()=>{K(!0),it(Ce.current),g(D=>D.filter(U=>U.toastId!==o.id)),setTimeout(()=>{R(o)},ss)},[o,R,g,Ce]);f.useEffect(()=>{if(o.promise&&te==="loading"||o.duration===1/0||o.type==="loading")return;let D;return j||a||Tt?(()=>{if(St.current<lt.current){const ne=new Date().getTime()-lt.current;Oe.current=Oe.current-ne}St.current=new Date().getTime()})():Oe.current!==1/0&&(lt.current=new Date().getTime(),D=setTimeout(()=>{o.onAutoClose==null||o.onAutoClose.call(o,o),he()},Oe.current)),()=>clearTimeout(D)},[j,a,o,te,Tt,he]),f.useEffect(()=>{o.delete&&(he(),o.onDismiss==null||o.onDismiss.call(o,o))},[he,o.delete]);function Mn(){var D;if(L?.loading){var U;return f.createElement("div",{className:ue(T?.loader,o==null||(U=o.classNames)==null?void 0:U.loader,"sonner-loader"),"data-visible":te==="loading"},L.loading)}return f.createElement(Bo,{className:ue(T?.loader,o==null||(D=o.classNames)==null?void 0:D.loader),visible:te==="loading"})}const Ln=o.icon||L?.[te]||Lo(te);var At,Ot;return f.createElement("li",{tabIndex:0,ref:pe,className:ue(B,An,T?.toast,o==null||(t=o.classNames)==null?void 0:t.toast,T?.default,T?.[te],o==null||(n=o.classNames)==null?void 0:n[te]),"data-sonner-toast":"","data-rich-colors":(At=o.richColors)!=null?At:E,"data-styled":!(o.jsx||o.unstyled||v),"data-mounted":N,"data-promise":!!o.promise,"data-swiped":$e,"data-removed":F,"data-visible":Tn,"data-y-position":_n,"data-x-position":Pn,"data-index":m,"data-front":kn,"data-swiping":z,"data-dismissible":Ne,"data-type":te,"data-invert":In,"data-swipe-out":ce,"data-swipe-direction":y,"data-expanded":!!(j||X&&N),"data-testid":o.testId,style:{"--index":m,"--toasts-before":m,"--z-index":w.length-m,"--offset":`${F?Rn:Ce.current}px`,"--initial-height":X?"auto":`${Sn}px`,...I,...o.style},onDragEnd:()=>{$(!1),H(null),Re.current=null},onPointerDown:D=>{D.button!==2&&(ct||!Ne||(Ct.current=new Date,it(Ce.current),D.target.setPointerCapture(D.pointerId),D.target.tagName!=="BUTTON"&&($(!0),Re.current={x:D.clientX,y:D.clientY})))},onPointerUp:()=>{var D,U,q;if(ce||!Ne)return;Re.current=null;const ne=Number(((D=pe.current)==null?void 0:D.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Fe=Number(((U=pe.current)==null?void 0:U.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),G=new Date().getTime()-((q=Ct.current)==null?void 0:q.getTime()),oe=V==="x"?ne:Fe,ze=Math.abs(oe)/G;if(Math.abs(oe)>=os||ze>.11){it(Ce.current),o.onDismiss==null||o.onDismiss.call(o,o),A(V==="x"?ne>0?"right":"left":Fe>0?"down":"up"),he(),Ee(!0);return}else{var ae,ie;(ae=pe.current)==null||ae.style.setProperty("--swipe-amount-x","0px"),(ie=pe.current)==null||ie.style.setProperty("--swipe-amount-y","0px")}je(!1),$(!1),H(null)},onPointerMove:D=>{var U,q,ne;if(!Re.current||!Ne||((U=window.getSelection())==null?void 0:U.toString().length)>0)return;const G=D.clientY-Re.current.y,oe=D.clientX-Re.current.x;var ze;const ae=(ze=e.swipeDirections)!=null?ze:as(Y);!V&&(Math.abs(oe)>1||Math.abs(G)>1)&&H(Math.abs(oe)>Math.abs(G)?"x":"y");let ie={x:0,y:0};const Dt=be=>1/(1.5+Math.abs(be)/20);if(V==="y"){if(ae.includes("top")||ae.includes("bottom"))if(ae.includes("top")&&G<0||ae.includes("bottom")&&G>0)ie.y=G;else{const be=G*Dt(G);ie.y=Math.abs(be)<Math.abs(G)?be:G}}else if(V==="x"&&(ae.includes("left")||ae.includes("right")))if(ae.includes("left")&&oe<0||ae.includes("right")&&oe>0)ie.x=oe;else{const be=oe*Dt(oe);ie.x=Math.abs(be)<Math.abs(oe)?be:oe}(Math.abs(ie.x)>0||Math.abs(ie.y)>0)&&je(!0),(q=pe.current)==null||q.style.setProperty("--swipe-amount-x",`${ie.x}px`),(ne=pe.current)==null||ne.style.setProperty("--swipe-amount-y",`${ie.y}px`)}},Dn&&!o.jsx&&te!=="loading"?f.createElement("button",{"aria-label":P,"data-disabled":ct,"data-close-button":!0,onClick:ct||!Ne?()=>{}:()=>{he(),o.onDismiss==null||o.onDismiss.call(o,o)},className:ue(T?.closeButton,o==null||(r=o.classNames)==null?void 0:r.closeButton)},(Ot=L?.close)!=null?Ot:Yo):null,(te||o.icon||o.promise)&&o.icon!==null&&(L?.[te]!==null||o.icon)?f.createElement("div",{"data-icon":"",className:ue(T?.icon,o==null||(s=o.classNames)==null?void 0:s.icon)},o.promise||o.type==="loading"&&!o.icon?o.icon||Mn():null,o.type!=="loading"?Ln:null):null,f.createElement("div",{"data-content":"",className:ue(T?.content,o==null||(i=o.classNames)==null?void 0:i.content)},f.createElement("div",{"data-title":"",className:ue(T?.title,o==null||(c=o.classNames)==null?void 0:c.title)},o.jsx?o.jsx:typeof o.title=="function"?o.title():o.title),o.description?f.createElement("div",{"data-description":"",className:ue(Z,On,T?.description,o==null||(u=o.classNames)==null?void 0:u.description)},typeof o.description=="function"?o.description():o.description):null),f.isValidElement(o.cancel)?o.cancel:o.cancel&&Ye(o.cancel)?f.createElement("button",{"data-button":!0,"data-cancel":!0,style:o.cancelButtonStyle||_,onClick:D=>{Ye(o.cancel)&&Ne&&(o.cancel.onClick==null||o.cancel.onClick.call(o.cancel,D),he())},className:ue(T?.cancelButton,o==null||(p=o.classNames)==null?void 0:p.cancelButton)},o.cancel.label):null,f.isValidElement(o.action)?o.action:o.action&&Ye(o.action)?f.createElement("button",{"data-button":!0,"data-action":!0,style:o.actionButtonStyle||M,onClick:D=>{Ye(o.action)&&(o.action.onClick==null||o.action.onClick.call(o.action,D),!D.defaultPrevented&&he())},className:ue(T?.actionButton,o==null||(d=o.classNames)==null?void 0:d.actionButton)},o.action.label):null)};function Kt(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function ls(e,t){const n={};return[e,t].forEach((r,s)=>{const i=s===1,c=i?"--mobile-offset":"--offset",u=i?ts:es;function p(d){["top","right","bottom","left"].forEach(h=>{n[`${c}-${h}`]=typeof d=="number"?`${d}px`:d})}typeof r=="number"||typeof r=="string"?p(r):typeof r=="object"?["top","right","bottom","left"].forEach(d=>{r[d]===void 0?n[`${c}-${d}`]=u:n[`${c}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):p(u)}),n}const cs=f.forwardRef(function(t,n){const{id:r,invert:s,position:i="bottom-right",hotkey:c=["altKey","KeyT"],expand:u,closeButton:p,className:d,offset:h,mobileOffset:o,theme:v="light",richColors:a,duration:g,style:b,visibleToasts:x=Zo,toastOptions:m,dir:w=Kt(),gap:j=rs,icons:R,containerAriaLabel:E="Notifications"}=t,[S,I]=f.useState([]),_=f.useMemo(()=>r?S.filter(N=>N.toasterId===r):S.filter(N=>!N.toasterId),[S,r]),M=f.useMemo(()=>Array.from(new Set([i].concat(_.filter(N=>N.position).map(N=>N.position)))),[_,i]),[B,Z]=f.useState([]),[Q,Y]=f.useState(!1),[W,X]=f.useState(!1),[T,L]=f.useState(v!=="system"?v:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),P=f.useRef(null),V=c.join("+").replace(/Key/g,"").replace(/Digit/g,""),H=f.useRef(null),y=f.useRef(!1),A=f.useCallback(N=>{I(O=>{var F;return(F=O.find(K=>K.id===N.id))!=null&&F.delete||ee.dismiss(N.id),O.filter(({id:K})=>K!==N.id)})},[]);return f.useEffect(()=>ee.subscribe(N=>{if(N.dismiss){requestAnimationFrame(()=>{I(O=>O.map(F=>F.id===N.id?{...F,delete:!0}:F))});return}setTimeout(()=>{Pe.flushSync(()=>{I(O=>{const F=O.findIndex(K=>K.id===N.id);return F!==-1?[...O.slice(0,F),{...O[F],...N},...O.slice(F+1)]:[N,...O]})})})}),[S]),f.useEffect(()=>{if(v!=="system"){L(v);return}if(v==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?L("dark"):L("light")),typeof window>"u")return;const N=window.matchMedia("(prefers-color-scheme: dark)");try{N.addEventListener("change",({matches:O})=>{L(O?"dark":"light")})}catch{N.addListener(({matches:F})=>{try{L(F?"dark":"light")}catch(K){console.error(K)}})}},[v]),f.useEffect(()=>{S.length<=1&&Y(!1)},[S]),f.useEffect(()=>{const N=O=>{var F;if(c.every($=>O[$]||O.code===$)){var z;Y(!0),(z=P.current)==null||z.focus()}O.code==="Escape"&&(document.activeElement===P.current||(F=P.current)!=null&&F.contains(document.activeElement))&&Y(!1)};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[c]),f.useEffect(()=>{if(P.current)return()=>{H.current&&(H.current.focus({preventScroll:!0}),H.current=null,y.current=!1)}},[P.current]),f.createElement("section",{ref:n,"aria-label":`${E} ${V}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((N,O)=>{var F;const[K,z]=N.split("-");return _.length?f.createElement("ol",{key:N,dir:w==="auto"?Kt():w,tabIndex:-1,ref:P,className:d,"data-sonner-toaster":!0,"data-sonner-theme":T,"data-y-position":K,"data-x-position":z,style:{"--front-toast-height":`${((F=B[0])==null?void 0:F.height)||0}px`,"--width":`${ns}px`,"--gap":`${j}px`,...b,...ls(h,o)},onBlur:$=>{y.current&&!$.currentTarget.contains($.relatedTarget)&&(y.current=!1,H.current&&(H.current.focus({preventScroll:!0}),H.current=null))},onFocus:$=>{$.target instanceof HTMLElement&&$.target.dataset.dismissible==="false"||y.current||(y.current=!0,H.current=$.relatedTarget)},onMouseEnter:()=>Y(!0),onMouseMove:()=>Y(!0),onMouseLeave:()=>{W||Y(!1)},onDragEnd:()=>Y(!1),onPointerDown:$=>{$.target instanceof HTMLElement&&$.target.dataset.dismissible==="false"||X(!0)},onPointerUp:()=>X(!1)},_.filter($=>!$.position&&O===0||$.position===N).map(($,ce)=>{var Ee,$e;return f.createElement(is,{key:$.id,icons:R,index:ce,toast:$,defaultRichColors:a,duration:(Ee=m?.duration)!=null?Ee:g,className:m?.className,descriptionClassName:m?.descriptionClassName,invert:s,visibleToasts:x,closeButton:($e=m?.closeButton)!=null?$e:p,interacting:W,position:N,style:m?.style,unstyled:m?.unstyled,classNames:m?.classNames,cancelButtonStyle:m?.cancelButtonStyle,actionButtonStyle:m?.actionButtonStyle,closeButtonAriaLabel:m?.closeButtonAriaLabel,removeToast:A,toasts:_.filter(je=>je.position==$.position),heights:B.filter(je=>je.position==$.position),setHeights:Z,expandByDefault:u,gap:j,expanded:Q,swipeDirections:t.swipeDirections})})):null}))});function us(){return l.jsx(cs,{richColors:!0,position:"bottom-right"})}function ds({children:e,content:t,className:n,placement:r="bottom"}){return l.jsx(st,{trigger:e,content:t,onHover:!0,placement:r,className:C("px-2 py-1 text-sm pointer-events-none",n)})}function fs({groups:e,items:t,open:n,onOpenChange:r}){const[s,i]=f.useState(!1),c=n!==void 0?n:s,u=r!==void 0?r:i,[p,d]=f.useState(!1),[h,o]=f.useState(!1),[v,a]=f.useState(""),[g,b]=f.useState(0),x=f.useRef([]),m=f.useRef(null),w=f.useMemo(()=>e||(t?[{id:"default",heading:"",items:t}]:[]),[e,t]),j=f.useMemo(()=>v?w.map(_=>({..._,items:_.items.filter(M=>M.title.toLowerCase().includes(v.toLowerCase()))})).filter(_=>_.items.length>0):w,[v,w]),R=f.useMemo(()=>j.flatMap(_=>_.items),[j]),E=f.useCallback(()=>{o(!1),setTimeout(()=>{u(!1),d(!1)},200)},[u]),S=f.useCallback(_=>{_.onSelect(),E()},[E]);if(f.useEffect(()=>{const _=M=>{if(M.key==="k"&&(M.metaKey||M.ctrlKey)&&(M.preventDefault(),c?E():u(!0)),c){if(M.key==="Escape")E();else if(M.key==="ArrowDown")M.preventDefault(),b(B=>(B+1)%R.length);else if(M.key==="ArrowUp")M.preventDefault(),b(B=>(B-1+R.length)%R.length);else if(M.key==="Enter"){M.preventDefault();const B=R[g];B&&S(B)}}};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[c,g,R,E,S,u]),f.useEffect(()=>{c&&d(!0)},[c]),f.useEffect(()=>{p&&(requestAnimationFrame(()=>{o(!0),m.current?.focus()}),b(0),a(""))},[p]),f.useEffect(()=>{b(0)},[v]),f.useEffect(()=>(p?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[p]),f.useEffect(()=>{p&&x.current[g]&&x.current[g]?.scrollIntoView({block:"nearest"})},[p,g]),!p)return null;let I=-1;return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:C("fixed inset-0 bg-black/50 bg-opacity-50 backdrop-blur-sm z-40 transition-opacity duration-200",h?"opacity-100":"opacity-0"),onClick:E}),l.jsx("div",{className:"fixed inset-0 flex items-start justify-center z-50 p-4 pt-24",onClick:E,children:l.jsxs("div",{className:C("bg-surface border border-outline rounded-lg shadow-lg max-w-lg w-full relative transition-all duration-200 ease-out",h?"opacity-100 translate-y-0":"opacity-0 translate-y-12"),onClick:_=>_.stopPropagation(),children:[l.jsxs("div",{className:"relative p-4",children:[l.jsx(se.Search,{className:"absolute left-7 top-1/2 -translate-y-1/2 w-4 h-4 text-on-surface/50"}),l.jsx(Qe,{ref:m,placeholder:"Search...",className:"pl-9 w-full",value:v,onChange:_=>a(_.target.value)})]}),l.jsx("div",{className:"p-4 pt-0 max-h-[400px] overflow-y-auto",children:R.length>0?l.jsx("ul",{children:j.map(_=>l.jsxs("li",{children:[_.heading&&l.jsx("p",{className:"text-sm text-on-surface/75 px-2 pb-2 pt-4",children:_.heading}),l.jsx("ul",{children:_.items.map(M=>{I++;const B=I;return l.jsx(at,{ref:Z=>{x.current[B]=Z},isActive:g===B,onSelect:()=>S(M),children:l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("p",{children:M.title}),M.description&&l.jsx("p",{className:"text-xs opacity-75",children:M.description})]})},M.id)})})]},_.id))}):l.jsx("p",{className:"text-center text-sm text-on-surface/75 py-4",children:"No results found."})})]})})]})}const Nn=f.createContext(null),ms=()=>{const e=f.useContext(Nn);if(!e)throw new Error("useNavigation must be used within a NavHost");return e};class Cn{routes={};screen(t,n,r){this.routes[t]={path:t,component:n,type:"screen",...r}}dialog(t,n,r){this.routes[t]={path:t,component:n,type:"dialog",...r}}bottomSheet(t,n,r){this.routes[t]={path:t,component:n,type:"bottomSheet",...r}}sheet(t,n,r){this.routes[t]={path:t,component:n,type:"sheet",side:r?.side||"right",title:r?.title,description:r?.description,className:r?.className,canActivate:r?.canActivate,canDeactivate:r?.canDeactivate}}list(t,n){this.routes[t]={path:t,type:"list",title:n.title,description:n.description,listOptions:{columns:n.columns,data:n.data},canActivate:n.canActivate,canDeactivate:n.canDeactivate}}}const ps=({startDestination:e,builder:t})=>{const n=f.useMemo(()=>{const a=new Cn;return t(a),a.routes},[t]),r=a=>{const g=window.location.pathname.slice(1);return a[g]?g:null},s=()=>{const a=new URLSearchParams(window.location.search),g={};return a.forEach((b,x)=>{b&&!isNaN(Number(b))&&!b.startsWith("0")?g[x]=Number(b):b==="true"?g[x]=!0:b==="false"?g[x]=!1:g[x]=b}),g},i=f.useCallback((a,g)=>{const b=new URL(window.location.href);b.pathname=`/${a}`,b.search="",g&&Object.entries(g).forEach(([x,m])=>{m!=null&&b.searchParams.set(x,String(m))}),window.location.pathname+window.location.search!==b.pathname+b.search&&window.history.pushState({path:a,params:g},"",b.toString())},[]),[c,u]=f.useState(()=>{const a=r(n)||e,g=s();return[{id:"root",path:a,params:g,config:n[a]}]}),p=f.useCallback((a,g)=>{const b=n[a];if(!b){console.warn(`Internal navigate: Route ${a} not found`);return}(b.type==="screen"||b.type==="list")&&i(a,g),u(x=>[...x,{id:Date.now().toString(),path:a,params:g,config:b}])},[n,i,u]);f.useEffect(()=>{const a=async()=>{const g=r(n)||e,b=s(),x=c[c.length-1];if((x.path!==g||JSON.stringify(x.params)!==JSON.stringify(b))&&x.config.canDeactivate){for(const m of x.config.canDeactivate)if(!await m(x.params,p)){i(x.path,x.params);return}}u(m=>{const w=m[m.length-1];if(w.path===g&&JSON.stringify(w.params)===JSON.stringify(b))return m;let j=-1;for(let R=m.length-1;R>=0;R--)if(m[R].path===g&&JSON.stringify(m[R].params)===JSON.stringify(b)){j=R;break}if(j!==-1){if(j===m.length-2){const R=m[m.length-1],E=[...m];return E[m.length-1]={...R,isExiting:!0},setTimeout(()=>{u(S=>S.filter(I=>I.id!==R.id))},350),E}return m.slice(0,j+1)}return[...m,{id:Date.now().toString(),path:g,params:b,config:n[g]}]})};return window.addEventListener("popstate",a),()=>window.removeEventListener("popstate",a)},[n,e,c,p,i]);const d=async(a,g)=>{const b=n[a];if(!b){console.warn(`Route ${a} not found`);return}if(b.canActivate){for(const x of b.canActivate)if(!await x(g,p))return}(b.type==="screen"||b.type==="list")&&i(a,g),u(x=>[...x,{id:Date.now().toString(),path:a,params:g,config:b}])},h=async()=>{const a=c[c.length-1];if(!(!a||a.isExiting||c.length<=1)){if(a.config.canDeactivate){for(const g of a.config.canDeactivate)if(!await g(a.params,p))return}a.config.type==="screen"||a.config.type==="list"?window.history.back():(u(g=>{const b=[...g],x=b.findIndex(m=>m.id===a.id);return x!==-1&&(b[x]={...b[x],isExiting:!0}),b}),setTimeout(()=>{u(g=>g.filter(b=>b.id!==a.id))},350))}},o=f.useMemo(()=>{let a=0;for(let x=c.length-1;x>=0;x--)if((c[x].config.type==="screen"||c[x].config.type==="list")&&!c[x].isExiting){a=x;break}let g=-1;for(let x=a-1;x>=0;x--)if(c[x].config.type==="screen"||c[x].config.type==="list"){g=x;break}const b=g!==-1?g:a;return c.slice(Math.max(0,b))},[c]),v=a=>a.isExiting?"animate-page-out":a.id===c[0].id?"":"animate-page-in";return l.jsx(Nn.Provider,{value:{navigate:d,popBackStack:h,currentRoute:c[c.length-1].path},children:l.jsx("div",{style:{position:"relative",width:"100%",height:"100vh",overflow:"clip"},children:o.map((a,g)=>{const b=a.config.component;return a.config.type==="list"&&a.config.listOptions?l.jsx("div",{className:`screen-wrapper shadow-2xl ${v(a)}`,style:{position:"absolute",inset:0,background:"var(--color-surface)",overflowY:"auto"},children:l.jsxs("div",{className:"p-8 max-w-7xl mx-auto space-y-6",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-3xl font-bold text-on-surface",children:a.config.title}),a.config.description&&l.jsx("p",{className:"mt-2 text-on-surface-variant",children:a.config.description})]}),l.jsx(cn,{columns:a.config.listOptions.columns,data:a.config.listOptions.data})]})},a.id):b?a.config.type==="screen"?l.jsx("div",{className:`screen-wrapper shadow-2xl ${v(a)}`,style:{position:"absolute",inset:0,background:"var(--color-surface)",overflowY:"auto"},children:l.jsx(b,{...a.params})},a.id):a.config.type==="dialog"?Pe.createPortal(l.jsxs("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:100+g},children:[l.jsx("div",{className:a.isExiting?"animate-overlay-out":"animate-overlay-in",style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"},onClick:h}),l.jsx(on,{className:`max-w-2xl w-full mx-4 shadow-2xl ${a.isExiting?"animate-dialog-out":"animate-dialog-in"}`,children:l.jsx(b,{...a.params})})]},a.id),document.body):a.config.type==="bottomSheet"?Pe.createPortal(l.jsxs("div",{style:{position:"fixed",inset:0,zIndex:100+g},children:[l.jsx("div",{className:a.isExiting?"animate-overlay-out":"animate-overlay-in",style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"},onClick:h}),l.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,background:"var(--color-surface)",padding:20,borderTopLeftRadius:16,borderTopRightRadius:16,boxShadow:"0 -4px 16px rgba(0,0,0,0.1)"},className:a.isExiting?"animate-dialog-out":"animate-dialog-in",children:l.jsx(b,{...a.params})})]},a.id),document.body):a.config.type==="sheet"?l.jsx(jn,{isOpen:!a.isExiting,onClose:h,side:a.config.side,title:a.params?.title||a.config.title,description:a.params?.description||a.config.description,className:g>0?`z-[${g*10+50}] ${a.config.className||""}`:a.config.className,children:l.jsx(b,{...a.params})},a.id):null:null})})})},hs=()=>{const[e,t]=f.useState(null),[n,r]=f.useState(null),[s,i]=f.useState(!1),c=f.useCallback(d=>new Promise(h=>{t(d),i(!0),r(()=>h)}),[]),u=f.useCallback(()=>{i(!1),setTimeout(()=>{n&&n(),t(null)},200)},[n]),p=f.useCallback(()=>e?l.jsx(nn,{open:s,onClose:u,...e}):null,[e,s,u]);return{alert:c,AlertDialog:p}},gs=()=>{const[e,t]=f.useState(null),[n,r]=f.useState(null),[s,i]=f.useState(!1),c=f.useCallback(h=>new Promise(o=>{t(h),i(!0),r(()=>o)}),[]),u=f.useCallback(()=>{i(!1),setTimeout(()=>{n&&n(!1),t(null)},200)},[n]),p=f.useCallback(()=>{i(!1),setTimeout(()=>{n&&n(!0),t(null)},200)},[n]),d=f.useCallback(()=>e?l.jsx(an,{open:s,onClose:u,onConfirm:p,...e}):null,[e,s,u,p]);return{confirm:c,ConfirmationDialog:d}};function xs(){return{toast:Qo}}exports.Accordion=Hn;exports.AccordionContent=Un;exports.AccordionItem=Yn;exports.AccordionTrigger=Wn;exports.Alert=nn;exports.Alignment=Se;exports.Button=Ie;exports.ButtonGroup=Xn;exports.ButtonGroupSeparator=qn;exports.ButtonGroupText=Kn;exports.Card=on;exports.Checkbox=sn;exports.Chip=vt;exports.CommandMenu=fs;exports.CommandMenuItem=at;exports.Confirm=an;exports.CopyButton=Jn;exports.DataTable=cn;exports.Dialog=xt;exports.FloatingActionButton=Zn;exports.Input=Qe;exports.Item=er;exports.NavHost=ps;exports.Pagination=tr;exports.PaginationContent=nr;exports.PaginationEllipsis=ar;exports.PaginationItem=rr;exports.PaginationLink=yt;exports.PaginationNext=sr;exports.PaginationPrevious=or;exports.Popover=st;exports.RouteBuilder=Cn;exports.Select=Ro;exports.Separator=rn;exports.Sheet=jn;exports.SheetDescription=Ao;exports.SheetFooter=ko;exports.SheetHeader=So;exports.SheetTitle=To;exports.Skeleton=Oo;exports.Spinner=Do;exports.Status=_o;exports.TagInput=Po;exports.Textarea=Io;exports.Toaster=us;exports.Tooltip=ds;exports.buttonVariants=bt;exports.cn=Je;exports.getHeaderGroups=ln;exports.useAlert=hs;exports.useConfirm=gs;exports.useNavigation=ms;exports.useToast=xs;