@buildbase/sdk 0.0.8 → 0.0.9

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.esm.js CHANGED
@@ -1,29 +1,29 @@
1
- import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import a,{Component as o,createContext as i,useReducer as s,useMemo as c,useCallback as l,useEffect as d,useState as u,forwardRef as f,createElement as p,useRef as m,useLayoutEffect as h,useContext as g}from"react";import*as v from"react-dom";import b from"react-dom";var y;!function(e){e.V1="v1"}(y||(y={}));class w extends Error{constructor(e,t,r,n){super(e),this.code=t,this.context=r,this.originalError=n,this.name="SDKError","undefined"!=typeof Error&&"captureStackTrace"in Error&&Error.captureStackTrace(this,w)}}const x=new class{constructor(){this.config={enableConsoleLogging:!0,showUserNotifications:!1}}configure(e){this.config={...this.config,...e}}handleError(e,t={}){const r=e instanceof Error?e:new w("string"==typeof e?e:"An unknown error occurred","UNKNOWN_ERROR",t),n=r instanceof w?r:new w(r.message,r.name,t,r),a=(()=>{try{return"undefined"!=typeof process&&"development"===process.env?.NODE_ENV}catch{return!1}})();if(this.config.enableConsoleLogging&&a&&console.error(`[SDK Error] ${t.component||"Unknown"}:`,{message:n.message,code:n.code,context:n.context,originalError:n.originalError,stack:n.stack}),this.config.onError)try{this.config.onError(n,t)}catch(e){console.error("[SDK Error Handler] Error in custom error callback:",e)}this.config.showUserNotifications&&this.notifyUser(n,t)}notifyUser(e,t){"undefined"!=typeof window&&window.dispatchEvent&&window.dispatchEvent(new CustomEvent("sdk-error",{detail:{error:e,context:t}}))}wrapAsync(e,t){return(...r)=>e(...r).catch(e=>{throw this.handleError(e,t),e})}wrapSync(e,t){return(...r)=>{try{return e(...r)}catch(e){throw this.handleError(e,t),e}}}};function S(e,t={}){x.handleError(e,t)}function k(e,t,r,n){return new w(e,t,r,n)}class A extends o{constructor(e){super(e),this.resetError=()=>{this.setState({hasError:!1,error:null})},this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){if(S(e,{component:"ErrorBoundary",action:"componentDidCatch",metadata:{componentStack:t.componentStack,errorBoundary:this.constructor.name}}),this.props.onError)try{this.props.onError(e,t)}catch(e){console.error("[SDK ErrorBoundary] Error in onError callback:",e)}}componentDidUpdate(e){this.state.hasError&&!1!==this.props.resetOnPropsChange&&e.children!==this.props.children&&this.resetError()}render(){return this.state.hasError&&this.state.error?this.props.fallback?"function"==typeof this.props.fallback?this.props.fallback(this.state.error,this.resetError):this.props.fallback:e("div",{style:{padding:"1rem",border:"1px solid #ef4444",borderRadius:"0.5rem",backgroundColor:"#fef2f2",color:"#991b1b"},children:[t("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem",fontWeight:600},children:"Something went wrong"}),t("p",{style:{margin:"0 0 1rem 0",fontSize:"0.875rem"},children:this.state.error.message||"An unexpected error occurred"}),t("button",{onClick:this.resetError,style:{padding:"0.5rem 1rem",backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:"0.25rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]}):this.props.children}}const E=()=>({type:"AUTHENTICATION_STARTED"}),C=()=>({type:"AUTHENTICATION_FAILED"}),T=e=>({type:"SET_SESSION",payload:e}),N=()=>({type:"REMOVE_SESSION"});function _({name:e,initialState:r,reducer:n,initializer:o}){const l=i(null),d=i(null),u=i(null),f=a.memo(({children:e})=>{const[a,i]=s(n,r,o||(e=>e)),f=c(()=>({state:a,dispatch:i}),[a,i]);return t(u.Provider,{value:f,children:t(l.Provider,{value:a,children:t(d.Provider,{value:i,children:e})})})});f.displayName=`${e}Provider`;const p=()=>{const t=a.useContext(l);if(null===t)throw new Error(`use${e}State must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`);return t};return{Provider:f,useContext:()=>{const t=a.useContext(u);if(!t)throw new Error(`use${e}Context must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`);return t},useState:p,useDispatch:()=>{const t=a.useContext(d);if(null===t)throw new Error(`use${e}Dispatch must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`);return t},useSelector:(e,t)=>{const r=p(),n=e||(e=>e),o=a.useRef(n),i=a.useRef(t),s=a.useRef(void 0),l=a.useRef(r);e&&(o.current=n),t&&(i.current=t);return c(()=>{const e=o.current(r);if(void 0!==s.current){if((i.current?i.current(s.current,e):Object.is(s.current,e))&&l.current===r)return s.current}return s.current=e,l.current=r,e},[r])}}}var R;function P(e){if("undefined"==typeof window)return null;try{return localStorage.getItem(e)}catch(t){return console.warn(`Failed to load ${e} from localStorage:`,t),null}}function O(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch(t){console.warn(`Failed to save ${e} to localStorage:`,t)}}function D(e){if("undefined"!=typeof window)try{localStorage.removeItem(e)}catch(t){console.warn(`Failed to remove ${e} from localStorage:`,t)}}!function(e){e.loading="loading",e.authenticated="authenticated",e.unauthenticated="unauthenticated",e.authenticating="authenticating"}(R||(R={}));const I="code",U="saas-session-id";function M(){D(U)}function L(){if("undefined"==typeof window)return null;try{return P(U)}catch(e){return console.warn("Failed to get sessionId from localStorage:",e),null}}function F(){const e=L(),t={};return e&&(t["x-session-id"]=e),t}function z(e,t){return{user:e,sessionId:t,expires:new Date(Date.now()+864e5).toISOString()}}const j=()=>({session:null,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:R.unauthenticated}),{Provider:B,useState:W,useDispatch:V}=_({name:"Auth",initialState:j(),reducer:(e,t)=>{switch(t.type){case"AUTHENTICATION_STARTED":return{...e,isLoading:!0,isAuthenticated:!1,isRedirecting:!0,status:R.authenticating};case"AUTHENTICATION_FAILED":return{...e,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:R.unauthenticated};case"SET_SESSION":{const n=t.payload;return r=n.sessionId,O(U,r),{...e,session:n,isAuthenticated:!0,isRedirecting:!1,isLoading:!1,status:R.authenticated}}case"REMOVE_SESSION":return M(),{...e,session:null,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:R.unauthenticated};default:return e}var r},initializer:j}),$=B,G=W,K=V,H=e=>({type:"SET_SAAS_OS_CONFIG",payload:e}),Z=e=>({type:"SET_SETTINGS",payload:e}),q=()=>({serverUrl:"",version:y.V1,orgId:"",settings:null}),{Provider:J,useState:Y,useDispatch:X}=_({name:"OS",initialState:q(),reducer:(e,t)=>{switch(t.type){case"SET_SAAS_OS_CONFIG":return{...e,...t.payload};case"REMOVE_SAAS_OS_CONFIG":return q();case"SET_SETTINGS":return{...e,settings:t.payload};default:return e}}}),Q=J,ee=Y,te=X,re=e=>({type:"SET_WORKSPACES",payload:e}),ne=e=>({type:"SET_ALL_FEATURES",payload:e}),ae=e=>({type:"SET_CURRENT_WORKSPACE",payload:e}),oe=()=>({type:"RESET_CURRENT_WORKSPACE"}),ie=e=>({type:"SET_IS_INITIALIZED",payload:e}),se=e=>({type:"SET_LOADING",payload:e}),ce=e=>({type:"SET_ERROR",payload:e}),le=e=>({type:"SET_REFRESHING",payload:e}),de="saas-workspace-current";const{Provider:ue,useState:fe,useDispatch:pe}=_({name:"Workspace",initialState:{workspaces:[],loading:!1,error:null,currentWorkspace:null,refreshing:!1,switching:!1,isInitialized:!1,allFeatures:[]},reducer:(e,t)=>{switch(t.type){case"SET_WORKSPACES":return{...e,workspaces:t.payload};case"SET_ALL_FEATURES":return{...e,allFeatures:t.payload};case"SET_CURRENT_WORKSPACE":return(r=t.payload._id)?O(de,r):D(de),{...e,currentWorkspace:t.payload};case"RESET_CURRENT_WORKSPACE":return D(de),{...e,currentWorkspace:null};case"SET_IS_INITIALIZED":return{...e,isInitialized:t.payload};case"SET_LOADING":return{...e,loading:t.payload};case"SET_ERROR":return{...e,error:t.payload};case"SET_REFRESHING":return{...e,refreshing:t.payload};case"SET_SWITCHING":return{...e,switching:t.payload};default:return e}var r}}),me=ue,he=fe,ge=pe,ve=a.memo(({children:e})=>t(Q,{children:t($,{children:t(me,{children:e})})}));function be(e,t){const r=ee(),n=G(),o=he(),i=c(()=>({os:r,auth:n,workspaces:o}),[r,n,o]),s=e||(e=>e),l=a.useRef(s),d=a.useRef(t),u=a.useRef(void 0),f=a.useRef(i);e&&(l.current=s);return c(()=>{const e=l.current(i);if(void 0!==u.current){if((d.current?d.current(u.current,e):Object.is(u.current,e))&&f.current===i)return u.current}return u.current=e,f.current=i,e},[i])}function ye(){const e=K(),t=te(),r=ge();return c(()=>({auth:e,os:t,workspaces:r}),[e,t,r])}ve.displayName="SDKContextProvider";const we=a.memo(({children:e,callbacks:n})=>{const o=ye(),i=be(e=>e.auth),s=be(e=>e.os),u=a.useRef(!1),f=a.useRef(null),p=c(()=>n,[n]),m=l(async e=>{try{if(p?.handleAuthentication){const{sessionId:t}=await p.handleAuthentication(e);if(!t||"string"!=typeof t||""===t.trim())throw new Error("Invalid sessionId received from authentication callback");const r=s,{serverUrl:n,version:a,orgId:i}=r;if(!n||!a||!i)throw new Error("OS configuration is not available");const c=await fetch(`${n}/api/${a}/public/profile`,{headers:{"x-session-id":t,"Content-Type":"application/json"}});if(!c.ok)throw new Error("Failed to fetch user profile");let l;try{l=await c.json()}catch(e){throw new Error("Failed to parse user profile response")}const d=l._id||l.id;if(!d||"string"!=typeof d)throw new Error("User data missing required ID field");if(!l.email||"string"!=typeof l.email)throw new Error("User data missing required email field");const u=z({id:d,name:l.name||"",org:i,email:l.email,emailVerified:!0,clientId:r.auth?.clientId||"",role:l.role||"",image:l.image},t);o.auth(T(u)),function(){try{const e=new URL(window.location.href);e.searchParams.delete(I),window.history.replaceState({},"",e.toString())}catch(e){console.error("Error removing token from URL:",e)}}()}}catch(t){throw S(t,{component:"AuthProviderWrapper",action:"handleAuthRedirect",metadata:{hasCode:!!e}}),o.auth(C()),t}},[o,p,s]);return d(()=>{if("undefined"==typeof window)return;if(i.isAuthenticated)return;const e=L();if(!e)return;(async()=>{try{const{serverUrl:t,version:r,orgId:n}=s;if(!t||!r||!n)return void S(new Error("OS configuration not available, cannot fetch user profile"),{component:"AuthProviderWrapper",action:"fetchUserProfile"});const a=await fetch(`${t}/api/${r}/public/profile`,{headers:{"x-session-id":e,"Content-Type":"application/json"}});if(!a.ok)return S(new Error("Session invalid, removing from localStorage"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{status:a.status}}),void M();let i;try{i=await a.json()}catch(e){return S(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"parseResponse"}}),void M()}const c=i._id||i.id;if(!c||"string"!=typeof c)return S(new Error("User data missing required ID field"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"validateUserData"}}),void M();if(!i.email||"string"!=typeof i.email)return S(new Error("User data missing required email field"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"validateUserData"}}),void M();const l=z({id:c,name:i.name||"",org:n,email:i.email,emailVerified:!0,clientId:s.auth?.clientId||"",role:i.role||"",image:i.image},e);o.auth(T(l))}catch(e){S(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"pageLoad"}}),M()}})()},[i.isAuthenticated,o,s]),d(()=>{const e=function(){if("undefined"==typeof window)return null;try{return new URLSearchParams(window.location.search).get(I)}catch(e){return console.error("Error getting token from URL:",e),null}}();if(!e)return;if(u.current||f.current===e)return;const{serverUrl:t,version:r,orgId:n}=s;t&&r&&n&&(u.current=!0,f.current=e,m(e).then(()=>{f.current=null}).catch(t=>{S(t,{component:"AuthProviderWrapper",action:"handleAuthRedirectEffect",metadata:{code:e.substring(0,10)+"..."}}),f.current=null}).finally(()=>{u.current=!1}))},[m,s.serverUrl,s.version,s.orgId]),t(r,{children:e})});we.displayName="AuthProviderWrapper";const xe=a.memo(({config:e,auth:n,children:o})=>{const i=ye(),s=be(e=>e.os),c=a.useMemo(()=>({clientId:n?.clientId||"",redirectUrl:n?.redirectUrl||"",callbacks:n?.callbacks}),[n?.clientId,n?.redirectUrl,n?.callbacks]);return d(()=>{i.os(H({...e,auth:c}))},[e,c,i]),d(()=>{const{serverUrl:e,version:t,orgId:r,settings:n}=s;if(e&&t&&r&&!n){(async()=>{try{const n=F(),a=await fetch(`${e}/api/${t}/public/${r}/settings`,{headers:n});if(a.ok){const e=await a.json();i.os(Z(e))}}catch(n){S(n,{component:"ContextConfigProvider",action:"fetchSettings",metadata:{serverUrl:e,version:t,orgId:r}})}})()}},[s.serverUrl,s.version,s.orgId,s.settings,i]),t(r,{children:o})});xe.displayName="ContextConfigProvider";const Se=new class{constructor(){this.callbacks=null}setCallbacks(e){this.callbacks=e}getCallbacks(){return this.callbacks}async emit(e,t){if(this.callbacks?.handleEvent)try{await this.callbacks.handleEvent(e,t)}catch(t){S(t,{component:"EventEmitter",action:"emit",metadata:{eventType:e}})}}async emitUserCreated(e){await this.emit("user:created",{user:e})}async emitUserUpdated(e,t){await this.emit("user:updated",{user:e,previousUser:t})}async emitWorkspaceChanged(e,t){await this.emit("workspace:changed",{workspace:e,previousWorkspace:t})}async emitWorkspaceUpdated(e){await this.emit("workspace:updated",{workspace:e})}async emitWorkspaceUserAdded(e,t,r){await this.emit("workspace:user-added",{userId:e,workspace:t,role:r})}async emitWorkspaceUserRemoved(e,t,r){await this.emit("workspace:user-removed",{userId:e,workspace:t,role:r})}async emitWorkspaceUserRoleChanged(e,t,r,n){await this.emit("workspace:user-role-changed",{userId:e,workspace:t,previousRole:r,newRole:n})}async emitWorkspaceCreated(e){await this.emit("workspace:created",{workspace:e})}async emitWorkspaceDeleted(e){await this.emit("workspace:deleted",{workspace:e})}},ke=i({container:null,setContainer:()=>{}}),Ae=a.memo(({children:r})=>{const[n,o]=a.useState(null),i=a.useMemo(()=>({container:n,setContainer:o}),[n]),s=a.useMemo(()=>r,[r]);return e(ke.Provider,{value:i,children:[s,t("div",{ref:o,id:"saas-os-portal",className:"saas-os-ui",style:{width:"100%",height:"100%"}})]})});Ae.displayName="PortalProvider";const Ee=a.createContext(void 0),Ce=a.memo(({children:e})=>{const r=be(e=>e.os),n=be(e=>e.auth),{serverUrl:o,version:i}=r,s=n.isAuthenticated,[c,f]=u({}),[p,m]=u({}),[h,g]=u(!1),[v,b]=u(null),y=l(async()=>{if(o&&i&&s)try{const e=await fetch(`${o}/api/${i}/public/users/attributes`,{headers:F()});if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.message||"Failed to fetch user attributes")}const t=await e.json();t&&"object"==typeof t&&!Array.isArray(t)?f(t):f({})}catch(e){const t=e instanceof Error?e:new Error("Failed to fetch user attributes");b(t),S(e,{component:"UserProvider",action:"fetchAttributes"})}else f({})},[o,i,s]),w=l(async()=>{if(o&&i&&s){g(!0),b(null);try{await y()}finally{g(!1)}}},[o,i,s,y]),x=l(async e=>{if(!o||!i)throw new Error("Server URL or version is missing");g(!0),b(null);try{const t=await fetch(`${o}/api/${i}/public/users/attributes`,{method:"PATCH",headers:{"Content-Type":"application/json",...F()},body:JSON.stringify({attributes:e})});if(!t.ok){const e=await t.json().catch(()=>({}));throw new Error(e.message||"Failed to update user attributes")}const r=await t.json();return await y(),r}catch(t){const r=t instanceof Error?t:new Error("Failed to update user attributes");throw b(r),S(t,{component:"UserProvider",action:"updateAttributes",metadata:{updates:e}}),r}finally{g(!1)}},[o,i,y]),k=l(async(e,t)=>{if(!o||!i)throw new Error("Server URL or version is missing");g(!0),b(null);try{const r=await fetch(`${o}/api/${i}/public/users/attributes/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...F()},body:JSON.stringify({value:t})});if(!r.ok){const e=await r.json().catch(()=>({}));throw new Error(e.message||"Failed to update user attribute")}const n=await r.json();return await y(),n}catch(r){const n=r instanceof Error?r:new Error("Failed to update user attribute");throw b(n),S(r,{component:"UserProvider",action:"updateAttribute",metadata:{attributeKey:e,value:t}}),n}finally{g(!1)}},[o,i,y]),A=l(async()=>{if(o&&i&&s)try{const e=await fetch(`${o}/api/${i}/public/users/features`,{headers:F()});if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.message||"Failed to fetch user features")}const t=await e.json();m("object"==typeof t?t:{})}catch(e){const t=e instanceof Error?e:new Error("Failed to fetch user features");b(t),S(e,{component:"UserProvider",action:"fetchFeatures"})}else m({})},[o,i,s]),E=l(async()=>{if(o&&i&&s){g(!0),b(null);try{await A()}finally{g(!1)}}},[o,i,s,A]);d(()=>{s&&o&&i?(g(!0),b(null),Promise.all([y(),A()]).finally(()=>{g(!1)})):(f({}),m({}))},[s,o,i,y,A]);const C=a.useMemo(()=>({attributes:c,features:p,isLoading:h,error:v,updateAttributes:x,updateAttribute:k,refreshAttributes:w,refreshFeatures:E}),[c,p,h,v,x,k,w,E]);return t(Ee.Provider,{value:C,children:e})});Ce.displayName="UserProvider";class Te{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}getAuthHeader(){return F()}async getWorkspaces(){const e=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces`,{headers:this.getAuthHeader()});if(!e.ok)throw new Error("Failed to fetch workspaces");return e.json()}async createWorkspace(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to create workspace");return t.json()}async updateWorkspace(e,t){const r=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)});if(!r.ok)throw new Error("Failed to update workspace");return r.json()}async deleteWorkspace(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"DELETE",headers:this.getAuthHeader()});if(!t.ok)throw new Error("Failed to delete workspace");return t.json()}async getWorkspaceUsers(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users`,{headers:this.getAuthHeader()});if(!t.ok)throw new Error("Failed to fetch workspace users");return t.json()}async addUser(e,t){const r=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/add`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)});if(!r.ok){const e=await r.json();throw new Error(e.message||"Failed to invite member")}return r.json()}async removeUser(e,t){const r=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/${t}`,{method:"DELETE",headers:this.getAuthHeader()});if(!r.ok){const e=await r.json();throw new Error(e.message||"Failed to remove user")}return r.json()}async updateUser(e,t,r){const n=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(r)});if(!n.ok){const e=await n.json();throw new Error(e.message||"Failed to update user")}return n.json()}async getFeatures(){const e=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/features`,{headers:this.getAuthHeader()});if(!e.ok)throw new Error("Failed to fetch features");return e.json()}async updateFeature(e,t,r){const n=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/features`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify({features:{[t]:r}})});if(!n.ok)throw new Error("Failed to update feature");return n.json()}async getWorkspace(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{headers:this.getAuthHeader()});if(!t.ok)throw new Error("Failed to fetch workspace");return t.json()}async getProfile(){const e=await fetch(`${this.serverUrl}/api/${this.version}/public/profile`,{headers:this.getAuthHeader()});if(!e.ok)throw new Error("Failed to fetch profile");return e.json()}async updateUserProfile(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/profile`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to update user profile");return t.json()}}var Ne=e=>"checkbox"===e.type,_e=e=>e instanceof Date,Re=e=>null==e;const Pe=e=>"object"==typeof e;var Oe=e=>!Re(e)&&!Array.isArray(e)&&Pe(e)&&!_e(e),De=e=>Oe(e)&&e.target?Ne(e.target)?e.target.checked:e.target.value:e,Ie=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),Ue="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Me(e){let t;const r=Array.isArray(e),n="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else{if(Ue&&(e instanceof Blob||n)||!r&&!Oe(e))return e;if(t=r?[]:Object.create(Object.getPrototypeOf(e)),r||(e=>{const t=e.constructor&&e.constructor.prototype;return Oe(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=Me(e[r]));else t=e}return t}var Le=e=>/^\w*$/.test(e),Fe=e=>void 0===e,ze=e=>Array.isArray(e)?e.filter(Boolean):[],je=e=>ze(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Be=(e,t,r)=>{if(!t||!Oe(e))return r;const n=(Le(t)?[t]:je(t)).reduce((e,t)=>Re(e)?e:e[t],e);return Fe(n)||n===e?Fe(e[t])?r:e[t]:n},We=e=>"boolean"==typeof e,Ve=(e,t,r)=>{let n=-1;const a=Le(t)?[t]:je(t),o=a.length,i=o-1;for(;++n<o;){const t=a[n];let o=r;if(n!==i){const r=e[t];o=Oe(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=o,e=e[t]}};const $e="blur",Ge="focusout",Ke="change",He="onBlur",Ze="onChange",qe="onSubmit",Je="onTouched",Ye="all",Xe="max",Qe="min",et="maxLength",tt="minLength",rt="pattern",nt="required",at="validate",ot=a.createContext(null);ot.displayName="HookFormContext";const it=()=>a.useContext(ot),st=e=>{const{children:t,...r}=e;return a.createElement(ot.Provider,{value:r},t)};var ct=(e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(a,o,{get:()=>{const a=o;return t._proxyFormState[a]!==Ye&&(t._proxyFormState[a]=!n||Ye),r&&(r[a]=!0),e[a]}});return a};const lt="undefined"!=typeof window?a.useLayoutEffect:a.useEffect;var dt=e=>"string"==typeof e,ut=(e,t,r,n,a)=>dt(e)?(n&&t.watch.add(e),Be(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),Be(r,e))):(n&&(t.watchAll=!0),r),ft=e=>Re(e)||!Pe(e);function pt(e,t,r=new WeakSet){if(ft(e)||ft(t))return e===t;if(_e(e)&&_e(t))return e.getTime()===t.getTime();const n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const o of n){const n=e[o];if(!a.includes(o))return!1;if("ref"!==o){const e=t[o];if(_e(n)&&_e(e)||Oe(n)&&Oe(e)||Array.isArray(n)&&Array.isArray(e)?!pt(n,e,r):n!==e)return!1}}return!0}function mt(e){const t=it(),{name:r,disabled:n,control:o=t.control,shouldUnregister:i,defaultValue:s}=e,c=Ie(o._names.array,r),l=a.useMemo(()=>Be(o._formValues,r,Be(o._defaultValues,r,s)),[o,r,s]),d=function(e){const t=it(),{control:r=t.control,name:n,defaultValue:o,disabled:i,exact:s,compute:c}=e||{},l=a.useRef(o),d=a.useRef(c),u=a.useRef(void 0);d.current=c;const f=a.useMemo(()=>r._getWatch(n,l.current),[r,n]),[p,m]=a.useState(d.current?d.current(f):f);return lt(()=>r._subscribe({name:n,formState:{values:!0},exact:s,callback:e=>{if(!i){const t=ut(n,r._names,e.values||r._formValues,!1,l.current);if(d.current){const e=d.current(t);pt(e,u.current)||(m(e),u.current=e)}else m(t)}}}),[r,i,n,s]),a.useEffect(()=>r._removeUnmounted()),p}({control:o,name:r,defaultValue:l,exact:!0}),u=function(e){const t=it(),{control:r=t.control,disabled:n,name:o,exact:i}=e||{},[s,c]=a.useState(r._formState),l=a.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return lt(()=>r._subscribe({name:o,formState:l.current,exact:i,callback:e=>{!n&&c({...r._formState,...e})}}),[o,n,i]),a.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),a.useMemo(()=>ct(s,r,l.current,!1),[s,r])}({control:o,name:r,exact:!0}),f=a.useRef(e),p=a.useRef(o.register(r,{...e.rules,value:d,...We(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const m=a.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Be(u.errors,r)},isDirty:{enumerable:!0,get:()=>!!Be(u.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Be(u.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Be(u.validatingFields,r)},error:{enumerable:!0,get:()=>Be(u.errors,r)}}),[u,r]),h=a.useCallback(e=>p.current.onChange({target:{value:De(e),name:r},type:Ke}),[r]),g=a.useCallback(()=>p.current.onBlur({target:{value:Be(o._formValues,r),name:r},type:$e}),[r,o._formValues]),v=a.useCallback(e=>{const t=Be(o._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus&&e.focus(),select:()=>e.select&&e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})},[o._fields,r]),b=a.useMemo(()=>({name:r,value:d,...We(n)||u.disabled?{disabled:u.disabled||n}:{},onChange:h,onBlur:g,ref:v}),[r,n,u.disabled,h,g,v,d]);return a.useEffect(()=>{const e=o._options.shouldUnregister||i;o.register(r,{...f.current.rules,...We(f.current.disabled)?{disabled:f.current.disabled}:{}});const t=(e,t)=>{const r=Be(o._fields,e);r&&r._f&&(r._f.mount=t)};if(t(r,!0),e){const e=Me(Be(o._options.defaultValues,r));Ve(o._defaultValues,r,e),Fe(Be(o._formValues,r))&&Ve(o._formValues,r,e)}return!c&&o.register(r),()=>{(c?e&&!o._state.action:e)?o.unregister(r):t(r,!1)}},[r,o,c,i]),a.useEffect(()=>{o._setDisabledField({disabled:n,name:r})},[n,r,o]),a.useMemo(()=>({field:b,formState:u,fieldState:m}),[b,u,m])}const ht=e=>e.render(mt(e));var gt=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},vt=e=>Array.isArray(e)?e:[e],bt=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},yt=e=>Oe(e)&&!Object.keys(e).length,wt=e=>"file"===e.type,xt=e=>"function"==typeof e,St=e=>{if(!Ue)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},kt=e=>"select-multiple"===e.type,At=e=>"radio"===e.type,Et=e=>St(e)&&e.isConnected;function Ct(e,t){const r=Array.isArray(t)?t:Le(t)?[t]:je(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Fe(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,o=r[a];return n&&delete n[o],0!==a&&(Oe(n)&&yt(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Fe(e[t]))return!1;return!0}(n))&&Ct(e,r.slice(0,-1)),e}var Tt=e=>{for(const t in e)if(xt(e[t]))return!0;return!1};function Nt(e,t={}){const r=Array.isArray(e);if(Oe(e)||r)for(const r in e)Array.isArray(e[r])||Oe(e[r])&&!Tt(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Nt(e[r],t[r])):Re(e[r])||(t[r]=!0);return t}function _t(e,t,r){const n=Array.isArray(e);if(Oe(e)||n)for(const n in e)Array.isArray(e[n])||Oe(e[n])&&!Tt(e[n])?Fe(t)||ft(r[n])?r[n]=Array.isArray(e[n])?Nt(e[n],[]):{...Nt(e[n])}:_t(e[n],Re(t)?{}:t[n],r[n]):r[n]=!pt(e[n],t[n]);return r}var Rt=(e,t)=>_t(e,t,Nt(t));const Pt={value:!1,isValid:!1},Ot={value:!0,isValid:!0};var Dt=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Fe(e[0].attributes.value)?Fe(e[0].value)||""===e[0].value?Ot:{value:e[0].value,isValid:!0}:Ot:Pt}return Pt},It=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Fe(e)?e:t?""===e?NaN:e?+e:e:r&&dt(e)?new Date(e):n?n(e):e;const Ut={isValid:!1,value:null};var Mt=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Ut):Ut;function Lt(e){const t=e.ref;return wt(t)?t.files:At(t)?Mt(e.refs).value:kt(t)?[...t.selectedOptions].map(({value:e})=>e):Ne(t)?Dt(e.refs).value:It(Fe(t.value)?e.ref.value:t.value,e)}var Ft=e=>e instanceof RegExp,zt=e=>Fe(e)?e:Ft(e)?e.source:Oe(e)?Ft(e.value)?e.value.source:e.value:e,jt=e=>({isOnSubmit:!e||e===qe,isOnBlur:e===He,isOnChange:e===Ze,isOnAll:e===Ye,isOnTouch:e===Je});const Bt="AsyncFunction";var Wt=e=>!!e&&!!e.validate&&!!(xt(e.validate)&&e.validate.constructor.name===Bt||Oe(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===Bt)),Vt=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const $t=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=Be(e,a);if(r){const{_f:e,...o}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!n)return!0;if(e.ref&&t(e.ref,e.name)&&!n)return!0;if($t(o,t))break}else if(Oe(o)&&$t(o,t))break}}};function Gt(e,t,r){const n=Be(e,r);if(n||Le(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),o=Be(t,n),i=Be(e,n);if(o&&!Array.isArray(o)&&r!==n)return{name:r};if(i&&i.type)return{name:n,error:i};if(i&&i.root&&i.root.type)return{name:`${n}.root`,error:i.root};a.pop()}return{name:r}}var Kt=(e,t,r)=>{const n=vt(Be(e,r));return Ve(n,"root",t[r]),Ve(e,r,n),e},Ht=e=>dt(e);function Zt(e,t,r="validate"){if(Ht(e)||Array.isArray(e)&&e.every(Ht)||We(e)&&!e)return{type:r,message:Ht(e)?e:"",ref:t}}var qt=e=>Oe(e)&&!Ft(e)?e:{value:e,message:""},Jt=async(e,t,r,n,a,o)=>{const{ref:i,refs:s,required:c,maxLength:l,minLength:d,min:u,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:v}=e._f,b=Be(r,h);if(!v||t.has(h))return{};const y=s?s[0]:i,w=e=>{a&&y.reportValidity&&(y.setCustomValidity(We(e)?"":e||""),y.reportValidity())},x={},S=At(i),k=Ne(i),A=S||k,E=(g||wt(i))&&Fe(i.value)&&Fe(b)||St(i)&&""===i.value||""===b||Array.isArray(b)&&!b.length,C=gt.bind(null,h,n,x),T=(e,t,r,n=et,a=tt)=>{const o=e?t:r;x[h]={type:e?n:a,message:o,ref:i,...C(e?n:a,o)}};if(o?!Array.isArray(b)||!b.length:c&&(!A&&(E||Re(b))||We(b)&&!b||k&&!Dt(s).isValid||S&&!Mt(s).isValid)){const{value:e,message:t}=Ht(c)?{value:!!c,message:c}:qt(c);if(e&&(x[h]={type:nt,message:t,ref:y,...C(nt,t)},!n))return w(t),x}if(!(E||Re(u)&&Re(f))){let e,t;const r=qt(f),a=qt(u);if(Re(b)||isNaN(b)){const n=i.valueAsDate||new Date(b),o=e=>new Date((new Date).toDateString()+" "+e),s="time"==i.type,c="week"==i.type;dt(r.value)&&b&&(e=s?o(b)>o(r.value):c?b>r.value:n>new Date(r.value)),dt(a.value)&&b&&(t=s?o(b)<o(a.value):c?b<a.value:n<new Date(a.value))}else{const n=i.valueAsNumber||(b?+b:b);Re(r.value)||(e=n>r.value),Re(a.value)||(t=n<a.value)}if((e||t)&&(T(!!e,r.message,a.message,Xe,Qe),!n))return w(x[h].message),x}if((l||d)&&!E&&(dt(b)||o&&Array.isArray(b))){const e=qt(l),t=qt(d),r=!Re(e.value)&&b.length>+e.value,a=!Re(t.value)&&b.length<+t.value;if((r||a)&&(T(r,e.message,t.message),!n))return w(x[h].message),x}if(p&&!E&&dt(b)){const{value:e,message:t}=qt(p);if(Ft(e)&&!b.match(e)&&(x[h]={type:rt,message:t,ref:i,...C(rt,t)},!n))return w(t),x}if(m)if(xt(m)){const e=Zt(await m(b,r),y);if(e&&(x[h]={...e,...C(at,e.message)},!n))return w(e.message),x}else if(Oe(m)){let e={};for(const t in m){if(!yt(e)&&!n)break;const a=Zt(await m[t](b,r),y,t);a&&(e={...a,...C(t,a.message)},w(a.message),n&&(x[h]=e))}if(!yt(e)&&(x[h]={ref:y,...e},!n))return x}return w(!0),x};const Yt={mode:qe,reValidateMode:Ze,shouldFocusError:!0};function Xt(e={}){let t,r={...Yt,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:xt(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},o=(Oe(r.defaultValues)||Oe(r.values))&&Me(r.defaultValues||r.values)||{},i=r.shouldUnregister?{}:Me(o),s={action:!1,mount:!1,watch:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let u={...d};const f={array:bt(),state:bt()},p=r.criteriaMode===Ye,m=async e=>{if(!r.disabled&&(d.isValid||u.isValid||e)){const e=r.resolver?yt((await y()).errors):await w(a,!0);e!==n.isValid&&f.state.next({isValid:e})}},h=(e,t)=>{!r.disabled&&(d.isValidating||d.validatingFields||u.isValidating||u.validatingFields)&&((e||Array.from(c.mount)).forEach(e=>{e&&(t?Ve(n.validatingFields,e,t):Ct(n.validatingFields,e))}),f.state.next({validatingFields:n.validatingFields,isValidating:!yt(n.validatingFields)}))},g=(e,t,r,n)=>{const c=Be(a,e);if(c){const a=Be(i,e,Fe(r)?Be(o,e):r);Fe(a)||n&&n.defaultChecked||t?Ve(i,e,t?a:Lt(c._f)):k(e,a),s.mount&&m()}},v=(e,t,a,i,s)=>{let c=!1,l=!1;const p={name:e};if(!r.disabled){if(!a||i){(d.isDirty||u.isDirty)&&(l=n.isDirty,n.isDirty=p.isDirty=x(),c=l!==p.isDirty);const r=pt(Be(o,e),t);l=!!Be(n.dirtyFields,e),r?Ct(n.dirtyFields,e):Ve(n.dirtyFields,e,!0),p.dirtyFields=n.dirtyFields,c=c||(d.dirtyFields||u.dirtyFields)&&l!==!r}if(a){const t=Be(n.touchedFields,e);t||(Ve(n.touchedFields,e,a),p.touchedFields=n.touchedFields,c=c||(d.touchedFields||u.touchedFields)&&t!==a)}c&&s&&f.state.next(p)}return c?p:{}},b=(e,a,o,i)=>{const s=Be(n.errors,e),c=(d.isValid||u.isValid)&&We(a)&&n.isValid!==a;var p;if(r.delayError&&o?(p=()=>((e,t)=>{Ve(n.errors,e,t),f.state.next({errors:n.errors})})(e,o),t=e=>{clearTimeout(l),l=setTimeout(p,e)},t(r.delayError)):(clearTimeout(l),t=null,o?Ve(n.errors,e,o):Ct(n.errors,e)),(o?!pt(s,o):s)||!yt(i)||c){const t={...i,...c&&We(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},f.state.next(t)}},y=async e=>{h(e,!0);const t=await r.resolver(i,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=Be(t,r);e&&Ve(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||c.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return h(e),t},w=async(e,t,a={valid:!0})=>{for(const o in e){const s=e[o];if(s){const{_f:e,...l}=s;if(e){const l=c.array.has(e.name),u=s._f&&Wt(s._f);u&&d.validatingFields&&h([o],!0);const f=await Jt(s,c.disabled,i,p,r.shouldUseNativeValidation&&!t,l);if(u&&d.validatingFields&&h([o]),f[e.name]&&(a.valid=!1,t))break;!t&&(Be(f,e.name)?l?Kt(n.errors,f,e.name):Ve(n.errors,e.name,f[e.name]):Ct(n.errors,e.name))}!yt(l)&&await w(l,t,a)}}return a.valid},x=(e,t)=>!r.disabled&&(e&&t&&Ve(i,e,t),!pt(_(),o)),S=(e,t,r)=>ut(e,c,{...s.mount?i:Fe(t)?o:dt(e)?{[e]:t}:t},r,t),k=(e,t,r={})=>{const n=Be(a,e);let o=t;if(n){const r=n._f;r&&(!r.disabled&&Ve(i,e,It(t,r)),o=St(r.ref)&&Re(t)?"":t,kt(r.ref)?[...r.ref.options].forEach(e=>e.selected=o.includes(e.value)):r.refs?Ne(r.ref)?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(o)?e.checked=!!o.find(t=>t===e.value):e.checked=o===e.value||!!o)}):r.refs.forEach(e=>e.checked=e.value===o):wt(r.ref)?r.ref.value="":(r.ref.value=o,r.ref.type||f.state.next({name:e,values:Me(i)})))}(r.shouldDirty||r.shouldTouch)&&v(e,o,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&N(e)},A=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const o=t[n],i=e+"."+n,s=Be(a,i);(c.array.has(e)||Oe(o)||s&&!s._f)&&!_e(o)?A(i,o,r):k(i,o,r)}},E=(e,t,r={})=>{const l=Be(a,e),p=c.array.has(e),m=Me(t);Ve(i,e,m),p?(f.array.next({name:e,values:Me(i)}),(d.isDirty||d.dirtyFields||u.isDirty||u.dirtyFields)&&r.shouldDirty&&f.state.next({name:e,dirtyFields:Rt(o,i),isDirty:x(e,m)})):!l||l._f||Re(m)?k(e,m,r):A(e,m,r),Vt(e,c)&&f.state.next({...n,name:e}),f.state.next({name:s.mount?e:void 0,values:Me(i)})},C=async e=>{s.mount=!0;const o=e.target;let l=o.name,g=!0;const x=Be(a,l),S=e=>{g=Number.isNaN(e)||_e(e)&&isNaN(e.getTime())||pt(e,Be(i,l,e))},k=jt(r.mode),A=jt(r.reValidateMode);if(x){let s,E;const C=o.type?Lt(x._f):De(e),T=e.type===$e||e.type===Ge,_=!(e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(x._f)&&!r.resolver&&!Be(n.errors,l)&&!x._f.deps||((e,t,r,n,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:!(r?n.isOnChange:a.isOnChange)||e))(T,Be(n.touchedFields,l),n.isSubmitted,A,k),R=Vt(l,c,T);Ve(i,l,C),T?o&&o.readOnly||(x._f.onBlur&&x._f.onBlur(e),t&&t(0)):x._f.onChange&&x._f.onChange(e);const P=v(l,C,T),O=!yt(P)||R;if(!T&&f.state.next({name:l,type:e.type,values:Me(i)}),_)return(d.isValid||u.isValid)&&("onBlur"===r.mode?T&&m():T||m()),O&&f.state.next({name:l,...R?{}:P});if(!T&&R&&f.state.next({...n}),r.resolver){const{errors:e}=await y([l]);if(S(C),g){const t=Gt(n.errors,a,l),r=Gt(e,a,t.name||l);s=r.error,l=r.name,E=yt(e)}}else h([l],!0),s=(await Jt(x,c.disabled,i,p,r.shouldUseNativeValidation))[l],h([l]),S(C),g&&(s?E=!1:(d.isValid||u.isValid)&&(E=await w(a,!0)));g&&(x._f.deps&&N(x._f.deps),b(l,E,s,P))}},T=(e,t)=>{if(Be(n.errors,t)&&e.focus)return e.focus(),1},N=async(e,t={})=>{let o,i;const s=vt(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await y(e);if(e)for(const r of e){const e=Be(t,r);e?Ve(n.errors,r,e):Ct(n.errors,r)}else n.errors=t;return t})(Fe(e)?e:s);o=yt(t),i=e?!s.some(e=>Be(t,e)):o}else e?(i=(await Promise.all(s.map(async e=>{const t=Be(a,e);return await w(t&&t._f?{[e]:t}:t)}))).every(Boolean),(i||n.isValid)&&m()):i=o=await w(a);return f.state.next({...!dt(e)||(d.isValid||u.isValid)&&o!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:o}:{},errors:n.errors}),t.shouldFocus&&!i&&$t(a,T,e?s:c.mount),i},_=e=>{const t={...s.mount?i:o};return Fe(e)?t:dt(e)?Be(t,e):e.map(e=>Be(t,e))},R=(e,t)=>({invalid:!!Be((t||n).errors,e),isDirty:!!Be((t||n).dirtyFields,e),error:Be((t||n).errors,e),isValidating:!!Be(n.validatingFields,e),isTouched:!!Be((t||n).touchedFields,e)}),P=(e,t,r)=>{const o=(Be(a,e,{_f:{}})._f||{}).ref,i=Be(n.errors,e)||{},{ref:s,message:c,type:l,...d}=i;Ve(n.errors,e,{...d,...t,ref:o}),f.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&o&&o.focus&&o.focus()},O=e=>f.state.subscribe({next:t=>{var r,a,s;r=e.name,a=t.name,s=e.exact,r&&a&&r!==a&&!vt(r).some(e=>e&&(s?e===a:e.startsWith(a)||a.startsWith(e)))||!((e,t,r,n)=>{r(e);const{name:a,...o}=e;return yt(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>t[e]===(!n||Ye))})(t,e.formState||d,j,e.reRenderRoot)||e.callback({values:{...i},...n,...t,defaultValues:o})}}).unsubscribe,D=(e,t={})=>{for(const s of e?vt(e):c.mount)c.mount.delete(s),c.array.delete(s),t.keepValue||(Ct(a,s),Ct(i,s)),!t.keepError&&Ct(n.errors,s),!t.keepDirty&&Ct(n.dirtyFields,s),!t.keepTouched&&Ct(n.touchedFields,s),!t.keepIsValidating&&Ct(n.validatingFields,s),!r.shouldUnregister&&!t.keepDefaultValue&&Ct(o,s);f.state.next({values:Me(i)}),f.state.next({...n,...t.keepDirty?{isDirty:x()}:{}}),!t.keepIsValid&&m()},I=({disabled:e,name:t})=>{(We(e)&&s.mount||e||c.disabled.has(t))&&(e?c.disabled.add(t):c.disabled.delete(t))},U=(e,t={})=>{let n=Be(a,e);const i=We(t.disabled)||We(r.disabled);return Ve(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),c.mount.add(e),n?I({disabled:We(t.disabled)?t.disabled:r.disabled,name:e}):g(e,!0,t.value),{...i?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:zt(t.min),max:zt(t.max),minLength:zt(t.minLength),maxLength:zt(t.maxLength),pattern:zt(t.pattern)}:{},name:e,onChange:C,onBlur:C,ref:i=>{if(i){U(e,t),n=Be(a,e);const r=Fe(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,s=(e=>At(e)||Ne(e))(r),c=n._f.refs||[];if(s?c.find(e=>e===r):r===n._f.ref)return;Ve(a,e,{_f:{...n._f,...s?{refs:[...c.filter(Et),r,...Array.isArray(Be(o,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),g(e,!1,void 0,r)}else n=Be(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!Ie(c.array,e)||!s.action)&&c.unMount.add(e)}}},M=()=>r.shouldFocusError&&$t(a,T,c.mount),L=(e,t)=>async o=>{let s;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=Me(i);if(f.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await y();n.errors=e,l=Me(t)}else await w(a);if(c.disabled.size)for(const e of c.disabled)Ct(l,e);if(Ct(n.errors,"root"),yt(n.errors)){f.state.next({errors:{}});try{await e(l,o)}catch(e){s=e}}else t&&await t({...n.errors},o),M(),setTimeout(M);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:yt(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},F=(e,t={})=>{const l=e?Me(e):o,u=Me(l),p=yt(e),m=p?o:u;if(t.keepDefaultValues||(o=l),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...c.mount,...Object.keys(Rt(o,i))]);for(const t of Array.from(e))Be(n.dirtyFields,t)?Ve(m,t,Be(i,t)):E(t,Be(m,t))}else{if(Ue&&Fe(e))for(const e of c.mount){const t=Be(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(St(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of c.mount)E(e,Be(m,e));else a={}}i=r.shouldUnregister?t.keepDefaultValues?Me(o):{}:Me(m),f.array.next({values:{...m}}),f.state.next({values:{...m}})}c={mount:t.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!t.keepIsValid||!!t.keepDirtyValues,s.watch=!!r.shouldUnregister,f.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!p&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||pt(e,o))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:p?{}:t.keepDirtyValues?t.keepDefaultValues&&i?Rt(o,i):n.dirtyFields:t.keepDefaultValues&&e?Rt(o,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:o})},z=(e,t)=>F(xt(e)?e(i):e,t),j=e=>{n={...n,...e}},B={control:{register:U,unregister:D,getFieldState:R,handleSubmit:L,setError:P,_subscribe:O,_runSchema:y,_focusError:M,_getWatch:S,_getDirty:x,_setValid:m,_setFieldArray:(e,t=[],c,l,p=!0,m=!0)=>{if(l&&c&&!r.disabled){if(s.action=!0,m&&Array.isArray(Be(a,e))){const t=c(Be(a,e),l.argA,l.argB);p&&Ve(a,e,t)}if(m&&Array.isArray(Be(n.errors,e))){const t=c(Be(n.errors,e),l.argA,l.argB);p&&Ve(n.errors,e,t),((e,t)=>{!ze(Be(e,t)).length&&Ct(e,t)})(n.errors,e)}if((d.touchedFields||u.touchedFields)&&m&&Array.isArray(Be(n.touchedFields,e))){const t=c(Be(n.touchedFields,e),l.argA,l.argB);p&&Ve(n.touchedFields,e,t)}(d.dirtyFields||u.dirtyFields)&&(n.dirtyFields=Rt(o,i)),f.state.next({name:e,isDirty:x(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Ve(i,e,t)},_setDisabledField:I,_setErrors:e=>{n.errors=e,f.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>ze(Be(s.mount?i:o,e,r.shouldUnregister?Be(o,e,[]):[])),_reset:F,_resetDefaultValues:()=>xt(r.defaultValues)&&r.defaultValues().then(e=>{z(e,r.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of c.unMount){const t=Be(a,e);t&&(t._f.refs?t._f.refs.every(e=>!Et(e)):!Et(t._f.ref))&&D(e)}c.unMount=new Set},_disableForm:e=>{We(e)&&(f.state.next({disabled:e}),$t(a,(t,r)=>{const n=Be(a,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach(t=>{t.disabled=n._f.disabled||e}))},0,!1))},_subjects:f,_proxyFormState:d,get _fields(){return a},get _formValues(){return i},get _state(){return s},set _state(e){s=e},get _defaultValues(){return o},get _names(){return c},set _names(e){c=e},get _formState(){return n},get _options(){return r},set _options(e){r={...r,...e}}},subscribe:e=>(s.mount=!0,u={...u,...e.formState},O({...e,formState:u})),trigger:N,register:U,handleSubmit:L,watch:(e,t)=>xt(e)?f.state.subscribe({next:r=>"values"in r&&e(S(void 0,t),r)}):S(e,t,!0),setValue:E,getValues:_,reset:z,resetField:(e,t={})=>{Be(a,e)&&(Fe(t.defaultValue)?E(e,Me(Be(o,e))):(E(e,t.defaultValue),Ve(o,e,Me(t.defaultValue))),t.keepTouched||Ct(n.touchedFields,e),t.keepDirty||(Ct(n.dirtyFields,e),n.isDirty=t.defaultValue?x(e,Me(Be(o,e))):x()),t.keepError||(Ct(n.errors,e),d.isValid&&m()),f.state.next({...n}))},clearErrors:e=>{e&&vt(e).forEach(e=>Ct(n.errors,e)),f.state.next({errors:e?n.errors:{}})},unregister:D,setError:P,setFocus:(e,t={})=>{const r=Be(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&(e.focus(),t.shouldSelect&&xt(e.select)&&e.select())}},getFieldState:R};return{...B,formControl:B}}function Qt(e={}){const t=a.useRef(void 0),r=a.useRef(void 0),[n,o]=a.useState({isDirty:!1,isValidating:!1,isLoading:xt(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:xt(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!xt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:r,...a}=Xt(e);t.current={...a,formState:n}}const i=t.current.control;return i._options=e,lt(()=>{const e=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(e=>({...e,isReady:!0})),i._formState.isReady=!0,e},[i]),a.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),a.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),a.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),a.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),a.useEffect(()=>{if(i._proxyFormState.isDirty){const e=i._getDirty();e!==n.isDirty&&i._subjects.state.next({isDirty:e})}},[i,n.isDirty]),a.useEffect(()=>{e.values&&!pt(e.values,r.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),r.current=e.values,o(e=>({...e}))):i._resetDefaultValues()},[i,e.values]),a.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=ct(n,i),t.current}const er=(e,t,r)=>{if(e&&"reportValidity"in e){const n=Be(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},tr=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?er(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>er(t,r,e))}},rr=(e,t)=>{t.shouldUseNativeValidation&&tr(e,t);const r={};for(const n in e){const a=Be(t.fields,n),o=Object.assign(e[n]||{},{ref:a&&a.ref});if(nr(t.names||Object.keys(e),n)){const e=Object.assign({},Be(r,n));Ve(e,"root",o),Ve(r,n,e)}else Ve(r,n,o)}return r},nr=(e,t)=>{const r=ar(t);return e.some(e=>ar(e).match(`^${r}\\.\\d+`))};function ar(e){return e.replace(/\]|\[/g,"")}function or(e,t,r){function n(r,n){var a;Object.defineProperty(r,"_zod",{value:r._zod??{},enumerable:!1}),(a=r._zod).traits??(a.traits=new Set),r._zod.traits.add(e),t(r,n);for(const e in i.prototype)e in r||Object.defineProperty(r,e,{value:i.prototype[e].bind(r)});r._zod.constr=i,r._zod.def=n}const a=r?.Parent??Object;class o extends a{}function i(e){var t;const a=r?.Parent?new o:this;n(a,e),(t=a._zod).deferred??(t.deferred=[]);for(const e of a._zod.deferred)e();return a}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class ir extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class sr extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const cr={};function lr(e){return cr}function dr(e,t){return"bigint"==typeof t?t.toString():t}function ur(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function fr(e){return null==e}function pr(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const mr=Symbol("evaluating");function hr(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==mr)return void 0===n&&(n=mr,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function gr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function vr(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function br(e){return JSON.stringify(e)}const yr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function wr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const xr=ur(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Sr(e){if(!1===wr(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!1!==wr(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function kr(e){return Sr(e)?{...e}:Array.isArray(e)?[...e]:e}const Ar=new Set(["string","number","symbol"]);function Er(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Cr(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function Tr(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function Nr(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!0!==e.issues[r]?.continue)return!0;return!1}function _r(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function Rr(e){return"string"==typeof e?e:e?.message}function Pr(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const a=Rr(e.inst?._zod.def?.error?.(e))??Rr(t?.error?.(e))??Rr(r.customError?.(e))??Rr(r.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Or(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Dr(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const Ir=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,dr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ur=or("$ZodError",Ir),Mr=or("$ZodError",Ir,{Parent:Error});const Lr=e=>(t,r,n,a)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new ir;if(i.issues.length){const t=new(a?.Err??e)(i.issues.map(e=>Pr(e,o,lr())));throw yr(t,a?.callee),t}return i.value},Fr=Lr(Mr),zr=e=>async(t,r,n,a)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const t=new(a?.Err??e)(i.issues.map(e=>Pr(e,o,lr())));throw yr(t,a?.callee),t}return i.value},jr=zr(Mr),Br=e=>(t,r,n)=>{const a=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new ir;return o.issues.length?{success:!1,error:new(e??Ur)(o.issues.map(e=>Pr(e,a,lr())))}:{success:!0,data:o.value}},Wr=Br(Mr),Vr=e=>async(t,r,n)=>{const a=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},a);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>Pr(e,a,lr())))}:{success:!0,data:o.value}},$r=Vr(Mr),Gr=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Lr(e)(t,r,a)},Kr=e=>(t,r,n)=>Lr(e)(t,r,n),Hr=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return zr(e)(t,r,a)},Zr=e=>async(t,r,n)=>zr(e)(t,r,n),qr=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Br(e)(t,r,a)},Jr=e=>(t,r,n)=>Br(e)(t,r,n),Yr=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Vr(e)(t,r,a)},Xr=e=>async(t,r,n)=>Vr(e)(t,r,n),Qr=/^[cC][^\s-]{8,}$/,en=/^[0-9a-z]+$/,tn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,rn=/^[0-9a-vA-V]{20}$/,nn=/^[A-Za-z0-9]{27}$/,an=/^[a-zA-Z0-9_-]{21}$/,on=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,sn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,cn=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ln=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const dn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,un=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,fn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,pn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,hn=/^[A-Za-z0-9_-]*$/,gn=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,vn=/^\+(?:[0-9]){6,14}[0-9]$/,bn="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",yn=new RegExp(`^${bn}$`);function wn(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const xn=/^[^A-Z]*$/,Sn=/^[^a-z]*$/,kn=or("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),An=or("$ZodCheckMaxLength",(e,t)=>{var r;kn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!fr(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const a=Or(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),En=or("$ZodCheckMinLength",(e,t)=>{var r;kn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!fr(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const a=Or(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Cn=or("$ZodCheckLengthEquals",(e,t)=>{var r;kn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!fr(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,a=n.length;if(a===t.length)return;const o=Or(n),i=a>t.length;r.issues.push({origin:o,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Tn=or("$ZodCheckStringFormat",(e,t)=>{var r,n;kn.init(e,t),e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Nn=or("$ZodCheckRegex",(e,t)=>{Tn.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_n=or("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=xn),Tn.init(e,t)}),Rn=or("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Sn),Tn.init(e,t)}),Pn=or("$ZodCheckIncludes",(e,t)=>{kn.init(e,t);const r=Er(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),On=or("$ZodCheckStartsWith",(e,t)=>{kn.init(e,t);const r=new RegExp(`^${Er(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Dn=or("$ZodCheckEndsWith",(e,t)=>{kn.init(e,t);const r=new RegExp(`.*${Er(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),In=or("$ZodCheckOverwrite",(e,t)=>{kn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Un{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(const e of n)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const Mn={major:4,minor:1,patch:8},Ln=or("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Mn;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const t of n)for(const r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,r)=>{let n,a=Nr(e);for(const o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(a)continue;const t=e.issues.length,i=o._zod.check(e);if(i instanceof Promise&&!1===r?.async)throw new ir;if(n||i instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await i;e.issues.length!==t&&(a||(a=Nr(e,t)))});else{if(e.issues.length===t)continue;a||(a=Nr(e,t))}}return n?n.then(()=>e):e},r=(r,a,o)=>{if(Nr(r))return r.aborted=!0,r;const i=t(a,n,o);if(i instanceof Promise){if(!1===o.async)throw new ir;return i.then(t=>e._zod.parse(t,o))}return e._zod.parse(i,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if("backward"===o.direction){const t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,o)):r(t,a,o)}const i=e._zod.parse(a,o);if(i instanceof Promise){if(!1===o.async)throw new ir;return i.then(e=>t(e,n,o))}return t(i,n,o)}}e["~standard"]={validate:t=>{try{const r=Wr(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return $r(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),Fn=or("$ZodString",(e,t)=>{var r;Ln.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(r=e._zod.bag,new RegExp(`^${r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),zn=or("$ZodStringFormat",(e,t)=>{Tn.init(e,t),Fn.init(e,t)}),jn=or("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=sn),zn.init(e,t)}),Bn=or("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=cn(e))}else t.pattern??(t.pattern=cn());zn.init(e,t)}),Wn=or("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ln),zn.init(e,t)}),Vn=or("$ZodURL",(e,t)=>{zn.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),a=new URL(n);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:gn.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),void(t.normalize?r.value=a.href:r.value=n)}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),$n=or("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),zn.init(e,t)}),Gn=or("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=an),zn.init(e,t)}),Kn=or("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Qr),zn.init(e,t)}),Hn=or("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=en),zn.init(e,t)}),Zn=or("$ZodULID",(e,t)=>{t.pattern??(t.pattern=tn),zn.init(e,t)}),qn=or("$ZodXID",(e,t)=>{t.pattern??(t.pattern=rn),zn.init(e,t)}),Jn=or("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=nn),zn.init(e,t)}),Yn=or("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=wn({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${bn}T(?:${n})$`)}(t)),zn.init(e,t)}),Xn=or("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=yn),zn.init(e,t)}),Qn=or("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${wn(t)}$`)),zn.init(e,t)}),ea=or("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=on),zn.init(e,t)}),ta=or("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=dn),zn.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),ra=or("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=un),zn.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),na=or("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=fn),zn.init(e,t)}),aa=or("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=pn),zn.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(2!==n.length)throw new Error;const[e,t]=n;if(!t)throw new Error;const r=Number(t);if(`${r}`!==t)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function oa(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const ia=or("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=mn),zn.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{oa(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const sa=or("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=hn),zn.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{(function(e){if(!hn.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return oa(t.padEnd(4*Math.ceil(t.length/4),"="))})(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ca=or("$ZodE164",(e,t)=>{t.pattern??(t.pattern=vn),zn.init(e,t)});const la=or("$ZodJWT",(e,t)=>{zn.init(e,t),e._zod.check=r=>{(function(e,t=null){try{const r=e.split(".");if(3!==r.length)return!1;const[n]=r;if(!n)return!1;const a=JSON.parse(atob(n));return!("typ"in a&&"JWT"!==a?.typ||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}})(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),da=or("$ZodUnknown",(e,t)=>{Ln.init(e,t),e._zod.parse=e=>e}),ua=or("$ZodNever",(e,t)=>{Ln.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function fa(e,t,r){e.issues.length&&t.issues.push(..._r(r,e.issues)),t.value[r]=e.value}const pa=or("$ZodArray",(e,t)=>{Ln.init(e,t),e._zod.parse=(r,n)=>{const a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);const o=[];for(let e=0;e<a.length;e++){const i=a[e],s=t.element._zod.run({value:i,issues:[]},n);s instanceof Promise?o.push(s.then(t=>fa(t,r,e))):fa(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function ma(e,t,r,n){e.issues.length&&t.issues.push(..._r(r,e.issues)),void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function ha(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const r=(n=e.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function ga(e,t,r,n,a,o){const i=[],s=a.keySet,c=a.catchall._zod,l=c.def.type;for(const a of Object.keys(t)){if(s.has(a))continue;if("never"===l){i.push(a);continue}const o=c.run({value:t[a],issues:[]},n);o instanceof Promise?e.push(o.then(e=>ma(e,r,a,t))):ma(o,r,a,t)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}const va=or("$ZodObject",(e,t)=>{Ln.init(e,t);const r=ur(()=>ha(t));hr(e._zod,"propValues",()=>{const e=t.shape,r={};for(const t in e){const n=e[t]._zod;if(n.values){r[t]??(r[t]=new Set);for(const e of n.values)r[t].add(e)}}return r});const n=wr,a=t.catchall;let o;e._zod.parse=(t,i)=>{o??(o=r.value);const s=t.value;if(!n(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const c=[],l=o.shape;for(const e of o.keys){const r=l[e]._zod.run({value:s[e],issues:[]},i);r instanceof Promise?c.push(r.then(r=>ma(r,t,e,s))):ma(r,t,e,s)}return a?ga(c,s,t,i,r.value,e):c.length?Promise.all(c).then(()=>t):t}}),ba=or("$ZodObjectJIT",(e,t)=>{va.init(e,t);const r=e._zod.parse,n=ur(()=>ha(t));let a;const o=wr,i=!cr.jitless,s=i&&xr.value,c=t.catchall;let l;e._zod.parse=(d,u)=>{l??(l=n.value);const f=d.value;return o(f)?i&&s&&!1===u?.async&&!0!==u.jitless?(a||(a=(e=>{const t=new Un(["shape","payload","ctx"]),r=n.value,a=e=>{const t=br(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let i=0;for(const e of r.keys)o[e]="key_"+i++;t.write("const newResult = {};");for(const e of r.keys){const r=o[e],n=br(e);t.write(`const ${r} = ${a(e)};`),t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${n}, ...iss.path] : [${n}]\n })));\n }\n \n \n if (${r}.value === undefined) {\n if (${n} in input) {\n newResult[${n}] = undefined;\n }\n } else {\n newResult[${n}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),d=a(d,u),c?ga([],f,d,u,l,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function ya(e,t,r,n){for(const r of e)if(0===r.issues.length)return t.value=r.value,t;const a=e.filter(e=>!Nr(e));return 1===a.length?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>Pr(e,n,lr())))}),t)}const wa=or("$ZodUnion",(e,t)=>{Ln.init(e,t),hr(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),hr(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),hr(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),hr(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>pr(e.source)).join("|")})$`)}});const r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(a,o)=>{if(r)return n(a,o);let i=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},o);if(t instanceof Promise)s.push(t),i=!0;else{if(0===t.issues.length)return t;s.push(t)}}return i?Promise.all(s).then(t=>ya(t,a,e,o)):ya(s,a,e,o)}}),xa=or("$ZodIntersection",(e,t)=>{Ln.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,a=t.left._zod.run({value:n,issues:[]},r),o=t.right._zod.run({value:n,issues:[]},r);return a instanceof Promise||o instanceof Promise?Promise.all([a,o]).then(([t,r])=>ka(e,t,r)):ka(e,a,o)}});function Sa(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Sr(e)&&Sr(t)){const r=Object.keys(t),n=Object.keys(e).filter(e=>-1!==r.indexOf(e)),a={...e,...t};for(const r of n){const n=Sa(e[r],t[r]);if(!n.valid)return{valid:!1,mergeErrorPath:[r,...n.mergeErrorPath]};a[r]=n.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const a=Sa(e[n],t[n]);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ka(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Nr(e))return e;const n=Sa(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const Aa=or("$ZodEnum",(e,t)=>{Ln.init(e,t);const r=function(e){const t=Object.values(e).filter(e=>"number"==typeof e),r=Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t);return r}(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>Ar.has(typeof e)).map(e=>"string"==typeof e?Er(e):e.toString()).join("|")})$`),e._zod.parse=(t,a)=>{const o=t.value;return n.has(o)||t.issues.push({code:"invalid_value",values:r,input:o,inst:e}),t}}),Ea=or("$ZodTransform",(e,t)=>{Ln.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new sr(e.constructor.name);const a=t.transform(r.value,r);if(n.async){return(a instanceof Promise?a:Promise.resolve(a)).then(e=>(r.value=e,r))}if(a instanceof Promise)throw new ir;return r.value=a,r}});function Ca(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Ta=or("$ZodOptional",(e,t)=>{Ln.init(e,t),e._zod.optin="optional",e._zod.optout="optional",hr(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),hr(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${pr(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>Ca(t,e.value)):Ca(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),Na=or("$ZodNullable",(e,t)=>{Ln.init(e,t),hr(e._zod,"optin",()=>t.innerType._zod.optin),hr(e._zod,"optout",()=>t.innerType._zod.optout),hr(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${pr(e.source)}|null)$`):void 0}),hr(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),_a=or("$ZodDefault",(e,t)=>{Ln.init(e,t),e._zod.optin="optional",hr(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>Ra(e,t)):Ra(n,t)}});function Ra(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Pa=or("$ZodPrefault",(e,t)=>{Ln.init(e,t),e._zod.optin="optional",hr(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),Oa=or("$ZodNonOptional",(e,t)=>{Ln.init(e,t),hr(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{const a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(t=>Da(t,e)):Da(a,e)}});function Da(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Ia=or("$ZodCatch",(e,t)=>{Ln.init(e,t),hr(e._zod,"optin",()=>t.innerType._zod.optin),hr(e._zod,"optout",()=>t.innerType._zod.optout),hr(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Pr(e,r,lr()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Pr(e,r,lr()))},input:e.value}),e.issues=[]),e)}}),Ua=or("$ZodPipe",(e,t)=>{Ln.init(e,t),hr(e._zod,"values",()=>t.in._zod.values),hr(e._zod,"optin",()=>t.in._zod.optin),hr(e._zod,"optout",()=>t.out._zod.optout),hr(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){const n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>Ma(e,t.in,r)):Ma(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>Ma(e,t.out,r)):Ma(n,t.out,r)}});function Ma(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const La=or("$ZodReadonly",(e,t)=>{Ln.init(e,t),hr(e._zod,"propValues",()=>t.innerType._zod.propValues),hr(e._zod,"values",()=>t.innerType._zod.values),hr(e._zod,"optin",()=>t.innerType._zod.optin),hr(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(Fa):Fa(n)}});function Fa(e){return e.value=Object.freeze(e.value),e}const za=or("$ZodCustom",(e,t)=>{kn.init(e,t),Ln.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{const n=r.value,a=t.fn(n);if(a instanceof Promise)return a.then(t=>ja(t,r,n,e));ja(a,r,n,e)}});function ja(e,t,r,n){if(!e){const e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(Dr(e))}}class Ba{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];if(this._map.set(e,r),r&&"object"==typeof r&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Wa(){return new Ba}const Va=Wa();function $a(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Tr(t)})}function Ga(e,t){return new An({check:"max_length",...Tr(t),maximum:e})}function Ka(e,t){return new En({check:"min_length",...Tr(t),minimum:e})}function Ha(e,t){return new Cn({check:"length_equals",...Tr(t),length:e})}function Za(e){return new In({check:"overwrite",tx:e})}function qa(e){const t=function(e,t){const r=new kn({check:"custom",...Tr(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(Dr(e,r.value,t._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(Dr(n))}},e(r.value,r)));return t}function Ja(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function Ya(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var s=n.unionErrors[0].errors[0];r[i]={message:s.message,type:s.code}}else r[i]={message:o,type:a};if("unionErrors"in n&&n.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=gt(i,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function Xa(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("invalid_union"===n.code&&n.errors.length>0){var s=n.errors[0][0];r[i]={message:s.message,type:s.code}}else r[i]={message:o,type:a};if("invalid_union"===n.code&&n.errors.forEach(function(t){return t.forEach(function(t){return e.push(t)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=gt(i,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function Qa(e,t,r){if(void 0===r&&(r={}),function(e){return"_def"in e&&"object"==typeof e._def&&"typeName"in e._def}(e))return function(n,a,o){try{return Promise.resolve(Ja(function(){return Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then(function(e){return o.shouldUseNativeValidation&&tr({},o),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return Array.isArray(null==e?void 0:e.issues)}(e))return{values:{},errors:rr(Ya(e.errors,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return"_zod"in e&&"object"==typeof e._zod}(e))return function(n,a,o){try{return Promise.resolve(Ja(function(){return Promise.resolve(("sync"===r.mode?Fr:jr)(e,n,t)).then(function(e){return o.shouldUseNativeValidation&&tr({},o),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return e instanceof Ur}(e))return{values:{},errors:rr(Xa(e.issues,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}};throw new Error("Invalid input: not a Zod schema")}
1
+ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import a,{Component as o,createContext as i,useReducer as s,useMemo as c,useCallback as l,useEffect as d,useState as u,forwardRef as f,createElement as p,useRef as m,useLayoutEffect as h,useContext as g}from"react";import*as v from"react-dom";import y from"react-dom";var b;!function(e){e.V1="v1"}(b||(b={}));class w extends Error{constructor(e,t,r,n){super(e),this.code=t,this.context=r,this.originalError=n,this.name="SDKError","undefined"!=typeof Error&&"captureStackTrace"in Error&&Error.captureStackTrace(this,w)}}const S=new class{constructor(){this.config={enableConsoleLogging:!0,showUserNotifications:!1}}configure(e){this.config={...this.config,...e}}handleError(e,t={}){const r=e instanceof Error?e:new w("string"==typeof e?e:"An unknown error occurred","UNKNOWN_ERROR",t),n=r instanceof w?r:new w(r.message,r.name,t,r),a=(()=>{try{return"undefined"!=typeof process&&"development"===process.env?.NODE_ENV}catch{return!1}})();if(this.config.enableConsoleLogging&&a&&console.error(`[SDK Error] ${t.component||"Unknown"}:`,{message:n.message,code:n.code,context:n.context,originalError:n.originalError,stack:n.stack}),this.config.onError)try{this.config.onError(n,t)}catch(e){console.error("[SDK Error Handler] Error in custom error callback:",e)}this.config.showUserNotifications&&this.notifyUser(n,t)}notifyUser(e,t){"undefined"!=typeof window&&window.dispatchEvent&&window.dispatchEvent(new CustomEvent("sdk-error",{detail:{error:e,context:t}}))}wrapAsync(e,t){return(...r)=>e(...r).catch(e=>{throw this.handleError(e,t),e})}wrapSync(e,t){return(...r)=>{try{return e(...r)}catch(e){throw this.handleError(e,t),e}}}};function x(e,t={}){S.handleError(e,t)}function k(e,t,r,n){return new w(e,t,r,n)}class A extends o{constructor(e){super(e),this.resetError=()=>{this.setState({hasError:!1,error:null})},this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){if(x(e,{component:"ErrorBoundary",action:"componentDidCatch",metadata:{componentStack:t.componentStack,errorBoundary:this.constructor.name}}),this.props.onError)try{this.props.onError(e,t)}catch(e){console.error("[SDK ErrorBoundary] Error in onError callback:",e)}}componentDidUpdate(e){this.state.hasError&&!1!==this.props.resetOnPropsChange&&e.children!==this.props.children&&this.resetError()}render(){return this.state.hasError&&this.state.error?this.props.fallback?"function"==typeof this.props.fallback?this.props.fallback(this.state.error,this.resetError):this.props.fallback:e("div",{style:{padding:"1rem",border:"1px solid #ef4444",borderRadius:"0.5rem",backgroundColor:"#fef2f2",color:"#991b1b"},children:[t("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem",fontWeight:600},children:"Something went wrong"}),t("p",{style:{margin:"0 0 1rem 0",fontSize:"0.875rem"},children:this.state.error.message||"An unexpected error occurred"}),t("button",{onClick:this.resetError,style:{padding:"0.5rem 1rem",backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:"0.25rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]}):this.props.children}}const E=()=>({type:"AUTHENTICATION_STARTED"}),C=()=>({type:"AUTHENTICATION_FAILED"}),T=e=>({type:"SET_SESSION",payload:e}),_=()=>({type:"REMOVE_SESSION"});function N({name:e,initialState:r,reducer:n,initializer:o}){const l=i(null),d=i(null),u=i(null),f=a.memo(({children:e})=>{const[a,i]=s(n,r,o||(e=>e)),f=c(()=>({state:a,dispatch:i}),[a,i]);return t(u.Provider,{value:f,children:t(l.Provider,{value:a,children:t(d.Provider,{value:i,children:e})})})});f.displayName=`${e}Provider`;const p=()=>{const t=a.useContext(l);if(null===t)throw new Error(`use${e}State must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`);return t};return{Provider:f,useContext:()=>{const t=a.useContext(u);if(!t)throw new Error(`use${e}Context must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`);return t},useState:p,useDispatch:()=>{const t=a.useContext(d);if(null===t)throw new Error(`use${e}Dispatch must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`);return t},useSelector:(e,t)=>{const r=p(),n=e||(e=>e),o=a.useRef(n),i=a.useRef(t),s=a.useRef(void 0),l=a.useRef(r);e&&(o.current=n),t&&(i.current=t);return c(()=>{const e=o.current(r);if(void 0!==s.current){if((i.current?i.current(s.current,e):Object.is(s.current,e))&&l.current===r)return s.current}return s.current=e,l.current=r,e},[r])}}}var R;function O(e){if("undefined"==typeof window)return null;try{return localStorage.getItem(e)}catch(t){return console.warn(`Failed to load ${e} from localStorage:`,t),null}}function P(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch(t){console.warn(`Failed to save ${e} to localStorage:`,t)}}function D(e){if("undefined"!=typeof window)try{localStorage.removeItem(e)}catch(t){console.warn(`Failed to remove ${e} from localStorage:`,t)}}!function(e){e.loading="loading",e.authenticated="authenticated",e.unauthenticated="unauthenticated",e.authenticating="authenticating"}(R||(R={}));const I="code",U="saas-session-id";function M(){D(U)}function z(){if("undefined"==typeof window)return null;try{return O(U)}catch(e){return console.warn("Failed to get sessionId from localStorage:",e),null}}function L(){const e=z(),t={};return e&&(t["x-session-id"]=e),t}function F(e,t){return{user:e,sessionId:t,expires:new Date(Date.now()+864e5).toISOString()}}const j=()=>({session:null,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:R.unauthenticated}),{Provider:$,useState:B,useDispatch:W}=N({name:"Auth",initialState:j(),reducer:(e,t)=>{switch(t.type){case"AUTHENTICATION_STARTED":return{...e,isLoading:!0,isAuthenticated:!1,isRedirecting:!0,status:R.authenticating};case"AUTHENTICATION_FAILED":return{...e,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:R.unauthenticated};case"SET_SESSION":{const n=t.payload;return r=n.sessionId,P(U,r),{...e,session:n,isAuthenticated:!0,isRedirecting:!1,isLoading:!1,status:R.authenticated}}case"REMOVE_SESSION":return M(),{...e,session:null,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:R.unauthenticated};default:return e}var r},initializer:j}),V=$,G=B,K=W,H=e=>({type:"SET_SAAS_OS_CONFIG",payload:e}),Z=e=>({type:"SET_SETTINGS",payload:e}),J=()=>({serverUrl:"",version:b.V1,orgId:"",settings:null}),{Provider:q,useState:Y,useDispatch:X}=N({name:"OS",initialState:J(),reducer:(e,t)=>{switch(t.type){case"SET_SAAS_OS_CONFIG":return{...e,...t.payload};case"REMOVE_SAAS_OS_CONFIG":return J();case"SET_SETTINGS":return{...e,settings:t.payload};default:return e}}}),Q=q,ee=Y,te=X,re=e=>({type:"SET_WORKSPACES",payload:e}),ne=e=>({type:"SET_ALL_FEATURES",payload:e}),ae=e=>({type:"SET_CURRENT_WORKSPACE",payload:e}),oe=()=>({type:"RESET_CURRENT_WORKSPACE"}),ie=e=>({type:"SET_IS_INITIALIZED",payload:e}),se=e=>({type:"SET_LOADING",payload:e}),ce=e=>({type:"SET_ERROR",payload:e}),le=e=>({type:"SET_REFRESHING",payload:e}),de="saas-workspace-current";const{Provider:ue,useState:fe,useDispatch:pe}=N({name:"Workspace",initialState:{workspaces:[],loading:!1,error:null,currentWorkspace:null,refreshing:!1,switching:!1,isInitialized:!1,allFeatures:[]},reducer:(e,t)=>{switch(t.type){case"SET_WORKSPACES":return{...e,workspaces:t.payload};case"SET_ALL_FEATURES":return{...e,allFeatures:t.payload};case"SET_CURRENT_WORKSPACE":return(r=t.payload._id)?P(de,r):D(de),{...e,currentWorkspace:t.payload};case"RESET_CURRENT_WORKSPACE":return D(de),{...e,currentWorkspace:null};case"SET_IS_INITIALIZED":return{...e,isInitialized:t.payload};case"SET_LOADING":return{...e,loading:t.payload};case"SET_ERROR":return{...e,error:t.payload};case"SET_REFRESHING":return{...e,refreshing:t.payload};case"SET_SWITCHING":return{...e,switching:t.payload};default:return e}var r}}),me=ue,he=fe,ge=pe,ve=a.memo(({children:e})=>t(Q,{children:t(V,{children:t(me,{children:e})})}));function ye(e,t){const r=ee(),n=G(),o=he(),i=c(()=>({os:r,auth:n,workspaces:o}),[r,n,o]),s=e||(e=>e),l=a.useRef(s),d=a.useRef(t),u=a.useRef(void 0),f=a.useRef(i);e&&(l.current=s);return c(()=>{const e=l.current(i);if(void 0!==u.current){if((d.current?d.current(u.current,e):Object.is(u.current,e))&&f.current===i)return u.current}return u.current=e,f.current=i,e},[i])}function be(){const e=K(),t=te(),r=ge();return c(()=>({auth:e,os:t,workspaces:r}),[e,t,r])}ve.displayName="SDKContextProvider";const we=a.memo(({children:e,callbacks:n})=>{const o=be(),i=ye(e=>e.auth),s=ye(e=>e.os),u=a.useRef(!1),f=a.useRef(null),p=c(()=>n,[n]),m=l(async e=>{try{if(p?.handleAuthentication){const{sessionId:t}=await p.handleAuthentication(e);if(!t||"string"!=typeof t||""===t.trim())throw new Error("Invalid sessionId received from authentication callback");const r=s,{serverUrl:n,version:a,orgId:i}=r;if(!n||!a||!i)throw new Error("OS configuration is not available");const c=await fetch(`${n}/api/${a}/public/profile`,{headers:{"x-session-id":t,"Content-Type":"application/json"}});if(!c.ok)throw new Error("Failed to fetch user profile");let l;try{l=await c.json()}catch(e){throw new Error("Failed to parse user profile response")}const d=l._id||l.id;if(!d||"string"!=typeof d)throw new Error("User data missing required ID field");if(!l.email||"string"!=typeof l.email)throw new Error("User data missing required email field");const u=F({id:d,name:l.name||"",org:i,email:l.email,emailVerified:!0,clientId:r.auth?.clientId||"",role:l.role||"",image:l.image},t);o.auth(T(u)),function(){try{const e=new URL(window.location.href);e.searchParams.delete(I),window.history.replaceState({},"",e.toString())}catch(e){console.error("Error removing token from URL:",e)}}()}}catch(t){throw x(t,{component:"AuthProviderWrapper",action:"handleAuthRedirect",metadata:{hasCode:!!e}}),o.auth(C()),t}},[o,p,s]);return d(()=>{if("undefined"==typeof window)return;if(i.isAuthenticated)return;const e=z();if(!e)return;(async()=>{try{const{serverUrl:t,version:r,orgId:n}=s;if(!t||!r||!n)return void x(new Error("OS configuration not available, cannot fetch user profile"),{component:"AuthProviderWrapper",action:"fetchUserProfile"});const a=await fetch(`${t}/api/${r}/public/profile`,{headers:{"x-session-id":e,"Content-Type":"application/json"}});if(!a.ok)return x(new Error("Session invalid, removing from localStorage"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{status:a.status}}),void M();let i;try{i=await a.json()}catch(e){return x(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"parseResponse"}}),void M()}const c=i._id||i.id;if(!c||"string"!=typeof c)return x(new Error("User data missing required ID field"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"validateUserData"}}),void M();if(!i.email||"string"!=typeof i.email)return x(new Error("User data missing required email field"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"validateUserData"}}),void M();const l=F({id:c,name:i.name||"",org:n,email:i.email,emailVerified:!0,clientId:s.auth?.clientId||"",role:i.role||"",image:i.image},e);o.auth(T(l))}catch(e){x(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"pageLoad"}}),M()}})()},[i.isAuthenticated,o,s]),d(()=>{const e=function(){if("undefined"==typeof window)return null;try{return new URLSearchParams(window.location.search).get(I)}catch(e){return console.error("Error getting token from URL:",e),null}}();if(!e)return;if(u.current||f.current===e)return;const{serverUrl:t,version:r,orgId:n}=s;t&&r&&n&&(u.current=!0,f.current=e,m(e).then(()=>{f.current=null}).catch(t=>{x(t,{component:"AuthProviderWrapper",action:"handleAuthRedirectEffect",metadata:{code:e.substring(0,10)+"..."}}),f.current=null}).finally(()=>{u.current=!1}))},[m,s.serverUrl,s.version,s.orgId]),t(r,{children:e})});we.displayName="AuthProviderWrapper";const Se=a.memo(({config:e,auth:n,children:o})=>{const i=be(),s=ye(e=>e.os),c=a.useMemo(()=>({clientId:n?.clientId||"",redirectUrl:n?.redirectUrl||"",callbacks:n?.callbacks}),[n?.clientId,n?.redirectUrl,n?.callbacks]);return d(()=>{i.os(H({...e,auth:c}))},[e,c,i]),d(()=>{const{serverUrl:e,version:t,orgId:r,settings:n}=s;if(e&&t&&r&&!n){(async()=>{try{const n=L(),a=await fetch(`${e}/api/${t}/public/${r}/settings`,{headers:n});if(a.ok){const e=await a.json();i.os(Z(e))}}catch(n){x(n,{component:"ContextConfigProvider",action:"fetchSettings",metadata:{serverUrl:e,version:t,orgId:r}})}})()}},[s.serverUrl,s.version,s.orgId,s.settings,i]),t(r,{children:o})});Se.displayName="ContextConfigProvider";const xe=new class{constructor(){this.callbacks=null}setCallbacks(e){this.callbacks=e}getCallbacks(){return this.callbacks}async emit(e,t){if(this.callbacks?.handleEvent)try{await this.callbacks.handleEvent(e,t)}catch(t){x(t,{component:"EventEmitter",action:"emit",metadata:{eventType:e}})}}async emitUserCreated(e){await this.emit("user:created",{user:e})}async emitUserUpdated(e,t){await this.emit("user:updated",{user:e,previousUser:t})}async emitWorkspaceChanged(e,t){await this.emit("workspace:changed",{workspace:e,previousWorkspace:t})}async emitWorkspaceUpdated(e){await this.emit("workspace:updated",{workspace:e})}async emitWorkspaceUserAdded(e,t,r){await this.emit("workspace:user-added",{userId:e,workspace:t,role:r})}async emitWorkspaceUserRemoved(e,t,r){await this.emit("workspace:user-removed",{userId:e,workspace:t,role:r})}async emitWorkspaceUserRoleChanged(e,t,r,n){await this.emit("workspace:user-role-changed",{userId:e,workspace:t,previousRole:r,newRole:n})}async emitWorkspaceCreated(e){await this.emit("workspace:created",{workspace:e})}async emitWorkspaceDeleted(e){await this.emit("workspace:deleted",{workspace:e})}},ke=i({container:null,setContainer:()=>{}}),Ae=a.memo(({children:r})=>{const[n,o]=a.useState(null),i=a.useMemo(()=>({container:n,setContainer:o}),[n]),s=a.useMemo(()=>r,[r]);return e(ke.Provider,{value:i,children:[s,t("div",{ref:o,id:"saas-os-portal",className:"saas-os-ui",style:{width:"100%",height:"100%"}})]})});Ae.displayName="PortalProvider";const Ee=a.createContext(void 0),Ce=a.memo(({children:e})=>{const r=ye(e=>e.os),n=ye(e=>e.auth),{serverUrl:o,version:i}=r,s=n.isAuthenticated,[c,f]=u({}),[p,m]=u({}),[h,g]=u(!1),[v,y]=u(null),b=l(async()=>{if(o&&i&&s)try{const e=await fetch(`${o}/api/${i}/public/users/attributes`,{headers:L()});if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.message||"Failed to fetch user attributes")}const t=await e.json();t&&"object"==typeof t&&!Array.isArray(t)?f(t):f({})}catch(e){const t=e instanceof Error?e:new Error("Failed to fetch user attributes");y(t),x(e,{component:"UserProvider",action:"fetchAttributes"})}else f({})},[o,i,s]),w=l(async()=>{if(o&&i&&s){g(!0),y(null);try{await b()}finally{g(!1)}}},[o,i,s,b]),S=l(async e=>{if(!o||!i)throw new Error("Server URL or version is missing");g(!0),y(null);try{const t=await fetch(`${o}/api/${i}/public/users/attributes`,{method:"PATCH",headers:{"Content-Type":"application/json",...L()},body:JSON.stringify({attributes:e})});if(!t.ok){const e=await t.json().catch(()=>({}));throw new Error(e.message||"Failed to update user attributes")}const r=await t.json();return await b(),r}catch(t){const r=t instanceof Error?t:new Error("Failed to update user attributes");throw y(r),x(t,{component:"UserProvider",action:"updateAttributes",metadata:{updates:e}}),r}finally{g(!1)}},[o,i,b]),k=l(async(e,t)=>{if(!o||!i)throw new Error("Server URL or version is missing");g(!0),y(null);try{const r=await fetch(`${o}/api/${i}/public/users/attributes/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...L()},body:JSON.stringify({value:t})});if(!r.ok){const e=await r.json().catch(()=>({}));throw new Error(e.message||"Failed to update user attribute")}const n=await r.json();return await b(),n}catch(r){const n=r instanceof Error?r:new Error("Failed to update user attribute");throw y(n),x(r,{component:"UserProvider",action:"updateAttribute",metadata:{attributeKey:e,value:t}}),n}finally{g(!1)}},[o,i,b]),A=l(async()=>{if(o&&i&&s)try{const e=await fetch(`${o}/api/${i}/public/users/features`,{headers:L()});if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.message||"Failed to fetch user features")}const t=await e.json();m("object"==typeof t?t:{})}catch(e){const t=e instanceof Error?e:new Error("Failed to fetch user features");y(t),x(e,{component:"UserProvider",action:"fetchFeatures"})}else m({})},[o,i,s]),E=l(async()=>{if(o&&i&&s){g(!0),y(null);try{await A()}finally{g(!1)}}},[o,i,s,A]);d(()=>{s&&o&&i?(g(!0),y(null),Promise.all([b(),A()]).finally(()=>{g(!1)})):(f({}),m({}))},[s,o,i,b,A]);const C=a.useMemo(()=>({attributes:c,features:p,isLoading:h,error:v,updateAttributes:S,updateAttribute:k,refreshAttributes:w,refreshFeatures:E}),[c,p,h,v,S,k,w,E]);return t(Ee.Provider,{value:C,children:e})});Ce.displayName="UserProvider";class Te{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}getAuthHeader(){return L()}async getWorkspaces(){const e=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces`,{headers:this.getAuthHeader()});if(!e.ok)throw new Error("Failed to fetch workspaces");return e.json()}async createWorkspace(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to create workspace");return t.json()}async updateWorkspace(e,t){const r=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)});if(!r.ok)throw new Error("Failed to update workspace");return r.json()}async deleteWorkspace(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"DELETE",headers:this.getAuthHeader()});if(!t.ok)throw new Error("Failed to delete workspace");return t.json()}async getWorkspaceUsers(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users`,{headers:this.getAuthHeader()});if(!t.ok)throw new Error("Failed to fetch workspace users");return t.json()}async addUser(e,t){const r=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/add`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)});if(!r.ok){const e=await r.json();throw new Error(e.message||"Failed to invite member")}return r.json()}async removeUser(e,t){const r=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/${t}`,{method:"DELETE",headers:this.getAuthHeader()});if(!r.ok){const e=await r.json();throw new Error(e.message||"Failed to remove user")}return r.json()}async updateUser(e,t,r){const n=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(r)});if(!n.ok){const e=await n.json();throw new Error(e.message||"Failed to update user")}return n.json()}async getFeatures(){const e=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/features`,{headers:this.getAuthHeader()});if(!e.ok)throw new Error("Failed to fetch features");return e.json()}async updateFeature(e,t,r){const n=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/features`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify({features:{[t]:r}})});if(!n.ok)throw new Error("Failed to update feature");return n.json()}async getWorkspace(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{headers:this.getAuthHeader()});if(!t.ok)throw new Error("Failed to fetch workspace");return t.json()}async getProfile(){const e=await fetch(`${this.serverUrl}/api/${this.version}/public/profile`,{headers:this.getAuthHeader()});if(!e.ok)throw new Error("Failed to fetch profile");return e.json()}async updateUserProfile(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/profile`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to update user profile");return t.json()}}var _e=e=>"checkbox"===e.type,Ne=e=>e instanceof Date,Re=e=>null==e;const Oe=e=>"object"==typeof e;var Pe=e=>!Re(e)&&!Array.isArray(e)&&Oe(e)&&!Ne(e),De=e=>Pe(e)&&e.target?_e(e.target)?e.target.checked:e.target.value:e,Ie=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),Ue="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Me(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(Ue&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!(r||Pe(e)&&(e=>{const t=e.constructor&&e.constructor.prototype;return Pe(t)&&t.hasOwnProperty("isPrototypeOf")})(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=Me(e[t]));return n}var ze=e=>/^\w*$/.test(e),Le=e=>void 0===e,Fe=e=>Array.isArray(e)?e.filter(Boolean):[],je=e=>Fe(e.replace(/["|']|\]/g,"").split(/\.|\[/)),$e=(e,t,r)=>{if(!t||!Pe(e))return r;const n=(ze(t)?[t]:je(t)).reduce((e,t)=>Re(e)?e:e[t],e);return Le(n)||n===e?Le(e[t])?r:e[t]:n},Be=e=>"boolean"==typeof e,We=e=>"function"==typeof e,Ve=(e,t,r)=>{let n=-1;const a=ze(t)?[t]:je(t),o=a.length,i=o-1;for(;++n<o;){const t=a[n];let o=r;if(n!==i){const r=e[t];o=Pe(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=o,e=e[t]}};const Ge="blur",Ke="focusout",He="change",Ze="onBlur",Je="onChange",qe="onSubmit",Ye="onTouched",Xe="all",Qe="max",et="min",tt="maxLength",rt="minLength",nt="pattern",at="required",ot="validate",it=a.createContext(null);it.displayName="HookFormContext";const st=()=>a.useContext(it),ct=e=>{const{children:t,...r}=e;return a.createElement(it.Provider,{value:r},t)};var lt=(e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(a,o,{get:()=>{const a=o;return t._proxyFormState[a]!==Xe&&(t._proxyFormState[a]=!n||Xe),r&&(r[a]=!0),e[a]}});return a};const dt="undefined"!=typeof window?a.useLayoutEffect:a.useEffect;var ut=e=>"string"==typeof e,ft=(e,t,r,n,a)=>ut(e)?(n&&t.watch.add(e),$e(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),$e(r,e))):(n&&(t.watchAll=!0),r),pt=e=>Re(e)||!Oe(e);function mt(e,t,r=new WeakSet){if(pt(e)||pt(t))return Object.is(e,t);if(Ne(e)&&Ne(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const o of n){const n=e[o];if(!a.includes(o))return!1;if("ref"!==o){const e=t[o];if(Ne(n)&&Ne(e)||Pe(n)&&Pe(e)||Array.isArray(n)&&Array.isArray(e)?!mt(n,e,r):!Object.is(n,e))return!1}}return!0}function ht(e){const t=st(),{name:r,disabled:n,control:o=t.control,shouldUnregister:i,defaultValue:s,exact:c=!0}=e,l=Ie(o._names.array,r),d=a.useMemo(()=>$e(o._formValues,r,$e(o._defaultValues,r,s)),[o,r,s]),u=function(e){const t=st(),{control:r=t.control,name:n,defaultValue:o,disabled:i,exact:s,compute:c}=e||{},l=a.useRef(o),d=a.useRef(c),u=a.useRef(void 0),f=a.useRef(r),p=a.useRef(n);d.current=c;const[m,h]=a.useState(()=>{const e=r._getWatch(n,l.current);return d.current?d.current(e):e}),g=a.useCallback(e=>{const t=ft(n,r._names,e||r._formValues,!1,l.current);return d.current?d.current(t):t},[r._formValues,r._names,n]),v=a.useCallback(e=>{if(!i){const t=ft(n,r._names,e||r._formValues,!1,l.current);if(d.current){const e=d.current(t);mt(e,u.current)||(h(e),u.current=e)}else h(t)}},[r._formValues,r._names,i,n]);dt(()=>(f.current===r&&mt(p.current,n)||(f.current=r,p.current=n,v()),r._subscribe({name:n,formState:{values:!0},exact:s,callback:e=>{v(e.values)}})),[r,s,n,v]),a.useEffect(()=>r._removeUnmounted());const y=f.current!==r,b=p.current,w=a.useMemo(()=>{if(i)return null;const e=!y&&!mt(b,n);return y||e?g():null},[i,y,n,b,g]);return null!==w?w:m}({control:o,name:r,defaultValue:d,exact:c}),f=function(e){const t=st(),{control:r=t.control,disabled:n,name:o,exact:i}=e||{},[s,c]=a.useState(r._formState),l=a.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return dt(()=>r._subscribe({name:o,formState:l.current,exact:i,callback:e=>{!n&&c({...r._formState,...e})}}),[o,n,i]),a.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),a.useMemo(()=>lt(s,r,l.current,!1),[s,r])}({control:o,name:r,exact:c}),p=a.useRef(e),m=a.useRef(void 0),h=a.useRef(o.register(r,{...e.rules,value:u,...Be(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const g=a.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!$e(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!$e(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!$e(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!$e(f.validatingFields,r)},error:{enumerable:!0,get:()=>$e(f.errors,r)}}),[f,r]),v=a.useCallback(e=>h.current.onChange({target:{value:De(e),name:r},type:He}),[r]),y=a.useCallback(()=>h.current.onBlur({target:{value:$e(o._formValues,r),name:r},type:Ge}),[r,o._formValues]),b=a.useCallback(e=>{const t=$e(o._fields,r);t&&t._f&&e&&(t._f.ref={focus:()=>We(e.focus)&&e.focus(),select:()=>We(e.select)&&e.select(),setCustomValidity:t=>We(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>We(e.reportValidity)&&e.reportValidity()})},[o._fields,r]),w=a.useMemo(()=>({name:r,value:u,...Be(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:v,onBlur:y,ref:b}),[r,n,f.disabled,v,y,b,u]);return a.useEffect(()=>{const e=o._options.shouldUnregister||i,t=m.current;t&&t!==r&&!l&&o.unregister(t),o.register(r,{...p.current.rules,...Be(p.current.disabled)?{disabled:p.current.disabled}:{}});const n=(e,t)=>{const r=$e(o._fields,e);r&&r._f&&(r._f.mount=t)};if(n(r,!0),e){const e=Me($e(o._options.defaultValues,r,p.current.defaultValue));Ve(o._defaultValues,r,e),Le($e(o._formValues,r))&&Ve(o._formValues,r,e)}return!l&&o.register(r),m.current=r,()=>{(l?e&&!o._state.action:e)?o.unregister(r):n(r,!1)}},[r,o,l,i]),a.useEffect(()=>{o._setDisabledField({disabled:n,name:r})},[n,r,o]),a.useMemo(()=>({field:w,formState:f,fieldState:g}),[w,f,g])}const gt=e=>e.render(ht(e));var vt=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},yt=e=>Array.isArray(e)?e:[e],bt=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function wt(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const a=e[n],o=t[n];if(a&&Pe(a)&&o){const e=wt(a,o);Pe(e)&&(r[n]=e)}else e[n]&&(r[n]=o)}return r}var St=e=>Pe(e)&&!Object.keys(e).length,xt=e=>"file"===e.type,kt=e=>{if(!Ue)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},At=e=>"select-multiple"===e.type,Et=e=>"radio"===e.type,Ct=e=>kt(e)&&e.isConnected;function Tt(e,t){const r=Array.isArray(t)?t:ze(t)?[t]:je(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Le(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,o=r[a];return n&&delete n[o],0!==a&&(Pe(n)&&St(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Le(e[t]))return!1;return!0}(n))&&Tt(e,r.slice(0,-1)),e}function _t(e){return Array.isArray(e)||Pe(e)&&!(e=>{for(const t in e)if(We(e[t]))return!0;return!1})(e)}function Nt(e,t={}){for(const r in e){const n=e[r];_t(n)?(t[r]=Array.isArray(n)?[]:{},Nt(n,t[r])):Le(n)||(t[r]=!0)}return t}function Rt(e,t,r){r||(r=Nt(t));for(const n in e){const a=e[n];if(_t(a))Le(t)||pt(r[n])?r[n]=Nt(a,Array.isArray(a)?[]:{}):Rt(a,Re(t)?{}:t[n],r[n]);else{const e=t[n];r[n]=!mt(a,e)}}return r}const Ot={value:!1,isValid:!1},Pt={value:!0,isValid:!0};var Dt=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Le(e[0].attributes.value)?Le(e[0].value)||""===e[0].value?Pt:{value:e[0].value,isValid:!0}:Pt:Ot}return Ot},It=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Le(e)?e:t?""===e?NaN:e?+e:e:r&&ut(e)?new Date(e):n?n(e):e;const Ut={isValid:!1,value:null};var Mt=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Ut):Ut;function zt(e){const t=e.ref;return xt(t)?t.files:Et(t)?Mt(e.refs).value:At(t)?[...t.selectedOptions].map(({value:e})=>e):_e(t)?Dt(e.refs).value:It(Le(t.value)?e.ref.value:t.value,e)}var Lt=e=>e instanceof RegExp,Ft=e=>Le(e)?e:Lt(e)?e.source:Pe(e)?Lt(e.value)?e.value.source:e.value:e,jt=e=>({isOnSubmit:!e||e===qe,isOnBlur:e===Ze,isOnChange:e===Je,isOnAll:e===Xe,isOnTouch:e===Ye});const $t="AsyncFunction";var Bt=e=>!!e&&!!e.validate&&!!(We(e.validate)&&e.validate.constructor.name===$t||Pe(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===$t)),Wt=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const Vt=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=$e(e,a);if(r){const{_f:e,...o}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!n)return!0;if(e.ref&&t(e.ref,e.name)&&!n)return!0;if(Vt(o,t))break}else if(Pe(o)&&Vt(o,t))break}}};function Gt(e,t,r){const n=$e(e,r);if(n||ze(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),o=$e(t,n),i=$e(e,n);if(o&&!Array.isArray(o)&&r!==n)return{name:r};if(i&&i.type)return{name:n,error:i};if(i&&i.root&&i.root.type)return{name:`${n}.root`,error:i.root};a.pop()}return{name:r}}var Kt=(e,t,r)=>{const n=yt($e(e,r));return Ve(n,"root",t[r]),Ve(e,r,n),e};function Ht(e,t,r="validate"){if(ut(e)||Array.isArray(e)&&e.every(ut)||Be(e)&&!e)return{type:r,message:ut(e)?e:"",ref:t}}var Zt=e=>Pe(e)&&!Lt(e)?e:{value:e,message:""},Jt=async(e,t,r,n,a,o)=>{const{ref:i,refs:s,required:c,maxLength:l,minLength:d,min:u,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:v}=e._f,y=$e(r,h);if(!v||t.has(h))return{};const b=s?s[0]:i,w=e=>{a&&b.reportValidity&&(b.setCustomValidity(Be(e)?"":e||""),b.reportValidity())},S={},x=Et(i),k=_e(i),A=x||k,E=(g||xt(i))&&Le(i.value)&&Le(y)||kt(i)&&""===i.value||""===y||Array.isArray(y)&&!y.length,C=vt.bind(null,h,n,S),T=(e,t,r,n=tt,a=rt)=>{const o=e?t:r;S[h]={type:e?n:a,message:o,ref:i,...C(e?n:a,o)}};if(o?!Array.isArray(y)||!y.length:c&&(!A&&(E||Re(y))||Be(y)&&!y||k&&!Dt(s).isValid||x&&!Mt(s).isValid)){const{value:e,message:t}=ut(c)?{value:!!c,message:c}:Zt(c);if(e&&(S[h]={type:at,message:t,ref:b,...C(at,t)},!n))return w(t),S}if(!(E||Re(u)&&Re(f))){let e,t;const r=Zt(f),a=Zt(u);if(Re(y)||isNaN(y)){const n=i.valueAsDate||new Date(y),o=e=>new Date((new Date).toDateString()+" "+e),s="time"==i.type,c="week"==i.type;ut(r.value)&&y&&(e=s?o(y)>o(r.value):c?y>r.value:n>new Date(r.value)),ut(a.value)&&y&&(t=s?o(y)<o(a.value):c?y<a.value:n<new Date(a.value))}else{const n=i.valueAsNumber||(y?+y:y);Re(r.value)||(e=n>r.value),Re(a.value)||(t=n<a.value)}if((e||t)&&(T(!!e,r.message,a.message,Qe,et),!n))return w(S[h].message),S}if((l||d)&&!E&&(ut(y)||o&&Array.isArray(y))){const e=Zt(l),t=Zt(d),r=!Re(e.value)&&y.length>+e.value,a=!Re(t.value)&&y.length<+t.value;if((r||a)&&(T(r,e.message,t.message),!n))return w(S[h].message),S}if(p&&!E&&ut(y)){const{value:e,message:t}=Zt(p);if(Lt(e)&&!y.match(e)&&(S[h]={type:nt,message:t,ref:i,...C(nt,t)},!n))return w(t),S}if(m)if(We(m)){const e=Ht(await m(y,r),b);if(e&&(S[h]={...e,...C(ot,e.message)},!n))return w(e.message),S}else if(Pe(m)){let e={};for(const t in m){if(!St(e)&&!n)break;const a=Ht(await m[t](y,r),b,t);a&&(e={...a,...C(t,a.message)},w(a.message),n&&(S[h]=e))}if(!St(e)&&(S[h]={ref:b,...e},!n))return S}return w(!0),S};const qt={mode:qe,reValidateMode:Je,shouldFocusError:!0};function Yt(e={}){let t,r={...qt,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:We(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},o=(Pe(r.defaultValues)||Pe(r.values))&&Me(r.defaultValues||r.values)||{},i=r.shouldUnregister?{}:Me(o),s={action:!1,mount:!1,watch:!1,keepIsValid:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},u={...d};let f={...u};const p={array:bt(),state:bt()},m=r.criteriaMode===Xe,h=async e=>{if(!s.keepIsValid&&!r.disabled&&(u.isValid||f.isValid||e)){let e;r.resolver?(e=St((await w()).errors),g()):e=await S(a,!0),e!==n.isValid&&p.state.next({isValid:e})}},g=(e,t)=>{!r.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((e||Array.from(c.mount)).forEach(e=>{e&&(t?Ve(n.validatingFields,e,t):Tt(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!St(n.validatingFields)}))},v=(e,t,r,n)=>{const c=$e(a,e);if(c){const a=$e(i,e,Le(r)?$e(o,e):r);Le(a)||n&&n.defaultChecked||t?Ve(i,e,t?a:zt(c._f)):A(e,a),s.mount&&!s.action&&h()}},y=(e,t,a,i,s)=>{let c=!1,l=!1;const d={name:e};if(!r.disabled){if(!a||i){(u.isDirty||f.isDirty)&&(l=n.isDirty,n.isDirty=d.isDirty=x(),c=l!==d.isDirty);const r=mt($e(o,e),t);l=!!$e(n.dirtyFields,e),r?Tt(n.dirtyFields,e):Ve(n.dirtyFields,e,!0),d.dirtyFields=n.dirtyFields,c=c||(u.dirtyFields||f.dirtyFields)&&l!==!r}if(a){const t=$e(n.touchedFields,e);t||(Ve(n.touchedFields,e,a),d.touchedFields=n.touchedFields,c=c||(u.touchedFields||f.touchedFields)&&t!==a)}c&&s&&p.state.next(d)}return c?d:{}},b=(e,a,o,i)=>{const s=$e(n.errors,e),c=(u.isValid||f.isValid)&&Be(a)&&n.isValid!==a;var d;if(r.delayError&&o?(d=()=>((e,t)=>{Ve(n.errors,e,t),p.state.next({errors:n.errors})})(e,o),t=e=>{clearTimeout(l),l=setTimeout(d,e)},t(r.delayError)):(clearTimeout(l),t=null,o?Ve(n.errors,e,o):Tt(n.errors,e)),(o?!mt(s,o):s)||!St(i)||c){const t={...i,...c&&Be(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},w=async e=>{g(e,!0);const t=await r.resolver(i,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=$e(t,r);e&&Ve(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||c.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return t},S=async(t,a,o={valid:!0})=>{for(const s in t){const l=t[s];if(l){const{_f:t,...s}=l;if(t){const s=c.array.has(t.name),d=l._f&&Bt(l._f);d&&u.validatingFields&&g([t.name],!0);const f=await Jt(l,c.disabled,i,m,r.shouldUseNativeValidation&&!a,s);if(d&&u.validatingFields&&g([t.name]),f[t.name]&&(o.valid=!1,a||e.shouldUseNativeValidation))break;!a&&($e(f,t.name)?s?Kt(n.errors,f,t.name):Ve(n.errors,t.name,f[t.name]):Tt(n.errors,t.name))}!St(s)&&await S(s,a,o)}}return o.valid},x=(e,t)=>!r.disabled&&(e&&t&&Ve(i,e,t),!mt(R(),o)),k=(e,t,r)=>ft(e,c,{...s.mount?i:Le(t)?o:ut(e)?{[e]:t}:t},r,t),A=(e,t,r={})=>{const n=$e(a,e);let o=t;if(n){const r=n._f;r&&(!r.disabled&&Ve(i,e,It(t,r)),o=kt(r.ref)&&Re(t)?"":t,At(r.ref)?[...r.ref.options].forEach(e=>e.selected=o.includes(e.value)):r.refs?_e(r.ref)?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(o)?e.checked=!!o.find(t=>t===e.value):e.checked=o===e.value||!!o)}):r.refs.forEach(e=>e.checked=e.value===o):xt(r.ref)?r.ref.value="":(r.ref.value=o,r.ref.type||p.state.next({name:e,values:Me(i)})))}(r.shouldDirty||r.shouldTouch)&&y(e,o,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&N(e)},E=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const o=t[n],i=e+"."+n,s=$e(a,i);(c.array.has(e)||Pe(o)||s&&!s._f)&&!Ne(o)?E(i,o,r):A(i,o,r)}},C=(e,t,r={})=>{const l=$e(a,e),d=c.array.has(e),m=Me(t);Ve(i,e,m),d?(p.array.next({name:e,values:Me(i)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&r.shouldDirty&&p.state.next({name:e,dirtyFields:Rt(o,i),isDirty:x(e,m)})):!l||l._f||Re(m)?A(e,m,r):E(e,m,r),Wt(e,c)?p.state.next({...n,name:e,values:Me(i)}):p.state.next({name:s.mount?e:void 0,values:Me(i)})},T=async e=>{s.mount=!0;const o=e.target;let l=o.name,d=!0;const v=$e(a,l),x=e=>{d=Number.isNaN(e)||Ne(e)&&isNaN(e.getTime())||mt(e,$e(i,l,e))},k=jt(r.mode),A=jt(r.reValidateMode);if(v){let s,E;const C=o.type?zt(v._f):De(e),T=e.type===Ge||e.type===Ke,_=!(e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(v._f)&&!r.resolver&&!$e(n.errors,l)&&!v._f.deps||((e,t,r,n,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:!(r?n.isOnChange:a.isOnChange)||e))(T,$e(n.touchedFields,l),n.isSubmitted,A,k),R=Wt(l,c,T);Ve(i,l,C),T?o&&o.readOnly||(v._f.onBlur&&v._f.onBlur(e),t&&t(0)):v._f.onChange&&v._f.onChange(e);const O=y(l,C,T),P=!St(O)||R;if(!T&&p.state.next({name:l,type:e.type,values:Me(i)}),_)return(u.isValid||f.isValid)&&("onBlur"===r.mode?T&&h():T||h()),P&&p.state.next({name:l,...R?{}:O});if(!T&&R&&p.state.next({...n}),r.resolver){const{errors:e}=await w([l]);if(g([l]),x(C),d){const t=Gt(n.errors,a,l),r=Gt(e,a,t.name||l);s=r.error,l=r.name,E=St(e)}}else g([l],!0),s=(await Jt(v,c.disabled,i,m,r.shouldUseNativeValidation))[l],g([l]),x(C),d&&(s?E=!1:(u.isValid||f.isValid)&&(E=await S(a,!0)));d&&(v._f.deps&&(!Array.isArray(v._f.deps)||v._f.deps.length>0)&&N(v._f.deps),b(l,E,s,O))}},_=(e,t)=>{if($e(n.errors,t)&&e.focus)return e.focus(),1},N=async(e,t={})=>{let o,i;const s=yt(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(g(e),e)for(const r of e){const e=$e(t,r);e?Ve(n.errors,r,e):Tt(n.errors,r)}else n.errors=t;return t})(Le(e)?e:s);o=St(t),i=e?!s.some(e=>$e(t,e)):o}else e?(i=(await Promise.all(s.map(async e=>{const t=$e(a,e);return await S(t&&t._f?{[e]:t}:t)}))).every(Boolean),(i||n.isValid)&&h()):i=o=await S(a);return p.state.next({...!ut(e)||(u.isValid||f.isValid)&&o!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:o}:{},errors:n.errors}),t.shouldFocus&&!i&&Vt(a,_,e?s:c.mount),i},R=(e,t)=>{let r={...s.mount?i:o};return t&&(r=wt(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),Le(e)?r:ut(e)?$e(r,e):e.map(e=>$e(r,e))},O=(e,t)=>({invalid:!!$e((t||n).errors,e),isDirty:!!$e((t||n).dirtyFields,e),error:$e((t||n).errors,e),isValidating:!!$e(n.validatingFields,e),isTouched:!!$e((t||n).touchedFields,e)}),P=(e,t,r)=>{const o=($e(a,e,{_f:{}})._f||{}).ref,i=$e(n.errors,e)||{},{ref:s,message:c,type:l,...d}=i;Ve(n.errors,e,{...d,...t,ref:o}),p.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&o&&o.focus&&o.focus()},D=e=>p.state.subscribe({next:t=>{var r,a,s;r=e.name,a=t.name,s=e.exact,r&&a&&r!==a&&!yt(r).some(e=>e&&(s?e===a:e.startsWith(a)||a.startsWith(e)))||!((e,t,r,n)=>{r(e);const{name:a,...o}=e;return St(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>t[e]===(!n||Xe))})(t,e.formState||u,$,e.reRenderRoot)||e.callback({values:{...i},...n,...t,defaultValues:o})}}).unsubscribe,I=(e,t={})=>{for(const s of e?yt(e):c.mount)c.mount.delete(s),c.array.delete(s),t.keepValue||(Tt(a,s),Tt(i,s)),!t.keepError&&Tt(n.errors,s),!t.keepDirty&&Tt(n.dirtyFields,s),!t.keepTouched&&Tt(n.touchedFields,s),!t.keepIsValidating&&Tt(n.validatingFields,s),!r.shouldUnregister&&!t.keepDefaultValue&&Tt(o,s);p.state.next({values:Me(i)}),p.state.next({...n,...t.keepDirty?{isDirty:x()}:{}}),!t.keepIsValid&&h()},U=({disabled:e,name:t})=>{(Be(e)&&s.mount||e||c.disabled.has(t))&&(e?c.disabled.add(t):c.disabled.delete(t))},M=(e,t={})=>{let n=$e(a,e);const i=Be(t.disabled)||Be(r.disabled);return Ve(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),c.mount.add(e),n?U({disabled:Be(t.disabled)?t.disabled:r.disabled,name:e}):v(e,!0,t.value),{...i?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:Ft(t.min),max:Ft(t.max),minLength:Ft(t.minLength),maxLength:Ft(t.maxLength),pattern:Ft(t.pattern)}:{},name:e,onChange:T,onBlur:T,ref:i=>{if(i){M(e,t),n=$e(a,e);const r=Le(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,s=(e=>Et(e)||_e(e))(r),c=n._f.refs||[];if(s?c.find(e=>e===r):r===n._f.ref)return;Ve(a,e,{_f:{...n._f,...s?{refs:[...c.filter(Ct),r,...Array.isArray($e(o,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),v(e,!1,void 0,r)}else n=$e(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!Ie(c.array,e)||!s.action)&&c.unMount.add(e)}}},z=()=>r.shouldFocusError&&Vt(a,_,c.mount),L=(e,t)=>async o=>{let s;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=Me(i);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await w();g(),n.errors=e,l=Me(t)}else await S(a);if(c.disabled.size)for(const e of c.disabled)Tt(l,e);if(Tt(n.errors,"root"),St(n.errors)){p.state.next({errors:{}});try{await e(l,o)}catch(e){s=e}}else t&&await t({...n.errors},o),z(),setTimeout(z);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:St(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},F=(e,t={})=>{const l=e?Me(e):o,d=Me(l),f=St(e),m=f?o:d;if(t.keepDefaultValues||(o=l),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...c.mount,...Object.keys(Rt(o,i))]);for(const t of Array.from(e)){const e=$e(n.dirtyFields,t),r=$e(i,t),a=$e(m,t);e&&!Le(r)?Ve(m,t,r):e||Le(a)||C(t,a)}}else{if(Ue&&Le(e))for(const e of c.mount){const t=$e(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(kt(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of c.mount)C(e,$e(m,e));else a={}}i=r.shouldUnregister?t.keepDefaultValues?Me(o):{}:Me(m),p.array.next({values:{...m}}),p.state.next({values:{...m}})}c={mount:t.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!u.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!r.shouldUnregister&&!St(m),s.watch=!!r.shouldUnregister,s.keepIsValid=!!t.keepIsValid,s.action=!1,t.keepErrors||(n.errors={}),p.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!f&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||mt(e,o))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:t.keepDirtyValues?t.keepDefaultValues&&i?Rt(o,i):n.dirtyFields:t.keepDefaultValues&&e?Rt(o,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:o})},j=(e,t)=>F(We(e)?e(i):e,{...r.resetOptions,...t}),$=e=>{n={...n,...e}},B={control:{register:M,unregister:I,getFieldState:O,handleSubmit:L,setError:P,_subscribe:D,_runSchema:w,_updateIsValidating:g,_focusError:z,_getWatch:k,_getDirty:x,_setValid:h,_setFieldArray:(e,t=[],c,l,d=!0,m=!0)=>{if(l&&c&&!r.disabled){if(s.action=!0,m&&Array.isArray($e(a,e))){const t=c($e(a,e),l.argA,l.argB);d&&Ve(a,e,t)}if(m&&Array.isArray($e(n.errors,e))){const t=c($e(n.errors,e),l.argA,l.argB);d&&Ve(n.errors,e,t),((e,t)=>{!Fe($e(e,t)).length&&Tt(e,t)})(n.errors,e)}if((u.touchedFields||f.touchedFields)&&m&&Array.isArray($e(n.touchedFields,e))){const t=c($e(n.touchedFields,e),l.argA,l.argB);d&&Ve(n.touchedFields,e,t)}(u.dirtyFields||f.dirtyFields)&&(n.dirtyFields=Rt(o,i)),p.state.next({name:e,isDirty:x(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Ve(i,e,t)},_setDisabledField:U,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>Fe($e(s.mount?i:o,e,r.shouldUnregister?$e(o,e,[]):[])),_reset:F,_resetDefaultValues:()=>We(r.defaultValues)&&r.defaultValues().then(e=>{j(e,r.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of c.unMount){const t=$e(a,e);t&&(t._f.refs?t._f.refs.every(e=>!Ct(e)):!Ct(t._f.ref))&&I(e)}c.unMount=new Set},_disableForm:e=>{Be(e)&&(p.state.next({disabled:e}),Vt(a,(t,r)=>{const n=$e(a,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach(t=>{t.disabled=n._f.disabled||e}))},0,!1))},_subjects:p,_proxyFormState:u,get _fields(){return a},get _formValues(){return i},get _state(){return s},set _state(e){s=e},get _defaultValues(){return o},get _names(){return c},set _names(e){c=e},get _formState(){return n},get _options(){return r},set _options(e){r={...r,...e}}},subscribe:e=>(s.mount=!0,f={...f,...e.formState},D({...e,formState:{...d,...e.formState}})),trigger:N,register:M,handleSubmit:L,watch:(e,t)=>We(e)?p.state.subscribe({next:r=>"values"in r&&e(k(void 0,t),r)}):k(e,t,!0),setValue:C,getValues:R,reset:j,resetField:(e,t={})=>{$e(a,e)&&(Le(t.defaultValue)?C(e,Me($e(o,e))):(C(e,t.defaultValue),Ve(o,e,Me(t.defaultValue))),t.keepTouched||Tt(n.touchedFields,e),t.keepDirty||(Tt(n.dirtyFields,e),n.isDirty=t.defaultValue?x(e,Me($e(o,e))):x()),t.keepError||(Tt(n.errors,e),u.isValid&&h()),p.state.next({...n}))},clearErrors:e=>{e&&yt(e).forEach(e=>Tt(n.errors,e)),p.state.next({errors:e?n.errors:{}})},unregister:I,setError:P,setFocus:(e,t={})=>{const r=$e(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&We(e.select)&&e.select()})}},getFieldState:O};return{...B,formControl:B}}function Xt(e={}){const t=a.useRef(void 0),r=a.useRef(void 0),[n,o]=a.useState({isDirty:!1,isValidating:!1,isLoading:We(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:We(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!We(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:r,...a}=Yt(e);t.current={...a,formState:n}}const i=t.current.control;return i._options=e,dt(()=>{const e=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(e=>({...e,isReady:!0})),i._formState.isReady=!0,e},[i]),a.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),a.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),a.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),a.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),a.useEffect(()=>{if(i._proxyFormState.isDirty){const e=i._getDirty();e!==n.isDirty&&i._subjects.state.next({isDirty:e})}},[i,n.isDirty]),a.useEffect(()=>{var t;e.values&&!mt(e.values,r.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),(null===(t=i._options.resetOptions)||void 0===t?void 0:t.keepIsValid)||i._setValid(),r.current=e.values,o(e=>({...e}))):i._resetDefaultValues()},[i,e.values]),a.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=lt(n,i),t.current}const Qt=(e,t,r)=>{if(e&&"reportValidity"in e){const n=$e(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},er=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Qt(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>Qt(t,r,e))}},tr=(e,t)=>{t.shouldUseNativeValidation&&er(e,t);const r={};for(const n in e){const a=$e(t.fields,n),o=Object.assign(e[n]||{},{ref:a&&a.ref});if(rr(t.names||Object.keys(e),n)){const e=Object.assign({},$e(r,n));Ve(e,"root",o),Ve(r,n,e)}else Ve(r,n,o)}return r},rr=(e,t)=>{const r=nr(t);return e.some(e=>nr(e).match(`^${r}\\.\\d+`))};function nr(e){return e.replace(/\]|\[/g,"")}function ar(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:i,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);const a=i.prototype,o=Object.keys(a);for(let e=0;e<o.length;e++){const t=o[e];t in r||(r[t]=a[t].bind(r))}}const a=r?.Parent??Object;class o extends a{}function i(e){var t;const a=r?.Parent?new o:this;n(a,e),(t=a._zod).deferred??(t.deferred=[]);for(const e of a._zod.deferred)e();return a}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class or extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ir extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const sr={};function cr(e){return sr}function lr(e){const t=Object.values(e).filter(e=>"number"==typeof e),r=Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t);return r}function dr(e,t){return"bigint"==typeof t?t.toString():t}function ur(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function fr(e){return null==e}function pr(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const mr=Symbol("evaluating");function hr(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==mr)return void 0===n&&(n=mr,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function gr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function vr(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function yr(e){return JSON.stringify(e)}const br="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function wr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Sr=ur(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function xr(e){if(!1===wr(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const r=t.prototype;return!1!==wr(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function kr(e){return xr(e)?{...e}:Array.isArray(e)?[...e]:e}const Ar=new Set(["string","number","symbol"]);function Er(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Cr(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function Tr(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function _r(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!0!==e.issues[r]?.continue)return!0;return!1}function Nr(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function Rr(e){return"string"==typeof e?e:e?.message}function Or(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const a=Rr(e.inst?._zod.def?.error?.(e))??Rr(t?.error?.(e))??Rr(r.customError?.(e))??Rr(r.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Pr(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Dr(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const Ir=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,dr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ur=ar("$ZodError",Ir),Mr=ar("$ZodError",Ir,{Parent:Error});const zr=e=>(t,r,n,a)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new or;if(i.issues.length){const t=new(a?.Err??e)(i.issues.map(e=>Or(e,o,cr())));throw br(t,a?.callee),t}return i.value},Lr=zr(Mr),Fr=e=>async(t,r,n,a)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const t=new(a?.Err??e)(i.issues.map(e=>Or(e,o,cr())));throw br(t,a?.callee),t}return i.value},jr=Fr(Mr),$r=e=>(t,r,n)=>{const a=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new or;return o.issues.length?{success:!1,error:new(e??Ur)(o.issues.map(e=>Or(e,a,cr())))}:{success:!0,data:o.value}},Br=$r(Mr),Wr=e=>async(t,r,n)=>{const a=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},a);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>Or(e,a,cr())))}:{success:!0,data:o.value}},Vr=Wr(Mr),Gr=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return zr(e)(t,r,a)},Kr=e=>(t,r,n)=>zr(e)(t,r,n),Hr=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Fr(e)(t,r,a)},Zr=e=>async(t,r,n)=>Fr(e)(t,r,n),Jr=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return $r(e)(t,r,a)},qr=e=>(t,r,n)=>$r(e)(t,r,n),Yr=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Wr(e)(t,r,a)},Xr=e=>async(t,r,n)=>Wr(e)(t,r,n),Qr=/^[cC][^\s-]{8,}$/,en=/^[0-9a-z]+$/,tn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,rn=/^[0-9a-vA-V]{20}$/,nn=/^[A-Za-z0-9]{27}$/,an=/^[a-zA-Z0-9_-]{21}$/,on=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,sn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,cn=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ln=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const dn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,un=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,fn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,pn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,hn=/^[A-Za-z0-9_-]*$/,gn=/^\+[1-9]\d{6,14}$/,vn="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",yn=new RegExp(`^${vn}$`);function bn(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const wn=/^[^A-Z]*$/,Sn=/^[^a-z]*$/,xn=ar("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),kn=ar("$ZodCheckMaxLength",(e,t)=>{var r;xn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!fr(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const a=Pr(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),An=ar("$ZodCheckMinLength",(e,t)=>{var r;xn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!fr(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const a=Pr(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),En=ar("$ZodCheckLengthEquals",(e,t)=>{var r;xn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!fr(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,a=n.length;if(a===t.length)return;const o=Pr(n),i=a>t.length;r.issues.push({origin:o,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Cn=ar("$ZodCheckStringFormat",(e,t)=>{var r,n;xn.init(e,t),e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Tn=ar("$ZodCheckRegex",(e,t)=>{Cn.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_n=ar("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=wn),Cn.init(e,t)}),Nn=ar("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Sn),Cn.init(e,t)}),Rn=ar("$ZodCheckIncludes",(e,t)=>{xn.init(e,t);const r=Er(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),On=ar("$ZodCheckStartsWith",(e,t)=>{xn.init(e,t);const r=new RegExp(`^${Er(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Pn=ar("$ZodCheckEndsWith",(e,t)=>{xn.init(e,t);const r=new RegExp(`.*${Er(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Dn=ar("$ZodCheckOverwrite",(e,t)=>{xn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class In{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(const e of n)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const Un={major:4,minor:3,patch:5},Mn=ar("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Un;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const t of n)for(const r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,r)=>{let n,a=_r(e);for(const o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(a)continue;const t=e.issues.length,i=o._zod.check(e);if(i instanceof Promise&&!1===r?.async)throw new or;if(n||i instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await i;e.issues.length!==t&&(a||(a=_r(e,t)))});else{if(e.issues.length===t)continue;a||(a=_r(e,t))}}return n?n.then(()=>e):e},r=(r,a,o)=>{if(_r(r))return r.aborted=!0,r;const i=t(a,n,o);if(i instanceof Promise){if(!1===o.async)throw new or;return i.then(t=>e._zod.parse(t,o))}return e._zod.parse(i,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if("backward"===o.direction){const t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,o)):r(t,a,o)}const i=e._zod.parse(a,o);if(i instanceof Promise){if(!1===o.async)throw new or;return i.then(e=>t(e,n,o))}return t(i,n,o)}}hr(e,"~standard",()=>({validate:t=>{try{const r=Br(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return Vr(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),zn=ar("$ZodString",(e,t)=>{var r;Mn.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(r=e._zod.bag,new RegExp(`^${r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ln=ar("$ZodStringFormat",(e,t)=>{Cn.init(e,t),zn.init(e,t)}),Fn=ar("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=sn),Ln.init(e,t)}),jn=ar("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=cn(e))}else t.pattern??(t.pattern=cn());Ln.init(e,t)}),$n=ar("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ln),Ln.init(e,t)}),Bn=ar("$ZodURL",(e,t)=>{Ln.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),a=new URL(n);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),void(t.normalize?r.value=a.href:r.value=n)}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Wn=ar("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ln.init(e,t)}),Vn=ar("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=an),Ln.init(e,t)}),Gn=ar("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Qr),Ln.init(e,t)}),Kn=ar("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=en),Ln.init(e,t)}),Hn=ar("$ZodULID",(e,t)=>{t.pattern??(t.pattern=tn),Ln.init(e,t)}),Zn=ar("$ZodXID",(e,t)=>{t.pattern??(t.pattern=rn),Ln.init(e,t)}),Jn=ar("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=nn),Ln.init(e,t)}),qn=ar("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=bn({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${vn}T(?:${n})$`)}(t)),Ln.init(e,t)}),Yn=ar("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=yn),Ln.init(e,t)}),Xn=ar("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${bn(t)}$`)),Ln.init(e,t)}),Qn=ar("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=on),Ln.init(e,t)}),ea=ar("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=dn),Ln.init(e,t),e._zod.bag.format="ipv4"}),ta=ar("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=un),Ln.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),ra=ar("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=fn),Ln.init(e,t)}),na=ar("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=pn),Ln.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(2!==n.length)throw new Error;const[e,t]=n;if(!t)throw new Error;const r=Number(t);if(`${r}`!==t)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function aa(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const oa=ar("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=mn),Ln.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{aa(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const ia=ar("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=hn),Ln.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!hn.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return aa(t.padEnd(4*Math.ceil(t.length/4),"="))})(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),sa=ar("$ZodE164",(e,t)=>{t.pattern??(t.pattern=gn),Ln.init(e,t)});const ca=ar("$ZodJWT",(e,t)=>{Ln.init(e,t),e._zod.check=r=>{(function(e,t=null){try{const r=e.split(".");if(3!==r.length)return!1;const[n]=r;if(!n)return!1;const a=JSON.parse(atob(n));return!("typ"in a&&"JWT"!==a?.typ||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}})(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),la=ar("$ZodUnknown",(e,t)=>{Mn.init(e,t),e._zod.parse=e=>e}),da=ar("$ZodNever",(e,t)=>{Mn.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function ua(e,t,r){e.issues.length&&t.issues.push(...Nr(r,e.issues)),t.value[r]=e.value}const fa=ar("$ZodArray",(e,t)=>{Mn.init(e,t),e._zod.parse=(r,n)=>{const a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);const o=[];for(let e=0;e<a.length;e++){const i=a[e],s=t.element._zod.run({value:i,issues:[]},n);s instanceof Promise?o.push(s.then(t=>ua(t,r,e))):ua(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function pa(e,t,r,n,a){if(e.issues.length){if(a&&!(r in n))return;t.issues.push(...Nr(r,e.issues))}void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function ma(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const r=(n=e.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function ha(e,t,r,n,a,o){const i=[],s=a.keySet,c=a.catchall._zod,l=c.def.type,d="optional"===c.optout;for(const a in t){if(s.has(a))continue;if("never"===l){i.push(a);continue}const o=c.run({value:t[a],issues:[]},n);o instanceof Promise?e.push(o.then(e=>pa(e,r,a,t,d))):pa(o,r,a,t,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}const ga=ar("$ZodObject",(e,t)=>{Mn.init(e,t);const r=Object.getOwnPropertyDescriptor(t,"shape");if(!r?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}const n=ur(()=>ma(t));hr(e._zod,"propValues",()=>{const e=t.shape,r={};for(const t in e){const n=e[t]._zod;if(n.values){r[t]??(r[t]=new Set);for(const e of n.values)r[t].add(e)}}return r});const a=wr,o=t.catchall;let i;e._zod.parse=(t,r)=>{i??(i=n.value);const s=t.value;if(!a(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const c=[],l=i.shape;for(const e of i.keys){const n=l[e],a="optional"===n._zod.optout,o=n._zod.run({value:s[e],issues:[]},r);o instanceof Promise?c.push(o.then(r=>pa(r,t,e,s,a))):pa(o,t,e,s,a)}return o?ha(c,s,t,r,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),va=ar("$ZodObjectJIT",(e,t)=>{ga.init(e,t);const r=e._zod.parse,n=ur(()=>ma(t));let a;const o=wr,i=!sr.jitless,s=i&&Sr.value,c=t.catchall;let l;e._zod.parse=(d,u)=>{l??(l=n.value);const f=d.value;return o(f)?i&&s&&!1===u?.async&&!0!==u.jitless?(a||(a=(e=>{const t=new In(["shape","payload","ctx"]),r=n.value,a=e=>{const t=yr(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let i=0;for(const e of r.keys)o[e]="key_"+i++;t.write("const newResult = {};");for(const n of r.keys){const r=o[n],i=yr(n),s=e[n],c="optional"===s?._zod?.optout;t.write(`const ${r} = ${a(n)};`),c?t.write(`\n if (${r}.issues.length) {\n if (${i} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${r}.value;\n }\n \n `):t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),d=a(d,u),c?ha([],f,d,u,l,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function ya(e,t,r,n){for(const r of e)if(0===r.issues.length)return t.value=r.value,t;const a=e.filter(e=>!_r(e));return 1===a.length?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>Or(e,n,cr())))}),t)}const ba=ar("$ZodUnion",(e,t)=>{Mn.init(e,t),hr(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),hr(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),hr(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),hr(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>pr(e.source)).join("|")})$`)}});const r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(a,o)=>{if(r)return n(a,o);let i=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},o);if(t instanceof Promise)s.push(t),i=!0;else{if(0===t.issues.length)return t;s.push(t)}}return i?Promise.all(s).then(t=>ya(t,a,e,o)):ya(s,a,e,o)}}),wa=ar("$ZodIntersection",(e,t)=>{Mn.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,a=t.left._zod.run({value:n,issues:[]},r),o=t.right._zod.run({value:n,issues:[]},r);return a instanceof Promise||o instanceof Promise?Promise.all([a,o]).then(([t,r])=>xa(e,t,r)):xa(e,a,o)}});function Sa(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(xr(e)&&xr(t)){const r=Object.keys(t),n=Object.keys(e).filter(e=>-1!==r.indexOf(e)),a={...e,...t};for(const r of n){const n=Sa(e[r],t[r]);if(!n.valid)return{valid:!1,mergeErrorPath:[r,...n.mergeErrorPath]};a[r]=n.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const a=Sa(e[n],t[n]);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function xa(e,t,r){const n=new Map;let a;for(const r of t.issues)if("unrecognized_keys"===r.code){a??(a=r);for(const e of r.keys)n.has(e)||n.set(e,{}),n.get(e).l=!0}else e.issues.push(r);for(const t of r.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)n.has(e)||n.set(e,{}),n.get(e).r=!0;else e.issues.push(t);const o=[...n].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&a&&e.issues.push({...a,keys:o}),_r(e))return e;const i=Sa(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const ka=ar("$ZodEnum",(e,t)=>{Mn.init(e,t);const r=lr(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>Ar.has(typeof e)).map(e=>"string"==typeof e?Er(e):e.toString()).join("|")})$`),e._zod.parse=(t,a)=>{const o=t.value;return n.has(o)||t.issues.push({code:"invalid_value",values:r,input:o,inst:e}),t}}),Aa=ar("$ZodTransform",(e,t)=>{Mn.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new ir(e.constructor.name);const a=t.transform(r.value,r);if(n.async){return(a instanceof Promise?a:Promise.resolve(a)).then(e=>(r.value=e,r))}if(a instanceof Promise)throw new or;return r.value=a,r}});function Ea(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Ca=ar("$ZodOptional",(e,t)=>{Mn.init(e,t),e._zod.optin="optional",e._zod.optout="optional",hr(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),hr(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${pr(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>Ea(t,e.value)):Ea(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),Ta=ar("$ZodExactOptional",(e,t)=>{Ca.init(e,t),hr(e._zod,"values",()=>t.innerType._zod.values),hr(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),_a=ar("$ZodNullable",(e,t)=>{Mn.init(e,t),hr(e._zod,"optin",()=>t.innerType._zod.optin),hr(e._zod,"optout",()=>t.innerType._zod.optout),hr(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${pr(e.source)}|null)$`):void 0}),hr(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),Na=ar("$ZodDefault",(e,t)=>{Mn.init(e,t),e._zod.optin="optional",hr(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>Ra(e,t)):Ra(n,t)}});function Ra(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Oa=ar("$ZodPrefault",(e,t)=>{Mn.init(e,t),e._zod.optin="optional",hr(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),Pa=ar("$ZodNonOptional",(e,t)=>{Mn.init(e,t),hr(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{const a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(t=>Da(t,e)):Da(a,e)}});function Da(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Ia=ar("$ZodCatch",(e,t)=>{Mn.init(e,t),hr(e._zod,"optin",()=>t.innerType._zod.optin),hr(e._zod,"optout",()=>t.innerType._zod.optout),hr(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Or(e,r,cr()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Or(e,r,cr()))},input:e.value}),e.issues=[]),e)}}),Ua=ar("$ZodPipe",(e,t)=>{Mn.init(e,t),hr(e._zod,"values",()=>t.in._zod.values),hr(e._zod,"optin",()=>t.in._zod.optin),hr(e._zod,"optout",()=>t.out._zod.optout),hr(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){const n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>Ma(e,t.in,r)):Ma(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>Ma(e,t.out,r)):Ma(n,t.out,r)}});function Ma(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const za=ar("$ZodReadonly",(e,t)=>{Mn.init(e,t),hr(e._zod,"propValues",()=>t.innerType._zod.propValues),hr(e._zod,"values",()=>t.innerType._zod.values),hr(e._zod,"optin",()=>t.innerType?._zod?.optin),hr(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(La):La(n)}});function La(e){return e.value=Object.freeze(e.value),e}const Fa=ar("$ZodCustom",(e,t)=>{xn.init(e,t),Mn.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{const n=r.value,a=t.fn(n);if(a instanceof Promise)return a.then(t=>ja(t,r,n,e));ja(a,r,n,e)}});function ja(e,t,r,n){if(!e){const e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(Dr(e))}}var $a;class Ba{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}($a=globalThis).__zod_globalRegistry??($a.__zod_globalRegistry=new Ba);const Wa=globalThis.__zod_globalRegistry;function Va(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Tr(t)})}function Ga(e,t){return new kn({check:"max_length",...Tr(t),maximum:e})}function Ka(e,t){return new An({check:"min_length",...Tr(t),minimum:e})}function Ha(e,t){return new En({check:"length_equals",...Tr(t),length:e})}function Za(e){return new Dn({check:"overwrite",tx:e})}function Ja(e){const t=function(e,t){const r=new xn({check:"custom",...Tr(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(Dr(e,r.value,t._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(Dr(n))}},e(r.value,r)));return t}function qa(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Wa,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Ya(e,t,r={path:[],schemaPath:[]}){var n;const a=e._zod.def,o=t.seen.get(e);if(o){o.count++;return r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema}const i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);const s=e._zod.toJSONSchema?.();if(s)i.schema=s;else{const n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,n);else{const r=i.schema,o=t.processors[a.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);o(e,t,r,n)}const o=e._zod.parent;o&&(i.ref||(i.ref=o),Ya(o,t,n),t.seen.get(o).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(i.schema,c),"input"===t.io&&eo(e)&&(delete i.schema.examples,delete i.schema.default),"input"===t.io&&i.schema._prefault&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault;return t.seen.get(e).schema}function Xa(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const t of e.seen.entries()){const r=e.metadataRegistry.get(t[0])?.id;if(r){const e=n.get(r);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(r,t[0])}}const a=t=>{if(t[1].schema.$ref)return;const n=t[1],{ref:a,defId:o}=(t=>{const n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const r=e.external.registry.get(t[0])?.id,a=e.external.uri??(e=>e);if(r)return{ref:a(r)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${a("__shared")}#/${n}/${o}`}}if(t[1]===r)return{ref:"#"};const a=`#/${n}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:a+o}})(t);n.def={...n.schema},o&&(n.defId=o);const i=n.schema;for(const e in i)delete i[e];i.$ref=a};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const r of e.seen.entries()){const n=r[1];if(t===r[0]){a(r);continue}if(e.external){const n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){a(r);continue}}const o=e.metadataRegistry.get(r[0])?.id;o?a(r):(n.cycle||n.count>1&&"ref"===e.reused)&&a(r)}}function Qa(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=t=>{const r=e.seen.get(t);if(null===r.ref)return;const a=r.def??r.schema,o={...a},i=r.ref;if(r.ref=null,i){n(i);const r=e.seen.get(i),s=r.schema;!s.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(a,s):(a.allOf=a.allOf??[],a.allOf.push(s)),Object.assign(a,o);if(t._zod.parent===i)for(const e in a)"$ref"!==e&&"allOf"!==e&&(e in o||delete a[e]);if(s.$ref)for(const e in a)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(a[e])===JSON.stringify(r.def[e])&&delete a[e]}const s=t._zod.parent;if(s&&s!==i){n(s);const t=e.seen.get(s);if(t?.schema.$ref&&(a.$ref=t.schema.$ref,t.def))for(const e in a)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(a[e])===JSON.stringify(t.def[e])&&delete a[e]}e.override({zodSchema:t,jsonSchema:a,path:r.path??[]})};for(const t of[...e.seen.entries()].reverse())n(t[0]);const a={};if("draft-2020-12"===e.target?a.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?a.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const r=e.external.registry.get(t)?.id;if(!r)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(r)}Object.assign(a,r.def??r.schema);const o=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?a.$defs=o:a.definitions=o);try{const r=JSON.parse(JSON.stringify(a));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:to(t,"input",e.processors),output:to(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw new Error("Error converting schema to JSON.")}}function eo(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if("transform"===n.type)return!0;if("array"===n.type)return eo(n.element,r);if("set"===n.type)return eo(n.valueType,r);if("lazy"===n.type)return eo(n.getter(),r);if("promise"===n.type||"optional"===n.type||"nonoptional"===n.type||"nullable"===n.type||"readonly"===n.type||"default"===n.type||"prefault"===n.type)return eo(n.innerType,r);if("intersection"===n.type)return eo(n.left,r)||eo(n.right,r);if("record"===n.type||"map"===n.type)return eo(n.keyType,r)||eo(n.valueType,r);if("pipe"===n.type)return eo(n.in,r)||eo(n.out,r);if("object"===n.type){for(const e in n.shape)if(eo(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if(eo(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if(eo(e,r))return!0;return!(!n.rest||!eo(n.rest,r))}return!1}const to=(e,t,r={})=>n=>{const{libraryOptions:a,target:o}=n??{},i=qa({...a??{},target:o,io:t,processors:r});return Ya(e,i),Xa(i,e),Qa(i,e)},ro={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},no=(e,t,r,n)=>{const a=e._zod.def;Ya(a.innerType,t,n);t.seen.get(e).ref=a.innerType};function ao(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function oo(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var s=n.unionErrors[0].errors[0];r[i]={message:s.message,type:s.code}}else r[i]={message:o,type:a};if("unionErrors"in n&&n.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=vt(i,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function io(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("invalid_union"===n.code&&n.errors.length>0){var s=n.errors[0][0];r[i]={message:s.message,type:s.code}}else r[i]={message:o,type:a};if("invalid_union"===n.code&&n.errors.forEach(function(t){return t.forEach(function(t){return e.push(t)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=vt(i,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function so(e,t,r){if(void 0===r&&(r={}),function(e){return"_def"in e&&"object"==typeof e._def&&"typeName"in e._def}(e))return function(n,a,o){try{return Promise.resolve(ao(function(){return Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then(function(e){return o.shouldUseNativeValidation&&er({},o),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return Array.isArray(null==e?void 0:e.issues)}(e))return{values:{},errors:tr(oo(e.errors,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return"_zod"in e&&"object"==typeof e._zod}(e))return function(n,a,o){try{return Promise.resolve(ao(function(){return Promise.resolve(("sync"===r.mode?Lr:jr)(e,n,t)).then(function(e){return o.shouldUseNativeValidation&&er({},o),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return e instanceof Ur}(e))return{values:{},errors:tr(io(e.issues,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}};throw new Error("Invalid input: not a Zod schema")}
2
2
  /**
3
3
  * @license lucide-react v0.544.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
6
6
  * See the LICENSE file in the root directory of this source tree.
7
- */const eo=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),to=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},ro=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),no=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
7
+ */const co=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),lo=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},uo=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),fo=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
8
8
  /**
9
9
  * @license lucide-react v0.544.0 - ISC
10
10
  *
11
11
  * This source code is licensed under the ISC license.
12
12
  * See the LICENSE file in the root directory of this source tree.
13
13
  */
14
- var ao={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};
14
+ var po={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};
15
15
  /**
16
16
  * @license lucide-react v0.544.0 - ISC
17
17
  *
18
18
  * This source code is licensed under the ISC license.
19
19
  * See the LICENSE file in the root directory of this source tree.
20
- */const oo=f(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:o,iconNode:i,...s},c)=>p("svg",{ref:c,...ao,width:t,height:t,stroke:e,strokeWidth:n?24*Number(r)/Number(t):r,className:ro("lucide",a),...!o&&!no(s)&&{"aria-hidden":"true"},...s},[...i.map(([e,t])=>p(e,t)),...Array.isArray(o)?o:[o]])),io=(e,t)=>{const r=f(({className:r,...n},a)=>p(oo,{ref:a,iconNode:t,className:ro(`lucide-${eo(to(e))}`,`lucide-${e}`,r),...n}));return r.displayName=to(e),r},so=io("building-2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]),co=io("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]),lo=io("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]),uo=io("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),fo=io("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),po=io("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),mo=io("refresh-ccw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]),ho=io("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),go=io("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),vo=io("smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]),bo=io("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),yo=io("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),wo=io("trash",[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),xo=io("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),So=io("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),ko=io("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),Ao=or("ZodISODateTime",(e,t)=>{Yn.init(e,t),qo.init(e,t)});
20
+ */const mo=f(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:o,iconNode:i,...s},c)=>p("svg",{ref:c,...po,width:t,height:t,stroke:e,strokeWidth:n?24*Number(r)/Number(t):r,className:uo("lucide",a),...!o&&!fo(s)&&{"aria-hidden":"true"},...s},[...i.map(([e,t])=>p(e,t)),...Array.isArray(o)?o:[o]])),ho=(e,t)=>{const r=f(({className:r,...n},a)=>p(mo,{ref:a,iconNode:t,className:uo(`lucide-${co(lo(e))}`,`lucide-${e}`,r),...n}));return r.displayName=lo(e),r},go=ho("building-2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]),vo=ho("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]),yo=ho("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]),bo=ho("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),wo=ho("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),So=ho("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),xo=ho("refresh-ccw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]),ko=ho("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),Ao=ho("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),Eo=ho("smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]),Co=ho("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),To=ho("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),_o=ho("trash",[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),No=ho("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Ro=ho("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),Oo=ho("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),Po=ar("ZodISODateTime",(e,t)=>{qn.init(e,t),ni.init(e,t)});
21
21
  /**
22
22
  * @license lucide-react v0.544.0 - ISC
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
26
- */function Eo(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Tr(t)})}(Ao,e)}const Co=or("ZodISODate",(e,t)=>{Xn.init(e,t),qo.init(e,t)});function To(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...Tr(t)})}(Co,e)}const No=or("ZodISOTime",(e,t)=>{Qn.init(e,t),qo.init(e,t)});function _o(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Tr(t)})}(No,e)}const Ro=or("ZodISODuration",(e,t)=>{ea.init(e,t),qo.init(e,t)});function Po(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...Tr(t)})}(Ro,e)}const Oo=or("ZodError",(e,t)=>{Ur.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const r=t||function(e){return e.message},n={_errors:[]},a=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map(e=>a({issues:e}));else if("invalid_key"===t.code)a({issues:t.issues});else if("invalid_element"===t.code)a({issues:t.issues});else if(0===t.path.length)n._errors.push(r(t));else{let e=n,a=0;for(;a<t.path.length;){const n=t.path[a];a===t.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(r(t))):e[n]=e[n]||{_errors:[]},e=e[n],a++}}};return a(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const r={},n=[];for(const a of e.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:r}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,dr,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,dr,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),Do=Lr(Oo),Io=zr(Oo),Uo=Br(Oo),Mo=Vr(Oo),Lo=Gr(Oo),Fo=Kr(Oo),zo=Hr(Oo),jo=Zr(Oo),Bo=qr(Oo),Wo=Jr(Oo),Vo=Yr(Oo),$o=Xr(Oo),Go=or("ZodType",(e,t)=>(Ln.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),e.clone=(t,r)=>Cr(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>Do(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>Uo(e,t,r),e.parseAsync=async(t,r)=>Io(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>Mo(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>Lo(e,t,r),e.decode=(t,r)=>Fo(e,t,r),e.encodeAsync=async(t,r)=>zo(e,t,r),e.decodeAsync=async(t,r)=>jo(e,t,r),e.safeEncode=(t,r)=>Bo(e,t,r),e.safeDecode=(t,r)=>Wo(e,t,r),e.safeEncodeAsync=async(t,r)=>Vo(e,t,r),e.safeDecodeAsync=async(t,r)=>$o(e,t,r),e.refine=(t,r)=>e.check(function(e,t={}){return function(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Tr(r)})}(Li,e,t)}(t,r)),e.superRefine=t=>e.check(qa(t)),e.overwrite=t=>e.check(Za(t)),e.optional=()=>Ti(e),e.nullable=()=>_i(e),e.nullish=()=>Ti(_i(e)),e.nonoptional=t=>function(e,t){return new Oi({type:"nonoptional",innerType:e,...Tr(t)})}(e,t),e.array=()=>{return function(e,t,r){return new e({type:"array",element:t,...Tr(r)})}(yi,e,t);var t},e.or=t=>function(e,t){return new Si({type:"union",options:e,...Tr(t)})}([e,t]),e.and=t=>new ki({type:"intersection",left:e,right:t}),e.transform=t=>Ui(e,new Ei({type:"transform",transform:t})),e.default=t=>{return r=t,new Ri({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():kr(r)}});var r},e.prefault=t=>{return r=t,new Pi({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():kr(r)}});var r},e.catch=t=>{return new Di({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>Ui(e,t),e.readonly=()=>new Mi({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return Va.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Va.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Va.get(e);const r=e.clone();return Va.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Ko=or("_ZodString",(e,t)=>{Fn.init(e,t),Go.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new Nn({check:"string_format",format:"regex",...Tr(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Pn({check:"string_format",format:"includes",...Tr(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new On({check:"string_format",format:"starts_with",...Tr(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Dn({check:"string_format",format:"ends_with",...Tr(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Ka(...t)),e.max=(...t)=>e.check(Ga(...t)),e.length=(...t)=>e.check(Ha(...t)),e.nonempty=(...t)=>e.check(Ka(1,...t)),e.lowercase=t=>e.check(function(e){return new _n({check:"string_format",format:"lowercase",...Tr(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Rn({check:"string_format",format:"uppercase",...Tr(e)})}(t)),e.trim=()=>e.check(Za(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Za(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Za(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Za(e=>e.toUpperCase()))}),Ho=or("ZodString",(e,t)=>{Fn.init(e,t),Ko.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Tr(t)})}(Jo,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Tr(t)})}(Qo,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Tr(t)})}(mi,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Tr(t)})}(ei,t)),e.guid=t=>e.check($a(Yo,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Tr(t)})}(Xo,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Tr(t)})}(Xo,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Tr(t)})}(Xo,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Tr(t)})}(Xo,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Tr(t)})}(ti,t)),e.guid=t=>e.check($a(Yo,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Tr(t)})}(ri,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Tr(t)})}(ni,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Tr(t)})}(ai,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Tr(t)})}(ui,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Tr(t)})}(fi,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Tr(t)})}(oi,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Tr(t)})}(ii,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Tr(t)})}(si,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Tr(t)})}(ci,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Tr(t)})}(li,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Tr(t)})}(di,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Tr(t)})}(pi,t)),e.datetime=t=>e.check(Eo(t)),e.date=t=>e.check(To(t)),e.time=t=>e.check(_o(t)),e.duration=t=>e.check(Po(t))});function Zo(e){return function(e,t){return new e({type:"string",...Tr(t)})}(Ho,e)}const qo=or("ZodStringFormat",(e,t)=>{zn.init(e,t),Ko.init(e,t)}),Jo=or("ZodEmail",(e,t)=>{Wn.init(e,t),qo.init(e,t)}),Yo=or("ZodGUID",(e,t)=>{jn.init(e,t),qo.init(e,t)}),Xo=or("ZodUUID",(e,t)=>{Bn.init(e,t),qo.init(e,t)}),Qo=or("ZodURL",(e,t)=>{Vn.init(e,t),qo.init(e,t)}),ei=or("ZodEmoji",(e,t)=>{$n.init(e,t),qo.init(e,t)}),ti=or("ZodNanoID",(e,t)=>{Gn.init(e,t),qo.init(e,t)}),ri=or("ZodCUID",(e,t)=>{Kn.init(e,t),qo.init(e,t)}),ni=or("ZodCUID2",(e,t)=>{Hn.init(e,t),qo.init(e,t)}),ai=or("ZodULID",(e,t)=>{Zn.init(e,t),qo.init(e,t)}),oi=or("ZodXID",(e,t)=>{qn.init(e,t),qo.init(e,t)}),ii=or("ZodKSUID",(e,t)=>{Jn.init(e,t),qo.init(e,t)}),si=or("ZodIPv4",(e,t)=>{ta.init(e,t),qo.init(e,t)}),ci=or("ZodIPv6",(e,t)=>{ra.init(e,t),qo.init(e,t)}),li=or("ZodCIDRv4",(e,t)=>{na.init(e,t),qo.init(e,t)}),di=or("ZodCIDRv6",(e,t)=>{aa.init(e,t),qo.init(e,t)}),ui=or("ZodBase64",(e,t)=>{ia.init(e,t),qo.init(e,t)}),fi=or("ZodBase64URL",(e,t)=>{sa.init(e,t),qo.init(e,t)}),pi=or("ZodE164",(e,t)=>{ca.init(e,t),qo.init(e,t)}),mi=or("ZodJWT",(e,t)=>{la.init(e,t),qo.init(e,t)}),hi=or("ZodUnknown",(e,t)=>{da.init(e,t),Go.init(e,t)});function gi(){return new hi({type:"unknown"})}const vi=or("ZodNever",(e,t)=>{ua.init(e,t),Go.init(e,t)});function bi(e){return function(e,t){return new e({type:"never",...Tr(t)})}(vi,e)}const yi=or("ZodArray",(e,t)=>{pa.init(e,t),Go.init(e,t),e.element=t.element,e.min=(t,r)=>e.check(Ka(t,r)),e.nonempty=t=>e.check(Ka(1,t)),e.max=(t,r)=>e.check(Ga(t,r)),e.length=(t,r)=>e.check(Ha(t,r)),e.unwrap=()=>e.element});const wi=or("ZodObject",(e,t)=>{ba.init(e,t),Go.init(e,t),hr(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Ai({type:"enum",entries:r,...Tr(t)})}(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:gi()}),e.loose=()=>e.clone({...e._zod.def,catchall:gi()}),e.strict=()=>e.clone({...e._zod.def,catchall:bi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!Sr(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const n=vr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return gr(this,"shape",r),r},checks:[]});return Cr(e,n)}(e,t),e.safeExtend=t=>function(e,t){if(!Sr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return gr(this,"shape",r),r},checks:e._zod.def.checks};return Cr(e,r)}(e,t),e.merge=t=>function(e,t){const r=vr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return gr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Cr(e,r)}(e,t),e.pick=t=>function(e,t){const r=e._zod.def;return Cr(e,vr(e._zod.def,{get shape(){const e={};for(const n in t){if(!(n in r.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return gr(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const r=e._zod.def,n=vr(e._zod.def,{get shape(){const n={...e._zod.def.shape};for(const e in t){if(!(e in r.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return gr(this,"shape",n),n},checks:[]});return Cr(e,n)}(e,t),e.partial=(...t)=>function(e,t,r){const n=vr(t._zod.def,{get shape(){const n=t._zod.def.shape,a={...n};if(r)for(const t in r){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(const t in n)a[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return gr(this,"shape",a),a},checks:[]});return Cr(t,n)}(Ci,e,t[0]),e.required=(...t)=>function(e,t,r){const n=vr(t._zod.def,{get shape(){const n=t._zod.def.shape,a={...n};if(r)for(const t in r){if(!(t in a))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(const t in n)a[t]=new e({type:"nonoptional",innerType:n[t]});return gr(this,"shape",a),a},checks:[]});return Cr(t,n)}(Oi,e,t[0])});function xi(e,t){const r={type:"object",get shape(){var t;return gr(this,"shape",e?(t=e,Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))):{}),this.shape},...Tr(t)};return new wi(r)}const Si=or("ZodUnion",(e,t)=>{wa.init(e,t),Go.init(e,t),e.options=t.options});const ki=or("ZodIntersection",(e,t)=>{xa.init(e,t),Go.init(e,t)});const Ai=or("ZodEnum",(e,t)=>{Aa.init(e,t),Go.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{const a={};for(const n of e){if(!r.has(n))throw new Error(`Key ${n} not found in enum`);a[n]=t.entries[n]}return new Ai({...t,checks:[],...Tr(n),entries:a})},e.exclude=(e,n)=>{const a={...t.entries};for(const t of e){if(!r.has(t))throw new Error(`Key ${t} not found in enum`);delete a[t]}return new Ai({...t,checks:[],...Tr(n),entries:a})}});const Ei=or("ZodTransform",(e,t)=>{Ea.init(e,t),Go.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new sr(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(Dr(n,r.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),r.issues.push(Dr(t))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});const Ci=or("ZodOptional",(e,t)=>{Ta.init(e,t),Go.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ti(e){return new Ci({type:"optional",innerType:e})}const Ni=or("ZodNullable",(e,t)=>{Na.init(e,t),Go.init(e,t),e.unwrap=()=>e._zod.def.innerType});function _i(e){return new Ni({type:"nullable",innerType:e})}const Ri=or("ZodDefault",(e,t)=>{_a.init(e,t),Go.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const Pi=or("ZodPrefault",(e,t)=>{Pa.init(e,t),Go.init(e,t),e.unwrap=()=>e._zod.def.innerType});const Oi=or("ZodNonOptional",(e,t)=>{Oa.init(e,t),Go.init(e,t),e.unwrap=()=>e._zod.def.innerType});const Di=or("ZodCatch",(e,t)=>{Ia.init(e,t),Go.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const Ii=or("ZodPipe",(e,t)=>{Ua.init(e,t),Go.init(e,t),e.in=t.in,e.out=t.out});function Ui(e,t){return new Ii({type:"pipe",in:e,out:t})}const Mi=or("ZodReadonly",(e,t)=>{La.init(e,t),Go.init(e,t),e.unwrap=()=>e._zod.def.innerType});const Li=or("ZodCustom",(e,t)=>{za.init(e,t),Go.init(e,t)});function Fi(e,r=[]){let a=[];const o=()=>{const t=a.map(e=>n.createContext(e));return function(r){const a=r?.[e]||t;return n.useMemo(()=>({[`__scope${e}`]:{...r,[e]:a}}),[r,a])}};return o.scopeName=e,[function(r,o){const i=n.createContext(o),s=a.length;a=[...a,o];const c=r=>{const{scope:a,children:o,...c}=r,l=a?.[e]?.[s]||i,d=n.useMemo(()=>c,Object.values(c));return t(l.Provider,{value:d,children:o})};return c.displayName=r+"Provider",[c,function(t,a){const c=a?.[e]?.[s]||i,l=n.useContext(c);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${r}\``)}]},zi(o,...r)]}function zi(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const a=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return n.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}function ji(e){const t=n.useRef(e);return n.useEffect(()=>{t.current=e}),n.useMemo(()=>(...e)=>t.current?.(...e),[])}var Bi=globalThis?.document?n.useLayoutEffect:()=>{};function Wi(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Vi(...e){return t=>{let r=!1;const n=e.map(e=>{const n=Wi(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){const r=n[t];"function"==typeof r?r():Wi(e[t],null)}}}}function $i(...e){return n.useCallback(Vi(...e),e)}function Gi(e){const r=Hi(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(qi);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}var Ki=Gi("Slot");function Hi(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?Vi(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Zi=Symbol("radix.slottable");function qi(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Zi}var Ji=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=Gi(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{});var Yi,Xi={exports:{}},Qi={};function es(){if(Yi)return Qi;Yi=1;var e=a;var t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=e.useState,n=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function s(e){var r=e.getSnapshot;e=e.value;try{var n=r();return!t(e,n)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var a=t(),c=r({inst:{value:a,getSnapshot:t}}),l=c[0].inst,d=c[1];return o(function(){l.value=a,l.getSnapshot=t,s(l)&&d({inst:l})},[e,a,t]),n(function(){return s(l)&&d({inst:l}),e(function(){s(l)&&d({inst:l})})},[e]),i(a),a};return Qi.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:c,Qi}var ts,rs,ns={};
26
+ */function Do(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Tr(t)})}(Po,e)}const Io=ar("ZodISODate",(e,t)=>{Yn.init(e,t),ni.init(e,t)});function Uo(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...Tr(t)})}(Io,e)}const Mo=ar("ZodISOTime",(e,t)=>{Xn.init(e,t),ni.init(e,t)});function zo(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Tr(t)})}(Mo,e)}const Lo=ar("ZodISODuration",(e,t)=>{Qn.init(e,t),ni.init(e,t)});function Fo(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...Tr(t)})}(Lo,e)}const jo=ar("ZodError",(e,t)=>{Ur.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const r={_errors:[]},n=e=>{for(const a of e.issues)if("invalid_union"===a.code&&a.errors.length)a.errors.map(e=>n({issues:e}));else if("invalid_key"===a.code)n({issues:a.issues});else if("invalid_element"===a.code)n({issues:a.issues});else if(0===a.path.length)r._errors.push(t(a));else{let e=r,n=0;for(;n<a.path.length;){const r=a.path[n];n===a.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(a))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(e),r}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const r={},n=[];for(const a of e.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:r}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,dr,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,dr,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),$o=zr(jo),Bo=Fr(jo),Wo=$r(jo),Vo=Wr(jo),Go=Gr(jo),Ko=Kr(jo),Ho=Hr(jo),Zo=Zr(jo),Jo=Jr(jo),qo=qr(jo),Yo=Yr(jo),Xo=Xr(jo),Qo=ar("ZodType",(e,t)=>(Mn.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:to(e,"input"),output:to(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{const n=qa({...r,processors:t});return Ya(e,n),Xa(n,e),Qa(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(vr(t,{checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,r)=>Cr(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>$o(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>Wo(e,t,r),e.parseAsync=async(t,r)=>Bo(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>Vo(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>Go(e,t,r),e.decode=(t,r)=>Ko(e,t,r),e.encodeAsync=async(t,r)=>Ho(e,t,r),e.decodeAsync=async(t,r)=>Zo(e,t,r),e.safeEncode=(t,r)=>Jo(e,t,r),e.safeDecode=(t,r)=>qo(e,t,r),e.safeEncodeAsync=async(t,r)=>Yo(e,t,r),e.safeDecodeAsync=async(t,r)=>Xo(e,t,r),e.refine=(t,r)=>e.check(function(e,t={}){return function(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Tr(r)})}(Ki,e,t)}(t,r)),e.superRefine=t=>e.check(Ja(t)),e.overwrite=t=>e.check(Za(t)),e.optional=()=>Ui(e),e.exactOptional=()=>new Mi({type:"optional",innerType:e}),e.nullable=()=>Li(e),e.nullish=()=>Ui(Li(e)),e.nonoptional=t=>function(e,t){return new $i({type:"nonoptional",innerType:e,...Tr(t)})}(e,t),e.array=()=>{return function(e,t,r){return new e({type:"array",element:t,...Tr(r)})}(Ti,e,t);var t},e.or=t=>function(e,t){return new Ri({type:"union",options:e,...Tr(t)})}([e,t]),e.and=t=>new Oi({type:"intersection",left:e,right:t}),e.transform=t=>Vi(e,new Di({type:"transform",transform:t})),e.default=t=>{return r=t,new Fi({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():kr(r)}});var r},e.prefault=t=>{return r=t,new ji({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():kr(r)}});var r},e.catch=t=>{return new Bi({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>Vi(e,t),e.readonly=()=>new Gi({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return Wa.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Wa.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Wa.get(e);const r=e.clone();return Wa.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),ei=ar("_ZodString",(e,t)=>{zn.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r;n.type="string";const{minimum:a,maximum:o,format:i,patterns:s,contentEncoding:c}=e._zod.bag;if("number"==typeof a&&(n.minLength=a),"number"==typeof o&&(n.maxLength=o),i&&(n.format=ro[i]??i,""===n.format&&delete n.format,"time"===i&&delete n.format),c&&(n.contentEncoding=c),s&&s.size>0){const e=[...s];1===e.length?n.pattern=e[0].source:e.length>1&&(n.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new Tn({check:"string_format",format:"regex",...Tr(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Rn({check:"string_format",format:"includes",...Tr(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new On({check:"string_format",format:"starts_with",...Tr(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Pn({check:"string_format",format:"ends_with",...Tr(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Ka(...t)),e.max=(...t)=>e.check(Ga(...t)),e.length=(...t)=>e.check(Ha(...t)),e.nonempty=(...t)=>e.check(Ka(1,...t)),e.lowercase=t=>e.check(function(e){return new _n({check:"string_format",format:"lowercase",...Tr(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Nn({check:"string_format",format:"uppercase",...Tr(e)})}(t)),e.trim=()=>e.check(Za(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Za(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Za(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Za(e=>e.toUpperCase())),e.slugify=()=>e.check(Za(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),ti=ar("ZodString",(e,t)=>{zn.init(e,t),ei.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Tr(t)})}(ai,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Tr(t)})}(si,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Tr(t)})}(xi,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Tr(t)})}(ci,t)),e.guid=t=>e.check(Va(oi,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Tr(t)})}(ii,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Tr(t)})}(ii,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Tr(t)})}(ii,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Tr(t)})}(ii,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Tr(t)})}(li,t)),e.guid=t=>e.check(Va(oi,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Tr(t)})}(di,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Tr(t)})}(ui,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Tr(t)})}(fi,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Tr(t)})}(bi,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Tr(t)})}(wi,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Tr(t)})}(pi,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Tr(t)})}(mi,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Tr(t)})}(hi,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Tr(t)})}(gi,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Tr(t)})}(vi,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Tr(t)})}(yi,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Tr(t)})}(Si,t)),e.datetime=t=>e.check(Do(t)),e.date=t=>e.check(Uo(t)),e.time=t=>e.check(zo(t)),e.duration=t=>e.check(Fo(t))});function ri(e){return function(e,t){return new e({type:"string",...Tr(t)})}(ti,e)}const ni=ar("ZodStringFormat",(e,t)=>{Ln.init(e,t),ei.init(e,t)}),ai=ar("ZodEmail",(e,t)=>{$n.init(e,t),ni.init(e,t)}),oi=ar("ZodGUID",(e,t)=>{Fn.init(e,t),ni.init(e,t)}),ii=ar("ZodUUID",(e,t)=>{jn.init(e,t),ni.init(e,t)}),si=ar("ZodURL",(e,t)=>{Bn.init(e,t),ni.init(e,t)}),ci=ar("ZodEmoji",(e,t)=>{Wn.init(e,t),ni.init(e,t)}),li=ar("ZodNanoID",(e,t)=>{Vn.init(e,t),ni.init(e,t)}),di=ar("ZodCUID",(e,t)=>{Gn.init(e,t),ni.init(e,t)}),ui=ar("ZodCUID2",(e,t)=>{Kn.init(e,t),ni.init(e,t)}),fi=ar("ZodULID",(e,t)=>{Hn.init(e,t),ni.init(e,t)}),pi=ar("ZodXID",(e,t)=>{Zn.init(e,t),ni.init(e,t)}),mi=ar("ZodKSUID",(e,t)=>{Jn.init(e,t),ni.init(e,t)}),hi=ar("ZodIPv4",(e,t)=>{ea.init(e,t),ni.init(e,t)}),gi=ar("ZodIPv6",(e,t)=>{ta.init(e,t),ni.init(e,t)}),vi=ar("ZodCIDRv4",(e,t)=>{ra.init(e,t),ni.init(e,t)}),yi=ar("ZodCIDRv6",(e,t)=>{na.init(e,t),ni.init(e,t)}),bi=ar("ZodBase64",(e,t)=>{oa.init(e,t),ni.init(e,t)}),wi=ar("ZodBase64URL",(e,t)=>{ia.init(e,t),ni.init(e,t)}),Si=ar("ZodE164",(e,t)=>{sa.init(e,t),ni.init(e,t)}),xi=ar("ZodJWT",(e,t)=>{ca.init(e,t),ni.init(e,t)}),ki=ar("ZodUnknown",(e,t)=>{la.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function Ai(){return new ki({type:"unknown"})}const Ei=ar("ZodNever",(e,t)=>{da.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});function Ci(e){return function(e,t){return new e({type:"never",...Tr(t)})}(Ei,e)}const Ti=ar("ZodArray",(e,t)=>{fa.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,o=e._zod.def,{minimum:i,maximum:s}=e._zod.bag;"number"==typeof i&&(a.minItems=i),"number"==typeof s&&(a.maxItems=s),a.type="array",a.items=Ya(o.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,e.min=(t,r)=>e.check(Ka(t,r)),e.nonempty=t=>e.check(Ka(1,t)),e.max=(t,r)=>e.check(Ga(t,r)),e.length=(t,r)=>e.check(Ha(t,r)),e.unwrap=()=>e.element});const _i=ar("ZodObject",(e,t)=>{va.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,o=e._zod.def;a.type="object",a.properties={};const i=o.shape;for(const e in i)a.properties[e]=Ya(i[e],t,{...n,path:[...n.path,"properties",e]});const s=new Set(Object.keys(i)),c=new Set([...s].filter(e=>{const r=o.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));c.size>0&&(a.required=Array.from(c)),"never"===o.catchall?._zod.def.type?a.additionalProperties=!1:o.catchall?o.catchall&&(a.additionalProperties=Ya(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(a.additionalProperties=!1)})(e,t,r,n),hr(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Pi({type:"enum",entries:r,...Tr(t)})}(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ai()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ai()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ci()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!xr(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const r=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const n=vr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return gr(this,"shape",r),r}});return Cr(e,n)}(e,t),e.safeExtend=t=>function(e,t){if(!xr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=vr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return gr(this,"shape",r),r}});return Cr(e,r)}(e,t),e.merge=t=>function(e,t){const r=vr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return gr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Cr(e,r)}(e,t),e.pick=t=>function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return Cr(e,vr(e._zod.def,{get shape(){const e={};for(const n in t){if(!(n in r.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return gr(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const a=vr(e._zod.def,{get shape(){const n={...e._zod.def.shape};for(const e in t){if(!(e in r.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return gr(this,"shape",n),n},checks:[]});return Cr(e,a)}(e,t),e.partial=(...t)=>function(e,t,r){const n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=vr(t._zod.def,{get shape(){const n=t._zod.def.shape,a={...n};if(r)for(const t in r){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(const t in n)a[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return gr(this,"shape",a),a},checks:[]});return Cr(t,a)}(Ii,e,t[0]),e.required=(...t)=>function(e,t,r){const n=vr(t._zod.def,{get shape(){const n=t._zod.def.shape,a={...n};if(r)for(const t in r){if(!(t in a))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(const t in n)a[t]=new e({type:"nonoptional",innerType:n[t]});return gr(this,"shape",a),a}});return Cr(t,n)}($i,e,t[0])});function Ni(e,t){const r={type:"object",shape:e??{},...Tr(t)};return new _i(r)}const Ri=ar("ZodUnion",(e,t)=>{ba.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=!1===a.inclusive,i=a.options.map((e,r)=>Ya(e,t,{...n,path:[...n.path,o?"oneOf":"anyOf",r]}));o?r.oneOf=i:r.anyOf=i})(e,t,r,n),e.options=t.options});const Oi=ar("ZodIntersection",(e,t)=>{wa.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=Ya(a.left,t,{...n,path:[...n.path,"allOf",0]}),i=Ya(a.right,t,{...n,path:[...n.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length,c=[...s(o)?o.allOf:[o],...s(i)?i.allOf:[i]];r.allOf=c})(e,t,r,n)});const Pi=ar("ZodEnum",(e,t)=>{ka.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=lr(e._zod.def.entries);n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=n})(e,0,r),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{const a={};for(const n of e){if(!r.has(n))throw new Error(`Key ${n} not found in enum`);a[n]=t.entries[n]}return new Pi({...t,checks:[],...Tr(n),entries:a})},e.exclude=(e,n)=>{const a={...t.entries};for(const t of e){if(!r.has(t))throw new Error(`Key ${t} not found in enum`);delete a[t]}return new Pi({...t,checks:[],...Tr(n),entries:a})}});const Di=ar("ZodTransform",(e,t)=>{Aa.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new ir(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(Dr(n,r.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),r.issues.push(Dr(t))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});const Ii=ar("ZodOptional",(e,t)=>{Ca.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>no(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function Ui(e){return new Ii({type:"optional",innerType:e})}const Mi=ar("ZodExactOptional",(e,t)=>{Ta.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>no(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const zi=ar("ZodNullable",(e,t)=>{_a.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=Ya(a.innerType,t,n),i=t.seen.get(e);"openapi-3.0"===t.target?(i.ref=a.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function Li(e){return new zi({type:"nullable",innerType:e})}const Fi=ar("ZodDefault",(e,t)=>{Na.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ya(a.innerType,t,n),t.seen.get(e).ref=a.innerType,r.default=JSON.parse(JSON.stringify(a.defaultValue))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const ji=ar("ZodPrefault",(e,t)=>{Oa.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ya(a.innerType,t,n),t.seen.get(e).ref=a.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(a.defaultValue)))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});const $i=ar("ZodNonOptional",(e,t)=>{Pa.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ya(a.innerType,t,n),t.seen.get(e).ref=a.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const Bi=ar("ZodCatch",(e,t)=>{Ia.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;let o;Ya(a.innerType,t,n),t.seen.get(e).ref=a.innerType;try{o=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=o})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const Wi=ar("ZodPipe",(e,t)=>{Ua.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o="input"===t.io?"transform"===a.in._zod.def.type?a.out:a.in:a.out;Ya(o,t,n),t.seen.get(e).ref=o})(e,t,0,n),e.in=t.in,e.out=t.out});function Vi(e,t){return new Wi({type:"pipe",in:e,out:t})}const Gi=ar("ZodReadonly",(e,t)=>{za.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ya(a.innerType,t,n),t.seen.get(e).ref=a.innerType,r.readOnly=!0})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});const Ki=ar("ZodCustom",(e,t)=>{Fa.init(e,t),Qo.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});function Hi(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const a=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return n.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}function Zi(e){const t=n.useRef(e);return n.useEffect(()=>{t.current=e}),n.useMemo(()=>(...e)=>t.current?.(...e),[])}var Ji=globalThis?.document?n.useLayoutEffect:()=>{};function qi(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Yi(...e){return t=>{let r=!1;const n=e.map(e=>{const n=qi(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){const r=n[t];"function"==typeof r?r():qi(e[t],null)}}}}function Xi(...e){return n.useCallback(Yi(...e),e)}var Qi=Symbol.for("react.lazy"),es=n[" use ".trim().toString()];function ts(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===Qi&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function rs(e){const r=as(e),a=n.forwardRef((e,a)=>{let{children:o,...i}=e;ts(o)&&"function"==typeof es&&(o=es(o._payload));const s=n.Children.toArray(o),c=s.find(is);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}var ns=rs("Slot");function as(e){const t=n.forwardRef((e,t)=>{let{children:r,...a}=e;if(ts(r)&&"function"==typeof es&&(r=es(r._payload)),n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?Yi(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var os=Symbol("radix.slottable");function is(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===os}var ss,cs=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=rs(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),ls={exports:{}},ds={};function us(){if(ss)return ds;ss=1;var e=a;var t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=e.useState,n=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function s(e){var r=e.getSnapshot;e=e.value;try{var n=r();return!t(e,n)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var a=t(),c=r({inst:{value:a,getSnapshot:t}}),l=c[0].inst,d=c[1];return o(function(){l.value=a,l.getSnapshot=t,s(l)&&d({inst:l})},[e,a,t]),n(function(){return s(l)&&d({inst:l}),e(function(){s(l)&&d({inst:l})})},[e]),i(a),a};return ds.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:c,ds}var fs,ps,ms={};
27
27
  /**
28
28
  * @license React
29
29
  * use-sync-external-store-shim.development.js
@@ -32,5 +32,5 @@ var ao={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
32
32
  *
33
33
  * This source code is licensed under the MIT license found in the
34
34
  * LICENSE file in the root directory of this source tree.
35
- */function as(){return ts||(ts=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=a,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=t.useState,o=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue,c=!1,l=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(a,d){c||void 0===t.startTransition||(c=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var u=d();if(!l){var f=d();r(u,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var p=(f=n({inst:{value:u,getSnapshot:d}}))[0].inst,m=f[1];return i(function(){p.value=u,p.getSnapshot=d,e(p)&&m({inst:p})},[a,u,d]),o(function(){return e(p)&&m({inst:p}),a(function(){e(p)&&m({inst:p})})},[a]),s(u),u};ns.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ns}function os(){return rs||(rs=1,"production"===process.env.NODE_ENV?Xi.exports=es():Xi.exports=as()),Xi.exports}var is=os();function ss(){return()=>{}}var cs="Avatar",[ls,ds]=Fi(cs),[us,fs]=ls(cs),ps=n.forwardRef((e,r)=>{const{__scopeAvatar:a,...o}=e,[i,s]=n.useState("idle");return t(us,{scope:a,imageLoadingStatus:i,onImageLoadingStatusChange:s,children:t(Ji.span,{...o,ref:r})})});ps.displayName=cs;var ms="AvatarImage",hs=n.forwardRef((e,r)=>{const{__scopeAvatar:a,src:o,onLoadingStatusChange:i=()=>{},...s}=e,c=fs(ms,a),l=function(e,{referrerPolicy:t,crossOrigin:r}){const a=is.useSyncExternalStore(ss,()=>!0,()=>!1),o=n.useRef(null),i=a?(o.current||(o.current=new window.Image),o.current):null,[s,c]=n.useState(()=>bs(i,e));return Bi(()=>{c(bs(i,e))},[i,e]),Bi(()=>{const e=e=>()=>{c(e)};if(!i)return;const n=e("loaded"),a=e("error");return i.addEventListener("load",n),i.addEventListener("error",a),t&&(i.referrerPolicy=t),"string"==typeof r&&(i.crossOrigin=r),()=>{i.removeEventListener("load",n),i.removeEventListener("error",a)}},[i,r,t]),s}(o,s),d=ji(e=>{i(e),c.onImageLoadingStatusChange(e)});return Bi(()=>{"idle"!==l&&d(l)},[l,d]),"loaded"===l?t(Ji.img,{...s,ref:r,src:o}):null});hs.displayName=ms;var gs="AvatarFallback",vs=n.forwardRef((e,r)=>{const{__scopeAvatar:a,delayMs:o,...i}=e,s=fs(gs,a),[c,l]=n.useState(void 0===o);return n.useEffect(()=>{if(void 0!==o){const e=window.setTimeout(()=>l(!0),o);return()=>window.clearTimeout(e)}},[o]),c&&"loaded"!==s.imageLoadingStatus?t(Ji.span,{...i,ref:r}):null});function bs(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}vs.displayName=gs;var ys=ps,ws=hs,xs=vs;function Ss(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=Ss(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ks(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=Ss(e))&&(n&&(n+=" "),n+=t);return n}const As=e=>{const t=Ns(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{const r=e.split("-");return""===r[0]&&1!==r.length&&r.shift(),Es(r,t)||Ts(e)},getConflictingClassGroupIds:(e,t)=>{const a=r[e]||[];return t&&n[e]?[...a,...n[e]]:a}}},Es=(e,t)=>{if(0===e.length)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?Es(e.slice(1),n):void 0;if(a)return a;if(0===t.validators.length)return;const o=e.join("-");return t.validators.find(({validator:e})=>e(o))?.classGroupId},Cs=/^\[(.+)\]$/,Ts=e=>{if(Cs.test(e)){const t=Cs.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},Ns=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const e in r)_s(r[e],n,e,t);return n},_s=(e,t,r,n)=>{e.forEach(e=>{if("string"==typeof e){return void((""===e?t:Rs(t,e)).classGroupId=r)}if("function"==typeof e)return Ps(e)?void _s(e(n),t,r,n):void t.validators.push({validator:e,classGroupId:r});Object.entries(e).forEach(([e,a])=>{_s(a,Rs(t,e),r,n)})})},Rs=(e,t)=>{let r=e;return t.split("-").forEach(e=>{r.nextPart.has(e)||r.nextPart.set(e,{nextPart:new Map,validators:[]}),r=r.nextPart.get(e)}),r},Ps=e=>e.isThemeGetter,Os=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(a,o)=>{r.set(a,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(e){let t=r.get(e);return void 0!==t?t:void 0!==(t=n.get(e))?(a(e,t),t):void 0},set(e,t){r.has(e)?r.set(e,t):a(e,t)}}},Ds=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=e=>{const t=[];let r,n=0,a=0,o=0;for(let i=0;i<e.length;i++){let s=e[i];if(0===n&&0===a){if(":"===s){t.push(e.slice(o,i)),o=i+1;continue}if("/"===s){r=i;continue}}"["===s?n++:"]"===s?n--:"("===s?a++:")"===s&&a--}const i=0===t.length?e:e.substring(o),s=Is(i);return{modifiers:t,hasImportantModifier:s!==i,baseClassName:s,maybePostfixModifierPosition:r&&r>o?r-o:void 0}};if(t){const e=t+":",r=n;n=t=>t.startsWith(e)?r(t.substring(e.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:t,maybePostfixModifierPosition:void 0}}if(r){const e=n;n=t=>r({className:t,parseClassName:e})}return n},Is=e=>e.endsWith("!")?e.substring(0,e.length-1):e.startsWith("!")?e.substring(1):e,Us=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(e=>[e,!0]));return e=>{if(e.length<=1)return e;const r=[];let n=[];return e.forEach(e=>{"["===e[0]||t[e]?(r.push(...n.sort(),e),n=[]):n.push(e)}),r.push(...n.sort()),r}},Ms=/\s+/;function Ls(){let e,t,r=0,n="";for(;r<arguments.length;)(e=arguments[r++])&&(t=Fs(e))&&(n&&(n+=" "),n+=t);return n}const Fs=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Fs(e[n]))&&(r&&(r+=" "),r+=t);return r};function zs(e,...t){let r,n,a,o=function(s){const c=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:Os(e.cacheSize),parseClassName:Ds(e),sortModifiers:Us(e),...As(e)}))(c),n=r.cache.get,a=r.cache.set,o=i,i(s)};function i(e){const t=n(e);if(t)return t;const o=((e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:o}=t,i=[],s=e.trim().split(Ms);let c="";for(let e=s.length-1;e>=0;e-=1){const t=s[e],{isExternal:l,modifiers:d,hasImportantModifier:u,baseClassName:f,maybePostfixModifierPosition:p}=r(t);if(l){c=t+(c.length>0?" "+c:c);continue}let m=!!p,h=n(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?" "+c:c);continue}if(h=n(f),!h){c=t+(c.length>0?" "+c:c);continue}m=!1}const g=o(d).join(":"),v=u?g+"!":g,b=v+h;if(i.includes(b))continue;i.push(b);const y=a(h,m);for(let e=0;e<y.length;++e){const t=y[e];i.push(v+t)}c=t+(c.length>0?" "+c:c)}return c})(e,r);return a(e,o),o}return function(){return o(Ls.apply(null,arguments))}}const js=e=>{const t=t=>t[e]||[];return t.isThemeGetter=!0,t},Bs=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ws=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Vs=/^\d+\/\d+$/,$s=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Gs=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ks=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Hs=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Zs=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qs=e=>Vs.test(e),Js=e=>!!e&&!Number.isNaN(Number(e)),Ys=e=>!!e&&Number.isInteger(Number(e)),Xs=e=>e.endsWith("%")&&Js(e.slice(0,-1)),Qs=e=>$s.test(e),ec=()=>!0,tc=e=>Gs.test(e)&&!Ks.test(e),rc=()=>!1,nc=e=>Hs.test(e),ac=e=>Zs.test(e),oc=e=>!sc(e)&&!pc(e),ic=e=>wc(e,Ac,rc),sc=e=>Bs.test(e),cc=e=>wc(e,Ec,tc),lc=e=>wc(e,Cc,Js),dc=e=>wc(e,Sc,rc),uc=e=>wc(e,kc,ac),fc=e=>wc(e,Nc,nc),pc=e=>Ws.test(e),mc=e=>xc(e,Ec),hc=e=>xc(e,Tc),gc=e=>xc(e,Sc),vc=e=>xc(e,Ac),bc=e=>xc(e,kc),yc=e=>xc(e,Nc,!0),wc=(e,t,r)=>{const n=Bs.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},xc=(e,t,r=!1)=>{const n=Ws.exec(e);return!!n&&(n[1]?t(n[1]):r)},Sc=e=>"position"===e||"percentage"===e,kc=e=>"image"===e||"url"===e,Ac=e=>"length"===e||"size"===e||"bg-size"===e,Ec=e=>"length"===e,Cc=e=>"number"===e,Tc=e=>"family-name"===e,Nc=e=>"shadow"===e,_c=zs(()=>{const e=js("color"),t=js("font"),r=js("text"),n=js("font-weight"),a=js("tracking"),o=js("leading"),i=js("breakpoint"),s=js("container"),c=js("spacing"),l=js("radius"),d=js("shadow"),u=js("inset-shadow"),f=js("text-shadow"),p=js("drop-shadow"),m=js("blur"),h=js("perspective"),g=js("aspect"),v=js("ease"),b=js("animate"),y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",pc,sc],w=()=>[pc,sc,c],x=()=>[qs,"full","auto",...w()],S=()=>[Ys,"none","subgrid",pc,sc],k=()=>["auto",{span:["full",Ys,pc,sc]},Ys,pc,sc],A=()=>[Ys,"auto",pc,sc],E=()=>["auto","min","max","fr",pc,sc],C=()=>["auto",...w()],T=()=>[qs,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],N=()=>[e,pc,sc],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",gc,dc,{position:[pc,sc]}],R=()=>["auto","cover","contain",vc,ic,{size:[pc,sc]}],P=()=>[Xs,mc,cc],O=()=>["","none","full",l,pc,sc],D=()=>["",Js,mc,cc],I=()=>[Js,Xs,gc,dc],U=()=>["","none",m,pc,sc],M=()=>["none",Js,pc,sc],L=()=>["none",Js,pc,sc],F=()=>[Js,pc,sc],z=()=>[qs,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Qs],breakpoint:[Qs],color:[ec],container:[Qs],"drop-shadow":[Qs],ease:["in","out","in-out"],font:[oc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Qs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Qs],shadow:[Qs],spacing:["px",Js],text:[Qs],"text-shadow":[Qs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",qs,sc,pc,g]}],container:["container"],columns:[{columns:[Js,sc,pc,s]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:y()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{start:x()}],end:[{end:x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[Ys,"auto",pc,sc]}],basis:[{basis:[qs,"full","auto",s,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Js,qs,"auto","initial","none",sc]}],grow:[{grow:["",Js,pc,sc]}],shrink:[{shrink:["",Js,pc,sc]}],order:[{order:[Ys,"first","last","none",pc,sc]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:k()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:k()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:T()}],w:[{w:[s,"screen",...T()]}],"min-w":[{"min-w":[s,"screen","none",...T()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...T()]}],h:[{h:["screen","lh",...T()]}],"min-h":[{"min-h":["screen","lh","none",...T()]}],"max-h":[{"max-h":["screen","lh",...T()]}],"font-size":[{text:["base",r,mc,cc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,pc,lc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Xs,sc]}],"font-family":[{font:[hc,sc,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,pc,sc]}],"line-clamp":[{"line-clamp":[Js,"none",pc,lc]}],leading:[{leading:[o,...w()]}],"list-image":[{"list-image":["none",pc,sc]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",pc,sc]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[Js,"from-font","auto",pc,cc]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[Js,"auto",pc,sc]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",pc,sc]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",pc,sc]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ys,pc,sc],radial:["",pc,sc],conic:[Ys,pc,sc]},bc,uc]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:O()}],"rounded-s":[{"rounded-s":O()}],"rounded-e":[{"rounded-e":O()}],"rounded-t":[{"rounded-t":O()}],"rounded-r":[{"rounded-r":O()}],"rounded-b":[{"rounded-b":O()}],"rounded-l":[{"rounded-l":O()}],"rounded-ss":[{"rounded-ss":O()}],"rounded-se":[{"rounded-se":O()}],"rounded-ee":[{"rounded-ee":O()}],"rounded-es":[{"rounded-es":O()}],"rounded-tl":[{"rounded-tl":O()}],"rounded-tr":[{"rounded-tr":O()}],"rounded-br":[{"rounded-br":O()}],"rounded-bl":[{"rounded-bl":O()}],"border-w":[{border:D()}],"border-w-x":[{"border-x":D()}],"border-w-y":[{"border-y":D()}],"border-w-s":[{"border-s":D()}],"border-w-e":[{"border-e":D()}],"border-w-t":[{"border-t":D()}],"border-w-r":[{"border-r":D()}],"border-w-b":[{"border-b":D()}],"border-w-l":[{"border-l":D()}],"divide-x":[{"divide-x":D()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":D()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[Js,pc,sc]}],"outline-w":[{outline:["",Js,mc,cc]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","none",d,yc,fc]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",u,yc,fc]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[Js,cc]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":D()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",f,yc,fc]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[Js,pc,sc]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Js]}],"mask-image-linear-from-pos":[{"mask-linear-from":I()}],"mask-image-linear-to-pos":[{"mask-linear-to":I()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":I()}],"mask-image-t-to-pos":[{"mask-t-to":I()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":I()}],"mask-image-r-to-pos":[{"mask-r-to":I()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":I()}],"mask-image-b-to-pos":[{"mask-b-to":I()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":I()}],"mask-image-l-to-pos":[{"mask-l-to":I()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":I()}],"mask-image-x-to-pos":[{"mask-x-to":I()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":I()}],"mask-image-y-to-pos":[{"mask-y-to":I()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[pc,sc]}],"mask-image-radial-from-pos":[{"mask-radial-from":I()}],"mask-image-radial-to-pos":[{"mask-radial-to":I()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[Js]}],"mask-image-conic-from-pos":[{"mask-conic-from":I()}],"mask-image-conic-to-pos":[{"mask-conic-to":I()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",pc,sc]}],filter:[{filter:["","none",pc,sc]}],blur:[{blur:U()}],brightness:[{brightness:[Js,pc,sc]}],contrast:[{contrast:[Js,pc,sc]}],"drop-shadow":[{"drop-shadow":["","none",p,yc,fc]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",Js,pc,sc]}],"hue-rotate":[{"hue-rotate":[Js,pc,sc]}],invert:[{invert:["",Js,pc,sc]}],saturate:[{saturate:[Js,pc,sc]}],sepia:[{sepia:["",Js,pc,sc]}],"backdrop-filter":[{"backdrop-filter":["","none",pc,sc]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[Js,pc,sc]}],"backdrop-contrast":[{"backdrop-contrast":[Js,pc,sc]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Js,pc,sc]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Js,pc,sc]}],"backdrop-invert":[{"backdrop-invert":["",Js,pc,sc]}],"backdrop-opacity":[{"backdrop-opacity":[Js,pc,sc]}],"backdrop-saturate":[{"backdrop-saturate":[Js,pc,sc]}],"backdrop-sepia":[{"backdrop-sepia":["",Js,pc,sc]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",pc,sc]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Js,"initial",pc,sc]}],ease:[{ease:["linear","initial",v,pc,sc]}],delay:[{delay:[Js,pc,sc]}],animate:[{animate:["none",b,pc,sc]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,pc,sc]}],"perspective-origin":[{"perspective-origin":y()}],rotate:[{rotate:M()}],"rotate-x":[{"rotate-x":M()}],"rotate-y":[{"rotate-y":M()}],"rotate-z":[{"rotate-z":M()}],scale:[{scale:L()}],"scale-x":[{"scale-x":L()}],"scale-y":[{"scale-y":L()}],"scale-z":[{"scale-z":L()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[pc,sc,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:z()}],"translate-x":[{"translate-x":z()}],"translate-y":[{"translate-y":z()}],"translate-z":[{"translate-z":z()}],"translate-none":["translate-none"],accent:[{accent:N()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",pc,sc]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",pc,sc]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[Js,mc,cc,lc]}],stroke:[{stroke:["none",...N()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Rc(...e){return _c(ks(e))}const Pc=n.forwardRef(({className:e,...r},n)=>t(ys,{ref:n,className:Rc("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...r}));Pc.displayName=ys.displayName;const Oc=n.forwardRef(({className:e,...r},n)=>t(ws,{ref:n,className:Rc("aspect-square h-full w-full",e),...r}));Oc.displayName=ws.displayName;const Dc=n.forwardRef(({className:e,...r},n)=>t(xs,{ref:n,className:Rc("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...r}));Dc.displayName=xs.displayName;const Ic=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,Uc=ks,Mc=(e,t)=>r=>{var n;if(null==(null==t?void 0:t.variants))return Uc(e,null==r?void 0:r.class,null==r?void 0:r.className);const{variants:a,defaultVariants:o}=t,i=Object.keys(a).map(e=>{const t=null==r?void 0:r[e],n=null==o?void 0:o[e];if(null===t)return null;const i=Ic(t)||Ic(n);return a[e][i]}),s=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{}),c=null==t||null===(n=t.compoundVariants)||void 0===n?void 0:n.reduce((e,t)=>{let{class:r,className:n,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...s}[t]):{...o,...s}[t]===r})?[...e,r,n]:e},[]);return Uc(e,i,c,null==r?void 0:r.class,null==r?void 0:r.className)},Lc=Mc("inline-flex items-center justify-center rounded-full font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input 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:"underline-offset-4 hover:underline text-primary"},withIcon:{true:"flex"},fullWidth:{true:"w-full"},size:{default:"h-9 py-2 px-4 text-sm",sm:"h-8 px-3 text-xs",lg:"h-10 px-6 text-base",icon:"h-9 w-9"}},compoundVariants:[{size:"lg",withIcon:!0,className:"gap-x-1.5"},{size:"default",withIcon:!0,className:"gap-x-1"},{size:"sm",withIcon:!0,className:"gap-x-0.5"}],defaultVariants:{variant:"default",size:"default"}}),Fc=n.forwardRef(({className:r,variant:a,progress:o,size:i,startIcon:s,endIcon:c,asChild:l=!1,...d},u)=>{const f=l?Ki:"button",p=function(e){switch(e){case"lg":return 20;case"sm":return 14;default:return 16}}(i);return e(f,{disabled:o||d.disabled,className:Rc(Lc({variant:a,size:i,withIcon:null!=o||null!=s||null!=c,className:r})),ref:u,...d,children:[o&&t(fo,{size:p,className:"animate-spin"}),s&&n.cloneElement(s,{size:p}),d.children,c&&n.cloneElement(c,{size:p})]})});function zc(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}Fc.displayName="Button";var jc=n[" useId ".trim().toString()]||(()=>{}),Bc=0;function Wc(e){const[t,r]=n.useState(jc());return Bi(()=>{r(e=>e??String(Bc++))},[e]),e||(t?`radix-${t}`:"")}var Vc=n[" useInsertionEffect ".trim().toString()]||Bi;function $c({prop:e,defaultProp:t,onChange:r=()=>{},caller:a}){const[o,i,s]=function({defaultProp:e,onChange:t}){const[r,a]=n.useState(e),o=n.useRef(r),i=n.useRef(t);return Vc(()=>{i.current=t},[t]),n.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,a,i]}({defaultProp:t,onChange:r}),c=void 0!==e,l=c?e:o;{const t=n.useRef(void 0!==e);n.useEffect(()=>{const e=t.current;if(e!==c){const t=e?"controlled":"uncontrolled",r=c?"controlled":"uncontrolled";console.warn(`${a} is changing from ${t} to ${r}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=c},[c,a])}const d=n.useCallback(t=>{if(c){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&s.current?.(r)}else i(t)},[c,e,i,s]);return[l,d]}var Gc,Kc="dismissableLayer.update",Hc="dismissableLayer.pointerDownOutside",Zc="dismissableLayer.focusOutside",qc=n.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Jc=n.forwardRef((e,r)=>{const{disableOutsidePointerEvents:a=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:c,onDismiss:l,...d}=e,u=n.useContext(qc),[f,p]=n.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=n.useState({}),g=$i(r,e=>p(e)),v=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(b),w=f?v.indexOf(f):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=w>=y,k=function(e,t=globalThis?.document){const r=ji(e),a=n.useRef(!1),o=n.useRef(()=>{});return n.useEffect(()=>{const e=e=>{if(e.target&&!a.current){let n=function(){Xc(Hc,r,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=n,t.addEventListener("click",o.current,{once:!0})):n()}else t.removeEventListener("click",o.current);a.current=!1},n=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(n),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>a.current=!0}}(e=>{const t=e.target,r=[...u.branches].some(e=>e.contains(t));S&&!r&&(i?.(e),c?.(e),e.defaultPrevented||l?.())},m),A=function(e,t=globalThis?.document){const r=ji(e),a=n.useRef(!1);return n.useEffect(()=>{const e=e=>{if(e.target&&!a.current){Xc(Zc,r,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(s?.(e),c?.(e),e.defaultPrevented||l?.())},m);return function(e,t=globalThis?.document){const r=ji(e);n.useEffect(()=>{const e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{w===u.layers.size-1&&(o?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},m),n.useEffect(()=>{if(f)return a&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(Gc=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Yc(),()=>{a&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=Gc)}},[f,m,a,u]),n.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Yc())},[f,u]),n.useEffect(()=>{const e=()=>h({});return document.addEventListener(Kc,e),()=>document.removeEventListener(Kc,e)},[]),t(Ji.div,{...d,ref:g,style:{pointerEvents:x?S?"auto":"none":void 0,...e.style},onFocusCapture:zc(e.onFocusCapture,A.onFocusCapture),onBlurCapture:zc(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:zc(e.onPointerDownCapture,k.onPointerDownCapture)})});Jc.displayName="DismissableLayer";function Yc(){const e=new CustomEvent(Kc);document.dispatchEvent(e)}function Xc(e,t,r,{discrete:n}){const a=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?function(e,t){e&&v.flushSync(()=>e.dispatchEvent(t))}(a,o):a.dispatchEvent(o)}n.forwardRef((e,r)=>{const a=n.useContext(qc),o=n.useRef(null),i=$i(r,o);return n.useEffect(()=>{const e=o.current;if(e)return a.branches.add(e),()=>{a.branches.delete(e)}},[a.branches]),t(Ji.div,{...e,ref:i})}).displayName="DismissableLayerBranch";var Qc="focusScope.autoFocusOnMount",el="focusScope.autoFocusOnUnmount",tl={bubbles:!1,cancelable:!0},rl=n.forwardRef((e,r)=>{const{loop:a=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...c}=e,[l,d]=n.useState(null),u=ji(i),f=ji(s),p=n.useRef(null),m=$i(r,e=>d(e)),h=n.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;n.useEffect(()=>{if(o){let e=function(e){if(h.paused||!l)return;const t=e.target;l.contains(t)?p.current=t:il(p.current,{select:!0})},t=function(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||il(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&il(l)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const n=new MutationObserver(r);return l&&n.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[o,l,h.paused]),n.useEffect(()=>{if(l){sl.add(h);const t=document.activeElement;if(!l.contains(t)){const r=new CustomEvent(Qc,tl);l.addEventListener(Qc,u),l.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(il(n,{select:t}),document.activeElement!==r)return}((e=nl(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&il(l))}return()=>{l.removeEventListener(Qc,u),setTimeout(()=>{const e=new CustomEvent(el,tl);l.addEventListener(el,f),l.dispatchEvent(e),e.defaultPrevented||il(t??document.body,{select:!0}),l.removeEventListener(el,f),sl.remove(h)},0)}}var e},[l,u,f,h]);const g=n.useCallback(e=>{if(!a&&!o)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){const t=e.currentTarget,[n,o]=function(e){const t=nl(e),r=al(t,e),n=al(t.reverse(),e);return[r,n]}(t);n&&o?e.shiftKey||r!==o?e.shiftKey&&r===n&&(e.preventDefault(),a&&il(o,{select:!0})):(e.preventDefault(),a&&il(n,{select:!0})):r===t&&e.preventDefault()}},[a,o,h.paused]);return t(Ji.div,{tabIndex:-1,...c,ref:m,onKeyDown:g})});function nl(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function al(e,t){for(const r of e)if(!ol(r,{upTo:t}))return r}function ol(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function il(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}rl.displayName="FocusScope";var sl=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=cl(e,t),e.unshift(t)},remove(t){e=cl(e,t),e[0]?.resume()}}}();function cl(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var ll=n.forwardRef((e,r)=>{const{container:a,...o}=e,[i,s]=n.useState(!1);Bi(()=>s(!0),[]);const c=a||i&&globalThis?.document?.body;return c?b.createPortal(t(Ji.div,{...o,ref:r}),c):null});ll.displayName="Portal";var dl=e=>{const{present:t,children:r}=e,a=function(e){const[t,r]=n.useState(),a=n.useRef(null),o=n.useRef(e),i=n.useRef("none"),s=e?"mounted":"unmounted",[c,l]=function(e,t){return n.useReducer((e,r)=>t[e][r]??e,e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return n.useEffect(()=>{const e=ul(a.current);i.current="mounted"===c?e:"none"},[c]),Bi(()=>{const t=a.current,r=o.current;if(r!==e){const n=i.current,a=ul(t);if(e)l("MOUNT");else if("none"===a||"none"===t?.display)l("UNMOUNT");else{l(r&&n!==a?"ANIMATION_OUT":"UNMOUNT")}o.current=e}},[e,l]),Bi(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,n=n=>{const i=ul(a.current).includes(CSS.escape(n.animationName));if(n.target===t&&i&&(l("ANIMATION_END"),!o.current)){const n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},s=e=>{e.target===t&&(i.current=ul(a.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",n),t.addEventListener("animationend",n),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",n),t.removeEventListener("animationend",n)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:n.useCallback(e=>{a.current=e?getComputedStyle(e):null,r(e)},[])}}(t),o="function"==typeof r?r({present:a.isPresent}):n.Children.only(r),i=$i(a.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof r||a.isPresent?n.cloneElement(o,{ref:i}):null};function ul(e){return e?.animationName||"none"}dl.displayName="Presence";var fl=0;function pl(){n.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ml()),document.body.insertAdjacentElement("beforeend",e[1]??ml()),fl++,()=>{1===fl&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),fl--}},[])}function ml(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var hl=function(){return hl=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},hl.apply(this,arguments)};function gl(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}"function"==typeof SuppressedError&&SuppressedError;var vl="right-scroll-bar-position",bl="width-before-scroll-bar";function yl(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var wl="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,xl=new WeakMap;function Sl(e,t){var r,n,a,o=(r=null,n=function(t){return e.forEach(function(e){return yl(e,t)})},(a=u(function(){return{value:r,callback:n,facade:{get current(){return a.value},set current(e){var t=a.value;t!==e&&(a.value=e,a.callback(e,t))}}}})[0]).callback=n,a.facade);return wl(function(){var t=xl.get(o);if(t){var r=new Set(t),n=new Set(e),a=o.current;r.forEach(function(e){n.has(e)||yl(e,null)}),n.forEach(function(e){r.has(e)||yl(e,a)})}xl.set(o,e)},[e]),o}function kl(e){return e}var Al=function(e){var t=e.sideCar,r=gl(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return n.createElement(a,hl({},r))};Al.isSideCarExport=!0;var El=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=kl);var r=[],n=!1;return{read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(e){var a=t(e,n);return r.push(a),function(){r=r.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var a=r;r=[],a.forEach(e),t=r}var o=function(){var r=t;t=[],r.forEach(e)},i=function(){return Promise.resolve().then(o)};i(),r={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),r}}}}}(null);return t.options=hl({async:!0,ssr:!1},e),t}(),Cl=function(){},Tl=n.forwardRef(function(e,t){var r=n.useRef(null),a=n.useState({onScrollCapture:Cl,onWheelCapture:Cl,onTouchMoveCapture:Cl}),o=a[0],i=a[1],s=e.forwardProps,c=e.children,l=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,v=e.allowPinchZoom,b=e.as,y=void 0===b?"div":b,w=e.gapMode,x=gl(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,k=Sl([r,t]),A=hl(hl({},x),o);return n.createElement(n.Fragment,null,u&&n.createElement(S,{sideCar:El,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:i,allowPinchZoom:!!v,lockRef:r,gapMode:w}),s?n.cloneElement(n.Children.only(c),hl(hl({},A),{ref:k})):n.createElement(y,hl({},A,{className:l,ref:k}),c))});Tl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Tl.classNames={fullWidth:bl,zeroRight:vl};function Nl(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var _l=function(){var e=0,t=null;return{add:function(r){var n,a;0==e&&(t=Nl())&&(a=r,(n=t).styleSheet?n.styleSheet.cssText=a:n.appendChild(document.createTextNode(a)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Rl=function(){var e,t=(e=_l(),function(t,r){n.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])});return function(e){var r=e.styles,n=e.dynamic;return t(r,n),null}},Pl={left:0,top:0,right:0,gap:0},Ol=function(e){return parseInt(e||"",10)||0},Dl=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Pl;var t=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[Ol(r),Ol(n),Ol(a)]}(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},Il=Rl(),Ul="data-scroll-locked",Ml=function(e,t,r,n){var a=e.left,o=e.top,i=e.right,s=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(s,"px ").concat(n,";\n }\n body[").concat(Ul,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(vl," {\n right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(bl," {\n margin-right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(vl," .").concat(vl," {\n right: 0 ").concat(n,";\n }\n \n .").concat(bl," .").concat(bl," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(Ul,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},Ll=function(){var e=parseInt(document.body.getAttribute(Ul)||"0",10);return isFinite(e)?e:0},Fl=function(e){var t=e.noRelative,r=e.noImportant,a=e.gapMode,o=void 0===a?"margin":a;n.useEffect(function(){return document.body.setAttribute(Ul,(Ll()+1).toString()),function(){var e=Ll()-1;e<=0?document.body.removeAttribute(Ul):document.body.setAttribute(Ul,e.toString())}},[]);var i=n.useMemo(function(){return Dl(o)},[o]);return n.createElement(Il,{styles:Ml(i,!t,o,r?"":"!important")})},zl=!1;if("undefined"!=typeof window)try{var jl=Object.defineProperty({},"passive",{get:function(){return zl=!0,!0}});window.addEventListener("test",jl,jl),window.removeEventListener("test",jl,jl)}catch(e){zl=!1}var Bl=!!zl&&{passive:!1},Wl=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&!(r.overflowY===r.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===r[t])},Vl=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),$l(e,n)){var a=Gl(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},$l=function(e,t){return"v"===e?function(e){return Wl(e,"overflowY")}(t):function(e){return Wl(e,"overflowX")}(t)},Gl=function(e,t){return"v"===e?[(r=t).scrollTop,r.scrollHeight,r.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var r},Kl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Hl=function(e){return[e.deltaX,e.deltaY]},Zl=function(e){return e&&"current"in e?e.current:e},ql=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Jl=0,Yl=[];function Xl(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Ql,ed=(Ql=function(e){var t=n.useRef([]),r=n.useRef([0,0]),a=n.useRef(),o=n.useState(Jl++)[0],i=n.useState(Rl)[0],s=n.useRef(e);n.useEffect(function(){s.current=e},[e]),n.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(Zl),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=n.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var n,o=Kl(e),i=r.current,c="deltaX"in e?e.deltaX:i[0]-o[0],l="deltaY"in e?e.deltaY:i[1]-o[1],d=e.target,u=Math.abs(c)>Math.abs(l)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var f=Vl(u,d);if(!f)return!0;if(f?n=u:(n="v"===u?"h":"v",f=Vl(u,d)),!f)return!1;if(!a.current&&"changedTouches"in e&&(c||l)&&(a.current=n),!n)return!0;var p=a.current||n;return function(e,t,r,n){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),o=a*n,i=r.target,s=t.contains(i),c=!1,l=o>0,d=0,u=0;do{if(!i)break;var f=Gl(e,i),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&$l(e,i)&&(d+=m,u+=p);var h=i.parentNode;i=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!s&&i!==document.body||s&&(t.contains(i)||t===i));return(l&&Math.abs(d)<1||!l&&Math.abs(u)<1)&&(c=!0),c}(p,t,e,"h"===p?c:l)},[]),l=n.useCallback(function(e){var r=e;if(Yl.length&&Yl[Yl.length-1]===i){var n="deltaY"in r?Hl(r):Kl(r),a=t.current.filter(function(e){return e.name===r.type&&(e.target===r.target||r.target===e.shadowParent)&&(t=e.delta,a=n,t[0]===a[0]&&t[1]===a[1]);var t,a})[0];if(a&&a.should)r.cancelable&&r.preventDefault();else if(!a){var o=(s.current.shards||[]).map(Zl).filter(Boolean).filter(function(e){return e.contains(r.target)});(o.length>0?c(r,o[0]):!s.current.noIsolation)&&r.cancelable&&r.preventDefault()}}},[]),d=n.useCallback(function(e,r,n,a){var o={name:e,delta:r,target:n,should:a,shadowParent:Xl(n)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),u=n.useCallback(function(e){r.current=Kl(e),a.current=void 0},[]),f=n.useCallback(function(t){d(t.type,Hl(t),t.target,c(t,e.lockRef.current))},[]),p=n.useCallback(function(t){d(t.type,Kl(t),t.target,c(t,e.lockRef.current))},[]);n.useEffect(function(){return Yl.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Bl),document.addEventListener("touchmove",l,Bl),document.addEventListener("touchstart",u,Bl),function(){Yl=Yl.filter(function(e){return e!==i}),document.removeEventListener("wheel",l,Bl),document.removeEventListener("touchmove",l,Bl),document.removeEventListener("touchstart",u,Bl)}},[]);var m=e.removeScrollBar,h=e.inert;return n.createElement(n.Fragment,null,h?n.createElement(i,{styles:ql(o)}):null,m?n.createElement(Fl,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},El.useMedium(Ql),Al),td=n.forwardRef(function(e,t){return n.createElement(Tl,hl({},e,{ref:t,sideCar:ed}))});td.classNames=Tl.classNames;var rd=new WeakMap,nd=new WeakMap,ad={},od=0,id=function(e){return e&&(e.host||id(e.parentNode))},sd=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=id(t);return r&&e.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);ad[r]||(ad[r]=new WeakMap);var o=ad[r],i=[],s=new Set,c=new Set(a),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};a.forEach(l);var d=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,c=(rd.get(e)||0)+1,l=(o.get(e)||0)+1;rd.set(e,c),o.set(e,l),i.push(e),1===c&&a&&nd.set(e,!0),1===l&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),s.clear(),od++,function(){i.forEach(function(e){var t=rd.get(e)-1,a=o.get(e)-1;rd.set(e,t),o.set(e,a),t||(nd.has(e)||e.removeAttribute(n),nd.delete(e)),a||e.removeAttribute(r)}),--od||(rd=new WeakMap,rd=new WeakMap,nd=new WeakMap,ad={})}},cd=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),sd(n,a,r,"aria-hidden")):function(){return null}},ld="Dialog",[dd,ud]=Fi(ld),[fd,pd]=dd(ld),md=e=>{const{__scopeDialog:r,children:a,open:o,defaultOpen:i,onOpenChange:s,modal:c=!0}=e,l=n.useRef(null),d=n.useRef(null),[u,f]=$c({prop:o,defaultProp:i??!1,onChange:s,caller:ld});return t(fd,{scope:r,triggerRef:l,contentRef:d,contentId:Wc(),titleId:Wc(),descriptionId:Wc(),open:u,onOpenChange:f,onOpenToggle:n.useCallback(()=>f(e=>!e),[f]),modal:c,children:a})};md.displayName=ld;var hd="DialogTrigger",gd=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=pd(hd,n),i=$i(r,o.triggerRef);return t(Ji.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Md(o.open),...a,ref:i,onClick:zc(e.onClick,o.onOpenToggle)})});gd.displayName=hd;var vd="DialogPortal",[bd,yd]=dd(vd,{forceMount:void 0}),wd=e=>{const{__scopeDialog:r,forceMount:a,children:o,container:i}=e,s=pd(vd,r);return t(bd,{scope:r,forceMount:a,children:n.Children.map(o,e=>t(dl,{present:a||s.open,children:t(ll,{asChild:!0,container:i,children:e})}))})};wd.displayName=vd;var xd="DialogOverlay",Sd=n.forwardRef((e,r)=>{const n=yd(xd,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,i=pd(xd,e.__scopeDialog);return i.modal?t(dl,{present:a||i.open,children:t(Ad,{...o,ref:r})}):null});Sd.displayName=xd;var kd=Gi("DialogOverlay.RemoveScroll"),Ad=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=pd(xd,n);return t(td,{as:kd,allowPinchZoom:!0,shards:[o.contentRef],children:t(Ji.div,{"data-state":Md(o.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),Ed="DialogContent",Cd=n.forwardRef((e,r)=>{const n=yd(Ed,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,i=pd(Ed,e.__scopeDialog);return t(dl,{present:a||i.open,children:i.modal?t(Td,{...o,ref:r}):t(Nd,{...o,ref:r})})});Cd.displayName=Ed;var Td=n.forwardRef((e,r)=>{const a=pd(Ed,e.__scopeDialog),o=n.useRef(null),i=$i(r,a.contentRef,o);return n.useEffect(()=>{const e=o.current;if(e)return cd(e)},[]),t(_d,{...e,ref:i,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:zc(e.onCloseAutoFocus,e=>{e.preventDefault(),a.triggerRef.current?.focus()}),onPointerDownOutside:zc(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:zc(e.onFocusOutside,e=>e.preventDefault())})}),Nd=n.forwardRef((e,r)=>{const a=pd(Ed,e.__scopeDialog),o=n.useRef(!1),i=n.useRef(!1);return t(_d,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||a.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));const r=t.target,n=a.triggerRef.current?.contains(r);n&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),_d=n.forwardRef((a,o)=>{const{__scopeDialog:i,trapFocus:s,onOpenAutoFocus:c,onCloseAutoFocus:l,...d}=a,u=pd(Ed,i),f=n.useRef(null),p=$i(o,f);return pl(),e(r,{children:[t(rl,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:c,onUnmountAutoFocus:l,children:t(Jc,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Md(u.open),...d,ref:p,onDismiss:()=>u.onOpenChange(!1)})}),e(r,{children:[t(jd,{titleId:u.titleId}),t(Bd,{contentRef:f,descriptionId:u.descriptionId})]})]})}),Rd="DialogTitle",Pd=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=pd(Rd,n);return t(Ji.h2,{id:o.titleId,...a,ref:r})});Pd.displayName=Rd;var Od="DialogDescription",Dd=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=pd(Od,n);return t(Ji.p,{id:o.descriptionId,...a,ref:r})});Dd.displayName=Od;var Id="DialogClose",Ud=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=pd(Id,n);return t(Ji.button,{type:"button",...a,ref:r,onClick:zc(e.onClick,()=>o.onOpenChange(!1))})});function Md(e){return e?"open":"closed"}Ud.displayName=Id;var Ld="DialogTitleWarning",[Fd,zd]=function(e,r){const a=n.createContext(r),o=e=>{const{children:r,...o}=e,i=n.useMemo(()=>o,Object.values(o));return t(a.Provider,{value:i,children:r})};return o.displayName=e+"Provider",[o,function(t){const o=n.useContext(a);if(o)return o;if(void 0!==r)return r;throw new Error(`\`${t}\` must be used within \`${e}\``)}]}(Ld,{contentName:Ed,titleName:Rd,docsSlug:"dialog"}),jd=({titleId:e})=>{const t=zd(Ld),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return n.useEffect(()=>{if(e){document.getElementById(e)||console.error(r)}},[r,e]),null},Bd=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${zd("DialogDescriptionWarning").contentName}}.`;return n.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)||console.warn(r)}},[r,e,t]),null},Wd=md,Vd=gd,$d=wd,Gd=Sd,Kd=Cd,Hd=Pd,Zd=Dd,qd=Ud;function Jd(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}var Yd=["color"],Xd=f(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=Jd(e,Yd);return p("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),p("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))}),Qd=["color"],eu=f(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=Jd(e,Qd);return p("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),p("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:n,fillRule:"evenodd",clipRule:"evenodd"}))}),tu=["color"],ru=f(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=Jd(e,tu);return p("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),p("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))}),nu=["color"],au=f(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=Jd(e,nu);return p("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),p("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))});const ou=Wd,iu=Vd,su=$d,cu=n.forwardRef(({className:e,...r},n)=>t(Gd,{ref:n,className:Rc("fixed inset-0 z-50 bg-background/80 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),...r}));cu.displayName=Gd.displayName;const lu=n.forwardRef(({className:r,children:a,...o},i)=>{const{container:s}=n.useContext(ke);return e(su,{container:s,children:[t(cu,{}),e(Kd,{ref:i,className:Rc("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",r),...o,children:[a,e(qd,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t(ru,{className:"h-4 w-4"}),t("span",{className:"sr-only",children:"Close"})]})]})]})});lu.displayName=Kd.displayName;const du=({className:e,...r})=>t("div",{className:Rc("flex flex-col space-y-1.5 text-center sm:text-left",e),...r});du.displayName="DialogHeader";const uu=n.forwardRef(({className:e,...r},n)=>t(Hd,{ref:n,className:Rc("text-lg font-semibold leading-none tracking-tight",e),...r}));uu.displayName=Hd.displayName;const fu=n.forwardRef(({className:e,...r},n)=>t(Zd,{ref:n,className:Rc("text-sm text-muted-foreground",e),...r}));fu.displayName=Zd.displayName;var pu=n.forwardRef((e,r)=>t(Ji.label,{...e,ref:r,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));pu.displayName="Label";var mu=pu;const hu=Mc("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),gu=n.forwardRef(({className:e,...r},n)=>t(mu,{ref:n,className:Rc(hu(),e),...r}));gu.displayName=mu.displayName;const vu=st,bu=n.createContext({}),yu=({...e})=>t(bu.Provider,{value:{name:e.name},children:t(ht,{...e})}),wu=()=>{const e=n.useContext(bu),t=n.useContext(xu),{getFieldState:r,formState:a}=it(),o=r(e.name,a);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...o}},xu=n.createContext({}),Su=n.forwardRef(({className:e,...r},a)=>{const o=n.useId();return t(xu.Provider,{value:{id:o},children:t("div",{ref:a,className:Rc("space-y-2",e),...r})})});Su.displayName="FormItem";const ku=n.forwardRef(({className:e,...r},n)=>{const{error:a,formItemId:o}=wu();return t(gu,{ref:n,className:Rc(a&&"text-destructive",e),htmlFor:o,...r})});ku.displayName="FormLabel";const Au=n.forwardRef(({...e},r)=>{const{error:n,formItemId:a,formDescriptionId:o,formMessageId:i}=wu();return t(Ki,{ref:r,id:a,"aria-describedby":n?`${o} ${i}`:`${o}`,"aria-invalid":!!n,...e})});Au.displayName="FormControl";const Eu=n.forwardRef(({className:e,...r},n)=>{const{formDescriptionId:a}=wu();return t("p",{ref:n,id:a,className:Rc("text-sm text-muted-foreground",e),...r})});Eu.displayName="FormDescription";const Cu=n.forwardRef(({className:e,children:r,...n},a)=>{const{error:o,formMessageId:i}=wu(),s=o?String(o?.message):r;return s?t("p",{ref:a,id:i,className:Rc("text-sm font-medium text-destructive",e),...n,children:s}):null});Cu.displayName="FormMessage";const Tu=n.forwardRef(({className:e,type:r,...n},a)=>t("input",{type:r,className:Rc("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...n}));function Nu(e){const r=e+"CollectionProvider",[n,o]=Fi(r),[i,s]=n(r,{collectionRef:{current:null},itemMap:new Map}),c=e=>{const{scope:r,children:n}=e,o=a.useRef(null),s=a.useRef(new Map).current;return t(i,{scope:r,itemMap:s,collectionRef:o,children:n})};c.displayName=r;const l=e+"CollectionSlot",d=Gi(l),u=a.forwardRef((e,r)=>{const{scope:n,children:a}=e,o=$i(r,s(l,n).collectionRef);return t(d,{ref:o,children:a})});u.displayName=l;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=Gi(f),h=a.forwardRef((e,r)=>{const{scope:n,children:o,...i}=e,c=a.useRef(null),l=$i(r,c),d=s(f,n);return a.useEffect(()=>(d.itemMap.set(c,{ref:c,...i}),()=>{d.itemMap.delete(c)})),t(m,{[p]:"",ref:l,children:o})});return h.displayName=f,[{Provider:c,Slot:u,ItemSlot:h},function(t){const r=s(e+"CollectionConsumer",t),n=a.useCallback(()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`)),n=Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current));return n},[r.collectionRef,r.itemMap]);return n},o]}Tu.displayName="Input";var _u=n.createContext(void 0);function Ru(e){const t=n.useContext(_u);return e||t||"ltr"}var Pu="rovingFocusGroup.onEntryFocus",Ou={bubbles:!1,cancelable:!0},Du="RovingFocusGroup",[Iu,Uu,Mu]=Nu(Du),[Lu,Fu]=Fi(Du,[Mu]),[zu,ju]=Lu(Du),Bu=n.forwardRef((e,r)=>t(Iu.Provider,{scope:e.__scopeRovingFocusGroup,children:t(Iu.Slot,{scope:e.__scopeRovingFocusGroup,children:t(Wu,{...e,ref:r})})}));Bu.displayName=Du;var Wu=n.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,orientation:o,loop:i=!1,dir:s,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=e,m=n.useRef(null),h=$i(r,m),g=Ru(s),[v,b]=$c({prop:c,defaultProp:l??null,onChange:d,caller:Du}),[y,w]=n.useState(!1),x=ji(u),S=Uu(a),k=n.useRef(!1),[A,E]=n.useState(0);return n.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(Pu,x),()=>e.removeEventListener(Pu,x)},[x]),t(zu,{scope:a,orientation:o,dir:g,loop:i,currentTabStopId:v,onItemFocus:n.useCallback(e=>b(e),[b]),onItemShiftTab:n.useCallback(()=>w(!0),[]),onFocusableItemAdd:n.useCallback(()=>E(e=>e+1),[]),onFocusableItemRemove:n.useCallback(()=>E(e=>e-1),[]),children:t(Ji.div,{tabIndex:y||0===A?-1:0,"data-orientation":o,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:zc(e.onMouseDown,()=>{k.current=!0}),onFocus:zc(e.onFocus,e=>{const t=!k.current;if(e.target===e.currentTarget&&t&&!y){const t=new CustomEvent(Pu,Ou);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=S().filter(e=>e.focusable);Ku([e.find(e=>e.active),e.find(e=>e.id===v),...e].filter(Boolean).map(e=>e.ref.current),f)}}k.current=!1}),onBlur:zc(e.onBlur,()=>w(!1))})})}),Vu="RovingFocusGroupItem",$u=n.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,focusable:o=!0,active:i=!1,tabStopId:s,children:c,...l}=e,d=Wc(),u=s||d,f=ju(Vu,a),p=f.currentTabStopId===u,m=Uu(a),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=f;return n.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),t(Iu.ItemSlot,{scope:a,id:u,focusable:o,active:i,children:t(Ji.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:r,onMouseDown:zc(e.onMouseDown,e=>{o?f.onItemFocus(u):e.preventDefault()}),onFocus:zc(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:zc(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void f.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,r){const n=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,r);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(n)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)?void 0:Gu[n]}(e,f.orientation,f.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let r=m().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)r.reverse();else if("prev"===t||"next"===t){"prev"===t&&r.reverse();const n=r.indexOf(e.currentTarget);r=f.loop?function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(r,n+1):r.slice(n+1)}setTimeout(()=>Ku(r))}}),children:"function"==typeof c?c({isCurrentTabStop:p,hasTabStop:null!=v}):c})})});$u.displayName=Vu;var Gu={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ku(e,t=!1){const r=document.activeElement;for(const n of e){if(n===r)return;if(n.focus({preventScroll:t}),document.activeElement!==r)return}}var Hu=Bu,Zu=$u;function qu(e){const[t,r]=n.useState(void 0);return Bi(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const n=t[0];let a,o;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,o=t.blockSize}else a=e.offsetWidth,o=e.offsetHeight;r({width:a,height:o})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}function Ju(e){const t=n.useRef({value:e,previous:e});return n.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Yu="Radio",[Xu,Qu]=Fi(Yu),[ef,tf]=Xu(Yu),rf=n.forwardRef((r,a)=>{const{__scopeRadio:o,name:i,checked:s=!1,required:c,disabled:l,value:d="on",onCheck:u,form:f,...p}=r,[m,h]=n.useState(null),g=$i(a,e=>h(e)),v=n.useRef(!1),b=!m||(f||!!m.closest("form"));return e(ef,{scope:o,checked:s,disabled:l,children:[t(Ji.button,{type:"button",role:"radio","aria-checked":s,"data-state":sf(s),"data-disabled":l?"":void 0,disabled:l,value:d,...p,ref:g,onClick:zc(r.onClick,e=>{s||u?.(),b&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})}),b&&t(of,{control:m,bubbles:!v.current,name:i,value:d,checked:s,required:c,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});rf.displayName=Yu;var nf="RadioIndicator",af=n.forwardRef((e,r)=>{const{__scopeRadio:n,forceMount:a,...o}=e,i=tf(nf,n);return t(dl,{present:a||i.checked,children:t(Ji.span,{"data-state":sf(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:r})})});af.displayName=nf;var of=n.forwardRef(({__scopeRadio:e,control:r,checked:a,bubbles:o=!0,...i},s)=>{const c=n.useRef(null),l=$i(c,s),d=Ju(a),u=qu(r);return n.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==a&&r){const t=new Event("click",{bubbles:o});r.call(e,a),e.dispatchEvent(t)}},[d,a,o]),t(Ji.input,{type:"radio","aria-hidden":!0,defaultChecked:a,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function sf(e){return e?"checked":"unchecked"}of.displayName="RadioBubbleInput";var cf=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],lf="RadioGroup",[df,uf]=Fi(lf,[Fu,Qu]),ff=Fu(),pf=Qu(),[mf,hf]=df(lf),gf=n.forwardRef((e,r)=>{const{__scopeRadioGroup:n,name:a,defaultValue:o,value:i,required:s=!1,disabled:c=!1,orientation:l,dir:d,loop:u=!0,onValueChange:f,...p}=e,m=ff(n),h=Ru(d),[g,v]=$c({prop:i,defaultProp:o??null,onChange:f,caller:lf});return t(mf,{scope:n,name:a,required:s,disabled:c,value:g,onValueChange:v,children:t(Hu,{asChild:!0,...m,orientation:l,dir:h,loop:u,children:t(Ji.div,{role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":c?"":void 0,dir:h,...p,ref:r})})})});gf.displayName=lf;var vf="RadioGroupItem",bf=n.forwardRef((e,r)=>{const{__scopeRadioGroup:a,disabled:o,...i}=e,s=hf(vf,a),c=s.disabled||o,l=ff(a),d=pf(a),u=n.useRef(null),f=$i(r,u),p=s.value===i.value,m=n.useRef(!1);return n.useEffect(()=>{const e=e=>{cf.includes(e.key)&&(m.current=!0)},t=()=>m.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),t(Zu,{asChild:!0,...l,focusable:!c,active:p,children:t(rf,{disabled:c,required:s.required,checked:p,...d,...i,name:s.name,ref:f,onCheck:()=>s.onValueChange(i.value),onKeyDown:zc(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:zc(i.onFocus,()=>{m.current&&u.current?.click()})})})});bf.displayName=vf;var yf=n.forwardRef((e,r)=>{const{__scopeRadioGroup:n,...a}=e,o=pf(n);return t(af,{...o,...a,ref:r})});yf.displayName="RadioGroupIndicator";var wf=gf,xf=bf,Sf=yf;const kf=n.forwardRef(({className:e,...r},n)=>t(wf,{className:Rc("grid gap-2",e),...r,ref:n}));kf.displayName=wf.displayName;const Af=n.forwardRef(({className:e,...r},n)=>t(xf,{ref:n,className:Rc("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:t(Sf,{className:"flex items-center justify-center",children:t(eu,{className:"h-3.5 w-3.5 fill-primary"})})}));function Ef(e,[t,r]){return Math.min(r,Math.max(t,e))}Af.displayName=xf.displayName;var Cf="ScrollArea",[Tf,Nf]=Fi(Cf),[_f,Rf]=Tf(Cf),Pf=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,type:o="hover",dir:i,scrollHideDelay:s=600,...c}=e,[l,d]=n.useState(null),[u,f]=n.useState(null),[p,m]=n.useState(null),[h,g]=n.useState(null),[v,b]=n.useState(null),[y,w]=n.useState(0),[x,S]=n.useState(0),[k,A]=n.useState(!1),[E,C]=n.useState(!1),T=$i(r,e=>d(e)),N=Ru(i);return t(_f,{scope:a,type:o,dir:N,scrollHideDelay:s,scrollArea:l,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:k,onScrollbarXEnabledChange:A,scrollbarY:v,onScrollbarYChange:b,scrollbarYEnabled:E,onScrollbarYEnabledChange:C,onCornerWidthChange:w,onCornerHeightChange:S,children:t(Ji.div,{dir:N,...c,ref:T,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":x+"px",...e.style}})})});Pf.displayName=Cf;var Of="ScrollAreaViewport",Df=n.forwardRef((a,o)=>{const{__scopeScrollArea:i,children:s,nonce:c,...l}=a,d=Rf(Of,i),u=$i(o,n.useRef(null),d.onViewportChange);return e(r,{children:[t("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:c}),t(Ji.div,{"data-radix-scroll-area-viewport":"",...l,ref:u,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...a.style},children:t("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});Df.displayName=Of;var If="ScrollAreaScrollbar",Uf=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=Rf(If,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:c}=i,l="horizontal"===e.orientation;return n.useEffect(()=>(l?s(!0):c(!0),()=>{l?s(!1):c(!1)}),[l,s,c]),"hover"===i.type?t(Mf,{...o,ref:r,forceMount:a}):"scroll"===i.type?t(Lf,{...o,ref:r,forceMount:a}):"auto"===i.type?t(Ff,{...o,ref:r,forceMount:a}):"always"===i.type?t(zf,{...o,ref:r}):null});Uf.displayName=If;var Mf=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=Rf(If,e.__scopeScrollArea),[s,c]=n.useState(!1);return n.useEffect(()=>{const e=i.scrollArea;let t=0;if(e){const r=()=>{window.clearTimeout(t),c(!0)},n=()=>{t=window.setTimeout(()=>c(!1),i.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[i.scrollArea,i.scrollHideDelay]),t(dl,{present:a||s,children:t(Ff,{"data-state":s?"visible":"hidden",...o,ref:r})})}),Lf=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=Rf(If,e.__scopeScrollArea),s="horizontal"===e.orientation,c=ap(()=>d("SCROLL_END"),100),[l,d]=(u="hidden",f={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},n.useReducer((e,t)=>f[e][t]??e,u));var u,f;return n.useEffect(()=>{if("idle"===l){const e=window.setTimeout(()=>d("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,i.scrollHideDelay,d]),n.useEffect(()=>{const e=i.viewport,t=s?"scrollLeft":"scrollTop";if(e){let r=e[t];const n=()=>{const n=e[t];r!==n&&(d("SCROLL"),c()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[i.viewport,s,d,c]),t(dl,{present:a||"hidden"!==l,children:t(zf,{"data-state":"hidden"===l?"hidden":"visible",...o,ref:r,onPointerEnter:zc(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:zc(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),Ff=n.forwardRef((e,r)=>{const a=Rf(If,e.__scopeScrollArea),{forceMount:o,...i}=e,[s,c]=n.useState(!1),l="horizontal"===e.orientation,d=ap(()=>{if(a.viewport){const e=a.viewport.offsetWidth<a.viewport.scrollWidth,t=a.viewport.offsetHeight<a.viewport.scrollHeight;c(l?e:t)}},10);return op(a.viewport,d),op(a.content,d),t(dl,{present:o||s,children:t(zf,{"data-state":s?"visible":"hidden",...i,ref:r})})}),zf=n.forwardRef((e,r)=>{const{orientation:a="vertical",...o}=e,i=Rf(If,e.__scopeScrollArea),s=n.useRef(null),c=n.useRef(0),[l,d]=n.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Xf(l.viewport,l.content),f={...o,sizes:l,onSizesChange:d,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>s.current=e,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:e=>c.current=e};function p(e,t){return function(e,t,r,n="ltr"){const a=Qf(r),o=a/2,i=t||o,s=a-i,c=r.scrollbar.paddingStart+i,l=r.scrollbar.size-r.scrollbar.paddingEnd-s,d=r.content-r.viewport,u="ltr"===n?[0,d]:[-1*d,0];return tp([c,l],u)(e)}(e,c.current,l,t)}return"horizontal"===a?t(jf,{...f,ref:r,onThumbPositionChange:()=>{if(i.viewport&&s.current){const e=ep(i.viewport.scrollLeft,l,i.dir);s.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=p(e,i.dir))}}):"vertical"===a?t(Bf,{...f,ref:r,onThumbPositionChange:()=>{if(i.viewport&&s.current){const e=ep(i.viewport.scrollTop,l);s.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=p(e))}}):null}),jf=n.forwardRef((e,r)=>{const{sizes:a,onSizesChange:o,...i}=e,s=Rf(If,e.__scopeScrollArea),[c,l]=n.useState(),d=n.useRef(null),u=$i(r,d,s.onScrollbarXChange);return n.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),t($f,{"data-orientation":"horizontal",...i,ref:u,sizes:a,style:{bottom:0,left:"rtl"===s.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===s.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Qf(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(s.viewport){const n=s.viewport.scrollLeft+t.deltaX;e.onWheelScroll(n),rp(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&c&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Yf(c.paddingLeft),paddingEnd:Yf(c.paddingRight)}})}})}),Bf=n.forwardRef((e,r)=>{const{sizes:a,onSizesChange:o,...i}=e,s=Rf(If,e.__scopeScrollArea),[c,l]=n.useState(),d=n.useRef(null),u=$i(r,d,s.onScrollbarYChange);return n.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),t($f,{"data-orientation":"vertical",...i,ref:u,sizes:a,style:{top:0,right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Qf(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(s.viewport){const n=s.viewport.scrollTop+t.deltaY;e.onWheelScroll(n),rp(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&c&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Yf(c.paddingTop),paddingEnd:Yf(c.paddingBottom)}})}})}),[Wf,Vf]=Tf(If),$f=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,sizes:o,hasThumb:i,onThumbChange:s,onThumbPointerUp:c,onThumbPointerDown:l,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=e,h=Rf(If,a),[g,v]=n.useState(null),b=$i(r,e=>v(e)),y=n.useRef(null),w=n.useRef(""),x=h.viewport,S=o.content-o.viewport,k=ji(f),A=ji(d),E=ap(p,10);function C(e){if(y.current){const t=e.clientX-y.current.left,r=e.clientY-y.current.top;u({x:t,y:r})}}return n.useEffect(()=>{const e=e=>{const t=e.target,r=g?.contains(t);r&&k(e,S)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[x,g,S,k]),n.useEffect(A,[o,A]),op(g,E),op(h.content,E),t(Wf,{scope:a,scrollbar:g,hasThumb:i,onThumbChange:ji(s),onThumbPointerUp:ji(c),onThumbPositionChange:A,onThumbPointerDown:ji(l),children:t(Ji.div,{...m,ref:b,style:{position:"absolute",...m.style},onPointerDown:zc(e.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),y.current=g.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),C(e)}}),onPointerMove:zc(e.onPointerMove,C),onPointerUp:zc(e.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=w.current,h.viewport&&(h.viewport.style.scrollBehavior=""),y.current=null})})})}),Gf="ScrollAreaThumb",Kf=n.forwardRef((e,r)=>{const{forceMount:n,...a}=e,o=Vf(Gf,e.__scopeScrollArea);return t(dl,{present:n||o.hasThumb,children:t(Hf,{ref:r,...a})})}),Hf=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,style:o,...i}=e,s=Rf(Gf,a),c=Vf(Gf,a),{onThumbPositionChange:l}=c,d=$i(r,e=>c.onThumbChange(e)),u=n.useRef(void 0),f=ap(()=>{u.current&&(u.current(),u.current=void 0)},100);return n.useEffect(()=>{const e=s.viewport;if(e){const t=()=>{if(f(),!u.current){const t=np(e,l);u.current=t,l()}};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[s.viewport,f,l]),t(Ji.div,{"data-state":c.hasThumb?"visible":"hidden",...i,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:zc(e.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;c.onThumbPointerDown({x:r,y:n})}),onPointerUp:zc(e.onPointerUp,c.onThumbPointerUp)})});Kf.displayName=Gf;var Zf="ScrollAreaCorner",qf=n.forwardRef((e,r)=>{const n=Rf(Zf,e.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?t(Jf,{...e,ref:r}):null});qf.displayName=Zf;var Jf=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,...o}=e,i=Rf(Zf,a),[s,c]=n.useState(0),[l,d]=n.useState(0),u=Boolean(s&&l);return op(i.scrollbarX,()=>{const e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),d(e)}),op(i.scrollbarY,()=>{const e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),c(e)}),u?t(Ji.div,{...o,ref:r,style:{width:s,height:l,position:"absolute",right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:0,...e.style}}):null});function Yf(e){return e?parseInt(e,10):0}function Xf(e,t){const r=e/t;return isNaN(r)?0:r}function Qf(e){const t=Xf(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function ep(e,t,r="ltr"){const n=Qf(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,i=t.content-t.viewport,s=o-n,c=Ef(e,"ltr"===r?[0,i]:[-1*i,0]);return tp([0,i],[0,s])(c)}function tp(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function rp(e,t){return e>0&&e<t}var np=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,s=r.top!==o.top;(i||s)&&t(),r=o,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function ap(e,t){const r=ji(e),a=n.useRef(0);return n.useEffect(()=>()=>window.clearTimeout(a.current),[]),n.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(r,t)},[r,t])}function op(e,t){const r=ji(t);Bi(()=>{let t=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}var ip=Pf,sp=Df,cp=qf;const lp=n.forwardRef(({className:r,children:n,...a},o)=>e(ip,{ref:o,className:Rc("relative overflow-hidden",r),...a,children:[t(sp,{className:"h-full w-full rounded-[inherit]",children:n}),t(dp,{}),t(cp,{})]}));lp.displayName=ip.displayName;const dp=n.forwardRef(({className:e,orientation:r="vertical",...n},a)=>t(Uf,{ref:a,orientation:r,className:Rc("flex touch-none select-none transition-colors","vertical"===r&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===r&&"h-2.5 border-t border-t-transparent p-[1px]",e),...n,children:t(Kf,{className:Rc("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));dp.displayName=Uf.displayName;var up="horizontal",fp=["horizontal","vertical"],pp=n.forwardRef((e,r)=>{const{decorative:n,orientation:a=up,...o}=e,i=function(e){return fp.includes(e)}(a)?a:up,s=n?{role:"none"}:{"aria-orientation":"vertical"===i?i:void 0,role:"separator"};return t(Ji.div,{"data-orientation":i,...s,...o,ref:r})});pp.displayName="Separator";var mp=pp;const hp=n.forwardRef(({className:e,orientation:r="horizontal",decorative:n=!0,...a},o)=>t(mp,{ref:o,decorative:n,orientation:r,className:Rc("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",e),...a}));function gp(){const e=ye(),t=be(e=>e.os),{serverUrl:r,version:n,orgId:a,settings:o}=t,i=m(!1),s=l(async()=>{if(i.current)return o||null;if(o)return o;if(!r||!n||!a)return null;i.current=!0;try{const t=F(),o=await fetch(`${r}/api/${n}/public/${a}/settings`,{headers:t});if(!o.ok)throw new Error("Failed to fetch settings");const i=await o.json();return e.os(Z(i)),i}catch(e){return console.error("Failed to fetch settings:",e),null}finally{i.current=!1}},[r,n,a,o,e]);return d(()=>{r&&n&&a&&!o&&!i.current&&s()},[r,n,a]),c(()=>({settings:o,getSettings:s}),[o,s])}hp.displayName=mp.displayName;var vp="AlertDialog",[bp,yp]=Fi(vp,[ud]),wp=ud(),xp=e=>{const{__scopeAlertDialog:r,...n}=e,a=wp(r);return t(Wd,{...a,...n,modal:!0})};xp.displayName=vp;var Sp=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=wp(n);return t(Vd,{...o,...a,ref:r})});Sp.displayName="AlertDialogTrigger";var kp=e=>{const{__scopeAlertDialog:r,...n}=e,a=wp(r);return t($d,{...a,...n})};kp.displayName="AlertDialogPortal";var Ap=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=wp(n);return t(Gd,{...o,...a,ref:r})});Ap.displayName="AlertDialogOverlay";var Ep="AlertDialogContent",[Cp,Tp]=bp(Ep),Np=function(e){const n=({children:e})=>t(r,{children:e});return n.displayName=`${e}.Slottable`,n.__radixId=Zi,n}("AlertDialogContent"),_p=n.forwardRef((r,a)=>{const{__scopeAlertDialog:o,children:i,...s}=r,c=wp(o),l=n.useRef(null),d=$i(a,l),u=n.useRef(null);return t(Fd,{contentName:Ep,titleName:Rp,docsSlug:"alert-dialog",children:t(Cp,{scope:o,cancelRef:u,children:e(Kd,{role:"alertdialog",...c,...s,ref:d,onOpenAutoFocus:zc(s.onOpenAutoFocus,e=>{e.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[t(Np,{children:i}),t(Lp,{contentRef:l})]})})})});_p.displayName=Ep;var Rp="AlertDialogTitle",Pp=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=wp(n);return t(Hd,{...o,...a,ref:r})});Pp.displayName=Rp;var Op="AlertDialogDescription",Dp=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=wp(n);return t(Zd,{...o,...a,ref:r})});Dp.displayName=Op;var Ip=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=wp(n);return t(qd,{...o,...a,ref:r})});Ip.displayName="AlertDialogAction";var Up="AlertDialogCancel",Mp=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,{cancelRef:o}=Tp(Up,n),i=wp(n),s=$i(r,o);return t(qd,{...i,...a,ref:s})});Mp.displayName=Up;var Lp=({contentRef:e})=>{const t=`\`${Ep}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${Ep}\` by passing a \`${Op}\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Ep}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return n.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Fp=Ap,zp=_p,jp=Ip,Bp=Mp,Wp=Pp,Vp=Dp;const $p=xp,Gp=Sp,Kp=kp,Hp=n.forwardRef(({className:e,...r},n)=>t(Fp,{className:Rc("fixed inset-0 z-50 bg-background/80 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),...r,ref:n}));Hp.displayName=Fp.displayName;const Zp=n.forwardRef(({className:r,...a},o)=>{const{container:i}=n.useContext(ke);return e(Kp,{container:i,children:[t(Hp,{}),t(zp,{ref:o,className:Rc("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",r),...a})]})});Zp.displayName=zp.displayName;const qp=({className:e,...r})=>t("div",{className:Rc("flex flex-col space-y-2 text-center sm:text-left",e),...r});qp.displayName="AlertDialogHeader";const Jp=({className:e,...r})=>t("div",{className:Rc("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...r});Jp.displayName="AlertDialogFooter";const Yp=n.forwardRef(({className:e,...r},n)=>t(Wp,{ref:n,className:Rc("text-lg font-semibold",e),...r}));Yp.displayName=Wp.displayName;const Xp=n.forwardRef(({className:e,...r},n)=>t(Vp,{ref:n,className:Rc("text-sm text-muted-foreground",e),...r}));Xp.displayName=Vp.displayName;const Qp=n.forwardRef(({className:e,...r},n)=>t(jp,{ref:n,className:Rc(Lc(),e),...r}));Qp.displayName=jp.displayName;const em=n.forwardRef(({className:e,...r},n)=>t(Bp,{ref:n,className:Rc(Lc({variant:"outline"}),"mt-2 sm:mt-0",e),...r}));em.displayName=Bp.displayName;const tm="saas-workspace-current",rm=()=>P(tm),nm=(e,t)=>!!e&&t.some(t=>t._id===e);function am(e,t){if(!t)return!1;const r=(n=e.createdBy)?"string"==typeof n?n:"object"==typeof n&&null!==n&&"_id"in n&&"string"==typeof n._id?n._id:null:null;var n;return null!==r&&r===t}function om({className:e,...r}){return t("div",{className:Rc("animate-pulse rounded-md bg-primary/10",e),...r})}function im(){return e("div",{className:"space-y-3.5",children:[t(om,{className:"h-10 w-full"}),t(om,{className:"h-10 w-full"}),t(om,{className:"h-10 w-full"})]})}const sm=({workspace:n})=>{const[a,o]=u(!1),{deleteWorkspace:i}=jy(),s=be(e=>e.auth.session?.user||null);if(!n)return t(im,{});const c=function(e,t){if(!t||!e.users||!Array.isArray(e.users))return null;const r=e.users.find(e=>"string"==typeof e?e===t:"object"==typeof e&&null!==e&&"_id"in e&&e._id===t);return r&&"object"==typeof r&&"role"in r&&"string"==typeof r.role?r.role:null}(n,s?.id??null);return"admin"===c?.toLowerCase()?e("div",{className:"space-y-4",children:[e("div",{children:[t("h3",{className:"text-lg font-semibold text-destructive",children:"Delete Workspace"}),e("p",{className:"text-sm text-muted-foreground mt-2",children:["Once you delete a workspace, there is no going back. This will permanently delete the workspace ",t("strong",{children:n.name})," and all of its data, including members, settings, and features."]})]}),e($p,{children:[t(Gp,{asChild:!0,children:e(Fc,{variant:"destructive",disabled:a,progress:a,children:[t(yo,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e(Zp,{children:[e(qp,{children:[t(Yp,{children:"Are you absolutely sure?"}),e(Xp,{children:["This action cannot be undone. This will permanently delete the workspace"," ",t("strong",{children:n.name})," and all of its data."]})]}),e(Jp,{children:[t(em,{disabled:a,children:"Cancel"}),t(Qp,{onClick:async()=>{o(!0);try{await i(n._id)}catch(e){S(e,{component:"WorkspaceSettingsDanger",action:"handleDeleteWorkspace",metadata:{workspaceId:n._id}}),alert(e instanceof Error?e.message:"Failed to delete workspace")}finally{o(!1)}},disabled:a,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:a?e(r,{children:[t(fo,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Workspace"})]})]})]})]}):t("div",{className:"space-y-4",children:t("div",{className:"text-red-500",children:"Only workspace admins can delete workspaces."})})};var cm="Switch",[lm,dm]=Fi(cm),[um,fm]=lm(cm),pm=n.forwardRef((r,a)=>{const{__scopeSwitch:o,name:i,checked:s,defaultChecked:c,required:l,disabled:d,value:u="on",onCheckedChange:f,form:p,...m}=r,[h,g]=n.useState(null),v=$i(a,e=>g(e)),b=n.useRef(!1),y=!h||(p||!!h.closest("form")),[w,x]=$c({prop:s,defaultProp:c??!1,onChange:f,caller:cm});return e(um,{scope:o,checked:w,disabled:d,children:[t(Ji.button,{type:"button",role:"switch","aria-checked":w,"aria-required":l,"data-state":vm(w),"data-disabled":d?"":void 0,disabled:d,value:u,...m,ref:v,onClick:zc(r.onClick,e=>{x(e=>!e),y&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),y&&t(gm,{control:h,bubbles:!b.current,name:i,value:u,checked:w,required:l,disabled:d,form:p,style:{transform:"translateX(-100%)"}})]})});pm.displayName=cm;var mm="SwitchThumb",hm=n.forwardRef((e,r)=>{const{__scopeSwitch:n,...a}=e,o=fm(mm,n);return t(Ji.span,{"data-state":vm(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:r})});hm.displayName=mm;var gm=n.forwardRef(({__scopeSwitch:e,control:r,checked:a,bubbles:o=!0,...i},s)=>{const c=n.useRef(null),l=$i(c,s),d=Ju(a),u=qu(r);return n.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==a&&r){const t=new Event("click",{bubbles:o});r.call(e,a),e.dispatchEvent(t)}},[d,a,o]),t("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function vm(e){return e?"checked":"unchecked"}gm.displayName="SwitchBubbleInput";var bm=pm,ym=hm;const wm=n.forwardRef(({className:e,...r},n)=>t(bm,{className:Rc("peer inline-flex h-[20px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...r,ref:n,children:t(ym,{className:Rc("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));wm.displayName=bm.displayName;const xm=({workspaceId:r})=>{const[n,a]=u({}),{allFeatures:o,updateFeature:i,getWorkspace:s}=jy(),[c,l]=u(null),f=be(e=>e.auth.session?.user||null);if(d(()=>{s(r).then(l)},[r]),!c)return t(im,{});const p=am(c,f?.id??null);return t("div",{children:e("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!p&&t("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!o.length&&t("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),o.length>0&&t("div",{className:"flex flex-col gap-y-3.5",children:o.map(r=>{const o=c?.features?.[r.slug];return e("div",{className:"flex items-center gap-x-2 justify-between w-full",children:[e("div",{className:"flex gap-x-2 flex-col",children:[t("h3",{className:"font-medium text-ellipsis",children:r.name}),t("p",{className:"text-muted-foreground",children:r.description})]}),t(wm,{disabled:n[r.slug]||!p,checked:o??r.defaultValue,onCheckedChange:e=>async function(e,t){if(!c)return;a(r=>({...r,[e]:t}));const r=await i(c._id,e,t);l(r),a(t=>({...t,[e]:!1}))}(r.slug,e)})]},r._id)})})]})})};function Sm(e){return`data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text x="50%" y="50%" dominant-baseline="middle" alignment-baseline="middle" text-anchor="middle" font-size="50" font-family="sans-serif">${e}</text></svg>`}const km=["🏢","🏬","🏣","🏤","🏦","🏛️","🏠","🏡","🏭","🏗️","🏪","🏨","🏫","🏥","💼","📊","📈","📉","📋","📁","📂","🗂️","🗃️","🗄️","📅","🗓️","📝","🖋️","✏️","🖊️","🖌️","🖍️","📇","📌","📍","📎","🖇️","💻","🖥️","🖨️","🖱️","⌨️","📱","📲","📡","🌐","🔗","🔒","🔓","⚙️","🔧","🛠️","🧑‍💻","👨‍💻","👩‍💻","🕹️","💾","📟","🖥️","🖲️","🚀","💡","🎨","🖼️","🧪","🔬","🧬","🎯","⚡","🎲","🎮","🧩","📷","🎥","✉️","📨","📩","📧","📞","☎️","📠","🗣️","💬","🗨️","📢","📣","🔔","🛎️","💰","💸","💳","🏦","📈","📉","⚖️","🧾","🪙","🏛️","⚗️","🧪","🔭","🔬","🩺","🧬","🩻","🏥","🌱","🌍","🌏","🌎","🌡️","👨‍💼","👩‍💼","👨‍🏫","👩‍🏫","👨‍🔬","👩‍🔬","👨‍🎨","👩‍🎨","👨‍🔧","👩‍🔧","👨‍🚀","👩‍🚀","👨‍⚖️","👩‍⚖️","🏅","🎖️","🥇","🥈","🥉","🏆","🎗️","🔑","🗝️","🧭","🛡️","🚩","🏳️‍🌈","🎟️","🎫"],Am=({workspace:r})=>{const[n,a]=u(!1),[o,i]=u("emoji"),[s,c]=u(),{updateWorkspace:l}=jy(),d=be(e=>e.auth.session?.user||null),f=Qt({resolver:Qa(xi({name:Zo().min(2,{message:"Workspace name must be at least 2 characters."}),image:Zo().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return t(im,{});const p=am(r,d?.id??null);return e("div",{children:[!p&&t("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),t(vu,{...f,children:e("form",{onSubmit:f.handleSubmit(async function(e){a(!0);try{await l(r,e)}catch(e){console.error("Failed to update workspace:",e)}finally{a(!1)}}),className:"space-y-6",children:[t(yu,{control:f.control,name:"name",render:({field:r})=>e(Su,{children:[t(ku,{children:"Name"}),t(Au,{children:t(Tu,{placeholder:"My Awesome Workspace",...r,disabled:!p})}),t(Cu,{})]})}),e("div",{className:"space-y-4",children:[e("div",{children:[t(gu,{className:"text-sm font-medium",children:"Icon"}),t(Eu,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e(kf,{value:o,disabled:!p,onValueChange:e=>i(e),className:"flex flex-col space-y-3",children:[e("div",{className:"flex items-center space-x-2",children:[t(Af,{value:"emoji",id:"emoji"}),e(gu,{htmlFor:"emoji",className:"flex items-center gap-2",children:[t(vo,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e("div",{className:"flex items-center space-x-2",children:[t(Af,{value:"url",id:"url"}),e(gu,{htmlFor:"url",className:"flex items-center gap-2",children:[t(uo,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===o&&e("div",{className:"space-y-3",children:[e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),e("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:[s&&t("span",{className:"text-2xl",children:s}),!s&&f.watch("image")?.trim()&&t("img",{src:f.watch("image")||void 0,alt:"Workspace preview"})]})]}),p&&t(lp,{className:"h-32 w-full rounded-md border",children:t("div",{className:"p-4 grid grid-cols-8 gap-2",children:km.map((e,r)=>t("button",{type:"button",onClick:()=>(e=>{c(e),f.setValue("image",Sm(e))})(e),disabled:!p,className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(s===e?"bg-primary text-primary-foreground":""),children:e},r))})})]}),"url"===o&&e("div",{className:"space-y-3",children:[t(yu,{control:f.control,name:"image",render:({field:r})=>e(Su,{children:[t(ku,{children:"Image URL"}),t(Au,{children:t(Tu,{placeholder:"https://example.com/image.png",...r,disabled:!p})}),t(Eu,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),t(Cu,{})]})}),f.watch("image")&&f.watch("image")?.trim()&&e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:t("img",{src:f.watch("image")||void 0,className:"w-full h-full object-cover",alt:"Workspace preview"})})]})]})]}),t("div",{className:"flex justify-end gap-3 pt-4",children:p&&t(Fc,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var Em=.999,Cm=/[\\\/_+.#"@\[\(\{&]/,Tm=/[\\\/_+.#"@\[\(\{&]/g,Nm=/[\s-]/,_m=/[\s-]/g;function Rm(e,t,r,n,a,o,i){if(o===t.length)return a===e.length?1:.99;var s=`${a},${o}`;if(void 0!==i[s])return i[s];for(var c,l,d,u,f=n.charAt(o),p=r.indexOf(f,a),m=0;p>=0;)(c=Rm(e,t,r,n,p+1,o+1,i))>m&&(p===a?c*=1:Cm.test(e.charAt(p-1))?(c*=.8,(d=e.slice(a,p-1).match(Tm))&&a>0&&(c*=Math.pow(Em,d.length))):Nm.test(e.charAt(p-1))?(c*=.9,(u=e.slice(a,p-1).match(_m))&&a>0&&(c*=Math.pow(Em,u.length))):(c*=.17,a>0&&(c*=Math.pow(Em,p-a))),e.charAt(p)!==t.charAt(o)&&(c*=.9999)),(c<.1&&r.charAt(p-1)===n.charAt(o+1)||n.charAt(o+1)===n.charAt(o)&&r.charAt(p-1)!==n.charAt(o))&&(.1*(l=Rm(e,t,r,n,p+1,o+2,i))>c&&(c=.1*l)),c>m&&(m=c),p=r.indexOf(f,p+1);return i[s]=m,m}function Pm(e){return e.toLowerCase().replace(_m," ")}function Om(e,t,r){return Rm(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,Pm(e),Pm(t),0,0,{})}var Dm='[cmdk-group=""]',Im='[cmdk-group-items=""]',Um='[cmdk-item=""]',Mm=`${Um}:not([aria-disabled="true"])`,Lm="cmdk-item-select",Fm="data-value",zm=(e,t,r)=>Om(e,t,r),jm=n.createContext(void 0),Bm=()=>n.useContext(jm),Wm=n.createContext(void 0),Vm=()=>n.useContext(Wm),$m=n.createContext(void 0),Gm=n.forwardRef((e,t)=>{let r=oh(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=oh(()=>new Set),o=oh(()=>new Map),i=oh(()=>new Map),s=oh(()=>new Set),c=nh(e),{label:l,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:v=!0,...b}=e,y=Wc(),w=Wc(),x=Wc(),S=n.useRef(null),k=ch();ah(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,A.emit()}},[u]),ah(()=>{k(6,R)},[]);let A=n.useMemo(()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,o,i,s;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)_(),T(),k(1,N);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(x);e?e.focus():null==(a=document.getElementById(y))||a.focus()}if(k(7,()=>{var e;r.current.selectedItemId=null==(e=P())?void 0:e.id,A.emit()}),n||k(5,R),void 0!==(null==(o=c.current)?void 0:o.value)){let e=null!=t?t:"";return void(null==(s=(i=c.current).onValueChange)||s.call(i,e))}}A.emit()}},emit:()=>{s.current.forEach(e=>e())}}),[]),E=n.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=i.current.get(e))?void 0:a.value)&&(i.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,C(t,n)),k(2,()=>{T(),A.emit()}))},item:(e,t)=>(a.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),k(3,()=>{_(),T(),r.current.value||N(),A.emit()}),()=>{i.current.delete(e),a.current.delete(e),r.current.filtered.items.delete(e);let t=P();k(4,()=>{_(),(null==t?void 0:t.getAttribute("id"))===e&&N(),A.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{i.current.delete(e),o.current.delete(e)}),filter:()=>c.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:y,inputId:x,labelId:w,listInnerRef:S}),[]);function C(e,t){var n,a;let o=null!=(a=null==(n=c.current)?void 0:n.filter)?a:zm;return e?o(e,r.current.search,t):0}function T(){if(!r.current.search||!1===c.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=o.current.get(r),a=0;n.forEach(t=>{let r=e.get(t);a=Math.max(r,a)}),t.push([r,a])});let n=S.current;O().sort((t,r)=>{var n,a;let o=t.getAttribute("id"),i=r.getAttribute("id");return(null!=(n=e.get(i))?n:0)-(null!=(a=e.get(o))?a:0)}).forEach(e=>{let t=e.closest(Im);t?t.appendChild(e.parentElement===t?e:e.closest(`${Im} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${Im} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=S.current)?void 0:t.querySelector(`${Dm}[${Fm}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function N(){let e=O().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(Fm);A.setState("value",t||void 0)}function _(){var e,t,n,s;if(!r.current.search||!1===c.current.shouldFilter)return void(r.current.filtered.count=a.current.size);r.current.filtered.groups=new Set;let l=0;for(let o of a.current){let a=C(null!=(t=null==(e=i.current.get(o))?void 0:e.value)?t:"",null!=(s=null==(n=i.current.get(o))?void 0:n.keywords)?s:[]);r.current.filtered.items.set(o,a),a>0&&l++}for(let[e,t]of o.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=l}function R(){var e,t,r;let n=P();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(Dm))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=S.current)?void 0:e.querySelector(`${Um}[aria-selected="true"]`)}function O(){var e;return Array.from((null==(e=S.current)?void 0:e.querySelectorAll(Mm))||[])}function D(e){let t=O()[e];t&&A.setState("value",t.getAttribute(Fm))}function I(e){var t;let r=P(),n=O(),a=n.findIndex(e=>e===r),o=n[a+e];null!=(t=c.current)&&t.loop&&(o=a+e<0?n[n.length-1]:a+e===n.length?n[0]:n[a+e]),o&&A.setState("value",o.getAttribute(Fm))}function U(e){let t,r=P(),n=null==r?void 0:r.closest(Dm);for(;n&&!t;)n=e>0?th(n,Dm):rh(n,Dm),t=null==n?void 0:n.querySelector(Mm);t?A.setState("value",t.getAttribute(Fm)):I(e)}let M=()=>D(O().length-1),L=e=>{e.preventDefault(),e.metaKey?M():e.altKey?U(1):I(1)},F=e=>{e.preventDefault(),e.metaKey?D(0):e.altKey?U(-1):I(-1)};return n.createElement(Ji.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=b.onKeyDown)||t.call(b,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!r)switch(e.key){case"n":case"j":v&&e.ctrlKey&&L(e);break;case"ArrowDown":L(e);break;case"p":case"k":v&&e.ctrlKey&&F(e);break;case"ArrowUp":F(e);break;case"Home":e.preventDefault(),D(0);break;case"End":e.preventDefault(),M();break;case"Enter":{e.preventDefault();let t=P();if(t){let e=new Event(Lm);t.dispatchEvent(e)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:dh},l),lh(e,e=>n.createElement(Wm.Provider,{value:A},n.createElement(jm.Provider,{value:E},e))))}),Km=n.forwardRef((e,t)=>{var r,a;let o=Wc(),i=n.useRef(null),s=n.useContext($m),c=Bm(),l=nh(e),d=null!=(a=null==(r=l.current)?void 0:r.forceMount)?a:null==s?void 0:s.forceMount;ah(()=>{if(!d)return c.item(o,null==s?void 0:s.id)},[d]);let u=sh(o,i,[e.value,e.children,i],e.keywords),f=Vm(),p=ih(e=>e.value&&e.value===u.current),m=ih(e=>!(!d&&!1!==c.filter())||(!e.search||e.filtered.items.get(o)>0));function h(){var e,t;g(),null==(t=(e=l.current).onSelect)||t.call(e,u.current)}function g(){f.setState("value",u.current,!0)}if(n.useEffect(()=>{let t=i.current;if(t&&!e.disabled)return t.addEventListener(Lm,h),()=>t.removeEventListener(Lm,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:v,value:b,onSelect:y,forceMount:w,keywords:x,...S}=e;return n.createElement(Ji.div,{ref:Vi(i,t),...S,id:o,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!p,"data-disabled":!!v,"data-selected":!!p,onPointerMove:v||c.getDisablePointerSelection()?void 0:g,onClick:v?void 0:h},e.children)}),Hm=n.forwardRef((e,t)=>{let{heading:r,children:a,forceMount:o,...i}=e,s=Wc(),c=n.useRef(null),l=n.useRef(null),d=Wc(),u=Bm(),f=ih(e=>!(!o&&!1!==u.filter())||(!e.search||e.filtered.groups.has(s)));ah(()=>u.group(s),[]),sh(s,c,[e.value,e.heading,l]);let p=n.useMemo(()=>({id:s,forceMount:o}),[o]);return n.createElement(Ji.div,{ref:Vi(c,t),...i,"cmdk-group":"",role:"presentation",hidden:!f||void 0},r&&n.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),lh(e,e=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},n.createElement($m.Provider,{value:p},e))))}),Zm=n.forwardRef((e,t)=>{let{alwaysRender:r,...a}=e,o=n.useRef(null),i=ih(e=>!e.search);return r||i?n.createElement(Ji.div,{ref:Vi(o,t),...a,"cmdk-separator":"",role:"separator"}):null}),qm=n.forwardRef((e,t)=>{let{onValueChange:r,...a}=e,o=null!=e.value,i=Vm(),s=ih(e=>e.search),c=ih(e=>e.selectedItemId),l=Bm();return n.useEffect(()=>{null!=e.value&&i.setState("search",e.value)},[e.value]),n.createElement(Ji.input,{ref:t,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:"text",value:o?e.value:s,onChange:e=>{o||i.setState("search",e.target.value),null==r||r(e.target.value)}})}),Jm=n.forwardRef((e,t)=>{let{children:r,label:a="Suggestions",...o}=e,i=n.useRef(null),s=n.useRef(null),c=ih(e=>e.selectedItemId),l=Bm();return n.useEffect(()=>{if(s.current&&i.current){let e,t=s.current,r=i.current,n=new ResizeObserver(()=>{e=requestAnimationFrame(()=>{let e=t.offsetHeight;r.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")})});return n.observe(t),()=>{cancelAnimationFrame(e),n.unobserve(t)}}},[]),n.createElement(Ji.div,{ref:Vi(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":a,id:l.listId},lh(e,e=>n.createElement("div",{ref:Vi(s,l.listInnerRef),"cmdk-list-sizer":""},e)))}),Ym=n.forwardRef((e,t)=>{let{open:r,onOpenChange:a,overlayClassName:o,contentClassName:i,container:s,...c}=e;return n.createElement(Wd,{open:r,onOpenChange:a},n.createElement($d,{container:s},n.createElement(Gd,{"cmdk-overlay":"",className:o}),n.createElement(Kd,{"aria-label":e.label,"cmdk-dialog":"",className:i},n.createElement(Gm,{ref:t,...c}))))}),Xm=n.forwardRef((e,t)=>ih(e=>0===e.filtered.count)?n.createElement(Ji.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Qm=n.forwardRef((e,t)=>{let{progress:r,children:a,label:o="Loading...",...i}=e;return n.createElement(Ji.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},lh(e,e=>n.createElement("div",{"aria-hidden":!0},e)))}),eh=Object.assign(Gm,{List:Jm,Item:Km,Input:qm,Group:Hm,Separator:Zm,Dialog:Ym,Empty:Xm,Loading:Qm});function th(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function rh(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function nh(e){let t=n.useRef(e);return ah(()=>{t.current=e}),t}var ah="undefined"==typeof window?n.useEffect:n.useLayoutEffect;function oh(e){let t=n.useRef();return void 0===t.current&&(t.current=e()),t}function ih(e){let t=Vm(),r=()=>e(t.snapshot());return n.useSyncExternalStore(t.subscribe,r,r)}function sh(e,t,r,a=[]){let o=n.useRef(),i=Bm();return ah(()=>{var n;let s=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():o.current}})(),c=a.map(e=>e.trim());i.value(e,s,c),null==(n=t.current)||n.setAttribute(Fm,s),o.current=s}),o}var ch=()=>{let[e,t]=n.useState(),r=oh(()=>new Map);return ah(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function lh({asChild:e,children:t},r){return e&&n.isValidElement(t)?n.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},r(t.props.children)):r(t)}var dh={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const uh=n.forwardRef(({className:e,...r},n)=>t(eh,{ref:n,className:Rc("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...r}));uh.displayName=eh.displayName;const fh=n.forwardRef(({className:r,...n},a)=>e("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[t(au,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),t(eh.Input,{ref:a,className:Rc("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",r),...n})]}));fh.displayName=eh.Input.displayName;const ph=n.forwardRef(({className:e,...r},n)=>t(eh.List,{ref:n,className:Rc("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...r}));ph.displayName=eh.List.displayName;n.forwardRef((e,r)=>t(eh.Empty,{ref:r,className:"py-6 text-center text-sm",...e})).displayName=eh.Empty.displayName;const mh=n.forwardRef(({className:e,...r},n)=>t(eh.Group,{ref:n,className:Rc("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...r}));mh.displayName=eh.Group.displayName;n.forwardRef(({className:e,...r},n)=>t(eh.Separator,{ref:n,className:Rc("-mx-1 h-px bg-border",e),...r})).displayName=eh.Separator.displayName;const hh=n.forwardRef(({className:e,...r},n)=>t(eh.Item,{ref:n,className:Rc("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r}));hh.displayName=eh.Item.displayName;const gh=["top","right","bottom","left"],vh=Math.min,bh=Math.max,yh=Math.round,wh=Math.floor,xh=e=>({x:e,y:e}),Sh={left:"right",right:"left",bottom:"top",top:"bottom"},kh={start:"end",end:"start"};function Ah(e,t,r){return bh(e,vh(t,r))}function Eh(e,t){return"function"==typeof e?e(t):e}function Ch(e){return e.split("-")[0]}function Th(e){return e.split("-")[1]}function Nh(e){return"x"===e?"y":"x"}function _h(e){return"y"===e?"height":"width"}const Rh=new Set(["top","bottom"]);function Ph(e){return Rh.has(Ch(e))?"y":"x"}function Oh(e){return Nh(Ph(e))}function Dh(e){return e.replace(/start|end/g,e=>kh[e])}const Ih=["left","right"],Uh=["right","left"],Mh=["top","bottom"],Lh=["bottom","top"];function Fh(e,t,r,n){const a=Th(e);let o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?Uh:Ih:t?Ih:Uh;case"left":case"right":return t?Mh:Lh;default:return[]}}(Ch(e),"start"===r,n);return a&&(o=o.map(e=>e+"-"+a),t&&(o=o.concat(o.map(Dh)))),o}function zh(e){return e.replace(/left|right|bottom|top/g,e=>Sh[e])}function jh(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Bh(e){const{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function Wh(e,t,r){let{reference:n,floating:a}=e;const o=Ph(t),i=Oh(t),s=_h(i),c=Ch(t),l="y"===o,d=n.x+n.width/2-a.width/2,u=n.y+n.height/2-a.height/2,f=n[s]/2-a[s]/2;let p;switch(c){case"top":p={x:d,y:n.y-a.height};break;case"bottom":p={x:d,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:u};break;case"left":p={x:n.x-a.width,y:u};break;default:p={x:n.x,y:n.y}}switch(Th(t)){case"start":p[i]-=f*(r&&l?-1:1);break;case"end":p[i]+=f*(r&&l?-1:1)}return p}async function Vh(e,t){var r;void 0===t&&(t={});const{x:n,y:a,platform:o,rects:i,elements:s,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=Eh(t,e),m=jh(p),h=s[f?"floating"===u?"reference":"floating":u],g=Bh(await o.getClippingRect({element:null==(r=await(null==o.isElement?void 0:o.isElement(h)))||r?h:h.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(s.floating)),boundary:l,rootBoundary:d,strategy:c})),v="floating"===u?{x:n,y:a,width:i.floating.width,height:i.floating.height}:i.reference,b=await(null==o.getOffsetParent?void 0:o.getOffsetParent(s.floating)),y=await(null==o.isElement?void 0:o.isElement(b))&&await(null==o.getScale?void 0:o.getScale(b))||{x:1,y:1},w=Bh(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:b,strategy:c}):v);return{top:(g.top-w.top+m.top)/y.y,bottom:(w.bottom-g.bottom+m.bottom)/y.y,left:(g.left-w.left+m.left)/y.x,right:(w.right-g.right+m.right)/y.x}}function $h(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Gh(e){return gh.some(t=>e[t]>=0)}const Kh=new Set(["left","top"]);function Hh(){return"undefined"!=typeof window}function Zh(e){return Yh(e)?(e.nodeName||"").toLowerCase():"#document"}function qh(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Jh(e){var t;return null==(t=(Yh(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Yh(e){return!!Hh()&&(e instanceof Node||e instanceof qh(e).Node)}function Xh(e){return!!Hh()&&(e instanceof Element||e instanceof qh(e).Element)}function Qh(e){return!!Hh()&&(e instanceof HTMLElement||e instanceof qh(e).HTMLElement)}function eg(e){return!(!Hh()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof qh(e).ShadowRoot)}const tg=new Set(["inline","contents"]);function rg(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=mg(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!tg.has(a)}const ng=new Set(["table","td","th"]);function ag(e){return ng.has(Zh(e))}const og=[":popover-open",":modal"];function ig(e){return og.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const sg=["transform","translate","scale","rotate","perspective"],cg=["transform","translate","scale","rotate","perspective","filter"],lg=["paint","layout","strict","content"];function dg(e){const t=ug(),r=Xh(e)?mg(e):e;return sg.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||cg.some(e=>(r.willChange||"").includes(e))||lg.some(e=>(r.contain||"").includes(e))}function ug(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const fg=new Set(["html","body","#document"]);function pg(e){return fg.has(Zh(e))}function mg(e){return qh(e).getComputedStyle(e)}function hg(e){return Xh(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function gg(e){if("html"===Zh(e))return e;const t=e.assignedSlot||e.parentNode||eg(e)&&e.host||Jh(e);return eg(t)?t.host:t}function vg(e){const t=gg(e);return pg(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qh(t)&&rg(t)?t:vg(t)}function bg(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=vg(e),o=a===(null==(n=e.ownerDocument)?void 0:n.body),i=qh(a);if(o){const e=yg(i);return t.concat(i,i.visualViewport||[],rg(a)?a:[],e&&r?bg(e):[])}return t.concat(a,bg(a,[],r))}function yg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wg(e){const t=mg(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Qh(e),o=a?e.offsetWidth:r,i=a?e.offsetHeight:n,s=yh(r)!==o||yh(n)!==i;return s&&(r=o,n=i),{width:r,height:n,$:s}}function xg(e){return Xh(e)?e:e.contextElement}function Sg(e){const t=xg(e);if(!Qh(t))return xh(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:o}=wg(t);let i=(o?yh(r.width):r.width)/n,s=(o?yh(r.height):r.height)/a;return i&&Number.isFinite(i)||(i=1),s&&Number.isFinite(s)||(s=1),{x:i,y:s}}const kg=xh(0);function Ag(e){const t=qh(e);return ug()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:kg}function Eg(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),o=xg(e);let i=xh(1);t&&(n?Xh(n)&&(i=Sg(n)):i=Sg(e));const s=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==qh(e))&&t}(o,r,n)?Ag(o):xh(0);let c=(a.left+s.x)/i.x,l=(a.top+s.y)/i.y,d=a.width/i.x,u=a.height/i.y;if(o){const e=qh(o),t=n&&Xh(n)?qh(n):n;let r=e,a=yg(r);for(;a&&n&&t!==r;){const e=Sg(a),t=a.getBoundingClientRect(),n=mg(a),o=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,i=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;c*=e.x,l*=e.y,d*=e.x,u*=e.y,c+=o,l+=i,r=qh(a),a=yg(r)}}return Bh({width:d,height:u,x:c,y:l})}function Cg(e,t){const r=hg(e).scrollLeft;return t?t.left+r:Eg(Jh(e)).left+r}function Tg(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-Cg(e,r),y:r.top+t.scrollTop}}const Ng=new Set(["absolute","fixed"]);function _g(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=qh(e),n=Jh(e),a=r.visualViewport;let o=n.clientWidth,i=n.clientHeight,s=0,c=0;if(a){o=a.width,i=a.height;const e=ug();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,c=a.offsetTop)}const l=Cg(n);if(l<=0){const e=n.ownerDocument,t=e.body,r=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,i=Math.abs(n.clientWidth-t.clientWidth-a);i<=25&&(o-=i)}else l<=25&&(o+=l);return{width:o,height:i,x:s,y:c}}(e,r);else if("document"===t)n=function(e){const t=Jh(e),r=hg(e),n=e.ownerDocument.body,a=bh(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=bh(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+Cg(e);const s=-r.scrollTop;return"rtl"===mg(n).direction&&(i+=bh(t.clientWidth,n.clientWidth)-a),{width:a,height:o,x:i,y:s}}(Jh(e));else if(Xh(t))n=function(e,t){const r=Eg(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,o=Qh(e)?Sg(e):xh(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:a*o.x,y:n*o.y}}(t,r);else{const r=Ag(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Bh(n)}function Rg(e,t){const r=gg(e);return!(r===t||!Xh(r)||pg(r))&&("fixed"===mg(r).position||Rg(r,t))}function Pg(e,t,r){const n=Qh(t),a=Jh(t),o="fixed"===r,i=Eg(e,!0,o,t);let s={scrollLeft:0,scrollTop:0};const c=xh(0);function l(){c.x=Cg(a)}if(n||!n&&!o)if(("body"!==Zh(t)||rg(a))&&(s=hg(t)),n){const e=Eg(t,!0,o,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else a&&l();o&&!n&&a&&l();const d=!a||n||o?xh(0):Tg(a,s);return{x:i.left+s.scrollLeft-c.x-d.x,y:i.top+s.scrollTop-c.y-d.y,width:i.width,height:i.height}}function Og(e){return"static"===mg(e).position}function Dg(e,t){if(!Qh(e)||"fixed"===mg(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Jh(e)===r&&(r=r.ownerDocument.body),r}function Ig(e,t){const r=qh(e);if(ig(e))return r;if(!Qh(e)){let t=gg(e);for(;t&&!pg(t);){if(Xh(t)&&!Og(t))return t;t=gg(t)}return r}let n=Dg(e,t);for(;n&&ag(n)&&Og(n);)n=Dg(n,t);return n&&pg(n)&&Og(n)&&!dg(n)?r:n||function(e){let t=gg(e);for(;Qh(t)&&!pg(t);){if(dg(t))return t;if(ig(t))return null;t=gg(t)}return null}(e)||r}const Ug={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const o="fixed"===a,i=Jh(n),s=!!t&&ig(t.floating);if(n===i||s&&o)return r;let c={scrollLeft:0,scrollTop:0},l=xh(1);const d=xh(0),u=Qh(n);if((u||!u&&!o)&&(("body"!==Zh(n)||rg(i))&&(c=hg(n)),Qh(n))){const e=Eg(n);l=Sg(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!i||u||o?xh(0):Tg(i,c);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+d.x+f.x,y:r.y*l.y-c.scrollTop*l.y+d.y+f.y}},getDocumentElement:Jh,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const o=[..."clippingAncestors"===r?ig(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=bg(e,[],!1).filter(e=>Xh(e)&&"body"!==Zh(e)),a=null;const o="fixed"===mg(e).position;let i=o?gg(e):e;for(;Xh(i)&&!pg(i);){const t=mg(i),r=dg(i);r||"fixed"!==t.position||(a=null),(o?!r&&!a:!r&&"static"===t.position&&a&&Ng.has(a.position)||rg(i)&&!r&&Rg(e,i))?n=n.filter(e=>e!==i):a=t,i=gg(i)}return t.set(e,n),n}(t,this._c):[].concat(r),n],i=o[0],s=o.reduce((e,r)=>{const n=_g(t,r,a);return e.top=bh(n.top,e.top),e.right=vh(n.right,e.right),e.bottom=vh(n.bottom,e.bottom),e.left=bh(n.left,e.left),e},_g(t,i,a));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:Ig,getElementRects:async function(e){const t=this.getOffsetParent||Ig,r=this.getDimensions,n=await r(e.floating);return{reference:Pg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:r}=wg(e);return{width:t,height:r}},getScale:Sg,isElement:Xh,isRTL:function(e){return"rtl"===mg(e).direction}};function Mg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Lg(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:c=!1}=n,l=xg(e),d=a||o?[...l?bg(l):[],...bg(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});const u=l&&s?function(e,t){let r,n=null;const a=Jh(e);function o(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function i(s,c){void 0===s&&(s=!1),void 0===c&&(c=1),o();const l=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=l;if(s||t(),!f||!p)return;const m={rootMargin:-wh(u)+"px "+-wh(a.clientWidth-(d+f))+"px "+-wh(a.clientHeight-(u+p))+"px "+-wh(d)+"px",threshold:bh(0,vh(1,c))||1};let h=!0;function g(t){const n=t[0].intersectionRatio;if(n!==c){if(!h)return i();n?i(!1,n):r=setTimeout(()=>{i(!1,1e-7)},1e3)}1!==n||Mg(l,e.getBoundingClientRect())||i(),h=!1}try{n=new IntersectionObserver(g,{...m,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),o}(l,r):null;let f,p=-1,m=null;i&&(m=new ResizeObserver(e=>{let[n]=e;n&&n.target===l&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),r()}),l&&!c&&m.observe(l),m.observe(t));let h=c?Eg(e):null;return c&&function t(){const n=Eg(e);h&&!Mg(h,n)&&r();h=n,f=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==u||u(),null==(e=m)||e.disconnect(),m=null,c&&cancelAnimationFrame(f)}}const Fg=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:o,placement:i,middlewareData:s}=t,c=await async function(e,t){const{placement:r,platform:n,elements:a}=e,o=await(null==n.isRTL?void 0:n.isRTL(a.floating)),i=Ch(r),s=Th(r),c="y"===Ph(r),l=Kh.has(i)?-1:1,d=o&&c?-1:1,u=Eh(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&"number"==typeof m&&(p="end"===s?-1*m:m),c?{x:p*d,y:f*l}:{x:f*l,y:p*d}}(t,e);return i===(null==(r=s.offset)?void 0:r.placement)&&null!=(n=s.arrow)&&n.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:{...c,placement:i}}}}},zg=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=Eh(e,t),l={x:r,y:n},d=await Vh(t,c),u=Ph(Ch(a)),f=Nh(u);let p=l[f],m=l[u];if(o){const e="y"===f?"bottom":"right";p=Ah(p+d["y"===f?"top":"left"],p,p-d[e])}if(i){const e="y"===u?"bottom":"right";m=Ah(m+d["y"===u?"top":"left"],m,m-d[e])}const h=s.fn({...t,[f]:p,[u]:m});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[f]:o,[u]:i}}}}}},jg=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:o,rects:i,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=Eh(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const v=Ch(a),b=Ph(s),y=Ch(s)===s,w=await(null==c.isRTL?void 0:c.isRTL(l.floating)),x=f||(y||!h?[zh(s)]:function(e){const t=zh(e);return[Dh(e),t,Dh(t)]}(s)),S="none"!==m;!f&&S&&x.push(...Fh(s,h,m,w));const k=[s,...x],A=await Vh(t,g),E=[];let C=(null==(n=o.flip)?void 0:n.overflows)||[];if(d&&E.push(A[v]),u){const e=function(e,t,r){void 0===r&&(r=!1);const n=Th(e),a=Oh(e),o=_h(a);let i="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=zh(i)),[i,zh(i)]}(a,i,w);E.push(A[e[0]],A[e[1]])}if(C=[...C,{placement:a,overflows:E}],!E.every(e=>e<=0)){var T,N;const e=((null==(T=o.flip)?void 0:T.index)||0)+1,t=k[e];if(t){if(!("alignment"===u&&b!==Ph(t))||C.every(e=>Ph(e.placement)!==b||e.overflows[0]>0))return{data:{index:e,overflows:C},reset:{placement:t}}}let r=null==(N=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:N.placement;if(!r)switch(p){case"bestFit":{var _;const e=null==(_=C.filter(e=>{if(S){const t=Ph(e.placement);return t===b||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:_[0];e&&(r=e);break}case"initialPlacement":r=s}if(a!==r)return{reset:{placement:r}}}return{}}}},Bg=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:o,platform:i,elements:s}=t,{apply:c=()=>{},...l}=Eh(e,t),d=await Vh(t,l),u=Ch(a),f=Th(a),p="y"===Ph(a),{width:m,height:h}=o.floating;let g,v;"top"===u||"bottom"===u?(g=u,v=f===(await(null==i.isRTL?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(v=u,g="end"===f?"top":"bottom");const b=h-d.top-d.bottom,y=m-d.left-d.right,w=vh(h-d[g],b),x=vh(m-d[v],y),S=!t.middlewareData.shift;let k=w,A=x;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(A=y),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(k=b),S&&!f){const e=bh(d.left,0),t=bh(d.right,0),r=bh(d.top,0),n=bh(d.bottom,0);p?A=m-2*(0!==e||0!==t?e+t:bh(d.left,d.right)):k=h-2*(0!==r||0!==n?r+n:bh(d.top,d.bottom))}await c({...t,availableWidth:A,availableHeight:k});const E=await i.getDimensions(s.floating);return m!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}},Wg=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...a}=Eh(e,t);switch(n){case"referenceHidden":{const e=$h(await Vh(t,{...a,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Gh(e)}}}case"escaped":{const e=$h(await Vh(t,{...a,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:Gh(e)}}}default:return{}}}}},Vg=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:o,platform:i,elements:s,middlewareData:c}=t,{element:l,padding:d=0}=Eh(e,t)||{};if(null==l)return{};const u=jh(d),f={x:r,y:n},p=Oh(a),m=_h(p),h=await i.getDimensions(l),g="y"===p,v=g?"top":"left",b=g?"bottom":"right",y=g?"clientHeight":"clientWidth",w=o.reference[m]+o.reference[p]-f[p]-o.floating[m],x=f[p]-o.reference[p],S=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l));let k=S?S[y]:0;k&&await(null==i.isElement?void 0:i.isElement(S))||(k=s.floating[y]||o.floating[m]);const A=w/2-x/2,E=k/2-h[m]/2-1,C=vh(u[v],E),T=vh(u[b],E),N=C,_=k-h[m]-T,R=k/2-h[m]/2+A,P=Ah(N,R,_),O=!c.arrow&&null!=Th(a)&&R!==P&&o.reference[m]/2-(R<N?C:T)-h[m]/2<0,D=O?R<N?R-N:R-_:0;return{[p]:f[p]+D,data:{[p]:P,centerOffset:R-P-D,...O&&{alignmentOffset:D}},reset:O}}}),$g=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:o,middlewareData:i}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Eh(e,t),d={x:r,y:n},u=Ph(a),f=Nh(u);let p=d[f],m=d[u];const h=Eh(s,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const e="y"===f?"height":"width",t=o.reference[f]-o.floating[e]+g.mainAxis,r=o.reference[f]+o.reference[e]-g.mainAxis;p<t?p=t:p>r&&(p=r)}if(l){var v,b;const e="y"===f?"width":"height",t=Kh.has(Ch(a)),r=o.reference[u]-o.floating[e]+(t&&(null==(v=i.offset)?void 0:v[u])||0)+(t?0:g.crossAxis),n=o.reference[u]+o.reference[e]+(t?0:(null==(b=i.offset)?void 0:b[u])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:p,[u]:m}}}},Gg=(e,t,r)=>{const n=new Map,a={platform:Ug,...r},o={...a.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:o=[],platform:i}=r,s=o.filter(Boolean),c=await(null==i.isRTL?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=Wh(l,n,c),f=n,p={},m=0;for(let r=0;r<s.length;r++){const{name:o,fn:h}=s[r],{x:g,y:v,data:b,reset:y}=await h({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:p,rects:l,platform:i,elements:{reference:e,floating:t}});d=null!=g?g:d,u=null!=v?v:u,p={...p,[o]:{...p[o],...b}},y&&m<=50&&(m++,"object"==typeof y&&(y.placement&&(f=y.placement),y.rects&&(l=!0===y.rects?await i.getElementRects({reference:e,floating:t,strategy:a}):y.rects),({x:d,y:u}=Wh(l,f,c))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:o})};var Kg="undefined"!=typeof document?h:function(){};function Hg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;0!==n--;)if(!Hg(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;0!==n--;){const r=a[n];if(("_owner"!==r||!e.$$typeof)&&!Hg(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function Zg(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function qg(e,t){const r=Zg(e);return Math.round(t*r)/r}function Jg(e){const t=n.useRef(e);return Kg(()=>{t.current=e}),t}const Yg=e=>({name:"arrow",options:e,fn(t){const{element:r,padding:n}="function"==typeof e?e(t):e;return r&&(a=r,{}.hasOwnProperty.call(a,"current"))?null!=r.current?Vg({element:r.current,padding:n}).fn(t):{}:r?Vg({element:r,padding:n}).fn(t):{};var a}}),Xg=(e,t)=>({...Fg(e),options:[e,t]}),Qg=(e,t)=>({...zg(e),options:[e,t]}),ev=(e,t)=>({...$g(e),options:[e,t]}),tv=(e,t)=>({...jg(e),options:[e,t]}),rv=(e,t)=>({...Bg(e),options:[e,t]}),nv=(e,t)=>({...Wg(e),options:[e,t]}),av=(e,t)=>({...Yg(e),options:[e,t]});var ov=n.forwardRef((e,r)=>{const{children:n,width:a=10,height:o=5,...i}=e;return t(Ji.svg,{...i,ref:r,width:a,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:t("polygon",{points:"0,0 30,0 15,10"})})});ov.displayName="Arrow";var iv=ov,sv="Popper",[cv,lv]=Fi(sv),[dv,uv]=cv(sv),fv=e=>{const{__scopePopper:r,children:a}=e,[o,i]=n.useState(null);return t(dv,{scope:r,anchor:o,onAnchorChange:i,children:a})};fv.displayName=sv;var pv="PopperAnchor",mv=n.forwardRef((e,r)=>{const{__scopePopper:a,virtualRef:o,...i}=e,s=uv(pv,a),c=n.useRef(null),l=$i(r,c),d=n.useRef(null);return n.useEffect(()=>{const e=d.current;d.current=o?.current||c.current,e!==d.current&&s.onAnchorChange(d.current)}),o?null:t(Ji.div,{...i,ref:l})});mv.displayName=pv;var hv="PopperContent",[gv,vv]=cv(hv),bv=n.forwardRef((e,r)=>{const{__scopePopper:a,side:o="bottom",sideOffset:i=0,align:s="center",alignOffset:c=0,arrowPadding:l=0,avoidCollisions:d=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:g,...b}=e,y=uv(hv,a),[w,x]=n.useState(null),S=$i(r,e=>x(e)),[k,A]=n.useState(null),E=qu(k),C=E?.width??0,T=E?.height??0,N=o+("center"!==s?"-"+s:""),_="number"==typeof f?f:{top:0,right:0,bottom:0,left:0,...f},R=Array.isArray(u)?u:[u],P=R.length>0,O={padding:_,boundary:R.filter(Sv),altBoundary:P},{refs:D,floatingStyles:I,placement:U,isPositioned:M,middlewareData:L}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:o,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:l,open:d}=e,[u,f]=n.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=n.useState(a);Hg(p,a)||m(a);const[h,g]=n.useState(null),[b,y]=n.useState(null),w=n.useCallback(e=>{e!==A.current&&(A.current=e,g(e))},[]),x=n.useCallback(e=>{e!==E.current&&(E.current=e,y(e))},[]),S=i||h,k=s||b,A=n.useRef(null),E=n.useRef(null),C=n.useRef(u),T=null!=l,N=Jg(l),_=Jg(o),R=Jg(d),P=n.useCallback(()=>{if(!A.current||!E.current)return;const e={placement:t,strategy:r,middleware:p};_.current&&(e.platform=_.current),Gg(A.current,E.current,e).then(e=>{const t={...e,isPositioned:!1!==R.current};O.current&&!Hg(C.current,t)&&(C.current=t,v.flushSync(()=>{f(t)}))})},[p,t,r,_,R]);Kg(()=>{!1===d&&C.current.isPositioned&&(C.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[d]);const O=n.useRef(!1);Kg(()=>(O.current=!0,()=>{O.current=!1}),[]),Kg(()=>{if(S&&(A.current=S),k&&(E.current=k),S&&k){if(N.current)return N.current(S,k,P);P()}},[S,k,P,N,T]);const D=n.useMemo(()=>({reference:A,floating:E,setReference:w,setFloating:x}),[w,x]),I=n.useMemo(()=>({reference:S,floating:k}),[S,k]),U=n.useMemo(()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=qg(I.floating,u.x),n=qg(I.floating,u.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...Zg(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,c,I.floating,u.x,u.y]);return n.useMemo(()=>({...u,update:P,refs:D,elements:I,floatingStyles:U}),[u,P,D,I,U])}({strategy:"fixed",placement:N,whileElementsMounted:(...e)=>Lg(...e,{animationFrame:"always"===h}),elements:{reference:y.anchor},middleware:[Xg({mainAxis:i+T,alignmentAxis:c}),d&&Qg({mainAxis:!0,crossAxis:!1,limiter:"partial"===p?ev():void 0,...O}),d&&tv({...O}),rv({...O,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const{width:a,height:o}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${r}px`),i.setProperty("--radix-popper-available-height",`${n}px`),i.setProperty("--radix-popper-anchor-width",`${a}px`),i.setProperty("--radix-popper-anchor-height",`${o}px`)}}),k&&av({element:k,padding:l}),kv({arrowWidth:C,arrowHeight:T}),m&&nv({strategy:"referenceHidden",...O})]}),[F,z]=Av(U),j=ji(g);Bi(()=>{M&&j?.()},[M,j]);const B=L.arrow?.x,W=L.arrow?.y,V=0!==L.arrow?.centerOffset,[$,G]=n.useState();return Bi(()=>{w&&G(window.getComputedStyle(w).zIndex)},[w]),t("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:M?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:$,"--radix-popper-transform-origin":[L.transformOrigin?.x,L.transformOrigin?.y].join(" "),...L.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t(gv,{scope:a,placedSide:F,onArrowChange:A,arrowX:B,arrowY:W,shouldHideArrow:V,children:t(Ji.div,{"data-side":F,"data-align":z,...b,ref:S,style:{...b.style,animation:M?void 0:"none"}})})})});bv.displayName=hv;var yv="PopperArrow",wv={top:"bottom",right:"left",bottom:"top",left:"right"},xv=n.forwardRef(function(e,r){const{__scopePopper:n,...a}=e,o=vv(yv,n),i=wv[o.placedSide];return t("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:t(iv,{...a,ref:r,style:{...a.style,display:"block"}})})});function Sv(e){return null!==e}xv.displayName=yv;var kv=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,o=0!==a.arrow?.centerOffset,i=o?0:e.arrowWidth,s=o?0:e.arrowHeight,[c,l]=Av(r),d={start:"0%",center:"50%",end:"100%"}[l],u=(a.arrow?.x??0)+i/2,f=(a.arrow?.y??0)+s/2;let p="",m="";return"bottom"===c?(p=o?d:`${u}px`,m=-s+"px"):"top"===c?(p=o?d:`${u}px`,m=`${n.floating.height+s}px`):"right"===c?(p=-s+"px",m=o?d:`${f}px`):"left"===c&&(p=`${n.floating.width+s}px`,m=o?d:`${f}px`),{data:{x:p,y:m}}}});function Av(e){const[t,r="center"]=e.split("-");return[t,r]}var Ev=fv,Cv=mv,Tv=bv,Nv=xv,_v="Popover",[Rv,Pv]=Fi(_v,[lv]),Ov=lv(),[Dv,Iv]=Rv(_v),Uv=e=>{const{__scopePopover:r,children:a,open:o,defaultOpen:i,onOpenChange:s,modal:c=!1}=e,l=Ov(r),d=n.useRef(null),[u,f]=n.useState(!1),[p,m]=$c({prop:o,defaultProp:i??!1,onChange:s,caller:_v});return t(Ev,{...l,children:t(Dv,{scope:r,contentId:Wc(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:n.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:n.useCallback(()=>f(!0),[]),onCustomAnchorRemove:n.useCallback(()=>f(!1),[]),modal:c,children:a})})};Uv.displayName=_v;var Mv="PopoverAnchor";n.forwardRef((e,r)=>{const{__scopePopover:a,...o}=e,i=Iv(Mv,a),s=Ov(a),{onCustomAnchorAdd:c,onCustomAnchorRemove:l}=i;return n.useEffect(()=>(c(),()=>l()),[c,l]),t(Cv,{...s,...o,ref:r})}).displayName=Mv;var Lv="PopoverTrigger",Fv=n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=Iv(Lv,n),i=Ov(n),s=$i(r,o.triggerRef),c=t(Ji.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Jv(o.open),...a,ref:s,onClick:zc(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?c:t(Cv,{asChild:!0,...i,children:c})});Fv.displayName=Lv;var zv="PopoverPortal",[jv,Bv]=Rv(zv,{forceMount:void 0}),Wv=e=>{const{__scopePopover:r,forceMount:n,children:a,container:o}=e,i=Iv(zv,r);return t(jv,{scope:r,forceMount:n,children:t(dl,{present:n||i.open,children:t(ll,{asChild:!0,container:o,children:a})})})};Wv.displayName=zv;var Vv="PopoverContent",$v=n.forwardRef((e,r)=>{const n=Bv(Vv,e.__scopePopover),{forceMount:a=n.forceMount,...o}=e,i=Iv(Vv,e.__scopePopover);return t(dl,{present:a||i.open,children:i.modal?t(Kv,{...o,ref:r}):t(Hv,{...o,ref:r})})});$v.displayName=Vv;var Gv=Gi("PopoverContent.RemoveScroll"),Kv=n.forwardRef((e,r)=>{const a=Iv(Vv,e.__scopePopover),o=n.useRef(null),i=$i(r,o),s=n.useRef(!1);return n.useEffect(()=>{const e=o.current;if(e)return cd(e)},[]),t(td,{as:Gv,allowPinchZoom:!0,children:t(Zv,{...e,ref:i,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:zc(e.onCloseAutoFocus,e=>{e.preventDefault(),s.current||a.triggerRef.current?.focus()}),onPointerDownOutside:zc(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;s.current=n},{checkForDefaultPrevented:!1}),onFocusOutside:zc(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Hv=n.forwardRef((e,r)=>{const a=Iv(Vv,e.__scopePopover),o=n.useRef(!1),i=n.useRef(!1);return t(Zv,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||a.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));const r=t.target,n=a.triggerRef.current?.contains(r);n&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),Zv=n.forwardRef((e,r)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:u,...f}=e,p=Iv(Vv,n),m=Ov(n);return pl(),t(rl,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:i,children:t(Jc,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:t(Tv,{"data-state":Jv(p.open),role:"dialog",id:p.contentId,...m,...f,ref:r,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),qv="PopoverClose";n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=Iv(qv,n);return t(Ji.button,{type:"button",...a,ref:r,onClick:zc(e.onClick,()=>o.onOpenChange(!1))})}).displayName=qv;function Jv(e){return e?"open":"closed"}n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=Ov(n);return t(Nv,{...o,...a,ref:r})}).displayName="PopoverArrow";var Yv=Wv,Xv=$v;const Qv=Uv,eb=Fv,tb=n.forwardRef(({className:e,align:r="center",sideOffset:a=4,...o},i)=>{const{container:s}=n.useContext(ke);return t(Yv,{container:s,children:t(Xv,{ref:i,align:r,sideOffset:a,className:Rc("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})})});tb.displayName=Xv.displayName;const rb={USD:"$",EUR:"€",JPY:"¥",GBP:"£",AUD:"A$",CAD:"C$",CHF:"CHF",CNY:"¥",SEK:"kr",NZD:"NZ$",INR:"₹",RUB:"₽",KRW:"₩",BRL:"R$",ZAR:"R",HKD:"HK$",SGD:"S$",MXN:"Mex$",NOK:"kr",TRY:"₺",IDR:"Rp",PLN:"zł",THB:"฿",ILS:"₪",PHP:"₱",MYR:"RM",CZK:"Kč",HUF:"Ft",DKK:"kr",PKR:"₨",EGP:"£",NGN:"₦",BDT:"৳",UAH:"₴",KZT:"₸",VND:"₫",ARS:"$",BGN:"лв",COP:"COL$",HRK:"kn",ISK:"kr",KES:"KSh",LKR:"Rs",MAD:"د.م.",MNT:"₮",NPR:"रू",RSD:"дин.",SAR:"ر.س",TWD:"NT$",UYU:"$U",YER:"﷼",FJD:"FJ$",JMD:"J$",HTG:"G",BHD:"ب.د",KWD:"د.ك",OMR:"ر.ع.",BND:"B$",KPW:"₩",GHS:"₵",SYP:"ل.س",SLL:"Le",SSP:"£",AFN:"؋",MGA:"Ar",MDL:"lei",FOK:"kr",GMD:"D",LTL:"Lt",LVL:"Ls",HNL:"L",GEL:"₾",BMD:"$",AWG:"Afl",BTN:"Nu",GTQ:"Q",TZS:"TSh",BBD:"Bds$",NAD:"N$",BZD:"$",JEP:"£",WST:"T",PGK:"K",KGS:"лв",AZN:"₼",QAR:"ر.ق",XOF:"CFA",XPF:"CFP"},nb={AF:"AFN",AX:"EUR",AL:"ALL",DZ:"DZD",AS:"USD",AD:"EUR",AO:"AOA",AI:"XCD",AQ:"USD",AG:"XCD",AR:"ARS",AM:"AMD",AW:"AWG",AU:"AUD",AT:"EUR",AZ:"AZN",BS:"BSD",BH:"BHD",BD:"BDT",BB:"BBD",BY:"BYN",BE:"EUR",BZ:"BZD",BJ:"XOF",BM:"BMD",BT:"BTN",BO:"BOB",BA:"BAM",BW:"BWP",BV:"NOK",BR:"BRL",IO:"USD",BN:"BND",BG:"BGN",BF:"XOF",BI:"BIF",KH:"KHR",CM:"XAF",CA:"CAD",CV:"CVE",KY:"KYD",CF:"XAF",TD:"XAF",CL:"CLP",CN:"CNY",CX:"AUD",CC:"AUD",CO:"COP",KM:"KMF",CG:"XAF",CD:"CDF",CK:"NZD",CR:"CRC",CI:"XOF",HR:"HRK",CU:"CUP",CY:"EUR",CZ:"CZK",DK:"DKK",DJ:"DJF",DM:"XCD",DO:"DOP",EC:"USD",EG:"EGP",SV:"USD",GQ:"XAF",ER:"ERN",EE:"EUR",ET:"ETB",FK:"FKP",FO:"DKK",FJ:"FJD",FI:"EUR",FR:"EUR",GF:"EUR",PF:"XPF",TF:"EUR",GA:"XAF",GM:"GMD",GE:"GEL",DE:"EUR",GH:"GHS",GI:"GIP",GR:"EUR",GL:"DKK",GD:"XCD",GP:"EUR",GU:"USD",GT:"GTQ",GG:"GBP",GN:"GNF",GW:"XOF",GY:"GYD",HT:"HTG",HM:"AUD",VA:"EUR",HN:"HNL",HK:"HKD",HU:"HUF",IS:"ISK",IN:"INR",ID:"IDR",IR:"IRR",IQ:"IQD",IE:"EUR",IM:"GBP",IL:"ILS",IT:"EUR",JM:"JMD",JP:"JPY",JE:"GBP",JO:"JOD",KZ:"KZT",KE:"KES",KI:"AUD",KP:"KPW",KR:"KRW",KW:"KWD",KG:"KGS",LA:"LAK",LV:"EUR",LB:"LBP",LS:"LSL",LR:"LRD",LY:"LYD",LI:"CHF",LT:"EUR",LU:"EUR",MO:"MOP",MK:"MKD",MG:"MGA",MW:"MWK",MY:"MYR",MV:"MVR",ML:"XOF",MT:"EUR",MH:"USD",MQ:"EUR",MR:"MRU",MU:"MUR",YT:"EUR",MX:"MXN",FM:"USD",MD:"MDL",MC:"EUR",MN:"MNT",ME:"EUR",MS:"XCD",MA:"MAD",MZ:"MZN",MM:"MMK",NA:"NAD",NR:"AUD",NP:"NPR",NL:"EUR",AN:"ANG",NC:"XPF",NZ:"NZD",NI:"NIO",NE:"XOF",NG:"NGN",NU:"NZD",NF:"AUD",MP:"USD",NO:"NOK",OM:"OMR",PK:"PKR",PW:"USD",PS:"ILS",PA:"PAB",PG:"PGK",PY:"PYG",PE:"PEN",PH:"PHP",PN:"NZD",PL:"PLN",PT:"EUR",PR:"USD",QA:"QAR",RE:"EUR",RO:"RON",RU:"RUB",RW:"RWF",SH:"SHP",KN:"XCD",LC:"XCD",PM:"EUR",VC:"XCD",WS:"WST",SM:"EUR",ST:"STN",SA:"SAR",SN:"XOF",RS:"RSD",SC:"SCR",SL:"SLL",SG:"SGD",SK:"EUR",SI:"EUR",SB:"SBD",SO:"SOS",ZA:"ZAR",GS:"GBP",ES:"EUR",LK:"LKR",SD:"SDG",SR:"SRD",SJ:"NOK",SZ:"SZL",SE:"SEK",CH:"CHF",SY:"SYP",TW:"TWD",TJ:"TJS",TZ:"TZS",TH:"THB"},ab=[{name:"Afghanistan",code:"AF"},{name:"land Islands",code:"AX"},{name:"Albania",code:"AL"},{name:"Algeria",code:"DZ"},{name:"American Samoa",code:"AS"},{name:"AndorrA",code:"AD"},{name:"Angola",code:"AO"},{name:"Anguilla",code:"AI"},{name:"Antarctica",code:"AQ"},{name:"Antigua and Barbuda",code:"AG"},{name:"Argentina",code:"AR"},{name:"Armenia",code:"AM"},{name:"Aruba",code:"AW"},{name:"Australia",code:"AU"},{name:"Austria",code:"AT"},{name:"Azerbaijan",code:"AZ"},{name:"Bahamas",code:"BS"},{name:"Bahrain",code:"BH"},{name:"Bangladesh",code:"BD"},{name:"Barbados",code:"BB"},{name:"Belarus",code:"BY"},{name:"Belgium",code:"BE"},{name:"Belize",code:"BZ"},{name:"Benin",code:"BJ"},{name:"Bermuda",code:"BM"},{name:"Bhutan",code:"BT"},{name:"Bolivia",code:"BO"},{name:"Bosnia and Herzegovina",code:"BA"},{name:"Botswana",code:"BW"},{name:"Bouvet Island",code:"BV"},{name:"Brazil",code:"BR"},{name:"British Indian Ocean Territory",code:"IO"},{name:"Brunei Darussalam",code:"BN"},{name:"Bulgaria",code:"BG"},{name:"Burkina Faso",code:"BF"},{name:"Burundi",code:"BI"},{name:"Cambodia",code:"KH"},{name:"Cameroon",code:"CM"},{name:"Canada",code:"CA"},{name:"Cape Verde",code:"CV"},{name:"Cayman Islands",code:"KY"},{name:"Central African Republic",code:"CF"},{name:"Chad",code:"TD"},{name:"Chile",code:"CL"},{name:"China",code:"CN"},{name:"Christmas Island",code:"CX"},{name:"Cocos (Keeling) Islands",code:"CC"},{name:"Colombia",code:"CO"},{name:"Comoros",code:"KM"},{name:"Congo",code:"CG"},{name:"Congo, The Democratic Republic of the",code:"CD"},{name:"Cook Islands",code:"CK"},{name:"Costa Rica",code:"CR"},{name:"Cote D Ivoire",code:"CI"},{name:"Croatia",code:"HR"},{name:"Cuba",code:"CU"},{name:"Cyprus",code:"CY"},{name:"Czech Republic",code:"CZ"},{name:"Denmark",code:"DK"},{name:"Djibouti",code:"DJ"},{name:"Dominica",code:"DM"},{name:"Dominican Republic",code:"DO"},{name:"Ecuador",code:"EC"},{name:"Egypt",code:"EG"},{name:"El Salvador",code:"SV"},{name:"Equatorial Guinea",code:"GQ"},{name:"Eritrea",code:"ER"},{name:"Estonia",code:"EE"},{name:"Ethiopia",code:"ET"},{name:"Falkland Islands (Malvinas)",code:"FK"},{name:"Faroe Islands",code:"FO"},{name:"Fiji",code:"FJ"},{name:"Finland",code:"FI"},{name:"France",code:"FR"},{name:"French Guiana",code:"GF"},{name:"French Polynesia",code:"PF"},{name:"French Southern Territories",code:"TF"},{name:"Gabon",code:"GA"},{name:"Gambia",code:"GM"},{name:"Georgia",code:"GE"},{name:"Germany",code:"DE"},{name:"Ghana",code:"GH"},{name:"Gibraltar",code:"GI"},{name:"Greece",code:"GR"},{name:"Greenland",code:"GL"},{name:"Grenada",code:"GD"},{name:"Guadeloupe",code:"GP"},{name:"Guam",code:"GU"},{name:"Guatemala",code:"GT"},{name:"Guernsey",code:"GG"},{name:"Guinea",code:"GN"},{name:"Guinea-Bissau",code:"GW"},{name:"Guyana",code:"GY"},{name:"Haiti",code:"HT"},{name:"Heard Island and Mcdonald Islands",code:"HM"},{name:"Holy See (Vatican City State)",code:"VA"},{name:"Honduras",code:"HN"},{name:"Hong Kong",code:"HK"},{name:"Hungary",code:"HU"},{name:"Iceland",code:"IS"},{name:"India",code:"IN"},{name:"Indonesia",code:"ID"},{name:"Iran, Islamic Republic Of",code:"IR"},{name:"Iraq",code:"IQ"},{name:"Ireland",code:"IE"},{name:"Isle of Man",code:"IM"},{name:"Israel",code:"IL"},{name:"Italy",code:"IT"},{name:"Jamaica",code:"JM"},{name:"Japan",code:"JP"},{name:"Jersey",code:"JE"},{name:"Jordan",code:"JO"},{name:"Kazakhstan",code:"KZ"},{name:"Kenya",code:"KE"},{name:"Kiribati",code:"KI"},{name:'Korea, Democratic People"S Republic of',code:"KP"},{name:"Korea, Republic of",code:"KR"},{name:"Kuwait",code:"KW"},{name:"Kyrgyzstan",code:"KG"},{name:'Lao People"S Democratic Republic',code:"LA"},{name:"Latvia",code:"LV"},{name:"Lebanon",code:"LB"},{name:"Lesotho",code:"LS"},{name:"Liberia",code:"LR"},{name:"Libyan Arab Jamahiriya",code:"LY"},{name:"Liechtenstein",code:"LI"},{name:"Lithuania",code:"LT"},{name:"Luxembourg",code:"LU"},{name:"Macao",code:"MO"},{name:"Macedonia, The Former Yugoslav Republic of",code:"MK"},{name:"Madagascar",code:"MG"},{name:"Malawi",code:"MW"},{name:"Malaysia",code:"MY"},{name:"Maldives",code:"MV"},{name:"Mali",code:"ML"},{name:"Malta",code:"MT"},{name:"Marshall Islands",code:"MH"},{name:"Martinique",code:"MQ"},{name:"Mauritania",code:"MR"},{name:"Mauritius",code:"MU"},{name:"Mayotte",code:"YT"},{name:"Mexico",code:"MX"},{name:"Micronesia, Federated States of",code:"FM"},{name:"Moldova, Republic of",code:"MD"},{name:"Monaco",code:"MC"},{name:"Mongolia",code:"MN"},{name:"Montenegro",code:"ME"},{name:"Montserrat",code:"MS"},{name:"Morocco",code:"MA"},{name:"Mozambique",code:"MZ"},{name:"Myanmar",code:"MM"},{name:"Namibia",code:"NA"},{name:"Nauru",code:"NR"},{name:"Nepal",code:"NP"},{name:"Netherlands",code:"NL"},{name:"Netherlands Antilles",code:"AN"},{name:"New Caledonia",code:"NC"},{name:"New Zealand",code:"NZ"},{name:"Nicaragua",code:"NI"},{name:"Niger",code:"NE"},{name:"Nigeria",code:"NG"},{name:"Niue",code:"NU"},{name:"Norfolk Island",code:"NF"},{name:"Northern Mariana Islands",code:"MP"},{name:"Norway",code:"NO"},{name:"Oman",code:"OM"},{name:"Pakistan",code:"PK"},{name:"Palau",code:"PW"},{name:"Palestinian Territory, Occupied",code:"PS"},{name:"Panama",code:"PA"},{name:"Papua New Guinea",code:"PG"},{name:"Paraguay",code:"PY"},{name:"Peru",code:"PE"},{name:"Philippines",code:"PH"},{name:"Pitcairn",code:"PN"},{name:"Poland",code:"PL"},{name:"Portugal",code:"PT"},{name:"Puerto Rico",code:"PR"},{name:"Qatar",code:"QA"},{name:"Reunion",code:"RE"},{name:"Romania",code:"RO"},{name:"Russian Federation",code:"RU"},{name:"RWANDA",code:"RW"},{name:"Saint Helena",code:"SH"},{name:"Saint Kitts and Nevis",code:"KN"},{name:"Saint Lucia",code:"LC"},{name:"Saint Pierre and Miquelon",code:"PM"},{name:"Saint Vincent and the Grenadines",code:"VC"},{name:"Samoa",code:"WS"},{name:"San Marino",code:"SM"},{name:"Sao Tome and Principe",code:"ST"},{name:"Saudi Arabia",code:"SA"},{name:"Senegal",code:"SN"},{name:"Serbia",code:"RS"},{name:"Seychelles",code:"SC"},{name:"Sierra Leone",code:"SL"},{name:"Singapore",code:"SG"},{name:"Slovakia",code:"SK"},{name:"Slovenia",code:"SI"},{name:"Solomon Islands",code:"SB"},{name:"Somalia",code:"SO"},{name:"South Africa",code:"ZA"},{name:"South Georgia and the South Sandwich Islands",code:"GS"},{name:"Spain",code:"ES"},{name:"Sri Lanka",code:"LK"},{name:"Sudan",code:"SD"},{name:"Suriname",code:"SR"},{name:"Svalbard and Jan Mayen",code:"SJ"},{name:"Swaziland",code:"SZ"},{name:"Sweden",code:"SE"},{name:"Switzerland",code:"CH"},{name:"Syrian Arab Republic",code:"SY"},{name:"Taiwan, Province of China",code:"TW"},{name:"Tajikistan",code:"TJ"},{name:"Tanzania, United Republic of",code:"TZ"},{name:"Thailand",code:"TH"},{name:"Timor-Leste",code:"TL"},{name:"Togo",code:"TG"},{name:"Tokelau",code:"TK"},{name:"Tonga",code:"TO"},{name:"Trinidad and Tobago",code:"TT"},{name:"Tunisia",code:"TN"},{name:"Turkey",code:"TR"},{name:"Turkmenistan",code:"TM"},{name:"Turks and Caicos Islands",code:"TC"},{name:"Tuvalu",code:"TV"},{name:"Uganda",code:"UG"},{name:"Ukraine",code:"UA"},{name:"United Arab Emirates",code:"AE"},{name:"United Kingdom",code:"GB"},{name:"United States",code:"US"},{name:"United States Minor Outlying Islands",code:"UM"},{name:"Uruguay",code:"UY"},{name:"Uzbekistan",code:"UZ"},{name:"Vanuatu",code:"VU"},{name:"Venezuela",code:"VE"},{name:"Viet Nam",code:"VN"},{name:"Virgin Islands, British",code:"VG"},{name:"Virgin Islands, U.S.",code:"VI"},{name:"Wallis and Futuna",code:"WF"},{name:"Western Sahara",code:"EH"},{name:"Yemen",code:"YE"},{name:"Zambia",code:"ZM"},{name:"Zimbabwe",code:"ZW"}].map(e=>{const t=nb[e.code]||"USD",r=rb[t]||"";return{value:e.code,flag:(n=e.code,n.toUpperCase().replace(/./g,e=>String.fromCodePoint(127397+e.charCodeAt(0)))),text:e.name,currencyCode:t,currencyIcon:r};var n});function ob(r){const[n,a]=u(r.value||""),[o,i]=u(!1),s=ab.find(e=>e.value==n);return e(Qv,{open:o,onOpenChange:i,children:[t(eb,{asChild:!0,children:e(Fc,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[s?.text&&e("div",{children:[String(s.text).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:s.flag})]}),!s&&t("span",{className:"text-muted-foreground",children:"Choose country"}),t(lo,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(tb,{className:"p-0 overflow-hidden text-ellipsis",children:e(uh,{children:[t(fh,{placeholder:"Choose country..."}),t(ph,{children:t(mh,{children:ab.map(o=>e(hh,{className:Rc("whitespace-nowrap text-left",{"text-green-500":n===o.value}),value:o.value,defaultValue:o.value,onSelect:e=>{const t=o.value;a(t),r.onChange&&"function"==typeof r.onChange&&r.onChange(t),i(!1)},children:[n===o.value&&t(co,{className:Rc("mr-2 h-4 w-4 text-green-400",n===o.value?"opacity-100":"opacity-0")}),String(o.text).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:o.flag})]},o.value))})})]})})]})}const ib=ab.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),sb=Array.from(new Set(ib.map(e=>e.value))).map(e=>ib.find(t=>t.value===e)).filter(e=>void 0!==e);function cb(r){const[n,a]=u(r.value||""),[o,i]=u(!1),s=sb.find(e=>e.value==n);return e(Qv,{open:o,onOpenChange:i,children:[t(eb,{asChild:!0,children:e(Fc,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[s?.text&&e("div",{children:[String(s.text).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:s.icon})]}),!s&&t("span",{className:"text-muted-foreground",children:"Choose Currency"}),t(lo,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(tb,{className:"p-0 overflow-hidden text-ellipsis",children:e(uh,{children:[t(fh,{placeholder:"Choose currency..."}),t(ph,{children:t(mh,{children:sb.map(o=>e(hh,{className:Rc("whitespace-nowrap text-left",{"text-green-500":n===o.value}),value:o.value,defaultValue:o.value,onSelect:e=>{const t=o.value;a(t),r.onChange&&"function"==typeof r.onChange&&r.onChange(t),i(!1)},children:[n===o.value&&t(co,{className:Rc("mr-2 h-4 w-4 text-green-400",n===o.value?"opacity-100":"opacity-0")}),String(o.text).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:o.icon})]},o.value))})})]})})]})}let lb=[{code:"en",label:"English",flag:"🇬🇧"},{code:"en-GB",label:"English (United Kingdom)",flag:"🇬🇧"},{code:"en-US",label:"English (United States)",flag:"🇺🇸"},{code:"en-AU",label:"English (Australia)",flag:"🇦🇺"},{code:"en-CA",label:"English (Canada)",flag:"🇨🇦"},{code:"en-NZ",label:"English (New Zealand)",flag:"🇳🇿"},{code:"es",label:"Spanish",flag:"🇪🇸"},{code:"es-ES",label:"Spanish (Spain)",flag:"🇪🇸"},{code:"es-MX",label:"Spanish (Mexico)",flag:"🇲🇽"},{code:"fr",label:"French",flag:"🇫🇷"},{code:"fr-FR",label:"French (France)",flag:"🇫🇷"},{code:"de",label:"German",flag:"🇩🇪"},{code:"de-DE",label:"German (Germany)",flag:"🇩🇪"},{code:"it",label:"Italian",flag:"🇮🇹"},{code:"it-IT",label:"Italian (Italy)",flag:"🇮🇹"},{code:"pt",label:"Portuguese",flag:"🇵🇹"},{code:"pt-PT",label:"Portuguese (Portugal)",flag:"🇵🇹"},{code:"pt-BR",label:"Portuguese (Brazil)",flag:"🇧🇷"},{code:"ru",label:"Russian",flag:"🇷🇺"},{code:"ru-RU",label:"Russian (Russia)",flag:"🇷🇺"},{code:"zh",label:"Chinese",flag:"🇨🇳"},{code:"zh-CN",label:"Chinese (Simplified)",flag:"🇨🇳"},{code:"zh-TW",label:"Chinese (Traditional)",flag:"🇹🇼"},{code:"ja",label:"Japanese",flag:"🇯🇵"},{code:"ja-JP",label:"Japanese (Japan)",flag:"🇯🇵"},{code:"ko",label:"Korean",flag:"🇰🇷"},{code:"ko-KR",label:"Korean (South Korea)",flag:"🇰🇷"},{code:"ar",label:"Arabic",flag:"🇸🇦"},{code:"ar-SA",label:"Arabic (Saudi Arabia)",flag:"🇸🇦"},{code:"hi",label:"Hindi",flag:"🇮🇳"},{code:"hi-IN",label:"Hindi (India)",flag:"🇮🇳"},{code:"bn",label:"Bengali",flag:"🇮🇳"},{code:"bn-IN",label:"Bengali (India)",flag:"🇮🇳"},{code:"gu",label:"Gujarati",flag:"🇮🇳"},{code:"gu-IN",label:"Gujarati (India)",flag:"🇮🇳"},{code:"ta",label:"Tamil",flag:"🇮🇳"},{code:"ta-IN",label:"Tamil (India)",flag:"🇮🇳"},{code:"te",label:"Telugu",flag:"🇮🇳"},{code:"te-IN",label:"Telugu (India)",flag:"🇮🇳"},{code:"ml",label:"Malayalam",flag:"🇮🇳"},{code:"ml-IN",label:"Malayalam (India)",flag:"🇮🇳"},{code:"kn",label:"Kannada",flag:"🇮🇳"},{code:"kn-IN",label:"Kannada (India)",flag:"🇮🇳"},{code:"mr",label:"Marathi",flag:"🇮🇳"},{code:"mr-IN",label:"Marathi (India)",flag:"🇮🇳"},{code:"pa",label:"Punjabi",flag:"🇮🇳"},{code:"pa-IN",label:"Punjabi (India)",flag:"🇮🇳"},{code:"ur",label:"Urdu",flag:"🇮🇳"},{code:"ur-IN",label:"Urdu (India)",flag:"🇮🇳"},{code:"or",label:"Odia",flag:"🇮🇳"},{code:"or-IN",label:"Odia (India)",flag:"🇮🇳"},{code:"as",label:"Assamese",flag:"🇮🇳"},{code:"as-IN",label:"Assamese (India)",flag:"🇮🇳"},{code:"zh-HK",label:"Chinese (Hong Kong)",flag:"🇭🇰"},{code:"nl",label:"Dutch",flag:"🇳🇱"},{code:"nl-NL",label:"Dutch (Netherlands)",flag:"🇳🇱"},{code:"pl",label:"Polish",flag:"🇵🇱"},{code:"pl-PL",label:"Polish (Poland)",flag:"🇵🇱"},{code:"sv",label:"Swedish",flag:"🇸🇪"},{code:"sv-SE",label:"Swedish (Sweden)",flag:"🇸🇪"},{code:"da",label:"Danish",flag:"🇩🇰"},{code:"da-DK",label:"Danish (Denmark)",flag:"🇩🇰"},{code:"no",label:"Norwegian",flag:"🇳🇴"},{code:"no-NO",label:"Norwegian (Norway)",flag:"🇳🇴"},{code:"fi",label:"Finnish",flag:"🇫🇮"},{code:"fi-FI",label:"Finnish (Finland)",flag:"🇫🇮"},{code:"tr",label:"Turkish",flag:"🇹🇷"},{code:"tr-TR",label:"Turkish (Turkey)",flag:"🇹🇷"},{code:"cs",label:"Czech",flag:"🇨🇿"},{code:"cs-CZ",label:"Czech (Czech Republic)",flag:"🇨🇿"},{code:"sk",label:"Slovak",flag:"🇸🇰"},{code:"sk-SK",label:"Slovak (Slovakia)",flag:"🇸🇰"},{code:"hu",label:"Hungarian",flag:"🇭🇺"},{code:"hu-HU",label:"Hungarian (Hungary)",flag:"🇭🇺"},{code:"ro",label:"Romanian",flag:"🇷🇴"},{code:"ro-RO",label:"Romanian (Romania)",flag:"🇷🇴"},{code:"el",label:"Greek",flag:"🇬🇷"},{code:"el-GR",label:"Greek (Greece)",flag:"🇬🇷"},{code:"th",label:"Thai",flag:"🇹🇭"},{code:"th-TH",label:"Thai (Thailand)",flag:"🇹🇭"},{code:"id",label:"Indonesian",flag:"🇮🇩"},{code:"id-ID",label:"Indonesian (Indonesia)",flag:"🇮🇩"},{code:"ms",label:"Malay",flag:"🇲🇾"},{code:"ms-MY",label:"Malay (Malaysia)",flag:"🇲🇾"},{code:"vi",label:"Vietnamese",flag:"🇻🇳"},{code:"vi-VN",label:"Vietnamese (Vietnam)",flag:"🇻🇳"},{code:"he",label:"Hebrew",flag:"🇮🇱"},{code:"he-IL",label:"Hebrew (Israel)",flag:"🇮🇱"}];lb=lb.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),lb.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const db=lb.filter(e=>function(e){try{const t=new Intl.DateTimeFormat(e);return t.resolvedOptions().locale===e||t.resolvedOptions().locale.startsWith(e)}catch{return!1}}(e.code)).filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)).map(e=>({value:e.code,label:e.label,flag:e.flag}));function ub(r){const[n,a]=u(r.value||""),[o,i]=u(!1),s=db.find(e=>e.value==n);return e(Qv,{open:o,onOpenChange:i,children:[t(eb,{asChild:!0,children:e(Fc,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[s&&e("div",{children:[String(s.label).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:s.flag})]}),!s&&"Choose language",t(lo,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(tb,{className:"p-0 overflow-hidden text-ellipsis",children:e(uh,{children:[t(fh,{placeholder:"Choose timezone..."}),t(ph,{children:t(mh,{children:db.map(o=>e(hh,{className:Rc("whitespace-nowrap text-left",{"text-green-500":n===o.value}),value:o.value,defaultValue:o.value,onSelect:e=>{const t=o.value;a(t),r.onChange&&"function"==typeof r.onChange&&r.onChange(t),i(!1)},children:[n===o.value&&t(co,{className:Rc("mr-2 h-4 w-4 text-green-400",n===o.value?"opacity-100":"opacity-0")}),String(o.label).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:o.flag})]},o.value))})})]})})]})}const fb=[{value:"Dateline Standard Time",abbr:"DST",offset:-12,isdst:!1,text:"(UTC-12:00) International Date Line West",utc:["Etc/GMT+12"]},{value:"UTC-11",abbr:"U",offset:-11,isdst:!1,text:"(UTC-11:00) Coordinated Universal Time-11",utc:["Etc/GMT+11","Pacific/Midway","Pacific/Niue","Pacific/Pago_Pago"]},{value:"Hawaiian Standard Time",abbr:"HST",offset:-10,isdst:!1,text:"(UTC-10:00) Hawaii",utc:["Etc/GMT+10","Pacific/Honolulu","Pacific/Johnston","Pacific/Rarotonga","Pacific/Tahiti"]},{value:"Alaskan Standard Time",abbr:"AKDT",offset:-8,isdst:!0,text:"(UTC-09:00) Alaska",utc:["America/Anchorage","America/Juneau","America/Nome","America/Sitka","America/Yakutat"]},{value:"Pacific Standard Time (Mexico)",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-08:00) Baja California",utc:["America/Santa_Isabel"]},{value:"Pacific Daylight Time",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-07:00) Pacific Daylight Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver"]},{value:"Pacific Standard Time",abbr:"PST",offset:-8,isdst:!1,text:"(UTC-08:00) Pacific Standard Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver","PST8PDT"]},{value:"US Mountain Standard Time",abbr:"UMST",offset:-7,isdst:!1,text:"(UTC-07:00) Arizona",utc:["America/Creston","America/Dawson","America/Dawson_Creek","America/Hermosillo","America/Phoenix","America/Whitehorse","Etc/GMT+7"]},{value:"Mountain Standard Time (Mexico)",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Chihuahua, La Paz, Mazatlan",utc:["America/Chihuahua","America/Mazatlan"]},{value:"Mountain Standard Time",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Mountain Time (US & Canada)",utc:["America/Boise","America/Cambridge_Bay","America/Denver","America/Edmonton","America/Inuvik","America/Ojinaga","America/Yellowknife","MST7MDT"]},{value:"Central America Standard Time",abbr:"CAST",offset:-6,isdst:!1,text:"(UTC-06:00) Central America",utc:["America/Belize","America/Costa_Rica","America/El_Salvador","America/Guatemala","America/Managua","America/Tegucigalpa","Etc/GMT+6","Pacific/Galapagos"]},{value:"Central Standard Time",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Central Time (US & Canada)",utc:["America/Chicago","America/Indiana/Knox","America/Indiana/Tell_City","America/Matamoros","America/Menominee","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Rainy_River","America/Rankin_Inlet","America/Resolute","America/Winnipeg","CST6CDT"]},{value:"Central Standard Time (Mexico)",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Guadalajara, Mexico City, Monterrey",utc:["America/Bahia_Banderas","America/Cancun","America/Merida","America/Mexico_City","America/Monterrey"]},{value:"Canada Central Standard Time",abbr:"CCST",offset:-6,isdst:!1,text:"(UTC-06:00) Saskatchewan",utc:["America/Regina","America/Swift_Current"]},{value:"SA Pacific Standard Time",abbr:"SPST",offset:-5,isdst:!1,text:"(UTC-05:00) Bogota, Lima, Quito",utc:["America/Bogota","America/Cayman","America/Coral_Harbour","America/Eirunepe","America/Guayaquil","America/Jamaica","America/Lima","America/Panama","America/Rio_Branco","Etc/GMT+5"]},{value:"Eastern Standard Time",abbr:"EST",offset:-5,isdst:!1,text:"(UTC-05:00) Eastern Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"Eastern Daylight Time",abbr:"EDT",offset:-4,isdst:!0,text:"(UTC-04:00) Eastern Daylight Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"US Eastern Standard Time",abbr:"UEDT",offset:-5,isdst:!1,text:"(UTC-05:00) Indiana (East)",utc:["America/Indiana/Marengo","America/Indiana/Vevay","America/Indianapolis"]},{value:"Venezuela Standard Time",abbr:"VST",offset:-4.5,isdst:!1,text:"(UTC-04:30) Caracas",utc:["America/Caracas"]},{value:"Paraguay Standard Time",abbr:"PYT",offset:-4,isdst:!1,text:"(UTC-04:00) Asuncion",utc:["America/Asuncion"]},{value:"Atlantic Standard Time",abbr:"ADT",offset:-3,isdst:!0,text:"(UTC-04:00) Atlantic Time (Canada)",utc:["America/Glace_Bay","America/Goose_Bay","America/Halifax","America/Moncton","America/Thule","Atlantic/Bermuda"]},{value:"Central Brazilian Standard Time",abbr:"CBST",offset:-4,isdst:!1,text:"(UTC-04:00) Cuiaba",utc:["America/Campo_Grande","America/Cuiaba"]},{value:"SA Western Standard Time",abbr:"SWST",offset:-4,isdst:!1,text:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan",utc:["America/Anguilla","America/Antigua","America/Aruba","America/Barbados","America/Blanc-Sablon","America/Boa_Vista","America/Curacao","America/Dominica","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guyana","America/Kralendijk","America/La_Paz","America/Lower_Princes","America/Manaus","America/Marigot","America/Martinique","America/Montserrat","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Santo_Domingo","America/St_Barthelemy","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Tortola","Etc/GMT+4"]},{value:"Pacific SA Standard Time",abbr:"PSST",offset:-4,isdst:!1,text:"(UTC-04:00) Santiago",utc:["America/Santiago","Antarctica/Palmer"]},{value:"Newfoundland Standard Time",abbr:"NDT",offset:-2.5,isdst:!0,text:"(UTC-03:30) Newfoundland",utc:["America/St_Johns"]},{value:"E. South America Standard Time",abbr:"ESAST",offset:-3,isdst:!1,text:"(UTC-03:00) Brasilia",utc:["America/Sao_Paulo"]},{value:"Argentina Standard Time",abbr:"AST",offset:-3,isdst:!1,text:"(UTC-03:00) Buenos Aires",utc:["America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Buenos_Aires","America/Catamarca","America/Cordoba","America/Jujuy","America/Mendoza"]},{value:"SA Eastern Standard Time",abbr:"SEST",offset:-3,isdst:!1,text:"(UTC-03:00) Cayenne, Fortaleza",utc:["America/Araguaina","America/Belem","America/Cayenne","America/Fortaleza","America/Maceio","America/Paramaribo","America/Recife","America/Santarem","Antarctica/Rothera","Atlantic/Stanley","Etc/GMT+3"]},{value:"Greenland Standard Time",abbr:"GDT",offset:-3,isdst:!0,text:"(UTC-03:00) Greenland",utc:["America/Godthab"]},{value:"Montevideo Standard Time",abbr:"MST",offset:-3,isdst:!1,text:"(UTC-03:00) Montevideo",utc:["America/Montevideo"]},{value:"Bahia Standard Time",abbr:"BST",offset:-3,isdst:!1,text:"(UTC-03:00) Salvador",utc:["America/Bahia"]},{value:"UTC-02",abbr:"U",offset:-2,isdst:!1,text:"(UTC-02:00) Coordinated Universal Time-02",utc:["America/Noronha","Atlantic/South_Georgia","Etc/GMT+2"]},{value:"Mid-Atlantic Standard Time",abbr:"MDT",offset:-1,isdst:!0,text:"(UTC-02:00) Mid-Atlantic - Old",utc:[]},{value:"Azores Standard Time",abbr:"ADT",offset:0,isdst:!0,text:"(UTC-01:00) Azores",utc:["America/Scoresbysund","Atlantic/Azores"]},{value:"Cape Verde Standard Time",abbr:"CVST",offset:-1,isdst:!1,text:"(UTC-01:00) Cape Verde Is.",utc:["Atlantic/Cape_Verde","Etc/GMT+1"]},{value:"Morocco Standard Time",abbr:"MDT",offset:1,isdst:!0,text:"(UTC) Casablanca",utc:["Africa/Casablanca","Africa/El_Aaiun"]},{value:"UTC",abbr:"UTC",offset:0,isdst:!1,text:"(UTC) Coordinated Universal Time",utc:["America/Danmarkshavn","Etc/GMT"]},{value:"GMT Standard Time",abbr:"GMT",offset:0,isdst:!1,text:"(UTC) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"British Summer Time",abbr:"BST",offset:1,isdst:!0,text:"(UTC+01:00) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"GMT Standard Time",abbr:"GDT",offset:1,isdst:!0,text:"(UTC) Dublin, Lisbon",utc:["Atlantic/Canary","Atlantic/Faeroe","Atlantic/Madeira","Europe/Dublin","Europe/Lisbon"]},{value:"Greenwich Standard Time",abbr:"GST",offset:0,isdst:!1,text:"(UTC) Monrovia, Reykjavik",utc:["Africa/Abidjan","Africa/Accra","Africa/Bamako","Africa/Banjul","Africa/Bissau","Africa/Conakry","Africa/Dakar","Africa/Freetown","Africa/Lome","Africa/Monrovia","Africa/Nouakchott","Africa/Ouagadougou","Africa/Sao_Tome","Atlantic/Reykjavik","Atlantic/St_Helena"]},{value:"W. Europe Standard Time",abbr:"WEDT",offset:2,isdst:!0,text:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",utc:["Arctic/Longyearbyen","Europe/Amsterdam","Europe/Andorra","Europe/Berlin","Europe/Busingen","Europe/Gibraltar","Europe/Luxembourg","Europe/Malta","Europe/Monaco","Europe/Oslo","Europe/Rome","Europe/San_Marino","Europe/Stockholm","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Zurich"]},{value:"Central Europe Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",utc:["Europe/Belgrade","Europe/Bratislava","Europe/Budapest","Europe/Ljubljana","Europe/Podgorica","Europe/Prague","Europe/Tirane"]},{value:"Romance Standard Time",abbr:"RDT",offset:2,isdst:!0,text:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris",utc:["Africa/Ceuta","Europe/Brussels","Europe/Copenhagen","Europe/Madrid","Europe/Paris"]},{value:"Central European Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb",utc:["Europe/Sarajevo","Europe/Skopje","Europe/Warsaw","Europe/Zagreb"]},{value:"W. Central Africa Standard Time",abbr:"WCAST",offset:1,isdst:!1,text:"(UTC+01:00) West Central Africa",utc:["Africa/Algiers","Africa/Bangui","Africa/Brazzaville","Africa/Douala","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Luanda","Africa/Malabo","Africa/Ndjamena","Africa/Niamey","Africa/Porto-Novo","Africa/Tunis","Etc/GMT-1"]},{value:"Namibia Standard Time",abbr:"NST",offset:1,isdst:!1,text:"(UTC+01:00) Windhoek",utc:["Africa/Windhoek"]},{value:"GTB Standard Time",abbr:"GDT",offset:3,isdst:!0,text:"(UTC+02:00) Athens, Bucharest",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau"]},{value:"Middle East Standard Time",abbr:"MEDT",offset:3,isdst:!0,text:"(UTC+02:00) Beirut",utc:["Asia/Beirut"]},{value:"Egypt Standard Time",abbr:"EST",offset:2,isdst:!1,text:"(UTC+02:00) Cairo",utc:["Africa/Cairo"]},{value:"Syria Standard Time",abbr:"SDT",offset:3,isdst:!0,text:"(UTC+02:00) Damascus",utc:["Asia/Damascus"]},{value:"E. Europe Standard Time",abbr:"EEDT",offset:3,isdst:!0,text:"(UTC+02:00) E. Europe",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau","Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Nicosia","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"South Africa Standard Time",abbr:"SAST",offset:2,isdst:!1,text:"(UTC+02:00) Harare, Pretoria",utc:["Africa/Blantyre","Africa/Bujumbura","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Kigali","Africa/Lubumbashi","Africa/Lusaka","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Etc/GMT-2"]},{value:"FLE Standard Time",abbr:"FDT",offset:3,isdst:!0,text:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",utc:["Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"Turkey Standard Time",abbr:"TDT",offset:3,isdst:!1,text:"(UTC+03:00) Istanbul",utc:["Europe/Istanbul"]},{value:"Israel Standard Time",abbr:"JDT",offset:3,isdst:!0,text:"(UTC+02:00) Jerusalem",utc:["Asia/Jerusalem"]},{value:"Libya Standard Time",abbr:"LST",offset:2,isdst:!1,text:"(UTC+02:00) Tripoli",utc:["Africa/Tripoli"]},{value:"Jordan Standard Time",abbr:"JST",offset:3,isdst:!1,text:"(UTC+03:00) Amman",utc:["Asia/Amman"]},{value:"Arabic Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Baghdad",utc:["Asia/Baghdad"]},{value:"Kaliningrad Standard Time",abbr:"KST",offset:3,isdst:!1,text:"(UTC+02:00) Kaliningrad",utc:["Europe/Kaliningrad"]},{value:"Arab Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Kuwait, Riyadh",utc:["Asia/Aden","Asia/Bahrain","Asia/Kuwait","Asia/Qatar","Asia/Riyadh"]},{value:"E. Africa Standard Time",abbr:"EAST",offset:3,isdst:!1,text:"(UTC+03:00) Nairobi",utc:["Africa/Addis_Ababa","Africa/Asmera","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Mogadishu","Africa/Nairobi","Antarctica/Syowa","Etc/GMT-3","Indian/Antananarivo","Indian/Comoro","Indian/Mayotte"]},{value:"Moscow Standard Time",abbr:"MSK",offset:3,isdst:!1,text:"(UTC+03:00) Moscow, St. Petersburg, Volgograd, Minsk",utc:["Europe/Kirov","Europe/Moscow","Europe/Simferopol","Europe/Volgograd","Europe/Minsk"]},{value:"Samara Time",abbr:"SAMT",offset:4,isdst:!1,text:"(UTC+04:00) Samara, Ulyanovsk, Saratov",utc:["Europe/Astrakhan","Europe/Samara","Europe/Ulyanovsk"]},{value:"Iran Standard Time",abbr:"IDT",offset:4.5,isdst:!0,text:"(UTC+03:30) Tehran",utc:["Asia/Tehran"]},{value:"Arabian Standard Time",abbr:"AST",offset:4,isdst:!1,text:"(UTC+04:00) Abu Dhabi, Muscat",utc:["Asia/Dubai","Asia/Muscat","Etc/GMT-4"]},{value:"Azerbaijan Standard Time",abbr:"ADT",offset:5,isdst:!0,text:"(UTC+04:00) Baku",utc:["Asia/Baku"]},{value:"Mauritius Standard Time",abbr:"MST",offset:4,isdst:!1,text:"(UTC+04:00) Port Louis",utc:["Indian/Mahe","Indian/Mauritius","Indian/Reunion"]},{value:"Georgian Standard Time",abbr:"GET",offset:4,isdst:!1,text:"(UTC+04:00) Tbilisi",utc:["Asia/Tbilisi"]},{value:"Caucasus Standard Time",abbr:"CST",offset:4,isdst:!1,text:"(UTC+04:00) Yerevan",utc:["Asia/Yerevan"]},{value:"Afghanistan Standard Time",abbr:"AST",offset:4.5,isdst:!1,text:"(UTC+04:30) Kabul",utc:["Asia/Kabul"]},{value:"West Asia Standard Time",abbr:"WAST",offset:5,isdst:!1,text:"(UTC+05:00) Ashgabat, Tashkent",utc:["Antarctica/Mawson","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Dushanbe","Asia/Oral","Asia/Samarkand","Asia/Tashkent","Etc/GMT-5","Indian/Kerguelen","Indian/Maldives"]},{value:"Yekaterinburg Time",abbr:"YEKT",offset:5,isdst:!1,text:"(UTC+05:00) Yekaterinburg",utc:["Asia/Yekaterinburg"]},{value:"Pakistan Standard Time",abbr:"PKT",offset:5,isdst:!1,text:"(UTC+05:00) Islamabad, Karachi",utc:["Asia/Karachi"]},{value:"India Standard Time",abbr:"IST",offset:5.5,isdst:!1,text:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",utc:["Asia/Kolkata","Asia/Calcutta"]},{value:"Sri Lanka Standard Time",abbr:"SLST",offset:5.5,isdst:!1,text:"(UTC+05:30) Sri Jayawardenepura",utc:["Asia/Colombo"]},{value:"Nepal Standard Time",abbr:"NST",offset:5.75,isdst:!1,text:"(UTC+05:45) Kathmandu",utc:["Asia/Kathmandu"]},{value:"Central Asia Standard Time",abbr:"CAST",offset:6,isdst:!1,text:"(UTC+06:00) Nur-Sultan (Astana)",utc:["Antarctica/Vostok","Asia/Almaty","Asia/Bishkek","Asia/Qyzylorda","Asia/Urumqi","Etc/GMT-6","Indian/Chagos"]},{value:"Bangladesh Standard Time",abbr:"BST",offset:6,isdst:!1,text:"(UTC+06:00) Dhaka",utc:["Asia/Dhaka","Asia/Thimphu"]},{value:"Myanmar Standard Time",abbr:"MST",offset:6.5,isdst:!1,text:"(UTC+06:30) Yangon (Rangoon)",utc:["Asia/Rangoon","Indian/Cocos"]},{value:"SE Asia Standard Time",abbr:"SAST",offset:7,isdst:!1,text:"(UTC+07:00) Bangkok, Hanoi, Jakarta",utc:["Antarctica/Davis","Asia/Bangkok","Asia/Hovd","Asia/Jakarta","Asia/Phnom_Penh","Asia/Pontianak","Asia/Saigon","Asia/Vientiane","Etc/GMT-7","Indian/Christmas"]},{value:"N. Central Asia Standard Time",abbr:"NCAST",offset:7,isdst:!1,text:"(UTC+07:00) Novosibirsk",utc:["Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk"]},{value:"China Standard Time",abbr:"CST",offset:8,isdst:!1,text:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi",utc:["Asia/Hong_Kong","Asia/Macau","Asia/Shanghai"]},{value:"North Asia Standard Time",abbr:"NAST",offset:8,isdst:!1,text:"(UTC+08:00) Krasnoyarsk",utc:["Asia/Krasnoyarsk"]},{value:"Singapore Standard Time",abbr:"MPST",offset:8,isdst:!1,text:"(UTC+08:00) Kuala Lumpur, Singapore",utc:["Asia/Brunei","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Makassar","Asia/Manila","Asia/Singapore","Etc/GMT-8"]},{value:"W. Australia Standard Time",abbr:"WAST",offset:8,isdst:!1,text:"(UTC+08:00) Perth",utc:["Antarctica/Casey","Australia/Perth"]},{value:"Taipei Standard Time",abbr:"TST",offset:8,isdst:!1,text:"(UTC+08:00) Taipei",utc:["Asia/Taipei"]},{value:"Ulaanbaatar Standard Time",abbr:"UST",offset:8,isdst:!1,text:"(UTC+08:00) Ulaanbaatar",utc:["Asia/Choibalsan","Asia/Ulaanbaatar"]},{value:"North Asia East Standard Time",abbr:"NAEST",offset:8,isdst:!1,text:"(UTC+08:00) Irkutsk",utc:["Asia/Irkutsk"]},{value:"Japan Standard Time",abbr:"JST",offset:9,isdst:!1,text:"(UTC+09:00) Osaka, Sapporo, Tokyo",utc:["Asia/Dili","Asia/Jayapura","Asia/Tokyo","Etc/GMT-9","Pacific/Palau"]},{value:"Korea Standard Time",abbr:"KST",offset:9,isdst:!1,text:"(UTC+09:00) Seoul",utc:["Asia/Pyongyang","Asia/Seoul"]},{value:"Cen. Australia Standard Time",abbr:"CAST",offset:9.5,isdst:!1,text:"(UTC+09:30) Adelaide",utc:["Australia/Adelaide","Australia/Broken_Hill"]},{value:"AUS Central Standard Time",abbr:"ACST",offset:9.5,isdst:!1,text:"(UTC+09:30) Darwin",utc:["Australia/Darwin"]},{value:"E. Australia Standard Time",abbr:"EAST",offset:10,isdst:!1,text:"(UTC+10:00) Brisbane",utc:["Australia/Brisbane","Australia/Lindeman"]},{value:"AUS Eastern Standard Time",abbr:"AEST",offset:10,isdst:!1,text:"(UTC+10:00) Canberra, Melbourne, Sydney",utc:["Australia/Melbourne","Australia/Sydney"]},{value:"West Pacific Standard Time",abbr:"WPST",offset:10,isdst:!1,text:"(UTC+10:00) Guam, Port Moresby",utc:["Antarctica/DumontDUrville","Etc/GMT-10","Pacific/Guam","Pacific/Port_Moresby","Pacific/Saipan","Pacific/Truk"]},{value:"Tasmania Standard Time",abbr:"TST",offset:10,isdst:!1,text:"(UTC+10:00) Hobart",utc:["Australia/Currie","Australia/Hobart"]},{value:"Yakutsk Standard Time",abbr:"YST",offset:9,isdst:!1,text:"(UTC+09:00) Yakutsk",utc:["Asia/Chita","Asia/Khandyga","Asia/Yakutsk"]},{value:"Central Pacific Standard Time",abbr:"CPST",offset:11,isdst:!1,text:"(UTC+11:00) Solomon Is., New Caledonia",utc:["Antarctica/Macquarie","Etc/GMT-11","Pacific/Efate","Pacific/Guadalcanal","Pacific/Kosrae","Pacific/Noumea","Pacific/Ponape"]},{value:"Vladivostok Standard Time",abbr:"VST",offset:11,isdst:!1,text:"(UTC+11:00) Vladivostok",utc:["Asia/Sakhalin","Asia/Ust-Nera","Asia/Vladivostok"]},{value:"New Zealand Standard Time",abbr:"NZST",offset:12,isdst:!1,text:"(UTC+12:00) Auckland, Wellington",utc:["Antarctica/McMurdo","Pacific/Auckland"]},{value:"UTC+12",abbr:"U",offset:12,isdst:!1,text:"(UTC+12:00) Coordinated Universal Time+12",utc:["Etc/GMT-12","Pacific/Funafuti","Pacific/Kwajalein","Pacific/Majuro","Pacific/Nauru","Pacific/Tarawa","Pacific/Wake","Pacific/Wallis"]},{value:"Fiji Standard Time",abbr:"FST",offset:12,isdst:!1,text:"(UTC+12:00) Fiji",utc:["Pacific/Fiji"]},{value:"Magadan Standard Time",abbr:"MST",offset:12,isdst:!1,text:"(UTC+12:00) Magadan",utc:["Asia/Anadyr","Asia/Kamchatka","Asia/Magadan","Asia/Srednekolymsk"]},{value:"Kamchatka Standard Time",abbr:"KDT",offset:13,isdst:!0,text:"(UTC+12:00) Petropavlovsk-Kamchatsky - Old",utc:["Asia/Kamchatka"]},{value:"Tonga Standard Time",abbr:"TST",offset:13,isdst:!1,text:"(UTC+13:00) Nuku'alofa",utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]},{value:"Samoa Standard Time",abbr:"SST",offset:13,isdst:!1,text:"(UTC+13:00) Samoa",utc:["Pacific/Apia"]}].filter(e=>e.utc.length).reduce((e,t)=>{let r=t.utc;for(let n=0;n<r.length;n++){const a=r[n],o=t.text;let i=o.substring(o.indexOf("(")+1,o.indexOf(")"));-1!==i.indexOf("UTC")&&e.push({value:a,abbr:t.abbr,offset:t.offset,isdst:t.isdst,text:`(${i}) ${a}`,utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]})}return e},[]).filter((e,t,r)=>t===r.findIndex(t=>t.value===e.value));function pb(r){const[n,a]=u(r.value||""),[o,i]=u(!1),s=fb.find(e=>e.value==n);return e(Qv,{open:o,onOpenChange:i,children:[t(eb,{asChild:!0,children:e(Fc,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[s?.text||"Choose timezone",t(lo,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(tb,{className:"p-0 overflow-hidden text-ellipsis",children:e(uh,{children:[t(fh,{placeholder:"Choose timezone..."}),t(ph,{children:t(mh,{children:fb.map(o=>e(hh,{className:Rc("whitespace-nowrap text-left",{"text-green-500":n===o.value}),value:o.value,defaultValue:o.value,onSelect:e=>{const t=o.value;a(t),r.onChange&&"function"==typeof r.onChange&&r.onChange(t),i(!1)},children:[n===o.value&&t(co,{className:Rc("mr-2 h-4 w-4 text-green-400",n===o.value?"opacity-100":"opacity-0")}),String(o.text).trim()]},o.value))})})]})})]})}const mb=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=jy(),[o,i]=u(!1),[s,c]=u(),[l,f]=u(0),p=Qt({resolver:Qa(xi({name:Zo().min(2,{message:"Name must be at least 2 characters."}),country:Zo().optional(),timezone:Zo().optional(),language:Zo().optional(),currency:Zo().optional()})),defaultValues:{name:s?.name||"",country:s?.country||"",timezone:s?.timezone||"",language:s?.language||"",currency:s?.currency||""}});return d(()=>{a().then(e=>{c(e),p.setValue("name",e.name),p.setValue("country",e.country),p.setValue("timezone",e.timezone),p.setValue("language",e.language),p.setValue("currency",e.currency)})},[l]),s?e("div",{children:[t("div",{className:"space-y-4",children:t(vu,{...p,children:e("form",{onSubmit:p.handleSubmit(async function(e){i(!0),await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),i(!1)}),className:"space-y-4",children:[e("div",{children:[t("label",{className:"block text-sm font-medium mb-1",children:"Email"}),t(Tu,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:s?.email})]}),t(yu,{disabled:o,control:p.control,name:"name",render:({field:r})=>e(Su,{children:[t(ku,{children:"Name"}),t(Au,{children:t(Tu,{...r})}),t(Cu,{})]})}),e("div",{className:"flex gap-y-2 my-4 flex-col",children:[e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Language"}),t(ub,{value:p.getValues("language"),onChange:e=>{p.setValue("language",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Country"}),t(ob,{value:p.getValues("country"),onChange:e=>{p.setValue("country",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Currency"}),t(cb,{value:p.getValues("currency"),onChange:e=>{p.setValue("currency",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Timezone"}),t(pb,{value:p.getValues("timezone"),onChange:e=>{p.setValue("timezone",e)}})]})]}),e("div",{className:"flex justify-end gap-x-2",children:[t(Fc,{type:"submit",progress:o,disabled:o,children:"Save"}),t(Fc,{type:"button",variant:"outline",onClick:()=>{f(e=>e+1)},disabled:o,children:"Reset"})]})]})})}),s?.image&&e("div",{children:[t("label",{className:"block text-sm font-medium mb-1",children:"Profile Image"}),t("div",{className:"w-16 h-16 rounded-full overflow-hidden",children:t("img",{src:s.image,alt:s.name,className:"w-full h-full object-cover"})})]})]}):t(im,{})};var hb=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});n.forwardRef((e,r)=>t(Ji.span,{...e,ref:r,style:{...hb,...e.style}})).displayName="VisuallyHidden";var gb=[" ","Enter","ArrowUp","ArrowDown"],vb=[" ","Enter"],bb="Select",[yb,wb,xb]=Nu(bb),[Sb,kb]=Fi(bb,[xb,lv]),Ab=lv(),[Eb,Cb]=Sb(bb),[Tb,Nb]=Sb(bb),_b=r=>{const{__scopeSelect:a,children:o,open:i,defaultOpen:s,onOpenChange:c,value:l,defaultValue:d,onValueChange:u,dir:f,name:p,autoComplete:m,disabled:h,required:g,form:v}=r,b=Ab(a),[y,w]=n.useState(null),[x,S]=n.useState(null),[k,A]=n.useState(!1),E=Ru(f),[C,T]=$c({prop:i,defaultProp:s??!1,onChange:c,caller:bb}),[N,_]=$c({prop:l,defaultProp:d,onChange:u,caller:bb}),R=n.useRef(null),P=!y||(v||!!y.closest("form")),[O,D]=n.useState(new Set),I=Array.from(O).map(e=>e.props.value).join(";");return t(Ev,{...b,children:e(Eb,{required:g,scope:a,trigger:y,onTriggerChange:w,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:k,onValueNodeHasChildrenChange:A,contentId:Wc(),value:N,onValueChange:_,open:C,onOpenChange:T,dir:E,triggerPointerDownPosRef:R,disabled:h,children:[t(yb.Provider,{scope:a,children:t(Tb,{scope:r.__scopeSelect,onNativeOptionAdd:n.useCallback(e=>{D(t=>new Set(t).add(e))},[]),onNativeOptionRemove:n.useCallback(e=>{D(t=>{const r=new Set(t);return r.delete(e),r})},[]),children:o})}),P?e(py,{"aria-hidden":!0,required:g,tabIndex:-1,name:p,autoComplete:m,value:N,onChange:e=>_(e.target.value),disabled:h,form:v,children:[void 0===N?t("option",{value:""}):null,Array.from(O)]},I):null]})})};_b.displayName=bb;var Rb="SelectTrigger",Pb=n.forwardRef((e,r)=>{const{__scopeSelect:a,disabled:o=!1,...i}=e,s=Ab(a),c=Cb(Rb,a),l=c.disabled||o,d=$i(r,c.onTriggerChange),u=wb(a),f=n.useRef("touch"),[p,m,h]=hy(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===c.value),n=gy(t,e,r);void 0!==n&&c.onValueChange(n.value)}),g=e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return t(Cv,{asChild:!0,...s,children:t(Ji.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":my(c.value)?"":void 0,...i,ref:d,onClick:zc(i.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:zc(i.onPointerDown,e=>{f.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())}),onKeyDown:zc(i.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||gb.includes(e.key)&&(g(),e.preventDefault())})})})});Pb.displayName=Rb;var Ob="SelectValue",Db=n.forwardRef((e,n)=>{const{__scopeSelect:a,className:o,style:i,children:s,placeholder:c="",...l}=e,d=Cb(Ob,a),{onValueNodeHasChildrenChange:u}=d,f=void 0!==s,p=$i(n,d.onValueNodeChange);return Bi(()=>{u(f)},[u,f]),t(Ji.span,{...l,ref:p,style:{pointerEvents:"none"},children:my(d.value)?t(r,{children:c}):s})});Db.displayName=Ob;var Ib=n.forwardRef((e,r)=>{const{__scopeSelect:n,children:a,...o}=e;return t(Ji.span,{"aria-hidden":!0,...o,ref:r,children:a||"▼"})});Ib.displayName="SelectIcon";var Ub=e=>t(ll,{asChild:!0,...e});Ub.displayName="SelectPortal";var Mb="SelectContent",Lb=n.forwardRef((e,r)=>{const a=Cb(Mb,e.__scopeSelect),[o,i]=n.useState();if(Bi(()=>{i(new DocumentFragment)},[]),!a.open){const r=o;return r?v.createPortal(t(zb,{scope:e.__scopeSelect,children:t(yb.Slot,{scope:e.__scopeSelect,children:t("div",{children:e.children})})}),r):null}return t(Wb,{...e,ref:r})});Lb.displayName=Mb;var Fb=10,[zb,jb]=Sb(Mb),Bb=Gi("SelectContent.RemoveScroll"),Wb=n.forwardRef((e,r)=>{const{__scopeSelect:a,position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:c,side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:b,...y}=e,w=Cb(Mb,a),[x,S]=n.useState(null),[k,A]=n.useState(null),E=$i(r,e=>S(e)),[C,T]=n.useState(null),[N,_]=n.useState(null),R=wb(a),[P,O]=n.useState(!1),D=n.useRef(!1);n.useEffect(()=>{if(x)return cd(x)},[x]),pl();const I=n.useCallback(e=>{const[t,...r]=R().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(const r of e){if(r===a)return;if(r?.scrollIntoView({block:"nearest"}),r===t&&k&&(k.scrollTop=0),r===n&&k&&(k.scrollTop=k.scrollHeight),r?.focus(),document.activeElement!==a)return}},[R,k]),U=n.useCallback(()=>I([C,x]),[I,C,x]);n.useEffect(()=>{P&&U()},[P,U]);const{onOpenChange:M,triggerPointerDownPosRef:L}=w;n.useEffect(()=>{if(x){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(L.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(L.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():x.contains(r.target)||M(!1),document.removeEventListener("pointermove",t),L.current=null};return null!==L.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[x,M,L]),n.useEffect(()=>{const e=()=>M(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[M]);const[F,z]=hy(e=>{const t=R().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=gy(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),j=n.useCallback((e,t,r)=>{const n=!D.current&&!r;(void 0!==w.value&&w.value===t||n)&&(T(e),n&&(D.current=!0))},[w.value]),B=n.useCallback(()=>x?.focus(),[x]),W=n.useCallback((e,t,r)=>{const n=!D.current&&!r;(void 0!==w.value&&w.value===t||n)&&_(e)},[w.value]),V="popper"===o?$b:Vb,$=V===$b?{side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:b}:{};return t(zb,{scope:a,content:x,viewport:k,onViewportChange:A,itemRefCallback:j,selectedItem:C,onItemLeave:B,itemTextRefCallback:W,focusSelectedItem:U,selectedItemText:N,position:o,isPositioned:P,searchRef:F,children:t(td,{as:Bb,allowPinchZoom:!0,children:t(rl,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:zc(i,e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:t(Jc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:t(V,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:e=>e.preventDefault(),...y,...$,onPlaced:()=>O(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:zc(y.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||z(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=R().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>I(t)),e.preventDefault()}})})})})})})});Wb.displayName="SelectContentImpl";var Vb=n.forwardRef((e,r)=>{const{__scopeSelect:a,onPlaced:o,...i}=e,s=Cb(Mb,a),c=jb(Mb,a),[l,d]=n.useState(null),[u,f]=n.useState(null),p=$i(r,e=>f(e)),m=wb(a),h=n.useRef(!1),g=n.useRef(!0),{viewport:v,selectedItem:b,selectedItemText:y,focusSelectedItem:w}=c,x=n.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&v&&b&&y){const e=s.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=s.valueNode.getBoundingClientRect(),n=y.getBoundingClientRect();if("rtl"!==s.dir){const a=n.left-t.left,o=r.left-a,i=e.left-o,s=e.width+i,c=Math.max(s,t.width),d=window.innerWidth-Fb,u=Ef(o,[Fb,Math.max(Fb,d-c)]);l.style.minWidth=s+"px",l.style.left=u+"px"}else{const a=t.right-n.right,o=window.innerWidth-r.right-a,i=window.innerWidth-e.right-o,s=e.width+i,c=Math.max(s,t.width),d=window.innerWidth-Fb,u=Ef(o,[Fb,Math.max(Fb,d-c)]);l.style.minWidth=s+"px",l.style.right=u+"px"}const a=m(),i=window.innerHeight-2*Fb,c=v.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),w=f+p+c+parseInt(d.paddingBottom,10)+g,x=Math.min(5*b.offsetHeight,w),S=window.getComputedStyle(v),k=parseInt(S.paddingTop,10),A=parseInt(S.paddingBottom,10),E=e.top+e.height/2-Fb,C=i-E,T=b.offsetHeight/2,N=f+p+(b.offsetTop+T),_=w-N;if(N<=E){const e=a.length>0&&b===a[a.length-1].ref.current;l.style.bottom="0px";const t=u.clientHeight-v.offsetTop-v.offsetHeight,r=N+Math.max(C,T+(e?A:0)+t+g);l.style.height=r+"px"}else{const e=a.length>0&&b===a[0].ref.current;l.style.top="0px";const t=Math.max(E,f+v.offsetTop+(e?k:0)+T)+_;l.style.height=t+"px",v.scrollTop=N-E+v.offsetTop}l.style.margin=`${Fb}px 0`,l.style.minHeight=x+"px",l.style.maxHeight=i+"px",o?.(),requestAnimationFrame(()=>h.current=!0)}},[m,s.trigger,s.valueNode,l,u,v,b,y,s.dir,o]);Bi(()=>x(),[x]);const[S,k]=n.useState();Bi(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const A=n.useCallback(e=>{e&&!0===g.current&&(x(),w?.(),g.current=!1)},[x,w]);return t(Gb,{scope:a,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:A,children:t("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:t(Ji.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Vb.displayName="SelectItemAlignedPosition";var $b=n.forwardRef((e,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:o=Fb,...i}=e,s=Ab(n);return t(Tv,{...s,...i,ref:r,align:a,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});$b.displayName="SelectPopperPosition";var[Gb,Kb]=Sb(Mb,{}),Hb="SelectViewport",Zb=n.forwardRef((a,o)=>{const{__scopeSelect:i,nonce:s,...c}=a,l=jb(Hb,i),d=Kb(Hb,i),u=$i(o,l.onViewportChange),f=n.useRef(0);return e(r,{children:[t("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),t(yb.Slot,{scope:i,children:t(Ji.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:zc(c.onScroll,e=>{const t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=d;if(n?.current&&r){const e=Math.abs(f.current-t.scrollTop);if(e>0){const n=window.innerHeight-2*Fb,a=parseFloat(r.style.minHeight),o=parseFloat(r.style.height),i=Math.max(a,o);if(i<n){const a=i+e,o=Math.min(n,a),s=a-o;r.style.height=o+"px","0px"===r.style.bottom&&(t.scrollTop=s>0?s:0,r.style.justifyContent="flex-end")}}}f.current=t.scrollTop})})})]})});Zb.displayName=Hb;var qb="SelectGroup",[Jb,Yb]=Sb(qb);n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=Wc();return t(Jb,{scope:n,id:o,children:t(Ji.div,{role:"group","aria-labelledby":o,...a,ref:r})})}).displayName=qb;var Xb="SelectLabel",Qb=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=Yb(Xb,n);return t(Ji.div,{id:o.id,...a,ref:r})});Qb.displayName=Xb;var ey="SelectItem",[ty,ry]=Sb(ey),ny=n.forwardRef((e,r)=>{const{__scopeSelect:a,value:o,disabled:i=!1,textValue:s,...c}=e,l=Cb(ey,a),d=jb(ey,a),u=l.value===o,[f,p]=n.useState(s??""),[m,h]=n.useState(!1),g=$i(r,e=>d.itemRefCallback?.(e,o,i)),v=Wc(),b=n.useRef("touch"),y=()=>{i||(l.onValueChange(o),l.onOpenChange(!1))};if(""===o)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return t(ty,{scope:a,value:o,disabled:i,textId:v,isSelected:u,onItemTextChange:n.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:t(yb.ItemSlot,{scope:a,value:o,disabled:i,textValue:f,children:t(Ji.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...c,ref:g,onFocus:zc(c.onFocus,()=>h(!0)),onBlur:zc(c.onBlur,()=>h(!1)),onClick:zc(c.onClick,()=>{"mouse"!==b.current&&y()}),onPointerUp:zc(c.onPointerUp,()=>{"mouse"===b.current&&y()}),onPointerDown:zc(c.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:zc(c.onPointerMove,e=>{b.current=e.pointerType,i?d.onItemLeave?.():"mouse"===b.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:zc(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:zc(c.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(vb.includes(e.key)&&y()," "===e.key&&e.preventDefault())})})})})});ny.displayName=ey;var ay="SelectItemText",oy=n.forwardRef((a,o)=>{const{__scopeSelect:i,className:s,style:c,...l}=a,d=Cb(ay,i),u=jb(ay,i),f=ry(ay,i),p=Nb(ay,i),[m,h]=n.useState(null),g=$i(o,e=>h(e),f.onItemTextChange,e=>u.itemTextRefCallback?.(e,f.value,f.disabled)),b=m?.textContent,y=n.useMemo(()=>t("option",{value:f.value,disabled:f.disabled,children:b},f.value),[f.disabled,f.value,b]),{onNativeOptionAdd:w,onNativeOptionRemove:x}=p;return Bi(()=>(w(y),()=>x(y)),[w,x,y]),e(r,{children:[t(Ji.span,{id:f.textId,...l,ref:g}),f.isSelected&&d.valueNode&&!d.valueNodeHasChildren?v.createPortal(l.children,d.valueNode):null]})});oy.displayName=ay;var iy="SelectItemIndicator",sy=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e;return ry(iy,n).isSelected?t(Ji.span,{"aria-hidden":!0,...a,ref:r}):null});sy.displayName=iy;var cy="SelectScrollUpButton";n.forwardRef((e,r)=>{const a=jb(cy,e.__scopeSelect),o=Kb(cy,e.__scopeSelect),[i,s]=n.useState(!1),c=$i(r,o.onScrollButtonChange);return Bi(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollTop>0;s(e)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),i?t(dy,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=cy;var ly="SelectScrollDownButton";n.forwardRef((e,r)=>{const a=jb(ly,e.__scopeSelect),o=Kb(ly,e.__scopeSelect),[i,s]=n.useState(!1),c=$i(r,o.onScrollButtonChange);return Bi(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,r=Math.ceil(t.scrollTop)<e;s(r)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),i?t(dy,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=ly;var dy=n.forwardRef((e,r)=>{const{__scopeSelect:a,onAutoScroll:o,...i}=e,s=jb("SelectScrollButton",a),c=n.useRef(null),l=wb(a),d=n.useCallback(()=>{null!==c.current&&(window.clearInterval(c.current),c.current=null)},[]);return n.useEffect(()=>()=>d(),[d]),Bi(()=>{const e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),t(Ji.div,{"aria-hidden":!0,...i,ref:r,style:{flexShrink:0,...i.style},onPointerDown:zc(i.onPointerDown,()=>{null===c.current&&(c.current=window.setInterval(o,50))}),onPointerMove:zc(i.onPointerMove,()=>{s.onItemLeave?.(),null===c.current&&(c.current=window.setInterval(o,50))}),onPointerLeave:zc(i.onPointerLeave,()=>{d()})})}),uy=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e;return t(Ji.div,{"aria-hidden":!0,...a,ref:r})});uy.displayName="SelectSeparator";var fy="SelectArrow";n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=Ab(n),i=Cb(fy,n),s=jb(fy,n);return i.open&&"popper"===s.position?t(Nv,{...o,...a,ref:r}):null}).displayName=fy;var py=n.forwardRef(({__scopeSelect:e,value:r,...a},o)=>{const i=n.useRef(null),s=$i(o,i),c=Ju(r);return n.useEffect(()=>{const e=i.current;if(!e)return;const t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,"value").set;if(c!==r&&n){const t=new Event("change",{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[c,r]),t(Ji.select,{...a,style:{...hb,...a.style},ref:s,defaultValue:r})});function my(e){return""===e||void 0===e}function hy(e){const t=ji(e),r=n.useRef(""),a=n.useRef(0),o=n.useCallback(e=>{const n=r.current+e;t(n),function e(t){r.current=t,window.clearTimeout(a.current),""!==t&&(a.current=window.setTimeout(()=>e(""),1e3))}(n)},[t]),i=n.useCallback(()=>{r.current="",window.clearTimeout(a.current)},[]);return n.useEffect(()=>()=>window.clearTimeout(a.current),[]),[r,o,i]}function gy(e,t,r){const n=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let o=function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(e,Math.max(a,0));1===n.length&&(o=o.filter(e=>e!==r));const i=o.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return i!==r?i:void 0}py.displayName="SelectBubbleInput";var vy=Pb,by=Ib,yy=Ub,wy=Lb,xy=Zb,Sy=Qb,ky=ny,Ay=oy,Ey=sy,Cy=uy;const Ty=_b,Ny=n.forwardRef(({className:r,children:n,...a},o)=>e(vy,{ref:o,className:Rc("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",r),...a,children:[n,t(by,{asChild:!0,children:t(Xd,{className:"h-4 w-4 opacity-50"})})]}));Ny.displayName=vy.displayName;const _y=n.forwardRef(({className:e,children:r,position:a="popper",...o},i)=>{const{container:s}=n.useContext(ke);return t(yy,{container:s,children:t(wy,{ref:i,className:Rc("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===a&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:a,...o,children:t(xy,{className:Rc("p-1","popper"===a&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});_y.displayName=wy.displayName;n.forwardRef(({className:e,...r},n)=>t(Sy,{ref:n,className:Rc("px-2 py-1.5 text-sm font-semibold",e),...r})).displayName=Sy.displayName;const Ry=n.forwardRef(({className:r,children:n,...a},o)=>e(ky,{ref:o,className:Rc("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...a,children:[t("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:t(Ey,{children:t(eu,{className:"h-4 w-4"})})}),t(Ay,{children:n})]}));Ry.displayName=ky.displayName;n.forwardRef(({className:e,...r},n)=>t(Cy,{ref:n,className:Rc("-mx-1 my-1 h-px bg-muted",e),...r})).displayName=Cy.displayName;const Py=({workspace:r})=>{const n=be(e=>e.auth.session?.user||null),[a,o]=u(0),[i,s]=u(!1),[c,l]=u([]),{getUsers:f,removeUser:p,updateUser:m}=jy(),{settings:h}=gp();d(()=>{r&&(s(!0),f(r._id).then(e=>{l(e)}).catch(e=>{console.error(e)}).finally(()=>{s(!1)}))},[r,a]);const g=()=>{o(e=>e+1)};if(i||!r)return t(im,{});const v=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},b=c.map(e=>({...e,...v(e.user)})),y=c.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,w="admin"===y,x=(h?.workspace.maxWorkspaceUsers??Number.MAX_VALUE)>(c.length??0);return e("div",{children:[!w&&t("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),w&&e("div",{className:"mb-4",children:[x&&t(Oy,{onInvite:g,workspaceId:r._id}),!x&&t("div",{className:"text-red-500",children:"You have reached the maximum number of users for this workspace."})]}),e("div",{className:"mb-4 flex items-center justify-between",children:[t("div",{children:e("div",{className:"text-sm text-gray-600 mb-2",children:[c.length," member",1!==c.length?"s":""]})}),t("div",{children:t(Fc,{variant:"ghost",size:"sm",onClick:g,progress:i,startIcon:t(mo,{}),children:"Refresh"})})]}),t("ul",{className:"space-y-2",children:b.map((a,o)=>{const i=a.id===n?.id,s=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===a.id;return e("li",{className:"flex items-center justify-between border rounded p-3",children:[e("div",{className:"flex items-center space-x-3",children:[t("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center text-sm font-medium",children:a.name.charAt(0).toUpperCase()}),e("div",{children:[t("div",{className:"font-medium",children:a.name}),t("div",{className:"text-xs text-gray-500",children:a.email})]})]}),e("div",{className:"flex items-center gap-x-1",children:[t("div",{children:e(Ty,{disabled:i||!w||s,value:a.role,onValueChange:e=>{return t=r._id,n=a.id,o=e,void(am(r,n)?S(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:t,userId:n,role:o}}):m(t,n,{role:o}).then(()=>{g()}).catch(e=>{S(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:t,userId:n,role:o}})}));var t,n,o},children:[t(Ny,{children:t(Db,{placeholder:"Select a role"})}),t(_y,{children:r?.roles.map(e=>t(Ry,{value:e,children:e},e))})]})}),i&&t("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"You"}),s&&t("span",{className:"text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded",children:"Owner"}),!i&&!s&&w&&t(Fc,{variant:"destructive",size:"sm",startIcon:t(wo,{}),onClick:()=>{var e;e=a.id,am(r,e)?S(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):p(r._id,e).then(()=>{g()}).catch(t=>{S(t,{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}})})}})]})]},o)})}),0===c.length&&t("div",{className:"text-center py-8 text-gray-500",children:"No members found in this workspace."})]})};function Oy({onInvite:r,workspaceId:n}){const[a,o]=u(""),[i,s]=u("admin"),[c,l]=u(!1),[f,p]=u(null),[m,h]=u(null),{addUser:g,getWorkspace:v}=jy(),[b,y]=u(null),{settings:w}=gp(),x=w?.workspace.roles??b?.roles??[];d(()=>{n&&v(n).then(y)},[n]);const S=()=>{p(null),h(null),o(""),s("admin")};return e("div",{className:"flex gap-2 flex-col gap-y-2",children:[f&&t("div",{className:"text-red-500 capitalize",children:f}),m&&t("div",{className:"text-green-500 capitalize",children:m}),e("div",{children:[t(gu,{children:"Invite member by email"}),t(Tu,{type:"email",value:a,onChange:e=>o(e.target.value),placeholder:"example@example.com"})]}),e("div",{children:[t(gu,{children:"Role"}),e(Ty,{value:i,onValueChange:s,children:[t(Ny,{children:t(Db,{placeholder:"Select a role"})}),t(_y,{children:x.map(e=>t(Ry,{value:e,children:e},e))})]})]}),t("div",{children:t(Fc,{progress:c,onClick:async()=>{const e=a.trim();if(!e)return void p("Email is required");/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(l(!0),await g(n,e,i).then(()=>{h("User invited successfully"),r?.()}).catch(e=>{console.error(e),p(e.message||"Failed to invite member")}).finally(()=>{l(!1),setTimeout(()=>{S()},6e3)})):p("Invalid email address format")},disabled:c||!a||!i,children:c?"Inviting...":`Invite as ${i}`})})]})}const Dy=({workspace:r,section:n,setSection:a})=>{const o=be(e=>e.auth.session?.user||null),i=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===o?.id;return e("div",{className:"w-56 h-full flex flex-col space-y-6",children:[r&&t("div",{className:"border-b p-2 py-4",children:e("div",{className:"flex items-center gap-x-2",children:[r.image&&r.image.trim()&&t("div",{className:"bg-blue-100 rounded flex items-center justify-center text-blue-600 font-medium px-0.5 py-0.5",style:{width:"40px",height:"40px",minWidth:"40px",minHeight:"40px"},children:t("img",{src:r.image,className:"w-full h-full object-contain",style:{width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px",objectFit:"contain"},alt:r.name})}),e("div",{className:Rc("flex-1 min-w-0",r.image?"":"pl-2"),children:[t("div",{className:"font-medium text-sm line-clamp-1 text-ellipsis overflow-hidden",children:r.name}),t("div",{className:"text-xs text-gray-500",children:r.workspaceId})]})]})}),t(Iy,{title:"Account",children:t(Uy,{activeSection:n,icon:t(So,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>a("profile")})}),e(Iy,{title:"Workspace",children:[t(Uy,{activeSection:n,icon:t(go,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>a("general")}),t(Uy,{activeSection:n,icon:t(ko,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>a("users")}),t(Uy,{activeSection:n,icon:t(bo,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>a("features")}),i&&t(Uy,{activeSection:n,icon:t(xo,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>a("danger")})]})]})};function Iy({title:r,children:n}){return e("div",{className:"px-2 flex flex-col space-y-1",children:[t("div",{className:"text-xs font-bold mb-2 text-gray-500 uppercase tracking-wide px-2",children:r}),n]})}function Uy({icon:t,label:r,section:n,onClick:a,activeSection:o}){return e("button",{className:Rc("flex w-full text-left px-2 py-1 rounded text-sm items-center gap-x-1",n===o?"bg-blue-100 text-blue-700 font-medium":"hover:bg-gray-200 hover:text-gray-700"),onClick:()=>a(n),children:[t,r]})}const My=({workspace:r,onClose:n,open:a,onOpenChange:o,defaultSection:i="profile",section:s,onSectionChange:c,showTrigger:l=!0,trigger:d})=>{const[f,p]=u(!1),[m,h]=u(i),g=void 0!==a?a:f,v=o||p,b=void 0!==s?s:m,y=c||h;if(!r)return null;const w=t(Fc,{variant:"outline",size:"icon",children:t(go,{className:"h-4 w-4"})});return e(ou,{open:g,onOpenChange:e=>{v(e),!e&&n&&n()},children:[l&&t(iu,{asChild:!0,children:d||w}),e(lu,{className:"flex max-w-2xl min-w-full sm:min-w-[800px] p-0 m-0 bg-muted sm:min-h-[600px] min-h-full gap-x-0 space-x-0",children:[t(fu,{className:"sr-only",children:"Workspace settings dialog"}),t(Dy,{workspace:r,section:b,setSection:y}),e("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e(uu,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===b&&"Account","general"===b&&"Workspace Settings","users"===b&&"Workspace Members","features"===b&&"Workspace Features","danger"===b&&"Danger Zone"]}),e("div",{className:"max-h-[500px] overflow-y-auto",children:["profile"===b&&t(mb,{workspace:r}),"general"===b&&t(Am,{workspace:r}),"users"===b&&t(Py,{workspace:r}),"features"===b&&t(xm,{workspaceId:r._id?.toString()}),"danger"===b&&t(sm,{workspace:r})]})]})]})]})};function Ly(n){const{workspaces:a,currentWorkspace:o,loading:i,refreshing:s}=be(e=>e.workspaces),c=be(e=>e.auth.session?.user),{settings:l}=gp(),[f,p]=u(!1),[m,h]=u(0),[g,v]=u(""),{fetchWorkspaces:b,getFeatures:y,refreshWorkspaces:w,setCurrentWorkspace:x,workspaces:S}=jy(),k=i||s;d(()=>{0===S.length?(b(),y()):y()},[]),d(()=>{m>0&&w()},[m]);const A=S.length>0?S:a,E=A.filter(e=>e._id!==o?._id).filter(e=>e.name.toLowerCase().includes(g.toLowerCase())),C=l?.workspace.maxWorkspaces??Number.MAX_VALUE,T=A?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===c?.id?.toString()).length,N=C>(T??0);return e(ou,{open:f,onOpenChange:p,children:[t(iu,{children:n.trigger?.(k,o)}),e(lu,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e(du,{children:[e(uu,{className:"flex items-center gap-2",children:[t(so,{className:"h-5 w-5"}),"Switch Workspace"]}),t(fu,{children:"Select a workspace to switch to or create a new one."})]}),!c&&t("div",{className:"flex flex-col items-center justify-center h-full py-4 sm:py-8",children:t("div",{className:"text-sm font-medium text-muted-foreground",children:"Looks like you are not logged in. Please login to continue."})}),c&&e("div",{className:"flex flex-col gap-4",children:[o&&t(Fy,{workspace:o,isCurrentWorkspace:!0,onWorkspaceChange:n.onWorkspaceChange,onClose:()=>p(!1),setCurrentWorkspace:x,setOpen:p,workspacesToUse:A}),t(hp,{}),e("div",{children:[e("div",{className:"flex items-center justify-between",children:[e("div",{className:"text-sm font-medium text-muted-foreground",children:["Available Workspaces (",E.length,")"]}),t("div",{children:t(Fc,{progress:s,disabled:s,variant:"ghost",onClick:function(){h(e=>e+1)},startIcon:t(mo,{}),children:s?"Refreshing...":"Refresh"})})]}),e("div",{className:"relative",children:[t(ho,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),t(Tu,{placeholder:"Search workspaces...",value:g,onChange:e=>v(e.target.value),className:"pl-10"})]}),i?e("div",{className:"flex items-center justify-center py-8",children:[t(fo,{className:"h-6 w-6 animate-spin text-muted-foreground"}),t("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading workspaces..."})]}):0===E.length?e("div",{className:"text-center py-8",children:[t(so,{className:"mx-auto h-12 w-12 text-muted-foreground"}),t("p",{className:"mt-2 text-sm text-muted-foreground",children:g?"No workspaces found":"No workspaces available"})]}):t(lp,{className:"h-64",children:t("div",{className:"flex flex-col gap-2 my-2.5",children:E.map(e=>{const r=e._id===o?._id;return t(Fy,{workspace:e,isCurrentWorkspace:r,onWorkspaceChange:n.onWorkspaceChange,onClose:()=>p(!1),setCurrentWorkspace:x,setOpen:p,workspacesToUse:A},e._id)})})})]}),N&&e(r,{children:[t(hp,{}),t(zy,{onCreated:()=>{b()}})]})]})]})]})}function Fy(r){const{workspace:n,setCurrentWorkspace:a,setOpen:o,workspacesToUse:i}=r,s=r.isCurrentWorkspace??!1,[c,l]=u(!1);return e("div",{className:Rc("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":s}),children:[e(Pc,{className:"h-8 w-8 flex items-center justify-center",children:[t("div",{children:t(Oc,{src:n.image&&n.image.trim()?n.image:void 0})}),t(Dc,{children:(d=n.name,d.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))})]}),e("div",{className:"flex-1 min-w-0 max-w-full",children:[t("div",{className:"flex items-center gap-2",children:t("span",{className:"font-medium line-clamp-1 text-ellipsis overflow-hidden max-w-full",children:n.name})}),e("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[t(ko,{className:"h-3 w-3"}),e("span",{children:[n.users?.length||0," members"]})]})]}),e("div",{className:"flex items-center gap-2",children:[s?null:t(Fc,{size:"sm",disabled:c,progress:c,onClick:()=>{l(!0),r.onWorkspaceChange(n).then(()=>{a(n),o(!1)}).catch(e=>{S(e,{component:"WorkspaceItem",action:"onWorkspaceChange",metadata:{workspaceId:n._id}})}).finally(()=>{l(!1)})},children:"Switch to"}),t(My,{workspace:n,onClose:()=>{if(s){const e=i.findIndex(e=>e._id?.toString()===n._id?.toString());-1!==e&&a(i[e])}}})]})]});var d}function zy(n){const[a,o]=u(!1),[i,s]=u("emoji"),[c,l]=u("🏢"),[d,f]=u(!1),{createWorkspace:p}=jy(),m=Qt({resolver:Qa(xi({name:Zo().min(2,{message:"Workspace name must be at least 2 characters."}),image:Zo().optional()})),defaultValues:{name:"",image:""}});return e(ou,{open:a,onOpenChange:o,children:[t(iu,{asChild:!0,children:e(Fc,{className:"w-full rounded-none",children:[t(po,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e(lu,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e(du,{children:[t(uu,{children:"Create New Workspace"}),t(fu,{children:"Create a new workspace to get started."})]}),t(vu,{...m,children:e("form",{onSubmit:m.handleSubmit(async function(e){let t="";if("emoji"===i)t=Sm(c);else if("url"===i&&e.image)try{new URL(e.image),t=e.image}catch{return void m.setError("image",{message:"Please enter a valid URL"})}f(!0);try{await p(e.name,t),o(!1),m.reset(),l("🏢"),s("emoji"),n?.onCreated?.()}catch(e){console.error("Failed to create workspace:",e)}finally{f(!1)}}),children:[t(yu,{control:m.control,name:"name",render:({field:r})=>e(Su,{children:[t(ku,{children:"Workspace Name"}),t(Au,{children:t(Tu,{placeholder:"My Awesome Workspace",...r})}),t(Cu,{})]})}),e("div",{className:"flex flex-col gap-y-2 my-2",children:[e("div",{children:[t(gu,{className:"text-sm font-medium",children:"Workspace Icon"}),t(Eu,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e(kf,{value:i,onValueChange:e=>s(e),className:"flex flex-col gap-y-2",children:[e("div",{className:"flex items-center gap-x-2 my-1",children:[t(Af,{value:"emoji",id:"emoji"}),e(gu,{htmlFor:"emoji",className:"flex items-center gap-2",children:[t(vo,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e("div",{className:"flex items-center gap-x-2 my-1",children:[t(Af,{value:"url",id:"url"}),e(gu,{htmlFor:"url",className:"flex items-center gap-2",children:[t(uo,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===i&&e("div",{className:"flex flex-col gap-y-2",children:[e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:c})]}),t(lp,{className:"h-32 w-full rounded-md border",children:t("div",{className:"p-4 grid grid-cols-8 gap-2",children:km.map((e,r)=>t("button",{type:"button",onClick:()=>(e=>{l(e),m.setValue("image",Sm(e))})(e),className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(c===e?"bg-primary text-primary-foreground":""),children:e},r))})})]}),"url"===i&&e("div",{className:"flex flex-col gap-y-2",children:[t(yu,{control:m.control,name:"image",render:({field:r})=>e(Su,{children:[t(ku,{children:"Image URL"}),t(Au,{children:t(Tu,{placeholder:"https://example.com/image.png",...r})}),t(Eu,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),t(Cu,{})]})}),m.watch("image")&&m.watch("image")?.trim()&&e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:t("img",{src:m.watch("image")||void 0,alt:"Workspace preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.style.display="none"}})})]})]})]}),e("div",{className:"flex justify-end gap-3 pt-4",children:[t(Fc,{type:"button",variant:"outline",onClick:()=>{o(!1),m.reset(),l("🏢"),s("emoji")},disabled:d,children:"Cancel"}),t(Fc,{type:"submit",disabled:d,children:d?e(r,{children:[t(fo,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}const jy=()=>{const e=ye(),t=be(e=>e.os),r=c(()=>new Te(t),[t]),n=be(e=>e.workspaces),o=be(e=>e.auth.session?.user),i=l(t=>{if(t._id!==n.currentWorkspace?._id&&t){const r=n.currentWorkspace;e.workspaces(ae(t)),Se.emitWorkspaceChanged(t,r).catch(e=>{S(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceChanged",metadata:{workspaceId:t._id}})})}},[n.currentWorkspace,e]);d(()=>{if(!n.isInitialized){const t=rm();if(e.workspaces(ie(!0)),t){const e=n.workspaces.find(e=>e._id===t);if(e){if(e._id===n.currentWorkspace?._id)return;i(e)}}}},[n.isInitialized,n.workspaces,n.currentWorkspace,e,i]);const s=l(()=>{e.workspaces(oe())},[e]),u=a.useRef(!1),f=a.useRef(!1),p=l(async()=>{if(!n.loading&&!u.current){u.current=!0,e.workspaces(se(!0)),e.workspaces(ce(null));try{const t=await r.getWorkspaces();if(e.workspaces(re(t)),t.length>0){const e=rm();if(e&&nm(e,t)){const r=t.find(t=>t._id===e);r&&i(r)}else t.length>0&&(n.currentWorkspace||i(t[0]))}}catch(t){e.workspaces(ce(t instanceof Error?t.message:"Failed to fetch workspaces"))}finally{e.workspaces(se(!1)),u.current=!1}}},[r,n.loading,n.currentWorkspace?._id,e,i]),m=l(async()=>{if(!n.refreshing&&!u.current){u.current=!0,e.workspaces(le(!0));try{const t=await r.getWorkspaces();e.workspaces(re(t))}catch(e){}finally{e.workspaces(le(!1)),u.current=!1}}},[r,n.refreshing,e]),h=l(async(t,a)=>{const o=await r.createWorkspace({name:t,image:a});e.workspaces(re([...n.workspaces,o])),Se.emitWorkspaceCreated(o).catch(e=>{S(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceCreated",metadata:{workspaceId:o._id}})})},[r,n.workspaces,e]),g=l(async(t,a)=>{const o=await r.updateWorkspace(t._id,a);e.workspaces(re(n.workspaces.map(e=>e._id===t._id?o:e))),Se.emitWorkspaceUpdated(o).catch(e=>{S(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceUpdated",metadata:{workspaceId:o._id}})})},[r,n.workspaces,e]),v=l(async()=>{if(f.current)return n.allFeatures.length>0?n.allFeatures:null;if(n.allFeatures.length>0)return n.allFeatures;f.current=!0;try{const t=await r.getFeatures();return e.workspaces(ne(t)),t}catch(e){return S(e,{component:"useSaaSWorkspaces",action:"getFeatures"}),null}finally{f.current=!1}},[r,e,n.allFeatures]),b=l(async(e,t,n)=>await r.updateFeature(e,t,n),[r]);d(()=>{if(!n.currentWorkspace?._id||0===n.workspaces.length)return;const e=n.currentWorkspace._id,t=n.workspaces.find(t=>t._id===e);if(t)t!==n.currentWorkspace&&i(t);else if(n.workspaces.length>0){const t=n.workspaces[0];t._id!==e&&i(t)}},[n.workspaces,n.currentWorkspace,i]);const y=l(async e=>await r.getWorkspaceUsers(e),[r]),w=l(async(e,t,a)=>{const o=await r.addUser(e,{email:t,role:a}),i=n.workspaces.find(t=>t._id===e);return i&&Se.emitWorkspaceUserAdded(o.userId,i,a).catch(t=>{S(t,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserAdded",metadata:{workspaceId:e,userId:o.userId,role:a}})}),o},[r,n.workspaces]),x=l(async(e,t)=>{const a=n.workspaces.find(t=>t._id===e);if(a&&am(a,t))throw new Error("Cannot remove the workspace owner");const o=(await r.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t),i=await r.removeUser(e,t);if(a&&o){const t=o.role;Se.emitWorkspaceUserRemoved(i.userId,a,t).catch(r=>{S(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRemoved",metadata:{workspaceId:e,userId:i.userId,role:t}})})}return i},[r,n.workspaces]),k=l(async(e,t,a)=>{if(a.role){const r=n.workspaces.find(t=>t._id===e);if(r&&am(r,t))throw new Error("Cannot change the role of the workspace owner")}let o;if(a.role){const n=(await r.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t);o=n?.role}const i=await r.updateUser(e,t,a);return a.role&&o&&o!==a.role&&Se.emitWorkspaceUserRoleChanged(i.userId,i.workspace,o,a.role).catch(r=>{S(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRoleChanged",metadata:{workspaceId:e,userId:t,previousRole:o,newRole:a.role}})}),i},[r,n.workspaces]),A=l(async e=>{const t=await r.getProfile().catch(()=>null),n=await r.updateUserProfile(e);return Se.emitUserUpdated(n,t||void 0).catch(e=>{S(e,{component:"useSaaSWorkspaces",action:"emitUserUpdated",metadata:{userId:n._id}})}),n},[r]),E=l(async()=>await r.getProfile(),[r]),C=l(async e=>await r.getWorkspace(e),[r]),T=l(async t=>{if(!o)throw new Error("User must be authenticated to delete a workspace");const a=n.workspaces.find(e=>e._id===t);if(!a)throw new Error("Workspace not found");if(!am(a,o.id))throw new Error("Only the workspace creator can delete the workspace");const i=await r.deleteWorkspace(t);return e.workspaces(re(n.workspaces.filter(e=>e._id!==t))),n.currentWorkspace?._id===t&&e.workspaces(oe()),a&&Se.emitWorkspaceDeleted(a).catch(e=>{S(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceDeleted",metadata:{workspaceId:t}})}),i},[r,n.workspaces,n.currentWorkspace,e,o]);return{workspaces:n.workspaces,loading:n.loading,error:n.error,fetchWorkspaces:p,refreshWorkspaces:m,refreshing:n.refreshing,WorkspaceSwitcher:Ly,currentWorkspace:n.currentWorkspace,setCurrentWorkspace:i,resetCurrentWorkspace:s,createWorkspace:h,allFeatures:n.allFeatures,getFeatures:v,updateFeature:b,getWorkspace:C,switching:n.switching,updateWorkspace:g,getUsers:y,addUser:w,removeUser:x,updateUser:k,getProfile:E,updateUserProfile:A,deleteWorkspace:T}};const By=new class{constructor(){this.listeners=new Set,this.currentState={open:!1,section:"profile"}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getState(){return{...this.currentState}}openWorkspaceSettings(e){this.currentState={open:!0,section:e||"profile"},this.notifyListeners()}closeSettings(){this.currentState={...this.currentState,open:!1},this.notifyListeners()}setSection(e){this.currentState={...this.currentState,section:e},this.notifyListeners()}notifyListeners(){this.listeners.forEach(e=>{e(this.currentState.open,this.currentState.section)})}},Wy=({children:n})=>{const{currentWorkspace:a}=jy(),[o,i]=u(!1),[s,c]=u("profile");return d(()=>{const e=By.getState();i(e.open),c(e.section);return By.subscribe((e,t)=>{i(e),c(t)})},[]),e(r,{children:[n,a&&t(My,{workspace:a,open:o,onOpenChange:e=>{e||By.closeSettings()},section:s,onSectionChange:e=>{By.setSection(e)},showTrigger:!1})]})},Vy=(e,t,r)=>{if(t!==y.V1)throw new Error(`Invalid version: "${t}". Only "${y.V1}" is currently supported.`);if(!e||"string"!=typeof e)throw new Error("serverUrl is required and must be a string");if(!(e=>{try{return new URL(e),!0}catch{return!1}})(e))throw new Error(`Invalid serverUrl: "${e}". Must be a valid URL.`);if(!r||"string"!=typeof r)throw new Error("orgId is required and must be a string");if(!/^[0-9a-fA-F]{24}$/.test(r))throw new Error(`Invalid orgId: "${r}". Must be a valid MongoDB ObjectId (24 hexadecimal characters).`)},$y=a.memo(({serverUrl:e,version:r,orgId:n,auth:o,children:i})=>{Vy(e,r,n);const s=a.useMemo(()=>({serverUrl:e,version:r,orgId:n}),[e,r,n]),c=a.useMemo(()=>o?.callbacks,[o?.callbacks]),l=a.useMemo(()=>o?.callbacks?.handleEvent,[o?.callbacks]);return d(()=>(Se.setCallbacks(l?{handleEvent:l}:null),()=>{Se.setCallbacks(null)}),[l]),t(A,{children:t(ve,{children:t(we,{callbacks:c,children:t(Ae,{children:t(xe,{config:s,auth:o,children:t(Ce,{children:t(Wy,{children:i})})})})})})})});$y.displayName="SaaSOSProvider";let Gy=class{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}async fetchConfig(){const e=await fetch(`${this.serverUrl}/api/${this.version}/beta/config?orgId=${this.orgId}`);if(!e.ok)throw new Error(`Failed to fetch beta form configuration: ${e.statusText}`);return e.json()}async submitBetaUser(e){const t=e?.context??{},r=t?.country??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[1]:void 0),n=t?.language??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[0]:void 0),a=t?.timezone??("undefined"!=typeof Intl&&Intl.DateTimeFormat?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0),o=t?.currency??("undefined"!=typeof Intl&&Intl.NumberFormat&&Intl.NumberFormat().resolvedOptions().currency?Intl.NumberFormat().resolvedOptions().currency:void 0),i=await fetch(`${this.serverUrl}/api/${this.version}/beta/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orgId:this.orgId,formData:{...e,country:r,language:n,timezone:a,currency:o}})});if(!i.ok)throw new Error(`Failed to submit beta user request: ${i.statusText}`);return i.json()}};const Ky=xi({name:Zo().min(1,"Please enter your name").max(50,"Name must be less than 50 characters").regex(/^[a-zA-Z\s]*$/,"Name can only contain letters and spaces"),email:Zo().min(1,"Please enter your email address").email("Please enter a valid email address").max(100,"Email must be less than 100 characters").regex(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,"Please enter a valid email format (e.g., name@domain.com)")}),Hy={en:{nameLabel:"Name",emailLabel:"Email",submitText:"Submit",submittingText:"Submitting...",errorMessage:"An error occurred"},es:{nameLabel:"Nombre",emailLabel:"Correo electrónico",submitText:"Enviar",submittingText:"Enviando...",errorMessage:"Ocurrió un error"},fr:{nameLabel:"Nom",emailLabel:"Email",submitText:"Soumettre",submittingText:"Soumission...",errorMessage:"Une erreur est survenue"},de:{nameLabel:"Name",emailLabel:"E-Mail",submitText:"Absenden",submittingText:"Wird gesendet...",errorMessage:"Ein Fehler ist aufgetreten"},zh:{nameLabel:"姓名",emailLabel:"电子邮件",submitText:"提交",submittingText:"提交中...",errorMessage:"发生错误"},ja:{nameLabel:"名前",emailLabel:"メールアドレス",submitText:"送信",submittingText:"送信中...",errorMessage:"エラーが発生しました"},ko:{nameLabel:"이름",emailLabel:"이메일",submitText:"제출",submittingText:"제출 중...",errorMessage:"오류가 발생했습니다"}},Zy=({onSuccess:n,onError:a,className:o="w-full",fieldClassName:i="flex flex-col gap-1.5 w-full",language:s,customTexts:c={},autoFocus:f=!0,showSuccessMessage:p=!0,hideLogo:m=!1,hideTitles:h=!1})=>{const[g,v]=u("en"),[b,y]=u(!1),[w,x]=u(!1),{submitBetaForm:S,isLoading:k,isSubmitting:A,error:E,config:C,success:T,message:N}=(()=>{const e=be(e=>e.os),[t,r]=u(null),[n,a]=u(!0),[o,i]=u(!1),[s,c]=u(null),[f,p]=u(!1),[m,h]=u(null);return d(()=>{(async()=>{a(!0);const t=new Gy(e),n=await t.fetchConfig();r(n),a(!1)})()},[e]),{isLoading:n,isSubmitting:o,config:t,error:s,success:f,message:m,submitBetaForm:l(async t=>{if(!e){const e="SaaS OS context is not initialized";return c(e),{success:!1,message:e}}try{i(!0),c(null),p(!1),h(null);const r=new Gy(e),n=await r.submitBetaUser({name:t.name||"",email:t.email}),a="success"===n.status;return p(a),h(n.message),{success:a,message:n.message}}catch(e){const t=e instanceof Error?e.message:"Failed to submit beta form";return c(t),p(!1),h(t),{success:!1,message:t}}finally{i(!1)}},[e])}})();d(()=>{v((()=>{if("undefined"==typeof window)return"en";const e=window.navigator.language.split("-")[0];return-1!==Object.keys(Hy).indexOf(e)?e:"en"})())},[]),d(()=>{T&&p&&(y(!0),x(!0)),E&&x(!0)},[T,p,E]);const _={...Hy[s||g],...c},R=Qt({resolver:Qa(Ky),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});d(()=>{f&&R.setFocus("name")},[f,R]);const P=R.formState.isValid&&!A;return t("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:e("div",k?{className:Rc("flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",o),children:[t(om,{className:"h-24 w-24 rounded-lg"}),t(om,{className:"h-6 w-32"}),e("div",{className:"w-full space-y-4",children:[e("div",{className:"space-y-2",children:[t(om,{className:"h-4 w-16"}),t(om,{className:"h-10 w-full"})]}),e("div",{className:"space-y-2",children:[t(om,{className:"h-4 w-16"}),t(om,{className:"h-10 w-full"})]}),t(om,{className:"h-10 w-full"})]})]}:{className:"flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",children:[!m&&e("div",{className:"flex flex-col items-center justify-center w-full",children:[C?.logo&&t(Jy,{logo:C?.logo}),C?.name&&t("div",{children:C?.name})]}),t(st,{...R,children:e("form",{onSubmit:R.handleSubmit(async e=>{try{const t=await S(e);t.success?(n?.(),R.reset(),p&&y(!0),x(!0)):(a?.(t.message),x(!0))}catch(e){a?.(e instanceof Error?e.message:_.errorMessage),x(!0)}}),className:o,noValidate:!0,"aria-busy":A,children:[!w&&e(r,{children:[!h&&C?.screen?.register&&t(qy,{screen:C?.screen?.register}),t(yu,{control:R.control,name:"name",render:({field:r})=>e(Su,{className:i,children:[t(ku,{children:_.nameLabel}),t(Au,{children:t(Tu,{...r})}),t(Eu,{}),t(Cu,{})]})}),t(yu,{control:R.control,name:"email",render:({field:r})=>e(Su,{className:i,children:[t(ku,{children:_.emailLabel}),t(Au,{children:t(Tu,{...r})}),t(Eu,{}),t(Cu,{})]})}),t(Fc,{type:"submit",disabled:!P,className:i,children:A?_.submittingText:_.submitText})]}),w&&E&&e("div",{className:"flex flex-col items-center justify-center w-full",children:[e("div",{className:"border-red-300 text-red-700",role:"alert","aria-live":"assertive","aria-atomic":!0,children:[t("span",{className:"text-4xl mb-2",role:"img","aria-label":"Error",children:"❗"}),E]}),t("div",{className:"mt-4 flex justify-center",children:t(Fc,{type:"button",onClick:()=>{x(!1),R.reset()},className:i,children:"Try Again"})})]}),w&&b&&N&&t("div",{className:"flex flex-col items-center justify-center w-full text-green-700 border-green-300 text-center",children:C?.screen?.thankYou&&t(qy,{screen:C?.screen?.thankYou})})]})}),!w&&t("div",{children:e("div",{children:["By submitting this form, you consent to our"," ",t("a",{href:C?.privacyPolicy,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Privacy Policy"})," ","and"," ",t("a",{href:C?.termsOfService,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Terms of Service"}),"."]})})]})})};function qy({screen:r}){return e("div",{className:"flex flex-col items-center justify-center w-full",children:[t("p",{className:"text-2xl font-bold",children:r?.title}),t("p",{className:"text-sm text-muted-foreground",children:r?.description})]})}function Jy({logo:e}){return t("img","string"==typeof e?{src:e,alt:"Logo",className:"max-h-24"}:{src:e.bucket?.url,alt:"Logo",className:"max-h-24"})}function Yy(e,t){return function(){return e.apply(t,arguments)}}const{toString:Xy}=Object.prototype,{getPrototypeOf:Qy}=Object,{iterator:ew,toStringTag:tw}=Symbol,rw=(nw=Object.create(null),e=>{const t=Xy.call(e);return nw[t]||(nw[t]=t.slice(8,-1).toLowerCase())});var nw;const aw=e=>(e=e.toLowerCase(),t=>rw(t)===e),ow=e=>t=>typeof t===e,{isArray:iw}=Array,sw=ow("undefined");function cw(e){return null!==e&&!sw(e)&&null!==e.constructor&&!sw(e.constructor)&&uw(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const lw=aw("ArrayBuffer");const dw=ow("string"),uw=ow("function"),fw=ow("number"),pw=e=>null!==e&&"object"==typeof e,mw=e=>{if("object"!==rw(e))return!1;const t=Qy(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||tw in e||ew in e)},hw=aw("Date"),gw=aw("File"),vw=aw("Blob"),bw=aw("FileList"),yw=aw("URLSearchParams"),[ww,xw,Sw,kw]=["ReadableStream","Request","Response","Headers"].map(aw);function Aw(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,a;if("object"!=typeof e&&(e=[e]),iw(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if(cw(e))return;const a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length;let i;for(n=0;n<o;n++)i=a[n],t.call(null,e[i],i,e)}}function Ew(e,t){if(cw(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,a=r.length;for(;a-- >0;)if(n=r[a],t===n.toLowerCase())return n;return null}const Cw="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Tw=e=>!sw(e)&&e!==Cw;const Nw=(_w="undefined"!=typeof Uint8Array&&Qy(Uint8Array),e=>_w&&e instanceof _w);var _w;const Rw=aw("HTMLFormElement"),Pw=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Ow=aw("RegExp"),Dw=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Aw(r,(r,a)=>{let o;!1!==(o=t(r,a,e))&&(n[a]=o||r)}),Object.defineProperties(e,n)};const Iw=aw("AsyncFunction"),Uw=(Mw="function"==typeof setImmediate,Lw=uw(Cw.postMessage),Mw?setImmediate:Lw?(Fw=`axios@${Math.random()}`,zw=[],Cw.addEventListener("message",({source:e,data:t})=>{e===Cw&&t===Fw&&zw.length&&zw.shift()()},!1),e=>{zw.push(e),Cw.postMessage(Fw,"*")}):e=>setTimeout(e));var Mw,Lw,Fw,zw;const jw="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Cw):"undefined"!=typeof process&&process.nextTick||Uw;var Bw={isArray:iw,isArrayBuffer:lw,isBuffer:cw,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||uw(e.append)&&("formdata"===(t=rw(e))||"object"===t&&uw(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&lw(e.buffer),t},isString:dw,isNumber:fw,isBoolean:e=>!0===e||!1===e,isObject:pw,isPlainObject:mw,isEmptyObject:e=>{if(!pw(e)||cw(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:ww,isRequest:xw,isResponse:Sw,isHeaders:kw,isUndefined:sw,isDate:hw,isFile:gw,isBlob:vw,isRegExp:Ow,isFunction:uw,isStream:e=>pw(e)&&uw(e.pipe),isURLSearchParams:yw,isTypedArray:Nw,isFileList:bw,forEach:Aw,merge:function e(){const{caseless:t,skipUndefined:r}=Tw(this)&&this||{},n={},a=(a,o)=>{const i=t&&Ew(n,o)||o;mw(n[i])&&mw(a)?n[i]=e(n[i],a):mw(a)?n[i]=e({},a):iw(a)?n[i]=a.slice():r&&sw(a)||(n[i]=a)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Aw(arguments[e],a);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(Aw(t,(t,n)=>{r&&uw(t)?e[n]=Yy(t,r):e[n]=t},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let a,o,i;const s={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)i=a[o],n&&!n(i,e,t)||s[i]||(t[i]=e[i],s[i]=!0);e=!1!==r&&Qy(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:rw,kindOfTest:aw,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(iw(e))return e;let t=e.length;if(!fw(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[ew]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Rw,hasOwnProperty:Pw,hasOwnProp:Pw,reduceDescriptors:Dw,freezeMethods:e=>{Dw(e,(t,r)=>{if(uw(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];uw(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return iw(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Ew,global:Cw,isContextDefined:Tw,isSpecCompliantForm:function(e){return!!(e&&uw(e.append)&&"FormData"===e[tw]&&e[ew])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(pw(e)){if(t.indexOf(e)>=0)return;if(cw(e))return e;if(!("toJSON"in e)){t[n]=e;const a=iw(e)?[]:{};return Aw(e,(e,t)=>{const o=r(e,n+1);!sw(o)&&(a[t]=o)}),t[n]=void 0,a}}return e};return r(e,0)},isAsyncFn:Iw,isThenable:e=>e&&(pw(e)||uw(e))&&uw(e.then)&&uw(e.catch),setImmediate:Uw,asap:jw,isIterable:e=>null!=e&&uw(e[ew])};function Ww(e,t,r,n,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),a&&(this.response=a,this.status=a.status?a.status:null)}Bw.inherits(Ww,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Bw.toJSONObject(this.config),code:this.code,status:this.status}}});const Vw=Ww.prototype,$w={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{$w[e]={value:e}}),Object.defineProperties(Ww,$w),Object.defineProperty(Vw,"isAxiosError",{value:!0}),Ww.from=(e,t,r,n,a,o)=>{const i=Object.create(Vw);Bw.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const s=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return Ww.call(i,s,c,r,n,a),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};function Gw(e){return Bw.isPlainObject(e)||Bw.isArray(e)}function Kw(e){return Bw.endsWith(e,"[]")?e.slice(0,-2):e}function Hw(e,t,r){return e?e.concat(t).map(function(e,t){return e=Kw(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const Zw=Bw.toFlatObject(Bw,{},null,function(e){return/^is[A-Z]/.test(e)});function qw(e,t,r){if(!Bw.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=Bw.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Bw.isUndefined(t[e])})).metaTokens,a=r.visitor||l,o=r.dots,i=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Bw.isSpecCompliantForm(t);if(!Bw.isFunction(a))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(Bw.isDate(e))return e.toISOString();if(Bw.isBoolean(e))return e.toString();if(!s&&Bw.isBlob(e))throw new Ww("Blob is not supported. Use a Buffer instead.");return Bw.isArrayBuffer(e)||Bw.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,a){let s=e;if(e&&!a&&"object"==typeof e)if(Bw.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(Bw.isArray(e)&&function(e){return Bw.isArray(e)&&!e.some(Gw)}(e)||(Bw.isFileList(e)||Bw.endsWith(r,"[]"))&&(s=Bw.toArray(e)))return r=Kw(r),s.forEach(function(e,n){!Bw.isUndefined(e)&&null!==e&&t.append(!0===i?Hw([r],n,o):null===i?r:r+"[]",c(e))}),!1;return!!Gw(e)||(t.append(Hw(a,r,o),c(e)),!1)}const d=[],u=Object.assign(Zw,{defaultVisitor:l,convertValue:c,isVisitable:Gw});if(!Bw.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!Bw.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),Bw.forEach(r,function(r,o){!0===(!(Bw.isUndefined(r)||null===r)&&a.call(t,r,Bw.isString(o)?o.trim():o,n,u))&&e(r,n?n.concat(o):[o])}),d.pop()}}(e),t}function Jw(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Yw(e,t){this._pairs=[],e&&qw(e,this,t)}const Xw=Yw.prototype;function Qw(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ex(e,t,r){if(!t)return e;const n=r&&r.encode||Qw;Bw.isFunction(r)&&(r={serialize:r});const a=r&&r.serialize;let o;if(o=a?a(t,r):Bw.isURLSearchParams(t)?t.toString():new Yw(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}Xw.append=function(e,t){this._pairs.push([e,t])},Xw.toString=function(e){const t=e?function(t){return e.call(this,t,Jw)}:Jw;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class tx{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Bw.forEach(this.handlers,function(t){null!==t&&e(t)})}}var rx={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},nx={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Yw,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ax="undefined"!=typeof window&&"undefined"!=typeof document,ox="object"==typeof navigator&&navigator||void 0,ix=ax&&(!ox||["ReactNative","NativeScript","NS"].indexOf(ox.product)<0),sx="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,cx=ax&&window.location.href||"http://localhost";var lx={...Object.freeze({__proto__:null,hasBrowserEnv:ax,hasStandardBrowserEnv:ix,hasStandardBrowserWebWorkerEnv:sx,navigator:ox,origin:cx}),...nx};function dx(e){function t(e,r,n,a){let o=e[a++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),s=a>=e.length;if(o=!o&&Bw.isArray(n)?n.length:o,s)return Bw.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!i;n[o]&&Bw.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],a)&&Bw.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const a=r.length;let o;for(n=0;n<a;n++)o=r[n],t[o]=e[o];return t}(n[o])),!i}if(Bw.isFormData(e)&&Bw.isFunction(e.entries)){const r={};return Bw.forEachEntry(e,(e,n)=>{t(function(e){return Bw.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const ux={transitional:rx,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,a=Bw.isObject(e);a&&Bw.isHTMLForm(e)&&(e=new FormData(e));if(Bw.isFormData(e))return n?JSON.stringify(dx(e)):e;if(Bw.isArrayBuffer(e)||Bw.isBuffer(e)||Bw.isStream(e)||Bw.isFile(e)||Bw.isBlob(e)||Bw.isReadableStream(e))return e;if(Bw.isArrayBufferView(e))return e.buffer;if(Bw.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return qw(e,new lx.classes.URLSearchParams,{visitor:function(e,t,r,n){return lx.isNode&&Bw.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=Bw.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return qw(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||n?(t.setContentType("application/json",!1),function(e,t,r){if(Bw.isString(e))try{return(t||JSON.parse)(e),Bw.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ux.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(Bw.isResponse(e)||Bw.isReadableStream(e))return e;if(e&&Bw.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(e){if(r){if("SyntaxError"===e.name)throw Ww.from(e,Ww.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:lx.classes.FormData,Blob:lx.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Bw.forEach(["delete","get","head","post","put","patch"],e=>{ux.headers[e]={}});const fx=Bw.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const px=Symbol("internals");function mx(e){return e&&String(e).trim().toLowerCase()}function hx(e){return!1===e||null==e?e:Bw.isArray(e)?e.map(hx):String(e)}function gx(e,t,r,n,a){return Bw.isFunction(n)?n.call(this,t,r):(a&&(t=r),Bw.isString(t)?Bw.isString(n)?-1!==t.indexOf(n):Bw.isRegExp(n)?n.test(t):void 0:void 0)}let vx=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function a(e,t,r){const a=mx(t);if(!a)throw new Error("header name must be a non-empty string");const o=Bw.findKey(n,a);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=hx(e))}const o=(e,t)=>Bw.forEach(e,(e,r)=>a(e,r,t));if(Bw.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(Bw.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,n,a;return e&&e.split("\n").forEach(function(e){a=e.indexOf(":"),r=e.substring(0,a).trim().toLowerCase(),n=e.substring(a+1).trim(),!r||t[r]&&fx[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(Bw.isObject(e)&&Bw.isIterable(e)){let r,n,a={};for(const t of e){if(!Bw.isArray(t))throw TypeError("Object iterator must return a key-value pair");a[n=t[0]]=(r=a[n])?Bw.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}o(a,t)}else null!=e&&a(t,e,r);return this}get(e,t){if(e=mx(e)){const r=Bw.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(Bw.isFunction(t))return t.call(this,e,r);if(Bw.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=mx(e)){const r=Bw.findKey(this,e);return!(!r||void 0===this[r]||t&&!gx(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function a(e){if(e=mx(e)){const a=Bw.findKey(r,e);!a||t&&!gx(0,r[a],a,t)||(delete r[a],n=!0)}}return Bw.isArray(e)?e.forEach(a):a(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const a=t[r];e&&!gx(0,this[a],a,e,!0)||(delete this[a],n=!0)}return n}normalize(e){const t=this,r={};return Bw.forEach(this,(n,a)=>{const o=Bw.findKey(r,a);if(o)return t[o]=hx(n),void delete t[a];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(a):String(a).trim();i!==a&&delete t[a],t[i]=hx(n),r[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Bw.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&Bw.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[px]=this[px]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=mx(e);t[n]||(!function(e,t){const r=Bw.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,a){return this[n].call(this,t,e,r,a)},configurable:!0})})}(r,e),t[n]=!0)}return Bw.isArray(e)?e.forEach(n):n(e),this}};function bx(e,t){const r=this||ux,n=t||r,a=vx.from(n.headers);let o=n.data;return Bw.forEach(e,function(e){o=e.call(r,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function yx(e){return!(!e||!e.__CANCEL__)}function wx(e,t,r){Ww.call(this,null==e?"canceled":e,Ww.ERR_CANCELED,t,r),this.name="CanceledError"}function xx(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new Ww("Request failed with status code "+r.status,[Ww.ERR_BAD_REQUEST,Ww.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}vx.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Bw.reduceDescriptors(vx.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),Bw.freezeMethods(vx),Bw.inherits(wx,Ww,{__CANCEL__:!0});const Sx=(e,t,r=3)=>{let n=0;const a=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let a,o=0,i=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),l=n[i];a||(a=c),r[o]=s,n[o]=c;let d=i,u=0;for(;d!==o;)u+=r[d++],d%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-a<t)return;const f=l&&c-l;return f?Math.round(1e3*u/f):void 0}}(50,250);return function(e,t){let r,n,a=0,o=1e3/t;const i=(t,o=Date.now())=>{a=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-a;s>=o?i(e,t):(r=e,n||(n=setTimeout(()=>{n=null,i(r)},o-s)))},()=>r&&i(r)]}(r=>{const o=r.loaded,i=r.lengthComputable?r.total:void 0,s=o-n,c=a(s);n=o;e({loaded:o,total:i,progress:i?o/i:void 0,bytes:s,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})},r)},kx=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Ax=e=>(...t)=>Bw.asap(()=>e(...t));var Ex=lx.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,lx.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(lx.origin),lx.navigator&&/(msie|trident)/i.test(lx.navigator.userAgent)):()=>!0,Cx=lx.hasStandardBrowserEnv?{write(e,t,r,n,a,o){const i=[e+"="+encodeURIComponent(t)];Bw.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),Bw.isString(n)&&i.push("path="+n),Bw.isString(a)&&i.push("domain="+a),!0===o&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Tx(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Nx=e=>e instanceof vx?{...e}:e;function _x(e,t){t=t||{};const r={};function n(e,t,r,n){return Bw.isPlainObject(e)&&Bw.isPlainObject(t)?Bw.merge.call({caseless:n},e,t):Bw.isPlainObject(t)?Bw.merge({},t):Bw.isArray(t)?t.slice():t}function a(e,t,r,a){return Bw.isUndefined(t)?Bw.isUndefined(e)?void 0:n(void 0,e,0,a):n(e,t,0,a)}function o(e,t){if(!Bw.isUndefined(t))return n(void 0,t)}function i(e,t){return Bw.isUndefined(t)?Bw.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,a,o){return o in t?n(r,a):o in e?n(void 0,r):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s,headers:(e,t,r)=>a(Nx(e),Nx(t),0,!0)};return Bw.forEach(Object.keys({...e,...t}),function(n){const o=c[n]||a,i=o(e[n],t[n],n);Bw.isUndefined(i)&&o!==s||(r[n]=i)}),r}var Rx=e=>{const t=_x({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:o,headers:i,auth:s}=t;if(t.headers=i=vx.from(i),t.url=ex(Tx(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&i.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),Bw.isFormData(r))if(lx.hasStandardBrowserEnv||lx.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(Bw.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&i.set(e,r)})}if(lx.hasStandardBrowserEnv&&(n&&Bw.isFunction(n)&&(n=n(t)),n||!1!==n&&Ex(t.url))){const e=a&&o&&Cx.read(o);e&&i.set(a,e)}return t};var Px="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=Rx(e);let a=n.data;const o=vx.from(n.headers).normalize();let i,s,c,l,d,{responseType:u,onUploadProgress:f,onDownloadProgress:p}=n;function m(){l&&l(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(i),n.signal&&n.signal.removeEventListener("abort",i)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=vx.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());xx(function(e){t(e),m()},function(e){r(e),m()},{data:u&&"text"!==u&&"json"!==u?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:n,config:e,request:h}),h=null}h.open(n.method.toUpperCase(),n.url,!0),h.timeout=n.timeout,"onloadend"in h?h.onloadend=g:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(g)},h.onabort=function(){h&&(r(new Ww("Request aborted",Ww.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const n=new Ww(t&&t.message?t.message:"Network Error",Ww.ERR_NETWORK,e,h);n.event=t||null,r(n),h=null},h.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const a=n.transitional||rx;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new Ww(t,a.clarifyTimeoutError?Ww.ETIMEDOUT:Ww.ECONNABORTED,e,h)),h=null},void 0===a&&o.setContentType(null),"setRequestHeader"in h&&Bw.forEach(o.toJSON(),function(e,t){h.setRequestHeader(t,e)}),Bw.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),p&&([c,d]=Sx(p,!0),h.addEventListener("progress",c)),f&&h.upload&&([s,l]=Sx(f),h.upload.addEventListener("progress",s),h.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(i=t=>{h&&(r(!t||t.type?new wx(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(i),n.signal&&(n.signal.aborted?i():n.signal.addEventListener("abort",i)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);v&&-1===lx.protocols.indexOf(v)?r(new Ww("Unsupported protocol "+v+":",Ww.ERR_BAD_REQUEST,e)):h.send(a||null)})};const Ox=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const a=function(e){if(!r){r=!0,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof Ww?t:new wx(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,a(new Ww(`timeout ${t} of ms exceeded`,Ww.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(a):e.removeEventListener("abort",a)}),e=null)};e.forEach(e=>e.addEventListener("abort",a));const{signal:s}=n;return s.unsubscribe=()=>Bw.asap(i),s}},Dx=function*(e,t){let r=e.byteLength;if(r<t)return void(yield e);let n,a=0;for(;a<r;)n=a+t,yield e.slice(a,n),a=n},Ix=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},Ux=(e,t,r,n)=>{const a=async function*(e,t){for await(const r of Ix(e))yield*Dx(r,t)}(e,t);let o,i=0,s=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await a.next();if(t)return s(),void e.close();let o=n.byteLength;if(r){let e=i+=o;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw s(e),e}},cancel:e=>(s(e),a.return())},{highWaterMark:2})},{isFunction:Mx}=Bw,Lx=(({Request:e,Response:t})=>({Request:e,Response:t}))(Bw.global),{ReadableStream:Fx,TextEncoder:zx}=Bw.global,jx=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Bx=e=>{e=Bw.merge.call({skipUndefined:!0},Lx,e);const{fetch:t,Request:r,Response:n}=e,a=t?Mx(t):"function"==typeof fetch,o=Mx(r),i=Mx(n);if(!a)return!1;const s=a&&Mx(Fx),c=a&&("function"==typeof zx?(l=new zx,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const d=o&&s&&jx(()=>{let e=!1;const t=new r(lx.origin,{body:new Fx,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=i&&s&&jx(()=>Bw.isReadableStream(new n("").body)),f={stream:u&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!f[e]&&(f[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new Ww(`Response type '${e}' is not supported`,Ww.ERR_NOT_SUPPORT,r)})});const p=async(e,t)=>{const n=Bw.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(Bw.isBlob(e))return e.size;if(Bw.isSpecCompliantForm(e)){const t=new r(lx.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Bw.isArrayBufferView(e)||Bw.isArrayBuffer(e)?e.byteLength:(Bw.isURLSearchParams(e)&&(e+=""),Bw.isString(e)?(await c(e)).byteLength:void 0)})(t):n};return async e=>{let{url:a,method:i,data:s,signal:c,cancelToken:l,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:v,headers:b,withCredentials:y="same-origin",fetchOptions:w}=Rx(e),x=t||fetch;v=v?(v+"").toLowerCase():"text";let S=Ox([c,l&&l.toAbortSignal()],m),k=null;const A=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let E;try{if(g&&d&&"get"!==i&&"head"!==i&&0!==(E=await p(b,s))){let e,t=new r(a,{method:"POST",body:s,duplex:"half"});if(Bw.isFormData(s)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,r]=kx(E,Sx(Ax(g)));s=Ux(t.body,65536,e,r)}}Bw.isString(y)||(y=y?"include":"omit");const t=o&&"credentials"in r.prototype,c={...w,signal:S,method:i.toUpperCase(),headers:b.normalize().toJSON(),body:s,duplex:"half",credentials:t?y:void 0};k=o&&new r(a,c);let l=await(o?x(k,w):x(a,c));const m=u&&("stream"===v||"response"===v);if(u&&(h||m&&A)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=Bw.toFiniteNumber(l.headers.get("content-length")),[r,a]=h&&kx(t,Sx(Ax(h),!0))||[];l=new n(Ux(l.body,65536,r,()=>{a&&a(),A&&A()}),e)}v=v||"text";let C=await f[Bw.findKey(f,v)||"text"](l,e);return!m&&A&&A(),await new Promise((t,r)=>{xx(t,r,{data:C,headers:vx.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:k})})}catch(t){if(A&&A(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Ww("Network Error",Ww.ERR_NETWORK,e,k),{cause:t.cause||t});throw Ww.from(t,t&&t.code,e,k)}}},Wx=new Map,Vx=e=>{let t=e?e.env:{};const{fetch:r,Request:n,Response:a}=t,o=[n,a,r];let i,s,c=o.length,l=Wx;for(;c--;)i=o[c],s=l.get(i),void 0===s&&l.set(i,s=c?new Map:Bx(t)),l=s;return s};Vx();const $x={http:null,xhr:Px,fetch:{get:Vx}};Bw.forEach($x,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Gx=e=>`- ${e}`,Kx=e=>Bw.isFunction(e)||null===e||!1===e;var Hx=(e,t)=>{e=Bw.isArray(e)?e:[e];const{length:r}=e;let n,a;const o={};for(let i=0;i<r;i++){let r;if(n=e[i],a=n,!Kx(n)&&(a=$x[(r=String(n)).toLowerCase()],void 0===a))throw new Ww(`Unknown adapter '${r}'`);if(a&&(Bw.isFunction(a)||(a=a.get(t))))break;o[r||"#"+i]=a}if(!a){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new Ww("There is no suitable adapter to dispatch the request "+(r?e.length>1?"since :\n"+e.map(Gx).join("\n"):" "+Gx(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return a};function Zx(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new wx(null,e)}function qx(e){Zx(e),e.headers=vx.from(e.headers),e.data=bx.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Hx(e.adapter||ux.adapter,e)(e).then(function(t){return Zx(e),t.data=bx.call(e,e.transformResponse,t),t.headers=vx.from(t.headers),t},function(t){return yx(t)||(Zx(e),t&&t.response&&(t.response.data=bx.call(e,e.transformResponse,t.response),t.response.headers=vx.from(t.response.headers))),Promise.reject(t)})}const Jx="1.12.2",Yx={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Yx[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Xx={};Yx.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Jx+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,a,o)=>{if(!1===e)throw new Ww(n(a," has been removed"+(t?" in "+t:"")),Ww.ERR_DEPRECATED);return t&&!Xx[a]&&(Xx[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,a,o)}},Yx.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var Qx={assertOptions:function(e,t,r){if("object"!=typeof e)throw new Ww("options must be an object",Ww.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const o=n[a],i=t[o];if(i){const t=e[o],r=void 0===t||i(t,o,e);if(!0!==r)throw new Ww("option "+o+" must be "+r,Ww.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new Ww("Unknown option "+o,Ww.ERR_BAD_OPTION)}},validators:Yx};const eS=Qx.validators;let tS=class{constructor(e){this.defaults=e||{},this.interceptors={request:new tx,response:new tx}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=_x(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:a}=t;void 0!==r&&Qx.assertOptions(r,{silentJSONParsing:eS.transitional(eS.boolean),forcedJSONParsing:eS.transitional(eS.boolean),clarifyTimeoutError:eS.transitional(eS.boolean)},!1),null!=n&&(Bw.isFunction(n)?t.paramsSerializer={serialize:n}:Qx.assertOptions(n,{encode:eS.function,serialize:eS.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Qx.assertOptions(t,{baseUrl:eS.spelling("baseURL"),withXsrfToken:eS.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=a&&Bw.merge(a.common,a[t.method]);a&&Bw.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=vx.concat(o,a);const i=[];let s=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let d,u=0;if(!s){const e=[qx.bind(this),void 0];for(e.unshift(...i),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=i.length;let f=t;for(;u<d;){const e=i[u++],t=i[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=qx.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return ex(Tx((e=_x(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};Bw.forEach(["delete","get","head","options"],function(e){tS.prototype[e]=function(t,r){return this.request(_x(r||{},{method:e,url:t,data:(r||{}).data}))}}),Bw.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,a){return this.request(_x(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}tS.prototype[e]=t(),tS.prototype[e+"Form"]=t(!0)});const rS={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(rS).forEach(([e,t])=>{rS[t]=e});const nS=function e(t){const r=new tS(t),n=Yy(tS.prototype.request,r);return Bw.extend(n,tS.prototype,r,{allOwnKeys:!0}),Bw.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(_x(t,r))},n}(ux);nS.Axios=tS,nS.CanceledError=wx,nS.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,a){r.reason||(r.reason=new wx(e,n,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},nS.isCancel=yx,nS.VERSION=Jx,nS.toFormData=qw,nS.AxiosError=Ww,nS.Cancel=nS.CanceledError,nS.all=function(e){return Promise.all(e)},nS.spread=function(e){return function(t){return e.apply(null,t)}},nS.isAxiosError=function(e){return Bw.isObject(e)&&!0===e.isAxiosError},nS.mergeConfig=_x,nS.AxiosHeaders=vx,nS.formToJSON=e=>dx(Bw.isHTMLForm(e)?new FormData(e):e),nS.getAdapter=Hx,nS.HttpStatusCode=rS,nS.default=nS;const{Axios:aS,AxiosError:oS,CanceledError:iS,isCancel:sS,CancelToken:cS,VERSION:lS,all:dS,Cancel:uS,isAxiosError:fS,spread:pS,toFormData:mS,AxiosHeaders:hS,HttpStatusCode:gS,formToJSON:vS,getAdapter:bS,mergeConfig:yS}=nS;const wS=new class{constructor(e={}){this.client=nS.create({baseURL:e.baseURL||"https://api.example.com",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json",...e.headers}}),this.client.interceptors.request.use(e=>{const t=L();return t&&(e.headers["x-session-id"]=t),e},e=>Promise.reject(e))}async get(e,t){const r=await this.client.get(e,t);return{data:r.data,status:r.status,statusText:r.statusText,headers:r.headers}}async post(e,t,r){const n=await this.client.post(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}async put(e,t,r){const n=await this.client.put(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}async delete(e,t){const r=await this.client.delete(e,t);return{data:r.data,status:r.status,statusText:r.statusText,headers:r.headers}}async patch(e,t,r){const n=await this.client.patch(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}setBaseURL(e){this.client.defaults.baseURL=e}setHeader(e,t){this.client.defaults.headers.common[e]=t}removeHeader(e){delete this.client.defaults.headers.common[e]}};function xS(){const e=ye(),t=be(e=>e.auth),r=be(e=>e.os),{serverUrl:n,orgId:a,auth:o}=r,{resetCurrentWorkspace:i,currentWorkspace:s}=jy(),d=l(async()=>{e.auth(E());try{const t=await wS.post(`${n}/api/v1/auth/request`,{orgId:a,clientId:o?.clientId,redirect:{success:o?.redirectUrl||window.location.href,error:o?.redirectUrl||window.location.href}});if(!t.data.success)throw e.auth(C()),new Error(t.data.message||"Authentication failed");window.location.href=t.data.data.redirectUrl}catch(t){throw e.auth(C()),S(t,{component:"useSaaSAuth",action:"signIn"}),t}},[n,a,o,e]),u=l(async()=>{try{o?.callbacks?.onSignOut&&"function"==typeof o.callbacks.onSignOut&&await o.callbacks.onSignOut(),e.auth(N()),i(),M()}catch(e){S(e,{component:"useSaaSAuth",action:"signOut"}),M()}},[e,i,o?.callbacks?.onSignOut]),f=l(e=>{s?By.openWorkspaceSettings(e):S(new Error("Cannot open settings: No current workspace"),{component:"useSaaSAuth",action:"openWorkspaceSettings"})},[s]);return c(()=>({user:t.session?.user,session:t.session,isLoading:t.isLoading,isAuthenticated:t.isAuthenticated,isRedirecting:t.isRedirecting,status:t.status,signIn:d,signOut:u,openWorkspaceSettings:f}),[t,d,u,f])}const SS=e=>{const{children:t}=e,{status:r}=xS();return r!==R.authenticated?null:t},kS=e=>{const{children:t}=e,{status:r}=xS();return r===R.authenticated?null:t},AS=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=xS();return n.includes(a?.role??"")?t:r||null},ES=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=xS(),{currentWorkspace:o}=jy(),i=o?.users.find(e=>e._id===a?.id);return i&&n.includes(i?.role??"")?t:r||null};function CS(){const e=g(Ee);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e}function TS(){const e=g(Ee);if(void 0===e)throw new Error("useUserFeatures must be used within a UserProvider");return{features:e.features,isLoading:e.isLoading,error:e.error,refreshFeatures:e.refreshFeatures,isFeatureEnabled:t=>Boolean(e.features[t])}}const NS=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=jy(),a=n?.features?.[r];return a?t:null},_S=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=jy(),a=n?.features?.[r];return a?null:t},RS=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=TS();return n(r)?t:null},PS=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=TS();return n(r)?null:t};export{y as ApiVersion,Zy as BetaForm,A as ErrorBoundary,w as SDKError,A as SDKErrorBoundary,$y as SaaSOSProvider,SS as WhenAuthenticated,AS as WhenRoles,kS as WhenUnauthenticated,PS as WhenUserFeatureDisabled,RS as WhenUserFeatureEnabled,_S as WhenWorkspaceFeatureDisabled,NS as WhenWorkspaceFeatureEnabled,ES as WhenWorkspaceRoles,Ly as WorkspaceSwitcher,k as createSDKError,x as errorHandler,Se as eventEmitter,S as handleError,xS as useSaaSAuth,gp as useSaaSSettings,jy as useSaaSWorkspaces,CS as useUserAttributes,TS as useUserFeatures};
35
+ */function hs(){return fs||(fs=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=a,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=t.useState,o=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue,c=!1,l=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(a,d){c||void 0===t.startTransition||(c=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var u=d();if(!l){var f=d();r(u,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var p=(f=n({inst:{value:u,getSnapshot:d}}))[0].inst,m=f[1];return i(function(){p.value=u,p.getSnapshot=d,e(p)&&m({inst:p})},[a,u,d]),o(function(){return e(p)&&m({inst:p}),a(function(){e(p)&&m({inst:p})})},[a]),s(u),u};ms.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ms}function gs(){return ps||(ps=1,"production"===process.env.NODE_ENV?ls.exports=us():ls.exports=hs()),ls.exports}var vs=gs();function ys(){return()=>{}}var bs="Avatar",[ws]=function(e,r=[]){let a=[];const o=()=>{const t=a.map(e=>n.createContext(e));return function(r){const a=r?.[e]||t;return n.useMemo(()=>({[`__scope${e}`]:{...r,[e]:a}}),[r,a])}};return o.scopeName=e,[function(r,o){const i=n.createContext(o);i.displayName=r+"Context";const s=a.length;a=[...a,o];const c=r=>{const{scope:a,children:o,...c}=r,l=a?.[e]?.[s]||i,d=n.useMemo(()=>c,Object.values(c));return t(l.Provider,{value:d,children:o})};return c.displayName=r+"Provider",[c,function(t,a){const c=a?.[e]?.[s]||i,l=n.useContext(c);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${r}\``)}]},Hi(o,...r)]}(bs),[Ss,xs]=ws(bs),ks=n.forwardRef((e,r)=>{const{__scopeAvatar:a,...o}=e,[i,s]=n.useState("idle");return t(Ss,{scope:a,imageLoadingStatus:i,onImageLoadingStatusChange:s,children:t(cs.span,{...o,ref:r})})});ks.displayName=bs;var As="AvatarImage",Es=n.forwardRef((e,r)=>{const{__scopeAvatar:a,src:o,onLoadingStatusChange:i=()=>{},...s}=e,c=xs(As,a),l=function(e,{referrerPolicy:t,crossOrigin:r}){const a=vs.useSyncExternalStore(ys,()=>!0,()=>!1),o=n.useRef(null),i=a?(o.current||(o.current=new window.Image),o.current):null,[s,c]=n.useState(()=>_s(i,e));return Ji(()=>{c(_s(i,e))},[i,e]),Ji(()=>{const e=e=>()=>{c(e)};if(!i)return;const n=e("loaded"),a=e("error");return i.addEventListener("load",n),i.addEventListener("error",a),t&&(i.referrerPolicy=t),"string"==typeof r&&(i.crossOrigin=r),()=>{i.removeEventListener("load",n),i.removeEventListener("error",a)}},[i,r,t]),s}(o,s),d=Zi(e=>{i(e),c.onImageLoadingStatusChange(e)});return Ji(()=>{"idle"!==l&&d(l)},[l,d]),"loaded"===l?t(cs.img,{...s,ref:r,src:o}):null});Es.displayName=As;var Cs="AvatarFallback",Ts=n.forwardRef((e,r)=>{const{__scopeAvatar:a,delayMs:o,...i}=e,s=xs(Cs,a),[c,l]=n.useState(void 0===o);return n.useEffect(()=>{if(void 0!==o){const e=window.setTimeout(()=>l(!0),o);return()=>window.clearTimeout(e)}},[o]),c&&"loaded"!==s.imageLoadingStatus?t(cs.span,{...i,ref:r}):null});function _s(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}Ts.displayName=Cs;var Ns=ks,Rs=Es,Os=Ts;function Ps(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=Ps(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Ds(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=Ps(e))&&(n&&(n+=" "),n+=t);return n}const Is=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Us="-",Ms=[],zs=e=>{const t=js(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return Fs(e);const r=e.split(Us),n=""===r[0]&&r.length>1?1:0;return Ls(r,n,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=n[e],a=r[e];return t?a?((e,t)=>{const r=new Array(e.length+t.length);for(let t=0;t<e.length;t++)r[t]=e[t];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r})(a,t):t:a||Ms}return r[e]||Ms}}},Ls=(e,t,r)=>{if(0===e.length-t)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const r=Ls(e,t+1,a);if(r)return r}const o=r.validators;if(null===o)return;const i=0===t?e.join(Us):e.slice(t).join(Us),s=o.length;for(let e=0;e<s;e++){const t=o[e];if(t.validator(i))return t.classGroupId}},Fs=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?"arbitrary.."+n:void 0})(),js=e=>{const{theme:t,classGroups:r}=e;return $s(r,t)},$s=(e,t)=>{const r=Is();for(const n in e){const a=e[n];Bs(a,r,n,t)}return r},Bs=(e,t,r,n)=>{const a=e.length;for(let o=0;o<a;o++){const a=e[o];Ws(a,t,r,n)}},Ws=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?Ks(e,t,r,n):Gs(e,t,r,n):Vs(e,t,r)},Vs=(e,t,r)=>{(""===e?t:Hs(t,e)).classGroupId=r},Gs=(e,t,r,n)=>{Zs(e)?Bs(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},Ks=(e,t,r,n)=>{const a=Object.entries(e),o=a.length;for(let e=0;e<o;e++){const[o,i]=a[e];Bs(i,Hs(t,o),r,n)}},Hs=(e,t)=>{let r=e;const n=t.split(Us),a=n.length;for(let e=0;e<a;e++){const t=n[e];let a=r.nextPart.get(t);a||(a=Is(),r.nextPart.set(t,a)),r=a}return r},Zs=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,Js=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(a,o)=>{r[a]=o,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(a(e,t),t):void 0},set(e,t){e in r?r[e]=t:a(e,t)}}},qs=[],Ys=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),Xs=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=e=>{const t=[];let r,n=0,a=0,o=0;const i=e.length;for(let s=0;s<i;s++){const i=e[s];if(0===n&&0===a){if(":"===i){t.push(e.slice(o,s)),o=s+1;continue}if("/"===i){r=s;continue}}"["===i?n++:"]"===i?n--:"("===i?a++:")"===i&&a--}const s=0===t.length?e:e.slice(o);let c=s,l=!1;s.endsWith("!")?(c=s.slice(0,-1),l=!0):s.startsWith("!")&&(c=s.slice(1),l=!0);return Ys(t,l,c,r&&r>o?r-o:void 0)};if(t){const e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):Ys(qs,!1,t,void 0,!0)}if(r){const e=n;n=t=>r({className:t,parseClassName:e})}return n},Qs=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((e,r)=>{t.set(e,1e6+r)}),e=>{const r=[];let n=[];for(let a=0;a<e.length;a++){const o=e[a],i="["===o[0],s=t.has(o);i||s?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(o)):n.push(o)}return n.length>0&&(n.sort(),r.push(...n)),r}},ec=/\s+/,tc=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=tc(e[n]))&&(r&&(r+=" "),r+=t);return r},rc=(e,...t)=>{let r,n,a,o;const i=e=>{const t=n(e);if(t)return t;const o=((e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:o}=t,i=[],s=e.trim().split(ec);let c="";for(let e=s.length-1;e>=0;e-=1){const t=s[e],{isExternal:l,modifiers:d,hasImportantModifier:u,baseClassName:f,maybePostfixModifierPosition:p}=r(t);if(l){c=t+(c.length>0?" "+c:c);continue}let m=!!p,h=n(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?" "+c:c);continue}if(h=n(f),!h){c=t+(c.length>0?" "+c:c);continue}m=!1}const g=0===d.length?"":1===d.length?d[0]:o(d).join(":"),v=u?g+"!":g,y=v+h;if(i.indexOf(y)>-1)continue;i.push(y);const b=a(h,m);for(let e=0;e<b.length;++e){const t=b[e];i.push(v+t)}c=t+(c.length>0?" "+c:c)}return c})(e,r);return a(e,o),o};return o=s=>{const c=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:Js(e.cacheSize),parseClassName:Xs(e),sortModifiers:Qs(e),...zs(e)}))(c),n=r.cache.get,a=r.cache.set,o=i,i(s)},(...e)=>o(((...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=tc(t))&&(a&&(a+=" "),a+=r);return a})(...e))},nc=[],ac=e=>{const t=t=>t[e]||nc;return t.isThemeGetter=!0,t},oc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ic=/^\((?:(\w[\w-]*):)?(.+)\)$/i,sc=/^\d+\/\d+$/,cc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,dc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,uc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,pc=e=>sc.test(e),mc=e=>!!e&&!Number.isNaN(Number(e)),hc=e=>!!e&&Number.isInteger(Number(e)),gc=e=>e.endsWith("%")&&mc(e.slice(0,-1)),vc=e=>cc.test(e),yc=()=>!0,bc=e=>lc.test(e)&&!dc.test(e),wc=()=>!1,Sc=e=>uc.test(e),xc=e=>fc.test(e),kc=e=>!Ec(e)&&!Oc(e),Ac=e=>Lc(e,Bc,wc),Ec=e=>oc.test(e),Cc=e=>Lc(e,Wc,bc),Tc=e=>Lc(e,Vc,mc),_c=e=>Lc(e,jc,wc),Nc=e=>Lc(e,$c,xc),Rc=e=>Lc(e,Kc,Sc),Oc=e=>ic.test(e),Pc=e=>Fc(e,Wc),Dc=e=>Fc(e,Gc),Ic=e=>Fc(e,jc),Uc=e=>Fc(e,Bc),Mc=e=>Fc(e,$c),zc=e=>Fc(e,Kc,!0),Lc=(e,t,r)=>{const n=oc.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},Fc=(e,t,r=!1)=>{const n=ic.exec(e);return!!n&&(n[1]?t(n[1]):r)},jc=e=>"position"===e||"percentage"===e,$c=e=>"image"===e||"url"===e,Bc=e=>"length"===e||"size"===e||"bg-size"===e,Wc=e=>"length"===e,Vc=e=>"number"===e,Gc=e=>"family-name"===e,Kc=e=>"shadow"===e,Hc=rc(()=>{const e=ac("color"),t=ac("font"),r=ac("text"),n=ac("font-weight"),a=ac("tracking"),o=ac("leading"),i=ac("breakpoint"),s=ac("container"),c=ac("spacing"),l=ac("radius"),d=ac("shadow"),u=ac("inset-shadow"),f=ac("text-shadow"),p=ac("drop-shadow"),m=ac("blur"),h=ac("perspective"),g=ac("aspect"),v=ac("ease"),y=ac("animate"),b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Oc,Ec],w=()=>[Oc,Ec,c],S=()=>[pc,"full","auto",...w()],x=()=>[hc,"none","subgrid",Oc,Ec],k=()=>["auto",{span:["full",hc,Oc,Ec]},hc,Oc,Ec],A=()=>[hc,"auto",Oc,Ec],E=()=>["auto","min","max","fr",Oc,Ec],C=()=>["auto",...w()],T=()=>[pc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],_=()=>[e,Oc,Ec],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Ic,_c,{position:[Oc,Ec]}],R=()=>["auto","cover","contain",Uc,Ac,{size:[Oc,Ec]}],O=()=>[gc,Pc,Cc],P=()=>["","none","full",l,Oc,Ec],D=()=>["",mc,Pc,Cc],I=()=>[mc,gc,Ic,_c],U=()=>["","none",m,Oc,Ec],M=()=>["none",mc,Oc,Ec],z=()=>["none",mc,Oc,Ec],L=()=>[mc,Oc,Ec],F=()=>[pc,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[vc],breakpoint:[vc],color:[yc],container:[vc],"drop-shadow":[vc],ease:["in","out","in-out"],font:[kc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[vc],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[vc],shadow:[vc],spacing:["px",mc],text:[vc],"text-shadow":[vc],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",pc,Ec,Oc,g]}],container:["container"],columns:[{columns:[mc,Ec,Oc,s]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:b()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:S()}],"inset-x":[{"inset-x":S()}],"inset-y":[{"inset-y":S()}],start:[{start:S()}],end:[{end:S()}],top:[{top:S()}],right:[{right:S()}],bottom:[{bottom:S()}],left:[{left:S()}],visibility:["visible","invisible","collapse"],z:[{z:[hc,"auto",Oc,Ec]}],basis:[{basis:[pc,"full","auto",s,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[mc,pc,"auto","initial","none",Ec]}],grow:[{grow:["",mc,Oc,Ec]}],shrink:[{shrink:["",mc,Oc,Ec]}],order:[{order:[hc,"first","last","none",Oc,Ec]}],"grid-cols":[{"grid-cols":x()}],"col-start-end":[{col:k()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":x()}],"row-start-end":[{row:k()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:T()}],w:[{w:[s,"screen",...T()]}],"min-w":[{"min-w":[s,"screen","none",...T()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...T()]}],h:[{h:["screen","lh",...T()]}],"min-h":[{"min-h":["screen","lh","none",...T()]}],"max-h":[{"max-h":["screen","lh",...T()]}],"font-size":[{text:["base",r,Pc,Cc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Oc,Tc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",gc,Ec]}],"font-family":[{font:[Dc,Ec,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,Oc,Ec]}],"line-clamp":[{"line-clamp":[mc,"none",Oc,Tc]}],leading:[{leading:[o,...w()]}],"list-image":[{"list-image":["none",Oc,Ec]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Oc,Ec]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[mc,"from-font","auto",Oc,Cc]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[mc,"auto",Oc,Ec]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Oc,Ec]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Oc,Ec]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:N()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},hc,Oc,Ec],radial:["",Oc,Ec],conic:[hc,Oc,Ec]},Mc,Nc]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:O()}],"gradient-via-pos":[{via:O()}],"gradient-to-pos":[{to:O()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:D()}],"border-w-x":[{"border-x":D()}],"border-w-y":[{"border-y":D()}],"border-w-s":[{"border-s":D()}],"border-w-e":[{"border-e":D()}],"border-w-t":[{"border-t":D()}],"border-w-r":[{"border-r":D()}],"border-w-b":[{"border-b":D()}],"border-w-l":[{"border-l":D()}],"divide-x":[{"divide-x":D()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":D()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[mc,Oc,Ec]}],"outline-w":[{outline:["",mc,Pc,Cc]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",d,zc,Rc]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",u,zc,Rc]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[mc,Cc]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":D()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",f,zc,Rc]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[mc,Oc,Ec]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[mc]}],"mask-image-linear-from-pos":[{"mask-linear-from":I()}],"mask-image-linear-to-pos":[{"mask-linear-to":I()}],"mask-image-linear-from-color":[{"mask-linear-from":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"mask-image-t-from-pos":[{"mask-t-from":I()}],"mask-image-t-to-pos":[{"mask-t-to":I()}],"mask-image-t-from-color":[{"mask-t-from":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"mask-image-r-from-pos":[{"mask-r-from":I()}],"mask-image-r-to-pos":[{"mask-r-to":I()}],"mask-image-r-from-color":[{"mask-r-from":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"mask-image-b-from-pos":[{"mask-b-from":I()}],"mask-image-b-to-pos":[{"mask-b-to":I()}],"mask-image-b-from-color":[{"mask-b-from":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"mask-image-l-from-pos":[{"mask-l-from":I()}],"mask-image-l-to-pos":[{"mask-l-to":I()}],"mask-image-l-from-color":[{"mask-l-from":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"mask-image-x-from-pos":[{"mask-x-from":I()}],"mask-image-x-to-pos":[{"mask-x-to":I()}],"mask-image-x-from-color":[{"mask-x-from":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"mask-image-y-from-pos":[{"mask-y-from":I()}],"mask-image-y-to-pos":[{"mask-y-to":I()}],"mask-image-y-from-color":[{"mask-y-from":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[Oc,Ec]}],"mask-image-radial-from-pos":[{"mask-radial-from":I()}],"mask-image-radial-to-pos":[{"mask-radial-to":I()}],"mask-image-radial-from-color":[{"mask-radial-from":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[mc]}],"mask-image-conic-from-pos":[{"mask-conic-from":I()}],"mask-image-conic-to-pos":[{"mask-conic-to":I()}],"mask-image-conic-from-color":[{"mask-conic-from":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:N()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Oc,Ec]}],filter:[{filter:["","none",Oc,Ec]}],blur:[{blur:U()}],brightness:[{brightness:[mc,Oc,Ec]}],contrast:[{contrast:[mc,Oc,Ec]}],"drop-shadow":[{"drop-shadow":["","none",p,zc,Rc]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",mc,Oc,Ec]}],"hue-rotate":[{"hue-rotate":[mc,Oc,Ec]}],invert:[{invert:["",mc,Oc,Ec]}],saturate:[{saturate:[mc,Oc,Ec]}],sepia:[{sepia:["",mc,Oc,Ec]}],"backdrop-filter":[{"backdrop-filter":["","none",Oc,Ec]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[mc,Oc,Ec]}],"backdrop-contrast":[{"backdrop-contrast":[mc,Oc,Ec]}],"backdrop-grayscale":[{"backdrop-grayscale":["",mc,Oc,Ec]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[mc,Oc,Ec]}],"backdrop-invert":[{"backdrop-invert":["",mc,Oc,Ec]}],"backdrop-opacity":[{"backdrop-opacity":[mc,Oc,Ec]}],"backdrop-saturate":[{"backdrop-saturate":[mc,Oc,Ec]}],"backdrop-sepia":[{"backdrop-sepia":["",mc,Oc,Ec]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Oc,Ec]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[mc,"initial",Oc,Ec]}],ease:[{ease:["linear","initial",v,Oc,Ec]}],delay:[{delay:[mc,Oc,Ec]}],animate:[{animate:["none",y,Oc,Ec]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,Oc,Ec]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:M()}],"rotate-x":[{"rotate-x":M()}],"rotate-y":[{"rotate-y":M()}],"rotate-z":[{"rotate-z":M()}],scale:[{scale:z()}],"scale-x":[{"scale-x":z()}],"scale-y":[{"scale-y":z()}],"scale-z":[{"scale-z":z()}],"scale-3d":["scale-3d"],skew:[{skew:L()}],"skew-x":[{"skew-x":L()}],"skew-y":[{"skew-y":L()}],transform:[{transform:[Oc,Ec,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:F()}],"translate-x":[{"translate-x":F()}],"translate-y":[{"translate-y":F()}],"translate-z":[{"translate-z":F()}],"translate-none":["translate-none"],accent:[{accent:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Oc,Ec]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Oc,Ec]}],fill:[{fill:["none",..._()]}],"stroke-w":[{stroke:[mc,Pc,Cc,Tc]}],stroke:[{stroke:["none",..._()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Zc(...e){return Hc(Ds(e))}const Jc=n.forwardRef(({className:e,...r},n)=>t(Ns,{ref:n,className:Zc("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...r}));Jc.displayName=Ns.displayName;const qc=n.forwardRef(({className:e,...r},n)=>t(Rs,{ref:n,className:Zc("aspect-square h-full w-full",e),...r}));qc.displayName=Rs.displayName;const Yc=n.forwardRef(({className:e,...r},n)=>t(Os,{ref:n,className:Zc("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...r}));Yc.displayName=Os.displayName;const Xc=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,Qc=Ds,el=(e,t)=>r=>{var n;if(null==(null==t?void 0:t.variants))return Qc(e,null==r?void 0:r.class,null==r?void 0:r.className);const{variants:a,defaultVariants:o}=t,i=Object.keys(a).map(e=>{const t=null==r?void 0:r[e],n=null==o?void 0:o[e];if(null===t)return null;const i=Xc(t)||Xc(n);return a[e][i]}),s=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{}),c=null==t||null===(n=t.compoundVariants)||void 0===n?void 0:n.reduce((e,t)=>{let{class:r,className:n,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...s}[t]):{...o,...s}[t]===r})?[...e,r,n]:e},[]);return Qc(e,i,c,null==r?void 0:r.class,null==r?void 0:r.className)},tl=el("inline-flex items-center justify-center rounded-full font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input 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:"underline-offset-4 hover:underline text-primary"},withIcon:{true:"flex"},fullWidth:{true:"w-full"},size:{default:"h-9 py-2 px-4 text-sm",sm:"h-8 px-3 text-xs",lg:"h-10 px-6 text-base",icon:"h-9 w-9"}},compoundVariants:[{size:"lg",withIcon:!0,className:"gap-x-1.5"},{size:"default",withIcon:!0,className:"gap-x-1"},{size:"sm",withIcon:!0,className:"gap-x-0.5"}],defaultVariants:{variant:"default",size:"default"}}),rl=n.forwardRef(({className:r,variant:a,progress:o,size:i,startIcon:s,endIcon:c,asChild:l=!1,...d},u)=>{const f=l?ns:"button",p=function(e){switch(e){case"lg":return 20;case"sm":return 14;default:return 16}}(i);return e(f,{disabled:o||d.disabled,className:Zc(tl({variant:a,size:i,withIcon:null!=o||null!=s||null!=c,className:r})),ref:u,...d,children:[o&&t(wo,{size:p,className:"animate-spin"}),s&&n.cloneElement(s,{size:p}),d.children,c&&n.cloneElement(c,{size:p})]})});function nl(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function al(e,r=[]){let a=[];const o=()=>{const t=a.map(e=>n.createContext(e));return function(r){const a=r?.[e]||t;return n.useMemo(()=>({[`__scope${e}`]:{...r,[e]:a}}),[r,a])}};return o.scopeName=e,[function(r,o){const i=n.createContext(o),s=a.length;a=[...a,o];const c=r=>{const{scope:a,children:o,...c}=r,l=a?.[e]?.[s]||i,d=n.useMemo(()=>c,Object.values(c));return t(l.Provider,{value:d,children:o})};return c.displayName=r+"Provider",[c,function(t,a){const c=a?.[e]?.[s]||i,l=n.useContext(c);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${r}\``)}]},ol(o,...r)]}function ol(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const a=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return n.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}rl.displayName="Button";var il=n[" useId ".trim().toString()]||(()=>{}),sl=0;function cl(e){const[t,r]=n.useState(il());return Ji(()=>{r(e=>e??String(sl++))},[e]),e||(t?`radix-${t}`:"")}var ll=n[" useInsertionEffect ".trim().toString()]||Ji;function dl({prop:e,defaultProp:t,onChange:r=()=>{},caller:a}){const[o,i,s]=function({defaultProp:e,onChange:t}){const[r,a]=n.useState(e),o=n.useRef(r),i=n.useRef(t);return ll(()=>{i.current=t},[t]),n.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,a,i]}({defaultProp:t,onChange:r}),c=void 0!==e,l=c?e:o;{const t=n.useRef(void 0!==e);n.useEffect(()=>{const e=t.current;if(e!==c){const t=e?"controlled":"uncontrolled",r=c?"controlled":"uncontrolled";console.warn(`${a} is changing from ${t} to ${r}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=c},[c,a])}const d=n.useCallback(t=>{if(c){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&s.current?.(r)}else i(t)},[c,e,i,s]);return[l,d]}function ul(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?Yi(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var fl=Symbol("radix.slottable");function pl(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===fl}var ml=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=function(e){const r=ul(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(pl);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{});var hl,gl="dismissableLayer.update",vl="dismissableLayer.pointerDownOutside",yl="dismissableLayer.focusOutside",bl=n.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),wl=n.forwardRef((e,r)=>{const{disableOutsidePointerEvents:a=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:c,onDismiss:l,...d}=e,u=n.useContext(bl),[f,p]=n.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=n.useState({}),g=Xi(r,e=>p(e)),v=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),w=f?v.indexOf(f):-1,S=u.layersWithOutsidePointerEventsDisabled.size>0,x=w>=b,k=function(e,t=globalThis?.document){const r=Zi(e),a=n.useRef(!1),o=n.useRef(()=>{});return n.useEffect(()=>{const e=e=>{if(e.target&&!a.current){let n=function(){xl(vl,r,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=n,t.addEventListener("click",o.current,{once:!0})):n()}else t.removeEventListener("click",o.current);a.current=!1},n=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(n),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>a.current=!0}}(e=>{const t=e.target,r=[...u.branches].some(e=>e.contains(t));x&&!r&&(i?.(e),c?.(e),e.defaultPrevented||l?.())},m),A=function(e,t=globalThis?.document){const r=Zi(e),a=n.useRef(!1);return n.useEffect(()=>{const e=e=>{if(e.target&&!a.current){xl(yl,r,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(s?.(e),c?.(e),e.defaultPrevented||l?.())},m);return function(e,t=globalThis?.document){const r=Zi(e);n.useEffect(()=>{const e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{w===u.layers.size-1&&(o?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},m),n.useEffect(()=>{if(f)return a&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(hl=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Sl(),()=>{a&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=hl)}},[f,m,a,u]),n.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Sl())},[f,u]),n.useEffect(()=>{const e=()=>h({});return document.addEventListener(gl,e),()=>document.removeEventListener(gl,e)},[]),t(ml.div,{...d,ref:g,style:{pointerEvents:S?x?"auto":"none":void 0,...e.style},onFocusCapture:nl(e.onFocusCapture,A.onFocusCapture),onBlurCapture:nl(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:nl(e.onPointerDownCapture,k.onPointerDownCapture)})});wl.displayName="DismissableLayer";function Sl(){const e=new CustomEvent(gl);document.dispatchEvent(e)}function xl(e,t,r,{discrete:n}){const a=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?function(e,t){e&&v.flushSync(()=>e.dispatchEvent(t))}(a,o):a.dispatchEvent(o)}n.forwardRef((e,r)=>{const a=n.useContext(bl),o=n.useRef(null),i=Xi(r,o);return n.useEffect(()=>{const e=o.current;if(e)return a.branches.add(e),()=>{a.branches.delete(e)}},[a.branches]),t(ml.div,{...e,ref:i})}).displayName="DismissableLayerBranch";var kl="focusScope.autoFocusOnMount",Al="focusScope.autoFocusOnUnmount",El={bubbles:!1,cancelable:!0},Cl=n.forwardRef((e,r)=>{const{loop:a=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...c}=e,[l,d]=n.useState(null),u=Zi(i),f=Zi(s),p=n.useRef(null),m=Xi(r,e=>d(e)),h=n.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;n.useEffect(()=>{if(o){let e=function(e){if(h.paused||!l)return;const t=e.target;l.contains(t)?p.current=t:Rl(p.current,{select:!0})},t=function(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||Rl(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Rl(l)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const n=new MutationObserver(r);return l&&n.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[o,l,h.paused]),n.useEffect(()=>{if(l){Ol.add(h);const t=document.activeElement;if(!l.contains(t)){const r=new CustomEvent(kl,El);l.addEventListener(kl,u),l.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Rl(n,{select:t}),document.activeElement!==r)return}((e=Tl(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&Rl(l))}return()=>{l.removeEventListener(kl,u),setTimeout(()=>{const e=new CustomEvent(Al,El);l.addEventListener(Al,f),l.dispatchEvent(e),e.defaultPrevented||Rl(t??document.body,{select:!0}),l.removeEventListener(Al,f),Ol.remove(h)},0)}}var e},[l,u,f,h]);const g=n.useCallback(e=>{if(!a&&!o)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){const t=e.currentTarget,[n,o]=function(e){const t=Tl(e),r=_l(t,e),n=_l(t.reverse(),e);return[r,n]}(t);n&&o?e.shiftKey||r!==o?e.shiftKey&&r===n&&(e.preventDefault(),a&&Rl(o,{select:!0})):(e.preventDefault(),a&&Rl(n,{select:!0})):r===t&&e.preventDefault()}},[a,o,h.paused]);return t(ml.div,{tabIndex:-1,...c,ref:m,onKeyDown:g})});function Tl(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function _l(e,t){for(const r of e)if(!Nl(r,{upTo:t}))return r}function Nl(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Rl(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}Cl.displayName="FocusScope";var Ol=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Pl(e,t),e.unshift(t)},remove(t){e=Pl(e,t),e[0]?.resume()}}}();function Pl(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var Dl=n.forwardRef((e,r)=>{const{container:a,...o}=e,[i,s]=n.useState(!1);Ji(()=>s(!0),[]);const c=a||i&&globalThis?.document?.body;return c?y.createPortal(t(ml.div,{...o,ref:r}),c):null});Dl.displayName="Portal";var Il=e=>{const{present:t,children:r}=e,a=function(e){const[t,r]=n.useState(),a=n.useRef(null),o=n.useRef(e),i=n.useRef("none"),s=e?"mounted":"unmounted",[c,l]=function(e,t){return n.useReducer((e,r)=>t[e][r]??e,e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return n.useEffect(()=>{const e=Ul(a.current);i.current="mounted"===c?e:"none"},[c]),Ji(()=>{const t=a.current,r=o.current;if(r!==e){const n=i.current,a=Ul(t);if(e)l("MOUNT");else if("none"===a||"none"===t?.display)l("UNMOUNT");else{l(r&&n!==a?"ANIMATION_OUT":"UNMOUNT")}o.current=e}},[e,l]),Ji(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,n=n=>{const i=Ul(a.current).includes(CSS.escape(n.animationName));if(n.target===t&&i&&(l("ANIMATION_END"),!o.current)){const n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},s=e=>{e.target===t&&(i.current=Ul(a.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",n),t.addEventListener("animationend",n),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",n),t.removeEventListener("animationend",n)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:n.useCallback(e=>{a.current=e?getComputedStyle(e):null,r(e)},[])}}(t),o="function"==typeof r?r({present:a.isPresent}):n.Children.only(r),i=Xi(a.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof r||a.isPresent?n.cloneElement(o,{ref:i}):null};function Ul(e){return e?.animationName||"none"}Il.displayName="Presence";var Ml=0;function zl(){n.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ll()),document.body.insertAdjacentElement("beforeend",e[1]??Ll()),Ml++,()=>{1===Ml&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Ml--}},[])}function Ll(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Fl=function(){return Fl=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Fl.apply(this,arguments)};function jl(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}"function"==typeof SuppressedError&&SuppressedError;var $l="right-scroll-bar-position",Bl="width-before-scroll-bar";function Wl(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var Vl="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,Gl=new WeakMap;function Kl(e,t){var r,n,a,o=(r=null,n=function(t){return e.forEach(function(e){return Wl(e,t)})},(a=u(function(){return{value:r,callback:n,facade:{get current(){return a.value},set current(e){var t=a.value;t!==e&&(a.value=e,a.callback(e,t))}}}})[0]).callback=n,a.facade);return Vl(function(){var t=Gl.get(o);if(t){var r=new Set(t),n=new Set(e),a=o.current;r.forEach(function(e){n.has(e)||Wl(e,null)}),n.forEach(function(e){r.has(e)||Wl(e,a)})}Gl.set(o,e)},[e]),o}function Hl(e){return e}var Zl=function(e){var t=e.sideCar,r=jl(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return n.createElement(a,Fl({},r))};Zl.isSideCarExport=!0;var Jl=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=Hl);var r=[],n=!1;return{read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(e){var a=t(e,n);return r.push(a),function(){r=r.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var a=r;r=[],a.forEach(e),t=r}var o=function(){var r=t;t=[],r.forEach(e)},i=function(){return Promise.resolve().then(o)};i(),r={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),r}}}}}(null);return t.options=Fl({async:!0,ssr:!1},e),t}(),ql=function(){},Yl=n.forwardRef(function(e,t){var r=n.useRef(null),a=n.useState({onScrollCapture:ql,onWheelCapture:ql,onTouchMoveCapture:ql}),o=a[0],i=a[1],s=e.forwardProps,c=e.children,l=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,v=e.allowPinchZoom,y=e.as,b=void 0===y?"div":y,w=e.gapMode,S=jl(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=p,k=Kl([r,t]),A=Fl(Fl({},S),o);return n.createElement(n.Fragment,null,u&&n.createElement(x,{sideCar:Jl,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:i,allowPinchZoom:!!v,lockRef:r,gapMode:w}),s?n.cloneElement(n.Children.only(c),Fl(Fl({},A),{ref:k})):n.createElement(b,Fl({},A,{className:l,ref:k}),c))});Yl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Yl.classNames={fullWidth:Bl,zeroRight:$l};function Xl(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var Ql=function(){var e=0,t=null;return{add:function(r){var n,a;0==e&&(t=Xl())&&(a=r,(n=t).styleSheet?n.styleSheet.cssText=a:n.appendChild(document.createTextNode(a)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ed=function(){var e,t=(e=Ql(),function(t,r){n.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])});return function(e){var r=e.styles,n=e.dynamic;return t(r,n),null}},td={left:0,top:0,right:0,gap:0},rd=function(e){return parseInt(e||"",10)||0},nd=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return td;var t=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[rd(r),rd(n),rd(a)]}(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},ad=ed(),od="data-scroll-locked",id=function(e,t,r,n){var a=e.left,o=e.top,i=e.right,s=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(s,"px ").concat(n,";\n }\n body[").concat(od,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat($l," {\n right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(Bl," {\n margin-right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat($l," .").concat($l," {\n right: 0 ").concat(n,";\n }\n \n .").concat(Bl," .").concat(Bl," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(od,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},sd=function(){var e=parseInt(document.body.getAttribute(od)||"0",10);return isFinite(e)?e:0},cd=function(e){var t=e.noRelative,r=e.noImportant,a=e.gapMode,o=void 0===a?"margin":a;n.useEffect(function(){return document.body.setAttribute(od,(sd()+1).toString()),function(){var e=sd()-1;e<=0?document.body.removeAttribute(od):document.body.setAttribute(od,e.toString())}},[]);var i=n.useMemo(function(){return nd(o)},[o]);return n.createElement(ad,{styles:id(i,!t,o,r?"":"!important")})},ld=!1;if("undefined"!=typeof window)try{var dd=Object.defineProperty({},"passive",{get:function(){return ld=!0,!0}});window.addEventListener("test",dd,dd),window.removeEventListener("test",dd,dd)}catch(e){ld=!1}var ud=!!ld&&{passive:!1},fd=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&!(r.overflowY===r.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===r[t])},pd=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),md(e,n)){var a=hd(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},md=function(e,t){return"v"===e?function(e){return fd(e,"overflowY")}(t):function(e){return fd(e,"overflowX")}(t)},hd=function(e,t){return"v"===e?function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]}(t):function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t)},gd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},vd=function(e){return[e.deltaX,e.deltaY]},yd=function(e){return e&&"current"in e?e.current:e},bd=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},wd=0,Sd=[];function xd(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var kd,Ad=(kd=function(e){var t=n.useRef([]),r=n.useRef([0,0]),a=n.useRef(),o=n.useState(wd++)[0],i=n.useState(ed)[0],s=n.useRef(e);n.useEffect(function(){s.current=e},[e]),n.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(yd),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=n.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var n,o=gd(e),i=r.current,c="deltaX"in e?e.deltaX:i[0]-o[0],l="deltaY"in e?e.deltaY:i[1]-o[1],d=e.target,u=Math.abs(c)>Math.abs(l)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===d||p.contains(d)))return!1;var m=pd(u,d);if(!m)return!0;if(m?n=u:(n="v"===u?"h":"v",m=pd(u,d)),!m)return!1;if(!a.current&&"changedTouches"in e&&(c||l)&&(a.current=n),!n)return!0;var h=a.current||n;return function(e,t,r,n){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),o=a*n,i=r.target,s=t.contains(i),c=!1,l=o>0,d=0,u=0;do{if(!i)break;var f=hd(e,i),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&md(e,i)&&(d+=m,u+=p);var h=i.parentNode;i=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!s&&i!==document.body||s&&(t.contains(i)||t===i));return(l&&Math.abs(d)<1||!l&&Math.abs(u)<1)&&(c=!0),c}(h,t,e,"h"===h?c:l)},[]),l=n.useCallback(function(e){var r=e;if(Sd.length&&Sd[Sd.length-1]===i){var n="deltaY"in r?vd(r):gd(r),a=t.current.filter(function(e){return e.name===r.type&&(e.target===r.target||r.target===e.shadowParent)&&(t=e.delta,a=n,t[0]===a[0]&&t[1]===a[1]);var t,a})[0];if(a&&a.should)r.cancelable&&r.preventDefault();else if(!a){var o=(s.current.shards||[]).map(yd).filter(Boolean).filter(function(e){return e.contains(r.target)});(o.length>0?c(r,o[0]):!s.current.noIsolation)&&r.cancelable&&r.preventDefault()}}},[]),d=n.useCallback(function(e,r,n,a){var o={name:e,delta:r,target:n,should:a,shadowParent:xd(n)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),u=n.useCallback(function(e){r.current=gd(e),a.current=void 0},[]),f=n.useCallback(function(t){d(t.type,vd(t),t.target,c(t,e.lockRef.current))},[]),p=n.useCallback(function(t){d(t.type,gd(t),t.target,c(t,e.lockRef.current))},[]);n.useEffect(function(){return Sd.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,ud),document.addEventListener("touchmove",l,ud),document.addEventListener("touchstart",u,ud),function(){Sd=Sd.filter(function(e){return e!==i}),document.removeEventListener("wheel",l,ud),document.removeEventListener("touchmove",l,ud),document.removeEventListener("touchstart",u,ud)}},[]);var m=e.removeScrollBar,h=e.inert;return n.createElement(n.Fragment,null,h?n.createElement(i,{styles:bd(o)}):null,m?n.createElement(cd,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},Jl.useMedium(kd),Zl),Ed=n.forwardRef(function(e,t){return n.createElement(Yl,Fl({},e,{ref:t,sideCar:Ad}))});Ed.classNames=Yl.classNames;var Cd=new WeakMap,Td=new WeakMap,_d={},Nd=0,Rd=function(e){return e&&(e.host||Rd(e.parentNode))},Od=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=Rd(t);return r&&e.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);_d[r]||(_d[r]=new WeakMap);var o=_d[r],i=[],s=new Set,c=new Set(a),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};a.forEach(l);var d=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,c=(Cd.get(e)||0)+1,l=(o.get(e)||0)+1;Cd.set(e,c),o.set(e,l),i.push(e),1===c&&a&&Td.set(e,!0),1===l&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),s.clear(),Nd++,function(){i.forEach(function(e){var t=Cd.get(e)-1,a=o.get(e)-1;Cd.set(e,t),o.set(e,a),t||(Td.has(e)||e.removeAttribute(n),Td.delete(e)),a||e.removeAttribute(r)}),--Nd||(Cd=new WeakMap,Cd=new WeakMap,Td=new WeakMap,_d={})}},Pd=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),Od(n,a,r,"aria-hidden")):function(){return null}};function Dd(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?Yi(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Id=Symbol("radix.slottable");function Ud(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Id}var Md="Dialog",[zd,Ld]=al(Md),[Fd,jd]=zd(Md),$d=e=>{const{__scopeDialog:r,children:a,open:o,defaultOpen:i,onOpenChange:s,modal:c=!0}=e,l=n.useRef(null),d=n.useRef(null),[u,f]=dl({prop:o,defaultProp:i??!1,onChange:s,caller:Md});return t(Fd,{scope:r,triggerRef:l,contentRef:d,contentId:cl(),titleId:cl(),descriptionId:cl(),open:u,onOpenChange:f,onOpenToggle:n.useCallback(()=>f(e=>!e),[f]),modal:c,children:a})};$d.displayName=Md;var Bd="DialogTrigger",Wd=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=jd(Bd,n),i=Xi(r,o.triggerRef);return t(ml.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":lu(o.open),...a,ref:i,onClick:nl(e.onClick,o.onOpenToggle)})});Wd.displayName=Bd;var Vd="DialogPortal",[Gd,Kd]=zd(Vd,{forceMount:void 0}),Hd=e=>{const{__scopeDialog:r,forceMount:a,children:o,container:i}=e,s=jd(Vd,r);return t(Gd,{scope:r,forceMount:a,children:n.Children.map(o,e=>t(Il,{present:a||s.open,children:t(Dl,{asChild:!0,container:i,children:e})}))})};Hd.displayName=Vd;var Zd="DialogOverlay",Jd=n.forwardRef((e,r)=>{const n=Kd(Zd,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,i=jd(Zd,e.__scopeDialog);return i.modal?t(Il,{present:a||i.open,children:t(Yd,{...o,ref:r})}):null});Jd.displayName=Zd;var qd=function(e){const r=Dd(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(Ud);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}("DialogOverlay.RemoveScroll"),Yd=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=jd(Zd,n);return t(Ed,{as:qd,allowPinchZoom:!0,shards:[o.contentRef],children:t(ml.div,{"data-state":lu(o.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),Xd="DialogContent",Qd=n.forwardRef((e,r)=>{const n=Kd(Xd,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,i=jd(Xd,e.__scopeDialog);return t(Il,{present:a||i.open,children:i.modal?t(eu,{...o,ref:r}):t(tu,{...o,ref:r})})});Qd.displayName=Xd;var eu=n.forwardRef((e,r)=>{const a=jd(Xd,e.__scopeDialog),o=n.useRef(null),i=Xi(r,a.contentRef,o);return n.useEffect(()=>{const e=o.current;if(e)return Pd(e)},[]),t(ru,{...e,ref:i,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:nl(e.onCloseAutoFocus,e=>{e.preventDefault(),a.triggerRef.current?.focus()}),onPointerDownOutside:nl(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:nl(e.onFocusOutside,e=>e.preventDefault())})}),tu=n.forwardRef((e,r)=>{const a=jd(Xd,e.__scopeDialog),o=n.useRef(!1),i=n.useRef(!1);return t(ru,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||a.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));const r=t.target,n=a.triggerRef.current?.contains(r);n&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),ru=n.forwardRef((a,o)=>{const{__scopeDialog:i,trapFocus:s,onOpenAutoFocus:c,onCloseAutoFocus:l,...d}=a,u=jd(Xd,i),f=n.useRef(null),p=Xi(o,f);return zl(),e(r,{children:[t(Cl,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:c,onUnmountAutoFocus:l,children:t(wl,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":lu(u.open),...d,ref:p,onDismiss:()=>u.onOpenChange(!1)})}),e(r,{children:[t(pu,{titleId:u.titleId}),t(mu,{contentRef:f,descriptionId:u.descriptionId})]})]})}),nu="DialogTitle",au=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=jd(nu,n);return t(ml.h2,{id:o.titleId,...a,ref:r})});au.displayName=nu;var ou="DialogDescription",iu=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=jd(ou,n);return t(ml.p,{id:o.descriptionId,...a,ref:r})});iu.displayName=ou;var su="DialogClose",cu=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=jd(su,n);return t(ml.button,{type:"button",...a,ref:r,onClick:nl(e.onClick,()=>o.onOpenChange(!1))})});function lu(e){return e?"open":"closed"}cu.displayName=su;var du="DialogTitleWarning",[uu,fu]=function(e,r){const a=n.createContext(r),o=e=>{const{children:r,...o}=e,i=n.useMemo(()=>o,Object.values(o));return t(a.Provider,{value:i,children:r})};return o.displayName=e+"Provider",[o,function(t){const o=n.useContext(a);if(o)return o;if(void 0!==r)return r;throw new Error(`\`${t}\` must be used within \`${e}\``)}]}(du,{contentName:Xd,titleName:nu,docsSlug:"dialog"}),pu=({titleId:e})=>{const t=fu(du),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return n.useEffect(()=>{if(e){document.getElementById(e)||console.error(r)}},[r,e]),null},mu=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${fu("DialogDescriptionWarning").contentName}}.`;return n.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)||console.warn(r)}},[r,e,t]),null},hu=$d,gu=Wd,vu=Hd,yu=Jd,bu=Qd,wu=au,Su=iu,xu=cu;function ku(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}var Au=["color"],Eu=f(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=ku(e,Au);return p("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),p("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))}),Cu=["color"],Tu=f(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=ku(e,Cu);return p("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),p("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:n,fillRule:"evenodd",clipRule:"evenodd"}))}),_u=["color"],Nu=f(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=ku(e,_u);return p("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),p("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))}),Ru=["color"],Ou=f(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=ku(e,Ru);return p("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),p("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))});const Pu=hu,Du=gu,Iu=vu,Uu=n.forwardRef(({className:e,...r},n)=>t(yu,{ref:n,className:Zc("fixed inset-0 z-50 bg-background/80 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),...r}));Uu.displayName=yu.displayName;const Mu=n.forwardRef(({className:r,children:a,...o},i)=>{const{container:s}=n.useContext(ke);return e(Iu,{container:s,children:[t(Uu,{}),e(bu,{ref:i,className:Zc("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",r),...o,children:[a,e(xu,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t(Nu,{className:"h-4 w-4"}),t("span",{className:"sr-only",children:"Close"})]})]})]})});Mu.displayName=bu.displayName;const zu=({className:e,...r})=>t("div",{className:Zc("flex flex-col space-y-1.5 text-center sm:text-left",e),...r});zu.displayName="DialogHeader";const Lu=n.forwardRef(({className:e,...r},n)=>t(wu,{ref:n,className:Zc("text-lg font-semibold leading-none tracking-tight",e),...r}));Lu.displayName=wu.displayName;const Fu=n.forwardRef(({className:e,...r},n)=>t(Su,{ref:n,className:Zc("text-sm text-muted-foreground",e),...r}));Fu.displayName=Su.displayName;var ju=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=rs(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),$u=n.forwardRef((e,r)=>t(ju.label,{...e,ref:r,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));$u.displayName="Label";var Bu=$u;const Wu=el("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Vu=n.forwardRef(({className:e,...r},n)=>t(Bu,{ref:n,className:Zc(Wu(),e),...r}));Vu.displayName=Bu.displayName;const Gu=ct,Ku=n.createContext({}),Hu=({...e})=>t(Ku.Provider,{value:{name:e.name},children:t(gt,{...e})}),Zu=()=>{const e=n.useContext(Ku),t=n.useContext(Ju),{getFieldState:r,formState:a}=st(),o=r(e.name,a);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...o}},Ju=n.createContext({}),qu=n.forwardRef(({className:e,...r},a)=>{const o=n.useId();return t(Ju.Provider,{value:{id:o},children:t("div",{ref:a,className:Zc("space-y-2",e),...r})})});qu.displayName="FormItem";const Yu=n.forwardRef(({className:e,...r},n)=>{const{error:a,formItemId:o}=Zu();return t(Vu,{ref:n,className:Zc(a&&"text-destructive",e),htmlFor:o,...r})});Yu.displayName="FormLabel";const Xu=n.forwardRef(({...e},r)=>{const{error:n,formItemId:a,formDescriptionId:o,formMessageId:i}=Zu();return t(ns,{ref:r,id:a,"aria-describedby":n?`${o} ${i}`:`${o}`,"aria-invalid":!!n,...e})});Xu.displayName="FormControl";const Qu=n.forwardRef(({className:e,...r},n)=>{const{formDescriptionId:a}=Zu();return t("p",{ref:n,id:a,className:Zc("text-sm text-muted-foreground",e),...r})});Qu.displayName="FormDescription";const ef=n.forwardRef(({className:e,children:r,...n},a)=>{const{error:o,formMessageId:i}=Zu(),s=o?String(o?.message):r;return s?t("p",{ref:a,id:i,className:Zc("text-sm font-medium text-destructive",e),...n,children:s}):null});ef.displayName="FormMessage";const tf=n.forwardRef(({className:e,type:r,...n},a)=>t("input",{type:r,className:Zc("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...n}));function rf(e){const r=nf(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(of);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}function nf(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?Yi(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}tf.displayName="Input";var af=Symbol("radix.slottable");function of(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===af}function sf(e){const r=e+"CollectionProvider",[n,o]=al(r),[i,s]=n(r,{collectionRef:{current:null},itemMap:new Map}),c=e=>{const{scope:r,children:n}=e,o=a.useRef(null),s=a.useRef(new Map).current;return t(i,{scope:r,itemMap:s,collectionRef:o,children:n})};c.displayName=r;const l=e+"CollectionSlot",d=rf(l),u=a.forwardRef((e,r)=>{const{scope:n,children:a}=e,o=Xi(r,s(l,n).collectionRef);return t(d,{ref:o,children:a})});u.displayName=l;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=rf(f),h=a.forwardRef((e,r)=>{const{scope:n,children:o,...i}=e,c=a.useRef(null),l=Xi(r,c),d=s(f,n);return a.useEffect(()=>(d.itemMap.set(c,{ref:c,...i}),()=>{d.itemMap.delete(c)})),t(m,{[p]:"",ref:l,children:o})});return h.displayName=f,[{Provider:c,Slot:u,ItemSlot:h},function(t){const r=s(e+"CollectionConsumer",t),n=a.useCallback(()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`)),n=Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current));return n},[r.collectionRef,r.itemMap]);return n},o]}var cf=n.createContext(void 0);function lf(e){const t=n.useContext(cf);return e||t||"ltr"}var df="rovingFocusGroup.onEntryFocus",uf={bubbles:!1,cancelable:!0},ff="RovingFocusGroup",[pf,mf,hf]=sf(ff),[gf,vf]=al(ff,[hf]),[yf,bf]=gf(ff),wf=n.forwardRef((e,r)=>t(pf.Provider,{scope:e.__scopeRovingFocusGroup,children:t(pf.Slot,{scope:e.__scopeRovingFocusGroup,children:t(Sf,{...e,ref:r})})}));wf.displayName=ff;var Sf=n.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,orientation:o,loop:i=!1,dir:s,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=e,m=n.useRef(null),h=Xi(r,m),g=lf(s),[v,y]=dl({prop:c,defaultProp:l??null,onChange:d,caller:ff}),[b,w]=n.useState(!1),S=Zi(u),x=mf(a),k=n.useRef(!1),[A,E]=n.useState(0);return n.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(df,S),()=>e.removeEventListener(df,S)},[S]),t(yf,{scope:a,orientation:o,dir:g,loop:i,currentTabStopId:v,onItemFocus:n.useCallback(e=>y(e),[y]),onItemShiftTab:n.useCallback(()=>w(!0),[]),onFocusableItemAdd:n.useCallback(()=>E(e=>e+1),[]),onFocusableItemRemove:n.useCallback(()=>E(e=>e-1),[]),children:t(ml.div,{tabIndex:b||0===A?-1:0,"data-orientation":o,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:nl(e.onMouseDown,()=>{k.current=!0}),onFocus:nl(e.onFocus,e=>{const t=!k.current;if(e.target===e.currentTarget&&t&&!b){const t=new CustomEvent(df,uf);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=x().filter(e=>e.focusable);Ef([e.find(e=>e.active),e.find(e=>e.id===v),...e].filter(Boolean).map(e=>e.ref.current),f)}}k.current=!1}),onBlur:nl(e.onBlur,()=>w(!1))})})}),xf="RovingFocusGroupItem",kf=n.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,focusable:o=!0,active:i=!1,tabStopId:s,children:c,...l}=e,d=cl(),u=s||d,f=bf(xf,a),p=f.currentTabStopId===u,m=mf(a),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=f;return n.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),t(pf.ItemSlot,{scope:a,id:u,focusable:o,active:i,children:t(ml.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:r,onMouseDown:nl(e.onMouseDown,e=>{o?f.onItemFocus(u):e.preventDefault()}),onFocus:nl(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:nl(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void f.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,r){const n=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,r);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(n)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)?void 0:Af[n]}(e,f.orientation,f.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let r=m().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)r.reverse();else if("prev"===t||"next"===t){"prev"===t&&r.reverse();const n=r.indexOf(e.currentTarget);r=f.loop?function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(r,n+1):r.slice(n+1)}setTimeout(()=>Ef(r))}}),children:"function"==typeof c?c({isCurrentTabStop:p,hasTabStop:null!=v}):c})})});kf.displayName=xf;var Af={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ef(e,t=!1){const r=document.activeElement;for(const n of e){if(n===r)return;if(n.focus({preventScroll:t}),document.activeElement!==r)return}}var Cf=wf,Tf=kf;function _f(e){const[t,r]=n.useState(void 0);return Ji(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const n=t[0];let a,o;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,o=t.blockSize}else a=e.offsetWidth,o=e.offsetHeight;r({width:a,height:o})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}function Nf(e){const t=n.useRef({value:e,previous:e});return n.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Rf="Radio",[Of,Pf]=al(Rf),[Df,If]=Of(Rf),Uf=n.forwardRef((r,a)=>{const{__scopeRadio:o,name:i,checked:s=!1,required:c,disabled:l,value:d="on",onCheck:u,form:f,...p}=r,[m,h]=n.useState(null),g=Xi(a,e=>h(e)),v=n.useRef(!1),y=!m||(f||!!m.closest("form"));return e(Df,{scope:o,checked:s,disabled:l,children:[t(ml.button,{type:"button",role:"radio","aria-checked":s,"data-state":Ff(s),"data-disabled":l?"":void 0,disabled:l,value:d,...p,ref:g,onClick:nl(r.onClick,e=>{s||u?.(),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})}),y&&t(Lf,{control:m,bubbles:!v.current,name:i,value:d,checked:s,required:c,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});Uf.displayName=Rf;var Mf="RadioIndicator",zf=n.forwardRef((e,r)=>{const{__scopeRadio:n,forceMount:a,...o}=e,i=If(Mf,n);return t(Il,{present:a||i.checked,children:t(ml.span,{"data-state":Ff(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:r})})});zf.displayName=Mf;var Lf=n.forwardRef(({__scopeRadio:e,control:r,checked:a,bubbles:o=!0,...i},s)=>{const c=n.useRef(null),l=Xi(c,s),d=Nf(a),u=_f(r);return n.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==a&&r){const t=new Event("click",{bubbles:o});r.call(e,a),e.dispatchEvent(t)}},[d,a,o]),t(ml.input,{type:"radio","aria-hidden":!0,defaultChecked:a,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Ff(e){return e?"checked":"unchecked"}Lf.displayName="RadioBubbleInput";var jf=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],$f="RadioGroup",[Bf]=al($f,[vf,Pf]),Wf=vf(),Vf=Pf(),[Gf,Kf]=Bf($f),Hf=n.forwardRef((e,r)=>{const{__scopeRadioGroup:n,name:a,defaultValue:o,value:i,required:s=!1,disabled:c=!1,orientation:l,dir:d,loop:u=!0,onValueChange:f,...p}=e,m=Wf(n),h=lf(d),[g,v]=dl({prop:i,defaultProp:o??null,onChange:f,caller:$f});return t(Gf,{scope:n,name:a,required:s,disabled:c,value:g,onValueChange:v,children:t(Cf,{asChild:!0,...m,orientation:l,dir:h,loop:u,children:t(ml.div,{role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":c?"":void 0,dir:h,...p,ref:r})})})});Hf.displayName=$f;var Zf="RadioGroupItem",Jf=n.forwardRef((e,r)=>{const{__scopeRadioGroup:a,disabled:o,...i}=e,s=Kf(Zf,a),c=s.disabled||o,l=Wf(a),d=Vf(a),u=n.useRef(null),f=Xi(r,u),p=s.value===i.value,m=n.useRef(!1);return n.useEffect(()=>{const e=e=>{jf.includes(e.key)&&(m.current=!0)},t=()=>m.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),t(Tf,{asChild:!0,...l,focusable:!c,active:p,children:t(Uf,{disabled:c,required:s.required,checked:p,...d,...i,name:s.name,ref:f,onCheck:()=>s.onValueChange(i.value),onKeyDown:nl(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:nl(i.onFocus,()=>{m.current&&u.current?.click()})})})});Jf.displayName=Zf;var qf=n.forwardRef((e,r)=>{const{__scopeRadioGroup:n,...a}=e,o=Vf(n);return t(zf,{...o,...a,ref:r})});qf.displayName="RadioGroupIndicator";var Yf=Hf,Xf=Jf,Qf=qf;const ep=n.forwardRef(({className:e,...r},n)=>t(Yf,{className:Zc("grid gap-2",e),...r,ref:n}));ep.displayName=Yf.displayName;const tp=n.forwardRef(({className:e,...r},n)=>t(Xf,{ref:n,className:Zc("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:t(Qf,{className:"flex items-center justify-center",children:t(Tu,{className:"h-3.5 w-3.5 fill-primary"})})}));function rp(e,[t,r]){return Math.min(r,Math.max(t,e))}tp.displayName=Xf.displayName;var np="ScrollArea",[ap]=al(np),[op,ip]=ap(np),sp=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,type:o="hover",dir:i,scrollHideDelay:s=600,...c}=e,[l,d]=n.useState(null),[u,f]=n.useState(null),[p,m]=n.useState(null),[h,g]=n.useState(null),[v,y]=n.useState(null),[b,w]=n.useState(0),[S,x]=n.useState(0),[k,A]=n.useState(!1),[E,C]=n.useState(!1),T=Xi(r,e=>d(e)),_=lf(i);return t(op,{scope:a,type:o,dir:_,scrollHideDelay:s,scrollArea:l,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:k,onScrollbarXEnabledChange:A,scrollbarY:v,onScrollbarYChange:y,scrollbarYEnabled:E,onScrollbarYEnabledChange:C,onCornerWidthChange:w,onCornerHeightChange:x,children:t(ml.div,{dir:_,...c,ref:T,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":S+"px",...e.style}})})});sp.displayName=np;var cp="ScrollAreaViewport",lp=n.forwardRef((a,o)=>{const{__scopeScrollArea:i,children:s,nonce:c,...l}=a,d=ip(cp,i),u=Xi(o,n.useRef(null),d.onViewportChange);return e(r,{children:[t("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:c}),t(ml.div,{"data-radix-scroll-area-viewport":"",...l,ref:u,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...a.style},children:t("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});lp.displayName=cp;var dp="ScrollAreaScrollbar",up=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=ip(dp,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:c}=i,l="horizontal"===e.orientation;return n.useEffect(()=>(l?s(!0):c(!0),()=>{l?s(!1):c(!1)}),[l,s,c]),"hover"===i.type?t(fp,{...o,ref:r,forceMount:a}):"scroll"===i.type?t(pp,{...o,ref:r,forceMount:a}):"auto"===i.type?t(mp,{...o,ref:r,forceMount:a}):"always"===i.type?t(hp,{...o,ref:r}):null});up.displayName=dp;var fp=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=ip(dp,e.__scopeScrollArea),[s,c]=n.useState(!1);return n.useEffect(()=>{const e=i.scrollArea;let t=0;if(e){const r=()=>{window.clearTimeout(t),c(!0)},n=()=>{t=window.setTimeout(()=>c(!1),i.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[i.scrollArea,i.scrollHideDelay]),t(Il,{present:a||s,children:t(mp,{"data-state":s?"visible":"hidden",...o,ref:r})})}),pp=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=ip(dp,e.__scopeScrollArea),s="horizontal"===e.orientation,c=Ip(()=>d("SCROLL_END"),100),[l,d]=(u="hidden",f={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},n.useReducer((e,t)=>f[e][t]??e,u));var u,f;return n.useEffect(()=>{if("idle"===l){const e=window.setTimeout(()=>d("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,i.scrollHideDelay,d]),n.useEffect(()=>{const e=i.viewport,t=s?"scrollLeft":"scrollTop";if(e){let r=e[t];const n=()=>{const n=e[t];r!==n&&(d("SCROLL"),c()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[i.viewport,s,d,c]),t(Il,{present:a||"hidden"!==l,children:t(hp,{"data-state":"hidden"===l?"hidden":"visible",...o,ref:r,onPointerEnter:nl(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:nl(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),mp=n.forwardRef((e,r)=>{const a=ip(dp,e.__scopeScrollArea),{forceMount:o,...i}=e,[s,c]=n.useState(!1),l="horizontal"===e.orientation,d=Ip(()=>{if(a.viewport){const e=a.viewport.offsetWidth<a.viewport.scrollWidth,t=a.viewport.offsetHeight<a.viewport.scrollHeight;c(l?e:t)}},10);return Up(a.viewport,d),Up(a.content,d),t(Il,{present:o||s,children:t(hp,{"data-state":s?"visible":"hidden",...i,ref:r})})}),hp=n.forwardRef((e,r)=>{const{orientation:a="vertical",...o}=e,i=ip(dp,e.__scopeScrollArea),s=n.useRef(null),c=n.useRef(0),[l,d]=n.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=_p(l.viewport,l.content),f={...o,sizes:l,onSizesChange:d,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>s.current=e,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:e=>c.current=e};function p(e,t){return function(e,t,r,n="ltr"){const a=Np(r),o=a/2,i=t||o,s=a-i,c=r.scrollbar.paddingStart+i,l=r.scrollbar.size-r.scrollbar.paddingEnd-s,d=r.content-r.viewport,u="ltr"===n?[0,d]:[-1*d,0];return Op([c,l],u)(e)}(e,c.current,l,t)}return"horizontal"===a?t(gp,{...f,ref:r,onThumbPositionChange:()=>{if(i.viewport&&s.current){const e=Rp(i.viewport.scrollLeft,l,i.dir);s.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=p(e,i.dir))}}):"vertical"===a?t(vp,{...f,ref:r,onThumbPositionChange:()=>{if(i.viewport&&s.current){const e=Rp(i.viewport.scrollTop,l);s.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=p(e))}}):null}),gp=n.forwardRef((e,r)=>{const{sizes:a,onSizesChange:o,...i}=e,s=ip(dp,e.__scopeScrollArea),[c,l]=n.useState(),d=n.useRef(null),u=Xi(r,d,s.onScrollbarXChange);return n.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),t(wp,{"data-orientation":"horizontal",...i,ref:u,sizes:a,style:{bottom:0,left:"rtl"===s.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===s.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Np(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(s.viewport){const n=s.viewport.scrollLeft+t.deltaX;e.onWheelScroll(n),Pp(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&c&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Tp(c.paddingLeft),paddingEnd:Tp(c.paddingRight)}})}})}),vp=n.forwardRef((e,r)=>{const{sizes:a,onSizesChange:o,...i}=e,s=ip(dp,e.__scopeScrollArea),[c,l]=n.useState(),d=n.useRef(null),u=Xi(r,d,s.onScrollbarYChange);return n.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),t(wp,{"data-orientation":"vertical",...i,ref:u,sizes:a,style:{top:0,right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Np(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(s.viewport){const n=s.viewport.scrollTop+t.deltaY;e.onWheelScroll(n),Pp(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&c&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Tp(c.paddingTop),paddingEnd:Tp(c.paddingBottom)}})}})}),[yp,bp]=ap(dp),wp=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,sizes:o,hasThumb:i,onThumbChange:s,onThumbPointerUp:c,onThumbPointerDown:l,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=e,h=ip(dp,a),[g,v]=n.useState(null),y=Xi(r,e=>v(e)),b=n.useRef(null),w=n.useRef(""),S=h.viewport,x=o.content-o.viewport,k=Zi(f),A=Zi(d),E=Ip(p,10);function C(e){if(b.current){const t=e.clientX-b.current.left,r=e.clientY-b.current.top;u({x:t,y:r})}}return n.useEffect(()=>{const e=e=>{const t=e.target,r=g?.contains(t);r&&k(e,x)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[S,g,x,k]),n.useEffect(A,[o,A]),Up(g,E),Up(h.content,E),t(yp,{scope:a,scrollbar:g,hasThumb:i,onThumbChange:Zi(s),onThumbPointerUp:Zi(c),onThumbPositionChange:A,onThumbPointerDown:Zi(l),children:t(ml.div,{...m,ref:y,style:{position:"absolute",...m.style},onPointerDown:nl(e.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),b.current=g.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),C(e)}}),onPointerMove:nl(e.onPointerMove,C),onPointerUp:nl(e.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=w.current,h.viewport&&(h.viewport.style.scrollBehavior=""),b.current=null})})})}),Sp="ScrollAreaThumb",xp=n.forwardRef((e,r)=>{const{forceMount:n,...a}=e,o=bp(Sp,e.__scopeScrollArea);return t(Il,{present:n||o.hasThumb,children:t(kp,{ref:r,...a})})}),kp=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,style:o,...i}=e,s=ip(Sp,a),c=bp(Sp,a),{onThumbPositionChange:l}=c,d=Xi(r,e=>c.onThumbChange(e)),u=n.useRef(void 0),f=Ip(()=>{u.current&&(u.current(),u.current=void 0)},100);return n.useEffect(()=>{const e=s.viewport;if(e){const t=()=>{if(f(),!u.current){const t=Dp(e,l);u.current=t,l()}};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[s.viewport,f,l]),t(ml.div,{"data-state":c.hasThumb?"visible":"hidden",...i,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:nl(e.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;c.onThumbPointerDown({x:r,y:n})}),onPointerUp:nl(e.onPointerUp,c.onThumbPointerUp)})});xp.displayName=Sp;var Ap="ScrollAreaCorner",Ep=n.forwardRef((e,r)=>{const n=ip(Ap,e.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?t(Cp,{...e,ref:r}):null});Ep.displayName=Ap;var Cp=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,...o}=e,i=ip(Ap,a),[s,c]=n.useState(0),[l,d]=n.useState(0),u=Boolean(s&&l);return Up(i.scrollbarX,()=>{const e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),d(e)}),Up(i.scrollbarY,()=>{const e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),c(e)}),u?t(ml.div,{...o,ref:r,style:{width:s,height:l,position:"absolute",right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:0,...e.style}}):null});function Tp(e){return e?parseInt(e,10):0}function _p(e,t){const r=e/t;return isNaN(r)?0:r}function Np(e){const t=_p(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Rp(e,t,r="ltr"){const n=Np(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,i=t.content-t.viewport,s=o-n,c=rp(e,"ltr"===r?[0,i]:[-1*i,0]);return Op([0,i],[0,s])(c)}function Op(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function Pp(e,t){return e>0&&e<t}var Dp=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,s=r.top!==o.top;(i||s)&&t(),r=o,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function Ip(e,t){const r=Zi(e),a=n.useRef(0);return n.useEffect(()=>()=>window.clearTimeout(a.current),[]),n.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(r,t)},[r,t])}function Up(e,t){const r=Zi(t);Ji(()=>{let t=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}var Mp=sp,zp=lp,Lp=Ep;const Fp=n.forwardRef(({className:r,children:n,...a},o)=>e(Mp,{ref:o,className:Zc("relative overflow-hidden",r),...a,children:[t(zp,{className:"h-full w-full rounded-[inherit]",children:n}),t(jp,{}),t(Lp,{})]}));Fp.displayName=Mp.displayName;const jp=n.forwardRef(({className:e,orientation:r="vertical",...n},a)=>t(up,{ref:a,orientation:r,className:Zc("flex touch-none select-none transition-colors","vertical"===r&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===r&&"h-2.5 border-t border-t-transparent p-[1px]",e),...n,children:t(xp,{className:Zc("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));jp.displayName=up.displayName;var $p=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=rs(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),Bp="horizontal",Wp=["horizontal","vertical"],Vp=n.forwardRef((e,r)=>{const{decorative:n,orientation:a=Bp,...o}=e,i=function(e){return Wp.includes(e)}(a)?a:Bp,s=n?{role:"none"}:{"aria-orientation":"vertical"===i?i:void 0,role:"separator"};return t($p.div,{"data-orientation":i,...s,...o,ref:r})});Vp.displayName="Separator";var Gp=Vp;const Kp=n.forwardRef(({className:e,orientation:r="horizontal",decorative:n=!0,...a},o)=>t(Gp,{ref:o,decorative:n,orientation:r,className:Zc("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",e),...a}));function Hp(){const e=be(),t=ye(e=>e.os),{serverUrl:r,version:n,orgId:a,settings:o}=t,i=m(!1),s=l(async()=>{if(i.current)return o||null;if(o)return o;if(!r||!n||!a)return null;i.current=!0;try{const t=L(),o=await fetch(`${r}/api/${n}/public/${a}/settings`,{headers:t});if(!o.ok)throw new Error("Failed to fetch settings");const i=await o.json();return e.os(Z(i)),i}catch(e){return console.error("Failed to fetch settings:",e),null}finally{i.current=!1}},[r,n,a,o,e]);return d(()=>{r&&n&&a&&!o&&!i.current&&s()},[r,n,a]),c(()=>({settings:o,getSettings:s}),[o,s])}Kp.displayName=Gp.displayName;var Zp=Symbol("radix.slottable");var Jp="AlertDialog",[qp]=al(Jp,[Ld]),Yp=Ld(),Xp=e=>{const{__scopeAlertDialog:r,...n}=e,a=Yp(r);return t(hu,{...a,...n,modal:!0})};Xp.displayName=Jp;var Qp=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=Yp(n);return t(gu,{...o,...a,ref:r})});Qp.displayName="AlertDialogTrigger";var em=e=>{const{__scopeAlertDialog:r,...n}=e,a=Yp(r);return t(vu,{...a,...n})};em.displayName="AlertDialogPortal";var tm=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=Yp(n);return t(yu,{...o,...a,ref:r})});tm.displayName="AlertDialogOverlay";var rm="AlertDialogContent",[nm,am]=qp(rm),om=function(e){const n=({children:e})=>t(r,{children:e});return n.displayName=`${e}.Slottable`,n.__radixId=Zp,n}("AlertDialogContent"),im=n.forwardRef((r,a)=>{const{__scopeAlertDialog:o,children:i,...s}=r,c=Yp(o),l=n.useRef(null),d=Xi(a,l),u=n.useRef(null);return t(uu,{contentName:rm,titleName:sm,docsSlug:"alert-dialog",children:t(nm,{scope:o,cancelRef:u,children:e(bu,{role:"alertdialog",...c,...s,ref:d,onOpenAutoFocus:nl(s.onOpenAutoFocus,e=>{e.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[t(om,{children:i}),t(mm,{contentRef:l})]})})})});im.displayName=rm;var sm="AlertDialogTitle",cm=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=Yp(n);return t(wu,{...o,...a,ref:r})});cm.displayName=sm;var lm="AlertDialogDescription",dm=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=Yp(n);return t(Su,{...o,...a,ref:r})});dm.displayName=lm;var um=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=Yp(n);return t(xu,{...o,...a,ref:r})});um.displayName="AlertDialogAction";var fm="AlertDialogCancel",pm=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,{cancelRef:o}=am(fm,n),i=Yp(n),s=Xi(r,o);return t(xu,{...i,...a,ref:s})});pm.displayName=fm;var mm=({contentRef:e})=>{const t=`\`${rm}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${rm}\` by passing a \`${lm}\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${rm}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return n.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},hm=tm,gm=im,vm=um,ym=pm,bm=cm,wm=dm;const Sm=Xp,xm=Qp,km=em,Am=n.forwardRef(({className:e,...r},n)=>t(hm,{className:Zc("fixed inset-0 z-50 bg-background/80 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),...r,ref:n}));Am.displayName=hm.displayName;const Em=n.forwardRef(({className:r,...a},o)=>{const{container:i}=n.useContext(ke);return e(km,{container:i,children:[t(Am,{}),t(gm,{ref:o,className:Zc("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",r),...a})]})});Em.displayName=gm.displayName;const Cm=({className:e,...r})=>t("div",{className:Zc("flex flex-col space-y-2 text-center sm:text-left",e),...r});Cm.displayName="AlertDialogHeader";const Tm=({className:e,...r})=>t("div",{className:Zc("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...r});Tm.displayName="AlertDialogFooter";const _m=n.forwardRef(({className:e,...r},n)=>t(bm,{ref:n,className:Zc("text-lg font-semibold",e),...r}));_m.displayName=bm.displayName;const Nm=n.forwardRef(({className:e,...r},n)=>t(wm,{ref:n,className:Zc("text-sm text-muted-foreground",e),...r}));Nm.displayName=wm.displayName;const Rm=n.forwardRef(({className:e,...r},n)=>t(vm,{ref:n,className:Zc(tl(),e),...r}));Rm.displayName=vm.displayName;const Om=n.forwardRef(({className:e,...r},n)=>t(ym,{ref:n,className:Zc(tl({variant:"outline"}),"mt-2 sm:mt-0",e),...r}));Om.displayName=ym.displayName;const Pm="saas-workspace-current",Dm=()=>O(Pm),Im=(e,t)=>!!e&&t.some(t=>t._id===e);function Um(e,t){if(!t)return!1;const r=(n=e.createdBy)?"string"==typeof n?n:"object"==typeof n&&null!==n&&"_id"in n&&"string"==typeof n._id?n._id:null:null;var n;return null!==r&&r===t}function Mm({className:e,...r}){return t("div",{className:Zc("animate-pulse rounded-md bg-primary/10",e),...r})}function zm(){return e("div",{className:"space-y-3.5",children:[t(Mm,{className:"h-10 w-full"}),t(Mm,{className:"h-10 w-full"}),t(Mm,{className:"h-10 w-full"})]})}const Lm=({workspace:n})=>{const[a,o]=u(!1),{deleteWorkspace:i}=ww(),s=ye(e=>e.auth.session?.user||null);if(!n)return t(zm,{});const c=function(e,t){if(!t||!e.users||!Array.isArray(e.users))return null;const r=e.users.find(e=>"string"==typeof e?e===t:"object"==typeof e&&null!==e&&"_id"in e&&e._id===t);return r&&"object"==typeof r&&"role"in r&&"string"==typeof r.role?r.role:null}(n,s?.id??null);return"admin"===c?.toLowerCase()?e("div",{className:"space-y-4",children:[e("div",{children:[t("h3",{className:"text-lg font-semibold text-destructive",children:"Delete Workspace"}),e("p",{className:"text-sm text-muted-foreground mt-2",children:["Once you delete a workspace, there is no going back. This will permanently delete the workspace ",t("strong",{children:n.name})," and all of its data, including members, settings, and features."]})]}),e(Sm,{children:[t(xm,{asChild:!0,children:e(rl,{variant:"destructive",disabled:a,progress:a,children:[t(To,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e(Em,{children:[e(Cm,{children:[t(_m,{children:"Are you absolutely sure?"}),e(Nm,{children:["This action cannot be undone. This will permanently delete the workspace"," ",t("strong",{children:n.name})," and all of its data."]})]}),e(Tm,{children:[t(Om,{disabled:a,children:"Cancel"}),t(Rm,{onClick:async()=>{o(!0);try{await i(n._id)}catch(e){x(e,{component:"WorkspaceSettingsDanger",action:"handleDeleteWorkspace",metadata:{workspaceId:n._id}}),alert(e instanceof Error?e.message:"Failed to delete workspace")}finally{o(!1)}},disabled:a,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:a?e(r,{children:[t(wo,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Workspace"})]})]})]})]}):t("div",{className:"space-y-4",children:t("div",{className:"text-red-500",children:"Only workspace admins can delete workspaces."})})};var Fm="Switch",[jm]=al(Fm),[$m,Bm]=jm(Fm),Wm=n.forwardRef((r,a)=>{const{__scopeSwitch:o,name:i,checked:s,defaultChecked:c,required:l,disabled:d,value:u="on",onCheckedChange:f,form:p,...m}=r,[h,g]=n.useState(null),v=Xi(a,e=>g(e)),y=n.useRef(!1),b=!h||(p||!!h.closest("form")),[w,S]=dl({prop:s,defaultProp:c??!1,onChange:f,caller:Fm});return e($m,{scope:o,checked:w,disabled:d,children:[t(ml.button,{type:"button",role:"switch","aria-checked":w,"aria-required":l,"data-state":Hm(w),"data-disabled":d?"":void 0,disabled:d,value:u,...m,ref:v,onClick:nl(r.onClick,e=>{S(e=>!e),b&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())})}),b&&t(Km,{control:h,bubbles:!y.current,name:i,value:u,checked:w,required:l,disabled:d,form:p,style:{transform:"translateX(-100%)"}})]})});Wm.displayName=Fm;var Vm="SwitchThumb",Gm=n.forwardRef((e,r)=>{const{__scopeSwitch:n,...a}=e,o=Bm(Vm,n);return t(ml.span,{"data-state":Hm(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:r})});Gm.displayName=Vm;var Km=n.forwardRef(({__scopeSwitch:e,control:r,checked:a,bubbles:o=!0,...i},s)=>{const c=n.useRef(null),l=Xi(c,s),d=Nf(a),u=_f(r);return n.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==a&&r){const t=new Event("click",{bubbles:o});r.call(e,a),e.dispatchEvent(t)}},[d,a,o]),t("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Hm(e){return e?"checked":"unchecked"}Km.displayName="SwitchBubbleInput";var Zm=Wm,Jm=Gm;const qm=n.forwardRef(({className:e,...r},n)=>t(Zm,{className:Zc("peer inline-flex h-[20px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...r,ref:n,children:t(Jm,{className:Zc("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));qm.displayName=Zm.displayName;const Ym=({workspaceId:r})=>{const[n,a]=u({}),{allFeatures:o,updateFeature:i,getWorkspace:s}=ww(),[c,l]=u(null),f=ye(e=>e.auth.session?.user||null);if(d(()=>{s(r).then(l)},[r]),!c)return t(zm,{});const p=Um(c,f?.id??null);return t("div",{children:e("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!p&&t("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!o.length&&t("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),o.length>0&&t("div",{className:"flex flex-col gap-y-3.5",children:o.map(r=>{const o=c?.features?.[r.slug];return e("div",{className:"flex items-center gap-x-2 justify-between w-full",children:[e("div",{className:"flex gap-x-2 flex-col",children:[t("h3",{className:"font-medium text-ellipsis",children:r.name}),t("p",{className:"text-muted-foreground",children:r.description})]}),t(qm,{disabled:n[r.slug]||!p,checked:o??r.defaultValue,onCheckedChange:e=>async function(e,t){if(!c)return;a(r=>({...r,[e]:t}));const r=await i(c._id,e,t);l(r),a(t=>({...t,[e]:!1}))}(r.slug,e)})]},r._id)})})]})})};function Xm(e){return`data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text x="50%" y="50%" dominant-baseline="middle" alignment-baseline="middle" text-anchor="middle" font-size="50" font-family="sans-serif">${e}</text></svg>`}const Qm=["🏢","🏬","🏣","🏤","🏦","🏛️","🏠","🏡","🏭","🏗️","🏪","🏨","🏫","🏥","💼","📊","📈","📉","📋","📁","📂","🗂️","🗃️","🗄️","📅","🗓️","📝","🖋️","✏️","🖊️","🖌️","🖍️","📇","📌","📍","📎","🖇️","💻","🖥️","🖨️","🖱️","⌨️","📱","📲","📡","🌐","🔗","🔒","🔓","⚙️","🔧","🛠️","🧑‍💻","👨‍💻","👩‍💻","🕹️","💾","📟","🖥️","🖲️","🚀","💡","🎨","🖼️","🧪","🔬","🧬","🎯","⚡","🎲","🎮","🧩","📷","🎥","✉️","📨","📩","📧","📞","☎️","📠","🗣️","💬","🗨️","📢","📣","🔔","🛎️","💰","💸","💳","🏦","📈","📉","⚖️","🧾","🪙","🏛️","⚗️","🧪","🔭","🔬","🩺","🧬","🩻","🏥","🌱","🌍","🌏","🌎","🌡️","👨‍💼","👩‍💼","👨‍🏫","👩‍🏫","👨‍🔬","👩‍🔬","👨‍🎨","👩‍🎨","👨‍🔧","👩‍🔧","👨‍🚀","👩‍🚀","👨‍⚖️","👩‍⚖️","🏅","🎖️","🥇","🥈","🥉","🏆","🎗️","🔑","🗝️","🧭","🛡️","🚩","🏳️‍🌈","🎟️","🎫"],eh=({workspace:r})=>{const[n,a]=u(!1),[o,i]=u("emoji"),[s,c]=u(),{updateWorkspace:l}=ww(),d=ye(e=>e.auth.session?.user||null),f=Xt({resolver:so(Ni({name:ri().min(2,{message:"Workspace name must be at least 2 characters."}),image:ri().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return t(zm,{});const p=Um(r,d?.id??null);return e("div",{children:[!p&&t("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),t(Gu,{...f,children:e("form",{onSubmit:f.handleSubmit(async function(e){a(!0);try{await l(r,e)}catch(e){console.error("Failed to update workspace:",e)}finally{a(!1)}}),className:"space-y-6",children:[t(Hu,{control:f.control,name:"name",render:({field:r})=>e(qu,{children:[t(Yu,{children:"Name"}),t(Xu,{children:t(tf,{placeholder:"My Awesome Workspace",...r,disabled:!p})}),t(ef,{})]})}),e("div",{className:"space-y-4",children:[e("div",{children:[t(Vu,{className:"text-sm font-medium",children:"Icon"}),t(Qu,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e(ep,{value:o,disabled:!p,onValueChange:e=>i(e),className:"flex flex-col space-y-3",children:[e("div",{className:"flex items-center space-x-2",children:[t(tp,{value:"emoji",id:"emoji"}),e(Vu,{htmlFor:"emoji",className:"flex items-center gap-2",children:[t(Eo,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e("div",{className:"flex items-center space-x-2",children:[t(tp,{value:"url",id:"url"}),e(Vu,{htmlFor:"url",className:"flex items-center gap-2",children:[t(bo,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===o&&e("div",{className:"space-y-3",children:[e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),e("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:[s&&t("span",{className:"text-2xl",children:s}),!s&&f.watch("image")?.trim()&&t("img",{src:f.watch("image")||void 0,alt:"Workspace preview"})]})]}),p&&t(Fp,{className:"h-32 w-full rounded-md border",children:t("div",{className:"p-4 grid grid-cols-8 gap-2",children:Qm.map((e,r)=>t("button",{type:"button",onClick:()=>(e=>{c(e),f.setValue("image",Xm(e))})(e),disabled:!p,className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(s===e?"bg-primary text-primary-foreground":""),children:e},r))})})]}),"url"===o&&e("div",{className:"space-y-3",children:[t(Hu,{control:f.control,name:"image",render:({field:r})=>e(qu,{children:[t(Yu,{children:"Image URL"}),t(Xu,{children:t(tf,{placeholder:"https://example.com/image.png",...r,disabled:!p})}),t(Qu,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),t(ef,{})]})}),f.watch("image")&&f.watch("image")?.trim()&&e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:t("img",{src:f.watch("image")||void 0,className:"w-full h-full object-cover",alt:"Workspace preview"})})]})]})]}),t("div",{className:"flex justify-end gap-3 pt-4",children:p&&t(rl,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var th=.999,rh=/[\\\/_+.#"@\[\(\{&]/,nh=/[\\\/_+.#"@\[\(\{&]/g,ah=/[\s-]/,oh=/[\s-]/g;function ih(e,t,r,n,a,o,i){if(o===t.length)return a===e.length?1:.99;var s=`${a},${o}`;if(void 0!==i[s])return i[s];for(var c,l,d,u,f=n.charAt(o),p=r.indexOf(f,a),m=0;p>=0;)(c=ih(e,t,r,n,p+1,o+1,i))>m&&(p===a?c*=1:rh.test(e.charAt(p-1))?(c*=.8,(d=e.slice(a,p-1).match(nh))&&a>0&&(c*=Math.pow(th,d.length))):ah.test(e.charAt(p-1))?(c*=.9,(u=e.slice(a,p-1).match(oh))&&a>0&&(c*=Math.pow(th,u.length))):(c*=.17,a>0&&(c*=Math.pow(th,p-a))),e.charAt(p)!==t.charAt(o)&&(c*=.9999)),(c<.1&&r.charAt(p-1)===n.charAt(o+1)||n.charAt(o+1)===n.charAt(o)&&r.charAt(p-1)!==n.charAt(o))&&(.1*(l=ih(e,t,r,n,p+1,o+2,i))>c&&(c=.1*l)),c>m&&(m=c),p=r.indexOf(f,p+1);return i[s]=m,m}function sh(e){return e.toLowerCase().replace(oh," ")}function ch(e,t,r){return ih(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,sh(e),sh(t),0,0,{})}var lh='[cmdk-group=""]',dh='[cmdk-group-items=""]',uh='[cmdk-item=""]',fh=`${uh}:not([aria-disabled="true"])`,ph="cmdk-item-select",mh="data-value",hh=(e,t,r)=>ch(e,t,r),gh=n.createContext(void 0),vh=()=>n.useContext(gh),yh=n.createContext(void 0),bh=()=>n.useContext(yh),wh=n.createContext(void 0),Sh=n.forwardRef((e,t)=>{let r=Uh(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=Uh(()=>new Set),o=Uh(()=>new Map),i=Uh(()=>new Map),s=Uh(()=>new Set),c=Dh(e),{label:l,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,b=cl(),w=cl(),S=cl(),x=n.useRef(null),k=Lh();Ih(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,A.emit()}},[u]),Ih(()=>{k(6,R)},[]);let A=n.useMemo(()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,o,i,s;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)N(),T(),k(1,_);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(S);e?e.focus():null==(a=document.getElementById(b))||a.focus()}if(k(7,()=>{var e;r.current.selectedItemId=null==(e=O())?void 0:e.id,A.emit()}),n||k(5,R),void 0!==(null==(o=c.current)?void 0:o.value)){let e=null!=t?t:"";return void(null==(s=(i=c.current).onValueChange)||s.call(i,e))}}A.emit()}},emit:()=>{s.current.forEach(e=>e())}}),[]),E=n.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=i.current.get(e))?void 0:a.value)&&(i.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,C(t,n)),k(2,()=>{T(),A.emit()}))},item:(e,t)=>(a.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),k(3,()=>{N(),T(),r.current.value||_(),A.emit()}),()=>{i.current.delete(e),a.current.delete(e),r.current.filtered.items.delete(e);let t=O();k(4,()=>{N(),(null==t?void 0:t.getAttribute("id"))===e&&_(),A.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{i.current.delete(e),o.current.delete(e)}),filter:()=>c.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:b,inputId:S,labelId:w,listInnerRef:x}),[]);function C(e,t){var n,a;let o=null!=(a=null==(n=c.current)?void 0:n.filter)?a:hh;return e?o(e,r.current.search,t):0}function T(){if(!r.current.search||!1===c.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=o.current.get(r),a=0;n.forEach(t=>{let r=e.get(t);a=Math.max(r,a)}),t.push([r,a])});let n=x.current;P().sort((t,r)=>{var n,a;let o=t.getAttribute("id"),i=r.getAttribute("id");return(null!=(n=e.get(i))?n:0)-(null!=(a=e.get(o))?a:0)}).forEach(e=>{let t=e.closest(dh);t?t.appendChild(e.parentElement===t?e:e.closest(`${dh} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${dh} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=x.current)?void 0:t.querySelector(`${lh}[${mh}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function _(){let e=P().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(mh);A.setState("value",t||void 0)}function N(){var e,t,n,s;if(!r.current.search||!1===c.current.shouldFilter)return void(r.current.filtered.count=a.current.size);r.current.filtered.groups=new Set;let l=0;for(let o of a.current){let a=C(null!=(t=null==(e=i.current.get(o))?void 0:e.value)?t:"",null!=(s=null==(n=i.current.get(o))?void 0:n.keywords)?s:[]);r.current.filtered.items.set(o,a),a>0&&l++}for(let[e,t]of o.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=l}function R(){var e,t,r;let n=O();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(lh))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function O(){var e;return null==(e=x.current)?void 0:e.querySelector(`${uh}[aria-selected="true"]`)}function P(){var e;return Array.from((null==(e=x.current)?void 0:e.querySelectorAll(fh))||[])}function D(e){let t=P()[e];t&&A.setState("value",t.getAttribute(mh))}function I(e){var t;let r=O(),n=P(),a=n.findIndex(e=>e===r),o=n[a+e];null!=(t=c.current)&&t.loop&&(o=a+e<0?n[n.length-1]:a+e===n.length?n[0]:n[a+e]),o&&A.setState("value",o.getAttribute(mh))}function U(e){let t,r=O(),n=null==r?void 0:r.closest(lh);for(;n&&!t;)n=e>0?Oh(n,lh):Ph(n,lh),t=null==n?void 0:n.querySelector(fh);t?A.setState("value",t.getAttribute(mh)):I(e)}let M=()=>D(P().length-1),z=e=>{e.preventDefault(),e.metaKey?M():e.altKey?U(1):I(1)},L=e=>{e.preventDefault(),e.metaKey?D(0):e.altKey?U(-1):I(-1)};return n.createElement(ml.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=y.onKeyDown)||t.call(y,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!r)switch(e.key){case"n":case"j":v&&e.ctrlKey&&z(e);break;case"ArrowDown":z(e);break;case"p":case"k":v&&e.ctrlKey&&L(e);break;case"ArrowUp":L(e);break;case"Home":e.preventDefault(),D(0);break;case"End":e.preventDefault(),M();break;case"Enter":{e.preventDefault();let t=O();if(t){let e=new Event(ph);t.dispatchEvent(e)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:jh},l),Fh(e,e=>n.createElement(yh.Provider,{value:A},n.createElement(gh.Provider,{value:E},e))))}),xh=n.forwardRef((e,t)=>{var r,a;let o=cl(),i=n.useRef(null),s=n.useContext(wh),c=vh(),l=Dh(e),d=null!=(a=null==(r=l.current)?void 0:r.forceMount)?a:null==s?void 0:s.forceMount;Ih(()=>{if(!d)return c.item(o,null==s?void 0:s.id)},[d]);let u=zh(o,i,[e.value,e.children,i],e.keywords),f=bh(),p=Mh(e=>e.value&&e.value===u.current),m=Mh(e=>!(!d&&!1!==c.filter())||(!e.search||e.filtered.items.get(o)>0));function h(){var e,t;g(),null==(t=(e=l.current).onSelect)||t.call(e,u.current)}function g(){f.setState("value",u.current,!0)}if(n.useEffect(()=>{let t=i.current;if(t&&!e.disabled)return t.addEventListener(ph,h),()=>t.removeEventListener(ph,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:v,value:y,onSelect:b,forceMount:w,keywords:S,...x}=e;return n.createElement(ml.div,{ref:Yi(i,t),...x,id:o,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!p,"data-disabled":!!v,"data-selected":!!p,onPointerMove:v||c.getDisablePointerSelection()?void 0:g,onClick:v?void 0:h},e.children)}),kh=n.forwardRef((e,t)=>{let{heading:r,children:a,forceMount:o,...i}=e,s=cl(),c=n.useRef(null),l=n.useRef(null),d=cl(),u=vh(),f=Mh(e=>!(!o&&!1!==u.filter())||(!e.search||e.filtered.groups.has(s)));Ih(()=>u.group(s),[]),zh(s,c,[e.value,e.heading,l]);let p=n.useMemo(()=>({id:s,forceMount:o}),[o]);return n.createElement(ml.div,{ref:Yi(c,t),...i,"cmdk-group":"",role:"presentation",hidden:!f||void 0},r&&n.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),Fh(e,e=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},n.createElement(wh.Provider,{value:p},e))))}),Ah=n.forwardRef((e,t)=>{let{alwaysRender:r,...a}=e,o=n.useRef(null),i=Mh(e=>!e.search);return r||i?n.createElement(ml.div,{ref:Yi(o,t),...a,"cmdk-separator":"",role:"separator"}):null}),Eh=n.forwardRef((e,t)=>{let{onValueChange:r,...a}=e,o=null!=e.value,i=bh(),s=Mh(e=>e.search),c=Mh(e=>e.selectedItemId),l=vh();return n.useEffect(()=>{null!=e.value&&i.setState("search",e.value)},[e.value]),n.createElement(ml.input,{ref:t,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:"text",value:o?e.value:s,onChange:e=>{o||i.setState("search",e.target.value),null==r||r(e.target.value)}})}),Ch=n.forwardRef((e,t)=>{let{children:r,label:a="Suggestions",...o}=e,i=n.useRef(null),s=n.useRef(null),c=Mh(e=>e.selectedItemId),l=vh();return n.useEffect(()=>{if(s.current&&i.current){let e,t=s.current,r=i.current,n=new ResizeObserver(()=>{e=requestAnimationFrame(()=>{let e=t.offsetHeight;r.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")})});return n.observe(t),()=>{cancelAnimationFrame(e),n.unobserve(t)}}},[]),n.createElement(ml.div,{ref:Yi(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":a,id:l.listId},Fh(e,e=>n.createElement("div",{ref:Yi(s,l.listInnerRef),"cmdk-list-sizer":""},e)))}),Th=n.forwardRef((e,t)=>{let{open:r,onOpenChange:a,overlayClassName:o,contentClassName:i,container:s,...c}=e;return n.createElement(hu,{open:r,onOpenChange:a},n.createElement(vu,{container:s},n.createElement(yu,{"cmdk-overlay":"",className:o}),n.createElement(bu,{"aria-label":e.label,"cmdk-dialog":"",className:i},n.createElement(Sh,{ref:t,...c}))))}),_h=n.forwardRef((e,t)=>Mh(e=>0===e.filtered.count)?n.createElement(ml.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Nh=n.forwardRef((e,t)=>{let{progress:r,children:a,label:o="Loading...",...i}=e;return n.createElement(ml.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},Fh(e,e=>n.createElement("div",{"aria-hidden":!0},e)))}),Rh=Object.assign(Sh,{List:Ch,Item:xh,Input:Eh,Group:kh,Separator:Ah,Dialog:Th,Empty:_h,Loading:Nh});function Oh(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function Ph(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function Dh(e){let t=n.useRef(e);return Ih(()=>{t.current=e}),t}var Ih="undefined"==typeof window?n.useEffect:n.useLayoutEffect;function Uh(e){let t=n.useRef();return void 0===t.current&&(t.current=e()),t}function Mh(e){let t=bh(),r=()=>e(t.snapshot());return n.useSyncExternalStore(t.subscribe,r,r)}function zh(e,t,r,a=[]){let o=n.useRef(),i=vh();return Ih(()=>{var n;let s=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():o.current}})(),c=a.map(e=>e.trim());i.value(e,s,c),null==(n=t.current)||n.setAttribute(mh,s),o.current=s}),o}var Lh=()=>{let[e,t]=n.useState(),r=Uh(()=>new Map);return Ih(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function Fh({asChild:e,children:t},r){return e&&n.isValidElement(t)?n.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},r(t.props.children)):r(t)}var jh={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const $h=n.forwardRef(({className:e,...r},n)=>t(Rh,{ref:n,className:Zc("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...r}));$h.displayName=Rh.displayName;const Bh=n.forwardRef(({className:r,...n},a)=>e("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[t(Ou,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),t(Rh.Input,{ref:a,className:Zc("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",r),...n})]}));Bh.displayName=Rh.Input.displayName;const Wh=n.forwardRef(({className:e,...r},n)=>t(Rh.List,{ref:n,className:Zc("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...r}));Wh.displayName=Rh.List.displayName;n.forwardRef((e,r)=>t(Rh.Empty,{ref:r,className:"py-6 text-center text-sm",...e})).displayName=Rh.Empty.displayName;const Vh=n.forwardRef(({className:e,...r},n)=>t(Rh.Group,{ref:n,className:Zc("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...r}));Vh.displayName=Rh.Group.displayName;n.forwardRef(({className:e,...r},n)=>t(Rh.Separator,{ref:n,className:Zc("-mx-1 h-px bg-border",e),...r})).displayName=Rh.Separator.displayName;const Gh=n.forwardRef(({className:e,...r},n)=>t(Rh.Item,{ref:n,className:Zc("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r}));Gh.displayName=Rh.Item.displayName;const Kh=["top","right","bottom","left"],Hh=Math.min,Zh=Math.max,Jh=Math.round,qh=Math.floor,Yh=e=>({x:e,y:e}),Xh={left:"right",right:"left",bottom:"top",top:"bottom"},Qh={start:"end",end:"start"};function eg(e,t,r){return Zh(e,Hh(t,r))}function tg(e,t){return"function"==typeof e?e(t):e}function rg(e){return e.split("-")[0]}function ng(e){return e.split("-")[1]}function ag(e){return"x"===e?"y":"x"}function og(e){return"y"===e?"height":"width"}const ig=new Set(["top","bottom"]);function sg(e){return ig.has(rg(e))?"y":"x"}function cg(e){return ag(sg(e))}function lg(e){return e.replace(/start|end/g,e=>Qh[e])}const dg=["left","right"],ug=["right","left"],fg=["top","bottom"],pg=["bottom","top"];function mg(e,t,r,n){const a=ng(e);let o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?ug:dg:t?dg:ug;case"left":case"right":return t?fg:pg;default:return[]}}(rg(e),"start"===r,n);return a&&(o=o.map(e=>e+"-"+a),t&&(o=o.concat(o.map(lg)))),o}function hg(e){return e.replace(/left|right|bottom|top/g,e=>Xh[e])}function gg(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function vg(e){const{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function yg(e,t,r){let{reference:n,floating:a}=e;const o=sg(t),i=cg(t),s=og(i),c=rg(t),l="y"===o,d=n.x+n.width/2-a.width/2,u=n.y+n.height/2-a.height/2,f=n[s]/2-a[s]/2;let p;switch(c){case"top":p={x:d,y:n.y-a.height};break;case"bottom":p={x:d,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:u};break;case"left":p={x:n.x-a.width,y:u};break;default:p={x:n.x,y:n.y}}switch(ng(t)){case"start":p[i]-=f*(r&&l?-1:1);break;case"end":p[i]+=f*(r&&l?-1:1)}return p}async function bg(e,t){var r;void 0===t&&(t={});const{x:n,y:a,platform:o,rects:i,elements:s,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=tg(t,e),m=gg(p),h=s[f?"floating"===u?"reference":"floating":u],g=vg(await o.getClippingRect({element:null==(r=await(null==o.isElement?void 0:o.isElement(h)))||r?h:h.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(s.floating)),boundary:l,rootBoundary:d,strategy:c})),v="floating"===u?{x:n,y:a,width:i.floating.width,height:i.floating.height}:i.reference,y=await(null==o.getOffsetParent?void 0:o.getOffsetParent(s.floating)),b=await(null==o.isElement?void 0:o.isElement(y))&&await(null==o.getScale?void 0:o.getScale(y))||{x:1,y:1},w=vg(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:c}):v);return{top:(g.top-w.top+m.top)/b.y,bottom:(w.bottom-g.bottom+m.bottom)/b.y,left:(g.left-w.left+m.left)/b.x,right:(w.right-g.right+m.right)/b.x}}function wg(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Sg(e){return Kh.some(t=>e[t]>=0)}const xg=new Set(["left","top"]);function kg(){return"undefined"!=typeof window}function Ag(e){return Tg(e)?(e.nodeName||"").toLowerCase():"#document"}function Eg(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Cg(e){var t;return null==(t=(Tg(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Tg(e){return!!kg()&&(e instanceof Node||e instanceof Eg(e).Node)}function _g(e){return!!kg()&&(e instanceof Element||e instanceof Eg(e).Element)}function Ng(e){return!!kg()&&(e instanceof HTMLElement||e instanceof Eg(e).HTMLElement)}function Rg(e){return!(!kg()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Eg(e).ShadowRoot)}const Og=new Set(["inline","contents"]);function Pg(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=Vg(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!Og.has(a)}const Dg=new Set(["table","td","th"]);function Ig(e){return Dg.has(Ag(e))}const Ug=[":popover-open",":modal"];function Mg(e){return Ug.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const zg=["transform","translate","scale","rotate","perspective"],Lg=["transform","translate","scale","rotate","perspective","filter"],Fg=["paint","layout","strict","content"];function jg(e){const t=$g(),r=_g(e)?Vg(e):e;return zg.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||Lg.some(e=>(r.willChange||"").includes(e))||Fg.some(e=>(r.contain||"").includes(e))}function $g(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Bg=new Set(["html","body","#document"]);function Wg(e){return Bg.has(Ag(e))}function Vg(e){return Eg(e).getComputedStyle(e)}function Gg(e){return _g(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Kg(e){if("html"===Ag(e))return e;const t=e.assignedSlot||e.parentNode||Rg(e)&&e.host||Cg(e);return Rg(t)?t.host:t}function Hg(e){const t=Kg(e);return Wg(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ng(t)&&Pg(t)?t:Hg(t)}function Zg(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=Hg(e),o=a===(null==(n=e.ownerDocument)?void 0:n.body),i=Eg(a);if(o){const e=Jg(i);return t.concat(i,i.visualViewport||[],Pg(a)?a:[],e&&r?Zg(e):[])}return t.concat(a,Zg(a,[],r))}function Jg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function qg(e){const t=Vg(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Ng(e),o=a?e.offsetWidth:r,i=a?e.offsetHeight:n,s=Jh(r)!==o||Jh(n)!==i;return s&&(r=o,n=i),{width:r,height:n,$:s}}function Yg(e){return _g(e)?e:e.contextElement}function Xg(e){const t=Yg(e);if(!Ng(t))return Yh(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:o}=qg(t);let i=(o?Jh(r.width):r.width)/n,s=(o?Jh(r.height):r.height)/a;return i&&Number.isFinite(i)||(i=1),s&&Number.isFinite(s)||(s=1),{x:i,y:s}}const Qg=Yh(0);function ev(e){const t=Eg(e);return $g()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Qg}function tv(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),o=Yg(e);let i=Yh(1);t&&(n?_g(n)&&(i=Xg(n)):i=Xg(e));const s=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==Eg(e))&&t}(o,r,n)?ev(o):Yh(0);let c=(a.left+s.x)/i.x,l=(a.top+s.y)/i.y,d=a.width/i.x,u=a.height/i.y;if(o){const e=Eg(o),t=n&&_g(n)?Eg(n):n;let r=e,a=Jg(r);for(;a&&n&&t!==r;){const e=Xg(a),t=a.getBoundingClientRect(),n=Vg(a),o=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,i=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;c*=e.x,l*=e.y,d*=e.x,u*=e.y,c+=o,l+=i,r=Eg(a),a=Jg(r)}}return vg({width:d,height:u,x:c,y:l})}function rv(e,t){const r=Gg(e).scrollLeft;return t?t.left+r:tv(Cg(e)).left+r}function nv(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-rv(e,r),y:r.top+t.scrollTop}}const av=new Set(["absolute","fixed"]);function ov(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=Eg(e),n=Cg(e),a=r.visualViewport;let o=n.clientWidth,i=n.clientHeight,s=0,c=0;if(a){o=a.width,i=a.height;const e=$g();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,c=a.offsetTop)}const l=rv(n);if(l<=0){const e=n.ownerDocument,t=e.body,r=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,i=Math.abs(n.clientWidth-t.clientWidth-a);i<=25&&(o-=i)}else l<=25&&(o+=l);return{width:o,height:i,x:s,y:c}}(e,r);else if("document"===t)n=function(e){const t=Cg(e),r=Gg(e),n=e.ownerDocument.body,a=Zh(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=Zh(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+rv(e);const s=-r.scrollTop;return"rtl"===Vg(n).direction&&(i+=Zh(t.clientWidth,n.clientWidth)-a),{width:a,height:o,x:i,y:s}}(Cg(e));else if(_g(t))n=function(e,t){const r=tv(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,o=Ng(e)?Xg(e):Yh(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:a*o.x,y:n*o.y}}(t,r);else{const r=ev(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return vg(n)}function iv(e,t){const r=Kg(e);return!(r===t||!_g(r)||Wg(r))&&("fixed"===Vg(r).position||iv(r,t))}function sv(e,t,r){const n=Ng(t),a=Cg(t),o="fixed"===r,i=tv(e,!0,o,t);let s={scrollLeft:0,scrollTop:0};const c=Yh(0);function l(){c.x=rv(a)}if(n||!n&&!o)if(("body"!==Ag(t)||Pg(a))&&(s=Gg(t)),n){const e=tv(t,!0,o,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else a&&l();o&&!n&&a&&l();const d=!a||n||o?Yh(0):nv(a,s);return{x:i.left+s.scrollLeft-c.x-d.x,y:i.top+s.scrollTop-c.y-d.y,width:i.width,height:i.height}}function cv(e){return"static"===Vg(e).position}function lv(e,t){if(!Ng(e)||"fixed"===Vg(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Cg(e)===r&&(r=r.ownerDocument.body),r}function dv(e,t){const r=Eg(e);if(Mg(e))return r;if(!Ng(e)){let t=Kg(e);for(;t&&!Wg(t);){if(_g(t)&&!cv(t))return t;t=Kg(t)}return r}let n=lv(e,t);for(;n&&Ig(n)&&cv(n);)n=lv(n,t);return n&&Wg(n)&&cv(n)&&!jg(n)?r:n||function(e){let t=Kg(e);for(;Ng(t)&&!Wg(t);){if(jg(t))return t;if(Mg(t))return null;t=Kg(t)}return null}(e)||r}const uv={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const o="fixed"===a,i=Cg(n),s=!!t&&Mg(t.floating);if(n===i||s&&o)return r;let c={scrollLeft:0,scrollTop:0},l=Yh(1);const d=Yh(0),u=Ng(n);if((u||!u&&!o)&&(("body"!==Ag(n)||Pg(i))&&(c=Gg(n)),Ng(n))){const e=tv(n);l=Xg(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!i||u||o?Yh(0):nv(i,c);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+d.x+f.x,y:r.y*l.y-c.scrollTop*l.y+d.y+f.y}},getDocumentElement:Cg,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const o=[..."clippingAncestors"===r?Mg(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=Zg(e,[],!1).filter(e=>_g(e)&&"body"!==Ag(e)),a=null;const o="fixed"===Vg(e).position;let i=o?Kg(e):e;for(;_g(i)&&!Wg(i);){const t=Vg(i),r=jg(i);r||"fixed"!==t.position||(a=null),(o?!r&&!a:!r&&"static"===t.position&&a&&av.has(a.position)||Pg(i)&&!r&&iv(e,i))?n=n.filter(e=>e!==i):a=t,i=Kg(i)}return t.set(e,n),n}(t,this._c):[].concat(r),n],i=o[0],s=o.reduce((e,r)=>{const n=ov(t,r,a);return e.top=Zh(n.top,e.top),e.right=Hh(n.right,e.right),e.bottom=Hh(n.bottom,e.bottom),e.left=Zh(n.left,e.left),e},ov(t,i,a));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:dv,getElementRects:async function(e){const t=this.getOffsetParent||dv,r=this.getDimensions,n=await r(e.floating);return{reference:sv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:r}=qg(e);return{width:t,height:r}},getScale:Xg,isElement:_g,isRTL:function(e){return"rtl"===Vg(e).direction}};function fv(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pv(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:c=!1}=n,l=Yg(e),d=a||o?[...l?Zg(l):[],...Zg(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});const u=l&&s?function(e,t){let r,n=null;const a=Cg(e);function o(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function i(s,c){void 0===s&&(s=!1),void 0===c&&(c=1),o();const l=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=l;if(s||t(),!f||!p)return;const m={rootMargin:-qh(u)+"px "+-qh(a.clientWidth-(d+f))+"px "+-qh(a.clientHeight-(u+p))+"px "+-qh(d)+"px",threshold:Zh(0,Hh(1,c))||1};let h=!0;function g(t){const n=t[0].intersectionRatio;if(n!==c){if(!h)return i();n?i(!1,n):r=setTimeout(()=>{i(!1,1e-7)},1e3)}1!==n||fv(l,e.getBoundingClientRect())||i(),h=!1}try{n=new IntersectionObserver(g,{...m,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),o}(l,r):null;let f,p=-1,m=null;i&&(m=new ResizeObserver(e=>{let[n]=e;n&&n.target===l&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),r()}),l&&!c&&m.observe(l),m.observe(t));let h=c?tv(e):null;return c&&function t(){const n=tv(e);h&&!fv(h,n)&&r();h=n,f=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==u||u(),null==(e=m)||e.disconnect(),m=null,c&&cancelAnimationFrame(f)}}const mv=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:o,placement:i,middlewareData:s}=t,c=await async function(e,t){const{placement:r,platform:n,elements:a}=e,o=await(null==n.isRTL?void 0:n.isRTL(a.floating)),i=rg(r),s=ng(r),c="y"===sg(r),l=xg.has(i)?-1:1,d=o&&c?-1:1,u=tg(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&"number"==typeof m&&(p="end"===s?-1*m:m),c?{x:p*d,y:f*l}:{x:f*l,y:p*d}}(t,e);return i===(null==(r=s.offset)?void 0:r.placement)&&null!=(n=s.arrow)&&n.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:{...c,placement:i}}}}},hv=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=tg(e,t),l={x:r,y:n},d=await bg(t,c),u=sg(rg(a)),f=ag(u);let p=l[f],m=l[u];if(o){const e="y"===f?"bottom":"right";p=eg(p+d["y"===f?"top":"left"],p,p-d[e])}if(i){const e="y"===u?"bottom":"right";m=eg(m+d["y"===u?"top":"left"],m,m-d[e])}const h=s.fn({...t,[f]:p,[u]:m});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[f]:o,[u]:i}}}}}},gv=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:o,rects:i,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=tg(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const v=rg(a),y=sg(s),b=rg(s)===s,w=await(null==c.isRTL?void 0:c.isRTL(l.floating)),S=f||(b||!h?[hg(s)]:function(e){const t=hg(e);return[lg(e),t,lg(t)]}(s)),x="none"!==m;!f&&x&&S.push(...mg(s,h,m,w));const k=[s,...S],A=await bg(t,g),E=[];let C=(null==(n=o.flip)?void 0:n.overflows)||[];if(d&&E.push(A[v]),u){const e=function(e,t,r){void 0===r&&(r=!1);const n=ng(e),a=cg(e),o=og(a);let i="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=hg(i)),[i,hg(i)]}(a,i,w);E.push(A[e[0]],A[e[1]])}if(C=[...C,{placement:a,overflows:E}],!E.every(e=>e<=0)){var T,_;const e=((null==(T=o.flip)?void 0:T.index)||0)+1,t=k[e];if(t){if(!("alignment"===u&&y!==sg(t))||C.every(e=>sg(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:C},reset:{placement:t}}}let r=null==(_=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:_.placement;if(!r)switch(p){case"bestFit":{var N;const e=null==(N=C.filter(e=>{if(x){const t=sg(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:N[0];e&&(r=e);break}case"initialPlacement":r=s}if(a!==r)return{reset:{placement:r}}}return{}}}},vv=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:o,platform:i,elements:s}=t,{apply:c=()=>{},...l}=tg(e,t),d=await bg(t,l),u=rg(a),f=ng(a),p="y"===sg(a),{width:m,height:h}=o.floating;let g,v;"top"===u||"bottom"===u?(g=u,v=f===(await(null==i.isRTL?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(v=u,g="end"===f?"top":"bottom");const y=h-d.top-d.bottom,b=m-d.left-d.right,w=Hh(h-d[g],y),S=Hh(m-d[v],b),x=!t.middlewareData.shift;let k=w,A=S;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(A=b),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(k=y),x&&!f){const e=Zh(d.left,0),t=Zh(d.right,0),r=Zh(d.top,0),n=Zh(d.bottom,0);p?A=m-2*(0!==e||0!==t?e+t:Zh(d.left,d.right)):k=h-2*(0!==r||0!==n?r+n:Zh(d.top,d.bottom))}await c({...t,availableWidth:A,availableHeight:k});const E=await i.getDimensions(s.floating);return m!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}},yv=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...a}=tg(e,t);switch(n){case"referenceHidden":{const e=wg(await bg(t,{...a,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Sg(e)}}}case"escaped":{const e=wg(await bg(t,{...a,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:Sg(e)}}}default:return{}}}}},bv=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:o,platform:i,elements:s,middlewareData:c}=t,{element:l,padding:d=0}=tg(e,t)||{};if(null==l)return{};const u=gg(d),f={x:r,y:n},p=cg(a),m=og(p),h=await i.getDimensions(l),g="y"===p,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",w=o.reference[m]+o.reference[p]-f[p]-o.floating[m],S=f[p]-o.reference[p],x=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l));let k=x?x[b]:0;k&&await(null==i.isElement?void 0:i.isElement(x))||(k=s.floating[b]||o.floating[m]);const A=w/2-S/2,E=k/2-h[m]/2-1,C=Hh(u[v],E),T=Hh(u[y],E),_=C,N=k-h[m]-T,R=k/2-h[m]/2+A,O=eg(_,R,N),P=!c.arrow&&null!=ng(a)&&R!==O&&o.reference[m]/2-(R<_?C:T)-h[m]/2<0,D=P?R<_?R-_:R-N:0;return{[p]:f[p]+D,data:{[p]:O,centerOffset:R-O-D,...P&&{alignmentOffset:D}},reset:P}}}),wv=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:o,middlewareData:i}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=tg(e,t),d={x:r,y:n},u=sg(a),f=ag(u);let p=d[f],m=d[u];const h=tg(s,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const e="y"===f?"height":"width",t=o.reference[f]-o.floating[e]+g.mainAxis,r=o.reference[f]+o.reference[e]-g.mainAxis;p<t?p=t:p>r&&(p=r)}if(l){var v,y;const e="y"===f?"width":"height",t=xg.has(rg(a)),r=o.reference[u]-o.floating[e]+(t&&(null==(v=i.offset)?void 0:v[u])||0)+(t?0:g.crossAxis),n=o.reference[u]+o.reference[e]+(t?0:(null==(y=i.offset)?void 0:y[u])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:p,[u]:m}}}},Sv=(e,t,r)=>{const n=new Map,a={platform:uv,...r},o={...a.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:o=[],platform:i}=r,s=o.filter(Boolean),c=await(null==i.isRTL?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=yg(l,n,c),f=n,p={},m=0;for(let r=0;r<s.length;r++){const{name:o,fn:h}=s[r],{x:g,y:v,data:y,reset:b}=await h({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:p,rects:l,platform:i,elements:{reference:e,floating:t}});d=null!=g?g:d,u=null!=v?v:u,p={...p,[o]:{...p[o],...y}},b&&m<=50&&(m++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(l=!0===b.rects?await i.getElementRects({reference:e,floating:t,strategy:a}):b.rects),({x:d,y:u}=yg(l,f,c))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:o})};var xv="undefined"!=typeof document?h:function(){};function kv(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;0!==n--;)if(!kv(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;0!==n--;){const r=a[n];if(("_owner"!==r||!e.$$typeof)&&!kv(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function Av(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ev(e,t){const r=Av(e);return Math.round(t*r)/r}function Cv(e){const t=n.useRef(e);return xv(()=>{t.current=e}),t}const Tv=e=>({name:"arrow",options:e,fn(t){const{element:r,padding:n}="function"==typeof e?e(t):e;return r&&(a=r,{}.hasOwnProperty.call(a,"current"))?null!=r.current?bv({element:r.current,padding:n}).fn(t):{}:r?bv({element:r,padding:n}).fn(t):{};var a}}),_v=(e,t)=>({...mv(e),options:[e,t]}),Nv=(e,t)=>({...hv(e),options:[e,t]}),Rv=(e,t)=>({...wv(e),options:[e,t]}),Ov=(e,t)=>({...gv(e),options:[e,t]}),Pv=(e,t)=>({...vv(e),options:[e,t]}),Dv=(e,t)=>({...yv(e),options:[e,t]}),Iv=(e,t)=>({...Tv(e),options:[e,t]});var Uv=n.forwardRef((e,r)=>{const{children:n,width:a=10,height:o=5,...i}=e;return t(ml.svg,{...i,ref:r,width:a,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:t("polygon",{points:"0,0 30,0 15,10"})})});Uv.displayName="Arrow";var Mv=Uv,zv="Popper",[Lv,Fv]=al(zv),[jv,$v]=Lv(zv),Bv=e=>{const{__scopePopper:r,children:a}=e,[o,i]=n.useState(null);return t(jv,{scope:r,anchor:o,onAnchorChange:i,children:a})};Bv.displayName=zv;var Wv="PopperAnchor",Vv=n.forwardRef((e,r)=>{const{__scopePopper:a,virtualRef:o,...i}=e,s=$v(Wv,a),c=n.useRef(null),l=Xi(r,c),d=n.useRef(null);return n.useEffect(()=>{const e=d.current;d.current=o?.current||c.current,e!==d.current&&s.onAnchorChange(d.current)}),o?null:t(ml.div,{...i,ref:l})});Vv.displayName=Wv;var Gv="PopperContent",[Kv,Hv]=Lv(Gv),Zv=n.forwardRef((e,r)=>{const{__scopePopper:a,side:o="bottom",sideOffset:i=0,align:s="center",alignOffset:c=0,arrowPadding:l=0,avoidCollisions:d=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:g,...y}=e,b=$v(Gv,a),[w,S]=n.useState(null),x=Xi(r,e=>S(e)),[k,A]=n.useState(null),E=_f(k),C=E?.width??0,T=E?.height??0,_=o+("center"!==s?"-"+s:""),N="number"==typeof f?f:{top:0,right:0,bottom:0,left:0,...f},R=Array.isArray(u)?u:[u],O=R.length>0,P={padding:N,boundary:R.filter(Xv),altBoundary:O},{refs:D,floatingStyles:I,placement:U,isPositioned:M,middlewareData:z}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:o,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:l,open:d}=e,[u,f]=n.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=n.useState(a);kv(p,a)||m(a);const[h,g]=n.useState(null),[y,b]=n.useState(null),w=n.useCallback(e=>{e!==A.current&&(A.current=e,g(e))},[]),S=n.useCallback(e=>{e!==E.current&&(E.current=e,b(e))},[]),x=i||h,k=s||y,A=n.useRef(null),E=n.useRef(null),C=n.useRef(u),T=null!=l,_=Cv(l),N=Cv(o),R=Cv(d),O=n.useCallback(()=>{if(!A.current||!E.current)return;const e={placement:t,strategy:r,middleware:p};N.current&&(e.platform=N.current),Sv(A.current,E.current,e).then(e=>{const t={...e,isPositioned:!1!==R.current};P.current&&!kv(C.current,t)&&(C.current=t,v.flushSync(()=>{f(t)}))})},[p,t,r,N,R]);xv(()=>{!1===d&&C.current.isPositioned&&(C.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[d]);const P=n.useRef(!1);xv(()=>(P.current=!0,()=>{P.current=!1}),[]),xv(()=>{if(x&&(A.current=x),k&&(E.current=k),x&&k){if(_.current)return _.current(x,k,O);O()}},[x,k,O,_,T]);const D=n.useMemo(()=>({reference:A,floating:E,setReference:w,setFloating:S}),[w,S]),I=n.useMemo(()=>({reference:x,floating:k}),[x,k]),U=n.useMemo(()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=Ev(I.floating,u.x),n=Ev(I.floating,u.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...Av(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,c,I.floating,u.x,u.y]);return n.useMemo(()=>({...u,update:O,refs:D,elements:I,floatingStyles:U}),[u,O,D,I,U])}({strategy:"fixed",placement:_,whileElementsMounted:(...e)=>pv(...e,{animationFrame:"always"===h}),elements:{reference:b.anchor},middleware:[_v({mainAxis:i+T,alignmentAxis:c}),d&&Nv({mainAxis:!0,crossAxis:!1,limiter:"partial"===p?Rv():void 0,...P}),d&&Ov({...P}),Pv({...P,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const{width:a,height:o}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${r}px`),i.setProperty("--radix-popper-available-height",`${n}px`),i.setProperty("--radix-popper-anchor-width",`${a}px`),i.setProperty("--radix-popper-anchor-height",`${o}px`)}}),k&&Iv({element:k,padding:l}),Qv({arrowWidth:C,arrowHeight:T}),m&&Dv({strategy:"referenceHidden",...P})]}),[L,F]=ey(U),j=Zi(g);Ji(()=>{M&&j?.()},[M,j]);const $=z.arrow?.x,B=z.arrow?.y,W=0!==z.arrow?.centerOffset,[V,G]=n.useState();return Ji(()=>{w&&G(window.getComputedStyle(w).zIndex)},[w]),t("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:M?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(" "),...z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t(Kv,{scope:a,placedSide:L,onArrowChange:A,arrowX:$,arrowY:B,shouldHideArrow:W,children:t(ml.div,{"data-side":L,"data-align":F,...y,ref:x,style:{...y.style,animation:M?void 0:"none"}})})})});Zv.displayName=Gv;var Jv="PopperArrow",qv={top:"bottom",right:"left",bottom:"top",left:"right"},Yv=n.forwardRef(function(e,r){const{__scopePopper:n,...a}=e,o=Hv(Jv,n),i=qv[o.placedSide];return t("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:t(Mv,{...a,ref:r,style:{...a.style,display:"block"}})})});function Xv(e){return null!==e}Yv.displayName=Jv;var Qv=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,o=0!==a.arrow?.centerOffset,i=o?0:e.arrowWidth,s=o?0:e.arrowHeight,[c,l]=ey(r),d={start:"0%",center:"50%",end:"100%"}[l],u=(a.arrow?.x??0)+i/2,f=(a.arrow?.y??0)+s/2;let p="",m="";return"bottom"===c?(p=o?d:`${u}px`,m=-s+"px"):"top"===c?(p=o?d:`${u}px`,m=`${n.floating.height+s}px`):"right"===c?(p=-s+"px",m=o?d:`${f}px`):"left"===c&&(p=`${n.floating.width+s}px`,m=o?d:`${f}px`),{data:{x:p,y:m}}}});function ey(e){const[t,r="center"]=e.split("-");return[t,r]}var ty=Bv,ry=Vv,ny=Zv,ay=Yv;function oy(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?Yi(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var iy=Symbol("radix.slottable");function sy(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===iy}var cy="Popover",[ly]=al(cy,[Fv]),dy=Fv(),[uy,fy]=ly(cy),py=e=>{const{__scopePopover:r,children:a,open:o,defaultOpen:i,onOpenChange:s,modal:c=!1}=e,l=dy(r),d=n.useRef(null),[u,f]=n.useState(!1),[p,m]=dl({prop:o,defaultProp:i??!1,onChange:s,caller:cy});return t(ty,{...l,children:t(uy,{scope:r,contentId:cl(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:n.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:n.useCallback(()=>f(!0),[]),onCustomAnchorRemove:n.useCallback(()=>f(!1),[]),modal:c,children:a})})};py.displayName=cy;var my="PopoverAnchor";n.forwardRef((e,r)=>{const{__scopePopover:a,...o}=e,i=fy(my,a),s=dy(a),{onCustomAnchorAdd:c,onCustomAnchorRemove:l}=i;return n.useEffect(()=>(c(),()=>l()),[c,l]),t(ry,{...s,...o,ref:r})}).displayName=my;var hy="PopoverTrigger",gy=n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=fy(hy,n),i=dy(n),s=Xi(r,o.triggerRef),c=t(ml.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":_y(o.open),...a,ref:s,onClick:nl(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?c:t(ry,{asChild:!0,...i,children:c})});gy.displayName=hy;var vy="PopoverPortal",[yy,by]=ly(vy,{forceMount:void 0}),wy=e=>{const{__scopePopover:r,forceMount:n,children:a,container:o}=e,i=fy(vy,r);return t(yy,{scope:r,forceMount:n,children:t(Il,{present:n||i.open,children:t(Dl,{asChild:!0,container:o,children:a})})})};wy.displayName=vy;var Sy="PopoverContent",xy=n.forwardRef((e,r)=>{const n=by(Sy,e.__scopePopover),{forceMount:a=n.forceMount,...o}=e,i=fy(Sy,e.__scopePopover);return t(Il,{present:a||i.open,children:i.modal?t(Ay,{...o,ref:r}):t(Ey,{...o,ref:r})})});xy.displayName=Sy;var ky=function(e){const r=oy(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(sy);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}("PopoverContent.RemoveScroll"),Ay=n.forwardRef((e,r)=>{const a=fy(Sy,e.__scopePopover),o=n.useRef(null),i=Xi(r,o),s=n.useRef(!1);return n.useEffect(()=>{const e=o.current;if(e)return Pd(e)},[]),t(Ed,{as:ky,allowPinchZoom:!0,children:t(Cy,{...e,ref:i,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:nl(e.onCloseAutoFocus,e=>{e.preventDefault(),s.current||a.triggerRef.current?.focus()}),onPointerDownOutside:nl(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;s.current=n},{checkForDefaultPrevented:!1}),onFocusOutside:nl(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Ey=n.forwardRef((e,r)=>{const a=fy(Sy,e.__scopePopover),o=n.useRef(!1),i=n.useRef(!1);return t(Cy,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||a.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));const r=t.target,n=a.triggerRef.current?.contains(r);n&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),Cy=n.forwardRef((e,r)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:u,...f}=e,p=fy(Sy,n),m=dy(n);return zl(),t(Cl,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:i,children:t(wl,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:t(ny,{"data-state":_y(p.open),role:"dialog",id:p.contentId,...m,...f,ref:r,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Ty="PopoverClose";n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=fy(Ty,n);return t(ml.button,{type:"button",...a,ref:r,onClick:nl(e.onClick,()=>o.onOpenChange(!1))})}).displayName=Ty;function _y(e){return e?"open":"closed"}n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=dy(n);return t(ay,{...o,...a,ref:r})}).displayName="PopoverArrow";var Ny=wy,Ry=xy;const Oy=py,Py=gy,Dy=n.forwardRef(({className:e,align:r="center",sideOffset:a=4,...o},i)=>{const{container:s}=n.useContext(ke);return t(Ny,{container:s,children:t(Ry,{ref:i,align:r,sideOffset:a,className:Zc("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})})});Dy.displayName=Ry.displayName;const Iy={USD:"$",EUR:"€",JPY:"¥",GBP:"£",AUD:"A$",CAD:"C$",CHF:"CHF",CNY:"¥",SEK:"kr",NZD:"NZ$",INR:"₹",RUB:"₽",KRW:"₩",BRL:"R$",ZAR:"R",HKD:"HK$",SGD:"S$",MXN:"Mex$",NOK:"kr",TRY:"₺",IDR:"Rp",PLN:"zł",THB:"฿",ILS:"₪",PHP:"₱",MYR:"RM",CZK:"Kč",HUF:"Ft",DKK:"kr",PKR:"₨",EGP:"£",NGN:"₦",BDT:"৳",UAH:"₴",KZT:"₸",VND:"₫",ARS:"$",BGN:"лв",COP:"COL$",HRK:"kn",ISK:"kr",KES:"KSh",LKR:"Rs",MAD:"د.م.",MNT:"₮",NPR:"रू",RSD:"дин.",SAR:"ر.س",TWD:"NT$",UYU:"$U",YER:"﷼",FJD:"FJ$",JMD:"J$",HTG:"G",BHD:"ب.د",KWD:"د.ك",OMR:"ر.ع.",BND:"B$",KPW:"₩",GHS:"₵",SYP:"ل.س",SLL:"Le",SSP:"£",AFN:"؋",MGA:"Ar",MDL:"lei",FOK:"kr",GMD:"D",LTL:"Lt",LVL:"Ls",HNL:"L",GEL:"₾",BMD:"$",AWG:"Afl",BTN:"Nu",GTQ:"Q",TZS:"TSh",BBD:"Bds$",NAD:"N$",BZD:"$",JEP:"£",WST:"T",PGK:"K",KGS:"лв",AZN:"₼",QAR:"ر.ق",XOF:"CFA",XPF:"CFP"},Uy={AF:"AFN",AX:"EUR",AL:"ALL",DZ:"DZD",AS:"USD",AD:"EUR",AO:"AOA",AI:"XCD",AQ:"USD",AG:"XCD",AR:"ARS",AM:"AMD",AW:"AWG",AU:"AUD",AT:"EUR",AZ:"AZN",BS:"BSD",BH:"BHD",BD:"BDT",BB:"BBD",BY:"BYN",BE:"EUR",BZ:"BZD",BJ:"XOF",BM:"BMD",BT:"BTN",BO:"BOB",BA:"BAM",BW:"BWP",BV:"NOK",BR:"BRL",IO:"USD",BN:"BND",BG:"BGN",BF:"XOF",BI:"BIF",KH:"KHR",CM:"XAF",CA:"CAD",CV:"CVE",KY:"KYD",CF:"XAF",TD:"XAF",CL:"CLP",CN:"CNY",CX:"AUD",CC:"AUD",CO:"COP",KM:"KMF",CG:"XAF",CD:"CDF",CK:"NZD",CR:"CRC",CI:"XOF",HR:"HRK",CU:"CUP",CY:"EUR",CZ:"CZK",DK:"DKK",DJ:"DJF",DM:"XCD",DO:"DOP",EC:"USD",EG:"EGP",SV:"USD",GQ:"XAF",ER:"ERN",EE:"EUR",ET:"ETB",FK:"FKP",FO:"DKK",FJ:"FJD",FI:"EUR",FR:"EUR",GF:"EUR",PF:"XPF",TF:"EUR",GA:"XAF",GM:"GMD",GE:"GEL",DE:"EUR",GH:"GHS",GI:"GIP",GR:"EUR",GL:"DKK",GD:"XCD",GP:"EUR",GU:"USD",GT:"GTQ",GG:"GBP",GN:"GNF",GW:"XOF",GY:"GYD",HT:"HTG",HM:"AUD",VA:"EUR",HN:"HNL",HK:"HKD",HU:"HUF",IS:"ISK",IN:"INR",ID:"IDR",IR:"IRR",IQ:"IQD",IE:"EUR",IM:"GBP",IL:"ILS",IT:"EUR",JM:"JMD",JP:"JPY",JE:"GBP",JO:"JOD",KZ:"KZT",KE:"KES",KI:"AUD",KP:"KPW",KR:"KRW",KW:"KWD",KG:"KGS",LA:"LAK",LV:"EUR",LB:"LBP",LS:"LSL",LR:"LRD",LY:"LYD",LI:"CHF",LT:"EUR",LU:"EUR",MO:"MOP",MK:"MKD",MG:"MGA",MW:"MWK",MY:"MYR",MV:"MVR",ML:"XOF",MT:"EUR",MH:"USD",MQ:"EUR",MR:"MRU",MU:"MUR",YT:"EUR",MX:"MXN",FM:"USD",MD:"MDL",MC:"EUR",MN:"MNT",ME:"EUR",MS:"XCD",MA:"MAD",MZ:"MZN",MM:"MMK",NA:"NAD",NR:"AUD",NP:"NPR",NL:"EUR",AN:"ANG",NC:"XPF",NZ:"NZD",NI:"NIO",NE:"XOF",NG:"NGN",NU:"NZD",NF:"AUD",MP:"USD",NO:"NOK",OM:"OMR",PK:"PKR",PW:"USD",PS:"ILS",PA:"PAB",PG:"PGK",PY:"PYG",PE:"PEN",PH:"PHP",PN:"NZD",PL:"PLN",PT:"EUR",PR:"USD",QA:"QAR",RE:"EUR",RO:"RON",RU:"RUB",RW:"RWF",SH:"SHP",KN:"XCD",LC:"XCD",PM:"EUR",VC:"XCD",WS:"WST",SM:"EUR",ST:"STN",SA:"SAR",SN:"XOF",RS:"RSD",SC:"SCR",SL:"SLL",SG:"SGD",SK:"EUR",SI:"EUR",SB:"SBD",SO:"SOS",ZA:"ZAR",GS:"GBP",ES:"EUR",LK:"LKR",SD:"SDG",SR:"SRD",SJ:"NOK",SZ:"SZL",SE:"SEK",CH:"CHF",SY:"SYP",TW:"TWD",TJ:"TJS",TZ:"TZS",TH:"THB"},My=[{name:"Afghanistan",code:"AF"},{name:"land Islands",code:"AX"},{name:"Albania",code:"AL"},{name:"Algeria",code:"DZ"},{name:"American Samoa",code:"AS"},{name:"AndorrA",code:"AD"},{name:"Angola",code:"AO"},{name:"Anguilla",code:"AI"},{name:"Antarctica",code:"AQ"},{name:"Antigua and Barbuda",code:"AG"},{name:"Argentina",code:"AR"},{name:"Armenia",code:"AM"},{name:"Aruba",code:"AW"},{name:"Australia",code:"AU"},{name:"Austria",code:"AT"},{name:"Azerbaijan",code:"AZ"},{name:"Bahamas",code:"BS"},{name:"Bahrain",code:"BH"},{name:"Bangladesh",code:"BD"},{name:"Barbados",code:"BB"},{name:"Belarus",code:"BY"},{name:"Belgium",code:"BE"},{name:"Belize",code:"BZ"},{name:"Benin",code:"BJ"},{name:"Bermuda",code:"BM"},{name:"Bhutan",code:"BT"},{name:"Bolivia",code:"BO"},{name:"Bosnia and Herzegovina",code:"BA"},{name:"Botswana",code:"BW"},{name:"Bouvet Island",code:"BV"},{name:"Brazil",code:"BR"},{name:"British Indian Ocean Territory",code:"IO"},{name:"Brunei Darussalam",code:"BN"},{name:"Bulgaria",code:"BG"},{name:"Burkina Faso",code:"BF"},{name:"Burundi",code:"BI"},{name:"Cambodia",code:"KH"},{name:"Cameroon",code:"CM"},{name:"Canada",code:"CA"},{name:"Cape Verde",code:"CV"},{name:"Cayman Islands",code:"KY"},{name:"Central African Republic",code:"CF"},{name:"Chad",code:"TD"},{name:"Chile",code:"CL"},{name:"China",code:"CN"},{name:"Christmas Island",code:"CX"},{name:"Cocos (Keeling) Islands",code:"CC"},{name:"Colombia",code:"CO"},{name:"Comoros",code:"KM"},{name:"Congo",code:"CG"},{name:"Congo, The Democratic Republic of the",code:"CD"},{name:"Cook Islands",code:"CK"},{name:"Costa Rica",code:"CR"},{name:"Cote D Ivoire",code:"CI"},{name:"Croatia",code:"HR"},{name:"Cuba",code:"CU"},{name:"Cyprus",code:"CY"},{name:"Czech Republic",code:"CZ"},{name:"Denmark",code:"DK"},{name:"Djibouti",code:"DJ"},{name:"Dominica",code:"DM"},{name:"Dominican Republic",code:"DO"},{name:"Ecuador",code:"EC"},{name:"Egypt",code:"EG"},{name:"El Salvador",code:"SV"},{name:"Equatorial Guinea",code:"GQ"},{name:"Eritrea",code:"ER"},{name:"Estonia",code:"EE"},{name:"Ethiopia",code:"ET"},{name:"Falkland Islands (Malvinas)",code:"FK"},{name:"Faroe Islands",code:"FO"},{name:"Fiji",code:"FJ"},{name:"Finland",code:"FI"},{name:"France",code:"FR"},{name:"French Guiana",code:"GF"},{name:"French Polynesia",code:"PF"},{name:"French Southern Territories",code:"TF"},{name:"Gabon",code:"GA"},{name:"Gambia",code:"GM"},{name:"Georgia",code:"GE"},{name:"Germany",code:"DE"},{name:"Ghana",code:"GH"},{name:"Gibraltar",code:"GI"},{name:"Greece",code:"GR"},{name:"Greenland",code:"GL"},{name:"Grenada",code:"GD"},{name:"Guadeloupe",code:"GP"},{name:"Guam",code:"GU"},{name:"Guatemala",code:"GT"},{name:"Guernsey",code:"GG"},{name:"Guinea",code:"GN"},{name:"Guinea-Bissau",code:"GW"},{name:"Guyana",code:"GY"},{name:"Haiti",code:"HT"},{name:"Heard Island and Mcdonald Islands",code:"HM"},{name:"Holy See (Vatican City State)",code:"VA"},{name:"Honduras",code:"HN"},{name:"Hong Kong",code:"HK"},{name:"Hungary",code:"HU"},{name:"Iceland",code:"IS"},{name:"India",code:"IN"},{name:"Indonesia",code:"ID"},{name:"Iran, Islamic Republic Of",code:"IR"},{name:"Iraq",code:"IQ"},{name:"Ireland",code:"IE"},{name:"Isle of Man",code:"IM"},{name:"Israel",code:"IL"},{name:"Italy",code:"IT"},{name:"Jamaica",code:"JM"},{name:"Japan",code:"JP"},{name:"Jersey",code:"JE"},{name:"Jordan",code:"JO"},{name:"Kazakhstan",code:"KZ"},{name:"Kenya",code:"KE"},{name:"Kiribati",code:"KI"},{name:'Korea, Democratic People"S Republic of',code:"KP"},{name:"Korea, Republic of",code:"KR"},{name:"Kuwait",code:"KW"},{name:"Kyrgyzstan",code:"KG"},{name:'Lao People"S Democratic Republic',code:"LA"},{name:"Latvia",code:"LV"},{name:"Lebanon",code:"LB"},{name:"Lesotho",code:"LS"},{name:"Liberia",code:"LR"},{name:"Libyan Arab Jamahiriya",code:"LY"},{name:"Liechtenstein",code:"LI"},{name:"Lithuania",code:"LT"},{name:"Luxembourg",code:"LU"},{name:"Macao",code:"MO"},{name:"Macedonia, The Former Yugoslav Republic of",code:"MK"},{name:"Madagascar",code:"MG"},{name:"Malawi",code:"MW"},{name:"Malaysia",code:"MY"},{name:"Maldives",code:"MV"},{name:"Mali",code:"ML"},{name:"Malta",code:"MT"},{name:"Marshall Islands",code:"MH"},{name:"Martinique",code:"MQ"},{name:"Mauritania",code:"MR"},{name:"Mauritius",code:"MU"},{name:"Mayotte",code:"YT"},{name:"Mexico",code:"MX"},{name:"Micronesia, Federated States of",code:"FM"},{name:"Moldova, Republic of",code:"MD"},{name:"Monaco",code:"MC"},{name:"Mongolia",code:"MN"},{name:"Montenegro",code:"ME"},{name:"Montserrat",code:"MS"},{name:"Morocco",code:"MA"},{name:"Mozambique",code:"MZ"},{name:"Myanmar",code:"MM"},{name:"Namibia",code:"NA"},{name:"Nauru",code:"NR"},{name:"Nepal",code:"NP"},{name:"Netherlands",code:"NL"},{name:"Netherlands Antilles",code:"AN"},{name:"New Caledonia",code:"NC"},{name:"New Zealand",code:"NZ"},{name:"Nicaragua",code:"NI"},{name:"Niger",code:"NE"},{name:"Nigeria",code:"NG"},{name:"Niue",code:"NU"},{name:"Norfolk Island",code:"NF"},{name:"Northern Mariana Islands",code:"MP"},{name:"Norway",code:"NO"},{name:"Oman",code:"OM"},{name:"Pakistan",code:"PK"},{name:"Palau",code:"PW"},{name:"Palestinian Territory, Occupied",code:"PS"},{name:"Panama",code:"PA"},{name:"Papua New Guinea",code:"PG"},{name:"Paraguay",code:"PY"},{name:"Peru",code:"PE"},{name:"Philippines",code:"PH"},{name:"Pitcairn",code:"PN"},{name:"Poland",code:"PL"},{name:"Portugal",code:"PT"},{name:"Puerto Rico",code:"PR"},{name:"Qatar",code:"QA"},{name:"Reunion",code:"RE"},{name:"Romania",code:"RO"},{name:"Russian Federation",code:"RU"},{name:"RWANDA",code:"RW"},{name:"Saint Helena",code:"SH"},{name:"Saint Kitts and Nevis",code:"KN"},{name:"Saint Lucia",code:"LC"},{name:"Saint Pierre and Miquelon",code:"PM"},{name:"Saint Vincent and the Grenadines",code:"VC"},{name:"Samoa",code:"WS"},{name:"San Marino",code:"SM"},{name:"Sao Tome and Principe",code:"ST"},{name:"Saudi Arabia",code:"SA"},{name:"Senegal",code:"SN"},{name:"Serbia",code:"RS"},{name:"Seychelles",code:"SC"},{name:"Sierra Leone",code:"SL"},{name:"Singapore",code:"SG"},{name:"Slovakia",code:"SK"},{name:"Slovenia",code:"SI"},{name:"Solomon Islands",code:"SB"},{name:"Somalia",code:"SO"},{name:"South Africa",code:"ZA"},{name:"South Georgia and the South Sandwich Islands",code:"GS"},{name:"Spain",code:"ES"},{name:"Sri Lanka",code:"LK"},{name:"Sudan",code:"SD"},{name:"Suriname",code:"SR"},{name:"Svalbard and Jan Mayen",code:"SJ"},{name:"Swaziland",code:"SZ"},{name:"Sweden",code:"SE"},{name:"Switzerland",code:"CH"},{name:"Syrian Arab Republic",code:"SY"},{name:"Taiwan, Province of China",code:"TW"},{name:"Tajikistan",code:"TJ"},{name:"Tanzania, United Republic of",code:"TZ"},{name:"Thailand",code:"TH"},{name:"Timor-Leste",code:"TL"},{name:"Togo",code:"TG"},{name:"Tokelau",code:"TK"},{name:"Tonga",code:"TO"},{name:"Trinidad and Tobago",code:"TT"},{name:"Tunisia",code:"TN"},{name:"Turkey",code:"TR"},{name:"Turkmenistan",code:"TM"},{name:"Turks and Caicos Islands",code:"TC"},{name:"Tuvalu",code:"TV"},{name:"Uganda",code:"UG"},{name:"Ukraine",code:"UA"},{name:"United Arab Emirates",code:"AE"},{name:"United Kingdom",code:"GB"},{name:"United States",code:"US"},{name:"United States Minor Outlying Islands",code:"UM"},{name:"Uruguay",code:"UY"},{name:"Uzbekistan",code:"UZ"},{name:"Vanuatu",code:"VU"},{name:"Venezuela",code:"VE"},{name:"Viet Nam",code:"VN"},{name:"Virgin Islands, British",code:"VG"},{name:"Virgin Islands, U.S.",code:"VI"},{name:"Wallis and Futuna",code:"WF"},{name:"Western Sahara",code:"EH"},{name:"Yemen",code:"YE"},{name:"Zambia",code:"ZM"},{name:"Zimbabwe",code:"ZW"}].map(e=>{const t=Uy[e.code]||"USD",r=Iy[t]||"";return{value:e.code,flag:(n=e.code,n.toUpperCase().replace(/./g,e=>String.fromCodePoint(127397+e.charCodeAt(0)))),text:e.name,currencyCode:t,currencyIcon:r};var n});function zy(r){const[n,a]=u(r.value||""),[o,i]=u(!1),s=My.find(e=>e.value==n);return e(Oy,{open:o,onOpenChange:i,children:[t(Py,{asChild:!0,children:e(rl,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[s?.text&&e("div",{children:[String(s.text).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:s.flag})]}),!s&&t("span",{className:"text-muted-foreground",children:"Choose country"}),t(yo,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(Dy,{className:"p-0 overflow-hidden text-ellipsis",children:e($h,{children:[t(Bh,{placeholder:"Choose country..."}),t(Wh,{children:t(Vh,{children:My.map(o=>e(Gh,{className:Zc("whitespace-nowrap text-left",{"text-green-500":n===o.value}),value:o.value,defaultValue:o.value,onSelect:e=>{const t=o.value;a(t),r.onChange&&"function"==typeof r.onChange&&r.onChange(t),i(!1)},children:[n===o.value&&t(vo,{className:Zc("mr-2 h-4 w-4 text-green-400",n===o.value?"opacity-100":"opacity-0")}),String(o.text).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:o.flag})]},o.value))})})]})})]})}const Ly=My.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),Fy=Array.from(new Set(Ly.map(e=>e.value))).map(e=>Ly.find(t=>t.value===e)).filter(e=>void 0!==e);function jy(r){const[n,a]=u(r.value||""),[o,i]=u(!1),s=Fy.find(e=>e.value==n);return e(Oy,{open:o,onOpenChange:i,children:[t(Py,{asChild:!0,children:e(rl,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[s?.text&&e("div",{children:[String(s.text).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:s.icon})]}),!s&&t("span",{className:"text-muted-foreground",children:"Choose Currency"}),t(yo,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(Dy,{className:"p-0 overflow-hidden text-ellipsis",children:e($h,{children:[t(Bh,{placeholder:"Choose currency..."}),t(Wh,{children:t(Vh,{children:Fy.map(o=>e(Gh,{className:Zc("whitespace-nowrap text-left",{"text-green-500":n===o.value}),value:o.value,defaultValue:o.value,onSelect:e=>{const t=o.value;a(t),r.onChange&&"function"==typeof r.onChange&&r.onChange(t),i(!1)},children:[n===o.value&&t(vo,{className:Zc("mr-2 h-4 w-4 text-green-400",n===o.value?"opacity-100":"opacity-0")}),String(o.text).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:o.icon})]},o.value))})})]})})]})}let $y=[{code:"en",label:"English",flag:"🇬🇧"},{code:"en-GB",label:"English (United Kingdom)",flag:"🇬🇧"},{code:"en-US",label:"English (United States)",flag:"🇺🇸"},{code:"en-AU",label:"English (Australia)",flag:"🇦🇺"},{code:"en-CA",label:"English (Canada)",flag:"🇨🇦"},{code:"en-NZ",label:"English (New Zealand)",flag:"🇳🇿"},{code:"es",label:"Spanish",flag:"🇪🇸"},{code:"es-ES",label:"Spanish (Spain)",flag:"🇪🇸"},{code:"es-MX",label:"Spanish (Mexico)",flag:"🇲🇽"},{code:"fr",label:"French",flag:"🇫🇷"},{code:"fr-FR",label:"French (France)",flag:"🇫🇷"},{code:"de",label:"German",flag:"🇩🇪"},{code:"de-DE",label:"German (Germany)",flag:"🇩🇪"},{code:"it",label:"Italian",flag:"🇮🇹"},{code:"it-IT",label:"Italian (Italy)",flag:"🇮🇹"},{code:"pt",label:"Portuguese",flag:"🇵🇹"},{code:"pt-PT",label:"Portuguese (Portugal)",flag:"🇵🇹"},{code:"pt-BR",label:"Portuguese (Brazil)",flag:"🇧🇷"},{code:"ru",label:"Russian",flag:"🇷🇺"},{code:"ru-RU",label:"Russian (Russia)",flag:"🇷🇺"},{code:"zh",label:"Chinese",flag:"🇨🇳"},{code:"zh-CN",label:"Chinese (Simplified)",flag:"🇨🇳"},{code:"zh-TW",label:"Chinese (Traditional)",flag:"🇹🇼"},{code:"ja",label:"Japanese",flag:"🇯🇵"},{code:"ja-JP",label:"Japanese (Japan)",flag:"🇯🇵"},{code:"ko",label:"Korean",flag:"🇰🇷"},{code:"ko-KR",label:"Korean (South Korea)",flag:"🇰🇷"},{code:"ar",label:"Arabic",flag:"🇸🇦"},{code:"ar-SA",label:"Arabic (Saudi Arabia)",flag:"🇸🇦"},{code:"hi",label:"Hindi",flag:"🇮🇳"},{code:"hi-IN",label:"Hindi (India)",flag:"🇮🇳"},{code:"bn",label:"Bengali",flag:"🇮🇳"},{code:"bn-IN",label:"Bengali (India)",flag:"🇮🇳"},{code:"gu",label:"Gujarati",flag:"🇮🇳"},{code:"gu-IN",label:"Gujarati (India)",flag:"🇮🇳"},{code:"ta",label:"Tamil",flag:"🇮🇳"},{code:"ta-IN",label:"Tamil (India)",flag:"🇮🇳"},{code:"te",label:"Telugu",flag:"🇮🇳"},{code:"te-IN",label:"Telugu (India)",flag:"🇮🇳"},{code:"ml",label:"Malayalam",flag:"🇮🇳"},{code:"ml-IN",label:"Malayalam (India)",flag:"🇮🇳"},{code:"kn",label:"Kannada",flag:"🇮🇳"},{code:"kn-IN",label:"Kannada (India)",flag:"🇮🇳"},{code:"mr",label:"Marathi",flag:"🇮🇳"},{code:"mr-IN",label:"Marathi (India)",flag:"🇮🇳"},{code:"pa",label:"Punjabi",flag:"🇮🇳"},{code:"pa-IN",label:"Punjabi (India)",flag:"🇮🇳"},{code:"ur",label:"Urdu",flag:"🇮🇳"},{code:"ur-IN",label:"Urdu (India)",flag:"🇮🇳"},{code:"or",label:"Odia",flag:"🇮🇳"},{code:"or-IN",label:"Odia (India)",flag:"🇮🇳"},{code:"as",label:"Assamese",flag:"🇮🇳"},{code:"as-IN",label:"Assamese (India)",flag:"🇮🇳"},{code:"zh-HK",label:"Chinese (Hong Kong)",flag:"🇭🇰"},{code:"nl",label:"Dutch",flag:"🇳🇱"},{code:"nl-NL",label:"Dutch (Netherlands)",flag:"🇳🇱"},{code:"pl",label:"Polish",flag:"🇵🇱"},{code:"pl-PL",label:"Polish (Poland)",flag:"🇵🇱"},{code:"sv",label:"Swedish",flag:"🇸🇪"},{code:"sv-SE",label:"Swedish (Sweden)",flag:"🇸🇪"},{code:"da",label:"Danish",flag:"🇩🇰"},{code:"da-DK",label:"Danish (Denmark)",flag:"🇩🇰"},{code:"no",label:"Norwegian",flag:"🇳🇴"},{code:"no-NO",label:"Norwegian (Norway)",flag:"🇳🇴"},{code:"fi",label:"Finnish",flag:"🇫🇮"},{code:"fi-FI",label:"Finnish (Finland)",flag:"🇫🇮"},{code:"tr",label:"Turkish",flag:"🇹🇷"},{code:"tr-TR",label:"Turkish (Turkey)",flag:"🇹🇷"},{code:"cs",label:"Czech",flag:"🇨🇿"},{code:"cs-CZ",label:"Czech (Czech Republic)",flag:"🇨🇿"},{code:"sk",label:"Slovak",flag:"🇸🇰"},{code:"sk-SK",label:"Slovak (Slovakia)",flag:"🇸🇰"},{code:"hu",label:"Hungarian",flag:"🇭🇺"},{code:"hu-HU",label:"Hungarian (Hungary)",flag:"🇭🇺"},{code:"ro",label:"Romanian",flag:"🇷🇴"},{code:"ro-RO",label:"Romanian (Romania)",flag:"🇷🇴"},{code:"el",label:"Greek",flag:"🇬🇷"},{code:"el-GR",label:"Greek (Greece)",flag:"🇬🇷"},{code:"th",label:"Thai",flag:"🇹🇭"},{code:"th-TH",label:"Thai (Thailand)",flag:"🇹🇭"},{code:"id",label:"Indonesian",flag:"🇮🇩"},{code:"id-ID",label:"Indonesian (Indonesia)",flag:"🇮🇩"},{code:"ms",label:"Malay",flag:"🇲🇾"},{code:"ms-MY",label:"Malay (Malaysia)",flag:"🇲🇾"},{code:"vi",label:"Vietnamese",flag:"🇻🇳"},{code:"vi-VN",label:"Vietnamese (Vietnam)",flag:"🇻🇳"},{code:"he",label:"Hebrew",flag:"🇮🇱"},{code:"he-IL",label:"Hebrew (Israel)",flag:"🇮🇱"}];$y=$y.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),$y.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const By=$y.filter(e=>function(e){try{const t=new Intl.DateTimeFormat(e);return t.resolvedOptions().locale===e||t.resolvedOptions().locale.startsWith(e)}catch{return!1}}(e.code)).filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)).map(e=>({value:e.code,label:e.label,flag:e.flag}));function Wy(r){const[n,a]=u(r.value||""),[o,i]=u(!1),s=By.find(e=>e.value==n);return e(Oy,{open:o,onOpenChange:i,children:[t(Py,{asChild:!0,children:e(rl,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[s&&e("div",{children:[String(s.label).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:s.flag})]}),!s&&"Choose language",t(yo,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(Dy,{className:"p-0 overflow-hidden text-ellipsis",children:e($h,{children:[t(Bh,{placeholder:"Choose timezone..."}),t(Wh,{children:t(Vh,{children:By.map(o=>e(Gh,{className:Zc("whitespace-nowrap text-left",{"text-green-500":n===o.value}),value:o.value,defaultValue:o.value,onSelect:e=>{const t=o.value;a(t),r.onChange&&"function"==typeof r.onChange&&r.onChange(t),i(!1)},children:[n===o.value&&t(vo,{className:Zc("mr-2 h-4 w-4 text-green-400",n===o.value?"opacity-100":"opacity-0")}),String(o.label).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:o.flag})]},o.value))})})]})})]})}const Vy=[{value:"Dateline Standard Time",abbr:"DST",offset:-12,isdst:!1,text:"(UTC-12:00) International Date Line West",utc:["Etc/GMT+12"]},{value:"UTC-11",abbr:"U",offset:-11,isdst:!1,text:"(UTC-11:00) Coordinated Universal Time-11",utc:["Etc/GMT+11","Pacific/Midway","Pacific/Niue","Pacific/Pago_Pago"]},{value:"Hawaiian Standard Time",abbr:"HST",offset:-10,isdst:!1,text:"(UTC-10:00) Hawaii",utc:["Etc/GMT+10","Pacific/Honolulu","Pacific/Johnston","Pacific/Rarotonga","Pacific/Tahiti"]},{value:"Alaskan Standard Time",abbr:"AKDT",offset:-8,isdst:!0,text:"(UTC-09:00) Alaska",utc:["America/Anchorage","America/Juneau","America/Nome","America/Sitka","America/Yakutat"]},{value:"Pacific Standard Time (Mexico)",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-08:00) Baja California",utc:["America/Santa_Isabel"]},{value:"Pacific Daylight Time",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-07:00) Pacific Daylight Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver"]},{value:"Pacific Standard Time",abbr:"PST",offset:-8,isdst:!1,text:"(UTC-08:00) Pacific Standard Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver","PST8PDT"]},{value:"US Mountain Standard Time",abbr:"UMST",offset:-7,isdst:!1,text:"(UTC-07:00) Arizona",utc:["America/Creston","America/Dawson","America/Dawson_Creek","America/Hermosillo","America/Phoenix","America/Whitehorse","Etc/GMT+7"]},{value:"Mountain Standard Time (Mexico)",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Chihuahua, La Paz, Mazatlan",utc:["America/Chihuahua","America/Mazatlan"]},{value:"Mountain Standard Time",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Mountain Time (US & Canada)",utc:["America/Boise","America/Cambridge_Bay","America/Denver","America/Edmonton","America/Inuvik","America/Ojinaga","America/Yellowknife","MST7MDT"]},{value:"Central America Standard Time",abbr:"CAST",offset:-6,isdst:!1,text:"(UTC-06:00) Central America",utc:["America/Belize","America/Costa_Rica","America/El_Salvador","America/Guatemala","America/Managua","America/Tegucigalpa","Etc/GMT+6","Pacific/Galapagos"]},{value:"Central Standard Time",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Central Time (US & Canada)",utc:["America/Chicago","America/Indiana/Knox","America/Indiana/Tell_City","America/Matamoros","America/Menominee","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Rainy_River","America/Rankin_Inlet","America/Resolute","America/Winnipeg","CST6CDT"]},{value:"Central Standard Time (Mexico)",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Guadalajara, Mexico City, Monterrey",utc:["America/Bahia_Banderas","America/Cancun","America/Merida","America/Mexico_City","America/Monterrey"]},{value:"Canada Central Standard Time",abbr:"CCST",offset:-6,isdst:!1,text:"(UTC-06:00) Saskatchewan",utc:["America/Regina","America/Swift_Current"]},{value:"SA Pacific Standard Time",abbr:"SPST",offset:-5,isdst:!1,text:"(UTC-05:00) Bogota, Lima, Quito",utc:["America/Bogota","America/Cayman","America/Coral_Harbour","America/Eirunepe","America/Guayaquil","America/Jamaica","America/Lima","America/Panama","America/Rio_Branco","Etc/GMT+5"]},{value:"Eastern Standard Time",abbr:"EST",offset:-5,isdst:!1,text:"(UTC-05:00) Eastern Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"Eastern Daylight Time",abbr:"EDT",offset:-4,isdst:!0,text:"(UTC-04:00) Eastern Daylight Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"US Eastern Standard Time",abbr:"UEDT",offset:-5,isdst:!1,text:"(UTC-05:00) Indiana (East)",utc:["America/Indiana/Marengo","America/Indiana/Vevay","America/Indianapolis"]},{value:"Venezuela Standard Time",abbr:"VST",offset:-4.5,isdst:!1,text:"(UTC-04:30) Caracas",utc:["America/Caracas"]},{value:"Paraguay Standard Time",abbr:"PYT",offset:-4,isdst:!1,text:"(UTC-04:00) Asuncion",utc:["America/Asuncion"]},{value:"Atlantic Standard Time",abbr:"ADT",offset:-3,isdst:!0,text:"(UTC-04:00) Atlantic Time (Canada)",utc:["America/Glace_Bay","America/Goose_Bay","America/Halifax","America/Moncton","America/Thule","Atlantic/Bermuda"]},{value:"Central Brazilian Standard Time",abbr:"CBST",offset:-4,isdst:!1,text:"(UTC-04:00) Cuiaba",utc:["America/Campo_Grande","America/Cuiaba"]},{value:"SA Western Standard Time",abbr:"SWST",offset:-4,isdst:!1,text:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan",utc:["America/Anguilla","America/Antigua","America/Aruba","America/Barbados","America/Blanc-Sablon","America/Boa_Vista","America/Curacao","America/Dominica","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guyana","America/Kralendijk","America/La_Paz","America/Lower_Princes","America/Manaus","America/Marigot","America/Martinique","America/Montserrat","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Santo_Domingo","America/St_Barthelemy","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Tortola","Etc/GMT+4"]},{value:"Pacific SA Standard Time",abbr:"PSST",offset:-4,isdst:!1,text:"(UTC-04:00) Santiago",utc:["America/Santiago","Antarctica/Palmer"]},{value:"Newfoundland Standard Time",abbr:"NDT",offset:-2.5,isdst:!0,text:"(UTC-03:30) Newfoundland",utc:["America/St_Johns"]},{value:"E. South America Standard Time",abbr:"ESAST",offset:-3,isdst:!1,text:"(UTC-03:00) Brasilia",utc:["America/Sao_Paulo"]},{value:"Argentina Standard Time",abbr:"AST",offset:-3,isdst:!1,text:"(UTC-03:00) Buenos Aires",utc:["America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Buenos_Aires","America/Catamarca","America/Cordoba","America/Jujuy","America/Mendoza"]},{value:"SA Eastern Standard Time",abbr:"SEST",offset:-3,isdst:!1,text:"(UTC-03:00) Cayenne, Fortaleza",utc:["America/Araguaina","America/Belem","America/Cayenne","America/Fortaleza","America/Maceio","America/Paramaribo","America/Recife","America/Santarem","Antarctica/Rothera","Atlantic/Stanley","Etc/GMT+3"]},{value:"Greenland Standard Time",abbr:"GDT",offset:-3,isdst:!0,text:"(UTC-03:00) Greenland",utc:["America/Godthab"]},{value:"Montevideo Standard Time",abbr:"MST",offset:-3,isdst:!1,text:"(UTC-03:00) Montevideo",utc:["America/Montevideo"]},{value:"Bahia Standard Time",abbr:"BST",offset:-3,isdst:!1,text:"(UTC-03:00) Salvador",utc:["America/Bahia"]},{value:"UTC-02",abbr:"U",offset:-2,isdst:!1,text:"(UTC-02:00) Coordinated Universal Time-02",utc:["America/Noronha","Atlantic/South_Georgia","Etc/GMT+2"]},{value:"Mid-Atlantic Standard Time",abbr:"MDT",offset:-1,isdst:!0,text:"(UTC-02:00) Mid-Atlantic - Old",utc:[]},{value:"Azores Standard Time",abbr:"ADT",offset:0,isdst:!0,text:"(UTC-01:00) Azores",utc:["America/Scoresbysund","Atlantic/Azores"]},{value:"Cape Verde Standard Time",abbr:"CVST",offset:-1,isdst:!1,text:"(UTC-01:00) Cape Verde Is.",utc:["Atlantic/Cape_Verde","Etc/GMT+1"]},{value:"Morocco Standard Time",abbr:"MDT",offset:1,isdst:!0,text:"(UTC) Casablanca",utc:["Africa/Casablanca","Africa/El_Aaiun"]},{value:"UTC",abbr:"UTC",offset:0,isdst:!1,text:"(UTC) Coordinated Universal Time",utc:["America/Danmarkshavn","Etc/GMT"]},{value:"GMT Standard Time",abbr:"GMT",offset:0,isdst:!1,text:"(UTC) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"British Summer Time",abbr:"BST",offset:1,isdst:!0,text:"(UTC+01:00) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"GMT Standard Time",abbr:"GDT",offset:1,isdst:!0,text:"(UTC) Dublin, Lisbon",utc:["Atlantic/Canary","Atlantic/Faeroe","Atlantic/Madeira","Europe/Dublin","Europe/Lisbon"]},{value:"Greenwich Standard Time",abbr:"GST",offset:0,isdst:!1,text:"(UTC) Monrovia, Reykjavik",utc:["Africa/Abidjan","Africa/Accra","Africa/Bamako","Africa/Banjul","Africa/Bissau","Africa/Conakry","Africa/Dakar","Africa/Freetown","Africa/Lome","Africa/Monrovia","Africa/Nouakchott","Africa/Ouagadougou","Africa/Sao_Tome","Atlantic/Reykjavik","Atlantic/St_Helena"]},{value:"W. Europe Standard Time",abbr:"WEDT",offset:2,isdst:!0,text:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",utc:["Arctic/Longyearbyen","Europe/Amsterdam","Europe/Andorra","Europe/Berlin","Europe/Busingen","Europe/Gibraltar","Europe/Luxembourg","Europe/Malta","Europe/Monaco","Europe/Oslo","Europe/Rome","Europe/San_Marino","Europe/Stockholm","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Zurich"]},{value:"Central Europe Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",utc:["Europe/Belgrade","Europe/Bratislava","Europe/Budapest","Europe/Ljubljana","Europe/Podgorica","Europe/Prague","Europe/Tirane"]},{value:"Romance Standard Time",abbr:"RDT",offset:2,isdst:!0,text:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris",utc:["Africa/Ceuta","Europe/Brussels","Europe/Copenhagen","Europe/Madrid","Europe/Paris"]},{value:"Central European Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb",utc:["Europe/Sarajevo","Europe/Skopje","Europe/Warsaw","Europe/Zagreb"]},{value:"W. Central Africa Standard Time",abbr:"WCAST",offset:1,isdst:!1,text:"(UTC+01:00) West Central Africa",utc:["Africa/Algiers","Africa/Bangui","Africa/Brazzaville","Africa/Douala","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Luanda","Africa/Malabo","Africa/Ndjamena","Africa/Niamey","Africa/Porto-Novo","Africa/Tunis","Etc/GMT-1"]},{value:"Namibia Standard Time",abbr:"NST",offset:1,isdst:!1,text:"(UTC+01:00) Windhoek",utc:["Africa/Windhoek"]},{value:"GTB Standard Time",abbr:"GDT",offset:3,isdst:!0,text:"(UTC+02:00) Athens, Bucharest",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau"]},{value:"Middle East Standard Time",abbr:"MEDT",offset:3,isdst:!0,text:"(UTC+02:00) Beirut",utc:["Asia/Beirut"]},{value:"Egypt Standard Time",abbr:"EST",offset:2,isdst:!1,text:"(UTC+02:00) Cairo",utc:["Africa/Cairo"]},{value:"Syria Standard Time",abbr:"SDT",offset:3,isdst:!0,text:"(UTC+02:00) Damascus",utc:["Asia/Damascus"]},{value:"E. Europe Standard Time",abbr:"EEDT",offset:3,isdst:!0,text:"(UTC+02:00) E. Europe",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau","Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Nicosia","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"South Africa Standard Time",abbr:"SAST",offset:2,isdst:!1,text:"(UTC+02:00) Harare, Pretoria",utc:["Africa/Blantyre","Africa/Bujumbura","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Kigali","Africa/Lubumbashi","Africa/Lusaka","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Etc/GMT-2"]},{value:"FLE Standard Time",abbr:"FDT",offset:3,isdst:!0,text:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",utc:["Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"Turkey Standard Time",abbr:"TDT",offset:3,isdst:!1,text:"(UTC+03:00) Istanbul",utc:["Europe/Istanbul"]},{value:"Israel Standard Time",abbr:"JDT",offset:3,isdst:!0,text:"(UTC+02:00) Jerusalem",utc:["Asia/Jerusalem"]},{value:"Libya Standard Time",abbr:"LST",offset:2,isdst:!1,text:"(UTC+02:00) Tripoli",utc:["Africa/Tripoli"]},{value:"Jordan Standard Time",abbr:"JST",offset:3,isdst:!1,text:"(UTC+03:00) Amman",utc:["Asia/Amman"]},{value:"Arabic Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Baghdad",utc:["Asia/Baghdad"]},{value:"Kaliningrad Standard Time",abbr:"KST",offset:3,isdst:!1,text:"(UTC+02:00) Kaliningrad",utc:["Europe/Kaliningrad"]},{value:"Arab Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Kuwait, Riyadh",utc:["Asia/Aden","Asia/Bahrain","Asia/Kuwait","Asia/Qatar","Asia/Riyadh"]},{value:"E. Africa Standard Time",abbr:"EAST",offset:3,isdst:!1,text:"(UTC+03:00) Nairobi",utc:["Africa/Addis_Ababa","Africa/Asmera","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Mogadishu","Africa/Nairobi","Antarctica/Syowa","Etc/GMT-3","Indian/Antananarivo","Indian/Comoro","Indian/Mayotte"]},{value:"Moscow Standard Time",abbr:"MSK",offset:3,isdst:!1,text:"(UTC+03:00) Moscow, St. Petersburg, Volgograd, Minsk",utc:["Europe/Kirov","Europe/Moscow","Europe/Simferopol","Europe/Volgograd","Europe/Minsk"]},{value:"Samara Time",abbr:"SAMT",offset:4,isdst:!1,text:"(UTC+04:00) Samara, Ulyanovsk, Saratov",utc:["Europe/Astrakhan","Europe/Samara","Europe/Ulyanovsk"]},{value:"Iran Standard Time",abbr:"IDT",offset:4.5,isdst:!0,text:"(UTC+03:30) Tehran",utc:["Asia/Tehran"]},{value:"Arabian Standard Time",abbr:"AST",offset:4,isdst:!1,text:"(UTC+04:00) Abu Dhabi, Muscat",utc:["Asia/Dubai","Asia/Muscat","Etc/GMT-4"]},{value:"Azerbaijan Standard Time",abbr:"ADT",offset:5,isdst:!0,text:"(UTC+04:00) Baku",utc:["Asia/Baku"]},{value:"Mauritius Standard Time",abbr:"MST",offset:4,isdst:!1,text:"(UTC+04:00) Port Louis",utc:["Indian/Mahe","Indian/Mauritius","Indian/Reunion"]},{value:"Georgian Standard Time",abbr:"GET",offset:4,isdst:!1,text:"(UTC+04:00) Tbilisi",utc:["Asia/Tbilisi"]},{value:"Caucasus Standard Time",abbr:"CST",offset:4,isdst:!1,text:"(UTC+04:00) Yerevan",utc:["Asia/Yerevan"]},{value:"Afghanistan Standard Time",abbr:"AST",offset:4.5,isdst:!1,text:"(UTC+04:30) Kabul",utc:["Asia/Kabul"]},{value:"West Asia Standard Time",abbr:"WAST",offset:5,isdst:!1,text:"(UTC+05:00) Ashgabat, Tashkent",utc:["Antarctica/Mawson","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Dushanbe","Asia/Oral","Asia/Samarkand","Asia/Tashkent","Etc/GMT-5","Indian/Kerguelen","Indian/Maldives"]},{value:"Yekaterinburg Time",abbr:"YEKT",offset:5,isdst:!1,text:"(UTC+05:00) Yekaterinburg",utc:["Asia/Yekaterinburg"]},{value:"Pakistan Standard Time",abbr:"PKT",offset:5,isdst:!1,text:"(UTC+05:00) Islamabad, Karachi",utc:["Asia/Karachi"]},{value:"India Standard Time",abbr:"IST",offset:5.5,isdst:!1,text:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",utc:["Asia/Kolkata","Asia/Calcutta"]},{value:"Sri Lanka Standard Time",abbr:"SLST",offset:5.5,isdst:!1,text:"(UTC+05:30) Sri Jayawardenepura",utc:["Asia/Colombo"]},{value:"Nepal Standard Time",abbr:"NST",offset:5.75,isdst:!1,text:"(UTC+05:45) Kathmandu",utc:["Asia/Kathmandu"]},{value:"Central Asia Standard Time",abbr:"CAST",offset:6,isdst:!1,text:"(UTC+06:00) Nur-Sultan (Astana)",utc:["Antarctica/Vostok","Asia/Almaty","Asia/Bishkek","Asia/Qyzylorda","Asia/Urumqi","Etc/GMT-6","Indian/Chagos"]},{value:"Bangladesh Standard Time",abbr:"BST",offset:6,isdst:!1,text:"(UTC+06:00) Dhaka",utc:["Asia/Dhaka","Asia/Thimphu"]},{value:"Myanmar Standard Time",abbr:"MST",offset:6.5,isdst:!1,text:"(UTC+06:30) Yangon (Rangoon)",utc:["Asia/Rangoon","Indian/Cocos"]},{value:"SE Asia Standard Time",abbr:"SAST",offset:7,isdst:!1,text:"(UTC+07:00) Bangkok, Hanoi, Jakarta",utc:["Antarctica/Davis","Asia/Bangkok","Asia/Hovd","Asia/Jakarta","Asia/Phnom_Penh","Asia/Pontianak","Asia/Saigon","Asia/Vientiane","Etc/GMT-7","Indian/Christmas"]},{value:"N. Central Asia Standard Time",abbr:"NCAST",offset:7,isdst:!1,text:"(UTC+07:00) Novosibirsk",utc:["Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk"]},{value:"China Standard Time",abbr:"CST",offset:8,isdst:!1,text:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi",utc:["Asia/Hong_Kong","Asia/Macau","Asia/Shanghai"]},{value:"North Asia Standard Time",abbr:"NAST",offset:8,isdst:!1,text:"(UTC+08:00) Krasnoyarsk",utc:["Asia/Krasnoyarsk"]},{value:"Singapore Standard Time",abbr:"MPST",offset:8,isdst:!1,text:"(UTC+08:00) Kuala Lumpur, Singapore",utc:["Asia/Brunei","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Makassar","Asia/Manila","Asia/Singapore","Etc/GMT-8"]},{value:"W. Australia Standard Time",abbr:"WAST",offset:8,isdst:!1,text:"(UTC+08:00) Perth",utc:["Antarctica/Casey","Australia/Perth"]},{value:"Taipei Standard Time",abbr:"TST",offset:8,isdst:!1,text:"(UTC+08:00) Taipei",utc:["Asia/Taipei"]},{value:"Ulaanbaatar Standard Time",abbr:"UST",offset:8,isdst:!1,text:"(UTC+08:00) Ulaanbaatar",utc:["Asia/Choibalsan","Asia/Ulaanbaatar"]},{value:"North Asia East Standard Time",abbr:"NAEST",offset:8,isdst:!1,text:"(UTC+08:00) Irkutsk",utc:["Asia/Irkutsk"]},{value:"Japan Standard Time",abbr:"JST",offset:9,isdst:!1,text:"(UTC+09:00) Osaka, Sapporo, Tokyo",utc:["Asia/Dili","Asia/Jayapura","Asia/Tokyo","Etc/GMT-9","Pacific/Palau"]},{value:"Korea Standard Time",abbr:"KST",offset:9,isdst:!1,text:"(UTC+09:00) Seoul",utc:["Asia/Pyongyang","Asia/Seoul"]},{value:"Cen. Australia Standard Time",abbr:"CAST",offset:9.5,isdst:!1,text:"(UTC+09:30) Adelaide",utc:["Australia/Adelaide","Australia/Broken_Hill"]},{value:"AUS Central Standard Time",abbr:"ACST",offset:9.5,isdst:!1,text:"(UTC+09:30) Darwin",utc:["Australia/Darwin"]},{value:"E. Australia Standard Time",abbr:"EAST",offset:10,isdst:!1,text:"(UTC+10:00) Brisbane",utc:["Australia/Brisbane","Australia/Lindeman"]},{value:"AUS Eastern Standard Time",abbr:"AEST",offset:10,isdst:!1,text:"(UTC+10:00) Canberra, Melbourne, Sydney",utc:["Australia/Melbourne","Australia/Sydney"]},{value:"West Pacific Standard Time",abbr:"WPST",offset:10,isdst:!1,text:"(UTC+10:00) Guam, Port Moresby",utc:["Antarctica/DumontDUrville","Etc/GMT-10","Pacific/Guam","Pacific/Port_Moresby","Pacific/Saipan","Pacific/Truk"]},{value:"Tasmania Standard Time",abbr:"TST",offset:10,isdst:!1,text:"(UTC+10:00) Hobart",utc:["Australia/Currie","Australia/Hobart"]},{value:"Yakutsk Standard Time",abbr:"YST",offset:9,isdst:!1,text:"(UTC+09:00) Yakutsk",utc:["Asia/Chita","Asia/Khandyga","Asia/Yakutsk"]},{value:"Central Pacific Standard Time",abbr:"CPST",offset:11,isdst:!1,text:"(UTC+11:00) Solomon Is., New Caledonia",utc:["Antarctica/Macquarie","Etc/GMT-11","Pacific/Efate","Pacific/Guadalcanal","Pacific/Kosrae","Pacific/Noumea","Pacific/Ponape"]},{value:"Vladivostok Standard Time",abbr:"VST",offset:11,isdst:!1,text:"(UTC+11:00) Vladivostok",utc:["Asia/Sakhalin","Asia/Ust-Nera","Asia/Vladivostok"]},{value:"New Zealand Standard Time",abbr:"NZST",offset:12,isdst:!1,text:"(UTC+12:00) Auckland, Wellington",utc:["Antarctica/McMurdo","Pacific/Auckland"]},{value:"UTC+12",abbr:"U",offset:12,isdst:!1,text:"(UTC+12:00) Coordinated Universal Time+12",utc:["Etc/GMT-12","Pacific/Funafuti","Pacific/Kwajalein","Pacific/Majuro","Pacific/Nauru","Pacific/Tarawa","Pacific/Wake","Pacific/Wallis"]},{value:"Fiji Standard Time",abbr:"FST",offset:12,isdst:!1,text:"(UTC+12:00) Fiji",utc:["Pacific/Fiji"]},{value:"Magadan Standard Time",abbr:"MST",offset:12,isdst:!1,text:"(UTC+12:00) Magadan",utc:["Asia/Anadyr","Asia/Kamchatka","Asia/Magadan","Asia/Srednekolymsk"]},{value:"Kamchatka Standard Time",abbr:"KDT",offset:13,isdst:!0,text:"(UTC+12:00) Petropavlovsk-Kamchatsky - Old",utc:["Asia/Kamchatka"]},{value:"Tonga Standard Time",abbr:"TST",offset:13,isdst:!1,text:"(UTC+13:00) Nuku'alofa",utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]},{value:"Samoa Standard Time",abbr:"SST",offset:13,isdst:!1,text:"(UTC+13:00) Samoa",utc:["Pacific/Apia"]}].filter(e=>e.utc.length).reduce((e,t)=>{let r=t.utc;for(let n=0;n<r.length;n++){const a=r[n],o=t.text;let i=o.substring(o.indexOf("(")+1,o.indexOf(")"));-1!==i.indexOf("UTC")&&e.push({value:a,abbr:t.abbr,offset:t.offset,isdst:t.isdst,text:`(${i}) ${a}`,utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]})}return e},[]).filter((e,t,r)=>t===r.findIndex(t=>t.value===e.value));function Gy(r){const[n,a]=u(r.value||""),[o,i]=u(!1),s=Vy.find(e=>e.value==n);return e(Oy,{open:o,onOpenChange:i,children:[t(Py,{asChild:!0,children:e(rl,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[s?.text||"Choose timezone",t(yo,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(Dy,{className:"p-0 overflow-hidden text-ellipsis",children:e($h,{children:[t(Bh,{placeholder:"Choose timezone..."}),t(Wh,{children:t(Vh,{children:Vy.map(o=>e(Gh,{className:Zc("whitespace-nowrap text-left",{"text-green-500":n===o.value}),value:o.value,defaultValue:o.value,onSelect:e=>{const t=o.value;a(t),r.onChange&&"function"==typeof r.onChange&&r.onChange(t),i(!1)},children:[n===o.value&&t(vo,{className:Zc("mr-2 h-4 w-4 text-green-400",n===o.value?"opacity-100":"opacity-0")}),String(o.text).trim()]},o.value))})})]})})]})}const Ky=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=ww(),[o,i]=u(!1),[s,c]=u(),[l,f]=u(0),p=Xt({resolver:so(Ni({name:ri().min(2,{message:"Name must be at least 2 characters."}),country:ri().optional(),timezone:ri().optional(),language:ri().optional(),currency:ri().optional()})),defaultValues:{name:s?.name||"",country:s?.country||"",timezone:s?.timezone||"",language:s?.language||"",currency:s?.currency||""}});return d(()=>{a().then(e=>{c(e),p.setValue("name",e.name),p.setValue("country",e.country),p.setValue("timezone",e.timezone),p.setValue("language",e.language),p.setValue("currency",e.currency)})},[l]),s?e("div",{children:[t("div",{className:"space-y-4",children:t(Gu,{...p,children:e("form",{onSubmit:p.handleSubmit(async function(e){i(!0),await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),i(!1)}),className:"space-y-4",children:[e("div",{children:[t("label",{className:"block text-sm font-medium mb-1",children:"Email"}),t(tf,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:s?.email})]}),t(Hu,{disabled:o,control:p.control,name:"name",render:({field:r})=>e(qu,{children:[t(Yu,{children:"Name"}),t(Xu,{children:t(tf,{...r})}),t(ef,{})]})}),e("div",{className:"flex gap-y-2 my-4 flex-col",children:[e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Language"}),t(Wy,{value:p.getValues("language"),onChange:e=>{p.setValue("language",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Country"}),t(zy,{value:p.getValues("country"),onChange:e=>{p.setValue("country",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Currency"}),t(jy,{value:p.getValues("currency"),onChange:e=>{p.setValue("currency",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Timezone"}),t(Gy,{value:p.getValues("timezone"),onChange:e=>{p.setValue("timezone",e)}})]})]}),e("div",{className:"flex justify-end gap-x-2",children:[t(rl,{type:"submit",progress:o,disabled:o,children:"Save"}),t(rl,{type:"button",variant:"outline",onClick:()=>{f(e=>e+1)},disabled:o,children:"Reset"})]})]})})}),s?.image&&e("div",{children:[t("label",{className:"block text-sm font-medium mb-1",children:"Profile Image"}),t("div",{className:"w-16 h-16 rounded-full overflow-hidden",children:t("img",{src:s.image,alt:s.name,className:"w-full h-full object-cover"})})]})]}):t(zm,{})};function Hy(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?Yi(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Zy=Symbol("radix.slottable");function Jy(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Zy}var qy=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});n.forwardRef((e,r)=>t(ml.span,{...e,ref:r,style:{...qy,...e.style}})).displayName="VisuallyHidden";var Yy=[" ","Enter","ArrowUp","ArrowDown"],Xy=[" ","Enter"],Qy="Select",[eb,tb,rb]=sf(Qy),[nb]=al(Qy,[rb,Fv]),ab=Fv(),[ob,ib]=nb(Qy),[sb,cb]=nb(Qy),lb=r=>{const{__scopeSelect:a,children:o,open:i,defaultOpen:s,onOpenChange:c,value:l,defaultValue:d,onValueChange:u,dir:f,name:p,autoComplete:m,disabled:h,required:g,form:v}=r,y=ab(a),[b,w]=n.useState(null),[S,x]=n.useState(null),[k,A]=n.useState(!1),E=lf(f),[C,T]=dl({prop:i,defaultProp:s??!1,onChange:c,caller:Qy}),[_,N]=dl({prop:l,defaultProp:d,onChange:u,caller:Qy}),R=n.useRef(null),O=!b||(v||!!b.closest("form")),[P,D]=n.useState(new Set),I=Array.from(P).map(e=>e.props.value).join(";");return t(ty,{...y,children:e(ob,{required:g,scope:a,trigger:b,onTriggerChange:w,valueNode:S,onValueNodeChange:x,valueNodeHasChildren:k,onValueNodeHasChildrenChange:A,contentId:cl(),value:_,onValueChange:N,open:C,onOpenChange:T,dir:E,triggerPointerDownPosRef:R,disabled:h,children:[t(eb.Provider,{scope:a,children:t(sb,{scope:r.__scopeSelect,onNativeOptionAdd:n.useCallback(e=>{D(t=>new Set(t).add(e))},[]),onNativeOptionRemove:n.useCallback(e=>{D(t=>{const r=new Set(t);return r.delete(e),r})},[]),children:o})}),O?e(Hb,{"aria-hidden":!0,required:g,tabIndex:-1,name:p,autoComplete:m,value:_,onChange:e=>N(e.target.value),disabled:h,form:v,children:[void 0===_?t("option",{value:""}):null,Array.from(P)]},I):null]})})};lb.displayName=Qy;var db="SelectTrigger",ub=n.forwardRef((e,r)=>{const{__scopeSelect:a,disabled:o=!1,...i}=e,s=ab(a),c=ib(db,a),l=c.disabled||o,d=Xi(r,c.onTriggerChange),u=tb(a),f=n.useRef("touch"),[p,m,h]=Jb(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===c.value),n=qb(t,e,r);void 0!==n&&c.onValueChange(n.value)}),g=e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return t(ry,{asChild:!0,...s,children:t(ml.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Zb(c.value)?"":void 0,...i,ref:d,onClick:nl(i.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:nl(i.onPointerDown,e=>{f.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())}),onKeyDown:nl(i.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||Yy.includes(e.key)&&(g(),e.preventDefault())})})})});ub.displayName=db;var fb="SelectValue",pb=n.forwardRef((e,n)=>{const{__scopeSelect:a,className:o,style:i,children:s,placeholder:c="",...l}=e,d=ib(fb,a),{onValueNodeHasChildrenChange:u}=d,f=void 0!==s,p=Xi(n,d.onValueNodeChange);return Ji(()=>{u(f)},[u,f]),t(ml.span,{...l,ref:p,style:{pointerEvents:"none"},children:Zb(d.value)?t(r,{children:c}):s})});pb.displayName=fb;var mb=n.forwardRef((e,r)=>{const{__scopeSelect:n,children:a,...o}=e;return t(ml.span,{"aria-hidden":!0,...o,ref:r,children:a||"▼"})});mb.displayName="SelectIcon";var hb=e=>t(Dl,{asChild:!0,...e});hb.displayName="SelectPortal";var gb="SelectContent",vb=n.forwardRef((e,r)=>{const a=ib(gb,e.__scopeSelect),[o,i]=n.useState();if(Ji(()=>{i(new DocumentFragment)},[]),!a.open){const r=o;return r?v.createPortal(t(bb,{scope:e.__scopeSelect,children:t(eb.Slot,{scope:e.__scopeSelect,children:t("div",{children:e.children})})}),r):null}return t(xb,{...e,ref:r})});vb.displayName=gb;var yb=10,[bb,wb]=nb(gb),Sb=function(e){const r=Hy(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(Jy);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}("SelectContent.RemoveScroll"),xb=n.forwardRef((e,r)=>{const{__scopeSelect:a,position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:c,side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y,...b}=e,w=ib(gb,a),[S,x]=n.useState(null),[k,A]=n.useState(null),E=Xi(r,e=>x(e)),[C,T]=n.useState(null),[_,N]=n.useState(null),R=tb(a),[O,P]=n.useState(!1),D=n.useRef(!1);n.useEffect(()=>{if(S)return Pd(S)},[S]),zl();const I=n.useCallback(e=>{const[t,...r]=R().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(const r of e){if(r===a)return;if(r?.scrollIntoView({block:"nearest"}),r===t&&k&&(k.scrollTop=0),r===n&&k&&(k.scrollTop=k.scrollHeight),r?.focus(),document.activeElement!==a)return}},[R,k]),U=n.useCallback(()=>I([C,S]),[I,C,S]);n.useEffect(()=>{O&&U()},[O,U]);const{onOpenChange:M,triggerPointerDownPosRef:z}=w;n.useEffect(()=>{if(S){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(z.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(z.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():S.contains(r.target)||M(!1),document.removeEventListener("pointermove",t),z.current=null};return null!==z.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[S,M,z]),n.useEffect(()=>{const e=()=>M(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[M]);const[L,F]=Jb(e=>{const t=R().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=qb(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),j=n.useCallback((e,t,r)=>{const n=!D.current&&!r;(void 0!==w.value&&w.value===t||n)&&(T(e),n&&(D.current=!0))},[w.value]),$=n.useCallback(()=>S?.focus(),[S]),B=n.useCallback((e,t,r)=>{const n=!D.current&&!r;(void 0!==w.value&&w.value===t||n)&&N(e)},[w.value]),W="popper"===o?Ab:kb,V=W===Ab?{side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return t(bb,{scope:a,content:S,viewport:k,onViewportChange:A,itemRefCallback:j,selectedItem:C,onItemLeave:$,itemTextRefCallback:B,focusSelectedItem:U,selectedItemText:_,position:o,isPositioned:O,searchRef:L,children:t(Ed,{as:Sb,allowPinchZoom:!0,children:t(Cl,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:nl(i,e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:t(wl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:t(W,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:e=>e.preventDefault(),...b,...V,onPlaced:()=>P(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:nl(b.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||F(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=R().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>I(t)),e.preventDefault()}})})})})})})});xb.displayName="SelectContentImpl";var kb=n.forwardRef((e,r)=>{const{__scopeSelect:a,onPlaced:o,...i}=e,s=ib(gb,a),c=wb(gb,a),[l,d]=n.useState(null),[u,f]=n.useState(null),p=Xi(r,e=>f(e)),m=tb(a),h=n.useRef(!1),g=n.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:w}=c,S=n.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&v&&y&&b){const e=s.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=s.valueNode.getBoundingClientRect(),n=b.getBoundingClientRect();if("rtl"!==s.dir){const a=n.left-t.left,o=r.left-a,i=e.left-o,s=e.width+i,c=Math.max(s,t.width),d=window.innerWidth-yb,u=rp(o,[yb,Math.max(yb,d-c)]);l.style.minWidth=s+"px",l.style.left=u+"px"}else{const a=t.right-n.right,o=window.innerWidth-r.right-a,i=window.innerWidth-e.right-o,s=e.width+i,c=Math.max(s,t.width),d=window.innerWidth-yb,u=rp(o,[yb,Math.max(yb,d-c)]);l.style.minWidth=s+"px",l.style.right=u+"px"}const a=m(),i=window.innerHeight-2*yb,c=v.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),w=f+p+c+parseInt(d.paddingBottom,10)+g,S=Math.min(5*y.offsetHeight,w),x=window.getComputedStyle(v),k=parseInt(x.paddingTop,10),A=parseInt(x.paddingBottom,10),E=e.top+e.height/2-yb,C=i-E,T=y.offsetHeight/2,_=f+p+(y.offsetTop+T),N=w-_;if(_<=E){const e=a.length>0&&y===a[a.length-1].ref.current;l.style.bottom="0px";const t=u.clientHeight-v.offsetTop-v.offsetHeight,r=_+Math.max(C,T+(e?A:0)+t+g);l.style.height=r+"px"}else{const e=a.length>0&&y===a[0].ref.current;l.style.top="0px";const t=Math.max(E,f+v.offsetTop+(e?k:0)+T)+N;l.style.height=t+"px",v.scrollTop=_-E+v.offsetTop}l.style.margin=`${yb}px 0`,l.style.minHeight=S+"px",l.style.maxHeight=i+"px",o?.(),requestAnimationFrame(()=>h.current=!0)}},[m,s.trigger,s.valueNode,l,u,v,y,b,s.dir,o]);Ji(()=>S(),[S]);const[x,k]=n.useState();Ji(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const A=n.useCallback(e=>{e&&!0===g.current&&(S(),w?.(),g.current=!1)},[S,w]);return t(Eb,{scope:a,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:A,children:t("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x},children:t(ml.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});kb.displayName="SelectItemAlignedPosition";var Ab=n.forwardRef((e,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:o=yb,...i}=e,s=ab(n);return t(ny,{...s,...i,ref:r,align:a,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Ab.displayName="SelectPopperPosition";var[Eb,Cb]=nb(gb,{}),Tb="SelectViewport",_b=n.forwardRef((a,o)=>{const{__scopeSelect:i,nonce:s,...c}=a,l=wb(Tb,i),d=Cb(Tb,i),u=Xi(o,l.onViewportChange),f=n.useRef(0);return e(r,{children:[t("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),t(eb.Slot,{scope:i,children:t(ml.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:nl(c.onScroll,e=>{const t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=d;if(n?.current&&r){const e=Math.abs(f.current-t.scrollTop);if(e>0){const n=window.innerHeight-2*yb,a=parseFloat(r.style.minHeight),o=parseFloat(r.style.height),i=Math.max(a,o);if(i<n){const a=i+e,o=Math.min(n,a),s=a-o;r.style.height=o+"px","0px"===r.style.bottom&&(t.scrollTop=s>0?s:0,r.style.justifyContent="flex-end")}}}f.current=t.scrollTop})})})]})});_b.displayName=Tb;var Nb="SelectGroup",[Rb,Ob]=nb(Nb);n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=cl();return t(Rb,{scope:n,id:o,children:t(ml.div,{role:"group","aria-labelledby":o,...a,ref:r})})}).displayName=Nb;var Pb="SelectLabel",Db=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=Ob(Pb,n);return t(ml.div,{id:o.id,...a,ref:r})});Db.displayName=Pb;var Ib="SelectItem",[Ub,Mb]=nb(Ib),zb=n.forwardRef((e,r)=>{const{__scopeSelect:a,value:o,disabled:i=!1,textValue:s,...c}=e,l=ib(Ib,a),d=wb(Ib,a),u=l.value===o,[f,p]=n.useState(s??""),[m,h]=n.useState(!1),g=Xi(r,e=>d.itemRefCallback?.(e,o,i)),v=cl(),y=n.useRef("touch"),b=()=>{i||(l.onValueChange(o),l.onOpenChange(!1))};if(""===o)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return t(Ub,{scope:a,value:o,disabled:i,textId:v,isSelected:u,onItemTextChange:n.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:t(eb.ItemSlot,{scope:a,value:o,disabled:i,textValue:f,children:t(ml.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...c,ref:g,onFocus:nl(c.onFocus,()=>h(!0)),onBlur:nl(c.onBlur,()=>h(!1)),onClick:nl(c.onClick,()=>{"mouse"!==y.current&&b()}),onPointerUp:nl(c.onPointerUp,()=>{"mouse"===y.current&&b()}),onPointerDown:nl(c.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:nl(c.onPointerMove,e=>{y.current=e.pointerType,i?d.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:nl(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:nl(c.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(Xy.includes(e.key)&&b()," "===e.key&&e.preventDefault())})})})})});zb.displayName=Ib;var Lb="SelectItemText",Fb=n.forwardRef((a,o)=>{const{__scopeSelect:i,className:s,style:c,...l}=a,d=ib(Lb,i),u=wb(Lb,i),f=Mb(Lb,i),p=cb(Lb,i),[m,h]=n.useState(null),g=Xi(o,e=>h(e),f.onItemTextChange,e=>u.itemTextRefCallback?.(e,f.value,f.disabled)),y=m?.textContent,b=n.useMemo(()=>t("option",{value:f.value,disabled:f.disabled,children:y},f.value),[f.disabled,f.value,y]),{onNativeOptionAdd:w,onNativeOptionRemove:S}=p;return Ji(()=>(w(b),()=>S(b)),[w,S,b]),e(r,{children:[t(ml.span,{id:f.textId,...l,ref:g}),f.isSelected&&d.valueNode&&!d.valueNodeHasChildren?v.createPortal(l.children,d.valueNode):null]})});Fb.displayName=Lb;var jb="SelectItemIndicator",$b=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e;return Mb(jb,n).isSelected?t(ml.span,{"aria-hidden":!0,...a,ref:r}):null});$b.displayName=jb;var Bb="SelectScrollUpButton";n.forwardRef((e,r)=>{const a=wb(Bb,e.__scopeSelect),o=Cb(Bb,e.__scopeSelect),[i,s]=n.useState(!1),c=Xi(r,o.onScrollButtonChange);return Ji(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollTop>0;s(e)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),i?t(Vb,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=Bb;var Wb="SelectScrollDownButton";n.forwardRef((e,r)=>{const a=wb(Wb,e.__scopeSelect),o=Cb(Wb,e.__scopeSelect),[i,s]=n.useState(!1),c=Xi(r,o.onScrollButtonChange);return Ji(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,r=Math.ceil(t.scrollTop)<e;s(r)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),i?t(Vb,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=Wb;var Vb=n.forwardRef((e,r)=>{const{__scopeSelect:a,onAutoScroll:o,...i}=e,s=wb("SelectScrollButton",a),c=n.useRef(null),l=tb(a),d=n.useCallback(()=>{null!==c.current&&(window.clearInterval(c.current),c.current=null)},[]);return n.useEffect(()=>()=>d(),[d]),Ji(()=>{const e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),t(ml.div,{"aria-hidden":!0,...i,ref:r,style:{flexShrink:0,...i.style},onPointerDown:nl(i.onPointerDown,()=>{null===c.current&&(c.current=window.setInterval(o,50))}),onPointerMove:nl(i.onPointerMove,()=>{s.onItemLeave?.(),null===c.current&&(c.current=window.setInterval(o,50))}),onPointerLeave:nl(i.onPointerLeave,()=>{d()})})}),Gb=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e;return t(ml.div,{"aria-hidden":!0,...a,ref:r})});Gb.displayName="SelectSeparator";var Kb="SelectArrow";n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=ab(n),i=ib(Kb,n),s=wb(Kb,n);return i.open&&"popper"===s.position?t(ay,{...o,...a,ref:r}):null}).displayName=Kb;var Hb=n.forwardRef(({__scopeSelect:e,value:r,...a},o)=>{const i=n.useRef(null),s=Xi(o,i),c=Nf(r);return n.useEffect(()=>{const e=i.current;if(!e)return;const t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,"value").set;if(c!==r&&n){const t=new Event("change",{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[c,r]),t(ml.select,{...a,style:{...qy,...a.style},ref:s,defaultValue:r})});function Zb(e){return""===e||void 0===e}function Jb(e){const t=Zi(e),r=n.useRef(""),a=n.useRef(0),o=n.useCallback(e=>{const n=r.current+e;t(n),function e(t){r.current=t,window.clearTimeout(a.current),""!==t&&(a.current=window.setTimeout(()=>e(""),1e3))}(n)},[t]),i=n.useCallback(()=>{r.current="",window.clearTimeout(a.current)},[]);return n.useEffect(()=>()=>window.clearTimeout(a.current),[]),[r,o,i]}function qb(e,t,r){const n=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let o=function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(e,Math.max(a,0));1===n.length&&(o=o.filter(e=>e!==r));const i=o.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return i!==r?i:void 0}Hb.displayName="SelectBubbleInput";var Yb=ub,Xb=mb,Qb=hb,ew=vb,tw=_b,rw=Db,nw=zb,aw=Fb,ow=$b,iw=Gb;const sw=lb,cw=n.forwardRef(({className:r,children:n,...a},o)=>e(Yb,{ref:o,className:Zc("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",r),...a,children:[n,t(Xb,{asChild:!0,children:t(Eu,{className:"h-4 w-4 opacity-50"})})]}));cw.displayName=Yb.displayName;const lw=n.forwardRef(({className:e,children:r,position:a="popper",...o},i)=>{const{container:s}=n.useContext(ke);return t(Qb,{container:s,children:t(ew,{ref:i,className:Zc("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===a&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:a,...o,children:t(tw,{className:Zc("p-1","popper"===a&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});lw.displayName=ew.displayName;n.forwardRef(({className:e,...r},n)=>t(rw,{ref:n,className:Zc("px-2 py-1.5 text-sm font-semibold",e),...r})).displayName=rw.displayName;const dw=n.forwardRef(({className:r,children:n,...a},o)=>e(nw,{ref:o,className:Zc("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...a,children:[t("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:t(ow,{children:t(Tu,{className:"h-4 w-4"})})}),t(aw,{children:n})]}));dw.displayName=nw.displayName;n.forwardRef(({className:e,...r},n)=>t(iw,{ref:n,className:Zc("-mx-1 my-1 h-px bg-muted",e),...r})).displayName=iw.displayName;const uw=({workspace:r})=>{const n=ye(e=>e.auth.session?.user||null),[a,o]=u(0),[i,s]=u(!1),[c,l]=u([]),{getUsers:f,removeUser:p,updateUser:m}=ww(),{settings:h}=Hp();d(()=>{r&&(s(!0),f(r._id).then(e=>{l(e)}).catch(e=>{console.error(e)}).finally(()=>{s(!1)}))},[r,a]);const g=()=>{o(e=>e+1)};if(i||!r)return t(zm,{});const v=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},y=c.map(e=>({...e,...v(e.user)})),b=c.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,w="admin"===b,S=(h?.workspace.maxWorkspaceUsers??Number.MAX_VALUE)>(c.length??0);return e("div",{children:[!w&&t("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),w&&e("div",{className:"mb-4",children:[S&&t(fw,{onInvite:g,workspaceId:r._id}),!S&&t("div",{className:"text-red-500",children:"You have reached the maximum number of users for this workspace."})]}),e("div",{className:"mb-4 flex items-center justify-between",children:[t("div",{children:e("div",{className:"text-sm text-gray-600 mb-2",children:[c.length," member",1!==c.length?"s":""]})}),t("div",{children:t(rl,{variant:"ghost",size:"sm",onClick:g,progress:i,startIcon:t(xo,{}),children:"Refresh"})})]}),t("ul",{className:"space-y-2",children:y.map((a,o)=>{const i=a.id===n?.id,s=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===a.id;return e("li",{className:"flex items-center justify-between border rounded p-3",children:[e("div",{className:"flex items-center space-x-3",children:[t("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center text-sm font-medium",children:a.name.charAt(0).toUpperCase()}),e("div",{children:[t("div",{className:"font-medium",children:a.name}),t("div",{className:"text-xs text-gray-500",children:a.email})]})]}),e("div",{className:"flex items-center gap-x-1",children:[t("div",{children:e(sw,{disabled:i||!w||s,value:a.role,onValueChange:e=>{return t=r._id,n=a.id,o=e,void(Um(r,n)?x(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:t,userId:n,role:o}}):m(t,n,{role:o}).then(()=>{g()}).catch(e=>{x(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:t,userId:n,role:o}})}));var t,n,o},children:[t(cw,{children:t(pb,{placeholder:"Select a role"})}),t(lw,{children:r?.roles.map(e=>t(dw,{value:e,children:e},e))})]})}),i&&t("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"You"}),s&&t("span",{className:"text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded",children:"Owner"}),!i&&!s&&w&&t(rl,{variant:"destructive",size:"sm",startIcon:t(_o,{}),onClick:()=>{var e;e=a.id,Um(r,e)?x(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):p(r._id,e).then(()=>{g()}).catch(t=>{x(t,{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}})})}})]})]},o)})}),0===c.length&&t("div",{className:"text-center py-8 text-gray-500",children:"No members found in this workspace."})]})};function fw({onInvite:r,workspaceId:n}){const[a,o]=u(""),[i,s]=u("admin"),[c,l]=u(!1),[f,p]=u(null),[m,h]=u(null),{addUser:g,getWorkspace:v}=ww(),[y,b]=u(null),{settings:w}=Hp(),S=w?.workspace.roles??y?.roles??[];d(()=>{n&&v(n).then(b)},[n]);const x=()=>{p(null),h(null),o(""),s("admin")};return e("div",{className:"flex gap-2 flex-col gap-y-2",children:[f&&t("div",{className:"text-red-500 capitalize",children:f}),m&&t("div",{className:"text-green-500 capitalize",children:m}),e("div",{children:[t(Vu,{children:"Invite member by email"}),t(tf,{type:"email",value:a,onChange:e=>o(e.target.value),placeholder:"example@example.com"})]}),e("div",{children:[t(Vu,{children:"Role"}),e(sw,{value:i,onValueChange:s,children:[t(cw,{children:t(pb,{placeholder:"Select a role"})}),t(lw,{children:S.map(e=>t(dw,{value:e,children:e},e))})]})]}),t("div",{children:t(rl,{progress:c,onClick:async()=>{const e=a.trim();if(!e)return void p("Email is required");/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(l(!0),await g(n,e,i).then(()=>{h("User invited successfully"),r?.()}).catch(e=>{console.error(e),p(e.message||"Failed to invite member")}).finally(()=>{l(!1),setTimeout(()=>{x()},6e3)})):p("Invalid email address format")},disabled:c||!a||!i,children:c?"Inviting...":`Invite as ${i}`})})]})}const pw=({workspace:r,section:n,setSection:a})=>{const o=ye(e=>e.auth.session?.user||null),i=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===o?.id;return e("div",{className:"w-56 h-full flex flex-col space-y-6",children:[r&&t("div",{className:"border-b p-2 py-4",children:e("div",{className:"flex items-center gap-x-2",children:[r.image&&r.image.trim()&&t("div",{className:"bg-blue-100 rounded flex items-center justify-center text-blue-600 font-medium px-0.5 py-0.5",style:{width:"40px",height:"40px",minWidth:"40px",minHeight:"40px"},children:t("img",{src:r.image,className:"w-full h-full object-contain",style:{width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px",objectFit:"contain"},alt:r.name})}),e("div",{className:Zc("flex-1 min-w-0",r.image?"":"pl-2"),children:[t("div",{className:"font-medium text-sm line-clamp-1 text-ellipsis overflow-hidden",children:r.name}),t("div",{className:"text-xs text-gray-500",children:r.workspaceId})]})]})}),t(mw,{title:"Account",children:t(hw,{activeSection:n,icon:t(Ro,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>a("profile")})}),e(mw,{title:"Workspace",children:[t(hw,{activeSection:n,icon:t(Ao,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>a("general")}),t(hw,{activeSection:n,icon:t(Oo,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>a("users")}),t(hw,{activeSection:n,icon:t(Co,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>a("features")}),i&&t(hw,{activeSection:n,icon:t(No,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>a("danger")})]})]})};function mw({title:r,children:n}){return e("div",{className:"px-2 flex flex-col space-y-1",children:[t("div",{className:"text-xs font-bold mb-2 text-gray-500 uppercase tracking-wide px-2",children:r}),n]})}function hw({icon:t,label:r,section:n,onClick:a,activeSection:o}){return e("button",{className:Zc("flex w-full text-left px-2 py-1 rounded text-sm items-center gap-x-1",n===o?"bg-blue-100 text-blue-700 font-medium":"hover:bg-gray-200 hover:text-gray-700"),onClick:()=>a(n),children:[t,r]})}const gw=({workspace:r,onClose:n,open:a,onOpenChange:o,defaultSection:i="profile",section:s,onSectionChange:c,showTrigger:l=!0,trigger:d})=>{const[f,p]=u(!1),[m,h]=u(i),g=void 0!==a?a:f,v=o||p,y=void 0!==s?s:m,b=c||h;if(!r)return null;const w=t(rl,{variant:"outline",size:"icon",children:t(Ao,{className:"h-4 w-4"})});return e(Pu,{open:g,onOpenChange:e=>{v(e),!e&&n&&n()},children:[l&&t(Du,{asChild:!0,children:d||w}),e(Mu,{className:"flex max-w-2xl min-w-full sm:min-w-[800px] p-0 m-0 bg-muted sm:min-h-[600px] min-h-full gap-x-0 space-x-0",children:[t(Fu,{className:"sr-only",children:"Workspace settings dialog"}),t(pw,{workspace:r,section:y,setSection:b}),e("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e(Lu,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===y&&"Account","general"===y&&"Workspace Settings","users"===y&&"Workspace Members","features"===y&&"Workspace Features","danger"===y&&"Danger Zone"]}),e("div",{className:"max-h-[500px] overflow-y-auto",children:["profile"===y&&t(Ky,{workspace:r}),"general"===y&&t(eh,{workspace:r}),"users"===y&&t(uw,{workspace:r}),"features"===y&&t(Ym,{workspaceId:r._id?.toString()}),"danger"===y&&t(Lm,{workspace:r})]})]})]})]})};function vw(n){const{workspaces:a,currentWorkspace:o,loading:i,refreshing:s}=ye(e=>e.workspaces),c=ye(e=>e.auth.session?.user),{settings:l}=Hp(),[f,p]=u(!1),[m,h]=u(0),[g,v]=u(""),{fetchWorkspaces:y,getFeatures:b,refreshWorkspaces:w,setCurrentWorkspace:S,workspaces:x}=ww(),k=i||s;d(()=>{0===x.length?(y(),b()):b()},[]),d(()=>{m>0&&w()},[m]);const A=x.length>0?x:a,E=A.filter(e=>e._id!==o?._id).filter(e=>e.name.toLowerCase().includes(g.toLowerCase())),C=l?.workspace.maxWorkspaces??Number.MAX_VALUE,T=A?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===c?.id?.toString()).length,_=C>(T??0);return e(Pu,{open:f,onOpenChange:p,children:[t(Du,{children:n.trigger?.(k,o)}),e(Mu,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e(zu,{children:[e(Lu,{className:"flex items-center gap-2",children:[t(go,{className:"h-5 w-5"}),"Switch Workspace"]}),t(Fu,{children:"Select a workspace to switch to or create a new one."})]}),!c&&t("div",{className:"flex flex-col items-center justify-center h-full py-4 sm:py-8",children:t("div",{className:"text-sm font-medium text-muted-foreground",children:"Looks like you are not logged in. Please login to continue."})}),c&&e("div",{className:"flex flex-col gap-4",children:[o&&t(yw,{workspace:o,isCurrentWorkspace:!0,onWorkspaceChange:n.onWorkspaceChange,onClose:()=>p(!1),setCurrentWorkspace:S,setOpen:p,workspacesToUse:A}),t(Kp,{}),e("div",{children:[e("div",{className:"flex items-center justify-between",children:[e("div",{className:"text-sm font-medium text-muted-foreground",children:["Available Workspaces (",E.length,")"]}),t("div",{children:t(rl,{progress:s,disabled:s,variant:"ghost",onClick:function(){h(e=>e+1)},startIcon:t(xo,{}),children:s?"Refreshing...":"Refresh"})})]}),e("div",{className:"relative",children:[t(ko,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),t(tf,{placeholder:"Search workspaces...",value:g,onChange:e=>v(e.target.value),className:"pl-10"})]}),i?e("div",{className:"flex items-center justify-center py-8",children:[t(wo,{className:"h-6 w-6 animate-spin text-muted-foreground"}),t("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading workspaces..."})]}):0===E.length?e("div",{className:"text-center py-8",children:[t(go,{className:"mx-auto h-12 w-12 text-muted-foreground"}),t("p",{className:"mt-2 text-sm text-muted-foreground",children:g?"No workspaces found":"No workspaces available"})]}):t(Fp,{className:"h-64",children:t("div",{className:"flex flex-col gap-2 my-2.5",children:E.map(e=>{const r=e._id===o?._id;return t(yw,{workspace:e,isCurrentWorkspace:r,onWorkspaceChange:n.onWorkspaceChange,onClose:()=>p(!1),setCurrentWorkspace:S,setOpen:p,workspacesToUse:A},e._id)})})})]}),_&&e(r,{children:[t(Kp,{}),t(bw,{onCreated:()=>{y()}})]})]})]})]})}function yw(r){const{workspace:n,setCurrentWorkspace:a,setOpen:o,workspacesToUse:i}=r,s=r.isCurrentWorkspace??!1,[c,l]=u(!1);return e("div",{className:Zc("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":s}),children:[e(Jc,{className:"h-8 w-8 flex items-center justify-center",children:[t("div",{children:t(qc,{src:n.image&&n.image.trim()?n.image:void 0})}),t(Yc,{children:(d=n.name,d.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))})]}),e("div",{className:"flex-1 min-w-0 max-w-full",children:[t("div",{className:"flex items-center gap-2",children:t("span",{className:"font-medium line-clamp-1 text-ellipsis overflow-hidden max-w-full",children:n.name})}),e("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[t(Oo,{className:"h-3 w-3"}),e("span",{children:[n.users?.length||0," members"]})]})]}),e("div",{className:"flex items-center gap-2",children:[s?null:t(rl,{size:"sm",disabled:c,progress:c,onClick:()=>{l(!0),r.onWorkspaceChange(n).then(()=>{a(n),o(!1)}).catch(e=>{x(e,{component:"WorkspaceItem",action:"onWorkspaceChange",metadata:{workspaceId:n._id}})}).finally(()=>{l(!1)})},children:"Switch to"}),t(gw,{workspace:n,onClose:()=>{if(s){const e=i.findIndex(e=>e._id?.toString()===n._id?.toString());-1!==e&&a(i[e])}}})]})]});var d}function bw(n){const[a,o]=u(!1),[i,s]=u("emoji"),[c,l]=u("🏢"),[d,f]=u(!1),{createWorkspace:p}=ww(),m=Xt({resolver:so(Ni({name:ri().min(2,{message:"Workspace name must be at least 2 characters."}),image:ri().optional()})),defaultValues:{name:"",image:""}});return e(Pu,{open:a,onOpenChange:o,children:[t(Du,{asChild:!0,children:e(rl,{className:"w-full rounded-none",children:[t(So,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e(Mu,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e(zu,{children:[t(Lu,{children:"Create New Workspace"}),t(Fu,{children:"Create a new workspace to get started."})]}),t(Gu,{...m,children:e("form",{onSubmit:m.handleSubmit(async function(e){let t="";if("emoji"===i)t=Xm(c);else if("url"===i&&e.image)try{new URL(e.image),t=e.image}catch{return void m.setError("image",{message:"Please enter a valid URL"})}f(!0);try{await p(e.name,t),o(!1),m.reset(),l("🏢"),s("emoji"),n?.onCreated?.()}catch(e){console.error("Failed to create workspace:",e)}finally{f(!1)}}),children:[t(Hu,{control:m.control,name:"name",render:({field:r})=>e(qu,{children:[t(Yu,{children:"Workspace Name"}),t(Xu,{children:t(tf,{placeholder:"My Awesome Workspace",...r})}),t(ef,{})]})}),e("div",{className:"flex flex-col gap-y-2 my-2",children:[e("div",{children:[t(Vu,{className:"text-sm font-medium",children:"Workspace Icon"}),t(Qu,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e(ep,{value:i,onValueChange:e=>s(e),className:"flex flex-col gap-y-2",children:[e("div",{className:"flex items-center gap-x-2 my-1",children:[t(tp,{value:"emoji",id:"emoji"}),e(Vu,{htmlFor:"emoji",className:"flex items-center gap-2",children:[t(Eo,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e("div",{className:"flex items-center gap-x-2 my-1",children:[t(tp,{value:"url",id:"url"}),e(Vu,{htmlFor:"url",className:"flex items-center gap-2",children:[t(bo,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===i&&e("div",{className:"flex flex-col gap-y-2",children:[e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:c})]}),t(Fp,{className:"h-32 w-full rounded-md border",children:t("div",{className:"p-4 grid grid-cols-8 gap-2",children:Qm.map((e,r)=>t("button",{type:"button",onClick:()=>(e=>{l(e),m.setValue("image",Xm(e))})(e),className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(c===e?"bg-primary text-primary-foreground":""),children:e},r))})})]}),"url"===i&&e("div",{className:"flex flex-col gap-y-2",children:[t(Hu,{control:m.control,name:"image",render:({field:r})=>e(qu,{children:[t(Yu,{children:"Image URL"}),t(Xu,{children:t(tf,{placeholder:"https://example.com/image.png",...r})}),t(Qu,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),t(ef,{})]})}),m.watch("image")&&m.watch("image")?.trim()&&e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:t("img",{src:m.watch("image")||void 0,alt:"Workspace preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.style.display="none"}})})]})]})]}),e("div",{className:"flex justify-end gap-3 pt-4",children:[t(rl,{type:"button",variant:"outline",onClick:()=>{o(!1),m.reset(),l("🏢"),s("emoji")},disabled:d,children:"Cancel"}),t(rl,{type:"submit",disabled:d,children:d?e(r,{children:[t(wo,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}const ww=()=>{const e=be(),t=ye(e=>e.os),r=c(()=>new Te(t),[t]),n=ye(e=>e.workspaces),o=ye(e=>e.auth.session?.user),i=l(t=>{if(t._id!==n.currentWorkspace?._id&&t){const r=n.currentWorkspace;e.workspaces(ae(t)),xe.emitWorkspaceChanged(t,r).catch(e=>{x(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceChanged",metadata:{workspaceId:t._id}})})}},[n.currentWorkspace,e]);d(()=>{if(!n.isInitialized){const t=Dm();if(e.workspaces(ie(!0)),t){const e=n.workspaces.find(e=>e._id===t);if(e){if(e._id===n.currentWorkspace?._id)return;i(e)}}}},[n.isInitialized,n.workspaces,n.currentWorkspace,e,i]);const s=l(()=>{e.workspaces(oe())},[e]),u=a.useRef(!1),f=a.useRef(!1),p=l(async()=>{if(!n.loading&&!u.current){u.current=!0,e.workspaces(se(!0)),e.workspaces(ce(null));try{const t=await r.getWorkspaces();if(e.workspaces(re(t)),t.length>0){const e=Dm();if(e&&Im(e,t)){const r=t.find(t=>t._id===e);r&&i(r)}else t.length>0&&(n.currentWorkspace||i(t[0]))}}catch(t){e.workspaces(ce(t instanceof Error?t.message:"Failed to fetch workspaces"))}finally{e.workspaces(se(!1)),u.current=!1}}},[r,n.loading,n.currentWorkspace?._id,e,i]),m=l(async()=>{if(!n.refreshing&&!u.current){u.current=!0,e.workspaces(le(!0));try{const t=await r.getWorkspaces();e.workspaces(re(t))}catch(e){}finally{e.workspaces(le(!1)),u.current=!1}}},[r,n.refreshing,e]),h=l(async(t,a)=>{const o=await r.createWorkspace({name:t,image:a});e.workspaces(re([...n.workspaces,o])),xe.emitWorkspaceCreated(o).catch(e=>{x(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceCreated",metadata:{workspaceId:o._id}})})},[r,n.workspaces,e]),g=l(async(t,a)=>{const o=await r.updateWorkspace(t._id,a);e.workspaces(re(n.workspaces.map(e=>e._id===t._id?o:e))),xe.emitWorkspaceUpdated(o).catch(e=>{x(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceUpdated",metadata:{workspaceId:o._id}})})},[r,n.workspaces,e]),v=l(async()=>{if(f.current)return n.allFeatures.length>0?n.allFeatures:null;if(n.allFeatures.length>0)return n.allFeatures;f.current=!0;try{const t=await r.getFeatures();return e.workspaces(ne(t)),t}catch(e){return x(e,{component:"useSaaSWorkspaces",action:"getFeatures"}),null}finally{f.current=!1}},[r,e,n.allFeatures]),y=l(async(e,t,n)=>await r.updateFeature(e,t,n),[r]);d(()=>{if(!n.currentWorkspace?._id||0===n.workspaces.length)return;const e=n.currentWorkspace._id,t=n.workspaces.find(t=>t._id===e);if(t)t!==n.currentWorkspace&&i(t);else if(n.workspaces.length>0){const t=n.workspaces[0];t._id!==e&&i(t)}},[n.workspaces,n.currentWorkspace,i]);const b=l(async e=>await r.getWorkspaceUsers(e),[r]),w=l(async(e,t,a)=>{const o=await r.addUser(e,{email:t,role:a}),i=n.workspaces.find(t=>t._id===e);return i&&xe.emitWorkspaceUserAdded(o.userId,i,a).catch(t=>{x(t,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserAdded",metadata:{workspaceId:e,userId:o.userId,role:a}})}),o},[r,n.workspaces]),S=l(async(e,t)=>{const a=n.workspaces.find(t=>t._id===e);if(a&&Um(a,t))throw new Error("Cannot remove the workspace owner");const o=(await r.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t),i=await r.removeUser(e,t);if(a&&o){const t=o.role;xe.emitWorkspaceUserRemoved(i.userId,a,t).catch(r=>{x(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRemoved",metadata:{workspaceId:e,userId:i.userId,role:t}})})}return i},[r,n.workspaces]),k=l(async(e,t,a)=>{if(a.role){const r=n.workspaces.find(t=>t._id===e);if(r&&Um(r,t))throw new Error("Cannot change the role of the workspace owner")}let o;if(a.role){const n=(await r.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t);o=n?.role}const i=await r.updateUser(e,t,a);return a.role&&o&&o!==a.role&&xe.emitWorkspaceUserRoleChanged(i.userId,i.workspace,o,a.role).catch(r=>{x(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRoleChanged",metadata:{workspaceId:e,userId:t,previousRole:o,newRole:a.role}})}),i},[r,n.workspaces]),A=l(async e=>{const t=await r.getProfile().catch(()=>null),n=await r.updateUserProfile(e);return xe.emitUserUpdated(n,t||void 0).catch(e=>{x(e,{component:"useSaaSWorkspaces",action:"emitUserUpdated",metadata:{userId:n._id}})}),n},[r]),E=l(async()=>await r.getProfile(),[r]),C=l(async e=>await r.getWorkspace(e),[r]),T=l(async t=>{if(!o)throw new Error("User must be authenticated to delete a workspace");const a=n.workspaces.find(e=>e._id===t);if(!a)throw new Error("Workspace not found");if(!Um(a,o.id))throw new Error("Only the workspace creator can delete the workspace");const i=await r.deleteWorkspace(t);return e.workspaces(re(n.workspaces.filter(e=>e._id!==t))),n.currentWorkspace?._id===t&&e.workspaces(oe()),a&&xe.emitWorkspaceDeleted(a).catch(e=>{x(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceDeleted",metadata:{workspaceId:t}})}),i},[r,n.workspaces,n.currentWorkspace,e,o]);return{workspaces:n.workspaces,loading:n.loading,error:n.error,fetchWorkspaces:p,refreshWorkspaces:m,refreshing:n.refreshing,WorkspaceSwitcher:vw,currentWorkspace:n.currentWorkspace,setCurrentWorkspace:i,resetCurrentWorkspace:s,createWorkspace:h,allFeatures:n.allFeatures,getFeatures:v,updateFeature:y,getWorkspace:C,switching:n.switching,updateWorkspace:g,getUsers:b,addUser:w,removeUser:S,updateUser:k,getProfile:E,updateUserProfile:A,deleteWorkspace:T}};const Sw=new class{constructor(){this.listeners=new Set,this.currentState={open:!1,section:"profile"}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getState(){return{...this.currentState}}openWorkspaceSettings(e){this.currentState={open:!0,section:e||"profile"},this.notifyListeners()}closeSettings(){this.currentState={...this.currentState,open:!1},this.notifyListeners()}setSection(e){this.currentState={...this.currentState,section:e},this.notifyListeners()}notifyListeners(){this.listeners.forEach(e=>{e(this.currentState.open,this.currentState.section)})}},xw=({children:n})=>{const{currentWorkspace:a}=ww(),[o,i]=u(!1),[s,c]=u("profile");return d(()=>{const e=Sw.getState();i(e.open),c(e.section);return Sw.subscribe((e,t)=>{i(e),c(t)})},[]),e(r,{children:[n,a&&t(gw,{workspace:a,open:o,onOpenChange:e=>{e||Sw.closeSettings()},section:s,onSectionChange:e=>{Sw.setSection(e)},showTrigger:!1})]})},kw=(e,t,r)=>{if(t!==b.V1)throw new Error(`Invalid version: "${t}". Only "${b.V1}" is currently supported.`);if(!e||"string"!=typeof e)throw new Error("serverUrl is required and must be a string");if(!(e=>{try{return new URL(e),!0}catch{return!1}})(e))throw new Error(`Invalid serverUrl: "${e}". Must be a valid URL.`);if(!r||"string"!=typeof r)throw new Error("orgId is required and must be a string");if(!/^[0-9a-fA-F]{24}$/.test(r))throw new Error(`Invalid orgId: "${r}". Must be a valid MongoDB ObjectId (24 hexadecimal characters).`)},Aw=a.memo(({serverUrl:e,version:r,orgId:n,auth:o,children:i})=>{kw(e,r,n);const s=a.useMemo(()=>({serverUrl:e,version:r,orgId:n}),[e,r,n]),c=a.useMemo(()=>o?.callbacks,[o?.callbacks]),l=a.useMemo(()=>o?.callbacks?.handleEvent,[o?.callbacks]);return d(()=>(xe.setCallbacks(l?{handleEvent:l}:null),()=>{xe.setCallbacks(null)}),[l]),t(A,{children:t(ve,{children:t(we,{callbacks:c,children:t(Ae,{children:t(Se,{config:s,auth:o,children:t(Ce,{children:t(xw,{children:i})})})})})})})});Aw.displayName="SaaSOSProvider";let Ew=class{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}async fetchConfig(){const e=await fetch(`${this.serverUrl}/api/${this.version}/beta/config?orgId=${this.orgId}`);if(!e.ok)throw new Error(`Failed to fetch beta form configuration: ${e.statusText}`);return e.json()}async submitBetaUser(e){const t=e?.context??{},r=t?.country??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[1]:void 0),n=t?.language??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[0]:void 0),a=t?.timezone??("undefined"!=typeof Intl&&Intl.DateTimeFormat?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0),o=t?.currency??("undefined"!=typeof Intl&&Intl.NumberFormat&&Intl.NumberFormat().resolvedOptions().currency?Intl.NumberFormat().resolvedOptions().currency:void 0),i=await fetch(`${this.serverUrl}/api/${this.version}/beta/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orgId:this.orgId,formData:{...e,country:r,language:n,timezone:a,currency:o}})});if(!i.ok)throw new Error(`Failed to submit beta user request: ${i.statusText}`);return i.json()}};const Cw=Ni({name:ri().min(1,"Please enter your name").max(50,"Name must be less than 50 characters").regex(/^[a-zA-Z\s]*$/,"Name can only contain letters and spaces"),email:ri().min(1,"Please enter your email address").email("Please enter a valid email address").max(100,"Email must be less than 100 characters").regex(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,"Please enter a valid email format (e.g., name@domain.com)")}),Tw={en:{nameLabel:"Name",emailLabel:"Email",submitText:"Submit",submittingText:"Submitting...",errorMessage:"An error occurred"},es:{nameLabel:"Nombre",emailLabel:"Correo electrónico",submitText:"Enviar",submittingText:"Enviando...",errorMessage:"Ocurrió un error"},fr:{nameLabel:"Nom",emailLabel:"Email",submitText:"Soumettre",submittingText:"Soumission...",errorMessage:"Une erreur est survenue"},de:{nameLabel:"Name",emailLabel:"E-Mail",submitText:"Absenden",submittingText:"Wird gesendet...",errorMessage:"Ein Fehler ist aufgetreten"},zh:{nameLabel:"姓名",emailLabel:"电子邮件",submitText:"提交",submittingText:"提交中...",errorMessage:"发生错误"},ja:{nameLabel:"名前",emailLabel:"メールアドレス",submitText:"送信",submittingText:"送信中...",errorMessage:"エラーが発生しました"},ko:{nameLabel:"이름",emailLabel:"이메일",submitText:"제출",submittingText:"제출 중...",errorMessage:"오류가 발생했습니다"}},_w=({onSuccess:n,onError:a,className:o="w-full",fieldClassName:i="flex flex-col gap-1.5 w-full",language:s,customTexts:c={},autoFocus:f=!0,showSuccessMessage:p=!0,hideLogo:m=!1,hideTitles:h=!1})=>{const[g,v]=u("en"),[y,b]=u(!1),[w,S]=u(!1),{submitBetaForm:x,isLoading:k,isSubmitting:A,error:E,config:C,success:T,message:_}=(()=>{const e=ye(e=>e.os),[t,r]=u(null),[n,a]=u(!0),[o,i]=u(!1),[s,c]=u(null),[f,p]=u(!1),[m,h]=u(null);return d(()=>{(async()=>{a(!0);const t=new Ew(e),n=await t.fetchConfig();r(n),a(!1)})()},[e]),{isLoading:n,isSubmitting:o,config:t,error:s,success:f,message:m,submitBetaForm:l(async t=>{if(!e){const e="SaaS OS context is not initialized";return c(e),{success:!1,message:e}}try{i(!0),c(null),p(!1),h(null);const r=new Ew(e),n=await r.submitBetaUser({name:t.name||"",email:t.email}),a="success"===n.status;return p(a),h(n.message),{success:a,message:n.message}}catch(e){const t=e instanceof Error?e.message:"Failed to submit beta form";return c(t),p(!1),h(t),{success:!1,message:t}}finally{i(!1)}},[e])}})();d(()=>{v((()=>{if("undefined"==typeof window)return"en";const e=window.navigator.language.split("-")[0];return-1!==Object.keys(Tw).indexOf(e)?e:"en"})())},[]),d(()=>{T&&p&&(b(!0),S(!0)),E&&S(!0)},[T,p,E]);const N={...Tw[s||g],...c},R=Xt({resolver:so(Cw),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});d(()=>{f&&R.setFocus("name")},[f,R]);const O=R.formState.isValid&&!A;return t("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:e("div",k?{className:Zc("flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",o),children:[t(Mm,{className:"h-24 w-24 rounded-lg"}),t(Mm,{className:"h-6 w-32"}),e("div",{className:"w-full space-y-4",children:[e("div",{className:"space-y-2",children:[t(Mm,{className:"h-4 w-16"}),t(Mm,{className:"h-10 w-full"})]}),e("div",{className:"space-y-2",children:[t(Mm,{className:"h-4 w-16"}),t(Mm,{className:"h-10 w-full"})]}),t(Mm,{className:"h-10 w-full"})]})]}:{className:"flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",children:[!m&&e("div",{className:"flex flex-col items-center justify-center w-full",children:[C?.logo&&t(Rw,{logo:C?.logo}),C?.name&&t("div",{children:C?.name})]}),t(ct,{...R,children:e("form",{onSubmit:R.handleSubmit(async e=>{try{const t=await x(e);t.success?(n?.(),R.reset(),p&&b(!0),S(!0)):(a?.(t.message),S(!0))}catch(e){a?.(e instanceof Error?e.message:N.errorMessage),S(!0)}}),className:o,noValidate:!0,"aria-busy":A,children:[!w&&e(r,{children:[!h&&C?.screen?.register&&t(Nw,{screen:C?.screen?.register}),t(Hu,{control:R.control,name:"name",render:({field:r})=>e(qu,{className:i,children:[t(Yu,{children:N.nameLabel}),t(Xu,{children:t(tf,{...r})}),t(Qu,{}),t(ef,{})]})}),t(Hu,{control:R.control,name:"email",render:({field:r})=>e(qu,{className:i,children:[t(Yu,{children:N.emailLabel}),t(Xu,{children:t(tf,{...r})}),t(Qu,{}),t(ef,{})]})}),t(rl,{type:"submit",disabled:!O,className:i,children:A?N.submittingText:N.submitText})]}),w&&E&&e("div",{className:"flex flex-col items-center justify-center w-full",children:[e("div",{className:"border-red-300 text-red-700",role:"alert","aria-live":"assertive","aria-atomic":!0,children:[t("span",{className:"text-4xl mb-2",role:"img","aria-label":"Error",children:"❗"}),E]}),t("div",{className:"mt-4 flex justify-center",children:t(rl,{type:"button",onClick:()=>{S(!1),R.reset()},className:i,children:"Try Again"})})]}),w&&y&&_&&t("div",{className:"flex flex-col items-center justify-center w-full text-green-700 border-green-300 text-center",children:C?.screen?.thankYou&&t(Nw,{screen:C?.screen?.thankYou})})]})}),!w&&t("div",{children:e("div",{children:["By submitting this form, you consent to our"," ",t("a",{href:C?.privacyPolicy,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Privacy Policy"})," ","and"," ",t("a",{href:C?.termsOfService,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Terms of Service"}),"."]})})]})})};function Nw({screen:r}){return e("div",{className:"flex flex-col items-center justify-center w-full",children:[t("p",{className:"text-2xl font-bold",children:r?.title}),t("p",{className:"text-sm text-muted-foreground",children:r?.description})]})}function Rw({logo:e}){return t("img","string"==typeof e?{src:e,alt:"Logo",className:"max-h-24"}:{src:e.bucket?.url,alt:"Logo",className:"max-h-24"})}function Ow(e,t){return function(){return e.apply(t,arguments)}}const{toString:Pw}=Object.prototype,{getPrototypeOf:Dw}=Object,{iterator:Iw,toStringTag:Uw}=Symbol,Mw=(zw=Object.create(null),e=>{const t=Pw.call(e);return zw[t]||(zw[t]=t.slice(8,-1).toLowerCase())});var zw;const Lw=e=>(e=e.toLowerCase(),t=>Mw(t)===e),Fw=e=>t=>typeof t===e,{isArray:jw}=Array,$w=Fw("undefined");function Bw(e){return null!==e&&!$w(e)&&null!==e.constructor&&!$w(e.constructor)&&Gw(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ww=Lw("ArrayBuffer");const Vw=Fw("string"),Gw=Fw("function"),Kw=Fw("number"),Hw=e=>null!==e&&"object"==typeof e,Zw=e=>{if("object"!==Mw(e))return!1;const t=Dw(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Uw in e||Iw in e)},Jw=Lw("Date"),qw=Lw("File"),Yw=Lw("Blob"),Xw=Lw("FileList"),Qw=Lw("URLSearchParams"),[eS,tS,rS,nS]=["ReadableStream","Request","Response","Headers"].map(Lw);function aS(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,a;if("object"!=typeof e&&(e=[e]),jw(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if(Bw(e))return;const a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length;let i;for(n=0;n<o;n++)i=a[n],t.call(null,e[i],i,e)}}function oS(e,t){if(Bw(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,a=r.length;for(;a-- >0;)if(n=r[a],t===n.toLowerCase())return n;return null}const iS="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,sS=e=>!$w(e)&&e!==iS;const cS=(lS="undefined"!=typeof Uint8Array&&Dw(Uint8Array),e=>lS&&e instanceof lS);var lS;const dS=Lw("HTMLFormElement"),uS=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),fS=Lw("RegExp"),pS=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};aS(r,(r,a)=>{let o;!1!==(o=t(r,a,e))&&(n[a]=o||r)}),Object.defineProperties(e,n)};const mS=Lw("AsyncFunction"),hS=(gS="function"==typeof setImmediate,vS=Gw(iS.postMessage),gS?setImmediate:vS?(yS=`axios@${Math.random()}`,bS=[],iS.addEventListener("message",({source:e,data:t})=>{e===iS&&t===yS&&bS.length&&bS.shift()()},!1),e=>{bS.push(e),iS.postMessage(yS,"*")}):e=>setTimeout(e));var gS,vS,yS,bS;const wS="undefined"!=typeof queueMicrotask?queueMicrotask.bind(iS):"undefined"!=typeof process&&process.nextTick||hS;var SS={isArray:jw,isArrayBuffer:Ww,isBuffer:Bw,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Gw(e.append)&&("formdata"===(t=Mw(e))||"object"===t&&Gw(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Ww(e.buffer),t},isString:Vw,isNumber:Kw,isBoolean:e=>!0===e||!1===e,isObject:Hw,isPlainObject:Zw,isEmptyObject:e=>{if(!Hw(e)||Bw(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:eS,isRequest:tS,isResponse:rS,isHeaders:nS,isUndefined:$w,isDate:Jw,isFile:qw,isBlob:Yw,isRegExp:fS,isFunction:Gw,isStream:e=>Hw(e)&&Gw(e.pipe),isURLSearchParams:Qw,isTypedArray:cS,isFileList:Xw,forEach:aS,merge:function e(){const{caseless:t,skipUndefined:r}=sS(this)&&this||{},n={},a=(a,o)=>{const i=t&&oS(n,o)||o;Zw(n[i])&&Zw(a)?n[i]=e(n[i],a):Zw(a)?n[i]=e({},a):jw(a)?n[i]=a.slice():r&&$w(a)||(n[i]=a)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&aS(arguments[e],a);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(aS(t,(t,n)=>{r&&Gw(t)?e[n]=Ow(t,r):e[n]=t},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let a,o,i;const s={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)i=a[o],n&&!n(i,e,t)||s[i]||(t[i]=e[i],s[i]=!0);e=!1!==r&&Dw(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:Mw,kindOfTest:Lw,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(jw(e))return e;let t=e.length;if(!Kw(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Iw]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:dS,hasOwnProperty:uS,hasOwnProp:uS,reduceDescriptors:pS,freezeMethods:e=>{pS(e,(t,r)=>{if(Gw(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];Gw(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return jw(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:oS,global:iS,isContextDefined:sS,isSpecCompliantForm:function(e){return!!(e&&Gw(e.append)&&"FormData"===e[Uw]&&e[Iw])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(Hw(e)){if(t.indexOf(e)>=0)return;if(Bw(e))return e;if(!("toJSON"in e)){t[n]=e;const a=jw(e)?[]:{};return aS(e,(e,t)=>{const o=r(e,n+1);!$w(o)&&(a[t]=o)}),t[n]=void 0,a}}return e};return r(e,0)},isAsyncFn:mS,isThenable:e=>e&&(Hw(e)||Gw(e))&&Gw(e.then)&&Gw(e.catch),setImmediate:hS,asap:wS,isIterable:e=>null!=e&&Gw(e[Iw])};function xS(e,t,r,n,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),a&&(this.response=a,this.status=a.status?a.status:null)}SS.inherits(xS,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:SS.toJSONObject(this.config),code:this.code,status:this.status}}});const kS=xS.prototype,AS={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{AS[e]={value:e}}),Object.defineProperties(xS,AS),Object.defineProperty(kS,"isAxiosError",{value:!0}),xS.from=(e,t,r,n,a,o)=>{const i=Object.create(kS);SS.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const s=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return xS.call(i,s,c,r,n,a),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};function ES(e){return SS.isPlainObject(e)||SS.isArray(e)}function CS(e){return SS.endsWith(e,"[]")?e.slice(0,-2):e}function TS(e,t,r){return e?e.concat(t).map(function(e,t){return e=CS(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const _S=SS.toFlatObject(SS,{},null,function(e){return/^is[A-Z]/.test(e)});function NS(e,t,r){if(!SS.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=SS.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!SS.isUndefined(t[e])})).metaTokens,a=r.visitor||l,o=r.dots,i=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&SS.isSpecCompliantForm(t);if(!SS.isFunction(a))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(SS.isDate(e))return e.toISOString();if(SS.isBoolean(e))return e.toString();if(!s&&SS.isBlob(e))throw new xS("Blob is not supported. Use a Buffer instead.");return SS.isArrayBuffer(e)||SS.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,a){let s=e;if(e&&!a&&"object"==typeof e)if(SS.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(SS.isArray(e)&&function(e){return SS.isArray(e)&&!e.some(ES)}(e)||(SS.isFileList(e)||SS.endsWith(r,"[]"))&&(s=SS.toArray(e)))return r=CS(r),s.forEach(function(e,n){!SS.isUndefined(e)&&null!==e&&t.append(!0===i?TS([r],n,o):null===i?r:r+"[]",c(e))}),!1;return!!ES(e)||(t.append(TS(a,r,o),c(e)),!1)}const d=[],u=Object.assign(_S,{defaultVisitor:l,convertValue:c,isVisitable:ES});if(!SS.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!SS.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),SS.forEach(r,function(r,o){!0===(!(SS.isUndefined(r)||null===r)&&a.call(t,r,SS.isString(o)?o.trim():o,n,u))&&e(r,n?n.concat(o):[o])}),d.pop()}}(e),t}function RS(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function OS(e,t){this._pairs=[],e&&NS(e,this,t)}const PS=OS.prototype;function DS(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function IS(e,t,r){if(!t)return e;const n=r&&r.encode||DS;SS.isFunction(r)&&(r={serialize:r});const a=r&&r.serialize;let o;if(o=a?a(t,r):SS.isURLSearchParams(t)?t.toString():new OS(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}PS.append=function(e,t){this._pairs.push([e,t])},PS.toString=function(e){const t=e?function(t){return e.call(this,t,RS)}:RS;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class US{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){SS.forEach(this.handlers,function(t){null!==t&&e(t)})}}var MS={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},zS={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:OS,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const LS="undefined"!=typeof window&&"undefined"!=typeof document,FS="object"==typeof navigator&&navigator||void 0,jS=LS&&(!FS||["ReactNative","NativeScript","NS"].indexOf(FS.product)<0),$S="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,BS=LS&&window.location.href||"http://localhost";var WS={...Object.freeze({__proto__:null,hasBrowserEnv:LS,hasStandardBrowserEnv:jS,hasStandardBrowserWebWorkerEnv:$S,navigator:FS,origin:BS}),...zS};function VS(e){function t(e,r,n,a){let o=e[a++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),s=a>=e.length;if(o=!o&&SS.isArray(n)?n.length:o,s)return SS.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!i;n[o]&&SS.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],a)&&SS.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const a=r.length;let o;for(n=0;n<a;n++)o=r[n],t[o]=e[o];return t}(n[o])),!i}if(SS.isFormData(e)&&SS.isFunction(e.entries)){const r={};return SS.forEachEntry(e,(e,n)=>{t(function(e){return SS.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const GS={transitional:MS,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,a=SS.isObject(e);a&&SS.isHTMLForm(e)&&(e=new FormData(e));if(SS.isFormData(e))return n?JSON.stringify(VS(e)):e;if(SS.isArrayBuffer(e)||SS.isBuffer(e)||SS.isStream(e)||SS.isFile(e)||SS.isBlob(e)||SS.isReadableStream(e))return e;if(SS.isArrayBufferView(e))return e.buffer;if(SS.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return NS(e,new WS.classes.URLSearchParams,{visitor:function(e,t,r,n){return WS.isNode&&SS.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=SS.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return NS(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||n?(t.setContentType("application/json",!1),function(e,t,r){if(SS.isString(e))try{return(t||JSON.parse)(e),SS.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||GS.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(SS.isResponse(e)||SS.isReadableStream(e))return e;if(e&&SS.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(e){if(r){if("SyntaxError"===e.name)throw xS.from(e,xS.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:WS.classes.FormData,Blob:WS.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};SS.forEach(["delete","get","head","post","put","patch"],e=>{GS.headers[e]={}});const KS=SS.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const HS=Symbol("internals");function ZS(e){return e&&String(e).trim().toLowerCase()}function JS(e){return!1===e||null==e?e:SS.isArray(e)?e.map(JS):String(e)}function qS(e,t,r,n,a){return SS.isFunction(n)?n.call(this,t,r):(a&&(t=r),SS.isString(t)?SS.isString(n)?-1!==t.indexOf(n):SS.isRegExp(n)?n.test(t):void 0:void 0)}let YS=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function a(e,t,r){const a=ZS(t);if(!a)throw new Error("header name must be a non-empty string");const o=SS.findKey(n,a);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=JS(e))}const o=(e,t)=>SS.forEach(e,(e,r)=>a(e,r,t));if(SS.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(SS.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,n,a;return e&&e.split("\n").forEach(function(e){a=e.indexOf(":"),r=e.substring(0,a).trim().toLowerCase(),n=e.substring(a+1).trim(),!r||t[r]&&KS[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(SS.isObject(e)&&SS.isIterable(e)){let r,n,a={};for(const t of e){if(!SS.isArray(t))throw TypeError("Object iterator must return a key-value pair");a[n=t[0]]=(r=a[n])?SS.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}o(a,t)}else null!=e&&a(t,e,r);return this}get(e,t){if(e=ZS(e)){const r=SS.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(SS.isFunction(t))return t.call(this,e,r);if(SS.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ZS(e)){const r=SS.findKey(this,e);return!(!r||void 0===this[r]||t&&!qS(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function a(e){if(e=ZS(e)){const a=SS.findKey(r,e);!a||t&&!qS(0,r[a],a,t)||(delete r[a],n=!0)}}return SS.isArray(e)?e.forEach(a):a(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const a=t[r];e&&!qS(0,this[a],a,e,!0)||(delete this[a],n=!0)}return n}normalize(e){const t=this,r={};return SS.forEach(this,(n,a)=>{const o=SS.findKey(r,a);if(o)return t[o]=JS(n),void delete t[a];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(a):String(a).trim();i!==a&&delete t[a],t[i]=JS(n),r[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return SS.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&SS.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[HS]=this[HS]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=ZS(e);t[n]||(!function(e,t){const r=SS.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,a){return this[n].call(this,t,e,r,a)},configurable:!0})})}(r,e),t[n]=!0)}return SS.isArray(e)?e.forEach(n):n(e),this}};function XS(e,t){const r=this||GS,n=t||r,a=YS.from(n.headers);let o=n.data;return SS.forEach(e,function(e){o=e.call(r,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function QS(e){return!(!e||!e.__CANCEL__)}function ex(e,t,r){xS.call(this,null==e?"canceled":e,xS.ERR_CANCELED,t,r),this.name="CanceledError"}function tx(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new xS("Request failed with status code "+r.status,[xS.ERR_BAD_REQUEST,xS.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}YS.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),SS.reduceDescriptors(YS.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),SS.freezeMethods(YS),SS.inherits(ex,xS,{__CANCEL__:!0});const rx=(e,t,r=3)=>{let n=0;const a=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let a,o=0,i=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),l=n[i];a||(a=c),r[o]=s,n[o]=c;let d=i,u=0;for(;d!==o;)u+=r[d++],d%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-a<t)return;const f=l&&c-l;return f?Math.round(1e3*u/f):void 0}}(50,250);return function(e,t){let r,n,a=0,o=1e3/t;const i=(t,o=Date.now())=>{a=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-a;s>=o?i(e,t):(r=e,n||(n=setTimeout(()=>{n=null,i(r)},o-s)))},()=>r&&i(r)]}(r=>{const o=r.loaded,i=r.lengthComputable?r.total:void 0,s=o-n,c=a(s);n=o;e({loaded:o,total:i,progress:i?o/i:void 0,bytes:s,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})},r)},nx=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},ax=e=>(...t)=>SS.asap(()=>e(...t));var ox=WS.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,WS.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(WS.origin),WS.navigator&&/(msie|trident)/i.test(WS.navigator.userAgent)):()=>!0,ix=WS.hasStandardBrowserEnv?{write(e,t,r,n,a,o,i){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];SS.isNumber(r)&&s.push(`expires=${new Date(r).toUTCString()}`),SS.isString(n)&&s.push(`path=${n}`),SS.isString(a)&&s.push(`domain=${a}`),!0===o&&s.push("secure"),SS.isString(i)&&s.push(`SameSite=${i}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function sx(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const cx=e=>e instanceof YS?{...e}:e;function lx(e,t){t=t||{};const r={};function n(e,t,r,n){return SS.isPlainObject(e)&&SS.isPlainObject(t)?SS.merge.call({caseless:n},e,t):SS.isPlainObject(t)?SS.merge({},t):SS.isArray(t)?t.slice():t}function a(e,t,r,a){return SS.isUndefined(t)?SS.isUndefined(e)?void 0:n(void 0,e,0,a):n(e,t,0,a)}function o(e,t){if(!SS.isUndefined(t))return n(void 0,t)}function i(e,t){return SS.isUndefined(t)?SS.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,a,o){return o in t?n(r,a):o in e?n(void 0,r):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s,headers:(e,t,r)=>a(cx(e),cx(t),0,!0)};return SS.forEach(Object.keys({...e,...t}),function(n){const o=c[n]||a,i=o(e[n],t[n],n);SS.isUndefined(i)&&o!==s||(r[n]=i)}),r}var dx=e=>{const t=lx({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:o,headers:i,auth:s}=t;if(t.headers=i=YS.from(i),t.url=IS(sx(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&i.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),SS.isFormData(r))if(WS.hasStandardBrowserEnv||WS.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(SS.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&i.set(e,r)})}if(WS.hasStandardBrowserEnv&&(n&&SS.isFunction(n)&&(n=n(t)),n||!1!==n&&ox(t.url))){const e=a&&o&&ix.read(o);e&&i.set(a,e)}return t};var ux="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=dx(e);let a=n.data;const o=YS.from(n.headers).normalize();let i,s,c,l,d,{responseType:u,onUploadProgress:f,onDownloadProgress:p}=n;function m(){l&&l(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(i),n.signal&&n.signal.removeEventListener("abort",i)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=YS.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());tx(function(e){t(e),m()},function(e){r(e),m()},{data:u&&"text"!==u&&"json"!==u?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:n,config:e,request:h}),h=null}h.open(n.method.toUpperCase(),n.url,!0),h.timeout=n.timeout,"onloadend"in h?h.onloadend=g:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(g)},h.onabort=function(){h&&(r(new xS("Request aborted",xS.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const n=new xS(t&&t.message?t.message:"Network Error",xS.ERR_NETWORK,e,h);n.event=t||null,r(n),h=null},h.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const a=n.transitional||MS;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new xS(t,a.clarifyTimeoutError?xS.ETIMEDOUT:xS.ECONNABORTED,e,h)),h=null},void 0===a&&o.setContentType(null),"setRequestHeader"in h&&SS.forEach(o.toJSON(),function(e,t){h.setRequestHeader(t,e)}),SS.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),p&&([c,d]=rx(p,!0),h.addEventListener("progress",c)),f&&h.upload&&([s,l]=rx(f),h.upload.addEventListener("progress",s),h.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(i=t=>{h&&(r(!t||t.type?new ex(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(i),n.signal&&(n.signal.aborted?i():n.signal.addEventListener("abort",i)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);v&&-1===WS.protocols.indexOf(v)?r(new xS("Unsupported protocol "+v+":",xS.ERR_BAD_REQUEST,e)):h.send(a||null)})};const fx=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const a=function(e){if(!r){r=!0,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof xS?t:new ex(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,a(new xS(`timeout ${t} of ms exceeded`,xS.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(a):e.removeEventListener("abort",a)}),e=null)};e.forEach(e=>e.addEventListener("abort",a));const{signal:s}=n;return s.unsubscribe=()=>SS.asap(i),s}},px=function*(e,t){let r=e.byteLength;if(r<t)return void(yield e);let n,a=0;for(;a<r;)n=a+t,yield e.slice(a,n),a=n},mx=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},hx=(e,t,r,n)=>{const a=async function*(e,t){for await(const r of mx(e))yield*px(r,t)}(e,t);let o,i=0,s=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await a.next();if(t)return s(),void e.close();let o=n.byteLength;if(r){let e=i+=o;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw s(e),e}},cancel:e=>(s(e),a.return())},{highWaterMark:2})},{isFunction:gx}=SS,vx=(({Request:e,Response:t})=>({Request:e,Response:t}))(SS.global),{ReadableStream:yx,TextEncoder:bx}=SS.global,wx=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Sx=e=>{e=SS.merge.call({skipUndefined:!0},vx,e);const{fetch:t,Request:r,Response:n}=e,a=t?gx(t):"function"==typeof fetch,o=gx(r),i=gx(n);if(!a)return!1;const s=a&&gx(yx),c=a&&("function"==typeof bx?(l=new bx,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const d=o&&s&&wx(()=>{let e=!1;const t=new r(WS.origin,{body:new yx,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=i&&s&&wx(()=>SS.isReadableStream(new n("").body)),f={stream:u&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!f[e]&&(f[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new xS(`Response type '${e}' is not supported`,xS.ERR_NOT_SUPPORT,r)})});const p=async(e,t)=>{const n=SS.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(SS.isBlob(e))return e.size;if(SS.isSpecCompliantForm(e)){const t=new r(WS.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return SS.isArrayBufferView(e)||SS.isArrayBuffer(e)?e.byteLength:(SS.isURLSearchParams(e)&&(e+=""),SS.isString(e)?(await c(e)).byteLength:void 0)})(t):n};return async e=>{let{url:a,method:i,data:s,signal:c,cancelToken:l,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:v,headers:y,withCredentials:b="same-origin",fetchOptions:w}=dx(e),S=t||fetch;v=v?(v+"").toLowerCase():"text";let x=fx([c,l&&l.toAbortSignal()],m),k=null;const A=x&&x.unsubscribe&&(()=>{x.unsubscribe()});let E;try{if(g&&d&&"get"!==i&&"head"!==i&&0!==(E=await p(y,s))){let e,t=new r(a,{method:"POST",body:s,duplex:"half"});if(SS.isFormData(s)&&(e=t.headers.get("content-type"))&&y.setContentType(e),t.body){const[e,r]=nx(E,rx(ax(g)));s=hx(t.body,65536,e,r)}}SS.isString(b)||(b=b?"include":"omit");const t=o&&"credentials"in r.prototype,c={...w,signal:x,method:i.toUpperCase(),headers:y.normalize().toJSON(),body:s,duplex:"half",credentials:t?b:void 0};k=o&&new r(a,c);let l=await(o?S(k,w):S(a,c));const m=u&&("stream"===v||"response"===v);if(u&&(h||m&&A)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=SS.toFiniteNumber(l.headers.get("content-length")),[r,a]=h&&nx(t,rx(ax(h),!0))||[];l=new n(hx(l.body,65536,r,()=>{a&&a(),A&&A()}),e)}v=v||"text";let C=await f[SS.findKey(f,v)||"text"](l,e);return!m&&A&&A(),await new Promise((t,r)=>{tx(t,r,{data:C,headers:YS.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:k})})}catch(t){if(A&&A(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new xS("Network Error",xS.ERR_NETWORK,e,k),{cause:t.cause||t});throw xS.from(t,t&&t.code,e,k)}}},xx=new Map,kx=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:a}=t,o=[n,a,r];let i,s,c=o.length,l=xx;for(;c--;)i=o[c],s=l.get(i),void 0===s&&l.set(i,s=c?new Map:Sx(t)),l=s;return s};kx();const Ax={http:null,xhr:ux,fetch:{get:kx}};SS.forEach(Ax,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Ex=e=>`- ${e}`,Cx=e=>SS.isFunction(e)||null===e||!1===e;var Tx={getAdapter:function(e,t){e=SS.isArray(e)?e:[e];const{length:r}=e;let n,a;const o={};for(let i=0;i<r;i++){let r;if(n=e[i],a=n,!Cx(n)&&(a=Ax[(r=String(n)).toLowerCase()],void 0===a))throw new xS(`Unknown adapter '${r}'`);if(a&&(SS.isFunction(a)||(a=a.get(t))))break;o[r||"#"+i]=a}if(!a){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new xS("There is no suitable adapter to dispatch the request "+(r?e.length>1?"since :\n"+e.map(Ex).join("\n"):" "+Ex(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return a},adapters:Ax};function _x(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ex(null,e)}function Nx(e){_x(e),e.headers=YS.from(e.headers),e.data=XS.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Tx.getAdapter(e.adapter||GS.adapter,e)(e).then(function(t){return _x(e),t.data=XS.call(e,e.transformResponse,t),t.headers=YS.from(t.headers),t},function(t){return QS(t)||(_x(e),t&&t.response&&(t.response.data=XS.call(e,e.transformResponse,t.response),t.response.headers=YS.from(t.response.headers))),Promise.reject(t)})}const Rx="1.13.2",Ox={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ox[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Px={};Ox.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Rx+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,a,o)=>{if(!1===e)throw new xS(n(a," has been removed"+(t?" in "+t:"")),xS.ERR_DEPRECATED);return t&&!Px[a]&&(Px[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,a,o)}},Ox.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var Dx={assertOptions:function(e,t,r){if("object"!=typeof e)throw new xS("options must be an object",xS.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const o=n[a],i=t[o];if(i){const t=e[o],r=void 0===t||i(t,o,e);if(!0!==r)throw new xS("option "+o+" must be "+r,xS.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new xS("Unknown option "+o,xS.ERR_BAD_OPTION)}},validators:Ox};const Ix=Dx.validators;let Ux=class{constructor(e){this.defaults=e||{},this.interceptors={request:new US,response:new US}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=lx(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:a}=t;void 0!==r&&Dx.assertOptions(r,{silentJSONParsing:Ix.transitional(Ix.boolean),forcedJSONParsing:Ix.transitional(Ix.boolean),clarifyTimeoutError:Ix.transitional(Ix.boolean)},!1),null!=n&&(SS.isFunction(n)?t.paramsSerializer={serialize:n}:Dx.assertOptions(n,{encode:Ix.function,serialize:Ix.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Dx.assertOptions(t,{baseUrl:Ix.spelling("baseURL"),withXsrfToken:Ix.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=a&&SS.merge(a.common,a[t.method]);a&&SS.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=YS.concat(o,a);const i=[];let s=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let d,u=0;if(!s){const e=[Nx.bind(this),void 0];for(e.unshift(...i),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=i.length;let f=t;for(;u<d;){const e=i[u++],t=i[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=Nx.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return IS(sx((e=lx(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};SS.forEach(["delete","get","head","options"],function(e){Ux.prototype[e]=function(t,r){return this.request(lx(r||{},{method:e,url:t,data:(r||{}).data}))}}),SS.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,a){return this.request(lx(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Ux.prototype[e]=t(),Ux.prototype[e+"Form"]=t(!0)});const Mx={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Mx).forEach(([e,t])=>{Mx[t]=e});const zx=function e(t){const r=new Ux(t),n=Ow(Ux.prototype.request,r);return SS.extend(n,Ux.prototype,r,{allOwnKeys:!0}),SS.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(lx(t,r))},n}(GS);zx.Axios=Ux,zx.CanceledError=ex,zx.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,a){r.reason||(r.reason=new ex(e,n,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},zx.isCancel=QS,zx.VERSION=Rx,zx.toFormData=NS,zx.AxiosError=xS,zx.Cancel=zx.CanceledError,zx.all=function(e){return Promise.all(e)},zx.spread=function(e){return function(t){return e.apply(null,t)}},zx.isAxiosError=function(e){return SS.isObject(e)&&!0===e.isAxiosError},zx.mergeConfig=lx,zx.AxiosHeaders=YS,zx.formToJSON=e=>VS(SS.isHTMLForm(e)?new FormData(e):e),zx.getAdapter=Tx.getAdapter,zx.HttpStatusCode=Mx,zx.default=zx;const{Axios:Lx,AxiosError:Fx,CanceledError:jx,isCancel:$x,CancelToken:Bx,VERSION:Wx,all:Vx,Cancel:Gx,isAxiosError:Kx,spread:Hx,toFormData:Zx,AxiosHeaders:Jx,HttpStatusCode:qx,formToJSON:Yx,getAdapter:Xx,mergeConfig:Qx}=zx;const ek=new class{constructor(e={}){this.client=zx.create({baseURL:e.baseURL||"https://api.example.com",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json",...e.headers}}),this.client.interceptors.request.use(e=>{const t=z();return t&&(e.headers["x-session-id"]=t),e},e=>Promise.reject(e))}async get(e,t){const r=await this.client.get(e,t);return{data:r.data,status:r.status,statusText:r.statusText,headers:r.headers}}async post(e,t,r){const n=await this.client.post(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}async put(e,t,r){const n=await this.client.put(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}async delete(e,t){const r=await this.client.delete(e,t);return{data:r.data,status:r.status,statusText:r.statusText,headers:r.headers}}async patch(e,t,r){const n=await this.client.patch(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}setBaseURL(e){this.client.defaults.baseURL=e}setHeader(e,t){this.client.defaults.headers.common[e]=t}removeHeader(e){delete this.client.defaults.headers.common[e]}};function tk(){const e=be(),t=ye(e=>e.auth),r=ye(e=>e.os),{serverUrl:n,orgId:a,auth:o}=r,{resetCurrentWorkspace:i,currentWorkspace:s}=ww(),d=l(async()=>{e.auth(E());try{const t=await ek.post(`${n}/api/v1/auth/request`,{orgId:a,clientId:o?.clientId,redirect:{success:o?.redirectUrl||window.location.href,error:o?.redirectUrl||window.location.href}});if(!t.data.success)throw e.auth(C()),new Error(t.data.message||"Authentication failed");window.location.href=t.data.data.redirectUrl}catch(t){throw e.auth(C()),x(t,{component:"useSaaSAuth",action:"signIn"}),t}},[n,a,o,e]),u=l(async()=>{try{o?.callbacks?.onSignOut&&"function"==typeof o.callbacks.onSignOut&&await o.callbacks.onSignOut(),e.auth(_()),i(),M()}catch(e){x(e,{component:"useSaaSAuth",action:"signOut"}),M()}},[e,i,o?.callbacks?.onSignOut]),f=l(e=>{s?Sw.openWorkspaceSettings(e):x(new Error("Cannot open settings: No current workspace"),{component:"useSaaSAuth",action:"openWorkspaceSettings"})},[s]);return c(()=>({user:t.session?.user,session:t.session,isLoading:t.isLoading,isAuthenticated:t.isAuthenticated,isRedirecting:t.isRedirecting,status:t.status,signIn:d,signOut:u,openWorkspaceSettings:f}),[t,d,u,f])}const rk=e=>{const{children:t}=e,{status:r}=tk();return r!==R.authenticated?null:t},nk=e=>{const{children:t}=e,{status:r}=tk();return r===R.authenticated?null:t},ak=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=tk();return n.includes(a?.role??"")?t:r||null},ok=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=tk(),{currentWorkspace:o}=ww(),i=o?.users.find(e=>e._id===a?.id);return i&&n.includes(i?.role??"")?t:r||null};function ik(){const e=g(Ee);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e}function sk(){const e=g(Ee);if(void 0===e)throw new Error("useUserFeatures must be used within a UserProvider");return{features:e.features,isLoading:e.isLoading,error:e.error,refreshFeatures:e.refreshFeatures,isFeatureEnabled:t=>Boolean(e.features[t])}}const ck=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=ww(),a=n?.features?.[r];return a?t:null},lk=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=ww(),a=n?.features?.[r];return a?null:t},dk=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=sk();return n(r)?t:null},uk=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=sk();return n(r)?null:t};export{b as ApiVersion,_w as BetaForm,A as ErrorBoundary,w as SDKError,A as SDKErrorBoundary,Aw as SaaSOSProvider,rk as WhenAuthenticated,ak as WhenRoles,nk as WhenUnauthenticated,uk as WhenUserFeatureDisabled,dk as WhenUserFeatureEnabled,lk as WhenWorkspaceFeatureDisabled,ck as WhenWorkspaceFeatureEnabled,ok as WhenWorkspaceRoles,vw as WorkspaceSwitcher,k as createSDKError,S as errorHandler,xe as eventEmitter,x as handleError,tk as useSaaSAuth,Hp as useSaaSSettings,ww as useSaaSWorkspaces,ik as useUserAttributes,sk as useUserFeatures};
36
36
  //# sourceMappingURL=index.esm.js.map