@arturoliveira/vesta-ui 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),cs=require("clsx"),ls=require("tailwind-merge"),v=require("react"),us=require("react-dom"),te=require("lucide-react"),_=require("@ark-ui/react");function x(...e){return ls.twMerge(cs.clsx(e))}const Ft={variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}};function it({className:e,variant:t="default",size:n="default",children:s,loading:r=!1,disabled:o,...c}){return h.jsxs("button",{className:x("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium","ring-offset-background transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",Ft.variant[t],Ft.size[n],e),disabled:o||r,...c,children:[r&&h.jsxs("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[h.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),h.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),s]})}function ds({className:e,...t}){return h.jsx("div",{className:x("rounded-lg border border-border bg-card text-card-foreground",e),...t})}function fs({className:e,...t}){return h.jsx("div",{className:x("flex flex-col space-y-1.5 p-6",e),...t})}function hs({className:e,...t}){return h.jsx("h3",{className:x("text-2xl font-semibold leading-none tracking-tight",e),...t})}function ps({className:e,...t}){return h.jsx("p",{className:x("text-sm text-muted-foreground",e),...t})}function gs({className:e,...t}){return h.jsx("div",{className:x("p-6 pt-0",e),...t})}function ms({className:e,...t}){return h.jsx("div",{className:x("flex items-center p-6 pt-0",e),...t})}function ys(e,t){return`${e} returned \`undefined\`. Seems you forgot to wrap component within ${t}`}function Z(e={}){const{name:t,strict:n=!0,hookName:s="useContext",providerName:r="Provider",errorMessage:o,defaultValue:c}=e,i=v.createContext(c);i.displayName=t;function u(){var l;const a=v.useContext(i);if(!a&&n){const d=new Error(o??ys(s,r));throw d.name="ContextError",(l=Error.captureStackTrace)==null||l.call(Error,d,u),d}return a}return[i.Provider,u,i]}const[vs,Ye]=Z({name:"CheckboxContext",hookName:"useCheckboxContext",providerName:"<CheckboxProvider />"}),bs=Symbol(),bt=Symbol(),we="a",on="f",Mt="p",an="c",cn="t",ln="h",Ve="w",un="o",dn="k";let Es=(e,t)=>new Proxy(e,t);const at=Object.getPrototypeOf,ct=new WeakMap,fn=e=>e&&(ct.has(e)?ct.get(e):at(e)===Object.prototype||at(e)===Array.prototype),_t=e=>typeof e=="object"&&e!==null,xs=e=>Object.values(Object.getOwnPropertyDescriptors(e)).some(t=>!t.configurable&&!t.writable),Ts=e=>{if(Array.isArray(e))return Array.from(e);const t=Object.getOwnPropertyDescriptors(e);return Object.values(t).forEach(n=>{n.configurable=!0}),Object.create(at(e),t)},Cs=(e,t)=>{const n={[on]:t};let s=!1;const r=(i,u)=>{if(!s){let a=n[we].get(e);if(a||(a={},n[we].set(e,a)),i===Ve)a[Ve]=!0;else{let l=a[i];l||(l=new Set,a[i]=l),l.add(u)}}},o=()=>{s=!0,n[we].delete(e)},c={get(i,u){return u===bt?e:(r(dn,u),pn(Reflect.get(i,u),n[we],n[an],n[cn]))},has(i,u){return u===bs?(o(),!0):(r(ln,u),Reflect.has(i,u))},getOwnPropertyDescriptor(i,u){return r(un,u),Reflect.getOwnPropertyDescriptor(i,u)},ownKeys(i){return r(Ve),Reflect.ownKeys(i)}};return t&&(c.set=c.deleteProperty=()=>!1),[c,n]},hn=e=>e[bt]||e,pn=(e,t,n,s)=>{if(!fn(e))return e;let r=s&&s.get(e);if(!r){const u=hn(e);xs(u)?r=[u,Ts(u)]:r=[u],s==null||s.set(e,r)}const[o,c]=r;let i=n&&n.get(o);return(!i||i[1][on]!==!!c)&&(i=Cs(o,!!c),i[1][Mt]=Es(c||o,i[0]),n&&n.set(o,i)),i[1][we]=t,i[1][an]=n,i[1][cn]=s,i[1][Mt]},ws=(e,t)=>{const n=Reflect.ownKeys(e),s=Reflect.ownKeys(t);return n.length!==s.length||n.some((r,o)=>r!==s[o])},gn=(e,t,n,s,r=Object.is)=>{if(r(e,t))return!1;if(!_t(e)||!_t(t))return!0;const o=n.get(hn(e));if(!o)return!0;if(s){if(s.get(e)===t)return!1;s.set(e,t)}let c=null;for(const i of o[ln]||[])if(c=Reflect.has(e,i)!==Reflect.has(t,i),c)return c;if(o[Ve]===!0){if(c=ws(e,t),c)return c}else for(const i of o[un]||[]){const u=!!Reflect.getOwnPropertyDescriptor(e,i),a=!!Reflect.getOwnPropertyDescriptor(t,i);if(c=u!==a,c)return c}for(const i of o[dn]||[])if(c=gn(e[i],t[i],n,s,r),c)return c;if(c===null)throw new Error("invalid used");return c},Ns=e=>fn(e)&&e[bt]||null,Bt=(e,t=!0)=>{ct.set(e,t)};function Ps(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function Et(e,t){const n=Ps();return n?(n[e]||(n[e]=t()),n[e]):t()}var Ne=Et("__zag__refSet",()=>new WeakSet),Ss=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,Os=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,ks=e=>typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeName=="string",Is=e=>Ss(e)||Os(e)||ks(e),lt=e=>e!==null&&typeof e=="object",ut=e=>lt(e)&&!Ne.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!Is(e)&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer)&&!(e instanceof Promise),Ke=()=>process.env.NODE_ENV!=="production";function $t(e,t,n){typeof n.value=="object"&&!ut(n.value)&&(n.value=ae(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||t==="__proto__"?Object.defineProperty(e,t,n):e[t]=n.value}function ae(e){if(typeof e!="object")return e;var t=0,n,s,r,o=Object.prototype.toString.call(e);if(o==="[object Object]"?r=Object.create(Object.getPrototypeOf(e)||null):o==="[object Array]"?r=Array(e.length):o==="[object Set]"?(r=new Set,e.forEach(function(c){r.add(ae(c))})):o==="[object Map]"?(r=new Map,e.forEach(function(c,i){r.set(ae(i),ae(c))})):o==="[object Date]"?r=new Date(+e):o==="[object RegExp]"?r=new RegExp(e.source,e.flags):o==="[object DataView]"?r=new e.constructor(ae(e.buffer)):o==="[object ArrayBuffer]"?r=e.slice(0):o==="[object Blob]"?r=e.slice():o.slice(-6)==="Array]"&&(r=new e.constructor(e)),r){for(s=Object.getOwnPropertySymbols(e);t<s.length;t++)$t(r,s[t],Object.getOwnPropertyDescriptor(e,s[t]));for(t=0,s=Object.getOwnPropertyNames(e);t<s.length;t++)Object.hasOwnProperty.call(r,n=s[t])&&r[n]===e[n]||$t(r,n,Object.getOwnPropertyDescriptor(e,n))}return r||e}var ie=Et("__zag__proxyStateMap",()=>new WeakMap),Ds=(e=Object.is,t=(i,u)=>new Proxy(i,u),n=new WeakMap,s=(i,u)=>{const a=n.get(i);if((a==null?void 0:a[0])===u)return a[1];const l=Array.isArray(i)?[]:Object.create(Object.getPrototypeOf(i));return Bt(l,!0),n.set(i,[u,l]),Reflect.ownKeys(i).forEach(d=>{const f=Reflect.get(i,d);Ne.has(f)?(Bt(f,!1),l[d]=f):ie.has(f)?l[d]=ne(f):l[d]=f}),Object.freeze(l)},r=new WeakMap,o=[1,1],c=i=>{if(!lt(i))throw new Error("object required");const u=r.get(i);if(u)return u;let a=o[0];const l=new Set,d=(E,T=++o[0])=>{a!==T&&(a=T,l.forEach(S=>S(E,T)))};let f=o[1];const p=(E=++o[1])=>(f!==E&&!l.size&&(f=E,m.forEach(([T])=>{const S=T[1](E);S>a&&(a=S)})),a),g=E=>(T,S)=>{const j=[...T];j[1]=[E,...j[1]],d(j,S)},m=new Map,N=(E,T)=>{if(Ke()&&m.has(E))throw new Error("prop listener already exists");if(l.size){const S=T[3](g(E));m.set(E,[T,S])}else m.set(E,[T])},b=E=>{var S;const T=m.get(E);T&&(m.delete(E),(S=T[1])==null||S.call(T))},O=E=>(l.add(E),l.size===1&&m.forEach(([S,j],J)=>{if(Ke()&&j)throw new Error("remove already exists");const Q=S[3](g(J));m.set(J,[S,Q])}),()=>{l.delete(E),l.size===0&&m.forEach(([S,j],J)=>{j&&(j(),m.set(J,[S]))})}),C=Array.isArray(i)?[]:Object.create(Object.getPrototypeOf(i)),P=t(C,{deleteProperty(E,T){const S=Reflect.get(E,T);b(T);const j=Reflect.deleteProperty(E,T);return j&&d(["delete",[T],S]),j},set(E,T,S,j){var Lt;const J=Reflect.has(E,T),Q=Reflect.get(E,T,j);if(J&&(e(Q,S)||r.has(S)&&e(Q,r.get(S))))return!0;b(T),lt(S)&&(S=Ns(S)||S);let Le=S;if(!((Lt=Object.getOwnPropertyDescriptor(E,T))!=null&&Lt.set)){!ie.has(S)&&ut(S)&&(Le=xt(S));const jt=!Ne.has(Le)&&ie.get(Le);jt&&N(T,jt)}return Reflect.set(E,T,Le,j),d(["set",[T],S,Q]),!0}});r.set(i,P);const D=[C,p,s,O];return ie.set(P,D),Reflect.ownKeys(i).forEach(E=>{const T=Object.getOwnPropertyDescriptor(i,E);T.get||T.set?Object.defineProperty(C,E,T):P[E]=i[E]}),P})=>[c,ie,Ne,e,t,ut,n,s,r,o],[As]=Ds();function xt(e={}){return As(e)}function We(e,t,n){const s=ie.get(e);Ke()&&!s&&console.warn("Please use proxy object");let r;const o=[],c=s[3];let i=!1;const a=c(l=>{if(o.push(l),n){t(o.splice(0));return}r||(r=Promise.resolve().then(()=>{r=void 0,i&&t(o.splice(0))}))});return i=!0,()=>{i=!1,a()}}function ne(e){const t=ie.get(e);Ke()&&!t&&console.warn("Please use proxy object");const[n,s,r]=t;return r(n,s())}function ke(e){return Ne.add(e),e}function Rs(e,t){Object.keys(t).forEach(r=>{if(Object.getOwnPropertyDescriptor(e,r))throw new Error("object property already defined");const o=t[r],{get:c,set:i}=typeof o=="function"?{get:o}:o,u={};u.get=()=>c(ne(s)),i&&(u.set=a=>i(s,a)),Object.defineProperty(e,r,u)});const s=xt(e);return s}function Ls(e){for(;e.length>0;)e.pop();return e}var Ht=e=>(e==null?void 0:e.constructor.name)==="Array",js=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Tt(e[n],t[n]))return!1;return!0},Tt=(e,t)=>{if(Object.is(e,t))return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(typeof(e==null?void 0:e.isEqual)=="function"&&typeof(t==null?void 0:t.isEqual)=="function")return e.isEqual(t);if(typeof e=="function"&&typeof t=="function")return e.toString()===t.toString();if(Ht(e)&&Ht(t))return js(Array.from(e),Array.from(t));if(typeof e!="object"||typeof t!="object")return!1;const n=Object.keys(t??Object.create(null)),s=n.length;for(let r=0;r<s;r++)if(!Reflect.has(e,n[r]))return!1;for(let r=0;r<s;r++){const o=n[r];if(!Tt(e[o],t[o]))return!1}return!0},Pe=(e,...t)=>(typeof e=="function"?e(...t):e)??void 0,X=e=>e,Fs=()=>{},dt=(...e)=>(...t)=>{e.forEach(function(n){n==null||n(...t)})},ft=(()=>{let e=0;return()=>(e++,e.toString(36))})(),Ms=()=>process.env.NODE_ENV!=="production",qe=e=>Array.isArray(e),mn=e=>e!=null&&typeof e=="object",Ge=e=>mn(e)&&!qe(e),_s=e=>typeof e=="number"&&!Number.isNaN(e),V=e=>typeof e=="string",ve=e=>typeof e=="function",yn=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Bs=e=>Object.prototype.toString.call(e),vn=Function.prototype.toString,$s=vn.call(Object),je=e=>{if(!mn(e)||Bs(e)!="[object Object]")return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=yn(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&vn.call(n)==$s};function le(e){if(!Hs(e)||e===void 0)return e;const t=Reflect.ownKeys(e).filter(s=>typeof s=="string"),n={};for(const s of t){const r=e[s];r!==void 0&&(n[s]=le(r))}return n}var Hs=e=>e&&typeof e=="object"&&e.constructor===Object;function me(...e){const t=e.length===1?e[0]:e[1];(e.length===2?e[0]:!0)&&process.env.NODE_ENV!=="production"&&console.warn(t)}function Ue(...e){const t=e.length===1?e[0]:e[1];if((e.length===2?e[0]:!0)&&process.env.NODE_ENV!=="production")throw new Error(t)}var Vs=Object.defineProperty,Gs=(e,t,n)=>t in e?Vs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y=(e,t,n)=>Gs(e,typeof t!="symbol"?t+"":t,n);function bn(e,...t){if(!je(e))throw new TypeError("Source argument must be a plain object");for(const n of t){if(!je(n))continue;const s=le(n);for(const r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r==="__proto__"||r==="constructor"||r==="prototype")continue;const o=e[r],c=n[r];je(c)?e[r]=je(o)?bn(o,c):{...c}:e[r]=c}}return e}function q(e){return V(e)?{type:e}:e}function ee(e){return e?qe(e)?e.slice():[e]:[]}function En(e){return Ge(e)&&e.predicate!=null}var Us=()=>!0;function Ct(e,t,n,s){return r=>{var o;return V(r)?!!((o=e[r])!=null&&o.call(e,t,n,s)):ve(r)?r(t,n,s):r.predicate(e)(t,n,s)}}function Ks(...e){return{predicate:t=>(n,s,r)=>e.map(Ct(t,n,s,r)).some(Boolean)}}function Ws(...e){return{predicate:t=>(n,s,r)=>e.map(Ct(t,n,s,r)).every(Boolean)}}function qs(e){return{predicate:t=>(n,s,r)=>!Ct(t,n,s,r)(e)}}var xn={or:Ks,and:Ws,not:qs};function Tn(e,t){return e=e??Us,(n,s,r)=>{if(V(e)){const o=t[e];return ve(o)?o(n,s,r):o}return En(e)?e.predicate(t)(n,s,r):e==null?void 0:e(n,s,r)}}function Qe(e,t){return(n,s,r)=>En(e)?e.predicate(t)(n,s,r):e}function zs(e){var o,c;const t=e.computed??X({}),n=e.context??X({}),s=e.initial?(c=(o=e.states)==null?void 0:o[e.initial])==null?void 0:c.tags:[],r=xt({value:e.initial??"",previousValue:"",event:X({}),previousEvent:X({}),context:Rs(n,t),done:!1,tags:s??[],hasTag(i){return this.tags.includes(i)},matches(...i){return i.includes(this.value)},can(i){return X(this).nextEvents.includes(i)},get nextEvents(){var a,l;const i=((l=(a=e.states)==null?void 0:a[this.value])==null?void 0:l.on)??{},u=(e==null?void 0:e.on)??{};return Object.keys({...i,...u})},get changed(){return this.event.value==="machine.init"||!this.previousValue?!1:this.value!==this.previousValue}});return X(r)}function Ee(e,t){return(n,s)=>{if(_s(e))return e;if(ve(e))return e(n,s);if(V(e)){const r=Number.parseFloat(e);if(!Number.isNaN(r))return r;if(t){const o=t==null?void 0:t[e];return Ue(o==null,`[@zag-js/core > determine-delay] Cannot determine delay for \`${e}\`. It doesn't exist in \`options.delays\``),ve(o)?o(n,s):o}}}}function Ys(e){return V(e)?{target:e}:e}function Xs(e,t){return(n,s,r)=>ee(e).map(Ys).find(o=>Tn(o.guard,t)(n,s,r)??o.target??o.actions)}var Cn=class{constructor(e,t){var n,s,r,o,c;y(this,"status","Not Started"),y(this,"state"),y(this,"initialState"),y(this,"initialContext"),y(this,"id"),y(this,"type","machine"),y(this,"activityEvents",new Map),y(this,"delayedEvents",new Map),y(this,"stateListeners",new Set),y(this,"doneListeners",new Set),y(this,"contextWatchers",new Set),y(this,"removeStateListener",Fs),y(this,"parent"),y(this,"children",new Map),y(this,"guardMap"),y(this,"actionMap"),y(this,"delayMap"),y(this,"activityMap"),y(this,"sync"),y(this,"options"),y(this,"config"),y(this,"_created",()=>{if(!this.config.created)return;const i=q("machine.created");this.executeActions(this.config.created,i)}),y(this,"start",i=>{if(this.state.value="",this.state.tags=[],this.status==="Running")return this;this.status="Running",this.removeStateListener=We(this.state,()=>{this.stateListeners.forEach(p=>{p(this.stateSnapshot)})},this.sync),this.setupContextWatchers(),this.executeActivities(q("machine.start"),ee(this.config.activities),"machine.start"),this.executeActions(this.config.entry,q("machine.start"));const u=q("machine.init"),a=Ge(i)?i.value:i,l=Ge(i)?i.context:void 0;l&&this.setContext(l);const d={target:a??this.config.initial},f=this.getNextStateInfo(d,u);return this.initialState=f,this.performStateChangeEffects(this.state.value,f,u),this}),y(this,"setupContextWatchers",()=>{const{watch:i}=this.config;if(!i)return;let u=ne(this.state.context);const a=We(this.state.context,()=>{var d;const l=ne(this.state.context);for(const[f,p]of Object.entries(i))(((d=this.options.compareFns)==null?void 0:d[f])??Object.is)(u[f],l[f])||this.executeActions(p,this.state.event);u=l});this.contextWatchers.add(a)}),y(this,"stop",()=>{if(this.status!=="Stopped")return this.performExitEffects(this.state.value,q("machine.stop")),this.executeActions(this.config.exit,q("machine.stop")),this.setState(""),this.setEvent("machine.stop"),this.stopStateListeners(),this.stopChildren(),this.stopActivities(),this.stopDelayedEvents(),this.stopContextWatchers(),this.status="Stopped",this}),y(this,"stopStateListeners",()=>{this.removeStateListener(),this.stateListeners.clear()}),y(this,"stopContextWatchers",()=>{this.contextWatchers.forEach(i=>i()),this.contextWatchers.clear()}),y(this,"stopDelayedEvents",()=>{this.delayedEvents.forEach(i=>{i.forEach(u=>u())}),this.delayedEvents.clear()}),y(this,"stopActivities",i=>{var u,a;i?((u=this.activityEvents.get(i))==null||u.forEach(l=>l()),(a=this.activityEvents.get(i))==null||a.clear(),this.activityEvents.delete(i)):(this.activityEvents.forEach(l=>{l.forEach(d=>d()),l.clear()}),this.activityEvents.clear())}),y(this,"sendChild",(i,u)=>{const a=q(i),l=Pe(u,this.contextSnapshot),d=this.children.get(l);d||Ue(`[@zag-js/core] Cannot send '${a.type}' event to unknown child`),d.send(a)}),y(this,"stopChild",i=>{this.children.has(i)||Ue(`[@zag-js/core > stop-child] Cannot stop unknown child ${i}`),this.children.get(i).stop(),this.children.delete(i)}),y(this,"removeChild",i=>{this.children.delete(i)}),y(this,"stopChildren",()=>{this.children.forEach(i=>i.stop()),this.children.clear()}),y(this,"setParent",i=>{this.parent=i}),y(this,"spawn",(i,u)=>{const a=Pe(i);return u&&(a.id=u),a.type="machine.actor",a.setParent(this),this.children.set(a.id,X(a)),a.onDone(()=>{this.removeChild(a.id)}).start(),X(ke(a))}),y(this,"stopActivity",i=>{var a;if(!this.state.value)return;const u=this.activityEvents.get(this.state.value);(a=u==null?void 0:u.get(i))==null||a(),u==null||u.delete(i)}),y(this,"addActivityCleanup",(i,u,a)=>{var l;i&&(this.activityEvents.has(i)?(l=this.activityEvents.get(i))==null||l.set(u,a):this.activityEvents.set(i,new Map([[u,a]])))}),y(this,"setState",i=>{this.state.previousValue=this.state.value,this.state.value=i;const u=this.getStateNode(i);i==null?Ls(this.state.tags):this.state.tags=ee(u==null?void 0:u.tags)}),y(this,"setContext",i=>{i&&bn(this.state.context,i)}),y(this,"setOptions",i=>{const u=le(i);this.actionMap={...this.actionMap,...u.actions},this.delayMap={...this.delayMap,...u.delays},this.activityMap={...this.activityMap,...u.activities},this.guardMap={...this.guardMap,...u.guards}}),y(this,"getStateNode",i=>{var u;if(i)return(u=this.config.states)==null?void 0:u[i]}),y(this,"getNextStateInfo",(i,u)=>{const a=this.determineTransition(i,u),l=!(a!=null&&a.target),d=(a==null?void 0:a.target)??this.state.value,f=this.state.value!==d,p=this.getStateNode(d),m={reenter:!l&&!f&&!(a!=null&&a.internal),transition:a,stateNode:p,target:d,changed:f};return this.log("NextState:",`[${u.type}]`,this.state.value,"---->",m.target),m}),y(this,"getAfterActions",(i,u)=>{let a;const l=this.state.value;return{entry:()=>{a=globalThis.setTimeout(()=>{const d=this.getNextStateInfo(i,this.state.event);this.performStateChangeEffects(l,d,this.state.event)},u)},exit:()=>{globalThis.clearTimeout(a)}}}),y(this,"getDelayedEventActions",i=>{const u=this.getStateNode(i),a=this.state.event;if(!u||!u.after)return;const l=[],d=[];if(qe(u.after)){const f=this.determineTransition(u.after,a);if(!f)return;if(!yn(f,"delay"))throw new Error(`[@zag-js/core > after] Delay is required for after transition: ${JSON.stringify(f)}`);const g=Ee(f.delay,this.delayMap)(this.contextSnapshot,a),m=this.getAfterActions(f,g);return l.push(m.entry),d.push(m.exit),{entries:l,exits:d}}if(Ge(u.after))for(const f in u.after){const p=u.after[f],m=Ee(f,this.delayMap)(this.contextSnapshot,a),N=this.getAfterActions(p,m);l.push(N.entry),d.push(N.exit)}return{entries:l,exits:d}}),y(this,"executeActions",(i,u)=>{var l;const a=Qe(i,this.guardMap)(this.contextSnapshot,u,this.guardMeta);for(const d of ee(a)){const f=V(d)?(l=this.actionMap)==null?void 0:l[d]:d;me(V(d)&&!f,`[@zag-js/core > execute-actions] No implementation found for action: \`${d}\``),f==null||f(this.state.context,u,this.meta)}}),y(this,"executeActivities",(i,u,a)=>{var l;for(const d of u){const f=V(d)?(l=this.activityMap)==null?void 0:l[d]:d;if(!f){me(`[@zag-js/core > execute-activity] No implementation found for activity: \`${d}\``);continue}const p=f(this.state.context,i,this.meta);if(p){const g=V(d)?d:d.name||ft();this.addActivityCleanup(a??this.state.value,g,p)}}}),y(this,"createEveryActivities",(i,u)=>{if(i)if(qe(i)){const a=ee(i).find(p=>{const g=p.delay,N=Ee(g,this.delayMap)(this.contextSnapshot,this.state.event);return Tn(p.guard,this.guardMap)(this.contextSnapshot,this.state.event,this.guardMeta)??N!=null});if(!a)return;const d=Ee(a.delay,this.delayMap)(this.contextSnapshot,this.state.event);u(()=>{const p=globalThis.setInterval(()=>{this.executeActions(a.actions,this.state.event)},d);return()=>{globalThis.clearInterval(p)}})}else for(const a in i){const l=i==null?void 0:i[a],f=Ee(a,this.delayMap)(this.contextSnapshot,this.state.event);u(()=>{const g=globalThis.setInterval(()=>{this.executeActions(l,this.state.event)},f);return()=>{globalThis.clearInterval(g)}})}}),y(this,"setEvent",i=>{this.state.previousEvent=this.state.event,this.state.event=ke(q(i))}),y(this,"performExitEffects",(i,u)=>{const a=this.state.value;if(a==="")return;const l=i?this.getStateNode(i):void 0;this.stopActivities(a);const d=Qe(l==null?void 0:l.exit,this.guardMap)(this.contextSnapshot,u,this.guardMeta),f=ee(d),p=this.delayedEvents.get(a);p&&f.push(...p),this.executeActions(f,u),this.delayedEvents.delete(a)}),y(this,"performEntryEffects",(i,u)=>{const a=this.getStateNode(i),l=ee(a==null?void 0:a.activities);this.createEveryActivities(a==null?void 0:a.every,g=>{l.unshift(g)}),l.length>0&&this.executeActivities(u,l);const d=Qe(a==null?void 0:a.entry,this.guardMap)(this.contextSnapshot,u,this.guardMeta),f=ee(d),p=this.getDelayedEventActions(i);a!=null&&a.after&&p&&(this.delayedEvents.set(i,p==null?void 0:p.exits),f.push(...p.entries)),this.executeActions(f,u),(a==null?void 0:a.type)==="final"&&(this.state.done=!0,this.doneListeners.forEach(g=>{g(this.stateSnapshot)}),this.stop())}),y(this,"performTransitionEffects",(i,u)=>{const a=this.determineTransition(i,u);this.executeActions(a==null?void 0:a.actions,u)}),y(this,"performStateChangeEffects",(i,u,a)=>{this.setEvent(a);const l=u.changed||u.reenter;l&&this.performExitEffects(i,a),this.performTransitionEffects(u.transition,a),this.setState(u.target),l&&this.performEntryEffects(u.target,a)}),y(this,"determineTransition",(i,u)=>{const a=Xs(i,this.guardMap);return a==null?void 0:a(this.contextSnapshot,u,this.guardMeta)}),y(this,"sendParent",i=>{var a;this.parent||Ue("[@zag-js/core > send-parent] Cannot send event to an unknown parent");const u=q(i);(a=this.parent)==null||a.send(u)}),y(this,"log",(...i)=>{Ms()&&this.options.debug&&console.log(...i)}),y(this,"send",i=>{const u=q(i);this.transition(this.state.value,u)}),y(this,"transition",(i,u)=>{var p,g;const a=V(i)?this.getStateNode(i):i==null?void 0:i.stateNode,l=q(u);if(!a&&!this.config.on){const m=this.status==="Stopped"?"[@zag-js/core > transition] Cannot transition a stopped machine":`[@zag-js/core > transition] State does not have a definition for \`state\`: ${i}, \`event\`: ${l.type}`;me(m);return}const d=((p=a==null?void 0:a.on)==null?void 0:p[l.type])??((g=this.config.on)==null?void 0:g[l.type]),f=this.getNextStateInfo(d,l);return this.performStateChangeEffects(this.state.value,f,l),f.stateNode}),y(this,"subscribe",i=>(this.stateListeners.add(i),this.status==="Running"&&i(this.stateSnapshot),()=>{this.stateListeners.delete(i)})),y(this,"onDone",i=>(this.doneListeners.add(i),this)),y(this,"onTransition",i=>(this.stateListeners.add(i),this.status==="Running"&&i(this.stateSnapshot),this)),this.config=ae(e),this.options=ae(t??{}),this.id=this.config.id??`machine-${ft()}`,this.guardMap=((n=this.options)==null?void 0:n.guards)??{},this.actionMap=((s=this.options)==null?void 0:s.actions)??{},this.delayMap=((r=this.options)==null?void 0:r.delays)??{},this.activityMap=((o=this.options)==null?void 0:o.activities)??{},this.sync=((c=this.options)==null?void 0:c.sync)??!1,this.state=zs(this.config),this.initialContext=ne(this.state.context)}get stateSnapshot(){return X(ne(this.state))}getState(){return this.stateSnapshot}get contextSnapshot(){return this.stateSnapshot.context}get self(){const e=this;return{id:this.id,send:this.send.bind(this),sendParent:this.sendParent.bind(this),sendChild:this.sendChild.bind(this),stop:this.stop.bind(this),stopChild:this.stopChild.bind(this),spawn:this.spawn.bind(this),stopActivity:this.stopActivity.bind(this),get state(){return e.stateSnapshot},get initialContext(){return e.initialContext},get initialState(){var t;return((t=e.initialState)==null?void 0:t.target)??""}}}get meta(){var e;return{state:this.stateSnapshot,guards:this.guardMap,send:this.send.bind(this),self:this.self,initialContext:this.initialContext,initialState:((e=this.initialState)==null?void 0:e.target)??"",getState:()=>this.stateSnapshot,getAction:t=>this.actionMap[t],getGuard:t=>this.guardMap[t]}}get guardMeta(){return{state:this.stateSnapshot}}get[Symbol.toStringTag](){return"Machine"}getHydrationState(){const e=this.getState();return{value:e.value,tags:e.tags}}},De=(e,t)=>new Cn(e,t),Zs=e=>e instanceof Cn||(e==null?void 0:e.type)==="machine",Js=(...e)=>e.map(t=>{var n;return(n=t==null?void 0:t.trim)==null?void 0:n.call(t)}).filter(Boolean).join(" "),Qs=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,Vt=e=>{const t={};let n;for(;n=Qs.exec(e);)t[n[1]]=n[2];return t},er=(e,t)=>{if(V(e)){if(V(t))return`${e};${t}`;e=Vt(e)}else V(t)&&(t=Vt(t));return Object.assign({},e??{},t??{})};function I(...e){let t={};for(let n of e){for(let s in t){if(s.startsWith("on")&&typeof t[s]=="function"&&typeof n[s]=="function"){t[s]=dt(n[s],t[s]);continue}if(s==="className"||s==="class"){t[s]=Js(t[s],n[s]);continue}if(s==="style"){t[s]=er(t[s],n[s]);continue}t[s]=n[s]!==void 0?n[s]:t[s]}for(let s in n)t[s]===void 0&&(t[s]=n[s])}return t}function tr(e){return new Proxy({},{get(){return e}})}var wt=()=>e=>Array.from(new Set(e)),Ae=tr(e=>e),Gt=e=>(e==null?void 0:e.constructor.name)==="Array",nr=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Nt(e[n],t[n]))return!1;return!0},Nt=(e,t)=>{if(Object.is(e,t))return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(typeof(e==null?void 0:e.isEqual)=="function"&&typeof(t==null?void 0:t.isEqual)=="function")return e.isEqual(t);if(typeof e=="function"&&typeof t=="function")return e.toString()===t.toString();if(Gt(e)&&Gt(t))return nr(Array.from(e),Array.from(t));if(typeof e!="object"||typeof t!="object")return!1;const n=Object.keys(t??Object.create(null)),s=n.length;for(let r=0;r<s;r++)if(!Reflect.has(e,n[r]))return!1;for(let r=0;r<s;r++){const o=n[r];if(!Nt(e[o],t[o]))return!1}return!0},sr=()=>process.env.NODE_ENV!=="production",rr=Function.prototype.toString;rr.call(Object);function wn(e){if(!or(e)||e===void 0)return e;const t=Reflect.ownKeys(e).filter(s=>typeof s=="string"),n={};for(const s of t){const r=e[s];r!==void 0&&(n[s]=wn(r))}return n}var or=e=>e&&typeof e=="object"&&e.constructor===Object;function ir(e,t){const n=v.useRef(!1),s=v.useRef(!1);v.useEffect(()=>{if(n.current&&s.current)return e();s.current=!0},t),v.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}var ar=Et("__zag__targetCache",()=>new WeakMap);function Nn(e,t){const{actions:n,context:s,sync:r}=t??{},o=v.useRef(void 0),c=v.useRef(void 0),i=v.useSyncExternalStore(v.useCallback(d=>We(e.state,d,r),[r]),()=>{const d=ne(e.state);try{if(o.current&&c.current&&!gn(o.current,d,c.current,new WeakMap))return o.current}catch{}return d},()=>ne(e.state));e.setOptions({actions:n});const u=v.useMemo(()=>wn(s??{}),[s]);ir(()=>{const d=Object.entries(u),f=e.contextSnapshot??{};d.map(([m,N])=>({key:m,curr:N,prev:f[m],equal:Nt(f[m],N)})).every(({equal:m})=>m)||e.setContext(u)},[u]);const a=new WeakMap;v.useEffect(()=>{o.current=i,c.current=a});const l=v.useMemo(()=>new WeakMap,[]);return pn(i,a,l,ar)}function cr(e){return[Nn(e),e.send]}function lr(e){const t=v.useRef(void 0);return t.current||(t.current={v:e()}),t.current.v}var ur=typeof document<"u"?v.useLayoutEffect:v.useEffect;function dr(e,t){const{state:n,context:s}=t??{},r=lr(()=>{const c=typeof e=="function"?e():e;return s&&c.setContext(s),c._created(),c}),o=v.useRef(void 0);return ur(()=>{const c=n??o.current;return r.start(c),()=>{sr()&&(o.current=r.getHydrationState()),r.stop()}},[]),r}function Xe(e,t){const n=dr(e,t);return[Nn(n,t),n.send,n]}function fr(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Pt(...e){return t=>{for(const n of e)fr(n,t)}}function hr(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const et=e=>{const t=v.memo(v.forwardRef((n,s)=>{const{asChild:r,children:o,...c}=n;if(!r)return v.createElement(e,{...c,ref:s},o);const i=v.Children.only(o);if(!v.isValidElement(i))return null;const u=hr(i);return v.cloneElement(i,{...I(c,i.props),ref:s?Pt(s,u):u})}));return t.displayName=e.displayName||e.name,t},pr=()=>{const e=new Map;return new Proxy(et,{apply(t,n,s){return et(s[0])},get(t,n){const s=n;return e.has(s)||e.set(s,et(s)),e.get(s)}})},L=pr(),Pn=v.forwardRef((e,t)=>{const n=Ye(),s=I(n.getControlProps(),e);return h.jsx(L.div,{...s,ref:t})});Pn.displayName="CheckboxControl";const St=()=>(e,t)=>t.reduce((n,s)=>{const[r,o]=n,c=s;return o[c]!==void 0&&(r[c]=o[c]),delete o[c],[r,o]},[{},{...e}]);var ye=(e,t=[])=>({parts:(...n)=>{if(gr(t))return ye(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>ye(e,[...t,...n]),rename:n=>ye(n,t),keys:()=>t,build:()=>[...new Set(t)].reduce((n,s)=>Object.assign(n,{[s]:{selector:[`&[data-scope="${fe(e)}"][data-part="${fe(s)}"]`,`& [data-scope="${fe(e)}"][data-part="${fe(s)}"]`].join(", "),attrs:{"data-scope":fe(e),"data-part":fe(s)}}}),{})}),fe=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),gr=e=>e.length===0,tt=(...e)=>t=>e.reduce((n,s)=>s(n),t),Fe=()=>{},Ze=e=>typeof e=="object"&&e!==null,mr=2147483647,$=e=>e?"":void 0,yr=1,vr=9,br=11,B=e=>Ze(e)&&e.nodeType===yr&&typeof e.nodeName=="string",Ot=e=>Ze(e)&&e.nodeType===vr,Er=e=>Ze(e)&&e===e.window,Sn=e=>B(e)?e.localName||"":"#document";function xr(e){return["html","body","#document"].includes(Sn(e))}var Tr=e=>Ze(e)&&e.nodeType!==void 0,Ie=e=>Tr(e)&&e.nodeType===br&&"host"in e,Cr=e=>B(e)&&e.localName==="input",wr=e=>B(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1,Nr=/(textarea|select)/;function Pr(e){if(e==null||!B(e))return!1;try{return Cr(e)&&e.selectionStart!=null||Nr.test(e.localName)||e.isContentEditable||e.getAttribute("contenteditable")==="true"||e.getAttribute("contenteditable")===""}catch{return!1}}function be(e,t){var s;if(!e||!t||!B(e)||!B(t))return!1;const n=(s=t.getRootNode)==null?void 0:s.call(t);if(e===t||e.contains(t))return!0;if(n&&Ie(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function U(e){return Ot(e)?e:Er(e)?e.document:(e==null?void 0:e.ownerDocument)??document}function Sr(e){return U(e).documentElement}function G(e){var t;return Ie(e)?G(e.host):Ot(e)?e.defaultView??window:B(e)?((t=e.ownerDocument)==null?void 0:t.defaultView)??window:window}function On(e){let t=e.activeElement;for(;t!=null&&t.shadowRoot;){const n=t.shadowRoot.activeElement;if(n===t)break;t=n}return t}function Or(e){if(Sn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ie(e)&&e.host||Sr(e);return Ie(t)?t.host:t}var nt=new WeakMap;function kr(e){return nt.has(e)||nt.set(e,G(e).getComputedStyle(e)),nt.get(e)}var Ir=()=>typeof document<"u";function Dr(){const e=navigator.userAgentData;return(e==null?void 0:e.platform)??navigator.platform}var kn=e=>Ir()&&e.test(Dr()),In=()=>kn(/^Mac/),Ar=()=>kn(/iP(hone|ad|od)|iOS/);function Rr(e){var t,n,s;return((t=e.composedPath)==null?void 0:t.call(e))??((s=(n=e.nativeEvent)==null?void 0:n.composedPath)==null?void 0:s.call(n))}function W(e){const t=Rr(e);return(t==null?void 0:t[0])??e.target}var Lr=e=>e.button===2||In()&&e.ctrlKey&&e.button===0,jr=e=>"touches"in e&&e.touches.length>0;function Fr(e,t="client"){const n=jr(e)?e.touches[0]||e.changedTouches[0]:e;return{x:n[`${t}X`],y:n[`${t}Y`]}}var A=(e,t,n,s)=>{const r=typeof e=="function"?e():e;return r==null||r.addEventListener(t,n,s),()=>{r==null||r.removeEventListener(t,n,s)}};function Dn(e,t){const{type:n="HTMLInputElement",property:s="value"}=t,r=G(e)[n].prototype;return Object.getOwnPropertyDescriptor(r,s)??{}}function Mr(e){if(e.localName==="input")return"HTMLInputElement";if(e.localName==="textarea")return"HTMLTextAreaElement";if(e.localName==="select")return"HTMLSelectElement"}function _r(e,t,n="value"){var r;const s=Mr(e);s&&((r=Dn(e,{type:s,property:n}).set)==null||r.call(e,t)),e.setAttribute(n,t)}function An(e,t){var s;(s=Dn(e,{type:"HTMLInputElement",property:"checked"}).set)==null||s.call(e,t),t?e.setAttribute("checked",""):e.removeAttribute("checked")}function Br(e,t){const{checked:n,bubbles:s=!0}=t;if(!e)return;const r=G(e);e instanceof r.HTMLInputElement&&(An(e,n),e.dispatchEvent(new r.Event("click",{bubbles:s})))}function $r(e){return Hr(e)?e.form:e.closest("form")}function Hr(e){return e.matches("textarea, input, select, button")}function Vr(e,t){if(!e)return;const n=$r(e),s=r=>{r.defaultPrevented||t()};return n==null||n.addEventListener("reset",s,{passive:!0}),()=>n==null?void 0:n.removeEventListener("reset",s)}function Gr(e,t){const n=e==null?void 0:e.closest("fieldset");if(!n)return;t(n.disabled);const s=G(n),r=new s.MutationObserver(()=>t(n.disabled));return r.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>r.disconnect()}function Ur(e,t){if(!e)return;const{onFieldsetDisabledChange:n,onFormReset:s}=t,r=[Vr(e,s),Gr(e,n)];return()=>r.forEach(o=>o==null?void 0:o())}var Rn=e=>B(e)&&e.tagName==="IFRAME",Kr=e=>!Number.isNaN(parseInt(e.getAttribute("tabindex")||"0",10)),Wr=e=>parseInt(e.getAttribute("tabindex")||"0",10)<0,kt="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type",Ln=(e,t=!1)=>{if(!e)return[];const n=Array.from(e.querySelectorAll(kt));(t==!0||t=="if-empty"&&n.length===0)&&B(e)&&se(e)&&n.unshift(e);const r=n.filter(se);return r.forEach((o,c)=>{if(Rn(o)&&o.contentDocument){const i=o.contentDocument.body;r.splice(c,1,...Ln(i))}}),r};function se(e){return!e||e.closest("[inert]")?!1:e.matches(kt)&&wr(e)}function jn(e,t){if(!e)return[];const s=Array.from(e.querySelectorAll(kt)).filter(oe);return s.forEach((r,o)=>{if(Rn(r)&&r.contentDocument){const c=r.contentDocument.body,i=jn(c);s.splice(o,1,...i)}}),s.length,s}function oe(e){return e!=null&&e.tabIndex>0?!0:se(e)&&!Wr(e)}function xe(e){return e.tabIndex<0&&(/^(audio|video|details)$/.test(e.localName)||Pr(e))&&!Kr(e)?0:e.tabIndex}function z(e){const t=globalThis.requestAnimationFrame(e);return()=>{globalThis.cancelAnimationFrame(t)}}function ht(e){const t=Or(e);return xr(t)?U(t).body:B(t)&&zr(t)?t:ht(t)}var qr=/auto|scroll|overlay|hidden|clip/;function zr(e){const t=G(e),{overflow:n,overflowX:s,overflowY:r,display:o}=t.getComputedStyle(e);return qr.test(n+r+s)&&!["inline","contents"].includes(o)}function Yr(e){const{pointerNode:t,keyboardNode:n=t,onPress:s,onPressStart:r,onPressEnd:o,isValidKey:c=C=>C.key==="Enter"}=e;if(!t)return Fe;const i=G(t),u=U(t);let a=Fe,l=Fe,d=Fe;const f=C=>({point:Fr(C),event:C});function p(C){r==null||r(f(C))}function g(C){o==null||o(f(C))}const N=A(t,"pointerdown",C=>{l();const P=A(i,"pointerup",E=>{const T=W(E);be(t,T)?s==null||s(f(E)):o==null||o(f(E))},{passive:!s}),D=A(i,"pointercancel",g,{passive:!o});l=tt(P,D),u.activeElement===n&&C.pointerType==="mouse"&&C.preventDefault(),p(C)},{passive:!r}),b=A(n,"focus",O);a=tt(N,b);function O(){const C=E=>{if(!c(E))return;const T=j=>{if(!c(j))return;const J=new i.PointerEvent("pointerup"),Q=f(J);s==null||s(Q),o==null||o(Q)};l(),l=A(n,"keyup",T);const S=new i.PointerEvent("pointerdown");p(S)},Y=()=>{const E=new i.PointerEvent("pointercancel");g(E)},P=A(n,"keydown",C),D=A(n,"blur",Y);d=tt(P,D)}return()=>{a(),l(),d()}}function Xr(e,t){return Array.from((e==null?void 0:e.querySelectorAll(t))??[])}function It(e){const t={getRootNode:n=>{var s;return((s=n.getRootNode)==null?void 0:s.call(n))??document},getDoc:n=>U(t.getRootNode(n)),getWin:n=>t.getDoc(n).defaultView??window,getActiveElement:n=>On(t.getRootNode(n)),isActiveElement:(n,s)=>s===t.getActiveElement(n),getById:(n,s)=>t.getRootNode(n).getElementById(s),setValue:(n,s)=>{n==null||s==null||_r(n,s.toString())}};return{...t,...e}}var st=new WeakMap;function Zr(e,t,n){st.has(e)||st.set(e,new Map);const s=st.get(e),r=s.get(t);if(!r)return s.set(t,n()),()=>{var i;(i=s.get(t))==null||i(),s.delete(t)};const o=n(),c=()=>{o(),r(),s.delete(t)};return s.set(t,c),()=>{s.get(t)===c&&(o(),s.set(t,r))}}function Jr(e,t){return e?Zr(e,"style",()=>{const s=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=s}}):()=>{}}var Qr={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"},eo=1e3/60;function to(e,t){const n=e();if(B(n)&&n.isConnected)return t(n),()=>{};{const s=setInterval(()=>{const r=e();B(r)&&r.isConnected&&(t(r),clearInterval(s))},eo);return()=>clearInterval(s)}}function no(e,t){const n=[];return e==null||e.forEach(s=>{const r=to(s,t);n.push(r)}),()=>{n.forEach(s=>s())}}function so(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function ro(e){return!(e.metaKey||!In()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}var oo=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function io(e,t,n){const s=n?W(n):null,r=G(s);return e=e||s instanceof r.HTMLInputElement&&!oo.has(s==null?void 0:s.type)||s instanceof r.HTMLTextAreaElement||s instanceof r.HTMLElement&&s.isContentEditable,!(e&&t==="keyboard"&&n instanceof r.KeyboardEvent&&!Reflect.has(ao,n.key))}var ue=null,pt=new Set,Se=new Map,ce=!1,gt=!1,ao={Tab:!0,Escape:!0};function Je(e,t){for(let n of pt)n(e,t)}function ze(e){ce=!0,ro(e)&&(ue="keyboard",Je("keyboard",e))}function K(e){ue="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(ce=!0,Je("pointer",e))}function Fn(e){so(e)&&(ce=!0,ue="virtual")}function Mn(e){const t=W(e);t===G(t)||t===U(t)||(!ce&&!gt&&(ue="virtual",Je("virtual",e)),ce=!1,gt=!1)}function _n(){ce=!1,gt=!0}function co(e){if(typeof window>"u"||Se.get(G(e)))return;const t=G(e),n=U(e);let s=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){ue="virtual",Je("virtual",null),ce=!0,s.apply(this,arguments)},n.addEventListener("keydown",ze,!0),n.addEventListener("keyup",ze,!0),n.addEventListener("click",Fn,!0),t.addEventListener("focus",Mn,!0),t.addEventListener("blur",_n,!1),typeof t.PointerEvent<"u"?(n.addEventListener("pointerdown",K,!0),n.addEventListener("pointermove",K,!0),n.addEventListener("pointerup",K,!0)):(n.addEventListener("mousedown",K,!0),n.addEventListener("mousemove",K,!0),n.addEventListener("mouseup",K,!0)),t.addEventListener("beforeunload",()=>{lo(e)},{once:!0}),Se.set(t,{focus:s})}var lo=(e,t)=>{const n=G(e),s=U(e);Se.has(n)&&(n.HTMLElement.prototype.focus=Se.get(n).focus,s.removeEventListener("keydown",ze,!0),s.removeEventListener("keyup",ze,!0),s.removeEventListener("click",Fn,!0),n.removeEventListener("focus",Mn,!0),n.removeEventListener("blur",_n,!1),typeof n.PointerEvent<"u"?(s.removeEventListener("pointerdown",K,!0),s.removeEventListener("pointermove",K,!0),s.removeEventListener("pointerup",K,!0)):(s.removeEventListener("mousedown",K,!0),s.removeEventListener("mousemove",K,!0),s.removeEventListener("mouseup",K,!0)),Se.delete(n))};function mt(){return ue==="keyboard"}function uo(e={}){const{isTextInput:t,autoFocus:n,onChange:s,root:r}=e;co(r),s==null||s({isFocusVisible:n||mt(),modality:ue});const o=(c,i)=>{io(!!t,c,i)&&(s==null||s({isFocusVisible:mt(),modality:c}))};return pt.add(o),()=>{pt.delete(o)}}var fo=ye("checkbox").parts("root","label","control","indicator"),Me=fo.build(),R=It({getRootId:e=>{var t;return((t=e.ids)==null?void 0:t.root)??`checkbox:${e.id}`},getLabelId:e=>{var t;return((t=e.ids)==null?void 0:t.label)??`checkbox:${e.id}:label`},getControlId:e=>{var t;return((t=e.ids)==null?void 0:t.control)??`checkbox:${e.id}:control`},getHiddenInputId:e=>{var t;return((t=e.ids)==null?void 0:t.hiddenInput)??`checkbox:${e.id}:input`},getRootEl:e=>R.getById(e,R.getRootId(e)),getHiddenInputEl:e=>R.getById(e,R.getHiddenInputId(e))});function ho(e,t,n){const s=e.context.isDisabled,r=e.context.readOnly,o=!s&&e.context.focused,c=!s&&e.context.focusVisible,i=e.context.isChecked,u=e.context.isIndeterminate,a={"data-active":$(e.context.active),"data-focus":$(o),"data-focus-visible":$(c),"data-readonly":$(r),"data-hover":$(e.context.hovered),"data-disabled":$(s),"data-state":u?"indeterminate":e.context.checked?"checked":"unchecked","data-invalid":$(e.context.invalid)};return{checked:i,disabled:s,indeterminate:u,focused:o,checkedState:e.context.checked,setChecked(l){t({type:"CHECKED.SET",checked:l,isTrusted:!1})},toggleChecked(){t({type:"CHECKED.TOGGLE",checked:i,isTrusted:!1})},getRootProps(){return n.label({...Me.root.attrs,...a,dir:e.context.dir,id:R.getRootId(e.context),htmlFor:R.getHiddenInputId(e.context),onPointerMove(){s||t({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){s||t({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(l){W(l)===R.getHiddenInputEl(e.context)&&l.stopPropagation()}})},getLabelProps(){return n.element({...Me.label.attrs,...a,dir:e.context.dir,id:R.getLabelId(e.context)})},getControlProps(){return n.element({...Me.control.attrs,...a,dir:e.context.dir,id:R.getControlId(e.context),"aria-hidden":!0})},getIndicatorProps(){return n.element({...Me.indicator.attrs,...a,dir:e.context.dir,hidden:!u&&!e.context.checked})},getHiddenInputProps(){return n.input({id:R.getHiddenInputId(e.context),type:"checkbox",required:e.context.required,defaultChecked:i,disabled:s,"aria-labelledby":R.getLabelId(e.context),"aria-invalid":e.context.invalid,name:e.context.name,form:e.context.form,value:e.context.value,style:Qr,onFocus(){const l=mt();t({type:"CONTEXT.SET",context:{focused:!0,focusVisible:l}})},onBlur(){t({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(l){if(r){l.preventDefault();return}const d=l.currentTarget.checked;t({type:"CHECKED.SET",checked:d,isTrusted:!0})}})}}}var{not:Ut}=xn;function po(e){const t=le(e);return De({id:"checkbox",initial:"ready",context:{checked:!1,value:"on",disabled:!1,...t,fieldsetDisabled:!1,focusVisible:!1},watch:{disabled:"removeFocusIfNeeded",checked:"syncInputElement"},activities:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:Ut("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:Ut("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},computed:{isIndeterminate:n=>yt(n.checked),isChecked:n=>Kt(n.checked),isDisabled:n=>!!n.disabled||n.fieldsetDisabled},states:{ready:{}}},{guards:{isTrusted:(n,s)=>!!s.isTrusted},activities:{trackPressEvent(n){if(!n.isDisabled)return Yr({pointerNode:R.getRootEl(n),keyboardNode:R.getHiddenInputEl(n),isValidKey:s=>s.key===" ",onPress:()=>n.active=!1,onPressStart:()=>n.active=!0,onPressEnd:()=>n.active=!1})},trackFocusVisible(n){if(!n.isDisabled)return uo({root:R.getRootNode(n)})},trackFormControlState(n,s,{send:r,initialContext:o}){return Ur(R.getHiddenInputEl(n),{onFieldsetDisabledChange(c){n.fieldsetDisabled=c},onFormReset(){r({type:"CHECKED.SET",checked:!!o.checked})}})}},actions:{setContext(n,s){Object.assign(n,s.context)},syncInputElement(n){const s=R.getHiddenInputEl(n);s&&(An(s,n.isChecked),s.indeterminate=n.isIndeterminate)},removeFocusIfNeeded(n){n.disabled&&n.focused&&(n.focused=!1,n.focusVisible=!1)},setChecked(n,s){Wt.checked(n,s.checked)},toggleChecked(n){const s=yt(n.checked)?!0:!n.checked;Wt.checked(n,s)},dispatchChangeEvent(n){const s=R.getHiddenInputEl(n);Br(s,{checked:Kt(n.checked)})}}})}function yt(e){return e==="indeterminate"}function Kt(e){return yt(e)?!1:!!e}var go={change:e=>{var t;(t=e.onCheckedChange)==null||t.call(e,{checked:e.checked})}},Wt={checked:(e,t)=>{Tt(e.checked,t)||(e.checked=t,go.change(e))}};wt()(["checked","dir","disabled","form","getRootNode","id","ids","invalid","name","onCheckedChange","readOnly","required","value"]);function Oe(e,t={}){const{sync:n=!1}=t,s=mo(e);return v.useCallback((...r)=>{var o;return n?queueMicrotask(()=>{var c;return(c=s.current)==null?void 0:c.call(s,...r)}):(o=s.current)==null?void 0:o.call(s,...r)},[n,s])}function mo(e){const t=v.useRef(e);return t.current=e,t}const[ga,yo]=Z({name:"CheckboxGroupContext",hookName:"useCheckboxGroupContext",providerName:"<CheckboxGroupProvider />",strict:!1}),[ma,Bn]=Z({name:"FieldContext",hookName:"useFieldContext",providerName:"<FieldProvider />",strict:!1}),$n=v.forwardRef((e,t)=>{const n=Ye(),s=I(n.getHiddenInputProps(),e),r=Bn();return h.jsx(L.input,{"aria-describedby":r==null?void 0:r.ariaDescribedby,...s,ref:t})});$n.displayName="CheckboxHiddenInput";const Hn=v.forwardRef((e,t)=>{const{indeterminate:n,...s}=e,r=Ye(),o=I(r.getIndicatorProps(),s),c=n?r.indeterminate:r.checked;return h.jsx(L.div,{...o,hidden:!c,ref:t})});Hn.displayName="CheckboxIndicator";const Vn=v.forwardRef((e,t)=>{const n=Ye(),s=I(n.getLabelProps(),e);return h.jsx(L.span,{...s,ref:t})});Vn.displayName="CheckboxLabel";const[ya,Dt]=Z({name:"EnvironmentContext",hookName:"useEnvironmentContext",providerName:"<EnvironmentProvider />",strict:!1,defaultValue:{getRootNode:()=>document,getDocument:()=>document,getWindow:()=>window}}),[va,Gn]=Z({name:"LocaleContext",hookName:"useLocaleContext",providerName:"<LocaleProvider />",strict:!1,defaultValue:{dir:"ltr",locale:"en-US"}}),vo=(e={})=>{const t=yo(),n=Bn(),s=v.useMemo(()=>I(e,(t==null?void 0:t.getItemProps({value:e.value}))??{}),[e,t]),{getRootNode:r}=Dt(),{dir:o}=Gn(),c={id:v.useId(),ids:{label:n==null?void 0:n.ids.label,hiddenInput:n==null?void 0:n.ids.control},dir:o,disabled:n==null?void 0:n.disabled,readOnly:n==null?void 0:n.readOnly,invalid:n==null?void 0:n.invalid,required:n==null?void 0:n.required,getRootNode:r,checked:s.defaultChecked,...s},i={...c,checked:s.checked,onCheckedChange:Oe(s.onCheckedChange,{sync:!0})},[u,a]=Xe(po(c),{context:i});return ho(u,a,Ae)},Un=v.forwardRef((e,t)=>{const[n,s]=St()(e,["checked","defaultChecked","disabled","form","id","ids","invalid","name","onCheckedChange","readOnly","required","value"]),r=vo(n),o=I(r.getRootProps(),s);return h.jsx(vs,{value:r,children:h.jsx(L.label,{...o,ref:t})})});Un.displayName="CheckboxRoot";function bo({children:e,checked:t,defaultChecked:n,disabled:s=!1,indeterminate:r=!1,onChange:o,name:c,value:i,className:u}){return h.jsxs(Un,{checked:t,defaultChecked:n,disabled:s,onCheckedChange:a=>o==null?void 0:o(a.checked===!0),name:c,value:i,className:x("inline-flex items-center gap-2 cursor-pointer select-none text-sm","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",u),children:[h.jsx(Pn,{className:x("relative h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background","data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground","data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","transition-colors"),children:h.jsx(Hn,{className:"absolute inset-0 flex items-center justify-center text-current",children:r?h.jsx("svg",{width:"12",height:"12",viewBox:"0 0 15 15",fill:"none",children:h.jsx("path",{d:"M2.25 7.5C2.25 7.22386 2.47386 7 2.75 7H12.25C12.5261 7 12.75 7.22386 12.75 7.5C12.75 7.77614 12.5261 8 12.25 8H2.75C2.47386 8 2.25 7.77614 2.25 7.5Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}):h.jsx("svg",{width:"12",height:"12",viewBox:"0 0 15 15",fill:"none",children:h.jsx("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})})}),e&&h.jsx(Vn,{className:"cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e}),h.jsx($n,{})]})}const[Eo,xo]=Z({name:"RenderStrategyContext",hookName:"useRenderStrategyContext",providerName:"<RenderStrategyPropsProvider />"}),To=e=>St()(e,["lazyMount","unmountOnExit"]);function Co(e,t,n){const s=e.matches("mounted","unmountSuspended");return{skip:!e.context.initial&&s,present:s,setNode(r){r&&t({type:"NODE.SET",node:r})},unmount(){t({type:"UNMOUNT"})}}}function wo(e){return De({initial:e.present?"mounted":"unmounted",context:{node:null,styles:null,unmountAnimationName:null,prevAnimationName:null,present:!1,initial:!1,...e},exit:["clearInitial","cleanupNode"],watch:{present:["setInitial","syncPresence"]},on:{"NODE.SET":{actions:["setNode","setStyles"]}},states:{mounted:{on:{UNMOUNT:{target:"unmounted",actions:["invokeOnExitComplete"]},"UNMOUNT.SUSPEND":"unmountSuspended"}},unmountSuspended:{activities:["trackAnimationEvents"],after:{ANIMATION_DURATION:{target:"unmounted",actions:["invokeOnExitComplete"]}},on:{MOUNT:{target:"mounted",actions:["setPrevAnimationName"]},UNMOUNT:{target:"unmounted",actions:["invokeOnExitComplete"]}}},unmounted:{entry:["clearPrevAnimationName"],on:{MOUNT:{target:"mounted",actions:["setPrevAnimationName"]}}}}},{delays:{ANIMATION_DURATION(t){var n,s;return qt((n=t.styles)==null?void 0:n.animationDuration)+qt((s=t.styles)==null?void 0:s.animationDelay)+No}},actions:{setInitial(t){t.initial=!0},clearInitial(t){t.initial=!1},cleanupNode(t){t.node=null,t.styles=null},invokeOnExitComplete(t){var n;(n=t.onExitComplete)==null||n.call(t)},setNode(t,n){t.node=ke(n.node)},setStyles(t,n){const s=n.node.ownerDocument.defaultView||window;t.styles=ke(s.getComputedStyle(n.node))},syncPresence(t,n,{send:s}){var c;if(t.present){s({type:"MOUNT",src:"presence.changed"});return}if(!t.present&&((c=t.node)==null?void 0:c.ownerDocument.visibilityState)==="hidden"){s({type:"UNMOUNT",src:"visibilitychange"});return}const r=_e(t.styles);(t.immediate?queueMicrotask:requestAnimationFrame)(()=>{var i,u;t.unmountAnimationName=r,r==="none"||r===t.prevAnimationName||((i=t.styles)==null?void 0:i.display)==="none"||((u=t.styles)==null?void 0:u.animationDuration)==="0s"?s({type:"UNMOUNT",src:"presence.changed"}):s({type:"UNMOUNT.SUSPEND"})})},setPrevAnimationName(t){(t.immediate?queueMicrotask:requestAnimationFrame)(()=>{t.prevAnimationName=_e(t.styles)})},clearPrevAnimationName(t){t.prevAnimationName=null}},activities:{trackAnimationEvents(t,n,{send:s}){const r=t.node;if(!r)return;const o=i=>{var a,l;(((l=(a=i.composedPath)==null?void 0:a.call(i))==null?void 0:l[0])??i.target)===r&&(t.prevAnimationName=_e(t.styles))},c=i=>{var l,d;const u=_e(t.styles);(((d=(l=i.composedPath)==null?void 0:l.call(i))==null?void 0:d[0])??i.target)===r&&u===t.unmountAnimationName&&s({type:"UNMOUNT",src:"animationend"})};return r.addEventListener("animationstart",o),r.addEventListener("animationcancel",c),r.addEventListener("animationend",c),()=>{r.removeEventListener("animationstart",o),r.removeEventListener("animationcancel",c),r.removeEventListener("animationend",c)}}}})}function _e(e){return(e==null?void 0:e.animationName)||"none"}function qt(e){return parseFloat(e||"0")*1e3}var No=16.667;wt()(["onExitComplete","present","immediate"]);const Kn=e=>{const{lazyMount:t,unmountOnExit:n,present:s,...r}=e,o=v.useRef(!1),c={...r,present:s,onExitComplete:Oe(e.onExitComplete)},[i,u]=Xe(wo(c),{context:c}),a=Co(i,u);a.present&&(o.current=!0);const l=!a.present&&!o.current&&t||n&&!a.present&&o.current,d=()=>({"data-state":s?"open":"closed",hidden:!a.present});return{ref:a.setNode,getPresenceProps:d,present:a.present,unmounted:l}},[Po,de]=Z({name:"DialogContext",hookName:"useDialogContext",providerName:"<DialogProvider />"}),Wn=v.forwardRef((e,t)=>{const n=de(),s=xo(),r=Kn({...s,present:n.open}),o=I(n.getBackdropProps(),r.getPresenceProps(),e);return r.unmounted?null:h.jsx(L.div,{...o,ref:Pt(r.ref,t)})});Wn.displayName="DialogBackdrop";const qn=v.forwardRef((e,t)=>{const n=de(),s=I(n.getCloseTriggerProps(),e);return h.jsx(L.button,{...s,ref:t})});qn.displayName="DialogCloseTrigger";const[So,At]=Z({name:"PresenceContext",hookName:"usePresenceContext",providerName:"<PresenceProvider />"}),zn=v.forwardRef((e,t)=>{const n=de(),s=At(),r=I(n.getContentProps(),s.getPresenceProps(),e);return s.unmounted?null:h.jsx(L.div,{...r,ref:Pt(s.ref,t)})});zn.displayName="DialogContent";const Yn=v.forwardRef((e,t)=>{const n=de(),s=I(n.getDescriptionProps(),e);return h.jsx(L.div,{...s,ref:t})});Yn.displayName="DialogDescription";const Xn=v.forwardRef((e,t)=>{const n=de(),s=I(n.getPositionerProps(),e);return At().unmounted?null:h.jsx(L.div,{...s,ref:t})});Xn.displayName="DialogPositioner";const Oo=e=>St()(e,["immediate","lazyMount","onExitComplete","present","unmountOnExit"]);var he=new WeakMap,Be=new WeakMap,$e={},rt=0,Zn=e=>e&&(e.host||Zn(e.parentNode)),ko=(e,t)=>t.map(n=>{if(e.contains(n))return n;const s=Zn(n);return s&&e.contains(s)?s:(console.error("[zag-js > ariaHidden] target",n,"in not contained inside",e,". Doing nothing"),null)}).filter(n=>!!n),Io=e=>e.localName==="next-route-announcer"||e.localName==="script"||e.hasAttribute("aria-live")?!0:e.matches("[data-live-announcer]"),Do=(e,t)=>{const{parentNode:n,markerName:s,controlAttribute:r,explicitBooleanValue:o}=t,c=ko(n,Array.isArray(e)?e:[e]);$e[s]||($e[s]=new WeakMap);const i=$e[s],u=[],a=new Set,l=new Set(c),d=p=>{!p||a.has(p)||(a.add(p),d(p.parentNode))};c.forEach(d);const f=p=>{!p||l.has(p)||Array.prototype.forEach.call(p.children,g=>{if(a.has(g))f(g);else try{if(Io(g))return;const m=g.getAttribute(r),N=o?m==="true":m!==null&&m!=="false",b=(he.get(g)||0)+1,O=(i.get(g)||0)+1;he.set(g,b),i.set(g,O),u.push(g),b===1&&N&&Be.set(g,!0),O===1&&g.setAttribute(s,""),N||g.setAttribute(r,o?"true":"")}catch(m){console.error("[zag-js > ariaHidden] cannot operate on ",g,m)}})};return f(n),a.clear(),rt++,()=>{u.forEach(p=>{const g=he.get(p)-1,m=i.get(p)-1;he.set(p,g),i.set(p,m),g||(Be.has(p)||p.removeAttribute(r),Be.delete(p)),m||p.removeAttribute(s)}),rt--,rt||(he=new WeakMap,he=new WeakMap,Be=new WeakMap,$e={})}},Ao=e=>(Array.isArray(e)?e[0]:e).ownerDocument.body,Ro=(e,t=Ao(e),n="data-aria-hidden")=>{if(t)return Do(e,{parentNode:t,markerName:n,controlAttribute:"aria-hidden",explicitBooleanValue:!0})},Lo=e=>{const t=requestAnimationFrame(()=>e());return()=>cancelAnimationFrame(t)};function jo(e,t={}){const{defer:n=!0}=t,s=n?Lo:o=>o(),r=[];return r.push(s(()=>{const c=(typeof e=="function"?e():e).filter(Boolean);c.length!==0&&r.push(Ro(c))})),()=>{r.forEach(o=>o==null?void 0:o())}}function Fo(e){const t={each(n){var s;for(let r=0;r<((s=e.frames)==null?void 0:s.length);r+=1){const o=e.frames[r];o&&n(o)}},addEventListener(n,s,r){return t.each(o=>{try{o.document.addEventListener(n,s,r)}catch{}}),()=>{try{t.removeEventListener(n,s,r)}catch{}}},removeEventListener(n,s,r){t.each(o=>{try{o.document.removeEventListener(n,s,r)}catch{}})}};return t}function Mo(e){const t=e.frameElement!=null?e.parent:null;return{addEventListener:(n,s,r)=>{try{t==null||t.addEventListener(n,s,r)}catch{}return()=>{try{t==null||t.removeEventListener(n,s,r)}catch{}}},removeEventListener:(n,s,r)=>{try{t==null||t.removeEventListener(n,s,r)}catch{}}}}var zt="pointerdown.outside",Yt="focus.outside";function _o(e){for(const t of e)if(B(t)&&se(t))return!0;return!1}var Jn=e=>"clientY"in e;function Bo(e,t){if(!Jn(t)||!e)return!1;const n=e.getBoundingClientRect();return n.width===0||n.height===0?!1:n.top<=t.clientY&&t.clientY<=n.top+n.height&&n.left<=t.clientX&&t.clientX<=n.left+n.width}function $o(e,t){return e.y<=t.y&&t.y<=e.y+e.height&&e.x<=t.x&&t.x<=e.x+e.width}function Xt(e,t){if(!t||!Jn(e))return!1;const n=t.scrollHeight>t.clientHeight,s=n&&e.clientX>t.offsetLeft+t.clientWidth,r=t.scrollWidth>t.clientWidth,o=r&&e.clientY>t.offsetTop+t.clientHeight,c={x:t.offsetLeft,y:t.offsetTop,width:t.clientWidth+(n?16:0),height:t.clientHeight+(r?16:0)},i={x:e.clientX,y:e.clientY};return $o(c,i)?s||o:!1}function Ho(e,t){const{exclude:n,onFocusOutside:s,onPointerDownOutside:r,onInteractOutside:o,defer:c}=t;if(!e)return;const i=U(e),u=G(e),a=Fo(u),l=Mo(u);function d(b){const O=W(b);if(!B(O)||!O.isConnected||be(e,O)||Bo(e,b))return!1;const C=i.querySelector(`[aria-controls="${e.id}"]`);if(C){const P=ht(C);if(Xt(b,P))return!1}const Y=ht(e);return Xt(b,Y)?!1:!(n!=null&&n(O))}const f=new Set;function p(b){function O(){var P;const C=c?z:D=>D(),Y=((P=b.composedPath)==null?void 0:P.call(b))??[b.target];C(()=>{if(!(!e||!d(b))){if(r||o){const D=dt(r,o);e.addEventListener(zt,D,{once:!0})}Zt(e,zt,{bubbles:!1,cancelable:!0,detail:{originalEvent:b,contextmenu:Lr(b),focusable:_o(Y)}})}})}b.pointerType==="touch"?(f.forEach(C=>C()),f.add(A(i,"click",O,{once:!0})),f.add(l.addEventListener("click",O,{once:!0})),f.add(a.addEventListener("click",O,{once:!0}))):O()}const g=new Set,m=setTimeout(()=>{g.add(A(i,"pointerdown",p,!0)),g.add(l.addEventListener("pointerdown",p,!0)),g.add(a.addEventListener("pointerdown",p,!0))},0);function N(b){(c?z:C=>C())(()=>{if(!(!e||!d(b))){if(s||o){const C=dt(s,o);e.addEventListener(Yt,C,{once:!0})}Zt(e,Yt,{bubbles:!1,cancelable:!0,detail:{originalEvent:b,contextmenu:!1,focusable:se(W(b))}})}})}return g.add(A(i,"focusin",N,!0)),g.add(l.addEventListener("focusin",N,!0)),g.add(a.addEventListener("focusin",N,!0)),()=>{clearTimeout(m),f.forEach(b=>b()),g.forEach(b=>b())}}function Vo(e,t){const{defer:n}=t,s=n?z:o=>o(),r=[];return r.push(s(()=>{const o=typeof e=="function"?e():e;r.push(Ho(o,t))})),()=>{r.forEach(o=>o==null?void 0:o())}}function Zt(e,t,n){const s=e.ownerDocument.defaultView||window,r=new s.CustomEvent(t,n);return e.dispatchEvent(r)}function Go(e,t){const n=s=>{s.key==="Escape"&&(s.isComposing||t==null||t(s))};return A(U(e),"keydown",n,{capture:!0})}var H={layers:[],branches:[],count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(e=>e.pointerBlocking)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(e){var s;const t=this.indexOf(e),n=this.topMostPointerBlockingLayer()?this.indexOf((s=this.topMostPointerBlockingLayer())==null?void 0:s.node):-1;return t<n},isTopMost(e){const t=this.layers[this.count()-1];return(t==null?void 0:t.node)===e},getNestedLayers(e){return Array.from(this.layers).slice(this.indexOf(e)+1)},isInNestedLayer(e,t){return this.getNestedLayers(e).some(n=>be(n.node,t))},isInBranch(e){return Array.from(this.branches).some(t=>be(t,e))},add(e){const t=this.layers.push(e);e.node.style.setProperty("--layer-index",`${t}`)},addBranch(e){this.branches.push(e)},remove(e){const t=this.indexOf(e);t<0||(t<this.count()-1&&this.getNestedLayers(e).forEach(s=>s.dismiss()),this.layers.splice(t,1),e.style.removeProperty("--layer-index"))},removeBranch(e){const t=this.branches.indexOf(e);t>=0&&this.branches.splice(t,1)},indexOf(e){return this.layers.findIndex(t=>t.node===e)},dismiss(e){var t;(t=this.layers[this.indexOf(e)])==null||t.dismiss()},clear(){this.remove(this.layers[0].node)}},Jt;function Qt(){H.layers.forEach(({node:e})=>{e.style.pointerEvents=H.isBelowPointerBlockingLayer(e)?"none":"auto"})}function Uo(e){e.style.pointerEvents=""}function Ko(e,t){const n=U(e),s=[];if(H.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(Jt=document.body.style.pointerEvents,queueMicrotask(()=>{n.body.style.pointerEvents="none",n.body.setAttribute("data-inert","")})),t){const r=no(t,o=>{s.push(Jr(o,{pointerEvents:"auto"}))});s.push(r)}return()=>{H.hasPointerBlockingLayer()||(queueMicrotask(()=>{n.body.style.pointerEvents=Jt,n.body.removeAttribute("data-inert"),n.body.style.length===0&&n.body.removeAttribute("style")}),s.forEach(r=>r()))}}function Wo(e,t){if(!e){me("[@zag-js/dismissable] node is `null` or `undefined`");return}const{onDismiss:n,pointerBlocking:s,exclude:r,debug:o}=t,c={dismiss:n,node:e,pointerBlocking:s};H.add(c),Qt();function i(f){var g,m;const p=W(f.detail.originalEvent);H.isBelowPointerBlockingLayer(e)||H.isInBranch(p)||((g=t.onPointerDownOutside)==null||g.call(t,f),(m=t.onInteractOutside)==null||m.call(t,f),!f.defaultPrevented&&(o&&console.log("onPointerDownOutside:",f.detail.originalEvent),n==null||n()))}function u(f){var g,m;const p=W(f.detail.originalEvent);H.isInBranch(p)||((g=t.onFocusOutside)==null||g.call(t,f),(m=t.onInteractOutside)==null||m.call(t,f),!f.defaultPrevented&&(o&&console.log("onFocusOutside:",f.detail.originalEvent),n==null||n()))}function a(f){var p;H.isTopMost(e)&&((p=t.onEscapeKeyDown)==null||p.call(t,f),!f.defaultPrevented&&n&&(f.preventDefault(),n()))}function l(f){var N;if(!e)return!1;const p=typeof r=="function"?r():r,g=Array.isArray(p)?p:[p],m=(N=t.persistentElements)==null?void 0:N.map(b=>b()).filter(B);return m&&g.push(...m),g.some(b=>be(b,f))||H.isInNestedLayer(e,f)}const d=[s?Ko(e,t.persistentElements):void 0,Go(e,a),Vo(e,{exclude:l,onFocusOutside:u,onPointerDownOutside:i,defer:t.defer})];return()=>{H.remove(e),Qt(),Uo(e),d.forEach(f=>f==null?void 0:f())}}function qo(e,t){const{defer:n}=t,s=n?z:o=>o(),r=[];return r.push(s(()=>{const o=ve(e)?e():e;r.push(Wo(o,t))})),()=>{r.forEach(o=>o==null?void 0:o())}}function zo(e,t={}){const{defer:n}=t,s=n?z:o=>o(),r=[];return r.push(s(()=>{const o=ve(e)?e():e;if(!o){me("[@zag-js/dismissable] branch node is `null` or `undefined`");return}H.addBranch(o),r.push(()=>{H.removeBranch(o)})})),()=>{r.forEach(o=>o==null?void 0:o())}}var Yo=Object.defineProperty,Xo=(e,t,n)=>t in e?Yo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,k=(e,t,n)=>Xo(e,typeof t!="symbol"?t+"":t,n),en={activateTrap(e,t){if(e.length>0){const s=e[e.length-1];s!==t&&s.pause()}const n=e.indexOf(t);n===-1||e.splice(n,1),e.push(t)},deactivateTrap(e,t){const n=e.indexOf(t);n!==-1&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}},Zo=[],Jo=class{constructor(e,t){k(this,"trapStack"),k(this,"config"),k(this,"doc"),k(this,"state",{containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0}),k(this,"listenerCleanups",[]),k(this,"handleFocus",s=>{const r=W(s),o=this.findContainerIndex(r,s)>=0;if(o||Ot(r))o&&(this.state.mostRecentlyFocusedNode=r);else{s.stopImmediatePropagation();let c,i=!0;if(this.state.mostRecentlyFocusedNode)if(xe(this.state.mostRecentlyFocusedNode)>0){const u=this.findContainerIndex(this.state.mostRecentlyFocusedNode),{tabbableNodes:a}=this.state.containerGroups[u];if(a.length>0){const l=a.findIndex(d=>d===this.state.mostRecentlyFocusedNode);l>=0&&(this.config.isKeyForward(this.state.recentNavEvent)?l+1<a.length&&(c=a[l+1],i=!1):l-1>=0&&(c=a[l-1],i=!1))}}else this.state.containerGroups.some(u=>u.tabbableNodes.some(a=>xe(a)>0))||(i=!1);else i=!1;i&&(c=this.findNextNavNode({target:this.state.mostRecentlyFocusedNode,isBackward:this.config.isKeyBackward(this.state.recentNavEvent)})),c?this.tryFocus(c):this.tryFocus(this.state.mostRecentlyFocusedNode||this.getInitialFocusNode())}this.state.recentNavEvent=void 0}),k(this,"handlePointerDown",s=>{const r=W(s);if(!(this.findContainerIndex(r,s)>=0)){if(Ce(this.config.clickOutsideDeactivates,s)){this.deactivate({returnFocus:this.config.returnFocusOnDeactivate});return}Ce(this.config.allowOutsideClick,s)||s.preventDefault()}}),k(this,"handleClick",s=>{const r=W(s);this.findContainerIndex(r,s)>=0||Ce(this.config.clickOutsideDeactivates,s)||Ce(this.config.allowOutsideClick,s)||(s.preventDefault(),s.stopImmediatePropagation())}),k(this,"handleTabKey",s=>{if(this.config.isKeyForward(s)||this.config.isKeyBackward(s)){this.state.recentNavEvent=s;const r=this.config.isKeyBackward(s),o=this.findNextNavNode({event:s,isBackward:r});if(!o)return;Te(s)&&s.preventDefault(),this.tryFocus(o)}}),k(this,"handleEscapeKey",s=>{Qo(s)&&Ce(this.config.escapeDeactivates,s)!==!1&&(s.preventDefault(),this.deactivate())}),k(this,"_mutationObserver"),k(this,"setupMutationObserver",()=>{const s=this.doc.defaultView||window;this._mutationObserver=new s.MutationObserver(r=>{r.some(c=>Array.from(c.removedNodes).some(u=>u===this.state.mostRecentlyFocusedNode))&&this.tryFocus(this.getInitialFocusNode())})}),k(this,"updateObservedNodes",()=>{var s;(s=this._mutationObserver)==null||s.disconnect(),this.state.active&&!this.state.paused&&this.state.containers.map(r=>{var o;(o=this._mutationObserver)==null||o.observe(r,{subtree:!0,childList:!0})})}),k(this,"getInitialFocusNode",()=>{let s=this.getNodeForOption("initialFocus",{hasFallback:!0});if(s===!1)return!1;if(s===void 0||s&&!se(s))if(this.findContainerIndex(this.doc.activeElement)>=0)s=this.doc.activeElement;else{const r=this.state.tabbableGroups[0];s=r&&r.firstTabbableNode||this.getNodeForOption("fallbackFocus")}else s===null&&(s=this.getNodeForOption("fallbackFocus"));if(!s)throw new Error("Your focus-trap needs to have at least one focusable element");return s.isConnected||(s=this.getNodeForOption("fallbackFocus")),s}),k(this,"tryFocus",s=>{if(s!==!1&&s!==On(this.doc)){if(!s||!s.focus){this.tryFocus(this.getInitialFocusNode());return}s.focus({preventScroll:!!this.config.preventScroll}),this.state.mostRecentlyFocusedNode=s,ei(s)&&s.select()}}),k(this,"deactivate",s=>{if(!this.state.active)return this;const r={onDeactivate:this.config.onDeactivate,onPostDeactivate:this.config.onPostDeactivate,checkCanReturnFocus:this.config.checkCanReturnFocus,...s};clearTimeout(this.state.delayInitialFocusTimer),this.state.delayInitialFocusTimer=void 0,this.removeListeners(),this.state.active=!1,this.state.paused=!1,this.updateObservedNodes(),en.deactivateTrap(this.trapStack,this);const o=this.getOption(r,"onDeactivate"),c=this.getOption(r,"onPostDeactivate"),i=this.getOption(r,"checkCanReturnFocus"),u=this.getOption(r,"returnFocus","returnFocusOnDeactivate");o==null||o();const a=()=>{tn(()=>{if(u){const l=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);this.tryFocus(l)}c==null||c()})};if(u&&i){const l=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);return i(l).then(a,a),this}return a(),this}),k(this,"pause",s=>{if(this.state.paused||!this.state.active)return this;const r=this.getOption(s,"onPause"),o=this.getOption(s,"onPostPause");return this.state.paused=!0,r==null||r(),this.removeListeners(),this.updateObservedNodes(),o==null||o(),this}),k(this,"unpause",s=>{if(!this.state.paused||!this.state.active)return this;const r=this.getOption(s,"onUnpause"),o=this.getOption(s,"onPostUnpause");return this.state.paused=!1,r==null||r(),this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),o==null||o(),this}),k(this,"updateContainerElements",s=>(this.state.containers=Array.isArray(s)?s.filter(Boolean):[s].filter(Boolean),this.state.active&&this.updateTabbableNodes(),this.updateObservedNodes(),this)),k(this,"getReturnFocusNode",s=>{const r=this.getNodeForOption("setReturnFocus",{params:[s]});return r||(r===!1?!1:s)}),k(this,"getOption",(s,r,o)=>s&&s[r]!==void 0?s[r]:this.config[o||r]),k(this,"getNodeForOption",(s,{hasFallback:r=!1,params:o=[]}={})=>{let c=this.config[s];if(typeof c=="function"&&(c=c(...o)),c===!0&&(c=void 0),!c){if(c===void 0||c===!1)return c;throw new Error(`\`${s}\` was specified but was not a node, or did not return a node`)}let i=c;if(typeof c=="string"){try{i=this.doc.querySelector(c)}catch(u){throw new Error(`\`${s}\` appears to be an invalid selector; error="${u.message}"`)}if(!i&&!r)throw new Error(`\`${s}\` as selector refers to no known node`)}return i}),k(this,"findNextNavNode",s=>{const{event:r,isBackward:o=!1}=s,c=s.target||W(r);this.updateTabbableNodes();let i=null;if(this.state.tabbableGroups.length>0){const u=this.findContainerIndex(c,r),a=u>=0?this.state.containerGroups[u]:void 0;if(u<0)o?i=this.state.tabbableGroups[this.state.tabbableGroups.length-1].lastTabbableNode:i=this.state.tabbableGroups[0].firstTabbableNode;else if(o){let l=this.state.tabbableGroups.findIndex(({firstTabbableNode:d})=>c===d);if(l<0&&((a==null?void 0:a.container)===c||se(c)&&!oe(c)&&!(a!=null&&a.nextTabbableNode(c,!1)))&&(l=u),l>=0){const d=l===0?this.state.tabbableGroups.length-1:l-1,f=this.state.tabbableGroups[d];i=xe(c)>=0?f.lastTabbableNode:f.lastDomTabbableNode}else Te(r)||(i=a==null?void 0:a.nextTabbableNode(c,!1))}else{let l=this.state.tabbableGroups.findIndex(({lastTabbableNode:d})=>c===d);if(l<0&&((a==null?void 0:a.container)===c||se(c)&&!oe(c)&&!(a!=null&&a.nextTabbableNode(c)))&&(l=u),l>=0){const d=l===this.state.tabbableGroups.length-1?0:l+1,f=this.state.tabbableGroups[d];i=xe(c)>=0?f.firstTabbableNode:f.firstDomTabbableNode}else Te(r)||(i=a==null?void 0:a.nextTabbableNode(c))}}else i=this.getNodeForOption("fallbackFocus");return i}),this.trapStack=t.trapStack||Zo;const n={returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward(s){return Te(s)&&!s.shiftKey},isKeyBackward(s){return Te(s)&&s.shiftKey},...t};this.doc=n.document||U(Array.isArray(e)?e[0]:e),this.config=n,this.updateContainerElements(e),this.setupMutationObserver()}get active(){return this.state.active}get paused(){return this.state.paused}findContainerIndex(e,t){const n=typeof(t==null?void 0:t.composedPath)=="function"?t.composedPath():void 0;return this.state.containerGroups.findIndex(({container:s,tabbableNodes:r})=>s.contains(e)||(n==null?void 0:n.includes(s))||r.find(o=>o===e))}updateTabbableNodes(){if(this.state.containerGroups=this.state.containers.map(e=>{const t=jn(e),n=Ln(e),s=t.length>0?t[0]:void 0,r=t.length>0?t[t.length-1]:void 0,o=n.find(a=>oe(a)),c=n.slice().reverse().find(a=>oe(a)),i=!!t.find(a=>xe(a)>0);function u(a,l=!0){const d=t.indexOf(a);return d<0?l?n.slice(n.indexOf(a)+1).find(f=>oe(f)):n.slice(0,n.indexOf(a)).reverse().find(f=>oe(f)):t[d+(l?1:-1)]}return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:i,firstTabbableNode:s,lastTabbableNode:r,firstDomTabbableNode:o,lastDomTabbableNode:c,nextTabbableNode:u}}),this.state.tabbableGroups=this.state.containerGroups.filter(e=>e.tabbableNodes.length>0),this.state.tabbableGroups.length<=0&&!this.getNodeForOption("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(this.state.containerGroups.find(e=>e.posTabIndexesFound)&&this.state.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")}addListeners(){if(this.state.active)return en.activateTrap(this.trapStack,this),this.state.delayInitialFocusTimer=this.config.delayInitialFocus?tn(()=>{this.tryFocus(this.getInitialFocusNode())}):this.tryFocus(this.getInitialFocusNode()),this.listenerCleanups.push(A(this.doc,"focusin",this.handleFocus,!0),A(this.doc,"mousedown",this.handlePointerDown,{capture:!0,passive:!1}),A(this.doc,"touchstart",this.handlePointerDown,{capture:!0,passive:!1}),A(this.doc,"click",this.handleClick,{capture:!0,passive:!1}),A(this.doc,"keydown",this.handleTabKey,{capture:!0,passive:!1}),A(this.doc,"keydown",this.handleEscapeKey)),this}removeListeners(){if(this.state.active)return this.listenerCleanups.forEach(e=>e()),this.listenerCleanups=[],this}activate(e){if(this.state.active)return this;const t=this.getOption(e,"onActivate"),n=this.getOption(e,"onPostActivate"),s=this.getOption(e,"checkCanFocusTrap");s||this.updateTabbableNodes(),this.state.active=!0,this.state.paused=!1,this.state.nodeFocusedBeforeActivation=this.doc.activeElement||null,t==null||t();const r=()=>{s&&this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),n==null||n()};return s?(s(this.state.containers.concat()).then(r,r),this):(r(),this)}},Te=e=>e.key==="Tab",Ce=(e,...t)=>typeof e=="function"?e(...t):e,Qo=e=>!e.isComposing&&e.key==="Escape",tn=e=>setTimeout(e,0),ei=e=>e.localName==="input"&&"select"in e&&typeof e.select=="function";function ti(e,t={}){let n;const s=z(()=>{const r=typeof e=="function"?e():e;if(r){n=new Jo(r,{escapeDeactivates:!1,allowOutsideClick:!0,preventScroll:!0,returnFocusOnDeactivate:!0,delayInitialFocus:!1,fallbackFocus:r,...t,document:U(r)});try{n.activate()}catch{}}});return function(){n==null||n.deactivate(),s()}}var ot="data-scroll-lock";function nn(e,t){if(!e)return;const n=Object.keys(t).reduce((s,r)=>(s[r]=e.style.getPropertyValue(r),s),{});return Object.assign(e.style,t),()=>{Object.assign(e.style,n)}}function ni(e,t,n){if(!e)return;const s=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{s?e.style.setProperty(t,s):e.style.removeProperty(t)}}function si(e){const t=e.getBoundingClientRect().left;return Math.round(t)+e.scrollLeft?"paddingLeft":"paddingRight"}function ri(e){const t=e??document,n=t.defaultView??window,{documentElement:s,body:r}=t;if(r.hasAttribute(ot))return;r.setAttribute(ot,"");const c=n.innerWidth-s.clientWidth,i=()=>ni(s,"--scrollbar-width",`${c}px`),u=si(s),a=()=>nn(r,{overflow:"hidden",[u]:`${c}px`}),l=()=>{const{scrollX:f,scrollY:p,visualViewport:g}=n,m=(g==null?void 0:g.offsetLeft)??0,N=(g==null?void 0:g.offsetTop)??0,b=nn(r,{position:"fixed",overflow:"hidden",top:`${-(p-Math.floor(N))}px`,left:`${-(f-Math.floor(m))}px`,right:"0",[u]:`${c}px`});return()=>{b==null||b(),n.scrollTo({left:f,top:p,behavior:"instant"})}},d=[i(),Ar()?l():a()];return()=>{d.forEach(f=>f==null?void 0:f()),r.removeAttribute(ot)}}var oi=ye("dialog").parts("trigger","backdrop","positioner","content","title","description","closeTrigger"),re=oi.build(),w=It({getPositionerId:e=>{var t;return((t=e.ids)==null?void 0:t.positioner)??`dialog:${e.id}:positioner`},getBackdropId:e=>{var t;return((t=e.ids)==null?void 0:t.backdrop)??`dialog:${e.id}:backdrop`},getContentId:e=>{var t;return((t=e.ids)==null?void 0:t.content)??`dialog:${e.id}:content`},getTriggerId:e=>{var t;return((t=e.ids)==null?void 0:t.trigger)??`dialog:${e.id}:trigger`},getTitleId:e=>{var t;return((t=e.ids)==null?void 0:t.title)??`dialog:${e.id}:title`},getDescriptionId:e=>{var t;return((t=e.ids)==null?void 0:t.description)??`dialog:${e.id}:description`},getCloseTriggerId:e=>{var t;return((t=e.ids)==null?void 0:t.closeTrigger)??`dialog:${e.id}:close`},getContentEl:e=>w.getById(e,w.getContentId(e)),getPositionerEl:e=>w.getById(e,w.getPositionerId(e)),getBackdropEl:e=>w.getById(e,w.getBackdropId(e)),getTriggerEl:e=>w.getById(e,w.getTriggerId(e)),getTitleEl:e=>w.getById(e,w.getTitleId(e)),getDescriptionEl:e=>w.getById(e,w.getDescriptionId(e)),getCloseTriggerEl:e=>w.getById(e,w.getCloseTriggerId(e))});function ii(e,t,n){const s=e.context["aria-label"],r=e.matches("open"),o=e.context.renderedElements;return{open:r,setOpen(c){c!==r&&t(c?"OPEN":"CLOSE")},getTriggerProps(){return n.button({...re.trigger.attrs,dir:e.context.dir,id:w.getTriggerId(e.context),"aria-haspopup":"dialog",type:"button","aria-expanded":r,"data-state":r?"open":"closed","aria-controls":w.getContentId(e.context),onClick(c){c.defaultPrevented||t("TOGGLE")}})},getBackdropProps(){return n.element({...re.backdrop.attrs,dir:e.context.dir,hidden:!r,id:w.getBackdropId(e.context),"data-state":r?"open":"closed"})},getPositionerProps(){return n.element({...re.positioner.attrs,dir:e.context.dir,id:w.getPositionerId(e.context),style:{pointerEvents:r?void 0:"none"}})},getContentProps(){return n.element({...re.content.attrs,dir:e.context.dir,role:e.context.role,hidden:!r,id:w.getContentId(e.context),tabIndex:-1,"data-state":r?"open":"closed","aria-modal":!0,"aria-label":s||void 0,"aria-labelledby":s||!o.title?void 0:w.getTitleId(e.context),"aria-describedby":o.description?w.getDescriptionId(e.context):void 0})},getTitleProps(){return n.element({...re.title.attrs,dir:e.context.dir,id:w.getTitleId(e.context)})},getDescriptionProps(){return n.element({...re.description.attrs,dir:e.context.dir,id:w.getDescriptionId(e.context)})},getCloseTriggerProps(){return n.button({...re.closeTrigger.attrs,dir:e.context.dir,id:w.getCloseTriggerId(e.context),type:"button",onClick(c){c.defaultPrevented||(c.stopPropagation(),t("CLOSE"))}})}}}function ai(e){const t=le(e);return De({id:"dialog",initial:t.open?"open":"closed",context:{role:"dialog",renderedElements:{title:!0,description:!0},modal:!0,trapFocus:!0,preventScroll:!0,closeOnInteractOutside:!0,closeOnEscape:!0,restoreFocus:!0,...t},created:["setAlertDialogProps"],watch:{open:["toggleVisibility"]},states:{open:{entry:["checkRenderedElements","syncZIndex"],activities:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],on:{"CONTROLLED.CLOSE":{target:"closed"},CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}]}},closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}}}},{guards:{isOpenControlled:n=>!!n["open.controlled"]},activities:{trackDismissableElement(n,s,{send:r}){return qo(()=>w.getContentEl(n),{defer:!0,pointerBlocking:n.modal,exclude:[w.getTriggerEl(n)],onInteractOutside(c){var i;(i=n.onInteractOutside)==null||i.call(n,c),n.closeOnInteractOutside||c.preventDefault()},persistentElements:n.persistentElements,onFocusOutside:n.onFocusOutside,onPointerDownOutside:n.onPointerDownOutside,onEscapeKeyDown(c){var i;(i=n.onEscapeKeyDown)==null||i.call(n,c),n.closeOnEscape||c.preventDefault()},onDismiss(){r({type:"CLOSE",src:"interact-outside"})}})},preventScroll(n){if(n.preventScroll)return ri(w.getDoc(n))},trapFocus(n){return!n.trapFocus||!n.modal?void 0:ti(()=>w.getContentEl(n),{preventScroll:!0,returnFocusOnDeactivate:!!n.restoreFocus,initialFocus:n.initialFocusEl,setReturnFocus:r=>{var o;return((o=n.finalFocusEl)==null?void 0:o.call(n))??r}})},hideContentBelow(n){return n.modal?jo(()=>[w.getContentEl(n)],{defer:!0}):void 0}},actions:{setAlertDialogProps(n){n.role==="alertdialog"&&(n.initialFocusEl||(n.initialFocusEl=()=>w.getCloseTriggerEl(n)),n.closeOnInteractOutside=!1)},checkRenderedElements(n){z(()=>{n.renderedElements.title=!!w.getTitleEl(n),n.renderedElements.description=!!w.getDescriptionEl(n)})},syncZIndex(n){z(()=>{const s=w.getContentEl(n);if(!s)return;const r=kr(s);[w.getPositionerEl(n),w.getBackdropEl(n)].forEach(c=>{c==null||c.style.setProperty("--z-index",r.zIndex)})})},invokeOnClose(n){var s;(s=n.onOpenChange)==null||s.call(n,{open:!1})},invokeOnOpen(n){var s;(s=n.onOpenChange)==null||s.call(n,{open:!0})},toggleVisibility(n,s,{send:r}){r({type:n.open?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:s})}}})}wt()(["aria-label","closeOnEscape","closeOnInteractOutside","dir","finalFocusEl","getRootNode","getRootNode","id","id","ids","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","open.controlled","open","persistentElements","preventScroll","restoreFocus","role","trapFocus"]);const ci=(e={})=>{const{getRootNode:t}=Dt(),{dir:n}=Gn(),s={id:v.useId(),getRootNode:t,dir:n,open:e.defaultOpen,"open.controlled":e.open!==void 0,...e},r={...s,open:e.open,onOpenChange:Oe(e.onOpenChange,{sync:!0}),onEscapeKeyDown:Oe(e.onEscapeKeyDown),onInteractOutside:Oe(e.onInteractOutside)},[o,c]=Xe(ai(s),{context:r});return ii(o,c,Ae)},li=e=>{const[t,{children:n,...s}]=Oo(e),[r]=To(t),o=ci(s),c=Kn(I({present:o.open},t));return h.jsx(Po,{value:o,children:h.jsx(Eo,{value:r,children:h.jsx(So,{value:c,children:n})})})},Qn=v.forwardRef((e,t)=>{const n=de(),s=I(n.getTitleProps(),e);return h.jsx(L.h2,{...s,ref:t})});Qn.displayName="DialogTitle";const es=v.forwardRef((e,t)=>{const n=de(),s=At(),r=I({...n.getTriggerProps(),"aria-controls":s.unmounted?void 0:n.getTriggerProps()["aria-controls"]},e);return h.jsx(L.button,{...r,ref:t})});es.displayName="DialogTrigger";const ui=e=>{var u;const{children:t,disabled:n}=e,[s,r]=v.useState((u=e.container)==null?void 0:u.current),o=v.useSyncExternalStore(fi,()=>!1,()=>!0),{getRootNode:c}=Dt();if(v.useEffect(()=>{r(()=>{var a;return(a=e.container)==null?void 0:a.current})},[e.container]),o||n)return h.jsx(h.Fragment,{children:t});const i=s??di(c);return h.jsx(h.Fragment,{children:v.Children.map(t,a=>us.createPortal(a,i))})},di=e=>{const t=e==null?void 0:e(),n=t.getRootNode();return Ie(n)?n:U(t).body},fi=()=>()=>{},hi=v.createContext({}),pi={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",full:"max-w-full mx-4"};function gi({open:e,onOpenChange:t,children:n,modal:s=!0,closeOnInteractOutside:r=!0,closeOnEscape:o=!0}){return h.jsx(li,{open:e,onOpenChange:t,modal:s,closeOnInteractOutside:r,closeOnEscape:o,children:n})}function mi({children:e,className:t}){return h.jsx(es,{className:t,children:e})}function yi({children:e}){return h.jsx(ui,{children:e})}function vi({className:e}){return h.jsx(Wn,{className:x("fixed inset-0 bg-black/50 backdrop-blur-sm","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),style:{zIndex:9999}})}function bi({children:e}){return h.jsx(Xn,{className:"fixed inset-0 flex items-center justify-center p-4",style:{zIndex:1e4},children:e})}function Ei({children:e,size:t="md",className:n}){return h.jsx(hi.Provider,{value:{size:t},children:h.jsx(zn,{className:x("relative w-full rounded-lg bg-card text-card-foreground shadow-lg border border-border","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=closed]:slide-out-to-bottom-[2%] data-[state=open]:slide-in-from-bottom-[2%]","duration-200",pi[t],n),children:e})})}function xi({children:e,className:t}){return h.jsx("div",{className:x("flex items-start justify-between gap-4 p-6 pb-4",t),children:e})}function Ti({children:e,className:t}){return h.jsx(Qn,{className:x("text-lg font-semibold text-foreground",t),children:e})}function Ci({children:e,className:t}){return h.jsx(Yn,{className:x("text-sm text-muted-foreground",t),children:e})}function wi({children:e,className:t}){return h.jsx("div",{className:x("px-6 py-4",t),children:e})}function Ni({children:e,className:t}){return h.jsx("div",{className:x("flex justify-end gap-2 p-6 pt-4",t),children:e})}function Pi({className:e}){return h.jsx(qn,{className:x("absolute right-4 top-4 rounded-md p-2 text-muted-foreground","hover:bg-secondary hover:text-foreground","focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:pointer-events-none","transition-colors",e),"aria-label":"Close dialog",children:h.jsx(te.X,{className:"h-4 w-4"})})}const Si={Root:gi,Trigger:mi,Portal:yi,Backdrop:vi,Positioner:bi,Content:Ei,Header:xi,Title:Ti,Description:Ci,Body:wi,Footer:Ni,CloseTrigger:Pi};function Oi({className:e,type:t="text",label:n,id:s,...r}){const o=h.jsx("input",{id:s,type:t,className:x("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm","ring-offset-background","file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50",e),...r});return n?h.jsxs("div",{className:"w-full",children:[h.jsx("label",{htmlFor:s,className:"block text-sm font-medium mb-1.5 text-card-foreground",children:n}),o]}):o}const ki={default:"bg-primary",success:"bg-green-600",warning:"bg-yellow-600",error:"bg-destructive"},Ii={sm:"h-1",md:"h-2",lg:"h-3"};function Di({value:e=0,indeterminate:t=!1,label:n,showValue:s=!1,variant:r="default",size:o="md",className:c}){const i=Math.min(100,Math.max(0,e));return h.jsxs("div",{className:x("w-full",c),children:[(n||s)&&h.jsxs("div",{className:"flex justify-between items-center mb-2",children:[n&&h.jsx("span",{className:"text-sm font-medium",children:n}),s&&!t&&h.jsxs("span",{className:"text-sm text-muted-foreground",children:[i,"%"]})]}),h.jsx("div",{className:x("w-full overflow-hidden rounded-full bg-muted",Ii[o]),role:"progressbar","aria-valuenow":t?void 0:i,"aria-valuemin":0,"aria-valuemax":100,"aria-label":n||"Progress",children:h.jsx("div",{className:x("h-full rounded-full transition-all duration-500 ease-out",ki[r],t&&"animate-pulse w-full"),style:{width:t?"100%":`${i}%`}})})]})}const ts=v.createContext({});function Ai({children:e,variant:t="default",interactive:n=!1,className:s}){return h.jsx(ts.Provider,{value:{variant:t,interactive:n},children:h.jsx("div",{className:x("relative w-full overflow-x-auto",s),children:h.jsx("table",{className:"w-full caption-bottom text-sm",children:e})})})}function Ri({children:e,className:t}){return h.jsx("thead",{className:x("[&_tr]:border-b",t),children:e})}function Li({children:e,className:t}){return h.jsx("tbody",{className:x("[&_tr:last-child]:border-0",t),children:e})}function ji({children:e,onClick:t,selected:n=!1,className:s}){const{interactive:r}=v.useContext(ts),o=t||r;return h.jsx("tr",{className:x("border-b transition-colors",o&&"cursor-pointer hover:bg-muted/50 data-[state=selected]:bg-muted",n&&"bg-muted",s),onClick:t,role:t?"button":void 0,tabIndex:t?0:void 0,"data-state":n?"selected":void 0,onKeyDown:c=>{t&&(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t())},children:e})}function Fi({children:e,align:t="left",sortable:n=!1,sorted:s=!1,onSort:r,className:o}){const c=()=>{n&&r&&r()};return h.jsx("th",{className:x("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t==="center"&&"text-center",t==="right"&&"text-right",n&&"cursor-pointer select-none hover:bg-muted/50 transition-colors",o),onClick:c,role:n?"button":void 0,tabIndex:n?0:void 0,"aria-sort":s?s==="asc"?"ascending":"descending":void 0,onKeyDown:i=>{n&&r&&(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),r())},children:h.jsxs("div",{className:x("flex items-center gap-2",t==="center"&&"justify-center",t==="right"&&"justify-end"),children:[e,n&&h.jsx("span",{className:"text-xs","aria-hidden":"true",children:s==="asc"?"↑":s==="desc"?"↓":"↕"})]})})}function Mi({children:e,align:t="left",className:n}){return h.jsx("td",{className:x("p-4 align-middle [&:has([role=checkbox])]:pr-0",t==="center"&&"text-center",t==="right"&&"text-right",n),children:e})}function _i({children:e,className:t}){return h.jsx("tfoot",{className:x("border-t font-medium",t),children:e})}function Bi({children:e,className:t}){return h.jsx("caption",{className:x("mt-4 text-sm text-muted-foreground",t),children:e})}const F={Root:Ai,Header:Ri,Body:Li,Row:ji,HeadCell:Fi,Cell:Mi,Footer:_i,Caption:Bi};function $i({products:e,isLoading:t=!1,isError:n=!1,error:s,onRefresh:r,onProductClick:o,className:c,currency:i="USD",sortField:u,sortDirection:a,onSort:l}){const[d,f]=v.useState("name"),[p,g]=v.useState("asc"),m=u??d,N=a??p,b=P=>{const D=m===P&&N==="asc"?"desc":"asc";l?l(P,D):(f(P),g(D))},O=[...e].sort((P,D)=>{let E=0;switch(m){case"name":E=P.name.localeCompare(D.name);break;case"price":E=P.price-D.price;break;case"expiration":E=new Date(P.expiration).getTime()-new Date(D.expiration).getTime();break}return N==="asc"?E:-E}),C=P=>new Intl.NumberFormat("en-US",{style:"currency",currency:i||"USD"}).format(P),Y=P=>new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric"}).format(new Date(P));return n?h.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-8 border rounded-lg text-center",children:[h.jsx("h3",{className:"text-2xl font-semibold",children:"Error Loading Products"}),h.jsx("p",{className:"text-sm max-w-md",children:(s==null?void 0:s.message)||"Failed to load products"}),r&&h.jsx(it,{onClick:r,variant:"default",children:"Retry"})]}):h.jsxs("div",{className:x("w-full",c),children:[r&&h.jsxs("div",{className:"flex items-center justify-between py-4 mb-4 border-b",children:[h.jsx("h2",{className:"text-2xl font-semibold",children:"Products Catalog"}),h.jsx(it,{onClick:r,variant:"ghost",size:"sm",loading:t,children:"Refresh"})]}),h.jsxs(F.Root,{variant:"bordered",interactive:!0,children:[h.jsx(F.Header,{children:h.jsxs(F.Row,{children:[h.jsx(F.HeadCell,{sortable:!0,sorted:m==="name"?N:!1,onSort:()=>b("name"),children:"Product Name"}),h.jsx(F.HeadCell,{align:"right",sortable:!0,sorted:m==="price"?N:!1,onSort:()=>b("price"),children:"Price"}),h.jsx(F.HeadCell,{align:"right",sortable:!0,sorted:m==="expiration"?N:!1,onSort:()=>b("expiration"),children:"Expiration Date"})]})}),h.jsx(F.Body,{children:t?h.jsx(F.Row,{children:h.jsx(F.Cell,{align:"center",className:"py-8 text-center italic",children:"Loading products..."})}):O.length===0?h.jsx(F.Row,{children:h.jsx(F.Cell,{align:"center",className:"py-8 text-center text-muted-foreground italic",children:"No products found"})}):O.map(P=>h.jsxs(F.Row,{onClick:o?()=>o(P):void 0,children:[h.jsx(F.Cell,{children:P.name}),h.jsx(F.Cell,{align:"right",className:"font-medium",children:(()=>{var E;if(i==="USD")return C(P.price);const D=(E=P.rates)==null?void 0:E.find(T=>T.currency===i);return C(D?D.convertedPrice:P.price)})()}),h.jsx(F.Cell,{align:"right",children:Y(P.expiration)})]},P.id))})]})]})}function Hi({children:e,className:t}){return h.jsx(_.Select.Positioner,{style:{zIndex:9999},children:h.jsx(_.Select.Content,{style:{backgroundColor:"white",zIndex:9999},className:x("w-full mt-1 max-h-60 overflow-auto rounded-md border border-gray-200 shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",t),children:e})})}function Vi(){return h.jsx(_.Select.HiddenSelect,{})}function Gi({className:e,children:t,...n}){return h.jsxs(_.Select.Item,{className:x("relative flex cursor-pointer items-center gap-2 px-3 py-2 text-sm outline-none","hover:bg-gray-100","data-[highlighted]:bg-gray-100","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[h.jsx(_.Select.ItemText,{children:t}),h.jsx(_.Select.ItemIndicator,{className:"ml-auto",children:h.jsx(te.Check,{className:"h-2 w-2 text-blue-600"})})]})}function Ui({className:e,children:t,...n}){return h.jsx(_.Select.ItemGroup,{className:x("py-1",e),...n,children:t})}function Ki({className:e,children:t,...n}){return h.jsx(_.Select.ItemGroupLabel,{className:x("px-3 py-1.5 text-xs font-semibold text-gray-500",e),...n,children:t})}function Wi({children:e,className:t}){return h.jsx(_.Select.Label,{className:x("mb-1 block text-sm font-medium text-gray-700",t),children:e})}const qi=v.createContext({});function zi(e){const{items:t,...n}=e,s=v.useMemo(()=>_.createListCollection({items:t}),[t]);return h.jsx(qi.Provider,{value:{},children:h.jsx(_.Select.Root,{collection:s,positioning:{sameWidth:!0},...n})})}function Yi({className:e,placeholder:t}){return h.jsxs(_.Select.Control,{className:x("flex items-center justify-between gap-2 rounded-md border border-gray-300 bg-white px-3 py-2 text-sm","hover:border-gray-400","focus-within:border-blue-500 focus-within:ring-1 focus-within:ring-blue-500","disabled:cursor-not-allowed disabled:opacity-50",e),children:[h.jsx(_.Select.Trigger,{className:"flex flex-1 items-center gap-2",children:h.jsx(_.Select.ValueText,{placeholder:t||"Select an option"})}),h.jsx(_.Select.Indicator,{children:h.jsx(te.ChevronDown,{className:"h-4 w-4 text-gray-500"})})]})}const Xi={Root:zi,Label:Wi,Trigger:Yi,Content:Hi,Item:Gi,ItemGroup:Ui,ItemGroupLabel:Ki,HiddenSelect:Vi};var Zi=ye("toast").parts("group","root","title","description","actionTrigger","closeTrigger"),pe=Zi.build(),M=It({getRegionId:e=>`toast-group:${e}`,getRegionEl:(e,t)=>M.getById(e,`toast-group:${t}`),getRootId:e=>`toast:${e.id}`,getRootEl:e=>M.getById(e,M.getRootId(e)),getTitleId:e=>`toast:${e.id}:title`,getDescriptionId:e=>`toast:${e.id}:description`,getCloseTriggerId:e=>`toast${e.id}:close`});function Rt(e,t){return e.filter(n=>n.state.context.placement===t)}var sn={info:5e3,error:5e3,success:2e3,loading:1/0,DEFAULT:5e3};function rn(e,t){return e??sn[t]??sn.DEFAULT}function Ji(e,t){var l;const n=e.offsets,s=typeof n=="string"?{left:n,right:n,bottom:n,top:n}:n,r=e.dir==="rtl",o=t.replace("-start",r?"-right":"-left").replace("-end",r?"-left":"-right"),c=o.includes("right"),i=o.includes("left"),u={position:"fixed",pointerEvents:e.count>0?void 0:"none",display:"flex",flexDirection:"column","--gap":`${e.gap}px`,"--first-height":`${((l=e.heights[0])==null?void 0:l.height)||0}px`,zIndex:mr};let a="center";if(c&&(a="flex-end"),i&&(a="flex-start"),u.alignItems=a,o.includes("top")){const d=s.top;u.top=`max(env(safe-area-inset-top, 0px), ${d})`}if(o.includes("bottom")){const d=s.bottom;u.bottom=`max(env(safe-area-inset-bottom, 0px), ${d})`}if(!o.includes("left")){const d=s.right;u.insetInlineEnd=`calc(env(safe-area-inset-right, 0px) + ${d})`}if(!o.includes("right")){const d=s.left;u.insetInlineStart=`calc(env(safe-area-inset-left, 0px) + ${d})`}return u}function Qi(e,t){const[n]=e.placement.split("-"),s=!e.frontmost,r=!e.stacked,o={position:"absolute",pointerEvents:"auto","--opacity":"0","--remove-delay":`${e.removeDelay}ms`,"--duration":`${e.type==="loading"?Number.MAX_SAFE_INTEGER:e.duration}ms`,"--initial-height":`${e.height}px`,"--offset":`${e.offset}px`,"--index":e.index,"--z-index":e.zIndex,"--lift-amount":"calc(var(--lift) * var(--gap))","--y":"100%","--x":"0"},c=i=>Object.assign(o,i);return n==="top"?c({top:"0","--sign":"-1","--y":"-100%","--lift":"1"}):n==="bottom"&&c({bottom:"0","--sign":"1","--y":"100%","--lift":"-1"}),e.mounted&&(c({"--y":"0","--opacity":"1"}),e.stacked&&c({"--y":"calc(var(--lift) * var(--offset))","--height":"var(--initial-height)"})),t||c({"--opacity":"0",pointerEvents:"none"}),s&&r&&(c({"--base-scale":"var(--index) * 0.05 + 1","--y":"calc(var(--lift-amount) * var(--index))","--scale":"calc(-1 * var(--base-scale))","--height":"var(--first-height)"}),t||c({"--y":"calc(var(--sign) * 40%)"})),s&&e.stacked&&!t&&c({"--y":"calc(var(--lift) * var(--offset) + var(--lift) * -100%)"}),e.frontmost&&!t&&c({"--y":"calc(var(--lift) * -100%)"}),o}function ea(e,t){const n={position:"absolute",inset:"0",scale:"1 2",pointerEvents:t?"none":"auto"},s=r=>Object.assign(n,r);return e.frontmost&&!t&&s({height:"calc(var(--initial-height) + 80%)"}),n}function ta(e,t){return{position:"absolute",left:"0",height:"calc(var(--gap) + 2px)",bottom:"100%",width:"100%"}}function na(e,t,n){function s(){return Zs(e)?e.getState():e}function r(l){return Rt(s().context.toasts,l)}function o(l){const d=s().context.toasts;return d.length?!!d.find(f=>f.id==l):!1}function c(l){const d=`toast:${ft()}`,f=l.id?l.id:d;return o(f)||t({type:"ADD_TOAST",toast:{...l,id:f}}),f}function i(l,d){return o(l)&&t({type:"UPDATE_TOAST",id:l,toast:d}),l}function u(l){const{id:d}=l;return(d?o(d):!1)&&d!=null?i(d,l):c(l)}function a(l){l==null?t("DISMISS_ALL"):o(l)&&t({type:"DISMISS_TOAST",id:l})}return{getCount(){return s().context.count},getPlacements(){const d=s().context.toasts.map(f=>f.state.context.placement);return Array.from(new Set(d))},getToastsByPlacement:r,isVisible:o,create:c,update:i,upsert:u,dismiss:a,remove(l){l==null?t("REMOVE_ALL"):o(l)&&t({type:"REMOVE_TOAST",id:l})},dismissByPlacement(l){r(l).forEach(f=>a(f.id))},loading(l){return u({...l,type:"loading"})},success(l){return u({...l,type:"success"})},error(l){return u({...l,type:"error"})},promise(l,d,f={}){const p=u({...f,...d.loading,type:"loading"});return Pe(l).then(g=>{const m=Pe(d.success,g);u({...f,...m,id:p,type:"success"})}).catch(g=>{const m=Pe(d.error,g);u({...f,...m,id:p,type:"error"})}).finally(()=>{var g;(g=d.finally)==null||g.call(d)}),p},pause(l){l==null?t("PAUSE_ALL"):o(l)&&t({type:"PAUSE_TOAST",id:l})},resume(l){l==null?t("RESUME_ALL"):o(l)&&t({type:"RESUME_TOAST",id:l})},getGroupProps(l){const{placement:d,label:f="Notifications"}=l,p=s(),g=p.context.hotkey.join("+").replace(/Key/g,"").replace(/Digit/g,""),[m,N="center"]=d.split("-");return n.element({...pe.group.attrs,dir:p.context.dir,tabIndex:-1,"aria-label":`${d} ${f} ${g}`,id:M.getRegionId(d),"data-placement":d,"data-side":m,"data-align":N,"aria-live":"polite",role:"region",style:Ji(p.context,d),onMouseMove(){t({type:"REGION.POINTER_ENTER",placement:d})},onMouseLeave(){t({type:"REGION.POINTER_LEAVE",placement:d})},onFocus(b){t({type:"REGION.FOCUS",target:b.relatedTarget})},onBlur(b){p.context.isFocusWithin&&!be(b.currentTarget,b.relatedTarget)&&t({type:"REGION.BLUR"})}})},subscribe(l){const d=s();return We(d.context.toasts,()=>{const p=r(d.context.placement).map(g=>g.getState().context);l(p)})}}}var{not:sa,and:ra,or:oa}=xn;function ia(e){const{type:t="info",duration:n,id:s="1",placement:r="bottom",removeDelay:o=200,...c}=e,i=le(c),u=rn(n,t);return De({id:s,context:{id:s,type:t,remaining:u,duration:u,removeDelay:o,createdAt:Date.now(),placement:r,...i,height:0,offset:0,frontmost:!1,mounted:!1,index:-1,zIndex:0},initial:t==="loading"?"visible:persist":"visible",on:{UPDATE:[{guard:ra("hasTypeChanged","isChangingToLoading"),target:"visible:persist",actions:["setContext"]},{guard:oa("hasDurationChanged","hasTypeChanged"),target:"visible:updating",actions:["setContext"]},{actions:["setContext"]}],MEASURE:{actions:["measureHeight"]}},entry:["invokeOnVisible"],activities:["trackHeight"],states:{"visible:updating":{tags:["visible","updating"],after:{0:"visible"}},"visible:persist":{tags:["visible","paused"],on:{RESUME:{guard:sa("isLoadingType"),target:"visible",actions:["setCreatedAt"]},DISMISS:"dismissing"}},visible:{tags:["visible"],after:{VISIBLE_DURATION:"dismissing"},on:{DISMISS:"dismissing",PAUSE:{target:"visible:persist",actions:"setRemainingDuration"}}},dismissing:{entry:"invokeOnDismiss",after:{REMOVE_DELAY:{target:"unmounted",actions:"notifyParentToRemove"}}},unmounted:{entry:"invokeOnUnmount",type:"final"}}},{activities:{trackHeight(a,l,{self:d}){let f;return z(()=>{const p=M.getRootEl(a);if(!p)return;a.mounted=!0;const g=Xr(p,"[data-ghost]");me(g.length!==2,"[toast] No ghost element found in toast. Render the `ghostBefore` and `ghostAfter` elements");const m=()=>{const O=p.style.height;p.style.height="auto";const C=p.getBoundingClientRect().height;p.style.height=O,a.height=C,d.sendParent({type:"UPDATE_HEIGHT",id:d.id,height:C,placement:a.placement})};m();const N=M.getWin(a),b=new N.MutationObserver(m);b.observe(p,{childList:!0,subtree:!0,characterData:!0}),f=()=>b.disconnect()}),()=>f==null?void 0:f()}},guards:{isChangingToLoading:(a,l)=>{var d;return((d=l.toast)==null?void 0:d.type)==="loading"},isLoadingType:a=>a.type==="loading",hasTypeChanged:(a,l)=>{var d;return((d=l.toast)==null?void 0:d.type)!=null&&l.toast.type!==a.type},hasDurationChanged:(a,l)=>{var d;return((d=l.toast)==null?void 0:d.duration)!=null&&l.toast.duration!==a.duration}},delays:{VISIBLE_DURATION:a=>a.remaining,REMOVE_DELAY:a=>a.removeDelay},actions:{measureHeight(a,l,{self:d}){z(()=>{const f=M.getRootEl(a);if(!f)return;a.mounted=!0;const p=f.style.height;f.style.height="auto";const g=f.getBoundingClientRect().height;f.style.height=p,a.height=g,d.sendParent({type:"UPDATE_HEIGHT",id:d.id,height:g,placement:a.placement})})},setRemainingDuration(a){a.remaining-=Date.now()-a.createdAt},setCreatedAt(a){a.createdAt=Date.now()},notifyParentToRemove(a,l,{self:d}){d.sendParent({type:"REMOVE_TOAST",id:d.id})},invokeOnDismiss(a){var l;(l=a.onStatusChange)==null||l.call(a,{status:"dismissing"})},invokeOnUnmount(a){var l;(l=a.onStatusChange)==null||l.call(a,{status:"unmounted"})},invokeOnVisible(a){var l;(l=a.onStatusChange)==null||l.call(a,{status:"visible"})},setContext(a,l){var g,m;const d=(g=l.toast)==null?void 0:g.duration,f=((m=l.toast)==null?void 0:m.type)??a.type,p=rn(d,f);Object.assign(a,{...l.toast,duration:p,remaining:p})}}})}function aa(e){const t=le(e);return De({id:"toaster",initial:t.overlap?"overlap":"stack",context:{dir:"ltr",max:Number.MAX_SAFE_INTEGER,gap:16,pauseOnPageIdle:!1,hotkey:["altKey","KeyT"],offsets:"1rem",placement:"bottom",removeDelay:200,...t,toasts:[],lastFocusedEl:null,isFocusWithin:!1,heights:[]},computed:{count:n=>n.toasts.length},activities:["trackDocumentVisibility","trackHotKeyPress"],watch:{toasts:["collapsedIfEmpty","setDismissableBranch"]},exit:["removeToasts","clearDismissableBranch","clearLastFocusedEl"],on:{PAUSE_TOAST:{actions:["pauseToast"]},PAUSE_ALL:{actions:["pauseToasts"]},RESUME_TOAST:{actions:["resumeToast"]},RESUME_ALL:{actions:["resumeToasts"]},ADD_TOAST:{guard:"isWithinRange",actions:["createToast","syncToastIndex"]},UPDATE_TOAST:{actions:["updateToast"]},DISMISS_TOAST:{actions:["dismissToast"]},DISMISS_ALL:{actions:["dismissToasts"]},REMOVE_TOAST:{actions:["removeToast","syncToastIndex","syncToastOffset"]},REMOVE_ALL:{actions:["removeToasts"]},UPDATE_HEIGHT:{actions:["syncHeights","syncToastOffset"]},"DOC.HOTKEY":{actions:["focusRegionEl"]},"REGION.BLUR":[{guard:"isOverlapping",target:"overlap",actions:["resumeToasts","restoreLastFocusedEl"]},{actions:["resumeToasts","restoreLastFocusedEl"]}]},states:{stack:{entry:["expandToasts"],on:{"REGION.POINTER_LEAVE":[{guard:"isOverlapping",target:"overlap",actions:["resumeToasts"]},{actions:["resumeToasts"]}],"REGION.OVERLAP":{target:"overlap"},"REGION.FOCUS":{actions:["setLastFocusedEl","pauseToasts"]},"REGION.POINTER_ENTER":{actions:["pauseToasts"]}}},overlap:{entry:["collapseToasts"],on:{"REGION.STACK":{target:"stack"},"REGION.POINTER_ENTER":{target:"stack",actions:["pauseToasts"]},"REGION.FOCUS":{target:"stack",actions:["setLastFocusedEl","pauseToasts"]}}}}},{guards:{isWithinRange:n=>n.toasts.length<n.max,isOverlapping:n=>!!n.overlap},activities:{trackHotKeyPress(n,s,{send:r}){return A(document,"keydown",c=>{n.hotkey.every(u=>c[u]||c.code===u)&&r({type:"DOC.HOTKEY"})},{capture:!0})},trackDocumentVisibility(n,s,{send:r}){if(!n.pauseOnPageIdle)return;const o=M.getDoc(n);return A(o,"visibilitychange",()=>{r(o.visibilityState==="hidden"?"PAUSE_ALL":"RESUME_ALL")})}},actions:{setDismissableBranch(n){var c;const r=Rt(n.toasts,n.placement).length>0;if(!r){(c=n._cleanup)==null||c.call(n);return}if(r&&n._cleanup)return;const o=()=>M.getRegionEl(n,n.placement);n._cleanup=zo(o,{defer:!0})},clearDismissableBranch(n){var s;(s=n._cleanup)==null||s.call(n)},focusRegionEl(n){queueMicrotask(()=>{var s;(s=M.getRegionEl(n,n.placement))==null||s.focus()})},expandToasts(n){He(n,s=>{s.state.context.stacked=!0})},collapseToasts(n){He(n,s=>{s.state.context.stacked=!1})},collapsedIfEmpty(n,s,{send:r}){!n.overlap||n.toasts.length>1||r("REGION.OVERLAP")},pauseToast(n,s,{self:r}){r.sendChild("PAUSE",s.id)},pauseToasts(n){n.toasts.forEach(s=>s.send("PAUSE"))},resumeToast(n,s,{self:r}){r.sendChild("RESUME",s.id)},resumeToasts(n){n.toasts.forEach(s=>s.send("RESUME"))},measureToasts(n){n.toasts.forEach(s=>s.send("MEASURE"))},createToast(n,s,{self:r,getState:o}){const c={placement:n.placement,duration:n.duration,removeDelay:n.removeDelay,...s.toast,dir:n.dir,getRootNode:n.getRootNode,stacked:o().matches("stack")},i=ia(c),u=r.spawn(i);n.toasts=[u,...n.toasts]},updateToast(n,s,{self:r}){r.sendChild({type:"UPDATE",toast:s.toast},s.id)},dismissToast(n,s,{self:r}){r.sendChild("DISMISS",s.id)},dismissToasts(n){n.toasts.forEach(s=>s.send("DISMISS"))},removeToast(n,s,{self:r}){r.stopChild(s.id),n.toasts=n.toasts.filter(o=>o.id!==s.id),n.heights=n.heights.filter(o=>o.id!==s.id)},removeToasts(n,s,{self:r}){n.toasts.forEach(o=>r.stopChild(o.id)),n.toasts=[],n.heights=[]},syncHeights(n,s){const r=n.heights.find(o=>o.id===s.id);if(r)r.height=s.height,r.placement=s.placement;else{const o={id:s.id,height:s.height,placement:s.placement};n.heights=[o,...n.heights]}},syncToastIndex(n){He(n,(s,r,o)=>{s.state.context.index=r,s.state.context.frontmost=r===0,s.state.context.zIndex=o.length-r})},syncToastOffset(n,s){const r=s.placement??n.placement;He({...n,placement:r},o=>{const c=Math.max(n.heights.findIndex(u=>u.id===o.id),0),i=n.heights.reduce((u,a,l)=>l>=c?u:u+a.height,0);o.state.context.offset=c*n.gap+i})},setLastFocusedEl(n,s){n.isFocusWithin||!s.target||(n.isFocusWithin=!0,n.lastFocusedEl=ke(s.target))},restoreLastFocusedEl(n){n.isFocusWithin=!1,n.lastFocusedEl&&(n.lastFocusedEl.focus({preventScroll:!0}),n.lastFocusedEl=null)},clearLastFocusedEl(n){n.lastFocusedEl&&(n.lastFocusedEl.focus({preventScroll:!0}),n.lastFocusedEl=null,n.isFocusWithin=!1)}}})}function He(e,t){Rt(e.toasts,e.placement).forEach(t)}function ca(e,t,n){const s=e.hasTag("visible"),r=e.hasTag("paused"),o=e.context.placement,c=e.context.type,[i,u="center"]=o.split("-");return{type:c,title:e.context.title,description:e.context.description,placement:o,visible:s,paused:r,pause(){t("PAUSE")},resume(){t("RESUME")},dismiss(){t("DISMISS")},getRootProps(){return n.element({...pe.root.attrs,dir:e.context.dir,id:M.getRootId(e.context),"data-state":s?"open":"closed","data-type":c,"data-placement":o,"data-align":u,"data-side":i,"data-mounted":$(e.context.mounted),"data-paused":$(r),"data-first":$(e.context.frontmost),"data-sibling":$(!e.context.frontmost),"data-stack":$(e.context.stacked),"data-overlap":$(!e.context.stacked),role:"status","aria-atomic":"true","aria-describedby":e.context.description?M.getDescriptionId(e.context):void 0,"aria-labelledby":e.context.title?M.getTitleId(e.context):void 0,tabIndex:0,style:Qi(e.context,s),onKeyDown(a){a.defaultPrevented||a.key=="Escape"&&(t("DISMISS"),a.preventDefault())}})},getGhostBeforeProps(){return n.element({"data-ghost":"before",style:ea(e.context,s)})},getGhostAfterProps(){return n.element({"data-ghost":"after",style:ta()})},getTitleProps(){return n.element({...pe.title.attrs,id:M.getTitleId(e.context)})},getDescriptionProps(){return n.element({...pe.description.attrs,id:M.getDescriptionId(e.context)})},getActionTriggerProps(){return n.button({...pe.actionTrigger.attrs,type:"button",onClick(a){var l,d;a.defaultPrevented||((d=(l=e.context.action)==null?void 0:l.onClick)==null||d.call(l),t("DISMISS"))}})},getCloseTriggerProps(){return n.button({id:M.getCloseTriggerId(e.context),...pe.closeTrigger.attrs,type:"button","aria-label":"Dismiss notification",onClick(a){a.defaultPrevented||t("DISMISS")}})}}}var vt={connect:na,machine:aa};const la=e=>{const t=vt.machine({id:"1",...e});return{...vt.connect(t,t.send,Ae),machine:t}},[ua,Re]=Z({name:"ToastContext",hookName:"useToastContext",providerName:"<ToastProvider />"}),ns=v.forwardRef((e,t)=>{const n=Re(),s=I(n.getActionTriggerProps(),e);return h.jsx(L.button,{...s,ref:t})});ns.displayName="ToastActionTrigger";const ss=v.forwardRef((e,t)=>{const n=Re(),s=I(n.getCloseTriggerProps(),e);return h.jsx(L.button,{...s,ref:t})});ss.displayName="ToastCloseTrigger";const rs=v.forwardRef((e,t)=>{const n=Re(),s=I(n.getDescriptionProps(),e);return h.jsx(L.div,{...s,ref:t})});rs.displayName="ToastDescription";const os=v.forwardRef((e,t)=>{const n=Re(),s=I(n.getRootProps(),e);return h.jsxs("div",{...s,ref:t,children:[h.jsx("div",{...n.getGhostBeforeProps()}),e.children,h.jsx("div",{...n.getGhostAfterProps()})]})});os.displayName="ToastRoot";const is=v.forwardRef((e,t)=>{const n=Re(),s=I(n.getTitleProps(),e);return h.jsx(L.div,{...s,ref:t})});is.displayName="ToastTitle";const as=v.forwardRef((e,t)=>{const{toaster:n,children:s,...r}=e,[o,c]=Xe(n.machine),i=o.context.placement,u=vt.connect(o,c,Ae),a=u.getToastsByPlacement(i),l=I(u.getGroupProps({placement:i}),r);return h.jsx(L.div,{...l,ref:t,children:a.map(d=>h.jsx(da,{value:d,children:f=>s(f)},d.id))})});as.displayName="Toaster";const da=e=>{const[t,n]=cr(e.value),s=ca(t,n,Ae);return h.jsx(ua,{value:s,children:e.children(t.context)})},ge=la({placement:"bottom-end",duration:5e3,overlap:!0,gap:16}),fa={success:{container:"border-green-200 bg-green-50 text-green-900",icon:"text-green-600",IconComponent:te.CheckCircle},error:{container:"border-red-200 bg-red-50 text-red-900",icon:"text-red-600",IconComponent:te.AlertCircle},warning:{container:"border-yellow-200 bg-yellow-50 text-yellow-900",icon:"text-yellow-600",IconComponent:te.AlertTriangle},info:{container:"border-blue-200 bg-blue-50 text-blue-900",icon:"text-blue-600",IconComponent:te.Info}};function ha({children:e}){return h.jsxs(h.Fragment,{children:[e,h.jsx(as,{toaster:ge,children:t=>{const n=t.type||"info",s=fa[n],r=s.IconComponent;return h.jsxs(os,{className:x("flex items-start gap-3 rounded-lg border p-4 shadow-lg","min-w-[320px] max-w-[420px]","[translate:var(--x)_var(--y)]","[scale:var(--scale)]","[z-index:var(--z-index)]","[height:var(--height)]","[opacity:var(--opacity)]",s.container),children:[h.jsx(r,{className:x("h-5 w-5 flex-shrink-0 mt-0.5",s.icon)}),h.jsxs("div",{className:"flex-1 space-y-1",children:[h.jsx(is,{className:"text-sm font-semibold",children:t.title}),t.description&&h.jsx(rs,{className:"text-sm opacity-90",children:t.description}),t.action&&h.jsx(ns,{className:x("mt-2 inline-flex items-center text-sm font-medium underline-offset-4 hover:underline"),children:t.action.label})]}),h.jsx(ss,{className:x("flex-shrink-0 rounded-md p-1 hover:bg-black/5","focus:outline-none focus:ring-2 focus:ring-offset-2"),"aria-label":"Close notification",children:h.jsx(te.X,{className:"h-4 w-4"})})]})}})]})}const pa={success:e=>ge.create({...e,type:"success"}),error:e=>ge.create({...e,type:"error"}),warning:e=>ge.create({...e,type:"warning"}),info:e=>ge.create({...e,type:"info"})};exports.Button=it;exports.Card=ds;exports.CardContent=gs;exports.CardDescription=ps;exports.CardFooter=ms;exports.CardHeader=fs;exports.CardTitle=hs;exports.Checkbox=bo;exports.Dialog=Si;exports.Input=Oi;exports.ProductsTable=$i;exports.Progress=Di;exports.Select=Xi;exports.Table=F;exports.ToastProvider=ha;exports.cn=x;exports.toast=pa;exports.toaster=ge;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),cs=require("clsx"),ls=require("tailwind-merge"),v=require("react"),us=require("react-dom"),te=require("lucide-react"),_=require("@ark-ui/react");function x(...e){return ls.twMerge(cs.clsx(e))}const ds={variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}};function fs({className:e,variant:t="default",children:n,...s}){return h.jsx("div",{className:x("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",ds.variant[t],e),...s,children:n})}const Ft={variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}};function it({className:e,variant:t="default",size:n="default",children:s,loading:r=!1,disabled:o,...c}){return h.jsxs("button",{className:x("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium","ring-offset-background transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",Ft.variant[t],Ft.size[n],e),disabled:o||r,...c,children:[r&&h.jsxs("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[h.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),h.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),s]})}function hs({className:e,...t}){return h.jsx("div",{className:x("rounded-lg border border-border bg-card text-card-foreground",e),...t})}function ps({className:e,...t}){return h.jsx("div",{className:x("flex flex-col space-y-1.5 p-6",e),...t})}function gs({className:e,...t}){return h.jsx("h3",{className:x("text-2xl font-semibold leading-none tracking-tight",e),...t})}function ms({className:e,...t}){return h.jsx("p",{className:x("text-sm text-muted-foreground",e),...t})}function ys({className:e,...t}){return h.jsx("div",{className:x("p-6 pt-0",e),...t})}function vs({className:e,...t}){return h.jsx("div",{className:x("flex items-center p-6 pt-0",e),...t})}function bs(e,t){return`${e} returned \`undefined\`. Seems you forgot to wrap component within ${t}`}function Z(e={}){const{name:t,strict:n=!0,hookName:s="useContext",providerName:r="Provider",errorMessage:o,defaultValue:c}=e,i=v.createContext(c);i.displayName=t;function u(){var l;const a=v.useContext(i);if(!a&&n){const d=new Error(o??bs(s,r));throw d.name="ContextError",(l=Error.captureStackTrace)==null||l.call(Error,d,u),d}return a}return[i.Provider,u,i]}const[Es,Ye]=Z({name:"CheckboxContext",hookName:"useCheckboxContext",providerName:"<CheckboxProvider />"}),xs=Symbol(),bt=Symbol(),we="a",on="f",Mt="p",an="c",cn="t",ln="h",Ve="w",un="o",dn="k";let Ts=(e,t)=>new Proxy(e,t);const at=Object.getPrototypeOf,ct=new WeakMap,fn=e=>e&&(ct.has(e)?ct.get(e):at(e)===Object.prototype||at(e)===Array.prototype),_t=e=>typeof e=="object"&&e!==null,Cs=e=>Object.values(Object.getOwnPropertyDescriptors(e)).some(t=>!t.configurable&&!t.writable),ws=e=>{if(Array.isArray(e))return Array.from(e);const t=Object.getOwnPropertyDescriptors(e);return Object.values(t).forEach(n=>{n.configurable=!0}),Object.create(at(e),t)},Ns=(e,t)=>{const n={[on]:t};let s=!1;const r=(i,u)=>{if(!s){let a=n[we].get(e);if(a||(a={},n[we].set(e,a)),i===Ve)a[Ve]=!0;else{let l=a[i];l||(l=new Set,a[i]=l),l.add(u)}}},o=()=>{s=!0,n[we].delete(e)},c={get(i,u){return u===bt?e:(r(dn,u),pn(Reflect.get(i,u),n[we],n[an],n[cn]))},has(i,u){return u===xs?(o(),!0):(r(ln,u),Reflect.has(i,u))},getOwnPropertyDescriptor(i,u){return r(un,u),Reflect.getOwnPropertyDescriptor(i,u)},ownKeys(i){return r(Ve),Reflect.ownKeys(i)}};return t&&(c.set=c.deleteProperty=()=>!1),[c,n]},hn=e=>e[bt]||e,pn=(e,t,n,s)=>{if(!fn(e))return e;let r=s&&s.get(e);if(!r){const u=hn(e);Cs(u)?r=[u,ws(u)]:r=[u],s==null||s.set(e,r)}const[o,c]=r;let i=n&&n.get(o);return(!i||i[1][on]!==!!c)&&(i=Ns(o,!!c),i[1][Mt]=Ts(c||o,i[0]),n&&n.set(o,i)),i[1][we]=t,i[1][an]=n,i[1][cn]=s,i[1][Mt]},Ps=(e,t)=>{const n=Reflect.ownKeys(e),s=Reflect.ownKeys(t);return n.length!==s.length||n.some((r,o)=>r!==s[o])},gn=(e,t,n,s,r=Object.is)=>{if(r(e,t))return!1;if(!_t(e)||!_t(t))return!0;const o=n.get(hn(e));if(!o)return!0;if(s){if(s.get(e)===t)return!1;s.set(e,t)}let c=null;for(const i of o[ln]||[])if(c=Reflect.has(e,i)!==Reflect.has(t,i),c)return c;if(o[Ve]===!0){if(c=Ps(e,t),c)return c}else for(const i of o[un]||[]){const u=!!Reflect.getOwnPropertyDescriptor(e,i),a=!!Reflect.getOwnPropertyDescriptor(t,i);if(c=u!==a,c)return c}for(const i of o[dn]||[])if(c=gn(e[i],t[i],n,s,r),c)return c;if(c===null)throw new Error("invalid used");return c},Ss=e=>fn(e)&&e[bt]||null,Bt=(e,t=!0)=>{ct.set(e,t)};function Os(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function Et(e,t){const n=Os();return n?(n[e]||(n[e]=t()),n[e]):t()}var Ne=Et("__zag__refSet",()=>new WeakSet),ks=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,Is=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,Ds=e=>typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeName=="string",As=e=>ks(e)||Is(e)||Ds(e),lt=e=>e!==null&&typeof e=="object",ut=e=>lt(e)&&!Ne.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!As(e)&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer)&&!(e instanceof Promise),Ke=()=>process.env.NODE_ENV!=="production";function $t(e,t,n){typeof n.value=="object"&&!ut(n.value)&&(n.value=ae(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||t==="__proto__"?Object.defineProperty(e,t,n):e[t]=n.value}function ae(e){if(typeof e!="object")return e;var t=0,n,s,r,o=Object.prototype.toString.call(e);if(o==="[object Object]"?r=Object.create(Object.getPrototypeOf(e)||null):o==="[object Array]"?r=Array(e.length):o==="[object Set]"?(r=new Set,e.forEach(function(c){r.add(ae(c))})):o==="[object Map]"?(r=new Map,e.forEach(function(c,i){r.set(ae(i),ae(c))})):o==="[object Date]"?r=new Date(+e):o==="[object RegExp]"?r=new RegExp(e.source,e.flags):o==="[object DataView]"?r=new e.constructor(ae(e.buffer)):o==="[object ArrayBuffer]"?r=e.slice(0):o==="[object Blob]"?r=e.slice():o.slice(-6)==="Array]"&&(r=new e.constructor(e)),r){for(s=Object.getOwnPropertySymbols(e);t<s.length;t++)$t(r,s[t],Object.getOwnPropertyDescriptor(e,s[t]));for(t=0,s=Object.getOwnPropertyNames(e);t<s.length;t++)Object.hasOwnProperty.call(r,n=s[t])&&r[n]===e[n]||$t(r,n,Object.getOwnPropertyDescriptor(e,n))}return r||e}var ie=Et("__zag__proxyStateMap",()=>new WeakMap),Rs=(e=Object.is,t=(i,u)=>new Proxy(i,u),n=new WeakMap,s=(i,u)=>{const a=n.get(i);if((a==null?void 0:a[0])===u)return a[1];const l=Array.isArray(i)?[]:Object.create(Object.getPrototypeOf(i));return Bt(l,!0),n.set(i,[u,l]),Reflect.ownKeys(i).forEach(d=>{const f=Reflect.get(i,d);Ne.has(f)?(Bt(f,!1),l[d]=f):ie.has(f)?l[d]=ne(f):l[d]=f}),Object.freeze(l)},r=new WeakMap,o=[1,1],c=i=>{if(!lt(i))throw new Error("object required");const u=r.get(i);if(u)return u;let a=o[0];const l=new Set,d=(E,T=++o[0])=>{a!==T&&(a=T,l.forEach(S=>S(E,T)))};let f=o[1];const p=(E=++o[1])=>(f!==E&&!l.size&&(f=E,m.forEach(([T])=>{const S=T[1](E);S>a&&(a=S)})),a),g=E=>(T,S)=>{const j=[...T];j[1]=[E,...j[1]],d(j,S)},m=new Map,N=(E,T)=>{if(Ke()&&m.has(E))throw new Error("prop listener already exists");if(l.size){const S=T[3](g(E));m.set(E,[T,S])}else m.set(E,[T])},b=E=>{var S;const T=m.get(E);T&&(m.delete(E),(S=T[1])==null||S.call(T))},O=E=>(l.add(E),l.size===1&&m.forEach(([S,j],J)=>{if(Ke()&&j)throw new Error("remove already exists");const Q=S[3](g(J));m.set(J,[S,Q])}),()=>{l.delete(E),l.size===0&&m.forEach(([S,j],J)=>{j&&(j(),m.set(J,[S]))})}),C=Array.isArray(i)?[]:Object.create(Object.getPrototypeOf(i)),P=t(C,{deleteProperty(E,T){const S=Reflect.get(E,T);b(T);const j=Reflect.deleteProperty(E,T);return j&&d(["delete",[T],S]),j},set(E,T,S,j){var Lt;const J=Reflect.has(E,T),Q=Reflect.get(E,T,j);if(J&&(e(Q,S)||r.has(S)&&e(Q,r.get(S))))return!0;b(T),lt(S)&&(S=Ss(S)||S);let Le=S;if(!((Lt=Object.getOwnPropertyDescriptor(E,T))!=null&&Lt.set)){!ie.has(S)&&ut(S)&&(Le=xt(S));const jt=!Ne.has(Le)&&ie.get(Le);jt&&N(T,jt)}return Reflect.set(E,T,Le,j),d(["set",[T],S,Q]),!0}});r.set(i,P);const D=[C,p,s,O];return ie.set(P,D),Reflect.ownKeys(i).forEach(E=>{const T=Object.getOwnPropertyDescriptor(i,E);T.get||T.set?Object.defineProperty(C,E,T):P[E]=i[E]}),P})=>[c,ie,Ne,e,t,ut,n,s,r,o],[Ls]=Rs();function xt(e={}){return Ls(e)}function We(e,t,n){const s=ie.get(e);Ke()&&!s&&console.warn("Please use proxy object");let r;const o=[],c=s[3];let i=!1;const a=c(l=>{if(o.push(l),n){t(o.splice(0));return}r||(r=Promise.resolve().then(()=>{r=void 0,i&&t(o.splice(0))}))});return i=!0,()=>{i=!1,a()}}function ne(e){const t=ie.get(e);Ke()&&!t&&console.warn("Please use proxy object");const[n,s,r]=t;return r(n,s())}function ke(e){return Ne.add(e),e}function js(e,t){Object.keys(t).forEach(r=>{if(Object.getOwnPropertyDescriptor(e,r))throw new Error("object property already defined");const o=t[r],{get:c,set:i}=typeof o=="function"?{get:o}:o,u={};u.get=()=>c(ne(s)),i&&(u.set=a=>i(s,a)),Object.defineProperty(e,r,u)});const s=xt(e);return s}function Fs(e){for(;e.length>0;)e.pop();return e}var Ht=e=>(e==null?void 0:e.constructor.name)==="Array",Ms=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Tt(e[n],t[n]))return!1;return!0},Tt=(e,t)=>{if(Object.is(e,t))return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(typeof(e==null?void 0:e.isEqual)=="function"&&typeof(t==null?void 0:t.isEqual)=="function")return e.isEqual(t);if(typeof e=="function"&&typeof t=="function")return e.toString()===t.toString();if(Ht(e)&&Ht(t))return Ms(Array.from(e),Array.from(t));if(typeof e!="object"||typeof t!="object")return!1;const n=Object.keys(t??Object.create(null)),s=n.length;for(let r=0;r<s;r++)if(!Reflect.has(e,n[r]))return!1;for(let r=0;r<s;r++){const o=n[r];if(!Tt(e[o],t[o]))return!1}return!0},Pe=(e,...t)=>(typeof e=="function"?e(...t):e)??void 0,X=e=>e,_s=()=>{},dt=(...e)=>(...t)=>{e.forEach(function(n){n==null||n(...t)})},ft=(()=>{let e=0;return()=>(e++,e.toString(36))})(),Bs=()=>process.env.NODE_ENV!=="production",qe=e=>Array.isArray(e),mn=e=>e!=null&&typeof e=="object",Ge=e=>mn(e)&&!qe(e),$s=e=>typeof e=="number"&&!Number.isNaN(e),V=e=>typeof e=="string",ve=e=>typeof e=="function",yn=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Hs=e=>Object.prototype.toString.call(e),vn=Function.prototype.toString,Vs=vn.call(Object),je=e=>{if(!mn(e)||Hs(e)!="[object Object]")return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=yn(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&vn.call(n)==Vs};function le(e){if(!Gs(e)||e===void 0)return e;const t=Reflect.ownKeys(e).filter(s=>typeof s=="string"),n={};for(const s of t){const r=e[s];r!==void 0&&(n[s]=le(r))}return n}var Gs=e=>e&&typeof e=="object"&&e.constructor===Object;function me(...e){const t=e.length===1?e[0]:e[1];(e.length===2?e[0]:!0)&&process.env.NODE_ENV!=="production"&&console.warn(t)}function Ue(...e){const t=e.length===1?e[0]:e[1];if((e.length===2?e[0]:!0)&&process.env.NODE_ENV!=="production")throw new Error(t)}var Us=Object.defineProperty,Ks=(e,t,n)=>t in e?Us(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y=(e,t,n)=>Ks(e,typeof t!="symbol"?t+"":t,n);function bn(e,...t){if(!je(e))throw new TypeError("Source argument must be a plain object");for(const n of t){if(!je(n))continue;const s=le(n);for(const r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r==="__proto__"||r==="constructor"||r==="prototype")continue;const o=e[r],c=n[r];je(c)?e[r]=je(o)?bn(o,c):{...c}:e[r]=c}}return e}function q(e){return V(e)?{type:e}:e}function ee(e){return e?qe(e)?e.slice():[e]:[]}function En(e){return Ge(e)&&e.predicate!=null}var Ws=()=>!0;function Ct(e,t,n,s){return r=>{var o;return V(r)?!!((o=e[r])!=null&&o.call(e,t,n,s)):ve(r)?r(t,n,s):r.predicate(e)(t,n,s)}}function qs(...e){return{predicate:t=>(n,s,r)=>e.map(Ct(t,n,s,r)).some(Boolean)}}function zs(...e){return{predicate:t=>(n,s,r)=>e.map(Ct(t,n,s,r)).every(Boolean)}}function Ys(e){return{predicate:t=>(n,s,r)=>!Ct(t,n,s,r)(e)}}var xn={or:qs,and:zs,not:Ys};function Tn(e,t){return e=e??Ws,(n,s,r)=>{if(V(e)){const o=t[e];return ve(o)?o(n,s,r):o}return En(e)?e.predicate(t)(n,s,r):e==null?void 0:e(n,s,r)}}function Qe(e,t){return(n,s,r)=>En(e)?e.predicate(t)(n,s,r):e}function Xs(e){var o,c;const t=e.computed??X({}),n=e.context??X({}),s=e.initial?(c=(o=e.states)==null?void 0:o[e.initial])==null?void 0:c.tags:[],r=xt({value:e.initial??"",previousValue:"",event:X({}),previousEvent:X({}),context:js(n,t),done:!1,tags:s??[],hasTag(i){return this.tags.includes(i)},matches(...i){return i.includes(this.value)},can(i){return X(this).nextEvents.includes(i)},get nextEvents(){var a,l;const i=((l=(a=e.states)==null?void 0:a[this.value])==null?void 0:l.on)??{},u=(e==null?void 0:e.on)??{};return Object.keys({...i,...u})},get changed(){return this.event.value==="machine.init"||!this.previousValue?!1:this.value!==this.previousValue}});return X(r)}function Ee(e,t){return(n,s)=>{if($s(e))return e;if(ve(e))return e(n,s);if(V(e)){const r=Number.parseFloat(e);if(!Number.isNaN(r))return r;if(t){const o=t==null?void 0:t[e];return Ue(o==null,`[@zag-js/core > determine-delay] Cannot determine delay for \`${e}\`. It doesn't exist in \`options.delays\``),ve(o)?o(n,s):o}}}}function Zs(e){return V(e)?{target:e}:e}function Js(e,t){return(n,s,r)=>ee(e).map(Zs).find(o=>Tn(o.guard,t)(n,s,r)??o.target??o.actions)}var Cn=class{constructor(e,t){var n,s,r,o,c;y(this,"status","Not Started"),y(this,"state"),y(this,"initialState"),y(this,"initialContext"),y(this,"id"),y(this,"type","machine"),y(this,"activityEvents",new Map),y(this,"delayedEvents",new Map),y(this,"stateListeners",new Set),y(this,"doneListeners",new Set),y(this,"contextWatchers",new Set),y(this,"removeStateListener",_s),y(this,"parent"),y(this,"children",new Map),y(this,"guardMap"),y(this,"actionMap"),y(this,"delayMap"),y(this,"activityMap"),y(this,"sync"),y(this,"options"),y(this,"config"),y(this,"_created",()=>{if(!this.config.created)return;const i=q("machine.created");this.executeActions(this.config.created,i)}),y(this,"start",i=>{if(this.state.value="",this.state.tags=[],this.status==="Running")return this;this.status="Running",this.removeStateListener=We(this.state,()=>{this.stateListeners.forEach(p=>{p(this.stateSnapshot)})},this.sync),this.setupContextWatchers(),this.executeActivities(q("machine.start"),ee(this.config.activities),"machine.start"),this.executeActions(this.config.entry,q("machine.start"));const u=q("machine.init"),a=Ge(i)?i.value:i,l=Ge(i)?i.context:void 0;l&&this.setContext(l);const d={target:a??this.config.initial},f=this.getNextStateInfo(d,u);return this.initialState=f,this.performStateChangeEffects(this.state.value,f,u),this}),y(this,"setupContextWatchers",()=>{const{watch:i}=this.config;if(!i)return;let u=ne(this.state.context);const a=We(this.state.context,()=>{var d;const l=ne(this.state.context);for(const[f,p]of Object.entries(i))(((d=this.options.compareFns)==null?void 0:d[f])??Object.is)(u[f],l[f])||this.executeActions(p,this.state.event);u=l});this.contextWatchers.add(a)}),y(this,"stop",()=>{if(this.status!=="Stopped")return this.performExitEffects(this.state.value,q("machine.stop")),this.executeActions(this.config.exit,q("machine.stop")),this.setState(""),this.setEvent("machine.stop"),this.stopStateListeners(),this.stopChildren(),this.stopActivities(),this.stopDelayedEvents(),this.stopContextWatchers(),this.status="Stopped",this}),y(this,"stopStateListeners",()=>{this.removeStateListener(),this.stateListeners.clear()}),y(this,"stopContextWatchers",()=>{this.contextWatchers.forEach(i=>i()),this.contextWatchers.clear()}),y(this,"stopDelayedEvents",()=>{this.delayedEvents.forEach(i=>{i.forEach(u=>u())}),this.delayedEvents.clear()}),y(this,"stopActivities",i=>{var u,a;i?((u=this.activityEvents.get(i))==null||u.forEach(l=>l()),(a=this.activityEvents.get(i))==null||a.clear(),this.activityEvents.delete(i)):(this.activityEvents.forEach(l=>{l.forEach(d=>d()),l.clear()}),this.activityEvents.clear())}),y(this,"sendChild",(i,u)=>{const a=q(i),l=Pe(u,this.contextSnapshot),d=this.children.get(l);d||Ue(`[@zag-js/core] Cannot send '${a.type}' event to unknown child`),d.send(a)}),y(this,"stopChild",i=>{this.children.has(i)||Ue(`[@zag-js/core > stop-child] Cannot stop unknown child ${i}`),this.children.get(i).stop(),this.children.delete(i)}),y(this,"removeChild",i=>{this.children.delete(i)}),y(this,"stopChildren",()=>{this.children.forEach(i=>i.stop()),this.children.clear()}),y(this,"setParent",i=>{this.parent=i}),y(this,"spawn",(i,u)=>{const a=Pe(i);return u&&(a.id=u),a.type="machine.actor",a.setParent(this),this.children.set(a.id,X(a)),a.onDone(()=>{this.removeChild(a.id)}).start(),X(ke(a))}),y(this,"stopActivity",i=>{var a;if(!this.state.value)return;const u=this.activityEvents.get(this.state.value);(a=u==null?void 0:u.get(i))==null||a(),u==null||u.delete(i)}),y(this,"addActivityCleanup",(i,u,a)=>{var l;i&&(this.activityEvents.has(i)?(l=this.activityEvents.get(i))==null||l.set(u,a):this.activityEvents.set(i,new Map([[u,a]])))}),y(this,"setState",i=>{this.state.previousValue=this.state.value,this.state.value=i;const u=this.getStateNode(i);i==null?Fs(this.state.tags):this.state.tags=ee(u==null?void 0:u.tags)}),y(this,"setContext",i=>{i&&bn(this.state.context,i)}),y(this,"setOptions",i=>{const u=le(i);this.actionMap={...this.actionMap,...u.actions},this.delayMap={...this.delayMap,...u.delays},this.activityMap={...this.activityMap,...u.activities},this.guardMap={...this.guardMap,...u.guards}}),y(this,"getStateNode",i=>{var u;if(i)return(u=this.config.states)==null?void 0:u[i]}),y(this,"getNextStateInfo",(i,u)=>{const a=this.determineTransition(i,u),l=!(a!=null&&a.target),d=(a==null?void 0:a.target)??this.state.value,f=this.state.value!==d,p=this.getStateNode(d),m={reenter:!l&&!f&&!(a!=null&&a.internal),transition:a,stateNode:p,target:d,changed:f};return this.log("NextState:",`[${u.type}]`,this.state.value,"---->",m.target),m}),y(this,"getAfterActions",(i,u)=>{let a;const l=this.state.value;return{entry:()=>{a=globalThis.setTimeout(()=>{const d=this.getNextStateInfo(i,this.state.event);this.performStateChangeEffects(l,d,this.state.event)},u)},exit:()=>{globalThis.clearTimeout(a)}}}),y(this,"getDelayedEventActions",i=>{const u=this.getStateNode(i),a=this.state.event;if(!u||!u.after)return;const l=[],d=[];if(qe(u.after)){const f=this.determineTransition(u.after,a);if(!f)return;if(!yn(f,"delay"))throw new Error(`[@zag-js/core > after] Delay is required for after transition: ${JSON.stringify(f)}`);const g=Ee(f.delay,this.delayMap)(this.contextSnapshot,a),m=this.getAfterActions(f,g);return l.push(m.entry),d.push(m.exit),{entries:l,exits:d}}if(Ge(u.after))for(const f in u.after){const p=u.after[f],m=Ee(f,this.delayMap)(this.contextSnapshot,a),N=this.getAfterActions(p,m);l.push(N.entry),d.push(N.exit)}return{entries:l,exits:d}}),y(this,"executeActions",(i,u)=>{var l;const a=Qe(i,this.guardMap)(this.contextSnapshot,u,this.guardMeta);for(const d of ee(a)){const f=V(d)?(l=this.actionMap)==null?void 0:l[d]:d;me(V(d)&&!f,`[@zag-js/core > execute-actions] No implementation found for action: \`${d}\``),f==null||f(this.state.context,u,this.meta)}}),y(this,"executeActivities",(i,u,a)=>{var l;for(const d of u){const f=V(d)?(l=this.activityMap)==null?void 0:l[d]:d;if(!f){me(`[@zag-js/core > execute-activity] No implementation found for activity: \`${d}\``);continue}const p=f(this.state.context,i,this.meta);if(p){const g=V(d)?d:d.name||ft();this.addActivityCleanup(a??this.state.value,g,p)}}}),y(this,"createEveryActivities",(i,u)=>{if(i)if(qe(i)){const a=ee(i).find(p=>{const g=p.delay,N=Ee(g,this.delayMap)(this.contextSnapshot,this.state.event);return Tn(p.guard,this.guardMap)(this.contextSnapshot,this.state.event,this.guardMeta)??N!=null});if(!a)return;const d=Ee(a.delay,this.delayMap)(this.contextSnapshot,this.state.event);u(()=>{const p=globalThis.setInterval(()=>{this.executeActions(a.actions,this.state.event)},d);return()=>{globalThis.clearInterval(p)}})}else for(const a in i){const l=i==null?void 0:i[a],f=Ee(a,this.delayMap)(this.contextSnapshot,this.state.event);u(()=>{const g=globalThis.setInterval(()=>{this.executeActions(l,this.state.event)},f);return()=>{globalThis.clearInterval(g)}})}}),y(this,"setEvent",i=>{this.state.previousEvent=this.state.event,this.state.event=ke(q(i))}),y(this,"performExitEffects",(i,u)=>{const a=this.state.value;if(a==="")return;const l=i?this.getStateNode(i):void 0;this.stopActivities(a);const d=Qe(l==null?void 0:l.exit,this.guardMap)(this.contextSnapshot,u,this.guardMeta),f=ee(d),p=this.delayedEvents.get(a);p&&f.push(...p),this.executeActions(f,u),this.delayedEvents.delete(a)}),y(this,"performEntryEffects",(i,u)=>{const a=this.getStateNode(i),l=ee(a==null?void 0:a.activities);this.createEveryActivities(a==null?void 0:a.every,g=>{l.unshift(g)}),l.length>0&&this.executeActivities(u,l);const d=Qe(a==null?void 0:a.entry,this.guardMap)(this.contextSnapshot,u,this.guardMeta),f=ee(d),p=this.getDelayedEventActions(i);a!=null&&a.after&&p&&(this.delayedEvents.set(i,p==null?void 0:p.exits),f.push(...p.entries)),this.executeActions(f,u),(a==null?void 0:a.type)==="final"&&(this.state.done=!0,this.doneListeners.forEach(g=>{g(this.stateSnapshot)}),this.stop())}),y(this,"performTransitionEffects",(i,u)=>{const a=this.determineTransition(i,u);this.executeActions(a==null?void 0:a.actions,u)}),y(this,"performStateChangeEffects",(i,u,a)=>{this.setEvent(a);const l=u.changed||u.reenter;l&&this.performExitEffects(i,a),this.performTransitionEffects(u.transition,a),this.setState(u.target),l&&this.performEntryEffects(u.target,a)}),y(this,"determineTransition",(i,u)=>{const a=Js(i,this.guardMap);return a==null?void 0:a(this.contextSnapshot,u,this.guardMeta)}),y(this,"sendParent",i=>{var a;this.parent||Ue("[@zag-js/core > send-parent] Cannot send event to an unknown parent");const u=q(i);(a=this.parent)==null||a.send(u)}),y(this,"log",(...i)=>{Bs()&&this.options.debug&&console.log(...i)}),y(this,"send",i=>{const u=q(i);this.transition(this.state.value,u)}),y(this,"transition",(i,u)=>{var p,g;const a=V(i)?this.getStateNode(i):i==null?void 0:i.stateNode,l=q(u);if(!a&&!this.config.on){const m=this.status==="Stopped"?"[@zag-js/core > transition] Cannot transition a stopped machine":`[@zag-js/core > transition] State does not have a definition for \`state\`: ${i}, \`event\`: ${l.type}`;me(m);return}const d=((p=a==null?void 0:a.on)==null?void 0:p[l.type])??((g=this.config.on)==null?void 0:g[l.type]),f=this.getNextStateInfo(d,l);return this.performStateChangeEffects(this.state.value,f,l),f.stateNode}),y(this,"subscribe",i=>(this.stateListeners.add(i),this.status==="Running"&&i(this.stateSnapshot),()=>{this.stateListeners.delete(i)})),y(this,"onDone",i=>(this.doneListeners.add(i),this)),y(this,"onTransition",i=>(this.stateListeners.add(i),this.status==="Running"&&i(this.stateSnapshot),this)),this.config=ae(e),this.options=ae(t??{}),this.id=this.config.id??`machine-${ft()}`,this.guardMap=((n=this.options)==null?void 0:n.guards)??{},this.actionMap=((s=this.options)==null?void 0:s.actions)??{},this.delayMap=((r=this.options)==null?void 0:r.delays)??{},this.activityMap=((o=this.options)==null?void 0:o.activities)??{},this.sync=((c=this.options)==null?void 0:c.sync)??!1,this.state=Xs(this.config),this.initialContext=ne(this.state.context)}get stateSnapshot(){return X(ne(this.state))}getState(){return this.stateSnapshot}get contextSnapshot(){return this.stateSnapshot.context}get self(){const e=this;return{id:this.id,send:this.send.bind(this),sendParent:this.sendParent.bind(this),sendChild:this.sendChild.bind(this),stop:this.stop.bind(this),stopChild:this.stopChild.bind(this),spawn:this.spawn.bind(this),stopActivity:this.stopActivity.bind(this),get state(){return e.stateSnapshot},get initialContext(){return e.initialContext},get initialState(){var t;return((t=e.initialState)==null?void 0:t.target)??""}}}get meta(){var e;return{state:this.stateSnapshot,guards:this.guardMap,send:this.send.bind(this),self:this.self,initialContext:this.initialContext,initialState:((e=this.initialState)==null?void 0:e.target)??"",getState:()=>this.stateSnapshot,getAction:t=>this.actionMap[t],getGuard:t=>this.guardMap[t]}}get guardMeta(){return{state:this.stateSnapshot}}get[Symbol.toStringTag](){return"Machine"}getHydrationState(){const e=this.getState();return{value:e.value,tags:e.tags}}},De=(e,t)=>new Cn(e,t),Qs=e=>e instanceof Cn||(e==null?void 0:e.type)==="machine",er=(...e)=>e.map(t=>{var n;return(n=t==null?void 0:t.trim)==null?void 0:n.call(t)}).filter(Boolean).join(" "),tr=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,Vt=e=>{const t={};let n;for(;n=tr.exec(e);)t[n[1]]=n[2];return t},nr=(e,t)=>{if(V(e)){if(V(t))return`${e};${t}`;e=Vt(e)}else V(t)&&(t=Vt(t));return Object.assign({},e??{},t??{})};function I(...e){let t={};for(let n of e){for(let s in t){if(s.startsWith("on")&&typeof t[s]=="function"&&typeof n[s]=="function"){t[s]=dt(n[s],t[s]);continue}if(s==="className"||s==="class"){t[s]=er(t[s],n[s]);continue}if(s==="style"){t[s]=nr(t[s],n[s]);continue}t[s]=n[s]!==void 0?n[s]:t[s]}for(let s in n)t[s]===void 0&&(t[s]=n[s])}return t}function sr(e){return new Proxy({},{get(){return e}})}var wt=()=>e=>Array.from(new Set(e)),Ae=sr(e=>e),Gt=e=>(e==null?void 0:e.constructor.name)==="Array",rr=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Nt(e[n],t[n]))return!1;return!0},Nt=(e,t)=>{if(Object.is(e,t))return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(typeof(e==null?void 0:e.isEqual)=="function"&&typeof(t==null?void 0:t.isEqual)=="function")return e.isEqual(t);if(typeof e=="function"&&typeof t=="function")return e.toString()===t.toString();if(Gt(e)&&Gt(t))return rr(Array.from(e),Array.from(t));if(typeof e!="object"||typeof t!="object")return!1;const n=Object.keys(t??Object.create(null)),s=n.length;for(let r=0;r<s;r++)if(!Reflect.has(e,n[r]))return!1;for(let r=0;r<s;r++){const o=n[r];if(!Nt(e[o],t[o]))return!1}return!0},or=()=>process.env.NODE_ENV!=="production",ir=Function.prototype.toString;ir.call(Object);function wn(e){if(!ar(e)||e===void 0)return e;const t=Reflect.ownKeys(e).filter(s=>typeof s=="string"),n={};for(const s of t){const r=e[s];r!==void 0&&(n[s]=wn(r))}return n}var ar=e=>e&&typeof e=="object"&&e.constructor===Object;function cr(e,t){const n=v.useRef(!1),s=v.useRef(!1);v.useEffect(()=>{if(n.current&&s.current)return e();s.current=!0},t),v.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}var lr=Et("__zag__targetCache",()=>new WeakMap);function Nn(e,t){const{actions:n,context:s,sync:r}=t??{},o=v.useRef(void 0),c=v.useRef(void 0),i=v.useSyncExternalStore(v.useCallback(d=>We(e.state,d,r),[r]),()=>{const d=ne(e.state);try{if(o.current&&c.current&&!gn(o.current,d,c.current,new WeakMap))return o.current}catch{}return d},()=>ne(e.state));e.setOptions({actions:n});const u=v.useMemo(()=>wn(s??{}),[s]);cr(()=>{const d=Object.entries(u),f=e.contextSnapshot??{};d.map(([m,N])=>({key:m,curr:N,prev:f[m],equal:Nt(f[m],N)})).every(({equal:m})=>m)||e.setContext(u)},[u]);const a=new WeakMap;v.useEffect(()=>{o.current=i,c.current=a});const l=v.useMemo(()=>new WeakMap,[]);return pn(i,a,l,lr)}function ur(e){return[Nn(e),e.send]}function dr(e){const t=v.useRef(void 0);return t.current||(t.current={v:e()}),t.current.v}var fr=typeof document<"u"?v.useLayoutEffect:v.useEffect;function hr(e,t){const{state:n,context:s}=t??{},r=dr(()=>{const c=typeof e=="function"?e():e;return s&&c.setContext(s),c._created(),c}),o=v.useRef(void 0);return fr(()=>{const c=n??o.current;return r.start(c),()=>{or()&&(o.current=r.getHydrationState()),r.stop()}},[]),r}function Xe(e,t){const n=hr(e,t);return[Nn(n,t),n.send,n]}function pr(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Pt(...e){return t=>{for(const n of e)pr(n,t)}}function gr(e){var s,r;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const et=e=>{const t=v.memo(v.forwardRef((n,s)=>{const{asChild:r,children:o,...c}=n;if(!r)return v.createElement(e,{...c,ref:s},o);const i=v.Children.only(o);if(!v.isValidElement(i))return null;const u=gr(i);return v.cloneElement(i,{...I(c,i.props),ref:s?Pt(s,u):u})}));return t.displayName=e.displayName||e.name,t},mr=()=>{const e=new Map;return new Proxy(et,{apply(t,n,s){return et(s[0])},get(t,n){const s=n;return e.has(s)||e.set(s,et(s)),e.get(s)}})},L=mr(),Pn=v.forwardRef((e,t)=>{const n=Ye(),s=I(n.getControlProps(),e);return h.jsx(L.div,{...s,ref:t})});Pn.displayName="CheckboxControl";const St=()=>(e,t)=>t.reduce((n,s)=>{const[r,o]=n,c=s;return o[c]!==void 0&&(r[c]=o[c]),delete o[c],[r,o]},[{},{...e}]);var ye=(e,t=[])=>({parts:(...n)=>{if(yr(t))return ye(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>ye(e,[...t,...n]),rename:n=>ye(n,t),keys:()=>t,build:()=>[...new Set(t)].reduce((n,s)=>Object.assign(n,{[s]:{selector:[`&[data-scope="${fe(e)}"][data-part="${fe(s)}"]`,`& [data-scope="${fe(e)}"][data-part="${fe(s)}"]`].join(", "),attrs:{"data-scope":fe(e),"data-part":fe(s)}}}),{})}),fe=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),yr=e=>e.length===0,tt=(...e)=>t=>e.reduce((n,s)=>s(n),t),Fe=()=>{},Ze=e=>typeof e=="object"&&e!==null,vr=2147483647,$=e=>e?"":void 0,br=1,Er=9,xr=11,B=e=>Ze(e)&&e.nodeType===br&&typeof e.nodeName=="string",Ot=e=>Ze(e)&&e.nodeType===Er,Tr=e=>Ze(e)&&e===e.window,Sn=e=>B(e)?e.localName||"":"#document";function Cr(e){return["html","body","#document"].includes(Sn(e))}var wr=e=>Ze(e)&&e.nodeType!==void 0,Ie=e=>wr(e)&&e.nodeType===xr&&"host"in e,Nr=e=>B(e)&&e.localName==="input",Pr=e=>B(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1,Sr=/(textarea|select)/;function Or(e){if(e==null||!B(e))return!1;try{return Nr(e)&&e.selectionStart!=null||Sr.test(e.localName)||e.isContentEditable||e.getAttribute("contenteditable")==="true"||e.getAttribute("contenteditable")===""}catch{return!1}}function be(e,t){var s;if(!e||!t||!B(e)||!B(t))return!1;const n=(s=t.getRootNode)==null?void 0:s.call(t);if(e===t||e.contains(t))return!0;if(n&&Ie(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function U(e){return Ot(e)?e:Tr(e)?e.document:(e==null?void 0:e.ownerDocument)??document}function kr(e){return U(e).documentElement}function G(e){var t;return Ie(e)?G(e.host):Ot(e)?e.defaultView??window:B(e)?((t=e.ownerDocument)==null?void 0:t.defaultView)??window:window}function On(e){let t=e.activeElement;for(;t!=null&&t.shadowRoot;){const n=t.shadowRoot.activeElement;if(n===t)break;t=n}return t}function Ir(e){if(Sn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ie(e)&&e.host||kr(e);return Ie(t)?t.host:t}var nt=new WeakMap;function Dr(e){return nt.has(e)||nt.set(e,G(e).getComputedStyle(e)),nt.get(e)}var Ar=()=>typeof document<"u";function Rr(){const e=navigator.userAgentData;return(e==null?void 0:e.platform)??navigator.platform}var kn=e=>Ar()&&e.test(Rr()),In=()=>kn(/^Mac/),Lr=()=>kn(/iP(hone|ad|od)|iOS/);function jr(e){var t,n,s;return((t=e.composedPath)==null?void 0:t.call(e))??((s=(n=e.nativeEvent)==null?void 0:n.composedPath)==null?void 0:s.call(n))}function W(e){const t=jr(e);return(t==null?void 0:t[0])??e.target}var Fr=e=>e.button===2||In()&&e.ctrlKey&&e.button===0,Mr=e=>"touches"in e&&e.touches.length>0;function _r(e,t="client"){const n=Mr(e)?e.touches[0]||e.changedTouches[0]:e;return{x:n[`${t}X`],y:n[`${t}Y`]}}var A=(e,t,n,s)=>{const r=typeof e=="function"?e():e;return r==null||r.addEventListener(t,n,s),()=>{r==null||r.removeEventListener(t,n,s)}};function Dn(e,t){const{type:n="HTMLInputElement",property:s="value"}=t,r=G(e)[n].prototype;return Object.getOwnPropertyDescriptor(r,s)??{}}function Br(e){if(e.localName==="input")return"HTMLInputElement";if(e.localName==="textarea")return"HTMLTextAreaElement";if(e.localName==="select")return"HTMLSelectElement"}function $r(e,t,n="value"){var r;const s=Br(e);s&&((r=Dn(e,{type:s,property:n}).set)==null||r.call(e,t)),e.setAttribute(n,t)}function An(e,t){var s;(s=Dn(e,{type:"HTMLInputElement",property:"checked"}).set)==null||s.call(e,t),t?e.setAttribute("checked",""):e.removeAttribute("checked")}function Hr(e,t){const{checked:n,bubbles:s=!0}=t;if(!e)return;const r=G(e);e instanceof r.HTMLInputElement&&(An(e,n),e.dispatchEvent(new r.Event("click",{bubbles:s})))}function Vr(e){return Gr(e)?e.form:e.closest("form")}function Gr(e){return e.matches("textarea, input, select, button")}function Ur(e,t){if(!e)return;const n=Vr(e),s=r=>{r.defaultPrevented||t()};return n==null||n.addEventListener("reset",s,{passive:!0}),()=>n==null?void 0:n.removeEventListener("reset",s)}function Kr(e,t){const n=e==null?void 0:e.closest("fieldset");if(!n)return;t(n.disabled);const s=G(n),r=new s.MutationObserver(()=>t(n.disabled));return r.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>r.disconnect()}function Wr(e,t){if(!e)return;const{onFieldsetDisabledChange:n,onFormReset:s}=t,r=[Ur(e,s),Kr(e,n)];return()=>r.forEach(o=>o==null?void 0:o())}var Rn=e=>B(e)&&e.tagName==="IFRAME",qr=e=>!Number.isNaN(parseInt(e.getAttribute("tabindex")||"0",10)),zr=e=>parseInt(e.getAttribute("tabindex")||"0",10)<0,kt="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type",Ln=(e,t=!1)=>{if(!e)return[];const n=Array.from(e.querySelectorAll(kt));(t==!0||t=="if-empty"&&n.length===0)&&B(e)&&se(e)&&n.unshift(e);const r=n.filter(se);return r.forEach((o,c)=>{if(Rn(o)&&o.contentDocument){const i=o.contentDocument.body;r.splice(c,1,...Ln(i))}}),r};function se(e){return!e||e.closest("[inert]")?!1:e.matches(kt)&&Pr(e)}function jn(e,t){if(!e)return[];const s=Array.from(e.querySelectorAll(kt)).filter(oe);return s.forEach((r,o)=>{if(Rn(r)&&r.contentDocument){const c=r.contentDocument.body,i=jn(c);s.splice(o,1,...i)}}),s.length,s}function oe(e){return e!=null&&e.tabIndex>0?!0:se(e)&&!zr(e)}function xe(e){return e.tabIndex<0&&(/^(audio|video|details)$/.test(e.localName)||Or(e))&&!qr(e)?0:e.tabIndex}function z(e){const t=globalThis.requestAnimationFrame(e);return()=>{globalThis.cancelAnimationFrame(t)}}function ht(e){const t=Ir(e);return Cr(t)?U(t).body:B(t)&&Xr(t)?t:ht(t)}var Yr=/auto|scroll|overlay|hidden|clip/;function Xr(e){const t=G(e),{overflow:n,overflowX:s,overflowY:r,display:o}=t.getComputedStyle(e);return Yr.test(n+r+s)&&!["inline","contents"].includes(o)}function Zr(e){const{pointerNode:t,keyboardNode:n=t,onPress:s,onPressStart:r,onPressEnd:o,isValidKey:c=C=>C.key==="Enter"}=e;if(!t)return Fe;const i=G(t),u=U(t);let a=Fe,l=Fe,d=Fe;const f=C=>({point:_r(C),event:C});function p(C){r==null||r(f(C))}function g(C){o==null||o(f(C))}const N=A(t,"pointerdown",C=>{l();const P=A(i,"pointerup",E=>{const T=W(E);be(t,T)?s==null||s(f(E)):o==null||o(f(E))},{passive:!s}),D=A(i,"pointercancel",g,{passive:!o});l=tt(P,D),u.activeElement===n&&C.pointerType==="mouse"&&C.preventDefault(),p(C)},{passive:!r}),b=A(n,"focus",O);a=tt(N,b);function O(){const C=E=>{if(!c(E))return;const T=j=>{if(!c(j))return;const J=new i.PointerEvent("pointerup"),Q=f(J);s==null||s(Q),o==null||o(Q)};l(),l=A(n,"keyup",T);const S=new i.PointerEvent("pointerdown");p(S)},Y=()=>{const E=new i.PointerEvent("pointercancel");g(E)},P=A(n,"keydown",C),D=A(n,"blur",Y);d=tt(P,D)}return()=>{a(),l(),d()}}function Jr(e,t){return Array.from((e==null?void 0:e.querySelectorAll(t))??[])}function It(e){const t={getRootNode:n=>{var s;return((s=n.getRootNode)==null?void 0:s.call(n))??document},getDoc:n=>U(t.getRootNode(n)),getWin:n=>t.getDoc(n).defaultView??window,getActiveElement:n=>On(t.getRootNode(n)),isActiveElement:(n,s)=>s===t.getActiveElement(n),getById:(n,s)=>t.getRootNode(n).getElementById(s),setValue:(n,s)=>{n==null||s==null||$r(n,s.toString())}};return{...t,...e}}var st=new WeakMap;function Qr(e,t,n){st.has(e)||st.set(e,new Map);const s=st.get(e),r=s.get(t);if(!r)return s.set(t,n()),()=>{var i;(i=s.get(t))==null||i(),s.delete(t)};const o=n(),c=()=>{o(),r(),s.delete(t)};return s.set(t,c),()=>{s.get(t)===c&&(o(),s.set(t,r))}}function eo(e,t){return e?Qr(e,"style",()=>{const s=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=s}}):()=>{}}var to={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"},no=1e3/60;function so(e,t){const n=e();if(B(n)&&n.isConnected)return t(n),()=>{};{const s=setInterval(()=>{const r=e();B(r)&&r.isConnected&&(t(r),clearInterval(s))},no);return()=>clearInterval(s)}}function ro(e,t){const n=[];return e==null||e.forEach(s=>{const r=so(s,t);n.push(r)}),()=>{n.forEach(s=>s())}}function oo(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function io(e){return!(e.metaKey||!In()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}var ao=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function co(e,t,n){const s=n?W(n):null,r=G(s);return e=e||s instanceof r.HTMLInputElement&&!ao.has(s==null?void 0:s.type)||s instanceof r.HTMLTextAreaElement||s instanceof r.HTMLElement&&s.isContentEditable,!(e&&t==="keyboard"&&n instanceof r.KeyboardEvent&&!Reflect.has(lo,n.key))}var ue=null,pt=new Set,Se=new Map,ce=!1,gt=!1,lo={Tab:!0,Escape:!0};function Je(e,t){for(let n of pt)n(e,t)}function ze(e){ce=!0,io(e)&&(ue="keyboard",Je("keyboard",e))}function K(e){ue="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(ce=!0,Je("pointer",e))}function Fn(e){oo(e)&&(ce=!0,ue="virtual")}function Mn(e){const t=W(e);t===G(t)||t===U(t)||(!ce&&!gt&&(ue="virtual",Je("virtual",e)),ce=!1,gt=!1)}function _n(){ce=!1,gt=!0}function uo(e){if(typeof window>"u"||Se.get(G(e)))return;const t=G(e),n=U(e);let s=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){ue="virtual",Je("virtual",null),ce=!0,s.apply(this,arguments)},n.addEventListener("keydown",ze,!0),n.addEventListener("keyup",ze,!0),n.addEventListener("click",Fn,!0),t.addEventListener("focus",Mn,!0),t.addEventListener("blur",_n,!1),typeof t.PointerEvent<"u"?(n.addEventListener("pointerdown",K,!0),n.addEventListener("pointermove",K,!0),n.addEventListener("pointerup",K,!0)):(n.addEventListener("mousedown",K,!0),n.addEventListener("mousemove",K,!0),n.addEventListener("mouseup",K,!0)),t.addEventListener("beforeunload",()=>{fo(e)},{once:!0}),Se.set(t,{focus:s})}var fo=(e,t)=>{const n=G(e),s=U(e);Se.has(n)&&(n.HTMLElement.prototype.focus=Se.get(n).focus,s.removeEventListener("keydown",ze,!0),s.removeEventListener("keyup",ze,!0),s.removeEventListener("click",Fn,!0),n.removeEventListener("focus",Mn,!0),n.removeEventListener("blur",_n,!1),typeof n.PointerEvent<"u"?(s.removeEventListener("pointerdown",K,!0),s.removeEventListener("pointermove",K,!0),s.removeEventListener("pointerup",K,!0)):(s.removeEventListener("mousedown",K,!0),s.removeEventListener("mousemove",K,!0),s.removeEventListener("mouseup",K,!0)),Se.delete(n))};function mt(){return ue==="keyboard"}function ho(e={}){const{isTextInput:t,autoFocus:n,onChange:s,root:r}=e;uo(r),s==null||s({isFocusVisible:n||mt(),modality:ue});const o=(c,i)=>{co(!!t,c,i)&&(s==null||s({isFocusVisible:mt(),modality:c}))};return pt.add(o),()=>{pt.delete(o)}}var po=ye("checkbox").parts("root","label","control","indicator"),Me=po.build(),R=It({getRootId:e=>{var t;return((t=e.ids)==null?void 0:t.root)??`checkbox:${e.id}`},getLabelId:e=>{var t;return((t=e.ids)==null?void 0:t.label)??`checkbox:${e.id}:label`},getControlId:e=>{var t;return((t=e.ids)==null?void 0:t.control)??`checkbox:${e.id}:control`},getHiddenInputId:e=>{var t;return((t=e.ids)==null?void 0:t.hiddenInput)??`checkbox:${e.id}:input`},getRootEl:e=>R.getById(e,R.getRootId(e)),getHiddenInputEl:e=>R.getById(e,R.getHiddenInputId(e))});function go(e,t,n){const s=e.context.isDisabled,r=e.context.readOnly,o=!s&&e.context.focused,c=!s&&e.context.focusVisible,i=e.context.isChecked,u=e.context.isIndeterminate,a={"data-active":$(e.context.active),"data-focus":$(o),"data-focus-visible":$(c),"data-readonly":$(r),"data-hover":$(e.context.hovered),"data-disabled":$(s),"data-state":u?"indeterminate":e.context.checked?"checked":"unchecked","data-invalid":$(e.context.invalid)};return{checked:i,disabled:s,indeterminate:u,focused:o,checkedState:e.context.checked,setChecked(l){t({type:"CHECKED.SET",checked:l,isTrusted:!1})},toggleChecked(){t({type:"CHECKED.TOGGLE",checked:i,isTrusted:!1})},getRootProps(){return n.label({...Me.root.attrs,...a,dir:e.context.dir,id:R.getRootId(e.context),htmlFor:R.getHiddenInputId(e.context),onPointerMove(){s||t({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){s||t({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(l){W(l)===R.getHiddenInputEl(e.context)&&l.stopPropagation()}})},getLabelProps(){return n.element({...Me.label.attrs,...a,dir:e.context.dir,id:R.getLabelId(e.context)})},getControlProps(){return n.element({...Me.control.attrs,...a,dir:e.context.dir,id:R.getControlId(e.context),"aria-hidden":!0})},getIndicatorProps(){return n.element({...Me.indicator.attrs,...a,dir:e.context.dir,hidden:!u&&!e.context.checked})},getHiddenInputProps(){return n.input({id:R.getHiddenInputId(e.context),type:"checkbox",required:e.context.required,defaultChecked:i,disabled:s,"aria-labelledby":R.getLabelId(e.context),"aria-invalid":e.context.invalid,name:e.context.name,form:e.context.form,value:e.context.value,style:to,onFocus(){const l=mt();t({type:"CONTEXT.SET",context:{focused:!0,focusVisible:l}})},onBlur(){t({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(l){if(r){l.preventDefault();return}const d=l.currentTarget.checked;t({type:"CHECKED.SET",checked:d,isTrusted:!0})}})}}}var{not:Ut}=xn;function mo(e){const t=le(e);return De({id:"checkbox",initial:"ready",context:{checked:!1,value:"on",disabled:!1,...t,fieldsetDisabled:!1,focusVisible:!1},watch:{disabled:"removeFocusIfNeeded",checked:"syncInputElement"},activities:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:Ut("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:Ut("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},computed:{isIndeterminate:n=>yt(n.checked),isChecked:n=>Kt(n.checked),isDisabled:n=>!!n.disabled||n.fieldsetDisabled},states:{ready:{}}},{guards:{isTrusted:(n,s)=>!!s.isTrusted},activities:{trackPressEvent(n){if(!n.isDisabled)return Zr({pointerNode:R.getRootEl(n),keyboardNode:R.getHiddenInputEl(n),isValidKey:s=>s.key===" ",onPress:()=>n.active=!1,onPressStart:()=>n.active=!0,onPressEnd:()=>n.active=!1})},trackFocusVisible(n){if(!n.isDisabled)return ho({root:R.getRootNode(n)})},trackFormControlState(n,s,{send:r,initialContext:o}){return Wr(R.getHiddenInputEl(n),{onFieldsetDisabledChange(c){n.fieldsetDisabled=c},onFormReset(){r({type:"CHECKED.SET",checked:!!o.checked})}})}},actions:{setContext(n,s){Object.assign(n,s.context)},syncInputElement(n){const s=R.getHiddenInputEl(n);s&&(An(s,n.isChecked),s.indeterminate=n.isIndeterminate)},removeFocusIfNeeded(n){n.disabled&&n.focused&&(n.focused=!1,n.focusVisible=!1)},setChecked(n,s){Wt.checked(n,s.checked)},toggleChecked(n){const s=yt(n.checked)?!0:!n.checked;Wt.checked(n,s)},dispatchChangeEvent(n){const s=R.getHiddenInputEl(n);Hr(s,{checked:Kt(n.checked)})}}})}function yt(e){return e==="indeterminate"}function Kt(e){return yt(e)?!1:!!e}var yo={change:e=>{var t;(t=e.onCheckedChange)==null||t.call(e,{checked:e.checked})}},Wt={checked:(e,t)=>{Tt(e.checked,t)||(e.checked=t,yo.change(e))}};wt()(["checked","dir","disabled","form","getRootNode","id","ids","invalid","name","onCheckedChange","readOnly","required","value"]);function Oe(e,t={}){const{sync:n=!1}=t,s=vo(e);return v.useCallback((...r)=>{var o;return n?queueMicrotask(()=>{var c;return(c=s.current)==null?void 0:c.call(s,...r)}):(o=s.current)==null?void 0:o.call(s,...r)},[n,s])}function vo(e){const t=v.useRef(e);return t.current=e,t}const[ya,bo]=Z({name:"CheckboxGroupContext",hookName:"useCheckboxGroupContext",providerName:"<CheckboxGroupProvider />",strict:!1}),[va,Bn]=Z({name:"FieldContext",hookName:"useFieldContext",providerName:"<FieldProvider />",strict:!1}),$n=v.forwardRef((e,t)=>{const n=Ye(),s=I(n.getHiddenInputProps(),e),r=Bn();return h.jsx(L.input,{"aria-describedby":r==null?void 0:r.ariaDescribedby,...s,ref:t})});$n.displayName="CheckboxHiddenInput";const Hn=v.forwardRef((e,t)=>{const{indeterminate:n,...s}=e,r=Ye(),o=I(r.getIndicatorProps(),s),c=n?r.indeterminate:r.checked;return h.jsx(L.div,{...o,hidden:!c,ref:t})});Hn.displayName="CheckboxIndicator";const Vn=v.forwardRef((e,t)=>{const n=Ye(),s=I(n.getLabelProps(),e);return h.jsx(L.span,{...s,ref:t})});Vn.displayName="CheckboxLabel";const[ba,Dt]=Z({name:"EnvironmentContext",hookName:"useEnvironmentContext",providerName:"<EnvironmentProvider />",strict:!1,defaultValue:{getRootNode:()=>document,getDocument:()=>document,getWindow:()=>window}}),[Ea,Gn]=Z({name:"LocaleContext",hookName:"useLocaleContext",providerName:"<LocaleProvider />",strict:!1,defaultValue:{dir:"ltr",locale:"en-US"}}),Eo=(e={})=>{const t=bo(),n=Bn(),s=v.useMemo(()=>I(e,(t==null?void 0:t.getItemProps({value:e.value}))??{}),[e,t]),{getRootNode:r}=Dt(),{dir:o}=Gn(),c={id:v.useId(),ids:{label:n==null?void 0:n.ids.label,hiddenInput:n==null?void 0:n.ids.control},dir:o,disabled:n==null?void 0:n.disabled,readOnly:n==null?void 0:n.readOnly,invalid:n==null?void 0:n.invalid,required:n==null?void 0:n.required,getRootNode:r,checked:s.defaultChecked,...s},i={...c,checked:s.checked,onCheckedChange:Oe(s.onCheckedChange,{sync:!0})},[u,a]=Xe(mo(c),{context:i});return go(u,a,Ae)},Un=v.forwardRef((e,t)=>{const[n,s]=St()(e,["checked","defaultChecked","disabled","form","id","ids","invalid","name","onCheckedChange","readOnly","required","value"]),r=Eo(n),o=I(r.getRootProps(),s);return h.jsx(Es,{value:r,children:h.jsx(L.label,{...o,ref:t})})});Un.displayName="CheckboxRoot";function xo({children:e,checked:t,defaultChecked:n,disabled:s=!1,indeterminate:r=!1,onChange:o,name:c,value:i,className:u}){return h.jsxs(Un,{checked:t,defaultChecked:n,disabled:s,onCheckedChange:a=>o==null?void 0:o(a.checked===!0),name:c,value:i,className:x("inline-flex items-center gap-2 cursor-pointer select-none text-sm","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",u),children:[h.jsx(Pn,{className:x("relative h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background","data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground","data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","transition-colors"),children:h.jsx(Hn,{className:"absolute inset-0 flex items-center justify-center text-current",children:r?h.jsx("svg",{width:"12",height:"12",viewBox:"0 0 15 15",fill:"none",children:h.jsx("path",{d:"M2.25 7.5C2.25 7.22386 2.47386 7 2.75 7H12.25C12.5261 7 12.75 7.22386 12.75 7.5C12.75 7.77614 12.5261 8 12.25 8H2.75C2.47386 8 2.25 7.77614 2.25 7.5Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}):h.jsx("svg",{width:"12",height:"12",viewBox:"0 0 15 15",fill:"none",children:h.jsx("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})})}),e&&h.jsx(Vn,{className:"cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e}),h.jsx($n,{})]})}const[To,Co]=Z({name:"RenderStrategyContext",hookName:"useRenderStrategyContext",providerName:"<RenderStrategyPropsProvider />"}),wo=e=>St()(e,["lazyMount","unmountOnExit"]);function No(e,t,n){const s=e.matches("mounted","unmountSuspended");return{skip:!e.context.initial&&s,present:s,setNode(r){r&&t({type:"NODE.SET",node:r})},unmount(){t({type:"UNMOUNT"})}}}function Po(e){return De({initial:e.present?"mounted":"unmounted",context:{node:null,styles:null,unmountAnimationName:null,prevAnimationName:null,present:!1,initial:!1,...e},exit:["clearInitial","cleanupNode"],watch:{present:["setInitial","syncPresence"]},on:{"NODE.SET":{actions:["setNode","setStyles"]}},states:{mounted:{on:{UNMOUNT:{target:"unmounted",actions:["invokeOnExitComplete"]},"UNMOUNT.SUSPEND":"unmountSuspended"}},unmountSuspended:{activities:["trackAnimationEvents"],after:{ANIMATION_DURATION:{target:"unmounted",actions:["invokeOnExitComplete"]}},on:{MOUNT:{target:"mounted",actions:["setPrevAnimationName"]},UNMOUNT:{target:"unmounted",actions:["invokeOnExitComplete"]}}},unmounted:{entry:["clearPrevAnimationName"],on:{MOUNT:{target:"mounted",actions:["setPrevAnimationName"]}}}}},{delays:{ANIMATION_DURATION(t){var n,s;return qt((n=t.styles)==null?void 0:n.animationDuration)+qt((s=t.styles)==null?void 0:s.animationDelay)+So}},actions:{setInitial(t){t.initial=!0},clearInitial(t){t.initial=!1},cleanupNode(t){t.node=null,t.styles=null},invokeOnExitComplete(t){var n;(n=t.onExitComplete)==null||n.call(t)},setNode(t,n){t.node=ke(n.node)},setStyles(t,n){const s=n.node.ownerDocument.defaultView||window;t.styles=ke(s.getComputedStyle(n.node))},syncPresence(t,n,{send:s}){var c;if(t.present){s({type:"MOUNT",src:"presence.changed"});return}if(!t.present&&((c=t.node)==null?void 0:c.ownerDocument.visibilityState)==="hidden"){s({type:"UNMOUNT",src:"visibilitychange"});return}const r=_e(t.styles);(t.immediate?queueMicrotask:requestAnimationFrame)(()=>{var i,u;t.unmountAnimationName=r,r==="none"||r===t.prevAnimationName||((i=t.styles)==null?void 0:i.display)==="none"||((u=t.styles)==null?void 0:u.animationDuration)==="0s"?s({type:"UNMOUNT",src:"presence.changed"}):s({type:"UNMOUNT.SUSPEND"})})},setPrevAnimationName(t){(t.immediate?queueMicrotask:requestAnimationFrame)(()=>{t.prevAnimationName=_e(t.styles)})},clearPrevAnimationName(t){t.prevAnimationName=null}},activities:{trackAnimationEvents(t,n,{send:s}){const r=t.node;if(!r)return;const o=i=>{var a,l;(((l=(a=i.composedPath)==null?void 0:a.call(i))==null?void 0:l[0])??i.target)===r&&(t.prevAnimationName=_e(t.styles))},c=i=>{var l,d;const u=_e(t.styles);(((d=(l=i.composedPath)==null?void 0:l.call(i))==null?void 0:d[0])??i.target)===r&&u===t.unmountAnimationName&&s({type:"UNMOUNT",src:"animationend"})};return r.addEventListener("animationstart",o),r.addEventListener("animationcancel",c),r.addEventListener("animationend",c),()=>{r.removeEventListener("animationstart",o),r.removeEventListener("animationcancel",c),r.removeEventListener("animationend",c)}}}})}function _e(e){return(e==null?void 0:e.animationName)||"none"}function qt(e){return parseFloat(e||"0")*1e3}var So=16.667;wt()(["onExitComplete","present","immediate"]);const Kn=e=>{const{lazyMount:t,unmountOnExit:n,present:s,...r}=e,o=v.useRef(!1),c={...r,present:s,onExitComplete:Oe(e.onExitComplete)},[i,u]=Xe(Po(c),{context:c}),a=No(i,u);a.present&&(o.current=!0);const l=!a.present&&!o.current&&t||n&&!a.present&&o.current,d=()=>({"data-state":s?"open":"closed",hidden:!a.present});return{ref:a.setNode,getPresenceProps:d,present:a.present,unmounted:l}},[Oo,de]=Z({name:"DialogContext",hookName:"useDialogContext",providerName:"<DialogProvider />"}),Wn=v.forwardRef((e,t)=>{const n=de(),s=Co(),r=Kn({...s,present:n.open}),o=I(n.getBackdropProps(),r.getPresenceProps(),e);return r.unmounted?null:h.jsx(L.div,{...o,ref:Pt(r.ref,t)})});Wn.displayName="DialogBackdrop";const qn=v.forwardRef((e,t)=>{const n=de(),s=I(n.getCloseTriggerProps(),e);return h.jsx(L.button,{...s,ref:t})});qn.displayName="DialogCloseTrigger";const[ko,At]=Z({name:"PresenceContext",hookName:"usePresenceContext",providerName:"<PresenceProvider />"}),zn=v.forwardRef((e,t)=>{const n=de(),s=At(),r=I(n.getContentProps(),s.getPresenceProps(),e);return s.unmounted?null:h.jsx(L.div,{...r,ref:Pt(s.ref,t)})});zn.displayName="DialogContent";const Yn=v.forwardRef((e,t)=>{const n=de(),s=I(n.getDescriptionProps(),e);return h.jsx(L.div,{...s,ref:t})});Yn.displayName="DialogDescription";const Xn=v.forwardRef((e,t)=>{const n=de(),s=I(n.getPositionerProps(),e);return At().unmounted?null:h.jsx(L.div,{...s,ref:t})});Xn.displayName="DialogPositioner";const Io=e=>St()(e,["immediate","lazyMount","onExitComplete","present","unmountOnExit"]);var he=new WeakMap,Be=new WeakMap,$e={},rt=0,Zn=e=>e&&(e.host||Zn(e.parentNode)),Do=(e,t)=>t.map(n=>{if(e.contains(n))return n;const s=Zn(n);return s&&e.contains(s)?s:(console.error("[zag-js > ariaHidden] target",n,"in not contained inside",e,". Doing nothing"),null)}).filter(n=>!!n),Ao=e=>e.localName==="next-route-announcer"||e.localName==="script"||e.hasAttribute("aria-live")?!0:e.matches("[data-live-announcer]"),Ro=(e,t)=>{const{parentNode:n,markerName:s,controlAttribute:r,explicitBooleanValue:o}=t,c=Do(n,Array.isArray(e)?e:[e]);$e[s]||($e[s]=new WeakMap);const i=$e[s],u=[],a=new Set,l=new Set(c),d=p=>{!p||a.has(p)||(a.add(p),d(p.parentNode))};c.forEach(d);const f=p=>{!p||l.has(p)||Array.prototype.forEach.call(p.children,g=>{if(a.has(g))f(g);else try{if(Ao(g))return;const m=g.getAttribute(r),N=o?m==="true":m!==null&&m!=="false",b=(he.get(g)||0)+1,O=(i.get(g)||0)+1;he.set(g,b),i.set(g,O),u.push(g),b===1&&N&&Be.set(g,!0),O===1&&g.setAttribute(s,""),N||g.setAttribute(r,o?"true":"")}catch(m){console.error("[zag-js > ariaHidden] cannot operate on ",g,m)}})};return f(n),a.clear(),rt++,()=>{u.forEach(p=>{const g=he.get(p)-1,m=i.get(p)-1;he.set(p,g),i.set(p,m),g||(Be.has(p)||p.removeAttribute(r),Be.delete(p)),m||p.removeAttribute(s)}),rt--,rt||(he=new WeakMap,he=new WeakMap,Be=new WeakMap,$e={})}},Lo=e=>(Array.isArray(e)?e[0]:e).ownerDocument.body,jo=(e,t=Lo(e),n="data-aria-hidden")=>{if(t)return Ro(e,{parentNode:t,markerName:n,controlAttribute:"aria-hidden",explicitBooleanValue:!0})},Fo=e=>{const t=requestAnimationFrame(()=>e());return()=>cancelAnimationFrame(t)};function Mo(e,t={}){const{defer:n=!0}=t,s=n?Fo:o=>o(),r=[];return r.push(s(()=>{const c=(typeof e=="function"?e():e).filter(Boolean);c.length!==0&&r.push(jo(c))})),()=>{r.forEach(o=>o==null?void 0:o())}}function _o(e){const t={each(n){var s;for(let r=0;r<((s=e.frames)==null?void 0:s.length);r+=1){const o=e.frames[r];o&&n(o)}},addEventListener(n,s,r){return t.each(o=>{try{o.document.addEventListener(n,s,r)}catch{}}),()=>{try{t.removeEventListener(n,s,r)}catch{}}},removeEventListener(n,s,r){t.each(o=>{try{o.document.removeEventListener(n,s,r)}catch{}})}};return t}function Bo(e){const t=e.frameElement!=null?e.parent:null;return{addEventListener:(n,s,r)=>{try{t==null||t.addEventListener(n,s,r)}catch{}return()=>{try{t==null||t.removeEventListener(n,s,r)}catch{}}},removeEventListener:(n,s,r)=>{try{t==null||t.removeEventListener(n,s,r)}catch{}}}}var zt="pointerdown.outside",Yt="focus.outside";function $o(e){for(const t of e)if(B(t)&&se(t))return!0;return!1}var Jn=e=>"clientY"in e;function Ho(e,t){if(!Jn(t)||!e)return!1;const n=e.getBoundingClientRect();return n.width===0||n.height===0?!1:n.top<=t.clientY&&t.clientY<=n.top+n.height&&n.left<=t.clientX&&t.clientX<=n.left+n.width}function Vo(e,t){return e.y<=t.y&&t.y<=e.y+e.height&&e.x<=t.x&&t.x<=e.x+e.width}function Xt(e,t){if(!t||!Jn(e))return!1;const n=t.scrollHeight>t.clientHeight,s=n&&e.clientX>t.offsetLeft+t.clientWidth,r=t.scrollWidth>t.clientWidth,o=r&&e.clientY>t.offsetTop+t.clientHeight,c={x:t.offsetLeft,y:t.offsetTop,width:t.clientWidth+(n?16:0),height:t.clientHeight+(r?16:0)},i={x:e.clientX,y:e.clientY};return Vo(c,i)?s||o:!1}function Go(e,t){const{exclude:n,onFocusOutside:s,onPointerDownOutside:r,onInteractOutside:o,defer:c}=t;if(!e)return;const i=U(e),u=G(e),a=_o(u),l=Bo(u);function d(b){const O=W(b);if(!B(O)||!O.isConnected||be(e,O)||Ho(e,b))return!1;const C=i.querySelector(`[aria-controls="${e.id}"]`);if(C){const P=ht(C);if(Xt(b,P))return!1}const Y=ht(e);return Xt(b,Y)?!1:!(n!=null&&n(O))}const f=new Set;function p(b){function O(){var P;const C=c?z:D=>D(),Y=((P=b.composedPath)==null?void 0:P.call(b))??[b.target];C(()=>{if(!(!e||!d(b))){if(r||o){const D=dt(r,o);e.addEventListener(zt,D,{once:!0})}Zt(e,zt,{bubbles:!1,cancelable:!0,detail:{originalEvent:b,contextmenu:Fr(b),focusable:$o(Y)}})}})}b.pointerType==="touch"?(f.forEach(C=>C()),f.add(A(i,"click",O,{once:!0})),f.add(l.addEventListener("click",O,{once:!0})),f.add(a.addEventListener("click",O,{once:!0}))):O()}const g=new Set,m=setTimeout(()=>{g.add(A(i,"pointerdown",p,!0)),g.add(l.addEventListener("pointerdown",p,!0)),g.add(a.addEventListener("pointerdown",p,!0))},0);function N(b){(c?z:C=>C())(()=>{if(!(!e||!d(b))){if(s||o){const C=dt(s,o);e.addEventListener(Yt,C,{once:!0})}Zt(e,Yt,{bubbles:!1,cancelable:!0,detail:{originalEvent:b,contextmenu:!1,focusable:se(W(b))}})}})}return g.add(A(i,"focusin",N,!0)),g.add(l.addEventListener("focusin",N,!0)),g.add(a.addEventListener("focusin",N,!0)),()=>{clearTimeout(m),f.forEach(b=>b()),g.forEach(b=>b())}}function Uo(e,t){const{defer:n}=t,s=n?z:o=>o(),r=[];return r.push(s(()=>{const o=typeof e=="function"?e():e;r.push(Go(o,t))})),()=>{r.forEach(o=>o==null?void 0:o())}}function Zt(e,t,n){const s=e.ownerDocument.defaultView||window,r=new s.CustomEvent(t,n);return e.dispatchEvent(r)}function Ko(e,t){const n=s=>{s.key==="Escape"&&(s.isComposing||t==null||t(s))};return A(U(e),"keydown",n,{capture:!0})}var H={layers:[],branches:[],count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(e=>e.pointerBlocking)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(e){var s;const t=this.indexOf(e),n=this.topMostPointerBlockingLayer()?this.indexOf((s=this.topMostPointerBlockingLayer())==null?void 0:s.node):-1;return t<n},isTopMost(e){const t=this.layers[this.count()-1];return(t==null?void 0:t.node)===e},getNestedLayers(e){return Array.from(this.layers).slice(this.indexOf(e)+1)},isInNestedLayer(e,t){return this.getNestedLayers(e).some(n=>be(n.node,t))},isInBranch(e){return Array.from(this.branches).some(t=>be(t,e))},add(e){const t=this.layers.push(e);e.node.style.setProperty("--layer-index",`${t}`)},addBranch(e){this.branches.push(e)},remove(e){const t=this.indexOf(e);t<0||(t<this.count()-1&&this.getNestedLayers(e).forEach(s=>s.dismiss()),this.layers.splice(t,1),e.style.removeProperty("--layer-index"))},removeBranch(e){const t=this.branches.indexOf(e);t>=0&&this.branches.splice(t,1)},indexOf(e){return this.layers.findIndex(t=>t.node===e)},dismiss(e){var t;(t=this.layers[this.indexOf(e)])==null||t.dismiss()},clear(){this.remove(this.layers[0].node)}},Jt;function Qt(){H.layers.forEach(({node:e})=>{e.style.pointerEvents=H.isBelowPointerBlockingLayer(e)?"none":"auto"})}function Wo(e){e.style.pointerEvents=""}function qo(e,t){const n=U(e),s=[];if(H.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(Jt=document.body.style.pointerEvents,queueMicrotask(()=>{n.body.style.pointerEvents="none",n.body.setAttribute("data-inert","")})),t){const r=ro(t,o=>{s.push(eo(o,{pointerEvents:"auto"}))});s.push(r)}return()=>{H.hasPointerBlockingLayer()||(queueMicrotask(()=>{n.body.style.pointerEvents=Jt,n.body.removeAttribute("data-inert"),n.body.style.length===0&&n.body.removeAttribute("style")}),s.forEach(r=>r()))}}function zo(e,t){if(!e){me("[@zag-js/dismissable] node is `null` or `undefined`");return}const{onDismiss:n,pointerBlocking:s,exclude:r,debug:o}=t,c={dismiss:n,node:e,pointerBlocking:s};H.add(c),Qt();function i(f){var g,m;const p=W(f.detail.originalEvent);H.isBelowPointerBlockingLayer(e)||H.isInBranch(p)||((g=t.onPointerDownOutside)==null||g.call(t,f),(m=t.onInteractOutside)==null||m.call(t,f),!f.defaultPrevented&&(o&&console.log("onPointerDownOutside:",f.detail.originalEvent),n==null||n()))}function u(f){var g,m;const p=W(f.detail.originalEvent);H.isInBranch(p)||((g=t.onFocusOutside)==null||g.call(t,f),(m=t.onInteractOutside)==null||m.call(t,f),!f.defaultPrevented&&(o&&console.log("onFocusOutside:",f.detail.originalEvent),n==null||n()))}function a(f){var p;H.isTopMost(e)&&((p=t.onEscapeKeyDown)==null||p.call(t,f),!f.defaultPrevented&&n&&(f.preventDefault(),n()))}function l(f){var N;if(!e)return!1;const p=typeof r=="function"?r():r,g=Array.isArray(p)?p:[p],m=(N=t.persistentElements)==null?void 0:N.map(b=>b()).filter(B);return m&&g.push(...m),g.some(b=>be(b,f))||H.isInNestedLayer(e,f)}const d=[s?qo(e,t.persistentElements):void 0,Ko(e,a),Uo(e,{exclude:l,onFocusOutside:u,onPointerDownOutside:i,defer:t.defer})];return()=>{H.remove(e),Qt(),Wo(e),d.forEach(f=>f==null?void 0:f())}}function Yo(e,t){const{defer:n}=t,s=n?z:o=>o(),r=[];return r.push(s(()=>{const o=ve(e)?e():e;r.push(zo(o,t))})),()=>{r.forEach(o=>o==null?void 0:o())}}function Xo(e,t={}){const{defer:n}=t,s=n?z:o=>o(),r=[];return r.push(s(()=>{const o=ve(e)?e():e;if(!o){me("[@zag-js/dismissable] branch node is `null` or `undefined`");return}H.addBranch(o),r.push(()=>{H.removeBranch(o)})})),()=>{r.forEach(o=>o==null?void 0:o())}}var Zo=Object.defineProperty,Jo=(e,t,n)=>t in e?Zo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,k=(e,t,n)=>Jo(e,typeof t!="symbol"?t+"":t,n),en={activateTrap(e,t){if(e.length>0){const s=e[e.length-1];s!==t&&s.pause()}const n=e.indexOf(t);n===-1||e.splice(n,1),e.push(t)},deactivateTrap(e,t){const n=e.indexOf(t);n!==-1&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}},Qo=[],ei=class{constructor(e,t){k(this,"trapStack"),k(this,"config"),k(this,"doc"),k(this,"state",{containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0}),k(this,"listenerCleanups",[]),k(this,"handleFocus",s=>{const r=W(s),o=this.findContainerIndex(r,s)>=0;if(o||Ot(r))o&&(this.state.mostRecentlyFocusedNode=r);else{s.stopImmediatePropagation();let c,i=!0;if(this.state.mostRecentlyFocusedNode)if(xe(this.state.mostRecentlyFocusedNode)>0){const u=this.findContainerIndex(this.state.mostRecentlyFocusedNode),{tabbableNodes:a}=this.state.containerGroups[u];if(a.length>0){const l=a.findIndex(d=>d===this.state.mostRecentlyFocusedNode);l>=0&&(this.config.isKeyForward(this.state.recentNavEvent)?l+1<a.length&&(c=a[l+1],i=!1):l-1>=0&&(c=a[l-1],i=!1))}}else this.state.containerGroups.some(u=>u.tabbableNodes.some(a=>xe(a)>0))||(i=!1);else i=!1;i&&(c=this.findNextNavNode({target:this.state.mostRecentlyFocusedNode,isBackward:this.config.isKeyBackward(this.state.recentNavEvent)})),c?this.tryFocus(c):this.tryFocus(this.state.mostRecentlyFocusedNode||this.getInitialFocusNode())}this.state.recentNavEvent=void 0}),k(this,"handlePointerDown",s=>{const r=W(s);if(!(this.findContainerIndex(r,s)>=0)){if(Ce(this.config.clickOutsideDeactivates,s)){this.deactivate({returnFocus:this.config.returnFocusOnDeactivate});return}Ce(this.config.allowOutsideClick,s)||s.preventDefault()}}),k(this,"handleClick",s=>{const r=W(s);this.findContainerIndex(r,s)>=0||Ce(this.config.clickOutsideDeactivates,s)||Ce(this.config.allowOutsideClick,s)||(s.preventDefault(),s.stopImmediatePropagation())}),k(this,"handleTabKey",s=>{if(this.config.isKeyForward(s)||this.config.isKeyBackward(s)){this.state.recentNavEvent=s;const r=this.config.isKeyBackward(s),o=this.findNextNavNode({event:s,isBackward:r});if(!o)return;Te(s)&&s.preventDefault(),this.tryFocus(o)}}),k(this,"handleEscapeKey",s=>{ti(s)&&Ce(this.config.escapeDeactivates,s)!==!1&&(s.preventDefault(),this.deactivate())}),k(this,"_mutationObserver"),k(this,"setupMutationObserver",()=>{const s=this.doc.defaultView||window;this._mutationObserver=new s.MutationObserver(r=>{r.some(c=>Array.from(c.removedNodes).some(u=>u===this.state.mostRecentlyFocusedNode))&&this.tryFocus(this.getInitialFocusNode())})}),k(this,"updateObservedNodes",()=>{var s;(s=this._mutationObserver)==null||s.disconnect(),this.state.active&&!this.state.paused&&this.state.containers.map(r=>{var o;(o=this._mutationObserver)==null||o.observe(r,{subtree:!0,childList:!0})})}),k(this,"getInitialFocusNode",()=>{let s=this.getNodeForOption("initialFocus",{hasFallback:!0});if(s===!1)return!1;if(s===void 0||s&&!se(s))if(this.findContainerIndex(this.doc.activeElement)>=0)s=this.doc.activeElement;else{const r=this.state.tabbableGroups[0];s=r&&r.firstTabbableNode||this.getNodeForOption("fallbackFocus")}else s===null&&(s=this.getNodeForOption("fallbackFocus"));if(!s)throw new Error("Your focus-trap needs to have at least one focusable element");return s.isConnected||(s=this.getNodeForOption("fallbackFocus")),s}),k(this,"tryFocus",s=>{if(s!==!1&&s!==On(this.doc)){if(!s||!s.focus){this.tryFocus(this.getInitialFocusNode());return}s.focus({preventScroll:!!this.config.preventScroll}),this.state.mostRecentlyFocusedNode=s,ni(s)&&s.select()}}),k(this,"deactivate",s=>{if(!this.state.active)return this;const r={onDeactivate:this.config.onDeactivate,onPostDeactivate:this.config.onPostDeactivate,checkCanReturnFocus:this.config.checkCanReturnFocus,...s};clearTimeout(this.state.delayInitialFocusTimer),this.state.delayInitialFocusTimer=void 0,this.removeListeners(),this.state.active=!1,this.state.paused=!1,this.updateObservedNodes(),en.deactivateTrap(this.trapStack,this);const o=this.getOption(r,"onDeactivate"),c=this.getOption(r,"onPostDeactivate"),i=this.getOption(r,"checkCanReturnFocus"),u=this.getOption(r,"returnFocus","returnFocusOnDeactivate");o==null||o();const a=()=>{tn(()=>{if(u){const l=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);this.tryFocus(l)}c==null||c()})};if(u&&i){const l=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);return i(l).then(a,a),this}return a(),this}),k(this,"pause",s=>{if(this.state.paused||!this.state.active)return this;const r=this.getOption(s,"onPause"),o=this.getOption(s,"onPostPause");return this.state.paused=!0,r==null||r(),this.removeListeners(),this.updateObservedNodes(),o==null||o(),this}),k(this,"unpause",s=>{if(!this.state.paused||!this.state.active)return this;const r=this.getOption(s,"onUnpause"),o=this.getOption(s,"onPostUnpause");return this.state.paused=!1,r==null||r(),this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),o==null||o(),this}),k(this,"updateContainerElements",s=>(this.state.containers=Array.isArray(s)?s.filter(Boolean):[s].filter(Boolean),this.state.active&&this.updateTabbableNodes(),this.updateObservedNodes(),this)),k(this,"getReturnFocusNode",s=>{const r=this.getNodeForOption("setReturnFocus",{params:[s]});return r||(r===!1?!1:s)}),k(this,"getOption",(s,r,o)=>s&&s[r]!==void 0?s[r]:this.config[o||r]),k(this,"getNodeForOption",(s,{hasFallback:r=!1,params:o=[]}={})=>{let c=this.config[s];if(typeof c=="function"&&(c=c(...o)),c===!0&&(c=void 0),!c){if(c===void 0||c===!1)return c;throw new Error(`\`${s}\` was specified but was not a node, or did not return a node`)}let i=c;if(typeof c=="string"){try{i=this.doc.querySelector(c)}catch(u){throw new Error(`\`${s}\` appears to be an invalid selector; error="${u.message}"`)}if(!i&&!r)throw new Error(`\`${s}\` as selector refers to no known node`)}return i}),k(this,"findNextNavNode",s=>{const{event:r,isBackward:o=!1}=s,c=s.target||W(r);this.updateTabbableNodes();let i=null;if(this.state.tabbableGroups.length>0){const u=this.findContainerIndex(c,r),a=u>=0?this.state.containerGroups[u]:void 0;if(u<0)o?i=this.state.tabbableGroups[this.state.tabbableGroups.length-1].lastTabbableNode:i=this.state.tabbableGroups[0].firstTabbableNode;else if(o){let l=this.state.tabbableGroups.findIndex(({firstTabbableNode:d})=>c===d);if(l<0&&((a==null?void 0:a.container)===c||se(c)&&!oe(c)&&!(a!=null&&a.nextTabbableNode(c,!1)))&&(l=u),l>=0){const d=l===0?this.state.tabbableGroups.length-1:l-1,f=this.state.tabbableGroups[d];i=xe(c)>=0?f.lastTabbableNode:f.lastDomTabbableNode}else Te(r)||(i=a==null?void 0:a.nextTabbableNode(c,!1))}else{let l=this.state.tabbableGroups.findIndex(({lastTabbableNode:d})=>c===d);if(l<0&&((a==null?void 0:a.container)===c||se(c)&&!oe(c)&&!(a!=null&&a.nextTabbableNode(c)))&&(l=u),l>=0){const d=l===this.state.tabbableGroups.length-1?0:l+1,f=this.state.tabbableGroups[d];i=xe(c)>=0?f.firstTabbableNode:f.firstDomTabbableNode}else Te(r)||(i=a==null?void 0:a.nextTabbableNode(c))}}else i=this.getNodeForOption("fallbackFocus");return i}),this.trapStack=t.trapStack||Qo;const n={returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward(s){return Te(s)&&!s.shiftKey},isKeyBackward(s){return Te(s)&&s.shiftKey},...t};this.doc=n.document||U(Array.isArray(e)?e[0]:e),this.config=n,this.updateContainerElements(e),this.setupMutationObserver()}get active(){return this.state.active}get paused(){return this.state.paused}findContainerIndex(e,t){const n=typeof(t==null?void 0:t.composedPath)=="function"?t.composedPath():void 0;return this.state.containerGroups.findIndex(({container:s,tabbableNodes:r})=>s.contains(e)||(n==null?void 0:n.includes(s))||r.find(o=>o===e))}updateTabbableNodes(){if(this.state.containerGroups=this.state.containers.map(e=>{const t=jn(e),n=Ln(e),s=t.length>0?t[0]:void 0,r=t.length>0?t[t.length-1]:void 0,o=n.find(a=>oe(a)),c=n.slice().reverse().find(a=>oe(a)),i=!!t.find(a=>xe(a)>0);function u(a,l=!0){const d=t.indexOf(a);return d<0?l?n.slice(n.indexOf(a)+1).find(f=>oe(f)):n.slice(0,n.indexOf(a)).reverse().find(f=>oe(f)):t[d+(l?1:-1)]}return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:i,firstTabbableNode:s,lastTabbableNode:r,firstDomTabbableNode:o,lastDomTabbableNode:c,nextTabbableNode:u}}),this.state.tabbableGroups=this.state.containerGroups.filter(e=>e.tabbableNodes.length>0),this.state.tabbableGroups.length<=0&&!this.getNodeForOption("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(this.state.containerGroups.find(e=>e.posTabIndexesFound)&&this.state.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")}addListeners(){if(this.state.active)return en.activateTrap(this.trapStack,this),this.state.delayInitialFocusTimer=this.config.delayInitialFocus?tn(()=>{this.tryFocus(this.getInitialFocusNode())}):this.tryFocus(this.getInitialFocusNode()),this.listenerCleanups.push(A(this.doc,"focusin",this.handleFocus,!0),A(this.doc,"mousedown",this.handlePointerDown,{capture:!0,passive:!1}),A(this.doc,"touchstart",this.handlePointerDown,{capture:!0,passive:!1}),A(this.doc,"click",this.handleClick,{capture:!0,passive:!1}),A(this.doc,"keydown",this.handleTabKey,{capture:!0,passive:!1}),A(this.doc,"keydown",this.handleEscapeKey)),this}removeListeners(){if(this.state.active)return this.listenerCleanups.forEach(e=>e()),this.listenerCleanups=[],this}activate(e){if(this.state.active)return this;const t=this.getOption(e,"onActivate"),n=this.getOption(e,"onPostActivate"),s=this.getOption(e,"checkCanFocusTrap");s||this.updateTabbableNodes(),this.state.active=!0,this.state.paused=!1,this.state.nodeFocusedBeforeActivation=this.doc.activeElement||null,t==null||t();const r=()=>{s&&this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),n==null||n()};return s?(s(this.state.containers.concat()).then(r,r),this):(r(),this)}},Te=e=>e.key==="Tab",Ce=(e,...t)=>typeof e=="function"?e(...t):e,ti=e=>!e.isComposing&&e.key==="Escape",tn=e=>setTimeout(e,0),ni=e=>e.localName==="input"&&"select"in e&&typeof e.select=="function";function si(e,t={}){let n;const s=z(()=>{const r=typeof e=="function"?e():e;if(r){n=new ei(r,{escapeDeactivates:!1,allowOutsideClick:!0,preventScroll:!0,returnFocusOnDeactivate:!0,delayInitialFocus:!1,fallbackFocus:r,...t,document:U(r)});try{n.activate()}catch{}}});return function(){n==null||n.deactivate(),s()}}var ot="data-scroll-lock";function nn(e,t){if(!e)return;const n=Object.keys(t).reduce((s,r)=>(s[r]=e.style.getPropertyValue(r),s),{});return Object.assign(e.style,t),()=>{Object.assign(e.style,n)}}function ri(e,t,n){if(!e)return;const s=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{s?e.style.setProperty(t,s):e.style.removeProperty(t)}}function oi(e){const t=e.getBoundingClientRect().left;return Math.round(t)+e.scrollLeft?"paddingLeft":"paddingRight"}function ii(e){const t=e??document,n=t.defaultView??window,{documentElement:s,body:r}=t;if(r.hasAttribute(ot))return;r.setAttribute(ot,"");const c=n.innerWidth-s.clientWidth,i=()=>ri(s,"--scrollbar-width",`${c}px`),u=oi(s),a=()=>nn(r,{overflow:"hidden",[u]:`${c}px`}),l=()=>{const{scrollX:f,scrollY:p,visualViewport:g}=n,m=(g==null?void 0:g.offsetLeft)??0,N=(g==null?void 0:g.offsetTop)??0,b=nn(r,{position:"fixed",overflow:"hidden",top:`${-(p-Math.floor(N))}px`,left:`${-(f-Math.floor(m))}px`,right:"0",[u]:`${c}px`});return()=>{b==null||b(),n.scrollTo({left:f,top:p,behavior:"instant"})}},d=[i(),Lr()?l():a()];return()=>{d.forEach(f=>f==null?void 0:f()),r.removeAttribute(ot)}}var ai=ye("dialog").parts("trigger","backdrop","positioner","content","title","description","closeTrigger"),re=ai.build(),w=It({getPositionerId:e=>{var t;return((t=e.ids)==null?void 0:t.positioner)??`dialog:${e.id}:positioner`},getBackdropId:e=>{var t;return((t=e.ids)==null?void 0:t.backdrop)??`dialog:${e.id}:backdrop`},getContentId:e=>{var t;return((t=e.ids)==null?void 0:t.content)??`dialog:${e.id}:content`},getTriggerId:e=>{var t;return((t=e.ids)==null?void 0:t.trigger)??`dialog:${e.id}:trigger`},getTitleId:e=>{var t;return((t=e.ids)==null?void 0:t.title)??`dialog:${e.id}:title`},getDescriptionId:e=>{var t;return((t=e.ids)==null?void 0:t.description)??`dialog:${e.id}:description`},getCloseTriggerId:e=>{var t;return((t=e.ids)==null?void 0:t.closeTrigger)??`dialog:${e.id}:close`},getContentEl:e=>w.getById(e,w.getContentId(e)),getPositionerEl:e=>w.getById(e,w.getPositionerId(e)),getBackdropEl:e=>w.getById(e,w.getBackdropId(e)),getTriggerEl:e=>w.getById(e,w.getTriggerId(e)),getTitleEl:e=>w.getById(e,w.getTitleId(e)),getDescriptionEl:e=>w.getById(e,w.getDescriptionId(e)),getCloseTriggerEl:e=>w.getById(e,w.getCloseTriggerId(e))});function ci(e,t,n){const s=e.context["aria-label"],r=e.matches("open"),o=e.context.renderedElements;return{open:r,setOpen(c){c!==r&&t(c?"OPEN":"CLOSE")},getTriggerProps(){return n.button({...re.trigger.attrs,dir:e.context.dir,id:w.getTriggerId(e.context),"aria-haspopup":"dialog",type:"button","aria-expanded":r,"data-state":r?"open":"closed","aria-controls":w.getContentId(e.context),onClick(c){c.defaultPrevented||t("TOGGLE")}})},getBackdropProps(){return n.element({...re.backdrop.attrs,dir:e.context.dir,hidden:!r,id:w.getBackdropId(e.context),"data-state":r?"open":"closed"})},getPositionerProps(){return n.element({...re.positioner.attrs,dir:e.context.dir,id:w.getPositionerId(e.context),style:{pointerEvents:r?void 0:"none"}})},getContentProps(){return n.element({...re.content.attrs,dir:e.context.dir,role:e.context.role,hidden:!r,id:w.getContentId(e.context),tabIndex:-1,"data-state":r?"open":"closed","aria-modal":!0,"aria-label":s||void 0,"aria-labelledby":s||!o.title?void 0:w.getTitleId(e.context),"aria-describedby":o.description?w.getDescriptionId(e.context):void 0})},getTitleProps(){return n.element({...re.title.attrs,dir:e.context.dir,id:w.getTitleId(e.context)})},getDescriptionProps(){return n.element({...re.description.attrs,dir:e.context.dir,id:w.getDescriptionId(e.context)})},getCloseTriggerProps(){return n.button({...re.closeTrigger.attrs,dir:e.context.dir,id:w.getCloseTriggerId(e.context),type:"button",onClick(c){c.defaultPrevented||(c.stopPropagation(),t("CLOSE"))}})}}}function li(e){const t=le(e);return De({id:"dialog",initial:t.open?"open":"closed",context:{role:"dialog",renderedElements:{title:!0,description:!0},modal:!0,trapFocus:!0,preventScroll:!0,closeOnInteractOutside:!0,closeOnEscape:!0,restoreFocus:!0,...t},created:["setAlertDialogProps"],watch:{open:["toggleVisibility"]},states:{open:{entry:["checkRenderedElements","syncZIndex"],activities:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],on:{"CONTROLLED.CLOSE":{target:"closed"},CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}]}},closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}}}},{guards:{isOpenControlled:n=>!!n["open.controlled"]},activities:{trackDismissableElement(n,s,{send:r}){return Yo(()=>w.getContentEl(n),{defer:!0,pointerBlocking:n.modal,exclude:[w.getTriggerEl(n)],onInteractOutside(c){var i;(i=n.onInteractOutside)==null||i.call(n,c),n.closeOnInteractOutside||c.preventDefault()},persistentElements:n.persistentElements,onFocusOutside:n.onFocusOutside,onPointerDownOutside:n.onPointerDownOutside,onEscapeKeyDown(c){var i;(i=n.onEscapeKeyDown)==null||i.call(n,c),n.closeOnEscape||c.preventDefault()},onDismiss(){r({type:"CLOSE",src:"interact-outside"})}})},preventScroll(n){if(n.preventScroll)return ii(w.getDoc(n))},trapFocus(n){return!n.trapFocus||!n.modal?void 0:si(()=>w.getContentEl(n),{preventScroll:!0,returnFocusOnDeactivate:!!n.restoreFocus,initialFocus:n.initialFocusEl,setReturnFocus:r=>{var o;return((o=n.finalFocusEl)==null?void 0:o.call(n))??r}})},hideContentBelow(n){return n.modal?Mo(()=>[w.getContentEl(n)],{defer:!0}):void 0}},actions:{setAlertDialogProps(n){n.role==="alertdialog"&&(n.initialFocusEl||(n.initialFocusEl=()=>w.getCloseTriggerEl(n)),n.closeOnInteractOutside=!1)},checkRenderedElements(n){z(()=>{n.renderedElements.title=!!w.getTitleEl(n),n.renderedElements.description=!!w.getDescriptionEl(n)})},syncZIndex(n){z(()=>{const s=w.getContentEl(n);if(!s)return;const r=Dr(s);[w.getPositionerEl(n),w.getBackdropEl(n)].forEach(c=>{c==null||c.style.setProperty("--z-index",r.zIndex)})})},invokeOnClose(n){var s;(s=n.onOpenChange)==null||s.call(n,{open:!1})},invokeOnOpen(n){var s;(s=n.onOpenChange)==null||s.call(n,{open:!0})},toggleVisibility(n,s,{send:r}){r({type:n.open?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:s})}}})}wt()(["aria-label","closeOnEscape","closeOnInteractOutside","dir","finalFocusEl","getRootNode","getRootNode","id","id","ids","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","open.controlled","open","persistentElements","preventScroll","restoreFocus","role","trapFocus"]);const ui=(e={})=>{const{getRootNode:t}=Dt(),{dir:n}=Gn(),s={id:v.useId(),getRootNode:t,dir:n,open:e.defaultOpen,"open.controlled":e.open!==void 0,...e},r={...s,open:e.open,onOpenChange:Oe(e.onOpenChange,{sync:!0}),onEscapeKeyDown:Oe(e.onEscapeKeyDown),onInteractOutside:Oe(e.onInteractOutside)},[o,c]=Xe(li(s),{context:r});return ci(o,c,Ae)},di=e=>{const[t,{children:n,...s}]=Io(e),[r]=wo(t),o=ui(s),c=Kn(I({present:o.open},t));return h.jsx(Oo,{value:o,children:h.jsx(To,{value:r,children:h.jsx(ko,{value:c,children:n})})})},Qn=v.forwardRef((e,t)=>{const n=de(),s=I(n.getTitleProps(),e);return h.jsx(L.h2,{...s,ref:t})});Qn.displayName="DialogTitle";const es=v.forwardRef((e,t)=>{const n=de(),s=At(),r=I({...n.getTriggerProps(),"aria-controls":s.unmounted?void 0:n.getTriggerProps()["aria-controls"]},e);return h.jsx(L.button,{...r,ref:t})});es.displayName="DialogTrigger";const fi=e=>{var u;const{children:t,disabled:n}=e,[s,r]=v.useState((u=e.container)==null?void 0:u.current),o=v.useSyncExternalStore(pi,()=>!1,()=>!0),{getRootNode:c}=Dt();if(v.useEffect(()=>{r(()=>{var a;return(a=e.container)==null?void 0:a.current})},[e.container]),o||n)return h.jsx(h.Fragment,{children:t});const i=s??hi(c);return h.jsx(h.Fragment,{children:v.Children.map(t,a=>us.createPortal(a,i))})},hi=e=>{const t=e==null?void 0:e(),n=t.getRootNode();return Ie(n)?n:U(t).body},pi=()=>()=>{},gi=v.createContext({}),mi={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",full:"max-w-full mx-4"};function yi({open:e,onOpenChange:t,children:n,modal:s=!0,closeOnInteractOutside:r=!0,closeOnEscape:o=!0}){return h.jsx(di,{open:e,onOpenChange:t,modal:s,closeOnInteractOutside:r,closeOnEscape:o,children:n})}function vi({children:e,className:t}){return h.jsx(es,{className:t,children:e})}function bi({children:e}){return h.jsx(fi,{children:e})}function Ei({className:e}){return h.jsx(Wn,{className:x("fixed inset-0 bg-black/50 backdrop-blur-sm","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),style:{zIndex:9999}})}function xi({children:e}){return h.jsx(Xn,{className:"fixed inset-0 flex items-center justify-center p-4",style:{zIndex:1e4},children:e})}function Ti({children:e,size:t="md",className:n}){return h.jsx(gi.Provider,{value:{size:t},children:h.jsx(zn,{className:x("relative w-full rounded-lg bg-card text-card-foreground shadow-lg border border-border","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=closed]:slide-out-to-bottom-[2%] data-[state=open]:slide-in-from-bottom-[2%]","duration-200",mi[t],n),children:e})})}function Ci({children:e,className:t}){return h.jsx("div",{className:x("flex items-start justify-between gap-4 p-6 pb-4",t),children:e})}function wi({children:e,className:t}){return h.jsx(Qn,{className:x("text-lg font-semibold text-foreground",t),children:e})}function Ni({children:e,className:t}){return h.jsx(Yn,{className:x("text-sm text-muted-foreground",t),children:e})}function Pi({children:e,className:t}){return h.jsx("div",{className:x("px-6 py-4",t),children:e})}function Si({children:e,className:t}){return h.jsx("div",{className:x("flex justify-end gap-2 p-6 pt-4",t),children:e})}function Oi({className:e}){return h.jsx(qn,{className:x("absolute right-4 top-4 rounded-md p-2 text-muted-foreground","hover:bg-secondary hover:text-foreground","focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:pointer-events-none","transition-colors",e),"aria-label":"Close dialog",children:h.jsx(te.X,{className:"h-4 w-4"})})}const ki={Root:yi,Trigger:vi,Portal:bi,Backdrop:Ei,Positioner:xi,Content:Ti,Header:Ci,Title:wi,Description:Ni,Body:Pi,Footer:Si,CloseTrigger:Oi};function Ii({className:e,type:t="text",label:n,id:s,...r}){const o=h.jsx("input",{id:s,type:t,className:x("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm","ring-offset-background","file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50",e),...r});return n?h.jsxs("div",{className:"w-full",children:[h.jsx("label",{htmlFor:s,className:"block text-sm font-medium mb-1.5 text-card-foreground",children:n}),o]}):o}const Di={default:"bg-primary",success:"bg-green-600",warning:"bg-yellow-600",error:"bg-destructive"},Ai={sm:"h-1",md:"h-2",lg:"h-3"};function Ri({value:e=0,indeterminate:t=!1,label:n,showValue:s=!1,variant:r="default",size:o="md",className:c}){const i=Math.min(100,Math.max(0,e));return h.jsxs("div",{className:x("w-full",c),children:[(n||s)&&h.jsxs("div",{className:"flex justify-between items-center mb-2",children:[n&&h.jsx("span",{className:"text-sm font-medium",children:n}),s&&!t&&h.jsxs("span",{className:"text-sm text-muted-foreground",children:[i,"%"]})]}),h.jsx("div",{className:x("w-full overflow-hidden rounded-full bg-muted",Ai[o]),role:"progressbar","aria-valuenow":t?void 0:i,"aria-valuemin":0,"aria-valuemax":100,"aria-label":n||"Progress",children:h.jsx("div",{className:x("h-full rounded-full transition-all duration-500 ease-out",Di[r],t&&"animate-pulse w-full"),style:{width:t?"100%":`${i}%`}})})]})}const ts=v.createContext({});function Li({children:e,variant:t="default",interactive:n=!1,className:s}){return h.jsx(ts.Provider,{value:{variant:t,interactive:n},children:h.jsx("div",{className:x("relative w-full overflow-x-auto",s),children:h.jsx("table",{className:"w-full caption-bottom text-sm",children:e})})})}function ji({children:e,className:t}){return h.jsx("thead",{className:x("[&_tr]:border-b",t),children:e})}function Fi({children:e,className:t}){return h.jsx("tbody",{className:x("[&_tr:last-child]:border-0",t),children:e})}function Mi({children:e,onClick:t,selected:n=!1,className:s}){const{interactive:r}=v.useContext(ts),o=t||r;return h.jsx("tr",{className:x("border-b transition-colors",o&&"cursor-pointer hover:bg-muted/50 data-[state=selected]:bg-muted",n&&"bg-muted",s),onClick:t,role:t?"button":void 0,tabIndex:t?0:void 0,"data-state":n?"selected":void 0,onKeyDown:c=>{t&&(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t())},children:e})}function _i({children:e,align:t="left",sortable:n=!1,sorted:s=!1,onSort:r,className:o}){const c=()=>{n&&r&&r()};return h.jsx("th",{className:x("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t==="center"&&"text-center",t==="right"&&"text-right",n&&"cursor-pointer select-none hover:bg-muted/50 transition-colors",o),onClick:c,role:n?"button":void 0,tabIndex:n?0:void 0,"aria-sort":s?s==="asc"?"ascending":"descending":void 0,onKeyDown:i=>{n&&r&&(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),r())},children:h.jsxs("div",{className:x("flex items-center gap-2",t==="center"&&"justify-center",t==="right"&&"justify-end"),children:[e,n&&h.jsx("span",{className:"text-xs","aria-hidden":"true",children:s==="asc"?"↑":s==="desc"?"↓":"↕"})]})})}function Bi({children:e,align:t="left",className:n}){return h.jsx("td",{className:x("p-4 align-middle [&:has([role=checkbox])]:pr-0",t==="center"&&"text-center",t==="right"&&"text-right",n),children:e})}function $i({children:e,className:t}){return h.jsx("tfoot",{className:x("border-t font-medium",t),children:e})}function Hi({children:e,className:t}){return h.jsx("caption",{className:x("mt-4 text-sm text-muted-foreground",t),children:e})}const F={Root:Li,Header:ji,Body:Fi,Row:Mi,HeadCell:_i,Cell:Bi,Footer:$i,Caption:Hi};function Vi({products:e,isLoading:t=!1,isError:n=!1,error:s,onRefresh:r,onProductClick:o,className:c,currency:i="USD",sortField:u,sortDirection:a,onSort:l}){const[d,f]=v.useState("name"),[p,g]=v.useState("asc"),m=u??d,N=a??p,b=P=>{const D=m===P&&N==="asc"?"desc":"asc";l?l(P,D):(f(P),g(D))},O=[...e].sort((P,D)=>{let E=0;switch(m){case"name":E=P.name.localeCompare(D.name);break;case"price":E=P.price-D.price;break;case"expiration":E=new Date(P.expiration).getTime()-new Date(D.expiration).getTime();break}return N==="asc"?E:-E}),C=P=>new Intl.NumberFormat("en-US",{style:"currency",currency:i||"USD"}).format(P),Y=P=>new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric"}).format(new Date(P));return n?h.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-8 border rounded-lg text-center",children:[h.jsx("h3",{className:"text-2xl font-semibold",children:"Error Loading Products"}),h.jsx("p",{className:"text-sm max-w-md",children:(s==null?void 0:s.message)||"Failed to load products"}),r&&h.jsx(it,{onClick:r,variant:"default",children:"Retry"})]}):h.jsxs("div",{className:x("w-full",c),children:[r&&h.jsxs("div",{className:"flex items-center justify-between py-4 mb-4 border-b",children:[h.jsx("h2",{className:"text-2xl font-semibold",children:"Products Catalog"}),h.jsx(it,{onClick:r,variant:"ghost",size:"sm",loading:t,children:"Refresh"})]}),h.jsxs(F.Root,{variant:"bordered",interactive:!0,children:[h.jsx(F.Header,{children:h.jsxs(F.Row,{children:[h.jsx(F.HeadCell,{sortable:!0,sorted:m==="name"?N:!1,onSort:()=>b("name"),children:"Product Name"}),h.jsx(F.HeadCell,{align:"right",sortable:!0,sorted:m==="price"?N:!1,onSort:()=>b("price"),children:"Price"}),h.jsx(F.HeadCell,{align:"right",sortable:!0,sorted:m==="expiration"?N:!1,onSort:()=>b("expiration"),children:"Expiration Date"})]})}),h.jsx(F.Body,{children:t?h.jsx(F.Row,{children:h.jsx(F.Cell,{align:"center",className:"py-8 text-center italic",children:"Loading products..."})}):O.length===0?h.jsx(F.Row,{children:h.jsx(F.Cell,{align:"center",className:"py-8 text-center text-muted-foreground italic",children:"No products found"})}):O.map(P=>h.jsxs(F.Row,{onClick:o?()=>o(P):void 0,children:[h.jsx(F.Cell,{children:P.name}),h.jsx(F.Cell,{align:"right",className:"font-medium",children:(()=>{var E;if(i==="USD")return C(P.price);const D=(E=P.rates)==null?void 0:E.find(T=>T.currency===i);return C(D?D.convertedPrice:P.price)})()}),h.jsx(F.Cell,{align:"right",children:Y(P.expiration)})]},P.id))})]})]})}function Gi({children:e,className:t}){return h.jsx(_.Select.Positioner,{style:{zIndex:9999},children:h.jsx(_.Select.Content,{style:{backgroundColor:"white",zIndex:9999},className:x("w-full mt-1 max-h-60 overflow-auto rounded-md border border-gray-200 shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",t),children:e})})}function Ui(){return h.jsx(_.Select.HiddenSelect,{})}function Ki({className:e,children:t,...n}){return h.jsxs(_.Select.Item,{className:x("relative flex cursor-pointer items-center gap-2 px-3 py-2 text-sm outline-none","hover:bg-gray-100","data-[highlighted]:bg-gray-100","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[h.jsx(_.Select.ItemText,{children:t}),h.jsx(_.Select.ItemIndicator,{className:"ml-auto",children:h.jsx(te.Check,{className:"h-2 w-2 text-blue-600"})})]})}function Wi({className:e,children:t,...n}){return h.jsx(_.Select.ItemGroup,{className:x("py-1",e),...n,children:t})}function qi({className:e,children:t,...n}){return h.jsx(_.Select.ItemGroupLabel,{className:x("px-3 py-1.5 text-xs font-semibold text-gray-500",e),...n,children:t})}function zi({children:e,className:t}){return h.jsx(_.Select.Label,{className:x("mb-1 block text-sm font-medium text-gray-700",t),children:e})}const Yi=v.createContext({});function Xi(e){const{items:t,...n}=e,s=v.useMemo(()=>_.createListCollection({items:t}),[t]);return h.jsx(Yi.Provider,{value:{},children:h.jsx(_.Select.Root,{collection:s,positioning:{sameWidth:!0},...n})})}function Zi({className:e,placeholder:t}){return h.jsxs(_.Select.Control,{className:x("flex items-center justify-between gap-2 rounded-md border border-gray-300 bg-white px-3 py-2 text-sm","hover:border-gray-400","focus-within:border-blue-500 focus-within:ring-1 focus-within:ring-blue-500","disabled:cursor-not-allowed disabled:opacity-50",e),children:[h.jsx(_.Select.Trigger,{className:"flex flex-1 items-center gap-2",children:h.jsx(_.Select.ValueText,{placeholder:t||"Select an option"})}),h.jsx(_.Select.Indicator,{children:h.jsx(te.ChevronDown,{className:"h-4 w-4 text-gray-500"})})]})}const Ji={Root:Xi,Label:zi,Trigger:Zi,Content:Gi,Item:Ki,ItemGroup:Wi,ItemGroupLabel:qi,HiddenSelect:Ui};var Qi=ye("toast").parts("group","root","title","description","actionTrigger","closeTrigger"),pe=Qi.build(),M=It({getRegionId:e=>`toast-group:${e}`,getRegionEl:(e,t)=>M.getById(e,`toast-group:${t}`),getRootId:e=>`toast:${e.id}`,getRootEl:e=>M.getById(e,M.getRootId(e)),getTitleId:e=>`toast:${e.id}:title`,getDescriptionId:e=>`toast:${e.id}:description`,getCloseTriggerId:e=>`toast${e.id}:close`});function Rt(e,t){return e.filter(n=>n.state.context.placement===t)}var sn={info:5e3,error:5e3,success:2e3,loading:1/0,DEFAULT:5e3};function rn(e,t){return e??sn[t]??sn.DEFAULT}function ea(e,t){var l;const n=e.offsets,s=typeof n=="string"?{left:n,right:n,bottom:n,top:n}:n,r=e.dir==="rtl",o=t.replace("-start",r?"-right":"-left").replace("-end",r?"-left":"-right"),c=o.includes("right"),i=o.includes("left"),u={position:"fixed",pointerEvents:e.count>0?void 0:"none",display:"flex",flexDirection:"column","--gap":`${e.gap}px`,"--first-height":`${((l=e.heights[0])==null?void 0:l.height)||0}px`,zIndex:vr};let a="center";if(c&&(a="flex-end"),i&&(a="flex-start"),u.alignItems=a,o.includes("top")){const d=s.top;u.top=`max(env(safe-area-inset-top, 0px), ${d})`}if(o.includes("bottom")){const d=s.bottom;u.bottom=`max(env(safe-area-inset-bottom, 0px), ${d})`}if(!o.includes("left")){const d=s.right;u.insetInlineEnd=`calc(env(safe-area-inset-right, 0px) + ${d})`}if(!o.includes("right")){const d=s.left;u.insetInlineStart=`calc(env(safe-area-inset-left, 0px) + ${d})`}return u}function ta(e,t){const[n]=e.placement.split("-"),s=!e.frontmost,r=!e.stacked,o={position:"absolute",pointerEvents:"auto","--opacity":"0","--remove-delay":`${e.removeDelay}ms`,"--duration":`${e.type==="loading"?Number.MAX_SAFE_INTEGER:e.duration}ms`,"--initial-height":`${e.height}px`,"--offset":`${e.offset}px`,"--index":e.index,"--z-index":e.zIndex,"--lift-amount":"calc(var(--lift) * var(--gap))","--y":"100%","--x":"0"},c=i=>Object.assign(o,i);return n==="top"?c({top:"0","--sign":"-1","--y":"-100%","--lift":"1"}):n==="bottom"&&c({bottom:"0","--sign":"1","--y":"100%","--lift":"-1"}),e.mounted&&(c({"--y":"0","--opacity":"1"}),e.stacked&&c({"--y":"calc(var(--lift) * var(--offset))","--height":"var(--initial-height)"})),t||c({"--opacity":"0",pointerEvents:"none"}),s&&r&&(c({"--base-scale":"var(--index) * 0.05 + 1","--y":"calc(var(--lift-amount) * var(--index))","--scale":"calc(-1 * var(--base-scale))","--height":"var(--first-height)"}),t||c({"--y":"calc(var(--sign) * 40%)"})),s&&e.stacked&&!t&&c({"--y":"calc(var(--lift) * var(--offset) + var(--lift) * -100%)"}),e.frontmost&&!t&&c({"--y":"calc(var(--lift) * -100%)"}),o}function na(e,t){const n={position:"absolute",inset:"0",scale:"1 2",pointerEvents:t?"none":"auto"},s=r=>Object.assign(n,r);return e.frontmost&&!t&&s({height:"calc(var(--initial-height) + 80%)"}),n}function sa(e,t){return{position:"absolute",left:"0",height:"calc(var(--gap) + 2px)",bottom:"100%",width:"100%"}}function ra(e,t,n){function s(){return Qs(e)?e.getState():e}function r(l){return Rt(s().context.toasts,l)}function o(l){const d=s().context.toasts;return d.length?!!d.find(f=>f.id==l):!1}function c(l){const d=`toast:${ft()}`,f=l.id?l.id:d;return o(f)||t({type:"ADD_TOAST",toast:{...l,id:f}}),f}function i(l,d){return o(l)&&t({type:"UPDATE_TOAST",id:l,toast:d}),l}function u(l){const{id:d}=l;return(d?o(d):!1)&&d!=null?i(d,l):c(l)}function a(l){l==null?t("DISMISS_ALL"):o(l)&&t({type:"DISMISS_TOAST",id:l})}return{getCount(){return s().context.count},getPlacements(){const d=s().context.toasts.map(f=>f.state.context.placement);return Array.from(new Set(d))},getToastsByPlacement:r,isVisible:o,create:c,update:i,upsert:u,dismiss:a,remove(l){l==null?t("REMOVE_ALL"):o(l)&&t({type:"REMOVE_TOAST",id:l})},dismissByPlacement(l){r(l).forEach(f=>a(f.id))},loading(l){return u({...l,type:"loading"})},success(l){return u({...l,type:"success"})},error(l){return u({...l,type:"error"})},promise(l,d,f={}){const p=u({...f,...d.loading,type:"loading"});return Pe(l).then(g=>{const m=Pe(d.success,g);u({...f,...m,id:p,type:"success"})}).catch(g=>{const m=Pe(d.error,g);u({...f,...m,id:p,type:"error"})}).finally(()=>{var g;(g=d.finally)==null||g.call(d)}),p},pause(l){l==null?t("PAUSE_ALL"):o(l)&&t({type:"PAUSE_TOAST",id:l})},resume(l){l==null?t("RESUME_ALL"):o(l)&&t({type:"RESUME_TOAST",id:l})},getGroupProps(l){const{placement:d,label:f="Notifications"}=l,p=s(),g=p.context.hotkey.join("+").replace(/Key/g,"").replace(/Digit/g,""),[m,N="center"]=d.split("-");return n.element({...pe.group.attrs,dir:p.context.dir,tabIndex:-1,"aria-label":`${d} ${f} ${g}`,id:M.getRegionId(d),"data-placement":d,"data-side":m,"data-align":N,"aria-live":"polite",role:"region",style:ea(p.context,d),onMouseMove(){t({type:"REGION.POINTER_ENTER",placement:d})},onMouseLeave(){t({type:"REGION.POINTER_LEAVE",placement:d})},onFocus(b){t({type:"REGION.FOCUS",target:b.relatedTarget})},onBlur(b){p.context.isFocusWithin&&!be(b.currentTarget,b.relatedTarget)&&t({type:"REGION.BLUR"})}})},subscribe(l){const d=s();return We(d.context.toasts,()=>{const p=r(d.context.placement).map(g=>g.getState().context);l(p)})}}}var{not:oa,and:ia,or:aa}=xn;function ca(e){const{type:t="info",duration:n,id:s="1",placement:r="bottom",removeDelay:o=200,...c}=e,i=le(c),u=rn(n,t);return De({id:s,context:{id:s,type:t,remaining:u,duration:u,removeDelay:o,createdAt:Date.now(),placement:r,...i,height:0,offset:0,frontmost:!1,mounted:!1,index:-1,zIndex:0},initial:t==="loading"?"visible:persist":"visible",on:{UPDATE:[{guard:ia("hasTypeChanged","isChangingToLoading"),target:"visible:persist",actions:["setContext"]},{guard:aa("hasDurationChanged","hasTypeChanged"),target:"visible:updating",actions:["setContext"]},{actions:["setContext"]}],MEASURE:{actions:["measureHeight"]}},entry:["invokeOnVisible"],activities:["trackHeight"],states:{"visible:updating":{tags:["visible","updating"],after:{0:"visible"}},"visible:persist":{tags:["visible","paused"],on:{RESUME:{guard:oa("isLoadingType"),target:"visible",actions:["setCreatedAt"]},DISMISS:"dismissing"}},visible:{tags:["visible"],after:{VISIBLE_DURATION:"dismissing"},on:{DISMISS:"dismissing",PAUSE:{target:"visible:persist",actions:"setRemainingDuration"}}},dismissing:{entry:"invokeOnDismiss",after:{REMOVE_DELAY:{target:"unmounted",actions:"notifyParentToRemove"}}},unmounted:{entry:"invokeOnUnmount",type:"final"}}},{activities:{trackHeight(a,l,{self:d}){let f;return z(()=>{const p=M.getRootEl(a);if(!p)return;a.mounted=!0;const g=Jr(p,"[data-ghost]");me(g.length!==2,"[toast] No ghost element found in toast. Render the `ghostBefore` and `ghostAfter` elements");const m=()=>{const O=p.style.height;p.style.height="auto";const C=p.getBoundingClientRect().height;p.style.height=O,a.height=C,d.sendParent({type:"UPDATE_HEIGHT",id:d.id,height:C,placement:a.placement})};m();const N=M.getWin(a),b=new N.MutationObserver(m);b.observe(p,{childList:!0,subtree:!0,characterData:!0}),f=()=>b.disconnect()}),()=>f==null?void 0:f()}},guards:{isChangingToLoading:(a,l)=>{var d;return((d=l.toast)==null?void 0:d.type)==="loading"},isLoadingType:a=>a.type==="loading",hasTypeChanged:(a,l)=>{var d;return((d=l.toast)==null?void 0:d.type)!=null&&l.toast.type!==a.type},hasDurationChanged:(a,l)=>{var d;return((d=l.toast)==null?void 0:d.duration)!=null&&l.toast.duration!==a.duration}},delays:{VISIBLE_DURATION:a=>a.remaining,REMOVE_DELAY:a=>a.removeDelay},actions:{measureHeight(a,l,{self:d}){z(()=>{const f=M.getRootEl(a);if(!f)return;a.mounted=!0;const p=f.style.height;f.style.height="auto";const g=f.getBoundingClientRect().height;f.style.height=p,a.height=g,d.sendParent({type:"UPDATE_HEIGHT",id:d.id,height:g,placement:a.placement})})},setRemainingDuration(a){a.remaining-=Date.now()-a.createdAt},setCreatedAt(a){a.createdAt=Date.now()},notifyParentToRemove(a,l,{self:d}){d.sendParent({type:"REMOVE_TOAST",id:d.id})},invokeOnDismiss(a){var l;(l=a.onStatusChange)==null||l.call(a,{status:"dismissing"})},invokeOnUnmount(a){var l;(l=a.onStatusChange)==null||l.call(a,{status:"unmounted"})},invokeOnVisible(a){var l;(l=a.onStatusChange)==null||l.call(a,{status:"visible"})},setContext(a,l){var g,m;const d=(g=l.toast)==null?void 0:g.duration,f=((m=l.toast)==null?void 0:m.type)??a.type,p=rn(d,f);Object.assign(a,{...l.toast,duration:p,remaining:p})}}})}function la(e){const t=le(e);return De({id:"toaster",initial:t.overlap?"overlap":"stack",context:{dir:"ltr",max:Number.MAX_SAFE_INTEGER,gap:16,pauseOnPageIdle:!1,hotkey:["altKey","KeyT"],offsets:"1rem",placement:"bottom",removeDelay:200,...t,toasts:[],lastFocusedEl:null,isFocusWithin:!1,heights:[]},computed:{count:n=>n.toasts.length},activities:["trackDocumentVisibility","trackHotKeyPress"],watch:{toasts:["collapsedIfEmpty","setDismissableBranch"]},exit:["removeToasts","clearDismissableBranch","clearLastFocusedEl"],on:{PAUSE_TOAST:{actions:["pauseToast"]},PAUSE_ALL:{actions:["pauseToasts"]},RESUME_TOAST:{actions:["resumeToast"]},RESUME_ALL:{actions:["resumeToasts"]},ADD_TOAST:{guard:"isWithinRange",actions:["createToast","syncToastIndex"]},UPDATE_TOAST:{actions:["updateToast"]},DISMISS_TOAST:{actions:["dismissToast"]},DISMISS_ALL:{actions:["dismissToasts"]},REMOVE_TOAST:{actions:["removeToast","syncToastIndex","syncToastOffset"]},REMOVE_ALL:{actions:["removeToasts"]},UPDATE_HEIGHT:{actions:["syncHeights","syncToastOffset"]},"DOC.HOTKEY":{actions:["focusRegionEl"]},"REGION.BLUR":[{guard:"isOverlapping",target:"overlap",actions:["resumeToasts","restoreLastFocusedEl"]},{actions:["resumeToasts","restoreLastFocusedEl"]}]},states:{stack:{entry:["expandToasts"],on:{"REGION.POINTER_LEAVE":[{guard:"isOverlapping",target:"overlap",actions:["resumeToasts"]},{actions:["resumeToasts"]}],"REGION.OVERLAP":{target:"overlap"},"REGION.FOCUS":{actions:["setLastFocusedEl","pauseToasts"]},"REGION.POINTER_ENTER":{actions:["pauseToasts"]}}},overlap:{entry:["collapseToasts"],on:{"REGION.STACK":{target:"stack"},"REGION.POINTER_ENTER":{target:"stack",actions:["pauseToasts"]},"REGION.FOCUS":{target:"stack",actions:["setLastFocusedEl","pauseToasts"]}}}}},{guards:{isWithinRange:n=>n.toasts.length<n.max,isOverlapping:n=>!!n.overlap},activities:{trackHotKeyPress(n,s,{send:r}){return A(document,"keydown",c=>{n.hotkey.every(u=>c[u]||c.code===u)&&r({type:"DOC.HOTKEY"})},{capture:!0})},trackDocumentVisibility(n,s,{send:r}){if(!n.pauseOnPageIdle)return;const o=M.getDoc(n);return A(o,"visibilitychange",()=>{r(o.visibilityState==="hidden"?"PAUSE_ALL":"RESUME_ALL")})}},actions:{setDismissableBranch(n){var c;const r=Rt(n.toasts,n.placement).length>0;if(!r){(c=n._cleanup)==null||c.call(n);return}if(r&&n._cleanup)return;const o=()=>M.getRegionEl(n,n.placement);n._cleanup=Xo(o,{defer:!0})},clearDismissableBranch(n){var s;(s=n._cleanup)==null||s.call(n)},focusRegionEl(n){queueMicrotask(()=>{var s;(s=M.getRegionEl(n,n.placement))==null||s.focus()})},expandToasts(n){He(n,s=>{s.state.context.stacked=!0})},collapseToasts(n){He(n,s=>{s.state.context.stacked=!1})},collapsedIfEmpty(n,s,{send:r}){!n.overlap||n.toasts.length>1||r("REGION.OVERLAP")},pauseToast(n,s,{self:r}){r.sendChild("PAUSE",s.id)},pauseToasts(n){n.toasts.forEach(s=>s.send("PAUSE"))},resumeToast(n,s,{self:r}){r.sendChild("RESUME",s.id)},resumeToasts(n){n.toasts.forEach(s=>s.send("RESUME"))},measureToasts(n){n.toasts.forEach(s=>s.send("MEASURE"))},createToast(n,s,{self:r,getState:o}){const c={placement:n.placement,duration:n.duration,removeDelay:n.removeDelay,...s.toast,dir:n.dir,getRootNode:n.getRootNode,stacked:o().matches("stack")},i=ca(c),u=r.spawn(i);n.toasts=[u,...n.toasts]},updateToast(n,s,{self:r}){r.sendChild({type:"UPDATE",toast:s.toast},s.id)},dismissToast(n,s,{self:r}){r.sendChild("DISMISS",s.id)},dismissToasts(n){n.toasts.forEach(s=>s.send("DISMISS"))},removeToast(n,s,{self:r}){r.stopChild(s.id),n.toasts=n.toasts.filter(o=>o.id!==s.id),n.heights=n.heights.filter(o=>o.id!==s.id)},removeToasts(n,s,{self:r}){n.toasts.forEach(o=>r.stopChild(o.id)),n.toasts=[],n.heights=[]},syncHeights(n,s){const r=n.heights.find(o=>o.id===s.id);if(r)r.height=s.height,r.placement=s.placement;else{const o={id:s.id,height:s.height,placement:s.placement};n.heights=[o,...n.heights]}},syncToastIndex(n){He(n,(s,r,o)=>{s.state.context.index=r,s.state.context.frontmost=r===0,s.state.context.zIndex=o.length-r})},syncToastOffset(n,s){const r=s.placement??n.placement;He({...n,placement:r},o=>{const c=Math.max(n.heights.findIndex(u=>u.id===o.id),0),i=n.heights.reduce((u,a,l)=>l>=c?u:u+a.height,0);o.state.context.offset=c*n.gap+i})},setLastFocusedEl(n,s){n.isFocusWithin||!s.target||(n.isFocusWithin=!0,n.lastFocusedEl=ke(s.target))},restoreLastFocusedEl(n){n.isFocusWithin=!1,n.lastFocusedEl&&(n.lastFocusedEl.focus({preventScroll:!0}),n.lastFocusedEl=null)},clearLastFocusedEl(n){n.lastFocusedEl&&(n.lastFocusedEl.focus({preventScroll:!0}),n.lastFocusedEl=null,n.isFocusWithin=!1)}}})}function He(e,t){Rt(e.toasts,e.placement).forEach(t)}function ua(e,t,n){const s=e.hasTag("visible"),r=e.hasTag("paused"),o=e.context.placement,c=e.context.type,[i,u="center"]=o.split("-");return{type:c,title:e.context.title,description:e.context.description,placement:o,visible:s,paused:r,pause(){t("PAUSE")},resume(){t("RESUME")},dismiss(){t("DISMISS")},getRootProps(){return n.element({...pe.root.attrs,dir:e.context.dir,id:M.getRootId(e.context),"data-state":s?"open":"closed","data-type":c,"data-placement":o,"data-align":u,"data-side":i,"data-mounted":$(e.context.mounted),"data-paused":$(r),"data-first":$(e.context.frontmost),"data-sibling":$(!e.context.frontmost),"data-stack":$(e.context.stacked),"data-overlap":$(!e.context.stacked),role:"status","aria-atomic":"true","aria-describedby":e.context.description?M.getDescriptionId(e.context):void 0,"aria-labelledby":e.context.title?M.getTitleId(e.context):void 0,tabIndex:0,style:ta(e.context,s),onKeyDown(a){a.defaultPrevented||a.key=="Escape"&&(t("DISMISS"),a.preventDefault())}})},getGhostBeforeProps(){return n.element({"data-ghost":"before",style:na(e.context,s)})},getGhostAfterProps(){return n.element({"data-ghost":"after",style:sa()})},getTitleProps(){return n.element({...pe.title.attrs,id:M.getTitleId(e.context)})},getDescriptionProps(){return n.element({...pe.description.attrs,id:M.getDescriptionId(e.context)})},getActionTriggerProps(){return n.button({...pe.actionTrigger.attrs,type:"button",onClick(a){var l,d;a.defaultPrevented||((d=(l=e.context.action)==null?void 0:l.onClick)==null||d.call(l),t("DISMISS"))}})},getCloseTriggerProps(){return n.button({id:M.getCloseTriggerId(e.context),...pe.closeTrigger.attrs,type:"button","aria-label":"Dismiss notification",onClick(a){a.defaultPrevented||t("DISMISS")}})}}}var vt={connect:ra,machine:la};const da=e=>{const t=vt.machine({id:"1",...e});return{...vt.connect(t,t.send,Ae),machine:t}},[fa,Re]=Z({name:"ToastContext",hookName:"useToastContext",providerName:"<ToastProvider />"}),ns=v.forwardRef((e,t)=>{const n=Re(),s=I(n.getActionTriggerProps(),e);return h.jsx(L.button,{...s,ref:t})});ns.displayName="ToastActionTrigger";const ss=v.forwardRef((e,t)=>{const n=Re(),s=I(n.getCloseTriggerProps(),e);return h.jsx(L.button,{...s,ref:t})});ss.displayName="ToastCloseTrigger";const rs=v.forwardRef((e,t)=>{const n=Re(),s=I(n.getDescriptionProps(),e);return h.jsx(L.div,{...s,ref:t})});rs.displayName="ToastDescription";const os=v.forwardRef((e,t)=>{const n=Re(),s=I(n.getRootProps(),e);return h.jsxs("div",{...s,ref:t,children:[h.jsx("div",{...n.getGhostBeforeProps()}),e.children,h.jsx("div",{...n.getGhostAfterProps()})]})});os.displayName="ToastRoot";const is=v.forwardRef((e,t)=>{const n=Re(),s=I(n.getTitleProps(),e);return h.jsx(L.div,{...s,ref:t})});is.displayName="ToastTitle";const as=v.forwardRef((e,t)=>{const{toaster:n,children:s,...r}=e,[o,c]=Xe(n.machine),i=o.context.placement,u=vt.connect(o,c,Ae),a=u.getToastsByPlacement(i),l=I(u.getGroupProps({placement:i}),r);return h.jsx(L.div,{...l,ref:t,children:a.map(d=>h.jsx(ha,{value:d,children:f=>s(f)},d.id))})});as.displayName="Toaster";const ha=e=>{const[t,n]=ur(e.value),s=ua(t,n,Ae);return h.jsx(fa,{value:s,children:e.children(t.context)})},ge=da({placement:"bottom-end",duration:5e3,overlap:!0,gap:16}),pa={success:{container:"border-green-200 bg-green-50 text-green-900",icon:"text-green-600",IconComponent:te.CheckCircle},error:{container:"border-red-200 bg-red-50 text-red-900",icon:"text-red-600",IconComponent:te.AlertCircle},warning:{container:"border-yellow-200 bg-yellow-50 text-yellow-900",icon:"text-yellow-600",IconComponent:te.AlertTriangle},info:{container:"border-blue-200 bg-blue-50 text-blue-900",icon:"text-blue-600",IconComponent:te.Info}};function ga({children:e}){return h.jsxs(h.Fragment,{children:[e,h.jsx(as,{toaster:ge,children:t=>{const n=t.type||"info",s=pa[n],r=s.IconComponent;return h.jsxs(os,{className:x("flex items-start gap-3 rounded-lg border p-4 shadow-lg","min-w-[320px] max-w-[420px]","[translate:var(--x)_var(--y)]","[scale:var(--scale)]","[z-index:var(--z-index)]","[height:var(--height)]","[opacity:var(--opacity)]",s.container),children:[h.jsx(r,{className:x("h-5 w-5 flex-shrink-0 mt-0.5",s.icon)}),h.jsxs("div",{className:"flex-1 space-y-1",children:[h.jsx(is,{className:"text-sm font-semibold",children:t.title}),t.description&&h.jsx(rs,{className:"text-sm opacity-90",children:t.description}),t.action&&h.jsx(ns,{className:x("mt-2 inline-flex items-center text-sm font-medium underline-offset-4 hover:underline"),children:t.action.label})]}),h.jsx(ss,{className:x("flex-shrink-0 rounded-md p-1 hover:bg-black/5","focus:outline-none focus:ring-2 focus:ring-offset-2"),"aria-label":"Close notification",children:h.jsx(te.X,{className:"h-4 w-4"})})]})}})]})}const ma={success:e=>ge.create({...e,type:"success"}),error:e=>ge.create({...e,type:"error"}),warning:e=>ge.create({...e,type:"warning"}),info:e=>ge.create({...e,type:"info"})};exports.Badge=fs;exports.Button=it;exports.Card=hs;exports.CardContent=ys;exports.CardDescription=ms;exports.CardFooter=vs;exports.CardHeader=ps;exports.CardTitle=gs;exports.Checkbox=xo;exports.Dialog=ki;exports.Input=Ii;exports.ProductsTable=Vi;exports.Progress=Ri;exports.Select=Ji;exports.Table=F;exports.ToastProvider=ga;exports.cn=x;exports.toast=ma;exports.toaster=ge;
2
2
  //# sourceMappingURL=index.cjs.map