auto-post-marketplace-facebook/releases/auto-post-facebook-extensio.../assets/popup-CHun9r8t.js

86 lines
247 KiB
JavaScript

import{r as f,j as c,a as $c,B as mt,c as Bt,d as y,u as ye,e as Rr,f as kt,g as oe,h as z,i as Ft,k as ot,l as Uo,m as fe,S as Bo,n as dt,o as ps,q as ms,s as gs,t as vs,F as ys,D as xs,v as Uc,w as Tn,x as zo,A as Ho,y as jt,z as Zo,C as Wo,E as Go,L as Bc,p as ze,G as Wn,I as Gt,H as zc,J as qo,K as Hc,P as Zc,b as Wc}from"./label-D0DDEqqs.js";import{u as Gc}from"./base64-Bxt0tHTb.js";import{a as qc,r as Kc}from"./app-DW8k92tM.js";var gr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Qt=typeof window>"u"||"Deno"in globalThis;function Oe(){}function Qc(e,t){return typeof e=="function"?e(t):e}function Gn(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ko(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Dt(e,t){return typeof e=="function"?e(t):e}function qe(e,t){return typeof e=="function"?e(t):e}function eo(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:o,queryKey:a,stale:i}=e;if(a){if(n){if(t.queryHash!==bs(a,t.options))return!1}else if(!kr(t.queryKey,a))return!1}if(r!=="all"){const l=t.isActive();if(r==="active"&&!l||r==="inactive"&&l)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||s&&s!==t.state.fetchStatus||o&&!o(t))}function to(e,t){const{exact:r,status:n,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(r){if(Yt(t.options.mutationKey)!==Yt(o))return!1}else if(!kr(t.options.mutationKey,o))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function bs(e,t){return(t?.queryKeyHashFn||Yt)(e)}function Yt(e){return JSON.stringify(e,(t,r)=>qn(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function kr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>kr(e[r],t[r])):!1}function Qo(e,t){if(e===t)return e;const r=ro(e)&&ro(t);if(r||qn(e)&&qn(t)){const n=r?e:Object.keys(e),s=n.length,o=r?t:Object.keys(t),a=o.length,i=r?[]:{},l=new Set(n);let d=0;for(let h=0;h<a;h++){const u=r?h:o[h];(!r&&l.has(u)||r)&&e[u]===void 0&&t[u]===void 0?(i[u]=void 0,d++):(i[u]=Qo(e[u],t[u]),i[u]===e[u]&&e[u]!==void 0&&d++)}return s===a&&d===s?e:i}return t}function on(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function ro(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function qn(e){if(!no(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!no(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function no(e){return Object.prototype.toString.call(e)==="[object Object]"}function Yc(e){return new Promise(t=>{setTimeout(t,e)})}function Kn(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?Qo(e,t):t}function Xc(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function Jc(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var ws=Symbol();function Yo(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ws?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Xo(e,t){return typeof e=="function"?e(...t):!!e}var el=class extends gr{#t;#e;#r;constructor(){super(),this.#r=e=>{if(!Qt&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#r=e,this.#e?.(),this.#e=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},_s=new el,tl=class extends gr{#t=!0;#e;#r;constructor(){super(),this.#r=e=>{if(!Qt&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#e||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#r=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#t}},an=new tl;function Qn(){let e,t;const r=new Promise((s,o)=>{e=s,t=o});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}function rl(e){return Math.min(1e3*2**e,3e4)}function Jo(e){return(e??"online")==="online"?an.isOnline():!0}var ea=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function ta(e){let t=!1,r=0,n;const s=Qn(),o=()=>s.status!=="pending",a=v=>{o()||(m(new ea(v)),e.abort?.())},i=()=>{t=!0},l=()=>{t=!1},d=()=>_s.isFocused()&&(e.networkMode==="always"||an.isOnline())&&e.canRun(),h=()=>Jo(e.networkMode)&&e.canRun(),u=v=>{o()||(n?.(),s.resolve(v))},m=v=>{o()||(n?.(),s.reject(v))},E=()=>new Promise(v=>{n=w=>{(o()||d())&&v(w)},e.onPause?.()}).then(()=>{n=void 0,o()||e.onContinue?.()}),S=()=>{if(o())return;let v;const w=r===0?e.initialPromise:void 0;try{v=w??e.fn()}catch(C){v=Promise.reject(C)}Promise.resolve(v).then(u).catch(C=>{if(o())return;const x=e.retry??(Qt?0:3),R=e.retryDelay??rl,T=typeof R=="function"?R(r,C):R,_=x===!0||typeof x=="number"&&r<x||typeof x=="function"&&x(r,C);if(t||!_){m(C);return}r++,e.onFail?.(r,C),Yc(T).then(()=>d()?void 0:E()).then(()=>{t?m(C):S()})})};return{promise:s,status:()=>s.status,cancel:a,continue:()=>(n?.(),s),cancelRetry:i,continueRetry:l,canStart:h,start:()=>(h()?S():E().then(S),s)}}var nl=e=>setTimeout(e,0);function sl(){let e=[],t=0,r=i=>{i()},n=i=>{i()},s=nl;const o=i=>{t?e.push(i):s(()=>{r(i)})},a=()=>{const i=e;e=[],i.length&&s(()=>{n(()=>{i.forEach(l=>{r(l)})})})};return{batch:i=>{let l;t++;try{l=i()}finally{t--,t||a()}return l},batchCalls:i=>(...l)=>{o(()=>{i(...l)})},schedule:o,setNotifyFunction:i=>{r=i},setBatchNotifyFunction:i=>{n=i},setScheduler:i=>{s=i}}}var Re=sl(),ra=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Gn(this.gcTime)&&(this.#t=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Qt?1/0:300*1e3))}clearGcTimeout(){this.#t&&(clearTimeout(this.#t),this.#t=void 0)}},ol=class extends ra{#t;#e;#r;#n;#s;#a;#i;constructor(e){super(),this.#i=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#n=e.client,this.#r=this.#n.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=al(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#s?.promise}setOptions(e){this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const r=Kn(this.state.data,e,this.options);return this.#o({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#o({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#s?.promise;return this.#s?.cancel(e),t?t.then(Oe).catch(Oe):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>qe(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ws||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Dt(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Ko(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#s?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#s?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#s&&(this.#i?this.#s.cancel({revert:!0}):this.#s.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#s?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#s)return this.#s.continueRetry(),this.#s.promise}if(e&&this.setOptions(e),!this.options.queryFn){const i=this.observers.find(l=>l.options.queryFn);i&&this.setOptions(i.options)}const r=new AbortController,n=i=>{Object.defineProperty(i,"signal",{enumerable:!0,get:()=>(this.#i=!0,r.signal)})},s=()=>{const i=Yo(this.options,t),d=(()=>{const h={client:this.#n,queryKey:this.queryKey,meta:this.meta};return n(h),h})();return this.#i=!1,this.options.persister?this.options.persister(i,d,this):i(d)},a=(()=>{const i={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#n,state:this.state,fetchFn:s};return n(i),i})();this.options.behavior?.onFetch(a,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#o({type:"fetch",meta:a.fetchOptions?.meta}),this.#s=ta({initialPromise:t?.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onFail:(i,l)=>{this.#o({type:"failed",failureCount:i,error:l})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{const i=await this.#s.start();if(i===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(i),this.#r.config.onSuccess?.(i,this),this.#r.config.onSettled?.(i,this.state.error,this),i}catch(i){if(i instanceof ea){if(i.silent)return this.#s.promise;if(i.revert){if(this.setState({...this.#e,fetchStatus:"idle"}),this.state.data===void 0)throw i;return this.state.data}}throw this.#o({type:"error",error:i}),this.#r.config.onError?.(i,this),this.#r.config.onSettled?.(this.state.data,i,this),i}finally{this.scheduleGc()}}#o(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...na(r.data,this.options),fetchMeta:e.meta??null};case"success":const n={...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=e.manual?n:void 0,n;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),Re.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function na(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Jo(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function al(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var il=class extends gr{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,r){const n=t.queryKey,s=t.queryHash??bs(n,t);let o=this.get(s);return o||(o=new ol({client:e,queryKey:n,queryHash:s,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(o)),o}add(e){this.#t.has(e.queryHash)||(this.#t.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#t.get(e.queryHash);t&&(e.destroy(),t===e&&this.#t.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Re.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#t.get(e)}getAll(){return[...this.#t.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>eo(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>eo(e,r)):t}notify(e){Re.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Re.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Re.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},cl=class extends ra{#t;#e;#r;constructor(e){super(),this.mutationId=e.mutationId,this.#e=e.mutationCache,this.#t=[],this.state=e.state||sa(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#e.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#e.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#n({type:"continue"})};this.#r=ta({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(s,o)=>{this.#n({type:"failed",failureCount:s,error:o})},onPause:()=>{this.#n({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});const r=this.state.status==="pending",n=!this.#r.canStart();try{if(r)t();else{this.#n({type:"pending",variables:e,isPaused:n}),await this.#e.config.onMutate?.(e,this);const o=await this.options.onMutate?.(e);o!==this.state.context&&this.#n({type:"pending",context:o,variables:e,isPaused:n})}const s=await this.#r.start();return await this.#e.config.onSuccess?.(s,e,this.state.context,this),await this.options.onSuccess?.(s,e,this.state.context),await this.#e.config.onSettled?.(s,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(s,null,e,this.state.context),this.#n({type:"success",data:s}),s}catch(s){try{throw await this.#e.config.onError?.(s,e,this.state.context,this),await this.options.onError?.(s,e,this.state.context),await this.#e.config.onSettled?.(void 0,s,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,s,e,this.state.context),s}finally{this.#n({type:"error",error:s})}}finally{this.#e.runNext(this)}}#n(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),Re.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#e.notify({mutation:this,type:"updated",action:e})})}};function sa(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ll=class extends gr{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#e=new Map,this.#r=0}#t;#e;#r;build(e,t,r){const n=new cl({mutationCache:this,mutationId:++this.#r,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#t.add(e);const t=Jr(e);if(typeof t=="string"){const r=this.#e.get(t);r?r.push(e):this.#e.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){const t=Jr(e);if(typeof t=="string"){const r=this.#e.get(t);if(r)if(r.length>1){const n=r.indexOf(e);n!==-1&&r.splice(n,1)}else r[0]===e&&this.#e.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Jr(e);if(typeof t=="string"){const n=this.#e.get(t)?.find(s=>s.state.status==="pending");return!n||n===e}else return!0}runNext(e){const t=Jr(e);return typeof t=="string"?this.#e.get(t)?.find(n=>n!==e&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Re.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(e){const t={exact:!0,...e};return this.getAll().find(r=>to(t,r))}findAll(e={}){return this.getAll().filter(t=>to(e,t))}notify(e){Re.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Re.batch(()=>Promise.all(e.map(t=>t.continue().catch(Oe))))}};function Jr(e){return e.options.scope?.id}function so(e){return{onFetch:(t,r)=>{const n=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let i={pages:[],pageParams:[]},l=0;const d=async()=>{let h=!1;const u=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(t.signal.aborted?h=!0:t.signal.addEventListener("abort",()=>{h=!0}),t.signal)})},m=Yo(t.options,t.fetchOptions),E=async(S,v,w)=>{if(h)return Promise.reject();if(v==null&&S.pages.length)return Promise.resolve(S);const x=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:v,direction:w?"backward":"forward",meta:t.options.meta};return u(P),P})(),R=await m(x),{maxPages:T}=t.options,_=w?Jc:Xc;return{pages:_(S.pages,R,T),pageParams:_(S.pageParams,v,T)}};if(s&&o.length){const S=s==="backward",v=S?ul:oo,w={pages:o,pageParams:a},C=v(n,w);i=await E(w,C,S)}else{const S=e??o.length;do{const v=l===0?a[0]??n.initialPageParam:oo(n,i);if(l>0&&v==null)break;i=await E(i,v),l++}while(l<S)}return i};t.options.persister?t.fetchFn=()=>t.options.persister?.(d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=d}}}function oo(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function ul(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var dl=class{#t;#e;#r;#n;#s;#a;#i;#o;constructor(e={}){this.#t=e.queryCache||new il,this.#e=e.mutationCache||new ll,this.#r=e.defaultOptions||{},this.#n=new Map,this.#s=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#i=_s.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#o=an.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#i?.(),this.#i=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#t.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#e.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#t.build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Dt(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#t.findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),o=this.#t.get(n.queryHash)?.state.data,a=Qc(t,o);if(a!==void 0)return this.#t.build(this,n).setData(a,{...r,manual:!0})}setQueriesData(e,t,r){return Re.batch(()=>this.#t.findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state}removeQueries(e){const t=this.#t;Re.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#t;return Re.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=Re.batch(()=>this.#t.findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Oe).catch(Oe)}invalidateQueries(e,t={}){return Re.batch(()=>(this.#t.findAll(e).forEach(r=>{r.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=Re.batch(()=>this.#t.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,r);return r.throwOnError||(o=o.catch(Oe)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(Oe)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#t.build(this,t);return r.isStaleByTime(Dt(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Oe).catch(Oe)}fetchInfiniteQuery(e){return e.behavior=so(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Oe).catch(Oe)}ensureInfiniteQueryData(e){return e.behavior=so(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return an.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#r}setDefaultOptions(e){this.#r=e}setQueryDefaults(e,t){this.#n.set(Yt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#n.values()],r={};return t.forEach(n=>{kr(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){this.#s.set(Yt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#s.values()],r={};return t.forEach(n=>{kr(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#r.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=bs(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ws&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#r.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},fl=class extends gr{constructor(e,t){super(),this.options=t,this.#t=e,this.#o=null,this.#i=Qn(),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#r=void 0;#n=void 0;#s;#a;#i;#o;#m;#f;#h;#l;#u;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),ao(this.#e,this.options)?this.#d():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Yn(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Yn(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#w(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,r=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof qe(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#_(),this.#e.setOptions(this.options),t._defaulted&&!on(this.options,t)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const n=this.hasListeners();n&&io(this.#e,r,this.options,t)&&this.#d(),this.updateResult(),n&&(this.#e!==r||qe(this.options.enabled,this.#e)!==qe(t.enabled,this.#e)||Dt(this.options.staleTime,this.#e)!==Dt(t.staleTime,this.#e))&&this.#g();const s=this.#v();n&&(this.#e!==r||qe(this.options.enabled,this.#e)!==qe(t.enabled,this.#e)||s!==this.#c)&&this.#y(s)}getOptimisticResult(e){const t=this.#t.getQueryCache().build(this.#t,e),r=this.createResult(t,e);return pl(this,r)&&(this.#n=r,this.#a=this.options,this.#s=this.#e.state),r}getCurrentResult(){return this.#n}trackResult(e,t){return new Proxy(e,{get:(r,n)=>(this.trackProp(n),t?.(n),n==="promise"&&!this.options.experimental_prefetchInRender&&this.#i.status==="pending"&&this.#i.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(r,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#t.defaultQueryOptions(e),r=this.#t.getQueryCache().build(this.#t,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#d(e){this.#_();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Oe)),t}#g(){this.#b();const e=Dt(this.options.staleTime,this.#e);if(Qt||this.#n.isStale||!Gn(e))return;const r=Ko(this.#n.dataUpdatedAt,e)+1;this.#l=setTimeout(()=>{this.#n.isStale||this.updateResult()},r)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#c=e,!(Qt||qe(this.options.enabled,this.#e)===!1||!Gn(this.#c)||this.#c===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||_s.isFocused())&&this.#d()},this.#c))}#x(){this.#g(),this.#y(this.#v())}#b(){this.#l&&(clearTimeout(this.#l),this.#l=void 0)}#w(){this.#u&&(clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const r=this.#e,n=this.options,s=this.#n,o=this.#s,a=this.#a,l=e!==r?e.state:this.#r,{state:d}=e;let h={...d},u=!1,m;if(t._optimisticResults){const U=this.hasListeners(),H=!U&&ao(e,t),G=U&&io(e,r,t,n);(H||G)&&(h={...h,...na(d.data,e.options)}),t._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:E,errorUpdatedAt:S,status:v}=h;m=h.data;let w=!1;if(t.placeholderData!==void 0&&m===void 0&&v==="pending"){let U;s?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(U=s.data,w=!0):U=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,U!==void 0&&(v="success",m=Kn(s?.data,U,t),u=!0)}if(t.select&&m!==void 0&&!w)if(s&&m===o?.data&&t.select===this.#m)m=this.#f;else try{this.#m=t.select,m=t.select(m),m=Kn(s?.data,m,t),this.#f=m,this.#o=null}catch(U){this.#o=U}this.#o&&(E=this.#o,m=this.#f,S=Date.now(),v="error");const C=h.fetchStatus==="fetching",x=v==="pending",R=v==="error",T=x&&C,_=m!==void 0,O={status:v,fetchStatus:h.fetchStatus,isPending:x,isSuccess:v==="success",isError:R,isInitialLoading:T,isLoading:T,data:m,dataUpdatedAt:h.dataUpdatedAt,error:E,errorUpdatedAt:S,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>l.dataUpdateCount||h.errorUpdateCount>l.errorUpdateCount,isFetching:C,isRefetching:C&&!x,isLoadingError:R&&!_,isPaused:h.fetchStatus==="paused",isPlaceholderData:u,isRefetchError:R&&_,isStale:Ss(e,t),refetch:this.refetch,promise:this.#i,isEnabled:qe(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const U=X=>{O.status==="error"?X.reject(O.error):O.data!==void 0&&X.resolve(O.data)},H=()=>{const X=this.#i=O.promise=Qn();U(X)},G=this.#i;switch(G.status){case"pending":e.queryHash===r.queryHash&&U(G);break;case"fulfilled":(O.status==="error"||O.data!==G.value)&&H();break;case"rejected":(O.status!=="error"||O.error!==G.reason)&&H();break}}return O}updateResult(){const e=this.#n,t=this.createResult(this.#e,this.options);if(this.#s=this.#e.state,this.#a=this.options,this.#s.data!==void 0&&(this.#h=this.#e),on(t,e))return;this.#n=t;const r=()=>{if(!e)return!0;const{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!this.#p.size)return!0;const o=new Set(s??this.#p);return this.options.throwOnError&&o.add("error"),Object.keys(this.#n).some(a=>{const i=a;return this.#n[i]!==e[i]&&o.has(i)})};this.#S({listeners:r()})}#_(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#r=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#x()}#S(e){Re.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#n)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function hl(e,t){return qe(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function ao(e,t){return hl(e,t)||e.state.data!==void 0&&Yn(e,t,t.refetchOnMount)}function Yn(e,t,r){if(qe(t.enabled,e)!==!1&&Dt(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Ss(e,t)}return!1}function io(e,t,r,n){return(e!==t||qe(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Ss(e,r)}function Ss(e,t){return qe(t.enabled,e)!==!1&&e.isStaleByTime(Dt(t.staleTime,e))}function pl(e,t){return!on(e.getCurrentResult(),t)}var ml=class extends gr{#t;#e=void 0;#r;#n;constructor(t,r){super(),this.#t=t,this.setOptions(r),this.bindMethods(),this.#s()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const r=this.options;this.options=this.#t.defaultMutationOptions(t),on(this.options,r)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),r?.mutationKey&&this.options.mutationKey&&Yt(r.mutationKey)!==Yt(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(t){this.#s(),this.#a(t)}getCurrentResult(){return this.#e}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#s(),this.#a()}mutate(t,r){return this.#n=r,this.#r?.removeObserver(this),this.#r=this.#t.getMutationCache().build(this.#t,this.options),this.#r.addObserver(this),this.#r.execute(t)}#s(){const t=this.#r?.state??sa();this.#e={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#a(t){Re.batch(()=>{if(this.#n&&this.hasListeners()){const r=this.#e.variables,n=this.#e.context;t?.type==="success"?(this.#n.onSuccess?.(t.data,r,n),this.#n.onSettled?.(t.data,null,r,n)):t?.type==="error"&&(this.#n.onError?.(t.error,r,n),this.#n.onSettled?.(void 0,t.error,r,n))}this.listeners.forEach(r=>{r(this.#e)})})}},oa=f.createContext(void 0),aa=e=>{const t=f.useContext(oa);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},zm=({client:e,children:t})=>(f.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(oa.Provider,{value:e,children:t})),ia=f.createContext(!1),gl=()=>f.useContext(ia);ia.Provider;function vl(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var yl=f.createContext(vl()),xl=()=>f.useContext(yl),bl=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},wl=e=>{f.useEffect(()=>{e.clearReset()},[e])},_l=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Xo(r,[e.error,n])),Sl=e=>{if(e.suspense){const t=n=>n==="static"?n:Math.max(n??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...n)=>t(r(...n)):t(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Cl=(e,t)=>e.isLoading&&e.isFetching&&!t,Tl=(e,t)=>e?.suspense&&t.isPending,co=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function El(e,t,r){const n=gl(),s=xl(),o=aa(),a=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=n?"isRestoring":"optimistic",Sl(a),bl(a,s),wl(s);const i=!o.getQueryCache().get(a.queryHash),[l]=f.useState(()=>new t(o,a)),d=l.getOptimisticResult(a),h=!n&&e.subscribed!==!1;if(f.useSyncExternalStore(f.useCallback(u=>{const m=h?l.subscribe(Re.batchCalls(u)):Oe;return l.updateResult(),m},[l,h]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),f.useEffect(()=>{l.setOptions(a)},[a,l]),Tl(a,d))throw co(a,l,s);if(_l({result:d,errorResetBoundary:s,throwOnError:a.throwOnError,query:o.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw d.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(a,d),a.experimental_prefetchInRender&&!Qt&&Cl(d,n)&&(i?co(a,l,s):o.getQueryCache().get(a.queryHash)?.promise)?.catch(Oe).finally(()=>{l.updateResult()}),a.notifyOnChangeProps?d:l.trackResult(d)}function Xn(e,t){return El(e,fl)}function ca(e,t){const r=aa(),[n]=f.useState(()=>new ml(r,e));f.useEffect(()=>{n.setOptions(e)},[n,e]);const s=f.useSyncExternalStore(f.useCallback(a=>n.subscribe(Re.batchCalls(a)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),o=f.useCallback((a,i)=>{n.mutate(a,i).catch(Oe)},[n]);if(s.error&&Xo(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}const Hm=new dl({defaultOptions:{queries:{staleTime:1e3*60,refetchOnWindowFocus:!1}}});/**
* @license lucide-react v0.540.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Rl=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),kl=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),lo=e=>{const t=kl(e);return t.charAt(0).toUpperCase()+t.slice(1)},la=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim(),jl=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
* @license lucide-react v0.540.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var Pl={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"};/**
* @license lucide-react v0.540.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Nl=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:o,iconNode:a,...i},l)=>f.createElement("svg",{ref:l,...Pl,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:la("lucide",s),...!o&&!jl(i)&&{"aria-hidden":"true"},...i},[...a.map(([d,h])=>f.createElement(d,h)),...Array.isArray(o)?o:[o]]));/**
* @license lucide-react v0.540.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qe=(e,t)=>{const r=f.forwardRef(({className:n,...s},o)=>f.createElement(Nl,{ref:o,iconNode:t,className:la(`lucide-${Rl(lo(e))}`,`lucide-${e}`,n),...s}));return r.displayName=lo(e),r};/**
* @license lucide-react v0.540.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Il=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ml=Qe("check",Il);/**
* @license lucide-react v0.540.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Al=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ua=Qe("chevron-down",Al);/**
* @license lucide-react v0.540.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ol=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Dl=Qe("chevron-left",Ol);/**
* @license lucide-react v0.540.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Fl=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Vl=Qe("chevron-right",Fl);/**
* @license lucide-react v0.540.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ll=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],$l=Qe("chevron-up",Ll);/**
* @license lucide-react v0.540.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ul=[["path",{d:"M11 20H2",key:"nlcfvz"}],["path",{d:"M11 4.562v16.157a1 1 0 0 0 1.242.97L19 20V5.562a2 2 0 0 0-1.515-1.94l-4-1A2 2 0 0 0 11 4.561z",key:"au4z13"}],["path",{d:"M11 4H8a2 2 0 0 0-2 2v14",key:"74r1mk"}],["path",{d:"M14 12h.01",key:"1jfl7z"}],["path",{d:"M22 20h-3",key:"vhrsz"}]],Bl=Qe("door-open",Ul);/**
* @license lucide-react v0.540.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zl=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Hl=Qe("ellipsis",zl);/**
* @license lucide-react v0.540.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Zl=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],da=Qe("eye-off",Zl);/**
* @license lucide-react v0.540.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wl=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],fa=Qe("eye",Wl);/**
* @license lucide-react v0.540.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Gl=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ql=Qe("search",Gl);/**
* @license lucide-react v0.540.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Kl=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Ql=Qe("square-pen",Kl);/**
* @license lucide-react v0.540.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Yl=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Cs=Qe("x",Yl);function Xl(){return c.jsx($c,{asChild:!0,children:c.jsx(mt,{size:"icon",children:c.jsx(Bl,{})})})}function Ts(e){const t=e+"CollectionProvider",[r,n]=Bt(t),[s,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:w,children:C}=v,x=y.useRef(null),R=y.useRef(new Map).current;return c.jsx(s,{scope:w,itemMap:R,collectionRef:x,children:C})};a.displayName=t;const i=e+"CollectionSlot",l=Rr(i),d=y.forwardRef((v,w)=>{const{scope:C,children:x}=v,R=o(i,C),T=ye(w,R.collectionRef);return c.jsx(l,{ref:T,children:x})});d.displayName=i;const h=e+"CollectionItemSlot",u="data-radix-collection-item",m=Rr(h),E=y.forwardRef((v,w)=>{const{scope:C,children:x,...R}=v,T=y.useRef(null),_=ye(w,T),P=o(h,C);return y.useEffect(()=>(P.itemMap.set(T,{ref:T,...R}),()=>void P.itemMap.delete(T))),c.jsx(m,{[u]:"",ref:_,children:x})});E.displayName=h;function S(v){const w=o(e+"CollectionConsumer",v);return y.useCallback(()=>{const x=w.collectionRef.current;if(!x)return[];const R=Array.from(x.querySelectorAll(`[${u}]`));return Array.from(w.itemMap.values()).sort((P,O)=>R.indexOf(P.ref.current)-R.indexOf(O.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:a,Slot:d,ItemSlot:E},S,n]}var Jl=f.createContext(void 0);function Hr(e){const t=f.useContext(Jl);return e||t||"ltr"}var Un="rovingFocusGroup.onEntryFocus",eu={bubbles:!1,cancelable:!0},Zr="RovingFocusGroup",[Jn,ha,tu]=Ts(Zr),[ru,En]=Bt(Zr,[tu]),[nu,su]=ru(Zr),pa=f.forwardRef((e,t)=>c.jsx(Jn.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(Jn.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(ou,{...e,ref:t})})}));pa.displayName=Zr;var ou=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:l,onEntryFocus:d,preventScrollOnEntryFocus:h=!1,...u}=e,m=f.useRef(null),E=ye(t,m),S=Hr(o),[v,w]=Ft({prop:a,defaultProp:i??null,onChange:l,caller:Zr}),[C,x]=f.useState(!1),R=ot(d),T=ha(r),_=f.useRef(!1),[P,O]=f.useState(0);return f.useEffect(()=>{const U=m.current;if(U)return U.addEventListener(Un,R),()=>U.removeEventListener(Un,R)},[R]),c.jsx(nu,{scope:r,orientation:n,dir:S,loop:s,currentTabStopId:v,onItemFocus:f.useCallback(U=>w(U),[w]),onItemShiftTab:f.useCallback(()=>x(!0),[]),onFocusableItemAdd:f.useCallback(()=>O(U=>U+1),[]),onFocusableItemRemove:f.useCallback(()=>O(U=>U-1),[]),children:c.jsx(oe.div,{tabIndex:C||P===0?-1:0,"data-orientation":n,...u,ref:E,style:{outline:"none",...e.style},onMouseDown:z(e.onMouseDown,()=>{_.current=!0}),onFocus:z(e.onFocus,U=>{const H=!_.current;if(U.target===U.currentTarget&&H&&!C){const G=new CustomEvent(Un,eu);if(U.currentTarget.dispatchEvent(G),!G.defaultPrevented){const X=T().filter(V=>V.focusable),B=X.find(V=>V.active),D=X.find(V=>V.id===v),ne=[B,D,...X].filter(Boolean).map(V=>V.ref.current);va(ne,h)}}_.current=!1}),onBlur:z(e.onBlur,()=>x(!1))})})}),ma="RovingFocusGroupItem",ga=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:o,children:a,...i}=e,l=kt(),d=o||l,h=su(ma,r),u=h.currentTabStopId===d,m=ha(r),{onFocusableItemAdd:E,onFocusableItemRemove:S,currentTabStopId:v}=h;return f.useEffect(()=>{if(n)return E(),()=>S()},[n,E,S]),c.jsx(Jn.ItemSlot,{scope:r,id:d,focusable:n,active:s,children:c.jsx(oe.span,{tabIndex:u?0:-1,"data-orientation":h.orientation,...i,ref:t,onMouseDown:z(e.onMouseDown,w=>{n?h.onItemFocus(d):w.preventDefault()}),onFocus:z(e.onFocus,()=>h.onItemFocus(d)),onKeyDown:z(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){h.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const C=cu(w,h.orientation,h.dir);if(C!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let R=m().filter(T=>T.focusable).map(T=>T.ref.current);if(C==="last")R.reverse();else if(C==="prev"||C==="next"){C==="prev"&&R.reverse();const T=R.indexOf(w.currentTarget);R=h.loop?lu(R,T+1):R.slice(T+1)}setTimeout(()=>va(R))}}),children:typeof a=="function"?a({isCurrentTabStop:u,hasTabStop:v!=null}):a})})});ga.displayName=ma;var au={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function iu(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function cu(e,t,r){const n=iu(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return au[n]}function va(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function lu(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var ya=pa,xa=ga,ba="Toggle",wa=f.forwardRef((e,t)=>{const{pressed:r,defaultPressed:n,onPressedChange:s,...o}=e,[a,i]=Ft({prop:r,onChange:s,defaultProp:n??!1,caller:ba});return c.jsx(oe.button,{type:"button","aria-pressed":a,"data-state":a?"on":"off","data-disabled":e.disabled?"":void 0,...o,ref:t,onClick:z(e.onClick,()=>{e.disabled||i(!a)})})});wa.displayName=ba;var zt="ToggleGroup",[_a,Zm]=Bt(zt,[En]),Sa=En(),Es=y.forwardRef((e,t)=>{const{type:r,...n}=e;if(r==="single"){const s=n;return c.jsx(uu,{...s,ref:t})}if(r==="multiple"){const s=n;return c.jsx(du,{...s,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${zt}\``)});Es.displayName=zt;var[Ca,Ta]=_a(zt),uu=y.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...o}=e,[a,i]=Ft({prop:r,defaultProp:n??"",onChange:s,caller:zt});return c.jsx(Ca,{scope:e.__scopeToggleGroup,type:"single",value:y.useMemo(()=>a?[a]:[],[a]),onItemActivate:i,onItemDeactivate:y.useCallback(()=>i(""),[i]),children:c.jsx(Ea,{...o,ref:t})})}),du=y.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...o}=e,[a,i]=Ft({prop:r,defaultProp:n??[],onChange:s,caller:zt}),l=y.useCallback(h=>i((u=[])=>[...u,h]),[i]),d=y.useCallback(h=>i((u=[])=>u.filter(m=>m!==h)),[i]);return c.jsx(Ca,{scope:e.__scopeToggleGroup,type:"multiple",value:a,onItemActivate:l,onItemDeactivate:d,children:c.jsx(Ea,{...o,ref:t})})});Es.displayName=zt;var[fu,hu]=_a(zt),Ea=y.forwardRef((e,t)=>{const{__scopeToggleGroup:r,disabled:n=!1,rovingFocus:s=!0,orientation:o,dir:a,loop:i=!0,...l}=e,d=Sa(r),h=Hr(a),u={role:"group",dir:h,...l};return c.jsx(fu,{scope:r,rovingFocus:s,disabled:n,children:s?c.jsx(ya,{asChild:!0,...d,orientation:o,dir:h,loop:i,children:c.jsx(oe.div,{...u,ref:t})}):c.jsx(oe.div,{...u,ref:t})})}),cn="ToggleGroupItem",Ra=y.forwardRef((e,t)=>{const r=Ta(cn,e.__scopeToggleGroup),n=hu(cn,e.__scopeToggleGroup),s=Sa(e.__scopeToggleGroup),o=r.value.includes(e.value),a=n.disabled||e.disabled,i={...e,pressed:o,disabled:a},l=y.useRef(null);return n.rovingFocus?c.jsx(xa,{asChild:!0,...s,focusable:!a,active:o,ref:l,children:c.jsx(uo,{...i,ref:t})}):c.jsx(uo,{...i,ref:t})});Ra.displayName=cn;var uo=y.forwardRef((e,t)=>{const{__scopeToggleGroup:r,value:n,...s}=e,o=Ta(cn,r),a={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},i=o.type==="single"?a:void 0;return c.jsx(wa,{...i,...s,ref:t,onPressedChange:l=>{l?o.onItemActivate(n):o.onItemDeactivate(n)}})}),pu=Es,mu=Ra;const gu=Uo("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),ka=f.createContext({size:"default",variant:"default"});function vu({className:e,variant:t,size:r,children:n,...s}){return c.jsx(pu,{"data-slot":"toggle-group","data-variant":t,"data-size":r,className:fe("group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",e),...s,children:c.jsx(ka.Provider,{value:{variant:t,size:r},children:n})})}function fo({className:e,children:t,variant:r,size:n,...s}){const o=f.useContext(ka);return c.jsx(mu,{"data-slot":"toggle-group-item","data-variant":o.variant||r,"data-size":o.size||n,className:fe(gu({variant:o.variant||r,size:o.size||n}),"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",e),...s,children:t})}function yu({filter:e,setFilter:t,activeFiltersCount:r,clearFilters:n}){return c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs(vu,{size:"sm",type:"single",value:e.statusFilter||"",onValueChange:s=>t({statusFilter:s||""}),className:"flex items-center gap-1 p-1 bg-muted rounded-lg",children:[c.jsxs(fo,{size:"sm",value:"listed","aria-label":"Hiển thị công khai",className:"flex items-center gap-2 px-3 py-2 rounded-md data-[state=on]:bg-green-100 data-[state=on]:text-green-700 data-[state=on]:border-green-200 hover:bg-green-50 transition-colors",children:[c.jsx(fa,{className:"h-2 w-2"}),c.jsx("span",{className:"text-sm font-medium",children:"Listed"})]}),c.jsxs(fo,{size:"sm",value:"unlisted","aria-label":"Ẩn khỏi danh sách",className:"flex items-center gap-2 px-3 py-2 rounded-md data-[state=on]:bg-orange-100 data-[state=on]:text-orange-700 data-[state=on]:border-orange-200 hover:bg-orange-50 transition-colors",children:[c.jsx(da,{className:"h-2 w-2"}),c.jsx("span",{className:"text-sm font-medium",children:"Unlisted"})]})]}),r>0&&c.jsxs(mt,{variant:"outline",size:"sm",onClick:n,className:"flex items-center gap-2 text-muted-foreground hover:text-foreground bg-transparent","aria-label":"clear",children:[c.jsx(Cs,{className:"h-2 w-2"}),c.jsx("span",{className:"text-sm",children:"Clear"})]})]})}function ja({color:e="black",...t}){return c.jsxs("div",{...t,className:fe("flex items-center justify-center flex-col gap-4",t.className),children:[c.jsx("div",{className:fe("!animate-spin rounded-full size-4 border-b-2",t.size,{"border-primary":e==="black","border-white":e==="white"})}),t.showLabel&&c.jsx("span",{children:"Đang tải..."})]})}var Wr=e=>e.type==="checkbox",qt=e=>e instanceof Date,De=e=>e==null;const Pa=e=>typeof e=="object";var Ce=e=>!De(e)&&!Array.isArray(e)&&Pa(e)&&!qt(e),Na=e=>Ce(e)&&e.target?Wr(e.target)?e.target.checked:e.target.value:e,xu=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Ia=(e,t)=>e.has(xu(t)),bu=e=>{const t=e.constructor&&e.constructor.prototype;return Ce(t)&&t.hasOwnProperty("isPrototypeOf")},Rs=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ee(e){let t;const r=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(Rs&&(e instanceof Blob||n))&&(r||Ce(e)))if(t=r?[]:Object.create(Object.getPrototypeOf(e)),!r&&!bu(e))t=e;else for(const s in e)e.hasOwnProperty(s)&&(t[s]=Ee(e[s]));else return e;return t}var Rn=e=>/^\w*$/.test(e),Se=e=>e===void 0,ks=e=>Array.isArray(e)?e.filter(Boolean):[],js=e=>ks(e.replace(/["|']|\]/g,"").split(/\.|\[/)),M=(e,t,r)=>{if(!t||!Ce(e))return r;const n=(Rn(t)?[t]:js(t)).reduce((s,o)=>De(s)?s:s[o],e);return Se(n)||n===e?Se(e[t])?r:e[t]:n},He=e=>typeof e=="boolean",me=(e,t,r)=>{let n=-1;const s=Rn(t)?[t]:js(t),o=s.length,a=o-1;for(;++n<o;){const i=s[n];let l=r;if(n!==a){const d=e[i];l=Ce(d)||Array.isArray(d)?d:isNaN(+s[n+1])?{}:[]}if(i==="__proto__"||i==="constructor"||i==="prototype")return;e[i]=l,e=e[i]}};const ln={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},at={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},wt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ps=y.createContext(null);Ps.displayName="HookFormContext";const kn=()=>y.useContext(Ps),wu=e=>{const{children:t,...r}=e;return y.createElement(Ps.Provider,{value:r},t)};var Ma=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const a=o;return t._proxyFormState[a]!==at.all&&(t._proxyFormState[a]=!n||at.all),r&&(r[a]=!0),e[a]}});return s};const Ns=typeof window<"u"?y.useLayoutEffect:y.useEffect;function Aa(e){const t=kn(),{control:r=t.control,disabled:n,name:s,exact:o}=e||{},[a,i]=y.useState(r._formState),l=y.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ns(()=>r._subscribe({name:s,formState:l.current,exact:o,callback:d=>{!n&&i({...r._formState,...d})}}),[s,n,o]),y.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),y.useMemo(()=>Ma(a,r,l.current,!1),[a,r])}var gt=e=>typeof e=="string",Oa=(e,t,r,n,s)=>gt(e)?(n&&t.watch.add(e),M(r,e,s)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),M(r,o))):(n&&(t.watchAll=!0),r),es=e=>De(e)||!Pa(e);function Rt(e,t,r=new WeakSet){if(es(e)||es(t))return e===t;if(qt(e)&&qt(t))return e.getTime()===t.getTime();const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const o of n){const a=e[o];if(!s.includes(o))return!1;if(o!=="ref"){const i=t[o];if(qt(a)&&qt(i)||Ce(a)&&Ce(i)||Array.isArray(a)&&Array.isArray(i)?!Rt(a,i,r):a!==i)return!1}}return!0}function _u(e){const t=kn(),{control:r=t.control,name:n,defaultValue:s,disabled:o,exact:a,compute:i}=e||{},l=y.useRef(s),d=y.useRef(i),h=y.useRef(void 0);d.current=i;const u=y.useMemo(()=>r._getWatch(n,l.current),[r,n]),[m,E]=y.useState(d.current?d.current(u):u);return Ns(()=>r._subscribe({name:n,formState:{values:!0},exact:a,callback:S=>{if(!o){const v=Oa(n,r._names,S.values||r._formValues,!1,l.current);if(d.current){const w=d.current(v);Rt(w,h.current)||(E(w),h.current=w)}else E(v)}}}),[r,o,n,a]),y.useEffect(()=>r._removeUnmounted()),m}function Su(e){const t=kn(),{name:r,disabled:n,control:s=t.control,shouldUnregister:o,defaultValue:a}=e,i=Ia(s._names.array,r),l=y.useMemo(()=>M(s._formValues,r,M(s._defaultValues,r,a)),[s,r,a]),d=_u({control:s,name:r,defaultValue:l,exact:!0}),h=Aa({control:s,name:r,exact:!0}),u=y.useRef(e),m=y.useRef(s.register(r,{...e.rules,value:d,...He(e.disabled)?{disabled:e.disabled}:{}}));u.current=e;const E=y.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!M(h.errors,r)},isDirty:{enumerable:!0,get:()=>!!M(h.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!M(h.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!M(h.validatingFields,r)},error:{enumerable:!0,get:()=>M(h.errors,r)}}),[h,r]),S=y.useCallback(x=>m.current.onChange({target:{value:Na(x),name:r},type:ln.CHANGE}),[r]),v=y.useCallback(()=>m.current.onBlur({target:{value:M(s._formValues,r),name:r},type:ln.BLUR}),[r,s._formValues]),w=y.useCallback(x=>{const R=M(s._fields,r);R&&x&&(R._f.ref={focus:()=>x.focus&&x.focus(),select:()=>x.select&&x.select(),setCustomValidity:T=>x.setCustomValidity(T),reportValidity:()=>x.reportValidity()})},[s._fields,r]),C=y.useMemo(()=>({name:r,value:d,...He(n)||h.disabled?{disabled:h.disabled||n}:{},onChange:S,onBlur:v,ref:w}),[r,n,h.disabled,S,v,w,d]);return y.useEffect(()=>{const x=s._options.shouldUnregister||o;s.register(r,{...u.current.rules,...He(u.current.disabled)?{disabled:u.current.disabled}:{}});const R=(T,_)=>{const P=M(s._fields,T);P&&P._f&&(P._f.mount=_)};if(R(r,!0),x){const T=Ee(M(s._options.defaultValues,r));me(s._defaultValues,r,T),Se(M(s._formValues,r))&&me(s._formValues,r,T)}return!i&&s.register(r),()=>{(i?x&&!s._state.action:x)?s.unregister(r):R(r,!1)}},[r,s,i,o]),y.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),y.useMemo(()=>({field:C,formState:h,fieldState:E}),[C,h,E])}const Cu=e=>e.render(Su(e));var Is=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Tr=e=>Array.isArray(e)?e:[e],ho=()=>{let e=[];return{get observers(){return e},next:s=>{for(const o of e)o.next&&o.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(o=>o!==s)}}),unsubscribe:()=>{e=[]}}},$e=e=>Ce(e)&&!Object.keys(e).length,Ms=e=>e.type==="file",it=e=>typeof e=="function",un=e=>{if(!Rs)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Da=e=>e.type==="select-multiple",As=e=>e.type==="radio",Tu=e=>As(e)||Wr(e),Bn=e=>un(e)&&e.isConnected;function Eu(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Se(e)?n++:e[t[n++]];return e}function Ru(e){for(const t in e)if(e.hasOwnProperty(t)&&!Se(e[t]))return!1;return!0}function Te(e,t){const r=Array.isArray(t)?t:Rn(t)?[t]:js(t),n=r.length===1?e:Eu(e,r),s=r.length-1,o=r[s];return n&&delete n[o],s!==0&&(Ce(n)&&$e(n)||Array.isArray(n)&&Ru(n))&&Te(e,r.slice(0,-1)),e}var Fa=e=>{for(const t in e)if(it(e[t]))return!0;return!1};function dn(e,t={}){const r=Array.isArray(e);if(Ce(e)||r)for(const n in e)Array.isArray(e[n])||Ce(e[n])&&!Fa(e[n])?(t[n]=Array.isArray(e[n])?[]:{},dn(e[n],t[n])):De(e[n])||(t[n]=!0);return t}function Va(e,t,r){const n=Array.isArray(e);if(Ce(e)||n)for(const s in e)Array.isArray(e[s])||Ce(e[s])&&!Fa(e[s])?Se(t)||es(r[s])?r[s]=Array.isArray(e[s])?dn(e[s],[]):{...dn(e[s])}:Va(e[s],De(t)?{}:t[s],r[s]):r[s]=!Rt(e[s],t[s]);return r}var wr=(e,t)=>Va(e,t,dn(t));const po={value:!1,isValid:!1},mo={value:!0,isValid:!0};var La=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Se(e[0].attributes.value)?Se(e[0].value)||e[0].value===""?mo:{value:e[0].value,isValid:!0}:mo:po}return po},$a=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Se(e)?e:t?e===""?NaN:e&&+e:r&&gt(e)?new Date(e):n?n(e):e;const go={isValid:!1,value:null};var Ua=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,go):go;function vo(e){const t=e.ref;return Ms(t)?t.files:As(t)?Ua(e.refs).value:Da(t)?[...t.selectedOptions].map(({value:r})=>r):Wr(t)?La(e.refs).value:$a(Se(t.value)?e.ref.value:t.value,e)}var ku=(e,t,r,n)=>{const s={};for(const o of e){const a=M(t,o);a&&me(s,o,a._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},fn=e=>e instanceof RegExp,_r=e=>Se(e)?e:fn(e)?e.source:Ce(e)?fn(e.value)?e.value.source:e.value:e,yo=e=>({isOnSubmit:!e||e===at.onSubmit,isOnBlur:e===at.onBlur,isOnChange:e===at.onChange,isOnAll:e===at.all,isOnTouch:e===at.onTouched});const xo="AsyncFunction";var ju=e=>!!e&&!!e.validate&&!!(it(e.validate)&&e.validate.constructor.name===xo||Ce(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===xo)),Pu=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),bo=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Er=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const o=M(e,s);if(o){const{_f:a,...i}=o;if(a){if(a.refs&&a.refs[0]&&t(a.refs[0],s)&&!n)return!0;if(a.ref&&t(a.ref,a.name)&&!n)return!0;if(Er(i,t))break}else if(Ce(i)&&Er(i,t))break}}};function wo(e,t,r){const n=M(e,r);if(n||Rn(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),a=M(t,o),i=M(e,o);if(a&&!Array.isArray(a)&&r!==o)return{name:r};if(i&&i.type)return{name:o,error:i};if(i&&i.root&&i.root.type)return{name:`${o}.root`,error:i.root};s.pop()}return{name:r}}var Nu=(e,t,r,n)=>{r(e);const{name:s,...o}=e;return $e(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(a=>t[a]===(!n||at.all))},Iu=(e,t,r)=>!e||!t||e===t||Tr(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),Mu=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,Au=(e,t)=>!ks(M(e,t)).length&&Te(e,t),Ou=(e,t,r)=>{const n=Tr(M(e,r));return me(n,"root",t[r]),me(e,r,n),e},sn=e=>gt(e);function _o(e,t,r="validate"){if(sn(e)||Array.isArray(e)&&e.every(sn)||He(e)&&!e)return{type:r,message:sn(e)?e:"",ref:t}}var ir=e=>Ce(e)&&!fn(e)?e:{value:e,message:""},So=async(e,t,r,n,s,o)=>{const{ref:a,refs:i,required:l,maxLength:d,minLength:h,min:u,max:m,pattern:E,validate:S,name:v,valueAsNumber:w,mount:C}=e._f,x=M(r,v);if(!C||t.has(v))return{};const R=i?i[0]:a,T=B=>{s&&R.reportValidity&&(R.setCustomValidity(He(B)?"":B||""),R.reportValidity())},_={},P=As(a),O=Wr(a),U=P||O,H=(w||Ms(a))&&Se(a.value)&&Se(x)||un(a)&&a.value===""||x===""||Array.isArray(x)&&!x.length,G=Is.bind(null,v,n,_),X=(B,D,q,ne=wt.maxLength,V=wt.minLength)=>{const te=B?D:q;_[v]={type:B?ne:V,message:te,ref:a,...G(B?ne:V,te)}};if(o?!Array.isArray(x)||!x.length:l&&(!U&&(H||De(x))||He(x)&&!x||O&&!La(i).isValid||P&&!Ua(i).isValid)){const{value:B,message:D}=sn(l)?{value:!!l,message:l}:ir(l);if(B&&(_[v]={type:wt.required,message:D,ref:R,...G(wt.required,D)},!n))return T(D),_}if(!H&&(!De(u)||!De(m))){let B,D;const q=ir(m),ne=ir(u);if(!De(x)&&!isNaN(x)){const V=a.valueAsNumber||x&&+x;De(q.value)||(B=V>q.value),De(ne.value)||(D=V<ne.value)}else{const V=a.valueAsDate||new Date(x),te=ve=>new Date(new Date().toDateString()+" "+ve),ue=a.type=="time",$=a.type=="week";gt(q.value)&&x&&(B=ue?te(x)>te(q.value):$?x>q.value:V>new Date(q.value)),gt(ne.value)&&x&&(D=ue?te(x)<te(ne.value):$?x<ne.value:V<new Date(ne.value))}if((B||D)&&(X(!!B,q.message,ne.message,wt.max,wt.min),!n))return T(_[v].message),_}if((d||h)&&!H&&(gt(x)||o&&Array.isArray(x))){const B=ir(d),D=ir(h),q=!De(B.value)&&x.length>+B.value,ne=!De(D.value)&&x.length<+D.value;if((q||ne)&&(X(q,B.message,D.message),!n))return T(_[v].message),_}if(E&&!H&&gt(x)){const{value:B,message:D}=ir(E);if(fn(B)&&!x.match(B)&&(_[v]={type:wt.pattern,message:D,ref:a,...G(wt.pattern,D)},!n))return T(D),_}if(S){if(it(S)){const B=await S(x,r),D=_o(B,R);if(D&&(_[v]={...D,...G(wt.validate,D.message)},!n))return T(D.message),_}else if(Ce(S)){let B={};for(const D in S){if(!$e(B)&&!n)break;const q=_o(await S[D](x,r),R,D);q&&(B={...q,...G(D,q.message)},T(q.message),n&&(_[v]=B))}if(!$e(B)&&(_[v]={ref:R,...B},!n))return _}}return T(!0),_};const Du={mode:at.onSubmit,reValidateMode:at.onChange,shouldFocusError:!0};function Fu(e={}){let t={...Du,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:it(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=Ce(t.defaultValues)||Ce(t.values)?Ee(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:Ee(s),a={action:!1,mount:!1,watch:!1},i={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,d=0;const h={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let u={...h};const m={array:ho(),state:ho()},E=t.criteriaMode===at.all,S=p=>g=>{clearTimeout(d),d=setTimeout(p,g)},v=async p=>{if(!t.disabled&&(h.isValid||u.isValid||p)){const g=t.resolver?$e((await O()).errors):await H(n,!0);g!==r.isValid&&m.state.next({isValid:g})}},w=(p,g)=>{!t.disabled&&(h.isValidating||h.validatingFields||u.isValidating||u.validatingFields)&&((p||Array.from(i.mount)).forEach(b=>{b&&(g?me(r.validatingFields,b,g):Te(r.validatingFields,b))}),m.state.next({validatingFields:r.validatingFields,isValidating:!$e(r.validatingFields)}))},C=(p,g=[],b,I,N=!0,j=!0)=>{if(I&&b&&!t.disabled){if(a.action=!0,j&&Array.isArray(M(n,p))){const W=b(M(n,p),I.argA,I.argB);N&&me(n,p,W)}if(j&&Array.isArray(M(r.errors,p))){const W=b(M(r.errors,p),I.argA,I.argB);N&&me(r.errors,p,W),Au(r.errors,p)}if((h.touchedFields||u.touchedFields)&&j&&Array.isArray(M(r.touchedFields,p))){const W=b(M(r.touchedFields,p),I.argA,I.argB);N&&me(r.touchedFields,p,W)}(h.dirtyFields||u.dirtyFields)&&(r.dirtyFields=wr(s,o)),m.state.next({name:p,isDirty:X(p,g),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else me(o,p,g)},x=(p,g)=>{me(r.errors,p,g),m.state.next({errors:r.errors})},R=p=>{r.errors=p,m.state.next({errors:r.errors,isValid:!1})},T=(p,g,b,I)=>{const N=M(n,p);if(N){const j=M(o,p,Se(b)?M(s,p):b);Se(j)||I&&I.defaultChecked||g?me(o,p,g?j:vo(N._f)):q(p,j),a.mount&&v()}},_=(p,g,b,I,N)=>{let j=!1,W=!1;const de={name:p};if(!t.disabled){if(!b||I){(h.isDirty||u.isDirty)&&(W=r.isDirty,r.isDirty=de.isDirty=X(),j=W!==de.isDirty);const pe=Rt(M(s,p),g);W=!!M(r.dirtyFields,p),pe?Te(r.dirtyFields,p):me(r.dirtyFields,p,!0),de.dirtyFields=r.dirtyFields,j=j||(h.dirtyFields||u.dirtyFields)&&W!==!pe}if(b){const pe=M(r.touchedFields,p);pe||(me(r.touchedFields,p,b),de.touchedFields=r.touchedFields,j=j||(h.touchedFields||u.touchedFields)&&pe!==b)}j&&N&&m.state.next(de)}return j?de:{}},P=(p,g,b,I)=>{const N=M(r.errors,p),j=(h.isValid||u.isValid)&&He(g)&&r.isValid!==g;if(t.delayError&&b?(l=S(()=>x(p,b)),l(t.delayError)):(clearTimeout(d),l=null,b?me(r.errors,p,b):Te(r.errors,p)),(b?!Rt(N,b):N)||!$e(I)||j){const W={...I,...j&&He(g)?{isValid:g}:{},errors:r.errors,name:p};r={...r,...W},m.state.next(W)}},O=async p=>{w(p,!0);const g=await t.resolver(o,t.context,ku(p||i.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return w(p),g},U=async p=>{const{errors:g}=await O(p);if(p)for(const b of p){const I=M(g,b);I?me(r.errors,b,I):Te(r.errors,b)}else r.errors=g;return g},H=async(p,g,b={valid:!0})=>{for(const I in p){const N=p[I];if(N){const{_f:j,...W}=N;if(j){const de=i.array.has(j.name),pe=N._f&&ju(N._f);pe&&h.validatingFields&&w([I],!0);const Ne=await So(N,i.disabled,o,E,t.shouldUseNativeValidation&&!g,de);if(pe&&h.validatingFields&&w([I]),Ne[j.name]&&(b.valid=!1,g))break;!g&&(M(Ne,j.name)?de?Ou(r.errors,Ne,j.name):me(r.errors,j.name,Ne[j.name]):Te(r.errors,j.name))}!$e(W)&&await H(W,g,b)}}return b.valid},G=()=>{for(const p of i.unMount){const g=M(n,p);g&&(g._f.refs?g._f.refs.every(b=>!Bn(b)):!Bn(g._f.ref))&&L(p)}i.unMount=new Set},X=(p,g)=>!t.disabled&&(p&&g&&me(o,p,g),!Rt(ve(),s)),B=(p,g,b)=>Oa(p,i,{...a.mount?o:Se(g)?s:gt(p)?{[p]:g}:g},b,g),D=p=>ks(M(a.mount?o:s,p,t.shouldUnregister?M(s,p,[]):[])),q=(p,g,b={})=>{const I=M(n,p);let N=g;if(I){const j=I._f;j&&(!j.disabled&&me(o,p,$a(g,j)),N=un(j.ref)&&De(g)?"":g,Da(j.ref)?[...j.ref.options].forEach(W=>W.selected=N.includes(W.value)):j.refs?Wr(j.ref)?j.refs.forEach(W=>{(!W.defaultChecked||!W.disabled)&&(Array.isArray(N)?W.checked=!!N.find(de=>de===W.value):W.checked=N===W.value||!!N)}):j.refs.forEach(W=>W.checked=W.value===N):Ms(j.ref)?j.ref.value="":(j.ref.value=N,j.ref.type||m.state.next({name:p,values:Ee(o)})))}(b.shouldDirty||b.shouldTouch)&&_(p,N,b.shouldTouch,b.shouldDirty,!0),b.shouldValidate&&$(p)},ne=(p,g,b)=>{for(const I in g){if(!g.hasOwnProperty(I))return;const N=g[I],j=p+"."+I,W=M(n,j);(i.array.has(p)||Ce(N)||W&&!W._f)&&!qt(N)?ne(j,N,b):q(j,N,b)}},V=(p,g,b={})=>{const I=M(n,p),N=i.array.has(p),j=Ee(g);me(o,p,j),N?(m.array.next({name:p,values:Ee(o)}),(h.isDirty||h.dirtyFields||u.isDirty||u.dirtyFields)&&b.shouldDirty&&m.state.next({name:p,dirtyFields:wr(s,o),isDirty:X(p,j)})):I&&!I._f&&!De(j)?ne(p,j,b):q(p,j,b),bo(p,i)&&m.state.next({...r,name:p}),m.state.next({name:a.mount?p:void 0,values:Ee(o)})},te=async p=>{a.mount=!0;const g=p.target;let b=g.name,I=!0;const N=M(n,b),j=pe=>{I=Number.isNaN(pe)||qt(pe)&&isNaN(pe.getTime())||Rt(pe,M(o,b,pe))},W=yo(t.mode),de=yo(t.reValidateMode);if(N){let pe,Ne;const et=g.type?vo(N._f):Na(p),tt=p.type===ln.BLUR||p.type===ln.FOCUS_OUT,Mt=!Pu(N._f)&&!t.resolver&&!M(r.errors,b)&&!N._f.deps||Mu(tt,M(r.touchedFields,b),r.isSubmitted,de,W),yr=bo(b,i,tt);me(o,b,et),tt?(!g||!g.readOnly)&&(N._f.onBlur&&N._f.onBlur(p),l&&l(0)):N._f.onChange&&N._f.onChange(p);const xr=_(b,et,tt),Qr=!$e(xr)||yr;if(!tt&&m.state.next({name:b,type:p.type,values:Ee(o)}),Mt)return(h.isValid||u.isValid)&&(t.mode==="onBlur"?tt&&v():tt||v()),Qr&&m.state.next({name:b,...yr?{}:xr});if(!tt&&yr&&m.state.next({...r}),t.resolver){const{errors:br}=await O([b]);if(j(et),I){const $n=wo(r.errors,n,b),ar=wo(br,n,$n.name||b);pe=ar.error,b=ar.name,Ne=$e(br)}}else w([b],!0),pe=(await So(N,i.disabled,o,E,t.shouldUseNativeValidation))[b],w([b]),j(et),I&&(pe?Ne=!1:(h.isValid||u.isValid)&&(Ne=await H(n,!0)));I&&(N._f.deps&&$(N._f.deps),P(b,Ne,pe,xr))}},ue=(p,g)=>{if(M(r.errors,g)&&p.focus)return p.focus(),1},$=async(p,g={})=>{let b,I;const N=Tr(p);if(t.resolver){const j=await U(Se(p)?p:N);b=$e(j),I=p?!N.some(W=>M(j,W)):b}else p?(I=(await Promise.all(N.map(async j=>{const W=M(n,j);return await H(W&&W._f?{[j]:W}:W)}))).every(Boolean),!(!I&&!r.isValid)&&v()):I=b=await H(n);return m.state.next({...!gt(p)||(h.isValid||u.isValid)&&b!==r.isValid?{}:{name:p},...t.resolver||!p?{isValid:b}:{},errors:r.errors}),g.shouldFocus&&!I&&Er(n,ue,p?N:i.mount),I},ve=p=>{const g={...a.mount?o:s};return Se(p)?g:gt(p)?M(g,p):p.map(b=>M(g,b))},we=(p,g)=>({invalid:!!M((g||r).errors,p),isDirty:!!M((g||r).dirtyFields,p),error:M((g||r).errors,p),isValidating:!!M(r.validatingFields,p),isTouched:!!M((g||r).touchedFields,p)}),Pe=p=>{p&&Tr(p).forEach(g=>Te(r.errors,g)),m.state.next({errors:p?r.errors:{}})},J=(p,g,b)=>{const I=(M(n,p,{_f:{}})._f||{}).ref,N=M(r.errors,p)||{},{ref:j,message:W,type:de,...pe}=N;me(r.errors,p,{...pe,...g,ref:I}),m.state.next({name:p,errors:r.errors,isValid:!1}),b&&b.shouldFocus&&I&&I.focus&&I.focus()},ae=(p,g)=>it(p)?m.state.subscribe({next:b=>"values"in b&&p(B(void 0,g),b)}):B(p,g,!0),ce=p=>m.state.subscribe({next:g=>{Iu(p.name,g.name,p.exact)&&Nu(g,p.formState||h,Je,p.reRenderRoot)&&p.callback({values:{...o},...r,...g,defaultValues:s})}}).unsubscribe,xe=p=>(a.mount=!0,u={...u,...p.formState},ce({...p,formState:u})),L=(p,g={})=>{for(const b of p?Tr(p):i.mount)i.mount.delete(b),i.array.delete(b),g.keepValue||(Te(n,b),Te(o,b)),!g.keepError&&Te(r.errors,b),!g.keepDirty&&Te(r.dirtyFields,b),!g.keepTouched&&Te(r.touchedFields,b),!g.keepIsValidating&&Te(r.validatingFields,b),!t.shouldUnregister&&!g.keepDefaultValue&&Te(s,b);m.state.next({values:Ee(o)}),m.state.next({...r,...g.keepDirty?{isDirty:X()}:{}}),!g.keepIsValid&&v()},K=({disabled:p,name:g})=>{(He(p)&&a.mount||p||i.disabled.has(g))&&(p?i.disabled.add(g):i.disabled.delete(g))},be=(p,g={})=>{let b=M(n,p);const I=He(g.disabled)||He(t.disabled);return me(n,p,{...b||{},_f:{...b&&b._f?b._f:{ref:{name:p}},name:p,mount:!0,...g}}),i.mount.add(p),b?K({disabled:He(g.disabled)?g.disabled:t.disabled,name:p}):T(p,!0,g.value),{...I?{disabled:g.disabled||t.disabled}:{},...t.progressive?{required:!!g.required,min:_r(g.min),max:_r(g.max),minLength:_r(g.minLength),maxLength:_r(g.maxLength),pattern:_r(g.pattern)}:{},name:p,onChange:te,onBlur:te,ref:N=>{if(N){be(p,g),b=M(n,p);const j=Se(N.value)&&N.querySelectorAll&&N.querySelectorAll("input,select,textarea")[0]||N,W=Tu(j),de=b._f.refs||[];if(W?de.find(pe=>pe===j):j===b._f.ref)return;me(n,p,{_f:{...b._f,...W?{refs:[...de.filter(Bn),j,...Array.isArray(M(s,p))?[{}]:[]],ref:{type:j.type,name:p}}:{ref:j}}}),T(p,!1,void 0,j)}else b=M(n,p,{}),b._f&&(b._f.mount=!1),(t.shouldUnregister||g.shouldUnregister)&&!(Ia(i.array,p)&&a.action)&&i.unMount.add(p)}}},le=()=>t.shouldFocusError&&Er(n,ue,i.mount),he=p=>{He(p)&&(m.state.next({disabled:p}),Er(n,(g,b)=>{const I=M(n,b);I&&(g.disabled=I._f.disabled||p,Array.isArray(I._f.refs)&&I._f.refs.forEach(N=>{N.disabled=I._f.disabled||p}))},0,!1))},ge=(p,g)=>async b=>{let I;b&&(b.preventDefault&&b.preventDefault(),b.persist&&b.persist());let N=Ee(o);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:j,values:W}=await O();r.errors=j,N=Ee(W)}else await H(n);if(i.disabled.size)for(const j of i.disabled)Te(N,j);if(Te(r.errors,"root"),$e(r.errors)){m.state.next({errors:{}});try{await p(N,b)}catch(j){I=j}}else g&&await g({...r.errors},b),le(),setTimeout(le);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:$e(r.errors)&&!I,submitCount:r.submitCount+1,errors:r.errors}),I)throw I},Xe=(p,g={})=>{M(n,p)&&(Se(g.defaultValue)?V(p,Ee(M(s,p))):(V(p,g.defaultValue),me(s,p,Ee(g.defaultValue))),g.keepTouched||Te(r.touchedFields,p),g.keepDirty||(Te(r.dirtyFields,p),r.isDirty=g.defaultValue?X(p,Ee(M(s,p))):X()),g.keepError||(Te(r.errors,p),h.isValid&&v()),m.state.next({...r}))},Le=(p,g={})=>{const b=p?Ee(p):s,I=Ee(b),N=$e(p),j=N?s:I;if(g.keepDefaultValues||(s=b),!g.keepValues){if(g.keepDirtyValues){const W=new Set([...i.mount,...Object.keys(wr(s,o))]);for(const de of Array.from(W))M(r.dirtyFields,de)?me(j,de,M(o,de)):V(de,M(j,de))}else{if(Rs&&Se(p))for(const W of i.mount){const de=M(n,W);if(de&&de._f){const pe=Array.isArray(de._f.refs)?de._f.refs[0]:de._f.ref;if(un(pe)){const Ne=pe.closest("form");if(Ne){Ne.reset();break}}}}if(g.keepFieldsRef)for(const W of i.mount)V(W,M(j,W));else n={}}o=t.shouldUnregister?g.keepDefaultValues?Ee(s):{}:Ee(j),m.array.next({values:{...j}}),m.state.next({values:{...j}})}i={mount:g.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!h.isValid||!!g.keepIsValid||!!g.keepDirtyValues,a.watch=!!t.shouldUnregister,m.state.next({submitCount:g.keepSubmitCount?r.submitCount:0,isDirty:N?!1:g.keepDirty?r.isDirty:!!(g.keepDefaultValues&&!Rt(p,s)),isSubmitted:g.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:N?{}:g.keepDirtyValues?g.keepDefaultValues&&o?wr(s,o):r.dirtyFields:g.keepDefaultValues&&p?wr(s,p):g.keepDirty?r.dirtyFields:{},touchedFields:g.keepTouched?r.touchedFields:{},errors:g.keepErrors?r.errors:{},isSubmitSuccessful:g.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Nt=(p,g)=>Le(it(p)?p(o):p,g),It=(p,g={})=>{const b=M(n,p),I=b&&b._f;if(I){const N=I.refs?I.refs[0]:I.ref;N.focus&&(N.focus(),g.shouldSelect&&it(N.select)&&N.select())}},Je=p=>{r={...r,...p}},We={control:{register:be,unregister:L,getFieldState:we,handleSubmit:ge,setError:J,_subscribe:ce,_runSchema:O,_focusError:le,_getWatch:B,_getDirty:X,_setValid:v,_setFieldArray:C,_setDisabledField:K,_setErrors:R,_getFieldArray:D,_reset:Le,_resetDefaultValues:()=>it(t.defaultValues)&&t.defaultValues().then(p=>{Nt(p,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:G,_disableForm:he,_subjects:m,_proxyFormState:h,get _fields(){return n},get _formValues(){return o},get _state(){return a},set _state(p){a=p},get _defaultValues(){return s},get _names(){return i},set _names(p){i=p},get _formState(){return r},get _options(){return t},set _options(p){t={...t,...p}}},subscribe:xe,trigger:$,register:be,handleSubmit:ge,watch:ae,setValue:V,getValues:ve,reset:Nt,resetField:Xe,clearErrors:Pe,unregister:L,setError:J,setFocus:It,getFieldState:we};return{...We,formControl:We}}function Vu(e={}){const t=y.useRef(void 0),r=y.useRef(void 0),[n,s]=y.useState({isDirty:!1,isValidating:!1,isLoading:it(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:it(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!it(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...i}=Fu(e);t.current={...i,formState:n}}const o=t.current.control;return o._options=e,Ns(()=>{const a=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState}),reRenderRoot:!0});return s(i=>({...i,isReady:!0})),o._formState.isReady=!0,a},[o]),y.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),y.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),y.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),y.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),y.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==n.isDirty&&o._subjects.state.next({isDirty:a})}},[o,n.isDirty]),y.useEffect(()=>{e.values&&!Rt(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),r.current=e.values,s(a=>({...a}))):o._resetDefaultValues()},[o,e.values]),y.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=Ma(n,o),t.current}const Co=(e,t,r)=>{if(e&&"reportValidity"in e){const n=M(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},ts=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Co(n.ref,r,e):n&&n.refs&&n.refs.forEach(s=>Co(s,r,e))}},To=(e,t)=>{t.shouldUseNativeValidation&&ts(e,t);const r={};for(const n in e){const s=M(t.fields,n),o=Object.assign(e[n]||{},{ref:s&&s.ref});if(Lu(t.names||Object.keys(e),n)){const a=Object.assign({},M(r,n));me(a,"root",o),me(r,n,a)}else me(r,n,o)}return r},Lu=(e,t)=>{const r=Eo(t);return e.some(n=>Eo(n).match(`^${r}\\.\\d+`))};function Eo(e){return e.replace(/\]|\[/g,"")}function Ba(e,t,r){function n(i,l){var d;Object.defineProperty(i,"_zod",{value:i._zod??{},enumerable:!1}),(d=i._zod).traits??(d.traits=new Set),i._zod.traits.add(e),t(i,l);for(const h in a.prototype)h in i||Object.defineProperty(i,h,{value:a.prototype[h].bind(i)});i._zod.constr=a,i._zod.def=l}const s=r?.Parent??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function a(i){var l;const d=r?.Parent?new o:this;n(d,i),(l=d._zod).deferred??(l.deferred=[]);for(const h of d._zod.deferred)h();return d}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:i=>r?.Parent&&i instanceof r.Parent?!0:i?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class $u extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Uu={};function za(e){return Uu}function Bu(e,t){return typeof t=="bigint"?t.toString():t}const Ha="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function en(e){return typeof e=="string"?e:e?.message}function Za(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const s=en(e.inst?._zod.def?.error?.(e))??en(t?.error?.(e))??en(r.customError?.(e))??en(r.localeError?.(e))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}const Wa=(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,Bu,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},zu=Ba("$ZodError",Wa),Ga=Ba("$ZodError",Wa,{Parent:Error}),Hu=e=>(t,r,n,s)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new $u;if(a.issues.length){const i=new(s?.Err??e)(a.issues.map(l=>Za(l,o,za())));throw Ha(i,s?.callee),i}return a.value},Zu=Hu(Ga),Wu=e=>async(t,r,n,s)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const i=new(s?.Err??e)(a.issues.map(l=>Za(l,o,za())));throw Ha(i,s?.callee),i}return a.value},Gu=Wu(Ga);function Ro(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function qu(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,a=n.path.join(".");if(!r[a])if("unionErrors"in n){var i=n.unionErrors[0].errors[0];r[a]={message:i.message,type:i.code}}else r[a]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(h){return h.errors.forEach(function(u){return e.push(u)})}),t){var l=r[a].types,d=l&&l[n.code];r[a]=Is(a,t,r,s,d?[].concat(d,n.message):n.message)}e.shift()}return r}function Ku(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,a=n.path.join(".");if(!r[a])if(n.code==="invalid_union"&&n.errors.length>0){var i=n.errors[0][0];r[a]={message:i.message,type:i.code}}else r[a]={message:o,type:s};if(n.code==="invalid_union"&&n.errors.forEach(function(h){return h.forEach(function(u){return e.push(u)})}),t){var l=r[a].types,d=l&&l[n.code];r[a]=Is(a,t,r,s,d?[].concat(d,n.message):n.message)}e.shift()}return r}function Qu(e,t,r){if(r===void 0&&(r={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,s,o){try{return Promise.resolve(Ro(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(a){return o.shouldUseNativeValidation&&ts({},o),{errors:{},values:r.raw?Object.assign({},n):a}})},function(a){if((function(i){return Array.isArray(i?.issues)})(a))return{values:{},errors:To(qu(a.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw a}))}catch(a){return Promise.reject(a)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,s,o){try{return Promise.resolve(Ro(function(){return Promise.resolve((r.mode==="sync"?Zu:Gu)(e,n,t)).then(function(a){return o.shouldUseNativeValidation&&ts({},o),{errors:{},values:r.raw?Object.assign({},n):a}})},function(a){if((function(i){return i instanceof zu})(a))return{values:{},errors:To(Ku(a.issues,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw a}))}catch(a){return Promise.reject(a)}};throw new Error("Invalid input: not a Zod schema")}const Yu=Uo("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function qa({className:e,variant:t,asChild:r=!1,...n}){const s=r?Bo:"span";return c.jsx(s,{"data-slot":"badge",className:fe(Yu({variant:t}),e),...n})}function zn({className:e,...t}){return c.jsx("div",{"data-slot":"card",className:fe("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function Hn({className:e,...t}){return c.jsx("div",{"data-slot":"card-content",className:fe("px-6",e),...t})}var jn="Dialog",[Ka,Wm]=Bt(jn),[Xu,ft]=Ka(jn),Qa=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,i=f.useRef(null),l=f.useRef(null),[d,h]=Ft({prop:n,defaultProp:s??!1,onChange:o,caller:jn});return c.jsx(Xu,{scope:t,triggerRef:i,contentRef:l,contentId:kt(),titleId:kt(),descriptionId:kt(),open:d,onOpenChange:h,onOpenToggle:f.useCallback(()=>h(u=>!u),[h]),modal:a,children:r})};Qa.displayName=jn;var Ya="DialogTrigger",Xa=f.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=ft(Ya,r),o=ye(t,s.triggerRef);return c.jsx(oe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Fs(s.open),...n,ref:o,onClick:z(e.onClick,s.onOpenToggle)})});Xa.displayName=Ya;var Os="DialogPortal",[Ju,Ja]=Ka(Os,{forceMount:void 0}),ei=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,o=ft(Os,t);return c.jsx(Ju,{scope:t,forceMount:r,children:f.Children.map(n,a=>c.jsx(dt,{present:r||o.open,children:c.jsx(ps,{asChild:!0,container:s,children:a})}))})};ei.displayName=Os;var hn="DialogOverlay",ti=f.forwardRef((e,t)=>{const r=Ja(hn,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=ft(hn,e.__scopeDialog);return o.modal?c.jsx(dt,{present:n||o.open,children:c.jsx(td,{...s,ref:t})}):null});ti.displayName=hn;var ed=Rr("DialogOverlay.RemoveScroll"),td=f.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=ft(hn,r);return c.jsx(gs,{as:ed,allowPinchZoom:!0,shards:[s.contentRef],children:c.jsx(oe.div,{"data-state":Fs(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),Xt="DialogContent",ri=f.forwardRef((e,t)=>{const r=Ja(Xt,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=ft(Xt,e.__scopeDialog);return c.jsx(dt,{present:n||o.open,children:o.modal?c.jsx(rd,{...s,ref:t}):c.jsx(nd,{...s,ref:t})})});ri.displayName=Xt;var rd=f.forwardRef((e,t)=>{const r=ft(Xt,e.__scopeDialog),n=f.useRef(null),s=ye(t,r.contentRef,n);return f.useEffect(()=>{const o=n.current;if(o)return ms(o)},[]),c.jsx(ni,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:z(e.onCloseAutoFocus,o=>{o.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:z(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&o.preventDefault()}),onFocusOutside:z(e.onFocusOutside,o=>o.preventDefault())})}),nd=f.forwardRef((e,t)=>{const r=ft(Xt,e.__scopeDialog),n=f.useRef(!1),s=f.useRef(!1);return c.jsx(ni,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(n.current||r.triggerRef.current?.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=o.target;r.triggerRef.current?.contains(a)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),ni=f.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,...a}=e,i=ft(Xt,r),l=f.useRef(null),d=ye(t,l);return vs(),c.jsxs(c.Fragment,{children:[c.jsx(ys,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:c.jsx(xs,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Fs(i.open),...a,ref:d,onDismiss:()=>i.onOpenChange(!1)})}),c.jsxs(c.Fragment,{children:[c.jsx(od,{titleId:i.titleId}),c.jsx(id,{contentRef:l,descriptionId:i.descriptionId})]})]})}),Ds="DialogTitle",si=f.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=ft(Ds,r);return c.jsx(oe.h2,{id:s.titleId,...n,ref:t})});si.displayName=Ds;var oi="DialogDescription",sd=f.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=ft(oi,r);return c.jsx(oe.p,{id:s.descriptionId,...n,ref:t})});sd.displayName=oi;var ai="DialogClose",ii=f.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=ft(ai,r);return c.jsx(oe.button,{type:"button",...n,ref:t,onClick:z(e.onClick,()=>s.onOpenChange(!1))})});ii.displayName=ai;function Fs(e){return e?"open":"closed"}var ci="DialogTitleWarning",[Gm,li]=Uc(ci,{contentName:Xt,titleName:Ds,docsSlug:"dialog"}),od=({titleId:e})=>{const t=li(ci),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return f.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},ad="DialogDescriptionWarning",id=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${li(ad).contentName}}.`;return f.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},cd=Qa,ld=Xa,ud=ei,dd=ti,fd=ri,hd=si,pd=ii;function md({...e}){return c.jsx(cd,{"data-slot":"dialog",...e})}function gd({...e}){return c.jsx(ld,{"data-slot":"dialog-trigger",...e})}function vd({...e}){return c.jsx(ud,{"data-slot":"dialog-portal",...e})}function yd({className:e,...t}){return c.jsx(dd,{"data-slot":"dialog-overlay",className:fe("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function xd({className:e,children:t,showCloseButton:r=!0,...n}){return c.jsxs(vd,{"data-slot":"dialog-portal",children:[c.jsx(yd,{}),c.jsxs(fd,{"data-slot":"dialog-content",className:fe("bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...n,children:[t,r&&c.jsxs(pd,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[c.jsx(Cs,{}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function bd({className:e,...t}){return c.jsx("div",{"data-slot":"dialog-header",className:fe("flex flex-col gap-2 text-center sm:text-left",e),...t})}function wd({className:e,...t}){return c.jsx(hd,{"data-slot":"dialog-title",className:fe("text-lg leading-none font-semibold",e),...t})}function rs(e,[t,r]){return Math.min(r,Math.max(t,e))}function _d(e){const t=f.useRef({value:e,previous:e});return f.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ui=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"}),Sd="VisuallyHidden",Cd=f.forwardRef((e,t)=>c.jsx(oe.span,{...e,ref:t,style:{...ui,...e.style}}));Cd.displayName=Sd;var Td=[" ","Enter","ArrowUp","ArrowDown"],Ed=[" ","Enter"],Jt="Select",[Pn,Nn,Rd]=Ts(Jt),[vr,qm]=Bt(Jt,[Rd,Tn]),In=Tn(),[kd,Ht]=vr(Jt),[jd,Pd]=vr(Jt),di=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:o,value:a,defaultValue:i,onValueChange:l,dir:d,name:h,autoComplete:u,disabled:m,required:E,form:S}=e,v=In(t),[w,C]=f.useState(null),[x,R]=f.useState(null),[T,_]=f.useState(!1),P=Hr(d),[O,U]=Ft({prop:n,defaultProp:s??!1,onChange:o,caller:Jt}),[H,G]=Ft({prop:a,defaultProp:i,onChange:l,caller:Jt}),X=f.useRef(null),B=w?S||!!w.closest("form"):!0,[D,q]=f.useState(new Set),ne=Array.from(D).map(V=>V.props.value).join(";");return c.jsx(zo,{...v,children:c.jsxs(kd,{required:E,scope:t,trigger:w,onTriggerChange:C,valueNode:x,onValueNodeChange:R,valueNodeHasChildren:T,onValueNodeHasChildrenChange:_,contentId:kt(),value:H,onValueChange:G,open:O,onOpenChange:U,dir:P,triggerPointerDownPosRef:X,disabled:m,children:[c.jsx(Pn.Provider,{scope:t,children:c.jsx(jd,{scope:e.__scopeSelect,onNativeOptionAdd:f.useCallback(V=>{q(te=>new Set(te).add(V))},[]),onNativeOptionRemove:f.useCallback(V=>{q(te=>{const ue=new Set(te);return ue.delete(V),ue})},[]),children:r})}),B?c.jsxs(Mi,{"aria-hidden":!0,required:E,tabIndex:-1,name:h,autoComplete:u,value:H,onChange:V=>G(V.target.value),disabled:m,form:S,children:[H===void 0?c.jsx("option",{value:""}):null,Array.from(D)]},ne):null]})})};di.displayName=Jt;var fi="SelectTrigger",hi=f.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,o=In(r),a=Ht(fi,r),i=a.disabled||n,l=ye(t,a.onTriggerChange),d=Nn(r),h=f.useRef("touch"),[u,m,E]=Oi(v=>{const w=d().filter(R=>!R.disabled),C=w.find(R=>R.value===a.value),x=Di(w,v,C);x!==void 0&&a.onValueChange(x.value)}),S=v=>{i||(a.onOpenChange(!0),E()),v&&(a.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return c.jsx(Ho,{asChild:!0,...o,children:c.jsx(oe.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:i,"data-disabled":i?"":void 0,"data-placeholder":Ai(a.value)?"":void 0,...s,ref:l,onClick:z(s.onClick,v=>{v.currentTarget.focus(),h.current!=="mouse"&&S(v)}),onPointerDown:z(s.onPointerDown,v=>{h.current=v.pointerType;const w=v.target;w.hasPointerCapture(v.pointerId)&&w.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(S(v),v.preventDefault())}),onKeyDown:z(s.onKeyDown,v=>{const w=u.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&m(v.key),!(w&&v.key===" ")&&Td.includes(v.key)&&(S(),v.preventDefault())})})})});hi.displayName=fi;var pi="SelectValue",mi=f.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:o,placeholder:a="",...i}=e,l=Ht(pi,r),{onValueNodeHasChildrenChange:d}=l,h=o!==void 0,u=ye(t,l.onValueNodeChange);return jt(()=>{d(h)},[d,h]),c.jsx(oe.span,{...i,ref:u,style:{pointerEvents:"none"},children:Ai(l.value)?c.jsx(c.Fragment,{children:a}):o})});mi.displayName=pi;var Nd="SelectIcon",gi=f.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return c.jsx(oe.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});gi.displayName=Nd;var Id="SelectPortal",vi=e=>c.jsx(ps,{asChild:!0,...e});vi.displayName=Id;var er="SelectContent",yi=f.forwardRef((e,t)=>{const r=Ht(er,e.__scopeSelect),[n,s]=f.useState();if(jt(()=>{s(new DocumentFragment)},[]),!r.open){const o=n;return o?Zo.createPortal(c.jsx(xi,{scope:e.__scopeSelect,children:c.jsx(Pn.Slot,{scope:e.__scopeSelect,children:c.jsx("div",{children:e.children})})}),o):null}return c.jsx(bi,{...e,ref:t})});yi.displayName=er;var st=10,[xi,Zt]=vr(er),Md="SelectContentImpl",Ad=Rr("SelectContent.RemoveScroll"),bi=f.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:a,side:i,sideOffset:l,align:d,alignOffset:h,arrowPadding:u,collisionBoundary:m,collisionPadding:E,sticky:S,hideWhenDetached:v,avoidCollisions:w,...C}=e,x=Ht(er,r),[R,T]=f.useState(null),[_,P]=f.useState(null),O=ye(t,L=>T(L)),[U,H]=f.useState(null),[G,X]=f.useState(null),B=Nn(r),[D,q]=f.useState(!1),ne=f.useRef(!1);f.useEffect(()=>{if(R)return ms(R)},[R]),vs();const V=f.useCallback(L=>{const[K,...be]=B().map(ge=>ge.ref.current),[le]=be.slice(-1),he=document.activeElement;for(const ge of L)if(ge===he||(ge?.scrollIntoView({block:"nearest"}),ge===K&&_&&(_.scrollTop=0),ge===le&&_&&(_.scrollTop=_.scrollHeight),ge?.focus(),document.activeElement!==he))return},[B,_]),te=f.useCallback(()=>V([U,R]),[V,U,R]);f.useEffect(()=>{D&&te()},[D,te]);const{onOpenChange:ue,triggerPointerDownPosRef:$}=x;f.useEffect(()=>{if(R){let L={x:0,y:0};const K=le=>{L={x:Math.abs(Math.round(le.pageX)-($.current?.x??0)),y:Math.abs(Math.round(le.pageY)-($.current?.y??0))}},be=le=>{L.x<=10&&L.y<=10?le.preventDefault():R.contains(le.target)||ue(!1),document.removeEventListener("pointermove",K),$.current=null};return $.current!==null&&(document.addEventListener("pointermove",K),document.addEventListener("pointerup",be,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",K),document.removeEventListener("pointerup",be,{capture:!0})}}},[R,ue,$]),f.useEffect(()=>{const L=()=>ue(!1);return window.addEventListener("blur",L),window.addEventListener("resize",L),()=>{window.removeEventListener("blur",L),window.removeEventListener("resize",L)}},[ue]);const[ve,we]=Oi(L=>{const K=B().filter(he=>!he.disabled),be=K.find(he=>he.ref.current===document.activeElement),le=Di(K,L,be);le&&setTimeout(()=>le.ref.current.focus())}),Pe=f.useCallback((L,K,be)=>{const le=!ne.current&&!be;(x.value!==void 0&&x.value===K||le)&&(H(L),le&&(ne.current=!0))},[x.value]),J=f.useCallback(()=>R?.focus(),[R]),ae=f.useCallback((L,K,be)=>{const le=!ne.current&&!be;(x.value!==void 0&&x.value===K||le)&&X(L)},[x.value]),ce=n==="popper"?ns:wi,xe=ce===ns?{side:i,sideOffset:l,align:d,alignOffset:h,arrowPadding:u,collisionBoundary:m,collisionPadding:E,sticky:S,hideWhenDetached:v,avoidCollisions:w}:{};return c.jsx(xi,{scope:r,content:R,viewport:_,onViewportChange:P,itemRefCallback:Pe,selectedItem:U,onItemLeave:J,itemTextRefCallback:ae,focusSelectedItem:te,selectedItemText:G,position:n,isPositioned:D,searchRef:ve,children:c.jsx(gs,{as:Ad,allowPinchZoom:!0,children:c.jsx(ys,{asChild:!0,trapped:x.open,onMountAutoFocus:L=>{L.preventDefault()},onUnmountAutoFocus:z(s,L=>{x.trigger?.focus({preventScroll:!0}),L.preventDefault()}),children:c.jsx(xs,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:L=>L.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:c.jsx(ce,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:L=>L.preventDefault(),...C,...xe,onPlaced:()=>q(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:z(C.onKeyDown,L=>{const K=L.ctrlKey||L.altKey||L.metaKey;if(L.key==="Tab"&&L.preventDefault(),!K&&L.key.length===1&&we(L.key),["ArrowUp","ArrowDown","Home","End"].includes(L.key)){let le=B().filter(he=>!he.disabled).map(he=>he.ref.current);if(["ArrowUp","End"].includes(L.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(L.key)){const he=L.target,ge=le.indexOf(he);le=le.slice(ge+1)}setTimeout(()=>V(le)),L.preventDefault()}})})})})})})});bi.displayName=Md;var Od="SelectItemAlignedPosition",wi=f.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,o=Ht(er,r),a=Zt(er,r),[i,l]=f.useState(null),[d,h]=f.useState(null),u=ye(t,O=>h(O)),m=Nn(r),E=f.useRef(!1),S=f.useRef(!0),{viewport:v,selectedItem:w,selectedItemText:C,focusSelectedItem:x}=a,R=f.useCallback(()=>{if(o.trigger&&o.valueNode&&i&&d&&v&&w&&C){const O=o.trigger.getBoundingClientRect(),U=d.getBoundingClientRect(),H=o.valueNode.getBoundingClientRect(),G=C.getBoundingClientRect();if(o.dir!=="rtl"){const he=G.left-U.left,ge=H.left-he,Xe=O.left-ge,Le=O.width+Xe,Nt=Math.max(Le,U.width),It=window.innerWidth-st,Je=rs(ge,[st,Math.max(st,It-Nt)]);i.style.minWidth=Le+"px",i.style.left=Je+"px"}else{const he=U.right-G.right,ge=window.innerWidth-H.right-he,Xe=window.innerWidth-O.right-ge,Le=O.width+Xe,Nt=Math.max(Le,U.width),It=window.innerWidth-st,Je=rs(ge,[st,Math.max(st,It-Nt)]);i.style.minWidth=Le+"px",i.style.right=Je+"px"}const X=m(),B=window.innerHeight-st*2,D=v.scrollHeight,q=window.getComputedStyle(d),ne=parseInt(q.borderTopWidth,10),V=parseInt(q.paddingTop,10),te=parseInt(q.borderBottomWidth,10),ue=parseInt(q.paddingBottom,10),$=ne+V+D+ue+te,ve=Math.min(w.offsetHeight*5,$),we=window.getComputedStyle(v),Pe=parseInt(we.paddingTop,10),J=parseInt(we.paddingBottom,10),ae=O.top+O.height/2-st,ce=B-ae,xe=w.offsetHeight/2,L=w.offsetTop+xe,K=ne+V+L,be=$-K;if(K<=ae){const he=X.length>0&&w===X[X.length-1].ref.current;i.style.bottom="0px";const ge=d.clientHeight-v.offsetTop-v.offsetHeight,Xe=Math.max(ce,xe+(he?J:0)+ge+te),Le=K+Xe;i.style.height=Le+"px"}else{const he=X.length>0&&w===X[0].ref.current;i.style.top="0px";const Xe=Math.max(ae,ne+v.offsetTop+(he?Pe:0)+xe)+be;i.style.height=Xe+"px",v.scrollTop=K-ae+v.offsetTop}i.style.margin=`${st}px 0`,i.style.minHeight=ve+"px",i.style.maxHeight=B+"px",n?.(),requestAnimationFrame(()=>E.current=!0)}},[m,o.trigger,o.valueNode,i,d,v,w,C,o.dir,n]);jt(()=>R(),[R]);const[T,_]=f.useState();jt(()=>{d&&_(window.getComputedStyle(d).zIndex)},[d]);const P=f.useCallback(O=>{O&&S.current===!0&&(R(),x?.(),S.current=!1)},[R,x]);return c.jsx(Fd,{scope:r,contentWrapper:i,shouldExpandOnScrollRef:E,onScrollButtonChange:P,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:c.jsx(oe.div,{...s,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});wi.displayName=Od;var Dd="SelectPopperPosition",ns=f.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=st,...o}=e,a=In(r);return c.jsx(Wo,{...a,...o,ref:t,align:n,collisionPadding:s,style:{boxSizing:"border-box",...o.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)"}})});ns.displayName=Dd;var[Fd,Vs]=vr(er,{}),ss="SelectViewport",_i=f.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,o=Zt(ss,r),a=Vs(ss,r),i=ye(t,o.onViewportChange),l=f.useRef(0);return c.jsxs(c.Fragment,{children:[c.jsx("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:n}),c.jsx(Pn.Slot,{scope:r,children:c.jsx(oe.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:z(s.onScroll,d=>{const h=d.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:m}=a;if(m?.current&&u){const E=Math.abs(l.current-h.scrollTop);if(E>0){const S=window.innerHeight-st*2,v=parseFloat(u.style.minHeight),w=parseFloat(u.style.height),C=Math.max(v,w);if(C<S){const x=C+E,R=Math.min(S,x),T=x-R;u.style.height=R+"px",u.style.bottom==="0px"&&(h.scrollTop=T>0?T:0,u.style.justifyContent="flex-end")}}}l.current=h.scrollTop})})})]})});_i.displayName=ss;var Si="SelectGroup",[Vd,Ld]=vr(Si),$d=f.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=kt();return c.jsx(Vd,{scope:r,id:s,children:c.jsx(oe.div,{role:"group","aria-labelledby":s,...n,ref:t})})});$d.displayName=Si;var Ci="SelectLabel",Ud=f.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Ld(Ci,r);return c.jsx(oe.div,{id:s.id,...n,ref:t})});Ud.displayName=Ci;var pn="SelectItem",[Bd,Ti]=vr(pn),Ei=f.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...a}=e,i=Ht(pn,r),l=Zt(pn,r),d=i.value===n,[h,u]=f.useState(o??""),[m,E]=f.useState(!1),S=ye(t,x=>l.itemRefCallback?.(x,n,s)),v=kt(),w=f.useRef("touch"),C=()=>{s||(i.onValueChange(n),i.onOpenChange(!1))};if(n==="")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 c.jsx(Bd,{scope:r,value:n,disabled:s,textId:v,isSelected:d,onItemTextChange:f.useCallback(x=>{u(R=>R||(x?.textContent??"").trim())},[]),children:c.jsx(Pn.ItemSlot,{scope:r,value:n,disabled:s,textValue:h,children:c.jsx(oe.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...a,ref:S,onFocus:z(a.onFocus,()=>E(!0)),onBlur:z(a.onBlur,()=>E(!1)),onClick:z(a.onClick,()=>{w.current!=="mouse"&&C()}),onPointerUp:z(a.onPointerUp,()=>{w.current==="mouse"&&C()}),onPointerDown:z(a.onPointerDown,x=>{w.current=x.pointerType}),onPointerMove:z(a.onPointerMove,x=>{w.current=x.pointerType,s?l.onItemLeave?.():w.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:z(a.onPointerLeave,x=>{x.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:z(a.onKeyDown,x=>{l.searchRef?.current!==""&&x.key===" "||(Ed.includes(x.key)&&C(),x.key===" "&&x.preventDefault())})})})})});Ei.displayName=pn;var Sr="SelectItemText",Ri=f.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...o}=e,a=Ht(Sr,r),i=Zt(Sr,r),l=Ti(Sr,r),d=Pd(Sr,r),[h,u]=f.useState(null),m=ye(t,C=>u(C),l.onItemTextChange,C=>i.itemTextRefCallback?.(C,l.value,l.disabled)),E=h?.textContent,S=f.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:E},l.value),[l.disabled,l.value,E]),{onNativeOptionAdd:v,onNativeOptionRemove:w}=d;return jt(()=>(v(S),()=>w(S)),[v,w,S]),c.jsxs(c.Fragment,{children:[c.jsx(oe.span,{id:l.textId,...o,ref:m}),l.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Zo.createPortal(o.children,a.valueNode):null]})});Ri.displayName=Sr;var ki="SelectItemIndicator",ji=f.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return Ti(ki,r).isSelected?c.jsx(oe.span,{"aria-hidden":!0,...n,ref:t}):null});ji.displayName=ki;var os="SelectScrollUpButton",Pi=f.forwardRef((e,t)=>{const r=Zt(os,e.__scopeSelect),n=Vs(os,e.__scopeSelect),[s,o]=f.useState(!1),a=ye(t,n.onScrollButtonChange);return jt(()=>{if(r.viewport&&r.isPositioned){let i=function(){const d=l.scrollTop>0;o(d)};const l=r.viewport;return i(),l.addEventListener("scroll",i),()=>l.removeEventListener("scroll",i)}},[r.viewport,r.isPositioned]),s?c.jsx(Ii,{...e,ref:a,onAutoScroll:()=>{const{viewport:i,selectedItem:l}=r;i&&l&&(i.scrollTop=i.scrollTop-l.offsetHeight)}}):null});Pi.displayName=os;var as="SelectScrollDownButton",Ni=f.forwardRef((e,t)=>{const r=Zt(as,e.__scopeSelect),n=Vs(as,e.__scopeSelect),[s,o]=f.useState(!1),a=ye(t,n.onScrollButtonChange);return jt(()=>{if(r.viewport&&r.isPositioned){let i=function(){const d=l.scrollHeight-l.clientHeight,h=Math.ceil(l.scrollTop)<d;o(h)};const l=r.viewport;return i(),l.addEventListener("scroll",i),()=>l.removeEventListener("scroll",i)}},[r.viewport,r.isPositioned]),s?c.jsx(Ii,{...e,ref:a,onAutoScroll:()=>{const{viewport:i,selectedItem:l}=r;i&&l&&(i.scrollTop=i.scrollTop+l.offsetHeight)}}):null});Ni.displayName=as;var Ii=f.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,o=Zt("SelectScrollButton",r),a=f.useRef(null),i=Nn(r),l=f.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return f.useEffect(()=>()=>l(),[l]),jt(()=>{i().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[i]),c.jsx(oe.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:z(s.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:z(s.onPointerMove,()=>{o.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:z(s.onPointerLeave,()=>{l()})})}),zd="SelectSeparator",Hd=f.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return c.jsx(oe.div,{"aria-hidden":!0,...n,ref:t})});Hd.displayName=zd;var is="SelectArrow",Zd=f.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=In(r),o=Ht(is,r),a=Zt(is,r);return o.open&&a.position==="popper"?c.jsx(Go,{...s,...n,ref:t}):null});Zd.displayName=is;var Wd="SelectBubbleInput",Mi=f.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const s=f.useRef(null),o=ye(n,s),a=_d(t);return f.useEffect(()=>{const i=s.current;if(!i)return;const l=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==t&&h){const u=new Event("change",{bubbles:!0});h.call(i,t),i.dispatchEvent(u)}},[a,t]),c.jsx(oe.select,{...r,style:{...ui,...r.style},ref:o,defaultValue:t})});Mi.displayName=Wd;function Ai(e){return e===""||e===void 0}function Oi(e){const t=ot(e),r=f.useRef(""),n=f.useRef(0),s=f.useCallback(a=>{const i=r.current+a;t(i),(function l(d){r.current=d,window.clearTimeout(n.current),d!==""&&(n.current=window.setTimeout(()=>l(""),1e3))})(i)},[t]),o=f.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return f.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function Di(e,t,r){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let a=Gd(e,Math.max(o,0));s.length===1&&(a=a.filter(d=>d!==r));const l=a.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==r?l:void 0}function Gd(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var qd=di,Kd=hi,Qd=mi,Yd=gi,Xd=vi,Jd=yi,ef=_i,tf=Ei,rf=Ri,nf=ji,sf=Pi,of=Ni;function ko({...e}){return c.jsx(qd,{"data-slot":"select",...e})}function jo({...e}){return c.jsx(Qd,{"data-slot":"select-value",...e})}function Po({className:e,size:t="default",children:r,...n}){return c.jsxs(Kd,{"data-slot":"select-trigger","data-size":t,className:fe("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n,children:[r,c.jsx(Yd,{asChild:!0,children:c.jsx(ua,{className:"size-4 opacity-50"})})]})}function No({className:e,children:t,position:r="popper",...n}){return c.jsx(Xd,{children:c.jsxs(Jd,{"data-slot":"select-content",className:fe("bg-popover text-popover-foreground 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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",r==="popper"&&"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:r,...n,children:[c.jsx(af,{}),c.jsx(ef,{className:fe("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),c.jsx(cf,{})]})})}function Io({className:e,children:t,...r}){return c.jsxs(tf,{"data-slot":"select-item",className:fe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[c.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:c.jsx(nf,{children:c.jsx(Ml,{className:"size-4"})})}),c.jsx(rf,{children:t})]})}function af({className:e,...t}){return c.jsx(sf,{"data-slot":"select-scroll-up-button",className:fe("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx($l,{className:"size-4"})})}function cf({className:e,...t}){return c.jsx(of,{"data-slot":"select-scroll-down-button",className:fe("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(ua,{className:"size-4"})})}function lf({className:e,...t}){return c.jsx("textarea",{"data-slot":"textarea",className:fe("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}const uf=wu,Fi=f.createContext({}),_t=({...e})=>c.jsx(Fi.Provider,{value:{name:e.name},children:c.jsx(Cu,{...e})}),Ls=()=>{const e=f.useContext(Fi),t=f.useContext(Vi),{getFieldState:r}=kn(),n=Aa({name:e.name}),s=r(e.name,n);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...s}},Vi=f.createContext({});function St({className:e,...t}){const r=f.useId();return c.jsx(Vi.Provider,{value:{id:r},children:c.jsx("div",{"data-slot":"form-item",className:fe("grid gap-2",e),...t})})}function ht({className:e,...t}){const{error:r,formItemId:n}=Ls();return c.jsx(Bc,{"data-slot":"form-label","data-error":!!r,className:fe("data-[error=true]:text-destructive",e),htmlFor:n,...t})}function Ot({...e}){const{error:t,formItemId:r,formDescriptionId:n,formMessageId:s}=Ls();return c.jsx(Bo,{"data-slot":"form-control",id:r,"aria-describedby":t?`${n} ${s}`:`${n}`,"aria-invalid":!!t,...e})}function Ct({className:e,...t}){const{error:r,formMessageId:n}=Ls(),s=r?String(r?.message??""):t.children;return s?c.jsx("p",{"data-slot":"form-message",id:n,className:fe("text-destructive text-sm",e),...t,children:s}):null}const df=e=>{const{isLoading:t,refetch:r,...n}=Xn({queryKey:["product",e?.id],queryFn:async()=>e?(await qc(300),await ze.apiRequest("get",e)):null});return{isLoading:t,refetch:r,...n}};var ie;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function r(s){throw new Error}e.assertNever=r,e.arrayToEnum=s=>{const o={};for(const a of s)o[a]=a;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(i=>typeof s[s[i]]!="number"),a={};for(const i of o)a[i]=s[i];return e.objectValues(a)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const a in s)Object.prototype.hasOwnProperty.call(s,a)&&o.push(a);return o},e.find=(s,o)=>{for(const a of s)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(ie||(ie={}));var cs;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(cs||(cs={}));const F=ie.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Et=e=>{switch(typeof e){case"undefined":return F.undefined;case"string":return F.string;case"number":return Number.isNaN(e)?F.nan:F.number;case"boolean":return F.boolean;case"function":return F.function;case"bigint":return F.bigint;case"symbol":return F.symbol;case"object":return Array.isArray(e)?F.array:e===null?F.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?F.promise:typeof Map<"u"&&e instanceof Map?F.map:typeof Set<"u"&&e instanceof Set?F.set:typeof Date<"u"&&e instanceof Date?F.date:F.object;default:return F.unknown}},k=ie.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),ff=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Ze extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){const r=t||function(o){return o.message},n={_errors:[]},s=o=>{for(const a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(s);else if(a.code==="invalid_return_type")s(a.returnTypeError);else if(a.code==="invalid_arguments")s(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let i=n,l=0;for(;l<a.path.length;){const d=a.path[l];l===a.path.length-1?(i[d]=i[d]||{_errors:[]},i[d]._errors.push(r(a))):i[d]=i[d]||{_errors:[]},i=i[d],l++}}};return s(this),n}static assert(t){if(!(t instanceof Ze))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ie.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r={},n=[];for(const s of this.issues)if(s.path.length>0){const o=s.path[0];r[o]=r[o]||[],r[o].push(t(s))}else n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Ze.create=e=>new Ze(e);const fr=(e,t)=>{let r;switch(e.code){case k.invalid_type:e.received===F.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case k.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ie.jsonStringifyReplacer)}`;break;case k.unrecognized_keys:r=`Unrecognized key(s) in object: ${ie.joinValues(e.keys,", ")}`;break;case k.invalid_union:r="Invalid input";break;case k.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ie.joinValues(e.options)}`;break;case k.invalid_enum_value:r=`Invalid enum value. Expected ${ie.joinValues(e.options)}, received '${e.received}'`;break;case k.invalid_arguments:r="Invalid function arguments";break;case k.invalid_return_type:r="Invalid function return type";break;case k.invalid_date:r="Invalid date";break;case k.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ie.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case k.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case k.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case k.custom:r="Invalid input";break;case k.invalid_intersection_types:r="Intersection results could not be merged";break;case k.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case k.not_finite:r="Number must be finite";break;default:r=t.defaultError,ie.assertNever(e)}return{message:r}};let Li=fr;function hf(e){Li=e}function mn(){return Li}const gn=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],a={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let i="";const l=n.filter(d=>!!d).slice().reverse();for(const d of l)i=d(a,{data:t,defaultError:i}).message;return{...s,path:o,message:i}},pf=[];function A(e,t){const r=mn(),n=gn({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===fr?void 0:fr].filter(s=>!!s)});e.common.issues.push(n)}class Me{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const s of r){if(s.status==="aborted")return Q;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const s of r){const o=await s.key,a=await s.value;n.push({key:o,value:a})}return Me.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:o,value:a}=s;if(o.status==="aborted"||a.status==="aborted")return Q;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||s.alwaysSet)&&(n[o.value]=a.value)}return{status:t.value,value:n}}}const Q=Object.freeze({status:"aborted"}),ur=e=>({status:"dirty",value:e}),Fe=e=>({status:"valid",value:e}),ls=e=>e.status==="aborted",us=e=>e.status==="dirty",tr=e=>e.status==="valid",jr=e=>typeof Promise<"u"&&e instanceof Promise;var Z;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Z||(Z={}));class yt{constructor(t,r,n,s){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Mo=(e,t)=>{if(tr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new Ze(e.common.issues);return this._error=r,this._error}}};function ee(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(a,i)=>{const{message:l}=e;return a.code==="invalid_enum_value"?{message:l??i.defaultError}:typeof i.data>"u"?{message:l??n??i.defaultError}:a.code!=="invalid_type"?{message:i.defaultError}:{message:l??r??i.defaultError}},description:s}}class se{get description(){return this._def.description}_getType(t){return Et(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Me,ctx:{common:t.parent.common,data:t.data,parsedType:Et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(jr(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)},s=this._parseSync({data:t,path:n.path,parent:n});return Mo(n,s)}"~validate"(t){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)};if(!this["~standard"].async)try{const n=this._parseSync({data:t,path:[],parent:r});return tr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>tr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)},s=this._parse({data:t,path:n.path,parent:n}),o=await(jr(s)?s:Promise.resolve(s));return Mo(n,o)}refine(t,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{const a=t(s),i=()=>o.addIssue({code:k.custom,...n(s)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(i(),!1)):a?!0:(i(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new ut({schema:this,typeName:Y.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return vt.create(this,this._def)}nullable(){return Ut.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return lt.create(this)}promise(){return pr.create(this,this._def)}or(t){return Mr.create([this,t],this._def)}and(t){return Ar.create(this,t,this._def)}transform(t){return new ut({...ee(this._def),schema:this,typeName:Y.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new Lr({...ee(this._def),innerType:this,defaultValue:r,typeName:Y.ZodDefault})}brand(){return new $s({typeName:Y.ZodBranded,type:this,...ee(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new $r({...ee(this._def),innerType:this,catchValue:r,typeName:Y.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Gr.create(this,t)}readonly(){return Ur.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const mf=/^c[^\s-]{8,}$/i,gf=/^[0-9a-z]+$/,vf=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yf=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,xf=/^[a-z0-9_-]{21}$/i,bf=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,wf=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,_f=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Sf="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Zn;const Cf=/^(?:(?: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])$/,Tf=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Ef=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Rf=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,kf=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,jf=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$i="((\\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])))",Pf=new RegExp(`^${$i}$`);function Ui(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function Nf(e){return new RegExp(`^${Ui(e)}$`)}function Bi(e){let t=`${$i}T${Ui(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function If(e,t){return!!((t==="v4"||!t)&&Cf.test(e)||(t==="v6"||!t)&&Ef.test(e))}function Mf(e,t){if(!bf.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function Af(e,t){return!!((t==="v4"||!t)&&Tf.test(e)||(t==="v6"||!t)&&Rf.test(e))}class ct extends se{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==F.string){const o=this._getOrReturnCtx(t);return A(o,{code:k.invalid_type,expected:F.string,received:o.parsedType}),Q}const n=new Me;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(s=this._getOrReturnCtx(t,s),A(s,{code:k.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(s=this._getOrReturnCtx(t,s),A(s,{code:k.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const a=t.data.length>o.value,i=t.data.length<o.value;(a||i)&&(s=this._getOrReturnCtx(t,s),a?A(s,{code:k.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):i&&A(s,{code:k.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")_f.test(t.data)||(s=this._getOrReturnCtx(t,s),A(s,{validation:"email",code:k.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")Zn||(Zn=new RegExp(Sf,"u")),Zn.test(t.data)||(s=this._getOrReturnCtx(t,s),A(s,{validation:"emoji",code:k.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")yf.test(t.data)||(s=this._getOrReturnCtx(t,s),A(s,{validation:"uuid",code:k.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")xf.test(t.data)||(s=this._getOrReturnCtx(t,s),A(s,{validation:"nanoid",code:k.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")mf.test(t.data)||(s=this._getOrReturnCtx(t,s),A(s,{validation:"cuid",code:k.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")gf.test(t.data)||(s=this._getOrReturnCtx(t,s),A(s,{validation:"cuid2",code:k.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")vf.test(t.data)||(s=this._getOrReturnCtx(t,s),A(s,{validation:"ulid",code:k.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),A(s,{validation:"url",code:k.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),A(s,{validation:"regex",code:k.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(t,s),A(s,{code:k.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(s=this._getOrReturnCtx(t,s),A(s,{code:k.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(s=this._getOrReturnCtx(t,s),A(s,{code:k.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?Bi(o).test(t.data)||(s=this._getOrReturnCtx(t,s),A(s,{code:k.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?Pf.test(t.data)||(s=this._getOrReturnCtx(t,s),A(s,{code:k.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?Nf(o).test(t.data)||(s=this._getOrReturnCtx(t,s),A(s,{code:k.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?wf.test(t.data)||(s=this._getOrReturnCtx(t,s),A(s,{validation:"duration",code:k.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?If(t.data,o.version)||(s=this._getOrReturnCtx(t,s),A(s,{validation:"ip",code:k.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?Mf(t.data,o.alg)||(s=this._getOrReturnCtx(t,s),A(s,{validation:"jwt",code:k.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?Af(t.data,o.version)||(s=this._getOrReturnCtx(t,s),A(s,{validation:"cidr",code:k.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?kf.test(t.data)||(s=this._getOrReturnCtx(t,s),A(s,{validation:"base64",code:k.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?jf.test(t.data)||(s=this._getOrReturnCtx(t,s),A(s,{validation:"base64url",code:k.invalid_string,message:o.message}),n.dirty()):ie.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(s=>t.test(s),{validation:r,code:k.invalid_string,...Z.errToObj(n)})}_addCheck(t){return new ct({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Z.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Z.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Z.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Z.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Z.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Z.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Z.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Z.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Z.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Z.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Z.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Z.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Z.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...Z.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Z.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Z.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Z.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Z.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Z.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Z.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Z.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Z.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Z.errToObj(r)})}nonempty(t){return this.min(1,Z.errToObj(t))}trim(){return new ct({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ct({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ct({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}ct.create=e=>new ct({checks:[],typeName:Y.ZodString,coerce:e?.coerce??!1,...ee(e)});function Of(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return o%a/10**s}class Vt extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==F.number){const o=this._getOrReturnCtx(t);return A(o,{code:k.invalid_type,expected:F.number,received:o.parsedType}),Q}let n;const s=new Me;for(const o of this._def.checks)o.kind==="int"?ie.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),A(n,{code:k.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),A(n,{code:k.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),A(n,{code:k.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?Of(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),A(n,{code:k.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),A(n,{code:k.not_finite,message:o.message}),s.dirty()):ie.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Z.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Z.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Z.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Z.toString(r))}setLimit(t,r,n,s){return new Vt({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Z.toString(s)}]})}_addCheck(t){return new Vt({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Z.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Z.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Z.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Z.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Z.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Z.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Z.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Z.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Z.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&ie.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}}Vt.create=e=>new Vt({checks:[],typeName:Y.ZodNumber,coerce:e?.coerce||!1,...ee(e)});class Lt extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==F.bigint)return this._getInvalidInput(t);let n;const s=new Me;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),A(n,{code:k.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),A(n,{code:k.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),A(n,{code:k.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):ie.assertNever(o);return{status:s.value,value:t.data}}_getInvalidInput(t){const r=this._getOrReturnCtx(t);return A(r,{code:k.invalid_type,expected:F.bigint,received:r.parsedType}),Q}gte(t,r){return this.setLimit("min",t,!0,Z.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Z.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Z.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Z.toString(r))}setLimit(t,r,n,s){return new Lt({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Z.toString(s)}]})}_addCheck(t){return new Lt({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Z.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Z.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Z.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Z.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Z.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}Lt.create=e=>new Lt({checks:[],typeName:Y.ZodBigInt,coerce:e?.coerce??!1,...ee(e)});class Pr extends se{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==F.boolean){const n=this._getOrReturnCtx(t);return A(n,{code:k.invalid_type,expected:F.boolean,received:n.parsedType}),Q}return Fe(t.data)}}Pr.create=e=>new Pr({typeName:Y.ZodBoolean,coerce:e?.coerce||!1,...ee(e)});class rr extends se{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==F.date){const o=this._getOrReturnCtx(t);return A(o,{code:k.invalid_type,expected:F.date,received:o.parsedType}),Q}if(Number.isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return A(o,{code:k.invalid_date}),Q}const n=new Me;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(s=this._getOrReturnCtx(t,s),A(s,{code:k.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(s=this._getOrReturnCtx(t,s),A(s,{code:k.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ie.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new rr({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Z.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Z.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}}rr.create=e=>new rr({checks:[],coerce:e?.coerce||!1,typeName:Y.ZodDate,...ee(e)});class vn extends se{_parse(t){if(this._getType(t)!==F.symbol){const n=this._getOrReturnCtx(t);return A(n,{code:k.invalid_type,expected:F.symbol,received:n.parsedType}),Q}return Fe(t.data)}}vn.create=e=>new vn({typeName:Y.ZodSymbol,...ee(e)});class Nr extends se{_parse(t){if(this._getType(t)!==F.undefined){const n=this._getOrReturnCtx(t);return A(n,{code:k.invalid_type,expected:F.undefined,received:n.parsedType}),Q}return Fe(t.data)}}Nr.create=e=>new Nr({typeName:Y.ZodUndefined,...ee(e)});class Ir extends se{_parse(t){if(this._getType(t)!==F.null){const n=this._getOrReturnCtx(t);return A(n,{code:k.invalid_type,expected:F.null,received:n.parsedType}),Q}return Fe(t.data)}}Ir.create=e=>new Ir({typeName:Y.ZodNull,...ee(e)});class hr extends se{constructor(){super(...arguments),this._any=!0}_parse(t){return Fe(t.data)}}hr.create=e=>new hr({typeName:Y.ZodAny,...ee(e)});class Kt extends se{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Fe(t.data)}}Kt.create=e=>new Kt({typeName:Y.ZodUnknown,...ee(e)});class Pt extends se{_parse(t){const r=this._getOrReturnCtx(t);return A(r,{code:k.invalid_type,expected:F.never,received:r.parsedType}),Q}}Pt.create=e=>new Pt({typeName:Y.ZodNever,...ee(e)});class yn extends se{_parse(t){if(this._getType(t)!==F.undefined){const n=this._getOrReturnCtx(t);return A(n,{code:k.invalid_type,expected:F.void,received:n.parsedType}),Q}return Fe(t.data)}}yn.create=e=>new yn({typeName:Y.ZodVoid,...ee(e)});class lt extends se{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==F.array)return A(r,{code:k.invalid_type,expected:F.array,received:r.parsedType}),Q;if(s.exactLength!==null){const a=r.data.length>s.exactLength.value,i=r.data.length<s.exactLength.value;(a||i)&&(A(r,{code:a?k.too_big:k.too_small,minimum:i?s.exactLength.value:void 0,maximum:a?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(A(r,{code:k.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(A(r,{code:k.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,i)=>s.type._parseAsync(new yt(r,a,r.path,i)))).then(a=>Me.mergeArray(n,a));const o=[...r.data].map((a,i)=>s.type._parseSync(new yt(r,a,r.path,i)));return Me.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new lt({...this._def,minLength:{value:t,message:Z.toString(r)}})}max(t,r){return new lt({...this._def,maxLength:{value:t,message:Z.toString(r)}})}length(t,r){return new lt({...this._def,exactLength:{value:t,message:Z.toString(r)}})}nonempty(t){return this.min(1,t)}}lt.create=(e,t)=>new lt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Y.ZodArray,...ee(t)});function lr(e){if(e instanceof _e){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=vt.create(lr(n))}return new _e({...e._def,shape:()=>t})}else return e instanceof lt?new lt({...e._def,type:lr(e.element)}):e instanceof vt?vt.create(lr(e.unwrap())):e instanceof Ut?Ut.create(lr(e.unwrap())):e instanceof xt?xt.create(e.items.map(t=>lr(t))):e}class _e extends se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),r=ie.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==F.object){const d=this._getOrReturnCtx(t);return A(d,{code:k.invalid_type,expected:F.object,received:d.parsedType}),Q}const{status:n,ctx:s}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof Pt&&this._def.unknownKeys==="strip"))for(const d in s.data)a.includes(d)||i.push(d);const l=[];for(const d of a){const h=o[d],u=s.data[d];l.push({key:{status:"valid",value:d},value:h._parse(new yt(s,u,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof Pt){const d=this._def.unknownKeys;if(d==="passthrough")for(const h of i)l.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(d==="strict")i.length>0&&(A(s,{code:k.unrecognized_keys,keys:i}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const h of i){const u=s.data[h];l.push({key:{status:"valid",value:h},value:d._parse(new yt(s,u,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const h of l){const u=await h.key,m=await h.value;d.push({key:u,value:m,alwaysSet:h.alwaysSet})}return d}).then(d=>Me.mergeObjectSync(n,d)):Me.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(t){return Z.errToObj,new _e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{const s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Z.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new _e({...this._def,unknownKeys:"strip"})}passthrough(){return new _e({...this._def,unknownKeys:"passthrough"})}extend(t){return new _e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new _e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Y.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new _e({...this._def,catchall:t})}pick(t){const r={};for(const n of ie.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new _e({...this._def,shape:()=>r})}omit(t){const r={};for(const n of ie.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new _e({...this._def,shape:()=>r})}deepPartial(){return lr(this)}partial(t){const r={};for(const n of ie.objectKeys(this.shape)){const s=this.shape[n];t&&!t[n]?r[n]=s:r[n]=s.optional()}return new _e({...this._def,shape:()=>r})}required(t){const r={};for(const n of ie.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof vt;)o=o._def.innerType;r[n]=o}return new _e({...this._def,shape:()=>r})}keyof(){return zi(ie.objectKeys(this.shape))}}_e.create=(e,t)=>new _e({shape:()=>e,unknownKeys:"strip",catchall:Pt.create(),typeName:Y.ZodObject,...ee(t)});_e.strictCreate=(e,t)=>new _e({shape:()=>e,unknownKeys:"strict",catchall:Pt.create(),typeName:Y.ZodObject,...ee(t)});_e.lazycreate=(e,t)=>new _e({shape:e,unknownKeys:"strip",catchall:Pt.create(),typeName:Y.ZodObject,...ee(t)});class Mr extends se{_parse(t){const{ctx:r}=this._processInputParams(t),n=this._def.options;function s(o){for(const i of o)if(i.result.status==="valid")return i.result;for(const i of o)if(i.result.status==="dirty")return r.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(i=>new Ze(i.ctx.common.issues));return A(r,{code:k.invalid_union,unionErrors:a}),Q}if(r.common.async)return Promise.all(n.map(async o=>{const a={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(s);{let o;const a=[];for(const l of n){const d={...r,common:{...r.common,issues:[]},parent:null},h=l._parseSync({data:r.data,path:r.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!o&&(o={result:h,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(l=>new Ze(l));return A(r,{code:k.invalid_union,unionErrors:i}),Q}}get options(){return this._def.options}}Mr.create=(e,t)=>new Mr({options:e,typeName:Y.ZodUnion,...ee(t)});const Tt=e=>e instanceof Dr?Tt(e.schema):e instanceof ut?Tt(e.innerType()):e instanceof Fr?[e.value]:e instanceof $t?e.options:e instanceof Vr?ie.objectValues(e.enum):e instanceof Lr?Tt(e._def.innerType):e instanceof Nr?[void 0]:e instanceof Ir?[null]:e instanceof vt?[void 0,...Tt(e.unwrap())]:e instanceof Ut?[null,...Tt(e.unwrap())]:e instanceof $s||e instanceof Ur?Tt(e.unwrap()):e instanceof $r?Tt(e._def.innerType):[];class Mn extends se{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==F.object)return A(r,{code:k.invalid_type,expected:F.object,received:r.parsedType}),Q;const n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(A(r,{code:k.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const s=new Map;for(const o of r){const a=Tt(o.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const i of a){if(s.has(i))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(i)}`);s.set(i,o)}}return new Mn({typeName:Y.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:s,...ee(n)})}}function ds(e,t){const r=Et(e),n=Et(t);if(e===t)return{valid:!0,data:e};if(r===F.object&&n===F.object){const s=ie.objectKeys(t),o=ie.objectKeys(e).filter(i=>s.indexOf(i)!==-1),a={...e,...t};for(const i of o){const l=ds(e[i],t[i]);if(!l.valid)return{valid:!1};a[i]=l.data}return{valid:!0,data:a}}else if(r===F.array&&n===F.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o<e.length;o++){const a=e[o],i=t[o],l=ds(a,i);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return r===F.date&&n===F.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Ar extends se{_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=(o,a)=>{if(ls(o)||ls(a))return Q;const i=ds(o.value,a.value);return i.valid?((us(o)||us(a))&&r.dirty(),{status:r.value,value:i.data}):(A(n,{code:k.invalid_intersection_types}),Q)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,a])=>s(o,a)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Ar.create=(e,t,r)=>new Ar({left:e,right:t,typeName:Y.ZodIntersection,...ee(r)});class xt extends se{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==F.array)return A(n,{code:k.invalid_type,expected:F.array,received:n.parsedType}),Q;if(n.data.length<this._def.items.length)return A(n,{code:k.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&n.data.length>this._def.items.length&&(A(n,{code:k.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const o=[...n.data].map((a,i)=>{const l=this._def.items[i]||this._def.rest;return l?l._parse(new yt(n,a,n.path,i)):null}).filter(a=>!!a);return n.common.async?Promise.all(o).then(a=>Me.mergeArray(r,a)):Me.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new xt({...this._def,rest:t})}}xt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xt({items:e,typeName:Y.ZodTuple,rest:null,...ee(t)})};class Or extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==F.object)return A(n,{code:k.invalid_type,expected:F.object,received:n.parsedType}),Q;const s=[],o=this._def.keyType,a=this._def.valueType;for(const i in n.data)s.push({key:o._parse(new yt(n,i,n.path,i)),value:a._parse(new yt(n,n.data[i],n.path,i)),alwaysSet:i in n.data});return n.common.async?Me.mergeObjectAsync(r,s):Me.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof se?new Or({keyType:t,valueType:r,typeName:Y.ZodRecord,...ee(n)}):new Or({keyType:ct.create(),valueType:t,typeName:Y.ZodRecord,...ee(r)})}}class xn extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==F.map)return A(n,{code:k.invalid_type,expected:F.map,received:n.parsedType}),Q;const s=this._def.keyType,o=this._def.valueType,a=[...n.data.entries()].map(([i,l],d)=>({key:s._parse(new yt(n,i,n.path,[d,"key"])),value:o._parse(new yt(n,l,n.path,[d,"value"]))}));if(n.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const l of a){const d=await l.key,h=await l.value;if(d.status==="aborted"||h.status==="aborted")return Q;(d.status==="dirty"||h.status==="dirty")&&r.dirty(),i.set(d.value,h.value)}return{status:r.value,value:i}})}else{const i=new Map;for(const l of a){const d=l.key,h=l.value;if(d.status==="aborted"||h.status==="aborted")return Q;(d.status==="dirty"||h.status==="dirty")&&r.dirty(),i.set(d.value,h.value)}return{status:r.value,value:i}}}}xn.create=(e,t,r)=>new xn({valueType:t,keyType:e,typeName:Y.ZodMap,...ee(r)});class nr extends se{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==F.set)return A(n,{code:k.invalid_type,expected:F.set,received:n.parsedType}),Q;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(A(n,{code:k.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(A(n,{code:k.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const o=this._def.valueType;function a(l){const d=new Set;for(const h of l){if(h.status==="aborted")return Q;h.status==="dirty"&&r.dirty(),d.add(h.value)}return{status:r.value,value:d}}const i=[...n.data.values()].map((l,d)=>o._parse(new yt(n,l,n.path,d)));return n.common.async?Promise.all(i).then(l=>a(l)):a(i)}min(t,r){return new nr({...this._def,minSize:{value:t,message:Z.toString(r)}})}max(t,r){return new nr({...this._def,maxSize:{value:t,message:Z.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}nr.create=(e,t)=>new nr({valueType:e,minSize:null,maxSize:null,typeName:Y.ZodSet,...ee(t)});class dr extends se{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==F.function)return A(r,{code:k.invalid_type,expected:F.function,received:r.parsedType}),Q;function n(i,l){return gn({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,mn(),fr].filter(d=>!!d),issueData:{code:k.invalid_arguments,argumentsError:l}})}function s(i,l){return gn({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,mn(),fr].filter(d=>!!d),issueData:{code:k.invalid_return_type,returnTypeError:l}})}const o={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof pr){const i=this;return Fe(async function(...l){const d=new Ze([]),h=await i._def.args.parseAsync(l,o).catch(E=>{throw d.addIssue(n(l,E)),d}),u=await Reflect.apply(a,this,h);return await i._def.returns._def.type.parseAsync(u,o).catch(E=>{throw d.addIssue(s(u,E)),d})})}else{const i=this;return Fe(function(...l){const d=i._def.args.safeParse(l,o);if(!d.success)throw new Ze([n(l,d.error)]);const h=Reflect.apply(a,this,d.data),u=i._def.returns.safeParse(h,o);if(!u.success)throw new Ze([s(h,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new dr({...this._def,args:xt.create(t).rest(Kt.create())})}returns(t){return new dr({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new dr({args:t||xt.create([]).rest(Kt.create()),returns:r||Kt.create(),typeName:Y.ZodFunction,...ee(n)})}}class Dr extends se{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Dr.create=(e,t)=>new Dr({getter:e,typeName:Y.ZodLazy,...ee(t)});class Fr extends se{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return A(r,{received:r.data,code:k.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:t.data}}get value(){return this._def.value}}Fr.create=(e,t)=>new Fr({value:e,typeName:Y.ZodLiteral,...ee(t)});function zi(e,t){return new $t({values:e,typeName:Y.ZodEnum,...ee(t)})}class $t extends se{_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return A(r,{expected:ie.joinValues(n),received:r.parsedType,code:k.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return A(r,{received:r.data,code:k.invalid_enum_value,options:n}),Q}return Fe(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return $t.create(t,{...this._def,...r})}exclude(t,r=this._def){return $t.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}$t.create=zi;class Vr extends se{_parse(t){const r=ie.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==F.string&&n.parsedType!==F.number){const s=ie.objectValues(r);return A(n,{expected:ie.joinValues(s),received:n.parsedType,code:k.invalid_type}),Q}if(this._cache||(this._cache=new Set(ie.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=ie.objectValues(r);return A(n,{received:n.data,code:k.invalid_enum_value,options:s}),Q}return Fe(t.data)}get enum(){return this._def.values}}Vr.create=(e,t)=>new Vr({values:e,typeName:Y.ZodNativeEnum,...ee(t)});class pr extends se{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==F.promise&&r.common.async===!1)return A(r,{code:k.invalid_type,expected:F.promise,received:r.parsedType}),Q;const n=r.parsedType===F.promise?r.data:Promise.resolve(r.data);return Fe(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}pr.create=(e,t)=>new pr({type:e,typeName:Y.ZodPromise,...ee(t)});class ut extends se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:a=>{A(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const a=s.transform(n.data,o);if(n.common.async)return Promise.resolve(a).then(async i=>{if(r.value==="aborted")return Q;const l=await this._def.schema._parseAsync({data:i,path:n.path,parent:n});return l.status==="aborted"?Q:l.status==="dirty"||r.value==="dirty"?ur(l.value):l});{if(r.value==="aborted")return Q;const i=this._def.schema._parseSync({data:a,path:n.path,parent:n});return i.status==="aborted"?Q:i.status==="dirty"||r.value==="dirty"?ur(i.value):i}}if(s.type==="refinement"){const a=i=>{const l=s.refinement(i,o);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Q:(i.status==="dirty"&&r.dirty(),a(i.value),{status:r.value,value:i.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"?Q:(i.status==="dirty"&&r.dirty(),a(i.value).then(()=>({status:r.value,value:i.value}))))}if(s.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!tr(a))return Q;const i=s.transform(a.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>tr(a)?Promise.resolve(s.transform(a.value,o)).then(i=>({status:r.value,value:i})):Q);ie.assertNever(s)}}ut.create=(e,t,r)=>new ut({schema:e,typeName:Y.ZodEffects,effect:t,...ee(r)});ut.createWithPreprocess=(e,t,r)=>new ut({schema:t,effect:{type:"preprocess",transform:e},typeName:Y.ZodEffects,...ee(r)});class vt extends se{_parse(t){return this._getType(t)===F.undefined?Fe(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}vt.create=(e,t)=>new vt({innerType:e,typeName:Y.ZodOptional,...ee(t)});class Ut extends se{_parse(t){return this._getType(t)===F.null?Fe(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ut.create=(e,t)=>new Ut({innerType:e,typeName:Y.ZodNullable,...ee(t)});class Lr extends se{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===F.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Lr.create=(e,t)=>new Lr({innerType:e,typeName:Y.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ee(t)});class $r extends se{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return jr(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ze(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ze(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}$r.create=(e,t)=>new $r({innerType:e,typeName:Y.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ee(t)});class bn extends se{_parse(t){if(this._getType(t)!==F.nan){const n=this._getOrReturnCtx(t);return A(n,{code:k.invalid_type,expected:F.nan,received:n.parsedType}),Q}return{status:"valid",value:t.data}}}bn.create=e=>new bn({typeName:Y.ZodNaN,...ee(e)});const Df=Symbol("zod_brand");class $s extends se{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Gr extends se{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Q:o.status==="dirty"?(r.dirty(),ur(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Q:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new Gr({in:t,out:r,typeName:Y.ZodPipeline})}}class Ur extends se{_parse(t){const r=this._def.innerType._parse(t),n=s=>(tr(s)&&(s.value=Object.freeze(s.value)),s);return jr(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}Ur.create=(e,t)=>new Ur({innerType:e,typeName:Y.ZodReadonly,...ee(t)});function Ao(e,t){const r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Hi(e,t={},r){return e?hr.create().superRefine((n,s)=>{const o=e(n);if(o instanceof Promise)return o.then(a=>{if(!a){const i=Ao(t,n),l=i.fatal??r??!0;s.addIssue({code:"custom",...i,fatal:l})}});if(!o){const a=Ao(t,n),i=a.fatal??r??!0;s.addIssue({code:"custom",...a,fatal:i})}}):hr.create()}const Ff={object:_e.lazycreate};var Y;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Y||(Y={}));const Vf=(e,t={message:`Input not instance of ${e.name}`})=>Hi(r=>r instanceof e,t),Zi=ct.create,Wi=Vt.create,Lf=bn.create,$f=Lt.create,Gi=Pr.create,Uf=rr.create,Bf=vn.create,zf=Nr.create,Hf=Ir.create,Zf=hr.create,Wf=Kt.create,Gf=Pt.create,qf=yn.create,Kf=lt.create,Qf=_e.create,Yf=_e.strictCreate,Xf=Mr.create,Jf=Mn.create,eh=Ar.create,th=xt.create,rh=Or.create,nh=xn.create,sh=nr.create,oh=dr.create,ah=Dr.create,ih=Fr.create,ch=$t.create,lh=Vr.create,uh=pr.create,Oo=ut.create,dh=vt.create,fh=Ut.create,hh=ut.createWithPreprocess,ph=Gr.create,mh=()=>Zi().optional(),gh=()=>Wi().optional(),vh=()=>Gi().optional(),yh={string:(e=>ct.create({...e,coerce:!0})),number:(e=>Vt.create({...e,coerce:!0})),boolean:(e=>Pr.create({...e,coerce:!0})),bigint:(e=>Lt.create({...e,coerce:!0})),date:(e=>rr.create({...e,coerce:!0}))},xh=Q,Ae=Object.freeze(Object.defineProperty({__proto__:null,BRAND:Df,DIRTY:ur,EMPTY_PATH:pf,INVALID:Q,NEVER:xh,OK:Fe,ParseStatus:Me,Schema:se,ZodAny:hr,ZodArray:lt,ZodBigInt:Lt,ZodBoolean:Pr,ZodBranded:$s,ZodCatch:$r,ZodDate:rr,ZodDefault:Lr,ZodDiscriminatedUnion:Mn,ZodEffects:ut,ZodEnum:$t,ZodError:Ze,get ZodFirstPartyTypeKind(){return Y},ZodFunction:dr,ZodIntersection:Ar,ZodIssueCode:k,ZodLazy:Dr,ZodLiteral:Fr,ZodMap:xn,ZodNaN:bn,ZodNativeEnum:Vr,ZodNever:Pt,ZodNull:Ir,ZodNullable:Ut,ZodNumber:Vt,ZodObject:_e,ZodOptional:vt,ZodParsedType:F,ZodPipeline:Gr,ZodPromise:pr,ZodReadonly:Ur,ZodRecord:Or,ZodSchema:se,ZodSet:nr,ZodString:ct,ZodSymbol:vn,ZodTransformer:ut,ZodTuple:xt,ZodType:se,ZodUndefined:Nr,ZodUnion:Mr,ZodUnknown:Kt,ZodVoid:yn,addIssueToContext:A,any:Zf,array:Kf,bigint:$f,boolean:Gi,coerce:yh,custom:Hi,date:Uf,datetimeRegex:Bi,defaultErrorMap:fr,discriminatedUnion:Jf,effect:Oo,enum:ch,function:oh,getErrorMap:mn,getParsedType:Et,instanceof:Vf,intersection:eh,isAborted:ls,isAsync:jr,isDirty:us,isValid:tr,late:Ff,lazy:ah,literal:ih,makeIssue:gn,map:nh,nan:Lf,nativeEnum:lh,never:Gf,null:Hf,nullable:fh,number:Wi,object:Qf,get objectUtil(){return cs},oboolean:vh,onumber:gh,optional:dh,ostring:mh,pipeline:ph,preprocess:hh,promise:uh,quotelessJson:ff,record:rh,set:sh,setErrorMap:hf,strictObject:Yf,string:Zi,symbol:Bf,transformer:Oo,tuple:th,undefined:zf,union:Xf,unknown:Wf,get util(){return ie},void:qf},Symbol.toStringTag,{value:"Module"})),bh=Ae.object({images:Ae.array(Ae.string()).min(1,"At least 1 image is required"),title:Ae.string().min(1,"Product title is required").min(5,"Product title must be at least 5 characters"),price:Ae.preprocess(e=>typeof e=="string"?Number(e):e,Ae.number({invalid_type_error:"Price must be a number",required_error:"Price is required"}).min(1,"Price must be greater than 0")),category:Ae.string().min(1,"Category is required"),condition:Ae.string().min(1,"Condition is required"),brand:Ae.string().optional(),description:Ae.string().min(1,"Description is required").min(20,"Description must be at least 20 characters"),tags:Ae.array(Ae.string()).optional(),sku:Ae.string().min(1,"Sku must be required"),location:Ae.string().optional(),publist:Ae.boolean().optional()});function wh({children:e,data:t,...r}){const[n,s]=f.useState(!1),[o,a]=f.useState(""),[i,l]=f.useState(""),d=Vu({resolver:Qu(bh),defaultValues:{images:[],title:"",price:0,category:"",condition:"",brand:"",description:"",tags:[],sku:"",location:"",publist:!1}}),h=d.watch("images"),u=d.watch("tags"),m=["New","Used - like new","Used - good","Used - fair"],E=["Tools","Electronics & computers"],{refetch:S,...v}=df(t),w=()=>{if(o.trim()&&!u?.includes(o.trim())){const _=d.getValues("tags")||[];d.setValue("tags",[..._,o.trim()]),a("")}},C=_=>{const P=d.getValues("tags")||[];d.setValue("tags",P.filter(O=>O!==_))},x=async({images:_,...P})=>{try{let O=[];if(t){const G=t.images||[];O=(_||[]).filter(B=>!G.includes(B))}else O=_||[];const U=await Promise.all(O.map(async G=>G.startsWith("blob:")?await Gc(G):G)),H={...P,images:U};console.log("Product data to submit:",H),console.log("Hình mới cần xử lý:",U)}catch(O){console.error("Error submitting form:",O)}},R=()=>{s(!1),d.reset(),l(""),a("")},T=ca({mutationKey:["createBlobUrl",t?.sku],mutationFn:_=>ze.apiRequest("createBlobUrl",_)});return f.useEffect(()=>{(async()=>{if(!v.data?.data||!t)return;const _=Wn({...v.data?.data}).images,P=await T.mutateAsync(_),O={...t,images:P};d.reset(O)})()},[v.data,t]),c.jsxs(md,{open:n,onOpenChange:s,children:[c.jsx(gd,{asChild:!0,children:e}),c.jsxs(xd,{"aria-describedby":void 0,className:"md:max-w-4xl h-[95vh] flex flex-col p-0",children:[c.jsx(bd,{className:"p-6 border-b",children:c.jsx(wd,{className:"text-2xl font-bold",children:t?"Edit product":"Create new product"})}),!v.isLoading&&!T.isPending&&c.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:c.jsx(uf,{...d,children:c.jsxs("form",{onSubmit:d.handleSubmit(x),className:"space-y-8",children:[c.jsx(zn,{children:c.jsx(Hn,{className:"p-6",children:c.jsx(_t,{control:d.control,name:"images",render:()=>c.jsxs(St,{children:[c.jsx(ht,{className:"text-lg font-semibold",children:"Images *"}),c.jsx(Ct,{}),h.length>0&&c.jsx("div",{className:"mt-6 overflow-x-auto",children:c.jsx("div",{className:"flex gap-3",children:h.map((_,P)=>c.jsx("div",{className:"relative flex-shrink-0 w-32 h-32 group rounded-lg border overflow-hidden",children:c.jsx("img",{src:_||"/placeholder.svg",alt:`Preview ${P+1}`,className:"w-full h-full object-cover"})},P))})})]})})})}),c.jsx(zn,{children:c.jsxs(Hn,{className:"p-6 space-y-6",children:[c.jsx("h3",{className:"text-lg font-semibold border-b pb-2",children:"Product information"}),c.jsx(_t,{control:d.control,name:"title",render:({field:_})=>c.jsxs(St,{children:[c.jsx(ht,{children:"Title *"}),c.jsx(Ot,{children:c.jsx(Gt,{placeholder:"VD: MacBook Pro 14-inch 2023",..._})}),c.jsx(Ct,{})]})}),c.jsx(_t,{control:d.control,name:"price",render:({field:_})=>c.jsxs(St,{children:[c.jsx(ht,{children:"Price ($) *"}),c.jsx(Ot,{children:c.jsx(Gt,{type:"number",placeholder:"10",..._})}),c.jsx(Ct,{})]})}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[c.jsx(_t,{control:d.control,name:"category",render:({field:_})=>c.jsxs(St,{children:[c.jsx(ht,{children:"Category *"}),c.jsx(Ot,{children:c.jsxs(ko,{onValueChange:_.onChange,value:_.value,children:[c.jsx(Po,{className:"w-full",children:c.jsx(jo,{placeholder:"Select category"})}),c.jsx(No,{children:E.map(P=>c.jsx(Io,{value:P.toLowerCase(),children:P},P))})]})}),c.jsx(Ct,{})]})}),c.jsx(_t,{control:d.control,name:"condition",render:({field:_})=>c.jsxs(St,{children:[c.jsx(ht,{children:"Condition *"}),c.jsx(Ot,{children:c.jsxs(ko,{onValueChange:_.onChange,value:_.value,children:[c.jsx(Po,{className:"w-full",children:c.jsx(jo,{placeholder:"Select condition"})}),c.jsx(No,{children:m.map(P=>c.jsx(Io,{value:P.toLowerCase(),children:P},P))})]})}),c.jsx(Ct,{})]})}),c.jsx(_t,{control:d.control,name:"brand",render:({field:_})=>c.jsxs(St,{children:[c.jsx(ht,{children:"Brand"}),c.jsx(Ot,{children:c.jsx(Gt,{readOnly:!!t,placeholder:"VD: Cisco",..._})}),c.jsx(Ct,{})]})})]}),c.jsx(_t,{control:d.control,name:"description",render:({field:_})=>c.jsxs(St,{children:[c.jsx(ht,{children:"Description *"}),c.jsx(Ot,{children:c.jsx(lf,{rows:4,..._})}),c.jsx(Ct,{})]})})]})}),c.jsx(zn,{children:c.jsxs(Hn,{className:"p-6 space-y-6",children:[c.jsx("h3",{className:"text-lg font-semibold border-b pb-2",children:"Additional information"}),c.jsxs("div",{className:"space-y-3",children:[c.jsx(ht,{children:"Tags"}),c.jsx("div",{className:"flex gap-2",children:c.jsx(Gt,{value:o,onChange:_=>a(_.target.value),placeholder:"Tag and press Enter",onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),w())}})}),u&&u?.length>0&&c.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(_=>c.jsxs(qa,{onClick:()=>C(_),variant:"secondary",className:"flex items-center gap-1 px-3 py-1",children:[_,c.jsx(Cs,{className:"w-3 h-3 cursor-pointer hover:text-red-500"})]},_))})]}),c.jsx(_t,{control:d.control,name:"sku",render:({field:_})=>c.jsxs(St,{children:[c.jsx(ht,{children:"Sku *"}),c.jsx(Ot,{children:c.jsx(Gt,{readOnly:!!t,placeholder:"VD: MBP14-2023-512GB",..._})}),c.jsx(Ct,{})]})}),c.jsx(_t,{control:d.control,name:"location",render:({field:_})=>c.jsxs(St,{children:[c.jsx(ht,{children:"Location"}),c.jsx(Ot,{children:c.jsx(Gt,{placeholder:"VD: Hà Nội, Việt Nam",..._})}),c.jsx(Ct,{})]})})]})})]})})}),(v.isLoading||T.isPending)&&c.jsx("div",{className:"flex items-center justify-center w-full h-full",children:c.jsx(ja,{})}),c.jsx("div",{className:"p-6 border-t bg-white flex justify-end gap-3",children:c.jsx(mt,{type:"button",variant:"outline",onClick:R,children:"Close"})})]})]})}var fs=["Enter"," "],_h=["ArrowDown","PageUp","Home"],qi=["ArrowUp","PageDown","End"],Sh=[..._h,...qi],Ch={ltr:[...fs,"ArrowRight"],rtl:[...fs,"ArrowLeft"]},Th={ltr:["ArrowLeft"],rtl:["ArrowRight"]},qr="Menu",[Br,Eh,Rh]=Ts(qr),[sr,Ki]=Bt(qr,[Rh,Tn,En]),An=Tn(),Qi=En(),[kh,or]=sr(qr),[jh,Kr]=sr(qr),Yi=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:s,onOpenChange:o,modal:a=!0}=e,i=An(t),[l,d]=f.useState(null),h=f.useRef(!1),u=ot(o),m=Hr(s);return f.useEffect(()=>{const E=()=>{h.current=!0,document.addEventListener("pointerdown",S,{capture:!0,once:!0}),document.addEventListener("pointermove",S,{capture:!0,once:!0})},S=()=>h.current=!1;return document.addEventListener("keydown",E,{capture:!0}),()=>{document.removeEventListener("keydown",E,{capture:!0}),document.removeEventListener("pointerdown",S,{capture:!0}),document.removeEventListener("pointermove",S,{capture:!0})}},[]),c.jsx(zo,{...i,children:c.jsx(kh,{scope:t,open:r,onOpenChange:u,content:l,onContentChange:d,children:c.jsx(jh,{scope:t,onClose:f.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:h,dir:m,modal:a,children:n})})})};Yi.displayName=qr;var Ph="MenuAnchor",Us=f.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=An(r);return c.jsx(Ho,{...s,...n,ref:t})});Us.displayName=Ph;var Bs="MenuPortal",[Nh,Xi]=sr(Bs,{forceMount:void 0}),Ji=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:s}=e,o=or(Bs,t);return c.jsx(Nh,{scope:t,forceMount:r,children:c.jsx(dt,{present:r||o.open,children:c.jsx(ps,{asChild:!0,container:s,children:n})})})};Ji.displayName=Bs;var Ke="MenuContent",[Ih,zs]=sr(Ke),ec=f.forwardRef((e,t)=>{const r=Xi(Ke,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=or(Ke,e.__scopeMenu),a=Kr(Ke,e.__scopeMenu);return c.jsx(Br.Provider,{scope:e.__scopeMenu,children:c.jsx(dt,{present:n||o.open,children:c.jsx(Br.Slot,{scope:e.__scopeMenu,children:a.modal?c.jsx(Mh,{...s,ref:t}):c.jsx(Ah,{...s,ref:t})})})})}),Mh=f.forwardRef((e,t)=>{const r=or(Ke,e.__scopeMenu),n=f.useRef(null),s=ye(t,n);return f.useEffect(()=>{const o=n.current;if(o)return ms(o)},[]),c.jsx(Hs,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:z(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Ah=f.forwardRef((e,t)=>{const r=or(Ke,e.__scopeMenu);return c.jsx(Hs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Oh=Rr("MenuContent.ScrollLock"),Hs=f.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:l,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:u,onInteractOutside:m,onDismiss:E,disableOutsideScroll:S,...v}=e,w=or(Ke,r),C=Kr(Ke,r),x=An(r),R=Qi(r),T=Eh(r),[_,P]=f.useState(null),O=f.useRef(null),U=ye(t,O,w.onContentChange),H=f.useRef(0),G=f.useRef(""),X=f.useRef(0),B=f.useRef(null),D=f.useRef("right"),q=f.useRef(0),ne=S?gs:f.Fragment,V=S?{as:Oh,allowPinchZoom:!0}:void 0,te=$=>{const ve=G.current+$,we=T().filter(L=>!L.disabled),Pe=document.activeElement,J=we.find(L=>L.ref.current===Pe)?.textValue,ae=we.map(L=>L.textValue),ce=Gh(ae,ve,J),xe=we.find(L=>L.textValue===ce)?.ref.current;(function L(K){G.current=K,window.clearTimeout(H.current),K!==""&&(H.current=window.setTimeout(()=>L(""),1e3))})(ve),xe&&setTimeout(()=>xe.focus())};f.useEffect(()=>()=>window.clearTimeout(H.current),[]),vs();const ue=f.useCallback($=>D.current===B.current?.side&&Kh($,B.current?.area),[]);return c.jsx(Ih,{scope:r,searchRef:G,onItemEnter:f.useCallback($=>{ue($)&&$.preventDefault()},[ue]),onItemLeave:f.useCallback($=>{ue($)||(O.current?.focus(),P(null))},[ue]),onTriggerLeave:f.useCallback($=>{ue($)&&$.preventDefault()},[ue]),pointerGraceTimerRef:X,onPointerGraceIntentChange:f.useCallback($=>{B.current=$},[]),children:c.jsx(ne,{...V,children:c.jsx(ys,{asChild:!0,trapped:s,onMountAutoFocus:z(o,$=>{$.preventDefault(),O.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:c.jsx(xs,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:u,onInteractOutside:m,onDismiss:E,children:c.jsx(ya,{asChild:!0,...R,dir:C.dir,orientation:"vertical",loop:n,currentTabStopId:_,onCurrentTabStopIdChange:P,onEntryFocus:z(l,$=>{C.isUsingKeyboardRef.current||$.preventDefault()}),preventScrollOnEntryFocus:!0,children:c.jsx(Wo,{role:"menu","aria-orientation":"vertical","data-state":gc(w.open),"data-radix-menu-content":"",dir:C.dir,...x,...v,ref:U,style:{outline:"none",...v.style},onKeyDown:z(v.onKeyDown,$=>{const we=$.target.closest("[data-radix-menu-content]")===$.currentTarget,Pe=$.ctrlKey||$.altKey||$.metaKey,J=$.key.length===1;we&&($.key==="Tab"&&$.preventDefault(),!Pe&&J&&te($.key));const ae=O.current;if($.target!==ae||!Sh.includes($.key))return;$.preventDefault();const xe=T().filter(L=>!L.disabled).map(L=>L.ref.current);qi.includes($.key)&&xe.reverse(),Zh(xe)}),onBlur:z(e.onBlur,$=>{$.currentTarget.contains($.target)||(window.clearTimeout(H.current),G.current="")}),onPointerMove:z(e.onPointerMove,zr($=>{const ve=$.target,we=q.current!==$.clientX;if($.currentTarget.contains(ve)&&we){const Pe=$.clientX>q.current?"right":"left";D.current=Pe,q.current=$.clientX}}))})})})})})})});ec.displayName=Ke;var Dh="MenuGroup",Zs=f.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return c.jsx(oe.div,{role:"group",...n,ref:t})});Zs.displayName=Dh;var Fh="MenuLabel",tc=f.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return c.jsx(oe.div,{...n,ref:t})});tc.displayName=Fh;var wn="MenuItem",Do="menu.itemSelect",On=f.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...s}=e,o=f.useRef(null),a=Kr(wn,e.__scopeMenu),i=zs(wn,e.__scopeMenu),l=ye(t,o),d=f.useRef(!1),h=()=>{const u=o.current;if(!r&&u){const m=new CustomEvent(Do,{bubbles:!0,cancelable:!0});u.addEventListener(Do,E=>n?.(E),{once:!0}),zc(u,m),m.defaultPrevented?d.current=!1:a.onClose()}};return c.jsx(rc,{...s,ref:l,disabled:r,onClick:z(e.onClick,h),onPointerDown:u=>{e.onPointerDown?.(u),d.current=!0},onPointerUp:z(e.onPointerUp,u=>{d.current||u.currentTarget?.click()}),onKeyDown:z(e.onKeyDown,u=>{const m=i.searchRef.current!=="";r||m&&u.key===" "||fs.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})})});On.displayName=wn;var rc=f.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...o}=e,a=zs(wn,r),i=Qi(r),l=f.useRef(null),d=ye(t,l),[h,u]=f.useState(!1),[m,E]=f.useState("");return f.useEffect(()=>{const S=l.current;S&&E((S.textContent??"").trim())},[o.children]),c.jsx(Br.ItemSlot,{scope:r,disabled:n,textValue:s??m,children:c.jsx(xa,{asChild:!0,...i,focusable:!n,children:c.jsx(oe.div,{role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:d,onPointerMove:z(e.onPointerMove,zr(S=>{n?a.onItemLeave(S):(a.onItemEnter(S),S.defaultPrevented||S.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:z(e.onPointerLeave,zr(S=>a.onItemLeave(S))),onFocus:z(e.onFocus,()=>u(!0)),onBlur:z(e.onBlur,()=>u(!1))})})})}),Vh="MenuCheckboxItem",nc=f.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...s}=e;return c.jsx(cc,{scope:e.__scopeMenu,checked:r,children:c.jsx(On,{role:"menuitemcheckbox","aria-checked":_n(r)?"mixed":r,...s,ref:t,"data-state":Gs(r),onSelect:z(s.onSelect,()=>n?.(_n(r)?!0:!r),{checkForDefaultPrevented:!1})})})});nc.displayName=Vh;var sc="MenuRadioGroup",[Lh,$h]=sr(sc,{value:void 0,onValueChange:()=>{}}),oc=f.forwardRef((e,t)=>{const{value:r,onValueChange:n,...s}=e,o=ot(n);return c.jsx(Lh,{scope:e.__scopeMenu,value:r,onValueChange:o,children:c.jsx(Zs,{...s,ref:t})})});oc.displayName=sc;var ac="MenuRadioItem",ic=f.forwardRef((e,t)=>{const{value:r,...n}=e,s=$h(ac,e.__scopeMenu),o=r===s.value;return c.jsx(cc,{scope:e.__scopeMenu,checked:o,children:c.jsx(On,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":Gs(o),onSelect:z(n.onSelect,()=>s.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});ic.displayName=ac;var Ws="MenuItemIndicator",[cc,Uh]=sr(Ws,{checked:!1}),lc=f.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...s}=e,o=Uh(Ws,r);return c.jsx(dt,{present:n||_n(o.checked)||o.checked===!0,children:c.jsx(oe.span,{...s,ref:t,"data-state":Gs(o.checked)})})});lc.displayName=Ws;var Bh="MenuSeparator",uc=f.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return c.jsx(oe.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});uc.displayName=Bh;var zh="MenuArrow",dc=f.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=An(r);return c.jsx(Go,{...s,...n,ref:t})});dc.displayName=zh;var Hh="MenuSub",[Km,fc]=sr(Hh),Cr="MenuSubTrigger",hc=f.forwardRef((e,t)=>{const r=or(Cr,e.__scopeMenu),n=Kr(Cr,e.__scopeMenu),s=fc(Cr,e.__scopeMenu),o=zs(Cr,e.__scopeMenu),a=f.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:l}=o,d={__scopeMenu:e.__scopeMenu},h=f.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return f.useEffect(()=>h,[h]),f.useEffect(()=>{const u=i.current;return()=>{window.clearTimeout(u),l(null)}},[i,l]),c.jsx(Us,{asChild:!0,...d,children:c.jsx(rc,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":gc(r.open),...e,ref:qo(t,s.onTriggerChange),onClick:u=>{e.onClick?.(u),!(e.disabled||u.defaultPrevented)&&(u.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:z(e.onPointerMove,zr(u=>{o.onItemEnter(u),!u.defaultPrevented&&!e.disabled&&!r.open&&!a.current&&(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),h()},100))})),onPointerLeave:z(e.onPointerLeave,zr(u=>{h();const m=r.content?.getBoundingClientRect();if(m){const E=r.content?.dataset.side,S=E==="right",v=S?-5:5,w=m[S?"left":"right"],C=m[S?"right":"left"];o.onPointerGraceIntentChange({area:[{x:u.clientX+v,y:u.clientY},{x:w,y:m.top},{x:C,y:m.top},{x:C,y:m.bottom},{x:w,y:m.bottom}],side:E}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(u),u.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:z(e.onKeyDown,u=>{const m=o.searchRef.current!=="";e.disabled||m&&u.key===" "||Ch[n.dir].includes(u.key)&&(r.onOpenChange(!0),r.content?.focus(),u.preventDefault())})})})});hc.displayName=Cr;var pc="MenuSubContent",mc=f.forwardRef((e,t)=>{const r=Xi(Ke,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=or(Ke,e.__scopeMenu),a=Kr(Ke,e.__scopeMenu),i=fc(pc,e.__scopeMenu),l=f.useRef(null),d=ye(t,l);return c.jsx(Br.Provider,{scope:e.__scopeMenu,children:c.jsx(dt,{present:n||o.open,children:c.jsx(Br.Slot,{scope:e.__scopeMenu,children:c.jsx(Hs,{id:i.contentId,"aria-labelledby":i.triggerId,...s,ref:d,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{a.isUsingKeyboardRef.current&&l.current?.focus(),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:z(e.onFocusOutside,h=>{h.target!==i.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:z(e.onEscapeKeyDown,h=>{a.onClose(),h.preventDefault()}),onKeyDown:z(e.onKeyDown,h=>{const u=h.currentTarget.contains(h.target),m=Th[a.dir].includes(h.key);u&&m&&(o.onOpenChange(!1),i.trigger?.focus(),h.preventDefault())})})})})})});mc.displayName=pc;function gc(e){return e?"open":"closed"}function _n(e){return e==="indeterminate"}function Gs(e){return _n(e)?"indeterminate":e?"checked":"unchecked"}function Zh(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function Wh(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function Gh(e,t,r){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let a=Wh(e,Math.max(o,0));s.length===1&&(a=a.filter(d=>d!==r));const l=a.find(d=>d.toLowerCase().startsWith(s.toLowerCase()));return l!==r?l:void 0}function qh(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const i=t[o],l=t[a],d=i.x,h=i.y,u=l.x,m=l.y;h>n!=m>n&&r<(u-d)*(n-h)/(m-h)+d&&(s=!s)}return s}function Kh(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return qh(r,t)}function zr(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Qh=Yi,Yh=Us,Xh=Ji,Jh=ec,ep=Zs,tp=tc,rp=On,np=nc,sp=oc,op=ic,ap=lc,ip=uc,cp=dc,lp=hc,up=mc,Dn="DropdownMenu",[dp,Qm]=Bt(Dn,[Ki]),Ve=Ki(),[fp,vc]=dp(Dn),yc=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:s,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,l=Ve(t),d=f.useRef(null),[h,u]=Ft({prop:s,defaultProp:o??!1,onChange:a,caller:Dn});return c.jsx(fp,{scope:t,triggerId:kt(),triggerRef:d,contentId:kt(),open:h,onOpenChange:u,onOpenToggle:f.useCallback(()=>u(m=>!m),[u]),modal:i,children:c.jsx(Qh,{...l,open:h,onOpenChange:u,dir:n,modal:i,children:r})})};yc.displayName=Dn;var xc="DropdownMenuTrigger",bc=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=e,o=vc(xc,r),a=Ve(r);return c.jsx(Yh,{asChild:!0,...a,children:c.jsx(oe.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:qo(t,o.triggerRef),onPointerDown:z(e.onPointerDown,i=>{!n&&i.button===0&&i.ctrlKey===!1&&(o.onOpenToggle(),o.open||i.preventDefault())}),onKeyDown:z(e.onKeyDown,i=>{n||(["Enter"," "].includes(i.key)&&o.onOpenToggle(),i.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});bc.displayName=xc;var hp="DropdownMenuPortal",wc=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Ve(t);return c.jsx(Xh,{...n,...r})};wc.displayName=hp;var _c="DropdownMenuContent",Sc=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=vc(_c,r),o=Ve(r),a=f.useRef(!1);return c.jsx(Jh,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...n,ref:t,onCloseAutoFocus:z(e.onCloseAutoFocus,i=>{a.current||s.triggerRef.current?.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:z(e.onInteractOutside,i=>{const l=i.detail.originalEvent,d=l.button===0&&l.ctrlKey===!0,h=l.button===2||d;(!s.modal||h)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Sc.displayName=_c;var pp="DropdownMenuGroup",mp=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ve(r);return c.jsx(ep,{...s,...n,ref:t})});mp.displayName=pp;var gp="DropdownMenuLabel",vp=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ve(r);return c.jsx(tp,{...s,...n,ref:t})});vp.displayName=gp;var yp="DropdownMenuItem",Cc=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ve(r);return c.jsx(rp,{...s,...n,ref:t})});Cc.displayName=yp;var xp="DropdownMenuCheckboxItem",bp=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ve(r);return c.jsx(np,{...s,...n,ref:t})});bp.displayName=xp;var wp="DropdownMenuRadioGroup",_p=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ve(r);return c.jsx(sp,{...s,...n,ref:t})});_p.displayName=wp;var Sp="DropdownMenuRadioItem",Cp=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ve(r);return c.jsx(op,{...s,...n,ref:t})});Cp.displayName=Sp;var Tp="DropdownMenuItemIndicator",Ep=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ve(r);return c.jsx(ap,{...s,...n,ref:t})});Ep.displayName=Tp;var Rp="DropdownMenuSeparator",kp=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ve(r);return c.jsx(ip,{...s,...n,ref:t})});kp.displayName=Rp;var jp="DropdownMenuArrow",Pp=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ve(r);return c.jsx(cp,{...s,...n,ref:t})});Pp.displayName=jp;var Np="DropdownMenuSubTrigger",Ip=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ve(r);return c.jsx(lp,{...s,...n,ref:t})});Ip.displayName=Np;var Mp="DropdownMenuSubContent",Ap=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ve(r);return c.jsx(up,{...s,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ap.displayName=Mp;var Op=yc,Dp=bc,Fp=wc,Vp=Sc,Lp=Cc;function $p({...e}){return c.jsx(Op,{"data-slot":"dropdown-menu",...e})}function Up({...e}){return c.jsx(Dp,{"data-slot":"dropdown-menu-trigger",...e})}function Bp({className:e,sideOffset:t=4,...r}){return c.jsx(Fp,{children:c.jsx(Vp,{"data-slot":"dropdown-menu-content",sideOffset:t,className:fe("bg-popover text-popover-foreground 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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...r})})}function Fo({className:e,inset:t,variant:r="default",...n}){return c.jsx(Lp,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:fe("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}function zp(e,t){return f.useReducer((r,n)=>t[r][n]??r,e)}var qs="ScrollArea",[Tc,Ym]=Bt(qs),[Hp,Ye]=Tc(qs),Ec=f.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:o=600,...a}=e,[i,l]=f.useState(null),[d,h]=f.useState(null),[u,m]=f.useState(null),[E,S]=f.useState(null),[v,w]=f.useState(null),[C,x]=f.useState(0),[R,T]=f.useState(0),[_,P]=f.useState(!1),[O,U]=f.useState(!1),H=ye(t,X=>l(X)),G=Hr(s);return c.jsx(Hp,{scope:r,type:n,dir:G,scrollHideDelay:o,scrollArea:i,viewport:d,onViewportChange:h,content:u,onContentChange:m,scrollbarX:E,onScrollbarXChange:S,scrollbarXEnabled:_,onScrollbarXEnabledChange:P,scrollbarY:v,onScrollbarYChange:w,scrollbarYEnabled:O,onScrollbarYEnabledChange:U,onCornerWidthChange:x,onCornerHeightChange:T,children:c.jsx(oe.div,{dir:G,...a,ref:H,style:{position:"relative","--radix-scroll-area-corner-width":C+"px","--radix-scroll-area-corner-height":R+"px",...e.style}})})});Ec.displayName=qs;var Rc="ScrollAreaViewport",kc=f.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:s,...o}=e,a=Ye(Rc,r),i=f.useRef(null),l=ye(t,i,a.onViewportChange);return c.jsxs(c.Fragment,{children:[c.jsx("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:s}),c.jsx(oe.div,{"data-radix-scroll-area-viewport":"",...o,ref:l,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...e.style},children:c.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});kc.displayName=Rc;var bt="ScrollAreaScrollbar",jc=f.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Ye(bt,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:a}=s,i=e.orientation==="horizontal";return f.useEffect(()=>(i?o(!0):a(!0),()=>{i?o(!1):a(!1)}),[i,o,a]),s.type==="hover"?c.jsx(Zp,{...n,ref:t,forceMount:r}):s.type==="scroll"?c.jsx(Wp,{...n,ref:t,forceMount:r}):s.type==="auto"?c.jsx(Pc,{...n,ref:t,forceMount:r}):s.type==="always"?c.jsx(Ks,{...n,ref:t}):null});jc.displayName=bt;var Zp=f.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Ye(bt,e.__scopeScrollArea),[o,a]=f.useState(!1);return f.useEffect(()=>{const i=s.scrollArea;let l=0;if(i){const d=()=>{window.clearTimeout(l),a(!0)},h=()=>{l=window.setTimeout(()=>a(!1),s.scrollHideDelay)};return i.addEventListener("pointerenter",d),i.addEventListener("pointerleave",h),()=>{window.clearTimeout(l),i.removeEventListener("pointerenter",d),i.removeEventListener("pointerleave",h)}}},[s.scrollArea,s.scrollHideDelay]),c.jsx(dt,{present:r||o,children:c.jsx(Pc,{"data-state":o?"visible":"hidden",...n,ref:t})})}),Wp=f.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Ye(bt,e.__scopeScrollArea),o=e.orientation==="horizontal",a=Vn(()=>l("SCROLL_END"),100),[i,l]=zp("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return f.useEffect(()=>{if(i==="idle"){const d=window.setTimeout(()=>l("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(d)}},[i,s.scrollHideDelay,l]),f.useEffect(()=>{const d=s.viewport,h=o?"scrollLeft":"scrollTop";if(d){let u=d[h];const m=()=>{const E=d[h];u!==E&&(l("SCROLL"),a()),u=E};return d.addEventListener("scroll",m),()=>d.removeEventListener("scroll",m)}},[s.viewport,o,l,a]),c.jsx(dt,{present:r||i!=="hidden",children:c.jsx(Ks,{"data-state":i==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:z(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:z(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),Pc=f.forwardRef((e,t)=>{const r=Ye(bt,e.__scopeScrollArea),{forceMount:n,...s}=e,[o,a]=f.useState(!1),i=e.orientation==="horizontal",l=Vn(()=>{if(r.viewport){const d=r.viewport.offsetWidth<r.viewport.scrollWidth,h=r.viewport.offsetHeight<r.viewport.scrollHeight;a(i?d:h)}},10);return mr(r.viewport,l),mr(r.content,l),c.jsx(dt,{present:n||o,children:c.jsx(Ks,{"data-state":o?"visible":"hidden",...s,ref:t})})}),Ks=f.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,s=Ye(bt,e.__scopeScrollArea),o=f.useRef(null),a=f.useRef(0),[i,l]=f.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Oc(i.viewport,i.content),h={...n,sizes:i,onSizesChange:l,hasThumb:d>0&&d<1,onThumbChange:m=>o.current=m,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:m=>a.current=m};function u(m,E){return Xp(m,a.current,i,E)}return r==="horizontal"?c.jsx(Gp,{...h,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollLeft,E=Vo(m,i,s.dir);o.current.style.transform=`translate3d(${E}px, 0, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollLeft=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollLeft=u(m,s.dir))}}):r==="vertical"?c.jsx(qp,{...h,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollTop,E=Vo(m,i);o.current.style.transform=`translate3d(0, ${E}px, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollTop=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollTop=u(m))}}):null}),Gp=f.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=Ye(bt,e.__scopeScrollArea),[a,i]=f.useState(),l=f.useRef(null),d=ye(t,l,o.onScrollbarXChange);return f.useEffect(()=>{l.current&&i(getComputedStyle(l.current))},[l]),c.jsx(Ic,{"data-orientation":"horizontal",...s,ref:d,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Fn(r)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.x),onDragScroll:h=>e.onDragScroll(h.x),onWheelScroll:(h,u)=>{if(o.viewport){const m=o.viewport.scrollLeft+h.deltaX;e.onWheelScroll(m),Fc(m,u)&&h.preventDefault()}},onResize:()=>{l.current&&o.viewport&&a&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Cn(a.paddingLeft),paddingEnd:Cn(a.paddingRight)}})}})}),qp=f.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=Ye(bt,e.__scopeScrollArea),[a,i]=f.useState(),l=f.useRef(null),d=ye(t,l,o.onScrollbarYChange);return f.useEffect(()=>{l.current&&i(getComputedStyle(l.current))},[l]),c.jsx(Ic,{"data-orientation":"vertical",...s,ref:d,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Fn(r)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.y),onDragScroll:h=>e.onDragScroll(h.y),onWheelScroll:(h,u)=>{if(o.viewport){const m=o.viewport.scrollTop+h.deltaY;e.onWheelScroll(m),Fc(m,u)&&h.preventDefault()}},onResize:()=>{l.current&&o.viewport&&a&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Cn(a.paddingTop),paddingEnd:Cn(a.paddingBottom)}})}})}),[Kp,Nc]=Tc(bt),Ic=f.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:o,onThumbPointerUp:a,onThumbPointerDown:i,onThumbPositionChange:l,onDragScroll:d,onWheelScroll:h,onResize:u,...m}=e,E=Ye(bt,r),[S,v]=f.useState(null),w=ye(t,H=>v(H)),C=f.useRef(null),x=f.useRef(""),R=E.viewport,T=n.content-n.viewport,_=ot(h),P=ot(l),O=Vn(u,10);function U(H){if(C.current){const G=H.clientX-C.current.left,X=H.clientY-C.current.top;d({x:G,y:X})}}return f.useEffect(()=>{const H=G=>{const X=G.target;S?.contains(X)&&_(G,T)};return document.addEventListener("wheel",H,{passive:!1}),()=>document.removeEventListener("wheel",H,{passive:!1})},[R,S,T,_]),f.useEffect(P,[n,P]),mr(S,O),mr(E.content,O),c.jsx(Kp,{scope:r,scrollbar:S,hasThumb:s,onThumbChange:ot(o),onThumbPointerUp:ot(a),onThumbPositionChange:P,onThumbPointerDown:ot(i),children:c.jsx(oe.div,{...m,ref:w,style:{position:"absolute",...m.style},onPointerDown:z(e.onPointerDown,H=>{H.button===0&&(H.target.setPointerCapture(H.pointerId),C.current=S.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",E.viewport&&(E.viewport.style.scrollBehavior="auto"),U(H))}),onPointerMove:z(e.onPointerMove,U),onPointerUp:z(e.onPointerUp,H=>{const G=H.target;G.hasPointerCapture(H.pointerId)&&G.releasePointerCapture(H.pointerId),document.body.style.webkitUserSelect=x.current,E.viewport&&(E.viewport.style.scrollBehavior=""),C.current=null})})})}),Sn="ScrollAreaThumb",Mc=f.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Nc(Sn,e.__scopeScrollArea);return c.jsx(dt,{present:r||s.hasThumb,children:c.jsx(Qp,{ref:t,...n})})}),Qp=f.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...s}=e,o=Ye(Sn,r),a=Nc(Sn,r),{onThumbPositionChange:i}=a,l=ye(t,u=>a.onThumbChange(u)),d=f.useRef(void 0),h=Vn(()=>{d.current&&(d.current(),d.current=void 0)},100);return f.useEffect(()=>{const u=o.viewport;if(u){const m=()=>{if(h(),!d.current){const E=Jp(u,i);d.current=E,i()}};return i(),u.addEventListener("scroll",m),()=>u.removeEventListener("scroll",m)}},[o.viewport,h,i]),c.jsx(oe.div,{"data-state":a.hasThumb?"visible":"hidden",...s,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:z(e.onPointerDownCapture,u=>{const E=u.target.getBoundingClientRect(),S=u.clientX-E.left,v=u.clientY-E.top;a.onThumbPointerDown({x:S,y:v})}),onPointerUp:z(e.onPointerUp,a.onThumbPointerUp)})});Mc.displayName=Sn;var Qs="ScrollAreaCorner",Ac=f.forwardRef((e,t)=>{const r=Ye(Qs,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?c.jsx(Yp,{...e,ref:t}):null});Ac.displayName=Qs;var Yp=f.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,s=Ye(Qs,r),[o,a]=f.useState(0),[i,l]=f.useState(0),d=!!(o&&i);return mr(s.scrollbarX,()=>{const h=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(h),l(h)}),mr(s.scrollbarY,()=>{const h=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(h),a(h)}),d?c.jsx(oe.div,{...n,ref:t,style:{width:o,height:i,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Cn(e){return e?parseInt(e,10):0}function Oc(e,t){const r=e/t;return isNaN(r)?0:r}function Fn(e){const t=Oc(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Xp(e,t,r,n="ltr"){const s=Fn(r),o=s/2,a=t||o,i=s-a,l=r.scrollbar.paddingStart+a,d=r.scrollbar.size-r.scrollbar.paddingEnd-i,h=r.content-r.viewport,u=n==="ltr"?[0,h]:[h*-1,0];return Dc([l,d],u)(e)}function Vo(e,t,r="ltr"){const n=Fn(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,a=t.content-t.viewport,i=o-n,l=r==="ltr"?[0,a]:[a*-1,0],d=rs(e,l);return Dc([0,a],[0,i])(d)}function Dc(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 Fc(e,t){return e>0&&e<t}var Jp=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return(function s(){const o={left:e.scrollLeft,top:e.scrollTop},a=r.left!==o.left,i=r.top!==o.top;(a||i)&&t(),r=o,n=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(n)};function Vn(e,t){const r=ot(e),n=f.useRef(0);return f.useEffect(()=>()=>window.clearTimeout(n.current),[]),f.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function mr(e,t){const r=ot(t);jt(()=>{let n=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(n),s.unobserve(e)}}},[e,r])}var em=Ec,tm=kc,rm=Ac;function nm({className:e,children:t,...r}){return c.jsxs(em,{"data-slot":"scroll-area",className:fe("relative",e),...r,children:[c.jsx(tm,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),c.jsx(sm,{}),c.jsx(rm,{})]})}function sm({className:e,orientation:t="vertical",...r}){return c.jsx(jc,{"data-slot":"scroll-area-scrollbar",orientation:t,className:fe("flex touch-none p-px transition-colors select-none",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...r,children:c.jsx(Mc,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function om({className:e,...t}){return c.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:c.jsx("table",{"data-slot":"table",className:fe("w-full caption-bottom text-sm",e),...t})})}function am({className:e,...t}){return c.jsx("thead",{"data-slot":"table-header",className:fe("[&_tr]:border-b",e),...t})}function im({className:e,...t}){return c.jsx("tbody",{"data-slot":"table-body",className:fe("[&_tr:last-child]:border-0",e),...t})}function tn({className:e,...t}){return c.jsx("tr",{"data-slot":"table-row",className:fe("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function rn({className:e,...t}){return c.jsx("th",{"data-slot":"table-head",className:fe("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function cr({className:e,...t}){return c.jsx("td",{"data-slot":"table-cell",className:fe("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function cm(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const lm=e=>{switch(e){case"success":return fm;case"info":return pm;case"warning":return hm;case"error":return mm;default:return null}},um=Array(12).fill(0),dm=({visible:e,className:t})=>y.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},y.createElement("div",{className:"sonner-spinner"},um.map((r,n)=>y.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),fm=y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},y.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),hm=y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},y.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),pm=y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},y.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),mm=y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},y.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),gm=y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},y.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),vm=()=>{const[e,t]=y.useState(document.hidden);return y.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let hs=1;class ym{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:n,...s}=t,o=typeof t?.id=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:hs++,a=this.toasts.find(l=>l.id===o),i=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),a?this.toasts=this.toasts.map(l=>l.id===o?(this.publish({...l,...t,id:o,title:n}),{...l,...t,id:o,dismissible:i,title:n}):l):this.addToast({title:n,...s,dismissible:i,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const s=Promise.resolve(t instanceof Function?t():t);let o=n!==void 0,a;const i=s.then(async d=>{if(a=["resolve",d],y.isValidElement(d))o=!1,this.create({id:n,type:"default",message:d});else if(bm(d)&&!d.ok){o=!1;const u=typeof r.error=="function"?await r.error(`HTTP error! status: ${d.status}`):r.error,m=typeof r.description=="function"?await r.description(`HTTP error! status: ${d.status}`):r.description,S=typeof u=="object"&&!y.isValidElement(u)?u:{message:u};this.create({id:n,type:"error",description:m,...S})}else if(d instanceof Error){o=!1;const u=typeof r.error=="function"?await r.error(d):r.error,m=typeof r.description=="function"?await r.description(d):r.description,S=typeof u=="object"&&!y.isValidElement(u)?u:{message:u};this.create({id:n,type:"error",description:m,...S})}else if(r.success!==void 0){o=!1;const u=typeof r.success=="function"?await r.success(d):r.success,m=typeof r.description=="function"?await r.description(d):r.description,S=typeof u=="object"&&!y.isValidElement(u)?u:{message:u};this.create({id:n,type:"success",description:m,...S})}}).catch(async d=>{if(a=["reject",d],r.error!==void 0){o=!1;const h=typeof r.error=="function"?await r.error(d):r.error,u=typeof r.description=="function"?await r.description(d):r.description,E=typeof h=="object"&&!y.isValidElement(h)?h:{message:h};this.create({id:n,type:"error",description:u,...E})}}).finally(()=>{o&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),l=()=>new Promise((d,h)=>i.then(()=>a[0]==="reject"?h(a[1]):d(a[1])).catch(h));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(t,r)=>{const n=r?.id||hs++;return this.create({jsx:t(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Ue=new ym,xm=(e,t)=>{const r=t?.id||hs++;return Ue.addToast({title:e,...t,id:r}),r},bm=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",wm=xm,_m=()=>Ue.toasts,Sm=()=>Ue.getActiveToasts(),Cm=Object.assign(wm,{success:Ue.success,info:Ue.info,warning:Ue.warning,error:Ue.error,custom:Ue.custom,message:Ue.message,promise:Ue.promise,dismiss:Ue.dismiss,loading:Ue.loading},{getHistory:_m,getToasts:Sm});cm("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function nn(e){return e.label!==void 0}const Tm=3,Em="24px",Rm="16px",Lo=4e3,km=356,jm=14,Pm=45,Nm=200;function pt(...e){return e.filter(Boolean).join(" ")}function Im(e){const[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}const Mm=e=>{var t,r,n,s,o,a,i,l,d;const{invert:h,toast:u,unstyled:m,interacting:E,setHeights:S,visibleToasts:v,heights:w,index:C,toasts:x,expanded:R,removeToast:T,defaultRichColors:_,closeButton:P,style:O,cancelButtonStyle:U,actionButtonStyle:H,className:G="",descriptionClassName:X="",duration:B,position:D,gap:q,expandByDefault:ne,classNames:V,icons:te,closeButtonAriaLabel:ue="Close toast"}=e,[$,ve]=y.useState(null),[we,Pe]=y.useState(null),[J,ae]=y.useState(!1),[ce,xe]=y.useState(!1),[L,K]=y.useState(!1),[be,le]=y.useState(!1),[he,ge]=y.useState(!1),[Xe,Le]=y.useState(0),[Nt,It]=y.useState(0),Je=y.useRef(u.duration||B||Lo),Ln=y.useRef(null),We=y.useRef(null),p=C===0,g=C+1<=v,b=u.type,I=u.dismissible!==!1,N=u.className||"",j=u.descriptionClassName||"",W=y.useMemo(()=>w.findIndex(re=>re.toastId===u.id)||0,[w,u.id]),de=y.useMemo(()=>{var re;return(re=u.closeButton)!=null?re:P},[u.closeButton,P]),pe=y.useMemo(()=>u.duration||B||Lo,[u.duration,B]),Ne=y.useRef(0),et=y.useRef(0),tt=y.useRef(0),Mt=y.useRef(null),[yr,xr]=D.split("-"),Qr=y.useMemo(()=>w.reduce((re,ke,Ie)=>Ie>=W?re:re+ke.height,0),[w,W]),br=vm(),$n=u.invert||h,ar=b==="loading";et.current=y.useMemo(()=>W*q+Qr,[W,Qr]),y.useEffect(()=>{Je.current=pe},[pe]),y.useEffect(()=>{ae(!0)},[]),y.useEffect(()=>{const re=We.current;if(re){const ke=re.getBoundingClientRect().height;return It(ke),S(Ie=>[{toastId:u.id,height:ke,position:u.position},...Ie]),()=>S(Ie=>Ie.filter(Be=>Be.toastId!==u.id))}},[S,u.id]),y.useLayoutEffect(()=>{if(!J)return;const re=We.current,ke=re.style.height;re.style.height="auto";const Ie=re.getBoundingClientRect().height;re.style.height=ke,It(Ie),S(Be=>Be.find(je=>je.toastId===u.id)?Be.map(je=>je.toastId===u.id?{...je,height:Ie}:je):[{toastId:u.id,height:Ie,position:u.position},...Be])},[J,u.title,u.description,S,u.id,u.jsx,u.action,u.cancel]);const At=y.useCallback(()=>{xe(!0),Le(et.current),S(re=>re.filter(ke=>ke.toastId!==u.id)),setTimeout(()=>{T(u)},Nm)},[u,T,S,et]);y.useEffect(()=>{if(u.promise&&b==="loading"||u.duration===1/0||u.type==="loading")return;let re;return R||E||br?(()=>{if(tt.current<Ne.current){const Be=new Date().getTime()-Ne.current;Je.current=Je.current-Be}tt.current=new Date().getTime()})():(()=>{Je.current!==1/0&&(Ne.current=new Date().getTime(),re=setTimeout(()=>{u.onAutoClose==null||u.onAutoClose.call(u,u),At()},Je.current))})(),()=>clearTimeout(re)},[R,E,u,b,br,At]),y.useEffect(()=>{u.delete&&(At(),u.onDismiss==null||u.onDismiss.call(u,u))},[At,u.delete]);function Vc(){var re;if(te?.loading){var ke;return y.createElement("div",{className:pt(V?.loader,u==null||(ke=u.classNames)==null?void 0:ke.loader,"sonner-loader"),"data-visible":b==="loading"},te.loading)}return y.createElement(dm,{className:pt(V?.loader,u==null||(re=u.classNames)==null?void 0:re.loader),visible:b==="loading"})}const Lc=u.icon||te?.[b]||lm(b);var Ys,Xs;return y.createElement("li",{tabIndex:0,ref:We,className:pt(G,N,V?.toast,u==null||(t=u.classNames)==null?void 0:t.toast,V?.default,V?.[b],u==null||(r=u.classNames)==null?void 0:r[b]),"data-sonner-toast":"","data-rich-colors":(Ys=u.richColors)!=null?Ys:_,"data-styled":!(u.jsx||u.unstyled||m),"data-mounted":J,"data-promise":!!u.promise,"data-swiped":he,"data-removed":ce,"data-visible":g,"data-y-position":yr,"data-x-position":xr,"data-index":C,"data-front":p,"data-swiping":L,"data-dismissible":I,"data-type":b,"data-invert":$n,"data-swipe-out":be,"data-swipe-direction":we,"data-expanded":!!(R||ne&&J),"data-testid":u.testId,style:{"--index":C,"--toasts-before":C,"--z-index":x.length-C,"--offset":`${ce?Xe:et.current}px`,"--initial-height":ne?"auto":`${Nt}px`,...O,...u.style},onDragEnd:()=>{K(!1),ve(null),Mt.current=null},onPointerDown:re=>{re.button!==2&&(ar||!I||(Ln.current=new Date,Le(et.current),re.target.setPointerCapture(re.pointerId),re.target.tagName!=="BUTTON"&&(K(!0),Mt.current={x:re.clientX,y:re.clientY})))},onPointerUp:()=>{var re,ke,Ie;if(be||!I)return;Mt.current=null;const Be=Number(((re=We.current)==null?void 0:re.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Yr=Number(((ke=We.current)==null?void 0:ke.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),je=new Date().getTime()-((Ie=Ln.current)==null?void 0:Ie.getTime()),Ge=$==="x"?Be:Yr,Xr=Math.abs(Ge)/je;if(Math.abs(Ge)>=Pm||Xr>.11){Le(et.current),u.onDismiss==null||u.onDismiss.call(u,u),Pe($==="x"?Be>0?"right":"left":Yr>0?"down":"up"),At(),le(!0);return}else{var rt,nt;(rt=We.current)==null||rt.style.setProperty("--swipe-amount-x","0px"),(nt=We.current)==null||nt.style.setProperty("--swipe-amount-y","0px")}ge(!1),K(!1),ve(null)},onPointerMove:re=>{var ke,Ie,Be;if(!Mt.current||!I||((ke=window.getSelection())==null?void 0:ke.toString().length)>0)return;const je=re.clientY-Mt.current.y,Ge=re.clientX-Mt.current.x;var Xr;const rt=(Xr=e.swipeDirections)!=null?Xr:Im(D);!$&&(Math.abs(Ge)>1||Math.abs(je)>1)&&ve(Math.abs(Ge)>Math.abs(je)?"x":"y");let nt={x:0,y:0};const Js=Wt=>1/(1.5+Math.abs(Wt)/20);if($==="y"){if(rt.includes("top")||rt.includes("bottom"))if(rt.includes("top")&&je<0||rt.includes("bottom")&&je>0)nt.y=je;else{const Wt=je*Js(je);nt.y=Math.abs(Wt)<Math.abs(je)?Wt:je}}else if($==="x"&&(rt.includes("left")||rt.includes("right")))if(rt.includes("left")&&Ge<0||rt.includes("right")&&Ge>0)nt.x=Ge;else{const Wt=Ge*Js(Ge);nt.x=Math.abs(Wt)<Math.abs(Ge)?Wt:Ge}(Math.abs(nt.x)>0||Math.abs(nt.y)>0)&&ge(!0),(Ie=We.current)==null||Ie.style.setProperty("--swipe-amount-x",`${nt.x}px`),(Be=We.current)==null||Be.style.setProperty("--swipe-amount-y",`${nt.y}px`)}},de&&!u.jsx&&b!=="loading"?y.createElement("button",{"aria-label":ue,"data-disabled":ar,"data-close-button":!0,onClick:ar||!I?()=>{}:()=>{At(),u.onDismiss==null||u.onDismiss.call(u,u)},className:pt(V?.closeButton,u==null||(n=u.classNames)==null?void 0:n.closeButton)},(Xs=te?.close)!=null?Xs:gm):null,(b||u.icon||u.promise)&&u.icon!==null&&(te?.[b]!==null||u.icon)?y.createElement("div",{"data-icon":"",className:pt(V?.icon,u==null||(s=u.classNames)==null?void 0:s.icon)},u.promise||u.type==="loading"&&!u.icon?u.icon||Vc():null,u.type!=="loading"?Lc:null):null,y.createElement("div",{"data-content":"",className:pt(V?.content,u==null||(o=u.classNames)==null?void 0:o.content)},y.createElement("div",{"data-title":"",className:pt(V?.title,u==null||(a=u.classNames)==null?void 0:a.title)},u.jsx?u.jsx:typeof u.title=="function"?u.title():u.title),u.description?y.createElement("div",{"data-description":"",className:pt(X,j,V?.description,u==null||(i=u.classNames)==null?void 0:i.description)},typeof u.description=="function"?u.description():u.description):null),y.isValidElement(u.cancel)?u.cancel:u.cancel&&nn(u.cancel)?y.createElement("button",{"data-button":!0,"data-cancel":!0,style:u.cancelButtonStyle||U,onClick:re=>{nn(u.cancel)&&I&&(u.cancel.onClick==null||u.cancel.onClick.call(u.cancel,re),At())},className:pt(V?.cancelButton,u==null||(l=u.classNames)==null?void 0:l.cancelButton)},u.cancel.label):null,y.isValidElement(u.action)?u.action:u.action&&nn(u.action)?y.createElement("button",{"data-button":!0,"data-action":!0,style:u.actionButtonStyle||H,onClick:re=>{nn(u.action)&&(u.action.onClick==null||u.action.onClick.call(u.action,re),!re.defaultPrevented&&At())},className:pt(V?.actionButton,u==null||(d=u.classNames)==null?void 0:d.actionButton)},u.action.label):null)};function $o(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function Am(e,t){const r={};return[e,t].forEach((n,s)=>{const o=s===1,a=o?"--mobile-offset":"--offset",i=o?Rm:Em;function l(d){["top","right","bottom","left"].forEach(h=>{r[`${a}-${h}`]=typeof d=="number"?`${d}px`:d})}typeof n=="number"||typeof n=="string"?l(n):typeof n=="object"?["top","right","bottom","left"].forEach(d=>{n[d]===void 0?r[`${a}-${d}`]=i:r[`${a}-${d}`]=typeof n[d]=="number"?`${n[d]}px`:n[d]}):l(i)}),r}const Xm=y.forwardRef(function(t,r){const{id:n,invert:s,position:o="bottom-right",hotkey:a=["altKey","KeyT"],expand:i,closeButton:l,className:d,offset:h,mobileOffset:u,theme:m="light",richColors:E,duration:S,style:v,visibleToasts:w=Tm,toastOptions:C,dir:x=$o(),gap:R=jm,icons:T,containerAriaLabel:_="Notifications"}=t,[P,O]=y.useState([]),U=y.useMemo(()=>n?P.filter(J=>J.toasterId===n):P.filter(J=>!J.toasterId),[P,n]),H=y.useMemo(()=>Array.from(new Set([o].concat(U.filter(J=>J.position).map(J=>J.position)))),[U,o]),[G,X]=y.useState([]),[B,D]=y.useState(!1),[q,ne]=y.useState(!1),[V,te]=y.useState(m!=="system"?m:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),ue=y.useRef(null),$=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),ve=y.useRef(null),we=y.useRef(!1),Pe=y.useCallback(J=>{O(ae=>{var ce;return(ce=ae.find(xe=>xe.id===J.id))!=null&&ce.delete||Ue.dismiss(J.id),ae.filter(({id:xe})=>xe!==J.id)})},[]);return y.useEffect(()=>Ue.subscribe(J=>{if(J.dismiss){requestAnimationFrame(()=>{O(ae=>ae.map(ce=>ce.id===J.id?{...ce,delete:!0}:ce))});return}setTimeout(()=>{Hc.flushSync(()=>{O(ae=>{const ce=ae.findIndex(xe=>xe.id===J.id);return ce!==-1?[...ae.slice(0,ce),{...ae[ce],...J},...ae.slice(ce+1)]:[J,...ae]})})})}),[P]),y.useEffect(()=>{if(m!=="system"){te(m);return}if(m==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?te("dark"):te("light")),typeof window>"u")return;const J=window.matchMedia("(prefers-color-scheme: dark)");try{J.addEventListener("change",({matches:ae})=>{te(ae?"dark":"light")})}catch{J.addListener(({matches:ce})=>{try{te(ce?"dark":"light")}catch(xe){console.error(xe)}})}},[m]),y.useEffect(()=>{P.length<=1&&D(!1)},[P]),y.useEffect(()=>{const J=ae=>{var ce;if(a.every(K=>ae[K]||ae.code===K)){var L;D(!0),(L=ue.current)==null||L.focus()}ae.code==="Escape"&&(document.activeElement===ue.current||(ce=ue.current)!=null&&ce.contains(document.activeElement))&&D(!1)};return document.addEventListener("keydown",J),()=>document.removeEventListener("keydown",J)},[a]),y.useEffect(()=>{if(ue.current)return()=>{ve.current&&(ve.current.focus({preventScroll:!0}),ve.current=null,we.current=!1)}},[ue.current]),y.createElement("section",{ref:r,"aria-label":`${_} ${$}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},H.map((J,ae)=>{var ce;const[xe,L]=J.split("-");return U.length?y.createElement("ol",{key:J,dir:x==="auto"?$o():x,tabIndex:-1,ref:ue,className:d,"data-sonner-toaster":!0,"data-sonner-theme":V,"data-y-position":xe,"data-x-position":L,style:{"--front-toast-height":`${((ce=G[0])==null?void 0:ce.height)||0}px`,"--width":`${km}px`,"--gap":`${R}px`,...v,...Am(h,u)},onBlur:K=>{we.current&&!K.currentTarget.contains(K.relatedTarget)&&(we.current=!1,ve.current&&(ve.current.focus({preventScroll:!0}),ve.current=null))},onFocus:K=>{K.target instanceof HTMLElement&&K.target.dataset.dismissible==="false"||we.current||(we.current=!0,ve.current=K.relatedTarget)},onMouseEnter:()=>D(!0),onMouseMove:()=>D(!0),onMouseLeave:()=>{q||D(!1)},onDragEnd:()=>D(!1),onPointerDown:K=>{K.target instanceof HTMLElement&&K.target.dataset.dismissible==="false"||ne(!0)},onPointerUp:()=>ne(!1)},U.filter(K=>!K.position&&ae===0||K.position===J).map((K,be)=>{var le,he;return y.createElement(Mm,{key:K.id,icons:T,index:be,toast:K,defaultRichColors:E,duration:(le=C?.duration)!=null?le:S,className:C?.className,descriptionClassName:C?.descriptionClassName,invert:s,visibleToasts:w,closeButton:(he=C?.closeButton)!=null?he:l,interacting:q,position:J,style:C?.style,unstyled:C?.unstyled,classNames:C?.classNames,cancelButtonStyle:C?.cancelButtonStyle,actionButtonStyle:C?.actionButtonStyle,closeButtonAriaLabel:C?.closeButtonAriaLabel,removeToast:Pe,toasts:U.filter(ge=>ge.position==K.position),heights:G.filter(ge=>ge.position==K.position),setHeights:X,expandByDefault:i,gap:R,expanded:B,swipeDirections:t.swipeDirections})})):null}))});function Om(e,t,r,n){var s=this,o=f.useRef(null),a=f.useRef(0),i=f.useRef(0),l=f.useRef(null),d=f.useRef([]),h=f.useRef(),u=f.useRef(),m=f.useRef(e),E=f.useRef(!0);m.current=e;var S=typeof window<"u",v=!t&&t!==0&&S;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var w=!!(r=r||{}).leading,C=!("trailing"in r)||!!r.trailing,x="maxWait"in r,R="debounceOnServer"in r&&!!r.debounceOnServer,T=x?Math.max(+r.maxWait||0,t):null;f.useEffect(function(){return E.current=!0,function(){E.current=!1}},[]);var _=f.useMemo(function(){var P=function(D){var q=d.current,ne=h.current;return d.current=h.current=null,a.current=D,i.current=i.current||D,u.current=m.current.apply(ne,q)},O=function(D,q){v&&cancelAnimationFrame(l.current),l.current=v?requestAnimationFrame(D):setTimeout(D,q)},U=function(D){if(!E.current)return!1;var q=D-o.current;return!o.current||q>=t||q<0||x&&D-a.current>=T},H=function(D){return l.current=null,C&&d.current?P(D):(d.current=h.current=null,u.current)},G=function D(){var q=Date.now();if(w&&i.current===a.current&&X(),U(q))return H(q);if(E.current){var ne=t-(q-o.current),V=x?Math.min(ne,T-(q-a.current)):ne;O(D,V)}},X=function(){n&&n({})},B=function(){if(S||R){var D=Date.now(),q=U(D);if(d.current=[].slice.call(arguments),h.current=s,o.current=D,q){if(!l.current&&E.current)return a.current=o.current,O(G,t),w?P(o.current):u.current;if(x)return O(G,t),P(o.current)}return l.current||O(G,t),u.current}};return B.cancel=function(){l.current&&(v?cancelAnimationFrame(l.current):clearTimeout(l.current)),a.current=0,d.current=o.current=h.current=l.current=null},B.isPending=function(){return!!l.current},B.flush=function(){return l.current?H(Date.now()):u.current},B},[w,x,t,T,C,v,S,R,n]);return _}function Dm(e,t){return e===t}function Fm(e,t,r){var n=Dm,s=f.useRef(e),o=f.useState({})[1],a=Om(f.useCallback(function(l){s.current=l,o({})},[o]),t,r,o),i=f.useRef(e);return n(i.current,e)||(a(e),i.current=e),[s.current,a]}function Jm(){const[e,t]=f.useState(""),[r,n]=f.useState({}),[s,o]=f.useState(1),[a]=Fm(e,400),i=f.useMemo(()=>["products",{currentPage:s,search:a,filter:r}],[s,a,r]),{data:l,isFetching:d}=Xn({queryKey:i,queryFn:async()=>await ze.apiRequest("index",Kc({skip:(s-1)*ze.item_per_page,where:{productModelCode:e,status_listing:r?.statusFilter==="all"?void 0:r.statusFilter}}))}),{data:h}=Xn({queryKey:["publised-products"],queryFn:async()=>await ze.apiRequest("getPublistedProducts",{})??[],staleTime:0,refetchOnMount:"always"}),u=ca({mutationKey:["action-mutaions"],mutationFn:async T=>{if(T.status)return ze.apiRequest("unlist",T);const _=await ze.apiRequest("get",T);if(!(!_||!_?.data))return ze.apiRequest("publist",{...T,images:Wn({..._?.data}).images})}}),m=f.useMemo(()=>!l||!l?.data?[]:l?.data.map(T=>Wn(T)),[l]),E=T=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(T),S=()=>{t(""),n({statusFilter:""}),o(1)},v=[r.statusFilter,e!==""].filter(Boolean).length,w=f.useMemo(()=>l?.total?Math.ceil(l.total/ze.item_per_page):0,[l?.total,ze.item_per_page]),C=f.useMemo(()=>(s-1)*ze.item_per_page+1,[s]),x=f.useMemo(()=>Math.min(s*ze.item_per_page,l?.total??0),[s,l]),R=async T=>{console.log({post:T}),u.mutate(T)};return f.useEffect(()=>{const T=setInterval(async()=>{try{if(!document.hidden){const _=await ze.apiRequest("dequeue",{});_&&Cm[_.type](_.title,{description:_.message})}}catch(_){console.error("Error in interval:",_)}},1e3);return()=>clearInterval(T)},[]),c.jsxs(Zc,{children:[c.jsx(Xl,{}),c.jsx(Wc,{side:"left",align:"end",className:"w-auto",children:c.jsxs("div",{className:"space-y-4 h-[78vh] min-w-[638px]",children:[c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx(ql,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),c.jsx(Gt,{placeholder:"Search...",value:e,onChange:T=>t(T.target.value),className:"pl-10"})]}),c.jsx(yu,{filter:r,setFilter:n,activeFiltersCount:v,clearFilters:S})]}),c.jsxs("div",{className:"flex items-center justify-between w-full gap-8",children:[c.jsxs("span",{children:["Showing ",C,"-",x," of ",l?.total??0," products"]}),w>1&&c.jsxs("div",{className:"flex items-center justify-end gap-2",children:[c.jsxs(mt,{variant:"outline",size:"xs",onClick:()=>o(T=>Math.max(1,T-1)),disabled:s===1,children:[c.jsx(Dl,{}),"Previous"]}),c.jsx("div",{className:"flex items-center gap-1",children:w<=7?Array.from({length:w},(T,_)=>c.jsx(mt,{variant:s===_+1?"default":"outline",size:"xs",onClick:()=>o(_+1),children:_+1},_+1)):c.jsxs(c.Fragment,{children:[c.jsx(mt,{variant:s===1?"default":"outline",size:"xs",onClick:()=>o(1),children:"1"}),s>4&&c.jsx("span",{className:"px-2 text-muted-foreground",children:"..."}),Array.from({length:3},(T,_)=>{let P;return s<=4?P=_+2:s>=w-3?P=w-4+_:P=s-1+_,P>1&&P<w?c.jsx(mt,{variant:s===P?"default":"outline",size:"xs",onClick:()=>o(P),children:P},P):null}).filter(Boolean),s<w-3&&c.jsx("span",{className:"px-2 text-muted-foreground",children:"..."}),c.jsx(mt,{variant:s===w?"default":"outline",size:"xs",onClick:()=>o(w),children:w})]})}),c.jsxs(mt,{variant:"outline",size:"xs",onClick:()=>o(T=>Math.min(w,T+1)),disabled:s===w,children:["Next",c.jsx(Vl,{})]})]})]}),c.jsx("div",{className:"rounded-md border overflow-x-auto relative",children:c.jsx(nm,{className:"h-[66vh] w-full",children:c.jsxs(om,{className:"h-fit",children:[c.jsx(am,{children:c.jsxs(tn,{children:[c.jsx(rn,{className:"min-w-[200px]",children:"Name"}),c.jsx(rn,{className:"w-[80px]",children:"Price"}),c.jsx(rn,{className:"w-[80px]",children:"Status"}),c.jsx(rn,{className:"w-[80px] text-center sticky right-0 bg-background border-l shadow-[-4px_0_8px_rgba(0,0,0,0.1)]",children:"Actions"})]})}),c.jsxs(im,{className:"relative",children:[d&&c.jsx(tn,{children:c.jsx(cr,{colSpan:10,className:"text-center py-8 text-muted-foreground ",children:c.jsx("div",{className:"h-full flex items-center justify-center w-full",children:c.jsx(ja,{})})})}),m.length===0&&!d?c.jsx(tn,{children:c.jsx(cr,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:c.jsx("div",{className:"h-full flex items-center justify-center w-full",children:c.jsx("span",{children:" No products found"})})})}):m.map(T=>{const _=h?.some(P=>P.title.includes(T.sku));return T.status=_,c.jsxs(tn,{children:[c.jsxs(cr,{className:"font-medium",children:[c.jsx("div",{className:"truncate max-w-[340px] w-fit",title:T.title,children:T.title}),c.jsx("div",{className:"text-sm text-muted-foreground truncate max-w-[340px]",title:T.description,children:T.description})]}),c.jsx(cr,{className:"font-semibold",children:E(T.price)}),c.jsx(cr,{children:c.jsx(qa,{variant:"secondary",children:T?.status?"Listed":"Unlisted"})}),c.jsx(cr,{className:"text-center sticky right-0 bg-background border-l shadow-[-4px_0_8px_rgba(0,0,0,0.1)]",children:c.jsxs($p,{children:[c.jsx(Up,{asChild:!0,children:c.jsx("div",{className:"w-full flex items-center justify-center",children:c.jsx(mt,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 mx-auto",children:c.jsx(Hl,{className:"h-4 w-4"})})})}),c.jsxs(Bp,{align:"end",children:[c.jsx(wh,{data:T,children:c.jsxs(Fo,{onSelect:P=>{P.preventDefault(),P.stopPropagation()},children:[c.jsx(Ql,{className:"h-4 w-4 mr-2"})," Review"]})}),c.jsxs(Fo,{onClick:()=>R(T),children:[T.status?c.jsx(da,{className:"h-4 w-4 mr-2"}):c.jsx(fa,{className:"h-4 w-4 mr-2"}),T.status?"Unlist":"List"]})]})]})})]},T.id)})]})]})})})]})})]})}export{Jm as P,zm as Q,Xm as T,Hm as q};