126 lines
279 KiB
JavaScript
126 lines
279 KiB
JavaScript
import{r as u,j as l,a as dd,c as qt,u as se,b as ma,d as fd,e as oe,B as ct,f as Q,g as ga,S as va,p as We,m as Bs,h as ya}from"./button-CQ7EuV7L.js";import{g as hd,a as pd,r as md}from"./app-DW8k92tM.js";import{u as gd}from"./base64-Bxt0tHTb.js";var Sr=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(){}},Kt=typeof window>"u"||"Deno"in globalThis;function Ae(){}function vd(e,t){return typeof e=="function"?e(t):e}function zs(e){return typeof e=="number"&&e>=0&&e!==1/0}function xa(e,t){return Math.max(e+(t||0)-Date.now(),0)}function jt(e,t){return typeof e=="function"?e(t):e}function He(e,t){return typeof e=="function"?e(t):e}function li(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:o,queryKey:i,stale:a}=e;if(i){if(n){if(t.queryHash!==vo(i,t.options))return!1}else if(!Lr(t.queryKey,i))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||o&&!o(t))}function ui(e,t){const{exact:r,status:n,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(r){if(Qt(t.options.mutationKey)!==Qt(o))return!1}else if(!Lr(t.options.mutationKey,o))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function vo(e,t){return(t?.queryKeyHashFn||Qt)(e)}function Qt(e){return JSON.stringify(e,(t,r)=>Ws(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Lr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Lr(e[r],t[r])):!1}function ba(e,t){if(e===t)return e;const r=di(e)&&di(t);if(r||Ws(e)&&Ws(t)){const n=r?e:Object.keys(e),s=n.length,o=r?t:Object.keys(t),i=o.length,a=r?[]:{},c=new Set(n);let d=0;for(let f=0;f<i;f++){const h=r?f:o[f];(!r&&c.has(h)||r)&&e[h]===void 0&&t[h]===void 0?(a[h]=void 0,d++):(a[h]=ba(e[h],t[h]),a[h]===e[h]&&e[h]!==void 0&&d++)}return s===i&&d===s?e:a}return t}function Nn(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 di(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ws(e){if(!fi(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!fi(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function fi(e){return Object.prototype.toString.call(e)==="[object Object]"}function yd(e){return new Promise(t=>{setTimeout(t,e)})}function Hs(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?ba(e,t):t}function xd(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function bd(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var yo=Symbol();function wa(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===yo?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function _a(e,t){return typeof e=="function"?e(...t):!!e}var wd=class extends Sr{#t;#e;#r;constructor(){super(),this.#r=e=>{if(!Kt&&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"}},xo=new wd,_d=class extends Sr{#t=!0;#e;#r;constructor(){super(),this.#r=e=>{if(!Kt&&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}},jn=new _d;function Zs(){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 Cd(e){return Math.min(1e3*2**e,3e4)}function Ca(e){return(e??"online")==="online"?jn.isOnline():!0}var Sa=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Ea(e){let t=!1,r=0,n;const s=Zs(),o=()=>s.status!=="pending",i=m=>{o()||(p(new Sa(m)),e.abort?.())},a=()=>{t=!0},c=()=>{t=!1},d=()=>xo.isFocused()&&(e.networkMode==="always"||jn.isOnline())&&e.canRun(),f=()=>Ca(e.networkMode)&&e.canRun(),h=m=>{o()||(n?.(),s.resolve(m))},p=m=>{o()||(n?.(),s.reject(m))},g=()=>new Promise(m=>{n=v=>{(o()||d())&&m(v)},e.onPause?.()}).then(()=>{n=void 0,o()||e.onContinue?.()}),b=()=>{if(o())return;let m;const v=r===0?e.initialPromise:void 0;try{m=v??e.fn()}catch(C){m=Promise.reject(C)}Promise.resolve(m).then(h).catch(C=>{if(o())return;const x=e.retry??(Kt?0:3),S=e.retryDelay??Cd,_=typeof S=="function"?S(r,C):S,w=x===!0||typeof x=="number"&&r<x||typeof x=="function"&&x(r,C);if(t||!w){p(C);return}r++,e.onFail?.(r,C),yd(_).then(()=>d()?void 0:g()).then(()=>{t?p(C):b()})})};return{promise:s,status:()=>s.status,cancel:i,continue:()=>(n?.(),s),cancelRetry:a,continueRetry:c,canStart:f,start:()=>(f()?b():g().then(b),s)}}var Sd=e=>setTimeout(e,0);function Ed(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=Sd;const o=a=>{t?e.push(a):s(()=>{r(a)})},i=()=>{const a=e;e=[],a.length&&s(()=>{n(()=>{a.forEach(c=>{r(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||i()}return c},batchCalls:a=>(...c)=>{o(()=>{a(...c)})},schedule:o,setNotifyFunction:a=>{r=a},setBatchNotifyFunction:a=>{n=a},setScheduler:a=>{s=a}}}var we=Ed(),Ra=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),zs(this.gcTime)&&(this.#t=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Kt?1/0:300*1e3))}clearGcTimeout(){this.#t&&(clearTimeout(this.#t),this.#t=void 0)}},Rd=class extends Ra{#t;#e;#r;#n;#s;#i;#a;constructor(e){super(),this.#a=!1,this.#i=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=Pd(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.#i,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const r=Hs(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(Ae).catch(Ae):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>He(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===yo||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>jt(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:!xa(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.#a?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 a=this.observers.find(c=>c.options.queryFn);a&&this.setOptions(a.options)}const r=new AbortController,n=a=>{Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(this.#a=!0,r.signal)})},s=()=>{const a=wa(this.options,t),d=(()=>{const f={client:this.#n,queryKey:this.queryKey,meta:this.meta};return n(f),f})();return this.#a=!1,this.options.persister?this.options.persister(a,d,this):a(d)},i=(()=>{const a={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#n,state:this.state,fetchFn:s};return n(a),a})();this.options.behavior?.onFetch(i,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==i.fetchOptions?.meta)&&this.#o({type:"fetch",meta:i.fetchOptions?.meta}),this.#s=Ea({initialPromise:t?.initialPromise,fn:i.fetchFn,abort:r.abort.bind(r),onFail:(a,c)=>{this.#o({type:"failed",failureCount:a,error:c})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0});try{const a=await this.#s.start();if(a===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(a),this.#r.config.onSuccess?.(a,this),this.#r.config.onSettled?.(a,this.state.error,this),a}catch(a){if(a instanceof Sa){if(a.silent)return this.#s.promise;if(a.revert){if(this.setState({...this.#e,fetchStatus:"idle"}),this.state.data===void 0)throw a;return this.state.data}}throw this.#o({type:"error",error:a}),this.#r.config.onError?.(a,this),this.#r.config.onSettled?.(this.state.data,a,this),a}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,...Pa(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),we.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function Pa(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ca(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Pd(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 Td=class extends Sr{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,r){const n=t.queryKey,s=t.queryHash??vo(n,t);let o=this.get(s);return o||(o=new Rd({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(){we.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=>li(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>li(e,r)):t}notify(e){we.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){we.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){we.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ad=class extends Ra{#t;#e;#r;constructor(e){super(),this.mutationId=e.mutationId,this.#e=e.mutationCache,this.#t=[],this.state=e.state||Ta(),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=Ea({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),we.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#e.notify({mutation:this,type:"updated",action:e})})}};function Ta(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Od=class extends Sr{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 Ad({mutationCache:this,mutationId:++this.#r,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#t.add(e);const t=yn(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=yn(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=yn(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=yn(e);return typeof t=="string"?this.#e.get(t)?.find(n=>n!==e&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){we.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=>ui(t,r))}findAll(e={}){return this.getAll().filter(t=>ui(e,t))}notify(e){we.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return we.batch(()=>Promise.all(e.map(t=>t.continue().catch(Ae))))}};function yn(e){return e.options.scope?.id}function hi(e){return{onFetch:(t,r)=>{const n=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],i=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},c=0;const d=async()=>{let f=!1;const h=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(t.signal.aborted?f=!0:t.signal.addEventListener("abort",()=>{f=!0}),t.signal)})},p=wa(t.options,t.fetchOptions),g=async(b,m,v)=>{if(f)return Promise.reject();if(m==null&&b.pages.length)return Promise.resolve(b);const x=(()=>{const T={client:t.client,queryKey:t.queryKey,pageParam:m,direction:v?"backward":"forward",meta:t.options.meta};return h(T),T})(),S=await p(x),{maxPages:_}=t.options,w=v?bd:xd;return{pages:w(b.pages,S,_),pageParams:w(b.pageParams,m,_)}};if(s&&o.length){const b=s==="backward",m=b?kd:pi,v={pages:o,pageParams:i},C=m(n,v);a=await g(v,C,b)}else{const b=e??o.length;do{const m=c===0?i[0]??n.initialPageParam:pi(n,a);if(c>0&&m==null)break;a=await g(a,m),c++}while(c<b)}return a};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 pi(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 kd(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Nd=class{#t;#e;#r;#n;#s;#i;#a;#o;constructor(e={}){this.#t=e.queryCache||new Td,this.#e=e.mutationCache||new Od,this.#r=e.defaultOptions||{},this.#n=new Map,this.#s=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#a=xo.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#o=jn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#a?.(),this.#a=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(jt(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,i=vd(t,o);if(i!==void 0)return this.#t.build(this,n).setData(i,{...r,manual:!0})}setQueriesData(e,t,r){return we.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;we.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#t;return we.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=we.batch(()=>this.#t.findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Ae).catch(Ae)}invalidateQueries(e,t={}){return we.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=we.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(Ae)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(Ae)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#t.build(this,t);return r.isStaleByTime(jt(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ae).catch(Ae)}fetchInfiniteQuery(e){return e.behavior=hi(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ae).catch(Ae)}ensureInfiniteQueryData(e){return e.behavior=hi(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return jn.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(Qt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#n.values()],r={};return t.forEach(n=>{Lr(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){this.#s.set(Qt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#s.values()],r={};return t.forEach(n=>{Lr(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=vo(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===yo&&(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()}},jd=class extends Sr{constructor(e,t){super(),this.options=t,this.#t=e,this.#o=null,this.#a=Zs(),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#r=void 0;#n=void 0;#s;#i;#a;#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),mi(this.#e,this.options)?this.#d():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Gs(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Gs(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 He(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&&!Nn(this.options,t)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const n=this.hasListeners();n&&gi(this.#e,r,this.options,t)&&this.#d(),this.updateResult(),n&&(this.#e!==r||He(this.options.enabled,this.#e)!==He(t.enabled,this.#e)||jt(this.options.staleTime,this.#e)!==jt(t.staleTime,this.#e))&&this.#g();const s=this.#v();n&&(this.#e!==r||He(this.options.enabled,this.#e)!==He(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 Id(this,r)&&(this.#n=r,this.#i=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.#a.status==="pending"&&this.#a.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(Ae)),t}#g(){this.#b();const e=jt(this.options.staleTime,this.#e);if(Kt||this.#n.isStale||!zs(e))return;const r=xa(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,!(Kt||He(this.options.enabled,this.#e)===!1||!zs(this.#c)||this.#c===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||xo.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,i=this.#i,c=e!==r?e.state:this.#r,{state:d}=e;let f={...d},h=!1,p;if(t._optimisticResults){const k=this.hasListeners(),j=!k&&mi(e,t),D=k&&gi(e,r,t,n);(j||D)&&(f={...f,...Pa(d.data,e.options)}),t._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:b,status:m}=f;p=f.data;let v=!1;if(t.placeholderData!==void 0&&p===void 0&&m==="pending"){let k;s?.isPlaceholderData&&t.placeholderData===i?.placeholderData?(k=s.data,v=!0):k=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,k!==void 0&&(m="success",p=Hs(s?.data,k,t),h=!0)}if(t.select&&p!==void 0&&!v)if(s&&p===o?.data&&t.select===this.#m)p=this.#f;else try{this.#m=t.select,p=t.select(p),p=Hs(s?.data,p,t),this.#f=p,this.#o=null}catch(k){this.#o=k}this.#o&&(g=this.#o,p=this.#f,b=Date.now(),m="error");const C=f.fetchStatus==="fetching",x=m==="pending",S=m==="error",_=x&&C,w=p!==void 0,R={status:m,fetchStatus:f.fetchStatus,isPending:x,isSuccess:m==="success",isError:S,isInitialLoading:_,isLoading:_,data:p,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:b,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>c.dataUpdateCount||f.errorUpdateCount>c.errorUpdateCount,isFetching:C,isRefetching:C&&!x,isLoadingError:S&&!w,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:S&&w,isStale:bo(e,t),refetch:this.refetch,promise:this.#a,isEnabled:He(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const k=G=>{R.status==="error"?G.reject(R.error):R.data!==void 0&&G.resolve(R.data)},j=()=>{const G=this.#a=R.promise=Zs();k(G)},D=this.#a;switch(D.status){case"pending":e.queryHash===r.queryHash&&k(D);break;case"fulfilled":(R.status==="error"||R.data!==D.value)&&j();break;case"rejected":(R.status!=="error"||R.error!==D.reason)&&j();break}}return R}updateResult(){const e=this.#n,t=this.createResult(this.#e,this.options);if(this.#s=this.#e.state,this.#i=this.options,this.#s.data!==void 0&&(this.#h=this.#e),Nn(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(i=>{const a=i;return this.#n[a]!==e[a]&&o.has(a)})};this.#C({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()}#C(e){we.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#n)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function Md(e,t){return He(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function mi(e,t){return Md(e,t)||e.state.data!==void 0&&Gs(e,t,t.refetchOnMount)}function Gs(e,t,r){if(He(t.enabled,e)!==!1&&jt(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&bo(e,t)}return!1}function gi(e,t,r,n){return(e!==t||He(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&bo(e,r)}function bo(e,t){return He(t.enabled,e)!==!1&&e.isStaleByTime(jt(t.staleTime,e))}function Id(e,t){return!Nn(e.getCurrentResult(),t)}var Dd=class extends Sr{#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),Nn(this.options,r)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),r?.mutationKey&&this.options.mutationKey&&Qt(r.mutationKey)!==Qt(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.#i(t)}getCurrentResult(){return this.#e}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#s(),this.#i()}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??Ta();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}}#i(t){we.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)})})}},Aa=u.createContext(void 0),Oa=e=>{const t=u.useContext(Aa);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},iw=({client:e,children:t})=>(u.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Aa.Provider,{value:e,children:t})),ka=u.createContext(!1),Fd=()=>u.useContext(ka);ka.Provider;function Ld(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Vd=u.createContext(Ld()),$d=()=>u.useContext(Vd),Ud=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Bd=e=>{u.useEffect(()=>{e.clearReset()},[e])},zd=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||_a(r,[e.error,n])),Wd=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))}},Hd=(e,t)=>e.isLoading&&e.isFetching&&!t,Zd=(e,t)=>e?.suspense&&t.isPending,vi=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Gd(e,t,r){const n=Fd(),s=$d(),o=Oa(),i=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(i),i._optimisticResults=n?"isRestoring":"optimistic",Wd(i),Ud(i,s),Bd(s);const a=!o.getQueryCache().get(i.queryHash),[c]=u.useState(()=>new t(o,i)),d=c.getOptimisticResult(i),f=!n&&e.subscribed!==!1;if(u.useSyncExternalStore(u.useCallback(h=>{const p=f?c.subscribe(we.batchCalls(h)):Ae;return c.updateResult(),p},[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),u.useEffect(()=>{c.setOptions(i)},[i,c]),Zd(i,d))throw vi(i,c,s);if(zd({result:d,errorResetBoundary:s,throwOnError:i.throwOnError,query:o.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw d.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(i,d),i.experimental_prefetchInRender&&!Kt&&Hd(d,n)&&(a?vi(i,c,s):o.getQueryCache().get(i.queryHash)?.promise)?.catch(Ae).finally(()=>{c.updateResult()}),i.notifyOnChangeProps?d:c.trackResult(d)}function qs(e,t){return Gd(e,jd)}function Na(e,t){const r=Oa(),[n]=u.useState(()=>new Dd(r,e));u.useEffect(()=>{n.setOptions(e)},[n,e]);const s=u.useSyncExternalStore(u.useCallback(i=>n.subscribe(we.batchCalls(i)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),o=u.useCallback((i,a)=>{n.mutate(i,a).catch(Ae)},[n]);if(s.error&&_a(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}const aw=new Nd({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 qd=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Kd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),yi=e=>{const t=Kd(e);return t.charAt(0).toUpperCase()+t.slice(1)},ja=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim(),Qd=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 Yd={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 Xd=u.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:o,iconNode:i,...a},c)=>u.createElement("svg",{ref:c,...Yd,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:ja("lucide",s),...!o&&!Qd(a)&&{"aria-hidden":"true"},...a},[...i.map(([d,f])=>u.createElement(d,f)),...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 Ge=(e,t)=>{const r=u.forwardRef(({className:n,...s},o)=>u.createElement(Xd,{ref:o,iconNode:t,className:ja(`lucide-${qd(yi(e))}`,`lucide-${e}`,n),...s}));return r.displayName=yi(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 Jd=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ef=Ge("check",Jd);/**
|
|
* @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 tf=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ma=Ge("chevron-down",tf);/**
|
|
* @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 rf=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],nf=Ge("chevron-left",rf);/**
|
|
* @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 sf=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],of=Ge("chevron-right",sf);/**
|
|
* @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 af=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],cf=Ge("chevron-up",af);/**
|
|
* @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 lf=[["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"}]],uf=Ge("door-open",lf);/**
|
|
* @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 df=[["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"}]],ff=Ge("ellipsis",df);/**
|
|
* @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 hf=[["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"}]],Ia=Ge("eye-off",hf);/**
|
|
* @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 pf=[["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"}]],Da=Ge("eye",pf);/**
|
|
* @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 mf=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],gf=Ge("search",mf);/**
|
|
* @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 vf=[["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"}]],yf=Ge("square-pen",vf);/**
|
|
* @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 xf=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],wo=Ge("x",xf);function L(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e?.(s),r===!1||!s.defaultPrevented)return t?.(s)}}function bf(e,t){const r=u.createContext(t),n=o=>{const{children:i,...a}=o,c=u.useMemo(()=>a,Object.values(a));return l.jsx(r.Provider,{value:c,children:i})};n.displayName=e+"Provider";function s(o){const i=u.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[n,s]}function st(e,t=[]){let r=[];function n(o,i){const a=u.createContext(i),c=r.length;r=[...r,i];const d=h=>{const{scope:p,children:g,...b}=h,m=p?.[e]?.[c]||a,v=u.useMemo(()=>b,Object.values(b));return l.jsx(m.Provider,{value:v,children:g})};d.displayName=o+"Provider";function f(h,p){const g=p?.[e]?.[c]||a,b=u.useContext(g);if(b)return b;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${o}\``)}return[d,f]}const s=()=>{const o=r.map(i=>u.createContext(i));return function(a){const c=a?.[e]||o;return u.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return s.scopeName=e,[n,wf(s,...t)]}function wf(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=n.reduce((a,{useScope:c,scopeName:d})=>{const h=c(o)[`__scope${d}`];return{...a,...h}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}var nn=dd();const _f=hd(nn);var Cf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ee=Cf.reduce((e,t)=>{const r=qt(`Primitive.${t}`),n=u.forwardRef((s,o)=>{const{asChild:i,...a}=s,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Fa(e,t){e&&nn.flushSync(()=>e.dispatchEvent(t))}function Ce(e){const t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...r)=>t.current?.(...r),[])}function Sf(e,t=globalThis?.document){const r=Ce(e);u.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Ef="DismissableLayer",Ks="dismissableLayer.update",Rf="dismissableLayer.pointerDownOutside",Pf="dismissableLayer.focusOutside",xi,La=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Er=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:a,...c}=e,d=u.useContext(La),[f,h]=u.useState(null),p=f?.ownerDocument??globalThis?.document,[,g]=u.useState({}),b=se(t,R=>h(R)),m=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),C=m.indexOf(v),x=f?m.indexOf(f):-1,S=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=C,w=Of(R=>{const k=R.target,j=[...d.branches].some(D=>D.contains(k));!_||j||(s?.(R),i?.(R),R.defaultPrevented||a?.())},p),T=kf(R=>{const k=R.target;[...d.branches].some(D=>D.contains(k))||(o?.(R),i?.(R),R.defaultPrevented||a?.())},p);return Sf(R=>{x===d.layers.size-1&&(n?.(R),!R.defaultPrevented&&a&&(R.preventDefault(),a()))},p),u.useEffect(()=>{if(f)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(xi=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),bi(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=xi)}},[f,p,r,d]),u.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),bi())},[f,d]),u.useEffect(()=>{const R=()=>g({});return document.addEventListener(Ks,R),()=>document.removeEventListener(Ks,R)},[]),l.jsx(ee.div,{...c,ref:b,style:{pointerEvents:S?_?"auto":"none":void 0,...e.style},onFocusCapture:L(e.onFocusCapture,T.onFocusCapture),onBlurCapture:L(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:L(e.onPointerDownCapture,w.onPointerDownCapture)})});Er.displayName=Ef;var Tf="DismissableLayerBranch",Af=u.forwardRef((e,t)=>{const r=u.useContext(La),n=u.useRef(null),s=se(t,n);return u.useEffect(()=>{const o=n.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),l.jsx(ee.div,{...e,ref:s})});Af.displayName=Tf;function Of(e,t=globalThis?.document){const r=Ce(e),n=u.useRef(!1),s=u.useRef(()=>{});return u.useEffect(()=>{const o=a=>{if(a.target&&!n.current){let c=function(){Va(Rf,r,d,{discrete:!0})};const d={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);n.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function kf(e,t=globalThis?.document){const r=Ce(e),n=u.useRef(!1);return u.useEffect(()=>{const s=o=>{o.target&&!n.current&&Va(Pf,r,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function bi(){const e=new CustomEvent(Ks);document.dispatchEvent(e)}function Va(e,t,r,{discrete:n}){const s=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?Fa(s,o):s.dispatchEvent(o)}var Se=globalThis?.document?u.useLayoutEffect:()=>{},Nf=ma[" useId ".trim().toString()]||(()=>{}),jf=0;function Je(e){const[t,r]=u.useState(Nf());return Se(()=>{r(n=>n??String(jf++))},[e]),e||(t?`radix-${t}`:"")}const Mf=["top","right","bottom","left"],Mt=Math.min,Le=Math.max,Mn=Math.round,xn=Math.floor,ft=e=>({x:e,y:e}),If={left:"right",right:"left",bottom:"top",top:"bottom"},Df={start:"end",end:"start"};function Qs(e,t,r){return Le(e,Mt(t,r))}function Pt(e,t){return typeof e=="function"?e(t):e}function Tt(e){return e.split("-")[0]}function Rr(e){return e.split("-")[1]}function _o(e){return e==="x"?"y":"x"}function Co(e){return e==="y"?"height":"width"}const Ff=new Set(["top","bottom"]);function ut(e){return Ff.has(Tt(e))?"y":"x"}function So(e){return _o(ut(e))}function Lf(e,t,r){r===void 0&&(r=!1);const n=Rr(e),s=So(e),o=Co(s);let i=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=In(i)),[i,In(i)]}function Vf(e){const t=In(e);return[Ys(e),t,Ys(t)]}function Ys(e){return e.replace(/start|end/g,t=>Df[t])}const wi=["left","right"],_i=["right","left"],$f=["top","bottom"],Uf=["bottom","top"];function Bf(e,t,r){switch(e){case"top":case"bottom":return r?t?_i:wi:t?wi:_i;case"left":case"right":return t?$f:Uf;default:return[]}}function zf(e,t,r,n){const s=Rr(e);let o=Bf(Tt(e),r==="start",n);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(Ys)))),o}function In(e){return e.replace(/left|right|bottom|top/g,t=>If[t])}function Wf(e){return{top:0,right:0,bottom:0,left:0,...e}}function $a(e){return typeof e!="number"?Wf(e):{top:e,right:e,bottom:e,left:e}}function Dn(e){const{x:t,y:r,width:n,height:s}=e;return{width:n,height:s,top:r,left:t,right:t+n,bottom:r+s,x:t,y:r}}function Ci(e,t,r){let{reference:n,floating:s}=e;const o=ut(t),i=So(t),a=Co(i),c=Tt(t),d=o==="y",f=n.x+n.width/2-s.width/2,h=n.y+n.height/2-s.height/2,p=n[a]/2-s[a]/2;let g;switch(c){case"top":g={x:f,y:n.y-s.height};break;case"bottom":g={x:f,y:n.y+n.height};break;case"right":g={x:n.x+n.width,y:h};break;case"left":g={x:n.x-s.width,y:h};break;default:g={x:n.x,y:n.y}}switch(Rr(t)){case"start":g[i]-=p*(r&&d?-1:1);break;case"end":g[i]+=p*(r&&d?-1:1);break}return g}const Hf=async(e,t,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:o=[],platform:i}=r,a=o.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:h}=Ci(d,n,c),p=n,g={},b=0;for(let m=0;m<a.length;m++){const{name:v,fn:C}=a[m],{x,y:S,data:_,reset:w}=await C({x:f,y:h,initialPlacement:n,placement:p,strategy:s,middlewareData:g,rects:d,platform:i,elements:{reference:e,floating:t}});f=x??f,h=S??h,g={...g,[v]:{...g[v],..._}},w&&b<=50&&(b++,typeof w=="object"&&(w.placement&&(p=w.placement),w.rects&&(d=w.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):w.rects),{x:f,y:h}=Ci(d,p,c)),m=-1)}return{x:f,y:h,placement:p,strategy:s,middlewareData:g}};async function Vr(e,t){var r;t===void 0&&(t={});const{x:n,y:s,platform:o,rects:i,elements:a,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:p=!1,padding:g=0}=Pt(t,e),b=$a(g),v=a[p?h==="floating"?"reference":"floating":h],C=Dn(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(v)))==null||r?v:v.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:d,rootBoundary:f,strategy:c})),x=h==="floating"?{x:n,y:s,width:i.floating.width,height:i.floating.height}:i.reference,S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),_=await(o.isElement==null?void 0:o.isElement(S))?await(o.getScale==null?void 0:o.getScale(S))||{x:1,y:1}:{x:1,y:1},w=Dn(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:S,strategy:c}):x);return{top:(C.top-w.top+b.top)/_.y,bottom:(w.bottom-C.bottom+b.bottom)/_.y,left:(C.left-w.left+b.left)/_.x,right:(w.right-C.right+b.right)/_.x}}const Zf=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:s,rects:o,platform:i,elements:a,middlewareData:c}=t,{element:d,padding:f=0}=Pt(e,t)||{};if(d==null)return{};const h=$a(f),p={x:r,y:n},g=So(s),b=Co(g),m=await i.getDimensions(d),v=g==="y",C=v?"top":"left",x=v?"bottom":"right",S=v?"clientHeight":"clientWidth",_=o.reference[b]+o.reference[g]-p[g]-o.floating[b],w=p[g]-o.reference[g],T=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let R=T?T[S]:0;(!R||!await(i.isElement==null?void 0:i.isElement(T)))&&(R=a.floating[S]||o.floating[b]);const k=_/2-w/2,j=R/2-m[b]/2-1,D=Mt(h[C],j),G=Mt(h[x],j),$=D,N=R-m[b]-G,U=R/2-m[b]/2+k,J=Qs($,U,N),H=!c.arrow&&Rr(s)!=null&&U!==J&&o.reference[b]/2-(U<$?D:G)-m[b]/2<0,te=H?U<$?U-$:U-N:0;return{[g]:p[g]+te,data:{[g]:J,centerOffset:U-J-te,...H&&{alignmentOffset:te}},reset:H}}}),Gf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:s,middlewareData:o,rects:i,initialPlacement:a,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:p,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:m=!0,...v}=Pt(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const C=Tt(s),x=ut(a),S=Tt(a)===a,_=await(c.isRTL==null?void 0:c.isRTL(d.floating)),w=p||(S||!m?[In(a)]:Vf(a)),T=b!=="none";!p&&T&&w.push(...zf(a,m,b,_));const R=[a,...w],k=await Vr(t,v),j=[];let D=((n=o.flip)==null?void 0:n.overflows)||[];if(f&&j.push(k[C]),h){const U=Lf(s,i,_);j.push(k[U[0]],k[U[1]])}if(D=[...D,{placement:s,overflows:j}],!j.every(U=>U<=0)){var G,$;const U=(((G=o.flip)==null?void 0:G.index)||0)+1,J=R[U];if(J&&(!(h==="alignment"?x!==ut(J):!1)||D.every(q=>ut(q.placement)===x?q.overflows[0]>0:!0)))return{data:{index:U,overflows:D},reset:{placement:J}};let H=($=D.filter(te=>te.overflows[0]<=0).sort((te,q)=>te.overflows[1]-q.overflows[1])[0])==null?void 0:$.placement;if(!H)switch(g){case"bestFit":{var N;const te=(N=D.filter(q=>{if(T){const V=ut(q.placement);return V===x||V==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(V=>V>0).reduce((V,de)=>V+de,0)]).sort((q,V)=>q[1]-V[1])[0])==null?void 0:N[0];te&&(H=te);break}case"initialPlacement":H=a;break}if(s!==H)return{reset:{placement:H}}}return{}}}};function Si(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ei(e){return Mf.some(t=>e[t]>=0)}const qf=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...s}=Pt(e,t);switch(n){case"referenceHidden":{const o=await Vr(t,{...s,elementContext:"reference"}),i=Si(o,r.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Ei(i)}}}case"escaped":{const o=await Vr(t,{...s,altBoundary:!0}),i=Si(o,r.floating);return{data:{escapedOffsets:i,escaped:Ei(i)}}}default:return{}}}}},Ua=new Set(["left","top"]);async function Kf(e,t){const{placement:r,platform:n,elements:s}=e,o=await(n.isRTL==null?void 0:n.isRTL(s.floating)),i=Tt(r),a=Rr(r),c=ut(r)==="y",d=Ua.has(i)?-1:1,f=o&&c?-1:1,h=Pt(t,e);let{mainAxis:p,crossAxis:g,alignmentAxis:b}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof b=="number"&&(g=a==="end"?b*-1:b),c?{x:g*f,y:p*d}:{x:p*d,y:g*f}}const Qf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:s,y:o,placement:i,middlewareData:a}=t,c=await Kf(t,e);return i===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:i}}}}},Yf=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:s}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:a={fn:v=>{let{x:C,y:x}=v;return{x:C,y:x}}},...c}=Pt(e,t),d={x:r,y:n},f=await Vr(t,c),h=ut(Tt(s)),p=_o(h);let g=d[p],b=d[h];if(o){const v=p==="y"?"top":"left",C=p==="y"?"bottom":"right",x=g+f[v],S=g-f[C];g=Qs(x,g,S)}if(i){const v=h==="y"?"top":"left",C=h==="y"?"bottom":"right",x=b+f[v],S=b-f[C];b=Qs(x,b,S)}const m=a.fn({...t,[p]:g,[h]:b});return{...m,data:{x:m.x-r,y:m.y-n,enabled:{[p]:o,[h]:i}}}}}},Xf=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:s,rects:o,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:d=!0}=Pt(e,t),f={x:r,y:n},h=ut(s),p=_o(h);let g=f[p],b=f[h];const m=Pt(a,t),v=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const S=p==="y"?"height":"width",_=o.reference[p]-o.floating[S]+v.mainAxis,w=o.reference[p]+o.reference[S]-v.mainAxis;g<_?g=_:g>w&&(g=w)}if(d){var C,x;const S=p==="y"?"width":"height",_=Ua.has(Tt(s)),w=o.reference[h]-o.floating[S]+(_&&((C=i.offset)==null?void 0:C[h])||0)+(_?0:v.crossAxis),T=o.reference[h]+o.reference[S]+(_?0:((x=i.offset)==null?void 0:x[h])||0)-(_?v.crossAxis:0);b<w?b=w:b>T&&(b=T)}return{[p]:g,[h]:b}}}},Jf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:s,rects:o,platform:i,elements:a}=t,{apply:c=()=>{},...d}=Pt(e,t),f=await Vr(t,d),h=Tt(s),p=Rr(s),g=ut(s)==="y",{width:b,height:m}=o.floating;let v,C;h==="top"||h==="bottom"?(v=h,C=p===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(C=h,v=p==="end"?"top":"bottom");const x=m-f.top-f.bottom,S=b-f.left-f.right,_=Mt(m-f[v],x),w=Mt(b-f[C],S),T=!t.middlewareData.shift;let R=_,k=w;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(k=S),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(R=x),T&&!p){const D=Le(f.left,0),G=Le(f.right,0),$=Le(f.top,0),N=Le(f.bottom,0);g?k=b-2*(D!==0||G!==0?D+G:Le(f.left,f.right)):R=m-2*($!==0||N!==0?$+N:Le(f.top,f.bottom))}await c({...t,availableWidth:k,availableHeight:R});const j=await i.getDimensions(a.floating);return b!==j.width||m!==j.height?{reset:{rects:!0}}:{}}}};function ts(){return typeof window<"u"}function Pr(e){return Ba(e)?(e.nodeName||"").toLowerCase():"#document"}function Ve(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function yt(e){var t;return(t=(Ba(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ba(e){return ts()?e instanceof Node||e instanceof Ve(e).Node:!1}function tt(e){return ts()?e instanceof Element||e instanceof Ve(e).Element:!1}function pt(e){return ts()?e instanceof HTMLElement||e instanceof Ve(e).HTMLElement:!1}function Ri(e){return!ts()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ve(e).ShadowRoot}const eh=new Set(["inline","contents"]);function sn(e){const{overflow:t,overflowX:r,overflowY:n,display:s}=rt(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!eh.has(s)}const th=new Set(["table","td","th"]);function rh(e){return th.has(Pr(e))}const nh=[":popover-open",":modal"];function rs(e){return nh.some(t=>{try{return e.matches(t)}catch{return!1}})}const sh=["transform","translate","scale","rotate","perspective"],oh=["transform","translate","scale","rotate","perspective","filter"],ih=["paint","layout","strict","content"];function Eo(e){const t=Ro(),r=tt(e)?rt(e):e;return sh.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||oh.some(n=>(r.willChange||"").includes(n))||ih.some(n=>(r.contain||"").includes(n))}function ah(e){let t=It(e);for(;pt(t)&&!vr(t);){if(Eo(t))return t;if(rs(t))return null;t=It(t)}return null}function Ro(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ch=new Set(["html","body","#document"]);function vr(e){return ch.has(Pr(e))}function rt(e){return Ve(e).getComputedStyle(e)}function ns(e){return tt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function It(e){if(Pr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ri(e)&&e.host||yt(e);return Ri(t)?t.host:t}function za(e){const t=It(e);return vr(t)?e.ownerDocument?e.ownerDocument.body:e.body:pt(t)&&sn(t)?t:za(t)}function $r(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=za(e),o=s===((n=e.ownerDocument)==null?void 0:n.body),i=Ve(s);if(o){const a=Xs(i);return t.concat(i,i.visualViewport||[],sn(s)?s:[],a&&r?$r(a):[])}return t.concat(s,$r(s,[],r))}function Xs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Wa(e){const t=rt(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const s=pt(e),o=s?e.offsetWidth:r,i=s?e.offsetHeight:n,a=Mn(r)!==o||Mn(n)!==i;return a&&(r=o,n=i),{width:r,height:n,$:a}}function Po(e){return tt(e)?e:e.contextElement}function pr(e){const t=Po(e);if(!pt(t))return ft(1);const r=t.getBoundingClientRect(),{width:n,height:s,$:o}=Wa(t);let i=(o?Mn(r.width):r.width)/n,a=(o?Mn(r.height):r.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const lh=ft(0);function Ha(e){const t=Ve(e);return!Ro()||!t.visualViewport?lh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function uh(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Ve(e)?!1:t}function Yt(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),o=Po(e);let i=ft(1);t&&(n?tt(n)&&(i=pr(n)):i=pr(e));const a=uh(o,r,n)?Ha(o):ft(0);let c=(s.left+a.x)/i.x,d=(s.top+a.y)/i.y,f=s.width/i.x,h=s.height/i.y;if(o){const p=Ve(o),g=n&&tt(n)?Ve(n):n;let b=p,m=Xs(b);for(;m&&n&&g!==b;){const v=pr(m),C=m.getBoundingClientRect(),x=rt(m),S=C.left+(m.clientLeft+parseFloat(x.paddingLeft))*v.x,_=C.top+(m.clientTop+parseFloat(x.paddingTop))*v.y;c*=v.x,d*=v.y,f*=v.x,h*=v.y,c+=S,d+=_,b=Ve(m),m=Xs(b)}}return Dn({width:f,height:h,x:c,y:d})}function To(e,t){const r=ns(e).scrollLeft;return t?t.left+r:Yt(yt(e)).left+r}function Za(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-(r?0:To(e,n)),o=n.top+t.scrollTop;return{x:s,y:o}}function dh(e){let{elements:t,rect:r,offsetParent:n,strategy:s}=e;const o=s==="fixed",i=yt(n),a=t?rs(t.floating):!1;if(n===i||a&&o)return r;let c={scrollLeft:0,scrollTop:0},d=ft(1);const f=ft(0),h=pt(n);if((h||!h&&!o)&&((Pr(n)!=="body"||sn(i))&&(c=ns(n)),pt(n))){const g=Yt(n);d=pr(n),f.x=g.x+n.clientLeft,f.y=g.y+n.clientTop}const p=i&&!h&&!o?Za(i,c,!0):ft(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-c.scrollLeft*d.x+f.x+p.x,y:r.y*d.y-c.scrollTop*d.y+f.y+p.y}}function fh(e){return Array.from(e.getClientRects())}function hh(e){const t=yt(e),r=ns(e),n=e.ownerDocument.body,s=Le(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=Le(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+To(e);const a=-r.scrollTop;return rt(n).direction==="rtl"&&(i+=Le(t.clientWidth,n.clientWidth)-s),{width:s,height:o,x:i,y:a}}function ph(e,t){const r=Ve(e),n=yt(e),s=r.visualViewport;let o=n.clientWidth,i=n.clientHeight,a=0,c=0;if(s){o=s.width,i=s.height;const d=Ro();(!d||d&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:o,height:i,x:a,y:c}}const mh=new Set(["absolute","fixed"]);function gh(e,t){const r=Yt(e,!0,t==="fixed"),n=r.top+e.clientTop,s=r.left+e.clientLeft,o=pt(e)?pr(e):ft(1),i=e.clientWidth*o.x,a=e.clientHeight*o.y,c=s*o.x,d=n*o.y;return{width:i,height:a,x:c,y:d}}function Pi(e,t,r){let n;if(t==="viewport")n=ph(e,r);else if(t==="document")n=hh(yt(e));else if(tt(t))n=gh(t,r);else{const s=Ha(e);n={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Dn(n)}function Ga(e,t){const r=It(e);return r===t||!tt(r)||vr(r)?!1:rt(r).position==="fixed"||Ga(r,t)}function vh(e,t){const r=t.get(e);if(r)return r;let n=$r(e,[],!1).filter(a=>tt(a)&&Pr(a)!=="body"),s=null;const o=rt(e).position==="fixed";let i=o?It(e):e;for(;tt(i)&&!vr(i);){const a=rt(i),c=Eo(i);!c&&a.position==="fixed"&&(s=null),(o?!c&&!s:!c&&a.position==="static"&&!!s&&mh.has(s.position)||sn(i)&&!c&&Ga(e,i))?n=n.filter(f=>f!==i):s=a,i=It(i)}return t.set(e,n),n}function yh(e){let{element:t,boundary:r,rootBoundary:n,strategy:s}=e;const i=[...r==="clippingAncestors"?rs(t)?[]:vh(t,this._c):[].concat(r),n],a=i[0],c=i.reduce((d,f)=>{const h=Pi(t,f,s);return d.top=Le(h.top,d.top),d.right=Mt(h.right,d.right),d.bottom=Mt(h.bottom,d.bottom),d.left=Le(h.left,d.left),d},Pi(t,a,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function xh(e){const{width:t,height:r}=Wa(e);return{width:t,height:r}}function bh(e,t,r){const n=pt(t),s=yt(t),o=r==="fixed",i=Yt(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=ft(0);function d(){c.x=To(s)}if(n||!n&&!o)if((Pr(t)!=="body"||sn(s))&&(a=ns(t)),n){const g=Yt(t,!0,o,t);c.x=g.x+t.clientLeft,c.y=g.y+t.clientTop}else s&&d();o&&!n&&s&&d();const f=s&&!n&&!o?Za(s,a):ft(0),h=i.left+a.scrollLeft-c.x-f.x,p=i.top+a.scrollTop-c.y-f.y;return{x:h,y:p,width:i.width,height:i.height}}function Ts(e){return rt(e).position==="static"}function Ti(e,t){if(!pt(e)||rt(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return yt(e)===r&&(r=r.ownerDocument.body),r}function qa(e,t){const r=Ve(e);if(rs(e))return r;if(!pt(e)){let s=It(e);for(;s&&!vr(s);){if(tt(s)&&!Ts(s))return s;s=It(s)}return r}let n=Ti(e,t);for(;n&&rh(n)&&Ts(n);)n=Ti(n,t);return n&&vr(n)&&Ts(n)&&!Eo(n)?r:n||ah(e)||r}const wh=async function(e){const t=this.getOffsetParent||qa,r=this.getDimensions,n=await r(e.floating);return{reference:bh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function _h(e){return rt(e).direction==="rtl"}const Ch={convertOffsetParentRelativeRectToViewportRelativeRect:dh,getDocumentElement:yt,getClippingRect:yh,getOffsetParent:qa,getElementRects:wh,getClientRects:fh,getDimensions:xh,getScale:pr,isElement:tt,isRTL:_h};function Ka(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Sh(e,t){let r=null,n;const s=yt(e);function o(){var a;clearTimeout(n),(a=r)==null||a.disconnect(),r=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const d=e.getBoundingClientRect(),{left:f,top:h,width:p,height:g}=d;if(a||t(),!p||!g)return;const b=xn(h),m=xn(s.clientWidth-(f+p)),v=xn(s.clientHeight-(h+g)),C=xn(f),S={rootMargin:-b+"px "+-m+"px "+-v+"px "+-C+"px",threshold:Le(0,Mt(1,c))||1};let _=!0;function w(T){const R=T[0].intersectionRatio;if(R!==c){if(!_)return i();R?i(!1,R):n=setTimeout(()=>{i(!1,1e-7)},1e3)}R===1&&!Ka(d,e.getBoundingClientRect())&&i(),_=!1}try{r=new IntersectionObserver(w,{...S,root:s.ownerDocument})}catch{r=new IntersectionObserver(w,S)}r.observe(e)}return i(!0),o}function Eh(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,d=Po(e),f=s||o?[...d?$r(d):[],...$r(t)]:[];f.forEach(C=>{s&&C.addEventListener("scroll",r,{passive:!0}),o&&C.addEventListener("resize",r)});const h=d&&a?Sh(d,r):null;let p=-1,g=null;i&&(g=new ResizeObserver(C=>{let[x]=C;x&&x.target===d&&g&&(g.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var S;(S=g)==null||S.observe(t)})),r()}),d&&!c&&g.observe(d),g.observe(t));let b,m=c?Yt(e):null;c&&v();function v(){const C=Yt(e);m&&!Ka(m,C)&&r(),m=C,b=requestAnimationFrame(v)}return r(),()=>{var C;f.forEach(x=>{s&&x.removeEventListener("scroll",r),o&&x.removeEventListener("resize",r)}),h?.(),(C=g)==null||C.disconnect(),g=null,c&&cancelAnimationFrame(b)}}const Rh=Qf,Ph=Yf,Th=Gf,Ah=Jf,Oh=qf,Ai=Zf,kh=Xf,Nh=(e,t,r)=>{const n=new Map,s={platform:Ch,...r},o={...s.platform,_c:n};return Hf(e,t,{...s,platform:o})};var jh=typeof document<"u",Mh=function(){},Tn=jh?u.useLayoutEffect:Mh;function Fn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!Fn(e[n],t[n]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,s[n]))return!1;for(n=r;n--!==0;){const o=s[n];if(!(o==="_owner"&&e.$$typeof)&&!Fn(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Qa(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Oi(e,t){const r=Qa(e);return Math.round(t*r)/r}function As(e){const t=u.useRef(e);return Tn(()=>{t.current=e}),t}function Ih(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:o,floating:i}={},transform:a=!0,whileElementsMounted:c,open:d}=e,[f,h]=u.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,g]=u.useState(n);Fn(p,n)||g(n);const[b,m]=u.useState(null),[v,C]=u.useState(null),x=u.useCallback(q=>{q!==T.current&&(T.current=q,m(q))},[]),S=u.useCallback(q=>{q!==R.current&&(R.current=q,C(q))},[]),_=o||b,w=i||v,T=u.useRef(null),R=u.useRef(null),k=u.useRef(f),j=c!=null,D=As(c),G=As(s),$=As(d),N=u.useCallback(()=>{if(!T.current||!R.current)return;const q={placement:t,strategy:r,middleware:p};G.current&&(q.platform=G.current),Nh(T.current,R.current,q).then(V=>{const de={...V,isPositioned:$.current!==!1};U.current&&!Fn(k.current,de)&&(k.current=de,nn.flushSync(()=>{h(de)}))})},[p,t,r,G,$]);Tn(()=>{d===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,h(q=>({...q,isPositioned:!1})))},[d]);const U=u.useRef(!1);Tn(()=>(U.current=!0,()=>{U.current=!1}),[]),Tn(()=>{if(_&&(T.current=_),w&&(R.current=w),_&&w){if(D.current)return D.current(_,w,N);N()}},[_,w,N,D,j]);const J=u.useMemo(()=>({reference:T,floating:R,setReference:x,setFloating:S}),[x,S]),H=u.useMemo(()=>({reference:_,floating:w}),[_,w]),te=u.useMemo(()=>{const q={position:r,left:0,top:0};if(!H.floating)return q;const V=Oi(H.floating,f.x),de=Oi(H.floating,f.y);return a?{...q,transform:"translate("+V+"px, "+de+"px)",...Qa(H.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:V,top:de}},[r,a,H.floating,f.x,f.y]);return u.useMemo(()=>({...f,update:N,refs:J,elements:H,floatingStyles:te}),[f,N,J,H,te])}const Dh=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:s}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?Ai({element:n.current,padding:s}).fn(r):{}:n?Ai({element:n,padding:s}).fn(r):{}}}},Fh=(e,t)=>({...Rh(e),options:[e,t]}),Lh=(e,t)=>({...Ph(e),options:[e,t]}),Vh=(e,t)=>({...kh(e),options:[e,t]}),$h=(e,t)=>({...Th(e),options:[e,t]}),Uh=(e,t)=>({...Ah(e),options:[e,t]}),Bh=(e,t)=>({...Oh(e),options:[e,t]}),zh=(e,t)=>({...Dh(e),options:[e,t]});var Wh="Arrow",Ya=u.forwardRef((e,t)=>{const{children:r,width:n=10,height:s=5,...o}=e;return l.jsx(ee.svg,{...o,ref:t,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ya.displayName=Wh;var Hh=Ya;function Zh(e){const[t,r]=u.useState(void 0);return Se(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let i,a;if("borderBoxSize"in o){const c=o.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,a=d.blockSize}else i=e.offsetWidth,a=e.offsetHeight;r({width:i,height:a})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var Ao="Popper",[Xa,$t]=st(Ao),[Gh,Ja]=Xa(Ao),ec=e=>{const{__scopePopper:t,children:r}=e,[n,s]=u.useState(null);return l.jsx(Gh,{scope:t,anchor:n,onAnchorChange:s,children:r})};ec.displayName=Ao;var tc="PopperAnchor",rc=u.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...s}=e,o=Ja(tc,r),i=u.useRef(null),a=se(t,i),c=u.useRef(null);return u.useEffect(()=>{const d=c.current;c.current=n?.current||i.current,d!==c.current&&o.onAnchorChange(c.current)}),n?null:l.jsx(ee.div,{...s,ref:a})});rc.displayName=tc;var Oo="PopperContent",[qh,Kh]=Xa(Oo),nc=u.forwardRef((e,t)=>{const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:p=!1,updatePositionStrategy:g="optimized",onPlaced:b,...m}=e,v=Ja(Oo,r),[C,x]=u.useState(null),S=se(t,W=>x(W)),[_,w]=u.useState(null),T=Zh(_),R=T?.width??0,k=T?.height??0,j=n+(o!=="center"?"-"+o:""),D=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},G=Array.isArray(d)?d:[d],$=G.length>0,N={padding:D,boundary:G.filter(Yh),altBoundary:$},{refs:U,floatingStyles:J,placement:H,isPositioned:te,middlewareData:q}=Ih({strategy:"fixed",placement:j,whileElementsMounted:(...W)=>Eh(...W,{animationFrame:g==="always"}),elements:{reference:v.anchor},middleware:[Fh({mainAxis:s+k,alignmentAxis:i}),c&&Lh({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Vh():void 0,...N}),c&&$h({...N}),Uh({...N,apply:({elements:W,rects:ue,availableWidth:xe,availableHeight:ae})=>{const{width:fe,height:pe}=ue.reference,Me=W.floating.style;Me.setProperty("--radix-popper-available-width",`${xe}px`),Me.setProperty("--radix-popper-available-height",`${ae}px`),Me.setProperty("--radix-popper-anchor-width",`${fe}px`),Me.setProperty("--radix-popper-anchor-height",`${pe}px`)}}),_&&zh({element:_,padding:a}),Xh({arrowWidth:R,arrowHeight:k}),p&&Bh({strategy:"referenceHidden",...N})]}),[V,de]=ic(H),_e=Ce(b);Se(()=>{te&&_e?.()},[te,_e]);const De=q.arrow?.x,Ue=q.arrow?.y,je=q.arrow?.centerOffset!==0,[Be,Pe]=u.useState();return Se(()=>{C&&Pe(window.getComputedStyle(C).zIndex)},[C]),l.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...J,transform:te?J.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Be,"--radix-popper-transform-origin":[q.transformOrigin?.x,q.transformOrigin?.y].join(" "),...q.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(qh,{scope:r,placedSide:V,onArrowChange:w,arrowX:De,arrowY:Ue,shouldHideArrow:je,children:l.jsx(ee.div,{"data-side":V,"data-align":de,...m,ref:S,style:{...m.style,animation:te?void 0:"none"}})})})});nc.displayName=Oo;var sc="PopperArrow",Qh={top:"bottom",right:"left",bottom:"top",left:"right"},oc=u.forwardRef(function(t,r){const{__scopePopper:n,...s}=t,o=Kh(sc,n),i=Qh[o.placedSide];return l.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:l.jsx(Hh,{...s,ref:r,style:{...s.style,display:"block"}})})});oc.displayName=sc;function Yh(e){return e!==null}var Xh=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:s}=t,i=s.arrow?.centerOffset!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,f]=ic(r),h={start:"0%",center:"50%",end:"100%"}[f],p=(s.arrow?.x??0)+a/2,g=(s.arrow?.y??0)+c/2;let b="",m="";return d==="bottom"?(b=i?h:`${p}px`,m=`${-c}px`):d==="top"?(b=i?h:`${p}px`,m=`${n.floating.height+c}px`):d==="right"?(b=`${-c}px`,m=i?h:`${g}px`):d==="left"&&(b=`${n.floating.width+c}px`,m=i?h:`${g}px`),{data:{x:b,y:m}}}});function ic(e){const[t,r="center"]=e.split("-");return[t,r]}var ss=ec,on=rc,os=nc,is=oc,Jh="Portal",Tr=u.forwardRef((e,t)=>{const{container:r,...n}=e,[s,o]=u.useState(!1);Se(()=>o(!0),[]);const i=r||s&&globalThis?.document?.body;return i?_f.createPortal(l.jsx(ee.div,{...n,ref:t}),i):null});Tr.displayName=Jh;function ep(e,t){return u.useReducer((r,n)=>t[r][n]??r,e)}var Re=e=>{const{present:t,children:r}=e,n=tp(t),s=typeof r=="function"?r({present:n.isPresent}):u.Children.only(r),o=se(n.ref,rp(s));return typeof r=="function"||n.isPresent?u.cloneElement(s,{ref:o}):null};Re.displayName="Presence";function tp(e){const[t,r]=u.useState(),n=u.useRef(null),s=u.useRef(e),o=u.useRef("none"),i=e?"mounted":"unmounted",[a,c]=ep(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=bn(n.current);o.current=a==="mounted"?d:"none"},[a]),Se(()=>{const d=n.current,f=s.current;if(f!==e){const p=o.current,g=bn(d);e?c("MOUNT"):g==="none"||d?.display==="none"?c("UNMOUNT"):c(f&&p!==g?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),Se(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=g=>{const m=bn(n.current).includes(CSS.escape(g.animationName));if(g.target===t&&m&&(c("ANIMATION_END"),!s.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},p=g=>{g.target===t&&(o.current=bn(n.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:u.useCallback(d=>{n.current=d?getComputedStyle(d):null,r(d)},[])}}function bn(e){return e?.animationName||"none"}function rp(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var np=ma[" useInsertionEffect ".trim().toString()]||Se;function mt({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,o,i]=sp({defaultProp:t,onChange:r}),a=e!==void 0,c=a?e:s;{const f=u.useRef(e!==void 0);u.useEffect(()=>{const h=f.current;h!==a&&console.warn(`${n} is changing from ${h?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=a},[a,n])}const d=u.useCallback(f=>{if(a){const h=op(f)?f(e):f;h!==e&&i.current?.(h)}else o(f)},[a,e,o,i]);return[c,d]}function sp({defaultProp:e,onChange:t}){const[r,n]=u.useState(e),s=u.useRef(r),o=u.useRef(t);return np(()=>{o.current=t},[t]),u.useEffect(()=>{s.current!==r&&(o.current?.(r),s.current=r)},[r,s]),[r,n,o]}function op(e){return typeof e=="function"}var ac=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"}),ip="VisuallyHidden",cc=u.forwardRef((e,t)=>l.jsx(ee.span,{...e,ref:t,style:{...ac,...e.style}}));cc.displayName=ip;var ap=cc,[as,cw]=st("Tooltip",[$t]),cs=$t(),lc="TooltipProvider",cp=700,Js="tooltip.open",[lp,ko]=as(lc),uc=e=>{const{__scopeTooltip:t,delayDuration:r=cp,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:o}=e,i=u.useRef(!0),a=u.useRef(!1),c=u.useRef(0);return u.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),l.jsx(lp,{scope:t,isOpenDelayedRef:i,delayDuration:r,onOpen:u.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:u.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,n)},[n]),isPointerInTransitRef:a,onPointerInTransitChange:u.useCallback(d=>{a.current=d},[]),disableHoverableContent:s,children:o})};uc.displayName=lc;var Ur="Tooltip",[up,an]=as(Ur),dc=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:s,onOpenChange:o,disableHoverableContent:i,delayDuration:a}=e,c=ko(Ur,e.__scopeTooltip),d=cs(t),[f,h]=u.useState(null),p=Je(),g=u.useRef(0),b=i??c.disableHoverableContent,m=a??c.delayDuration,v=u.useRef(!1),[C,x]=mt({prop:n,defaultProp:s??!1,onChange:R=>{R?(c.onOpen(),document.dispatchEvent(new CustomEvent(Js))):c.onClose(),o?.(R)},caller:Ur}),S=u.useMemo(()=>C?v.current?"delayed-open":"instant-open":"closed",[C]),_=u.useCallback(()=>{window.clearTimeout(g.current),g.current=0,v.current=!1,x(!0)},[x]),w=u.useCallback(()=>{window.clearTimeout(g.current),g.current=0,x(!1)},[x]),T=u.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{v.current=!0,x(!0),g.current=0},m)},[m,x]);return u.useEffect(()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)},[]),l.jsx(ss,{...d,children:l.jsx(up,{scope:t,contentId:p,open:C,stateAttribute:S,trigger:f,onTriggerChange:h,onTriggerEnter:u.useCallback(()=>{c.isOpenDelayedRef.current?T():_()},[c.isOpenDelayedRef,T,_]),onTriggerLeave:u.useCallback(()=>{b?w():(window.clearTimeout(g.current),g.current=0)},[w,b]),onOpen:_,onClose:w,disableHoverableContent:b,children:r})})};dc.displayName=Ur;var eo="TooltipTrigger",fc=u.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=an(eo,r),o=ko(eo,r),i=cs(r),a=u.useRef(null),c=se(t,a,s.onTriggerChange),d=u.useRef(!1),f=u.useRef(!1),h=u.useCallback(()=>d.current=!1,[]);return u.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),l.jsx(on,{asChild:!0,...i,children:l.jsx(ee.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:L(e.onPointerMove,p=>{p.pointerType!=="touch"&&!f.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),f.current=!0)}),onPointerLeave:L(e.onPointerLeave,()=>{s.onTriggerLeave(),f.current=!1}),onPointerDown:L(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:L(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:L(e.onBlur,s.onClose),onClick:L(e.onClick,s.onClose)})})});fc.displayName=eo;var No="TooltipPortal",[dp,fp]=as(No,{forceMount:void 0}),hc=e=>{const{__scopeTooltip:t,forceMount:r,children:n,container:s}=e,o=an(No,t);return l.jsx(dp,{scope:t,forceMount:r,children:l.jsx(Re,{present:r||o.open,children:l.jsx(Tr,{asChild:!0,container:s,children:n})})})};hc.displayName=No;var yr="TooltipContent",pc=u.forwardRef((e,t)=>{const r=fp(yr,e.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...o}=e,i=an(yr,e.__scopeTooltip);return l.jsx(Re,{present:n||i.open,children:i.disableHoverableContent?l.jsx(mc,{side:s,...o,ref:t}):l.jsx(hp,{side:s,...o,ref:t})})}),hp=u.forwardRef((e,t)=>{const r=an(yr,e.__scopeTooltip),n=ko(yr,e.__scopeTooltip),s=u.useRef(null),o=se(t,s),[i,a]=u.useState(null),{trigger:c,onClose:d}=r,f=s.current,{onPointerInTransitChange:h}=n,p=u.useCallback(()=>{a(null),h(!1)},[h]),g=u.useCallback((b,m)=>{const v=b.currentTarget,C={x:b.clientX,y:b.clientY},x=vp(C,v.getBoundingClientRect()),S=yp(C,x),_=xp(m.getBoundingClientRect()),w=wp([...S,..._]);a(w),h(!0)},[h]);return u.useEffect(()=>()=>p(),[p]),u.useEffect(()=>{if(c&&f){const b=v=>g(v,f),m=v=>g(v,c);return c.addEventListener("pointerleave",b),f.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",b),f.removeEventListener("pointerleave",m)}}},[c,f,g,p]),u.useEffect(()=>{if(i){const b=m=>{const v=m.target,C={x:m.clientX,y:m.clientY},x=c?.contains(v)||f?.contains(v),S=!bp(C,i);x?p():S&&(p(),d())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,f,i,d,p]),l.jsx(mc,{...e,ref:o})}),[pp,mp]=as(Ur,{isInside:!1}),gp=fd("TooltipContent"),mc=u.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:i,...a}=e,c=an(yr,r),d=cs(r),{onClose:f}=c;return u.useEffect(()=>(document.addEventListener(Js,f),()=>document.removeEventListener(Js,f)),[f]),u.useEffect(()=>{if(c.trigger){const h=p=>{p.target?.contains(c.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,f]),l.jsx(Er,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:l.jsxs(os,{"data-state":c.stateAttribute,...d,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[l.jsx(gp,{children:n}),l.jsx(pp,{scope:r,isInside:!0,children:l.jsx(ap,{id:c.contentId,role:"tooltip",children:s||n})})]})})});pc.displayName=yr;var gc="TooltipArrow",vc=u.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=cs(r);return mp(gc,r).isInside?null:l.jsx(is,{...s,...n,ref:t})});vc.displayName=gc;function vp(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,s,o)){case o:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function yp(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function xp(e){const{top:t,right:r,bottom:n,left:s}=e;return[{x:s,y:t},{x:r,y:t},{x:r,y:n},{x:s,y:n}]}function bp(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const a=t[o],c=t[i],d=a.x,f=a.y,h=c.x,p=c.y;f>n!=p>n&&r<(h-d)*(n-f)/(p-f)+d&&(s=!s)}return s}function wp(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),_p(t)}function _p(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const s=e[n];for(;t.length>=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const s=e[n];for(;r.length>=2;){const o=r[r.length-1],i=r[r.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))r.pop();else break}r.push(s)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var Cp=uc,Sp=dc,Ep=fc,Rp=hc,Pp=pc,Tp=vc;function Ap({delayDuration:e=0,...t}){return l.jsx(Cp,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Op({...e}){return l.jsx(Ap,{children:l.jsx(Sp,{"data-slot":"tooltip",...e})})}function kp({...e}){return l.jsx(Ep,{"data-slot":"tooltip-trigger",...e})}function Np({className:e,sideOffset:t=0,children:r,...n}){return l.jsx(Rp,{children:l.jsxs(Pp,{"data-slot":"tooltip-content",sideOffset:t,className:oe("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...n,children:[r,l.jsx(Tp,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}var Os=0;function ls(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ki()),document.body.insertAdjacentElement("beforeend",e[1]??ki()),Os++,()=>{Os===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Os--}},[])}function ki(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ks="focusScope.autoFocusOnMount",Ns="focusScope.autoFocusOnUnmount",Ni={bubbles:!1,cancelable:!0},jp="FocusScope",cn=u.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=e,[a,c]=u.useState(null),d=Ce(s),f=Ce(o),h=u.useRef(null),p=se(t,m=>c(m)),g=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(n){let m=function(S){if(g.paused||!a)return;const _=S.target;a.contains(_)?h.current=_:Nt(h.current,{select:!0})},v=function(S){if(g.paused||!a)return;const _=S.relatedTarget;_!==null&&(a.contains(_)||Nt(h.current,{select:!0}))},C=function(S){if(document.activeElement===document.body)for(const w of S)w.removedNodes.length>0&&Nt(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",v);const x=new MutationObserver(C);return a&&x.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",v),x.disconnect()}}},[n,a,g.paused]),u.useEffect(()=>{if(a){Mi.add(g);const m=document.activeElement;if(!a.contains(m)){const C=new CustomEvent(ks,Ni);a.addEventListener(ks,d),a.dispatchEvent(C),C.defaultPrevented||(Mp(Vp(yc(a)),{select:!0}),document.activeElement===m&&Nt(a))}return()=>{a.removeEventListener(ks,d),setTimeout(()=>{const C=new CustomEvent(Ns,Ni);a.addEventListener(Ns,f),a.dispatchEvent(C),C.defaultPrevented||Nt(m??document.body,{select:!0}),a.removeEventListener(Ns,f),Mi.remove(g)},0)}}},[a,d,f,g]);const b=u.useCallback(m=>{if(!r&&!n||g.paused)return;const v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,C=document.activeElement;if(v&&C){const x=m.currentTarget,[S,_]=Ip(x);S&&_?!m.shiftKey&&C===_?(m.preventDefault(),r&&Nt(S,{select:!0})):m.shiftKey&&C===S&&(m.preventDefault(),r&&Nt(_,{select:!0})):C===x&&m.preventDefault()}},[r,n,g.paused]);return l.jsx(ee.div,{tabIndex:-1,...i,ref:p,onKeyDown:b})});cn.displayName=jp;function Mp(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Nt(n,{select:t}),document.activeElement!==r)return}function Ip(e){const t=yc(e),r=ji(t,e),n=ji(t.reverse(),e);return[r,n]}function yc(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function ji(e,t){for(const r of e)if(!Dp(r,{upTo:t}))return r}function Dp(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Fp(e){return e instanceof HTMLInputElement&&"select"in e}function Nt(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Fp(e)&&t&&e.select()}}var Mi=Lp();function Lp(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Ii(e,t),e.unshift(t)},remove(t){e=Ii(e,t),e[0]?.resume()}}}function Ii(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Vp(e){return e.filter(t=>t.tagName!=="A")}var $p=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ar=new WeakMap,wn=new WeakMap,_n={},js=0,xc=function(e){return e&&(e.host||xc(e.parentNode))},Up=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=xc(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Bp=function(e,t,r,n){var s=Up(t,Array.isArray(e)?e:[e]);_n[r]||(_n[r]=new WeakMap);var o=_n[r],i=[],a=new Set,c=new Set(s),d=function(h){!h||a.has(h)||(a.add(h),d(h.parentNode))};s.forEach(d);var f=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(p){if(a.has(p))f(p);else try{var g=p.getAttribute(n),b=g!==null&&g!=="false",m=(ar.get(p)||0)+1,v=(o.get(p)||0)+1;ar.set(p,m),o.set(p,v),i.push(p),m===1&&b&&wn.set(p,!0),v===1&&p.setAttribute(r,"true"),b||p.setAttribute(n,"true")}catch(C){console.error("aria-hidden: cannot operate on ",p,C)}})};return f(t),a.clear(),js++,function(){i.forEach(function(h){var p=ar.get(h)-1,g=o.get(h)-1;ar.set(h,p),o.set(h,g),p||(wn.has(h)||h.removeAttribute(n),wn.delete(h)),g||h.removeAttribute(r)}),js--,js||(ar=new WeakMap,ar=new WeakMap,wn=new WeakMap,_n={})}},us=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),s=$p(e);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live], script"))),Bp(n,s,r,"aria-hidden")):function(){return null}},lt=function(){return lt=Object.assign||function(t){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},lt.apply(this,arguments)};function bc(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r}function zp(e,t,r){if(r||arguments.length===2)for(var n=0,s=t.length,o;n<s;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}var An="right-scroll-bar-position",On="width-before-scroll-bar",Wp="with-scroll-bars-hidden",Hp="--removed-body-scroll-bar-size";function Ms(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Zp(e,t){var r=u.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=t,r.facade}var Gp=typeof window<"u"?u.useLayoutEffect:u.useEffect,Di=new WeakMap;function qp(e,t){var r=Zp(null,function(n){return e.forEach(function(s){return Ms(s,n)})});return Gp(function(){var n=Di.get(r);if(n){var s=new Set(n),o=new Set(e),i=r.current;s.forEach(function(a){o.has(a)||Ms(a,null)}),o.forEach(function(a){s.has(a)||Ms(a,i)})}Di.set(r,e)},[e]),r}function Kp(e){return e}function Qp(e,t){t===void 0&&(t=Kp);var r=[],n=!1,s={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(o){var i=t(o,n);return r.push(i),function(){r=r.filter(function(a){return a!==i})}},assignSyncMedium:function(o){for(n=!0;r.length;){var i=r;r=[],i.forEach(o)}r={push:function(a){return o(a)},filter:function(){return r}}},assignMedium:function(o){n=!0;var i=[];if(r.length){var a=r;r=[],a.forEach(o),i=r}var c=function(){var f=i;i=[],f.forEach(o)},d=function(){return Promise.resolve().then(c)};d(),r={push:function(f){i.push(f),d()},filter:function(f){return i=i.filter(f),r}}}};return s}function Yp(e){e===void 0&&(e={});var t=Qp(null);return t.options=lt({async:!0,ssr:!1},e),t}var wc=function(e){var t=e.sideCar,r=bc(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return u.createElement(n,lt({},r))};wc.isSideCarExport=!0;function Xp(e,t){return e.useMedium(t),wc}var _c=Yp(),Is=function(){},ds=u.forwardRef(function(e,t){var r=u.useRef(null),n=u.useState({onScrollCapture:Is,onWheelCapture:Is,onTouchMoveCapture:Is}),s=n[0],o=n[1],i=e.forwardProps,a=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,h=e.shards,p=e.sideCar,g=e.noRelative,b=e.noIsolation,m=e.inert,v=e.allowPinchZoom,C=e.as,x=C===void 0?"div":C,S=e.gapMode,_=bc(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),w=p,T=qp([r,t]),R=lt(lt({},_),s);return u.createElement(u.Fragment,null,f&&u.createElement(w,{sideCar:_c,removeScrollBar:d,shards:h,noRelative:g,noIsolation:b,inert:m,setCallbacks:o,allowPinchZoom:!!v,lockRef:r,gapMode:S}),i?u.cloneElement(u.Children.only(a),lt(lt({},R),{ref:T})):u.createElement(x,lt({},R,{className:c,ref:T}),a))});ds.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ds.classNames={fullWidth:On,zeroRight:An};var Jp=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function em(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Jp();return t&&e.setAttribute("nonce",t),e}function tm(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function rm(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var nm=function(){var e=0,t=null;return{add:function(r){e==0&&(t=em())&&(tm(t,r),rm(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},sm=function(){var e=nm();return function(t,r){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Cc=function(){var e=sm(),t=function(r){var n=r.styles,s=r.dynamic;return e(n,s),null};return t},om={left:0,top:0,right:0,gap:0},Ds=function(e){return parseInt(e||"",10)||0},im=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Ds(r),Ds(n),Ds(s)]},am=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return om;var t=im(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},cm=Cc(),mr="data-scroll-locked",lm=function(e,t,r,n){var s=e.left,o=e.top,i=e.right,a=e.gap;return r===void 0&&(r="margin"),`
|
|
.`.concat(Wp,` {
|
|
overflow: hidden `).concat(n,`;
|
|
padding-right: `).concat(a,"px ").concat(n,`;
|
|
}
|
|
body[`).concat(mr,`] {
|
|
overflow: hidden `).concat(n,`;
|
|
overscroll-behavior: contain;
|
|
`).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
|
|
padding-left: `.concat(s,`px;
|
|
padding-top: `).concat(o,`px;
|
|
padding-right: `).concat(i,`px;
|
|
margin-left:0;
|
|
margin-top:0;
|
|
margin-right: `).concat(a,"px ").concat(n,`;
|
|
`),r==="padding"&&"padding-right: ".concat(a,"px ").concat(n,";")].filter(Boolean).join(""),`
|
|
}
|
|
|
|
.`).concat(An,` {
|
|
right: `).concat(a,"px ").concat(n,`;
|
|
}
|
|
|
|
.`).concat(On,` {
|
|
margin-right: `).concat(a,"px ").concat(n,`;
|
|
}
|
|
|
|
.`).concat(An," .").concat(An,` {
|
|
right: 0 `).concat(n,`;
|
|
}
|
|
|
|
.`).concat(On," .").concat(On,` {
|
|
margin-right: 0 `).concat(n,`;
|
|
}
|
|
|
|
body[`).concat(mr,`] {
|
|
`).concat(Hp,": ").concat(a,`px;
|
|
}
|
|
`)},Fi=function(){var e=parseInt(document.body.getAttribute(mr)||"0",10);return isFinite(e)?e:0},um=function(){u.useEffect(function(){return document.body.setAttribute(mr,(Fi()+1).toString()),function(){var e=Fi()-1;e<=0?document.body.removeAttribute(mr):document.body.setAttribute(mr,e.toString())}},[])},dm=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=n===void 0?"margin":n;um();var o=u.useMemo(function(){return am(s)},[s]);return u.createElement(cm,{styles:lm(o,!t,s,r?"":"!important")})},to=!1;if(typeof window<"u")try{var Cn=Object.defineProperty({},"passive",{get:function(){return to=!0,!0}});window.addEventListener("test",Cn,Cn),window.removeEventListener("test",Cn,Cn)}catch{to=!1}var cr=to?{passive:!1}:!1,fm=function(e){return e.tagName==="TEXTAREA"},Sc=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!fm(e)&&r[t]==="visible")},hm=function(e){return Sc(e,"overflowY")},pm=function(e){return Sc(e,"overflowX")},Li=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=Ec(e,n);if(s){var o=Rc(e,n),i=o[1],a=o[2];if(i>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},mm=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},gm=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Ec=function(e,t){return e==="v"?hm(t):pm(t)},Rc=function(e,t){return e==="v"?mm(t):gm(t)},vm=function(e,t){return e==="h"&&t==="rtl"?-1:1},ym=function(e,t,r,n,s){var o=vm(e,window.getComputedStyle(t).direction),i=o*n,a=r.target,c=t.contains(a),d=!1,f=i>0,h=0,p=0;do{if(!a)break;var g=Rc(e,a),b=g[0],m=g[1],v=g[2],C=m-v-o*b;(b||C)&&Ec(e,a)&&(h+=C,p+=b);var x=a.parentNode;a=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(f&&Math.abs(h)<1||!f&&Math.abs(p)<1)&&(d=!0),d},Sn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Vi=function(e){return[e.deltaX,e.deltaY]},$i=function(e){return e&&"current"in e?e.current:e},xm=function(e,t){return e[0]===t[0]&&e[1]===t[1]},bm=function(e){return`
|
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
`)},wm=0,lr=[];function _m(e){var t=u.useRef([]),r=u.useRef([0,0]),n=u.useRef(),s=u.useState(wm++)[0],o=u.useState(Cc)[0],i=u.useRef(e);u.useEffect(function(){i.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var m=zp([e.lockRef.current],(e.shards||[]).map($i),!0).filter(Boolean);return m.forEach(function(v){return v.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=u.useCallback(function(m,v){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var C=Sn(m),x=r.current,S="deltaX"in m?m.deltaX:x[0]-C[0],_="deltaY"in m?m.deltaY:x[1]-C[1],w,T=m.target,R=Math.abs(S)>Math.abs(_)?"h":"v";if("touches"in m&&R==="h"&&T.type==="range")return!1;var k=Li(R,T);if(!k)return!0;if(k?w=R:(w=R==="v"?"h":"v",k=Li(R,T)),!k)return!1;if(!n.current&&"changedTouches"in m&&(S||_)&&(n.current=w),!w)return!0;var j=n.current||w;return ym(j,v,m,j==="h"?S:_)},[]),c=u.useCallback(function(m){var v=m;if(!(!lr.length||lr[lr.length-1]!==o)){var C="deltaY"in v?Vi(v):Sn(v),x=t.current.filter(function(w){return w.name===v.type&&(w.target===v.target||v.target===w.shadowParent)&&xm(w.delta,C)})[0];if(x&&x.should){v.cancelable&&v.preventDefault();return}if(!x){var S=(i.current.shards||[]).map($i).filter(Boolean).filter(function(w){return w.contains(v.target)}),_=S.length>0?a(v,S[0]):!i.current.noIsolation;_&&v.cancelable&&v.preventDefault()}}},[]),d=u.useCallback(function(m,v,C,x){var S={name:m,delta:v,target:C,should:x,shadowParent:Cm(C)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(_){return _!==S})},1)},[]),f=u.useCallback(function(m){r.current=Sn(m),n.current=void 0},[]),h=u.useCallback(function(m){d(m.type,Vi(m),m.target,a(m,e.lockRef.current))},[]),p=u.useCallback(function(m){d(m.type,Sn(m),m.target,a(m,e.lockRef.current))},[]);u.useEffect(function(){return lr.push(o),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:p}),document.addEventListener("wheel",c,cr),document.addEventListener("touchmove",c,cr),document.addEventListener("touchstart",f,cr),function(){lr=lr.filter(function(m){return m!==o}),document.removeEventListener("wheel",c,cr),document.removeEventListener("touchmove",c,cr),document.removeEventListener("touchstart",f,cr)}},[]);var g=e.removeScrollBar,b=e.inert;return u.createElement(u.Fragment,null,b?u.createElement(o,{styles:bm(s)}):null,g?u.createElement(dm,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Cm(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Sm=Xp(_c,_m);var ln=u.forwardRef(function(e,t){return u.createElement(ds,lt({},e,{ref:t,sideCar:Sm}))});ln.classNames=ds.classNames;var fs="Popover",[Pc,lw]=st(fs,[$t]),un=$t(),[Em,Ut]=Pc(fs),Tc=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:i=!1}=e,a=un(t),c=u.useRef(null),[d,f]=u.useState(!1),[h,p]=mt({prop:n,defaultProp:s??!1,onChange:o,caller:fs});return l.jsx(ss,{...a,children:l.jsx(Em,{scope:t,contentId:Je(),triggerRef:c,open:h,onOpenChange:p,onOpenToggle:u.useCallback(()=>p(g=>!g),[p]),hasCustomAnchor:d,onCustomAnchorAdd:u.useCallback(()=>f(!0),[]),onCustomAnchorRemove:u.useCallback(()=>f(!1),[]),modal:i,children:r})})};Tc.displayName=fs;var Ac="PopoverAnchor",Rm=u.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=Ut(Ac,r),o=un(r),{onCustomAnchorAdd:i,onCustomAnchorRemove:a}=s;return u.useEffect(()=>(i(),()=>a()),[i,a]),l.jsx(on,{...o,...n,ref:t})});Rm.displayName=Ac;var Oc="PopoverTrigger",kc=u.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=Ut(Oc,r),o=un(r),i=se(t,s.triggerRef),a=l.jsx(ee.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Dc(s.open),...n,ref:i,onClick:L(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?a:l.jsx(on,{asChild:!0,...o,children:a})});kc.displayName=Oc;var jo="PopoverPortal",[Pm,Tm]=Pc(jo,{forceMount:void 0}),Nc=e=>{const{__scopePopover:t,forceMount:r,children:n,container:s}=e,o=Ut(jo,t);return l.jsx(Pm,{scope:t,forceMount:r,children:l.jsx(Re,{present:r||o.open,children:l.jsx(Tr,{asChild:!0,container:s,children:n})})})};Nc.displayName=jo;var xr="PopoverContent",jc=u.forwardRef((e,t)=>{const r=Tm(xr,e.__scopePopover),{forceMount:n=r.forceMount,...s}=e,o=Ut(xr,e.__scopePopover);return l.jsx(Re,{present:n||o.open,children:o.modal?l.jsx(Om,{...s,ref:t}):l.jsx(km,{...s,ref:t})})});jc.displayName=xr;var Am=qt("PopoverContent.RemoveScroll"),Om=u.forwardRef((e,t)=>{const r=Ut(xr,e.__scopePopover),n=u.useRef(null),s=se(t,n),o=u.useRef(!1);return u.useEffect(()=>{const i=n.current;if(i)return us(i)},[]),l.jsx(ln,{as:Am,allowPinchZoom:!0,children:l.jsx(Mc,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:L(e.onCloseAutoFocus,i=>{i.preventDefault(),o.current||r.triggerRef.current?.focus()}),onPointerDownOutside:L(e.onPointerDownOutside,i=>{const a=i.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0,d=a.button===2||c;o.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:L(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),km=u.forwardRef((e,t)=>{const r=Ut(xr,e.__scopePopover),n=u.useRef(!1),s=u.useRef(!1);return l.jsx(Mc,{...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 i=o.target;r.triggerRef.current?.contains(i)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),Mc=u.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:i,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,...h}=e,p=Ut(xr,r),g=un(r);return ls(),l.jsx(cn,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(Er,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:f,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:l.jsx(os,{"data-state":Dc(p.open),role:"dialog",id:p.contentId,...g,...h,ref:t,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Ic="PopoverClose",Nm=u.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=Ut(Ic,r);return l.jsx(ee.button,{type:"button",...n,ref:t,onClick:L(e.onClick,()=>s.onOpenChange(!1))})});Nm.displayName=Ic;var jm="PopoverArrow",Mm=u.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=un(r);return l.jsx(is,{...s,...n,ref:t})});Mm.displayName=jm;function Dc(e){return e?"open":"closed"}var Im=Tc,Dm=kc,Fm=Nc,Lm=jc;function Vm({...e}){return l.jsx(Im,{"data-slot":"popover",...e})}function $m({...e}){return l.jsx(Dm,{"data-slot":"popover-trigger",...e})}function Um({className:e,align:t="center",sideOffset:r=4,...n}){return l.jsx(Fm,{children:l.jsx(Lm,{"data-slot":"popover-content",align:t,sideOffset:r,className:oe("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 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...n})})}function Bm(){return l.jsxs(Op,{children:[l.jsx(kp,{asChild:!0,children:l.jsx($m,{asChild:!0,children:l.jsx(ct,{size:"icon",children:l.jsx(uf,{})})})}),l.jsx(Np,{children:l.jsx("p",{children:"Add to library"})})]})}function Mo(e){const t=e+"CollectionProvider",[r,n]=st(t),[s,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:v,children:C}=m,x=Q.useRef(null),S=Q.useRef(new Map).current;return l.jsx(s,{scope:v,itemMap:S,collectionRef:x,children:C})};i.displayName=t;const a=e+"CollectionSlot",c=qt(a),d=Q.forwardRef((m,v)=>{const{scope:C,children:x}=m,S=o(a,C),_=se(v,S.collectionRef);return l.jsx(c,{ref:_,children:x})});d.displayName=a;const f=e+"CollectionItemSlot",h="data-radix-collection-item",p=qt(f),g=Q.forwardRef((m,v)=>{const{scope:C,children:x,...S}=m,_=Q.useRef(null),w=se(v,_),T=o(f,C);return Q.useEffect(()=>(T.itemMap.set(_,{ref:_,...S}),()=>void T.itemMap.delete(_))),l.jsx(p,{[h]:"",ref:w,children:x})});g.displayName=f;function b(m){const v=o(e+"CollectionConsumer",m);return Q.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const S=Array.from(x.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((T,R)=>S.indexOf(T.ref.current)-S.indexOf(R.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:d,ItemSlot:g},b,n]}var zm=u.createContext(void 0);function dn(e){const t=u.useContext(zm);return e||t||"ltr"}var Fs="rovingFocusGroup.onEntryFocus",Wm={bubbles:!1,cancelable:!0},fn="RovingFocusGroup",[ro,Fc,Hm]=Mo(fn),[Zm,hs]=st(fn,[Hm]),[Gm,qm]=Zm(fn),Lc=u.forwardRef((e,t)=>l.jsx(ro.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(ro.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Km,{...e,ref:t})})}));Lc.displayName=fn;var Km=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=e,p=u.useRef(null),g=se(t,p),b=dn(o),[m,v]=mt({prop:i,defaultProp:a??null,onChange:c,caller:fn}),[C,x]=u.useState(!1),S=Ce(d),_=Fc(r),w=u.useRef(!1),[T,R]=u.useState(0);return u.useEffect(()=>{const k=p.current;if(k)return k.addEventListener(Fs,S),()=>k.removeEventListener(Fs,S)},[S]),l.jsx(Gm,{scope:r,orientation:n,dir:b,loop:s,currentTabStopId:m,onItemFocus:u.useCallback(k=>v(k),[v]),onItemShiftTab:u.useCallback(()=>x(!0),[]),onFocusableItemAdd:u.useCallback(()=>R(k=>k+1),[]),onFocusableItemRemove:u.useCallback(()=>R(k=>k-1),[]),children:l.jsx(ee.div,{tabIndex:C||T===0?-1:0,"data-orientation":n,...h,ref:g,style:{outline:"none",...e.style},onMouseDown:L(e.onMouseDown,()=>{w.current=!0}),onFocus:L(e.onFocus,k=>{const j=!w.current;if(k.target===k.currentTarget&&j&&!C){const D=new CustomEvent(Fs,Wm);if(k.currentTarget.dispatchEvent(D),!D.defaultPrevented){const G=_().filter(H=>H.focusable),$=G.find(H=>H.active),N=G.find(H=>H.id===m),J=[$,N,...G].filter(Boolean).map(H=>H.ref.current);Uc(J,f)}}w.current=!1}),onBlur:L(e.onBlur,()=>x(!1))})})}),Vc="RovingFocusGroupItem",$c=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:o,children:i,...a}=e,c=Je(),d=o||c,f=qm(Vc,r),h=f.currentTabStopId===d,p=Fc(r),{onFocusableItemAdd:g,onFocusableItemRemove:b,currentTabStopId:m}=f;return u.useEffect(()=>{if(n)return g(),()=>b()},[n,g,b]),l.jsx(ro.ItemSlot,{scope:r,id:d,focusable:n,active:s,children:l.jsx(ee.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...a,ref:t,onMouseDown:L(e.onMouseDown,v=>{n?f.onItemFocus(d):v.preventDefault()}),onFocus:L(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:L(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const C=Xm(v,f.orientation,f.dir);if(C!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let S=p().filter(_=>_.focusable).map(_=>_.ref.current);if(C==="last")S.reverse();else if(C==="prev"||C==="next"){C==="prev"&&S.reverse();const _=S.indexOf(v.currentTarget);S=f.loop?Jm(S,_+1):S.slice(_+1)}setTimeout(()=>Uc(S))}}),children:typeof i=="function"?i({isCurrentTabStop:h,hasTabStop:m!=null}):i})})});$c.displayName=Vc;var Qm={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ym(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Xm(e,t,r){const n=Ym(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Qm[n]}function Uc(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function Jm(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Bc=Lc,zc=$c,Wc="Toggle",Hc=u.forwardRef((e,t)=>{const{pressed:r,defaultPressed:n,onPressedChange:s,...o}=e,[i,a]=mt({prop:r,onChange:s,defaultProp:n??!1,caller:Wc});return l.jsx(ee.button,{type:"button","aria-pressed":i,"data-state":i?"on":"off","data-disabled":e.disabled?"":void 0,...o,ref:t,onClick:L(e.onClick,()=>{e.disabled||a(!i)})})});Hc.displayName=Wc;var Bt="ToggleGroup",[Zc,uw]=st(Bt,[hs]),Gc=hs(),Io=Q.forwardRef((e,t)=>{const{type:r,...n}=e;if(r==="single"){const s=n;return l.jsx(eg,{...s,ref:t})}if(r==="multiple"){const s=n;return l.jsx(tg,{...s,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${Bt}\``)});Io.displayName=Bt;var[qc,Kc]=Zc(Bt),eg=Q.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...o}=e,[i,a]=mt({prop:r,defaultProp:n??"",onChange:s,caller:Bt});return l.jsx(qc,{scope:e.__scopeToggleGroup,type:"single",value:Q.useMemo(()=>i?[i]:[],[i]),onItemActivate:a,onItemDeactivate:Q.useCallback(()=>a(""),[a]),children:l.jsx(Qc,{...o,ref:t})})}),tg=Q.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...o}=e,[i,a]=mt({prop:r,defaultProp:n??[],onChange:s,caller:Bt}),c=Q.useCallback(f=>a((h=[])=>[...h,f]),[a]),d=Q.useCallback(f=>a((h=[])=>h.filter(p=>p!==f)),[a]);return l.jsx(qc,{scope:e.__scopeToggleGroup,type:"multiple",value:i,onItemActivate:c,onItemDeactivate:d,children:l.jsx(Qc,{...o,ref:t})})});Io.displayName=Bt;var[rg,ng]=Zc(Bt),Qc=Q.forwardRef((e,t)=>{const{__scopeToggleGroup:r,disabled:n=!1,rovingFocus:s=!0,orientation:o,dir:i,loop:a=!0,...c}=e,d=Gc(r),f=dn(i),h={role:"group",dir:f,...c};return l.jsx(rg,{scope:r,rovingFocus:s,disabled:n,children:s?l.jsx(Bc,{asChild:!0,...d,orientation:o,dir:f,loop:a,children:l.jsx(ee.div,{...h,ref:t})}):l.jsx(ee.div,{...h,ref:t})})}),Ln="ToggleGroupItem",Yc=Q.forwardRef((e,t)=>{const r=Kc(Ln,e.__scopeToggleGroup),n=ng(Ln,e.__scopeToggleGroup),s=Gc(e.__scopeToggleGroup),o=r.value.includes(e.value),i=n.disabled||e.disabled,a={...e,pressed:o,disabled:i},c=Q.useRef(null);return n.rovingFocus?l.jsx(zc,{asChild:!0,...s,focusable:!i,active:o,ref:c,children:l.jsx(Ui,{...a,ref:t})}):l.jsx(Ui,{...a,ref:t})});Yc.displayName=Ln;var Ui=Q.forwardRef((e,t)=>{const{__scopeToggleGroup:r,value:n,...s}=e,o=Kc(Ln,r),i={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},a=o.type==="single"?i:void 0;return l.jsx(Hc,{...a,...s,ref:t,onPressedChange:c=>{c?o.onItemActivate(n):o.onItemDeactivate(n)}})}),sg=Io,og=Yc;const ig=ga("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"}}),Xc=u.createContext({size:"default",variant:"default"});function ag({className:e,variant:t,size:r,children:n,...s}){return l.jsx(sg,{"data-slot":"toggle-group","data-variant":t,"data-size":r,className:oe("group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",e),...s,children:l.jsx(Xc.Provider,{value:{variant:t,size:r},children:n})})}function Bi({className:e,children:t,variant:r,size:n,...s}){const o=u.useContext(Xc);return l.jsx(og,{"data-slot":"toggle-group-item","data-variant":o.variant||r,"data-size":o.size||n,className:oe(ig({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 cg({filter:e,setFilter:t,activeFiltersCount:r,clearFilters:n}){return l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs(ag,{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:[l.jsxs(Bi,{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:[l.jsx(Da,{className:"h-2 w-2"}),l.jsx("span",{className:"text-sm font-medium",children:"Listed"})]}),l.jsxs(Bi,{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:[l.jsx(Ia,{className:"h-2 w-2"}),l.jsx("span",{className:"text-sm font-medium",children:"Unlisted"})]})]}),r>0&&l.jsxs(ct,{variant:"outline",size:"sm",onClick:n,className:"flex items-center gap-2 text-muted-foreground hover:text-foreground bg-transparent","aria-label":"clear",children:[l.jsx(wo,{className:"h-2 w-2"}),l.jsx("span",{className:"text-sm",children:"Clear"})]})]})}function Jc({color:e="black",...t}){return l.jsxs("div",{...t,className:oe("flex items-center justify-center flex-col gap-4",t.className),children:[l.jsx("div",{className:oe("!animate-spin rounded-full size-4 border-b-2",t.size,{"border-primary":e==="black","border-white":e==="white"})}),t.showLabel&&l.jsx("span",{children:"Đang tải..."})]})}var hn=e=>e.type==="checkbox",Zt=e=>e instanceof Date,Oe=e=>e==null;const el=e=>typeof e=="object";var ve=e=>!Oe(e)&&!Array.isArray(e)&&el(e)&&!Zt(e),tl=e=>ve(e)&&e.target?hn(e.target)?e.target.checked:e.target.value:e,lg=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,rl=(e,t)=>e.has(lg(t)),ug=e=>{const t=e.constructor&&e.constructor.prototype;return ve(t)&&t.hasOwnProperty("isPrototypeOf")},Do=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function be(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(!(Do&&(e instanceof Blob||n))&&(r||ve(e)))if(t=r?[]:Object.create(Object.getPrototypeOf(e)),!r&&!ug(e))t=e;else for(const s in e)e.hasOwnProperty(s)&&(t[s]=be(e[s]));else return e;return t}var ps=e=>/^\w*$/.test(e),ge=e=>e===void 0,Fo=e=>Array.isArray(e)?e.filter(Boolean):[],Lo=e=>Fo(e.replace(/["|']|\]/g,"").split(/\.|\[/)),I=(e,t,r)=>{if(!t||!ve(e))return r;const n=(ps(t)?[t]:Lo(t)).reduce((s,o)=>Oe(s)?s:s[o],e);return ge(n)||n===e?ge(e[t])?r:e[t]:n},Fe=e=>typeof e=="boolean",le=(e,t,r)=>{let n=-1;const s=ps(t)?[t]:Lo(t),o=s.length,i=o-1;for(;++n<o;){const a=s[n];let c=r;if(n!==i){const d=e[a];c=ve(d)||Array.isArray(d)?d:isNaN(+s[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=c,e=e[a]}};const Vn={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Qe={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},bt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Vo=Q.createContext(null);Vo.displayName="HookFormContext";const ms=()=>Q.useContext(Vo),dg=e=>{const{children:t,...r}=e;return Q.createElement(Vo.Provider,{value:r},t)};var nl=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const i=o;return t._proxyFormState[i]!==Qe.all&&(t._proxyFormState[i]=!n||Qe.all),r&&(r[i]=!0),e[i]}});return s};const $o=typeof window<"u"?Q.useLayoutEffect:Q.useEffect;function sl(e){const t=ms(),{control:r=t.control,disabled:n,name:s,exact:o}=e||{},[i,a]=Q.useState(r._formState),c=Q.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return $o(()=>r._subscribe({name:s,formState:c.current,exact:o,callback:d=>{!n&&a({...r._formState,...d})}}),[s,n,o]),Q.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),Q.useMemo(()=>nl(i,r,c.current,!1),[i,r])}var dt=e=>typeof e=="string",ol=(e,t,r,n,s)=>dt(e)?(n&&t.watch.add(e),I(r,e,s)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),I(r,o))):(n&&(t.watchAll=!0),r),no=e=>Oe(e)||!el(e);function Rt(e,t,r=new WeakSet){if(no(e)||no(t))return e===t;if(Zt(e)&&Zt(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 i=e[o];if(!s.includes(o))return!1;if(o!=="ref"){const a=t[o];if(Zt(i)&&Zt(a)||ve(i)&&ve(a)||Array.isArray(i)&&Array.isArray(a)?!Rt(i,a,r):i!==a)return!1}}return!0}function fg(e){const t=ms(),{control:r=t.control,name:n,defaultValue:s,disabled:o,exact:i,compute:a}=e||{},c=Q.useRef(s),d=Q.useRef(a),f=Q.useRef(void 0);d.current=a;const h=Q.useMemo(()=>r._getWatch(n,c.current),[r,n]),[p,g]=Q.useState(d.current?d.current(h):h);return $o(()=>r._subscribe({name:n,formState:{values:!0},exact:i,callback:b=>{if(!o){const m=ol(n,r._names,b.values||r._formValues,!1,c.current);if(d.current){const v=d.current(m);Rt(v,f.current)||(g(v),f.current=v)}else g(m)}}}),[r,o,n,i]),Q.useEffect(()=>r._removeUnmounted()),p}function hg(e){const t=ms(),{name:r,disabled:n,control:s=t.control,shouldUnregister:o,defaultValue:i}=e,a=rl(s._names.array,r),c=Q.useMemo(()=>I(s._formValues,r,I(s._defaultValues,r,i)),[s,r,i]),d=fg({control:s,name:r,defaultValue:c,exact:!0}),f=sl({control:s,name:r,exact:!0}),h=Q.useRef(e),p=Q.useRef(s.register(r,{...e.rules,value:d,...Fe(e.disabled)?{disabled:e.disabled}:{}}));h.current=e;const g=Q.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!I(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!I(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!I(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!I(f.validatingFields,r)},error:{enumerable:!0,get:()=>I(f.errors,r)}}),[f,r]),b=Q.useCallback(x=>p.current.onChange({target:{value:tl(x),name:r},type:Vn.CHANGE}),[r]),m=Q.useCallback(()=>p.current.onBlur({target:{value:I(s._formValues,r),name:r},type:Vn.BLUR}),[r,s._formValues]),v=Q.useCallback(x=>{const S=I(s._fields,r);S&&x&&(S._f.ref={focus:()=>x.focus&&x.focus(),select:()=>x.select&&x.select(),setCustomValidity:_=>x.setCustomValidity(_),reportValidity:()=>x.reportValidity()})},[s._fields,r]),C=Q.useMemo(()=>({name:r,value:d,...Fe(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:b,onBlur:m,ref:v}),[r,n,f.disabled,b,m,v,d]);return Q.useEffect(()=>{const x=s._options.shouldUnregister||o;s.register(r,{...h.current.rules,...Fe(h.current.disabled)?{disabled:h.current.disabled}:{}});const S=(_,w)=>{const T=I(s._fields,_);T&&T._f&&(T._f.mount=w)};if(S(r,!0),x){const _=be(I(s._options.defaultValues,r));le(s._defaultValues,r,_),ge(I(s._formValues,r))&&le(s._formValues,r,_)}return!a&&s.register(r),()=>{(a?x&&!s._state.action:x)?s.unregister(r):S(r,!1)}},[r,s,a,o]),Q.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),Q.useMemo(()=>({field:C,formState:f,fieldState:g}),[C,f,g])}const pg=e=>e.render(hg(e));var Uo=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Dr=e=>Array.isArray(e)?e:[e],zi=()=>{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=[]}}},Ie=e=>ve(e)&&!Object.keys(e).length,Bo=e=>e.type==="file",Ye=e=>typeof e=="function",$n=e=>{if(!Do)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},il=e=>e.type==="select-multiple",zo=e=>e.type==="radio",mg=e=>zo(e)||hn(e),Ls=e=>$n(e)&&e.isConnected;function gg(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=ge(e)?n++:e[t[n++]];return e}function vg(e){for(const t in e)if(e.hasOwnProperty(t)&&!ge(e[t]))return!1;return!0}function ye(e,t){const r=Array.isArray(t)?t:ps(t)?[t]:Lo(t),n=r.length===1?e:gg(e,r),s=r.length-1,o=r[s];return n&&delete n[o],s!==0&&(ve(n)&&Ie(n)||Array.isArray(n)&&vg(n))&&ye(e,r.slice(0,-1)),e}var al=e=>{for(const t in e)if(Ye(e[t]))return!0;return!1};function Un(e,t={}){const r=Array.isArray(e);if(ve(e)||r)for(const n in e)Array.isArray(e[n])||ve(e[n])&&!al(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Un(e[n],t[n])):Oe(e[n])||(t[n]=!0);return t}function cl(e,t,r){const n=Array.isArray(e);if(ve(e)||n)for(const s in e)Array.isArray(e[s])||ve(e[s])&&!al(e[s])?ge(t)||no(r[s])?r[s]=Array.isArray(e[s])?Un(e[s],[]):{...Un(e[s])}:cl(e[s],Oe(t)?{}:t[s],r[s]):r[s]=!Rt(e[s],t[s]);return r}var Nr=(e,t)=>cl(e,t,Un(t));const Wi={value:!1,isValid:!1},Hi={value:!0,isValid:!0};var ll=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&&!ge(e[0].attributes.value)?ge(e[0].value)||e[0].value===""?Hi:{value:e[0].value,isValid:!0}:Hi:Wi}return Wi},ul=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>ge(e)?e:t?e===""?NaN:e&&+e:r&&dt(e)?new Date(e):n?n(e):e;const Zi={isValid:!1,value:null};var dl=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Zi):Zi;function Gi(e){const t=e.ref;return Bo(t)?t.files:zo(t)?dl(e.refs).value:il(t)?[...t.selectedOptions].map(({value:r})=>r):hn(t)?ll(e.refs).value:ul(ge(t.value)?e.ref.value:t.value,e)}var yg=(e,t,r,n)=>{const s={};for(const o of e){const i=I(t,o);i&&le(s,o,i._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Bn=e=>e instanceof RegExp,jr=e=>ge(e)?e:Bn(e)?e.source:ve(e)?Bn(e.value)?e.value.source:e.value:e,qi=e=>({isOnSubmit:!e||e===Qe.onSubmit,isOnBlur:e===Qe.onBlur,isOnChange:e===Qe.onChange,isOnAll:e===Qe.all,isOnTouch:e===Qe.onTouched});const Ki="AsyncFunction";var xg=e=>!!e&&!!e.validate&&!!(Ye(e.validate)&&e.validate.constructor.name===Ki||ve(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Ki)),bg=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Qi=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Fr=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const o=I(e,s);if(o){const{_f:i,...a}=o;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!n)return!0;if(i.ref&&t(i.ref,i.name)&&!n)return!0;if(Fr(a,t))break}else if(ve(a)&&Fr(a,t))break}}};function Yi(e,t,r){const n=I(e,r);if(n||ps(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),i=I(t,o),a=I(e,o);if(i&&!Array.isArray(i)&&r!==o)return{name:r};if(a&&a.type)return{name:o,error:a};if(a&&a.root&&a.root.type)return{name:`${o}.root`,error:a.root};s.pop()}return{name:r}}var wg=(e,t,r,n)=>{r(e);const{name:s,...o}=e;return Ie(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!n||Qe.all))},_g=(e,t,r)=>!e||!t||e===t||Dr(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),Cg=(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,Sg=(e,t)=>!Fo(I(e,t)).length&&ye(e,t),Eg=(e,t,r)=>{const n=Dr(I(e,r));return le(n,"root",t[r]),le(e,r,n),e},kn=e=>dt(e);function Xi(e,t,r="validate"){if(kn(e)||Array.isArray(e)&&e.every(kn)||Fe(e)&&!e)return{type:r,message:kn(e)?e:"",ref:t}}var ur=e=>ve(e)&&!Bn(e)?e:{value:e,message:""},Ji=async(e,t,r,n,s,o)=>{const{ref:i,refs:a,required:c,maxLength:d,minLength:f,min:h,max:p,pattern:g,validate:b,name:m,valueAsNumber:v,mount:C}=e._f,x=I(r,m);if(!C||t.has(m))return{};const S=a?a[0]:i,_=$=>{s&&S.reportValidity&&(S.setCustomValidity(Fe($)?"":$||""),S.reportValidity())},w={},T=zo(i),R=hn(i),k=T||R,j=(v||Bo(i))&&ge(i.value)&&ge(x)||$n(i)&&i.value===""||x===""||Array.isArray(x)&&!x.length,D=Uo.bind(null,m,n,w),G=($,N,U,J=bt.maxLength,H=bt.minLength)=>{const te=$?N:U;w[m]={type:$?J:H,message:te,ref:i,...D($?J:H,te)}};if(o?!Array.isArray(x)||!x.length:c&&(!k&&(j||Oe(x))||Fe(x)&&!x||R&&!ll(a).isValid||T&&!dl(a).isValid)){const{value:$,message:N}=kn(c)?{value:!!c,message:c}:ur(c);if($&&(w[m]={type:bt.required,message:N,ref:S,...D(bt.required,N)},!n))return _(N),w}if(!j&&(!Oe(h)||!Oe(p))){let $,N;const U=ur(p),J=ur(h);if(!Oe(x)&&!isNaN(x)){const H=i.valueAsNumber||x&&+x;Oe(U.value)||($=H>U.value),Oe(J.value)||(N=H<J.value)}else{const H=i.valueAsDate||new Date(x),te=de=>new Date(new Date().toDateString()+" "+de),q=i.type=="time",V=i.type=="week";dt(U.value)&&x&&($=q?te(x)>te(U.value):V?x>U.value:H>new Date(U.value)),dt(J.value)&&x&&(N=q?te(x)<te(J.value):V?x<J.value:H<new Date(J.value))}if(($||N)&&(G(!!$,U.message,J.message,bt.max,bt.min),!n))return _(w[m].message),w}if((d||f)&&!j&&(dt(x)||o&&Array.isArray(x))){const $=ur(d),N=ur(f),U=!Oe($.value)&&x.length>+$.value,J=!Oe(N.value)&&x.length<+N.value;if((U||J)&&(G(U,$.message,N.message),!n))return _(w[m].message),w}if(g&&!j&&dt(x)){const{value:$,message:N}=ur(g);if(Bn($)&&!x.match($)&&(w[m]={type:bt.pattern,message:N,ref:i,...D(bt.pattern,N)},!n))return _(N),w}if(b){if(Ye(b)){const $=await b(x,r),N=Xi($,S);if(N&&(w[m]={...N,...D(bt.validate,N.message)},!n))return _(N.message),w}else if(ve(b)){let $={};for(const N in b){if(!Ie($)&&!n)break;const U=Xi(await b[N](x,r),S,N);U&&($={...U,...D(N,U.message)},_(U.message),n&&(w[m]=$))}if(!Ie($)&&(w[m]={ref:S,...$},!n))return w}}return _(!0),w};const Rg={mode:Qe.onSubmit,reValidateMode:Qe.onChange,shouldFocusError:!0};function Pg(e={}){let t={...Rg,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ye(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=ve(t.defaultValues)||ve(t.values)?be(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:be(s),i={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let h={...f};const p={array:zi(),state:zi()},g=t.criteriaMode===Qe.all,b=y=>E=>{clearTimeout(d),d=setTimeout(y,E)},m=async y=>{if(!t.disabled&&(f.isValid||h.isValid||y)){const E=t.resolver?Ie((await R()).errors):await j(n,!0);E!==r.isValid&&p.state.next({isValid:E})}},v=(y,E)=>{!t.disabled&&(f.isValidating||f.validatingFields||h.isValidating||h.validatingFields)&&((y||Array.from(a.mount)).forEach(P=>{P&&(E?le(r.validatingFields,P,E):ye(r.validatingFields,P))}),p.state.next({validatingFields:r.validatingFields,isValidating:!Ie(r.validatingFields)}))},C=(y,E=[],P,B,M=!0,O=!0)=>{if(B&&P&&!t.disabled){if(i.action=!0,O&&Array.isArray(I(n,y))){const K=P(I(n,y),B.argA,B.argB);M&&le(n,y,K)}if(O&&Array.isArray(I(r.errors,y))){const K=P(I(r.errors,y),B.argA,B.argB);M&&le(r.errors,y,K),Sg(r.errors,y)}if((f.touchedFields||h.touchedFields)&&O&&Array.isArray(I(r.touchedFields,y))){const K=P(I(r.touchedFields,y),B.argA,B.argB);M&&le(r.touchedFields,y,K)}(f.dirtyFields||h.dirtyFields)&&(r.dirtyFields=Nr(s,o)),p.state.next({name:y,isDirty:G(y,E),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else le(o,y,E)},x=(y,E)=>{le(r.errors,y,E),p.state.next({errors:r.errors})},S=y=>{r.errors=y,p.state.next({errors:r.errors,isValid:!1})},_=(y,E,P,B)=>{const M=I(n,y);if(M){const O=I(o,y,ge(P)?I(s,y):P);ge(O)||B&&B.defaultChecked||E?le(o,y,E?O:Gi(M._f)):U(y,O),i.mount&&m()}},w=(y,E,P,B,M)=>{let O=!1,K=!1;const ce={name:y};if(!t.disabled){if(!P||B){(f.isDirty||h.isDirty)&&(K=r.isDirty,r.isDirty=ce.isDirty=G(),O=K!==ce.isDirty);const he=Rt(I(s,y),E);K=!!I(r.dirtyFields,y),he?ye(r.dirtyFields,y):le(r.dirtyFields,y,!0),ce.dirtyFields=r.dirtyFields,O=O||(f.dirtyFields||h.dirtyFields)&&K!==!he}if(P){const he=I(r.touchedFields,y);he||(le(r.touchedFields,y,P),ce.touchedFields=r.touchedFields,O=O||(f.touchedFields||h.touchedFields)&&he!==P)}O&&M&&p.state.next(ce)}return O?ce:{}},T=(y,E,P,B)=>{const M=I(r.errors,y),O=(f.isValid||h.isValid)&&Fe(E)&&r.isValid!==E;if(t.delayError&&P?(c=b(()=>x(y,P)),c(t.delayError)):(clearTimeout(d),c=null,P?le(r.errors,y,P):ye(r.errors,y)),(P?!Rt(M,P):M)||!Ie(B)||O){const K={...B,...O&&Fe(E)?{isValid:E}:{},errors:r.errors,name:y};r={...r,...K},p.state.next(K)}},R=async y=>{v(y,!0);const E=await t.resolver(o,t.context,yg(y||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return v(y),E},k=async y=>{const{errors:E}=await R(y);if(y)for(const P of y){const B=I(E,P);B?le(r.errors,P,B):ye(r.errors,P)}else r.errors=E;return E},j=async(y,E,P={valid:!0})=>{for(const B in y){const M=y[B];if(M){const{_f:O,...K}=M;if(O){const ce=a.array.has(O.name),he=M._f&&xg(M._f);he&&f.validatingFields&&v([B],!0);const ze=await Ji(M,a.disabled,o,g,t.shouldUseNativeValidation&&!E,ce);if(he&&f.validatingFields&&v([B]),ze[O.name]&&(P.valid=!1,E))break;!E&&(I(ze,O.name)?ce?Eg(r.errors,ze,O.name):le(r.errors,O.name,ze[O.name]):ye(r.errors,O.name))}!Ie(K)&&await j(K,E,P)}}return P.valid},D=()=>{for(const y of a.unMount){const E=I(n,y);E&&(E._f.refs?E._f.refs.every(P=>!Ls(P)):!Ls(E._f.ref))&&W(y)}a.unMount=new Set},G=(y,E)=>!t.disabled&&(y&&E&&le(o,y,E),!Rt(de(),s)),$=(y,E,P)=>ol(y,a,{...i.mount?o:ge(E)?s:dt(y)?{[y]:E}:E},P,E),N=y=>Fo(I(i.mount?o:s,y,t.shouldUnregister?I(s,y,[]):[])),U=(y,E,P={})=>{const B=I(n,y);let M=E;if(B){const O=B._f;O&&(!O.disabled&&le(o,y,ul(E,O)),M=$n(O.ref)&&Oe(E)?"":E,il(O.ref)?[...O.ref.options].forEach(K=>K.selected=M.includes(K.value)):O.refs?hn(O.ref)?O.refs.forEach(K=>{(!K.defaultChecked||!K.disabled)&&(Array.isArray(M)?K.checked=!!M.find(ce=>ce===K.value):K.checked=M===K.value||!!M)}):O.refs.forEach(K=>K.checked=K.value===M):Bo(O.ref)?O.ref.value="":(O.ref.value=M,O.ref.type||p.state.next({name:y,values:be(o)})))}(P.shouldDirty||P.shouldTouch)&&w(y,M,P.shouldTouch,P.shouldDirty,!0),P.shouldValidate&&V(y)},J=(y,E,P)=>{for(const B in E){if(!E.hasOwnProperty(B))return;const M=E[B],O=y+"."+B,K=I(n,O);(a.array.has(y)||ve(M)||K&&!K._f)&&!Zt(M)?J(O,M,P):U(O,M,P)}},H=(y,E,P={})=>{const B=I(n,y),M=a.array.has(y),O=be(E);le(o,y,O),M?(p.array.next({name:y,values:be(o)}),(f.isDirty||f.dirtyFields||h.isDirty||h.dirtyFields)&&P.shouldDirty&&p.state.next({name:y,dirtyFields:Nr(s,o),isDirty:G(y,O)})):B&&!B._f&&!Oe(O)?J(y,O,P):U(y,O,P),Qi(y,a)&&p.state.next({...r,name:y}),p.state.next({name:i.mount?y:void 0,values:be(o)})},te=async y=>{i.mount=!0;const E=y.target;let P=E.name,B=!0;const M=I(n,P),O=he=>{B=Number.isNaN(he)||Zt(he)&&isNaN(he.getTime())||Rt(he,I(o,P,he))},K=qi(t.mode),ce=qi(t.reValidateMode);if(M){let he,ze;const vn=E.type?Gi(M._f):tl(y),Ot=y.type===Vn.BLUR||y.type===Vn.FOCUS_OUT,cd=!bg(M._f)&&!t.resolver&&!I(r.errors,P)&&!M._f.deps||Cg(Ot,I(r.touchedFields,P),r.isSubmitted,ce,K),Rs=Qi(P,a,Ot);le(o,P,vn),Ot?(!E||!E.readOnly)&&(M._f.onBlur&&M._f.onBlur(y),c&&c(0)):M._f.onChange&&M._f.onChange(y);const Ps=w(P,vn,Ot),ld=!Ie(Ps)||Rs;if(!Ot&&p.state.next({name:P,type:y.type,values:be(o)}),cd)return(f.isValid||h.isValid)&&(t.mode==="onBlur"?Ot&&m():Ot||m()),ld&&p.state.next({name:P,...Rs?{}:Ps});if(!Ot&&Rs&&p.state.next({...r}),t.resolver){const{errors:ai}=await R([P]);if(O(vn),B){const ud=Yi(r.errors,n,P),ci=Yi(ai,n,ud.name||P);he=ci.error,P=ci.name,ze=Ie(ai)}}else v([P],!0),he=(await Ji(M,a.disabled,o,g,t.shouldUseNativeValidation))[P],v([P]),O(vn),B&&(he?ze=!1:(f.isValid||h.isValid)&&(ze=await j(n,!0)));B&&(M._f.deps&&V(M._f.deps),T(P,ze,he,Ps))}},q=(y,E)=>{if(I(r.errors,E)&&y.focus)return y.focus(),1},V=async(y,E={})=>{let P,B;const M=Dr(y);if(t.resolver){const O=await k(ge(y)?y:M);P=Ie(O),B=y?!M.some(K=>I(O,K)):P}else y?(B=(await Promise.all(M.map(async O=>{const K=I(n,O);return await j(K&&K._f?{[O]:K}:K)}))).every(Boolean),!(!B&&!r.isValid)&&m()):B=P=await j(n);return p.state.next({...!dt(y)||(f.isValid||h.isValid)&&P!==r.isValid?{}:{name:y},...t.resolver||!y?{isValid:P}:{},errors:r.errors}),E.shouldFocus&&!B&&Fr(n,q,y?M:a.mount),B},de=y=>{const E={...i.mount?o:s};return ge(y)?E:dt(y)?I(E,y):y.map(P=>I(E,P))},_e=(y,E)=>({invalid:!!I((E||r).errors,y),isDirty:!!I((E||r).dirtyFields,y),error:I((E||r).errors,y),isValidating:!!I(r.validatingFields,y),isTouched:!!I((E||r).touchedFields,y)}),De=y=>{y&&Dr(y).forEach(E=>ye(r.errors,E)),p.state.next({errors:y?r.errors:{}})},Ue=(y,E,P)=>{const B=(I(n,y,{_f:{}})._f||{}).ref,M=I(r.errors,y)||{},{ref:O,message:K,type:ce,...he}=M;le(r.errors,y,{...he,...E,ref:B}),p.state.next({name:y,errors:r.errors,isValid:!1}),P&&P.shouldFocus&&B&&B.focus&&B.focus()},je=(y,E)=>Ye(y)?p.state.subscribe({next:P=>"values"in P&&y($(void 0,E),P)}):$(y,E,!0),Be=y=>p.state.subscribe({next:E=>{_g(y.name,E.name,y.exact)&&wg(E,y.formState||f,kr,y.reRenderRoot)&&y.callback({values:{...o},...r,...E,defaultValues:s})}}).unsubscribe,Pe=y=>(i.mount=!0,h={...h,...y.formState},Be({...y,formState:h})),W=(y,E={})=>{for(const P of y?Dr(y):a.mount)a.mount.delete(P),a.array.delete(P),E.keepValue||(ye(n,P),ye(o,P)),!E.keepError&&ye(r.errors,P),!E.keepDirty&&ye(r.dirtyFields,P),!E.keepTouched&&ye(r.touchedFields,P),!E.keepIsValidating&&ye(r.validatingFields,P),!t.shouldUnregister&&!E.keepDefaultValue&&ye(s,P);p.state.next({values:be(o)}),p.state.next({...r,...E.keepDirty?{isDirty:G()}:{}}),!E.keepIsValid&&m()},ue=({disabled:y,name:E})=>{(Fe(y)&&i.mount||y||a.disabled.has(E))&&(y?a.disabled.add(E):a.disabled.delete(E))},xe=(y,E={})=>{let P=I(n,y);const B=Fe(E.disabled)||Fe(t.disabled);return le(n,y,{...P||{},_f:{...P&&P._f?P._f:{ref:{name:y}},name:y,mount:!0,...E}}),a.mount.add(y),P?ue({disabled:Fe(E.disabled)?E.disabled:t.disabled,name:y}):_(y,!0,E.value),{...B?{disabled:E.disabled||t.disabled}:{},...t.progressive?{required:!!E.required,min:jr(E.min),max:jr(E.max),minLength:jr(E.minLength),maxLength:jr(E.maxLength),pattern:jr(E.pattern)}:{},name:y,onChange:te,onBlur:te,ref:M=>{if(M){xe(y,E),P=I(n,y);const O=ge(M.value)&&M.querySelectorAll&&M.querySelectorAll("input,select,textarea")[0]||M,K=mg(O),ce=P._f.refs||[];if(K?ce.find(he=>he===O):O===P._f.ref)return;le(n,y,{_f:{...P._f,...K?{refs:[...ce.filter(Ls),O,...Array.isArray(I(s,y))?[{}]:[]],ref:{type:O.type,name:y}}:{ref:O}}}),_(y,!1,void 0,O)}else P=I(n,y,{}),P._f&&(P._f.mount=!1),(t.shouldUnregister||E.shouldUnregister)&&!(rl(a.array,y)&&i.action)&&a.unMount.add(y)}}},ae=()=>t.shouldFocusError&&Fr(n,q,a.mount),fe=y=>{Fe(y)&&(p.state.next({disabled:y}),Fr(n,(E,P)=>{const B=I(n,P);B&&(E.disabled=B._f.disabled||y,Array.isArray(B._f.refs)&&B._f.refs.forEach(M=>{M.disabled=B._f.disabled||y}))},0,!1))},pe=(y,E)=>async P=>{let B;P&&(P.preventDefault&&P.preventDefault(),P.persist&&P.persist());let M=be(o);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:O,values:K}=await R();r.errors=O,M=be(K)}else await j(n);if(a.disabled.size)for(const O of a.disabled)ye(M,O);if(ye(r.errors,"root"),Ie(r.errors)){p.state.next({errors:{}});try{await y(M,P)}catch(O){B=O}}else E&&await E({...r.errors},P),ae(),setTimeout(ae);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ie(r.errors)&&!B,submitCount:r.submitCount+1,errors:r.errors}),B)throw B},Me=(y,E={})=>{I(n,y)&&(ge(E.defaultValue)?H(y,be(I(s,y))):(H(y,E.defaultValue),le(s,y,be(E.defaultValue))),E.keepTouched||ye(r.touchedFields,y),E.keepDirty||(ye(r.dirtyFields,y),r.isDirty=E.defaultValue?G(y,be(I(s,y))):G()),E.keepError||(ye(r.errors,y),f.isValid&&m()),p.state.next({...r}))},it=(y,E={})=>{const P=y?be(y):s,B=be(P),M=Ie(y),O=M?s:B;if(E.keepDefaultValues||(s=P),!E.keepValues){if(E.keepDirtyValues){const K=new Set([...a.mount,...Object.keys(Nr(s,o))]);for(const ce of Array.from(K))I(r.dirtyFields,ce)?le(O,ce,I(o,ce)):H(ce,I(O,ce))}else{if(Do&&ge(y))for(const K of a.mount){const ce=I(n,K);if(ce&&ce._f){const he=Array.isArray(ce._f.refs)?ce._f.refs[0]:ce._f.ref;if($n(he)){const ze=he.closest("form");if(ze){ze.reset();break}}}}if(E.keepFieldsRef)for(const K of a.mount)H(K,I(O,K));else n={}}o=t.shouldUnregister?E.keepDefaultValues?be(s):{}:be(O),p.array.next({values:{...O}}),p.state.next({values:{...O}})}a={mount:E.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!f.isValid||!!E.keepIsValid||!!E.keepDirtyValues,i.watch=!!t.shouldUnregister,p.state.next({submitCount:E.keepSubmitCount?r.submitCount:0,isDirty:M?!1:E.keepDirty?r.isDirty:!!(E.keepDefaultValues&&!Rt(y,s)),isSubmitted:E.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:M?{}:E.keepDirtyValues?E.keepDefaultValues&&o?Nr(s,o):r.dirtyFields:E.keepDefaultValues&&y?Nr(s,y):E.keepDirty?r.dirtyFields:{},touchedFields:E.keepTouched?r.touchedFields:{},errors:E.keepErrors?r.errors:{},isSubmitSuccessful:E.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},ir=(y,E)=>it(Ye(y)?y(o):y,E),Or=(y,E={})=>{const P=I(n,y),B=P&&P._f;if(B){const M=B.refs?B.refs[0]:B.ref;M.focus&&(M.focus(),E.shouldSelect&&Ye(M.select)&&M.select())}},kr=y=>{r={...r,...y}},ii={control:{register:xe,unregister:W,getFieldState:_e,handleSubmit:pe,setError:Ue,_subscribe:Be,_runSchema:R,_focusError:ae,_getWatch:$,_getDirty:G,_setValid:m,_setFieldArray:C,_setDisabledField:ue,_setErrors:S,_getFieldArray:N,_reset:it,_resetDefaultValues:()=>Ye(t.defaultValues)&&t.defaultValues().then(y=>{ir(y,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:D,_disableForm:fe,_subjects:p,_proxyFormState:f,get _fields(){return n},get _formValues(){return o},get _state(){return i},set _state(y){i=y},get _defaultValues(){return s},get _names(){return a},set _names(y){a=y},get _formState(){return r},get _options(){return t},set _options(y){t={...t,...y}}},subscribe:Pe,trigger:V,register:xe,handleSubmit:pe,watch:je,setValue:H,getValues:de,reset:ir,resetField:Me,clearErrors:De,unregister:W,setError:Ue,setFocus:Or,getFieldState:_e};return{...ii,formControl:ii}}function Tg(e={}){const t=Q.useRef(void 0),r=Q.useRef(void 0),[n,s]=Q.useState({isDirty:!1,isValidating:!1,isLoading:Ye(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:Ye(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!Ye(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...a}=Pg(e);t.current={...a,formState:n}}const o=t.current.control;return o._options=e,$o(()=>{const i=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState}),reRenderRoot:!0});return s(a=>({...a,isReady:!0})),o._formState.isReady=!0,i},[o]),Q.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),Q.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),Q.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),Q.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),Q.useEffect(()=>{if(o._proxyFormState.isDirty){const i=o._getDirty();i!==n.isDirty&&o._subjects.state.next({isDirty:i})}},[o,n.isDirty]),Q.useEffect(()=>{e.values&&!Rt(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),r.current=e.values,s(i=>({...i}))):o._resetDefaultValues()},[o,e.values]),Q.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=nl(n,o),t.current}const ea=(e,t,r)=>{if(e&&"reportValidity"in e){const n=I(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},so=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?ea(n.ref,r,e):n&&n.refs&&n.refs.forEach(s=>ea(s,r,e))}},ta=(e,t)=>{t.shouldUseNativeValidation&&so(e,t);const r={};for(const n in e){const s=I(t.fields,n),o=Object.assign(e[n]||{},{ref:s&&s.ref});if(Ag(t.names||Object.keys(e),n)){const i=Object.assign({},I(r,n));le(i,"root",o),le(r,n,i)}else le(r,n,o)}return r},Ag=(e,t)=>{const r=ra(t);return e.some(n=>ra(n).match(`^${r}\\.\\d+`))};function ra(e){return e.replace(/\]|\[/g,"")}function fl(e,t,r){function n(a,c){var d;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(d=a._zod).traits??(d.traits=new Set),a._zod.traits.add(e),t(a,c);for(const f in i.prototype)f in a||Object.defineProperty(a,f,{value:i.prototype[f].bind(a)});a._zod.constr=i,a._zod.def=c}const s=r?.Parent??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function i(a){var c;const d=r?.Parent?new o:this;n(d,a),(c=d._zod).deferred??(c.deferred=[]);for(const f of d._zod.deferred)f();return d}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Og extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const kg={};function hl(e){return kg}function Ng(e,t){return typeof t=="bigint"?t.toString():t}const pl="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function En(e){return typeof e=="string"?e:e?.message}function ml(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 gl=(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,Ng,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},jg=fl("$ZodError",gl),vl=fl("$ZodError",gl,{Parent:Error}),Mg=e=>(t,r,n,s)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Og;if(i.issues.length){const a=new(s?.Err??e)(i.issues.map(c=>ml(c,o,hl())));throw pl(a,s?.callee),a}return i.value},Ig=Mg(vl),Dg=e=>async(t,r,n,s)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(s?.Err??e)(i.issues.map(c=>ml(c,o,hl())));throw pl(a,s?.callee),a}return i.value},Fg=Dg(vl);function na(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function Lg(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(f){return f.errors.forEach(function(h){return e.push(h)})}),t){var c=r[i].types,d=c&&c[n.code];r[i]=Uo(i,t,r,s,d?[].concat(d,n.message):n.message)}e.shift()}return r}function Vg(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if(n.code==="invalid_union"&&n.errors.forEach(function(f){return f.forEach(function(h){return e.push(h)})}),t){var c=r[i].types,d=c&&c[n.code];r[i]=Uo(i,t,r,s,d?[].concat(d,n.message):n.message)}e.shift()}return r}function $g(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(na(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(i){return o.shouldUseNativeValidation&&so({},o),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return Array.isArray(a?.issues)})(i))return{values:{},errors:ta(Lg(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,s,o){try{return Promise.resolve(na(function(){return Promise.resolve((r.mode==="sync"?Ig:Fg)(e,n,t)).then(function(i){return o.shouldUseNativeValidation&&so({},o),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return a instanceof jg})(i))return{values:{},errors:ta(Vg(i.issues,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}};throw new Error("Invalid input: not a Zod schema")}const Ug=ga("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 yl({className:e,variant:t,asChild:r=!1,...n}){const s=r?va:"span";return l.jsx(s,{"data-slot":"badge",className:oe(Ug({variant:t}),e),...n})}function Vs({className:e,...t}){return l.jsx("div",{"data-slot":"card",className:oe("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function $s({className:e,...t}){return l.jsx("div",{"data-slot":"card-content",className:oe("px-6",e),...t})}var gs="Dialog",[xl,dw]=st(gs),[Bg,ot]=xl(gs),bl=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,a=u.useRef(null),c=u.useRef(null),[d,f]=mt({prop:n,defaultProp:s??!1,onChange:o,caller:gs});return l.jsx(Bg,{scope:t,triggerRef:a,contentRef:c,contentId:Je(),titleId:Je(),descriptionId:Je(),open:d,onOpenChange:f,onOpenToggle:u.useCallback(()=>f(h=>!h),[f]),modal:i,children:r})};bl.displayName=gs;var wl="DialogTrigger",_l=u.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=ot(wl,r),o=se(t,s.triggerRef);return l.jsx(ee.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Zo(s.open),...n,ref:o,onClick:L(e.onClick,s.onOpenToggle)})});_l.displayName=wl;var Wo="DialogPortal",[zg,Cl]=xl(Wo,{forceMount:void 0}),Sl=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,o=ot(Wo,t);return l.jsx(zg,{scope:t,forceMount:r,children:u.Children.map(n,i=>l.jsx(Re,{present:r||o.open,children:l.jsx(Tr,{asChild:!0,container:s,children:i})}))})};Sl.displayName=Wo;var zn="DialogOverlay",El=u.forwardRef((e,t)=>{const r=Cl(zn,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=ot(zn,e.__scopeDialog);return o.modal?l.jsx(Re,{present:n||o.open,children:l.jsx(Hg,{...s,ref:t})}):null});El.displayName=zn;var Wg=qt("DialogOverlay.RemoveScroll"),Hg=u.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=ot(zn,r);return l.jsx(ln,{as:Wg,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(ee.div,{"data-state":Zo(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),Xt="DialogContent",Rl=u.forwardRef((e,t)=>{const r=Cl(Xt,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=ot(Xt,e.__scopeDialog);return l.jsx(Re,{present:n||o.open,children:o.modal?l.jsx(Zg,{...s,ref:t}):l.jsx(Gg,{...s,ref:t})})});Rl.displayName=Xt;var Zg=u.forwardRef((e,t)=>{const r=ot(Xt,e.__scopeDialog),n=u.useRef(null),s=se(t,r.contentRef,n);return u.useEffect(()=>{const o=n.current;if(o)return us(o)},[]),l.jsx(Pl,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:L(e.onCloseAutoFocus,o=>{o.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:L(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&o.preventDefault()}),onFocusOutside:L(e.onFocusOutside,o=>o.preventDefault())})}),Gg=u.forwardRef((e,t)=>{const r=ot(Xt,e.__scopeDialog),n=u.useRef(!1),s=u.useRef(!1);return l.jsx(Pl,{...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 i=o.target;r.triggerRef.current?.contains(i)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),Pl=u.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,a=ot(Xt,r),c=u.useRef(null),d=se(t,c);return ls(),l.jsxs(l.Fragment,{children:[l.jsx(cn,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(Er,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Zo(a.open),...i,ref:d,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(Kg,{titleId:a.titleId}),l.jsx(Yg,{contentRef:c,descriptionId:a.descriptionId})]})]})}),Ho="DialogTitle",Tl=u.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=ot(Ho,r);return l.jsx(ee.h2,{id:s.titleId,...n,ref:t})});Tl.displayName=Ho;var Al="DialogDescription",qg=u.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=ot(Al,r);return l.jsx(ee.p,{id:s.descriptionId,...n,ref:t})});qg.displayName=Al;var Ol="DialogClose",kl=u.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=ot(Ol,r);return l.jsx(ee.button,{type:"button",...n,ref:t,onClick:L(e.onClick,()=>s.onOpenChange(!1))})});kl.displayName=Ol;function Zo(e){return e?"open":"closed"}var Nl="DialogTitleWarning",[fw,jl]=bf(Nl,{contentName:Xt,titleName:Ho,docsSlug:"dialog"}),Kg=({titleId:e})=>{const t=jl(Nl),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 u.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Qg="DialogDescriptionWarning",Yg=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jl(Qg).contentName}}.`;return u.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Xg=bl,Jg=_l,ev=Sl,tv=El,rv=Rl,nv=Tl,sv=kl;function ov({...e}){return l.jsx(Xg,{"data-slot":"dialog",...e})}function iv({...e}){return l.jsx(Jg,{"data-slot":"dialog-trigger",...e})}function av({...e}){return l.jsx(ev,{"data-slot":"dialog-portal",...e})}function cv({className:e,...t}){return l.jsx(tv,{"data-slot":"dialog-overlay",className:oe("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 lv({className:e,children:t,showCloseButton:r=!0,...n}){return l.jsxs(av,{"data-slot":"dialog-portal",children:[l.jsx(cv,{}),l.jsxs(rv,{"data-slot":"dialog-content",className:oe("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&&l.jsxs(sv,{"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:[l.jsx(wo,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function uv({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:oe("flex flex-col gap-2 text-center sm:text-left",e),...t})}function dv({className:e,...t}){return l.jsx(nv,{"data-slot":"dialog-title",className:oe("text-lg leading-none font-semibold",e),...t})}function Ht({className:e,type:t,...r}){return l.jsx("input",{type:t,"data-slot":"input",className:oe("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","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",e),...r})}function oo(e,[t,r]){return Math.min(r,Math.max(t,e))}function fv(e){const t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var hv=[" ","Enter","ArrowUp","ArrowDown"],pv=[" ","Enter"],Jt="Select",[vs,ys,mv]=Mo(Jt),[Ar,hw]=st(Jt,[mv,$t]),xs=$t(),[gv,zt]=Ar(Jt),[vv,yv]=Ar(Jt),Ml=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:o,value:i,defaultValue:a,onValueChange:c,dir:d,name:f,autoComplete:h,disabled:p,required:g,form:b}=e,m=xs(t),[v,C]=u.useState(null),[x,S]=u.useState(null),[_,w]=u.useState(!1),T=dn(d),[R,k]=mt({prop:n,defaultProp:s??!1,onChange:o,caller:Jt}),[j,D]=mt({prop:i,defaultProp:a,onChange:c,caller:Jt}),G=u.useRef(null),$=v?b||!!v.closest("form"):!0,[N,U]=u.useState(new Set),J=Array.from(N).map(H=>H.props.value).join(";");return l.jsx(ss,{...m,children:l.jsxs(gv,{required:g,scope:t,trigger:v,onTriggerChange:C,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:_,onValueNodeHasChildrenChange:w,contentId:Je(),value:j,onValueChange:D,open:R,onOpenChange:k,dir:T,triggerPointerDownPosRef:G,disabled:p,children:[l.jsx(vs.Provider,{scope:t,children:l.jsx(vv,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(H=>{U(te=>new Set(te).add(H))},[]),onNativeOptionRemove:u.useCallback(H=>{U(te=>{const q=new Set(te);return q.delete(H),q})},[]),children:r})}),$?l.jsxs(ru,{"aria-hidden":!0,required:g,tabIndex:-1,name:f,autoComplete:h,value:j,onChange:H=>D(H.target.value),disabled:p,form:b,children:[j===void 0?l.jsx("option",{value:""}):null,Array.from(N)]},J):null]})})};Ml.displayName=Jt;var Il="SelectTrigger",Dl=u.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,o=xs(r),i=zt(Il,r),a=i.disabled||n,c=se(t,i.onTriggerChange),d=ys(r),f=u.useRef("touch"),[h,p,g]=su(m=>{const v=d().filter(S=>!S.disabled),C=v.find(S=>S.value===i.value),x=ou(v,m,C);x!==void 0&&i.onValueChange(x.value)}),b=m=>{a||(i.onOpenChange(!0),g()),m&&(i.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return l.jsx(on,{asChild:!0,...o,children:l.jsx(ee.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":nu(i.value)?"":void 0,...s,ref:c,onClick:L(s.onClick,m=>{m.currentTarget.focus(),f.current!=="mouse"&&b(m)}),onPointerDown:L(s.onPointerDown,m=>{f.current=m.pointerType;const v=m.target;v.hasPointerCapture(m.pointerId)&&v.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(b(m),m.preventDefault())}),onKeyDown:L(s.onKeyDown,m=>{const v=h.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&p(m.key),!(v&&m.key===" ")&&hv.includes(m.key)&&(b(),m.preventDefault())})})})});Dl.displayName=Il;var Fl="SelectValue",Ll=u.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:o,placeholder:i="",...a}=e,c=zt(Fl,r),{onValueNodeHasChildrenChange:d}=c,f=o!==void 0,h=se(t,c.onValueNodeChange);return Se(()=>{d(f)},[d,f]),l.jsx(ee.span,{...a,ref:h,style:{pointerEvents:"none"},children:nu(c.value)?l.jsx(l.Fragment,{children:i}):o})});Ll.displayName=Fl;var xv="SelectIcon",Vl=u.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return l.jsx(ee.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});Vl.displayName=xv;var bv="SelectPortal",$l=e=>l.jsx(Tr,{asChild:!0,...e});$l.displayName=bv;var er="SelectContent",Ul=u.forwardRef((e,t)=>{const r=zt(er,e.__scopeSelect),[n,s]=u.useState();if(Se(()=>{s(new DocumentFragment)},[]),!r.open){const o=n;return o?nn.createPortal(l.jsx(Bl,{scope:e.__scopeSelect,children:l.jsx(vs.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),o):null}return l.jsx(zl,{...e,ref:t})});Ul.displayName=er;var Ke=10,[Bl,Wt]=Ar(er),wv="SelectContentImpl",_v=qt("SelectContent.RemoveScroll"),zl=u.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:a,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:p,collisionPadding:g,sticky:b,hideWhenDetached:m,avoidCollisions:v,...C}=e,x=zt(er,r),[S,_]=u.useState(null),[w,T]=u.useState(null),R=se(t,W=>_(W)),[k,j]=u.useState(null),[D,G]=u.useState(null),$=ys(r),[N,U]=u.useState(!1),J=u.useRef(!1);u.useEffect(()=>{if(S)return us(S)},[S]),ls();const H=u.useCallback(W=>{const[ue,...xe]=$().map(pe=>pe.ref.current),[ae]=xe.slice(-1),fe=document.activeElement;for(const pe of W)if(pe===fe||(pe?.scrollIntoView({block:"nearest"}),pe===ue&&w&&(w.scrollTop=0),pe===ae&&w&&(w.scrollTop=w.scrollHeight),pe?.focus(),document.activeElement!==fe))return},[$,w]),te=u.useCallback(()=>H([k,S]),[H,k,S]);u.useEffect(()=>{N&&te()},[N,te]);const{onOpenChange:q,triggerPointerDownPosRef:V}=x;u.useEffect(()=>{if(S){let W={x:0,y:0};const ue=ae=>{W={x:Math.abs(Math.round(ae.pageX)-(V.current?.x??0)),y:Math.abs(Math.round(ae.pageY)-(V.current?.y??0))}},xe=ae=>{W.x<=10&&W.y<=10?ae.preventDefault():S.contains(ae.target)||q(!1),document.removeEventListener("pointermove",ue),V.current=null};return V.current!==null&&(document.addEventListener("pointermove",ue),document.addEventListener("pointerup",xe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ue),document.removeEventListener("pointerup",xe,{capture:!0})}}},[S,q,V]),u.useEffect(()=>{const W=()=>q(!1);return window.addEventListener("blur",W),window.addEventListener("resize",W),()=>{window.removeEventListener("blur",W),window.removeEventListener("resize",W)}},[q]);const[de,_e]=su(W=>{const ue=$().filter(fe=>!fe.disabled),xe=ue.find(fe=>fe.ref.current===document.activeElement),ae=ou(ue,W,xe);ae&&setTimeout(()=>ae.ref.current.focus())}),De=u.useCallback((W,ue,xe)=>{const ae=!J.current&&!xe;(x.value!==void 0&&x.value===ue||ae)&&(j(W),ae&&(J.current=!0))},[x.value]),Ue=u.useCallback(()=>S?.focus(),[S]),je=u.useCallback((W,ue,xe)=>{const ae=!J.current&&!xe;(x.value!==void 0&&x.value===ue||ae)&&G(W)},[x.value]),Be=n==="popper"?io:Wl,Pe=Be===io?{side:a,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:p,collisionPadding:g,sticky:b,hideWhenDetached:m,avoidCollisions:v}:{};return l.jsx(Bl,{scope:r,content:S,viewport:w,onViewportChange:T,itemRefCallback:De,selectedItem:k,onItemLeave:Ue,itemTextRefCallback:je,focusSelectedItem:te,selectedItemText:D,position:n,isPositioned:N,searchRef:de,children:l.jsx(ln,{as:_v,allowPinchZoom:!0,children:l.jsx(cn,{asChild:!0,trapped:x.open,onMountAutoFocus:W=>{W.preventDefault()},onUnmountAutoFocus:L(s,W=>{x.trigger?.focus({preventScroll:!0}),W.preventDefault()}),children:l.jsx(Er,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:W=>W.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:l.jsx(Be,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:W=>W.preventDefault(),...C,...Pe,onPlaced:()=>U(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:L(C.onKeyDown,W=>{const ue=W.ctrlKey||W.altKey||W.metaKey;if(W.key==="Tab"&&W.preventDefault(),!ue&&W.key.length===1&&_e(W.key),["ArrowUp","ArrowDown","Home","End"].includes(W.key)){let ae=$().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);if(["ArrowUp","End"].includes(W.key)&&(ae=ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(W.key)){const fe=W.target,pe=ae.indexOf(fe);ae=ae.slice(pe+1)}setTimeout(()=>H(ae)),W.preventDefault()}})})})})})})});zl.displayName=wv;var Cv="SelectItemAlignedPosition",Wl=u.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,o=zt(er,r),i=Wt(er,r),[a,c]=u.useState(null),[d,f]=u.useState(null),h=se(t,R=>f(R)),p=ys(r),g=u.useRef(!1),b=u.useRef(!0),{viewport:m,selectedItem:v,selectedItemText:C,focusSelectedItem:x}=i,S=u.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&d&&m&&v&&C){const R=o.trigger.getBoundingClientRect(),k=d.getBoundingClientRect(),j=o.valueNode.getBoundingClientRect(),D=C.getBoundingClientRect();if(o.dir!=="rtl"){const fe=D.left-k.left,pe=j.left-fe,Me=R.left-pe,it=R.width+Me,ir=Math.max(it,k.width),Or=window.innerWidth-Ke,kr=oo(pe,[Ke,Math.max(Ke,Or-ir)]);a.style.minWidth=it+"px",a.style.left=kr+"px"}else{const fe=k.right-D.right,pe=window.innerWidth-j.right-fe,Me=window.innerWidth-R.right-pe,it=R.width+Me,ir=Math.max(it,k.width),Or=window.innerWidth-Ke,kr=oo(pe,[Ke,Math.max(Ke,Or-ir)]);a.style.minWidth=it+"px",a.style.right=kr+"px"}const G=p(),$=window.innerHeight-Ke*2,N=m.scrollHeight,U=window.getComputedStyle(d),J=parseInt(U.borderTopWidth,10),H=parseInt(U.paddingTop,10),te=parseInt(U.borderBottomWidth,10),q=parseInt(U.paddingBottom,10),V=J+H+N+q+te,de=Math.min(v.offsetHeight*5,V),_e=window.getComputedStyle(m),De=parseInt(_e.paddingTop,10),Ue=parseInt(_e.paddingBottom,10),je=R.top+R.height/2-Ke,Be=$-je,Pe=v.offsetHeight/2,W=v.offsetTop+Pe,ue=J+H+W,xe=V-ue;if(ue<=je){const fe=G.length>0&&v===G[G.length-1].ref.current;a.style.bottom="0px";const pe=d.clientHeight-m.offsetTop-m.offsetHeight,Me=Math.max(Be,Pe+(fe?Ue:0)+pe+te),it=ue+Me;a.style.height=it+"px"}else{const fe=G.length>0&&v===G[0].ref.current;a.style.top="0px";const Me=Math.max(je,J+m.offsetTop+(fe?De:0)+Pe)+xe;a.style.height=Me+"px",m.scrollTop=ue-je+m.offsetTop}a.style.margin=`${Ke}px 0`,a.style.minHeight=de+"px",a.style.maxHeight=$+"px",n?.(),requestAnimationFrame(()=>g.current=!0)}},[p,o.trigger,o.valueNode,a,d,m,v,C,o.dir,n]);Se(()=>S(),[S]);const[_,w]=u.useState();Se(()=>{d&&w(window.getComputedStyle(d).zIndex)},[d]);const T=u.useCallback(R=>{R&&b.current===!0&&(S(),x?.(),b.current=!1)},[S,x]);return l.jsx(Ev,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:g,onScrollButtonChange:T,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:l.jsx(ee.div,{...s,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Wl.displayName=Cv;var Sv="SelectPopperPosition",io=u.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=Ke,...o}=e,i=xs(r);return l.jsx(os,{...i,...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)"}})});io.displayName=Sv;var[Ev,Go]=Ar(er,{}),ao="SelectViewport",Hl=u.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,o=Wt(ao,r),i=Go(ao,r),a=se(t,o.onViewportChange),c=u.useRef(0);return l.jsxs(l.Fragment,{children:[l.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}),l.jsx(vs.Slot,{scope:r,children:l.jsx(ee.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:L(s.onScroll,d=>{const f=d.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:p}=i;if(p?.current&&h){const g=Math.abs(c.current-f.scrollTop);if(g>0){const b=window.innerHeight-Ke*2,m=parseFloat(h.style.minHeight),v=parseFloat(h.style.height),C=Math.max(m,v);if(C<b){const x=C+g,S=Math.min(b,x),_=x-S;h.style.height=S+"px",h.style.bottom==="0px"&&(f.scrollTop=_>0?_:0,h.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});Hl.displayName=ao;var Zl="SelectGroup",[Rv,Pv]=Ar(Zl),Tv=u.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Je();return l.jsx(Rv,{scope:r,id:s,children:l.jsx(ee.div,{role:"group","aria-labelledby":s,...n,ref:t})})});Tv.displayName=Zl;var Gl="SelectLabel",Av=u.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Pv(Gl,r);return l.jsx(ee.div,{id:s.id,...n,ref:t})});Av.displayName=Gl;var Wn="SelectItem",[Ov,ql]=Ar(Wn),Kl=u.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...i}=e,a=zt(Wn,r),c=Wt(Wn,r),d=a.value===n,[f,h]=u.useState(o??""),[p,g]=u.useState(!1),b=se(t,x=>c.itemRefCallback?.(x,n,s)),m=Je(),v=u.useRef("touch"),C=()=>{s||(a.onValueChange(n),a.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 l.jsx(Ov,{scope:r,value:n,disabled:s,textId:m,isSelected:d,onItemTextChange:u.useCallback(x=>{h(S=>S||(x?.textContent??"").trim())},[]),children:l.jsx(vs.ItemSlot,{scope:r,value:n,disabled:s,textValue:f,children:l.jsx(ee.div,{role:"option","aria-labelledby":m,"data-highlighted":p?"":void 0,"aria-selected":d&&p,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:b,onFocus:L(i.onFocus,()=>g(!0)),onBlur:L(i.onBlur,()=>g(!1)),onClick:L(i.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:L(i.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:L(i.onPointerDown,x=>{v.current=x.pointerType}),onPointerMove:L(i.onPointerMove,x=>{v.current=x.pointerType,s?c.onItemLeave?.():v.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:L(i.onPointerLeave,x=>{x.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:L(i.onKeyDown,x=>{c.searchRef?.current!==""&&x.key===" "||(pv.includes(x.key)&&C(),x.key===" "&&x.preventDefault())})})})})});Kl.displayName=Wn;var Mr="SelectItemText",Ql=u.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...o}=e,i=zt(Mr,r),a=Wt(Mr,r),c=ql(Mr,r),d=yv(Mr,r),[f,h]=u.useState(null),p=se(t,C=>h(C),c.onItemTextChange,C=>a.itemTextRefCallback?.(C,c.value,c.disabled)),g=f?.textContent,b=u.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:m,onNativeOptionRemove:v}=d;return Se(()=>(m(b),()=>v(b)),[m,v,b]),l.jsxs(l.Fragment,{children:[l.jsx(ee.span,{id:c.textId,...o,ref:p}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?nn.createPortal(o.children,i.valueNode):null]})});Ql.displayName=Mr;var Yl="SelectItemIndicator",Xl=u.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return ql(Yl,r).isSelected?l.jsx(ee.span,{"aria-hidden":!0,...n,ref:t}):null});Xl.displayName=Yl;var co="SelectScrollUpButton",Jl=u.forwardRef((e,t)=>{const r=Wt(co,e.__scopeSelect),n=Go(co,e.__scopeSelect),[s,o]=u.useState(!1),i=se(t,n.onScrollButtonChange);return Se(()=>{if(r.viewport&&r.isPositioned){let a=function(){const d=c.scrollTop>0;o(d)};const c=r.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(tu,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});Jl.displayName=co;var lo="SelectScrollDownButton",eu=u.forwardRef((e,t)=>{const r=Wt(lo,e.__scopeSelect),n=Go(lo,e.__scopeSelect),[s,o]=u.useState(!1),i=se(t,n.onScrollButtonChange);return Se(()=>{if(r.viewport&&r.isPositioned){let a=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;o(f)};const c=r.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(tu,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});eu.displayName=lo;var tu=u.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,o=Wt("SelectScrollButton",r),i=u.useRef(null),a=ys(r),c=u.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),Se(()=>{a().find(f=>f.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[a]),l.jsx(ee.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:L(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:L(s.onPointerMove,()=>{o.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:L(s.onPointerLeave,()=>{c()})})}),kv="SelectSeparator",Nv=u.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return l.jsx(ee.div,{"aria-hidden":!0,...n,ref:t})});Nv.displayName=kv;var uo="SelectArrow",jv=u.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=xs(r),o=zt(uo,r),i=Wt(uo,r);return o.open&&i.position==="popper"?l.jsx(is,{...s,...n,ref:t}):null});jv.displayName=uo;var Mv="SelectBubbleInput",ru=u.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const s=u.useRef(null),o=se(n,s),i=fv(t);return u.useEffect(()=>{const a=s.current;if(!a)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&f){const h=new Event("change",{bubbles:!0});f.call(a,t),a.dispatchEvent(h)}},[i,t]),l.jsx(ee.select,{...r,style:{...ac,...r.style},ref:o,defaultValue:t})});ru.displayName=Mv;function nu(e){return e===""||e===void 0}function su(e){const t=Ce(e),r=u.useRef(""),n=u.useRef(0),s=u.useCallback(i=>{const a=r.current+i;t(a),(function c(d){r.current=d,window.clearTimeout(n.current),d!==""&&(n.current=window.setTimeout(()=>c(""),1e3))})(a)},[t]),o=u.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function ou(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 i=Iv(e,Math.max(o,0));s.length===1&&(i=i.filter(d=>d!==r));const c=i.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function Iv(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Dv=Ml,Fv=Dl,Lv=Ll,Vv=Vl,$v=$l,Uv=Ul,Bv=Hl,zv=Kl,Wv=Ql,Hv=Xl,Zv=Jl,Gv=eu;function sa({...e}){return l.jsx(Dv,{"data-slot":"select",...e})}function oa({...e}){return l.jsx(Lv,{"data-slot":"select-value",...e})}function ia({className:e,size:t="default",children:r,...n}){return l.jsxs(Fv,{"data-slot":"select-trigger","data-size":t,className:oe("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,l.jsx(Vv,{asChild:!0,children:l.jsx(Ma,{className:"size-4 opacity-50"})})]})}function aa({className:e,children:t,position:r="popper",...n}){return l.jsx($v,{children:l.jsxs(Uv,{"data-slot":"select-content",className:oe("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:[l.jsx(qv,{}),l.jsx(Bv,{className:oe("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),l.jsx(Kv,{})]})})}function ca({className:e,children:t,...r}){return l.jsxs(zv,{"data-slot":"select-item",className:oe("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:[l.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:l.jsx(Hv,{children:l.jsx(ef,{className:"size-4"})})}),l.jsx(Wv,{children:t})]})}function qv({className:e,...t}){return l.jsx(Zv,{"data-slot":"select-scroll-up-button",className:oe("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(cf,{className:"size-4"})})}function Kv({className:e,...t}){return l.jsx(Gv,{"data-slot":"select-scroll-down-button",className:oe("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Ma,{className:"size-4"})})}function Qv({className:e,...t}){return l.jsx("textarea",{"data-slot":"textarea",className:oe("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})}var Yv="Label",iu=u.forwardRef((e,t)=>l.jsx(ee.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));iu.displayName=Yv;var Xv=iu;function Jv({className:e,...t}){return l.jsx(Xv,{"data-slot":"label",className:oe("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}const ey=dg,au=u.createContext({}),wt=({...e})=>l.jsx(au.Provider,{value:{name:e.name},children:l.jsx(pg,{...e})}),qo=()=>{const e=u.useContext(au),t=u.useContext(cu),{getFieldState:r}=ms(),n=sl({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}},cu=u.createContext({});function _t({className:e,...t}){const r=u.useId();return l.jsx(cu.Provider,{value:{id:r},children:l.jsx("div",{"data-slot":"form-item",className:oe("grid gap-2",e),...t})})}function at({className:e,...t}){const{error:r,formItemId:n}=qo();return l.jsx(Jv,{"data-slot":"form-label","data-error":!!r,className:oe("data-[error=true]:text-destructive",e),htmlFor:n,...t})}function kt({...e}){const{error:t,formItemId:r,formDescriptionId:n,formMessageId:s}=qo();return l.jsx(va,{"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}=qo(),s=r?String(r?.message??""):t.children;return s?l.jsx("p",{"data-slot":"form-message",id:n,className:oe("text-destructive text-sm",e),...t,children:s}):null}const ty=e=>{const{isLoading:t,refetch:r,...n}=qs({queryKey:["product",e?.id],queryFn:async()=>e?(await pd(300),await We.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 i of s)o[i]=i;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(const a of o)i[a]=s[a];return e.objectValues(i)},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 i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},e.find=(s,o)=>{for(const i of s)if(o(i))return i},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(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(ie||(ie={}));var fo;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(fo||(fo={}));const z=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 z.undefined;case"string":return z.string;case"number":return Number.isNaN(e)?z.nan:z.number;case"boolean":return z.boolean;case"function":return z.function;case"bigint":return z.bigint;case"symbol":return z.symbol;case"object":return Array.isArray(e)?z.array:e===null?z.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?z.promise:typeof Map<"u"&&e instanceof Map?z.map:typeof Set<"u"&&e instanceof Set?z.set:typeof Date<"u"&&e instanceof Date?z.date:z.object;default:return z.unknown}},A=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"]),ry=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class $e 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 i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){const d=i.path[c];c===i.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(r(i))):a[d]=a[d]||{_errors:[]},a=a[d],c++}}};return s(this),n}static assert(t){if(!(t instanceof $e))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()}}$e.create=e=>new $e(e);const br=(e,t)=>{let r;switch(e.code){case A.invalid_type:e.received===z.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case A.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ie.jsonStringifyReplacer)}`;break;case A.unrecognized_keys:r=`Unrecognized key(s) in object: ${ie.joinValues(e.keys,", ")}`;break;case A.invalid_union:r="Invalid input";break;case A.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ie.joinValues(e.options)}`;break;case A.invalid_enum_value:r=`Invalid enum value. Expected ${ie.joinValues(e.options)}, received '${e.received}'`;break;case A.invalid_arguments:r="Invalid function arguments";break;case A.invalid_return_type:r="Invalid function return type";break;case A.invalid_date:r="Invalid date";break;case A.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 A.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 A.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 A.custom:r="Invalid input";break;case A.invalid_intersection_types:r="Intersection results could not be merged";break;case A.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case A.not_finite:r="Number must be finite";break;default:r=t.defaultError,ie.assertNever(e)}return{message:r}};let lu=br;function ny(e){lu=e}function Hn(){return lu}const Zn=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="";const c=n.filter(d=>!!d).slice().reverse();for(const d of c)a=d(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}},sy=[];function F(e,t){const r=Hn(),n=Zn({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===br?void 0:br].filter(s=>!!s)});e.common.issues.push(n)}class Ee{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 Y;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,i=await s.value;n.push({key:o,value:i})}return Ee.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return Y;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:t.value,value:n}}}const Y=Object.freeze({status:"aborted"}),hr=e=>({status:"dirty",value:e}),ke=e=>({status:"valid",value:e}),ho=e=>e.status==="aborted",po=e=>e.status==="dirty",tr=e=>e.status==="valid",Br=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 gt{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 la=(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 $e(e.common.issues);return this._error=r,this._error}}};function re(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:(i,a)=>{const{message:c}=e;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:s}}class ne{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 Ee,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(Br(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 la(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(Br(s)?s:Promise.resolve(s));return la(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 i=t(s),a=()=>o.addIssue({code:A.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!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 nt({schema:this,typeName:X.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 ht.create(this,this._def)}nullable(){return Vt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return et.create(this)}promise(){return _r.create(this,this._def)}or(t){return Zr.create([this,t],this._def)}and(t){return Gr.create(this,t,this._def)}transform(t){return new nt({...re(this._def),schema:this,typeName:X.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new Xr({...re(this._def),innerType:this,defaultValue:r,typeName:X.ZodDefault})}brand(){return new Ko({typeName:X.ZodBranded,type:this,...re(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new Jr({...re(this._def),innerType:this,catchValue:r,typeName:X.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return pn.create(this,t)}readonly(){return en.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const oy=/^c[^\s-]{8,}$/i,iy=/^[0-9a-z]+$/,ay=/^[0-9A-HJKMNP-TV-Z]{26}$/i,cy=/^[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,ly=/^[a-z0-9_-]{21}$/i,uy=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,dy=/^[-+]?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)?)??$/,fy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,hy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Us;const py=/^(?:(?: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])$/,my=/^(?:(?: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])$/,gy=/^(([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]))$/,vy=/^(([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])$/,yy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,xy=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,uu="((\\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])))",by=new RegExp(`^${uu}$`);function du(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 wy(e){return new RegExp(`^${du(e)}$`)}function fu(e){let t=`${uu}T${du(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 _y(e,t){return!!((t==="v4"||!t)&&py.test(e)||(t==="v6"||!t)&&gy.test(e))}function Cy(e,t){if(!uy.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 Sy(e,t){return!!((t==="v4"||!t)&&my.test(e)||(t==="v6"||!t)&&vy.test(e))}class Xe extends ne{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==z.string){const o=this._getOrReturnCtx(t);return F(o,{code:A.invalid_type,expected:z.string,received:o.parsedType}),Y}const n=new Ee;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(s=this._getOrReturnCtx(t,s),F(s,{code:A.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),F(s,{code:A.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,a=t.data.length<o.value;(i||a)&&(s=this._getOrReturnCtx(t,s),i?F(s,{code:A.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&F(s,{code:A.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")fy.test(t.data)||(s=this._getOrReturnCtx(t,s),F(s,{validation:"email",code:A.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")Us||(Us=new RegExp(hy,"u")),Us.test(t.data)||(s=this._getOrReturnCtx(t,s),F(s,{validation:"emoji",code:A.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")cy.test(t.data)||(s=this._getOrReturnCtx(t,s),F(s,{validation:"uuid",code:A.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")ly.test(t.data)||(s=this._getOrReturnCtx(t,s),F(s,{validation:"nanoid",code:A.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")oy.test(t.data)||(s=this._getOrReturnCtx(t,s),F(s,{validation:"cuid",code:A.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")iy.test(t.data)||(s=this._getOrReturnCtx(t,s),F(s,{validation:"cuid2",code:A.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")ay.test(t.data)||(s=this._getOrReturnCtx(t,s),F(s,{validation:"ulid",code:A.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),F(s,{validation:"url",code:A.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),F(s,{validation:"regex",code:A.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),F(s,{code:A.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),F(s,{code:A.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(s=this._getOrReturnCtx(t,s),F(s,{code:A.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?fu(o).test(t.data)||(s=this._getOrReturnCtx(t,s),F(s,{code:A.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?by.test(t.data)||(s=this._getOrReturnCtx(t,s),F(s,{code:A.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?wy(o).test(t.data)||(s=this._getOrReturnCtx(t,s),F(s,{code:A.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?dy.test(t.data)||(s=this._getOrReturnCtx(t,s),F(s,{validation:"duration",code:A.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?_y(t.data,o.version)||(s=this._getOrReturnCtx(t,s),F(s,{validation:"ip",code:A.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?Cy(t.data,o.alg)||(s=this._getOrReturnCtx(t,s),F(s,{validation:"jwt",code:A.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?Sy(t.data,o.version)||(s=this._getOrReturnCtx(t,s),F(s,{validation:"cidr",code:A.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?yy.test(t.data)||(s=this._getOrReturnCtx(t,s),F(s,{validation:"base64",code:A.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?xy.test(t.data)||(s=this._getOrReturnCtx(t,s),F(s,{validation:"base64url",code:A.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:A.invalid_string,...Z.errToObj(n)})}_addCheck(t){return new Xe({...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 Xe({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Xe({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Xe({...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}}Xe.create=e=>new Xe({checks:[],typeName:X.ZodString,coerce:e?.coerce??!1,...re(e)});function Ey(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(".","")),i=Number.parseInt(t.toFixed(s).replace(".",""));return o%i/10**s}class Dt extends ne{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)!==z.number){const o=this._getOrReturnCtx(t);return F(o,{code:A.invalid_type,expected:z.number,received:o.parsedType}),Y}let n;const s=new Ee;for(const o of this._def.checks)o.kind==="int"?ie.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),F(n,{code:A.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),F(n,{code:A.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),F(n,{code:A.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?Ey(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),F(n,{code:A.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),F(n,{code:A.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 Dt({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Z.toString(s)}]})}_addCheck(t){return new Dt({...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)}}Dt.create=e=>new Dt({checks:[],typeName:X.ZodNumber,coerce:e?.coerce||!1,...re(e)});class Ft extends ne{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)!==z.bigint)return this._getInvalidInput(t);let n;const s=new Ee;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),F(n,{code:A.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),F(n,{code:A.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),F(n,{code:A.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 F(r,{code:A.invalid_type,expected:z.bigint,received:r.parsedType}),Y}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 Ft({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Z.toString(s)}]})}_addCheck(t){return new Ft({...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}}Ft.create=e=>new Ft({checks:[],typeName:X.ZodBigInt,coerce:e?.coerce??!1,...re(e)});class zr extends ne{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==z.boolean){const n=this._getOrReturnCtx(t);return F(n,{code:A.invalid_type,expected:z.boolean,received:n.parsedType}),Y}return ke(t.data)}}zr.create=e=>new zr({typeName:X.ZodBoolean,coerce:e?.coerce||!1,...re(e)});class rr extends ne{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==z.date){const o=this._getOrReturnCtx(t);return F(o,{code:A.invalid_type,expected:z.date,received:o.parsedType}),Y}if(Number.isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return F(o,{code:A.invalid_date}),Y}const n=new Ee;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(s=this._getOrReturnCtx(t,s),F(s,{code:A.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),F(s,{code:A.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:X.ZodDate,...re(e)});class Gn extends ne{_parse(t){if(this._getType(t)!==z.symbol){const n=this._getOrReturnCtx(t);return F(n,{code:A.invalid_type,expected:z.symbol,received:n.parsedType}),Y}return ke(t.data)}}Gn.create=e=>new Gn({typeName:X.ZodSymbol,...re(e)});class Wr extends ne{_parse(t){if(this._getType(t)!==z.undefined){const n=this._getOrReturnCtx(t);return F(n,{code:A.invalid_type,expected:z.undefined,received:n.parsedType}),Y}return ke(t.data)}}Wr.create=e=>new Wr({typeName:X.ZodUndefined,...re(e)});class Hr extends ne{_parse(t){if(this._getType(t)!==z.null){const n=this._getOrReturnCtx(t);return F(n,{code:A.invalid_type,expected:z.null,received:n.parsedType}),Y}return ke(t.data)}}Hr.create=e=>new Hr({typeName:X.ZodNull,...re(e)});class wr extends ne{constructor(){super(...arguments),this._any=!0}_parse(t){return ke(t.data)}}wr.create=e=>new wr({typeName:X.ZodAny,...re(e)});class Gt extends ne{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ke(t.data)}}Gt.create=e=>new Gt({typeName:X.ZodUnknown,...re(e)});class At extends ne{_parse(t){const r=this._getOrReturnCtx(t);return F(r,{code:A.invalid_type,expected:z.never,received:r.parsedType}),Y}}At.create=e=>new At({typeName:X.ZodNever,...re(e)});class qn extends ne{_parse(t){if(this._getType(t)!==z.undefined){const n=this._getOrReturnCtx(t);return F(n,{code:A.invalid_type,expected:z.void,received:n.parsedType}),Y}return ke(t.data)}}qn.create=e=>new qn({typeName:X.ZodVoid,...re(e)});class et extends ne{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==z.array)return F(r,{code:A.invalid_type,expected:z.array,received:r.parsedType}),Y;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(i||a)&&(F(r,{code:i?A.too_big:A.too_small,minimum:a?s.exactLength.value:void 0,maximum:i?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&&(F(r,{code:A.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&&(F(r,{code:A.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((i,a)=>s.type._parseAsync(new gt(r,i,r.path,a)))).then(i=>Ee.mergeArray(n,i));const o=[...r.data].map((i,a)=>s.type._parseSync(new gt(r,i,r.path,a)));return Ee.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new et({...this._def,minLength:{value:t,message:Z.toString(r)}})}max(t,r){return new et({...this._def,maxLength:{value:t,message:Z.toString(r)}})}length(t,r){return new et({...this._def,exactLength:{value:t,message:Z.toString(r)}})}nonempty(t){return this.min(1,t)}}et.create=(e,t)=>new et({type:e,minLength:null,maxLength:null,exactLength:null,typeName:X.ZodArray,...re(t)});function fr(e){if(e instanceof me){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=ht.create(fr(n))}return new me({...e._def,shape:()=>t})}else return e instanceof et?new et({...e._def,type:fr(e.element)}):e instanceof ht?ht.create(fr(e.unwrap())):e instanceof Vt?Vt.create(fr(e.unwrap())):e instanceof vt?vt.create(e.items.map(t=>fr(t))):e}class me extends ne{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)!==z.object){const d=this._getOrReturnCtx(t);return F(d,{code:A.invalid_type,expected:z.object,received:d.parsedType}),Y}const{status:n,ctx:s}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof At&&this._def.unknownKeys==="strip"))for(const d in s.data)i.includes(d)||a.push(d);const c=[];for(const d of i){const f=o[d],h=s.data[d];c.push({key:{status:"valid",value:d},value:f._parse(new gt(s,h,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof At){const d=this._def.unknownKeys;if(d==="passthrough")for(const f of a)c.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(d==="strict")a.length>0&&(F(s,{code:A.unrecognized_keys,keys:a}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const f of a){const h=s.data[f];c.push({key:{status:"valid",value:f},value:d._parse(new gt(s,h,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const f of c){const h=await f.key,p=await f.value;d.push({key:h,value:p,alwaysSet:f.alwaysSet})}return d}).then(d=>Ee.mergeObjectSync(n,d)):Ee.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return Z.errToObj,new me({...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 me({...this._def,unknownKeys:"strip"})}passthrough(){return new me({...this._def,unknownKeys:"passthrough"})}extend(t){return new me({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new me({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:X.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new me({...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 me({...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 me({...this._def,shape:()=>r})}deepPartial(){return fr(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 me({...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 ht;)o=o._def.innerType;r[n]=o}return new me({...this._def,shape:()=>r})}keyof(){return hu(ie.objectKeys(this.shape))}}me.create=(e,t)=>new me({shape:()=>e,unknownKeys:"strip",catchall:At.create(),typeName:X.ZodObject,...re(t)});me.strictCreate=(e,t)=>new me({shape:()=>e,unknownKeys:"strict",catchall:At.create(),typeName:X.ZodObject,...re(t)});me.lazycreate=(e,t)=>new me({shape:e,unknownKeys:"strip",catchall:At.create(),typeName:X.ZodObject,...re(t)});class Zr extends ne{_parse(t){const{ctx:r}=this._processInputParams(t),n=this._def.options;function s(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(a=>new $e(a.ctx.common.issues));return F(r,{code:A.invalid_union,unionErrors:i}),Y}if(r.common.async)return Promise.all(n.map(async o=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o;const i=[];for(const c of n){const d={...r,common:{...r.common,issues:[]},parent:null},f=c._parseSync({data:r.data,path:r.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!o&&(o={result:f,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(c=>new $e(c));return F(r,{code:A.invalid_union,unionErrors:a}),Y}}get options(){return this._def.options}}Zr.create=(e,t)=>new Zr({options:e,typeName:X.ZodUnion,...re(t)});const St=e=>e instanceof Kr?St(e.schema):e instanceof nt?St(e.innerType()):e instanceof Qr?[e.value]:e instanceof Lt?e.options:e instanceof Yr?ie.objectValues(e.enum):e instanceof Xr?St(e._def.innerType):e instanceof Wr?[void 0]:e instanceof Hr?[null]:e instanceof ht?[void 0,...St(e.unwrap())]:e instanceof Vt?[null,...St(e.unwrap())]:e instanceof Ko||e instanceof en?St(e.unwrap()):e instanceof Jr?St(e._def.innerType):[];class bs extends ne{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==z.object)return F(r,{code:A.invalid_type,expected:z.object,received:r.parsedType}),Y;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}):(F(r,{code:A.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Y)}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 i=St(o.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of i){if(s.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);s.set(a,o)}}return new bs({typeName:X.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:s,...re(n)})}}function mo(e,t){const r=Et(e),n=Et(t);if(e===t)return{valid:!0,data:e};if(r===z.object&&n===z.object){const s=ie.objectKeys(t),o=ie.objectKeys(e).filter(a=>s.indexOf(a)!==-1),i={...e,...t};for(const a of o){const c=mo(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===z.array&&n===z.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o<e.length;o++){const i=e[o],a=t[o],c=mo(i,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===z.date&&n===z.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Gr extends ne{_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=(o,i)=>{if(ho(o)||ho(i))return Y;const a=mo(o.value,i.value);return a.valid?((po(o)||po(i))&&r.dirty(),{status:r.value,value:a.data}):(F(n,{code:A.invalid_intersection_types}),Y)};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,i])=>s(o,i)):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}))}}Gr.create=(e,t,r)=>new Gr({left:e,right:t,typeName:X.ZodIntersection,...re(r)});class vt extends ne{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==z.array)return F(n,{code:A.invalid_type,expected:z.array,received:n.parsedType}),Y;if(n.data.length<this._def.items.length)return F(n,{code:A.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Y;!this._def.rest&&n.data.length>this._def.items.length&&(F(n,{code:A.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const o=[...n.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new gt(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>Ee.mergeArray(r,i)):Ee.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new vt({...this._def,rest:t})}}vt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new vt({items:e,typeName:X.ZodTuple,rest:null,...re(t)})};class qr extends ne{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!==z.object)return F(n,{code:A.invalid_type,expected:z.object,received:n.parsedType}),Y;const s=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)s.push({key:o._parse(new gt(n,a,n.path,a)),value:i._parse(new gt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Ee.mergeObjectAsync(r,s):Ee.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof ne?new qr({keyType:t,valueType:r,typeName:X.ZodRecord,...re(n)}):new qr({keyType:Xe.create(),valueType:t,typeName:X.ZodRecord,...re(r)})}}class Kn extends ne{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!==z.map)return F(n,{code:A.invalid_type,expected:z.map,received:n.parsedType}),Y;const s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,c],d)=>({key:s._parse(new gt(n,a,n.path,[d,"key"])),value:o._parse(new gt(n,c,n.path,[d,"value"]))}));if(n.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of i){const d=await c.key,f=await c.value;if(d.status==="aborted"||f.status==="aborted")return Y;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(d.value,f.value)}return{status:r.value,value:a}})}else{const a=new Map;for(const c of i){const d=c.key,f=c.value;if(d.status==="aborted"||f.status==="aborted")return Y;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(d.value,f.value)}return{status:r.value,value:a}}}}Kn.create=(e,t,r)=>new Kn({valueType:t,keyType:e,typeName:X.ZodMap,...re(r)});class nr extends ne{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==z.set)return F(n,{code:A.invalid_type,expected:z.set,received:n.parsedType}),Y;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(F(n,{code:A.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&&(F(n,{code:A.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const o=this._def.valueType;function i(c){const d=new Set;for(const f of c){if(f.status==="aborted")return Y;f.status==="dirty"&&r.dirty(),d.add(f.value)}return{status:r.value,value:d}}const a=[...n.data.values()].map((c,d)=>o._parse(new gt(n,c,n.path,d)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}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:X.ZodSet,...re(t)});class gr extends ne{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==z.function)return F(r,{code:A.invalid_type,expected:z.function,received:r.parsedType}),Y;function n(a,c){return Zn({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Hn(),br].filter(d=>!!d),issueData:{code:A.invalid_arguments,argumentsError:c}})}function s(a,c){return Zn({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Hn(),br].filter(d=>!!d),issueData:{code:A.invalid_return_type,returnTypeError:c}})}const o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof _r){const a=this;return ke(async function(...c){const d=new $e([]),f=await a._def.args.parseAsync(c,o).catch(g=>{throw d.addIssue(n(c,g)),d}),h=await Reflect.apply(i,this,f);return await a._def.returns._def.type.parseAsync(h,o).catch(g=>{throw d.addIssue(s(h,g)),d})})}else{const a=this;return ke(function(...c){const d=a._def.args.safeParse(c,o);if(!d.success)throw new $e([n(c,d.error)]);const f=Reflect.apply(i,this,d.data),h=a._def.returns.safeParse(f,o);if(!h.success)throw new $e([s(f,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new gr({...this._def,args:vt.create(t).rest(Gt.create())})}returns(t){return new gr({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new gr({args:t||vt.create([]).rest(Gt.create()),returns:r||Gt.create(),typeName:X.ZodFunction,...re(n)})}}class Kr extends ne{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})}}Kr.create=(e,t)=>new Kr({getter:e,typeName:X.ZodLazy,...re(t)});class Qr extends ne{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return F(r,{received:r.data,code:A.invalid_literal,expected:this._def.value}),Y}return{status:"valid",value:t.data}}get value(){return this._def.value}}Qr.create=(e,t)=>new Qr({value:e,typeName:X.ZodLiteral,...re(t)});function hu(e,t){return new Lt({values:e,typeName:X.ZodEnum,...re(t)})}class Lt extends ne{_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return F(r,{expected:ie.joinValues(n),received:r.parsedType,code:A.invalid_type}),Y}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 F(r,{received:r.data,code:A.invalid_enum_value,options:n}),Y}return ke(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 Lt.create(t,{...this._def,...r})}exclude(t,r=this._def){return Lt.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}Lt.create=hu;class Yr extends ne{_parse(t){const r=ie.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==z.string&&n.parsedType!==z.number){const s=ie.objectValues(r);return F(n,{expected:ie.joinValues(s),received:n.parsedType,code:A.invalid_type}),Y}if(this._cache||(this._cache=new Set(ie.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=ie.objectValues(r);return F(n,{received:n.data,code:A.invalid_enum_value,options:s}),Y}return ke(t.data)}get enum(){return this._def.values}}Yr.create=(e,t)=>new Yr({values:e,typeName:X.ZodNativeEnum,...re(t)});class _r extends ne{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==z.promise&&r.common.async===!1)return F(r,{code:A.invalid_type,expected:z.promise,received:r.parsedType}),Y;const n=r.parsedType===z.promise?r.data:Promise.resolve(r.data);return ke(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}_r.create=(e,t)=>new _r({type:e,typeName:X.ZodPromise,...re(t)});class nt extends ne{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===X.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:i=>{F(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return Y;const c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Y:c.status==="dirty"||r.value==="dirty"?hr(c.value):c});{if(r.value==="aborted")return Y;const a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?Y:a.status==="dirty"||r.value==="dirty"?hr(a.value):a}}if(s.type==="refinement"){const i=a=>{const c=s.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Y:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Y:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!tr(i))return Y;const a=s.transform(i.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>tr(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):Y);ie.assertNever(s)}}nt.create=(e,t,r)=>new nt({schema:e,typeName:X.ZodEffects,effect:t,...re(r)});nt.createWithPreprocess=(e,t,r)=>new nt({schema:t,effect:{type:"preprocess",transform:e},typeName:X.ZodEffects,...re(r)});class ht extends ne{_parse(t){return this._getType(t)===z.undefined?ke(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ht.create=(e,t)=>new ht({innerType:e,typeName:X.ZodOptional,...re(t)});class Vt extends ne{_parse(t){return this._getType(t)===z.null?ke(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Vt.create=(e,t)=>new Vt({innerType:e,typeName:X.ZodNullable,...re(t)});class Xr extends ne{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Xr.create=(e,t)=>new Xr({innerType:e,typeName:X.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...re(t)});class Jr extends ne{_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 Br(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new $e(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new $e(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Jr.create=(e,t)=>new Jr({innerType:e,typeName:X.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...re(t)});class Qn extends ne{_parse(t){if(this._getType(t)!==z.nan){const n=this._getOrReturnCtx(t);return F(n,{code:A.invalid_type,expected:z.nan,received:n.parsedType}),Y}return{status:"valid",value:t.data}}}Qn.create=e=>new Qn({typeName:X.ZodNaN,...re(e)});const Ry=Symbol("zod_brand");class Ko extends ne{_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 pn extends ne{_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"?Y:o.status==="dirty"?(r.dirty(),hr(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"?Y: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 pn({in:t,out:r,typeName:X.ZodPipeline})}}class en extends ne{_parse(t){const r=this._def.innerType._parse(t),n=s=>(tr(s)&&(s.value=Object.freeze(s.value)),s);return Br(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}en.create=(e,t)=>new en({innerType:e,typeName:X.ZodReadonly,...re(t)});function ua(e,t){const r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function pu(e,t={},r){return e?wr.create().superRefine((n,s)=>{const o=e(n);if(o instanceof Promise)return o.then(i=>{if(!i){const a=ua(t,n),c=a.fatal??r??!0;s.addIssue({code:"custom",...a,fatal:c})}});if(!o){const i=ua(t,n),a=i.fatal??r??!0;s.addIssue({code:"custom",...i,fatal:a})}}):wr.create()}const Py={object:me.lazycreate};var X;(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"})(X||(X={}));const Ty=(e,t={message:`Input not instance of ${e.name}`})=>pu(r=>r instanceof e,t),mu=Xe.create,gu=Dt.create,Ay=Qn.create,Oy=Ft.create,vu=zr.create,ky=rr.create,Ny=Gn.create,jy=Wr.create,My=Hr.create,Iy=wr.create,Dy=Gt.create,Fy=At.create,Ly=qn.create,Vy=et.create,$y=me.create,Uy=me.strictCreate,By=Zr.create,zy=bs.create,Wy=Gr.create,Hy=vt.create,Zy=qr.create,Gy=Kn.create,qy=nr.create,Ky=gr.create,Qy=Kr.create,Yy=Qr.create,Xy=Lt.create,Jy=Yr.create,ex=_r.create,da=nt.create,tx=ht.create,rx=Vt.create,nx=nt.createWithPreprocess,sx=pn.create,ox=()=>mu().optional(),ix=()=>gu().optional(),ax=()=>vu().optional(),cx={string:(e=>Xe.create({...e,coerce:!0})),number:(e=>Dt.create({...e,coerce:!0})),boolean:(e=>zr.create({...e,coerce:!0})),bigint:(e=>Ft.create({...e,coerce:!0})),date:(e=>rr.create({...e,coerce:!0}))},lx=Y,Te=Object.freeze(Object.defineProperty({__proto__:null,BRAND:Ry,DIRTY:hr,EMPTY_PATH:sy,INVALID:Y,NEVER:lx,OK:ke,ParseStatus:Ee,Schema:ne,ZodAny:wr,ZodArray:et,ZodBigInt:Ft,ZodBoolean:zr,ZodBranded:Ko,ZodCatch:Jr,ZodDate:rr,ZodDefault:Xr,ZodDiscriminatedUnion:bs,ZodEffects:nt,ZodEnum:Lt,ZodError:$e,get ZodFirstPartyTypeKind(){return X},ZodFunction:gr,ZodIntersection:Gr,ZodIssueCode:A,ZodLazy:Kr,ZodLiteral:Qr,ZodMap:Kn,ZodNaN:Qn,ZodNativeEnum:Yr,ZodNever:At,ZodNull:Hr,ZodNullable:Vt,ZodNumber:Dt,ZodObject:me,ZodOptional:ht,ZodParsedType:z,ZodPipeline:pn,ZodPromise:_r,ZodReadonly:en,ZodRecord:qr,ZodSchema:ne,ZodSet:nr,ZodString:Xe,ZodSymbol:Gn,ZodTransformer:nt,ZodTuple:vt,ZodType:ne,ZodUndefined:Wr,ZodUnion:Zr,ZodUnknown:Gt,ZodVoid:qn,addIssueToContext:F,any:Iy,array:Vy,bigint:Oy,boolean:vu,coerce:cx,custom:pu,date:ky,datetimeRegex:fu,defaultErrorMap:br,discriminatedUnion:zy,effect:da,enum:Xy,function:Ky,getErrorMap:Hn,getParsedType:Et,instanceof:Ty,intersection:Wy,isAborted:ho,isAsync:Br,isDirty:po,isValid:tr,late:Py,lazy:Qy,literal:Yy,makeIssue:Zn,map:Gy,nan:Ay,nativeEnum:Jy,never:Fy,null:My,nullable:rx,number:gu,object:$y,get objectUtil(){return fo},oboolean:ax,onumber:ix,optional:tx,ostring:ox,pipeline:sx,preprocess:nx,promise:ex,quotelessJson:ry,record:Zy,set:qy,setErrorMap:ny,strictObject:Uy,string:mu,symbol:Ny,transformer:da,tuple:Hy,undefined:jy,union:By,unknown:Dy,get util(){return ie},void:Ly},Symbol.toStringTag,{value:"Module"})),ux=Te.object({images:Te.array(Te.string()).min(1,"At least 1 image is required"),title:Te.string().min(1,"Product title is required").min(5,"Product title must be at least 5 characters"),price:Te.preprocess(e=>typeof e=="string"?Number(e):e,Te.number({invalid_type_error:"Price must be a number",required_error:"Price is required"}).min(1,"Price must be greater than 0")),category:Te.string().min(1,"Category is required"),condition:Te.string().min(1,"Condition is required"),brand:Te.string().optional(),description:Te.string().min(1,"Description is required").min(20,"Description must be at least 20 characters"),tags:Te.array(Te.string()).optional(),sku:Te.string().min(1,"Sku must be required"),location:Te.string().optional(),publist:Te.boolean().optional()});function dx({children:e,data:t,...r}){const[n,s]=u.useState(!1),[o,i]=u.useState(""),[a,c]=u.useState(""),d=Tg({resolver:$g(ux),defaultValues:{images:[],title:"",price:0,category:"",condition:"",brand:"",description:"",tags:[],sku:"",location:"",publist:!1}}),f=d.watch("images"),h=d.watch("tags"),p=["New","Used - like new","Used - good","Used - fair"],g=["Tools","Electronics & computers"],{refetch:b,...m}=ty(t),v=()=>{if(o.trim()&&!h?.includes(o.trim())){const w=d.getValues("tags")||[];d.setValue("tags",[...w,o.trim()]),i("")}},C=w=>{const T=d.getValues("tags")||[];d.setValue("tags",T.filter(R=>R!==w))},x=async({images:w,...T})=>{try{let R=[];if(t){const D=t.images||[];R=(w||[]).filter($=>!D.includes($))}else R=w||[];const k=await Promise.all(R.map(async D=>D.startsWith("blob:")?await gd(D):D)),j={...T,images:k};console.log("Product data to submit:",j),console.log("Hình mới cần xử lý:",k)}catch(R){console.error("Error submitting form:",R)}},S=()=>{s(!1),d.reset(),c(""),i("")},_=Na({mutationKey:["createBlobUrl",t?.sku],mutationFn:w=>We.apiRequest("createBlobUrl",w)});return u.useEffect(()=>{(async()=>{if(!m.data?.data||!t)return;const w=Bs({...m.data?.data}).images,T=await _.mutateAsync(w),R={...t,images:T};d.reset(R)})()},[m.data,t]),l.jsxs(ov,{open:n,onOpenChange:s,children:[l.jsx(iv,{asChild:!0,children:e}),l.jsxs(lv,{"aria-describedby":void 0,className:"md:max-w-4xl h-[95vh] flex flex-col p-0",children:[l.jsx(uv,{className:"p-6 border-b",children:l.jsx(dv,{className:"text-2xl font-bold",children:t?"Edit product":"Create new product"})}),!m.isLoading&&!_.isPending&&l.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:l.jsx(ey,{...d,children:l.jsxs("form",{onSubmit:d.handleSubmit(x),className:"space-y-8",children:[l.jsx(Vs,{children:l.jsx($s,{className:"p-6",children:l.jsx(wt,{control:d.control,name:"images",render:()=>l.jsxs(_t,{children:[l.jsx(at,{className:"text-lg font-semibold",children:"Images *"}),l.jsx(Ct,{}),f.length>0&&l.jsx("div",{className:"mt-6 overflow-x-auto",children:l.jsx("div",{className:"flex gap-3",children:f.map((w,T)=>l.jsx("div",{className:"relative flex-shrink-0 w-32 h-32 group rounded-lg border overflow-hidden",children:l.jsx("img",{src:w||"/placeholder.svg",alt:`Preview ${T+1}`,className:"w-full h-full object-cover"})},T))})})]})})})}),l.jsx(Vs,{children:l.jsxs($s,{className:"p-6 space-y-6",children:[l.jsx("h3",{className:"text-lg font-semibold border-b pb-2",children:"Product information"}),l.jsx(wt,{control:d.control,name:"title",render:({field:w})=>l.jsxs(_t,{children:[l.jsx(at,{children:"Title *"}),l.jsx(kt,{children:l.jsx(Ht,{placeholder:"VD: MacBook Pro 14-inch 2023",...w})}),l.jsx(Ct,{})]})}),l.jsx(wt,{control:d.control,name:"price",render:({field:w})=>l.jsxs(_t,{children:[l.jsx(at,{children:"Price ($) *"}),l.jsx(kt,{children:l.jsx(Ht,{type:"number",placeholder:"10",...w})}),l.jsx(Ct,{})]})}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[l.jsx(wt,{control:d.control,name:"category",render:({field:w})=>l.jsxs(_t,{children:[l.jsx(at,{children:"Category *"}),l.jsx(kt,{children:l.jsxs(sa,{onValueChange:w.onChange,value:w.value,children:[l.jsx(ia,{className:"w-full",children:l.jsx(oa,{placeholder:"Select category"})}),l.jsx(aa,{children:g.map(T=>l.jsx(ca,{value:T.toLowerCase(),children:T},T))})]})}),l.jsx(Ct,{})]})}),l.jsx(wt,{control:d.control,name:"condition",render:({field:w})=>l.jsxs(_t,{children:[l.jsx(at,{children:"Condition *"}),l.jsx(kt,{children:l.jsxs(sa,{onValueChange:w.onChange,value:w.value,children:[l.jsx(ia,{className:"w-full",children:l.jsx(oa,{placeholder:"Select condition"})}),l.jsx(aa,{children:p.map(T=>l.jsx(ca,{value:T.toLowerCase(),children:T},T))})]})}),l.jsx(Ct,{})]})}),l.jsx(wt,{control:d.control,name:"brand",render:({field:w})=>l.jsxs(_t,{children:[l.jsx(at,{children:"Brand"}),l.jsx(kt,{children:l.jsx(Ht,{readOnly:!!t,placeholder:"VD: Cisco",...w})}),l.jsx(Ct,{})]})})]}),l.jsx(wt,{control:d.control,name:"description",render:({field:w})=>l.jsxs(_t,{children:[l.jsx(at,{children:"Description *"}),l.jsx(kt,{children:l.jsx(Qv,{rows:4,...w})}),l.jsx(Ct,{})]})})]})}),l.jsx(Vs,{children:l.jsxs($s,{className:"p-6 space-y-6",children:[l.jsx("h3",{className:"text-lg font-semibold border-b pb-2",children:"Additional information"}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(at,{children:"Tags"}),l.jsx("div",{className:"flex gap-2",children:l.jsx(Ht,{value:o,onChange:w=>i(w.target.value),placeholder:"Tag and press Enter",onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),v())}})}),h&&h?.length>0&&l.jsx("div",{className:"flex flex-wrap gap-2",children:h.map(w=>l.jsxs(yl,{onClick:()=>C(w),variant:"secondary",className:"flex items-center gap-1 px-3 py-1",children:[w,l.jsx(wo,{className:"w-3 h-3 cursor-pointer hover:text-red-500"})]},w))})]}),l.jsx(wt,{control:d.control,name:"sku",render:({field:w})=>l.jsxs(_t,{children:[l.jsx(at,{children:"Sku *"}),l.jsx(kt,{children:l.jsx(Ht,{readOnly:!!t,placeholder:"VD: MBP14-2023-512GB",...w})}),l.jsx(Ct,{})]})}),l.jsx(wt,{control:d.control,name:"location",render:({field:w})=>l.jsxs(_t,{children:[l.jsx(at,{children:"Location"}),l.jsx(kt,{children:l.jsx(Ht,{placeholder:"VD: Hà Nội, Việt Nam",...w})}),l.jsx(Ct,{})]})})]})})]})})}),(m.isLoading||_.isPending)&&l.jsx("div",{className:"flex items-center justify-center w-full h-full",children:l.jsx(Jc,{})}),l.jsx("div",{className:"p-6 border-t bg-white flex justify-end gap-3",children:l.jsx(ct,{type:"button",variant:"outline",onClick:S,children:"Close"})})]})]})}var go=["Enter"," "],fx=["ArrowDown","PageUp","Home"],yu=["ArrowUp","PageDown","End"],hx=[...fx,...yu],px={ltr:[...go,"ArrowRight"],rtl:[...go,"ArrowLeft"]},mx={ltr:["ArrowLeft"],rtl:["ArrowRight"]},mn="Menu",[tn,gx,vx]=Mo(mn),[sr,xu]=st(mn,[vx,$t,hs]),ws=$t(),bu=hs(),[yx,or]=sr(mn),[xx,gn]=sr(mn),wu=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:s,onOpenChange:o,modal:i=!0}=e,a=ws(t),[c,d]=u.useState(null),f=u.useRef(!1),h=Ce(o),p=dn(s);return u.useEffect(()=>{const g=()=>{f.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>f.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),l.jsx(ss,{...a,children:l.jsx(yx,{scope:t,open:r,onOpenChange:h,content:c,onContentChange:d,children:l.jsx(xx,{scope:t,onClose:u.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:p,modal:i,children:n})})})};wu.displayName=mn;var bx="MenuAnchor",Qo=u.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=ws(r);return l.jsx(on,{...s,...n,ref:t})});Qo.displayName=bx;var Yo="MenuPortal",[wx,_u]=sr(Yo,{forceMount:void 0}),Cu=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:s}=e,o=or(Yo,t);return l.jsx(wx,{scope:t,forceMount:r,children:l.jsx(Re,{present:r||o.open,children:l.jsx(Tr,{asChild:!0,container:s,children:n})})})};Cu.displayName=Yo;var Ze="MenuContent",[_x,Xo]=sr(Ze),Su=u.forwardRef((e,t)=>{const r=_u(Ze,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=or(Ze,e.__scopeMenu),i=gn(Ze,e.__scopeMenu);return l.jsx(tn.Provider,{scope:e.__scopeMenu,children:l.jsx(Re,{present:n||o.open,children:l.jsx(tn.Slot,{scope:e.__scopeMenu,children:i.modal?l.jsx(Cx,{...s,ref:t}):l.jsx(Sx,{...s,ref:t})})})})}),Cx=u.forwardRef((e,t)=>{const r=or(Ze,e.__scopeMenu),n=u.useRef(null),s=se(t,n);return u.useEffect(()=>{const o=n.current;if(o)return us(o)},[]),l.jsx(Jo,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:L(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Sx=u.forwardRef((e,t)=>{const r=or(Ze,e.__scopeMenu);return l.jsx(Jo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Ex=qt("MenuContent.ScrollLock"),Jo=u.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:p,onDismiss:g,disableOutsideScroll:b,...m}=e,v=or(Ze,r),C=gn(Ze,r),x=ws(r),S=bu(r),_=gx(r),[w,T]=u.useState(null),R=u.useRef(null),k=se(t,R,v.onContentChange),j=u.useRef(0),D=u.useRef(""),G=u.useRef(0),$=u.useRef(null),N=u.useRef("right"),U=u.useRef(0),J=b?ln:u.Fragment,H=b?{as:Ex,allowPinchZoom:!0}:void 0,te=V=>{const de=D.current+V,_e=_().filter(W=>!W.disabled),De=document.activeElement,Ue=_e.find(W=>W.ref.current===De)?.textValue,je=_e.map(W=>W.textValue),Be=Fx(je,de,Ue),Pe=_e.find(W=>W.textValue===Be)?.ref.current;(function W(ue){D.current=ue,window.clearTimeout(j.current),ue!==""&&(j.current=window.setTimeout(()=>W(""),1e3))})(de),Pe&&setTimeout(()=>Pe.focus())};u.useEffect(()=>()=>window.clearTimeout(j.current),[]),ls();const q=u.useCallback(V=>N.current===$.current?.side&&Vx(V,$.current?.area),[]);return l.jsx(_x,{scope:r,searchRef:D,onItemEnter:u.useCallback(V=>{q(V)&&V.preventDefault()},[q]),onItemLeave:u.useCallback(V=>{q(V)||(R.current?.focus(),T(null))},[q]),onTriggerLeave:u.useCallback(V=>{q(V)&&V.preventDefault()},[q]),pointerGraceTimerRef:G,onPointerGraceIntentChange:u.useCallback(V=>{$.current=V},[]),children:l.jsx(J,{...H,children:l.jsx(cn,{asChild:!0,trapped:s,onMountAutoFocus:L(o,V=>{V.preventDefault(),R.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:l.jsx(Er,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:p,onDismiss:g,children:l.jsx(Bc,{asChild:!0,...S,dir:C.dir,orientation:"vertical",loop:n,currentTabStopId:w,onCurrentTabStopIdChange:T,onEntryFocus:L(c,V=>{C.isUsingKeyboardRef.current||V.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(os,{role:"menu","aria-orientation":"vertical","data-state":$u(v.open),"data-radix-menu-content":"",dir:C.dir,...x,...m,ref:k,style:{outline:"none",...m.style},onKeyDown:L(m.onKeyDown,V=>{const _e=V.target.closest("[data-radix-menu-content]")===V.currentTarget,De=V.ctrlKey||V.altKey||V.metaKey,Ue=V.key.length===1;_e&&(V.key==="Tab"&&V.preventDefault(),!De&&Ue&&te(V.key));const je=R.current;if(V.target!==je||!hx.includes(V.key))return;V.preventDefault();const Pe=_().filter(W=>!W.disabled).map(W=>W.ref.current);yu.includes(V.key)&&Pe.reverse(),Ix(Pe)}),onBlur:L(e.onBlur,V=>{V.currentTarget.contains(V.target)||(window.clearTimeout(j.current),D.current="")}),onPointerMove:L(e.onPointerMove,rn(V=>{const de=V.target,_e=U.current!==V.clientX;if(V.currentTarget.contains(de)&&_e){const De=V.clientX>U.current?"right":"left";N.current=De,U.current=V.clientX}}))})})})})})})});Su.displayName=Ze;var Rx="MenuGroup",ei=u.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(ee.div,{role:"group",...n,ref:t})});ei.displayName=Rx;var Px="MenuLabel",Eu=u.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(ee.div,{...n,ref:t})});Eu.displayName=Px;var Yn="MenuItem",fa="menu.itemSelect",_s=u.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...s}=e,o=u.useRef(null),i=gn(Yn,e.__scopeMenu),a=Xo(Yn,e.__scopeMenu),c=se(t,o),d=u.useRef(!1),f=()=>{const h=o.current;if(!r&&h){const p=new CustomEvent(fa,{bubbles:!0,cancelable:!0});h.addEventListener(fa,g=>n?.(g),{once:!0}),Fa(h,p),p.defaultPrevented?d.current=!1:i.onClose()}};return l.jsx(Ru,{...s,ref:c,disabled:r,onClick:L(e.onClick,f),onPointerDown:h=>{e.onPointerDown?.(h),d.current=!0},onPointerUp:L(e.onPointerUp,h=>{d.current||h.currentTarget?.click()}),onKeyDown:L(e.onKeyDown,h=>{const p=a.searchRef.current!=="";r||p&&h.key===" "||go.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});_s.displayName=Yn;var Ru=u.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...o}=e,i=Xo(Yn,r),a=bu(r),c=u.useRef(null),d=se(t,c),[f,h]=u.useState(!1),[p,g]=u.useState("");return u.useEffect(()=>{const b=c.current;b&&g((b.textContent??"").trim())},[o.children]),l.jsx(tn.ItemSlot,{scope:r,disabled:n,textValue:s??p,children:l.jsx(zc,{asChild:!0,...a,focusable:!n,children:l.jsx(ee.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:d,onPointerMove:L(e.onPointerMove,rn(b=>{n?i.onItemLeave(b):(i.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:L(e.onPointerLeave,rn(b=>i.onItemLeave(b))),onFocus:L(e.onFocus,()=>h(!0)),onBlur:L(e.onBlur,()=>h(!1))})})})}),Tx="MenuCheckboxItem",Pu=u.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...s}=e;return l.jsx(Nu,{scope:e.__scopeMenu,checked:r,children:l.jsx(_s,{role:"menuitemcheckbox","aria-checked":Xn(r)?"mixed":r,...s,ref:t,"data-state":ri(r),onSelect:L(s.onSelect,()=>n?.(Xn(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Pu.displayName=Tx;var Tu="MenuRadioGroup",[Ax,Ox]=sr(Tu,{value:void 0,onValueChange:()=>{}}),Au=u.forwardRef((e,t)=>{const{value:r,onValueChange:n,...s}=e,o=Ce(n);return l.jsx(Ax,{scope:e.__scopeMenu,value:r,onValueChange:o,children:l.jsx(ei,{...s,ref:t})})});Au.displayName=Tu;var Ou="MenuRadioItem",ku=u.forwardRef((e,t)=>{const{value:r,...n}=e,s=Ox(Ou,e.__scopeMenu),o=r===s.value;return l.jsx(Nu,{scope:e.__scopeMenu,checked:o,children:l.jsx(_s,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":ri(o),onSelect:L(n.onSelect,()=>s.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});ku.displayName=Ou;var ti="MenuItemIndicator",[Nu,kx]=sr(ti,{checked:!1}),ju=u.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...s}=e,o=kx(ti,r);return l.jsx(Re,{present:n||Xn(o.checked)||o.checked===!0,children:l.jsx(ee.span,{...s,ref:t,"data-state":ri(o.checked)})})});ju.displayName=ti;var Nx="MenuSeparator",Mu=u.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(ee.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});Mu.displayName=Nx;var jx="MenuArrow",Iu=u.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=ws(r);return l.jsx(is,{...s,...n,ref:t})});Iu.displayName=jx;var Mx="MenuSub",[pw,Du]=sr(Mx),Ir="MenuSubTrigger",Fu=u.forwardRef((e,t)=>{const r=or(Ir,e.__scopeMenu),n=gn(Ir,e.__scopeMenu),s=Du(Ir,e.__scopeMenu),o=Xo(Ir,e.__scopeMenu),i=u.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=o,d={__scopeMenu:e.__scopeMenu},f=u.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return u.useEffect(()=>f,[f]),u.useEffect(()=>{const h=a.current;return()=>{window.clearTimeout(h),c(null)}},[a,c]),l.jsx(Qo,{asChild:!0,...d,children:l.jsx(Ru,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":$u(r.open),...e,ref:ya(t,s.onTriggerChange),onClick:h=>{e.onClick?.(h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:L(e.onPointerMove,rn(h=>{o.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!r.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{r.onOpenChange(!0),f()},100))})),onPointerLeave:L(e.onPointerLeave,rn(h=>{f();const p=r.content?.getBoundingClientRect();if(p){const g=r.content?.dataset.side,b=g==="right",m=b?-5:5,v=p[b?"left":"right"],C=p[b?"right":"left"];o.onPointerGraceIntentChange({area:[{x:h.clientX+m,y:h.clientY},{x:v,y:p.top},{x:C,y:p.top},{x:C,y:p.bottom},{x:v,y:p.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(h),h.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:L(e.onKeyDown,h=>{const p=o.searchRef.current!=="";e.disabled||p&&h.key===" "||px[n.dir].includes(h.key)&&(r.onOpenChange(!0),r.content?.focus(),h.preventDefault())})})})});Fu.displayName=Ir;var Lu="MenuSubContent",Vu=u.forwardRef((e,t)=>{const r=_u(Ze,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=or(Ze,e.__scopeMenu),i=gn(Ze,e.__scopeMenu),a=Du(Lu,e.__scopeMenu),c=u.useRef(null),d=se(t,c);return l.jsx(tn.Provider,{scope:e.__scopeMenu,children:l.jsx(Re,{present:n||o.open,children:l.jsx(tn.Slot,{scope:e.__scopeMenu,children:l.jsx(Jo,{id:a.contentId,"aria-labelledby":a.triggerId,...s,ref:d,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{i.isUsingKeyboardRef.current&&c.current?.focus(),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:L(e.onFocusOutside,f=>{f.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:L(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:L(e.onKeyDown,f=>{const h=f.currentTarget.contains(f.target),p=mx[i.dir].includes(f.key);h&&p&&(o.onOpenChange(!1),a.trigger?.focus(),f.preventDefault())})})})})})});Vu.displayName=Lu;function $u(e){return e?"open":"closed"}function Xn(e){return e==="indeterminate"}function ri(e){return Xn(e)?"indeterminate":e?"checked":"unchecked"}function Ix(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function Dx(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function Fx(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 i=Dx(e,Math.max(o,0));s.length===1&&(i=i.filter(d=>d!==r));const c=i.find(d=>d.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function Lx(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const a=t[o],c=t[i],d=a.x,f=a.y,h=c.x,p=c.y;f>n!=p>n&&r<(h-d)*(n-f)/(p-f)+d&&(s=!s)}return s}function Vx(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return Lx(r,t)}function rn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var $x=wu,Ux=Qo,Bx=Cu,zx=Su,Wx=ei,Hx=Eu,Zx=_s,Gx=Pu,qx=Au,Kx=ku,Qx=ju,Yx=Mu,Xx=Iu,Jx=Fu,eb=Vu,Cs="DropdownMenu",[tb,mw]=st(Cs,[xu]),Ne=xu(),[rb,Uu]=tb(Cs),Bu=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:s,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,c=Ne(t),d=u.useRef(null),[f,h]=mt({prop:s,defaultProp:o??!1,onChange:i,caller:Cs});return l.jsx(rb,{scope:t,triggerId:Je(),triggerRef:d,contentId:Je(),open:f,onOpenChange:h,onOpenToggle:u.useCallback(()=>h(p=>!p),[h]),modal:a,children:l.jsx($x,{...c,open:f,onOpenChange:h,dir:n,modal:a,children:r})})};Bu.displayName=Cs;var zu="DropdownMenuTrigger",Wu=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=e,o=Uu(zu,r),i=Ne(r);return l.jsx(Ux,{asChild:!0,...i,children:l.jsx(ee.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:ya(t,o.triggerRef),onPointerDown:L(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:L(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});Wu.displayName=zu;var nb="DropdownMenuPortal",Hu=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Ne(t);return l.jsx(Bx,{...n,...r})};Hu.displayName=nb;var Zu="DropdownMenuContent",Gu=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Uu(Zu,r),o=Ne(r),i=u.useRef(!1);return l.jsx(zx,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...n,ref:t,onCloseAutoFocus:L(e.onCloseAutoFocus,a=>{i.current||s.triggerRef.current?.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:L(e.onInteractOutside,a=>{const c=a.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,f=c.button===2||d;(!s.modal||f)&&(i.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)"}})});Gu.displayName=Zu;var sb="DropdownMenuGroup",ob=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ne(r);return l.jsx(Wx,{...s,...n,ref:t})});ob.displayName=sb;var ib="DropdownMenuLabel",ab=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ne(r);return l.jsx(Hx,{...s,...n,ref:t})});ab.displayName=ib;var cb="DropdownMenuItem",qu=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ne(r);return l.jsx(Zx,{...s,...n,ref:t})});qu.displayName=cb;var lb="DropdownMenuCheckboxItem",ub=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ne(r);return l.jsx(Gx,{...s,...n,ref:t})});ub.displayName=lb;var db="DropdownMenuRadioGroup",fb=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ne(r);return l.jsx(qx,{...s,...n,ref:t})});fb.displayName=db;var hb="DropdownMenuRadioItem",pb=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ne(r);return l.jsx(Kx,{...s,...n,ref:t})});pb.displayName=hb;var mb="DropdownMenuItemIndicator",gb=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ne(r);return l.jsx(Qx,{...s,...n,ref:t})});gb.displayName=mb;var vb="DropdownMenuSeparator",yb=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ne(r);return l.jsx(Yx,{...s,...n,ref:t})});yb.displayName=vb;var xb="DropdownMenuArrow",bb=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ne(r);return l.jsx(Xx,{...s,...n,ref:t})});bb.displayName=xb;var wb="DropdownMenuSubTrigger",_b=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ne(r);return l.jsx(Jx,{...s,...n,ref:t})});_b.displayName=wb;var Cb="DropdownMenuSubContent",Sb=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Ne(r);return l.jsx(eb,{...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)"}})});Sb.displayName=Cb;var Eb=Bu,Rb=Wu,Pb=Hu,Tb=Gu,Ab=qu;function Ob({...e}){return l.jsx(Eb,{"data-slot":"dropdown-menu",...e})}function kb({...e}){return l.jsx(Rb,{"data-slot":"dropdown-menu-trigger",...e})}function Nb({className:e,sideOffset:t=4,...r}){return l.jsx(Pb,{children:l.jsx(Tb,{"data-slot":"dropdown-menu-content",sideOffset:t,className:oe("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 ha({className:e,inset:t,variant:r="default",...n}){return l.jsx(Ab,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:oe("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 jb(e,t){return u.useReducer((r,n)=>t[r][n]??r,e)}var ni="ScrollArea",[Ku,gw]=st(ni),[Mb,qe]=Ku(ni),Qu=u.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:o=600,...i}=e,[a,c]=u.useState(null),[d,f]=u.useState(null),[h,p]=u.useState(null),[g,b]=u.useState(null),[m,v]=u.useState(null),[C,x]=u.useState(0),[S,_]=u.useState(0),[w,T]=u.useState(!1),[R,k]=u.useState(!1),j=se(t,G=>c(G)),D=dn(s);return l.jsx(Mb,{scope:r,type:n,dir:D,scrollHideDelay:o,scrollArea:a,viewport:d,onViewportChange:f,content:h,onContentChange:p,scrollbarX:g,onScrollbarXChange:b,scrollbarXEnabled:w,onScrollbarXEnabledChange:T,scrollbarY:m,onScrollbarYChange:v,scrollbarYEnabled:R,onScrollbarYEnabledChange:k,onCornerWidthChange:x,onCornerHeightChange:_,children:l.jsx(ee.div,{dir:D,...i,ref:j,style:{position:"relative","--radix-scroll-area-corner-width":C+"px","--radix-scroll-area-corner-height":S+"px",...e.style}})})});Qu.displayName=ni;var Yu="ScrollAreaViewport",Xu=u.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:s,...o}=e,i=qe(Yu,r),a=u.useRef(null),c=se(t,a,i.onViewportChange);return l.jsxs(l.Fragment,{children:[l.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}),l.jsx(ee.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:l.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});Xu.displayName=Yu;var xt="ScrollAreaScrollbar",Ju=u.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=qe(xt,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,a=e.orientation==="horizontal";return u.useEffect(()=>(a?o(!0):i(!0),()=>{a?o(!1):i(!1)}),[a,o,i]),s.type==="hover"?l.jsx(Ib,{...n,ref:t,forceMount:r}):s.type==="scroll"?l.jsx(Db,{...n,ref:t,forceMount:r}):s.type==="auto"?l.jsx(ed,{...n,ref:t,forceMount:r}):s.type==="always"?l.jsx(si,{...n,ref:t}):null});Ju.displayName=xt;var Ib=u.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=qe(xt,e.__scopeScrollArea),[o,i]=u.useState(!1);return u.useEffect(()=>{const a=s.scrollArea;let c=0;if(a){const d=()=>{window.clearTimeout(c),i(!0)},f=()=>{c=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",d),a.addEventListener("pointerleave",f),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",d),a.removeEventListener("pointerleave",f)}}},[s.scrollArea,s.scrollHideDelay]),l.jsx(Re,{present:r||o,children:l.jsx(ed,{"data-state":o?"visible":"hidden",...n,ref:t})})}),Db=u.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=qe(xt,e.__scopeScrollArea),o=e.orientation==="horizontal",i=Es(()=>c("SCROLL_END"),100),[a,c]=jb("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 u.useEffect(()=>{if(a==="idle"){const d=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(d)}},[a,s.scrollHideDelay,c]),u.useEffect(()=>{const d=s.viewport,f=o?"scrollLeft":"scrollTop";if(d){let h=d[f];const p=()=>{const g=d[f];h!==g&&(c("SCROLL"),i()),h=g};return d.addEventListener("scroll",p),()=>d.removeEventListener("scroll",p)}},[s.viewport,o,c,i]),l.jsx(Re,{present:r||a!=="hidden",children:l.jsx(si,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:L(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:L(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),ed=u.forwardRef((e,t)=>{const r=qe(xt,e.__scopeScrollArea),{forceMount:n,...s}=e,[o,i]=u.useState(!1),a=e.orientation==="horizontal",c=Es(()=>{if(r.viewport){const d=r.viewport.offsetWidth<r.viewport.scrollWidth,f=r.viewport.offsetHeight<r.viewport.scrollHeight;i(a?d:f)}},10);return Cr(r.viewport,c),Cr(r.content,c),l.jsx(Re,{present:n||o,children:l.jsx(si,{"data-state":o?"visible":"hidden",...s,ref:t})})}),si=u.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,s=qe(xt,e.__scopeScrollArea),o=u.useRef(null),i=u.useRef(0),[a,c]=u.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=od(a.viewport,a.content),f={...n,sizes:a,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:p=>o.current=p,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:p=>i.current=p};function h(p,g){return Bb(p,i.current,a,g)}return r==="horizontal"?l.jsx(Fb,{...f,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const p=s.viewport.scrollLeft,g=pa(p,a,s.dir);o.current.style.transform=`translate3d(${g}px, 0, 0)`}},onWheelScroll:p=>{s.viewport&&(s.viewport.scrollLeft=p)},onDragScroll:p=>{s.viewport&&(s.viewport.scrollLeft=h(p,s.dir))}}):r==="vertical"?l.jsx(Lb,{...f,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const p=s.viewport.scrollTop,g=pa(p,a);o.current.style.transform=`translate3d(0, ${g}px, 0)`}},onWheelScroll:p=>{s.viewport&&(s.viewport.scrollTop=p)},onDragScroll:p=>{s.viewport&&(s.viewport.scrollTop=h(p))}}):null}),Fb=u.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=qe(xt,e.__scopeScrollArea),[i,a]=u.useState(),c=u.useRef(null),d=se(t,c,o.onScrollbarXChange);return u.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(rd,{"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":Ss(r)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,h)=>{if(o.viewport){const p=o.viewport.scrollLeft+f.deltaX;e.onWheelScroll(p),ad(p,h)&&f.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:es(i.paddingLeft),paddingEnd:es(i.paddingRight)}})}})}),Lb=u.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=qe(xt,e.__scopeScrollArea),[i,a]=u.useState(),c=u.useRef(null),d=se(t,c,o.onScrollbarYChange);return u.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(rd,{"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":Ss(r)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,h)=>{if(o.viewport){const p=o.viewport.scrollTop+f.deltaY;e.onWheelScroll(p),ad(p,h)&&f.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:es(i.paddingTop),paddingEnd:es(i.paddingBottom)}})}})}),[Vb,td]=Ku(xt),rd=u.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:f,onResize:h,...p}=e,g=qe(xt,r),[b,m]=u.useState(null),v=se(t,j=>m(j)),C=u.useRef(null),x=u.useRef(""),S=g.viewport,_=n.content-n.viewport,w=Ce(f),T=Ce(c),R=Es(h,10);function k(j){if(C.current){const D=j.clientX-C.current.left,G=j.clientY-C.current.top;d({x:D,y:G})}}return u.useEffect(()=>{const j=D=>{const G=D.target;b?.contains(G)&&w(D,_)};return document.addEventListener("wheel",j,{passive:!1}),()=>document.removeEventListener("wheel",j,{passive:!1})},[S,b,_,w]),u.useEffect(T,[n,T]),Cr(b,R),Cr(g.content,R),l.jsx(Vb,{scope:r,scrollbar:b,hasThumb:s,onThumbChange:Ce(o),onThumbPointerUp:Ce(i),onThumbPositionChange:T,onThumbPointerDown:Ce(a),children:l.jsx(ee.div,{...p,ref:v,style:{position:"absolute",...p.style},onPointerDown:L(e.onPointerDown,j=>{j.button===0&&(j.target.setPointerCapture(j.pointerId),C.current=b.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",g.viewport&&(g.viewport.style.scrollBehavior="auto"),k(j))}),onPointerMove:L(e.onPointerMove,k),onPointerUp:L(e.onPointerUp,j=>{const D=j.target;D.hasPointerCapture(j.pointerId)&&D.releasePointerCapture(j.pointerId),document.body.style.webkitUserSelect=x.current,g.viewport&&(g.viewport.style.scrollBehavior=""),C.current=null})})})}),Jn="ScrollAreaThumb",nd=u.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=td(Jn,e.__scopeScrollArea);return l.jsx(Re,{present:r||s.hasThumb,children:l.jsx($b,{ref:t,...n})})}),$b=u.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...s}=e,o=qe(Jn,r),i=td(Jn,r),{onThumbPositionChange:a}=i,c=se(t,h=>i.onThumbChange(h)),d=u.useRef(void 0),f=Es(()=>{d.current&&(d.current(),d.current=void 0)},100);return u.useEffect(()=>{const h=o.viewport;if(h){const p=()=>{if(f(),!d.current){const g=zb(h,a);d.current=g,a()}};return a(),h.addEventListener("scroll",p),()=>h.removeEventListener("scroll",p)}},[o.viewport,f,a]),l.jsx(ee.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:L(e.onPointerDownCapture,h=>{const g=h.target.getBoundingClientRect(),b=h.clientX-g.left,m=h.clientY-g.top;i.onThumbPointerDown({x:b,y:m})}),onPointerUp:L(e.onPointerUp,i.onThumbPointerUp)})});nd.displayName=Jn;var oi="ScrollAreaCorner",sd=u.forwardRef((e,t)=>{const r=qe(oi,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?l.jsx(Ub,{...e,ref:t}):null});sd.displayName=oi;var Ub=u.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,s=qe(oi,r),[o,i]=u.useState(0),[a,c]=u.useState(0),d=!!(o&&a);return Cr(s.scrollbarX,()=>{const f=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(f),c(f)}),Cr(s.scrollbarY,()=>{const f=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(f),i(f)}),d?l.jsx(ee.div,{...n,ref:t,style:{width:o,height:a,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function es(e){return e?parseInt(e,10):0}function od(e,t){const r=e/t;return isNaN(r)?0:r}function Ss(e){const t=od(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Bb(e,t,r,n="ltr"){const s=Ss(r),o=s/2,i=t||o,a=s-i,c=r.scrollbar.paddingStart+i,d=r.scrollbar.size-r.scrollbar.paddingEnd-a,f=r.content-r.viewport,h=n==="ltr"?[0,f]:[f*-1,0];return id([c,d],h)(e)}function pa(e,t,r="ltr"){const n=Ss(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,i=t.content-t.viewport,a=o-n,c=r==="ltr"?[0,i]:[i*-1,0],d=oo(e,c);return id([0,i],[0,a])(d)}function id(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 ad(e,t){return e>0&&e<t}var zb=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return(function s(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,a=r.top!==o.top;(i||a)&&t(),r=o,n=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(n)};function Es(e,t){const r=Ce(e),n=u.useRef(0);return u.useEffect(()=>()=>window.clearTimeout(n.current),[]),u.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Cr(e,t){const r=Ce(t);Se(()=>{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 Wb=Qu,Hb=Xu,Zb=sd;function Gb({className:e,children:t,...r}){return l.jsxs(Wb,{"data-slot":"scroll-area",className:oe("relative",e),...r,children:[l.jsx(Hb,{"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}),l.jsx(qb,{}),l.jsx(Zb,{})]})}function qb({className:e,orientation:t="vertical",...r}){return l.jsx(Ju,{"data-slot":"scroll-area-scrollbar",orientation:t,className:oe("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:l.jsx(nd,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function Kb({className:e,...t}){return l.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:l.jsx("table",{"data-slot":"table",className:oe("w-full caption-bottom text-sm",e),...t})})}function Qb({className:e,...t}){return l.jsx("thead",{"data-slot":"table-header",className:oe("[&_tr]:border-b",e),...t})}function Yb({className:e,...t}){return l.jsx("tbody",{"data-slot":"table-body",className:oe("[&_tr:last-child]:border-0",e),...t})}function Rn({className:e,...t}){return l.jsx("tr",{"data-slot":"table-row",className:oe("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Pn({className:e,...t}){return l.jsx("th",{"data-slot":"table-head",className:oe("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 dr({className:e,...t}){return l.jsx("td",{"data-slot":"table-cell",className:oe("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function Xb(e,t,r,n){var s=this,o=u.useRef(null),i=u.useRef(0),a=u.useRef(0),c=u.useRef(null),d=u.useRef([]),f=u.useRef(),h=u.useRef(),p=u.useRef(e),g=u.useRef(!0);p.current=e;var b=typeof window<"u",m=!t&&t!==0&&b;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var v=!!(r=r||{}).leading,C=!("trailing"in r)||!!r.trailing,x="maxWait"in r,S="debounceOnServer"in r&&!!r.debounceOnServer,_=x?Math.max(+r.maxWait||0,t):null;u.useEffect(function(){return g.current=!0,function(){g.current=!1}},[]);var w=u.useMemo(function(){var T=function(N){var U=d.current,J=f.current;return d.current=f.current=null,i.current=N,a.current=a.current||N,h.current=p.current.apply(J,U)},R=function(N,U){m&&cancelAnimationFrame(c.current),c.current=m?requestAnimationFrame(N):setTimeout(N,U)},k=function(N){if(!g.current)return!1;var U=N-o.current;return!o.current||U>=t||U<0||x&&N-i.current>=_},j=function(N){return c.current=null,C&&d.current?T(N):(d.current=f.current=null,h.current)},D=function N(){var U=Date.now();if(v&&a.current===i.current&&G(),k(U))return j(U);if(g.current){var J=t-(U-o.current),H=x?Math.min(J,_-(U-i.current)):J;R(N,H)}},G=function(){n&&n({})},$=function(){if(b||S){var N=Date.now(),U=k(N);if(d.current=[].slice.call(arguments),f.current=s,o.current=N,U){if(!c.current&&g.current)return i.current=o.current,R(D,t),v?T(o.current):h.current;if(x)return R(D,t),T(o.current)}return c.current||R(D,t),h.current}};return $.cancel=function(){c.current&&(m?cancelAnimationFrame(c.current):clearTimeout(c.current)),i.current=0,d.current=o.current=f.current=c.current=null},$.isPending=function(){return!!c.current},$.flush=function(){return c.current?j(Date.now()):h.current},$},[v,x,t,_,C,m,b,S,n]);return w}function Jb(e,t){return e===t}function ew(e,t,r){var n=Jb,s=u.useRef(e),o=u.useState({})[1],i=Xb(u.useCallback(function(c){s.current=c,o({})},[o]),t,r,o),a=u.useRef(e);return n(a.current,e)||(i(e),a.current=e),[s.current,i]}function vw(){const[e,t]=u.useState(""),[r,n]=u.useState({}),[s,o]=u.useState(1),[i]=ew(e,400),a=u.useMemo(()=>["products",{currentPage:s,search:i,filter:r}],[s,i,r]),{data:c,isFetching:d}=qs({queryKey:a,queryFn:async()=>await We.apiRequest("index",md({skip:(s-1)*We.item_per_page,where:{productModelCode:e,status_listing:r?.statusFilter==="all"?void 0:r.statusFilter}}))}),{data:f}=qs({queryKey:["publised-products"],queryFn:async()=>await We.apiRequest("getPublistedProducts",{})??[],staleTime:0,refetchOnMount:"always"}),h=Na({mutationKey:["action-mutaions"],mutationFn:async _=>{if(_.status)return We.apiRequest("unlist",_);const w=await We.apiRequest("get",_);if(!(!w||!w?.data))return We.apiRequest("publist",{..._,images:Bs({...w?.data}).images})}}),p=u.useMemo(()=>!c||!c?.data?[]:c?.data.map(_=>Bs(_)),[c]),g=_=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(_),b=()=>{t(""),n({statusFilter:""}),o(1)},m=[r.statusFilter,e!==""].filter(Boolean).length,v=u.useMemo(()=>c?.total?Math.ceil(c.total/We.item_per_page):0,[c?.total,We.item_per_page]),C=u.useMemo(()=>(s-1)*We.item_per_page+1,[s]),x=u.useMemo(()=>Math.min(s*We.item_per_page,c?.total??0),[s,c]),S=async _=>{console.log({post:_}),h.mutate(_)};return l.jsxs(Vm,{children:[l.jsx(Bm,{}),l.jsx(Um,{side:"left",align:"end",className:"w-auto",children:l.jsxs("div",{className:"space-y-4 h-[78vh] min-w-[638px]",children:[l.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx(gf,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Ht,{placeholder:"Search...",value:e,onChange:_=>t(_.target.value),className:"pl-10"})]}),l.jsx(cg,{filter:r,setFilter:n,activeFiltersCount:m,clearFilters:b})]}),l.jsxs("div",{className:"flex items-center justify-between w-full gap-8",children:[l.jsxs("span",{children:["Showing ",C,"-",x," of ",c?.total??0," products"]}),v>1&&l.jsxs("div",{className:"flex items-center justify-end gap-2",children:[l.jsxs(ct,{variant:"outline",size:"xs",onClick:()=>o(_=>Math.max(1,_-1)),disabled:s===1,children:[l.jsx(nf,{}),"Previous"]}),l.jsx("div",{className:"flex items-center gap-1",children:v<=7?Array.from({length:v},(_,w)=>l.jsx(ct,{variant:s===w+1?"default":"outline",size:"xs",onClick:()=>o(w+1),children:w+1},w+1)):l.jsxs(l.Fragment,{children:[l.jsx(ct,{variant:s===1?"default":"outline",size:"xs",onClick:()=>o(1),children:"1"}),s>4&&l.jsx("span",{className:"px-2 text-muted-foreground",children:"..."}),Array.from({length:3},(_,w)=>{let T;return s<=4?T=w+2:s>=v-3?T=v-4+w:T=s-1+w,T>1&&T<v?l.jsx(ct,{variant:s===T?"default":"outline",size:"xs",onClick:()=>o(T),children:T},T):null}).filter(Boolean),s<v-3&&l.jsx("span",{className:"px-2 text-muted-foreground",children:"..."}),l.jsx(ct,{variant:s===v?"default":"outline",size:"xs",onClick:()=>o(v),children:v})]})}),l.jsxs(ct,{variant:"outline",size:"xs",onClick:()=>o(_=>Math.min(v,_+1)),disabled:s===v,children:["Next",l.jsx(of,{})]})]})]}),l.jsx("div",{className:"rounded-md border overflow-x-auto relative",children:l.jsx(Gb,{className:"h-[66vh] w-full",children:l.jsxs(Kb,{className:"h-fit",children:[l.jsx(Qb,{children:l.jsxs(Rn,{children:[l.jsx(Pn,{className:"min-w-[200px]",children:"Name"}),l.jsx(Pn,{className:"w-[80px]",children:"Price"}),l.jsx(Pn,{className:"w-[80px]",children:"Status"}),l.jsx(Pn,{className:"w-[80px] text-center sticky right-0 bg-background border-l shadow-[-4px_0_8px_rgba(0,0,0,0.1)]",children:"Actions"})]})}),l.jsxs(Yb,{className:"relative",children:[d&&l.jsx(Rn,{children:l.jsx(dr,{colSpan:10,className:"text-center py-8 text-muted-foreground ",children:l.jsx("div",{className:"h-full flex items-center justify-center w-full",children:l.jsx(Jc,{})})})}),p.length===0&&!d?l.jsx(Rn,{children:l.jsx(dr,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:l.jsx("div",{className:"h-full flex items-center justify-center w-full",children:l.jsx("span",{children:" No products found"})})})}):p.map(_=>{const w=f?.some(T=>T.title.includes(_.sku));return _.status=w,l.jsxs(Rn,{children:[l.jsxs(dr,{className:"font-medium",children:[l.jsx("div",{className:"truncate max-w-[340px] w-fit",title:_.title,children:_.title}),l.jsx("div",{className:"text-sm text-muted-foreground truncate max-w-[340px]",title:_.description,children:_.description})]}),l.jsx(dr,{className:"font-semibold",children:g(_.price)}),l.jsx(dr,{children:l.jsx(yl,{variant:"secondary",children:_?.status?"Listed":"Unlisted"})}),l.jsx(dr,{className:"text-center sticky right-0 bg-background border-l shadow-[-4px_0_8px_rgba(0,0,0,0.1)]",children:l.jsxs(Ob,{children:[l.jsx(kb,{asChild:!0,children:l.jsx("div",{className:"w-full flex items-center justify-center",children:l.jsx(ct,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 mx-auto",children:l.jsx(ff,{className:"h-4 w-4"})})})}),l.jsxs(Nb,{align:"end",children:[l.jsx(dx,{data:_,children:l.jsxs(ha,{onSelect:T=>{T.preventDefault(),T.stopPropagation()},children:[l.jsx(yf,{className:"h-4 w-4 mr-2"})," Review"]})}),l.jsxs(ha,{onClick:()=>S(_),children:[_.status?l.jsx(Ia,{className:"h-4 w-4 mr-2"}):l.jsx(Da,{className:"h-4 w-4 mr-2"}),_.status?"Unlist":"List"]})]})]})})]},_.id)})]})]})})})]})})]})}export{vw as P,iw as Q,aw as q};
|