@gup-fe/js-sdk 2.4.1 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,21 +2,21 @@
2
2
  (function(yt,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("react/jsx-runtime"),require("react-dom/client"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react-dom/client","react","react-dom"],w):(yt=typeof globalThis<"u"?globalThis:yt||self,w(yt.SDK={},yt.jsxRuntime,yt.ReactDOM,yt.React,yt.ReactDOM))})(this,(function(yt,w,em,oe,tm){"use strict";function Uc(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const f=Uc(oe),Kt=Uc(tm);var Kr=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(){}},Ro=typeof window>"u"||"Deno"in globalThis;function Jt(){}function nm(e,t){return typeof e=="function"?e(t):e}function rm(e){return typeof e=="number"&&e>=0&&e!==1/0}function om(e,t){return Math.max(e+(t||0)-Date.now(),0)}function gi(e,t){return typeof e=="function"?e(t):e}function sm(e,t){return typeof e=="function"?e(t):e}function Bc(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:s,queryKey:i,stale:a}=e;if(i){if(r){if(t.queryHash!==yi(i,t.options))return!1}else if(!Jr(t.queryKey,i))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||s&&!s(t))}function Wc(e,t){const{exact:n,status:r,predicate:o,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(tr(t.options.mutationKey)!==tr(s))return!1}else if(!Jr(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function yi(e,t){return(t?.queryKeyHashFn||tr)(e)}function tr(e){return JSON.stringify(e,(t,n)=>bi(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Jr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Jr(e[n],t[n])):!1}function vi(e,t){if(e===t)return e;const n=Zc(e)&&Zc(t);if(n||bi(e)&&bi(t)){const r=n?e:Object.keys(e),o=r.length,s=n?t:Object.keys(t),i=s.length,a=n?[]:{},c=new Set(r);let u=0;for(let l=0;l<i;l++){const d=n?l:s[l];(!n&&c.has(d)||n)&&e[d]===void 0&&t[d]===void 0?(a[d]=void 0,u++):(a[d]=vi(e[d],t[d]),a[d]===e[d]&&e[d]!==void 0&&u++)}return o===i&&u===o?e:a}return t}function im(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Zc(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function bi(e){if(!Gc(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Gc(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Gc(e){return Object.prototype.toString.call(e)==="[object Object]"}function am(e){return new Promise(t=>{setTimeout(t,e)})}function cm(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return vi(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return vi(e,t)}return t}function um(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function lm(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var No=Symbol();function Yc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===No&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===No?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function dm(e,t){return typeof e=="function"?e(...t):!!e}var fm=class extends Kr{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Ro&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},Xc=new fm,pm=class extends Kr{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Ro&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},Mo=new pm;function hm(){let e,t;const n=new Promise((o,s)=>{e=o,t=s});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function mm(e){return Math.min(1e3*2**e,3e4)}function qc(e){return(e??"online")==="online"?Mo.isOnline():!0}var Kc=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function wi(e){return e instanceof Kc}function Jc(e){let t=!1,n=0,r=!1,o;const s=hm(),i=g=>{r||(p(new Kc(g)),e.abort?.())},a=()=>{t=!0},c=()=>{t=!1},u=()=>Xc.isFocused()&&(e.networkMode==="always"||Mo.isOnline())&&e.canRun(),l=()=>qc(e.networkMode)&&e.canRun(),d=g=>{r||(r=!0,e.onSuccess?.(g),o?.(),s.resolve(g))},p=g=>{r||(r=!0,e.onError?.(g),o?.(),s.reject(g))},h=()=>new Promise(g=>{o=v=>{(r||u())&&g(v)},e.onPause?.()}).then(()=>{o=void 0,r||e.onContinue?.()}),m=()=>{if(r)return;let g;const v=n===0?e.initialPromise:void 0;try{g=v??e.fn()}catch(y){g=Promise.reject(y)}Promise.resolve(g).then(d).catch(y=>{if(r)return;const C=e.retry??(Ro?0:3),S=e.retryDelay??mm,E=typeof S=="function"?S(n,y):S,b=C===!0||typeof C=="number"&&n<C||typeof C=="function"&&C(n,y);if(t||!b){p(y);return}n++,e.onFail?.(n,y),am(E).then(()=>u()?void 0:h()).then(()=>{t?p(y):m()})})};return{promise:s,cancel:i,continue:()=>(o?.(),s),cancelRetry:a,continueRetry:c,canStart:l,start:()=>(l()?m():h().then(m),s)}}var gm=e=>setTimeout(e,0);function ym(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=gm;const s=a=>{t?e.push(a):o(()=>{n(a)})},i=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||i()}return c},batchCalls:a=>(...c)=>{s(()=>{a(...c)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var Ot=ym(),Qc=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),rm(this.gcTime)&&(this.#e=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ro?1/0:300*1e3))}clearGcTimeout(){this.#e&&(clearTimeout(this.#e),this.#e=void 0)}},vm=class extends Qc{#e;#t;#n;#r;#o;#i;#a;constructor(e){super(),this.#a=!1,this.#i=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=wm(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#o?.promise}setOptions(e){this.options={...this.#i,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=cm(this.state.data,e,this.options);return this.#s({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#o?.promise;return this.#o?.cancel(e),t?t.then(Jt).catch(Jt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>sm(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===No||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>gi(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:!om(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#o?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#o?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.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.#o&&(this.#a?this.#o.cancel({revert:!0}):this.#o.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}fetch(e,t){if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#o)return this.#o.continueRetry(),this.#o.promise}if(e&&this.setOptions(e),!this.options.queryFn){const c=this.observers.find(u=>u.options.queryFn);c&&this.setOptions(c.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,r=c=>{Object.defineProperty(c,"signal",{enumerable:!0,get:()=>(this.#a=!0,n.signal)})},o=()=>{const c=Yc(this.options,t),l=(()=>{const d={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(d),d})();return this.#a=!1,this.options.persister?this.options.persister(c,l,this):c(l)},i=(()=>{const c={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:o};return r(c),c})();this.options.behavior?.onFetch(i,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==i.fetchOptions?.meta)&&this.#s({type:"fetch",meta:i.fetchOptions?.meta});const a=c=>{wi(c)&&c.silent||this.#s({type:"error",error:c}),wi(c)||(this.#n.config.onError?.(c,this),this.#n.config.onSettled?.(this.state.data,c,this)),this.scheduleGc()};return this.#o=Jc({initialPromise:t?.initialPromise,fn:i.fetchFn,abort:n.abort.bind(n),onSuccess:c=>{if(c===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(c)}catch(u){a(u);return}this.#n.config.onSuccess?.(c,this),this.#n.config.onSettled?.(c,this.state.error,this),this.scheduleGc()},onError:a,onFail:(c,u)=>{this.#s({type:"failed",failureCount:c,error:u})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}),this.#o.start()}#s(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...bm(n.data,this.options),fetchMeta:e.meta??null};case"success":return this.#t=void 0,{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const r=e.error;return wi(r)&&r.revert&&this.#t?{...this.#t,fetchStatus:"idle"}:{...n,error:r,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),Ot.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function bm(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:qc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function wm(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Sm=class extends Kr{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,o=t.queryHash??yi(r,t);let s=this.get(o);return s||(s=new vm({client:e,queryKey:r,queryHash:o,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(s)),s}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Ot.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>Bc(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>Bc(e,n)):t}notify(e){Ot.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Ot.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ot.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Em=class extends Qc{#e;#t;#n;constructor(e){super(),this.mutationId=e.mutationId,this.#t=e.mutationCache,this.#e=[],this.state=e.state||eu(),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.#e.includes(e)||(this.#e.push(e),this.clearGcTimeout(),this.#t.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#e=this.#e.filter(t=>t!==e),this.scheduleGc(),this.#t.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#t.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})};this.#n=Jc({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(o,s)=>{this.#r({type:"failed",failureCount:o,error:s})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#t.canRun(this)});const n=this.state.status==="pending",r=!this.#n.canStart();try{if(n)t();else{this.#r({type:"pending",variables:e,isPaused:r}),await this.#t.config.onMutate?.(e,this);const s=await this.options.onMutate?.(e);s!==this.state.context&&this.#r({type:"pending",context:s,variables:e,isPaused:r})}const o=await this.#n.start();return await this.#t.config.onSuccess?.(o,e,this.state.context,this),await this.options.onSuccess?.(o,e,this.state.context),await this.#t.config.onSettled?.(o,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(o,null,e,this.state.context),this.#r({type:"success",data:o}),o}catch(o){try{throw await this.#t.config.onError?.(o,e,this.state.context,this),await this.options.onError?.(o,e,this.state.context),await this.#t.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,o,e,this.state.context),o}finally{this.#r({type:"error",error:o})}}finally{this.#t.runNext(this)}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,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{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),Ot.batch(()=>{this.#e.forEach(n=>{n.onMutationUpdate(e)}),this.#t.notify({mutation:this,type:"updated",action:e})})}};function eu(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var xm=class extends Kr{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new Em({mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=Ao(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Ao(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Ao(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(o=>o.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=Ao(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Ot.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>Wc(t,n))}findAll(e={}){return this.getAll().filter(t=>Wc(e,t))}notify(e){Ot.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Ot.batch(()=>Promise.all(e.map(t=>t.continue().catch(Jt))))}};function Ao(e){return e.options.scope?.id}function tu(e){return{onFetch:(t,n)=>{const r=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],i=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let l=!1;const d=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(t.signal.aborted?l=!0:t.signal.addEventListener("abort",()=>{l=!0}),t.signal)})},p=Yc(t.options,t.fetchOptions),h=async(m,g,v)=>{if(l)return Promise.reject();if(g==null&&m.pages.length)return Promise.resolve(m);const C=(()=>{const x={client:t.client,queryKey:t.queryKey,pageParam:g,direction:v?"backward":"forward",meta:t.options.meta};return d(x),x})(),S=await p(C),{maxPages:E}=t.options,b=v?lm:um;return{pages:b(m.pages,S,E),pageParams:b(m.pageParams,g,E)}};if(o&&s.length){const m=o==="backward",g=m?Cm:nu,v={pages:s,pageParams:i},y=g(r,v);a=await h(v,y,m)}else{const m=e??s.length;do{const g=c===0?i[0]??r.initialPageParam:nu(r,a);if(c>0&&g==null)break;a=await h(a,g),c++}while(c<m)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=u}}}function nu(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Cm(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Tm=class{#e;#t;#n;#r;#o;#i;#a;#s;constructor(e={}){this.#e=e.queryCache||new Sm,this.#t=e.mutationCache||new xm,this.#n=e.defaultOptions||{},this.#r=new Map,this.#o=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#a=Xc.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Mo.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#a?.(),this.#a=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(gi(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=this.#e.get(r.queryHash)?.state.data,i=nm(t,s);if(i!==void 0)return this.#e.build(this,r).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Ot.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;Ot.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return Ot.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ot.batch(()=>this.#e.findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Jt).catch(Jt)}invalidateQueries(e,t={}){return Ot.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Ot.batch(()=>this.#e.findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let s=o.fetch(void 0,n);return n.throwOnError||(s=s.catch(Jt)),o.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Jt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(gi(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Jt).catch(Jt)}fetchInfiniteQuery(e){return e.behavior=tu(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Jt).catch(Jt)}ensureInfiniteQueryData(e){return e.behavior=tu(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Mo.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(tr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{Jr(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#o.set(tr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#o.values()],n={};return t.forEach(r=>{Jr(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=yi(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===No&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Om=class extends Kr{#e;#t=void 0;#n;#r;constructor(t,n){super(),this.#e=t,this.setOptions(n),this.bindMethods(),this.#o()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#e.defaultMutationOptions(t),im(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&tr(n.mutationKey)!==tr(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#o(),this.#i(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#o(),this.#i()}mutate(t,n){return this.#r=n,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#o(){const t=this.#n?.state??eu();this.#t={...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){Ot.batch(()=>{if(this.#r&&this.hasListeners()){const n=this.#t.variables,r=this.#t.context;t?.type==="success"?(this.#r.onSuccess?.(t.data,n,r),this.#r.onSettled?.(t.data,null,n,r)):t?.type==="error"&&(this.#r.onError?.(t.error,n,r),this.#r.onSettled?.(void 0,t.error,n,r))}this.listeners.forEach(n=>{n(this.#t)})})}},ru=f.createContext(void 0),Pm=e=>{const t=f.useContext(ru);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},_m=({client:e,children:t})=>(f.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),w.jsx(ru.Provider,{value:e,children:t}));function sn(e,t){const n=Pm(),[r]=f.useState(()=>new Om(n,e));f.useEffect(()=>{r.setOptions(e)},[r,e]);const o=f.useSyncExternalStore(f.useCallback(i=>r.subscribe(Ot.batchCalls(i)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=f.useCallback((i,a)=>{r.mutate(i,a).catch(Jt)},[r]);if(o.error&&dm(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:s,mutateAsync:o.mutate}}var Si=function(){return Si=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Si.apply(this,arguments)};function pn(e,t,n,r){function o(s){return s instanceof n?s:new n(function(i){i(s)})}return new(n||(n=Promise))(function(s,i){function a(l){try{u(r.next(l))}catch(d){i(d)}}function c(l){try{u(r.throw(l))}catch(d){i(d)}}function u(l){l.done?s(l.value):o(l.value).then(a,c)}u((r=r.apply(e,t||[])).next())})}function hn(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,o,s,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(u){return function(l){return c([u,l])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(n=0)),n;)try{if(r=1,o&&(s=u[0]&2?o.return:u[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,u[1])).done)return s;switch(o=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,o=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1],s=u;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(u);break}s[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(l){u=[6,l],o=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Im(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{for(;(t===void 0||t-- >0)&&!(o=r.next()).done;)s.push(o.value)}catch(a){i={error:a}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}function ou(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var su="4.6.2";function Do(e,t){return new Promise(function(n){return setTimeout(n,e,t)})}function km(){return new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})}function Rm(e,t){t===void 0&&(t=1/0);var n=window.requestIdleCallback;return n?new Promise(function(r){return n.call(window,function(){return r()},{timeout:t})}):Do(Math.min(e,t))}function iu(e){return!!e&&typeof e.then=="function"}function au(e,t){try{var n=e();iu(n)?n.then(function(r){return t(!0,r)},function(r){return t(!1,r)}):t(!0,n)}catch(r){t(!1,r)}}function cu(e,t,n){return n===void 0&&(n=16),pn(this,void 0,void 0,function(){var r,o,s,i;return hn(this,function(a){switch(a.label){case 0:r=Array(e.length),o=Date.now(),s=0,a.label=1;case 1:return s<e.length?(r[s]=t(e[s],s),i=Date.now(),i>=o+n?(o=i,[4,km()]):[3,3]):[3,4];case 2:a.sent(),a.label=3;case 3:return++s,[3,1];case 4:return[2,r]}})})}function Qr(e){return e.then(void 0,function(){}),e}function Nm(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return!0;return!1}function Mm(e,t){return!Nm(e,t)}function Ei(e){return parseInt(e)}function an(e){return parseFloat(e)}function In(e,t){return typeof e=="number"&&isNaN(e)?t:e}function Nt(e){return e.reduce(function(t,n){return t+(n?1:0)},0)}function uu(e,t){if(t===void 0&&(t=1),Math.abs(t)>=1)return Math.round(e/t)*t;var n=1/t;return Math.round(e*n)/n}function Am(e){for(var t,n,r="Unexpected syntax '".concat(e,"'"),o=/^\s*([a-z-]*)(.*)$/i.exec(e),s=o[1]||void 0,i={},a=/([.:#][\w-]+|\[.+?\])/gi,c=function(p,h){i[p]=i[p]||[],i[p].push(h)};;){var u=a.exec(o[2]);if(!u)break;var l=u[0];switch(l[0]){case".":c("class",l.slice(1));break;case"#":c("id",l.slice(1));break;case"[":{var d=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(l);if(d)c(d[1],(n=(t=d[4])!==null&&t!==void 0?t:d[5])!==null&&n!==void 0?n:"");else throw new Error(r);break}default:throw new Error(r)}}return[s,i]}function Dm(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r>127)return new TextEncoder().encode(e);t[n]=r}return t}function jn(e,t){var n=e[0]>>>16,r=e[0]&65535,o=e[1]>>>16,s=e[1]&65535,i=t[0]>>>16,a=t[0]&65535,c=t[1]>>>16,u=t[1]&65535,l=0,d=0,p=0,h=0;h+=s+u,p+=h>>>16,h&=65535,p+=o+c,d+=p>>>16,p&=65535,d+=r+a,l+=d>>>16,d&=65535,l+=n+i,l&=65535,e[0]=l<<16|d,e[1]=p<<16|h}function Qt(e,t){var n=e[0]>>>16,r=e[0]&65535,o=e[1]>>>16,s=e[1]&65535,i=t[0]>>>16,a=t[0]&65535,c=t[1]>>>16,u=t[1]&65535,l=0,d=0,p=0,h=0;h+=s*u,p+=h>>>16,h&=65535,p+=o*u,d+=p>>>16,p&=65535,p+=s*c,d+=p>>>16,p&=65535,d+=r*u,l+=d>>>16,d&=65535,d+=o*c,l+=d>>>16,d&=65535,d+=s*a,l+=d>>>16,d&=65535,l+=n*u+r*c+o*a+s*i,l&=65535,e[0]=l<<16|d,e[1]=p<<16|h}function Tr(e,t){var n=e[0];t%=64,t===32?(e[0]=e[1],e[1]=n):t<32?(e[0]=n<<t|e[1]>>>32-t,e[1]=e[1]<<t|n>>>32-t):(t-=32,e[0]=e[1]<<t|n>>>32-t,e[1]=n<<t|e[1]>>>32-t)}function Wt(e,t){t%=64,t!==0&&(t<32?(e[0]=e[1]>>>32-t,e[1]=e[1]<<t):(e[0]=e[1]<<t-32,e[1]=0))}function dt(e,t){e[0]^=t[0],e[1]^=t[1]}var Lm=[4283543511,3981806797],Fm=[3301882366,444984403];function lu(e){var t=[0,e[0]>>>1];dt(e,t),Qt(e,Lm),t[1]=e[0]>>>1,dt(e,t),Qt(e,Fm),t[1]=e[0]>>>1,dt(e,t)}var Lo=[2277735313,289559509],Fo=[1291169091,658871167],du=[0,5],Vm=[0,1390208809],zm=[0,944331445];function $m(e,t){var n=Dm(e);t=t||0;var r=[0,n.length],o=r[1]%16,s=r[1]-o,i=[0,t],a=[0,t],c=[0,0],u=[0,0],l;for(l=0;l<s;l=l+16)c[0]=n[l+4]|n[l+5]<<8|n[l+6]<<16|n[l+7]<<24,c[1]=n[l]|n[l+1]<<8|n[l+2]<<16|n[l+3]<<24,u[0]=n[l+12]|n[l+13]<<8|n[l+14]<<16|n[l+15]<<24,u[1]=n[l+8]|n[l+9]<<8|n[l+10]<<16|n[l+11]<<24,Qt(c,Lo),Tr(c,31),Qt(c,Fo),dt(i,c),Tr(i,27),jn(i,a),Qt(i,du),jn(i,Vm),Qt(u,Fo),Tr(u,33),Qt(u,Lo),dt(a,u),Tr(a,31),jn(a,i),Qt(a,du),jn(a,zm);c[0]=0,c[1]=0,u[0]=0,u[1]=0;var d=[0,0];switch(o){case 15:d[1]=n[l+14],Wt(d,48),dt(u,d);case 14:d[1]=n[l+13],Wt(d,40),dt(u,d);case 13:d[1]=n[l+12],Wt(d,32),dt(u,d);case 12:d[1]=n[l+11],Wt(d,24),dt(u,d);case 11:d[1]=n[l+10],Wt(d,16),dt(u,d);case 10:d[1]=n[l+9],Wt(d,8),dt(u,d);case 9:d[1]=n[l+8],dt(u,d),Qt(u,Fo),Tr(u,33),Qt(u,Lo),dt(a,u);case 8:d[1]=n[l+7],Wt(d,56),dt(c,d);case 7:d[1]=n[l+6],Wt(d,48),dt(c,d);case 6:d[1]=n[l+5],Wt(d,40),dt(c,d);case 5:d[1]=n[l+4],Wt(d,32),dt(c,d);case 4:d[1]=n[l+3],Wt(d,24),dt(c,d);case 3:d[1]=n[l+2],Wt(d,16),dt(c,d);case 2:d[1]=n[l+1],Wt(d,8),dt(c,d);case 1:d[1]=n[l],dt(c,d),Qt(c,Lo),Tr(c,31),Qt(c,Fo),dt(i,c)}return dt(i,r),dt(a,r),jn(i,a),jn(a,i),lu(i),lu(a),jn(i,a),jn(a,i),("00000000"+(i[0]>>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)+("00000000"+(a[0]>>>0).toString(16)).slice(-8)+("00000000"+(a[1]>>>0).toString(16)).slice(-8)}function jm(e){var t;return Si({name:e.name,message:e.message,stack:(t=e.stack)===null||t===void 0?void 0:t.split(`
3
3
  `)},e)}function Hm(e){return/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))}function Um(e){return typeof e!="function"}function Bm(e,t){var n=Qr(new Promise(function(r){var o=Date.now();au(e.bind(null,t),function(){for(var s=[],i=0;i<arguments.length;i++)s[i]=arguments[i];var a=Date.now()-o;if(!s[0])return r(function(){return{error:s[1],duration:a}});var c=s[1];if(Um(c))return r(function(){return{value:c,duration:a}});r(function(){return new Promise(function(u){var l=Date.now();au(c,function(){for(var d=[],p=0;p<arguments.length;p++)d[p]=arguments[p];var h=a+Date.now()-l;if(!d[0])return u({error:d[1],duration:h});u({value:d[1],duration:h})})})})})}));return function(){return n.then(function(o){return o()})}}function Wm(e,t,n,r){var o=Object.keys(e).filter(function(i){return Mm(n,i)}),s=Qr(cu(o,function(i){return Bm(e[i],t)},r));return function(){return pn(this,void 0,void 0,function(){var a,c,u,l,d;return hn(this,function(p){switch(p.label){case 0:return[4,s];case 1:return a=p.sent(),[4,cu(a,function(h){return Qr(h())},r)];case 2:return c=p.sent(),[4,Promise.all(c)];case 3:for(u=p.sent(),l={},d=0;d<o.length;++d)l[o[d]]=u[d];return[2,l]}})})}}function fu(){var e=window,t=navigator;return Nt(["MSCSSMatrix"in e,"msSetImmediate"in e,"msIndexedDB"in e,"msMaxTouchPoints"in t,"msPointerEnabled"in t])>=4}function Zm(){var e=window,t=navigator;return Nt(["msWriteProfilerMark"in e,"MSStream"in e,"msLaunchUri"in t,"msSaveBlob"in t])>=3&&!fu()}function eo(){var e=window,t=navigator;return Nt(["webkitPersistentStorage"in t,"webkitTemporaryStorage"in t,(t.vendor||"").indexOf("Google")===0,"webkitResolveLocalFileSystemURL"in e,"BatteryManager"in e,"webkitMediaStream"in e,"webkitSpeechGrammar"in e])>=5}function cn(){var e=window,t=navigator;return Nt(["ApplePayError"in e,"CSSPrimitiveValue"in e,"Counter"in e,t.vendor.indexOf("Apple")===0,"RGBColor"in e,"WebKitMediaKeys"in e])>=4}function xi(){var e=window,t=e.HTMLElement,n=e.Document;return Nt(["safari"in e,!("ongestureend"in e),!("TouchEvent"in e),!("orientation"in e),t&&!("autocapitalize"in t.prototype),n&&"pointerLockElement"in n.prototype])>=4}function to(){var e=window;return Hm(e.print)&&String(e.browser)==="[object WebPageNamespace]"}function pu(){var e,t,n=window;return Nt(["buildID"in navigator,"MozAppearance"in((t=(e=document.documentElement)===null||e===void 0?void 0:e.style)!==null&&t!==void 0?t:{}),"onmozfullscreenchange"in n,"mozInnerScreenX"in n,"CSSMozDocumentRule"in n,"CanvasCaptureMediaStream"in n])>=4}function Gm(){var e=window;return Nt([!("MediaSettingsRange"in e),"RTCEncodedAudioFrame"in e,""+e.Intl=="[object Intl]",""+e.Reflect=="[object Reflect]"])>=3}function Ym(){var e=window,t=e.URLPattern;return Nt(["union"in Set.prototype,"Iterator"in e,t&&"hasRegExpGroups"in t.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}function Xm(){var e=window;return Nt(["DOMRectList"in e,"RTCPeerConnectionIceEvent"in e,"SVGGeometryElement"in e,"ontransitioncancel"in e])>=3}function no(){var e=window,t=navigator,n=e.CSS,r=e.HTMLButtonElement;return Nt([!("getStorageUpdates"in t),r&&"popover"in r.prototype,"CSSCounterStyleRule"in e,n.supports("font-size-adjust: ex-height 0.5"),n.supports("text-transform: full-width")])>=4}function qm(){if(navigator.platform==="iPad")return!0;var e=screen,t=e.width/e.height;return Nt(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}function Km(){var e=document;return e.fullscreenElement||e.msFullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||null}function Jm(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function Ci(){var e=eo(),t=pu(),n=window,r=navigator,o="connection";return e?Nt([!("SharedWorker"in n),r[o]&&"ontypechange"in r[o],!("sinkId"in new Audio)])>=2:t?Nt(["onorientationchange"in n,"orientation"in n,/android/i.test(r.appVersion)])>=2:!1}function Qm(){var e=navigator,t=window,n=Audio.prototype,r=t.visualViewport;return Nt(["srLatency"in n,"srChannelCount"in n,"devicePosture"in e,r&&"segments"in r,"getTextInformation"in Image.prototype])>=3}function eg(){return rg()?-4:tg()}function tg(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(ng())return-1;var n=4500,r=5e3,o=new t(1,r,44100),s=o.createOscillator();s.type="triangle",s.frequency.value=1e4;var i=o.createDynamicsCompressor();i.threshold.value=-50,i.knee.value=40,i.ratio.value=12,i.attack.value=0,i.release.value=.25,s.connect(i),i.connect(o.destination),s.start(0);var a=og(o),c=a[0],u=a[1],l=Qr(c.then(function(d){return sg(d.getChannelData(0).subarray(n))},function(d){if(d.name==="timeout"||d.name==="suspended")return-3;throw d}));return function(){return u(),l}}function ng(){return cn()&&!xi()&&!Xm()}function rg(){return cn()&&no()&&to()||eo()&&Qm()&&Ym()}function og(e){var t=3,n=500,r=500,o=5e3,s=function(){},i=new Promise(function(a,c){var u=!1,l=0,d=0;e.oncomplete=function(m){return a(m.renderedBuffer)};var p=function(){setTimeout(function(){return c(hu("timeout"))},Math.min(r,d+o-Date.now()))},h=function(){try{var m=e.startRendering();switch(iu(m)&&Qr(m),e.state){case"running":d=Date.now(),u&&p();break;case"suspended":document.hidden||l++,u&&l>=t?c(hu("suspended")):setTimeout(h,n);break}}catch(g){c(g)}};h(),s=function(){u||(u=!0,d>0&&p())}});return[i,s]}function sg(e){for(var t=0,n=0;n<e.length;++n)t+=Math.abs(e[n]);return t}function hu(e){var t=new Error(e);return t.name=e,t}function mu(e,t,n){var r,o,s;return n===void 0&&(n=50),pn(this,void 0,void 0,function(){var i,a;return hn(this,function(c){switch(c.label){case 0:i=document,c.label=1;case 1:return i.body?[3,3]:[4,Do(n)];case 2:return c.sent(),[3,1];case 3:a=i.createElement("iframe"),c.label=4;case 4:return c.trys.push([4,,10,11]),[4,new Promise(function(u,l){var d=!1,p=function(){d=!0,u()},h=function(v){d=!0,l(v)};a.onload=p,a.onerror=h;var m=a.style;m.setProperty("display","block","important"),m.position="absolute",m.top="0",m.left="0",m.visibility="hidden",t&&"srcdoc"in a?a.srcdoc=t:a.src="about:blank",i.body.appendChild(a);var g=function(){var v,y;d||(((y=(v=a.contentWindow)===null||v===void 0?void 0:v.document)===null||y===void 0?void 0:y.readyState)==="complete"?p():setTimeout(g,10))};g()})];case 5:c.sent(),c.label=6;case 6:return!((o=(r=a.contentWindow)===null||r===void 0?void 0:r.document)===null||o===void 0)&&o.body?[3,8]:[4,Do(n)];case 7:return c.sent(),[3,6];case 8:return[4,e(a,a.contentWindow)];case 9:return[2,c.sent()];case 10:return(s=a.parentNode)===null||s===void 0||s.removeChild(a),[7];case 11:return[2]}})})}function ig(e){for(var t=Am(e),n=t[0],r=t[1],o=document.createElement(n??"div"),s=0,i=Object.keys(r);s<i.length;s++){var a=i[s],c=r[a].join(" ");a==="style"?ag(o.style,c):o.setAttribute(a,c)}return o}function ag(e,t){for(var n=0,r=t.split(";");n<r.length;n++){var o=r[n],s=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(o);if(s){var i=s[1],a=s[2],c=s[4];e.setProperty(i,a,c||"")}}}function cg(){for(var e=window;;){var t=e.parent;if(!t||t===e)return!1;try{if(t.location.origin!==e.location.origin)return!0}catch(n){if(n instanceof Error&&n.name==="SecurityError")return!0;throw n}e=t}}var ug="mmMwWLliI0O&1",lg="48px",Or=["monospace","sans-serif","serif"],gu=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function dg(){var e=this;return mu(function(t,n){var r=n.document;return pn(e,void 0,void 0,function(){var o,s,i,a,c,u,l,d,p,h,m,g;return hn(this,function(v){for(o=r.body,o.style.fontSize=lg,s=r.createElement("div"),s.style.setProperty("visibility","hidden","important"),i={},a={},c=function(y){var C=r.createElement("span"),S=C.style;return S.position="absolute",S.top="0",S.left="0",S.fontFamily=y,C.textContent=ug,s.appendChild(C),C},u=function(y,C){return c("'".concat(y,"',").concat(C))},l=function(){return Or.map(c)},d=function(){for(var y={},C=function(x){y[x]=Or.map(function(T){return u(x,T)})},S=0,E=gu;S<E.length;S++){var b=E[S];C(b)}return y},p=function(y){return Or.some(function(C,S){return y[S].offsetWidth!==i[C]||y[S].offsetHeight!==a[C]})},h=l(),m=d(),o.appendChild(s),g=0;g<Or.length;g++)i[Or[g]]=h[g].offsetWidth,a[Or[g]]=h[g].offsetHeight;return[2,gu.filter(function(y){return p(m[y])})]})})})}function fg(){var e=navigator.plugins;if(e){for(var t=[],n=0;n<e.length;++n){var r=e[n];if(r){for(var o=[],s=0;s<r.length;++s){var i=r[s];o.push({type:i.type,suffixes:i.suffixes})}t.push({name:r.name,description:r.description,mimeTypes:o})}}return t}}function pg(){return hg(Sg())}function hg(e){var t,n=!1,r,o,s=mg(),i=s[0],a=s[1];return gg(i,a)?(n=yg(a),e?r=o="skipped":(t=vg(i,a),r=t[0],o=t[1])):r=o="unsupported",{winding:n,geometry:r,text:o}}function mg(){var e=document.createElement("canvas");return e.width=1,e.height=1,[e,e.getContext("2d")]}function gg(e,t){return!!(t&&e.toDataURL)}function yg(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,"evenodd")}function vg(e,t){bg(e,t);var n=Ti(e),r=Ti(e);if(n!==r)return["unstable","unstable"];wg(e,t);var o=Ti(e);return[o,n]}function bg(e,t){e.width=240,e.height=60,t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"';var n="Cwm fjordbank gly ".concat("😃");t.fillText(n,2,15),t.fillStyle="rgba(102, 204, 0, 0.2)",t.font="18pt Arial",t.fillText(n,4,45)}function wg(e,t){e.width=122,e.height=110,t.globalCompositeOperation="multiply";for(var n=0,r=[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]];n<r.length;n++){var o=r[n],s=o[0],i=o[1],a=o[2];t.fillStyle=s,t.beginPath(),t.arc(i,a,40,0,Math.PI*2,!0),t.closePath(),t.fill()}t.fillStyle="#f9c",t.arc(60,60,60,0,Math.PI*2,!0),t.arc(60,60,20,0,Math.PI*2,!0),t.fill("evenodd")}function Ti(e){return e.toDataURL()}function Sg(){return cn()&&no()&&to()}function Eg(){var e=navigator,t=0,n;e.maxTouchPoints!==void 0?t=Ei(e.maxTouchPoints):e.msMaxTouchPoints!==void 0&&(t=e.msMaxTouchPoints);try{document.createEvent("TouchEvent"),n=!0}catch{n=!1}var r="ontouchstart"in window;return{maxTouchPoints:t,touchEvent:n,touchStart:r}}function xg(){return navigator.oscpu}function Cg(){var e=navigator,t=[],n=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(n!==void 0&&t.push([n]),Array.isArray(e.languages))eo()&&Gm()||t.push(e.languages);else if(typeof e.languages=="string"){var r=e.languages;r&&t.push(r.split(","))}return t}function Tg(){return window.screen.colorDepth}function Og(){return In(an(navigator.deviceMemory),void 0)}function Pg(){if(!(cn()&&no()&&to()))return _g()}function _g(){var e=screen,t=function(r){return In(Ei(r),null)},n=[t(e.width),t(e.height)];return n.sort().reverse(),n}var Ig=2500,kg=10,Vo,Oi;function Rg(){if(Oi===void 0){var e=function(){var t=Pi();_i(t)?Oi=setTimeout(e,Ig):(Vo=t,Oi=void 0)};e()}}function Ng(){var e=this;return Rg(),function(){return pn(e,void 0,void 0,function(){var t;return hn(this,function(n){switch(n.label){case 0:return t=Pi(),_i(t)?Vo?[2,ou([],Vo,!0)]:Km()?[4,Jm()]:[3,2]:[3,2];case 1:n.sent(),t=Pi(),n.label=2;case 2:return _i(t)||(Vo=t),[2,t]}})})}}function Mg(){var e=this;if(cn()&&no()&&to())return function(){return Promise.resolve(void 0)};var t=Ng();return function(){return pn(e,void 0,void 0,function(){var n,r;return hn(this,function(o){switch(o.label){case 0:return[4,t()];case 1:return n=o.sent(),r=function(s){return s===null?null:uu(s,kg)},[2,[r(n[0]),r(n[1]),r(n[2]),r(n[3])]]}})})}}function Pi(){var e=screen;return[In(an(e.availTop),null),In(an(e.width)-an(e.availWidth)-In(an(e.availLeft),0),null),In(an(e.height)-an(e.availHeight)-In(an(e.availTop),0),null),In(an(e.availLeft),null)]}function _i(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function Ag(){return In(Ei(navigator.hardwareConcurrency),void 0)}function Dg(){var e,t=(e=window.Intl)===null||e===void 0?void 0:e.DateTimeFormat;if(t){var n=new t().resolvedOptions().timeZone;if(n)return n}var r=-Lg();return"UTC".concat(r>=0?"+":"").concat(r)}function Lg(){var e=new Date().getFullYear();return Math.max(an(new Date(e,0,1).getTimezoneOffset()),an(new Date(e,6,1).getTimezoneOffset()))}function Fg(){try{return!!window.sessionStorage}catch{return!0}}function Vg(){try{return!!window.localStorage}catch{return!0}}function zg(){if(!(fu()||Zm()))try{return!!window.indexedDB}catch{return!0}}function $g(){return!!window.openDatabase}function jg(){return navigator.cpuClass}function Hg(){var e=navigator.platform;return e==="MacIntel"&&cn()&&!xi()?qm()?"iPad":"iPhone":e}function Ug(){return navigator.vendor||""}function Bg(){for(var e=[],t=0,n=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];t<n.length;t++){var r=n[t],o=window[r];o&&typeof o=="object"&&e.push(r)}return e.sort()}function Wg(){var e=document;try{e.cookie="cookietest=1; SameSite=Strict;";var t=e.cookie.indexOf("cookietest=")!==-1;return e.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}catch{return!1}}function Zg(){var e=atob;return{abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',e("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",e("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",e("LnNwb25zb3JpdA=="),".ylamainos",e("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",e("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",e("LmhlYWRlci1ibG9ja2VkLWFk"),e("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",e("I2FkXzMwMFgyNTA="),e("I2Jhbm5lcmZsb2F0MjI="),e("I2NhbXBhaWduLWJhbm5lcg=="),e("I0FkLUNvbnRlbnQ=")],adGuardChinese:[e("LlppX2FkX2FfSA=="),e("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",e("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),e("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",e("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",e("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",e("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),e("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),e("LmFkZ29vZ2xl"),e("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[e("YW1wLWF1dG8tYWRz"),e("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",e("I2FkX2ludmlld19hcmVh")],adGuardRussian:[e("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),e("LnJlY2xhbWE="),'div[id^="smi2adblock"]',e("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[e("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),e("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",e("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),e("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),e("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",e("I3Jla2xhbWk="),e("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),e("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),e("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[e("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",e("LndpZGdldF9wb19hZHNfd2lkZ2V0"),e("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",e("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[e("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),e("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",e("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",e("I3Jla2xhbW5pLWJveA=="),e("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",e("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[e("I2FkdmVydGVudGll"),e("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",e("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",e("LnNwb25zb3JsaW5rZ3J1ZW4="),e("I3dlcmJ1bmdza3k="),e("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),e("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[e("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",e("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[e("LnJla2xhbW9zX3RhcnBhcw=="),e("LnJla2xhbW9zX251b3JvZG9z"),e("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),e("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),e("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[e("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[e("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),e("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",e("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[e("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),e("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),e("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",e("LmFkX19tYWlu"),e("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[e("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[e("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),e("I2xpdmVyZUFkV3JhcHBlcg=="),e("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),e("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[e("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",e("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),e("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),e("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[e("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),e("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),e("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",e("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),e("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),e("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),e("ZGl2I3NrYXBpZWNfYWQ=")],ro:[e("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),e("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[e("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),e("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),e("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",e("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),e("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",e("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]}}function Gg(e){var t=e===void 0?{}:e,n=t.debug;return pn(this,void 0,void 0,function(){var r,o,s,i,a,c;return hn(this,function(u){switch(u.label){case 0:return Yg()?(r=Zg(),o=Object.keys(r),s=(c=[]).concat.apply(c,o.map(function(l){return r[l]})),[4,Xg(s)]):[2,void 0];case 1:return i=u.sent(),n&&qg(r,i),a=o.filter(function(l){var d=r[l],p=Nt(d.map(function(h){return i[h]}));return p>d.length*.6}),a.sort(),[2,a]}})})}function Yg(){return cn()||Ci()}function Xg(e){var t;return pn(this,void 0,void 0,function(){var n,r,o,s,c,i,a,c;return hn(this,function(u){switch(u.label){case 0:for(n=document,r=n.createElement("div"),o=new Array(e.length),s={},yu(r),c=0;c<e.length;++c)i=ig(e[c]),i.tagName==="DIALOG"&&i.show(),a=n.createElement("div"),yu(a),a.appendChild(i),r.appendChild(a),o[c]=i;u.label=1;case 1:return n.body?[3,3]:[4,Do(50)];case 2:return u.sent(),[3,1];case 3:n.body.appendChild(r);try{for(c=0;c<e.length;++c)o[c].offsetParent||(s[e[c]]=!0)}finally{(t=r.parentNode)===null||t===void 0||t.removeChild(r)}return[2,s]}})})}function yu(e){e.style.setProperty("visibility","hidden","important"),e.style.setProperty("display","block","important")}function qg(e,t){for(var n="DOM blockers debug:\n```",r=0,o=Object.keys(e);r<o.length;r++){var s=o[r];n+=`
4
4
  `.concat(s,":");for(var i=0,a=e[s];i<a.length;i++){var c=a[i];n+=`
5
- `.concat(t[c]?"🚫":"➡️"," ").concat(c)}}console.log("".concat(n,"\n```"))}function Kg(){for(var e=0,t=["rec2020","p3","srgb"];e<t.length;e++){var n=t[e];if(matchMedia("(color-gamut: ".concat(n,")")).matches)return n}}function Jg(){if(vu("inverted"))return!0;if(vu("none"))return!1}function vu(e){return matchMedia("(inverted-colors: ".concat(e,")")).matches}function Qg(){if(bu("active"))return!0;if(bu("none"))return!1}function bu(e){return matchMedia("(forced-colors: ".concat(e,")")).matches}var ey=100;function ty(){if(matchMedia("(min-monochrome: 0)").matches){for(var e=0;e<=ey;++e)if(matchMedia("(max-monochrome: ".concat(e,")")).matches)return e;throw new Error("Too high value")}}function ny(){if(Pr("no-preference"))return 0;if(Pr("high")||Pr("more"))return 1;if(Pr("low")||Pr("less"))return-1;if(Pr("forced"))return 10}function Pr(e){return matchMedia("(prefers-contrast: ".concat(e,")")).matches}function ry(){if(wu("reduce"))return!0;if(wu("no-preference"))return!1}function wu(e){return matchMedia("(prefers-reduced-motion: ".concat(e,")")).matches}function oy(){if(Su("reduce"))return!0;if(Su("no-preference"))return!1}function Su(e){return matchMedia("(prefers-reduced-transparency: ".concat(e,")")).matches}function sy(){if(Eu("high"))return!0;if(Eu("standard"))return!1}function Eu(e){return matchMedia("(dynamic-range: ".concat(e,")")).matches}var et=Math,Mt=function(){return 0};function iy(){var e=et.acos||Mt,t=et.acosh||Mt,n=et.asin||Mt,r=et.asinh||Mt,o=et.atanh||Mt,s=et.atan||Mt,i=et.sin||Mt,a=et.sinh||Mt,c=et.cos||Mt,u=et.cosh||Mt,l=et.tan||Mt,d=et.tanh||Mt,p=et.exp||Mt,h=et.expm1||Mt,m=et.log1p||Mt,g=function(P){return et.pow(et.PI,P)},v=function(P){return et.log(P+et.sqrt(P*P-1))},y=function(P){return et.log(P+et.sqrt(P*P+1))},C=function(P){return et.log((1+P)/(1-P))/2},S=function(P){return et.exp(P)-1/et.exp(P)/2},E=function(P){return(et.exp(P)+1/et.exp(P))/2},b=function(P){return et.exp(P)-1},x=function(P){return(et.exp(2*P)-1)/(et.exp(2*P)+1)},T=function(P){return et.log(1+P)};return{acos:e(.12312423423423424),acosh:t(1e308),acoshPf:v(1e154),asin:n(.12312423423423424),asinh:r(1),asinhPf:y(1),atanh:o(.5),atanhPf:C(.5),atan:s(.5),sin:i(-1e300),sinh:a(1),sinhPf:S(1),cos:c(10.000000000123),cosh:u(1),coshPf:E(1),tan:l(-1e300),tanh:d(1),tanhPf:x(1),exp:p(1),expm1:h(1),expm1Pf:b(1),log1p:m(10),log1pPf:T(10),powPI:g(-100)}}var ay="mmMwWLliI0fiflO&1",Ii={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};function cy(){return uy(function(e,t){for(var n={},r={},o=0,s=Object.keys(Ii);o<s.length;o++){var i=s[o],a=Ii[i],c=a[0],u=c===void 0?{}:c,l=a[1],d=l===void 0?ay:l,p=e.createElement("span");p.textContent=d,p.style.whiteSpace="nowrap";for(var h=0,m=Object.keys(u);h<m.length;h++){var g=m[h],v=u[g];v!==void 0&&(p.style[g]=v)}n[i]=p,t.append(e.createElement("br"),p)}for(var y=0,C=Object.keys(Ii);y<C.length;y++){var i=C[y];r[i]=n[i].getBoundingClientRect().width}return r})}function uy(e,t){return t===void 0&&(t=4e3),mu(function(n,r){var o=r.document,s=o.body,i=s.style;i.width="".concat(t,"px"),i.webkitTextSizeAdjust=i.textSizeAdjust="none",eo()?s.style.zoom="".concat(1/r.devicePixelRatio):cn()&&(s.style.zoom="reset");var a=o.createElement("div");return a.textContent=ou([],Array(t/20<<0),!0).map(function(){return"word"}).join(" "),s.appendChild(a),e(o,s)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}function ly(){return navigator.pdfViewerEnabled}function dy(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}function fy(){var e=window.ApplePaySession;if(typeof e?.canMakePayments!="function")return-1;if(py())return-3;try{return e.canMakePayments()?1:0}catch(t){return hy(t)}}var py=cg;function hy(e){if(e instanceof Error&&e.name==="InvalidAccessError"&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}function my(){var e,t=document.createElement("a"),n=(e=t.attributionSourceId)!==null&&e!==void 0?e:t.attributionsourceid;return n===void 0?void 0:String(n)}var xu=-1,Cu=-2,gy=new Set([10752,2849,2884,2885,2886,2928,2929,2930,2931,2932,2960,2961,2962,2963,2964,2965,2966,2967,2968,2978,3024,3042,3088,3089,3106,3107,32773,32777,32777,32823,32824,32936,32937,32938,32939,32968,32969,32970,32971,3317,33170,3333,3379,3386,33901,33902,34016,34024,34076,3408,3410,3411,3412,3413,3414,3415,34467,34816,34817,34818,34819,34877,34921,34930,35660,35661,35724,35738,35739,36003,36004,36005,36347,36348,36349,37440,37441,37443,7936,7937,7938]),yy=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),vy=["FRAGMENT_SHADER","VERTEX_SHADER"],by=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],Tu="WEBGL_debug_renderer_info",wy="WEBGL_polygon_mode";function Sy(e){var t,n,r,o,s,i,a=e.cache,c=Ou(a);if(!c)return xu;if(!Iu(c))return Cu;var u=_u()?null:c.getExtension(Tu);return{version:((t=c.getParameter(c.VERSION))===null||t===void 0?void 0:t.toString())||"",vendor:((n=c.getParameter(c.VENDOR))===null||n===void 0?void 0:n.toString())||"",vendorUnmasked:u?(r=c.getParameter(u.UNMASKED_VENDOR_WEBGL))===null||r===void 0?void 0:r.toString():"",renderer:((o=c.getParameter(c.RENDERER))===null||o===void 0?void 0:o.toString())||"",rendererUnmasked:u?(s=c.getParameter(u.UNMASKED_RENDERER_WEBGL))===null||s===void 0?void 0:s.toString():"",shadingLanguageVersion:((i=c.getParameter(c.SHADING_LANGUAGE_VERSION))===null||i===void 0?void 0:i.toString())||""}}function Ey(e){var t=e.cache,n=Ou(t);if(!n)return xu;if(!Iu(n))return Cu;var r=n.getSupportedExtensions(),o=n.getContextAttributes(),s=[],i=[],a=[],c=[],u=[];if(o)for(var l=0,d=Object.keys(o);l<d.length;l++){var p=d[l];i.push("".concat(p,"=").concat(o[p]))}for(var h=Pu(n),m=0,g=h;m<g.length;m++){var v=g[m],y=n[v];a.push("".concat(v,"=").concat(y).concat(gy.has(y)?"=".concat(n.getParameter(y)):""))}if(r)for(var C=0,S=r;C<S.length;C++){var E=S[C];if(!(E===Tu&&_u()||E===wy&&Ty())){var b=n.getExtension(E);if(!b){s.push(E);continue}for(var x=0,T=Pu(b);x<T.length;x++){var v=T[x],y=b[v];c.push("".concat(v,"=").concat(y).concat(yy.has(y)?"=".concat(n.getParameter(y)):""))}}}for(var P=0,z=vy;P<z.length;P++)for(var I=z[P],D=0,$=by;D<$.length;D++){var V=$[D],N=xy(n,I,V);u.push("".concat(I,".").concat(V,"=").concat(N.join(",")))}return c.sort(),a.sort(),{contextAttributes:i,parameters:a,shaderPrecisions:u,extensions:r,extensionParameters:c,unsupportedExtensions:s}}function Ou(e){if(e.webgl)return e.webgl.context;var t=document.createElement("canvas"),n;t.addEventListener("webglCreateContextError",function(){return n=void 0});for(var r=0,o=["webgl","experimental-webgl"];r<o.length;r++){var s=o[r];try{n=t.getContext(s)}catch{}if(n)break}return e.webgl={context:n},n}function xy(e,t,n){var r=e.getShaderPrecisionFormat(e[t],e[n]);return r?[r.rangeMin,r.rangeMax,r.precision]:[]}function Pu(e){var t=Object.keys(e.__proto__);return t.filter(Cy)}function Cy(e){return typeof e=="string"&&!e.match(/[^A-Z0-9_x]/)}function _u(){return pu()}function Ty(){return eo()||cn()}function Iu(e){return typeof e.getParameter=="function"}function Oy(){var e=Ci()||cn();if(!e)return-2;if(!window.AudioContext)return-1;var t=new AudioContext().baseLatency;return t==null?-1:isFinite(t)?t:-3}function Py(){if(!window.Intl)return-1;var e=window.Intl.DateTimeFormat;if(!e)return-2;var t=e().resolvedOptions().locale;return!t&&t!==""?-3:t}var _y={fonts:dg,domBlockers:Gg,fontPreferences:cy,audio:eg,screenFrame:Mg,canvas:pg,osCpu:xg,languages:Cg,colorDepth:Tg,deviceMemory:Og,screenResolution:Pg,hardwareConcurrency:Ag,timezone:Dg,sessionStorage:Fg,localStorage:Vg,indexedDB:zg,openDatabase:$g,cpuClass:jg,platform:Hg,plugins:fg,touchSupport:Eg,vendor:Ug,vendorFlavors:Bg,cookiesEnabled:Wg,colorGamut:Kg,invertedColors:Jg,forcedColors:Qg,monochrome:ty,contrast:ny,reducedMotion:ry,reducedTransparency:oy,hdr:sy,math:iy,pdfViewerEnabled:ly,architecture:dy,applePay:fy,privateClickMeasurement:my,audioBaseLatency:Oy,dateTimeLocale:Py,webGlBasics:Sy,webGlExtensions:Ey};function Iy(e){return Wm(_y,e,[])}var ky="$ if upgrade to Pro: https://fpjs.dev/pro";function Ry(e){var t=Ny(e),n=My(t);return{score:t,comment:ky.replace(/\$/g,"".concat(n))}}function Ny(e){if(Ci())return .4;if(cn())return xi()&&!(no()&&to())?.5:.3;var t="value"in e.platform?e.platform.value:"";return/^Win/.test(t)?.6:/^Mac/.test(t)?.5:.7}function My(e){return uu(.99+.01*e,1e-4)}function Ay(e){for(var t="",n=0,r=Object.keys(e).sort();n<r.length;n++){var o=r[n],s=e[o],i="error"in s?"error":JSON.stringify(s.value);t+="".concat(t?"|":"").concat(o.replace(/([:|\\])/g,"\\$1"),":").concat(i)}return t}function ku(e){return JSON.stringify(e,function(t,n){return n instanceof Error?jm(n):n},2)}function Ru(e){return $m(Ay(e))}function Dy(e){var t,n=Ry(e);return{get visitorId(){return t===void 0&&(t=Ru(this.components)),t},set visitorId(r){t=r},confidence:n,components:e,version:su}}function Ly(e){return e===void 0&&(e=50),Rm(e,e*2)}function Fy(e,t){var n=Date.now();return{get:function(r){return pn(this,void 0,void 0,function(){var o,s,i;return hn(this,function(a){switch(a.label){case 0:return o=Date.now(),[4,e()];case 1:return s=a.sent(),i=Dy(s),(t||r?.debug)&&console.log("Copy the text below to get the debug data:\n\n```\nversion: ".concat(i.version,`
5
+ `.concat(t[c]?"🚫":"➡️"," ").concat(c)}}console.log("".concat(n,"\n```"))}function Kg(){for(var e=0,t=["rec2020","p3","srgb"];e<t.length;e++){var n=t[e];if(matchMedia("(color-gamut: ".concat(n,")")).matches)return n}}function Jg(){if(vu("inverted"))return!0;if(vu("none"))return!1}function vu(e){return matchMedia("(inverted-colors: ".concat(e,")")).matches}function Qg(){if(bu("active"))return!0;if(bu("none"))return!1}function bu(e){return matchMedia("(forced-colors: ".concat(e,")")).matches}var ey=100;function ty(){if(matchMedia("(min-monochrome: 0)").matches){for(var e=0;e<=ey;++e)if(matchMedia("(max-monochrome: ".concat(e,")")).matches)return e;throw new Error("Too high value")}}function ny(){if(Pr("no-preference"))return 0;if(Pr("high")||Pr("more"))return 1;if(Pr("low")||Pr("less"))return-1;if(Pr("forced"))return 10}function Pr(e){return matchMedia("(prefers-contrast: ".concat(e,")")).matches}function ry(){if(wu("reduce"))return!0;if(wu("no-preference"))return!1}function wu(e){return matchMedia("(prefers-reduced-motion: ".concat(e,")")).matches}function oy(){if(Su("reduce"))return!0;if(Su("no-preference"))return!1}function Su(e){return matchMedia("(prefers-reduced-transparency: ".concat(e,")")).matches}function sy(){if(Eu("high"))return!0;if(Eu("standard"))return!1}function Eu(e){return matchMedia("(dynamic-range: ".concat(e,")")).matches}var et=Math,Mt=function(){return 0};function iy(){var e=et.acos||Mt,t=et.acosh||Mt,n=et.asin||Mt,r=et.asinh||Mt,o=et.atanh||Mt,s=et.atan||Mt,i=et.sin||Mt,a=et.sinh||Mt,c=et.cos||Mt,u=et.cosh||Mt,l=et.tan||Mt,d=et.tanh||Mt,p=et.exp||Mt,h=et.expm1||Mt,m=et.log1p||Mt,g=function(P){return et.pow(et.PI,P)},v=function(P){return et.log(P+et.sqrt(P*P-1))},y=function(P){return et.log(P+et.sqrt(P*P+1))},C=function(P){return et.log((1+P)/(1-P))/2},S=function(P){return et.exp(P)-1/et.exp(P)/2},E=function(P){return(et.exp(P)+1/et.exp(P))/2},b=function(P){return et.exp(P)-1},x=function(P){return(et.exp(2*P)-1)/(et.exp(2*P)+1)},T=function(P){return et.log(1+P)};return{acos:e(.12312423423423424),acosh:t(1e308),acoshPf:v(1e154),asin:n(.12312423423423424),asinh:r(1),asinhPf:y(1),atanh:o(.5),atanhPf:C(.5),atan:s(.5),sin:i(-1e300),sinh:a(1),sinhPf:S(1),cos:c(10.000000000123),cosh:u(1),coshPf:E(1),tan:l(-1e300),tanh:d(1),tanhPf:x(1),exp:p(1),expm1:h(1),expm1Pf:b(1),log1p:m(10),log1pPf:T(10),powPI:g(-100)}}var ay="mmMwWLliI0fiflO&1",Ii={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};function cy(){return uy(function(e,t){for(var n={},r={},o=0,s=Object.keys(Ii);o<s.length;o++){var i=s[o],a=Ii[i],c=a[0],u=c===void 0?{}:c,l=a[1],d=l===void 0?ay:l,p=e.createElement("span");p.textContent=d,p.style.whiteSpace="nowrap";for(var h=0,m=Object.keys(u);h<m.length;h++){var g=m[h],v=u[g];v!==void 0&&(p.style[g]=v)}n[i]=p,t.append(e.createElement("br"),p)}for(var y=0,C=Object.keys(Ii);y<C.length;y++){var i=C[y];r[i]=n[i].getBoundingClientRect().width}return r})}function uy(e,t){return t===void 0&&(t=4e3),mu(function(n,r){var o=r.document,s=o.body,i=s.style;i.width="".concat(t,"px"),i.webkitTextSizeAdjust=i.textSizeAdjust="none",eo()?s.style.zoom="".concat(1/r.devicePixelRatio):cn()&&(s.style.zoom="reset");var a=o.createElement("div");return a.textContent=ou([],Array(t/20<<0),!0).map(function(){return"word"}).join(" "),s.appendChild(a),e(o,s)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}function ly(){return navigator.pdfViewerEnabled}function dy(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}function fy(){var e=window.ApplePaySession;if(typeof e?.canMakePayments!="function")return-1;if(py())return-3;try{return e.canMakePayments()?1:0}catch(t){return hy(t)}}var py=cg;function hy(e){if(e instanceof Error&&e.name==="InvalidAccessError"&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}function my(){var e,t=document.createElement("a"),n=(e=t.attributionSourceId)!==null&&e!==void 0?e:t.attributionsourceid;return n===void 0?void 0:String(n)}var xu=-1,Cu=-2,gy=new Set([10752,2849,2884,2885,2886,2928,2929,2930,2931,2932,2960,2961,2962,2963,2964,2965,2966,2967,2968,2978,3024,3042,3088,3089,3106,3107,32773,32777,32777,32823,32824,32936,32937,32938,32939,32968,32969,32970,32971,3317,33170,3333,3379,3386,33901,33902,34016,34024,34076,3408,3410,3411,3412,3413,3414,3415,34467,34816,34817,34818,34819,34877,34921,34930,35660,35661,35724,35738,35739,36003,36004,36005,36347,36348,36349,37440,37441,37443,7936,7937,7938]),yy=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),vy=["FRAGMENT_SHADER","VERTEX_SHADER"],by=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],Tu="WEBGL_debug_renderer_info",wy="WEBGL_polygon_mode";function Sy(e){var t,n,r,o,s,i,a=e.cache,c=Ou(a);if(!c)return xu;if(!Iu(c))return Cu;var u=_u()?null:c.getExtension(Tu);return{version:((t=c.getParameter(c.VERSION))===null||t===void 0?void 0:t.toString())||"",vendor:((n=c.getParameter(c.VENDOR))===null||n===void 0?void 0:n.toString())||"",vendorUnmasked:u?(r=c.getParameter(u.UNMASKED_VENDOR_WEBGL))===null||r===void 0?void 0:r.toString():"",renderer:((o=c.getParameter(c.RENDERER))===null||o===void 0?void 0:o.toString())||"",rendererUnmasked:u?(s=c.getParameter(u.UNMASKED_RENDERER_WEBGL))===null||s===void 0?void 0:s.toString():"",shadingLanguageVersion:((i=c.getParameter(c.SHADING_LANGUAGE_VERSION))===null||i===void 0?void 0:i.toString())||""}}function Ey(e){var t=e.cache,n=Ou(t);if(!n)return xu;if(!Iu(n))return Cu;var r=n.getSupportedExtensions(),o=n.getContextAttributes(),s=[],i=[],a=[],c=[],u=[];if(o)for(var l=0,d=Object.keys(o);l<d.length;l++){var p=d[l];i.push("".concat(p,"=").concat(o[p]))}for(var h=Pu(n),m=0,g=h;m<g.length;m++){var v=g[m],y=n[v];a.push("".concat(v,"=").concat(y).concat(gy.has(y)?"=".concat(n.getParameter(y)):""))}if(r)for(var C=0,S=r;C<S.length;C++){var E=S[C];if(!(E===Tu&&_u()||E===wy&&Ty())){var b=n.getExtension(E);if(!b){s.push(E);continue}for(var x=0,T=Pu(b);x<T.length;x++){var v=T[x],y=b[v];c.push("".concat(v,"=").concat(y).concat(yy.has(y)?"=".concat(n.getParameter(y)):""))}}}for(var P=0,$=vy;P<$.length;P++)for(var M=$[P],V=0,L=by;V<L.length;V++){var D=L[V],R=xy(n,M,D);u.push("".concat(M,".").concat(D,"=").concat(R.join(",")))}return c.sort(),a.sort(),{contextAttributes:i,parameters:a,shaderPrecisions:u,extensions:r,extensionParameters:c,unsupportedExtensions:s}}function Ou(e){if(e.webgl)return e.webgl.context;var t=document.createElement("canvas"),n;t.addEventListener("webglCreateContextError",function(){return n=void 0});for(var r=0,o=["webgl","experimental-webgl"];r<o.length;r++){var s=o[r];try{n=t.getContext(s)}catch{}if(n)break}return e.webgl={context:n},n}function xy(e,t,n){var r=e.getShaderPrecisionFormat(e[t],e[n]);return r?[r.rangeMin,r.rangeMax,r.precision]:[]}function Pu(e){var t=Object.keys(e.__proto__);return t.filter(Cy)}function Cy(e){return typeof e=="string"&&!e.match(/[^A-Z0-9_x]/)}function _u(){return pu()}function Ty(){return eo()||cn()}function Iu(e){return typeof e.getParameter=="function"}function Oy(){var e=Ci()||cn();if(!e)return-2;if(!window.AudioContext)return-1;var t=new AudioContext().baseLatency;return t==null?-1:isFinite(t)?t:-3}function Py(){if(!window.Intl)return-1;var e=window.Intl.DateTimeFormat;if(!e)return-2;var t=e().resolvedOptions().locale;return!t&&t!==""?-3:t}var _y={fonts:dg,domBlockers:Gg,fontPreferences:cy,audio:eg,screenFrame:Mg,canvas:pg,osCpu:xg,languages:Cg,colorDepth:Tg,deviceMemory:Og,screenResolution:Pg,hardwareConcurrency:Ag,timezone:Dg,sessionStorage:Fg,localStorage:Vg,indexedDB:zg,openDatabase:$g,cpuClass:jg,platform:Hg,plugins:fg,touchSupport:Eg,vendor:Ug,vendorFlavors:Bg,cookiesEnabled:Wg,colorGamut:Kg,invertedColors:Jg,forcedColors:Qg,monochrome:ty,contrast:ny,reducedMotion:ry,reducedTransparency:oy,hdr:sy,math:iy,pdfViewerEnabled:ly,architecture:dy,applePay:fy,privateClickMeasurement:my,audioBaseLatency:Oy,dateTimeLocale:Py,webGlBasics:Sy,webGlExtensions:Ey};function Iy(e){return Wm(_y,e,[])}var ky="$ if upgrade to Pro: https://fpjs.dev/pro";function Ry(e){var t=Ny(e),n=My(t);return{score:t,comment:ky.replace(/\$/g,"".concat(n))}}function Ny(e){if(Ci())return .4;if(cn())return xi()&&!(no()&&to())?.5:.3;var t="value"in e.platform?e.platform.value:"";return/^Win/.test(t)?.6:/^Mac/.test(t)?.5:.7}function My(e){return uu(.99+.01*e,1e-4)}function Ay(e){for(var t="",n=0,r=Object.keys(e).sort();n<r.length;n++){var o=r[n],s=e[o],i="error"in s?"error":JSON.stringify(s.value);t+="".concat(t?"|":"").concat(o.replace(/([:|\\])/g,"\\$1"),":").concat(i)}return t}function ku(e){return JSON.stringify(e,function(t,n){return n instanceof Error?jm(n):n},2)}function Ru(e){return $m(Ay(e))}function Dy(e){var t,n=Ry(e);return{get visitorId(){return t===void 0&&(t=Ru(this.components)),t},set visitorId(r){t=r},confidence:n,components:e,version:su}}function Ly(e){return e===void 0&&(e=50),Rm(e,e*2)}function Fy(e,t){var n=Date.now();return{get:function(r){return pn(this,void 0,void 0,function(){var o,s,i;return hn(this,function(a){switch(a.label){case 0:return o=Date.now(),[4,e()];case 1:return s=a.sent(),i=Dy(s),(t||r?.debug)&&console.log("Copy the text below to get the debug data:\n\n```\nversion: ".concat(i.version,`
6
6
  userAgent: `).concat(navigator.userAgent,`
7
7
  timeBetweenLoadAndGet: `).concat(o-n,`
8
8
  visitorId: `).concat(i.visitorId,`
9
- components: `).concat(ku(s),"\n```")),[2,i]}})})}}}function Vy(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(su,"/npm-monitoring"),!0),e.send()}catch(t){console.error(t)}}function zy(e){var t;return e===void 0&&(e={}),pn(this,void 0,void 0,function(){var n,r,o;return hn(this,function(s){switch(s.label){case 0:return(!((t=e.monitoring)!==null&&t!==void 0)||t)&&Vy(),n=e.delayFallback,r=e.debug,[4,Ly(n)];case 1:return s.sent(),o=Iy({cache:{},debug:r}),[2,Fy(o,r)]}})})}var $y={load:zy,hashComponents:Ru,componentsToDebugString:ku};function Nu(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Nu(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Mu(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Nu(e))&&(r&&(r+=" "),r+=t);return r}const ki="-",jy=e=>{const t=Uy(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(ki);return a[0]===""&&a.length!==1&&a.shift(),Au(a,t)||Hy(i)},getConflictingClassGroupIds:(i,a)=>{const c=n[i]||[];return a&&r[i]?[...c,...r[i]]:c}}},Au=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?Au(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(ki);return t.validators.find(({validator:i})=>i(s))?.classGroupId},Du=/^\[(.+)\]$/,Hy=e=>{if(Du.test(e)){const t=Du.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Uy=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return Wy(Object.entries(e.classGroups),n).forEach(([s,i])=>{Ri(i,r,s,t)}),r},Ri=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:Lu(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(By(o)){Ri(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{Ri(i,Lu(t,s),n,r)})})},Lu=(e,t)=>{let n=e;return t.split(ki).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},By=e=>e.isThemeGetter,Wy=(e,t)=>t?e.map(([n,r])=>{const o=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([i,a])=>[t+i,a])):s);return[n,o]}):e,Zy=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=r.get(s))!==void 0)return o(s,i),i},set(s,i){n.has(s)?n.set(s,i):o(s,i)}}},Fu="!",Gy=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],s=t.length,i=a=>{const c=[];let u=0,l=0,d;for(let v=0;v<a.length;v++){let y=a[v];if(u===0){if(y===o&&(r||a.slice(v,v+s)===t)){c.push(a.slice(l,v)),l=v+s;continue}if(y==="/"){d=v;continue}}y==="["?u++:y==="]"&&u--}const p=c.length===0?a:a.substring(l),h=p.startsWith(Fu),m=h?p.substring(1):p,g=d&&d>l?d-l:void 0;return{modifiers:c,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:g}};return n?a=>n({className:a,parseClassName:i}):i},Yy=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},Xy=e=>({cache:Zy(e.cacheSize),parseClassName:Gy(e),...jy(e)}),qy=/\s+/,Ky=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,s=[],i=e.trim().split(qy);let a="";for(let c=i.length-1;c>=0;c-=1){const u=i[c],{modifiers:l,hasImportantModifier:d,baseClassName:p,maybePostfixModifierPosition:h}=n(u);let m=!!h,g=r(m?p.substring(0,h):p);if(!g){if(!m){a=u+(a.length>0?" "+a:a);continue}if(g=r(p),!g){a=u+(a.length>0?" "+a:a);continue}m=!1}const v=Yy(l).join(":"),y=d?v+Fu:v,C=y+g;if(s.includes(C))continue;s.push(C);const S=o(g,m);for(let E=0;E<S.length;++E){const b=S[E];s.push(y+b)}a=u+(a.length>0?" "+a:a)}return a};function Jy(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Vu(t))&&(r&&(r+=" "),r+=n);return r}const Vu=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Vu(e[r]))&&(n&&(n+=" "),n+=t);return n};function Qy(e,...t){let n,r,o,s=i;function i(c){const u=t.reduce((l,d)=>d(l),e());return n=Xy(u),r=n.cache.get,o=n.cache.set,s=a,a(c)}function a(c){const u=r(c);if(u)return u;const l=Ky(c,n);return o(c,l),l}return function(){return s(Jy.apply(null,arguments))}}const ut=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},zu=/^\[(?:([a-z-]+):)?(.+)\]$/i,ev=/^\d+\/\d+$/,tv=new Set(["px","full","screen"]),nv=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,rv=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ov=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,sv=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,iv=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,kn=e=>_r(e)||tv.has(e)||ev.test(e),Hn=e=>Ir(e,"length",hv),_r=e=>!!e&&!Number.isNaN(Number(e)),Ni=e=>Ir(e,"number",_r),ro=e=>!!e&&Number.isInteger(Number(e)),av=e=>e.endsWith("%")&&_r(e.slice(0,-1)),ze=e=>zu.test(e),Un=e=>nv.test(e),cv=new Set(["length","size","percentage"]),uv=e=>Ir(e,cv,$u),lv=e=>Ir(e,"position",$u),dv=new Set(["image","url"]),fv=e=>Ir(e,dv,gv),pv=e=>Ir(e,"",mv),oo=()=>!0,Ir=(e,t,n)=>{const r=zu.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},hv=e=>rv.test(e)&&!ov.test(e),$u=()=>!1,mv=e=>sv.test(e),gv=e=>iv.test(e),Mi=Qy(()=>{const e=ut("colors"),t=ut("spacing"),n=ut("blur"),r=ut("brightness"),o=ut("borderColor"),s=ut("borderRadius"),i=ut("borderSpacing"),a=ut("borderWidth"),c=ut("contrast"),u=ut("grayscale"),l=ut("hueRotate"),d=ut("invert"),p=ut("gap"),h=ut("gradientColorStops"),m=ut("gradientColorStopPositions"),g=ut("inset"),v=ut("margin"),y=ut("opacity"),C=ut("padding"),S=ut("saturate"),E=ut("scale"),b=ut("sepia"),x=ut("skew"),T=ut("space"),P=ut("translate"),z=()=>["auto","contain","none"],I=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",ze,t],$=()=>[ze,t],V=()=>["",kn,Hn],N=()=>["auto",_r,ze],O=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],k=()=>["solid","dashed","dotted","double","none"],_=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],M=()=>["start","end","center","between","around","evenly","stretch"],A=()=>["","0",ze],j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>[_r,ze];return{cacheSize:500,separator:":",theme:{colors:[oo],spacing:[kn,Hn],blur:["none","",Un,ze],brightness:B(),borderColor:[e],borderRadius:["none","","full",Un,ze],borderSpacing:$(),borderWidth:V(),contrast:B(),grayscale:A(),hueRotate:B(),invert:A(),gap:$(),gradientColorStops:[e],gradientColorStopPositions:[av,Hn],inset:D(),margin:D(),opacity:B(),padding:$(),saturate:B(),scale:B(),sepia:A(),skew:B(),space:$(),translate:$()},classGroups:{aspect:[{aspect:["auto","square","video",ze]}],container:["container"],columns:[{columns:[Un]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...O(),ze]}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ro,ze]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ze]}],grow:[{grow:A()}],shrink:[{shrink:A()}],order:[{order:["first","last","none",ro,ze]}],"grid-cols":[{"grid-cols":[oo]}],"col-start-end":[{col:["auto",{span:["full",ro,ze]},ze]}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":[oo]}],"row-start-end":[{row:["auto",{span:[ro,ze]},ze]}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ze]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ze]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...M()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...M(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...M(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ze,t]}],"min-w":[{"min-w":[ze,t,"min","max","fit"]}],"max-w":[{"max-w":[ze,t,"none","full","min","max","fit","prose",{screen:[Un]},Un]}],h:[{h:[ze,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ze,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ze,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ze,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Un,Hn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ni]}],"font-family":[{font:[oo]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ze]}],"line-clamp":[{"line-clamp":["none",_r,Ni]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",kn,ze]}],"list-image":[{"list-image":["none",ze]}],"list-style-type":[{list:["none","disc","decimal",ze]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...k(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",kn,Hn]}],"underline-offset":[{"underline-offset":["auto",kn,ze]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ze]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...O(),lv]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",uv]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},fv]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...k(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:k()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...k()]}],"outline-offset":[{"outline-offset":[kn,ze]}],"outline-w":[{outline:[kn,Hn]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[kn,Hn]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Un,pv]}],"shadow-color":[{shadow:[oo]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[..._(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":_()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Un,ze]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[l]}],invert:[{invert:[d]}],saturate:[{saturate:[S]}],sepia:[{sepia:[b]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[l]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[b]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ze]}],duration:[{duration:B()}],ease:[{ease:["linear","in","out","in-out",ze]}],delay:[{delay:B()}],animate:[{animate:["none","spin","ping","pulse","bounce",ze]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[ro,ze]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[x]}],"skew-y":[{"skew-y":[x]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ze]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ze]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ze]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[kn,Hn,Ni]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}),yv=[];function so(e){f.useEffect(e,yv)}const ju={};function wt(e,t){const n=f.useRef(ju);return n.current===ju&&(n.current=e(t)),n}function vv(e,t){return function(r,...o){const s=new URL(e);return s.searchParams.set("code",r.toString()),o.forEach(i=>s.searchParams.append("args[]",i)),`${t} error #${r}; visit ${s} for the full message.`}}const ft=vv("https://base-ui.com/production-error","Base UI"),zo=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(zo.displayName="ToastContext");function Hu(){const e=f.useContext(zo);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: useToastManager must be used within <Toast.Provider>.":ft(73));return e}const de=(e,t,n,r,o,s,...i)=>{if(i.length>0)throw new Error(process.env.NODE_ENV!=="production"?"Unsupported number of selectors":ft(1));let a;if(e&&t&&n&&r&&o&&s)a=(c,u,l,d)=>{const p=e(c,u,l,d),h=t(c,u,l,d),m=n(c,u,l,d),g=r(c,u,l,d),v=o(c,u,l,d);return s(p,h,m,g,v,u,l,d)};else if(e&&t&&n&&r&&o)a=(c,u,l,d)=>{const p=e(c,u,l,d),h=t(c,u,l,d),m=n(c,u,l,d),g=r(c,u,l,d);return o(p,h,m,g,u,l,d)};else if(e&&t&&n&&r)a=(c,u,l,d)=>{const p=e(c,u,l,d),h=t(c,u,l,d),m=n(c,u,l,d);return r(p,h,m,u,l,d)};else if(e&&t&&n)a=(c,u,l,d)=>{const p=e(c,u,l,d),h=t(c,u,l,d);return n(p,h,u,l,d)};else if(e&&t)a=(c,u,l,d)=>{const p=e(c,u,l,d);return t(p,u,l,d)};else if(e)a=e;else throw new Error("Missing arguments");return a};var bv=(e,t,n)=>{if(t.length===1&&t[0]===n){let r=!1;try{const o={};e(o)===o&&(r=!0)}catch{}if(r){let o;try{throw new Error}catch(s){({stack:o}=s)}console.warn(`The result function returned its own inputs without modification. e.g
9
+ components: `).concat(ku(s),"\n```")),[2,i]}})})}}}function Vy(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(su,"/npm-monitoring"),!0),e.send()}catch(t){console.error(t)}}function zy(e){var t;return e===void 0&&(e={}),pn(this,void 0,void 0,function(){var n,r,o;return hn(this,function(s){switch(s.label){case 0:return(!((t=e.monitoring)!==null&&t!==void 0)||t)&&Vy(),n=e.delayFallback,r=e.debug,[4,Ly(n)];case 1:return s.sent(),o=Iy({cache:{},debug:r}),[2,Fy(o,r)]}})})}var $y={load:zy,hashComponents:Ru,componentsToDebugString:ku};function Nu(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Nu(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Mu(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Nu(e))&&(r&&(r+=" "),r+=t);return r}const ki="-",jy=e=>{const t=Uy(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(ki);return a[0]===""&&a.length!==1&&a.shift(),Au(a,t)||Hy(i)},getConflictingClassGroupIds:(i,a)=>{const c=n[i]||[];return a&&r[i]?[...c,...r[i]]:c}}},Au=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?Au(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(ki);return t.validators.find(({validator:i})=>i(s))?.classGroupId},Du=/^\[(.+)\]$/,Hy=e=>{if(Du.test(e)){const t=Du.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Uy=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return Wy(Object.entries(e.classGroups),n).forEach(([s,i])=>{Ri(i,r,s,t)}),r},Ri=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:Lu(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(By(o)){Ri(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{Ri(i,Lu(t,s),n,r)})})},Lu=(e,t)=>{let n=e;return t.split(ki).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},By=e=>e.isThemeGetter,Wy=(e,t)=>t?e.map(([n,r])=>{const o=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([i,a])=>[t+i,a])):s);return[n,o]}):e,Zy=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=r.get(s))!==void 0)return o(s,i),i},set(s,i){n.has(s)?n.set(s,i):o(s,i)}}},Fu="!",Gy=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],s=t.length,i=a=>{const c=[];let u=0,l=0,d;for(let v=0;v<a.length;v++){let y=a[v];if(u===0){if(y===o&&(r||a.slice(v,v+s)===t)){c.push(a.slice(l,v)),l=v+s;continue}if(y==="/"){d=v;continue}}y==="["?u++:y==="]"&&u--}const p=c.length===0?a:a.substring(l),h=p.startsWith(Fu),m=h?p.substring(1):p,g=d&&d>l?d-l:void 0;return{modifiers:c,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:g}};return n?a=>n({className:a,parseClassName:i}):i},Yy=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},Xy=e=>({cache:Zy(e.cacheSize),parseClassName:Gy(e),...jy(e)}),qy=/\s+/,Ky=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,s=[],i=e.trim().split(qy);let a="";for(let c=i.length-1;c>=0;c-=1){const u=i[c],{modifiers:l,hasImportantModifier:d,baseClassName:p,maybePostfixModifierPosition:h}=n(u);let m=!!h,g=r(m?p.substring(0,h):p);if(!g){if(!m){a=u+(a.length>0?" "+a:a);continue}if(g=r(p),!g){a=u+(a.length>0?" "+a:a);continue}m=!1}const v=Yy(l).join(":"),y=d?v+Fu:v,C=y+g;if(s.includes(C))continue;s.push(C);const S=o(g,m);for(let E=0;E<S.length;++E){const b=S[E];s.push(y+b)}a=u+(a.length>0?" "+a:a)}return a};function Jy(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Vu(t))&&(r&&(r+=" "),r+=n);return r}const Vu=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Vu(e[r]))&&(n&&(n+=" "),n+=t);return n};function Qy(e,...t){let n,r,o,s=i;function i(c){const u=t.reduce((l,d)=>d(l),e());return n=Xy(u),r=n.cache.get,o=n.cache.set,s=a,a(c)}function a(c){const u=r(c);if(u)return u;const l=Ky(c,n);return o(c,l),l}return function(){return s(Jy.apply(null,arguments))}}const ut=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},zu=/^\[(?:([a-z-]+):)?(.+)\]$/i,ev=/^\d+\/\d+$/,tv=new Set(["px","full","screen"]),nv=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,rv=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ov=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,sv=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,iv=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,kn=e=>_r(e)||tv.has(e)||ev.test(e),Hn=e=>Ir(e,"length",hv),_r=e=>!!e&&!Number.isNaN(Number(e)),Ni=e=>Ir(e,"number",_r),ro=e=>!!e&&Number.isInteger(Number(e)),av=e=>e.endsWith("%")&&_r(e.slice(0,-1)),ze=e=>zu.test(e),Un=e=>nv.test(e),cv=new Set(["length","size","percentage"]),uv=e=>Ir(e,cv,$u),lv=e=>Ir(e,"position",$u),dv=new Set(["image","url"]),fv=e=>Ir(e,dv,gv),pv=e=>Ir(e,"",mv),oo=()=>!0,Ir=(e,t,n)=>{const r=zu.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},hv=e=>rv.test(e)&&!ov.test(e),$u=()=>!1,mv=e=>sv.test(e),gv=e=>iv.test(e),Mi=Qy(()=>{const e=ut("colors"),t=ut("spacing"),n=ut("blur"),r=ut("brightness"),o=ut("borderColor"),s=ut("borderRadius"),i=ut("borderSpacing"),a=ut("borderWidth"),c=ut("contrast"),u=ut("grayscale"),l=ut("hueRotate"),d=ut("invert"),p=ut("gap"),h=ut("gradientColorStops"),m=ut("gradientColorStopPositions"),g=ut("inset"),v=ut("margin"),y=ut("opacity"),C=ut("padding"),S=ut("saturate"),E=ut("scale"),b=ut("sepia"),x=ut("skew"),T=ut("space"),P=ut("translate"),$=()=>["auto","contain","none"],M=()=>["auto","hidden","clip","visible","scroll"],V=()=>["auto",ze,t],L=()=>[ze,t],D=()=>["",kn,Hn],R=()=>["auto",_r,ze],O=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],I=()=>["solid","dashed","dotted","double","none"],_=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],N=()=>["start","end","center","between","around","evenly","stretch"],A=()=>["","0",ze],j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>[_r,ze];return{cacheSize:500,separator:":",theme:{colors:[oo],spacing:[kn,Hn],blur:["none","",Un,ze],brightness:B(),borderColor:[e],borderRadius:["none","","full",Un,ze],borderSpacing:L(),borderWidth:D(),contrast:B(),grayscale:A(),hueRotate:B(),invert:A(),gap:L(),gradientColorStops:[e],gradientColorStopPositions:[av,Hn],inset:V(),margin:V(),opacity:B(),padding:L(),saturate:B(),scale:B(),sepia:A(),skew:B(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",ze]}],container:["container"],columns:[{columns:[Un]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...O(),ze]}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ro,ze]}],basis:[{basis:V()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ze]}],grow:[{grow:A()}],shrink:[{shrink:A()}],order:[{order:["first","last","none",ro,ze]}],"grid-cols":[{"grid-cols":[oo]}],"col-start-end":[{col:["auto",{span:["full",ro,ze]},ze]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[oo]}],"row-start-end":[{row:["auto",{span:[ro,ze]},ze]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ze]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ze]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...N()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...N(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...N(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ze,t]}],"min-w":[{"min-w":[ze,t,"min","max","fit"]}],"max-w":[{"max-w":[ze,t,"none","full","min","max","fit","prose",{screen:[Un]},Un]}],h:[{h:[ze,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ze,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ze,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ze,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Un,Hn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ni]}],"font-family":[{font:[oo]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ze]}],"line-clamp":[{"line-clamp":["none",_r,Ni]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",kn,ze]}],"list-image":[{"list-image":["none",ze]}],"list-style-type":[{list:["none","disc","decimal",ze]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...I(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",kn,Hn]}],"underline-offset":[{"underline-offset":["auto",kn,ze]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ze]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...O(),lv]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",uv]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},fv]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...I(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:I()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...I()]}],"outline-offset":[{"outline-offset":[kn,ze]}],"outline-w":[{outline:[kn,Hn]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[kn,Hn]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Un,pv]}],"shadow-color":[{shadow:[oo]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[..._(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":_()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Un,ze]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[l]}],invert:[{invert:[d]}],saturate:[{saturate:[S]}],sepia:[{sepia:[b]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[l]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[b]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ze]}],duration:[{duration:B()}],ease:[{ease:["linear","in","out","in-out",ze]}],delay:[{delay:B()}],animate:[{animate:["none","spin","ping","pulse","bounce",ze]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[ro,ze]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[x]}],"skew-y":[{"skew-y":[x]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ze]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ze]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ze]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[kn,Hn,Ni]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}),yv=[];function so(e){f.useEffect(e,yv)}const ju={};function wt(e,t){const n=f.useRef(ju);return n.current===ju&&(n.current=e(t)),n}function vv(e,t){return function(r,...o){const s=new URL(e);return s.searchParams.set("code",r.toString()),o.forEach(i=>s.searchParams.append("args[]",i)),`${t} error #${r}; visit ${s} for the full message.`}}const ft=vv("https://base-ui.com/production-error","Base UI"),zo=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(zo.displayName="ToastContext");function Hu(){const e=f.useContext(zo);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: useToastManager must be used within <Toast.Provider>.":ft(73));return e}const de=(e,t,n,r,o,s,...i)=>{if(i.length>0)throw new Error(process.env.NODE_ENV!=="production"?"Unsupported number of selectors":ft(1));let a;if(e&&t&&n&&r&&o&&s)a=(c,u,l,d)=>{const p=e(c,u,l,d),h=t(c,u,l,d),m=n(c,u,l,d),g=r(c,u,l,d),v=o(c,u,l,d);return s(p,h,m,g,v,u,l,d)};else if(e&&t&&n&&r&&o)a=(c,u,l,d)=>{const p=e(c,u,l,d),h=t(c,u,l,d),m=n(c,u,l,d),g=r(c,u,l,d);return o(p,h,m,g,u,l,d)};else if(e&&t&&n&&r)a=(c,u,l,d)=>{const p=e(c,u,l,d),h=t(c,u,l,d),m=n(c,u,l,d);return r(p,h,m,u,l,d)};else if(e&&t&&n)a=(c,u,l,d)=>{const p=e(c,u,l,d),h=t(c,u,l,d);return n(p,h,u,l,d)};else if(e&&t)a=(c,u,l,d)=>{const p=e(c,u,l,d);return t(p,u,l,d)};else if(e)a=e;else throw new Error("Missing arguments");return a};var bv=(e,t,n)=>{if(t.length===1&&t[0]===n){let r=!1;try{const o={};e(o)===o&&(r=!0)}catch{}if(r){let o;try{throw new Error}catch(s){({stack:o}=s)}console.warn(`The result function returned its own inputs without modification. e.g
10
10
  \`createSelector([state => state.todos], todos => todos)\`
11
11
  This could lead to inefficient memoization and unnecessary re-renders.
12
12
  Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,{stack:o})}}},wv=(e,t,n)=>{const{memoize:r,memoizeOptions:o}=t,{inputSelectorResults:s,inputSelectorResultsCopy:i}=e,a=r(()=>({}),...o);if(!(a.apply(null,s)===a.apply(null,i))){let u;try{throw new Error}catch(l){({stack:u}=l)}console.warn(`An input selector returned a different result when passed same arguments.
13
13
  This means your output selector will likely run more frequently than intended.
14
14
  Avoid returning a new reference inside your input selector, e.g.
15
- \`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,{arguments:n,firstInputs:s,secondInputs:i,stack:u})}},Sv={inputStabilityCheck:"once",identityFunctionCheck:"once"},$o=Symbol("NOT_FOUND");function Ev(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function xv(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function Cv(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var Uu=e=>Array.isArray(e)?e:[e];function Tv(e){const t=Array.isArray(e[0])?e[0]:e;return Cv(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Bu(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}var Ov=(e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:r}={...Sv,...t};return{identityFunctionCheck:{shouldRun:n==="always"||n==="once"&&e,run:bv},inputStabilityCheck:{shouldRun:r==="always"||r==="once"&&e,run:wv}}};function Pv(e){let t;return{get(n){return t&&e(t.key,n)?t.value:$o},put(n,r){t={key:n,value:r}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function _v(e,t){let n=[];function r(a){const c=n.findIndex(u=>t(a,u.key));if(c>-1){const u=n[c];return c>0&&(n.splice(c,1),n.unshift(u)),u.value}return $o}function o(a,c){r(a)===$o&&(n.unshift({key:a,value:c}),n.length>e&&n.pop())}function s(){return n}function i(){n=[]}return{get:r,put:o,getEntries:s,clear:i}}var Iv=(e,t)=>e===t;function kv(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;const{length:o}=n;for(let s=0;s<o;s++)if(!e(n[s],r[s]))return!1;return!0}}function Rv(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:r=Iv,maxSize:o=1,resultEqualityCheck:s}=n,i=kv(r);let a=0;const c=o<=1?Pv(i):_v(o,i);function u(){let l=c.get(arguments);if(l===$o){if(l=e.apply(null,arguments),a++,s){const p=c.getEntries().find(h=>s(h.value,l));p&&(l=p.value,a!==0&&a--)}c.put(arguments,l)}return l}return u.clearCache=()=>{c.clear(),u.resetResultsCount()},u.resultsCount=()=>a,u.resetResultsCount=()=>{a=0},u}var Nv=class{constructor(e){this.value=e}deref(){return this.value}},Mv=typeof WeakRef<"u"?WeakRef:Nv,Av=0,Wu=1;function jo(){return{s:Av,v:void 0,o:null,p:null}}function Zu(e,t={}){let n=jo();const{resultEqualityCheck:r}=t;let o,s=0;function i(){let a=n;const{length:c}=arguments;for(let d=0,p=c;d<p;d++){const h=arguments[d];if(typeof h=="function"||typeof h=="object"&&h!==null){let m=a.o;m===null&&(a.o=m=new WeakMap);const g=m.get(h);g===void 0?(a=jo(),m.set(h,a)):a=g}else{let m=a.p;m===null&&(a.p=m=new Map);const g=m.get(h);g===void 0?(a=jo(),m.set(h,a)):a=g}}const u=a;let l;if(a.s===Wu)l=a.v;else if(l=e.apply(null,arguments),s++,r){const d=o?.deref?.()??o;d!=null&&r(d,l)&&(l=d,s!==0&&s--),o=typeof l=="object"&&l!==null||typeof l=="function"?new Mv(l):l}return u.s=Wu,u.v=l,l}return i.clearCache=()=>{n=jo(),i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function Gu(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...o)=>{let s=0,i=0,a,c={},u=o.pop();typeof u=="object"&&(c=u,u=o.pop()),Ev(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const l={...n,...c},{memoize:d,memoizeOptions:p=[],argsMemoize:h=Zu,argsMemoizeOptions:m=[],devModeChecks:g={}}=l,v=Uu(p),y=Uu(m),C=Tv(o),S=d(function(){return s++,u.apply(null,arguments)},...v);let E=!0;const b=h(function(){i++;const T=Bu(C,arguments);if(a=S.apply(null,T),process.env.NODE_ENV!=="production"){const{identityFunctionCheck:P,inputStabilityCheck:z}=Ov(E,g);if(P.shouldRun&&P.run(u,T,a),z.shouldRun){const I=Bu(C,arguments);z.run({inputSelectorResults:T,inputSelectorResultsCopy:I},{memoize:d,memoizeOptions:v},arguments)}E&&(E=!1)}return a},...y);return Object.assign(b,{resultFunc:u,memoizedResultFunc:S,dependencies:C,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:d,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var Dv=Gu(Zu),Lv=Object.assign((e,t=Dv)=>{xv(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(s=>e[s]);return t(r,(...s)=>s.reduce((i,a,c)=>(i[n[c]]=a,i),{}))},{withTypes:()=>Lv});const Fv=Gu({memoize:Rv,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),Vv=(...e)=>{const t=new WeakMap;let n=1;const r=e[e.length-1],o=e.length-1||1,s=r.length-o;if(s>3)throw new Error(process.env.NODE_ENV!=="production"?"Unsupported number of arguments":ft(2));return(a,c,u,l)=>{let d=a.__cacheKey__;d||(d={id:n},a.__cacheKey__=d,n+=1);let p=t.get(d);if(!p){let h=e;const m=[void 0,void 0,void 0];switch(s){case 0:break;case 1:{h=[...e.slice(0,-1),()=>m[0],r];break}case 2:{h=[...e.slice(0,-1),()=>m[0],()=>m[1],r];break}case 3:{h=[...e.slice(0,-1),()=>m[0],()=>m[1],()=>m[2],r];break}default:throw new Error(process.env.NODE_ENV!=="production"?"Unsupported number of arguments":ft(2))}p=Fv(...h),p.selectorArgs=m,t.set(d,p)}switch(p.selectorArgs[0]=c,p.selectorArgs[1]=u,p.selectorArgs[2]=l,s){case 0:return p(a);case 1:return p(a,c);case 2:return p(a,c,u);case 3:return p(a,c,u,l);default:throw new Error("unreachable")}}};var Ho=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Uo={exports:{}},Ai={};var Yu;function $v(){if(Yu)return Ai;Yu=1;var e=oe;function t(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(d,p){var h=p(),m=r({inst:{value:h,getSnapshot:p}}),g=m[0].inst,v=m[1];return s(function(){g.value=h,g.getSnapshot=p,c(g)&&v({inst:g})},[d,h,p]),o(function(){return c(g)&&v({inst:g}),d(function(){c(g)&&v({inst:g})})},[d]),i(h),h}function c(d){var p=d.getSnapshot;d=d.value;try{var h=p();return!n(d,h)}catch{return!0}}function u(d,p){return p()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return Ai.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:l,Ai}var Di={};var Xu;function jv(){return Xu||(Xu=1,process.env.NODE_ENV!=="production"&&(function(){function e(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}function t(h,m){l||o.startTransition===void 0||(l=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var g=m();if(!d){var v=m();s(g,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}v=i({inst:{value:g,getSnapshot:m}});var y=v[0].inst,C=v[1];return c(function(){y.value=g,y.getSnapshot=m,n(y)&&C({inst:y})},[h,g,m]),a(function(){return n(y)&&C({inst:y}),h(function(){n(y)&&C({inst:y})})},[h]),u(g),g}function n(h){var m=h.getSnapshot;h=h.value;try{var g=m();return!s(h,g)}catch{return!0}}function r(h,m){return m()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=oe,s=typeof Object.is=="function"?Object.is:e,i=o.useState,a=o.useEffect,c=o.useLayoutEffect,u=o.useDebugValue,l=!1,d=!1,p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Di.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:p,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Di}var qu;function Li(){return qu||(qu=1,process.env.NODE_ENV==="production"?Uo.exports=$v():Uo.exports=jv()),Uo.exports}var Hv=Li(),Bo={exports:{}},Fi={};var Ku;function Uv(){if(Ku)return Fi;Ku=1;var e=oe,t=Li();function n(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,c=e.useDebugValue;return Fi.useSyncExternalStoreWithSelector=function(u,l,d,p,h){var m=s(null);if(m.current===null){var g={hasValue:!1,value:null};m.current=g}else g=m.current;m=a(function(){function y(x){if(!C){if(C=!0,S=x,x=p(x),h!==void 0&&g.hasValue){var T=g.value;if(h(T,x))return E=T}return E=x}if(T=E,r(S,x))return T;var P=p(x);return h!==void 0&&h(T,P)?(S=x,T):(S=x,E=P)}var C=!1,S,E,b=d===void 0?null:d;return[function(){return y(l())},b===null?void 0:function(){return y(b())}]},[l,d,p,h]);var v=o(u,m[0],m[1]);return i(function(){g.hasValue=!0,g.value=v},[v]),c(v),v},Fi}var Vi={};var Ju;function Bv(){return Ju||(Ju=1,process.env.NODE_ENV!=="production"&&(function(){function e(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=oe,n=Li(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,a=t.useMemo,c=t.useDebugValue;Vi.useSyncExternalStoreWithSelector=function(u,l,d,p,h){var m=s(null);if(m.current===null){var g={hasValue:!1,value:null};m.current=g}else g=m.current;m=a(function(){function y(x){if(!C){if(C=!0,S=x,x=p(x),h!==void 0&&g.hasValue){var T=g.value;if(h(T,x))return E=T}return E=x}if(T=E,r(S,x))return T;var P=p(x);return h!==void 0&&h(T,P)?(S=x,T):(S=x,E=P)}var C=!1,S,E,b=d===void 0?null:d;return[function(){return y(l())},b===null?void 0:function(){return y(b())}]},[l,d,p,h]);var v=o(u,m[0],m[1]);return i(function(){g.hasValue=!0,g.value=v},[v]),c(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Vi}var Qu;function Wv(){return Qu||(Qu=1,process.env.NODE_ENV==="production"?Bo.exports=Uv():Bo.exports=Bv()),Bo.exports}var Zv=Wv();const Gv=parseInt(f.version,10);function zi(e){return Gv>=e}const Yv=zi(19)?qv:Kv;function We(e,t,n,r,o){return Yv(e,t,n,r,o)}function Xv(e,t,n,r,o){const s=f.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return Hv.useSyncExternalStore(e.subscribe,s,s)}function qv(e,t,n,r,o){return Xv(e,t,n,r,o)}function Kv(e,t,n,r,o){return Zv.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class el{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,o){return We(this,t,n,r,o)}}const $i=f[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Jv=$i&&$i!==f.useLayoutEffect?$i:e=>e();function ie(e){const t=wt(Qv).current;return t.next=e,Jv(t.effect),t.trampoline}function Qv(){const e={next:void 0,callback:eb,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function eb(){if(process.env.NODE_ENV!=="production")throw new Error("Base UI: Cannot call an event handler while rendering.")}const he=typeof document<"u"?f.useLayoutEffect:()=>{};function Ct(){}const tl=Object.freeze([]),mt=Object.freeze({});class Wo extends el{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){f.useDebugValue(t),he(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const r=this;he(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this;if(process.env.NODE_ENV!=="production"){f.useDebugValue(t,i=>Object.keys(i));const o=f.useRef(Object.keys(t)).current,s=Object.keys(t);(o.length!==s.length||o.some((i,a)=>i!==s[a]))&&console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.")}const r=Object.values(t);he(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){f.useDebugValue(t);const r=n!==void 0;if(he(()=>{r&&!Object.is(this.state[t],n)&&super.setState({...this.state,[t]:n})},[t,n,r]),process.env.NODE_ENV!=="production"){const o=this.controlledValues??=new Map;o.has(t)||o.set(t,r);const s=o.get(t);s!==void 0&&s!==r&&console.error(`A component is changing the ${r?"":"un"}controlled state of ${t.toString()} to be ${r?"un":""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`)}}select(t,n,r,o){const s=this.selectors[t];return s(this.state,n,r,o)}useState(t,n,r,o){return f.useDebugValue(t),We(this,this.selectors[t],n,r,o)}useContextCallback(t,n){f.useDebugValue(t);const r=ie(n??Ct);this.context[t]=r}useStateSetter(t){const n=f.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return n(o,o,this),this.subscribe(s=>{const i=r(s);if(!Object.is(o,i)){const a=o;o=i,n(i,a,this)}})}}function Zo(){return typeof window<"u"}function kt(e){return ji(e)?(e.nodeName||"").toLowerCase():"#document"}function tt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mn(e){var t;return(t=(ji(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ji(e){return Zo()?e instanceof Node||e instanceof tt(e).Node:!1}function $e(e){return Zo()?e instanceof Element||e instanceof tt(e).Element:!1}function it(e){return Zo()?e instanceof HTMLElement||e instanceof tt(e).HTMLElement:!1}function kr(e){return!Zo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof tt(e).ShadowRoot}function Bn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=At(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function tb(e){return/^(table|td|th)$/.test(kt(e))}function Go(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const nb=/transform|translate|scale|rotate|perspective|filter/,rb=/paint|layout|strict|content/,nr=e=>!!e&&e!=="none";let Hi;function Ui(e){const t=$e(e)?At(e):e;return nr(t.transform)||nr(t.translate)||nr(t.scale)||nr(t.rotate)||nr(t.perspective)||!Yo()&&(nr(t.backdropFilter)||nr(t.filter))||nb.test(t.willChange||"")||rb.test(t.contain||"")}function ob(e){let t=Nn(e);for(;it(t)&&!Rn(t);){if(Ui(t))return t;if(Go(t))return null;t=Nn(t)}return null}function Yo(){return Hi==null&&(Hi=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Hi}function Rn(e){return/^(html|body|#document)$/.test(kt(e))}function At(e){return tt(e).getComputedStyle(e)}function Xo(e){return $e(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Nn(e){if(kt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||kr(e)&&e.host||mn(e);return kr(t)?t.host:t}function nl(e){const t=Nn(e);return Rn(t)?e.ownerDocument?e.ownerDocument.body:e.body:it(t)&&Bn(t)?t:nl(t)}function io(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=nl(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=tt(o);if(s){const a=Bi(i);return t.concat(i,i.visualViewport||[],Bn(o)?o:[],a&&n?io(a):[])}else return t.concat(o,io(o,[],n))}function Bi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gn(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function Ie(e){return e?.ownerDocument||document}function Fe(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}const qo=null;let rl=globalThis.requestAnimationFrame;class sb{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)n[o]?.(t)};request(t){const n=this.nextId;this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1;const r=process.env.NODE_ENV!=="production"&&rl!==requestAnimationFrame&&(rl=requestAnimationFrame,!0);return(!this.isScheduled||r)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const Ko=new sb;class yn{static create(){return new yn}static request(t){return Ko.request(t)}static cancel(t){return Ko.cancel(t)}currentId=qo;request(t){this.cancel(),this.currentId=Ko.request(()=>{this.currentId=qo,t()})}cancel=()=>{this.currentId!==qo&&(Ko.cancel(this.currentId),this.currentId=qo)};disposeEffect=()=>this.cancel}function ao(){const e=wt(yn.create).current;return so(e.disposeEffect),e}const co=0;class Zt{static create(){return new Zt}currentId=co;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=co,n()},t)}isStarted(){return this.currentId!==co}clear=()=>{this.currentId!==co&&(clearTimeout(this.currentId),this.currentId=co)};disposeEffect=()=>this.clear}function Gt(){const e=wt(Zt.create).current;return so(e.disposeEffect),e}let ol=0;function ib(e){return ol+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${ol}`}function Wi(e,t){if(typeof e=="string")return{description:e};if(typeof e=="function"){const n=e(t);return typeof n=="string"?{description:n}:n}return e}const Rr=typeof navigator<"u",Zi=cb(),sl=lb(),il=ub(),Gi=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),al=Zi.platform==="MacIntel"&&Zi.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Zi.platform),ab=Rr&&/apple/i.test(navigator.vendor),Jo=Rr&&/android/i.test(sl)||/android/i.test(il);Rr&&sl.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const cl=il.includes("jsdom/");function cb(){if(!Rr)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function ub(){if(!Rr)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function lb(){if(!Rr)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const Yi="data-base-ui-focusable",ul="active",ll="selected",dl="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Wn="ArrowLeft",Zn="ArrowRight",Xi="ArrowUp",uo="ArrowDown";function Pt(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function we(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&kr(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function lt(e){return"composedPath"in e?e.composedPath()[0]:e.target}function fl(e,t){if(!$e(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of t.entries())if(we(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function un(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function db(e){return e.matches("html,body")}function qi(e){return it(e)&&e.matches(dl)}function fb(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${dl}`)!=null}function Ki(e){return e?e.getAttribute("role")==="combobox"&&qi(e):!1}function Ji(e){if(!e||cl)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function lo(e){return e?e.hasAttribute(Yi)?e:e.querySelector(`[${Yi}]`)||e:null}function vn(e,t,n=!0){return e.filter(o=>o.parentId===t).flatMap(o=>[...!n||o.context?.open?[o]:[],...vn(e,o.id,n)])}function pl(e,t){let n=[],r=e.find(o=>o.id===t)?.parentId;for(;r;){const o=e.find(s=>s.id===r);r=o?.parentId,o&&(n=n.concat(o))}return n}function Yt(e){e.preventDefault(),e.stopPropagation()}function pb(e){return"nativeEvent"in e}function hl(e){return e.pointerType===""&&e.isTrusted?!0:Jo&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function ml(e){return cl?!1:!Jo&&e.width===0&&e.height===0||Jo&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function fo(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function gl(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const hb=["top","right","bottom","left"],Nr=Math.min,Xt=Math.max,Qo=Math.round,rr=Math.floor,bn=e=>({x:e,y:e}),mb={left:"right",right:"left",bottom:"top",top:"bottom"};function Qi(e,t,n){return Xt(e,Nr(t,n))}function Mn(e,t){return typeof e=="function"?e(t):e}function jt(e){return e.split("-")[0]}function Gn(e){return e.split("-")[1]}function ea(e){return e==="x"?"y":"x"}function ta(e){return e==="y"?"height":"width"}function en(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function na(e){return ea(en(e))}function gb(e,t,n){n===void 0&&(n=!1);const r=Gn(e),o=na(e),s=ta(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=es(i)),[i,es(i)]}function yb(e){const t=es(e);return[ra(e),t,ra(t)]}function ra(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const yl=["left","right"],vl=["right","left"],vb=["top","bottom"],bb=["bottom","top"];function wb(e,t,n){switch(e){case"top":case"bottom":return n?t?vl:yl:t?yl:vl;case"left":case"right":return t?vb:bb;default:return[]}}function Sb(e,t,n,r){const o=Gn(e);let s=wb(jt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ra)))),s}function es(e){const t=jt(e);return mb[t]+e.slice(t.length)}function Eb(e){return{top:0,right:0,bottom:0,left:0,...e}}function bl(e){return typeof e!="number"?Eb(e):{top:e,right:e,bottom:e,left:e}}function po(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function ts(e,t,n){return Math.floor(e/t)!==n}function ns(e,t){return t<0||t>=e.length}function oa(e,t){return Dt(e.current,{disabledIndices:t})}function wl(e,t){return Dt(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Dt(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let s=t;do s+=n?-o:o;while(s>=0&&s<=e.length-1&&Mr(e,s,r));return s}function xb(e,{event:t,orientation:n,loopFocus:r,onLoop:o,rtl:s,cols:i,disabledIndices:a,minIndex:c,maxIndex:u,prevIndex:l,stopEvent:d=!1}){let p=l,h;if(t.key===Xi?h="up":t.key===uo&&(h="down"),h){const m=[],g=[];let v=!1,y=0;{let z=null,I=-1;e.forEach((D,$)=>{if(D==null)return;y+=1;const V=D.closest('[role="row"]');V&&(v=!0),(V!==z||I===-1)&&(z=V,I+=1,m[I]=[]),m[I].push($),g[$]=I})}let C=!1,S=0;if(v)for(const z of m){const I=z.length;I>S&&(S=I),I!==i&&(C=!0)}const E=C&&y<e.length,b=S||i,x=z=>{if(!C||l===-1)return;const I=g[l];if(I==null)return;const D=m[I].indexOf(l),$=z==="up"?-1:1;for(let V=I+$,N=0;N<m.length;N+=1,V+=$){if(V<0||V>=m.length){if(!r||E)return;if(V=V<0?m.length-1:0,o){const k=Math.min(D,m[V].length-1),_=m[V][k]??m[V][0],M=o(t,l,_);V=g[M]??V}}const O=m[V];for(let k=Math.min(D,O.length-1);k>=0;k-=1){const _=O[k];if(!Mr(e,_,a))return _}}},T=z=>{if(!E||l===-1)return;const I=l%b,D=z==="up"?-b:b,$=u-u%b,V=rr(u/b)+1;for(let N=l-I+D,O=0;O<V;O+=1,N+=D){if(N<0||N>u){if(!r)return;N=N<0?$:0}const k=Math.min(N+b-1,u);for(let _=Math.min(N+I,k);_>=N;_-=1)if(!Mr(e,_,a))return _}};d&&Yt(t);const P=x(h)??T(h);if(P!==void 0)p=P;else if(l===-1)p=h==="up"?u:c;else if(p=Dt(e,{startingIndex:l,amount:b,decrement:h==="up",disabledIndices:a}),r){if(h==="up"&&(l-b<c||p<0)){const z=l%b,I=u%b,D=u-(I-z);I===z?p=u:p=I>z?D:D-b,o&&(p=o(t,l,p))}h==="down"&&l+b>u&&(p=Dt(e,{startingIndex:l%b-b,amount:b,disabledIndices:a}),o&&(p=o(t,l,p)))}ns(e,p)&&(p=l)}if(n==="both"){const m=rr(l/i);t.key===(s?Wn:Zn)&&(d&&Yt(t),l%i!==i-1?(p=Dt(e,{startingIndex:l,disabledIndices:a}),r&&ts(p,i,m)&&(p=Dt(e,{startingIndex:l-l%i-1,disabledIndices:a}),o&&(p=o(t,l,p)))):r&&(p=Dt(e,{startingIndex:l-l%i-1,disabledIndices:a}),o&&(p=o(t,l,p))),ts(p,i,m)&&(p=l)),t.key===(s?Zn:Wn)&&(d&&Yt(t),l%i!==0?(p=Dt(e,{startingIndex:l,decrement:!0,disabledIndices:a}),r&&ts(p,i,m)&&(p=Dt(e,{startingIndex:l+(i-l%i),decrement:!0,disabledIndices:a}),o&&(p=o(t,l,p)))):r&&(p=Dt(e,{startingIndex:l+(i-l%i),decrement:!0,disabledIndices:a}),o&&(p=o(t,l,p))),ts(p,i,m)&&(p=l));const g=rr(u/i)===m;ns(e,p)&&(r&&g?(p=t.key===(s?Zn:Wn)?u:Dt(e,{startingIndex:l-l%i-1,disabledIndices:a}),o&&(p=o(t,l,p))):p=l)}return p}function Cb(e,t,n){const r=[];let o=0;return e.forEach(({width:s,height:i},a)=>{if(s>t&&process.env.NODE_ENV!=="production")throw new Error(`[Floating UI]: Invalid grid - item width at index ${a} is greater than grid columns`);let c=!1;for(;!c;){const u=[];for(let l=0;l<s;l+=1)for(let d=0;d<i;d+=1)u.push(o+l+d*t);o%t+s<=t&&u.every(l=>r[l]==null)?(u.forEach(l=>{r[l]=a}),c=!0):o+=1}}),[...r]}function Tb(e,t,n,r,o){if(e===-1)return-1;const s=n.indexOf(e),i=t[e];switch(o){case"tl":return s;case"tr":return i?s+i.width-1:s;case"bl":return i?s+(i.height-1)*r:s;case"br":return n.lastIndexOf(e);default:return-1}}function Ob(e,t){return t.flatMap((n,r)=>e.includes(n)?[r]:[])}function Mr(e,t,n){if(typeof n=="function"?n(t):n?.includes(t)??!1)return!0;const o=e[t];return o?rs(o)?!n&&(o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true"):!0:!1}function Pb(e){return e.visibility==="hidden"||e.visibility==="collapse"}function rs(e,t=e?At(e):null){return!e||!e.isConnected||!t||Pb(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const _b='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function Ib(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return kr(n)?n.host:null}function sa(e){for(const t of Array.from(e.children))if(kt(t)==="summary")return t;return null}function kb(e,t){const n=sa(t);return!!n&&(e===n||we(n,e))}function Sl(e){const t=e?kt(e):"";return e!=null&&e.matches(_b)&&(t!=="summary"||e.parentElement!=null&&kt(e.parentElement)==="details"&&sa(e.parentElement)===e)&&(t!=="details"||sa(e)==null)&&(t!=="input"||e.type!=="hidden")}function El(e){if(!Sl(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=Ib(t)){const n=t!==e,r=kt(t)==="slot";if(t.hasAttribute("inert")||n&&kt(t)==="details"&&!t.open&&!kb(e,t)||t.hasAttribute("hidden")||!r&&!Rb(t,n))return!1}return!0}function Rb(e,t){const n=At(e);return t?n.display!=="none":rs(e,n)}function xl(e){const t=e.tabIndex;if(t<0){const n=kt(e);if(n==="details"||n==="audio"||n==="video"||it(e)&&e.isContentEditable)return 0}return t}function ia(e){if(kt(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function Nb(e,t){const n=ia(e);if(!n)return!0;const r=t.find(o=>{const s=ia(o);return s?.name===n.name&&s.form===n.form&&s.checked});return r?r===n:t.find(o=>{const s=ia(o);return s?.name===n.name&&s.form===n.form})===n}function Cl(e){if(it(e)&&kt(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return it(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Tl(e,t){Cl(e).forEach(n=>{Sl(n)&&t.push(n),Tl(n,t)})}function Ol(e,t,n){Cl(e).forEach(r=>{it(r)&&r.matches(t)&&n.push(r),Ol(r,t,n)})}function aa(e){return El(e)&&xl(e)>=0}function Pl(e){const t=[];return Tl(e,t),t.filter(El)}function ho(e){const t=Pl(e);return t.filter(n=>xl(n)>=0&&Nb(n,t))}function _l(e,t){const n=ho(e),r=n.length;if(r===0)return;const o=Pt(Ie(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function ca(e){return _l(Ie(e).body,1)||e}function Il(e){return _l(Ie(e).body,-1)||e}function kl(e,t){if(!e)return null;const n=ho(Ie(e).body),r=n.length;if(r===0)return null;const o=n.indexOf(e);if(o===-1)return null;const s=(o+t+r)%r;return n[s]}function Mb(e){return kl(e,1)}function Ab(e){return kl(e,-1)}function Ar(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!we(n,r)}function Db(e){ho(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Rl(e){const t=[];Ol(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const os=Vv(e=>e.toasts,e=>{const t=new Map;let n=0,r=0;return e.forEach((o,s)=>{const i=o.transitionStatus==="ending";t.set(o.id,{value:o,domIndex:s,visibleIndex:i?-1:n,offsetY:r}),r+=o.height||0,i||(n+=1)}),t}),wn={toasts:de(e=>e.toasts),isEmpty:de(e=>e.toasts.length===0),toast:de(os,(e,t)=>e.get(t)?.value),toastIndex:de(os,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:de(os,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:de(os,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:de(e=>e.hovering),focused:de(e=>e.focused),expanded:de(e=>e.hovering||e.focused),expandedOrOutOfFocus:de(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:de(e=>e.prevFocusElement)};class Lb extends Wo{timers=new Map;areTimersPaused=!1;constructor(t){super(t,{},wn)}setFocused(t){this.set("focused",t)}setHovering(t){this.set("hovering",t)}setIsWindowFocused(t){this.set("isWindowFocused",t)}setPrevFocusElement(t){this.set("prevFocusElement",t)}setViewport=t=>{this.set("viewport",t)};disposeEffect=()=>()=>{this.timers.forEach(t=>{t.timeout?.clear()}),this.timers.clear()};removeToast(t,n={}){const r=wn.toastIndex(this.state,t);if(r===-1)return;const o=this.state.toasts[r];n.skipOnRemove||o?.onRemove?.();const s=[...this.state.toasts];s.splice(r,1),this.setToasts(s)}addToast=t=>{const{timeout:n,limit:r}=this.state,o=t.id||ib("toast");if(t.id){const u=wn.toast(this.state,t.id);if(u)if(u.transitionStatus==="ending")this.removeToast(t.id,{skipOnRemove:!0});else{const{id:l,transitionStatus:d,...p}=t;return this.updateToastInternal(t.id,p,{resetTimer:!0,markUpdated:!0}),t.id}}const s={...t,id:o,updateKey:0,transitionStatus:"starting"},i=[s,...this.state.toasts],a=i.filter(u=>u.transitionStatus!=="ending");if(a.length>r){const u=a.length-r,l=a.slice(-u),d=new Set(l.map(p=>p.id));this.setToasts(i.map(p=>{const h=d.has(p.id);return p.limited!==h?{...p,limited:h}:p}))}else this.setToasts(i.map(u=>u.limited?{...u,limited:!1}:u));const c=s.timeout??n;return s.type!=="loading"&&c>0&&this.scheduleTimer(o,c,()=>this.closeToast(o)),wn.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),o};updateToast=(t,n)=>{this.updateToastInternal(t,n,{markUpdated:!0})};updateToastInternal=(t,n,r={})=>{const{timeout:o,toasts:s}=this.state,i=wn.toast(this.state,t)??null;if(!i||i.transitionStatus==="ending")return;const a={...i,...n,...r.markUpdated&&{updateKey:(i.updateKey??0)+1}};this.setToasts(s.map(g=>g.id===t?a:g));const c=a.timeout??o,u=i?.timeout??o,l=Object.hasOwn(n,"timeout"),d=a.transitionStatus!=="ending"&&a.type!=="loading"&&c>0,p=this.timers.has(t),h=u!==c,m=i?.type==="loading";if(!d&&p){this.timers.get(t)?.timeout?.clear(),this.timers.delete(t);return}if(d&&(!p||h||l||m||r.resetTimer)){const g=this.timers.get(t);g&&(g.timeout?.clear(),this.timers.delete(t)),this.scheduleTimer(t,c,()=>this.closeToast(t)),wn.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}};closeToast=t=>{const n=t===void 0,{limit:r,toasts:o}=this.state;let s;if(n)s=o,this.timers.forEach(u=>{u.timeout?.clear()}),this.timers.clear();else{const u=wn.toast(this.state,t);if(!u)return;s=[u];const l=this.timers.get(t);l?.timeout&&(l.timeout.clear(),this.timers.delete(t))}let i=0;const c={toasts:o.map(u=>{if(n||u.id===t)return{...u,transitionStatus:"ending",height:0};if(u.transitionStatus==="ending")return u;const l=i>=r;return i+=1,u.limited!==l?{...u,limited:l}:u})};(n||o.length===1)&&(c.hovering=!1,c.focused=!1),this.update(c),s.forEach(u=>{u.transitionStatus!=="ending"&&u.onClose?.()}),this.handleFocusManagement(t)};promiseToast=(t,n)=>{const r=Wi(n.loading),o=this.addToast({...r,type:"loading"}),s=t.then(i=>{const a=Wi(n.success,i);return this.updateToast(o,{...a,type:"success",timeout:a.timeout}),i}).catch(i=>{const a=Wi(n.error,i);return this.updateToast(o,{...a,type:"error",timeout:a.timeout}),Promise.reject(i)});return{}.hasOwnProperty.call(n,"setPromise")&&n.setPromise(s),s};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(t=>{if(t.timeout){t.timeout.clear();const n=Date.now()-t.start,r=t.delay-n;t.remaining=r>0?r:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((t,n)=>{t.remaining=t.remaining>0?t.remaining:t.delay,t.timeout??=Zt.create(),t.timeout.start(t.remaining,()=>{this.timers.delete(n),t.callback()}),t.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=t=>{if(t.pointerType!=="touch")return;const n=lt(t);we(this.state.viewport,n)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(t,n,r){const o=Date.now(),s=!wn.expandedOrOutOfFocus(this.state),i=s?Zt.create():void 0;i?.start(n,()=>{this.timers.delete(t),r()}),this.timers.set(t,{timeout:i,start:s?o:0,delay:n,remaining:n,callback:r})}setToasts(t){const n={toasts:t};t.length===0&&(n.hovering=!1,n.focused=!1),this.update(n)}handleFocusManagement(t){const n=Pt(Ie(this.state.viewport));if(!this.state.viewport||!we(this.state.viewport,n)||!Ji(n))return;if(t===void 0){this.restoreFocusToPrevElement();return}const r=wn.toasts(this.state),o=wn.toastIndex(this.state,t);let s=null,i=o+1;for(;i<r.length;){if(r[i].transitionStatus!=="ending"){s=r[i];break}i+=1}if(!s)for(i=o-1;i>=0;){if(r[i].transitionStatus!=="ending"){s=r[i];break}i-=1}s?s.ref?.current?.focus():this.restoreFocusToPrevElement()}}const Nl=function(t){const{children:n,timeout:r=5e3,limit:o=3,toastManager:s}=t,i=wt(()=>new Lb({timeout:r,limit:o,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return so(i.disposeEffect),f.useEffect(function(){return s?s[" subscribe"](({action:u,options:l})=>{const d=l.id;u==="promise"&&l.promise?i.promiseToast(l.promise,l):u==="update"&&d?i.updateToast(d,l):u==="close"?i.closeToast(d):i.addToast(l)}):void 0},[i,r,s]),i.useSyncedValues({timeout:r,limit:o}),w.jsx(zo.Provider,{value:i,children:n})};process.env.NODE_ENV!=="production"&&(Nl.displayName="ToastProvider");const Ml={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},ss={...Ml,position:"fixed",top:0,left:0},Al={...Ml,position:"absolute"},Sn=f.forwardRef(function(t,n){const[r,o]=f.useState();he(()=>{ab&&o("button")},[]);const s={tabIndex:0,role:r};return w.jsx("span",{...t,ref:n,style:ss,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});process.env.NODE_ENV!=="production"&&(Sn.displayName="FocusGuard");function or(e,t,n,r){const o=wt(Dl).current;return Vb(o,e,t,n,r)&&Ll(o,[e,t,n,r]),o.callback}function Fb(e){const t=wt(Dl).current;return zb(t,e)&&Ll(t,e),t.callback}function Dl(){return{callback:null,cleanup:null,refs:[]}}function Vb(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function zb(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function Ll(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const i=s(n);typeof i=="function"&&(r[o]=i);break}case"object":{s.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const i=r[o];typeof i=="function"?i():s(null);break}case"object":{s.current=null;break}}}}}}}function Fl(e){if(!f.isValidElement(e))return null;const t=e,n=t.props;return(zi(19)?n?.ref:t.ref)??null}function ua(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}let la;process.env.NODE_ENV!=="production"&&(la=new Set);function $b(...e){if(process.env.NODE_ENV!=="production"){const t=e.join(" ");la.has(t)||(la.add(t),console.warn(`Base UI: ${t}`))}}function jb(e,t){const n={};for(const r in e){const o=e[r];if(t?.hasOwnProperty(r)){const s=t[r](o);s!=null&&Object.assign(n,s);continue}o===!0?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}function Hb(e,t){return typeof e=="function"?e(t):e}function Ub(e,t){return typeof e=="function"?e(t):e}const da={};function En(e,t,n,r,o){if(!n&&!r&&!o&&!e)return is(t);let s=is(e);return t&&(s=mo(s,t)),n&&(s=mo(s,n)),r&&(s=mo(s,r)),o&&(s=mo(s,o)),s}function Bb(e){if(e.length===0)return da;if(e.length===1)return is(e[0]);let t=is(e[0]);for(let n=1;n<e.length;n+=1)t=mo(t,e[n]);return t}function is(e){return fa(e)?{...zl(e,da)}:Wb(e)}function mo(e,t){return fa(t)?zl(t,e):Zb(e,t)}function Wb(e){const t={...e};for(const n in t){const r=t[n];Vl(n,r)&&(t[n]=$l(r))}return t}function Zb(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=ua(e.style,r);break}case"className":{e[n]=jl(e.className,r);break}default:Vl(n,r)?e[n]=Gb(e[n],r):e[n]=r}}return e}function Vl(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return n===111&&r===110&&o>=65&&o<=90&&(typeof t=="function"||typeof t>"u")}function fa(e){return typeof e=="function"}function zl(e,t){return fa(e)?e(t):e??da}function Gb(e,t){return t?e?(...n)=>{const r=n[0];if(Hl(r)){const s=r;as(s);const i=t(...n);return s.baseUIHandlerPrevented||e?.(...n),i}const o=t(...n);return e?.(...n),o}:$l(t):e}function $l(e){return e&&((...t)=>{const n=t[0];return Hl(n)&&as(n),e(...t)})}function as(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function jl(e,t){return t?e?t+" "+e:t:e}function Hl(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function qe(e,t,n={}){const r=t.render,o=Yb(t,n);if(n.enabled===!1)return null;const s=n.state??mt;return Qb(e,r,o,s)}function Yb(e,t={}){const{className:n,style:r,render:o}=e,{state:s=mt,ref:i,props:a,stateAttributesMapping:c,enabled:u=!0}=t,l=u?Hb(n,s):void 0,d=u?Ub(r,s):void 0,p=u?jb(s,c):mt,h=u&&a?Xb(a):void 0,m=u?ua(p,h)??{}:mt;return typeof document<"u"&&(u?Array.isArray(i)?m.ref=Fb([m.ref,Fl(o),...i]):m.ref=or(m.ref,Fl(o),i):or(null,null)),u?(l!==void 0&&(m.className=jl(m.className,l)),d!==void 0&&(m.style=ua(m.style,d)),m):mt}function Xb(e){return Array.isArray(e)?Bb(e):En(void 0,e)}const qb=Symbol.for("react.lazy"),Kb=/^[A-Z][A-Za-z0-9$]*$/,Jb=/[a-z]/;function Qb(e,t,n,r){if(t){if(typeof t=="function")return process.env.NODE_ENV!=="production"&&e0(t),t(n,r);const o=En(n,t.props);o.ref=n.ref;let s=t;if(s?.$$typeof===qb&&(s=f.Children.toArray(t)[0]),process.env.NODE_ENV!=="production"&&!f.isValidElement(s))throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.","A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.","https://base-ui.com/r/invalid-render-prop"].join(`
16
- `));return f.cloneElement(s,o)}if(e&&typeof e=="string")return t0(e,n);throw new Error(process.env.NODE_ENV!=="production"?"Base UI: Render element or function are not defined.":ft(8))}function e0(e){const t=e.name;t.length!==0&&Kb.test(t)&&Jb.test(t)&&$b(`The \`render\` prop received a function named \`${t}\` that starts with an uppercase letter.`,"This usually means a React component was passed directly as `render={Component}`.","Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.","If this is an intentional render callback, rename it to start with a lowercase letter.","Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.","https://base-ui.com/r/invalid-render-prop")}function t0(e,t){return e==="button"?oe.createElement("button",{type:"button",...t,key:t.key}):e==="img"?oe.createElement("img",{alt:"",...t,key:t.key}):f.createElement(e,t)}let n0=(function(e){return e.frontmostHeight="--toast-frontmost-height",e})({});const Ul=f.forwardRef(function(t,n){const{render:r,className:o,style:s,children:i,...a}=t,c=Hu(),u=Gt(),l=f.useRef(!1),d=f.useRef(!1),p=f.useRef(!1),h=c.useState("isEmpty"),m=c.useState("toasts"),g=c.useState("focused"),v=c.useState("expanded"),y=c.useState("prevFocusElement"),C=m[0]?.height??0,S=f.useMemo(()=>m.some(_=>_.transitionStatus==="ending"),[m]);f.useEffect(()=>{const _=c.state.viewport;if(!_)return;function M(j){h||j.key==="F6"&&lt(j)!==_&&(j.preventDefault(),c.setPrevFocusElement(Pt(Ie(_))),_?.focus({preventScroll:!0}),c.pauseTimers(),c.setFocused(!0))}const A=tt(_);return Fe(A,"keydown",M)},[c,h]),f.useEffect(()=>{const _=c.state.viewport;if(!_||h)return;const M=tt(_);function A(B){lt(B)===M&&(c.setIsWindowFocused(!1),c.pauseTimers())}function j(B){if(B.relatedTarget)return;const U=lt(B),W=Pt(Ie(_));(U===M||!we(_,U)||!Ji(W))&&c.resumeTimers(),u.start(0,()=>c.setIsWindowFocused(!0))}return gn(Fe(M,"blur",A,!0),Fe(M,"focus",j,!0))},[c,u,h]),f.useEffect(()=>{const _=c.state.viewport;if(!_||h)return;const M=Ie(_);return Fe(M,"pointerdown",c.handleDocumentPointerDown,!0)},[h,c]);function E(_){const M=c.state.viewport;M&&(l.current=!0,_.relatedTarget===M?m[0]?.ref?.current?.focus():c.restoreFocusToPrevElement())}function b(_){_.key==="Tab"&&_.shiftKey&&lt(_.nativeEvent)===c.state.viewport&&(_.preventDefault(),c.restoreFocusToPrevElement(),c.resumeTimers())}function x(){const _=c.state.toasts.some(M=>M.transitionStatus==="ending");!c.state.isWindowFocused||_||p.current||!d.current||(c.resumeTimers(),c.setHovering(!1),d.current=!1)}f.useEffect(x,[S,c]);function T(){c.pauseTimers(),c.setHovering(!0),d.current=!1}function P(){S||p.current?d.current=!0:(c.resumeTimers(),c.setHovering(!1))}function z(_){_.pointerType==="touch"&&(p.current=!0)}function I(_){_.pointerType==="touch"&&(p.current=!1,x())}function D(){if(l.current){l.current=!1;return}g||Ji(Pt(Ie(c.state.viewport)))&&(c.setFocused(!0),c.pauseTimers())}function $(_){!g||we(c.state.viewport,_.relatedTarget)||(c.setFocused(!1),c.resumeTimers())}const V={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:T,onMouseMove:T,onMouseLeave:P,onFocus:D,onBlur:$,onKeyDown:b,onClick:D,onPointerDown:z,onPointerUp:I,onPointerCancel:I},N={expanded:v},O=qe("div",t,{ref:[n,c.setViewport],state:N,props:[V,{style:{[n0.frontmostHeight]:C?`${C}px`:void 0}},a,{children:w.jsxs(f.Fragment,{children:[!h&&y&&w.jsx(Sn,{onFocus:E}),i,!h&&y&&w.jsx(Sn,{onFocus:E})]})}]}),k=f.useMemo(()=>m.filter(_=>_.priority==="high"),[m]);return w.jsxs(f.Fragment,{children:[!h&&y&&w.jsx(Sn,{onFocus:E}),O,!g&&k.length>0&&w.jsx("div",{style:ss,children:k.map(_=>w.jsxs("div",{role:"alert","aria-atomic":!0,children:[w.jsx("div",{children:_.title}),w.jsx("div",{children:_.description})]},_.id))})]})});process.env.NODE_ENV!=="production"&&(Ul.displayName="ToastViewport");function cs(e){return zi(19)?e:e?"true":void 0}const pa=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(pa.displayName="ToastRootContext");function r0(){const e=f.useContext(pa);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.":ft(66));return e}let sr=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const o0={[sr.startingStyle]:""},s0={[sr.endingStyle]:""},tn={transitionStatus(e){return e==="starting"?o0:e==="ending"?s0:null}};function An(e){return e==null?e:"current"in e?e.current:e}function Bl(e,t=!1,n=!0){const r=ao();return ie((o,s=null)=>{r.cancel();const i=An(e);if(i==null)return;const a=i,c=()=>{Kt.flushSync(o)};if(typeof a.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){o();return}function u(){Promise.all(a.getAnimations().map(l=>l.finished)).then(()=>{s?.aborted||c()}).catch(()=>{if(n){s?.aborted||c();return}const l=a.getAnimations();!s?.aborted&&l.length>0&&l.some(d=>d.pending||d.playState!=="finished")&&u()})}if(t){const l=sr.startingStyle;if(!a.hasAttribute(l)){r.request(u);return}const d=new MutationObserver(()=>{a.hasAttribute(l)||(d.disconnect(),u())});d.observe(a,{attributes:!0,attributeFilter:[l]}),s?.addEventListener("abort",()=>d.disconnect(),{once:!0});return}r.request(u)})}function xn(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=ie(o),i=Bl(r,n,!1);f.useEffect(()=>{if(!t)return;const a=new AbortController;return i(s,a.signal),()=>{a.abort()}},[t,n,s,i])}let ir=(function(e){return e.index="--toast-index",e.offsetY="--toast-offset-y",e.height="--toast-height",e.swipeMovementX="--toast-swipe-movement-x",e.swipeMovementY="--toast-swipe-movement-y",e})({});const i0=500,a0={style:{transition:"none"}},ha="data-base-ui-click-trigger",c0="data-base-ui-swipe-ignore",u0="data-swipe-ignore",Wl=`[${c0}]`,l0=`[${u0}]`,d0={fallbackAxisSide:"none"},f0={fallbackAxisSide:"end"},p0={clipPath:"inset(50%)",position:"fixed",top:0,left:0},h0={...tn,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},go=40,m0=10,Yn=.5,g0=1,y0=`${Wl},${l0}`;function Zl(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}function v0(e){const n=tt(e).getComputedStyle(e).transform;let r=0,o=0,s=1;if(n&&n!=="none"){const i=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(i){const a=i[1].split(", ").map(parseFloat);a.length===6?(r=a[4],o=a[5],s=Math.sqrt(a[0]*a[0]+a[1]*a[1])):a.length===16&&(r=a[12],o=a[13],s=a[0])}}return{x:r,y:o,scale:s}}const Gl=f.forwardRef(function(t,n){const{toast:r,render:o,className:s,swipeDirection:i=["down","right"],style:a,...c}=t,u=r.positionerProps?.anchor!==void 0;let l=[];u||(l=Array.isArray(i)?i:[i]);const d=l.length>0,p=Hu(),[h,m]=f.useState(void 0),[g,v]=f.useState(!1),[y,C]=f.useState(!1),[S,E]=f.useState(!1),[b,x]=f.useState({x:0,y:0}),[T,P]=f.useState({x:0,y:0,scale:1}),[z,I]=f.useState(),[D,$]=f.useState(),[V,N]=f.useState(null),O=f.useRef(null),k=f.useRef({x:0,y:0}),_=f.useRef({x:0,y:0,scale:1}),M=f.useRef(void 0),A=f.useRef(0),j=f.useRef(!1),B=f.useRef({x:0,y:0}),U=f.useRef(!1),W=p.useState("toastIndex",r.id),G=p.useState("toastVisibleIndex",r.id),Z=p.useState("toastOffsetY",r.id),X=p.useState("focused"),K=p.useState("expanded");xn({open:r.transitionStatus!=="ending",ref:O,onComplete(){r.transitionStatus==="ending"&&p.removeToast(r.id)}});const J=ie((R=!1)=>{const H=O.current;if(!H)return;const L=H.style.height;H.style.height="auto";const F=H.offsetHeight;H.style.height=L;function Q(){p.updateToastInternal(r.id,{ref:O,height:F,...r.transitionStatus==="starting"?{transitionStatus:void 0}:{}})}R?Kt.flushSync(Q):Q()});he(J,[J]);function se(R,H){let L=R,F=H;return!l.includes("left")&&!l.includes("right")?L=R>0?R**Yn:-(Math.abs(R)**Yn):(!l.includes("right")&&R>0&&(L=R**Yn),!l.includes("left")&&R<0&&(L=-(Math.abs(R)**Yn))),!l.includes("up")&&!l.includes("down")?F=H>0?H**Yn:-(Math.abs(H)**Yn):(!l.includes("down")&&H>0&&(F=H**Yn),!l.includes("up")&&H<0&&(F=-(Math.abs(H)**Yn))),{x:L,y:F}}function ae(R){if(R.button!==0)return;R.pointerType==="touch"&&p.pauseTimers();const H=lt(R.nativeEvent);if(!(H&&H.closest(`button,a,input,textarea,[role="button"],${y0}`))){if(j.current=!1,M.current=void 0,A.current=0,k.current={x:R.clientX,y:R.clientY},B.current=k.current,O.current){const F=v0(O.current);_.current=F,P(F),x({x:F.x,y:F.y})}p.setHovering(!0),v(!0),C(!1),N(null),U.current=!0,O.current?.setPointerCapture(R.pointerId)}}function pe(R){if(!g)return;R.preventDefault(),U.current&&(k.current={x:R.clientX,y:R.clientY},U.current=!1);const{clientY:H,clientX:L,movementX:F,movementY:Q}=R;(Q<0&&H>B.current.y||Q>0&&H<B.current.y)&&(B.current={x:B.current.x,y:H}),(F<0&&L>B.current.x||F>0&&L<B.current.x)&&(B.current={x:L,y:B.current.y});const ne=L-k.current.x,te=H-k.current.y,ye=H-B.current.y,_e=L-B.current.x;if(!y&&Math.sqrt(ne*ne+te*te)>=g0&&(C(!0),V===null)){const He=l.includes("left")||l.includes("right"),nt=l.includes("up")||l.includes("down");if(He&&nt){const st=Math.abs(ne),Re=Math.abs(te);N(st>Re?"horizontal":"vertical")}}let Ee;if(!M.current)V==="vertical"?te>0?Ee="down":te<0&&(Ee="up"):V==="horizontal"?ne>0?Ee="right":ne<0&&(Ee="left"):Math.abs(ne)>=Math.abs(te)?Ee=ne>0?"right":"left":Ee=te>0?"down":"up",Ee&&l.includes(Ee)&&(M.current=Ee,A.current=Zl(Ee,ne,te),m(Ee));else{const Ge=M.current,He=Zl(Ge,_e,ye);He>go?(j.current=!1,m(Ge)):!(l.includes("left")&&l.includes("right"))&&!(l.includes("up")&&l.includes("down"))&&A.current-He>=m0&&(j.current=!0)}const Ce=se(ne,te);let Pe=_.current.x,Ve=_.current.y;V==="horizontal"?(l.includes("left")||l.includes("right"))&&(Pe+=Ce.x):(V==="vertical"||(l.includes("left")||l.includes("right"))&&(Pe+=Ce.x),(l.includes("up")||l.includes("down"))&&(Ve+=Ce.y)),x({x:Pe,y:Ve})}function Y(R){if(!g)return;if(v(!1),C(!1),N(null),O.current?.releasePointerCapture(R.pointerId),j.current){x({x:T.x,y:T.y}),m(void 0);return}let H=!1;const L=b.x-T.x,F=b.y-T.y;let Q;for(const ne of l){switch(ne){case"right":L>go&&(H=!0,Q="right");break;case"left":L<-go&&(H=!0,Q="left");break;case"down":F>go&&(H=!0,Q="down");break;case"up":F<-go&&(H=!0,Q="up");break}if(H)break}H?(m(Q),E(!0),p.closeToast(r.id)):(x({x:T.x,y:T.y}),m(void 0))}function me(){g&&(v(!1),C(!1),N(null),x({x:T.x,y:T.y}),m(void 0))}function ge(R){if(R.key==="Escape"){if(!O.current||!we(O.current,Pt(Ie(O.current))))return;p.closeToast(r.id)}}f.useEffect(()=>{if(!d)return;const R=O.current;if(!R)return;function H(L){we(R,lt(L))&&L.preventDefault()}return Fe(R,"touchmove",H,{passive:!1})},[d]);function fe(){if(!g&&b.x===T.x&&b.y===T.y&&!S)return{[ir.swipeMovementX]:"0px",[ir.swipeMovementY]:"0px"};const R=b.x-T.x,H=b.y-T.y;return{transition:g?"none":void 0,transform:g?`translateX(${b.x}px) translateY(${b.y}px) scale(${T.scale})`:void 0,[ir.swipeMovementX]:`${R}px`,[ir.swipeMovementY]:`${H}px`}}const le=r.priority==="high",ce={role:le?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":z,"aria-describedby":D,"aria-hidden":le&&!X?!0:void 0,onPointerDown:d?ae:void 0,onPointerMove:d?pe:void 0,onPointerUp:d?Y:void 0,onPointerCancel:d?me:void 0,onKeyDown:ge,inert:cs(r.limited),style:{...fe(),[ir.index]:r.transitionStatus==="ending"?W:G,[ir.offsetY]:`${Z}px`,[ir.height]:r.height?`${r.height}px`:void 0}},ve=f.useMemo(()=>({rootRef:O,toast:r,titleId:z,setTitleId:I,descriptionId:D,setDescriptionId:$,swiping:g,swipeDirection:h,recalculateHeight:J,index:W,visibleIndex:G,expanded:K}),[r,z,D,g,h,J,W,G,K]),ue={transitionStatus:r.transitionStatus,expanded:K,limited:r.limited||!1,type:r.type,swiping:ve.swiping,swipeDirection:ve.swipeDirection},Se=qe("div",t,{ref:[n,ve.rootRef],state:ue,stateAttributesMapping:h0,props:[ce,c]});return w.jsx(pa.Provider,{value:ve,children:Se})});process.env.NODE_ENV!=="production"&&(Gl.displayName="ToastRoot");const Dr={...f};let Yl=0;function b0(e,t="mui"){const[n,r]=f.useState(e),o=e||n;return f.useEffect(()=>{n==null&&(Yl+=1,r(`${t}-${Yl}`))},[n,t]),o}const Xl=Dr.useId;function Xn(e,t){if(Xl!==void 0){const n=Xl();return e??(t?`${t}-${n}`:n)}return b0(e,t)}const ql=f.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,children:a,...c}=t,{toast:u,setDescriptionId:l}=r0(),d=a??u.description,p=!!d,h=Xn(i);he(()=>{if(p)return l(h),()=>{l(void 0)}},[p,h,l]);const m={type:u.type},g=qe("p",t,{ref:n,state:m,props:{...c,id:h,children:d}});return p?g:null});process.env.NODE_ENV!=="production"&&(ql.displayName="ToastDescription");let ma;process.env.NODE_ENV!=="production"&&(ma=new Set);function ar(...e){if(process.env.NODE_ENV!=="production"){const t=e.join(" ");ma.has(t)||(ma.add(t),console.error(`Base UI: ${t}`))}}const Kl=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Kl.displayName="CompositeRootContext");function w0(e=!1){const t=f.useContext(Kl);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.":ft(16));return t}function S0(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:s}=e,i=r&&t!==!1,a=r&&t===!1;return{props:f.useMemo(()=>{const u={onKeyDown(l){n&&t&&l.key!=="Tab"&&l.preventDefault()}};return r||(u.tabIndex=o,!s&&n&&(u.tabIndex=t?o:-1)),(s&&(t||i)||!s&&n)&&(u["aria-disabled"]=n),s&&(!t||a)&&(u.disabled=n),u},[r,n,t,i,a,s,o])}}function Lr(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0,composite:s}=e,i=f.useRef(null),a=w0(!0),c=s??a!==void 0,{props:u}=S0({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:o});process.env.NODE_ENV!=="production"&&f.useEffect(()=>{if(!i.current)return;const h=us(i.current);if(o){if(!h){const m=Dr.captureOwnerStack?.()||"";ar(`A component that acts as a button expected a native <button> because the \`nativeButton\` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the \`render\` prop, or set \`nativeButton\` to \`false\`.${m}`)}}else if(h){const m=Dr.captureOwnerStack?.()||"";ar(`A component that acts as a button expected a non-<button> because the \`nativeButton\` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as \`role\` or \`aria-disabled\`). Use a non-<button> in the \`render\` prop, or set \`nativeButton\` to \`true\`.${m}`)}},[o]);const l=f.useCallback(()=>{const h=i.current;us(h)&&c&&t&&u.disabled===void 0&&h.disabled&&(h.disabled=!1)},[t,u.disabled,c]);he(l,[l]);const d=f.useCallback((h={})=>{const{onClick:m,onMouseDown:g,onKeyUp:v,onKeyDown:y,onPointerDown:C,...S}=h;return En({type:o?"button":void 0,onClick(b){if(t){b.preventDefault();return}m?.(b)},onMouseDown(b){t||g?.(b)},onKeyDown(b){if(t||(as(b),y?.(b),b.baseUIHandlerPrevented))return;const x=b.target===b.currentTarget,T=b.currentTarget,P=us(T),z=!o&&E0(T),I=x&&(o?P:!z),D=b.key==="Enter",$=b.key===" ",V=T.getAttribute("role"),N=V?.startsWith("menuitem")||V==="option"||V==="gridcell";if(x&&c&&$){if(b.defaultPrevented&&N)return;b.preventDefault(),z||o&&P?(T.click(),b.preventBaseUIHandler()):I&&(m?.(b),b.preventBaseUIHandler());return}I&&(!o&&($||D)&&b.preventDefault(),!o&&D&&m?.(b))},onKeyUp(b){if(!t){if(as(b),v?.(b),b.target===b.currentTarget&&o&&c&&us(b.currentTarget)&&b.key===" "){b.preventDefault();return}b.baseUIHandlerPrevented||b.target===b.currentTarget&&!o&&!c&&b.key===" "&&m?.(b)}},onPointerDown(b){if(t){b.preventDefault();return}C?.(b)}},o?void 0:{role:"button"},u,S)},[t,u,c,o]),p=ie(h=>{i.current=h,l()});return{getButtonProps:d,buttonRef:p}}function us(e){return it(e)&&e.tagName==="BUTTON"}function E0(e){return!!(e?.tagName==="A"&&e?.href)}function x0(e,t){return t!=null&&!fo(t)?0:typeof e=="function"?e():e}function ga(e,t,n){const r=x0(e,n);return typeof r=="number"?r:r?.[t]}function Jl(e){return typeof e=="function"?e():e}function Ql(e,t){return t||e==="click"||e==="mousedown"}const cr="none",Fr="trigger-press",Lt="trigger-hover",ya="outside-press",va="item-press",C0="close-press",ur="focus-out",ed="escape-key",T0="close-watcher",ba="list-navigation",O0="cancel-open",td="imperative-action",ls="swipe",P0="window-resize";function Ae(e,t,n,r){let o=!1,s=!1;const i=mt;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...i}}function _0(e,t,n){const r=mt;return{reason:e,event:t??new Event("base-ui"),...r}}function vt(e){const t=wt(I0,e).current;return t.next=e,he(t.effect),t}function I0(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function ds(e){return`data-base-ui-${e}`}let fs=0;function ps(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(fs);const s=()=>e?.focus({preventScroll:n});if(o)return s(),Ct;const i=requestAnimationFrame(s);return fs=i,()=>{fs===i&&(cancelAnimationFrame(i),fs=0)}}const wa={inert:new WeakMap,"aria-hidden":new WeakMap},nd="data-base-ui-inert",Sa={inert:new WeakSet,"aria-hidden":new WeakSet};let yo=new WeakMap,Ea=0;function k0(e){return Sa[e]}function rd(e){return e?kr(e)?e.host:rd(e.parentNode):null}const xa=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=rd(n);return e.contains(r)?r:null}).filter(n=>n!=null),od=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},sd=(e,t,n)=>{const r=[],o=s=>{!s||n.has(s)||Array.from(s.children).forEach(i=>{kt(i)!=="script"&&(t.has(i)?o(i):r.push(i))})};return o(e),r};function R0(e,t,n,r,{mark:o=!0,markerIgnoreElements:s=[]}){const i=r?"inert":n?"aria-hidden":null;let a=null,c=null;const u=xa(t,e),l=o?xa(t,s):[],d=new Set(l),p=o?sd(t,od(u),new Set(u)).filter(g=>!d.has(g)):[],h=[],m=[];if(i){const g=wa[i],v=k0(i);c=v,a=g;const y=xa(t,Array.from(t.querySelectorAll("[aria-live]"))),C=u.concat(y);sd(t,od(C),new Set(C)).forEach(E=>{const b=E.getAttribute(i),x=b!==null&&b!=="false",T=(g.get(E)||0)+1;g.set(E,T),h.push(E),T===1&&x&&v.add(E),x||E.setAttribute(i,i==="inert"?"":"true")})}return o&&p.forEach(g=>{const v=(yo.get(g)||0)+1;yo.set(g,v),m.push(g),v===1&&g.setAttribute(nd,"")}),Ea+=1,()=>{a&&h.forEach(g=>{const y=(a.get(g)||0)-1;a.set(g,y),y||(!c?.has(g)&&i&&g.removeAttribute(i),c?.delete(g))}),o&&m.forEach(g=>{const v=(yo.get(g)||0)-1;yo.set(g,v),v||g.removeAttribute(nd)}),Ea-=1,Ea||(wa.inert=new WeakMap,wa["aria-hidden"]=new WeakMap,Sa.inert=new WeakSet,Sa["aria-hidden"]=new WeakSet,yo=new WeakMap)}}function id(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:o=!0,markerIgnoreElements:s=[]}=t,i=Ie(e[0]).body;return R0(e,i,n,r,{mark:o,markerIgnoreElements:s})}const Ca=f.createContext(null);process.env.NODE_ENV!=="production"&&(Ca.displayName="PortalContext");const ad=()=>f.useContext(Ca),N0=ds("portal");function cd(e={}){const{ref:t,container:n,componentProps:r=mt,elementProps:o}=e,s=Xn(),a=ad()?.portalNode,[c,u]=f.useState(null),[l,d]=f.useState(null),p=ie(v=>{v!==null&&d(v)}),h=f.useRef(null);he(()=>{if(n===null){h.current&&(h.current=null,d(null),u(null));return}if(s==null)return;const v=(n&&(ji(n)?n:n.current))??a??document.body;if(v==null){h.current&&(h.current=null,d(null),u(null));return}h.current!==v&&(h.current=v,d(null),u(v))},[n,a,s]);const m=qe("div",r,{ref:[t,p],props:[{id:s,[N0]:""},o]});return{portalNode:l,portalSubtree:c&&m?Kt.createPortal(m,c):null}}const hs=f.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,renderGuards:a,style:c,...u}=t,{portalNode:l,portalSubtree:d}=cd({container:o,ref:n,componentProps:t,elementProps:u}),p=f.useRef(null),h=f.useRef(null),m=f.useRef(null),g=f.useRef(null),[v,y]=f.useState(null),C=f.useRef(!1),S=v?.modal,E=v?.open,b=typeof a=="boolean"?a:!!v&&!v.modal&&v.open&&!!l;f.useEffect(()=>{if(!l||S)return;function T(P){l&&P.relatedTarget&&Ar(P)&&(P.type==="focusin"?C.current&&(Rl(l),C.current=!1):(Db(l),C.current=!0))}return gn(Fe(l,"focusin",T,!0),Fe(l,"focusout",T,!0))},[l,S]),f.useEffect(()=>{!l||E!==!1||(Rl(l),C.current=!1)},[E,l]);const x=f.useMemo(()=>({beforeOutsideRef:p,afterOutsideRef:h,beforeInsideRef:m,afterInsideRef:g,portalNode:l,setFocusManagerState:y}),[l]);return w.jsxs(f.Fragment,{children:[d,w.jsxs(Ca.Provider,{value:x,children:[b&&l&&w.jsx(Sn,{"data-type":"outside",ref:p,onFocus:T=>{if(Ar(T,l))m.current?.focus();else{const P=v?v.domReference:null;Il(P)?.focus()}}}),b&&l&&w.jsx("span",{"aria-owns":l.id,style:p0}),l&&Kt.createPortal(r,l),b&&l&&w.jsx(Sn,{"data-type":"outside",ref:h,onFocus:T=>{if(Ar(T,l))g.current?.focus();else{const P=v?v.domReference:null;ca(P)?.focus(),v?.closeOnFocusOut&&v?.onOpenChange(!1,Ae(ur,T.nativeEvent))}}})]})]})});process.env.NODE_ENV!=="production"&&(hs.displayName="FloatingPortal");function ud(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class M0{nodesRef={current:[]};events=ud();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Ta=f.createContext(null);process.env.NODE_ENV!=="production"&&(Ta.displayName="FloatingNodeContext");const Oa=f.createContext(null);process.env.NODE_ENV!=="production"&&(Oa.displayName="FloatingTreeContext");const qn=()=>f.useContext(Ta)?.id||null,lr=e=>{const t=f.useContext(Oa);return e??t};function A0(e){const t=Xn(),n=lr(e),r=qn();return he(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function D0(e){const{children:t,id:n}=e,r=qn();return w.jsx(Ta.Provider,{value:f.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function L0(e){const{children:t,externalTree:n}=e,r=wt(()=>n??new M0).current;return w.jsx(Oa.Provider,{value:r,children:t})}function F0(e,t){const n=tt(lt(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const ld=20;let Kn=[];function Pa(){Kn=Kn.filter(e=>e.deref()?.isConnected)}function V0(e){Pa(),e&&kt(e)!=="body"&&(Kn.push(new WeakRef(e)),Kn.length>ld&&(Kn=Kn.slice(-ld)))}function _a(){return Pa(),Kn[Kn.length-1]?.deref()}function z0(e){return e?aa(e)?e:ho(e)[0]||e:null}function dd(e,t){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const r=Pl(e).filter(s=>{const i=s.getAttribute("data-tabindex")||"";return aa(s)||s.hasAttribute("data-tabindex")&&!i.startsWith("-")}),o=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?o!=="0"&&e.setAttribute("tabindex","0"):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function ms(e){const{context:t,children:n,disabled:r=!1,initialFocus:o=!0,returnFocus:s=!0,restoreFocus:i=!1,modal:a=!0,closeOnFocusOut:c=!0,openInteractionType:u="",nextFocusableElement:l,previousFocusableElement:d,beforeContentFocusGuardRef:p,externalTree:h,getInsideElements:m}=e,g="rootStore"in t?t.rootStore:t,v=g.useState("open"),y=g.useState("domReferenceElement"),C=g.useState("floatingElement"),{events:S,dataRef:E}=g.context,b=ie(()=>E.current.floatingContext?.nodeId),x=o===!1,T=Ki(y)&&x,P=f.useRef(["content"]),z=vt(o),I=vt(s),D=vt(u),$=lr(h),V=ad(),N=f.useRef(!1),O=f.useRef(!1),k=f.useRef(!1),_=f.useRef(null),M=f.useRef(""),A=f.useRef(""),j=f.useRef(null),B=f.useRef(null),U=or(j,p,V?.beforeInsideRef),W=or(B,V?.afterInsideRef),G=Gt(),Z=Gt(),X=ao(),K=V!=null,J=lo(C),se=ie((Y=J)=>Y?ho(Y):[]),ae=ie(()=>m?.().filter(Y=>Y!=null)??[]);f.useEffect(()=>{if(r||!a)return;function Y(ge){ge.key==="Tab"&&we(J,Pt(Ie(J)))&&se().length===0&&!T&&Yt(ge)}const me=Ie(J);return Fe(me,"keydown",Y)},[r,y,J,a,P,T,se]),f.useEffect(()=>{if(r||!v)return;const Y=Ie(J);function me(){k.current=!1}function ge(le){const ce=lt(le),ve=ae(),ue=we(C,ce)||we(y,ce)||we(V?.portalNode,ce)||ve.some(Se=>Se===ce||we(Se,ce));k.current=!ue,A.current=le.pointerType||"keyboard",ce?.closest(`[${ha}]`)&&(O.current=!0)}function fe(){A.current="keyboard"}return gn(Fe(Y,"pointerdown",ge,!0),Fe(Y,"pointerup",me,!0),Fe(Y,"pointercancel",me,!0),Fe(Y,"keydown",fe,!0))},[r,C,y,J,v,V,ae]),f.useEffect(()=>{if(r||!c)return;const Y=Ie(J);function me(){O.current=!0,Z.start(0,()=>{O.current=!1})}function ge(ve){const ue=lt(ve);aa(ue)&&(_.current=ue)}function fe(ve){const ue=ve.relatedTarget,Se=ve.currentTarget,R=lt(ve);queueMicrotask(()=>{const H=b(),L=g.context.triggerElements,F=ae(),Q=ue?.hasAttribute(ds("focus-guard"))&&[j.current,B.current,V?.beforeInsideRef.current,V?.afterInsideRef.current,V?.beforeOutsideRef.current,V?.afterOutsideRef.current,An(d),An(l)].includes(ue),ne=!(we(y,ue)||we(C,ue)||we(ue,C)||we(V?.portalNode,ue)||F.some(te=>te===ue||we(te,ue))||ue!=null&&L.hasElement(ue)||L.hasMatchingElement(te=>we(te,ue))||Q||$&&(vn($.nodesRef.current,H).find(te=>we(te.context?.elements.floating,ue)||we(te.context?.elements.domReference,ue))||pl($.nodesRef.current,H).find(te=>[te.context?.elements.floating,lo(te.context?.elements.floating)].includes(ue)||te.context?.elements.domReference===ue)));if(Se===y&&J&&dd(J,P),i&&Se!==y&&!rs(R)&&Pt(Y)===Y.body){if(it(J)&&(J.focus(),i==="popup")){X.request(()=>{J.focus()});return}const te=se(),ye=_.current,_e=(ye&&te.includes(ye)?ye:null)||te[te.length-1]||J;it(_e)&&_e.focus()}if(E.current.insideReactTree){E.current.insideReactTree=!1;return}(T||!a)&&ue&&ne&&!O.current&&(T||ue!==_a())&&(N.current=!0,g.setOpen(!1,Ae(ur,ve)))})}function le(){k.current||(E.current.insideReactTree=!0,G.start(0,()=>{E.current.insideReactTree=!1}))}const ce=it(y)?y:null;if(!(!C&&!ce))return gn(ce&&Fe(ce,"focusout",fe),ce&&Fe(ce,"pointerdown",me),C&&Fe(C,"focusin",ge),C&&Fe(C,"focusout",fe),C&&V&&Fe(C,"focusout",le,!0))},[r,y,C,J,a,$,V,g,c,i,se,T,b,P,E,G,Z,X,l,d,ae]),f.useEffect(()=>{if(r||!C||!v)return;const Y=Array.from(V?.portalNode?.querySelectorAll(`[${ds("portal")}]`)||[]),ge=($?pl($.nodesRef.current,b()):[]).find(Se=>Ki(Se.context?.elements.domReference||null))?.context?.elements.domReference,le=[...[C,...Y,j.current,B.current,V?.beforeOutsideRef.current,V?.afterOutsideRef.current,...ae()],ge,An(d),An(l),T?y:null].filter(Se=>Se!=null),ce=id(le,{ariaHidden:a||T,mark:!1}),ve=[C,...Y].filter(Se=>Se!=null),ue=id(ve);return()=>{ue(),ce()}},[v,r,y,C,a,P,V,T,$,b,l,d,ae]),he(()=>{if(!v||r||!it(J))return;const Y=Ie(J),me=Pt(Y);queueMicrotask(()=>{const ge=z.current,fe=typeof ge=="function"?ge(D.current||""):ge;if(fe===void 0||fe===!1||we(J,me))return;let ce=null;const ve=()=>(ce==null&&(ce=se(J)),ce[0]||J);let ue;fe===!0||fe===null?ue=ve():ue=An(fe),ue=ue||ve(),ps(ue,{preventScroll:ue===J})})},[r,v,J,x,se,z,D]),he(()=>{if(r||!J)return;const Y=Ie(J),me=Pt(Y);V0(me);function ge(le){if(le.open||(M.current=F0(le.nativeEvent,A.current)),le.reason===Lt&&le.nativeEvent.type==="mouseleave"&&(N.current=!0),le.reason===ya)if(le.nested)N.current=!1;else if(hl(le.nativeEvent)||ml(le.nativeEvent))N.current=!1;else{let ce=!1;Ie(J).createElement("div").focus({get preventScroll(){return ce=!0,!1}}),ce?N.current=!1:N.current=!0}}S.on("openchange",ge);function fe(){const le=I.current;let ce=typeof le=="function"?le(M.current):le;if(ce===void 0||ce===!1)return null;if(ce===null&&(ce=!0),typeof ce=="boolean"){const ue=y||_a();return ue&&ue.isConnected?ue:null}const ve=y||_a();return An(ce)||ve||null}return()=>{S.off("openchange",ge);const le=Pt(Y),ce=ae(),ve=we(C,le)||ce.some(R=>R===le||we(R,le))||$&&vn($.nodesRef.current,b(),!1).some(R=>we(R.context?.elements.floating,le)),ue=I.current,Se=fe();queueMicrotask(()=>{const R=z0(Se),H=typeof ue!="boolean";ue&&!N.current&&it(R)&&(!(!H&&R!==le&&le!==Y.body)||ve)&&R.focus({preventScroll:!0}),N.current=!1})}},[r,C,J,I,E,S,$,y,b,ae]),he(()=>{if(!Gi||v||!C)return;const Y=Pt(Ie(C));!it(Y)||!qi(Y)||we(C,Y)&&Y.blur()},[v,C]),he(()=>{if(!(r||!V))return V.setFocusManagerState({modal:a,closeOnFocusOut:c,open:v,onOpenChange:g.setOpen,domReference:y}),()=>{V.setFocusManagerState(null)}},[r,V,a,v,g,c,y]),he(()=>{if(!(r||!J))return dd(J,P),()=>{queueMicrotask(Pa)}},[r,J,P]);const pe=!r&&(a?!T:!0)&&(K||a);return w.jsxs(f.Fragment,{children:[pe&&w.jsx(Sn,{"data-type":"inside",ref:U,onFocus:Y=>{if(a){const me=se();ps(me[me.length-1])}else V?.portalNode&&(N.current=!1,Ar(Y,V.portalNode)?ca(y)?.focus():An(d??V.beforeOutsideRef)?.focus())}}),n,pe&&w.jsx(Sn,{"data-type":"inside",ref:W,onFocus:Y=>{a?ps(se()[0]):V?.portalNode&&(c&&(N.current=!0),Ar(Y,V.portalNode)?Il(y)?.focus():An(l??V.afterOutsideRef)?.focus())}})]})}function Ia(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:o=!0,event:s="click",toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:c=!0,touchOpenDelay:u=0,reason:l=Fr}=t,d=f.useRef(void 0),p=ao(),h=Gt(),m=f.useMemo(()=>({onPointerDown(g){d.current=g.pointerType},onMouseDown(g){const v=d.current,y=g.nativeEvent,C=n.select("open");if(g.button!==0||s==="click"||fo(v,!0)&&a)return;const S=r.current.openEvent,E=S?.type,b=n.select("domReferenceElement")!==g.currentTarget,x=C&&b||!(C&&i&&(!(S&&c)||E==="click"||E==="mousedown")),T=lt(y);if(qi(T)){const z=Ae(l,y,T);x&&v==="touch"&&u>0?h.start(u,()=>{n.setOpen(!0,z)}):n.setOpen(x,z);return}const P=g.currentTarget;p.request(()=>{const z=Ae(l,y,P);x&&v==="touch"&&u>0?h.start(u,()=>{n.setOpen(!0,z)}):n.setOpen(x,z)})},onClick(g){if(s==="mousedown-only")return;const v=d.current;if(s==="mousedown"&&v){d.current=void 0;return}if(fo(v,!0)&&a)return;const y=n.select("open"),C=r.current.openEvent,S=n.select("domReferenceElement")!==g.currentTarget,E=y&&S||!(y&&i&&(!(C&&c)||gl(C))),b=Ae(l,g.nativeEvent,g.currentTarget);E&&v==="touch"&&u>0?h.start(u,()=>{n.setOpen(!0,b)}):n.setOpen(E,b)},onKeyDown(){d.current=void 0}}),[r,s,a,n,c,i,p,h,u,l]);return f.useMemo(()=>o?{reference:m}:mt,[o,m])}const $0={intentional:"onClick",sloppy:"onPointerDown"};function j0(){return!1}function H0(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function ka(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),{dataRef:s}=n.context,{enabled:i=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:u="sloppy",referencePress:l=j0,referencePressEvent:d="sloppy",bubbles:p,externalTree:h}=t,m=lr(h),g=ie(typeof c=="function"?c:()=>!1),v=typeof c=="function"?g:c,y=v!==!1,C=ie(()=>u),S=f.useRef(!1),E=f.useRef(!1),b=f.useRef(!1),{escapeKey:x,outsidePress:T}=H0(p),P=f.useRef(null),z=Gt(),I=Gt(),D=ie(()=>{I.clear(),s.current.insideReactTree=!1}),$=f.useRef(!1),V=f.useRef(""),N=ie(l),O=ie(B=>{if(!r||!i||!a||B.key!=="Escape"||$.current)return;const U=s.current.floatingContext?.nodeId,W=m?vn(m.nodesRef.current,U):[];if(!x&&W.length>0){let X=!0;if(W.forEach(K=>{K.context?.open&&!K.context.dataRef.current.__escapeKeyBubbles&&(X=!1)}),!X)return}const G=pb(B)?B.nativeEvent:B,Z=Ae(ed,G);n.setOpen(!1,Z),!x&&!Z.isPropagationAllowed&&B.stopPropagation()}),k=ie(()=>{s.current.insideReactTree=!0,I.start(0,D)});f.useEffect(()=>{if(!r||!i)return;s.current.__escapeKeyBubbles=x,s.current.__outsidePressBubbles=T;const B=new Zt,U=new Zt;function W(){B.clear(),$.current=!0}function G(){B.start(Yo()?5:0,()=>{$.current=!1})}function Z(){b.current=!0,U.start(0,()=>{b.current=!1})}function X(){S.current=!1,E.current=!1}function K(){const L=V.current,F=L==="pen"||!L?"mouse":L,Q=C(),ne=typeof Q=="function"?Q():Q;return typeof ne=="string"?ne:ne[F]}function J(L){const F=K();return F==="intentional"&&L.type!=="click"||F==="sloppy"&&L.type==="click"}function se(L){const F=s.current.floatingContext?.nodeId,Q=m&&vn(m.nodesRef.current,F).some(ne=>un(L,ne.context?.elements.floating));return un(L,n.select("floatingElement"))||un(L,n.select("domReferenceElement"))||Q}function ae(L){if(J(L)){D();return}if(s.current.insideReactTree){D();return}const F=lt(L),Q=`[${ds("inert")}]`,ne=$e(F)?F.getRootNode():null,te=Array.from((kr(ne)?ne:Ie(n.select("floatingElement"))).querySelectorAll(Q)),ye=n.context.triggerElements;if(F&&(ye.hasElement(F)||ye.hasMatchingElement(Pe=>we(Pe,F))))return;let _e=$e(F)?F:null;for(;_e&&!Rn(_e);){const Pe=Nn(_e);if(Rn(Pe)||!$e(Pe))break;_e=Pe}if(te.length&&$e(F)&&!db(F)&&!we(F,n.select("floatingElement"))&&te.every(Pe=>!we(_e,Pe)))return;if(it(F)&&!("touches"in L)){const Pe=Rn(F),Ve=At(F),Ge=/auto|scroll/,He=Pe||Ge.test(Ve.overflowX),nt=Pe||Ge.test(Ve.overflowY),st=He&&F.clientWidth>0&&F.scrollWidth>F.clientWidth,Re=nt&&F.clientHeight>0&&F.scrollHeight>F.clientHeight,Te=Ve.direction==="rtl",Ue=Re&&(Te?L.offsetX<=F.offsetWidth-F.clientWidth:L.offsetX>F.clientWidth),Be=st&&L.offsetY>F.clientHeight;if(Ue||Be)return}if(se(L))return;if(K()==="intentional"&&b.current){U.clear(),b.current=!1;return}if(typeof v=="function"&&!v(L))return;const Ee=s.current.floatingContext?.nodeId,Ce=m?vn(m.nodesRef.current,Ee):[];if(Ce.length>0){let Pe=!0;if(Ce.forEach(Ve=>{Ve.context?.open&&!Ve.context.dataRef.current.__outsidePressBubbles&&(Pe=!1)}),!Pe)return}n.setOpen(!1,Ae(ya,L)),D()}function pe(L){K()!=="sloppy"||L.pointerType==="touch"||!n.select("open")||!i||un(L,n.select("floatingElement"))||un(L,n.select("domReferenceElement"))||ae(L)}function Y(L){if(K()!=="sloppy"||!n.select("open")||!i||un(L,n.select("floatingElement"))||un(L,n.select("domReferenceElement")))return;const F=L.touches[0];F&&(P.current={startTime:Date.now(),startX:F.clientX,startY:F.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},z.start(1e3,()=>{P.current&&(P.current.dismissOnTouchEnd=!1,P.current.dismissOnMouseDown=!1)}))}function me(L,F){const Q=lt(L);if(!Q)return;const ne=Fe(Q,L.type,()=>{F(L),ne()})}function ge(L){V.current="touch",me(L,Y)}function fe(L){z.clear(),L.type==="pointerdown"&&(V.current=L.pointerType),!(L.type==="mousedown"&&P.current&&!P.current.dismissOnMouseDown)&&me(L,F=>{F.type==="pointerdown"?pe(F):ae(F)})}function le(L){if(!S.current)return;const F=E.current;if(X(),K()==="intentional"){if(L.type==="pointercancel"){F&&Z();return}if(!se(L)){if(F){Z();return}typeof v=="function"&&!v(L)||(U.clear(),b.current=!0,D())}}}function ce(L){if(K()!=="sloppy"||!P.current||un(L,n.select("floatingElement"))||un(L,n.select("domReferenceElement")))return;const F=L.touches[0];if(!F)return;const Q=Math.abs(F.clientX-P.current.startX),ne=Math.abs(F.clientY-P.current.startY),te=Math.sqrt(Q*Q+ne*ne);te>5&&(P.current.dismissOnTouchEnd=!0),te>10&&(ae(L),z.clear(),P.current=null)}function ve(L){me(L,ce)}function ue(L){K()!=="sloppy"||!P.current||un(L,n.select("floatingElement"))||un(L,n.select("domReferenceElement"))||(P.current.dismissOnTouchEnd&&ae(L),z.clear(),P.current=null)}function Se(L){me(L,ue)}const R=Ie(o),H=gn(a&&gn(Fe(R,"keydown",O),Fe(R,"compositionstart",W),Fe(R,"compositionend",G)),y&&gn(Fe(R,"click",fe,!0),Fe(R,"pointerdown",fe,!0),Fe(R,"pointerup",le,!0),Fe(R,"pointercancel",le,!0),Fe(R,"mousedown",fe,!0),Fe(R,"mouseup",le,!0),Fe(R,"touchstart",ge,!0),Fe(R,"touchmove",ve,!0),Fe(R,"touchend",Se,!0)));return()=>{H(),B.clear(),U.clear(),X(),b.current=!1}},[s,o,a,y,v,r,i,x,T,O,D,C,m,n,z]),f.useEffect(D,[v,D]);const _=f.useMemo(()=>({onKeyDown:O,[$0[d]]:B=>{N()&&n.setOpen(!1,Ae(Fr,B.nativeEvent))},...d!=="intentional"&&{onClick(B){N()&&n.setOpen(!1,Ae(Fr,B.nativeEvent))}}}),[O,n,d,N]),M=ie(B=>{if(!r||!i||B.button!==0)return;const U=lt(B.nativeEvent);we(n.select("floatingElement"),U)&&(S.current||(S.current=!0,E.current=!1))}),A=ie(B=>{!r||!i||(B.defaultPrevented||B.nativeEvent.defaultPrevented)&&S.current&&(E.current=!0)}),j=f.useMemo(()=>({onKeyDown:O,onPointerDown:A,onMouseDown:A,onClickCapture:k,onMouseDownCapture(B){k(),M(B)},onPointerDownCapture(B){k(),M(B)},onMouseUpCapture:k,onTouchEndCapture:k,onTouchMoveCapture:k}),[O,k,M,A]);return f.useMemo(()=>i?{reference:_,floating:j,trigger:_}:{},[i,_,j])}function fd(e,t,n){let{reference:r,floating:o}=e;const s=en(t),i=na(t),a=ta(i),c=jt(t),u=s==="y",l=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let h;switch(c){case"top":h={x:l,y:r.y-o.height};break;case"bottom":h={x:l,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(Gn(t)){case"start":h[i]-=p*(n&&u?-1:1);break;case"end":h[i]+=p*(n&&u?-1:1);break}return h}async function U0(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:d="floating",altBoundary:p=!1,padding:h=0}=Mn(t,e),m=bl(h),v=a[p?d==="floating"?"reference":"floating":d],y=po(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:l,strategy:c})),C=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),E=await(s.isElement==null?void 0:s.isElement(S))?await(s.getScale==null?void 0:s.getScale(S))||{x:1,y:1}:{x:1,y:1},b=po(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:C,offsetParent:S,strategy:c}):C);return{top:(y.top-b.top+m.top)/E.y,bottom:(b.bottom-y.bottom+m.bottom)/E.y,left:(y.left-b.left+m.left)/E.x,right:(b.right-y.right+m.right)/E.x}}const B0=50,W0=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:U0},c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:d}=fd(u,r,c),p=r,h=0;const m={};for(let g=0;g<s.length;g++){const v=s[g];if(!v)continue;const{name:y,fn:C}=v,{x:S,y:E,data:b,reset:x}=await C({x:l,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:m,rects:u,platform:a,elements:{reference:e,floating:t}});l=S??l,d=E??d,m[y]={...m[y],...b},x&&h<B0&&(h++,typeof x=="object"&&(x.placement&&(p=x.placement),x.rects&&(u=x.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):x.rects),{x:l,y:d}=fd(u,p,c)),g=-1)}return{x:l,y:d,placement:p,strategy:o,middlewareData:m}},Z0=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:l=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...v}=Mn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=jt(o),C=en(a),S=jt(a)===a,E=await(c.isRTL==null?void 0:c.isRTL(u.floating)),b=p||(S||!g?[es(a)]:yb(a)),x=m!=="none";!p&&x&&b.push(...Sb(a,g,m,E));const T=[a,...b],P=await c.detectOverflow(t,v),z=[];let I=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&z.push(P[y]),d){const N=gb(o,i,E);z.push(P[N[0]],P[N[1]])}if(I=[...I,{placement:o,overflows:z}],!z.every(N=>N<=0)){var D,$;const N=(((D=s.flip)==null?void 0:D.index)||0)+1,O=T[N];if(O&&(!(d==="alignment"?C!==en(O):!1)||I.every(M=>en(M.placement)===C?M.overflows[0]>0:!0)))return{data:{index:N,overflows:I},reset:{placement:O}};let k=($=I.filter(_=>_.overflows[0]<=0).sort((_,M)=>_.overflows[1]-M.overflows[1])[0])==null?void 0:$.placement;if(!k)switch(h){case"bestFit":{var V;const _=(V=I.filter(M=>{if(x){const A=en(M.placement);return A===C||A==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(A=>A>0).reduce((A,j)=>A+j,0)]).sort((M,A)=>M[1]-A[1])[0])==null?void 0:V[0];_&&(k=_);break}case"initialPlacement":k=a;break}if(o!==k)return{reset:{placement:k}}}return{}}}};function pd(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function hd(e){return hb.some(t=>e[t]>=0)}const G0=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=Mn(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=pd(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:hd(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),a=pd(i,n.floating);return{data:{escapedOffsets:a,escaped:hd(a)}}}default:return{}}}}},md=new Set(["left","top"]);async function Y0(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=jt(n),a=Gn(n),c=en(n)==="y",u=md.has(i)?-1:1,l=s&&c?-1:1,d=Mn(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(h=a==="end"?m*-1:m),c?{x:h*l,y:p*u}:{x:p*u,y:h*l}}const X0=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,c=await Y0(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},q0=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:c={fn:y=>{let{x:C,y:S}=y;return{x:C,y:S}}},...u}=Mn(e,t),l={x:n,y:r},d=await s.detectOverflow(t,u),p=en(jt(o)),h=ea(p);let m=l[h],g=l[p];if(i){const y=h==="y"?"top":"left",C=h==="y"?"bottom":"right",S=m+d[y],E=m-d[C];m=Qi(S,m,E)}if(a){const y=p==="y"?"top":"left",C=p==="y"?"bottom":"right",S=g+d[y],E=g-d[C];g=Qi(S,g,E)}const v=c.fn({...t,[h]:m,[p]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:i,[p]:a}}}}}},K0=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Mn(e,t),l={x:n,y:r},d=en(o),p=ea(d);let h=l[p],m=l[d];const g=Mn(a,t),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const S=p==="y"?"height":"width",E=s.reference[p]-s.floating[S]+v.mainAxis,b=s.reference[p]+s.reference[S]-v.mainAxis;h<E?h=E:h>b&&(h=b)}if(u){var y,C;const S=p==="y"?"width":"height",E=md.has(jt(o)),b=s.reference[d]-s.floating[S]+(E&&((y=i.offset)==null?void 0:y[d])||0)+(E?0:v.crossAxis),x=s.reference[d]+s.reference[S]+(E?0:((C=i.offset)==null?void 0:C[d])||0)-(E?v.crossAxis:0);m<b?m=b:m>x&&(m=x)}return{[p]:h,[d]:m}}}},J0=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:c=()=>{},...u}=Mn(e,t),l=await i.detectOverflow(t,u),d=jt(o),p=Gn(o),h=en(o)==="y",{width:m,height:g}=s.floating;let v,y;d==="top"||d==="bottom"?(v=d,y=p===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,v=p==="end"?"top":"bottom");const C=g-l.top-l.bottom,S=m-l.left-l.right,E=Nr(g-l[v],C),b=Nr(m-l[y],S),x=!t.middlewareData.shift;let T=E,P=b;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=C),x&&!p){const I=Xt(l.left,0),D=Xt(l.right,0),$=Xt(l.top,0),V=Xt(l.bottom,0);h?P=m-2*(I!==0||D!==0?I+D:Xt(l.left,l.right)):T=g-2*($!==0||V!==0?$+V:Xt(l.top,l.bottom))}await c({...t,availableWidth:P,availableHeight:T});const z=await i.getDimensions(a.floating);return m!==z.width||g!==z.height?{reset:{rects:!0}}:{}}}};function gd(e){const t=At(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=it(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Qo(n)!==s||Qo(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function Ra(e){return $e(e)?e:e.contextElement}function Vr(e){const t=Ra(e);if(!it(t))return bn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=gd(t);let i=(s?Qo(n.width):n.width)/r,a=(s?Qo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Q0=bn(0);function yd(e){const t=tt(e);return!Yo()||!t.visualViewport?Q0:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ew(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==tt(e)?!1:t}function dr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ra(e);let i=bn(1);t&&(r?$e(r)&&(i=Vr(r)):i=Vr(e));const a=ew(s,n,r)?yd(s):bn(0);let c=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,l=o.width/i.x,d=o.height/i.y;if(s){const p=tt(s),h=r&&$e(r)?tt(r):r;let m=p,g=Bi(m);for(;g&&r&&h!==m;){const v=Vr(g),y=g.getBoundingClientRect(),C=At(g),S=y.left+(g.clientLeft+parseFloat(C.paddingLeft))*v.x,E=y.top+(g.clientTop+parseFloat(C.paddingTop))*v.y;c*=v.x,u*=v.y,l*=v.x,d*=v.y,c+=S,u+=E,m=tt(g),g=Bi(m)}}return po({width:l,height:d,x:c,y:u})}function gs(e,t){const n=Xo(e).scrollLeft;return t?t.left+n:dr(mn(e)).left+n}function vd(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-gs(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function tw(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=mn(r),a=t?Go(t.floating):!1;if(r===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},u=bn(1);const l=bn(0),d=it(r);if((d||!d&&!s)&&((kt(r)!=="body"||Bn(i))&&(c=Xo(r)),d)){const h=dr(r);u=Vr(r),l.x=h.x+r.clientLeft,l.y=h.y+r.clientTop}const p=i&&!d&&!s?vd(i,c):bn(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+l.x+p.x,y:n.y*u.y-c.scrollTop*u.y+l.y+p.y}}function nw(e){return Array.from(e.getClientRects())}function rw(e){const t=mn(e),n=Xo(e),r=e.ownerDocument.body,o=Xt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Xt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+gs(e);const a=-n.scrollTop;return At(r).direction==="rtl"&&(i+=Xt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const bd=25;function ow(e,t){const n=tt(e),r=mn(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,c=0;if(o){s=o.width,i=o.height;const l=Yo();(!l||l&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}const u=gs(r);if(u<=0){const l=r.ownerDocument,d=l.body,p=getComputedStyle(d),h=l.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,m=Math.abs(r.clientWidth-d.clientWidth-h);m<=bd&&(s-=m)}else u<=bd&&(s+=u);return{width:s,height:i,x:a,y:c}}function sw(e,t){const n=dr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=it(e)?Vr(e):bn(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:a,x:c,y:u}}function wd(e,t,n){let r;if(t==="viewport")r=ow(e,n);else if(t==="document")r=rw(mn(e));else if($e(t))r=sw(t,n);else{const o=yd(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return po(r)}function Sd(e,t){const n=Nn(e);return n===t||!$e(n)||Rn(n)?!1:At(n).position==="fixed"||Sd(n,t)}function iw(e,t){const n=t.get(e);if(n)return n;let r=io(e,[],!1).filter(a=>$e(a)&&kt(a)!=="body"),o=null;const s=At(e).position==="fixed";let i=s?Nn(e):e;for(;$e(i)&&!Rn(i);){const a=At(i),c=Ui(i);!c&&a.position==="fixed"&&(o=null),(s?!c&&!o:!c&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Bn(i)&&!c&&Sd(e,i))?r=r.filter(l=>l!==i):o=a,i=Nn(i)}return t.set(e,r),r}function aw(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Go(t)?[]:iw(t,this._c):[].concat(n),r],a=wd(t,i[0],o);let c=a.top,u=a.right,l=a.bottom,d=a.left;for(let p=1;p<i.length;p++){const h=wd(t,i[p],o);c=Xt(h.top,c),u=Nr(h.right,u),l=Nr(h.bottom,l),d=Xt(h.left,d)}return{width:u-d,height:l-c,x:d,y:c}}function cw(e){const{width:t,height:n}=gd(e);return{width:t,height:n}}function uw(e,t,n){const r=it(t),o=mn(t),s=n==="fixed",i=dr(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=bn(0);function u(){c.x=gs(o)}if(r||!r&&!s)if((kt(t)!=="body"||Bn(o))&&(a=Xo(t)),r){const h=dr(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else o&&u();s&&!r&&o&&u();const l=o&&!r&&!s?vd(o,a):bn(0),d=i.left+a.scrollLeft-c.x-l.x,p=i.top+a.scrollTop-c.y-l.y;return{x:d,y:p,width:i.width,height:i.height}}function Na(e){return At(e).position==="static"}function Ed(e,t){if(!it(e)||At(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return mn(e)===n&&(n=n.ownerDocument.body),n}function xd(e,t){const n=tt(e);if(Go(e))return n;if(!it(e)){let o=Nn(e);for(;o&&!Rn(o);){if($e(o)&&!Na(o))return o;o=Nn(o)}return n}let r=Ed(e,t);for(;r&&tb(r)&&Na(r);)r=Ed(r,t);return r&&Rn(r)&&Na(r)&&!Ui(r)?n:r||ob(e)||n}const lw=async function(e){const t=this.getOffsetParent||xd,n=this.getDimensions,r=await n(e.floating);return{reference:uw(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function dw(e){return At(e).direction==="rtl"}const Cd={convertOffsetParentRelativeRectToViewportRelativeRect:tw,getDocumentElement:mn,getClippingRect:aw,getOffsetParent:xd,getElementRects:lw,getClientRects:nw,getDimensions:cw,getScale:Vr,isElement:$e,isRTL:dw};function Td(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function fw(e,t){let n=null,r;const o=mn(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const u=e.getBoundingClientRect(),{left:l,top:d,width:p,height:h}=u;if(a||t(),!p||!h)return;const m=rr(d),g=rr(o.clientWidth-(l+p)),v=rr(o.clientHeight-(d+h)),y=rr(l),S={rootMargin:-m+"px "+-g+"px "+-v+"px "+-y+"px",threshold:Xt(0,Nr(1,c))||1};let E=!0;function b(x){const T=x[0].intersectionRatio;if(T!==c){if(!E)return i();T?i(!1,T):r=setTimeout(()=>{i(!1,1e-7)},1e3)}T===1&&!Td(u,e.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(b,{...S,root:o.ownerDocument})}catch{n=new IntersectionObserver(b,S)}n.observe(e)}return i(!0),s}function Od(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Ra(e),l=o||s?[...u?io(u):[],...t?io(t):[]]:[];l.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const d=u&&a?fw(u,n):null;let p=-1,h=null;i&&(h=new ResizeObserver(y=>{let[C]=y;C&&C.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var S;(S=h)==null||S.observe(t)})),n()}),u&&!c&&h.observe(u),t&&h.observe(t));let m,g=c?dr(e):null;c&&v();function v(){const y=dr(e);g&&!Td(g,y)&&n(),g=y,m=requestAnimationFrame(v)}return n(),()=>{var y;l.forEach(C=>{o&&C.removeEventListener("scroll",n),s&&C.removeEventListener("resize",n)}),d?.(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(m)}}const pw=X0,hw=q0,mw=Z0,gw=J0,yw=G0,vw=K0,bw=(e,t,n)=>{const r=new Map,o={platform:Cd,...n},s={...o.platform,_c:r};return W0(e,t,{...o,platform:s})};var ww=typeof document<"u",Sw=function(){},ys=ww?oe.useLayoutEffect:Sw;function vs(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!vs(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!vs(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Pd(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function _d(e,t){const n=Pd(e);return Math.round(t*n)/n}function Ma(e){const t=f.useRef(e);return ys(()=>{t.current=e}),t}function Ew(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[l,d]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=f.useState(r);vs(p,r)||h(r);const[m,g]=f.useState(null),[v,y]=f.useState(null),C=f.useCallback(M=>{M!==x.current&&(x.current=M,g(M))},[]),S=f.useCallback(M=>{M!==T.current&&(T.current=M,y(M))},[]),E=s||m,b=i||v,x=f.useRef(null),T=f.useRef(null),P=f.useRef(l),z=c!=null,I=Ma(c),D=Ma(o),$=Ma(u),V=f.useCallback(()=>{if(!x.current||!T.current)return;const M={placement:t,strategy:n,middleware:p};D.current&&(M.platform=D.current),bw(x.current,T.current,M).then(A=>{const j={...A,isPositioned:$.current!==!1};N.current&&!vs(P.current,j)&&(P.current=j,Kt.flushSync(()=>{d(j)}))})},[p,t,n,D,$]);ys(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,d(M=>({...M,isPositioned:!1})))},[u]);const N=f.useRef(!1);ys(()=>(N.current=!0,()=>{N.current=!1}),[]),ys(()=>{if(E&&(x.current=E),b&&(T.current=b),E&&b){if(I.current)return I.current(E,b,V);V()}},[E,b,V,I,z]);const O=f.useMemo(()=>({reference:x,floating:T,setReference:C,setFloating:S}),[C,S]),k=f.useMemo(()=>({reference:E,floating:b}),[E,b]),_=f.useMemo(()=>{const M={position:n,left:0,top:0};if(!k.floating)return M;const A=_d(k.floating,l.x),j=_d(k.floating,l.y);return a?{...M,transform:"translate("+A+"px, "+j+"px)",...Pd(k.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:A,top:j}},[n,a,k.floating,l.x,l.y]);return f.useMemo(()=>({...l,update:V,refs:O,elements:k,floatingStyles:_}),[l,V,O,k,_])}const xw=(e,t)=>{const n=pw(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cw=(e,t)=>{const n=hw(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tw=(e,t)=>({fn:vw(e).fn,options:[e,t]}),Ow=(e,t)=>{const n=mw(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pw=(e,t)=>{const n=gw(e);return{name:n.name,fn:n.fn,options:[e,t]}},_w=(e,t)=>{const n=yw(e);return{name:n.name,fn:n.fn,options:[e,t]}},Iw={open:de(e=>e.open),transitionStatus:de(e=>e.transitionStatus),domReferenceElement:de(e=>e.domReferenceElement),referenceElement:de(e=>e.positionReference??e.referenceElement),floatingElement:de(e=>e.floatingElement),floatingId:de(e=>e.floatingId)};class Aa extends Wo{constructor(t){const{syncOnly:n,nested:r,onOpenChange:o,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:ud(),nested:r,triggerElements:s},Iw),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&gl(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function vo(e,t=!1,n=!1){const[r,o]=f.useState(e&&t?"idle":void 0),[s,i]=f.useState(e);return e&&!s&&(i(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),he(()=>{if(!e&&s&&r!=="ending"&&n){const a=yn.request(()=>{o("ending")});return()=>{yn.cancel(a)}}},[e,s,r,n]),he(()=>{if(!e||t)return;const a=yn.request(()=>{o(void 0)});return()=>{yn.cancel(a)}},[t,e]),he(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const a=yn.request(()=>{o("idle")});return()=>{yn.cancel(a)}},[t,e,s,r]),{mounted:s,setMounted:i,transitionStatus:r}}function kw(e,t){const n=f.useRef(null),r=f.useRef(null);return f.useCallback(o=>{if(e!==void 0){if(n.current!==null){const s=n.current,i=r.current,a=t.context.triggerElements.getById(s);i&&a===i&&t.context.triggerElements.delete(s),n.current=null,r.current=null}o!==null&&(n.current=e,r.current=o,t.context.triggerElements.add(e,o))}},[t,e])}function Id(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=kw(e,n),i=ie(a=>{if(s(a),!a||!n.select("open"))return;const c=n.select("activeTriggerId");if(c===e){n.update({activeTriggerElement:a,...r});return}c==null&&n.update({activeTriggerId:e,activeTriggerElement:a,...r})});return he(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:o}}function kd(e){const t=e.useState("open");he(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[r,o]=n.value;e.update({activeTriggerId:r,activeTriggerElement:o})}}},[t,e])}function Rd(e,t,n){const{mounted:r,setMounted:o,transitionStatus:s}=vo(e);t.useSyncedValues({mounted:r,transitionStatus:s});const i=ie(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),a=t.useState("preventUnmountingOnClose");return xn({enabled:!a,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:s}}class bs{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);if(r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(t,n),process.env.NODE_ENV!=="production"&&this.elementsSet.size!==this.idMap.size))throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.")}delete(t){const n=this.idMap.get(t);n&&(this.elementsSet.delete(n),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const n of this.elementsSet)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function Rw(){return new Aa({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new bs,floatingId:"",syncOnly:!1,nested:!1,onOpenChange:void 0})}function Nd(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Rw(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:mt,inactiveTriggerProps:mt,popupProps:mt}}const ws=de(e=>e.triggerIdProp??e.activeTriggerId),Md={open:de(e=>e.openProp??e.open),mounted:de(e=>e.mounted),transitionStatus:de(e=>e.transitionStatus),floatingRootContext:de(e=>e.floatingRootContext),preventUnmountingOnClose:de(e=>e.preventUnmountingOnClose),payload:de(e=>e.payload),activeTriggerId:ws,activeTriggerElement:de(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:de((e,t)=>t!==void 0&&ws(e)===t),isOpenedByTrigger:de((e,t)=>t!==void 0&&ws(e)===t&&e.open),isMountedByTrigger:de((e,t)=>t!==void 0&&ws(e)===t&&e.mounted),triggerProps:de((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:de(e=>e.popupProps),popupElement:de(e=>e.popupElement),positionerElement:de(e=>e.positionerElement)};function Ad(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Xn(),s=qn()!=null;if(process.env.NODE_ENV!=="production"){const a=r.reference;a&&!$e(a)&&console.error("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `context.setPositionReference()`","instead.")}const i=wt(()=>new Aa({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new bs,floatingId:o,syncOnly:!1,nested:s})).current;return he(()=>{const a={open:t,floatingId:o};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=$e(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),i.update(a)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function Nw(e={}){const{nodeId:t,externalTree:n}=e,r=Ad(e),o=e.rootContext||r,s={reference:o.useState("referenceElement"),floating:o.useState("floatingElement"),domReference:o.useState("domReferenceElement")},[i,a]=f.useState(null),c=f.useRef(null),u=lr(n);he(()=>{s.domReference&&(c.current=s.domReference)},[s.domReference]);const l=Ew({...e,elements:{...s,...i&&{reference:i}}}),d=f.useCallback(P=>{const z=$e(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;a(z),l.refs.setReference(z)},[l.refs]),[p,h]=f.useState(void 0),[m,g]=f.useState(null);o.useSyncedValue("referenceElement",p??null);const v=$e(p)?p:null;o.useSyncedValue("domReferenceElement",p===void 0?s.domReference:v),o.useSyncedValue("floatingElement",m);const y=f.useCallback(P=>{($e(P)||P===null)&&(c.current=P,h(P)),($e(l.refs.reference.current)||l.refs.reference.current===null||P!==null&&!$e(P))&&l.refs.setReference(P)},[l.refs,h]),C=f.useCallback(P=>{g(P),l.refs.setFloating(P)},[l.refs]),S=f.useMemo(()=>({...l.refs,setReference:y,setFloating:C,setPositionReference:d,domReference:c}),[l.refs,y,C,d]),E=f.useMemo(()=>({...l.elements,domReference:s.domReference}),[l.elements,s.domReference]),b=o.useState("open"),x=o.useState("floatingId"),T=f.useMemo(()=>({...l,dataRef:o.context.dataRef,open:b,onOpenChange:o.setOpen,events:o.context.events,floatingId:x,refs:S,elements:E,nodeId:t,rootStore:o}),[l,S,E,t,o,b,x]);return he(()=>{o.context.dataRef.current.floatingContext=T;const P=u?.nodesRef.current.find(z=>z.id===t);P&&(P.context=T)}),f.useMemo(()=>({...l,context:T,refs:S,elements:E,rootStore:o}),[l,S,E,T,o])}function Dd(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,o=Xn(),s=qn()!=null,i=t.useState("open"),a=t.useState("activeTriggerElement"),c=t.useState(n?"popupElement":"positionerElement"),u=t.context.triggerElements,l=wt(()=>new Aa({open:i,transitionStatus:void 0,referenceElement:a,floatingElement:c,triggerElements:u,onOpenChange:r,floatingId:o,syncOnly:!0,nested:s})).current;return he(()=>{const d={open:i,floatingId:o,referenceElement:a,floatingElement:c};$e(a)&&(d.domReferenceElement=a),l.state.positionReference===l.state.referenceElement&&(d.positionReference=a),l.update(d)},[i,o,a,c,l]),l.context.onOpenChange=r,l.context.nested=s,l}class Da{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Zt,this.restTimeout=new Zt,this.handleCloseOptions=void 0}static create(){return new Da}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const Ss=new WeakMap;function Es(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&Ss.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),Ss.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Ld(e,t){const{scopeElement:n,referenceElement:r,floatingElement:o}=t,s=Ss.get(n);s&&s!==e&&Es(s),Es(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=o,Ss.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",o.style.pointerEvents="auto"}function Fd(e){const t=wt(Da.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||(n.hoverInteractionState=t),so(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function Mw(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:a=!0,closeDelay:c=0,nodeId:u}=t,l=Fd(n),d=lr(),p=qn(),h=ie(()=>Ql(i.current.openEvent?.type,l.interactedInside)),m=ie(()=>{const E=i.current.openEvent?.type;return E?.includes("mouse")&&E!=="mousedown"}),g=ie(E=>fl(E,n.context.triggerElements)),v=f.useCallback(E=>{const b=ga(c,"close",l.pointerType),x=()=>{n.setOpen(!1,Ae(Lt,E)),d?.events.emit("floating.closed",E)};b?l.openChangeTimeout.start(b,x):(l.openChangeTimeout.clear(),x())},[c,n,l,d]),y=ie(()=>{Es(l)}),C=ie(E=>{const b=lt(E);if(!fb(b)){l.interactedInside=!1;return}l.interactedInside=b?.closest("[aria-haspopup]")!=null});he(()=>{r||(l.pointerType=void 0,l.restTimeoutPending=!1,l.interactedInside=!1,y())},[r,l,y]),f.useEffect(()=>y,[y]),he(()=>{if(a&&r&&l.handleCloseOptions?.blockPointerEvents&&m()&&$e(s)&&o){const E=s,b=o,x=Ie(o),T=d?.nodesRef.current.find(z=>z.id===p)?.context?.elements.floating;T&&(T.style.pointerEvents="");const P=l.handleCloseOptions?.getScope?.()??l.pointerEventsScopeElement??T??E.closest("[data-rootownerid]")??x.body;return Ld(l,{scopeElement:P,referenceElement:E,floatingElement:b}),()=>{y()}}},[a,r,s,o,l,m,d,p,y]);const S=Gt();f.useEffect(()=>{if(!a)return;function E(){l.openChangeTimeout.clear(),S.clear(),d?.events.off("floating.closed",x),y()}function b(P){if(d&&p&&vn(d.nodesRef.current,p).length>0){d.events.on("floating.closed",x);return}if(g(P.relatedTarget))return;const z=i.current.floatingContext?.nodeId??u,I=P.relatedTarget;if(!(d&&z&&$e(I)&&vn(d.nodesRef.current,z,!1).some($=>we($.context?.elements.floating,I)))){if(l.handler){l.handler(P);return}y(),h()||v(P)}}function x(P){!d||!p||vn(d.nodesRef.current,p).length>0||S.start(0,()=>{d.events.off("floating.closed",x),n.setOpen(!1,Ae(Lt,P)),d.events.emit("floating.closed",P)})}const T=o;return gn(T&&Fe(T,"mouseenter",E),T&&Fe(T,"mouseleave",b),T&&Fe(T,"pointerdown",C,!0),()=>{d?.events.off("floating.closed",x)})},[a,o,n,i,u,h,g,v,y,C,l,d,p,S])}const Aw={current:null};function Dw(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:r,events:o}=n.context,{enabled:s=!0,delay:i=0,handleClose:a=null,mouseOnly:c=!1,restMs:u=0,move:l=!0,triggerElementRef:d=Aw,externalTree:p,isActiveTrigger:h=!0,getHandleCloseContext:m,isClosing:g}=t,v=lr(p),y=Fd(n),C=f.useRef(!1),S=vt(a),E=vt(i),b=vt(u),x=vt(s),T=vt(g);h&&(y.handleCloseOptions=S.current?.__options);const P=ie(()=>Ql(r.current.openEvent?.type,y.interactedInside)),z=ie(N=>fl(N,n.context.triggerElements)),I=ie((N,O,k)=>{const _=n.context.triggerElements;if(_.hasElement(O))return!N||!we(N,O);if(!$e(k))return!1;const M=k;return _.hasMatchingElement(A=>we(A,M))&&(!N||!we(N,M))}),D=ie((N,O=!0)=>{const k=ga(E.current,"close",y.pointerType);k?y.openChangeTimeout.start(k,()=>{n.setOpen(!1,Ae(Lt,N)),v?.events.emit("floating.closed",N)}):O&&(y.openChangeTimeout.clear(),n.setOpen(!1,Ae(Lt,N)),v?.events.emit("floating.closed",N))}),$=ie(()=>{if(!y.handler)return;Ie(n.select("domReferenceElement")).removeEventListener("mousemove",y.handler),y.handler=void 0}),V=ie(()=>{Es(y)});return f.useEffect(()=>$,[$]),f.useEffect(()=>{if(!s)return;function N(O){O.open?C.current=!1:(C.current=O.reason===Lt,$(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return o.on("openchange",N),()=>{o.off("openchange",N)}},[s,o,y,$]),f.useEffect(()=>{if(!s)return;const N=d.current??(h?n.select("domReferenceElement"):null);if(!$e(N))return;function O(_){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,c&&!fo(y.pointerType))return;const M=Jl(b.current),A=ga(E.current,"open",y.pointerType),j=lt(_),B=_.currentTarget??null,U=n.select("domReferenceElement");let W=B;if($e(j)&&!n.context.triggerElements.hasElement(j)){for(const Y of n.context.triggerElements.elements())if(we(Y,j)){W=Y;break}}$e(B)&&$e(U)&&!n.context.triggerElements.hasElement(B)&&we(B,U)&&(W=U);const G=W==null?!1:I(U,W,j),Z=n.select("open"),X=T.current?.()??n.select("transitionStatus")==="ending",K=!Z&&X&&C.current,J=!G&&$e(W)&&$e(U)&&we(U,W)&&K,se=M>0&&!A,ae=G&&(Z||K)||J,pe=!Z||G;if(ae){n.setOpen(!0,Ae(Lt,_,W));return}se||(A?y.openChangeTimeout.start(A,()=>{pe&&n.setOpen(!0,Ae(Lt,_,W))}):pe&&n.setOpen(!0,Ae(Lt,_,W)))}function k(_){if(P()){V();return}$();const M=n.select("domReferenceElement"),A=Ie(M);y.restTimeout.clear(),y.restTimeoutPending=!1;const j=r.current.floatingContext??m?.();if(z(_.relatedTarget))return;if(S.current&&j){n.select("open")||y.openChangeTimeout.clear();const W=d.current;y.handler=S.current({...j,tree:v,x:_.clientX,y:_.clientY,onClose(){V(),$(),x.current&&!P()&&W===n.select("domReferenceElement")&&D(_,!0)}}),A.addEventListener("mousemove",y.handler),y.handler(_);return}(y.pointerType!=="touch"||!we(n.select("floatingElement"),_.relatedTarget))&&D(_)}return l?gn(Fe(N,"mousemove",O,{once:!0}),Fe(N,"mouseenter",O),Fe(N,"mouseleave",k)):gn(Fe(N,"mouseenter",O),Fe(N,"mouseleave",k))},[$,V,r,E,D,n,s,S,y,h,I,P,z,c,l,b,d,v,x,m,T]),f.useMemo(()=>{if(!s)return;function N(O){y.pointerType=O.pointerType}return{onPointerDown:N,onPointerEnter:N,onMouseMove(O){const{nativeEvent:k}=O,_=O.currentTarget,M=n.select("domReferenceElement"),A=n.select("open"),j=I(M,_,O.target);if(c&&!fo(y.pointerType))return;if(A&&j&&y.handleCloseOptions?.blockPointerEvents){const W=n.select("floatingElement");if(W){const G=y.handleCloseOptions?.getScope?.()??_.ownerDocument.body;Ld(y,{scopeElement:G,referenceElement:_,floatingElement:W})}}const B=Jl(b.current);if(A&&!j||B===0||!j&&y.restTimeoutPending&&O.movementX**2+O.movementY**2<2)return;y.restTimeout.clear();function U(){if(y.restTimeoutPending=!1,P())return;const W=n.select("open");!y.blockMouseMove&&(!W||j)&&n.setOpen(!0,Ae(Lt,k,_))}y.pointerType==="touch"?Kt.flushSync(()=>{U()}):j&&A?U():(y.restTimeoutPending=!0,y.restTimeout.start(B,U))}}},[s,y,P,I,c,n,b])}function bo(e=[]){const t=e.map(u=>u?.reference),n=e.map(u=>u?.floating),r=e.map(u=>u?.item),o=e.map(u=>u?.trigger),s=f.useCallback(u=>xs(u,e,"reference"),t),i=f.useCallback(u=>xs(u,e,"floating"),n),a=f.useCallback(u=>xs(u,e,"item"),r),c=f.useCallback(u=>xs(u,e,"trigger"),o);return f.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:a,getTriggerProps:c}),[s,i,a,c])}function xs(e,t,n){const r=new Map,o=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[Yi]="");for(const i in e)o&&e&&(i===ul||i===ll)||(s[i]=e[i]);for(let i=0;i<t.length;i+=1){let a;const c=t[i]?.[n];typeof c=="function"?a=e?c(e):null:a=c,a&&Vd(s,a,o,r)}return Vd(s,e,o,r),s}function Vd(e,t,n,r){for(const o in t){const s=t[o];n&&(o===ul||o===ll)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),typeof s=="function"&&(r.get(o)?.push(s),e[o]=(...i)=>r.get(o)?.map(a=>a(...i)).find(a=>a!==void 0))):e[o]=s)}}const Lw="Escape";function Cs(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Ts(e,t){return Cs(t,e===Xi||e===uo,e===Wn||e===Zn)}function La(e,t,n){return Cs(t,e===uo,n?e===Wn:e===Zn)||e==="Enter"||e===" "||e===""}function Fw(e,t,n){return Cs(t,n?e===Wn:e===Zn,e===uo)}function Vw(e,t,n,r){const o=n?e===Zn:e===Wn,s=e===Xi;return t==="both"||t==="horizontal"&&r&&r>1?e===Lw:Cs(t,o,s)}function zw(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{listRef:a,activeIndex:c,onNavigate:u=()=>{},enabled:l=!0,selectedIndex:d=null,allowEscape:p=!1,loopFocus:h=!1,nested:m=!1,rtl:g=!1,virtual:v=!1,focusItemOnOpen:y="auto",focusItemOnHover:C=!0,openOnArrowKeyDown:S=!0,disabledIndices:E=void 0,orientation:b="vertical",parentOrientation:x,cols:T=1,id:P,resetOnPointerLeave:z=!0,externalTree:I}=t;process.env.NODE_ENV!=="production"&&(p&&(h||console.warn("`useListNavigation` looping must be enabled to allow escaping."),v||console.warn("`useListNavigation` must be virtual to allow escaping.")),b==="vertical"&&T>1&&console.warn("In grid list navigation mode (`cols` > 1), the `orientation` should",'be either "horizontal" or "both".'));const D=lo(o),$=vt(D),V=qn(),N=lr(I);he(()=>{i.current.orientation=b},[i,b]);const O=Ki(s),k=f.useRef(y),_=f.useRef(d??-1),M=f.useRef(null),A=f.useRef(!0),j=ie(R=>{u(_.current===-1?null:_.current,R)}),B=f.useRef(j),U=f.useRef(!!o),W=f.useRef(r),G=f.useRef(!1),Z=f.useRef(!1),X=f.useRef(null),K=vt(E),J=vt(r),se=vt(d),ae=vt(z),pe=ie(()=>{function R(Q){v?N?.events.emit("virtualfocus",Q):X.current=ps(Q,{sync:G.current,preventScroll:!0})}const H=a.current[_.current],L=Z.current;H&&R(H),(G.current?Q=>Q():requestAnimationFrame)(()=>{const Q=a.current[_.current]||H;if(!Q)return;H||R(Q),ge&&(L||!A.current)&&Q.scrollIntoView?.({block:"nearest",inline:"nearest"})})});he(()=>{l&&(r&&o?(_.current=d??-1,k.current&&d!=null&&(Z.current=!0,j())):U.current&&(_.current=-1,B.current()))},[l,r,o,d,j]),he(()=>{if(l){if(!r){G.current=!1;return}if(o)if(c==null){if(G.current=!1,se.current!=null)return;if(U.current&&(_.current=-1,pe()),(!W.current||!U.current)&&k.current&&(M.current!=null||k.current===!0&&M.current==null)){let R=0;const H=()=>{a.current[0]==null?(R<2&&(R?requestAnimationFrame:queueMicrotask)(H),R+=1):(_.current=M.current==null||La(M.current,b,g)||m?oa(a):wl(a),M.current=null,j())};H()}}else ns(a.current,c)||(_.current=c,pe(),Z.current=!1)}},[l,r,o,c,se,m,a,b,g,j,pe,K]),he(()=>{if(!l||o||!N||v||!U.current)return;const R=N.nodesRef.current,H=R.find(Q=>Q.id===V)?.context?.elements.floating,L=Pt(Ie(o)),F=R.some(Q=>Q.context&&we(Q.context.elements.floating,L));H&&!F&&A.current&&H.focus({preventScroll:!0})},[l,o,N,V,v]),he(()=>{B.current=j,W.current=r,U.current=!!o}),he(()=>{r||(M.current=null,k.current=y)},[r,y]);const Y=c!=null,me=ie(R=>{if(!J.current)return;const H=a.current.indexOf(R.currentTarget);H!==-1&&(_.current!==H||c!==H)&&(_.current=H,j(R))}),ge=f.useMemo(()=>({onFocus(H){G.current=!0,me(H)},onClick:({currentTarget:H})=>H.focus({preventScroll:!0}),onMouseMove(H){G.current=!0,Z.current=!1,C&&me(H)},onPointerLeave(H){if(!J.current||!A.current||H.pointerType==="touch")return;G.current=!0;const L=H.relatedTarget;if(!(!C||a.current.includes(L))&&ae.current&&(X.current?.(),X.current=null,_.current=-1,j(H),!v)){const F=$.current,Q=Pt(Ie(F));F&&we(F,Q)&&F.focus({preventScroll:!0})}}}),[me,J,$,C,a,j,ae,v]),fe=f.useCallback(()=>x??N?.nodesRef.current.find(R=>R.id===V)?.context?.dataRef?.current.orientation,[V,N,x]),le=ie(R=>{if(A.current=!1,G.current=!0,R.which===229||!J.current&&R.currentTarget===$.current)return;if(m&&Vw(R.key,b,g,T)){Ts(R.key,fe())||Yt(R),n.setOpen(!1,Ae(ba,R.nativeEvent)),it(s)&&(v?N?.events.emit("virtualfocus",s):s.focus());return}const H=_.current,L=oa(a,E),F=wl(a,E);if(O||(R.key==="Home"&&(Yt(R),_.current=L,j(R)),R.key==="End"&&(Yt(R),_.current=F,j(R))),T>1){const Q=Array.from({length:a.current.length},()=>({width:1,height:1})),ne=Cb(Q,T),te=ne.findIndex(Ee=>Ee!=null&&!Mr(a.current,Ee,E)),ye=ne.reduce((Ee,Ce,Pe)=>Ce!=null&&!Mr(a.current,Ce,E)?Pe:Ee,-1),_e=ne[xb(ne.map(Ee=>Ee!=null?a.current[Ee]:null),{event:R,orientation:b,loopFocus:h,rtl:g,cols:T,disabledIndices:Ob([...(typeof E!="function"?E:null)||a.current.map((Ee,Ce)=>Mr(a.current,Ce,E)?Ce:void 0),void 0],ne),minIndex:te,maxIndex:ye,prevIndex:Tb(_.current>F?L:_.current,Q,ne,T,R.key===uo?"bl":R.key===(g?Wn:Zn)?"tr":"tl"),stopEvent:!0})];if(_e!=null&&(_.current=_e,j(R)),b==="both")return}if(Ts(R.key,b)){if(Yt(R),r&&!v&&Pt(R.currentTarget.ownerDocument)===R.currentTarget){_.current=La(R.key,b,g)?L:F,j(R);return}La(R.key,b,g)?h?H>=F?p&&H!==a.current.length?_.current=-1:(G.current=!1,_.current=L):_.current=Dt(a.current,{startingIndex:H,disabledIndices:E}):_.current=Math.min(F,Dt(a.current,{startingIndex:H,disabledIndices:E})):h?H<=L?p&&H!==-1?_.current=a.current.length:(G.current=!1,_.current=F):_.current=Dt(a.current,{startingIndex:H,decrement:!0,disabledIndices:E}):_.current=Math.max(L,Dt(a.current,{startingIndex:H,decrement:!0,disabledIndices:E})),ns(a.current,_.current)&&(_.current=-1),j(R)}}),ce=f.useMemo(()=>v&&r&&Y&&{"aria-activedescendant":`${P}-${c}`},[v,r,Y,P,c]),ve=f.useMemo(()=>({"aria-orientation":b==="both"?void 0:b,...O?{}:ce,onKeyDown(R){if(R.key==="Tab"&&R.shiftKey&&r&&!v){const H=lt(R.nativeEvent);if(H&&!we($.current,H))return;Yt(R),n.setOpen(!1,Ae(ur,R.nativeEvent)),it(s)&&s.focus();return}le(R)},onPointerMove(){A.current=!0}}),[ce,le,$,b,O,n,r,v,s]),ue=f.useMemo(()=>{function R(L){y==="auto"&&hl(L.nativeEvent)&&(k.current=!v)}function H(L){k.current=y,y==="auto"&&ml(L.nativeEvent)&&(k.current=!0)}return{onKeyDown(L){const F=n.select("open");A.current=!1;const Q=L.key.startsWith("Arrow"),ne=Fw(L.key,fe(),g),te=Ts(L.key,b),ye=(m?ne:te)||L.key==="Enter"||L.key.trim()==="";if(v&&F)return le(L);if(!(!F&&!S&&Q)){if(ye){const _e=Ts(L.key,fe());M.current=m&&_e?null:L.key}if(m){ne&&(Yt(L),F?(_.current=oa(a,K.current),j(L)):n.setOpen(!0,Ae(ba,L.nativeEvent,L.currentTarget)));return}te&&(se.current!=null&&(_.current=se.current),Yt(L),!F&&S?n.setOpen(!0,Ae(ba,L.nativeEvent,L.currentTarget)):le(L),F&&j(L))}},onFocus(L){n.select("open")&&!v&&(_.current=-1,j(L))},onPointerDown:H,onPointerEnter:H,onMouseDown:R,onClick:R}},[le,K,y,a,m,j,n,S,b,fe,g,se,v]),Se=f.useMemo(()=>({...ce,...ue}),[ce,ue]);return f.useMemo(()=>l?{reference:Se,floating:ve,item:ge,trigger:ue}:{},[l,Se,ve,ue,ge])}const $w=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function zd(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingId"),s=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{role:a="dialog"}=t,c=Xn(),u=s?.id||c,l=f.useMemo(()=>lo(i)?.id||o,[i,o]),d=$w.get(a)??a,h=qn()!=null,m=f.useMemo(()=>d==="tooltip"||a==="label"?mt:{"aria-haspopup":d==="alertdialog"?"dialog":d,"aria-expanded":"false",...d==="listbox"&&{role:"combobox"},...d==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[d,h,a]),g=f.useMemo(()=>d==="tooltip"||a==="label"?{[`aria-${a==="label"?"labelledby":"describedby"}`]:r?l:void 0}:{...m,"aria-expanded":r?"true":"false","aria-controls":r?l:void 0,...d==="menu"&&{id:u}},[d,l,r,u,a,m]),v=f.useMemo(()=>{const C={id:l,...d&&{role:d}};return d==="tooltip"||a==="label"?C:{...C,...d==="menu"&&{"aria-labelledby":u}}},[d,l,u,a]),y=f.useCallback(({active:C,selected:S})=>{const E={role:"option",...C&&{id:`${l}-fui-option`}};switch(a){case"select":case"combobox":return{...E,"aria-selected":S}}return{}},[l,a]);return f.useMemo(()=>({reference:g,floating:v,item:y,trigger:m}),[g,v,m,y])}function jw(e,t){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,o=n.useState("open"),{listRef:s,elementsRef:i,activeIndex:a,onMatch:c,onTypingChange:u,enabled:l=!0,resetMs:d=750,selectedIndex:p=null}=t,h=Gt(),m=f.useRef(""),g=f.useRef(p??a??-1),v=f.useRef(null);he(()=>{!o&&p!==null||(h.clear(),v.current=null,m.current!==""&&(m.current=""))},[o,p,h]),he(()=>{o&&m.current===""&&(g.current=p??a??-1)},[o,p,a]);const y=ie(x=>{x?r.current.typing||(r.current.typing=x,u?.(x)):r.current.typing&&(r.current.typing=x,u?.(x))}),C=ie(x=>{function T(O){const k=i?.current[O];return!k||rs(k)}function P(O,k,_=0){if(O.length===0)return-1;const M=(_%O.length+O.length)%O.length,A=k.toLocaleLowerCase();for(let j=0;j<O.length;j+=1){const B=(M+j)%O.length;if(!(!O[B]?.toLocaleLowerCase().startsWith(A)||!T(B)))return B}return-1}const z=s.current;if(m.current.length>0&&x.key===" "&&(Yt(x),y(!0)),m.current.length>0&&m.current[0]!==" "&&P(z,m.current)===-1&&x.key!==" "&&y(!1),z==null||x.key.length!==1||x.ctrlKey||x.metaKey||x.altKey)return;o&&x.key!==" "&&(Yt(x),y(!0));const I=m.current==="";I&&(g.current=p??a??-1),z.every(O=>O?O[0]?.toLocaleLowerCase()!==O[1]?.toLocaleLowerCase():!0)&&m.current===x.key&&(m.current="",g.current=v.current),m.current+=x.key,h.start(d,()=>{m.current="",g.current=v.current,y(!1)});const V=((I?p??a??-1:g.current)??0)+1,N=P(z,m.current,V);N!==-1?(c?.(N),v.current=N):x.key!==" "&&(m.current="",y(!1))}),S=ie(x=>{const T=x.relatedTarget,P=n.select("domReferenceElement"),z=n.select("floatingElement"),I=we(P,T),D=we(z,T);I||D||(h.clear(),m.current="",g.current=v.current,y(!1))}),E=f.useMemo(()=>({onKeyDown:C,onBlur:S}),[C,S]),b=f.useMemo(()=>({onKeyDown:C,onBlur:S}),[C,S]);return f.useMemo(()=>l?{reference:E,floating:b}:{},[l,E,b])}const $d=.1,Hw=$d*$d,rt=.5;function Os(e,t,n,r,o,s){return r>=t!=s>=t&&e<=(o-n)*(t-r)/(s-r)+n}function Ps(e,t,n,r,o,s,i,a,c,u){let l=!1;return Os(e,t,n,r,o,s)&&(l=!l),Os(e,t,o,s,i,a)&&(l=!l),Os(e,t,i,a,c,u)&&(l=!l),Os(e,t,c,u,n,r)&&(l=!l),l}function Uw(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function _s(e,t,n,r,o,s){const i=Math.min(n,o),a=Math.max(n,o),c=Math.min(r,s),u=Math.max(r,s);return e>=i&&e<=a&&t>=c&&t<=u}function Bw(e={}){const{blockPointerEvents:t=!1}=e,n=new Zt,r=({x:o,y:s,placement:i,elements:a,onClose:c,nodeId:u,tree:l})=>{const d=i?.split("-")[0];let p=!1,h=null,m=null,g=typeof performance<"u"?performance.now():0;function v(C,S){const E=performance.now(),b=E-g;if(h===null||m===null||b===0)return h=C,m=S,g=E,!1;const x=C-h,T=S-m,P=x*x+T*T,z=b*b*Hw;return h=C,m=S,g=E,P<z}function y(){n.clear(),c()}return function(S){n.clear();const E=a.domReference,b=a.floating;if(!E||!b||d==null||o==null||s==null)return;const{clientX:x,clientY:T}=S,P=lt(S),z=S.type==="mouseleave",I=we(b,P),D=we(E,P);if(I&&(p=!0,!z))return;if(D&&(p=!1,!z)){p=!0;return}if(z&&$e(S.relatedTarget)&&we(b,S.relatedTarget))return;function $(){return!!(l&&vn(l.nodesRef.current,u).length>0)}function V(){$()||y()}if($())return;const N=E.getBoundingClientRect(),O=b.getBoundingClientRect(),k=o>O.right-O.width/2,_=s>O.bottom-O.height/2,M=O.width>N.width,A=O.height>N.height,j=(M?N:O).left,B=(M?N:O).right,U=(A?N:O).top,W=(A?N:O).bottom;if(d==="top"&&s>=N.bottom-1||d==="bottom"&&s<=N.top+1||d==="left"&&o>=N.right-1||d==="right"&&o<=N.left+1){V();return}let G=!1;switch(d){case"top":G=_s(x,T,j,N.top+1,B,O.bottom-1);break;case"bottom":G=_s(x,T,j,O.top+1,B,N.bottom-1);break;case"left":G=_s(x,T,O.right-1,W,N.left+1,U);break;case"right":G=_s(x,T,N.right-1,W,O.left+1,U);break}if(G)return;if(p&&!Uw(x,T,N)){V();return}if(!z&&v(x,T)){V();return}let Z=!1;switch(d){case"top":{const X=M?rt/2:rt*4,K=M||k?o+X:o-X,J=M?o-X:k?o+X:o-X,se=s+rt+1,ae=k||M?O.bottom-rt:O.top,pe=k?M?O.bottom-rt:O.top:O.bottom-rt;Z=Ps(x,T,K,se,J,se,O.left,ae,O.right,pe);break}case"bottom":{const X=M?rt/2:rt*4,K=M||k?o+X:o-X,J=M?o-X:k?o+X:o-X,se=s-rt,ae=k||M?O.top+rt:O.bottom,pe=k?M?O.top+rt:O.bottom:O.top+rt;Z=Ps(x,T,K,se,J,se,O.left,ae,O.right,pe);break}case"left":{const X=A?rt/2:rt*4,K=A||_?s+X:s-X,J=A?s-X:_?s+X:s-X,se=o+rt+1,ae=_||A?O.right-rt:O.left,pe=_?A?O.right-rt:O.left:O.right-rt;Z=Ps(x,T,ae,O.top,pe,O.bottom,se,K,se,J);break}case"right":{const X=A?rt/2:rt*4,K=A||_?s+X:s-X,J=A?s-X:_?s+X:s-X,se=o-rt,ae=_||A?O.left+rt:O.right,pe=_?A?O.left+rt:O.right:O.left+rt;Z=Ps(x,T,se,K,se,J,ae,O.top,pe,O.bottom);break}}Z?p||n.start(40,V):V()}};return r.__options={...e,blockPointerEvents:t},r}const jd=f.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,style:a,...c}=t,{portalNode:u,portalSubtree:l}=cd({container:o,ref:n,componentProps:t,elementProps:c});return!l&&!u?null:w.jsxs(f.Fragment,{children:[l,u&&Kt.createPortal(r,u)]})});process.env.NODE_ENV!=="production"&&(jd.displayName="FloatingPortalLite");const Ww=jd,Hd=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Hd.displayName="DirectionContext");function Ud(){return f.useContext(Hd)?.direction??"ltr"}const Zw=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:l=0,offsetParent:d="real"}=Mn(e,t)||{};if(u==null)return{};const p=bl(l),h={x:n,y:r},m=na(o),g=ta(m),v=await i.getDimensions(u),y=m==="y",C=y?"top":"left",S=y?"bottom":"right",E=y?"clientHeight":"clientWidth",b=s.reference[g]+s.reference[m]-h[m]-s.floating[g],x=h[m]-s.reference[m],T=d==="real"?await i.getOffsetParent?.(u):a.floating;let P=a.floating[E]||s.floating[g];(!P||!await i.isElement?.(T))&&(P=a.floating[E]||s.floating[g]);const z=b/2-x/2,I=P/2-v[g]/2-1,D=Math.min(p[C],I),$=Math.min(p[S],I),V=D,N=P-v[g]-$,O=P/2-v[g]/2+z,k=Qi(V,O,N),_=!c.arrow&&Gn(o)!=null&&O!==k&&s.reference[g]/2-(O<V?D:$)-v[g]/2<0,M=_?O<V?O-V:O-N:0;return{[m]:h[m]+M,data:{[m]:k,centerOffset:O-k-M,..._&&{alignmentOffset:M}},reset:_}}}),Gw=(e,t)=>({...Zw(e),options:[e,t]}),Yw={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await _w().fn(e)).data?.referenceHidden||s}}}},Is={sideX:"left",sideY:"top"},Xw={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:a}=e,c=tt(o),u=c.getComputedStyle(o);if(!(u.transitionDuration!=="0s"&&u.transitionDuration!==""))return{x:t,y:n,data:Is};const d=await s.getOffsetParent?.(o);let p={width:0,height:0};if(i==="fixed"&&c?.visualViewport)p={width:c.visualViewport.width,height:c.visualViewport.height};else if(d===c){const C=Ie(o);p={width:C.documentElement.clientWidth,height:C.documentElement.clientHeight}}else await s.isElement?.(d)&&(p=await s.getDimensions(d));const h=jt(a);let m=t,g=n;h==="left"&&(m=p.width-(t+r.width)),h==="top"&&(g=p.height-(n+r.height));const v=h==="left"?"right":Is.sideX,y=h==="top"?"bottom":Is.sideY;return{x:m,y:g,data:{sideX:v,sideY:y}}}};function Bd(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function Wd(e,t,n){const{rects:r,placement:o}=e;return{side:Bd(t,jt(o),n),align:Gn(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Zd(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:a,collisionPadding:c=5,sticky:u=!1,arrowPadding:l=5,disableAnchorTracking:d=!1,keepMounted:p=!1,floatingRootContext:h,mounted:m,collisionAvoidance:g,shiftCrossAxis:v=!1,nodeId:y,adaptiveOrigin:C,lazyFlip:S=!1,externalTree:E}=e,[b,x]=f.useState(null);!m&&b!==null&&x(null);const T=g.side||"flip",P=g.align||"flip",z=g.fallbackAxisSide||"end",I=typeof t=="function"?t:void 0,D=ie(I),$=I?D:t,V=vt(t),N=vt(m),k=Ud()==="rtl",_=b||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":k?"left":"right","inline-start":k?"right":"left"}[r],M=s==="center"?_:`${_}-${s}`;let A=c;const j=1,B=r==="bottom"?j:0,U=r==="top"?j:0,W=r==="right"?j:0,G=r==="left"?j:0;typeof A=="number"?A={top:A+B,right:A+G,bottom:A+U,left:A+W}:A&&(A={top:(A.top||0)+B,right:(A.right||0)+G,bottom:(A.bottom||0)+U,left:(A.left||0)+W});const Z={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:A},X=f.useRef(null),K=vt(o),J=vt(i),pe=[xw(Re=>{const Te=Wd(Re,r,k),Ue=typeof K.current=="function"?K.current(Te):K.current,Be=typeof J.current=="function"?J.current(Te):J.current;return{mainAxis:Ue,crossAxis:Be,alignmentAxis:Be}},[typeof o!="function"?o:0,typeof i!="function"?i:0,k,r])],Y=P==="none"&&T!=="shift",me=!Y&&(u||v||T==="shift"),ge=T==="none"?null:Ow({...Z,padding:{top:A.top+j,right:A.right+j,bottom:A.bottom+j,left:A.left+j},mainAxis:!v&&T==="flip",crossAxis:P==="flip"?"alignment":!1,fallbackAxisSideDirection:z}),fe=Y?null:Cw(Re=>{const Te=Ie(Re.elements.floating).documentElement;return{...Z,rootBoundary:v?{x:0,y:0,width:Te.clientWidth,height:Te.clientHeight}:void 0,mainAxis:P!=="none",crossAxis:me,limiter:u||v?void 0:Tw(Ue=>{if(!X.current)return{};const{width:Be,height:ct}=X.current.getBoundingClientRect(),Ye=en(jt(Ue.placement)),Ut=Ye==="y"?Be:ct,$t=Ye==="y"?A.left+A.right:A.top+A.bottom;return{offset:Ut/2+$t/2}})}},[Z,u,v,A,P]);T==="shift"||P==="shift"||s==="center"?pe.push(fe,ge):pe.push(ge,fe),pe.push(Pw({...Z,apply({elements:{floating:Re},availableWidth:Te,availableHeight:Ue,rects:Be}){if(!N.current)return;const ct=Re.style;ct.setProperty("--available-width",`${Te}px`),ct.setProperty("--available-height",`${Ue}px`);const Ye=tt(Re).devicePixelRatio||1,{x:Ut,y:$t,width:Ke,height:q}=Be.reference,re=(Math.round((Ut+Ke)*Ye)-Math.round(Ut*Ye))/Ye,be=(Math.round(($t+q)*Ye)-Math.round($t*Ye))/Ye;ct.setProperty("--anchor-width",`${re}px`),ct.setProperty("--anchor-height",`${be}px`)}}),Gw(()=>({element:X.current||Ie(X.current).createElement("div"),padding:l,offsetParent:"floating"}),[l]),{name:"transformOrigin",fn(Re){const{elements:Te,middlewareData:Ue,placement:Be,rects:ct,y:Ye}=Re,Ut=jt(Be),$t=en(Ut),Ke=X.current,q=Ue.arrow?.x||0,re=Ue.arrow?.y||0,be=Ke?.clientWidth||0,Le=Ke?.clientHeight||0,je=q+be/2,De=re+Le/2,Qe=Math.abs(Ue.shift?.y||0),Oe=ct.reference.height/2,xe=typeof o=="function"?o(Wd(Re,r,k)):o,Ne=Qe>xe,Me={top:`${je}px calc(100% + ${xe}px)`,bottom:`${je}px ${-xe}px`,left:`calc(100% + ${xe}px) ${De}px`,right:`${-xe}px ${De}px`}[Ut],Xe=`${je}px ${ct.reference.y+Oe-Ye}px`;return Te.floating.style.setProperty("--transform-origin",me&&$t==="y"&&Ne?Xe:Me),{}}},Yw,C),he(()=>{!m&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[m,h]);const le=f.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<"u",layoutShift:!d&&typeof IntersectionObserver<"u"}),[d]),{refs:ce,elements:ve,x:ue,y:Se,middlewareData:R,update:H,placement:L,context:F,isPositioned:Q,floatingStyles:ne}=Nw({rootContext:h,open:p?m:void 0,placement:M,middleware:pe,strategy:n,whileElementsMounted:p?void 0:(...Re)=>Od(...Re,le),nodeId:y,externalTree:E}),{sideX:te,sideY:ye}=R.adaptiveOrigin||Is,_e=Q?n:"fixed",Ee=f.useMemo(()=>{const Re=C?{position:_e,[te]:ue,[ye]:Se}:{position:_e,...ne};return Q||(Re.opacity=0),Re},[C,_e,te,ue,ye,Se,ne,Q]),Ce=f.useRef(null);he(()=>{if(!m)return;const Re=V.current,Te=typeof Re=="function"?Re():Re,Be=(Gd(Te)?Te.current:Te)||null||null;Be!==Ce.current&&(ce.setPositionReference(Be),Ce.current=Be)},[m,ce,$,V]),f.useEffect(()=>{if(!m)return;const Re=V.current;typeof Re!="function"&&Gd(Re)&&Re.current!==Ce.current&&(ce.setPositionReference(Re.current),Ce.current=Re.current)},[m,ce,$,V]),f.useEffect(()=>{if(p&&m&&ve.domReference&&ve.floating)return Od(ve.domReference,ve.floating,H,le)},[p,m,ve,H,le]);const Pe=jt(L),Ve=Bd(r,Pe,k),Ge=Gn(L)||"center",He=!!R.hide?.referenceHidden;he(()=>{S&&m&&Q&&x(Pe)},[S,m,Q,Pe]);const nt=f.useMemo(()=>({position:"absolute",top:R.arrow?.y,left:R.arrow?.x}),[R.arrow]),st=R.arrow?.centerOffset!==0;return f.useMemo(()=>({positionerStyles:Ee,arrowStyles:nt,arrowRef:X,arrowUncentered:st,side:Ve,align:Ge,physicalSide:Pe,anchorHidden:He,refs:ce,context:F,isPositioned:Q,update:H}),[Ee,nt,X,st,Ve,Ge,Pe,He,ce,F,Q,H])}function Gd(e){return e!=null&&"current"in e}let Ft=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=sr.startingStyle]="startingStyle",e[e.endingStyle=sr.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),Fa=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const qw={[Fa.popupOpen]:""},Kw={[Fa.popupOpen]:"",[Fa.pressed]:""},Jw={[Ft.open]:""},Qw={[Ft.closed]:""},eS={[Ft.anchorHidden]:""},Yd={open(e){return e?qw:null}},Xd={open(e){return e?Kw:null}},Cn={open(e){return e?Jw:Qw},anchorHidden(e){return e?eS:null}};function Va(e){return e==="starting"?a0:mt}function qd(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:a=!1}){const c={...n};return a&&(c.pointerEvents="none"),qe("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:c},Va(r),o],stateAttributesMapping:Cn})}function Kd(){const e=f.useContext(zo);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: useToastManager must be used within <Toast.Provider>.":ft(73));const t=e.useState("toasts");return f.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function fr(...e){return Mi(Mu(e))}const Jd={Viewport:"_Viewport_ai81v_1",Toast:"_Toast_ai81v_14"};let zr=null,wo=3e3;function tS({timeout:e}){const t=Kd();return f.useEffect(()=>(zr=t,wo=e,()=>{zr=null}),[t,e]),null}const gt={success:(e,t)=>zr?.add({description:e,timeout:t?.timeout||wo}),error:(e,t)=>zr?.add({description:e,timeout:t?.timeout||wo}),info:(e,t)=>zr?.add({description:e,timeout:t?.timeout||wo}),warning:(e,t)=>zr?.add({description:e,timeout:t?.timeout||wo})};function nS({toastConfigs:e}){const t=e?.timeout??3e3;return w.jsxs(Nl,{timeout:t,children:[w.jsx(tS,{timeout:t}),w.jsx(rS,{configs:e})]})}function rS({configs:e}){const{toasts:t}=Kd();return w.jsx(Ww,{children:w.jsx(Ul,{className:fr(Jd.Viewport,e?.viewportClassName),children:t.map(n=>w.jsx(Gl,{toast:n,className:fr("pointer-events-none flex items-center justify-center px-6 py-3 min-w-[200px] max-w-[80vw]","text-white text-base rounded-md bg-black/80",Jd.Toast,e?.className),style:e?.style,children:w.jsx(ql,{className:"text-xs",children:n.description})},n.id))})})}class oS{baseUrl;credentials;interceptors;timeout;onError;headers;constructor({baseUrl:t,timeout:n=1/0,responseInterceptor:r=c=>c.data,requestInterceptor:o=c=>c,onError:s=()=>{},headers:i,credentials:a="include"}){this.baseUrl=t,this.timeout=n,this.credentials=a,this.interceptors={request:o,response:r},this.headers=new Headers({"Content-Type":"application/json",...i}),this.onError=s}async request(t){const n=new AbortController;t.url=`${this.baseUrl}${t.url}`,t=this.interceptors.request(t);const r=new Headers(this.headers);Object.entries(t.headers||{}).forEach(([a,c])=>{r.set(a,c)});const o=this.headers.get("content-type");let s=null;if(t.data instanceof FormData)s=t.data,r.delete("Content-Type");else if(t.data!==void 0&&t.method!=="GET")if(o==="application/x-www-form-urlencoded"){const a=new URLSearchParams;for(const c in t.data)t.data[c]!==void 0&&a.append(c,t.data[c]);s=a.toString()}else s=JSON.stringify(t.data);else if(t.method==="GET"){const a=new URLSearchParams;for(const u in t.data)t.data[u]!==void 0&&a.append(u,t.data[u]);const c=a.toString();t.url+=c?`?${c}`:""}const i=fetch(t.url,{method:t.method,headers:r,body:s,signal:t.signal||n.signal,credentials:this.credentials});try{const a=t.timeout||this.timeout,{timeoutId:c,timeoutPromise:u}=this._setTimeout(a,n),l=await Promise.race([i,u].filter(Boolean));if(c&&clearTimeout(c),l.ok){const d=await l.json();return this.interceptors.response(d,l).catch(p=>(this.onError({data:p,response:l}),Promise.reject(d)))}else{const d=await l.json();return this.onError({data:d,response:l}),Promise.reject(d)}}catch(a){return a.name!=="AbortError"&&this.onError({}),Promise.reject(a)}}_setTimeout(t,n){let r=null,o=null;return t!==1/0&&(o=new Promise((s,i)=>{r=setTimeout(()=>{i(new Error("请求超时")),n.abort()},t)})),{timeoutPromise:o,timeoutId:r}}get(t,n,r){return this.request({...r,url:t,method:"GET",data:n})}post(t,n,r){return this.request({...r,url:t,method:"POST",data:n})}put(t,n,r){return this.request({...r,url:t,method:"PUT",data:n})}delete(t,n){return this.request({...n,url:t,method:"DELETE"})}patch(t,n,r){return this.request({...r,url:t,method:"PATCH",data:n})}}const _t=new oS({baseUrl:"https://apis.sdk.mobileztgame.com",credentials:"omit",headers:{"Content-Type":"application/x-www-form-urlencoded"},async responseInterceptor(e,t){if(["/passport-api/v2/ztgame/auth/login","/passport-api/v2/sms-captchas","/passport-api/v2/ztgame/auth/mobile-register","/passport-api/v2/ztgame/auth/auth","/passport-api/v2/ztgame/auth/re-auth","/passport-api/v2/ztgame/user-center/forget-password/forget-password-keys","/passport-api/v2/ztgame/user-center/forget-password/","/passport-api/v2/ztgame/user-center/forget-password/sms-captchas","/passport-api/v2/ztgame/user-center/forget-password/forget-password-update","/idcard"].some(r=>t.url.includes(r))){const r=t.headers.get("set-authentication")||t.headers.get("Set-Authentication")||"";return{...e,_auth:r}}if(e?.code!==0)throw new Error(e.error);return e},onError({response:e,data:t}){if(e&&e?.status!==401){const n=`${t?.message||t?.detail||"未知错误"}`;gt.error(n)}}});function Qd(e){_t.headers.set("Authentication",e)}const at={ROLE_ID:"roleid",GIANT:"giant",MOBILE:"mobile"},ks={default:{types:[at.GIANT,at.MOBILE],default:at.GIANT},5327:{types:[at.GIANT,at.MOBILE],default:at.MOBILE},5273:{types:[at.ROLE_ID],default:at.ROLE_ID},5199:{types:[at.ROLE_ID],default:at.ROLE_ID},5012:{types:[at.ROLE_ID],default:at.ROLE_ID},5242:{types:[at.GIANT,at.MOBILE],default:at.MOBILE}};function St(...e){return Mi(Mu(e))}function sS(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(t,n)=>String.fromCharCode(Number.parseInt(n,16))))}function iS(e){return e==="5199"||e==="5012"}function aS(e){const{entity:t,gaplaySign:n}=e;return sS(`${JSON.stringify(t)}$$${n}`)}function Rs(e,t){return t||ks[e]?.types||ks.default?.types||[]}function cS(e,t){return t||ks[e]?.default||ks.default?.default}function ef({loginTypes:e,gameId:t}){return Rs(t,e).includes(at.GIANT)}function tf({loginTypes:e,gameId:t}){return Rs(t,e).includes(at.ROLE_ID)}function nf({loginTypes:e,gameId:t}){return Rs(t,e).includes(at.MOBILE)}function rf({gameId:e}){_t.headers.set("X-GAME-ID",e),_t.headers.set("X-Login-H5","1");const t=localStorage.getItem("UNIQUE_ID");t&&_t.headers.set("X-Client-Info",JSON.stringify({sdk_version:"3.0.0",device_udid:t,appunid:t}))}async function uS({gameId:e}){rf({gameId:e});let t=localStorage.getItem("UNIQUE_ID");t||(t=(await(await $y.load()).get()).visitorId,localStorage.setItem("UNIQUE_ID",t)),_t.headers.set("X-Client-Info",JSON.stringify({sdk_version:"3.0.0",device_udid:t,appunid:t}))}const lS=[{code:"86",name:"中国大陆"},{code:"886",name:"台湾地区"},{code:"852",name:"香港特别行政区"},{code:"853",name:"澳门特别行政区"},{code:"1",name:"美国"},{code:"81",name:"日本"},{code:"376",name:"安道尔"},{code:"971",name:"阿拉伯联合酋长国"},{code:"93",name:"阿富汗"},{code:"1268",name:"安提瓜和巴布达"},{code:"1264",name:"安圭拉"},{code:"355",name:"阿尔巴尼亚"},{code:"374",name:"亚美尼亚"},{code:"244",name:"安哥拉"},{code:"54",name:"阿根廷"},{code:"1684",name:"美属萨摩亚"},{code:"43",name:"奥地利"},{code:"61",name:"澳大利亚"},{code:"297",name:"阿鲁巴"},{code:"994",name:"阿塞拜疆"},{code:"387",name:"波斯尼亚和黑塞哥维那"},{code:"1246",name:"巴巴多斯"},{code:"880",name:"孟加拉国"},{code:"32",name:"比利时"},{code:"226",name:"布基纳法索"},{code:"359",name:"保加利亚"},{code:"973",name:"巴林"},{code:"257",name:"布隆迪"},{code:"229",name:"贝宁"},{code:"1441",name:"百慕大群岛"},{code:"673",name:"文莱"},{code:"591",name:"玻利维亚"},{code:"599",name:"荷兰加勒比"},{code:"55",name:"巴西"},{code:"1242",name:"巴哈马"},{code:"975",name:"不丹"},{code:"267",name:"博茨瓦纳"},{code:"375",name:"白俄罗斯"},{code:"501",name:"伯利兹"},{code:"1",name:"加拿大"},{code:"243",name:"刚果民主共和国"},{code:"236",name:"中非共和国"},{code:"242",name:"刚果共和国"},{code:"41",name:"瑞士"},{code:"225",name:"象牙海岸"},{code:"682",name:"库克群岛"},{code:"56",name:"智利"},{code:"237",name:"喀麦隆"},{code:"57",name:"哥伦比亚"},{code:"506",name:"哥斯达黎加"},{code:"53",name:"古巴"},{code:"238",name:"佛得角共和国"},{code:"599",name:"库拉索"},{code:"357",name:"塞浦路斯"},{code:"420",name:"捷克"},{code:"49",name:"德国"},{code:"253",name:"吉布提"},{code:"45",name:"丹麦"},{code:"1767",name:"多米尼加"},{code:"1809",name:"多米尼加共和国"},{code:"213",name:"阿尔及利亚"},{code:"593",name:"厄瓜多尔"},{code:"372",name:"爱沙尼亚"},{code:"20",name:"埃及"},{code:"291",name:"厄立特里亚"},{code:"34",name:"西班牙"},{code:"251",name:"埃塞俄比亚"},{code:"358",name:"芬兰"},{code:"679",name:"斐济"},{code:"691",name:"密克罗尼西亚"},{code:"298",name:"法罗群岛"},{code:"33",name:"法国"},{code:"241",name:"加蓬"},{code:"44",name:"英国"},{code:"1473",name:"格林纳达"},{code:"995",name:"格鲁吉亚"},{code:"594",name:"法属圭亚那"},{code:"233",name:"加纳"},{code:"350",name:"直布罗陀"},{code:"299",name:"格陵兰岛"},{code:"220",name:"冈比亚"},{code:"224",name:"几内亚"},{code:"590",name:"瓜德罗普岛"},{code:"240",name:"赤道几内亚"},{code:"30",name:"希腊"},{code:"502",name:"瓜地马拉"},{code:"1671",name:"关岛"},{code:"245",name:"几内亚比绍共和国"},{code:"592",name:"圭亚那"},{code:"504",name:"洪都拉斯"},{code:"385",name:"克罗地亚"},{code:"509",name:"海地"},{code:"36",name:"匈牙利"},{code:"62",name:"印度尼西亚"},{code:"353",name:"爱尔兰"},{code:"972",name:"以色列"},{code:"91",name:"印度"},{code:"964",name:"伊拉克"},{code:"98",name:"伊朗"},{code:"354",name:"冰岛"},{code:"39",name:"意大利"},{code:"1876",name:"牙买加"},{code:"962",name:"约旦"},{code:"254",name:"肯尼亚"},{code:"996",name:"吉尔吉斯斯坦"},{code:"855",name:"柬埔寨"},{code:"686",name:"基里巴斯"},{code:"269",name:"科摩罗"},{code:"1869",name:"圣基茨和尼维斯"},{code:"850",name:"朝鲜"},{code:"82",name:"韩国"},{code:"965",name:"科威特"},{code:"1345",name:"开曼群岛"},{code:"7",name:"哈萨克斯坦"},{code:"856",name:"老挝"},{code:"961",name:"黎巴嫩"},{code:"1758",name:"圣露西亚"},{code:"423",name:"列支敦士登"},{code:"94",name:"斯里兰卡"},{code:"231",name:"利比里亚"},{code:"266",name:"莱索托"},{code:"370",name:"立陶宛"},{code:"352",name:"卢森堡"},{code:"371",name:"拉脱维亚"},{code:"218",name:"利比亚"},{code:"212",name:"摩洛哥"},{code:"377",name:"摩纳哥"},{code:"373",name:"摩尔多瓦"},{code:"382",name:"黑山"},{code:"261",name:"马达加斯加"},{code:"692",name:"马绍尔群岛"},{code:"389",name:"北马其顿"},{code:"223",name:"马里"},{code:"95",name:"缅甸"},{code:"976",name:"蒙古"},{code:"222",name:"毛里塔尼亚"},{code:"1664",name:"蒙特塞拉特岛"},{code:"356",name:"马耳他"},{code:"230",name:"毛里求斯"},{code:"960",name:"马尔代夫"},{code:"265",name:"马拉维"},{code:"52",name:"墨西哥"},{code:"60",name:"马来西亚"},{code:"258",name:"莫桑比克"},{code:"264",name:"纳米比亚"},{code:"687",name:"新喀里多尼亚"},{code:"227",name:"尼日尔"},{code:"234",name:"尼日利亚"},{code:"505",name:"尼加拉瓜"},{code:"31",name:"荷兰"},{code:"47",name:"挪威"},{code:"977",name:"尼泊尔"},{code:"674",name:"拿鲁岛"},{code:"64",name:"新西兰"},{code:"968",name:"阿曼"},{code:"507",name:"巴拿马"},{code:"51",name:"秘鲁"},{code:"689",name:"法属波利尼西亚"},{code:"675",name:"巴布亚新几内亚"},{code:"63",name:"菲律宾"},{code:"92",name:"巴基斯坦"},{code:"48",name:"波兰"},{code:"508",name:"圣彼埃尔和密克隆岛"},{code:"1787",name:"波多黎各"},{code:"351",name:"葡萄牙"},{code:"680",name:"帕劳"},{code:"595",name:"巴拉圭"},{code:"974",name:"卡塔尔"},{code:"262",name:"留尼汪"},{code:"40",name:"罗马尼亚"},{code:"381",name:"塞尔维亚"},{code:"7",name:"俄罗斯"},{code:"250",name:"卢旺达"},{code:"966",name:"沙特阿拉伯"},{code:"677",name:"所罗门群岛"},{code:"248",name:"塞舌尔"},{code:"249",name:"苏丹"},{code:"46",name:"瑞典"},{code:"65",name:"新加坡"},{code:"386",name:"斯洛文尼亚"},{code:"421",name:"斯洛伐克"},{code:"232",name:"塞拉利昂"},{code:"378",name:"圣马力诺"},{code:"221",name:"塞内加尔"},{code:"252",name:"索马里"},{code:"597",name:"苏里南"},{code:"239",name:"圣多美和普林西比"},{code:"503",name:"萨尔瓦多"},{code:"963",name:"叙利亚"},{code:"268",name:"埃斯瓦蒂尼"},{code:"1649",name:"特克斯和凯科斯群岛"},{code:"235",name:"乍得"},{code:"228",name:"多哥"},{code:"66",name:"泰国"},{code:"992",name:"塔吉克斯坦"},{code:"670",name:"东帝汶"},{code:"993",name:"土库曼斯坦"},{code:"216",name:"突尼斯"},{code:"676",name:"汤加"},{code:"90",name:"土耳其"},{code:"1868",name:"特立尼达和多巴哥"},{code:"255",name:"坦桑尼亚"},{code:"380",name:"乌克兰"},{code:"256",name:"乌干达"},{code:"598",name:"乌拉圭"},{code:"998",name:"乌兹别克斯坦"},{code:"1784",name:"圣文森特和格林纳丁斯"},{code:"58",name:"委内瑞拉"},{code:"1284",name:"英属处女群岛"},{code:"84",name:"越南"},{code:"678",name:"瓦努阿图"},{code:"685",name:"萨摩亚"},{code:"967",name:"也门"},{code:"269",name:"马约特"},{code:"27",name:"南非"},{code:"260",name:"赞比亚"},{code:"263",name:"津巴布韦"}].map(e=>({label:e.name,value:e.code,id:`${e.code}-${e.name}`}));function dS(e){return lS}function fS(e){return"account"in e}function pS({gameId:e,serverUserInfo:t,extraState:n}){const r={game_id:e,xToken:aS(t),saveTime:t.entity.time,$version:"v2",extraState:n};if(fS(t))r.openid=t.entity.openid,r.gaplaySign=t.gaplaySign,r.account=t.account,r.username=t.account.view_name,r.loginByRoleMail=!1,r.channelId=t.channel||6;else if(t.gaplaySign){const{ZONEID:o,openid:s,CHARID:i,NAME:a,REALZONEID:c,ZONENAME:u}=t.entity;r.openid=s,r.zone={zoneid:c||o,zonename:u,area:o},r.char={...t.entity,CHARID:i,NAME:a,GAMEPOINT:t.entity.GAMEPOINT,VIPLEVEL:t.entity.VIPLEVEL},r.loginByRoleMail=!0,r.gaplaySign=t.gaplaySign}else{const{ZONEID:o,CHARID:s,NAME:i,REALZONEID:a,ZONENAME:c,OPENID:u,CHANNELID:l,GAMEPOINT:d,VIPLEVEL:p}=t.entity;r.openid=u,r.channelId=l,r.char={CHARID:s,NAME:i,GAMEPOINT:d,VIPLEVEL:p},r.loginByRoleMail=!1,r.username=i,r.zone={zoneid:a||o,zonename:c,area:o},r.xToken=void 0}return r}function of(){try{const e=localStorage.getItem("userInfo")||"[]";return JSON.parse(e)}catch{return[]}}function za(e){return of().find(n=>n.game_id===e)}function hS(e){const t=localStorage.getItem("userInfo")||"[]",n=JSON.parse(t),r=n.find(s=>s.game_id===e);r?.openid&&sf(r.openid,e);const o=n.filter(s=>s.game_id!==e);localStorage.setItem("userInfo",JSON.stringify(o))}function mS(e){const t=of(),n=za(e.game_id),r=t.findIndex(o=>o.game_id===e.game_id);n?t[r]=e:t.push(e),localStorage.setItem("userInfo",JSON.stringify(t))}const So="LOGIN_SDK_ACCOUNTS";function $r(e){try{const t=JSON.parse(localStorage.getItem(So)||"[]");return e?t.filter(n=>n.gameId===e):t}catch{return[]}}function Ns(e,t,n){if(!n)return;const r=JSON.parse(localStorage.getItem(So)||"[]");let o=1;const s=r.filter(c=>c.openid===e.accid&&c.gameId===n?(o=(c.loginCnt||1)+1,!1):!0),a=[{openid:e.accid,username:e.account?.view_name||"",uid:e.account?.uid||"",mobile:e.account?.mobile||"",accountType:e.account?.account_type||0,authorization:t,loginAt:Date.now(),loginCnt:o,gameId:n},...s].slice(0,20);localStorage.setItem(So,JSON.stringify(a))}function sf(e,t){if(!t)return;const r=JSON.parse(localStorage.getItem(So)||"[]").filter(o=>!(o.openid===e&&o.gameId===t));localStorage.setItem(So,JSON.stringify(r))}let af={};function cf(e){af=e}function pr(e){const t=e||af.gameId;if(!t)throw new Error("gameId is required. Call init({ gameId }) first or pass it as an argument.");return t}const uf=oe.createContext(void 0),gS={enabled:!0,days:7},lf={"--primary-color":"#787bf4","--icon-color":"#a9aad1","--input-border-color":"#cad0e0","--input-label-color":"var(--jssdk-primary-color)","--input-bg-color":"#fff"};function Dn(){const e=oe.use(uf);if(!e)throw new Error("useConfig 必须在 ConfigProvider 中使用");return e}function df({children:e,value:t}){const n=pr(t.gameId),r=Rs(n,t.loginTypes),o=cS(n,t.defaultLoginType),s=oe.useRef(null);rf({gameId:n});const i=oe.useMemo(()=>!t.defaultLoginType&&$r(n).length>0?"quick":o,[t.defaultLoginType,n,o]),[a,c]=oe.useState(i),[u,l]=oe.useState(!0),[d,p]=oe.useState(!1),[h,m]=oe.useState(!1),[g,v]=oe.useState(""),y=()=>{p(!0)};oe.useEffect(()=>{uS({gameId:n})},[n]);const C={...t,gameId:n,loginTypes:r,defaultLoginType:o,autoLoginConfig:{...gS,...t.autoLoginConfig}};oe.useEffect(()=>{document.body.classList.add(`game-${n}`)},[n]);function S(E){Object.entries(E).forEach(([b,x])=>{const T=`--jssdk-${b.replace(/^--/,"")}`;document.documentElement.style.setProperty(T,x)})}return oe.useEffect(()=>{const E=s.current;if(E){const b={...lf,...t.styleVars};S(b)}return()=>{E&&S(lf)}},[t.styleVars]),w.jsx("div",{ref:s,children:w.jsx(uf,{value:{...C,currentLoginType:a,setCurrentLoginType:c,isShowGiantLogo:u,setIsShowGiantLogo:l,showRealNameModal:d,setShowRealNameModal:p,triggerRealNameAuth:y,isAutoLoggingIn:h,setIsAutoLoggingIn:m,autoLoginAccountName:g,setAutoLoginAccountName:v,onClose:t.onClose},children:e})})}function Eo({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=f.useRef(e!==void 0),[s,i]=f.useState(t),a=o?e:s;if(process.env.NODE_ENV!=="production"){f.useEffect(()=>{o!==(e!==void 0)&&ar([`A component is changing the ${o?"":"un"}controlled ${r} state of ${n} to be ${o?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${n} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
15
+ \`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,{arguments:n,firstInputs:s,secondInputs:i,stack:u})}},Sv={inputStabilityCheck:"once",identityFunctionCheck:"once"},$o=Symbol("NOT_FOUND");function Ev(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function xv(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function Cv(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var Uu=e=>Array.isArray(e)?e:[e];function Tv(e){const t=Array.isArray(e[0])?e[0]:e;return Cv(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Bu(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}var Ov=(e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:r}={...Sv,...t};return{identityFunctionCheck:{shouldRun:n==="always"||n==="once"&&e,run:bv},inputStabilityCheck:{shouldRun:r==="always"||r==="once"&&e,run:wv}}};function Pv(e){let t;return{get(n){return t&&e(t.key,n)?t.value:$o},put(n,r){t={key:n,value:r}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function _v(e,t){let n=[];function r(a){const c=n.findIndex(u=>t(a,u.key));if(c>-1){const u=n[c];return c>0&&(n.splice(c,1),n.unshift(u)),u.value}return $o}function o(a,c){r(a)===$o&&(n.unshift({key:a,value:c}),n.length>e&&n.pop())}function s(){return n}function i(){n=[]}return{get:r,put:o,getEntries:s,clear:i}}var Iv=(e,t)=>e===t;function kv(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;const{length:o}=n;for(let s=0;s<o;s++)if(!e(n[s],r[s]))return!1;return!0}}function Rv(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:r=Iv,maxSize:o=1,resultEqualityCheck:s}=n,i=kv(r);let a=0;const c=o<=1?Pv(i):_v(o,i);function u(){let l=c.get(arguments);if(l===$o){if(l=e.apply(null,arguments),a++,s){const p=c.getEntries().find(h=>s(h.value,l));p&&(l=p.value,a!==0&&a--)}c.put(arguments,l)}return l}return u.clearCache=()=>{c.clear(),u.resetResultsCount()},u.resultsCount=()=>a,u.resetResultsCount=()=>{a=0},u}var Nv=class{constructor(e){this.value=e}deref(){return this.value}},Mv=typeof WeakRef<"u"?WeakRef:Nv,Av=0,Wu=1;function jo(){return{s:Av,v:void 0,o:null,p:null}}function Zu(e,t={}){let n=jo();const{resultEqualityCheck:r}=t;let o,s=0;function i(){let a=n;const{length:c}=arguments;for(let d=0,p=c;d<p;d++){const h=arguments[d];if(typeof h=="function"||typeof h=="object"&&h!==null){let m=a.o;m===null&&(a.o=m=new WeakMap);const g=m.get(h);g===void 0?(a=jo(),m.set(h,a)):a=g}else{let m=a.p;m===null&&(a.p=m=new Map);const g=m.get(h);g===void 0?(a=jo(),m.set(h,a)):a=g}}const u=a;let l;if(a.s===Wu)l=a.v;else if(l=e.apply(null,arguments),s++,r){const d=o?.deref?.()??o;d!=null&&r(d,l)&&(l=d,s!==0&&s--),o=typeof l=="object"&&l!==null||typeof l=="function"?new Mv(l):l}return u.s=Wu,u.v=l,l}return i.clearCache=()=>{n=jo(),i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function Gu(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...o)=>{let s=0,i=0,a,c={},u=o.pop();typeof u=="object"&&(c=u,u=o.pop()),Ev(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const l={...n,...c},{memoize:d,memoizeOptions:p=[],argsMemoize:h=Zu,argsMemoizeOptions:m=[],devModeChecks:g={}}=l,v=Uu(p),y=Uu(m),C=Tv(o),S=d(function(){return s++,u.apply(null,arguments)},...v);let E=!0;const b=h(function(){i++;const T=Bu(C,arguments);if(a=S.apply(null,T),process.env.NODE_ENV!=="production"){const{identityFunctionCheck:P,inputStabilityCheck:$}=Ov(E,g);if(P.shouldRun&&P.run(u,T,a),$.shouldRun){const M=Bu(C,arguments);$.run({inputSelectorResults:T,inputSelectorResultsCopy:M},{memoize:d,memoizeOptions:v},arguments)}E&&(E=!1)}return a},...y);return Object.assign(b,{resultFunc:u,memoizedResultFunc:S,dependencies:C,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:d,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var Dv=Gu(Zu),Lv=Object.assign((e,t=Dv)=>{xv(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(s=>e[s]);return t(r,(...s)=>s.reduce((i,a,c)=>(i[n[c]]=a,i),{}))},{withTypes:()=>Lv});const Fv=Gu({memoize:Rv,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),Vv=(...e)=>{const t=new WeakMap;let n=1;const r=e[e.length-1],o=e.length-1||1,s=r.length-o;if(s>3)throw new Error(process.env.NODE_ENV!=="production"?"Unsupported number of arguments":ft(2));return(a,c,u,l)=>{let d=a.__cacheKey__;d||(d={id:n},a.__cacheKey__=d,n+=1);let p=t.get(d);if(!p){let h=e;const m=[void 0,void 0,void 0];switch(s){case 0:break;case 1:{h=[...e.slice(0,-1),()=>m[0],r];break}case 2:{h=[...e.slice(0,-1),()=>m[0],()=>m[1],r];break}case 3:{h=[...e.slice(0,-1),()=>m[0],()=>m[1],()=>m[2],r];break}default:throw new Error(process.env.NODE_ENV!=="production"?"Unsupported number of arguments":ft(2))}p=Fv(...h),p.selectorArgs=m,t.set(d,p)}switch(p.selectorArgs[0]=c,p.selectorArgs[1]=u,p.selectorArgs[2]=l,s){case 0:return p(a);case 1:return p(a,c);case 2:return p(a,c,u);case 3:return p(a,c,u,l);default:throw new Error("unreachable")}}};var Ho=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Uo={exports:{}},Ai={};var Yu;function $v(){if(Yu)return Ai;Yu=1;var e=oe;function t(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(d,p){var h=p(),m=r({inst:{value:h,getSnapshot:p}}),g=m[0].inst,v=m[1];return s(function(){g.value=h,g.getSnapshot=p,c(g)&&v({inst:g})},[d,h,p]),o(function(){return c(g)&&v({inst:g}),d(function(){c(g)&&v({inst:g})})},[d]),i(h),h}function c(d){var p=d.getSnapshot;d=d.value;try{var h=p();return!n(d,h)}catch{return!0}}function u(d,p){return p()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return Ai.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:l,Ai}var Di={};var Xu;function jv(){return Xu||(Xu=1,process.env.NODE_ENV!=="production"&&(function(){function e(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}function t(h,m){l||o.startTransition===void 0||(l=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var g=m();if(!d){var v=m();s(g,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}v=i({inst:{value:g,getSnapshot:m}});var y=v[0].inst,C=v[1];return c(function(){y.value=g,y.getSnapshot=m,n(y)&&C({inst:y})},[h,g,m]),a(function(){return n(y)&&C({inst:y}),h(function(){n(y)&&C({inst:y})})},[h]),u(g),g}function n(h){var m=h.getSnapshot;h=h.value;try{var g=m();return!s(h,g)}catch{return!0}}function r(h,m){return m()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=oe,s=typeof Object.is=="function"?Object.is:e,i=o.useState,a=o.useEffect,c=o.useLayoutEffect,u=o.useDebugValue,l=!1,d=!1,p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Di.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:p,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Di}var qu;function Li(){return qu||(qu=1,process.env.NODE_ENV==="production"?Uo.exports=$v():Uo.exports=jv()),Uo.exports}var Hv=Li(),Bo={exports:{}},Fi={};var Ku;function Uv(){if(Ku)return Fi;Ku=1;var e=oe,t=Li();function n(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,c=e.useDebugValue;return Fi.useSyncExternalStoreWithSelector=function(u,l,d,p,h){var m=s(null);if(m.current===null){var g={hasValue:!1,value:null};m.current=g}else g=m.current;m=a(function(){function y(x){if(!C){if(C=!0,S=x,x=p(x),h!==void 0&&g.hasValue){var T=g.value;if(h(T,x))return E=T}return E=x}if(T=E,r(S,x))return T;var P=p(x);return h!==void 0&&h(T,P)?(S=x,T):(S=x,E=P)}var C=!1,S,E,b=d===void 0?null:d;return[function(){return y(l())},b===null?void 0:function(){return y(b())}]},[l,d,p,h]);var v=o(u,m[0],m[1]);return i(function(){g.hasValue=!0,g.value=v},[v]),c(v),v},Fi}var Vi={};var Ju;function Bv(){return Ju||(Ju=1,process.env.NODE_ENV!=="production"&&(function(){function e(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=oe,n=Li(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,a=t.useMemo,c=t.useDebugValue;Vi.useSyncExternalStoreWithSelector=function(u,l,d,p,h){var m=s(null);if(m.current===null){var g={hasValue:!1,value:null};m.current=g}else g=m.current;m=a(function(){function y(x){if(!C){if(C=!0,S=x,x=p(x),h!==void 0&&g.hasValue){var T=g.value;if(h(T,x))return E=T}return E=x}if(T=E,r(S,x))return T;var P=p(x);return h!==void 0&&h(T,P)?(S=x,T):(S=x,E=P)}var C=!1,S,E,b=d===void 0?null:d;return[function(){return y(l())},b===null?void 0:function(){return y(b())}]},[l,d,p,h]);var v=o(u,m[0],m[1]);return i(function(){g.hasValue=!0,g.value=v},[v]),c(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Vi}var Qu;function Wv(){return Qu||(Qu=1,process.env.NODE_ENV==="production"?Bo.exports=Uv():Bo.exports=Bv()),Bo.exports}var Zv=Wv();const Gv=parseInt(f.version,10);function zi(e){return Gv>=e}const Yv=zi(19)?qv:Kv;function We(e,t,n,r,o){return Yv(e,t,n,r,o)}function Xv(e,t,n,r,o){const s=f.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return Hv.useSyncExternalStore(e.subscribe,s,s)}function qv(e,t,n,r,o){return Xv(e,t,n,r,o)}function Kv(e,t,n,r,o){return Zv.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class el{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,o){return We(this,t,n,r,o)}}const $i=f[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Jv=$i&&$i!==f.useLayoutEffect?$i:e=>e();function ie(e){const t=wt(Qv).current;return t.next=e,Jv(t.effect),t.trampoline}function Qv(){const e={next:void 0,callback:eb,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function eb(){if(process.env.NODE_ENV!=="production")throw new Error("Base UI: Cannot call an event handler while rendering.")}const he=typeof document<"u"?f.useLayoutEffect:()=>{};function Ct(){}const tl=Object.freeze([]),mt=Object.freeze({});class Wo extends el{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){f.useDebugValue(t),he(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const r=this;he(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this;if(process.env.NODE_ENV!=="production"){f.useDebugValue(t,i=>Object.keys(i));const o=f.useRef(Object.keys(t)).current,s=Object.keys(t);(o.length!==s.length||o.some((i,a)=>i!==s[a]))&&console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.")}const r=Object.values(t);he(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){f.useDebugValue(t);const r=n!==void 0;if(he(()=>{r&&!Object.is(this.state[t],n)&&super.setState({...this.state,[t]:n})},[t,n,r]),process.env.NODE_ENV!=="production"){const o=this.controlledValues??=new Map;o.has(t)||o.set(t,r);const s=o.get(t);s!==void 0&&s!==r&&console.error(`A component is changing the ${r?"":"un"}controlled state of ${t.toString()} to be ${r?"un":""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`)}}select(t,n,r,o){const s=this.selectors[t];return s(this.state,n,r,o)}useState(t,n,r,o){return f.useDebugValue(t),We(this,this.selectors[t],n,r,o)}useContextCallback(t,n){f.useDebugValue(t);const r=ie(n??Ct);this.context[t]=r}useStateSetter(t){const n=f.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return n(o,o,this),this.subscribe(s=>{const i=r(s);if(!Object.is(o,i)){const a=o;o=i,n(i,a,this)}})}}function Zo(){return typeof window<"u"}function kt(e){return ji(e)?(e.nodeName||"").toLowerCase():"#document"}function tt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mn(e){var t;return(t=(ji(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ji(e){return Zo()?e instanceof Node||e instanceof tt(e).Node:!1}function $e(e){return Zo()?e instanceof Element||e instanceof tt(e).Element:!1}function it(e){return Zo()?e instanceof HTMLElement||e instanceof tt(e).HTMLElement:!1}function kr(e){return!Zo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof tt(e).ShadowRoot}function Bn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=At(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function tb(e){return/^(table|td|th)$/.test(kt(e))}function Go(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const nb=/transform|translate|scale|rotate|perspective|filter/,rb=/paint|layout|strict|content/,nr=e=>!!e&&e!=="none";let Hi;function Ui(e){const t=$e(e)?At(e):e;return nr(t.transform)||nr(t.translate)||nr(t.scale)||nr(t.rotate)||nr(t.perspective)||!Yo()&&(nr(t.backdropFilter)||nr(t.filter))||nb.test(t.willChange||"")||rb.test(t.contain||"")}function ob(e){let t=Nn(e);for(;it(t)&&!Rn(t);){if(Ui(t))return t;if(Go(t))return null;t=Nn(t)}return null}function Yo(){return Hi==null&&(Hi=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Hi}function Rn(e){return/^(html|body|#document)$/.test(kt(e))}function At(e){return tt(e).getComputedStyle(e)}function Xo(e){return $e(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Nn(e){if(kt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||kr(e)&&e.host||mn(e);return kr(t)?t.host:t}function nl(e){const t=Nn(e);return Rn(t)?e.ownerDocument?e.ownerDocument.body:e.body:it(t)&&Bn(t)?t:nl(t)}function io(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=nl(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=tt(o);if(s){const a=Bi(i);return t.concat(i,i.visualViewport||[],Bn(o)?o:[],a&&n?io(a):[])}else return t.concat(o,io(o,[],n))}function Bi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gn(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function Ie(e){return e?.ownerDocument||document}function Fe(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}const qo=null;let rl=globalThis.requestAnimationFrame;class sb{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)n[o]?.(t)};request(t){const n=this.nextId;this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1;const r=process.env.NODE_ENV!=="production"&&rl!==requestAnimationFrame&&(rl=requestAnimationFrame,!0);return(!this.isScheduled||r)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const Ko=new sb;class yn{static create(){return new yn}static request(t){return Ko.request(t)}static cancel(t){return Ko.cancel(t)}currentId=qo;request(t){this.cancel(),this.currentId=Ko.request(()=>{this.currentId=qo,t()})}cancel=()=>{this.currentId!==qo&&(Ko.cancel(this.currentId),this.currentId=qo)};disposeEffect=()=>this.cancel}function ao(){const e=wt(yn.create).current;return so(e.disposeEffect),e}const co=0;class Zt{static create(){return new Zt}currentId=co;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=co,n()},t)}isStarted(){return this.currentId!==co}clear=()=>{this.currentId!==co&&(clearTimeout(this.currentId),this.currentId=co)};disposeEffect=()=>this.clear}function Gt(){const e=wt(Zt.create).current;return so(e.disposeEffect),e}let ol=0;function ib(e){return ol+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${ol}`}function Wi(e,t){if(typeof e=="string")return{description:e};if(typeof e=="function"){const n=e(t);return typeof n=="string"?{description:n}:n}return e}const Rr=typeof navigator<"u",Zi=cb(),sl=lb(),il=ub(),Gi=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),al=Zi.platform==="MacIntel"&&Zi.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Zi.platform),ab=Rr&&/apple/i.test(navigator.vendor),Jo=Rr&&/android/i.test(sl)||/android/i.test(il);Rr&&sl.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const cl=il.includes("jsdom/");function cb(){if(!Rr)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function ub(){if(!Rr)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function lb(){if(!Rr)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const Yi="data-base-ui-focusable",ul="active",ll="selected",dl="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Wn="ArrowLeft",Zn="ArrowRight",Xi="ArrowUp",uo="ArrowDown";function Pt(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function we(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&kr(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function lt(e){return"composedPath"in e?e.composedPath()[0]:e.target}function fl(e,t){if(!$e(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of t.entries())if(we(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function un(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function db(e){return e.matches("html,body")}function qi(e){return it(e)&&e.matches(dl)}function fb(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${dl}`)!=null}function Ki(e){return e?e.getAttribute("role")==="combobox"&&qi(e):!1}function Ji(e){if(!e||cl)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function lo(e){return e?e.hasAttribute(Yi)?e:e.querySelector(`[${Yi}]`)||e:null}function vn(e,t,n=!0){return e.filter(o=>o.parentId===t).flatMap(o=>[...!n||o.context?.open?[o]:[],...vn(e,o.id,n)])}function pl(e,t){let n=[],r=e.find(o=>o.id===t)?.parentId;for(;r;){const o=e.find(s=>s.id===r);r=o?.parentId,o&&(n=n.concat(o))}return n}function Yt(e){e.preventDefault(),e.stopPropagation()}function pb(e){return"nativeEvent"in e}function hl(e){return e.pointerType===""&&e.isTrusted?!0:Jo&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function ml(e){return cl?!1:!Jo&&e.width===0&&e.height===0||Jo&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function fo(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function gl(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const hb=["top","right","bottom","left"],Nr=Math.min,Xt=Math.max,Qo=Math.round,rr=Math.floor,bn=e=>({x:e,y:e}),mb={left:"right",right:"left",bottom:"top",top:"bottom"};function Qi(e,t,n){return Xt(e,Nr(t,n))}function Mn(e,t){return typeof e=="function"?e(t):e}function jt(e){return e.split("-")[0]}function Gn(e){return e.split("-")[1]}function ea(e){return e==="x"?"y":"x"}function ta(e){return e==="y"?"height":"width"}function en(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function na(e){return ea(en(e))}function gb(e,t,n){n===void 0&&(n=!1);const r=Gn(e),o=na(e),s=ta(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=es(i)),[i,es(i)]}function yb(e){const t=es(e);return[ra(e),t,ra(t)]}function ra(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const yl=["left","right"],vl=["right","left"],vb=["top","bottom"],bb=["bottom","top"];function wb(e,t,n){switch(e){case"top":case"bottom":return n?t?vl:yl:t?yl:vl;case"left":case"right":return t?vb:bb;default:return[]}}function Sb(e,t,n,r){const o=Gn(e);let s=wb(jt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ra)))),s}function es(e){const t=jt(e);return mb[t]+e.slice(t.length)}function Eb(e){return{top:0,right:0,bottom:0,left:0,...e}}function bl(e){return typeof e!="number"?Eb(e):{top:e,right:e,bottom:e,left:e}}function po(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function ts(e,t,n){return Math.floor(e/t)!==n}function ns(e,t){return t<0||t>=e.length}function oa(e,t){return Dt(e.current,{disabledIndices:t})}function wl(e,t){return Dt(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Dt(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let s=t;do s+=n?-o:o;while(s>=0&&s<=e.length-1&&Mr(e,s,r));return s}function xb(e,{event:t,orientation:n,loopFocus:r,onLoop:o,rtl:s,cols:i,disabledIndices:a,minIndex:c,maxIndex:u,prevIndex:l,stopEvent:d=!1}){let p=l,h;if(t.key===Xi?h="up":t.key===uo&&(h="down"),h){const m=[],g=[];let v=!1,y=0;{let $=null,M=-1;e.forEach((V,L)=>{if(V==null)return;y+=1;const D=V.closest('[role="row"]');D&&(v=!0),(D!==$||M===-1)&&($=D,M+=1,m[M]=[]),m[M].push(L),g[L]=M})}let C=!1,S=0;if(v)for(const $ of m){const M=$.length;M>S&&(S=M),M!==i&&(C=!0)}const E=C&&y<e.length,b=S||i,x=$=>{if(!C||l===-1)return;const M=g[l];if(M==null)return;const V=m[M].indexOf(l),L=$==="up"?-1:1;for(let D=M+L,R=0;R<m.length;R+=1,D+=L){if(D<0||D>=m.length){if(!r||E)return;if(D=D<0?m.length-1:0,o){const I=Math.min(V,m[D].length-1),_=m[D][I]??m[D][0],N=o(t,l,_);D=g[N]??D}}const O=m[D];for(let I=Math.min(V,O.length-1);I>=0;I-=1){const _=O[I];if(!Mr(e,_,a))return _}}},T=$=>{if(!E||l===-1)return;const M=l%b,V=$==="up"?-b:b,L=u-u%b,D=rr(u/b)+1;for(let R=l-M+V,O=0;O<D;O+=1,R+=V){if(R<0||R>u){if(!r)return;R=R<0?L:0}const I=Math.min(R+b-1,u);for(let _=Math.min(R+M,I);_>=R;_-=1)if(!Mr(e,_,a))return _}};d&&Yt(t);const P=x(h)??T(h);if(P!==void 0)p=P;else if(l===-1)p=h==="up"?u:c;else if(p=Dt(e,{startingIndex:l,amount:b,decrement:h==="up",disabledIndices:a}),r){if(h==="up"&&(l-b<c||p<0)){const $=l%b,M=u%b,V=u-(M-$);M===$?p=u:p=M>$?V:V-b,o&&(p=o(t,l,p))}h==="down"&&l+b>u&&(p=Dt(e,{startingIndex:l%b-b,amount:b,disabledIndices:a}),o&&(p=o(t,l,p)))}ns(e,p)&&(p=l)}if(n==="both"){const m=rr(l/i);t.key===(s?Wn:Zn)&&(d&&Yt(t),l%i!==i-1?(p=Dt(e,{startingIndex:l,disabledIndices:a}),r&&ts(p,i,m)&&(p=Dt(e,{startingIndex:l-l%i-1,disabledIndices:a}),o&&(p=o(t,l,p)))):r&&(p=Dt(e,{startingIndex:l-l%i-1,disabledIndices:a}),o&&(p=o(t,l,p))),ts(p,i,m)&&(p=l)),t.key===(s?Zn:Wn)&&(d&&Yt(t),l%i!==0?(p=Dt(e,{startingIndex:l,decrement:!0,disabledIndices:a}),r&&ts(p,i,m)&&(p=Dt(e,{startingIndex:l+(i-l%i),decrement:!0,disabledIndices:a}),o&&(p=o(t,l,p)))):r&&(p=Dt(e,{startingIndex:l+(i-l%i),decrement:!0,disabledIndices:a}),o&&(p=o(t,l,p))),ts(p,i,m)&&(p=l));const g=rr(u/i)===m;ns(e,p)&&(r&&g?(p=t.key===(s?Zn:Wn)?u:Dt(e,{startingIndex:l-l%i-1,disabledIndices:a}),o&&(p=o(t,l,p))):p=l)}return p}function Cb(e,t,n){const r=[];let o=0;return e.forEach(({width:s,height:i},a)=>{if(s>t&&process.env.NODE_ENV!=="production")throw new Error(`[Floating UI]: Invalid grid - item width at index ${a} is greater than grid columns`);let c=!1;for(;!c;){const u=[];for(let l=0;l<s;l+=1)for(let d=0;d<i;d+=1)u.push(o+l+d*t);o%t+s<=t&&u.every(l=>r[l]==null)?(u.forEach(l=>{r[l]=a}),c=!0):o+=1}}),[...r]}function Tb(e,t,n,r,o){if(e===-1)return-1;const s=n.indexOf(e),i=t[e];switch(o){case"tl":return s;case"tr":return i?s+i.width-1:s;case"bl":return i?s+(i.height-1)*r:s;case"br":return n.lastIndexOf(e);default:return-1}}function Ob(e,t){return t.flatMap((n,r)=>e.includes(n)?[r]:[])}function Mr(e,t,n){if(typeof n=="function"?n(t):n?.includes(t)??!1)return!0;const o=e[t];return o?rs(o)?!n&&(o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true"):!0:!1}function Pb(e){return e.visibility==="hidden"||e.visibility==="collapse"}function rs(e,t=e?At(e):null){return!e||!e.isConnected||!t||Pb(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const _b='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function Ib(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return kr(n)?n.host:null}function sa(e){for(const t of Array.from(e.children))if(kt(t)==="summary")return t;return null}function kb(e,t){const n=sa(t);return!!n&&(e===n||we(n,e))}function Sl(e){const t=e?kt(e):"";return e!=null&&e.matches(_b)&&(t!=="summary"||e.parentElement!=null&&kt(e.parentElement)==="details"&&sa(e.parentElement)===e)&&(t!=="details"||sa(e)==null)&&(t!=="input"||e.type!=="hidden")}function El(e){if(!Sl(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=Ib(t)){const n=t!==e,r=kt(t)==="slot";if(t.hasAttribute("inert")||n&&kt(t)==="details"&&!t.open&&!kb(e,t)||t.hasAttribute("hidden")||!r&&!Rb(t,n))return!1}return!0}function Rb(e,t){const n=At(e);return t?n.display!=="none":rs(e,n)}function xl(e){const t=e.tabIndex;if(t<0){const n=kt(e);if(n==="details"||n==="audio"||n==="video"||it(e)&&e.isContentEditable)return 0}return t}function ia(e){if(kt(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function Nb(e,t){const n=ia(e);if(!n)return!0;const r=t.find(o=>{const s=ia(o);return s?.name===n.name&&s.form===n.form&&s.checked});return r?r===n:t.find(o=>{const s=ia(o);return s?.name===n.name&&s.form===n.form})===n}function Cl(e){if(it(e)&&kt(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return it(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Tl(e,t){Cl(e).forEach(n=>{Sl(n)&&t.push(n),Tl(n,t)})}function Ol(e,t,n){Cl(e).forEach(r=>{it(r)&&r.matches(t)&&n.push(r),Ol(r,t,n)})}function aa(e){return El(e)&&xl(e)>=0}function Pl(e){const t=[];return Tl(e,t),t.filter(El)}function ho(e){const t=Pl(e);return t.filter(n=>xl(n)>=0&&Nb(n,t))}function _l(e,t){const n=ho(e),r=n.length;if(r===0)return;const o=Pt(Ie(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function ca(e){return _l(Ie(e).body,1)||e}function Il(e){return _l(Ie(e).body,-1)||e}function kl(e,t){if(!e)return null;const n=ho(Ie(e).body),r=n.length;if(r===0)return null;const o=n.indexOf(e);if(o===-1)return null;const s=(o+t+r)%r;return n[s]}function Mb(e){return kl(e,1)}function Ab(e){return kl(e,-1)}function Ar(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!we(n,r)}function Db(e){ho(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Rl(e){const t=[];Ol(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const os=Vv(e=>e.toasts,e=>{const t=new Map;let n=0,r=0;return e.forEach((o,s)=>{const i=o.transitionStatus==="ending";t.set(o.id,{value:o,domIndex:s,visibleIndex:i?-1:n,offsetY:r}),r+=o.height||0,i||(n+=1)}),t}),wn={toasts:de(e=>e.toasts),isEmpty:de(e=>e.toasts.length===0),toast:de(os,(e,t)=>e.get(t)?.value),toastIndex:de(os,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:de(os,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:de(os,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:de(e=>e.hovering),focused:de(e=>e.focused),expanded:de(e=>e.hovering||e.focused),expandedOrOutOfFocus:de(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:de(e=>e.prevFocusElement)};class Lb extends Wo{timers=new Map;areTimersPaused=!1;constructor(t){super(t,{},wn)}setFocused(t){this.set("focused",t)}setHovering(t){this.set("hovering",t)}setIsWindowFocused(t){this.set("isWindowFocused",t)}setPrevFocusElement(t){this.set("prevFocusElement",t)}setViewport=t=>{this.set("viewport",t)};disposeEffect=()=>()=>{this.timers.forEach(t=>{t.timeout?.clear()}),this.timers.clear()};removeToast(t,n={}){const r=wn.toastIndex(this.state,t);if(r===-1)return;const o=this.state.toasts[r];n.skipOnRemove||o?.onRemove?.();const s=[...this.state.toasts];s.splice(r,1),this.setToasts(s)}addToast=t=>{const{timeout:n,limit:r}=this.state,o=t.id||ib("toast");if(t.id){const u=wn.toast(this.state,t.id);if(u)if(u.transitionStatus==="ending")this.removeToast(t.id,{skipOnRemove:!0});else{const{id:l,transitionStatus:d,...p}=t;return this.updateToastInternal(t.id,p,{resetTimer:!0,markUpdated:!0}),t.id}}const s={...t,id:o,updateKey:0,transitionStatus:"starting"},i=[s,...this.state.toasts],a=i.filter(u=>u.transitionStatus!=="ending");if(a.length>r){const u=a.length-r,l=a.slice(-u),d=new Set(l.map(p=>p.id));this.setToasts(i.map(p=>{const h=d.has(p.id);return p.limited!==h?{...p,limited:h}:p}))}else this.setToasts(i.map(u=>u.limited?{...u,limited:!1}:u));const c=s.timeout??n;return s.type!=="loading"&&c>0&&this.scheduleTimer(o,c,()=>this.closeToast(o)),wn.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),o};updateToast=(t,n)=>{this.updateToastInternal(t,n,{markUpdated:!0})};updateToastInternal=(t,n,r={})=>{const{timeout:o,toasts:s}=this.state,i=wn.toast(this.state,t)??null;if(!i||i.transitionStatus==="ending")return;const a={...i,...n,...r.markUpdated&&{updateKey:(i.updateKey??0)+1}};this.setToasts(s.map(g=>g.id===t?a:g));const c=a.timeout??o,u=i?.timeout??o,l=Object.hasOwn(n,"timeout"),d=a.transitionStatus!=="ending"&&a.type!=="loading"&&c>0,p=this.timers.has(t),h=u!==c,m=i?.type==="loading";if(!d&&p){this.timers.get(t)?.timeout?.clear(),this.timers.delete(t);return}if(d&&(!p||h||l||m||r.resetTimer)){const g=this.timers.get(t);g&&(g.timeout?.clear(),this.timers.delete(t)),this.scheduleTimer(t,c,()=>this.closeToast(t)),wn.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}};closeToast=t=>{const n=t===void 0,{limit:r,toasts:o}=this.state;let s;if(n)s=o,this.timers.forEach(u=>{u.timeout?.clear()}),this.timers.clear();else{const u=wn.toast(this.state,t);if(!u)return;s=[u];const l=this.timers.get(t);l?.timeout&&(l.timeout.clear(),this.timers.delete(t))}let i=0;const c={toasts:o.map(u=>{if(n||u.id===t)return{...u,transitionStatus:"ending",height:0};if(u.transitionStatus==="ending")return u;const l=i>=r;return i+=1,u.limited!==l?{...u,limited:l}:u})};(n||o.length===1)&&(c.hovering=!1,c.focused=!1),this.update(c),s.forEach(u=>{u.transitionStatus!=="ending"&&u.onClose?.()}),this.handleFocusManagement(t)};promiseToast=(t,n)=>{const r=Wi(n.loading),o=this.addToast({...r,type:"loading"}),s=t.then(i=>{const a=Wi(n.success,i);return this.updateToast(o,{...a,type:"success",timeout:a.timeout}),i}).catch(i=>{const a=Wi(n.error,i);return this.updateToast(o,{...a,type:"error",timeout:a.timeout}),Promise.reject(i)});return{}.hasOwnProperty.call(n,"setPromise")&&n.setPromise(s),s};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(t=>{if(t.timeout){t.timeout.clear();const n=Date.now()-t.start,r=t.delay-n;t.remaining=r>0?r:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((t,n)=>{t.remaining=t.remaining>0?t.remaining:t.delay,t.timeout??=Zt.create(),t.timeout.start(t.remaining,()=>{this.timers.delete(n),t.callback()}),t.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=t=>{if(t.pointerType!=="touch")return;const n=lt(t);we(this.state.viewport,n)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(t,n,r){const o=Date.now(),s=!wn.expandedOrOutOfFocus(this.state),i=s?Zt.create():void 0;i?.start(n,()=>{this.timers.delete(t),r()}),this.timers.set(t,{timeout:i,start:s?o:0,delay:n,remaining:n,callback:r})}setToasts(t){const n={toasts:t};t.length===0&&(n.hovering=!1,n.focused=!1),this.update(n)}handleFocusManagement(t){const n=Pt(Ie(this.state.viewport));if(!this.state.viewport||!we(this.state.viewport,n)||!Ji(n))return;if(t===void 0){this.restoreFocusToPrevElement();return}const r=wn.toasts(this.state),o=wn.toastIndex(this.state,t);let s=null,i=o+1;for(;i<r.length;){if(r[i].transitionStatus!=="ending"){s=r[i];break}i+=1}if(!s)for(i=o-1;i>=0;){if(r[i].transitionStatus!=="ending"){s=r[i];break}i-=1}s?s.ref?.current?.focus():this.restoreFocusToPrevElement()}}const Nl=function(t){const{children:n,timeout:r=5e3,limit:o=3,toastManager:s}=t,i=wt(()=>new Lb({timeout:r,limit:o,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return so(i.disposeEffect),f.useEffect(function(){return s?s[" subscribe"](({action:u,options:l})=>{const d=l.id;u==="promise"&&l.promise?i.promiseToast(l.promise,l):u==="update"&&d?i.updateToast(d,l):u==="close"?i.closeToast(d):i.addToast(l)}):void 0},[i,r,s]),i.useSyncedValues({timeout:r,limit:o}),w.jsx(zo.Provider,{value:i,children:n})};process.env.NODE_ENV!=="production"&&(Nl.displayName="ToastProvider");const Ml={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},ss={...Ml,position:"fixed",top:0,left:0},Al={...Ml,position:"absolute"},Sn=f.forwardRef(function(t,n){const[r,o]=f.useState();he(()=>{ab&&o("button")},[]);const s={tabIndex:0,role:r};return w.jsx("span",{...t,ref:n,style:ss,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});process.env.NODE_ENV!=="production"&&(Sn.displayName="FocusGuard");function or(e,t,n,r){const o=wt(Dl).current;return Vb(o,e,t,n,r)&&Ll(o,[e,t,n,r]),o.callback}function Fb(e){const t=wt(Dl).current;return zb(t,e)&&Ll(t,e),t.callback}function Dl(){return{callback:null,cleanup:null,refs:[]}}function Vb(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function zb(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function Ll(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const i=s(n);typeof i=="function"&&(r[o]=i);break}case"object":{s.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const i=r[o];typeof i=="function"?i():s(null);break}case"object":{s.current=null;break}}}}}}}function Fl(e){if(!f.isValidElement(e))return null;const t=e,n=t.props;return(zi(19)?n?.ref:t.ref)??null}function ua(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}let la;process.env.NODE_ENV!=="production"&&(la=new Set);function $b(...e){if(process.env.NODE_ENV!=="production"){const t=e.join(" ");la.has(t)||(la.add(t),console.warn(`Base UI: ${t}`))}}function jb(e,t){const n={};for(const r in e){const o=e[r];if(t?.hasOwnProperty(r)){const s=t[r](o);s!=null&&Object.assign(n,s);continue}o===!0?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}function Hb(e,t){return typeof e=="function"?e(t):e}function Ub(e,t){return typeof e=="function"?e(t):e}const da={};function En(e,t,n,r,o){if(!n&&!r&&!o&&!e)return is(t);let s=is(e);return t&&(s=mo(s,t)),n&&(s=mo(s,n)),r&&(s=mo(s,r)),o&&(s=mo(s,o)),s}function Bb(e){if(e.length===0)return da;if(e.length===1)return is(e[0]);let t=is(e[0]);for(let n=1;n<e.length;n+=1)t=mo(t,e[n]);return t}function is(e){return fa(e)?{...zl(e,da)}:Wb(e)}function mo(e,t){return fa(t)?zl(t,e):Zb(e,t)}function Wb(e){const t={...e};for(const n in t){const r=t[n];Vl(n,r)&&(t[n]=$l(r))}return t}function Zb(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=ua(e.style,r);break}case"className":{e[n]=jl(e.className,r);break}default:Vl(n,r)?e[n]=Gb(e[n],r):e[n]=r}}return e}function Vl(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return n===111&&r===110&&o>=65&&o<=90&&(typeof t=="function"||typeof t>"u")}function fa(e){return typeof e=="function"}function zl(e,t){return fa(e)?e(t):e??da}function Gb(e,t){return t?e?(...n)=>{const r=n[0];if(Hl(r)){const s=r;as(s);const i=t(...n);return s.baseUIHandlerPrevented||e?.(...n),i}const o=t(...n);return e?.(...n),o}:$l(t):e}function $l(e){return e&&((...t)=>{const n=t[0];return Hl(n)&&as(n),e(...t)})}function as(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function jl(e,t){return t?e?t+" "+e:t:e}function Hl(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function qe(e,t,n={}){const r=t.render,o=Yb(t,n);if(n.enabled===!1)return null;const s=n.state??mt;return Qb(e,r,o,s)}function Yb(e,t={}){const{className:n,style:r,render:o}=e,{state:s=mt,ref:i,props:a,stateAttributesMapping:c,enabled:u=!0}=t,l=u?Hb(n,s):void 0,d=u?Ub(r,s):void 0,p=u?jb(s,c):mt,h=u&&a?Xb(a):void 0,m=u?ua(p,h)??{}:mt;return typeof document<"u"&&(u?Array.isArray(i)?m.ref=Fb([m.ref,Fl(o),...i]):m.ref=or(m.ref,Fl(o),i):or(null,null)),u?(l!==void 0&&(m.className=jl(m.className,l)),d!==void 0&&(m.style=ua(m.style,d)),m):mt}function Xb(e){return Array.isArray(e)?Bb(e):En(void 0,e)}const qb=Symbol.for("react.lazy"),Kb=/^[A-Z][A-Za-z0-9$]*$/,Jb=/[a-z]/;function Qb(e,t,n,r){if(t){if(typeof t=="function")return process.env.NODE_ENV!=="production"&&e0(t),t(n,r);const o=En(n,t.props);o.ref=n.ref;let s=t;if(s?.$$typeof===qb&&(s=f.Children.toArray(t)[0]),process.env.NODE_ENV!=="production"&&!f.isValidElement(s))throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.","A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.","https://base-ui.com/r/invalid-render-prop"].join(`
16
+ `));return f.cloneElement(s,o)}if(e&&typeof e=="string")return t0(e,n);throw new Error(process.env.NODE_ENV!=="production"?"Base UI: Render element or function are not defined.":ft(8))}function e0(e){const t=e.name;t.length!==0&&Kb.test(t)&&Jb.test(t)&&$b(`The \`render\` prop received a function named \`${t}\` that starts with an uppercase letter.`,"This usually means a React component was passed directly as `render={Component}`.","Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.","If this is an intentional render callback, rename it to start with a lowercase letter.","Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.","https://base-ui.com/r/invalid-render-prop")}function t0(e,t){return e==="button"?oe.createElement("button",{type:"button",...t,key:t.key}):e==="img"?oe.createElement("img",{alt:"",...t,key:t.key}):f.createElement(e,t)}let n0=(function(e){return e.frontmostHeight="--toast-frontmost-height",e})({});const Ul=f.forwardRef(function(t,n){const{render:r,className:o,style:s,children:i,...a}=t,c=Hu(),u=Gt(),l=f.useRef(!1),d=f.useRef(!1),p=f.useRef(!1),h=c.useState("isEmpty"),m=c.useState("toasts"),g=c.useState("focused"),v=c.useState("expanded"),y=c.useState("prevFocusElement"),C=m[0]?.height??0,S=f.useMemo(()=>m.some(_=>_.transitionStatus==="ending"),[m]);f.useEffect(()=>{const _=c.state.viewport;if(!_)return;function N(j){h||j.key==="F6"&&lt(j)!==_&&(j.preventDefault(),c.setPrevFocusElement(Pt(Ie(_))),_?.focus({preventScroll:!0}),c.pauseTimers(),c.setFocused(!0))}const A=tt(_);return Fe(A,"keydown",N)},[c,h]),f.useEffect(()=>{const _=c.state.viewport;if(!_||h)return;const N=tt(_);function A(B){lt(B)===N&&(c.setIsWindowFocused(!1),c.pauseTimers())}function j(B){if(B.relatedTarget)return;const U=lt(B),W=Pt(Ie(_));(U===N||!we(_,U)||!Ji(W))&&c.resumeTimers(),u.start(0,()=>c.setIsWindowFocused(!0))}return gn(Fe(N,"blur",A,!0),Fe(N,"focus",j,!0))},[c,u,h]),f.useEffect(()=>{const _=c.state.viewport;if(!_||h)return;const N=Ie(_);return Fe(N,"pointerdown",c.handleDocumentPointerDown,!0)},[h,c]);function E(_){const N=c.state.viewport;N&&(l.current=!0,_.relatedTarget===N?m[0]?.ref?.current?.focus():c.restoreFocusToPrevElement())}function b(_){_.key==="Tab"&&_.shiftKey&&lt(_.nativeEvent)===c.state.viewport&&(_.preventDefault(),c.restoreFocusToPrevElement(),c.resumeTimers())}function x(){const _=c.state.toasts.some(N=>N.transitionStatus==="ending");!c.state.isWindowFocused||_||p.current||!d.current||(c.resumeTimers(),c.setHovering(!1),d.current=!1)}f.useEffect(x,[S,c]);function T(){c.pauseTimers(),c.setHovering(!0),d.current=!1}function P(){S||p.current?d.current=!0:(c.resumeTimers(),c.setHovering(!1))}function $(_){_.pointerType==="touch"&&(p.current=!0)}function M(_){_.pointerType==="touch"&&(p.current=!1,x())}function V(){if(l.current){l.current=!1;return}g||Ji(Pt(Ie(c.state.viewport)))&&(c.setFocused(!0),c.pauseTimers())}function L(_){!g||we(c.state.viewport,_.relatedTarget)||(c.setFocused(!1),c.resumeTimers())}const D={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:T,onMouseMove:T,onMouseLeave:P,onFocus:V,onBlur:L,onKeyDown:b,onClick:V,onPointerDown:$,onPointerUp:M,onPointerCancel:M},R={expanded:v},O=qe("div",t,{ref:[n,c.setViewport],state:R,props:[D,{style:{[n0.frontmostHeight]:C?`${C}px`:void 0}},a,{children:w.jsxs(f.Fragment,{children:[!h&&y&&w.jsx(Sn,{onFocus:E}),i,!h&&y&&w.jsx(Sn,{onFocus:E})]})}]}),I=f.useMemo(()=>m.filter(_=>_.priority==="high"),[m]);return w.jsxs(f.Fragment,{children:[!h&&y&&w.jsx(Sn,{onFocus:E}),O,!g&&I.length>0&&w.jsx("div",{style:ss,children:I.map(_=>w.jsxs("div",{role:"alert","aria-atomic":!0,children:[w.jsx("div",{children:_.title}),w.jsx("div",{children:_.description})]},_.id))})]})});process.env.NODE_ENV!=="production"&&(Ul.displayName="ToastViewport");function cs(e){return zi(19)?e:e?"true":void 0}const pa=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(pa.displayName="ToastRootContext");function r0(){const e=f.useContext(pa);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.":ft(66));return e}let sr=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const o0={[sr.startingStyle]:""},s0={[sr.endingStyle]:""},tn={transitionStatus(e){return e==="starting"?o0:e==="ending"?s0:null}};function An(e){return e==null?e:"current"in e?e.current:e}function Bl(e,t=!1,n=!0){const r=ao();return ie((o,s=null)=>{r.cancel();const i=An(e);if(i==null)return;const a=i,c=()=>{Kt.flushSync(o)};if(typeof a.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){o();return}function u(){Promise.all(a.getAnimations().map(l=>l.finished)).then(()=>{s?.aborted||c()}).catch(()=>{if(n){s?.aborted||c();return}const l=a.getAnimations();!s?.aborted&&l.length>0&&l.some(d=>d.pending||d.playState!=="finished")&&u()})}if(t){const l=sr.startingStyle;if(!a.hasAttribute(l)){r.request(u);return}const d=new MutationObserver(()=>{a.hasAttribute(l)||(d.disconnect(),u())});d.observe(a,{attributes:!0,attributeFilter:[l]}),s?.addEventListener("abort",()=>d.disconnect(),{once:!0});return}r.request(u)})}function xn(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=ie(o),i=Bl(r,n,!1);f.useEffect(()=>{if(!t)return;const a=new AbortController;return i(s,a.signal),()=>{a.abort()}},[t,n,s,i])}let ir=(function(e){return e.index="--toast-index",e.offsetY="--toast-offset-y",e.height="--toast-height",e.swipeMovementX="--toast-swipe-movement-x",e.swipeMovementY="--toast-swipe-movement-y",e})({});const i0=500,a0={style:{transition:"none"}},ha="data-base-ui-click-trigger",c0="data-base-ui-swipe-ignore",u0="data-swipe-ignore",Wl=`[${c0}]`,l0=`[${u0}]`,d0={fallbackAxisSide:"none"},f0={fallbackAxisSide:"end"},p0={clipPath:"inset(50%)",position:"fixed",top:0,left:0},h0={...tn,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},go=40,m0=10,Yn=.5,g0=1,y0=`${Wl},${l0}`;function Zl(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}function v0(e){const n=tt(e).getComputedStyle(e).transform;let r=0,o=0,s=1;if(n&&n!=="none"){const i=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(i){const a=i[1].split(", ").map(parseFloat);a.length===6?(r=a[4],o=a[5],s=Math.sqrt(a[0]*a[0]+a[1]*a[1])):a.length===16&&(r=a[12],o=a[13],s=a[0])}}return{x:r,y:o,scale:s}}const Gl=f.forwardRef(function(t,n){const{toast:r,render:o,className:s,swipeDirection:i=["down","right"],style:a,...c}=t,u=r.positionerProps?.anchor!==void 0;let l=[];u||(l=Array.isArray(i)?i:[i]);const d=l.length>0,p=Hu(),[h,m]=f.useState(void 0),[g,v]=f.useState(!1),[y,C]=f.useState(!1),[S,E]=f.useState(!1),[b,x]=f.useState({x:0,y:0}),[T,P]=f.useState({x:0,y:0,scale:1}),[$,M]=f.useState(),[V,L]=f.useState(),[D,R]=f.useState(null),O=f.useRef(null),I=f.useRef({x:0,y:0}),_=f.useRef({x:0,y:0,scale:1}),N=f.useRef(void 0),A=f.useRef(0),j=f.useRef(!1),B=f.useRef({x:0,y:0}),U=f.useRef(!1),W=p.useState("toastIndex",r.id),G=p.useState("toastVisibleIndex",r.id),Z=p.useState("toastOffsetY",r.id),X=p.useState("focused"),K=p.useState("expanded");xn({open:r.transitionStatus!=="ending",ref:O,onComplete(){r.transitionStatus==="ending"&&p.removeToast(r.id)}});const J=ie((k=!1)=>{const H=O.current;if(!H)return;const F=H.style.height;H.style.height="auto";const z=H.offsetHeight;H.style.height=F;function Q(){p.updateToastInternal(r.id,{ref:O,height:z,...r.transitionStatus==="starting"?{transitionStatus:void 0}:{}})}k?Kt.flushSync(Q):Q()});he(J,[J]);function se(k,H){let F=k,z=H;return!l.includes("left")&&!l.includes("right")?F=k>0?k**Yn:-(Math.abs(k)**Yn):(!l.includes("right")&&k>0&&(F=k**Yn),!l.includes("left")&&k<0&&(F=-(Math.abs(k)**Yn))),!l.includes("up")&&!l.includes("down")?z=H>0?H**Yn:-(Math.abs(H)**Yn):(!l.includes("down")&&H>0&&(z=H**Yn),!l.includes("up")&&H<0&&(z=-(Math.abs(H)**Yn))),{x:F,y:z}}function ae(k){if(k.button!==0)return;k.pointerType==="touch"&&p.pauseTimers();const H=lt(k.nativeEvent);if(!(H&&H.closest(`button,a,input,textarea,[role="button"],${y0}`))){if(j.current=!1,N.current=void 0,A.current=0,I.current={x:k.clientX,y:k.clientY},B.current=I.current,O.current){const z=v0(O.current);_.current=z,P(z),x({x:z.x,y:z.y})}p.setHovering(!0),v(!0),C(!1),R(null),U.current=!0,O.current?.setPointerCapture(k.pointerId)}}function pe(k){if(!g)return;k.preventDefault(),U.current&&(I.current={x:k.clientX,y:k.clientY},U.current=!1);const{clientY:H,clientX:F,movementX:z,movementY:Q}=k;(Q<0&&H>B.current.y||Q>0&&H<B.current.y)&&(B.current={x:B.current.x,y:H}),(z<0&&F>B.current.x||z>0&&F<B.current.x)&&(B.current={x:F,y:B.current.y});const ne=F-I.current.x,te=H-I.current.y,ye=H-B.current.y,_e=F-B.current.x;if(!y&&Math.sqrt(ne*ne+te*te)>=g0&&(C(!0),D===null)){const He=l.includes("left")||l.includes("right"),nt=l.includes("up")||l.includes("down");if(He&&nt){const st=Math.abs(ne),Re=Math.abs(te);R(st>Re?"horizontal":"vertical")}}let Ee;if(!N.current)D==="vertical"?te>0?Ee="down":te<0&&(Ee="up"):D==="horizontal"?ne>0?Ee="right":ne<0&&(Ee="left"):Math.abs(ne)>=Math.abs(te)?Ee=ne>0?"right":"left":Ee=te>0?"down":"up",Ee&&l.includes(Ee)&&(N.current=Ee,A.current=Zl(Ee,ne,te),m(Ee));else{const Ge=N.current,He=Zl(Ge,_e,ye);He>go?(j.current=!1,m(Ge)):!(l.includes("left")&&l.includes("right"))&&!(l.includes("up")&&l.includes("down"))&&A.current-He>=m0&&(j.current=!0)}const Ce=se(ne,te);let Pe=_.current.x,Ve=_.current.y;D==="horizontal"?(l.includes("left")||l.includes("right"))&&(Pe+=Ce.x):(D==="vertical"||(l.includes("left")||l.includes("right"))&&(Pe+=Ce.x),(l.includes("up")||l.includes("down"))&&(Ve+=Ce.y)),x({x:Pe,y:Ve})}function Y(k){if(!g)return;if(v(!1),C(!1),R(null),O.current?.releasePointerCapture(k.pointerId),j.current){x({x:T.x,y:T.y}),m(void 0);return}let H=!1;const F=b.x-T.x,z=b.y-T.y;let Q;for(const ne of l){switch(ne){case"right":F>go&&(H=!0,Q="right");break;case"left":F<-go&&(H=!0,Q="left");break;case"down":z>go&&(H=!0,Q="down");break;case"up":z<-go&&(H=!0,Q="up");break}if(H)break}H?(m(Q),E(!0),p.closeToast(r.id)):(x({x:T.x,y:T.y}),m(void 0))}function me(){g&&(v(!1),C(!1),R(null),x({x:T.x,y:T.y}),m(void 0))}function ge(k){if(k.key==="Escape"){if(!O.current||!we(O.current,Pt(Ie(O.current))))return;p.closeToast(r.id)}}f.useEffect(()=>{if(!d)return;const k=O.current;if(!k)return;function H(F){we(k,lt(F))&&F.preventDefault()}return Fe(k,"touchmove",H,{passive:!1})},[d]);function fe(){if(!g&&b.x===T.x&&b.y===T.y&&!S)return{[ir.swipeMovementX]:"0px",[ir.swipeMovementY]:"0px"};const k=b.x-T.x,H=b.y-T.y;return{transition:g?"none":void 0,transform:g?`translateX(${b.x}px) translateY(${b.y}px) scale(${T.scale})`:void 0,[ir.swipeMovementX]:`${k}px`,[ir.swipeMovementY]:`${H}px`}}const le=r.priority==="high",ce={role:le?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":$,"aria-describedby":V,"aria-hidden":le&&!X?!0:void 0,onPointerDown:d?ae:void 0,onPointerMove:d?pe:void 0,onPointerUp:d?Y:void 0,onPointerCancel:d?me:void 0,onKeyDown:ge,inert:cs(r.limited),style:{...fe(),[ir.index]:r.transitionStatus==="ending"?W:G,[ir.offsetY]:`${Z}px`,[ir.height]:r.height?`${r.height}px`:void 0}},ve=f.useMemo(()=>({rootRef:O,toast:r,titleId:$,setTitleId:M,descriptionId:V,setDescriptionId:L,swiping:g,swipeDirection:h,recalculateHeight:J,index:W,visibleIndex:G,expanded:K}),[r,$,V,g,h,J,W,G,K]),ue={transitionStatus:r.transitionStatus,expanded:K,limited:r.limited||!1,type:r.type,swiping:ve.swiping,swipeDirection:ve.swipeDirection},Se=qe("div",t,{ref:[n,ve.rootRef],state:ue,stateAttributesMapping:h0,props:[ce,c]});return w.jsx(pa.Provider,{value:ve,children:Se})});process.env.NODE_ENV!=="production"&&(Gl.displayName="ToastRoot");const Dr={...f};let Yl=0;function b0(e,t="mui"){const[n,r]=f.useState(e),o=e||n;return f.useEffect(()=>{n==null&&(Yl+=1,r(`${t}-${Yl}`))},[n,t]),o}const Xl=Dr.useId;function Xn(e,t){if(Xl!==void 0){const n=Xl();return e??(t?`${t}-${n}`:n)}return b0(e,t)}const ql=f.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,children:a,...c}=t,{toast:u,setDescriptionId:l}=r0(),d=a??u.description,p=!!d,h=Xn(i);he(()=>{if(p)return l(h),()=>{l(void 0)}},[p,h,l]);const m={type:u.type},g=qe("p",t,{ref:n,state:m,props:{...c,id:h,children:d}});return p?g:null});process.env.NODE_ENV!=="production"&&(ql.displayName="ToastDescription");let ma;process.env.NODE_ENV!=="production"&&(ma=new Set);function ar(...e){if(process.env.NODE_ENV!=="production"){const t=e.join(" ");ma.has(t)||(ma.add(t),console.error(`Base UI: ${t}`))}}const Kl=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Kl.displayName="CompositeRootContext");function w0(e=!1){const t=f.useContext(Kl);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.":ft(16));return t}function S0(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:s}=e,i=r&&t!==!1,a=r&&t===!1;return{props:f.useMemo(()=>{const u={onKeyDown(l){n&&t&&l.key!=="Tab"&&l.preventDefault()}};return r||(u.tabIndex=o,!s&&n&&(u.tabIndex=t?o:-1)),(s&&(t||i)||!s&&n)&&(u["aria-disabled"]=n),s&&(!t||a)&&(u.disabled=n),u},[r,n,t,i,a,s,o])}}function Lr(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0,composite:s}=e,i=f.useRef(null),a=w0(!0),c=s??a!==void 0,{props:u}=S0({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:o});process.env.NODE_ENV!=="production"&&f.useEffect(()=>{if(!i.current)return;const h=us(i.current);if(o){if(!h){const m=Dr.captureOwnerStack?.()||"";ar(`A component that acts as a button expected a native <button> because the \`nativeButton\` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the \`render\` prop, or set \`nativeButton\` to \`false\`.${m}`)}}else if(h){const m=Dr.captureOwnerStack?.()||"";ar(`A component that acts as a button expected a non-<button> because the \`nativeButton\` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as \`role\` or \`aria-disabled\`). Use a non-<button> in the \`render\` prop, or set \`nativeButton\` to \`true\`.${m}`)}},[o]);const l=f.useCallback(()=>{const h=i.current;us(h)&&c&&t&&u.disabled===void 0&&h.disabled&&(h.disabled=!1)},[t,u.disabled,c]);he(l,[l]);const d=f.useCallback((h={})=>{const{onClick:m,onMouseDown:g,onKeyUp:v,onKeyDown:y,onPointerDown:C,...S}=h;return En({type:o?"button":void 0,onClick(b){if(t){b.preventDefault();return}m?.(b)},onMouseDown(b){t||g?.(b)},onKeyDown(b){if(t||(as(b),y?.(b),b.baseUIHandlerPrevented))return;const x=b.target===b.currentTarget,T=b.currentTarget,P=us(T),$=!o&&E0(T),M=x&&(o?P:!$),V=b.key==="Enter",L=b.key===" ",D=T.getAttribute("role"),R=D?.startsWith("menuitem")||D==="option"||D==="gridcell";if(x&&c&&L){if(b.defaultPrevented&&R)return;b.preventDefault(),$||o&&P?(T.click(),b.preventBaseUIHandler()):M&&(m?.(b),b.preventBaseUIHandler());return}M&&(!o&&(L||V)&&b.preventDefault(),!o&&V&&m?.(b))},onKeyUp(b){if(!t){if(as(b),v?.(b),b.target===b.currentTarget&&o&&c&&us(b.currentTarget)&&b.key===" "){b.preventDefault();return}b.baseUIHandlerPrevented||b.target===b.currentTarget&&!o&&!c&&b.key===" "&&m?.(b)}},onPointerDown(b){if(t){b.preventDefault();return}C?.(b)}},o?void 0:{role:"button"},u,S)},[t,u,c,o]),p=ie(h=>{i.current=h,l()});return{getButtonProps:d,buttonRef:p}}function us(e){return it(e)&&e.tagName==="BUTTON"}function E0(e){return!!(e?.tagName==="A"&&e?.href)}function x0(e,t){return t!=null&&!fo(t)?0:typeof e=="function"?e():e}function ga(e,t,n){const r=x0(e,n);return typeof r=="number"?r:r?.[t]}function Jl(e){return typeof e=="function"?e():e}function Ql(e,t){return t||e==="click"||e==="mousedown"}const cr="none",Fr="trigger-press",Lt="trigger-hover",ya="outside-press",va="item-press",C0="close-press",ur="focus-out",ed="escape-key",T0="close-watcher",ba="list-navigation",O0="cancel-open",td="imperative-action",ls="swipe",P0="window-resize";function Ae(e,t,n,r){let o=!1,s=!1;const i=mt;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...i}}function _0(e,t,n){const r=mt;return{reason:e,event:t??new Event("base-ui"),...r}}function vt(e){const t=wt(I0,e).current;return t.next=e,he(t.effect),t}function I0(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function ds(e){return`data-base-ui-${e}`}let fs=0;function ps(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(fs);const s=()=>e?.focus({preventScroll:n});if(o)return s(),Ct;const i=requestAnimationFrame(s);return fs=i,()=>{fs===i&&(cancelAnimationFrame(i),fs=0)}}const wa={inert:new WeakMap,"aria-hidden":new WeakMap},nd="data-base-ui-inert",Sa={inert:new WeakSet,"aria-hidden":new WeakSet};let yo=new WeakMap,Ea=0;function k0(e){return Sa[e]}function rd(e){return e?kr(e)?e.host:rd(e.parentNode):null}const xa=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=rd(n);return e.contains(r)?r:null}).filter(n=>n!=null),od=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},sd=(e,t,n)=>{const r=[],o=s=>{!s||n.has(s)||Array.from(s.children).forEach(i=>{kt(i)!=="script"&&(t.has(i)?o(i):r.push(i))})};return o(e),r};function R0(e,t,n,r,{mark:o=!0,markerIgnoreElements:s=[]}){const i=r?"inert":n?"aria-hidden":null;let a=null,c=null;const u=xa(t,e),l=o?xa(t,s):[],d=new Set(l),p=o?sd(t,od(u),new Set(u)).filter(g=>!d.has(g)):[],h=[],m=[];if(i){const g=wa[i],v=k0(i);c=v,a=g;const y=xa(t,Array.from(t.querySelectorAll("[aria-live]"))),C=u.concat(y);sd(t,od(C),new Set(C)).forEach(E=>{const b=E.getAttribute(i),x=b!==null&&b!=="false",T=(g.get(E)||0)+1;g.set(E,T),h.push(E),T===1&&x&&v.add(E),x||E.setAttribute(i,i==="inert"?"":"true")})}return o&&p.forEach(g=>{const v=(yo.get(g)||0)+1;yo.set(g,v),m.push(g),v===1&&g.setAttribute(nd,"")}),Ea+=1,()=>{a&&h.forEach(g=>{const y=(a.get(g)||0)-1;a.set(g,y),y||(!c?.has(g)&&i&&g.removeAttribute(i),c?.delete(g))}),o&&m.forEach(g=>{const v=(yo.get(g)||0)-1;yo.set(g,v),v||g.removeAttribute(nd)}),Ea-=1,Ea||(wa.inert=new WeakMap,wa["aria-hidden"]=new WeakMap,Sa.inert=new WeakSet,Sa["aria-hidden"]=new WeakSet,yo=new WeakMap)}}function id(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:o=!0,markerIgnoreElements:s=[]}=t,i=Ie(e[0]).body;return R0(e,i,n,r,{mark:o,markerIgnoreElements:s})}const Ca=f.createContext(null);process.env.NODE_ENV!=="production"&&(Ca.displayName="PortalContext");const ad=()=>f.useContext(Ca),N0=ds("portal");function cd(e={}){const{ref:t,container:n,componentProps:r=mt,elementProps:o}=e,s=Xn(),a=ad()?.portalNode,[c,u]=f.useState(null),[l,d]=f.useState(null),p=ie(v=>{v!==null&&d(v)}),h=f.useRef(null);he(()=>{if(n===null){h.current&&(h.current=null,d(null),u(null));return}if(s==null)return;const v=(n&&(ji(n)?n:n.current))??a??document.body;if(v==null){h.current&&(h.current=null,d(null),u(null));return}h.current!==v&&(h.current=v,d(null),u(v))},[n,a,s]);const m=qe("div",r,{ref:[t,p],props:[{id:s,[N0]:""},o]});return{portalNode:l,portalSubtree:c&&m?Kt.createPortal(m,c):null}}const hs=f.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,renderGuards:a,style:c,...u}=t,{portalNode:l,portalSubtree:d}=cd({container:o,ref:n,componentProps:t,elementProps:u}),p=f.useRef(null),h=f.useRef(null),m=f.useRef(null),g=f.useRef(null),[v,y]=f.useState(null),C=f.useRef(!1),S=v?.modal,E=v?.open,b=typeof a=="boolean"?a:!!v&&!v.modal&&v.open&&!!l;f.useEffect(()=>{if(!l||S)return;function T(P){l&&P.relatedTarget&&Ar(P)&&(P.type==="focusin"?C.current&&(Rl(l),C.current=!1):(Db(l),C.current=!0))}return gn(Fe(l,"focusin",T,!0),Fe(l,"focusout",T,!0))},[l,S]),f.useEffect(()=>{!l||E!==!1||(Rl(l),C.current=!1)},[E,l]);const x=f.useMemo(()=>({beforeOutsideRef:p,afterOutsideRef:h,beforeInsideRef:m,afterInsideRef:g,portalNode:l,setFocusManagerState:y}),[l]);return w.jsxs(f.Fragment,{children:[d,w.jsxs(Ca.Provider,{value:x,children:[b&&l&&w.jsx(Sn,{"data-type":"outside",ref:p,onFocus:T=>{if(Ar(T,l))m.current?.focus();else{const P=v?v.domReference:null;Il(P)?.focus()}}}),b&&l&&w.jsx("span",{"aria-owns":l.id,style:p0}),l&&Kt.createPortal(r,l),b&&l&&w.jsx(Sn,{"data-type":"outside",ref:h,onFocus:T=>{if(Ar(T,l))g.current?.focus();else{const P=v?v.domReference:null;ca(P)?.focus(),v?.closeOnFocusOut&&v?.onOpenChange(!1,Ae(ur,T.nativeEvent))}}})]})]})});process.env.NODE_ENV!=="production"&&(hs.displayName="FloatingPortal");function ud(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class M0{nodesRef={current:[]};events=ud();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Ta=f.createContext(null);process.env.NODE_ENV!=="production"&&(Ta.displayName="FloatingNodeContext");const Oa=f.createContext(null);process.env.NODE_ENV!=="production"&&(Oa.displayName="FloatingTreeContext");const qn=()=>f.useContext(Ta)?.id||null,lr=e=>{const t=f.useContext(Oa);return e??t};function A0(e){const t=Xn(),n=lr(e),r=qn();return he(()=>{if(!t)return;const o={id:t,parentId:r};return n?.addNode(o),()=>{n?.removeNode(o)}},[n,t,r]),t}function D0(e){const{children:t,id:n}=e,r=qn();return w.jsx(Ta.Provider,{value:f.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function L0(e){const{children:t,externalTree:n}=e,r=wt(()=>n??new M0).current;return w.jsx(Oa.Provider,{value:r,children:t})}function F0(e,t){const n=tt(lt(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const ld=20;let Kn=[];function Pa(){Kn=Kn.filter(e=>e.deref()?.isConnected)}function V0(e){Pa(),e&&kt(e)!=="body"&&(Kn.push(new WeakRef(e)),Kn.length>ld&&(Kn=Kn.slice(-ld)))}function _a(){return Pa(),Kn[Kn.length-1]?.deref()}function z0(e){return e?aa(e)?e:ho(e)[0]||e:null}function dd(e,t){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const r=Pl(e).filter(s=>{const i=s.getAttribute("data-tabindex")||"";return aa(s)||s.hasAttribute("data-tabindex")&&!i.startsWith("-")}),o=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?o!=="0"&&e.setAttribute("tabindex","0"):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function ms(e){const{context:t,children:n,disabled:r=!1,initialFocus:o=!0,returnFocus:s=!0,restoreFocus:i=!1,modal:a=!0,closeOnFocusOut:c=!0,openInteractionType:u="",nextFocusableElement:l,previousFocusableElement:d,beforeContentFocusGuardRef:p,externalTree:h,getInsideElements:m}=e,g="rootStore"in t?t.rootStore:t,v=g.useState("open"),y=g.useState("domReferenceElement"),C=g.useState("floatingElement"),{events:S,dataRef:E}=g.context,b=ie(()=>E.current.floatingContext?.nodeId),x=o===!1,T=Ki(y)&&x,P=f.useRef(["content"]),$=vt(o),M=vt(s),V=vt(u),L=lr(h),D=ad(),R=f.useRef(!1),O=f.useRef(!1),I=f.useRef(!1),_=f.useRef(null),N=f.useRef(""),A=f.useRef(""),j=f.useRef(null),B=f.useRef(null),U=or(j,p,D?.beforeInsideRef),W=or(B,D?.afterInsideRef),G=Gt(),Z=Gt(),X=ao(),K=D!=null,J=lo(C),se=ie((Y=J)=>Y?ho(Y):[]),ae=ie(()=>m?.().filter(Y=>Y!=null)??[]);f.useEffect(()=>{if(r||!a)return;function Y(ge){ge.key==="Tab"&&we(J,Pt(Ie(J)))&&se().length===0&&!T&&Yt(ge)}const me=Ie(J);return Fe(me,"keydown",Y)},[r,y,J,a,P,T,se]),f.useEffect(()=>{if(r||!v)return;const Y=Ie(J);function me(){I.current=!1}function ge(le){const ce=lt(le),ve=ae(),ue=we(C,ce)||we(y,ce)||we(D?.portalNode,ce)||ve.some(Se=>Se===ce||we(Se,ce));I.current=!ue,A.current=le.pointerType||"keyboard",ce?.closest(`[${ha}]`)&&(O.current=!0)}function fe(){A.current="keyboard"}return gn(Fe(Y,"pointerdown",ge,!0),Fe(Y,"pointerup",me,!0),Fe(Y,"pointercancel",me,!0),Fe(Y,"keydown",fe,!0))},[r,C,y,J,v,D,ae]),f.useEffect(()=>{if(r||!c)return;const Y=Ie(J);function me(){O.current=!0,Z.start(0,()=>{O.current=!1})}function ge(ve){const ue=lt(ve);aa(ue)&&(_.current=ue)}function fe(ve){const ue=ve.relatedTarget,Se=ve.currentTarget,k=lt(ve);queueMicrotask(()=>{const H=b(),F=g.context.triggerElements,z=ae(),Q=ue?.hasAttribute(ds("focus-guard"))&&[j.current,B.current,D?.beforeInsideRef.current,D?.afterInsideRef.current,D?.beforeOutsideRef.current,D?.afterOutsideRef.current,An(d),An(l)].includes(ue),ne=!(we(y,ue)||we(C,ue)||we(ue,C)||we(D?.portalNode,ue)||z.some(te=>te===ue||we(te,ue))||ue!=null&&F.hasElement(ue)||F.hasMatchingElement(te=>we(te,ue))||Q||L&&(vn(L.nodesRef.current,H).find(te=>we(te.context?.elements.floating,ue)||we(te.context?.elements.domReference,ue))||pl(L.nodesRef.current,H).find(te=>[te.context?.elements.floating,lo(te.context?.elements.floating)].includes(ue)||te.context?.elements.domReference===ue)));if(Se===y&&J&&dd(J,P),i&&Se!==y&&!rs(k)&&Pt(Y)===Y.body){if(it(J)&&(J.focus(),i==="popup")){X.request(()=>{J.focus()});return}const te=se(),ye=_.current,_e=(ye&&te.includes(ye)?ye:null)||te[te.length-1]||J;it(_e)&&_e.focus()}if(E.current.insideReactTree){E.current.insideReactTree=!1;return}(T||!a)&&ue&&ne&&!O.current&&(T||ue!==_a())&&(R.current=!0,g.setOpen(!1,Ae(ur,ve)))})}function le(){I.current||(E.current.insideReactTree=!0,G.start(0,()=>{E.current.insideReactTree=!1}))}const ce=it(y)?y:null;if(!(!C&&!ce))return gn(ce&&Fe(ce,"focusout",fe),ce&&Fe(ce,"pointerdown",me),C&&Fe(C,"focusin",ge),C&&Fe(C,"focusout",fe),C&&D&&Fe(C,"focusout",le,!0))},[r,y,C,J,a,L,D,g,c,i,se,T,b,P,E,G,Z,X,l,d,ae]),f.useEffect(()=>{if(r||!C||!v)return;const Y=Array.from(D?.portalNode?.querySelectorAll(`[${ds("portal")}]`)||[]),ge=(L?pl(L.nodesRef.current,b()):[]).find(Se=>Ki(Se.context?.elements.domReference||null))?.context?.elements.domReference,le=[...[C,...Y,j.current,B.current,D?.beforeOutsideRef.current,D?.afterOutsideRef.current,...ae()],ge,An(d),An(l),T?y:null].filter(Se=>Se!=null),ce=id(le,{ariaHidden:a||T,mark:!1}),ve=[C,...Y].filter(Se=>Se!=null),ue=id(ve);return()=>{ue(),ce()}},[v,r,y,C,a,P,D,T,L,b,l,d,ae]),he(()=>{if(!v||r||!it(J))return;const Y=Ie(J),me=Pt(Y);queueMicrotask(()=>{const ge=$.current,fe=typeof ge=="function"?ge(V.current||""):ge;if(fe===void 0||fe===!1||we(J,me))return;let ce=null;const ve=()=>(ce==null&&(ce=se(J)),ce[0]||J);let ue;fe===!0||fe===null?ue=ve():ue=An(fe),ue=ue||ve(),ps(ue,{preventScroll:ue===J})})},[r,v,J,x,se,$,V]),he(()=>{if(r||!J)return;const Y=Ie(J),me=Pt(Y);V0(me);function ge(le){if(le.open||(N.current=F0(le.nativeEvent,A.current)),le.reason===Lt&&le.nativeEvent.type==="mouseleave"&&(R.current=!0),le.reason===ya)if(le.nested)R.current=!1;else if(hl(le.nativeEvent)||ml(le.nativeEvent))R.current=!1;else{let ce=!1;Ie(J).createElement("div").focus({get preventScroll(){return ce=!0,!1}}),ce?R.current=!1:R.current=!0}}S.on("openchange",ge);function fe(){const le=M.current;let ce=typeof le=="function"?le(N.current):le;if(ce===void 0||ce===!1)return null;if(ce===null&&(ce=!0),typeof ce=="boolean"){const ue=y||_a();return ue&&ue.isConnected?ue:null}const ve=y||_a();return An(ce)||ve||null}return()=>{S.off("openchange",ge);const le=Pt(Y),ce=ae(),ve=we(C,le)||ce.some(k=>k===le||we(k,le))||L&&vn(L.nodesRef.current,b(),!1).some(k=>we(k.context?.elements.floating,le)),ue=M.current,Se=fe();queueMicrotask(()=>{const k=z0(Se),H=typeof ue!="boolean";ue&&!R.current&&it(k)&&(!(!H&&k!==le&&le!==Y.body)||ve)&&k.focus({preventScroll:!0}),R.current=!1})}},[r,C,J,M,E,S,L,y,b,ae]),he(()=>{if(!Gi||v||!C)return;const Y=Pt(Ie(C));!it(Y)||!qi(Y)||we(C,Y)&&Y.blur()},[v,C]),he(()=>{if(!(r||!D))return D.setFocusManagerState({modal:a,closeOnFocusOut:c,open:v,onOpenChange:g.setOpen,domReference:y}),()=>{D.setFocusManagerState(null)}},[r,D,a,v,g,c,y]),he(()=>{if(!(r||!J))return dd(J,P),()=>{queueMicrotask(Pa)}},[r,J,P]);const pe=!r&&(a?!T:!0)&&(K||a);return w.jsxs(f.Fragment,{children:[pe&&w.jsx(Sn,{"data-type":"inside",ref:U,onFocus:Y=>{if(a){const me=se();ps(me[me.length-1])}else D?.portalNode&&(R.current=!1,Ar(Y,D.portalNode)?ca(y)?.focus():An(d??D.beforeOutsideRef)?.focus())}}),n,pe&&w.jsx(Sn,{"data-type":"inside",ref:W,onFocus:Y=>{a?ps(se()[0]):D?.portalNode&&(c&&(R.current=!0),Ar(Y,D.portalNode)?Il(y)?.focus():An(l??D.afterOutsideRef)?.focus())}})]})}function Ia(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:o=!0,event:s="click",toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:c=!0,touchOpenDelay:u=0,reason:l=Fr}=t,d=f.useRef(void 0),p=ao(),h=Gt(),m=f.useMemo(()=>({onPointerDown(g){d.current=g.pointerType},onMouseDown(g){const v=d.current,y=g.nativeEvent,C=n.select("open");if(g.button!==0||s==="click"||fo(v,!0)&&a)return;const S=r.current.openEvent,E=S?.type,b=n.select("domReferenceElement")!==g.currentTarget,x=C&&b||!(C&&i&&(!(S&&c)||E==="click"||E==="mousedown")),T=lt(y);if(qi(T)){const $=Ae(l,y,T);x&&v==="touch"&&u>0?h.start(u,()=>{n.setOpen(!0,$)}):n.setOpen(x,$);return}const P=g.currentTarget;p.request(()=>{const $=Ae(l,y,P);x&&v==="touch"&&u>0?h.start(u,()=>{n.setOpen(!0,$)}):n.setOpen(x,$)})},onClick(g){if(s==="mousedown-only")return;const v=d.current;if(s==="mousedown"&&v){d.current=void 0;return}if(fo(v,!0)&&a)return;const y=n.select("open"),C=r.current.openEvent,S=n.select("domReferenceElement")!==g.currentTarget,E=y&&S||!(y&&i&&(!(C&&c)||gl(C))),b=Ae(l,g.nativeEvent,g.currentTarget);E&&v==="touch"&&u>0?h.start(u,()=>{n.setOpen(!0,b)}):n.setOpen(E,b)},onKeyDown(){d.current=void 0}}),[r,s,a,n,c,i,p,h,u,l]);return f.useMemo(()=>o?{reference:m}:mt,[o,m])}const $0={intentional:"onClick",sloppy:"onPointerDown"};function j0(){return!1}function H0(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function ka(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),{dataRef:s}=n.context,{enabled:i=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:u="sloppy",referencePress:l=j0,referencePressEvent:d="sloppy",bubbles:p,externalTree:h}=t,m=lr(h),g=ie(typeof c=="function"?c:()=>!1),v=typeof c=="function"?g:c,y=v!==!1,C=ie(()=>u),S=f.useRef(!1),E=f.useRef(!1),b=f.useRef(!1),{escapeKey:x,outsidePress:T}=H0(p),P=f.useRef(null),$=Gt(),M=Gt(),V=ie(()=>{M.clear(),s.current.insideReactTree=!1}),L=f.useRef(!1),D=f.useRef(""),R=ie(l),O=ie(B=>{if(!r||!i||!a||B.key!=="Escape"||L.current)return;const U=s.current.floatingContext?.nodeId,W=m?vn(m.nodesRef.current,U):[];if(!x&&W.length>0){let X=!0;if(W.forEach(K=>{K.context?.open&&!K.context.dataRef.current.__escapeKeyBubbles&&(X=!1)}),!X)return}const G=pb(B)?B.nativeEvent:B,Z=Ae(ed,G);n.setOpen(!1,Z),!x&&!Z.isPropagationAllowed&&B.stopPropagation()}),I=ie(()=>{s.current.insideReactTree=!0,M.start(0,V)});f.useEffect(()=>{if(!r||!i)return;s.current.__escapeKeyBubbles=x,s.current.__outsidePressBubbles=T;const B=new Zt,U=new Zt;function W(){B.clear(),L.current=!0}function G(){B.start(Yo()?5:0,()=>{L.current=!1})}function Z(){b.current=!0,U.start(0,()=>{b.current=!1})}function X(){S.current=!1,E.current=!1}function K(){const F=D.current,z=F==="pen"||!F?"mouse":F,Q=C(),ne=typeof Q=="function"?Q():Q;return typeof ne=="string"?ne:ne[z]}function J(F){const z=K();return z==="intentional"&&F.type!=="click"||z==="sloppy"&&F.type==="click"}function se(F){const z=s.current.floatingContext?.nodeId,Q=m&&vn(m.nodesRef.current,z).some(ne=>un(F,ne.context?.elements.floating));return un(F,n.select("floatingElement"))||un(F,n.select("domReferenceElement"))||Q}function ae(F){if(J(F)){V();return}if(s.current.insideReactTree){V();return}const z=lt(F),Q=`[${ds("inert")}]`,ne=$e(z)?z.getRootNode():null,te=Array.from((kr(ne)?ne:Ie(n.select("floatingElement"))).querySelectorAll(Q)),ye=n.context.triggerElements;if(z&&(ye.hasElement(z)||ye.hasMatchingElement(Pe=>we(Pe,z))))return;let _e=$e(z)?z:null;for(;_e&&!Rn(_e);){const Pe=Nn(_e);if(Rn(Pe)||!$e(Pe))break;_e=Pe}if(te.length&&$e(z)&&!db(z)&&!we(z,n.select("floatingElement"))&&te.every(Pe=>!we(_e,Pe)))return;if(it(z)&&!("touches"in F)){const Pe=Rn(z),Ve=At(z),Ge=/auto|scroll/,He=Pe||Ge.test(Ve.overflowX),nt=Pe||Ge.test(Ve.overflowY),st=He&&z.clientWidth>0&&z.scrollWidth>z.clientWidth,Re=nt&&z.clientHeight>0&&z.scrollHeight>z.clientHeight,Te=Ve.direction==="rtl",Ue=Re&&(Te?F.offsetX<=z.offsetWidth-z.clientWidth:F.offsetX>z.clientWidth),Be=st&&F.offsetY>z.clientHeight;if(Ue||Be)return}if(se(F))return;if(K()==="intentional"&&b.current){U.clear(),b.current=!1;return}if(typeof v=="function"&&!v(F))return;const Ee=s.current.floatingContext?.nodeId,Ce=m?vn(m.nodesRef.current,Ee):[];if(Ce.length>0){let Pe=!0;if(Ce.forEach(Ve=>{Ve.context?.open&&!Ve.context.dataRef.current.__outsidePressBubbles&&(Pe=!1)}),!Pe)return}n.setOpen(!1,Ae(ya,F)),V()}function pe(F){K()!=="sloppy"||F.pointerType==="touch"||!n.select("open")||!i||un(F,n.select("floatingElement"))||un(F,n.select("domReferenceElement"))||ae(F)}function Y(F){if(K()!=="sloppy"||!n.select("open")||!i||un(F,n.select("floatingElement"))||un(F,n.select("domReferenceElement")))return;const z=F.touches[0];z&&(P.current={startTime:Date.now(),startX:z.clientX,startY:z.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},$.start(1e3,()=>{P.current&&(P.current.dismissOnTouchEnd=!1,P.current.dismissOnMouseDown=!1)}))}function me(F,z){const Q=lt(F);if(!Q)return;const ne=Fe(Q,F.type,()=>{z(F),ne()})}function ge(F){D.current="touch",me(F,Y)}function fe(F){$.clear(),F.type==="pointerdown"&&(D.current=F.pointerType),!(F.type==="mousedown"&&P.current&&!P.current.dismissOnMouseDown)&&me(F,z=>{z.type==="pointerdown"?pe(z):ae(z)})}function le(F){if(!S.current)return;const z=E.current;if(X(),K()==="intentional"){if(F.type==="pointercancel"){z&&Z();return}if(!se(F)){if(z){Z();return}typeof v=="function"&&!v(F)||(U.clear(),b.current=!0,V())}}}function ce(F){if(K()!=="sloppy"||!P.current||un(F,n.select("floatingElement"))||un(F,n.select("domReferenceElement")))return;const z=F.touches[0];if(!z)return;const Q=Math.abs(z.clientX-P.current.startX),ne=Math.abs(z.clientY-P.current.startY),te=Math.sqrt(Q*Q+ne*ne);te>5&&(P.current.dismissOnTouchEnd=!0),te>10&&(ae(F),$.clear(),P.current=null)}function ve(F){me(F,ce)}function ue(F){K()!=="sloppy"||!P.current||un(F,n.select("floatingElement"))||un(F,n.select("domReferenceElement"))||(P.current.dismissOnTouchEnd&&ae(F),$.clear(),P.current=null)}function Se(F){me(F,ue)}const k=Ie(o),H=gn(a&&gn(Fe(k,"keydown",O),Fe(k,"compositionstart",W),Fe(k,"compositionend",G)),y&&gn(Fe(k,"click",fe,!0),Fe(k,"pointerdown",fe,!0),Fe(k,"pointerup",le,!0),Fe(k,"pointercancel",le,!0),Fe(k,"mousedown",fe,!0),Fe(k,"mouseup",le,!0),Fe(k,"touchstart",ge,!0),Fe(k,"touchmove",ve,!0),Fe(k,"touchend",Se,!0)));return()=>{H(),B.clear(),U.clear(),X(),b.current=!1}},[s,o,a,y,v,r,i,x,T,O,V,C,m,n,$]),f.useEffect(V,[v,V]);const _=f.useMemo(()=>({onKeyDown:O,[$0[d]]:B=>{R()&&n.setOpen(!1,Ae(Fr,B.nativeEvent))},...d!=="intentional"&&{onClick(B){R()&&n.setOpen(!1,Ae(Fr,B.nativeEvent))}}}),[O,n,d,R]),N=ie(B=>{if(!r||!i||B.button!==0)return;const U=lt(B.nativeEvent);we(n.select("floatingElement"),U)&&(S.current||(S.current=!0,E.current=!1))}),A=ie(B=>{!r||!i||(B.defaultPrevented||B.nativeEvent.defaultPrevented)&&S.current&&(E.current=!0)}),j=f.useMemo(()=>({onKeyDown:O,onPointerDown:A,onMouseDown:A,onClickCapture:I,onMouseDownCapture(B){I(),N(B)},onPointerDownCapture(B){I(),N(B)},onMouseUpCapture:I,onTouchEndCapture:I,onTouchMoveCapture:I}),[O,I,N,A]);return f.useMemo(()=>i?{reference:_,floating:j,trigger:_}:{},[i,_,j])}function fd(e,t,n){let{reference:r,floating:o}=e;const s=en(t),i=na(t),a=ta(i),c=jt(t),u=s==="y",l=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let h;switch(c){case"top":h={x:l,y:r.y-o.height};break;case"bottom":h={x:l,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(Gn(t)){case"start":h[i]-=p*(n&&u?-1:1);break;case"end":h[i]+=p*(n&&u?-1:1);break}return h}async function U0(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:d="floating",altBoundary:p=!1,padding:h=0}=Mn(t,e),m=bl(h),v=a[p?d==="floating"?"reference":"floating":d],y=po(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:l,strategy:c})),C=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),E=await(s.isElement==null?void 0:s.isElement(S))?await(s.getScale==null?void 0:s.getScale(S))||{x:1,y:1}:{x:1,y:1},b=po(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:C,offsetParent:S,strategy:c}):C);return{top:(y.top-b.top+m.top)/E.y,bottom:(b.bottom-y.bottom+m.bottom)/E.y,left:(y.left-b.left+m.left)/E.x,right:(b.right-y.right+m.right)/E.x}}const B0=50,W0=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:U0},c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:d}=fd(u,r,c),p=r,h=0;const m={};for(let g=0;g<s.length;g++){const v=s[g];if(!v)continue;const{name:y,fn:C}=v,{x:S,y:E,data:b,reset:x}=await C({x:l,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:m,rects:u,platform:a,elements:{reference:e,floating:t}});l=S??l,d=E??d,m[y]={...m[y],...b},x&&h<B0&&(h++,typeof x=="object"&&(x.placement&&(p=x.placement),x.rects&&(u=x.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):x.rects),{x:l,y:d}=fd(u,p,c)),g=-1)}return{x:l,y:d,placement:p,strategy:o,middlewareData:m}},Z0=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:l=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...v}=Mn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=jt(o),C=en(a),S=jt(a)===a,E=await(c.isRTL==null?void 0:c.isRTL(u.floating)),b=p||(S||!g?[es(a)]:yb(a)),x=m!=="none";!p&&x&&b.push(...Sb(a,g,m,E));const T=[a,...b],P=await c.detectOverflow(t,v),$=[];let M=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&$.push(P[y]),d){const R=gb(o,i,E);$.push(P[R[0]],P[R[1]])}if(M=[...M,{placement:o,overflows:$}],!$.every(R=>R<=0)){var V,L;const R=(((V=s.flip)==null?void 0:V.index)||0)+1,O=T[R];if(O&&(!(d==="alignment"?C!==en(O):!1)||M.every(N=>en(N.placement)===C?N.overflows[0]>0:!0)))return{data:{index:R,overflows:M},reset:{placement:O}};let I=(L=M.filter(_=>_.overflows[0]<=0).sort((_,N)=>_.overflows[1]-N.overflows[1])[0])==null?void 0:L.placement;if(!I)switch(h){case"bestFit":{var D;const _=(D=M.filter(N=>{if(x){const A=en(N.placement);return A===C||A==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(A=>A>0).reduce((A,j)=>A+j,0)]).sort((N,A)=>N[1]-A[1])[0])==null?void 0:D[0];_&&(I=_);break}case"initialPlacement":I=a;break}if(o!==I)return{reset:{placement:I}}}return{}}}};function pd(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function hd(e){return hb.some(t=>e[t]>=0)}const G0=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=Mn(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=pd(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:hd(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),a=pd(i,n.floating);return{data:{escapedOffsets:a,escaped:hd(a)}}}default:return{}}}}},md=new Set(["left","top"]);async function Y0(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=jt(n),a=Gn(n),c=en(n)==="y",u=md.has(i)?-1:1,l=s&&c?-1:1,d=Mn(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(h=a==="end"?m*-1:m),c?{x:h*l,y:p*u}:{x:p*u,y:h*l}}const X0=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,c=await Y0(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},q0=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:c={fn:y=>{let{x:C,y:S}=y;return{x:C,y:S}}},...u}=Mn(e,t),l={x:n,y:r},d=await s.detectOverflow(t,u),p=en(jt(o)),h=ea(p);let m=l[h],g=l[p];if(i){const y=h==="y"?"top":"left",C=h==="y"?"bottom":"right",S=m+d[y],E=m-d[C];m=Qi(S,m,E)}if(a){const y=p==="y"?"top":"left",C=p==="y"?"bottom":"right",S=g+d[y],E=g-d[C];g=Qi(S,g,E)}const v=c.fn({...t,[h]:m,[p]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:i,[p]:a}}}}}},K0=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Mn(e,t),l={x:n,y:r},d=en(o),p=ea(d);let h=l[p],m=l[d];const g=Mn(a,t),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const S=p==="y"?"height":"width",E=s.reference[p]-s.floating[S]+v.mainAxis,b=s.reference[p]+s.reference[S]-v.mainAxis;h<E?h=E:h>b&&(h=b)}if(u){var y,C;const S=p==="y"?"width":"height",E=md.has(jt(o)),b=s.reference[d]-s.floating[S]+(E&&((y=i.offset)==null?void 0:y[d])||0)+(E?0:v.crossAxis),x=s.reference[d]+s.reference[S]+(E?0:((C=i.offset)==null?void 0:C[d])||0)-(E?v.crossAxis:0);m<b?m=b:m>x&&(m=x)}return{[p]:h,[d]:m}}}},J0=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:c=()=>{},...u}=Mn(e,t),l=await i.detectOverflow(t,u),d=jt(o),p=Gn(o),h=en(o)==="y",{width:m,height:g}=s.floating;let v,y;d==="top"||d==="bottom"?(v=d,y=p===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,v=p==="end"?"top":"bottom");const C=g-l.top-l.bottom,S=m-l.left-l.right,E=Nr(g-l[v],C),b=Nr(m-l[y],S),x=!t.middlewareData.shift;let T=E,P=b;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=C),x&&!p){const M=Xt(l.left,0),V=Xt(l.right,0),L=Xt(l.top,0),D=Xt(l.bottom,0);h?P=m-2*(M!==0||V!==0?M+V:Xt(l.left,l.right)):T=g-2*(L!==0||D!==0?L+D:Xt(l.top,l.bottom))}await c({...t,availableWidth:P,availableHeight:T});const $=await i.getDimensions(a.floating);return m!==$.width||g!==$.height?{reset:{rects:!0}}:{}}}};function gd(e){const t=At(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=it(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Qo(n)!==s||Qo(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function Ra(e){return $e(e)?e:e.contextElement}function Vr(e){const t=Ra(e);if(!it(t))return bn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=gd(t);let i=(s?Qo(n.width):n.width)/r,a=(s?Qo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Q0=bn(0);function yd(e){const t=tt(e);return!Yo()||!t.visualViewport?Q0:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ew(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==tt(e)?!1:t}function dr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ra(e);let i=bn(1);t&&(r?$e(r)&&(i=Vr(r)):i=Vr(e));const a=ew(s,n,r)?yd(s):bn(0);let c=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,l=o.width/i.x,d=o.height/i.y;if(s){const p=tt(s),h=r&&$e(r)?tt(r):r;let m=p,g=Bi(m);for(;g&&r&&h!==m;){const v=Vr(g),y=g.getBoundingClientRect(),C=At(g),S=y.left+(g.clientLeft+parseFloat(C.paddingLeft))*v.x,E=y.top+(g.clientTop+parseFloat(C.paddingTop))*v.y;c*=v.x,u*=v.y,l*=v.x,d*=v.y,c+=S,u+=E,m=tt(g),g=Bi(m)}}return po({width:l,height:d,x:c,y:u})}function gs(e,t){const n=Xo(e).scrollLeft;return t?t.left+n:dr(mn(e)).left+n}function vd(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-gs(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function tw(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=mn(r),a=t?Go(t.floating):!1;if(r===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},u=bn(1);const l=bn(0),d=it(r);if((d||!d&&!s)&&((kt(r)!=="body"||Bn(i))&&(c=Xo(r)),d)){const h=dr(r);u=Vr(r),l.x=h.x+r.clientLeft,l.y=h.y+r.clientTop}const p=i&&!d&&!s?vd(i,c):bn(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+l.x+p.x,y:n.y*u.y-c.scrollTop*u.y+l.y+p.y}}function nw(e){return Array.from(e.getClientRects())}function rw(e){const t=mn(e),n=Xo(e),r=e.ownerDocument.body,o=Xt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Xt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+gs(e);const a=-n.scrollTop;return At(r).direction==="rtl"&&(i+=Xt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const bd=25;function ow(e,t){const n=tt(e),r=mn(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,c=0;if(o){s=o.width,i=o.height;const l=Yo();(!l||l&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}const u=gs(r);if(u<=0){const l=r.ownerDocument,d=l.body,p=getComputedStyle(d),h=l.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,m=Math.abs(r.clientWidth-d.clientWidth-h);m<=bd&&(s-=m)}else u<=bd&&(s+=u);return{width:s,height:i,x:a,y:c}}function sw(e,t){const n=dr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=it(e)?Vr(e):bn(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:a,x:c,y:u}}function wd(e,t,n){let r;if(t==="viewport")r=ow(e,n);else if(t==="document")r=rw(mn(e));else if($e(t))r=sw(t,n);else{const o=yd(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return po(r)}function Sd(e,t){const n=Nn(e);return n===t||!$e(n)||Rn(n)?!1:At(n).position==="fixed"||Sd(n,t)}function iw(e,t){const n=t.get(e);if(n)return n;let r=io(e,[],!1).filter(a=>$e(a)&&kt(a)!=="body"),o=null;const s=At(e).position==="fixed";let i=s?Nn(e):e;for(;$e(i)&&!Rn(i);){const a=At(i),c=Ui(i);!c&&a.position==="fixed"&&(o=null),(s?!c&&!o:!c&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Bn(i)&&!c&&Sd(e,i))?r=r.filter(l=>l!==i):o=a,i=Nn(i)}return t.set(e,r),r}function aw(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Go(t)?[]:iw(t,this._c):[].concat(n),r],a=wd(t,i[0],o);let c=a.top,u=a.right,l=a.bottom,d=a.left;for(let p=1;p<i.length;p++){const h=wd(t,i[p],o);c=Xt(h.top,c),u=Nr(h.right,u),l=Nr(h.bottom,l),d=Xt(h.left,d)}return{width:u-d,height:l-c,x:d,y:c}}function cw(e){const{width:t,height:n}=gd(e);return{width:t,height:n}}function uw(e,t,n){const r=it(t),o=mn(t),s=n==="fixed",i=dr(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=bn(0);function u(){c.x=gs(o)}if(r||!r&&!s)if((kt(t)!=="body"||Bn(o))&&(a=Xo(t)),r){const h=dr(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else o&&u();s&&!r&&o&&u();const l=o&&!r&&!s?vd(o,a):bn(0),d=i.left+a.scrollLeft-c.x-l.x,p=i.top+a.scrollTop-c.y-l.y;return{x:d,y:p,width:i.width,height:i.height}}function Na(e){return At(e).position==="static"}function Ed(e,t){if(!it(e)||At(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return mn(e)===n&&(n=n.ownerDocument.body),n}function xd(e,t){const n=tt(e);if(Go(e))return n;if(!it(e)){let o=Nn(e);for(;o&&!Rn(o);){if($e(o)&&!Na(o))return o;o=Nn(o)}return n}let r=Ed(e,t);for(;r&&tb(r)&&Na(r);)r=Ed(r,t);return r&&Rn(r)&&Na(r)&&!Ui(r)?n:r||ob(e)||n}const lw=async function(e){const t=this.getOffsetParent||xd,n=this.getDimensions,r=await n(e.floating);return{reference:uw(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function dw(e){return At(e).direction==="rtl"}const Cd={convertOffsetParentRelativeRectToViewportRelativeRect:tw,getDocumentElement:mn,getClippingRect:aw,getOffsetParent:xd,getElementRects:lw,getClientRects:nw,getDimensions:cw,getScale:Vr,isElement:$e,isRTL:dw};function Td(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function fw(e,t){let n=null,r;const o=mn(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const u=e.getBoundingClientRect(),{left:l,top:d,width:p,height:h}=u;if(a||t(),!p||!h)return;const m=rr(d),g=rr(o.clientWidth-(l+p)),v=rr(o.clientHeight-(d+h)),y=rr(l),S={rootMargin:-m+"px "+-g+"px "+-v+"px "+-y+"px",threshold:Xt(0,Nr(1,c))||1};let E=!0;function b(x){const T=x[0].intersectionRatio;if(T!==c){if(!E)return i();T?i(!1,T):r=setTimeout(()=>{i(!1,1e-7)},1e3)}T===1&&!Td(u,e.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(b,{...S,root:o.ownerDocument})}catch{n=new IntersectionObserver(b,S)}n.observe(e)}return i(!0),s}function Od(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Ra(e),l=o||s?[...u?io(u):[],...t?io(t):[]]:[];l.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const d=u&&a?fw(u,n):null;let p=-1,h=null;i&&(h=new ResizeObserver(y=>{let[C]=y;C&&C.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var S;(S=h)==null||S.observe(t)})),n()}),u&&!c&&h.observe(u),t&&h.observe(t));let m,g=c?dr(e):null;c&&v();function v(){const y=dr(e);g&&!Td(g,y)&&n(),g=y,m=requestAnimationFrame(v)}return n(),()=>{var y;l.forEach(C=>{o&&C.removeEventListener("scroll",n),s&&C.removeEventListener("resize",n)}),d?.(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(m)}}const pw=X0,hw=q0,mw=Z0,gw=J0,yw=G0,vw=K0,bw=(e,t,n)=>{const r=new Map,o={platform:Cd,...n},s={...o.platform,_c:r};return W0(e,t,{...o,platform:s})};var ww=typeof document<"u",Sw=function(){},ys=ww?oe.useLayoutEffect:Sw;function vs(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!vs(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!vs(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Pd(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function _d(e,t){const n=Pd(e);return Math.round(t*n)/n}function Ma(e){const t=f.useRef(e);return ys(()=>{t.current=e}),t}function Ew(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[l,d]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=f.useState(r);vs(p,r)||h(r);const[m,g]=f.useState(null),[v,y]=f.useState(null),C=f.useCallback(N=>{N!==x.current&&(x.current=N,g(N))},[]),S=f.useCallback(N=>{N!==T.current&&(T.current=N,y(N))},[]),E=s||m,b=i||v,x=f.useRef(null),T=f.useRef(null),P=f.useRef(l),$=c!=null,M=Ma(c),V=Ma(o),L=Ma(u),D=f.useCallback(()=>{if(!x.current||!T.current)return;const N={placement:t,strategy:n,middleware:p};V.current&&(N.platform=V.current),bw(x.current,T.current,N).then(A=>{const j={...A,isPositioned:L.current!==!1};R.current&&!vs(P.current,j)&&(P.current=j,Kt.flushSync(()=>{d(j)}))})},[p,t,n,V,L]);ys(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,d(N=>({...N,isPositioned:!1})))},[u]);const R=f.useRef(!1);ys(()=>(R.current=!0,()=>{R.current=!1}),[]),ys(()=>{if(E&&(x.current=E),b&&(T.current=b),E&&b){if(M.current)return M.current(E,b,D);D()}},[E,b,D,M,$]);const O=f.useMemo(()=>({reference:x,floating:T,setReference:C,setFloating:S}),[C,S]),I=f.useMemo(()=>({reference:E,floating:b}),[E,b]),_=f.useMemo(()=>{const N={position:n,left:0,top:0};if(!I.floating)return N;const A=_d(I.floating,l.x),j=_d(I.floating,l.y);return a?{...N,transform:"translate("+A+"px, "+j+"px)",...Pd(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:A,top:j}},[n,a,I.floating,l.x,l.y]);return f.useMemo(()=>({...l,update:D,refs:O,elements:I,floatingStyles:_}),[l,D,O,I,_])}const xw=(e,t)=>{const n=pw(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cw=(e,t)=>{const n=hw(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tw=(e,t)=>({fn:vw(e).fn,options:[e,t]}),Ow=(e,t)=>{const n=mw(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pw=(e,t)=>{const n=gw(e);return{name:n.name,fn:n.fn,options:[e,t]}},_w=(e,t)=>{const n=yw(e);return{name:n.name,fn:n.fn,options:[e,t]}},Iw={open:de(e=>e.open),transitionStatus:de(e=>e.transitionStatus),domReferenceElement:de(e=>e.domReferenceElement),referenceElement:de(e=>e.positionReference??e.referenceElement),floatingElement:de(e=>e.floatingElement),floatingId:de(e=>e.floatingId)};class Aa extends Wo{constructor(t){const{syncOnly:n,nested:r,onOpenChange:o,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:ud(),nested:r,triggerElements:s},Iw),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&gl(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function vo(e,t=!1,n=!1){const[r,o]=f.useState(e&&t?"idle":void 0),[s,i]=f.useState(e);return e&&!s&&(i(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),he(()=>{if(!e&&s&&r!=="ending"&&n){const a=yn.request(()=>{o("ending")});return()=>{yn.cancel(a)}}},[e,s,r,n]),he(()=>{if(!e||t)return;const a=yn.request(()=>{o(void 0)});return()=>{yn.cancel(a)}},[t,e]),he(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const a=yn.request(()=>{o("idle")});return()=>{yn.cancel(a)}},[t,e,s,r]),{mounted:s,setMounted:i,transitionStatus:r}}function kw(e,t){const n=f.useRef(null),r=f.useRef(null);return f.useCallback(o=>{if(e!==void 0){if(n.current!==null){const s=n.current,i=r.current,a=t.context.triggerElements.getById(s);i&&a===i&&t.context.triggerElements.delete(s),n.current=null,r.current=null}o!==null&&(n.current=e,r.current=o,t.context.triggerElements.add(e,o))}},[t,e])}function Id(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=kw(e,n),i=ie(a=>{if(s(a),!a||!n.select("open"))return;const c=n.select("activeTriggerId");if(c===e){n.update({activeTriggerElement:a,...r});return}c==null&&n.update({activeTriggerId:e,activeTriggerElement:a,...r})});return he(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:o}}function kd(e){const t=e.useState("open");he(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[r,o]=n.value;e.update({activeTriggerId:r,activeTriggerElement:o})}}},[t,e])}function Rd(e,t,n){const{mounted:r,setMounted:o,transitionStatus:s}=vo(e);t.useSyncedValues({mounted:r,transitionStatus:s});const i=ie(()=>{o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),a=t.useState("preventUnmountingOnClose");return xn({enabled:!a,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:s}}class bs{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);if(r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(t,n),process.env.NODE_ENV!=="production"&&this.elementsSet.size!==this.idMap.size))throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.")}delete(t){const n=this.idMap.get(t);n&&(this.elementsSet.delete(n),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const n of this.elementsSet)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function Rw(){return new Aa({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new bs,floatingId:"",syncOnly:!1,nested:!1,onOpenChange:void 0})}function Nd(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Rw(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:mt,inactiveTriggerProps:mt,popupProps:mt}}const ws=de(e=>e.triggerIdProp??e.activeTriggerId),Md={open:de(e=>e.openProp??e.open),mounted:de(e=>e.mounted),transitionStatus:de(e=>e.transitionStatus),floatingRootContext:de(e=>e.floatingRootContext),preventUnmountingOnClose:de(e=>e.preventUnmountingOnClose),payload:de(e=>e.payload),activeTriggerId:ws,activeTriggerElement:de(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:de((e,t)=>t!==void 0&&ws(e)===t),isOpenedByTrigger:de((e,t)=>t!==void 0&&ws(e)===t&&e.open),isMountedByTrigger:de((e,t)=>t!==void 0&&ws(e)===t&&e.mounted),triggerProps:de((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:de(e=>e.popupProps),popupElement:de(e=>e.popupElement),positionerElement:de(e=>e.positionerElement)};function Ad(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Xn(),s=qn()!=null;if(process.env.NODE_ENV!=="production"){const a=r.reference;a&&!$e(a)&&console.error("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `context.setPositionReference()`","instead.")}const i=wt(()=>new Aa({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new bs,floatingId:o,syncOnly:!1,nested:s})).current;return he(()=>{const a={open:t,floatingId:o};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=$e(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),i.update(a)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function Nw(e={}){const{nodeId:t,externalTree:n}=e,r=Ad(e),o=e.rootContext||r,s={reference:o.useState("referenceElement"),floating:o.useState("floatingElement"),domReference:o.useState("domReferenceElement")},[i,a]=f.useState(null),c=f.useRef(null),u=lr(n);he(()=>{s.domReference&&(c.current=s.domReference)},[s.domReference]);const l=Ew({...e,elements:{...s,...i&&{reference:i}}}),d=f.useCallback(P=>{const $=$e(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;a($),l.refs.setReference($)},[l.refs]),[p,h]=f.useState(void 0),[m,g]=f.useState(null);o.useSyncedValue("referenceElement",p??null);const v=$e(p)?p:null;o.useSyncedValue("domReferenceElement",p===void 0?s.domReference:v),o.useSyncedValue("floatingElement",m);const y=f.useCallback(P=>{($e(P)||P===null)&&(c.current=P,h(P)),($e(l.refs.reference.current)||l.refs.reference.current===null||P!==null&&!$e(P))&&l.refs.setReference(P)},[l.refs,h]),C=f.useCallback(P=>{g(P),l.refs.setFloating(P)},[l.refs]),S=f.useMemo(()=>({...l.refs,setReference:y,setFloating:C,setPositionReference:d,domReference:c}),[l.refs,y,C,d]),E=f.useMemo(()=>({...l.elements,domReference:s.domReference}),[l.elements,s.domReference]),b=o.useState("open"),x=o.useState("floatingId"),T=f.useMemo(()=>({...l,dataRef:o.context.dataRef,open:b,onOpenChange:o.setOpen,events:o.context.events,floatingId:x,refs:S,elements:E,nodeId:t,rootStore:o}),[l,S,E,t,o,b,x]);return he(()=>{o.context.dataRef.current.floatingContext=T;const P=u?.nodesRef.current.find($=>$.id===t);P&&(P.context=T)}),f.useMemo(()=>({...l,context:T,refs:S,elements:E,rootStore:o}),[l,S,E,T,o])}function Dd(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,o=Xn(),s=qn()!=null,i=t.useState("open"),a=t.useState("activeTriggerElement"),c=t.useState(n?"popupElement":"positionerElement"),u=t.context.triggerElements,l=wt(()=>new Aa({open:i,transitionStatus:void 0,referenceElement:a,floatingElement:c,triggerElements:u,onOpenChange:r,floatingId:o,syncOnly:!0,nested:s})).current;return he(()=>{const d={open:i,floatingId:o,referenceElement:a,floatingElement:c};$e(a)&&(d.domReferenceElement=a),l.state.positionReference===l.state.referenceElement&&(d.positionReference=a),l.update(d)},[i,o,a,c,l]),l.context.onOpenChange=r,l.context.nested=s,l}class Da{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Zt,this.restTimeout=new Zt,this.handleCloseOptions=void 0}static create(){return new Da}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const Ss=new WeakMap;function Es(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&Ss.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),Ss.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Ld(e,t){const{scopeElement:n,referenceElement:r,floatingElement:o}=t,s=Ss.get(n);s&&s!==e&&Es(s),Es(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=o,Ss.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",o.style.pointerEvents="auto"}function Fd(e){const t=wt(Da.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||(n.hoverInteractionState=t),so(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function Mw(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:a=!0,closeDelay:c=0,nodeId:u}=t,l=Fd(n),d=lr(),p=qn(),h=ie(()=>Ql(i.current.openEvent?.type,l.interactedInside)),m=ie(()=>{const E=i.current.openEvent?.type;return E?.includes("mouse")&&E!=="mousedown"}),g=ie(E=>fl(E,n.context.triggerElements)),v=f.useCallback(E=>{const b=ga(c,"close",l.pointerType),x=()=>{n.setOpen(!1,Ae(Lt,E)),d?.events.emit("floating.closed",E)};b?l.openChangeTimeout.start(b,x):(l.openChangeTimeout.clear(),x())},[c,n,l,d]),y=ie(()=>{Es(l)}),C=ie(E=>{const b=lt(E);if(!fb(b)){l.interactedInside=!1;return}l.interactedInside=b?.closest("[aria-haspopup]")!=null});he(()=>{r||(l.pointerType=void 0,l.restTimeoutPending=!1,l.interactedInside=!1,y())},[r,l,y]),f.useEffect(()=>y,[y]),he(()=>{if(a&&r&&l.handleCloseOptions?.blockPointerEvents&&m()&&$e(s)&&o){const E=s,b=o,x=Ie(o),T=d?.nodesRef.current.find($=>$.id===p)?.context?.elements.floating;T&&(T.style.pointerEvents="");const P=l.handleCloseOptions?.getScope?.()??l.pointerEventsScopeElement??T??E.closest("[data-rootownerid]")??x.body;return Ld(l,{scopeElement:P,referenceElement:E,floatingElement:b}),()=>{y()}}},[a,r,s,o,l,m,d,p,y]);const S=Gt();f.useEffect(()=>{if(!a)return;function E(){l.openChangeTimeout.clear(),S.clear(),d?.events.off("floating.closed",x),y()}function b(P){if(d&&p&&vn(d.nodesRef.current,p).length>0){d.events.on("floating.closed",x);return}if(g(P.relatedTarget))return;const $=i.current.floatingContext?.nodeId??u,M=P.relatedTarget;if(!(d&&$&&$e(M)&&vn(d.nodesRef.current,$,!1).some(L=>we(L.context?.elements.floating,M)))){if(l.handler){l.handler(P);return}y(),h()||v(P)}}function x(P){!d||!p||vn(d.nodesRef.current,p).length>0||S.start(0,()=>{d.events.off("floating.closed",x),n.setOpen(!1,Ae(Lt,P)),d.events.emit("floating.closed",P)})}const T=o;return gn(T&&Fe(T,"mouseenter",E),T&&Fe(T,"mouseleave",b),T&&Fe(T,"pointerdown",C,!0),()=>{d?.events.off("floating.closed",x)})},[a,o,n,i,u,h,g,v,y,C,l,d,p,S])}const Aw={current:null};function Dw(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:r,events:o}=n.context,{enabled:s=!0,delay:i=0,handleClose:a=null,mouseOnly:c=!1,restMs:u=0,move:l=!0,triggerElementRef:d=Aw,externalTree:p,isActiveTrigger:h=!0,getHandleCloseContext:m,isClosing:g}=t,v=lr(p),y=Fd(n),C=f.useRef(!1),S=vt(a),E=vt(i),b=vt(u),x=vt(s),T=vt(g);h&&(y.handleCloseOptions=S.current?.__options);const P=ie(()=>Ql(r.current.openEvent?.type,y.interactedInside)),$=ie(R=>fl(R,n.context.triggerElements)),M=ie((R,O,I)=>{const _=n.context.triggerElements;if(_.hasElement(O))return!R||!we(R,O);if(!$e(I))return!1;const N=I;return _.hasMatchingElement(A=>we(A,N))&&(!R||!we(R,N))}),V=ie((R,O=!0)=>{const I=ga(E.current,"close",y.pointerType);I?y.openChangeTimeout.start(I,()=>{n.setOpen(!1,Ae(Lt,R)),v?.events.emit("floating.closed",R)}):O&&(y.openChangeTimeout.clear(),n.setOpen(!1,Ae(Lt,R)),v?.events.emit("floating.closed",R))}),L=ie(()=>{if(!y.handler)return;Ie(n.select("domReferenceElement")).removeEventListener("mousemove",y.handler),y.handler=void 0}),D=ie(()=>{Es(y)});return f.useEffect(()=>L,[L]),f.useEffect(()=>{if(!s)return;function R(O){O.open?C.current=!1:(C.current=O.reason===Lt,L(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return o.on("openchange",R),()=>{o.off("openchange",R)}},[s,o,y,L]),f.useEffect(()=>{if(!s)return;const R=d.current??(h?n.select("domReferenceElement"):null);if(!$e(R))return;function O(_){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,c&&!fo(y.pointerType))return;const N=Jl(b.current),A=ga(E.current,"open",y.pointerType),j=lt(_),B=_.currentTarget??null,U=n.select("domReferenceElement");let W=B;if($e(j)&&!n.context.triggerElements.hasElement(j)){for(const Y of n.context.triggerElements.elements())if(we(Y,j)){W=Y;break}}$e(B)&&$e(U)&&!n.context.triggerElements.hasElement(B)&&we(B,U)&&(W=U);const G=W==null?!1:M(U,W,j),Z=n.select("open"),X=T.current?.()??n.select("transitionStatus")==="ending",K=!Z&&X&&C.current,J=!G&&$e(W)&&$e(U)&&we(U,W)&&K,se=N>0&&!A,ae=G&&(Z||K)||J,pe=!Z||G;if(ae){n.setOpen(!0,Ae(Lt,_,W));return}se||(A?y.openChangeTimeout.start(A,()=>{pe&&n.setOpen(!0,Ae(Lt,_,W))}):pe&&n.setOpen(!0,Ae(Lt,_,W)))}function I(_){if(P()){D();return}L();const N=n.select("domReferenceElement"),A=Ie(N);y.restTimeout.clear(),y.restTimeoutPending=!1;const j=r.current.floatingContext??m?.();if($(_.relatedTarget))return;if(S.current&&j){n.select("open")||y.openChangeTimeout.clear();const W=d.current;y.handler=S.current({...j,tree:v,x:_.clientX,y:_.clientY,onClose(){D(),L(),x.current&&!P()&&W===n.select("domReferenceElement")&&V(_,!0)}}),A.addEventListener("mousemove",y.handler),y.handler(_);return}(y.pointerType!=="touch"||!we(n.select("floatingElement"),_.relatedTarget))&&V(_)}return l?gn(Fe(R,"mousemove",O,{once:!0}),Fe(R,"mouseenter",O),Fe(R,"mouseleave",I)):gn(Fe(R,"mouseenter",O),Fe(R,"mouseleave",I))},[L,D,r,E,V,n,s,S,y,h,M,P,$,c,l,b,d,v,x,m,T]),f.useMemo(()=>{if(!s)return;function R(O){y.pointerType=O.pointerType}return{onPointerDown:R,onPointerEnter:R,onMouseMove(O){const{nativeEvent:I}=O,_=O.currentTarget,N=n.select("domReferenceElement"),A=n.select("open"),j=M(N,_,O.target);if(c&&!fo(y.pointerType))return;if(A&&j&&y.handleCloseOptions?.blockPointerEvents){const W=n.select("floatingElement");if(W){const G=y.handleCloseOptions?.getScope?.()??_.ownerDocument.body;Ld(y,{scopeElement:G,referenceElement:_,floatingElement:W})}}const B=Jl(b.current);if(A&&!j||B===0||!j&&y.restTimeoutPending&&O.movementX**2+O.movementY**2<2)return;y.restTimeout.clear();function U(){if(y.restTimeoutPending=!1,P())return;const W=n.select("open");!y.blockMouseMove&&(!W||j)&&n.setOpen(!0,Ae(Lt,I,_))}y.pointerType==="touch"?Kt.flushSync(()=>{U()}):j&&A?U():(y.restTimeoutPending=!0,y.restTimeout.start(B,U))}}},[s,y,P,M,c,n,b])}function bo(e=[]){const t=e.map(u=>u?.reference),n=e.map(u=>u?.floating),r=e.map(u=>u?.item),o=e.map(u=>u?.trigger),s=f.useCallback(u=>xs(u,e,"reference"),t),i=f.useCallback(u=>xs(u,e,"floating"),n),a=f.useCallback(u=>xs(u,e,"item"),r),c=f.useCallback(u=>xs(u,e,"trigger"),o);return f.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:a,getTriggerProps:c}),[s,i,a,c])}function xs(e,t,n){const r=new Map,o=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[Yi]="");for(const i in e)o&&e&&(i===ul||i===ll)||(s[i]=e[i]);for(let i=0;i<t.length;i+=1){let a;const c=t[i]?.[n];typeof c=="function"?a=e?c(e):null:a=c,a&&Vd(s,a,o,r)}return Vd(s,e,o,r),s}function Vd(e,t,n,r){for(const o in t){const s=t[o];n&&(o===ul||o===ll)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),typeof s=="function"&&(r.get(o)?.push(s),e[o]=(...i)=>r.get(o)?.map(a=>a(...i)).find(a=>a!==void 0))):e[o]=s)}}const Lw="Escape";function Cs(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Ts(e,t){return Cs(t,e===Xi||e===uo,e===Wn||e===Zn)}function La(e,t,n){return Cs(t,e===uo,n?e===Wn:e===Zn)||e==="Enter"||e===" "||e===""}function Fw(e,t,n){return Cs(t,n?e===Wn:e===Zn,e===uo)}function Vw(e,t,n,r){const o=n?e===Zn:e===Wn,s=e===Xi;return t==="both"||t==="horizontal"&&r&&r>1?e===Lw:Cs(t,o,s)}function zw(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{listRef:a,activeIndex:c,onNavigate:u=()=>{},enabled:l=!0,selectedIndex:d=null,allowEscape:p=!1,loopFocus:h=!1,nested:m=!1,rtl:g=!1,virtual:v=!1,focusItemOnOpen:y="auto",focusItemOnHover:C=!0,openOnArrowKeyDown:S=!0,disabledIndices:E=void 0,orientation:b="vertical",parentOrientation:x,cols:T=1,id:P,resetOnPointerLeave:$=!0,externalTree:M}=t;process.env.NODE_ENV!=="production"&&(p&&(h||console.warn("`useListNavigation` looping must be enabled to allow escaping."),v||console.warn("`useListNavigation` must be virtual to allow escaping.")),b==="vertical"&&T>1&&console.warn("In grid list navigation mode (`cols` > 1), the `orientation` should",'be either "horizontal" or "both".'));const V=lo(o),L=vt(V),D=qn(),R=lr(M);he(()=>{i.current.orientation=b},[i,b]);const O=Ki(s),I=f.useRef(y),_=f.useRef(d??-1),N=f.useRef(null),A=f.useRef(!0),j=ie(k=>{u(_.current===-1?null:_.current,k)}),B=f.useRef(j),U=f.useRef(!!o),W=f.useRef(r),G=f.useRef(!1),Z=f.useRef(!1),X=f.useRef(null),K=vt(E),J=vt(r),se=vt(d),ae=vt($),pe=ie(()=>{function k(Q){v?R?.events.emit("virtualfocus",Q):X.current=ps(Q,{sync:G.current,preventScroll:!0})}const H=a.current[_.current],F=Z.current;H&&k(H),(G.current?Q=>Q():requestAnimationFrame)(()=>{const Q=a.current[_.current]||H;if(!Q)return;H||k(Q),ge&&(F||!A.current)&&Q.scrollIntoView?.({block:"nearest",inline:"nearest"})})});he(()=>{l&&(r&&o?(_.current=d??-1,I.current&&d!=null&&(Z.current=!0,j())):U.current&&(_.current=-1,B.current()))},[l,r,o,d,j]),he(()=>{if(l){if(!r){G.current=!1;return}if(o)if(c==null){if(G.current=!1,se.current!=null)return;if(U.current&&(_.current=-1,pe()),(!W.current||!U.current)&&I.current&&(N.current!=null||I.current===!0&&N.current==null)){let k=0;const H=()=>{a.current[0]==null?(k<2&&(k?requestAnimationFrame:queueMicrotask)(H),k+=1):(_.current=N.current==null||La(N.current,b,g)||m?oa(a):wl(a),N.current=null,j())};H()}}else ns(a.current,c)||(_.current=c,pe(),Z.current=!1)}},[l,r,o,c,se,m,a,b,g,j,pe,K]),he(()=>{if(!l||o||!R||v||!U.current)return;const k=R.nodesRef.current,H=k.find(Q=>Q.id===D)?.context?.elements.floating,F=Pt(Ie(o)),z=k.some(Q=>Q.context&&we(Q.context.elements.floating,F));H&&!z&&A.current&&H.focus({preventScroll:!0})},[l,o,R,D,v]),he(()=>{B.current=j,W.current=r,U.current=!!o}),he(()=>{r||(N.current=null,I.current=y)},[r,y]);const Y=c!=null,me=ie(k=>{if(!J.current)return;const H=a.current.indexOf(k.currentTarget);H!==-1&&(_.current!==H||c!==H)&&(_.current=H,j(k))}),ge=f.useMemo(()=>({onFocus(H){G.current=!0,me(H)},onClick:({currentTarget:H})=>H.focus({preventScroll:!0}),onMouseMove(H){G.current=!0,Z.current=!1,C&&me(H)},onPointerLeave(H){if(!J.current||!A.current||H.pointerType==="touch")return;G.current=!0;const F=H.relatedTarget;if(!(!C||a.current.includes(F))&&ae.current&&(X.current?.(),X.current=null,_.current=-1,j(H),!v)){const z=L.current,Q=Pt(Ie(z));z&&we(z,Q)&&z.focus({preventScroll:!0})}}}),[me,J,L,C,a,j,ae,v]),fe=f.useCallback(()=>x??R?.nodesRef.current.find(k=>k.id===D)?.context?.dataRef?.current.orientation,[D,R,x]),le=ie(k=>{if(A.current=!1,G.current=!0,k.which===229||!J.current&&k.currentTarget===L.current)return;if(m&&Vw(k.key,b,g,T)){Ts(k.key,fe())||Yt(k),n.setOpen(!1,Ae(ba,k.nativeEvent)),it(s)&&(v?R?.events.emit("virtualfocus",s):s.focus());return}const H=_.current,F=oa(a,E),z=wl(a,E);if(O||(k.key==="Home"&&(Yt(k),_.current=F,j(k)),k.key==="End"&&(Yt(k),_.current=z,j(k))),T>1){const Q=Array.from({length:a.current.length},()=>({width:1,height:1})),ne=Cb(Q,T),te=ne.findIndex(Ee=>Ee!=null&&!Mr(a.current,Ee,E)),ye=ne.reduce((Ee,Ce,Pe)=>Ce!=null&&!Mr(a.current,Ce,E)?Pe:Ee,-1),_e=ne[xb(ne.map(Ee=>Ee!=null?a.current[Ee]:null),{event:k,orientation:b,loopFocus:h,rtl:g,cols:T,disabledIndices:Ob([...(typeof E!="function"?E:null)||a.current.map((Ee,Ce)=>Mr(a.current,Ce,E)?Ce:void 0),void 0],ne),minIndex:te,maxIndex:ye,prevIndex:Tb(_.current>z?F:_.current,Q,ne,T,k.key===uo?"bl":k.key===(g?Wn:Zn)?"tr":"tl"),stopEvent:!0})];if(_e!=null&&(_.current=_e,j(k)),b==="both")return}if(Ts(k.key,b)){if(Yt(k),r&&!v&&Pt(k.currentTarget.ownerDocument)===k.currentTarget){_.current=La(k.key,b,g)?F:z,j(k);return}La(k.key,b,g)?h?H>=z?p&&H!==a.current.length?_.current=-1:(G.current=!1,_.current=F):_.current=Dt(a.current,{startingIndex:H,disabledIndices:E}):_.current=Math.min(z,Dt(a.current,{startingIndex:H,disabledIndices:E})):h?H<=F?p&&H!==-1?_.current=a.current.length:(G.current=!1,_.current=z):_.current=Dt(a.current,{startingIndex:H,decrement:!0,disabledIndices:E}):_.current=Math.max(F,Dt(a.current,{startingIndex:H,decrement:!0,disabledIndices:E})),ns(a.current,_.current)&&(_.current=-1),j(k)}}),ce=f.useMemo(()=>v&&r&&Y&&{"aria-activedescendant":`${P}-${c}`},[v,r,Y,P,c]),ve=f.useMemo(()=>({"aria-orientation":b==="both"?void 0:b,...O?{}:ce,onKeyDown(k){if(k.key==="Tab"&&k.shiftKey&&r&&!v){const H=lt(k.nativeEvent);if(H&&!we(L.current,H))return;Yt(k),n.setOpen(!1,Ae(ur,k.nativeEvent)),it(s)&&s.focus();return}le(k)},onPointerMove(){A.current=!0}}),[ce,le,L,b,O,n,r,v,s]),ue=f.useMemo(()=>{function k(F){y==="auto"&&hl(F.nativeEvent)&&(I.current=!v)}function H(F){I.current=y,y==="auto"&&ml(F.nativeEvent)&&(I.current=!0)}return{onKeyDown(F){const z=n.select("open");A.current=!1;const Q=F.key.startsWith("Arrow"),ne=Fw(F.key,fe(),g),te=Ts(F.key,b),ye=(m?ne:te)||F.key==="Enter"||F.key.trim()==="";if(v&&z)return le(F);if(!(!z&&!S&&Q)){if(ye){const _e=Ts(F.key,fe());N.current=m&&_e?null:F.key}if(m){ne&&(Yt(F),z?(_.current=oa(a,K.current),j(F)):n.setOpen(!0,Ae(ba,F.nativeEvent,F.currentTarget)));return}te&&(se.current!=null&&(_.current=se.current),Yt(F),!z&&S?n.setOpen(!0,Ae(ba,F.nativeEvent,F.currentTarget)):le(F),z&&j(F))}},onFocus(F){n.select("open")&&!v&&(_.current=-1,j(F))},onPointerDown:H,onPointerEnter:H,onMouseDown:k,onClick:k}},[le,K,y,a,m,j,n,S,b,fe,g,se,v]),Se=f.useMemo(()=>({...ce,...ue}),[ce,ue]);return f.useMemo(()=>l?{reference:Se,floating:ve,item:ge,trigger:ue}:{},[l,Se,ve,ue,ge])}const $w=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function zd(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingId"),s=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{role:a="dialog"}=t,c=Xn(),u=s?.id||c,l=f.useMemo(()=>lo(i)?.id||o,[i,o]),d=$w.get(a)??a,h=qn()!=null,m=f.useMemo(()=>d==="tooltip"||a==="label"?mt:{"aria-haspopup":d==="alertdialog"?"dialog":d,"aria-expanded":"false",...d==="listbox"&&{role:"combobox"},...d==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[d,h,a]),g=f.useMemo(()=>d==="tooltip"||a==="label"?{[`aria-${a==="label"?"labelledby":"describedby"}`]:r?l:void 0}:{...m,"aria-expanded":r?"true":"false","aria-controls":r?l:void 0,...d==="menu"&&{id:u}},[d,l,r,u,a,m]),v=f.useMemo(()=>{const C={id:l,...d&&{role:d}};return d==="tooltip"||a==="label"?C:{...C,...d==="menu"&&{"aria-labelledby":u}}},[d,l,u,a]),y=f.useCallback(({active:C,selected:S})=>{const E={role:"option",...C&&{id:`${l}-fui-option`}};switch(a){case"select":case"combobox":return{...E,"aria-selected":S}}return{}},[l,a]);return f.useMemo(()=>({reference:g,floating:v,item:y,trigger:m}),[g,v,m,y])}function jw(e,t){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,o=n.useState("open"),{listRef:s,elementsRef:i,activeIndex:a,onMatch:c,onTypingChange:u,enabled:l=!0,resetMs:d=750,selectedIndex:p=null}=t,h=Gt(),m=f.useRef(""),g=f.useRef(p??a??-1),v=f.useRef(null);he(()=>{!o&&p!==null||(h.clear(),v.current=null,m.current!==""&&(m.current=""))},[o,p,h]),he(()=>{o&&m.current===""&&(g.current=p??a??-1)},[o,p,a]);const y=ie(x=>{x?r.current.typing||(r.current.typing=x,u?.(x)):r.current.typing&&(r.current.typing=x,u?.(x))}),C=ie(x=>{function T(O){const I=i?.current[O];return!I||rs(I)}function P(O,I,_=0){if(O.length===0)return-1;const N=(_%O.length+O.length)%O.length,A=I.toLocaleLowerCase();for(let j=0;j<O.length;j+=1){const B=(N+j)%O.length;if(!(!O[B]?.toLocaleLowerCase().startsWith(A)||!T(B)))return B}return-1}const $=s.current;if(m.current.length>0&&x.key===" "&&(Yt(x),y(!0)),m.current.length>0&&m.current[0]!==" "&&P($,m.current)===-1&&x.key!==" "&&y(!1),$==null||x.key.length!==1||x.ctrlKey||x.metaKey||x.altKey)return;o&&x.key!==" "&&(Yt(x),y(!0));const M=m.current==="";M&&(g.current=p??a??-1),$.every(O=>O?O[0]?.toLocaleLowerCase()!==O[1]?.toLocaleLowerCase():!0)&&m.current===x.key&&(m.current="",g.current=v.current),m.current+=x.key,h.start(d,()=>{m.current="",g.current=v.current,y(!1)});const D=((M?p??a??-1:g.current)??0)+1,R=P($,m.current,D);R!==-1?(c?.(R),v.current=R):x.key!==" "&&(m.current="",y(!1))}),S=ie(x=>{const T=x.relatedTarget,P=n.select("domReferenceElement"),$=n.select("floatingElement"),M=we(P,T),V=we($,T);M||V||(h.clear(),m.current="",g.current=v.current,y(!1))}),E=f.useMemo(()=>({onKeyDown:C,onBlur:S}),[C,S]),b=f.useMemo(()=>({onKeyDown:C,onBlur:S}),[C,S]);return f.useMemo(()=>l?{reference:E,floating:b}:{},[l,E,b])}const $d=.1,Hw=$d*$d,rt=.5;function Os(e,t,n,r,o,s){return r>=t!=s>=t&&e<=(o-n)*(t-r)/(s-r)+n}function Ps(e,t,n,r,o,s,i,a,c,u){let l=!1;return Os(e,t,n,r,o,s)&&(l=!l),Os(e,t,o,s,i,a)&&(l=!l),Os(e,t,i,a,c,u)&&(l=!l),Os(e,t,c,u,n,r)&&(l=!l),l}function Uw(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function _s(e,t,n,r,o,s){const i=Math.min(n,o),a=Math.max(n,o),c=Math.min(r,s),u=Math.max(r,s);return e>=i&&e<=a&&t>=c&&t<=u}function Bw(e={}){const{blockPointerEvents:t=!1}=e,n=new Zt,r=({x:o,y:s,placement:i,elements:a,onClose:c,nodeId:u,tree:l})=>{const d=i?.split("-")[0];let p=!1,h=null,m=null,g=typeof performance<"u"?performance.now():0;function v(C,S){const E=performance.now(),b=E-g;if(h===null||m===null||b===0)return h=C,m=S,g=E,!1;const x=C-h,T=S-m,P=x*x+T*T,$=b*b*Hw;return h=C,m=S,g=E,P<$}function y(){n.clear(),c()}return function(S){n.clear();const E=a.domReference,b=a.floating;if(!E||!b||d==null||o==null||s==null)return;const{clientX:x,clientY:T}=S,P=lt(S),$=S.type==="mouseleave",M=we(b,P),V=we(E,P);if(M&&(p=!0,!$))return;if(V&&(p=!1,!$)){p=!0;return}if($&&$e(S.relatedTarget)&&we(b,S.relatedTarget))return;function L(){return!!(l&&vn(l.nodesRef.current,u).length>0)}function D(){L()||y()}if(L())return;const R=E.getBoundingClientRect(),O=b.getBoundingClientRect(),I=o>O.right-O.width/2,_=s>O.bottom-O.height/2,N=O.width>R.width,A=O.height>R.height,j=(N?R:O).left,B=(N?R:O).right,U=(A?R:O).top,W=(A?R:O).bottom;if(d==="top"&&s>=R.bottom-1||d==="bottom"&&s<=R.top+1||d==="left"&&o>=R.right-1||d==="right"&&o<=R.left+1){D();return}let G=!1;switch(d){case"top":G=_s(x,T,j,R.top+1,B,O.bottom-1);break;case"bottom":G=_s(x,T,j,O.top+1,B,R.bottom-1);break;case"left":G=_s(x,T,O.right-1,W,R.left+1,U);break;case"right":G=_s(x,T,R.right-1,W,O.left+1,U);break}if(G)return;if(p&&!Uw(x,T,R)){D();return}if(!$&&v(x,T)){D();return}let Z=!1;switch(d){case"top":{const X=N?rt/2:rt*4,K=N||I?o+X:o-X,J=N?o-X:I?o+X:o-X,se=s+rt+1,ae=I||N?O.bottom-rt:O.top,pe=I?N?O.bottom-rt:O.top:O.bottom-rt;Z=Ps(x,T,K,se,J,se,O.left,ae,O.right,pe);break}case"bottom":{const X=N?rt/2:rt*4,K=N||I?o+X:o-X,J=N?o-X:I?o+X:o-X,se=s-rt,ae=I||N?O.top+rt:O.bottom,pe=I?N?O.top+rt:O.bottom:O.top+rt;Z=Ps(x,T,K,se,J,se,O.left,ae,O.right,pe);break}case"left":{const X=A?rt/2:rt*4,K=A||_?s+X:s-X,J=A?s-X:_?s+X:s-X,se=o+rt+1,ae=_||A?O.right-rt:O.left,pe=_?A?O.right-rt:O.left:O.right-rt;Z=Ps(x,T,ae,O.top,pe,O.bottom,se,K,se,J);break}case"right":{const X=A?rt/2:rt*4,K=A||_?s+X:s-X,J=A?s-X:_?s+X:s-X,se=o-rt,ae=_||A?O.left+rt:O.right,pe=_?A?O.left+rt:O.right:O.left+rt;Z=Ps(x,T,se,K,se,J,ae,O.top,pe,O.bottom);break}}Z?p||n.start(40,D):D()}};return r.__options={...e,blockPointerEvents:t},r}const jd=f.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,style:a,...c}=t,{portalNode:u,portalSubtree:l}=cd({container:o,ref:n,componentProps:t,elementProps:c});return!l&&!u?null:w.jsxs(f.Fragment,{children:[l,u&&Kt.createPortal(r,u)]})});process.env.NODE_ENV!=="production"&&(jd.displayName="FloatingPortalLite");const Ww=jd,Hd=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Hd.displayName="DirectionContext");function Ud(){return f.useContext(Hd)?.direction??"ltr"}const Zw=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:l=0,offsetParent:d="real"}=Mn(e,t)||{};if(u==null)return{};const p=bl(l),h={x:n,y:r},m=na(o),g=ta(m),v=await i.getDimensions(u),y=m==="y",C=y?"top":"left",S=y?"bottom":"right",E=y?"clientHeight":"clientWidth",b=s.reference[g]+s.reference[m]-h[m]-s.floating[g],x=h[m]-s.reference[m],T=d==="real"?await i.getOffsetParent?.(u):a.floating;let P=a.floating[E]||s.floating[g];(!P||!await i.isElement?.(T))&&(P=a.floating[E]||s.floating[g]);const $=b/2-x/2,M=P/2-v[g]/2-1,V=Math.min(p[C],M),L=Math.min(p[S],M),D=V,R=P-v[g]-L,O=P/2-v[g]/2+$,I=Qi(D,O,R),_=!c.arrow&&Gn(o)!=null&&O!==I&&s.reference[g]/2-(O<D?V:L)-v[g]/2<0,N=_?O<D?O-D:O-R:0;return{[m]:h[m]+N,data:{[m]:I,centerOffset:O-I-N,..._&&{alignmentOffset:N}},reset:_}}}),Gw=(e,t)=>({...Zw(e),options:[e,t]}),Yw={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await _w().fn(e)).data?.referenceHidden||s}}}},Is={sideX:"left",sideY:"top"},Xw={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:a}=e,c=tt(o),u=c.getComputedStyle(o);if(!(u.transitionDuration!=="0s"&&u.transitionDuration!==""))return{x:t,y:n,data:Is};const d=await s.getOffsetParent?.(o);let p={width:0,height:0};if(i==="fixed"&&c?.visualViewport)p={width:c.visualViewport.width,height:c.visualViewport.height};else if(d===c){const C=Ie(o);p={width:C.documentElement.clientWidth,height:C.documentElement.clientHeight}}else await s.isElement?.(d)&&(p=await s.getDimensions(d));const h=jt(a);let m=t,g=n;h==="left"&&(m=p.width-(t+r.width)),h==="top"&&(g=p.height-(n+r.height));const v=h==="left"?"right":Is.sideX,y=h==="top"?"bottom":Is.sideY;return{x:m,y:g,data:{sideX:v,sideY:y}}}};function Bd(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function Wd(e,t,n){const{rects:r,placement:o}=e;return{side:Bd(t,jt(o),n),align:Gn(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Zd(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:a,collisionPadding:c=5,sticky:u=!1,arrowPadding:l=5,disableAnchorTracking:d=!1,keepMounted:p=!1,floatingRootContext:h,mounted:m,collisionAvoidance:g,shiftCrossAxis:v=!1,nodeId:y,adaptiveOrigin:C,lazyFlip:S=!1,externalTree:E}=e,[b,x]=f.useState(null);!m&&b!==null&&x(null);const T=g.side||"flip",P=g.align||"flip",$=g.fallbackAxisSide||"end",M=typeof t=="function"?t:void 0,V=ie(M),L=M?V:t,D=vt(t),R=vt(m),I=Ud()==="rtl",_=b||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":I?"left":"right","inline-start":I?"right":"left"}[r],N=s==="center"?_:`${_}-${s}`;let A=c;const j=1,B=r==="bottom"?j:0,U=r==="top"?j:0,W=r==="right"?j:0,G=r==="left"?j:0;typeof A=="number"?A={top:A+B,right:A+G,bottom:A+U,left:A+W}:A&&(A={top:(A.top||0)+B,right:(A.right||0)+G,bottom:(A.bottom||0)+U,left:(A.left||0)+W});const Z={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:A},X=f.useRef(null),K=vt(o),J=vt(i),pe=[xw(Re=>{const Te=Wd(Re,r,I),Ue=typeof K.current=="function"?K.current(Te):K.current,Be=typeof J.current=="function"?J.current(Te):J.current;return{mainAxis:Ue,crossAxis:Be,alignmentAxis:Be}},[typeof o!="function"?o:0,typeof i!="function"?i:0,I,r])],Y=P==="none"&&T!=="shift",me=!Y&&(u||v||T==="shift"),ge=T==="none"?null:Ow({...Z,padding:{top:A.top+j,right:A.right+j,bottom:A.bottom+j,left:A.left+j},mainAxis:!v&&T==="flip",crossAxis:P==="flip"?"alignment":!1,fallbackAxisSideDirection:$}),fe=Y?null:Cw(Re=>{const Te=Ie(Re.elements.floating).documentElement;return{...Z,rootBoundary:v?{x:0,y:0,width:Te.clientWidth,height:Te.clientHeight}:void 0,mainAxis:P!=="none",crossAxis:me,limiter:u||v?void 0:Tw(Ue=>{if(!X.current)return{};const{width:Be,height:ct}=X.current.getBoundingClientRect(),Ye=en(jt(Ue.placement)),Ut=Ye==="y"?Be:ct,$t=Ye==="y"?A.left+A.right:A.top+A.bottom;return{offset:Ut/2+$t/2}})}},[Z,u,v,A,P]);T==="shift"||P==="shift"||s==="center"?pe.push(fe,ge):pe.push(ge,fe),pe.push(Pw({...Z,apply({elements:{floating:Re},availableWidth:Te,availableHeight:Ue,rects:Be}){if(!R.current)return;const ct=Re.style;ct.setProperty("--available-width",`${Te}px`),ct.setProperty("--available-height",`${Ue}px`);const Ye=tt(Re).devicePixelRatio||1,{x:Ut,y:$t,width:Ke,height:q}=Be.reference,re=(Math.round((Ut+Ke)*Ye)-Math.round(Ut*Ye))/Ye,be=(Math.round(($t+q)*Ye)-Math.round($t*Ye))/Ye;ct.setProperty("--anchor-width",`${re}px`),ct.setProperty("--anchor-height",`${be}px`)}}),Gw(()=>({element:X.current||Ie(X.current).createElement("div"),padding:l,offsetParent:"floating"}),[l]),{name:"transformOrigin",fn(Re){const{elements:Te,middlewareData:Ue,placement:Be,rects:ct,y:Ye}=Re,Ut=jt(Be),$t=en(Ut),Ke=X.current,q=Ue.arrow?.x||0,re=Ue.arrow?.y||0,be=Ke?.clientWidth||0,Le=Ke?.clientHeight||0,je=q+be/2,De=re+Le/2,Qe=Math.abs(Ue.shift?.y||0),Oe=ct.reference.height/2,xe=typeof o=="function"?o(Wd(Re,r,I)):o,Ne=Qe>xe,Me={top:`${je}px calc(100% + ${xe}px)`,bottom:`${je}px ${-xe}px`,left:`calc(100% + ${xe}px) ${De}px`,right:`${-xe}px ${De}px`}[Ut],Xe=`${je}px ${ct.reference.y+Oe-Ye}px`;return Te.floating.style.setProperty("--transform-origin",me&&$t==="y"&&Ne?Xe:Me),{}}},Yw,C),he(()=>{!m&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[m,h]);const le=f.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<"u",layoutShift:!d&&typeof IntersectionObserver<"u"}),[d]),{refs:ce,elements:ve,x:ue,y:Se,middlewareData:k,update:H,placement:F,context:z,isPositioned:Q,floatingStyles:ne}=Nw({rootContext:h,open:p?m:void 0,placement:N,middleware:pe,strategy:n,whileElementsMounted:p?void 0:(...Re)=>Od(...Re,le),nodeId:y,externalTree:E}),{sideX:te,sideY:ye}=k.adaptiveOrigin||Is,_e=Q?n:"fixed",Ee=f.useMemo(()=>{const Re=C?{position:_e,[te]:ue,[ye]:Se}:{position:_e,...ne};return Q||(Re.opacity=0),Re},[C,_e,te,ue,ye,Se,ne,Q]),Ce=f.useRef(null);he(()=>{if(!m)return;const Re=D.current,Te=typeof Re=="function"?Re():Re,Be=(Gd(Te)?Te.current:Te)||null||null;Be!==Ce.current&&(ce.setPositionReference(Be),Ce.current=Be)},[m,ce,L,D]),f.useEffect(()=>{if(!m)return;const Re=D.current;typeof Re!="function"&&Gd(Re)&&Re.current!==Ce.current&&(ce.setPositionReference(Re.current),Ce.current=Re.current)},[m,ce,L,D]),f.useEffect(()=>{if(p&&m&&ve.domReference&&ve.floating)return Od(ve.domReference,ve.floating,H,le)},[p,m,ve,H,le]);const Pe=jt(F),Ve=Bd(r,Pe,I),Ge=Gn(F)||"center",He=!!k.hide?.referenceHidden;he(()=>{S&&m&&Q&&x(Pe)},[S,m,Q,Pe]);const nt=f.useMemo(()=>({position:"absolute",top:k.arrow?.y,left:k.arrow?.x}),[k.arrow]),st=k.arrow?.centerOffset!==0;return f.useMemo(()=>({positionerStyles:Ee,arrowStyles:nt,arrowRef:X,arrowUncentered:st,side:Ve,align:Ge,physicalSide:Pe,anchorHidden:He,refs:ce,context:z,isPositioned:Q,update:H}),[Ee,nt,X,st,Ve,Ge,Pe,He,ce,z,Q,H])}function Gd(e){return e!=null&&"current"in e}let Ft=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=sr.startingStyle]="startingStyle",e[e.endingStyle=sr.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),Fa=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const qw={[Fa.popupOpen]:""},Kw={[Fa.popupOpen]:"",[Fa.pressed]:""},Jw={[Ft.open]:""},Qw={[Ft.closed]:""},eS={[Ft.anchorHidden]:""},Yd={open(e){return e?qw:null}},Xd={open(e){return e?Kw:null}},Cn={open(e){return e?Jw:Qw},anchorHidden(e){return e?eS:null}};function Va(e){return e==="starting"?a0:mt}function qd(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:a=!1}){const c={...n};return a&&(c.pointerEvents="none"),qe("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:c},Va(r),o],stateAttributesMapping:Cn})}function Kd(){const e=f.useContext(zo);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: useToastManager must be used within <Toast.Provider>.":ft(73));const t=e.useState("toasts");return f.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function fr(...e){return Mi(Mu(e))}const Jd={Viewport:"_Viewport_ai81v_1",Toast:"_Toast_ai81v_14"};let zr=null,wo=3e3;function tS({timeout:e}){const t=Kd();return f.useEffect(()=>(zr=t,wo=e,()=>{zr=null}),[t,e]),null}const gt={success:(e,t)=>zr?.add({description:e,timeout:t?.timeout||wo}),error:(e,t)=>zr?.add({description:e,timeout:t?.timeout||wo}),info:(e,t)=>zr?.add({description:e,timeout:t?.timeout||wo}),warning:(e,t)=>zr?.add({description:e,timeout:t?.timeout||wo})};function nS({toastConfigs:e}){const t=e?.timeout??3e3;return w.jsxs(Nl,{timeout:t,children:[w.jsx(tS,{timeout:t}),w.jsx(rS,{configs:e})]})}function rS({configs:e}){const{toasts:t}=Kd();return w.jsx(Ww,{children:w.jsx(Ul,{className:fr(Jd.Viewport,e?.viewportClassName),children:t.map(n=>w.jsx(Gl,{toast:n,className:fr("pointer-events-none flex items-center justify-center px-6 py-3 min-w-[200px] max-w-[80vw]","text-white text-base rounded-md bg-black/80",Jd.Toast,e?.className),style:e?.style,children:w.jsx(ql,{className:"text-xs",children:n.description})},n.id))})})}class oS{baseUrl;credentials;interceptors;timeout;onError;headers;constructor({baseUrl:t,timeout:n=1/0,responseInterceptor:r=c=>c.data,requestInterceptor:o=c=>c,onError:s=()=>{},headers:i,credentials:a="include"}){this.baseUrl=t,this.timeout=n,this.credentials=a,this.interceptors={request:o,response:r},this.headers=new Headers({"Content-Type":"application/json",...i}),this.onError=s}async request(t){const n=new AbortController;t.url=`${this.baseUrl}${t.url}`,t=this.interceptors.request(t);const r=new Headers(this.headers);Object.entries(t.headers||{}).forEach(([a,c])=>{r.set(a,c)});const o=this.headers.get("content-type");let s=null;if(t.data instanceof FormData)s=t.data,r.delete("Content-Type");else if(t.data!==void 0&&t.method!=="GET")if(o==="application/x-www-form-urlencoded"){const a=new URLSearchParams;for(const c in t.data)t.data[c]!==void 0&&a.append(c,t.data[c]);s=a.toString()}else s=JSON.stringify(t.data);else if(t.method==="GET"){const a=new URLSearchParams;for(const u in t.data)t.data[u]!==void 0&&a.append(u,t.data[u]);const c=a.toString();t.url+=c?`?${c}`:""}const i=fetch(t.url,{method:t.method,headers:r,body:s,signal:t.signal||n.signal,credentials:this.credentials});try{const a=t.timeout||this.timeout,{timeoutId:c,timeoutPromise:u}=this._setTimeout(a,n),l=await Promise.race([i,u].filter(Boolean));if(c&&clearTimeout(c),l.ok){const d=await l.json();return this.interceptors.response(d,l).catch(p=>(this.onError({data:p,response:l}),Promise.reject(d)))}else{const d=await l.json();return this.onError({data:d,response:l}),Promise.reject(d)}}catch(a){return a.name!=="AbortError"&&this.onError({}),Promise.reject(a)}}_setTimeout(t,n){let r=null,o=null;return t!==1/0&&(o=new Promise((s,i)=>{r=setTimeout(()=>{i(new Error("请求超时")),n.abort()},t)})),{timeoutPromise:o,timeoutId:r}}get(t,n,r){return this.request({...r,url:t,method:"GET",data:n})}post(t,n,r){return this.request({...r,url:t,method:"POST",data:n})}put(t,n,r){return this.request({...r,url:t,method:"PUT",data:n})}delete(t,n){return this.request({...n,url:t,method:"DELETE"})}patch(t,n,r){return this.request({...r,url:t,method:"PATCH",data:n})}}const _t=new oS({baseUrl:"https://apis.sdk.mobileztgame.com",credentials:"omit",headers:{"Content-Type":"application/x-www-form-urlencoded"},async responseInterceptor(e,t){if(["/passport-api/v2/ztgame/auth/login","/passport-api/v2/sms-captchas","/passport-api/v2/ztgame/auth/mobile-register","/passport-api/v2/ztgame/auth/auth","/passport-api/v2/ztgame/auth/re-auth","/passport-api/v2/ztgame/user-center/forget-password/forget-password-keys","/passport-api/v2/ztgame/user-center/forget-password/","/passport-api/v2/ztgame/user-center/forget-password/sms-captchas","/passport-api/v2/ztgame/user-center/forget-password/forget-password-update","/idcard"].some(r=>t.url.includes(r))){const r=t.headers.get("set-authentication")||t.headers.get("Set-Authentication")||"";return{...e,_auth:r}}if(e?.code!==0)throw new Error(e.error);return e},onError({response:e,data:t}){if(e&&e?.status!==401){const n=`${t?.message||t?.detail||"未知错误"}`;gt.error(n)}}});function Qd(e){_t.headers.set("Authentication",e)}const at={ROLE_ID:"roleid",GIANT:"giant",MOBILE:"mobile"},ks={default:{types:[at.GIANT,at.MOBILE],default:at.GIANT},5327:{types:[at.GIANT,at.MOBILE],default:at.MOBILE},5273:{types:[at.ROLE_ID],default:at.ROLE_ID},5199:{types:[at.ROLE_ID],default:at.ROLE_ID},5012:{types:[at.ROLE_ID],default:at.ROLE_ID},5242:{types:[at.GIANT,at.MOBILE],default:at.MOBILE}};function St(...e){return Mi(Mu(e))}function sS(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(t,n)=>String.fromCharCode(Number.parseInt(n,16))))}function iS(e){return e==="5199"||e==="5012"}function aS(e){const{entity:t,gaplaySign:n}=e;return sS(`${JSON.stringify(t)}$$${n}`)}function Rs(e,t){return t||ks[e]?.types||ks.default?.types||[]}function cS(e,t){return t||ks[e]?.default||ks.default?.default}function ef({loginTypes:e,gameId:t}){return Rs(t,e).includes(at.GIANT)}function tf({loginTypes:e,gameId:t}){return Rs(t,e).includes(at.ROLE_ID)}function nf({loginTypes:e,gameId:t}){return Rs(t,e).includes(at.MOBILE)}function rf({gameId:e}){_t.headers.set("X-GAME-ID",e),_t.headers.set("X-Login-H5","1");const t=localStorage.getItem("UNIQUE_ID");t&&_t.headers.set("X-Client-Info",JSON.stringify({sdk_version:"3.0.0",device_udid:t,appunid:t}))}async function uS({gameId:e}){rf({gameId:e});let t=localStorage.getItem("UNIQUE_ID");t||(t=(await(await $y.load()).get()).visitorId,localStorage.setItem("UNIQUE_ID",t)),_t.headers.set("X-Client-Info",JSON.stringify({sdk_version:"3.0.0",device_udid:t,appunid:t}))}const lS=[{code:"86",name:"中国大陆"},{code:"886",name:"台湾地区"},{code:"852",name:"香港特别行政区"},{code:"853",name:"澳门特别行政区"},{code:"1",name:"美国"},{code:"81",name:"日本"},{code:"376",name:"安道尔"},{code:"971",name:"阿拉伯联合酋长国"},{code:"93",name:"阿富汗"},{code:"1268",name:"安提瓜和巴布达"},{code:"1264",name:"安圭拉"},{code:"355",name:"阿尔巴尼亚"},{code:"374",name:"亚美尼亚"},{code:"244",name:"安哥拉"},{code:"54",name:"阿根廷"},{code:"1684",name:"美属萨摩亚"},{code:"43",name:"奥地利"},{code:"61",name:"澳大利亚"},{code:"297",name:"阿鲁巴"},{code:"994",name:"阿塞拜疆"},{code:"387",name:"波斯尼亚和黑塞哥维那"},{code:"1246",name:"巴巴多斯"},{code:"880",name:"孟加拉国"},{code:"32",name:"比利时"},{code:"226",name:"布基纳法索"},{code:"359",name:"保加利亚"},{code:"973",name:"巴林"},{code:"257",name:"布隆迪"},{code:"229",name:"贝宁"},{code:"1441",name:"百慕大群岛"},{code:"673",name:"文莱"},{code:"591",name:"玻利维亚"},{code:"599",name:"荷兰加勒比"},{code:"55",name:"巴西"},{code:"1242",name:"巴哈马"},{code:"975",name:"不丹"},{code:"267",name:"博茨瓦纳"},{code:"375",name:"白俄罗斯"},{code:"501",name:"伯利兹"},{code:"1",name:"加拿大"},{code:"243",name:"刚果民主共和国"},{code:"236",name:"中非共和国"},{code:"242",name:"刚果共和国"},{code:"41",name:"瑞士"},{code:"225",name:"象牙海岸"},{code:"682",name:"库克群岛"},{code:"56",name:"智利"},{code:"237",name:"喀麦隆"},{code:"57",name:"哥伦比亚"},{code:"506",name:"哥斯达黎加"},{code:"53",name:"古巴"},{code:"238",name:"佛得角共和国"},{code:"599",name:"库拉索"},{code:"357",name:"塞浦路斯"},{code:"420",name:"捷克"},{code:"49",name:"德国"},{code:"253",name:"吉布提"},{code:"45",name:"丹麦"},{code:"1767",name:"多米尼加"},{code:"1809",name:"多米尼加共和国"},{code:"213",name:"阿尔及利亚"},{code:"593",name:"厄瓜多尔"},{code:"372",name:"爱沙尼亚"},{code:"20",name:"埃及"},{code:"291",name:"厄立特里亚"},{code:"34",name:"西班牙"},{code:"251",name:"埃塞俄比亚"},{code:"358",name:"芬兰"},{code:"679",name:"斐济"},{code:"691",name:"密克罗尼西亚"},{code:"298",name:"法罗群岛"},{code:"33",name:"法国"},{code:"241",name:"加蓬"},{code:"44",name:"英国"},{code:"1473",name:"格林纳达"},{code:"995",name:"格鲁吉亚"},{code:"594",name:"法属圭亚那"},{code:"233",name:"加纳"},{code:"350",name:"直布罗陀"},{code:"299",name:"格陵兰岛"},{code:"220",name:"冈比亚"},{code:"224",name:"几内亚"},{code:"590",name:"瓜德罗普岛"},{code:"240",name:"赤道几内亚"},{code:"30",name:"希腊"},{code:"502",name:"瓜地马拉"},{code:"1671",name:"关岛"},{code:"245",name:"几内亚比绍共和国"},{code:"592",name:"圭亚那"},{code:"504",name:"洪都拉斯"},{code:"385",name:"克罗地亚"},{code:"509",name:"海地"},{code:"36",name:"匈牙利"},{code:"62",name:"印度尼西亚"},{code:"353",name:"爱尔兰"},{code:"972",name:"以色列"},{code:"91",name:"印度"},{code:"964",name:"伊拉克"},{code:"98",name:"伊朗"},{code:"354",name:"冰岛"},{code:"39",name:"意大利"},{code:"1876",name:"牙买加"},{code:"962",name:"约旦"},{code:"254",name:"肯尼亚"},{code:"996",name:"吉尔吉斯斯坦"},{code:"855",name:"柬埔寨"},{code:"686",name:"基里巴斯"},{code:"269",name:"科摩罗"},{code:"1869",name:"圣基茨和尼维斯"},{code:"850",name:"朝鲜"},{code:"82",name:"韩国"},{code:"965",name:"科威特"},{code:"1345",name:"开曼群岛"},{code:"7",name:"哈萨克斯坦"},{code:"856",name:"老挝"},{code:"961",name:"黎巴嫩"},{code:"1758",name:"圣露西亚"},{code:"423",name:"列支敦士登"},{code:"94",name:"斯里兰卡"},{code:"231",name:"利比里亚"},{code:"266",name:"莱索托"},{code:"370",name:"立陶宛"},{code:"352",name:"卢森堡"},{code:"371",name:"拉脱维亚"},{code:"218",name:"利比亚"},{code:"212",name:"摩洛哥"},{code:"377",name:"摩纳哥"},{code:"373",name:"摩尔多瓦"},{code:"382",name:"黑山"},{code:"261",name:"马达加斯加"},{code:"692",name:"马绍尔群岛"},{code:"389",name:"北马其顿"},{code:"223",name:"马里"},{code:"95",name:"缅甸"},{code:"976",name:"蒙古"},{code:"222",name:"毛里塔尼亚"},{code:"1664",name:"蒙特塞拉特岛"},{code:"356",name:"马耳他"},{code:"230",name:"毛里求斯"},{code:"960",name:"马尔代夫"},{code:"265",name:"马拉维"},{code:"52",name:"墨西哥"},{code:"60",name:"马来西亚"},{code:"258",name:"莫桑比克"},{code:"264",name:"纳米比亚"},{code:"687",name:"新喀里多尼亚"},{code:"227",name:"尼日尔"},{code:"234",name:"尼日利亚"},{code:"505",name:"尼加拉瓜"},{code:"31",name:"荷兰"},{code:"47",name:"挪威"},{code:"977",name:"尼泊尔"},{code:"674",name:"拿鲁岛"},{code:"64",name:"新西兰"},{code:"968",name:"阿曼"},{code:"507",name:"巴拿马"},{code:"51",name:"秘鲁"},{code:"689",name:"法属波利尼西亚"},{code:"675",name:"巴布亚新几内亚"},{code:"63",name:"菲律宾"},{code:"92",name:"巴基斯坦"},{code:"48",name:"波兰"},{code:"508",name:"圣彼埃尔和密克隆岛"},{code:"1787",name:"波多黎各"},{code:"351",name:"葡萄牙"},{code:"680",name:"帕劳"},{code:"595",name:"巴拉圭"},{code:"974",name:"卡塔尔"},{code:"262",name:"留尼汪"},{code:"40",name:"罗马尼亚"},{code:"381",name:"塞尔维亚"},{code:"7",name:"俄罗斯"},{code:"250",name:"卢旺达"},{code:"966",name:"沙特阿拉伯"},{code:"677",name:"所罗门群岛"},{code:"248",name:"塞舌尔"},{code:"249",name:"苏丹"},{code:"46",name:"瑞典"},{code:"65",name:"新加坡"},{code:"386",name:"斯洛文尼亚"},{code:"421",name:"斯洛伐克"},{code:"232",name:"塞拉利昂"},{code:"378",name:"圣马力诺"},{code:"221",name:"塞内加尔"},{code:"252",name:"索马里"},{code:"597",name:"苏里南"},{code:"239",name:"圣多美和普林西比"},{code:"503",name:"萨尔瓦多"},{code:"963",name:"叙利亚"},{code:"268",name:"埃斯瓦蒂尼"},{code:"1649",name:"特克斯和凯科斯群岛"},{code:"235",name:"乍得"},{code:"228",name:"多哥"},{code:"66",name:"泰国"},{code:"992",name:"塔吉克斯坦"},{code:"670",name:"东帝汶"},{code:"993",name:"土库曼斯坦"},{code:"216",name:"突尼斯"},{code:"676",name:"汤加"},{code:"90",name:"土耳其"},{code:"1868",name:"特立尼达和多巴哥"},{code:"255",name:"坦桑尼亚"},{code:"380",name:"乌克兰"},{code:"256",name:"乌干达"},{code:"598",name:"乌拉圭"},{code:"998",name:"乌兹别克斯坦"},{code:"1784",name:"圣文森特和格林纳丁斯"},{code:"58",name:"委内瑞拉"},{code:"1284",name:"英属处女群岛"},{code:"84",name:"越南"},{code:"678",name:"瓦努阿图"},{code:"685",name:"萨摩亚"},{code:"967",name:"也门"},{code:"269",name:"马约特"},{code:"27",name:"南非"},{code:"260",name:"赞比亚"},{code:"263",name:"津巴布韦"}].map(e=>({label:e.name,value:e.code,id:`${e.code}-${e.name}`}));function dS(e){return lS}function fS(e){return"account"in e}function pS({gameId:e,serverUserInfo:t,extraState:n}){const r={game_id:e,xToken:aS(t),saveTime:t.entity.time,$version:"v2",extraState:n};if(fS(t))r.openid=t.entity.openid,r.gaplaySign=t.gaplaySign,r.account=t.account,r.username=t.account.view_name,r.loginByRoleMail=!1,r.channelId=t.channel||6;else if(t.gaplaySign){const{ZONEID:o,openid:s,CHARID:i,NAME:a,REALZONEID:c,ZONENAME:u}=t.entity;r.openid=s,r.zone={zoneid:c||o,zonename:u,area:o},r.char={...t.entity,CHARID:i,NAME:a,GAMEPOINT:t.entity.GAMEPOINT,VIPLEVEL:t.entity.VIPLEVEL},r.loginByRoleMail=!0,r.gaplaySign=t.gaplaySign}else{const{ZONEID:o,CHARID:s,NAME:i,REALZONEID:a,ZONENAME:c,OPENID:u,CHANNELID:l,GAMEPOINT:d,VIPLEVEL:p}=t.entity;r.openid=u,r.channelId=l,r.char={CHARID:s,NAME:i,GAMEPOINT:d,VIPLEVEL:p},r.loginByRoleMail=!1,r.username=i,r.zone={zoneid:a||o,zonename:c,area:o},r.xToken=void 0}return r}function of(){try{const e=localStorage.getItem("userInfo")||"[]";return JSON.parse(e)}catch{return[]}}function za(e){return of().find(n=>n.game_id===e)}function hS(e){const t=localStorage.getItem("userInfo")||"[]",n=JSON.parse(t),r=n.find(s=>s.game_id===e);r?.openid&&sf(r.openid,e);const o=n.filter(s=>s.game_id!==e);localStorage.setItem("userInfo",JSON.stringify(o))}function mS(e){const t=of(),n=za(e.game_id),r=t.findIndex(o=>o.game_id===e.game_id);n?t[r]=e:t.push(e),localStorage.setItem("userInfo",JSON.stringify(t))}const So="LOGIN_SDK_ACCOUNTS";function $r(e){try{const t=JSON.parse(localStorage.getItem(So)||"[]");return e?t.filter(n=>n.gameId===e):t}catch{return[]}}function Ns(e,t,n){if(!n)return;const r=JSON.parse(localStorage.getItem(So)||"[]");let o=1;const s=r.filter(c=>c.openid===e.accid&&c.gameId===n?(o=(c.loginCnt||1)+1,!1):!0),a=[{openid:e.accid,username:e.account?.view_name||"",uid:e.account?.uid||"",mobile:e.account?.mobile||"",accountType:e.account?.account_type||0,authorization:t,loginAt:Date.now(),loginCnt:o,gameId:n},...s].slice(0,20);localStorage.setItem(So,JSON.stringify(a))}function sf(e,t){if(!t)return;const r=JSON.parse(localStorage.getItem(So)||"[]").filter(o=>!(o.openid===e&&o.gameId===t));localStorage.setItem(So,JSON.stringify(r))}let af={};function cf(e){af=e}function pr(e){const t=e||af.gameId;if(!t)throw new Error("gameId is required. Call init({ gameId }) first or pass it as an argument.");return t}const uf=oe.createContext(void 0),gS={enabled:!0,days:7},lf={"--primary-color":"#787bf4","--icon-color":"#a9aad1","--input-border-color":"#cad0e0","--input-label-color":"var(--jssdk-primary-color)","--input-bg-color":"#fff"};function Dn(){const e=oe.use(uf);if(!e)throw new Error("useConfig 必须在 ConfigProvider 中使用");return e}function df({children:e,value:t}){const n=pr(t.gameId),r=Rs(n,t.loginTypes),o=cS(n,t.defaultLoginType),s=oe.useRef(null);rf({gameId:n});const i=oe.useMemo(()=>!t.defaultLoginType&&$r(n).length>0?"quick":o,[t.defaultLoginType,n,o]),[a,c]=oe.useState(i),[u,l]=oe.useState(!0),[d,p]=oe.useState(!1),[h,m]=oe.useState(!1),[g,v]=oe.useState(""),y=()=>{p(!0)};oe.useEffect(()=>{uS({gameId:n})},[n]);const C={...t,gameId:n,loginTypes:r,defaultLoginType:o,autoLoginConfig:{...gS,...t.autoLoginConfig}};oe.useEffect(()=>{document.body.classList.add(`game-${n}`)},[n]);function S(E){Object.entries(E).forEach(([b,x])=>{const T=`--jssdk-${b.replace(/^--/,"")}`;document.documentElement.style.setProperty(T,x)})}return oe.useEffect(()=>{const E=s.current;if(E){const b={...lf,...t.styleVars};S(b)}return()=>{E&&S(lf)}},[t.styleVars]),w.jsx("div",{ref:s,children:w.jsx(uf,{value:{...C,currentLoginType:a,setCurrentLoginType:c,isShowGiantLogo:u,setIsShowGiantLogo:l,showRealNameModal:d,setShowRealNameModal:p,triggerRealNameAuth:y,isAutoLoggingIn:h,setIsAutoLoggingIn:m,autoLoginAccountName:g,setAutoLoginAccountName:v,onClose:t.onClose},children:e})})}function Eo({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=f.useRef(e!==void 0),[s,i]=f.useState(t),a=o?e:s;if(process.env.NODE_ENV!=="production"){f.useEffect(()=>{o!==(e!==void 0)&&ar([`A component is changing the ${o?"":"un"}controlled ${r} state of ${n} to be ${o?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${n} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
17
17
  `))},[r,n,e]);const{current:u}=f.useRef(t);f.useEffect(()=>{!o&&ff(u)!==ff(t)&&ar([`A component is changing the default ${r} state of an uncontrolled ${n} after being initialized. To suppress this warning opt to use a controlled ${n}.`].join(`
18
- `))},[t])}const c=f.useCallback(u=>{o||i(u)},[]);return[a,c]}function ff(e){let t=0;const n=new WeakMap;try{return JSON.stringify(e,function(s,i){if(!(s==="_owner"&&this!=null&&typeof this=="object"&&"$$typeof"in this)){if(typeof i=="bigint")return`__bigint__:${i}`;if(i!==null&&typeof i=="object"){const a=n.get(i);if(a!==void 0)return`__object__:${a}`;n.set(i,t),t+=1}return i}})??`__top__:${typeof e}`}catch{return"__unserializable__"}}const $a=f.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});process.env.NODE_ENV!=="production"&&($a.displayName="CompositeListContext");function yS(){return f.useContext($a)}function vS(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=ie(o),i=f.useRef(0),a=wt(wS).current,c=wt(bS).current,[u,l]=f.useState(0),d=f.useRef(u),p=ie((y,C)=>{c.set(y,C??null),d.current+=1,l(d.current)}),h=ie(y=>{c.delete(y),d.current+=1,l(d.current)}),m=f.useMemo(()=>{const y=new Map;return Array.from(c.keys()).filter(S=>S.isConnected).sort(SS).forEach((S,E)=>{const b=c.get(S)??{};y.set(S,{...b,index:E})}),y},[c,u]);he(()=>{if(typeof MutationObserver!="function"||m.size===0)return;const y=new MutationObserver(C=>{const S=new Set,E=b=>S.has(b)?S.delete(b):S.add(b);C.forEach(b=>{b.removedNodes.forEach(E),b.addedNodes.forEach(E)}),S.size===0&&(d.current+=1,l(d.current))});return m.forEach((C,S)=>{S.parentElement&&y.observe(S.parentElement,{childList:!0})}),()=>{y.disconnect()}},[m]),he(()=>{d.current===u&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),i.current=m.size),s(m)},[s,m,n,r,u]),he(()=>()=>{n.current=[]},[n]),he(()=>()=>{r&&(r.current=[])},[r]);const g=ie(y=>(a.add(y),()=>{a.delete(y)}));he(()=>{a.forEach(y=>y(m))},[a,m]);const v=f.useMemo(()=>({register:p,unregister:h,subscribeMapChange:g,elementsRef:n,labelsRef:r,nextIndexRef:i}),[p,h,g,n,r,i]);return w.jsx($a.Provider,{value:v,children:t})}function bS(){return new Map}function wS(){return new Set}function SS(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}function qt(e){return Xn(e,"base-ui")}let pf=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function ES(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:i,unregister:a,subscribeMapChange:c,elementsRef:u,labelsRef:l,nextIndexRef:d}=yS(),p=f.useRef(-1),[h,m]=f.useState(s??(o===pf.GuessFromOrder?()=>{if(p.current===-1){const y=d.current;d.current+=1,p.current=y}return p.current}:-1)),g=f.useRef(null),v=f.useCallback(y=>{if(g.current=y,h!==-1&&y!==null&&(u.current[h]=y,l)){const C=t!==void 0;l.current[h]=C?t:r?.current?.textContent??y.textContent}},[h,u,l,t,r]);return he(()=>{if(s!=null)return;const y=g.current;if(y)return i(y,n),()=>{a(y)}},[s,i,a,n]),he(()=>{if(s==null)return c(y=>{const C=g.current?y.get(g.current)?.index:null;C!=null&&m(C)})},[s,c,m]),f.useMemo(()=>({ref:v,index:h}),[h,v])}const hf="ArrowUp",mf="ArrowDown",gf="ArrowLeft",yf="ArrowRight",vf="Home",bf="End",xS=new Set([gf,yf]),CS=new Set([hf,mf]),TS=new Set([...xS,...CS]);[...TS];const Ms=new Set([hf,mf,gf,yf,vf,bf]);function ja(e){const t=f.useRef(!0);t.current&&(t.current=!1,e())}let wf={},Sf={},Ef="";function OS(e){if(typeof document>"u")return!1;const t=Ie(e);return tt(t).innerWidth-t.documentElement.clientWidth>0}function PS(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=Ie(e),r=n.documentElement,o=n.body,s=Bn(r)?r:o,i=s.style.overflowY,a=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",s.style.overflowY="scroll";const c=s.offsetWidth;s.style.overflowY="hidden";const u=s.offsetWidth;return s.style.overflowY=i,r.style.scrollbarGutter=a,c===u}function _S(e){const t=Ie(e),n=t.documentElement,r=t.body,o=Bn(n)?n:r,s={overflowY:o.style.overflowY,overflowX:o.style.overflowX};return Object.assign(o.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(o.style,s)}}function IS(e){const t=Ie(e),n=t.documentElement,r=t.body,o=tt(n);let s=0,i=0,a=!1;const c=yn.create();if(Gi&&(o.visualViewport?.scale??1)!==1)return()=>{};function u(){const h=o.getComputedStyle(n),m=o.getComputedStyle(r),y=(h.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,wf={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Ef=n.style.scrollBehavior,Sf={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const C=n.scrollHeight>n.clientHeight,S=n.scrollWidth>n.clientWidth,E=h.overflowY==="scroll"||m.overflowY==="scroll",b=h.overflowX==="scroll"||m.overflowX==="scroll",x=Math.max(0,o.innerWidth-r.clientWidth),T=Math.max(0,o.innerHeight-r.clientHeight),P=parseFloat(m.marginTop)+parseFloat(m.marginBottom),z=parseFloat(m.marginLeft)+parseFloat(m.marginRight),I=Bn(n)?n:r;if(a=PS(e),a){n.style.scrollbarGutter=y,I.style.overflowY="hidden",I.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:y,overflowY:"hidden",overflowX:"hidden"}),(C||E)&&(n.style.overflowY="scroll"),(S||b)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:P||T?`calc(100dvh - ${P+T}px)`:"100dvh",width:z||x?`calc(100vw - ${z+x}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=s,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function l(){Object.assign(n.style,wf),Object.assign(r.style,Sf),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Ef)}function d(){l(),c.request(u)}u();const p=Fe(o,"resize",d);return()=>{c.cancel(),l(),typeof o.removeEventListener=="function"&&p()}}class kS{lockCount=0;restore=null;timeoutLock=Zt.create();timeoutUnlock=Zt.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const r=Ie(t).documentElement,o=tt(r).getComputedStyle(r).overflowY;if(o==="hidden"||o==="clip"){this.restore=Ct;return}const s=al||!OS(t);this.restore=s?_S(t):IS(t)}}const RS=new kS;function xf(e=!0,t=null){he(()=>{if(e)return RS.acquire(t)},[e,t])}function NS(e){const t=f.useRef(""),n=f.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:f.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function As(e,t){const n=f.useRef(e),r=ie(t);he(()=>{n.current!==e&&r(n.current)},[e,r]),he(()=>{n.current=e},[e])}function Ha(e){const[t,n]=f.useState(null),r=ie((i,a)=>{e||n(a||(al?"touch":""))});As(e,i=>{i&&!e&&n(null)});const{onClick:o,onPointerDown:s}=NS(r);return f.useMemo(()=>({openMethod:t,triggerProps:{onClick:o,onPointerDown:s}}),[t,o,s])}function MS(e){const{store:t,parentContext:n,actionsRef:r,isDrawer:o}=e,s=t.useState("open"),i=t.useState("disablePointerDismissal"),a=t.useState("modal"),c=t.useState("popupElement"),{openMethod:u,triggerProps:l}=Ha(s);kd(t);const{forceUnmount:d}=Rd(s,t),p=f.useCallback(()=>{t.setOpen(!1,Ae(td))},[t]);f.useImperativeHandle(r,()=>({unmount:d,close:p}),[d,p]);const h=Dd({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[m,g]=f.useState(0),[v,y]=f.useState(0),C=m===0,S=zd(h),E=ka(h,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:a==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(D){if(!t.context.outsidePressEnabledRef.current||"button"in D&&D.button!==0||"touches"in D&&D.touches.length!==1)return!1;const $=lt(D);if(C&&!i){const V=$;return a&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===V||t.context.backdropRef.current===V||we(V,c)&&!V?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:C});xf(s&&a===!0,c);const{getReferenceProps:b,getFloatingProps:x,getTriggerProps:T}=bo([S,E]);t.useContextCallback("onNestedDialogOpen",(D,$)=>{g(D),y($)}),t.useContextCallback("onNestedDialogClose",()=>{g(0),y(0)}),f.useEffect(()=>(n?.onNestedDialogOpen&&s&&n.onNestedDialogOpen(m+1,v+(o?1:0)),n?.onNestedDialogClose&&!s&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&s&&n.onNestedDialogClose()}),[o,s,m,v,n]);const P=f.useMemo(()=>b(l),[b,l]),z=f.useMemo(()=>T(l),[T,l]),I=f.useMemo(()=>x(),[x]);t.useSyncedValues({openMethod:u,activeTriggerProps:P,inactiveTriggerProps:z,popupProps:I,floatingRootContext:h,nestedOpenDialogCount:m,nestedOpenDrawerCount:v})}const Ua=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ua.displayName="DialogRootContext");function Vt(e){const t=f.useContext(Ua);if(e===!1&&t===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.":ft(27));return t}const AS={...Md,modal:de(e=>e.modal),nested:de(e=>e.nested),nestedOpenDialogCount:de(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:de(e=>e.nestedOpenDrawerCount),disablePointerDismissal:de(e=>e.disablePointerDismissal),openMethod:de(e=>e.openMethod),descriptionElementId:de(e=>e.descriptionElementId),titleElementId:de(e=>e.titleElementId),viewportElement:de(e=>e.viewportElement),role:de(e=>e.role)};class Ba extends Wo{constructor(t){super(DS(t),{popupRef:f.createRef(),backdropRef:f.createRef(),internalBackdropRef:f.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new bs,onOpenChange:void 0,onOpenChangeComplete:void 0},AS)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const r={open:t},o=n.trigger?.id??null;(o||t)&&(r.activeTriggerId=o,r.activeTriggerElement=n.trigger??null),this.update(r)};static useStore(t,n){const r=wt(()=>new Ba(n)).current;return t??r}}function DS(e={}){return{...Nd(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}const Ds=f.createContext(!1);process.env.NODE_ENV!=="production"&&(Ds.displayName="IsDrawerContext");function Wa(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:s,disablePointerDismissal:i=!1,modal:a=!0,actionsRef:c,handle:u,triggerId:l,defaultTriggerId:d=null}=e,p=Vt(!0),h=f.useContext(Ds),m=!!p,g=Ba.useStore(u?.store,{open:r,openProp:n,activeTriggerId:d,triggerIdProp:l,modal:a,disablePointerDismissal:i,nested:m});ja(()=>{n===void 0&&g.state.open===!1&&r===!0&&g.update({open:!0,activeTriggerId:d})}),g.useControlledProp("openProp",n),g.useControlledProp("triggerIdProp",l),g.useSyncedValues({disablePointerDismissal:i,nested:m,modal:a}),g.useContextCallback("onOpenChange",o),g.useContextCallback("onOpenChangeComplete",s);const v=g.useState("payload");MS({store:g,actionsRef:c,parentContext:p?.store.context,isDrawer:h});const y=f.useMemo(()=>({store:g}),[g]);return w.jsx(Ds.Provider,{value:!1,children:w.jsx(Ua.Provider,{value:y,children:typeof t=="function"?t({payload:v}):t})})}const LS={...Cn,...tn},Za=f.forwardRef(function(t,n){const{render:r,className:o,style:s,forceRender:i=!1,...a}=t,{store:c}=Vt(),u=c.useState("open"),l=c.useState("nested"),d=c.useState("mounted"),p=c.useState("transitionStatus");return qe("div",t,{state:{open:u,transitionStatus:p},ref:[c.context.backdropRef,n],stateAttributesMapping:LS,props:[{role:"presentation",hidden:!d,style:{userSelect:"none",WebkitUserSelect:"none"}},a],enabled:i||!l})});process.env.NODE_ENV!=="production"&&(Za.displayName="DialogBackdrop");const Ga=f.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,style:a,...c}=t,{store:u}=Vt(),l=u.useState("open");function d(g){l&&u.setOpen(!1,Ae(C0,g.nativeEvent))}const{getButtonProps:p,buttonRef:h}=Lr({disabled:s,native:i});return qe("button",t,{state:{disabled:s},ref:[n,h],props:[{onClick:d},c,p]})});process.env.NODE_ENV!=="production"&&(Ga.displayName="DialogClose");const Ya=f.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,{store:c}=Vt(),u=qt(i);return c.useSyncedValueWithCleanup("descriptionElementId",u),qe("p",t,{ref:n,props:[{id:u},a]})});process.env.NODE_ENV!=="production"&&(Ya.displayName="DialogDescription");let FS=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),VS=(function(e){return e[e.open=Ft.open]="open",e[e.closed=Ft.closed]="closed",e[e.startingStyle=Ft.startingStyle]="startingStyle",e[e.endingStyle=Ft.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Xa=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Xa.displayName="DialogPortalContext");function qa(){const e=f.useContext(Xa);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Dialog.Portal> is missing.":ft(26));return e}const zS={...Cn,...tn,nestedDialogOpen(e){return e?{[VS.nestedDialogOpen]:""}:null}},Ka=f.forwardRef(function(t,n){const{className:r,finalFocus:o,initialFocus:s,render:i,style:a,...c}=t,{store:u}=Vt(),l=u.useState("descriptionElementId"),d=u.useState("disablePointerDismissal"),p=u.useState("floatingRootContext"),h=u.useState("popupProps"),m=u.useState("modal"),g=u.useState("mounted"),v=u.useState("nested"),y=u.useState("nestedOpenDialogCount"),C=u.useState("open"),S=u.useState("openMethod"),E=u.useState("titleElementId"),b=u.useState("transitionStatus"),x=u.useState("role");qa(),xn({open:C,ref:u.context.popupRef,onComplete(){C&&u.context.onOpenChangeComplete?.(!0)}});function T($){return $==="touch"?u.context.popupRef.current:!0}const P=s===void 0?T:s,z=y>0,D=qe("div",t,{state:{open:C,nested:v,transitionStatus:b,nestedDialogOpen:z},props:[h,{"aria-labelledby":E??void 0,"aria-describedby":l??void 0,role:x,tabIndex:-1,hidden:!g,onKeyDown($){Ms.has($.key)&&$.stopPropagation()},style:{[FS.nestedDialogs]:y}},c],ref:[n,u.context.popupRef,u.useStateSetter("popupElement")],stateAttributesMapping:zS});return w.jsx(ms,{context:p,openInteractionType:S,disabled:!g,closeOnFocusOut:!d,initialFocus:P,returnFocus:o,modal:m!==!1,restoreFocus:"popup",children:D})});process.env.NODE_ENV!=="production"&&(Ka.displayName="DialogPopup");const Ls=f.forwardRef(function(t,n){const{cutout:r,...o}=t;let s;if(r){const i=r.getBoundingClientRect();s=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return w.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})});process.env.NODE_ENV!=="production"&&(Ls.displayName="InternalBackdrop");const Fs=f.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=Vt(),i=s.useState("mounted"),a=s.useState("modal"),c=s.useState("open");return i||r?w.jsx(Xa.Provider,{value:r,children:w.jsxs(hs,{ref:n,...o,children:[i&&a===!0&&w.jsx(Ls,{ref:s.context.internalBackdropRef,inert:cs(!c)}),t.children]})}):null});process.env.NODE_ENV!=="production"&&(Fs.displayName="DialogPortal");const Vs=f.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,{store:c}=Vt(),u=qt(i);return c.useSyncedValueWithCleanup("titleElementId",u),qe("h2",t,{ref:n,props:[{id:u},a]})});process.env.NODE_ENV!=="production"&&(Vs.displayName="DialogTitle");const zs=f.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,id:a,payload:c,handle:u,style:l,...d}=t,p=Vt(!0),h=u?.store??p?.store;if(!h)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Dialog.Trigger> must be used within <Dialog.Root> or provided with a handle.":ft(79));const m=qt(a),g=h.useState("floatingRootContext"),v=h.useState("isOpenedByTrigger",m),y=f.useRef(null),{registerTrigger:C,isMountedByThisTrigger:S}=Id(m,y,h,{payload:c}),{getButtonProps:E,buttonRef:b}=Lr({disabled:s,native:i}),x=Ia(g,{enabled:g!=null}),T=bo([x]),P={disabled:s,open:v},z=h.useState("triggerProps",S);return qe("button",t,{state:P,ref:[b,n,C,y],props:[T.getReferenceProps(),z,{[ha]:"",id:m},d,E],stateAttributesMapping:Yd})});process.env.NODE_ENV!=="production"&&(zs.displayName="DialogTrigger");let Cf=(function(e){return e[e.open=Ft.open]="open",e[e.closed=Ft.closed]="closed",e[e.startingStyle=Ft.startingStyle]="startingStyle",e[e.endingStyle=Ft.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const $S={...Cn,...tn,nested(e){return e?{[Cf.nested]:""}:null},nestedDialogOpen(e){return e?{[Cf.nestedDialogOpen]:""}:null}},Tf=f.forwardRef(function(t,n){const{className:r,render:o,children:s,style:i,...a}=t,c=qa(),{store:u}=Vt(),l=u.useState("open"),d=u.useState("nested"),p=u.useState("transitionStatus"),h=u.useState("nestedOpenDialogCount"),m=u.useState("mounted"),g=h>0;return qe("div",t,{enabled:c||m,state:{open:l,nested:d,transitionStatus:p,nestedDialogOpen:g},ref:[n,u.useStateSetter("viewportElement")],stateAttributesMapping:$S,props:[{role:"presentation",hidden:!m,style:{pointerEvents:l?void 0:"none"},children:s},a]})});process.env.NODE_ENV!=="production"&&(Tf.displayName="DialogViewport");const jS=(e,t)=>Object.is(e,t);function jr(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function HS(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:jr(t,r,n))}function xo(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:jr(r,t,n))}function US(e,t,n){return e.filter(r=>!jr(t,r,n))}function Ja(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function BS(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function WS(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(BS(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function ZS(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Ja(e)}function Hr(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Ja(e.value):Ja(e)}let Of=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const $s={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Co={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},GS={disabled:!1,...Co},hr={valid(e){return e===null?null:e?{[Of.valid]:""}:{[Of.invalid]:""}}},Qa=f.createContext({invalid:void 0,name:void 0,validityData:{state:$s,errors:[],error:"",value:"",initialValue:null},setValidityData:Ct,disabled:void 0,touched:Co.touched,setTouched:Ct,dirty:Co.dirty,setDirty:Ct,filled:Co.filled,setFilled:Ct,focused:Co.focused,setFocused:Ct,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:GS,markedDirtyRef:{current:!1},registerFieldControl:Ct,validation:{getValidationProps:(e=mt)=>e,getInputValidationProps:(e=mt)=>e,inputRef:{current:null},commit:async()=>{}}});process.env.NODE_ENV!=="production"&&(Qa.displayName="FieldRootContext");function mr(e=!0){const t=f.useContext(Qa);if(t.setValidityData===Ct&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.":ft(28));return t}function ec(e,t){const{enabled:n=!0,getValue:r,id:o,value:s}=t,{registerFieldControl:i}=mr(),a=f.useRef(null);a.current||(a.current=Symbol()),he(()=>{const c=a.current;if(!(!c||!n))return i(c,{controlRef:e,getValue:r,id:o,value:s}),()=>{i(c,void 0)}},[e,n,r,o,i,s])}const tc=f.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Ct,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});process.env.NODE_ENV!=="production"&&(tc.displayName="FormContext");function Ur(){return f.useContext(tc)}const nc=f.createContext({controlId:void 0,registerControlId:Ct,labelId:void 0,setLabelId:Ct,messageIds:[],setMessageIds:Ct,getDescriptionProps:e=>e});process.env.NODE_ENV!=="production"&&(nc.displayName="LabelableContext");function Ln(){return f.useContext(nc)}function rc(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:o,registerControlId:s}=Ln(),i=qt(t),a=n?o:void 0,c=wt(()=>Symbol("labelable-control")),u=f.useRef(!1),l=f.useRef(t!=null),d=ie(()=>{!u.current||s===Ct||(u.current=!1,s(c.current,void 0))});return he(()=>{if(s===Ct)return;let p;if(n){const h=r?.current;$e(h)&&h.closest("label")!=null?p=t??null:p=a??i}else if(t!=null)l.current=!0,p=t;else if(l.current)p=i;else{d();return}if(p===void 0){d();return}u.current=!0,s(c.current,p)},[t,r,a,s,n,i,c,d]),f.useEffect(()=>d,[d]),o??i}function YS(e){const t=e.getBoundingClientRect();if(process.env.NODE_ENV!=="production")return t;const n=tt(e),r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||o.content!=="none"))return t;const i=parseFloat(r.width)||0,a=parseFloat(r.height)||0,c=parseFloat(o.width)||0,u=parseFloat(o.height)||0,l=Math.max(t.width,i,c),d=Math.max(t.height,a,u),p=l-t.width,h=d-t.height;return{left:t.left-p/2,right:t.right+p/2,top:t.top-h/2,bottom:t.bottom+h/2}}function XS(e,t){return e??t}const qS=20;function Pf(e,t,n,r){const[o,s]=f.useState(!1);he(()=>{if(!e||!t||n==null){s(!1);return}const i=Ie(n).documentElement.clientWidth,a=n.offsetWidth;s(i>0&&a>0&&a>=i-qS)},[e,t,n]),xf(e&&(!t||o),r)}let _f=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.indeterminate="data-indeterminate",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});function If(e){return f.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[_f.checked]:""}:{[_f.unchecked]:""}},...hr}),[e.indeterminate])}const kf=f.createContext({disabled:!1});process.env.NODE_ENV!=="production"&&(kf.displayName="FieldItemContext");function KS(){return f.useContext(kf)}function JS(e,t,n,r=!0,o){const[s,i]=f.useState(),a=qt(o?`${o}-label`:void 0),c=e??t??s;return he(()=>{const u=e||t||!r?void 0:QS(n.current,a);s!==u&&i(u)}),c}function QS(e,t){const n=eE(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function eE(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const n=e.id;if(n){const o=e.nextElementSibling;if(o&&o.htmlFor===n)return o}const r=e.labels;return r&&r[0]}const Rf=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Rf.displayName="CheckboxGroupContext");function tE(e=!0){const t=f.useContext(Rf);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CheckboxGroupContext is missing. CheckboxGroup parts must be placed within <CheckboxGroup>.":ft(3));return t}const oc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(oc.displayName="CheckboxRootContext");function nE(){const e=f.useContext(oc);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CheckboxRootContext is missing. Checkbox parts must be placed within <Checkbox.Root>.":ft(14));return e}const rE="data-parent",sc=f.forwardRef(function(t,n){const{checked:r,className:o,defaultChecked:s=!1,"aria-labelledby":i,disabled:a=!1,form:c,id:u,indeterminate:l=!1,inputRef:d,name:p,onCheckedChange:h,parent:m=!1,readOnly:g=!1,render:v,required:y=!1,uncheckedValue:C,value:S,nativeButton:E=!1,style:b,...x}=t,{clearErrors:T}=Ur(),{disabled:P,name:z,setDirty:I,setFilled:D,setFocused:$,setTouched:V,state:N,validationMode:O,validityData:k,shouldValidateOnChange:_,validation:M}=mr(),A=KS(),{labelId:j,controlId:B,registerControlId:U,getDescriptionProps:W}=Ln(),G=tE(),Z=G?.parent,X=Z&&G.allValues,K=P||A.disabled||G?.disabled||a,J=z??p,se=S??J,ae=qt(),pe=qt();let Y=B;X?Y=m?pe:`${Z.id}-${se}`:u&&(Y=u);let me={};X&&(m?me=G.parent.getParentProps():se&&(me=G.parent.getChildProps(se)));const ge=ie(h),{checked:fe=r,indeterminate:le=l,onCheckedChange:ce,...ve}=me,ue=G?.value,Se=G?.setValue,R=G?.defaultValue,H=f.useRef(null),L=wt(()=>Symbol("checkbox-control")),F=f.useRef(!1),{getButtonProps:Q,buttonRef:ne}=Lr({disabled:K,native:E}),te=G?.validation??M,[ye,_e]=Eo({controlled:se&&ue&&!m?ue.includes(se):fe,default:se&&R&&!m?R.includes(se):s,name:"Checkbox",state:"checked"});he(()=>{U!==Ct&&(F.current=!0,U(L.current,Y))},[Y,G,U,m,L]),f.useEffect(()=>{const Te=L.current;return()=>{!F.current||U===Ct||(F.current=!1,U(Te,void 0))}},[U,L]),ec(H,{enabled:!G,id:ae,value:ye});const Ee=f.useRef(null),Ce=or(d,Ee,te.inputRef),Pe=JS(i,j,Ee,!E,Y??void 0);he(()=>{Ee.current&&(Ee.current.indeterminate=le,ye&&D(!0))},[ye,le,D]),As(ye,()=>{G&&!m||(T(J),D(ye),I(ye!==k.initialValue),_()?te.commit(ye):te.commit(ye,!0))});const Ve=En({checked:ye,disabled:K,form:c,name:m?void 0:J,id:E?void 0:Y??void 0,required:y,ref:Ce,style:J?Al:ss,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(Te){if(Te.nativeEvent.defaultPrevented)return;if(g){Te.preventDefault();return}const Ue=Te.currentTarget.checked,Be=Ae(cr,Te.nativeEvent);if(ce?.(Ue,Be),ge(Ue,Be),!Be.isCanceled&&(_e(Ue),se&&ue&&Se&&!m&&!X)){const ct=Ue?[...ue,se]:ue.filter(Ye=>Ye!==se);Se(ct,Be)}},onFocus(){H.current?.focus()}},S!==void 0?{value:(G?ye&&S:S)||""}:mt,W,G?te.getValidationProps:te.getInputValidationProps),Ge=X?!!fe:ye,He=X&&le||l;f.useEffect(()=>{if(!Z||!se)return;const Te=Z.disabledStatesRef.current;return Te.set(se,K),()=>{Te.delete(se)}},[Z,K,se]);const nt=f.useMemo(()=>({...N,checked:Ge,disabled:K,readOnly:g,required:y,indeterminate:He}),[N,Ge,K,g,y,He]),st=If(nt),Re=qe("span",t,{state:nt,ref:[ne,H,n,G?.registerControlRef],props:[{id:E?Y??void 0:ae,role:"checkbox","aria-checked":le?"mixed":ye,"aria-readonly":g||void 0,"aria-required":y||void 0,"aria-labelledby":Pe,[rE]:m?"":void 0,onFocus(){$(!0)},onBlur(){const Te=Ee.current;Te&&(V(!0),$(!1),O==="onBlur"&&te.commit(G?ue:Te.checked))},onClick(Te){g||K||(Te.preventDefault(),Ee.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:Te.shiftKey,ctrlKey:Te.ctrlKey,altKey:Te.altKey,metaKey:Te.metaKey})))}},W,te.getValidationProps,x,ve,Q],stateAttributesMapping:st});return w.jsxs(oc.Provider,{value:nt,children:[Re,!ye&&!G&&J&&!m&&C!==void 0&&w.jsx("input",{type:"hidden",form:c,name:J,value:C}),w.jsx("input",{...Ve,suppressHydrationWarning:!0})]})});process.env.NODE_ENV!=="production"&&(sc.displayName="CheckboxRoot");const ic=f.forwardRef(function(t,n){const{render:r,className:o,style:s,keepMounted:i=!1,...a}=t,c=nE(),u=c.checked||c.indeterminate,{mounted:l,transitionStatus:d,setMounted:p}=vo(u),h=f.useRef(null),m={...c,transitionStatus:d};xn({open:u,ref:h,onComplete(){u||p(!1)}});const g=If(c),v=f.useMemo(()=>({...g,...tn,...hr}),[g]),y=i||l,C=qe("span",t,{ref:[n,h],state:m,stateAttributesMapping:v,props:a});return y?C:null});process.env.NODE_ENV!=="production"&&(ic.displayName="CheckboxIndicator");function oE(e,t){const n=qt(e);return he(()=>(t(n),()=>{t(void 0)}),[n,t]),n}function sE(e={}){const{id:t,fallbackControlId:n,native:r=!1,setLabelId:o,focusControl:s}=e,{controlId:i,setLabelId:a}=Ln(),c=ie(h=>{a(h),o?.(h)}),u=oE(t,c),l=i??n;function d(h){if(s){s(h,l);return}if(!l)return;const m=Ie(h.currentTarget).getElementById(l);it(m)&&iE(m)}function p(h){lt(h.nativeEvent)?.closest("button,input,select,textarea")||(!h.defaultPrevented&&h.detail>1&&h.preventDefault(),!r&&d(h))}return r?{id:u,htmlFor:l??void 0,onMouseDown:p}:{id:u,onClick:p,onPointerDown(h){h.preventDefault()}}}function iE(e){e.focus({focusVisible:!0})}const Nf=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Nf.displayName="ToolbarRootContext");function Mf(e){return f.useContext(Nf)}function aE(e,t){const n=f.useRef(null),r=ie(s=>{Kt.flushSync(()=>{e.setOpen(!1,Ae(ur,s.nativeEvent,s.currentTarget))}),Ab(n.current)?.focus()}),o=ie(s=>{const i=e.select("positionerElement");if(i&&Ar(s,i))e.context.beforeContentFocusGuardRef.current?.focus();else{Kt.flushSync(()=>{e.setOpen(!1,Ae(ur,s.nativeEvent,s.currentTarget))});let a=Mb(e.context.triggerFocusTargetRef.current||t.current);for(;a!==null&&we(i,a);){const c=a;if(a=ca(a),a===c)break}a?.focus()}});return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:o}}function cE(e){const[t,n]=f.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}const Af=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Af.displayName="CSPContext");const uE={disableStyleElements:!1};function lE(){return f.useContext(Af)??uE}let Tt=(function(e){return e.nestedDrawers="--nested-drawers",e.height="--drawer-height",e.frontmostHeight="--drawer-frontmost-height",e.swipeMovementX="--drawer-swipe-movement-x",e.swipeMovementY="--drawer-swipe-movement-y",e.snapPointOffset="--drawer-snap-point-offset",e.swipeStrength="--drawer-swipe-strength",e})({}),Fn=(function(e){return e.swipeProgress="--drawer-swipe-progress",e})({});const dE={...Cn,...tn},Df=f.forwardRef(function(t,n){const{render:r,className:o,style:s,forceRender:i=!1,...a}=t,{store:c}=Vt(),u=c.useState("open"),l=c.useState("nested"),d=c.useState("mounted"),p=c.useState("transitionStatus");return qe("div",t,{state:{open:u,transitionStatus:p},ref:[c.context.backdropRef,n],stateAttributesMapping:dE,props:[{role:"presentation",hidden:!d,style:{pointerEvents:u?void 0:"none",userSelect:"none",WebkitUserSelect:"none",[Fn.swipeProgress]:"0",[Tt.swipeStrength]:"1"}},a],enabled:i||!l})});process.env.NODE_ENV!=="production"&&(Df.displayName="DrawerBackdrop");const Lf="data-drawer-content",Ff=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t;return Vt(),qe("div",t,{ref:n,props:[{[Lf]:""},i]})});process.env.NODE_ENV!=="production"&&(Ff.displayName="DrawerContent");const Vf=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Vf.displayName="DrawerProviderContext");function zf(e){return f.useContext(Vf)}let ln=(function(e){return e[e.open=Ft.open]="open",e[e.closed=Ft.closed]="closed",e[e.startingStyle=Ft.startingStyle]="startingStyle",e[e.endingStyle=Ft.endingStyle]="endingStyle",e.expanded="data-expanded",e.nestedDrawerOpen="data-nested-drawer-open",e.nestedDrawerSwiping="data-nested-drawer-swiping",e.swipeDismiss="data-swipe-dismiss",e.swipeDirection="data-swipe-direction",e.swiping="data-swiping",e})({});const ac=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(ac.displayName="DrawerRootContext");function js(e){const t=f.useContext(ac);if(e===!1&&t===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: DrawerRootContext is missing. Drawer parts must be placed within <Drawer.Root>.":ft(90));return t}function bt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function $f(e,t,n){if(!Number.isFinite(t)||t<=0)return null;if(typeof e=="number")return Number.isFinite(e)?e<=1?bt(e,0,1)*t:e:null;const r=e.trim();if(r.endsWith("px")){const o=Number.parseFloat(r);return Number.isFinite(o)?o:null}if(r.endsWith("rem")){const o=Number.parseFloat(r);return Number.isFinite(o)?o*n:null}return null}function fE(e,t){let n=null,r=1/0;for(const o of t){const s=Math.abs(o.height-e);s<r&&(r=s,n=o)}return n}function jf(){const{store:e}=Vt(),{snapPoints:t,activeSnapPoint:n,setActiveSnapPoint:r,popupHeight:o}=js(),s=e.useState("viewportElement"),[i,a]=f.useState(0),[c,u]=f.useState(16),l=ie(()=>{const m=Ie(s).documentElement;s&&a(s.offsetHeight),s||a(m.clientHeight);const g=parseFloat(getComputedStyle(m).fontSize);Number.isFinite(g)&&u(g)});he(()=>{if(l(),!s||typeof ResizeObserver!="function")return;const h=new ResizeObserver(l);return h.observe(s),()=>{h.disconnect()}},[l,s]);const d=f.useMemo(()=>{if(!t||t.length===0||i<=0||o<=0)return[];const h=Math.min(o,i);if(!Number.isFinite(h)||h<=0)return[];const m=t.map(y=>{const C=$f(y,i,c);if(C===null||!Number.isFinite(C))return null;const S=bt(C,0,h);return{value:y,height:S,offset:Math.max(0,o-S)}}).filter(y=>!!y);if(m.length<=1)return m;const g=[],v=[];for(let y=m.length-1;y>=0;y-=1){const C=m[y];v.some(E=>Math.abs(E-C.height)<=1)||(v.push(C.height),g.push(C))}return g.reverse(),g},[o,c,t,i]),p=f.useMemo(()=>{if(n===void 0)return d[0];if(n===null)return;const h=d.find(y=>Object.is(y.value,n));if(h)return h;const m=Math.min(o,i),g=$f(n,i,c);if(g===null||!Number.isFinite(g))return;const v=bt(g,0,m);return fE(v,d)??void 0},[n,o,d,c,i]);return{snapPoints:t,activeSnapPoint:n,setActiveSnapPoint:r,popupHeight:o,viewportHeight:i,resolvedSnapPoints:d,activeSnapPointOffset:p?.offset??null}}const cc=f.createContext(null);process.env.NODE_ENV!=="production"&&(cc.displayName="DrawerViewportContext");function pE(e){return f.useContext(cc)}let Hf=!1;function hE(){Hf||(typeof CSS<"u"&&"registerProperty"in CSS&&([Tt.swipeMovementX,Tt.swipeMovementY,Tt.snapPointOffset].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),[{name:Fn.swipeProgress,initialValue:"0"},{name:Tt.swipeStrength,initialValue:"1"}].forEach(({name:e,initialValue:t})=>{try{CSS.registerProperty({name:e,syntax:"<number>",inherits:!1,initialValue:t})}catch{}})),Hf=!0)}const mE={...Cn,...tn,expanded(e){return e?{[ln.expanded]:""}:null},nestedDrawerOpen(e){return e?{[ln.nestedDrawerOpen]:""}:null},nestedDrawerSwiping(e){return e?{[ln.nestedDrawerSwiping]:""}:null},swipeDirection(e){return e?{[ln.swipeDirection]:e}:null},swiping(e){return e?{[ln.swiping]:""}:null}},Uf=f.forwardRef(function(t,n){const{className:r,finalFocus:o,initialFocus:s,render:i,style:a,...c}=t,{store:u}=Vt(),{swipeDirection:l,frontmostHeight:d,hasNestedDrawer:p,nestedSwiping:h,nestedSwipeProgressStore:m,onPopupHeightChange:g,notifyParentFrontmostHeight:v,notifyParentHasNestedDrawer:y}=js(),C=u.useState("descriptionElementId"),S=u.useState("disablePointerDismissal"),E=u.useState("floatingRootContext"),b=u.useState("popupProps"),x=u.useState("modal"),T=u.useState("mounted"),P=u.useState("nested"),z=u.useState("nestedOpenDrawerCount"),I=u.useState("transitionStatus"),D=u.useState("open"),$=u.useState("openMethod"),V=u.useState("titleElementId"),N=u.useState("role"),O=z>0,k=pE(),_=k?.swiping??!1,M=k?.swipeStrength??null,{snapPoints:A,activeSnapPoint:j,activeSnapPointOffset:B}=jf();qa();const[U,W]=f.useState(0),G=f.useRef(0);process.env.NODE_ENV!=="production"&&f.useEffect(()=>{if(k)return;const ge=Dr.captureOwnerStack?.()||"";ar(`<Drawer.Popup> expected to be rendered within <Drawer.Viewport>. Omitting the viewport disables drawer swipe handling and touch scroll locking. Wrap <Drawer.Popup> in <Drawer.Viewport>.${ge}`)},[k]);const Z=ie(()=>{const ge=u.context.popupRef.current;if(!ge)return;const fe=ge.offsetHeight;if(G.current>0&&d>G.current&&fe>G.current)return;if(G.current>0&&p){const ve=G.current;W(ve),g(ve);return}const ce=fe;ce!==G.current&&(G.current=ce,W(ce),g(ce))});he(()=>{if(!T){G.current=0,W(0),g(0);return}const ge=u.context.popupRef.current;if(!ge||(hE(),Z(),typeof ResizeObserver!="function"))return;const fe=new ResizeObserver(Z);return fe.observe(ge),()=>{fe.disconnect()}},[Z,T,O,g,u.context.popupRef]),he(()=>{const ge=u.context.popupRef,fe=()=>{const ce=ge.current;if(!ce)return;const ve=m.getSnapshot();ve>0?ce.style.setProperty(Fn.swipeProgress,`${ve}`):ce.style.setProperty(Fn.swipeProgress,"0")};fe();const le=m.subscribe(fe);return()=>{le();const ce=ge.current;ce&&ce.style.setProperty(Fn.swipeProgress,"0")}},[m,u.context.popupRef]),f.useEffect(()=>{if(D)return v?.(d),()=>{v?.(0)}},[d,D,v]),f.useEffect(()=>y?(y(D||I==="ending"),()=>{y(!1)}):void 0,[y,D,I]),xn({open:D,ref:u.context.popupRef,onComplete(){D&&u.context.onOpenChangeComplete?.(!0)}});const X=s===void 0?u.context.popupRef:s,K={open:D,nested:P,transitionStatus:I,expanded:j===1,nestedDrawerOpen:O,nestedDrawerSwiping:h,swipeDirection:l,swiping:_};let J;U&&!(!p&&I!=="ending")&&(J=`${U}px`);const ae=A&&A.length>0&&(l==="down"||l==="up");let pe=null;ae&&B!==null&&(pe=l==="up"?-B:B);let Y=k?k.getDragStyles():mt;if(ae&&l==="down"){const ge=B??0,fe=Number.parseFloat(String(Y[Tt.swipeMovementY]??0)),le=Number.isFinite(fe)?ge+fe:ge,ce=le<0;if(_&&ce&&Number.isFinite(fe)){const ve=Math.abs(le),Se=-Math.sqrt(ve)-ge;Y={...Y,transform:void 0,[Tt.swipeMovementY]:`${Se}px`}}else Y={...Y,transform:void 0}}const me=qe("div",t,{state:K,props:[b,{"aria-labelledby":V,"aria-describedby":C,role:N,tabIndex:-1,hidden:!T,onKeyDown(ge){Ms.has(ge.key)&&ge.stopPropagation()},style:{...Y,[Fn.swipeProgress]:"0",[Tt.nestedDrawers]:z,[Tt.height]:J,[Tt.snapPointOffset]:typeof pe=="number"?`${pe}px`:"0px",[Tt.frontmostHeight]:d?`${d}px`:void 0,[Tt.swipeStrength]:typeof M=="number"&&Number.isFinite(M)&&M>0?`${M}`:"1"}},c],ref:[n,u.context.popupRef,u.useStateSetter("popupElement")],stateAttributesMapping:mE});return w.jsx(ms,{context:E,openInteractionType:$,disabled:!T,closeOnFocusOut:!S,initialFocus:X,returnFocus:o,modal:x!==!1,restoreFocus:"popup",children:me})});process.env.NODE_ENV!=="production"&&(Uf.displayName="DrawerPopup");const gE=Fs;var Bf,Wf;function yE(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:s,disablePointerDismissal:i=!1,modal:a=!0,actionsRef:c,handle:u,triggerId:l,defaultTriggerId:d=null,swipeDirection:p="down",snapToSequentialPoints:h=!1,snapPoints:m,snapPoint:g,defaultSnapPoint:v,onSnapPointChange:y}=e,C=ie(y),S=js(!0),E=S?.onNestedSwipeProgressChange,b=S?.onNestedFrontmostHeightChange,x=S?.onNestedSwipingChange,T=S?.onNestedDrawerPresenceChange,[P,z]=f.useState(0),[I,D]=f.useState(0),[$,V]=f.useState(!1),[N,O]=f.useState(!1),[k]=f.useState(vE),_=v!==void 0?v:m?.[0]??null,M=g!==void 0,[A,j]=Eo({controlled:g,default:_,name:"Drawer",state:"snapPoint"}),B=f.useRef(!1),U=ie((Y,me)=>{const ge=me??Ae(cr);C?.(Y,ge),!ge.isCanceled&&j(Y)}),W=f.useMemo(()=>M||!m||m.length===0?A:A===null||!m.some(Y=>Object.is(Y,A))?_:A,[A,M,_,m]),G=ie(Y=>{z(Y),!B.current&&Y>0&&D(Y)}),Z=ie(Y=>{if(Y>0){B.current=!0,D(Y);return}B.current=!1,P>0&&D(P)}),X=ie(Y=>{V(Y)}),K=ie(Y=>{k.set(Y),E?.(Y)}),J=ie(Y=>{O(Y),x?.(Y)}),se=ie((Y,me)=>{o?.(Y,me),!me.isCanceled&&!Y&&m&&m.length>0&&U(_,Ae(me.reason,me.event,me.trigger))}),ae=f.useMemo(()=>({swipeDirection:p,snapToSequentialPoints:h,snapPoints:m,activeSnapPoint:W,setActiveSnapPoint:U,frontmostHeight:I,popupHeight:P,hasNestedDrawer:$,nestedSwiping:N,nestedSwipeProgressStore:k,onNestedDrawerPresenceChange:X,onPopupHeightChange:G,onNestedFrontmostHeightChange:Z,onNestedSwipingChange:J,onNestedSwipeProgressChange:K,notifyParentFrontmostHeight:b,notifyParentSwipingChange:x,notifyParentSwipeProgressChange:E,notifyParentHasNestedDrawer:T}),[W,I,$,N,k,T,E,x,b,X,Z,K,J,G,P,U,m,h,p]),pe=typeof t=="function"?Y=>w.jsxs(f.Fragment,{children:[Bf||(Bf=w.jsx(Zf,{})),t(Y)]}):w.jsxs(f.Fragment,{children:[Wf||(Wf=w.jsx(Zf,{})),t]});return w.jsx(ac.Provider,{value:ae,children:w.jsx(Ds.Provider,{value:!0,children:w.jsx(Wa,{open:n,defaultOpen:r,onOpenChange:se,onOpenChangeComplete:s,disablePointerDismissal:i,modal:a,actionsRef:c,handle:u,triggerId:l,defaultTriggerId:d,children:pe})})})}function vE(){let e=0;const t=new Set;return{getSnapshot:()=>e,set(n){const r=Number.isFinite(n)?n:0;r!==e&&(e=r,t.forEach(o=>{o()}))},subscribe(n){return t.add(n),()=>{t.delete(n)}}}}function Zf(){const e=Xn(),t=zf(),n=Vt(!1),r=n.store.useState("open"),o=n.store.useState("nestedOpenDialogCount"),s=n.store.useState("popupElement"),i=o===0;return f.useEffect(()=>{if(!(!t||e==null))return()=>{t.removeDrawer(e)}},[e,t]),f.useEffect(()=>{e!=null&&t?.setDrawerOpen(e,r)},[e,r,t]),f.useEffect(()=>{if(!r||!i||!Jo)return;const c=tt(s).CloseWatcher;if(!c)return;function u(p){n.store.select("open")&&n.store.setOpen(!1,Ae(T0,p))}const l=new c,d=Fe(l,"close",u);return()=>{d(),l.destroy()}},[n.store,i,r,s]),null}function uc(e,t){const n=At(e);if(t==="vertical"){const o=n.overflowY;return(o==="auto"||o==="scroll")&&e.scrollHeight>e.clientHeight}const r=n.overflowX;return(r==="auto"||r==="scroll")&&e.scrollWidth>e.clientWidth}function bE(e,t,n){let r=e;for(;r&&r!==t;){for(const o of n)if(uc(r,o))return!0;r=r.parentElement}return!1}function Br(e,t,n="vertical"){let r=it(e)?e:null;for(;r&&r!==t;){if(uc(r,n))return r;r=r.parentElement}return uc(t,n)?t:null}function Hs(e,t,n){return typeof e?.elementFromPoint=="function"?e.elementFromPoint(t,n):null}const wE=40,SE=10,EE=1,xE=50,Gf=16,CE=80,TE='button,a,input,select,textarea,label,[role="button"]';function lc(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}function OE(e){const n=tt(e).getComputedStyle(e).transform;let r=0,o=0,s=1;if(n&&n!=="none"){const i=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(i){const a=i[1].split(", ").map(parseFloat);a.length===6?(r=a[4],o=a[5],s=Math.sqrt(a[0]*a[0]+a[1]*a[1])):a.length===16&&(r=a[12],o=a[13],s=a[0])}}return{x:r,y:o,scale:s}}function Us(e){return Number.isFinite(e)&&e>0?e:null}function PE(e){return e%2===1}function dc(e,t,n){const r=e[n];if(typeof r=="function")try{r.call(e,t)}catch(o){if(o&&typeof o=="object"&&"name"in o&&o.name==="NotFoundError")return;throw o}}function _E(e){const{enabled:t,directions:n,elementRef:r,movementCssVars:o,canStart:s,ignoreSelectorWhenTouch:i=!0,ignoreScrollableAncestors:a=!1,swipeThreshold:c,onDismiss:u,onProgress:l,onCancel:d,onSwipeStart:p,onRelease:h,onSwipingChange:m,trackDrag:g=!0}=e,v=TE,y=n.length===1?n[0]:void 0,C=Math.max(0,typeof c=="number"?c:wE),S=n.includes("left"),E=n.includes("right"),b=n.includes("up"),x=n.includes("down"),T=S||E,P=b||x,z=f.useMemo(()=>{const q=[];return P&&q.push("vertical"),T&&q.push("horizontal"),q},[T,P]),[I,D]=f.useState(void 0),[$,V]=f.useState(!1),[N,O]=f.useState(!1),[k,_]=f.useState(!1),[M,A]=f.useState({x:0,y:0}),[j,B]=f.useState({x:0,y:0,scale:1}),[U,W]=f.useState(null),G=f.useRef({x:0,y:0}),Z=f.useRef({x:0,y:0}),X=f.useRef(null),K=f.useRef({x:0,y:0,scale:1}),J=f.useRef(void 0),se=f.useRef(0),ae=f.useRef(!1),pe=f.useRef({x:0,y:0}),Y=f.useRef(!1),me=f.useRef(!1),ge=f.useRef(null),fe=f.useRef(!1),le=f.useRef(!1),ce=f.useRef({width:0,height:0}),ve=f.useRef(0),ue=f.useRef(C),Se=f.useRef(null),R=f.useRef(null),H=f.useRef({x:0,y:0}),L=f.useRef(null),F=f.useRef(!1),Q=ie(q=>{F.current!==q&&(F.current=q,V(q),m?.(q))});function ne(q){if(!q)return;if(typeof c!="function"){ue.current=C;return}const re=r.current;if(!re)return;const be=c({element:re,direction:q});ue.current=Math.max(0,be)}const te=ie((q,re)=>{const be=Number.isFinite(q)?bt(q,0,1):0,Le=be!==ve.current;let je=!1;if(re){const De=L.current;je=!De||De.deltaX!==re.deltaX||De.deltaY!==re.deltaY||De.direction!==re.direction}!Le&&!je||(ve.current=be,re?L.current=re:Le&&(L.current=null),l?.(be,re))});function ye(q,re){if(re===null)return;const be=R.current;if(be&&re>be.time){const Le=Math.max(re-be.time,Gf);H.current={x:(q.x-be.x)/Le,y:(q.y-be.y)/Le}}R.current={x:q.x,y:q.y,time:re}}const _e=f.useCallback(()=>{D(void 0),Q(!1),O(!1),_(!1),A({x:0,y:0}),B({x:0,y:0,scale:1}),W(null),te(0),ue.current=C,G.current={x:0,y:0},Z.current={x:0,y:0},K.current={x:0,y:0,scale:1},J.current=void 0,se.current=0,ae.current=!1,pe.current={x:0,y:0},Y.current=!1,X.current=null,me.current=!1,ge.current=null,fe.current=!1,le.current=!1,ce.current={width:0,height:0},Se.current=null,R.current=null,H.current={x:0,y:0},L.current=null},[Q,C,te]);f.useEffect(()=>{typeof c!="function"&&(ue.current=C)},[C,c]);function Ee(q){if("touches"in q){const re=q.touches[0];return re?{x:re.clientX,y:re.clientY}:null}return{x:q.clientX,y:q.clientY}}function Ce(q){return"touches"in q?!0:q.pointerType==="touch"}function Pe(q,re){const be=Ie(r.current);return Hs(be,q.x,q.y)??lt(re)}function Ve(q,re){return T&&!P?Br(q,re,"horizontal"):P&&!T?Br(q,re,"vertical"):Br(q,re,"vertical")??Br(q,re,"horizontal")}function Ge(q,re,be){fe.current=!1;const Le=Ce(q),je=Pe(re,q.nativeEvent),Qe=Ie(r.current).body,Oe=Le&&Qe?Ve(je,Qe):null,xe=be?.ignoreScrollableTarget??!1;if(Oe&&!xe||(fe.current=!!(Oe&&xe),(je?je.closest(v):!1)&&(!Le||i)))return!1;const Me=r.current;if(a&&Me&&je&&z.length>0&&!(be?.ignoreScrollableAncestors??!1)&&bE(je,Me,z))return!1;if(ae.current=!1,J.current=void 0,se.current=0,G.current=re,Se.current=Us(q.timeStamp),pe.current=re,X.current=re,Me){ce.current={width:Me.offsetWidth,height:Me.offsetHeight},ne(y);const Xe=OE(Me);K.current=Xe,Z.current={x:Xe.x,y:Xe.y},B(Xe),A({x:Xe.x,y:Xe.y}),ye({x:Xe.x,y:Xe.y},Se.current),"touches"in q||dc(Me,q.pointerId,"setPointerCapture")}return p?.(q.nativeEvent),Q(!0),O(!1),W(null),Y.current=!0,te(0),!0}function He(){nt(),fe.current=!1,X.current=null}function nt(){me.current=!1,ge.current=null}function st(q){if(He(),!F.current)return;Q(!1),O(!1),W(null);const re=g?j:K.current;Z.current={x:re.x,y:re.y},A({x:re.x,y:re.y}),D(void 0),le.current=!1;const be=r.current;be&&dc(be,q.pointerId,"releasePointerCapture"),te(0,{deltaX:0,deltaY:0,direction:void 0}),d?.(q.nativeEvent)}function Re(q,re){const be=Qe=>Qe>=0?Qe**.5:-(Math.abs(Qe)**.5),Le=(Qe,Oe,xe)=>!Oe&&Qe<0||!xe&&Qe>0?be(Qe):Qe,je=T?Le(q,S,E):be(q),De=P?Le(re,b,x):be(re);return{x:je,y:De}}function Te(q,re,be){const Le=Math.abs(re),je=Math.abs(be);if(P&&be!==0&&(!T||je>=Le)){const Oe=Math.max(0,q.scrollHeight-q.clientHeight),xe=q.scrollTop<=0,Ne=q.scrollTop>=Oe,Me=be>0,Xe=be<0;return Me&&xe&&x||Xe&&Ne&&b}if(T&&re!==0&&(!P||Le>je)){const Oe=Math.max(0,q.scrollWidth-q.clientWidth),xe=q.scrollLeft<=0,Ne=q.scrollLeft>=Oe,Me=re>0,Xe=re<0;return Me&&xe&&E||Xe&&Ne&&S}return null}const Ue=ie(q=>{if(!t||q.defaultPrevented||q.nativeEvent.defaultPrevented||!("touches"in q)&&q.button!==0)return;const re=Ee(q);!re||(me.current=!0,ge.current=re,fe.current=!1,le.current=!1,!(s?s(re,{nativeEvent:q.nativeEvent,direction:y}):!0))||Ge(q,re)&&nt()});function Be(q,re,be){if(!t||!F.current)return;const Le=lt(q.nativeEvent);if(Ce(q)&&!fe.current){const on=q.currentTarget;if(Ve(Le,on))return}if("touches"in q||q.preventDefault(),Y.current){G.current=re;const on=Us(q.timeStamp);on!==null&&(Se.current=on),Y.current=!1}const je=re.x,De=re.y,Qe=be.x,Oe=be.y;(Oe<0&&De>pe.current.y||Oe>0&&De<pe.current.y)&&(pe.current={x:pe.current.x,y:De}),(Qe<0&&je>pe.current.x||Qe>0&&je<pe.current.x)&&(pe.current={x:je,y:pe.current.y});const xe=je-G.current.x,Ne=De-G.current.y,Me=De-pe.current.y,Xe=je-pe.current.x;if(!N&&Math.sqrt(xe*xe+Ne*Ne)>=EE&&(O(!0),U===null&&T&&P)){const qr=Math.abs(xe),Hc=Math.abs(Ne);W(qr>Hc?"horizontal":"vertical")}let Je;if(!J.current)U==="vertical"?Ne>0?Je="down":Ne<0&&(Je="up"):U==="horizontal"?xe>0?Je="right":xe<0&&(Je="left"):Math.abs(xe)>=Math.abs(Ne)?Je=xe>0?"right":"left":Je=Ne>0?"down":"up",Je&&(Je==="left"&&S||Je==="right"&&E||Je==="up"&&b||Je==="down"&&x)&&(J.current=Je,se.current=lc(Je,xe,Ne),D(Je),ne(Je));else{const on=J.current,qr=lc(on,Xe,Me);qr>ue.current?(ae.current=!1,D(on)):!(S&&E)&&!(b&&x)&&se.current-qr>=SE&&(ae.current=!0)}const dn=Re(xe,Ne);let rn=K.current.x,Bt=K.current.y;U==="horizontal"?T&&(rn+=dn.x):(U==="vertical"||T&&(rn+=dn.x),P&&(Bt+=dn.y)),Z.current={x:rn,y:Bt},g&&A({x:rn,y:Bt}),ye({x:rn,y:Bt},Us(q.timeStamp));const er=rn-K.current.x,Pn=Bt-K.current.y,Er=J.current,xr=y??J.current;if(!xr){te(0,{deltaX:er,deltaY:Pn,direction:Er});return}const _n=xr==="left"||xr==="right"?ce.current.width:ce.current.height,fn=K.current.scale||1;if(_n<=0||fn<=0){te(0,{deltaX:er,deltaY:Pn,direction:Er});return}const Cr=lc(xr,rn-K.current.x,Bt-K.current.y);if(Cr<=0){te(0,{deltaX:er,deltaY:Pn,direction:Er});return}te(Cr/(_n*fn),{deltaX:er,deltaY:Pn,direction:Er})}const ct=ie(q=>{const re=Ee(q);if(!re)return;if(!("touches"in q)){const je=PE(q.buttons);je&&(le.current=!0);const De=q.buttons===0&&le.current;if(q.buttons!==0&&!je||De){st(q);return}}if(!$&&me.current){if(!Ce(q)&&(q.defaultPrevented||q.nativeEvent.defaultPrevented)){He();return}if(s?s(re,{nativeEvent:q.nativeEvent,direction:y}):!0){const De=ge.current;let Qe=!1;if(Ce(q)){const xe=r.current;if(De&&xe){const Ne=Pe(re,q.nativeEvent),Xe=Ie(xe).body,Je=Xe?Ve(Ne,Xe):null;if(Je&&(we(xe,Je)||we(Je,xe))){const dn=re.x-De.x,rn=re.y-De.y,Bt=Te(Je,dn,rn);if(Bt===!1)return;Bt===!0&&(Qe=!0)}}}Ge(q,re,{ignoreScrollableTarget:Qe,ignoreScrollableAncestors:Qe})&&(De&&Qe?(nt(),G.current=De,pe.current=De,X.current=De,Y.current=!1):(nt(),fe.current=!1))}}const be=X.current,Le=be===null?{x:0,y:0}:{x:re.x-be.x,y:re.y-be.y};X.current=re,Be(q,re,Le)}),Ye=ie(q=>{if(!t)return;const re=Z.current,be=K.current,Le=re.x-be.x,je=re.y-be.y,De={deltaX:Le,deltaY:je,direction:I??J.current};if(!F.current){He(),te(0,De);return}Q(!1),O(!1),W(null),He(),le.current=!1;const Qe=r.current;Qe&&("touches"in q||dc(Qe,q.pointerId,"releasePointerCapture"));const Oe=Le,xe=je,Ne=Se.current,Me=Us(q.timeStamp),Xe=Ne!==null&&Me!==null&&Me>Ne?Me-Ne:0,Je=Xe>0?Math.max(Xe,xE):0,dn=Je>0?Oe/Je:0,rn=Je>0?xe/Je:0;let Bt=H.current.x,er=H.current.y;const Pn=R.current;if(Pn&&Me!==null&&Me>=Pn.time){const Cr=Me-Pn.time;if(Cr<=CE){const on=Math.max(Cr,Gf),qr=re.x-Pn.x,Hc=re.y-Pn.y,Jh=qr/on,Qh=Hc/on;Jh!==0&&(Bt=Jh),Qh!==0&&(er=Qh)}else Bt=0,er=0}const Er=h?.({event:q.nativeEvent,direction:I??J.current,deltaX:Oe,deltaY:xe,velocityX:dn,velocityY:rn,releaseVelocityX:Bt,releaseVelocityY:er}),xr=typeof Er=="boolean";if(ae.current&&!xr){Z.current={x:be.x,y:be.y},A({x:be.x,y:be.y}),D(void 0),te(0,De);return}let _n=!1,fn;if(xr)_n=Er,fn=I??J.current??y;else for(const Cr of n){switch(Cr){case"right":Oe>ue.current&&(_n=!0,fn="right");break;case"left":Oe<-ue.current&&(_n=!0,fn="left");break;case"down":xe>ue.current&&(_n=!0,fn="down");break;case"up":xe<-ue.current&&(_n=!0,fn="up");break}if(_n)break}_n&&fn?(D(fn),_(!0),u?.(q.nativeEvent,{direction:fn})):(Z.current={x:be.x,y:be.y},A({x:be.x,y:be.y}),D(void 0),te(0,De))}),Ut=f.useCallback(()=>{const q=g?M:Z.current,re=g?j:K.current;if(!$&&q.x===re.x&&q.y===re.y&&!k)return{[o.x]:"0px",[o.y]:"0px"};const be=q.x-re.x,Le=q.y-re.y;return{transition:$?"none":void 0,transform:$?`translateX(${q.x}px) translateY(${q.y}px) scale(${re.scale})`:void 0,[o.x]:`${be}px`,[o.y]:`${Le}px`}},[k,M,j,$,o,g]),$t=f.useCallback(()=>t?{onPointerDown:Ue,onPointerMove:ct,onPointerUp:Ye,onPointerCancel:Ye}:{},[t,Ye,ct,Ue]),Ke=f.useCallback(()=>t?{onTouchStart:Ue,onTouchMove:ct,onTouchEnd:Ye,onTouchCancel:Ye}:{},[t,Ye,ct,Ue]);return{swiping:$,swipeDirection:I,dragDismissed:k,getPointerProps:$t,getTouchProps:Ke,getDragStyles:Ut,reset:_e}}const IE=Vs,kE=zs,fc=10,Yf=.5,Xf=.5,RE=300,qf=4,Kf=.2,NE=4,pc=80,Jf=360,hc=.1,Qf=1,ME=`[${Lf}]`,ep=f.forwardRef(function(t,n){const{className:r,render:o,style:s,children:i,...a}=t,{store:c}=Vt(),{swipeDirection:u,notifyParentSwipingChange:l,notifyParentSwipeProgressChange:d,frontmostHeight:p,snapToSequentialPoints:h}=js(),g=zf()?.visualStateStore,v=c.useState("open"),y=c.useState("mounted"),C=c.useState("nested"),S=c.useState("nestedOpenDrawerCount"),E=c.useState("viewportElement"),b=c.useState("popupElement"),x=S>0,T=u==="left"||u==="right"?"horizontal":"vertical",P=T==="vertical",z=P?"horizontal":"vertical",{snapPoints:I,resolvedSnapPoints:D,activeSnapPoint:$,activeSnapPointOffset:V,setActiveSnapPoint:N,popupHeight:O}=jf(),[k,_]=f.useState(null),M=f.useRef(void 0),A=f.useRef(null),j=ao(),B=f.useRef(!1),U=f.useRef(""),W=f.useRef(!1),G=f.useRef(!1),Z=f.useRef(null),X=f.useMemo(()=>{if(!I||I.length<2||u!=="down"&&u!=="up"||D.length<2)return null;const R=D.map(ne=>ne.offset).filter(ne=>Number.isFinite(ne)).sort((ne,te)=>ne-te);if(R.length<2)return null;const H=R[0],L=R[1],F=R[R.length-1];let Q=L-H;if(!Number.isFinite(Q)||Q<=0){const ne=F-H;if(!Number.isFinite(ne)||ne<=0)return null;Q=ne}return{minOffset:H,range:Q}},[D,I,u]),K=f.useMemo(()=>!X||V===null?null:bt((V-X.minOffset)/X.range,0,1),[V,X]),J=f.useMemo(()=>I&&I.length>0&&(u==="down"||u==="up")?u==="down"?["down","up"]:["up","down"]:[u],[I,u]),se=ie(R=>{tp(c.context.popupRef.current,c.context.backdropRef.current,R)}),ae=ie(()=>{se(!1),c.context.popupRef.current?.removeAttribute(sr.endingStyle),_(null)}),pe=ie(()=>{B.current&&(B.current=!1,l?.(!1))}),Y=ie(({resolvedProgress:R,shouldTrackProgress:H,notifyParent:L})=>{const F=v&&!C&&H,Q=F?R:0,ne=v&&H?R:0;L&&d&&(d(ne),ne<=0&&pe()),g?.set({swipeProgress:Q,frontmostHeight:Q>0?p:0});const te=c.context.backdropRef.current;if(te){if(!F||Q<=0){te.style.setProperty(Fn.swipeProgress,"0"),te.style.removeProperty(Tt.height);return}te.style.setProperty(Fn.swipeProgress,`${Q}`),p>0?te.style.setProperty(Tt.height,`${p}px`):te.style.removeProperty(Tt.height)}});function me({direction:R,deltaX:H,deltaY:L,velocityX:F,velocityY:Q,releaseVelocityX:ne,releaseVelocityY:te}){if(!R)return null;const ye=c.context.popupRef.current;if(!ye)return null;const _e=R==="left"||R==="right"?ye.offsetWidth:ye.offsetHeight;if(!Number.isFinite(_e)||_e<=0)return null;const Ee=R==="left"||R==="right"?H:L,Ce=I&&I.length>0?V??0:0;let Pe=0;R==="down"?Pe=Ce:R==="up"&&(Pe=-Ce);const Ve=Pe+Ee,Ge=R==="left"||R==="up"?-Ve:Ve,He=Math.max(0,_e-Ge);if(!Number.isFinite(He)||He<=0)return null;const nt=R==="left"||R==="right"?ne:te,st=R==="left"||R==="right"?F:Q,Re=Math.abs(nt)>0&&Number.isFinite(nt)?nt:st,Te=R==="left"||R==="up"?-Re:Re;if(!Number.isFinite(Te)||Te<=Kf)return null;const Ue=bt(Te,Kf,NE),Be=bt(He/Ue,pc,Jf);if(!Number.isFinite(Be))return null;const ct=(Be-pc)/(Jf-pc),Ye=bt(hc+ct*(Qf-hc),hc,Qf);return!Number.isFinite(Ye)||Ye<=0?null:Ye}function ge(R){if(B.current||!R)return;const H=R.direction??u,L=H==="left"||H==="right"?R.deltaX:R.deltaY;!Number.isFinite(L)||Math.abs(L)<fc||(B.current=!0,l?.(!0))}const fe=_E({enabled:y&&!x,directions:J,elementRef:c.context.popupRef,ignoreSelectorWhenTouch:!1,ignoreScrollableAncestors:!0,movementCssVars:{x:Tt.swipeMovementX,y:Tt.swipeMovementY},onSwipeStart(R){if("touches"in R||"pointerType"in R&&R.pointerType==="touch")return;const H=c.context.popupRef.current;if(!H)return;const F=Ie(H).getSelection?.();if(!F||F.isCollapsed)return;const Q=$e(F.anchorNode)?F.anchorNode:F.anchorNode?.parentElement,ne=$e(F.focusNode)?F.focusNode:F.focusNode?.parentElement;!we(H,Q)&&!we(H,ne)||F.removeAllRanges()},onSwipingChange(R){np(c.context.backdropRef.current,R),!R&&!d&&pe()},swipeThreshold({element:R,direction:H}){return rp(R,H)},canStart(R,H){const L=c.context.popupRef.current;if(!L)return!1;const F=L.ownerDocument,Q=Hs(F,R.x,R.y);if(!Q||!we(L,Q))return!1;const ne=H.nativeEvent;return!(("touches"in ne||"pointerType"in ne&&ne.pointerType==="touch")&&sp(F,L)||ne.type==="touchstart"&&mc(Q))},onProgress(R,H){ge(H);const L=H?.direction??fe.swipeDirection,F=L===void 0||L===u,Q=!!(I&&I.length>0),te=Q&&(u==="down"||u==="up")||!Q||u==="left"||u==="right"||F;let ye=R;if(X&&O>0){if(H&&Number.isFinite(H.deltaY)){const _e=V??X.minOffset,Ee=bt(_e+H.deltaY,0,O);ye=bt((Ee-X.minOffset)/X.range,0,1)}else if(K!==null)ye=K;else if(L==="down"||L==="up"){const _e=R*O,Ee=V??X.minOffset,Ce=L==="down"?Ee+_e:Ee-_e;ye=bt((Ce-X.minOffset)/X.range,0,1)}}Y({resolvedProgress:ye,shouldTrackProgress:te,notifyParent:!0})},onRelease({event:R,deltaX:H,deltaY:L,direction:F,velocityX:Q,velocityY:ne,releaseVelocityX:te,releaseVelocityY:ye}){const _e={deltaX:H,deltaY:L,velocityX:Q,velocityY:ne,releaseVelocityX:te,releaseVelocityY:ye};function Ee(Ke){const q=c.context.popupRef.current;q&&(pe(),se(!0),q.style.removeProperty("transition"),q.setAttribute(sr.endingStyle,""),Kt.flushSync(()=>{_(me({direction:Ke,..._e}))}))}if(!I||I.length===0){if(!F){ae();return}const Ke=c.context.popupRef.current;if(!Ke){ae();return}const q=rp(Ke,F),re=F==="left"||F==="right"?H:L;if(!Number.isFinite(re)){ae();return}const be=F==="left"||F==="up"?-re:re;if(be<=0)return ae(),!1;const Le=F==="left"||F==="right"?Q:ne;if((F==="left"||F==="up"?-Le:Le)>=Yf&&be>0)return Ee(F),!0;const De=be>q;return De?Ee(F):ae(),De}if(u!=="down"&&u!=="up"){ae();return}if(!O||D.length===0){ae();return}const Ce=u==="down"?L:-L;if(!Number.isFinite(Ce)){ae();return}const Pe=Math.sign(Ce),Ve=u==="down"?ye:-ye,Ge=u==="down"?ne:-ne;let He=Number.isFinite(Ve)?Ve:Ge;if(Pe!==0&&Math.abs(Ce)>=fc&&Number.isFinite(He)){const Ke=Math.sign(He);Ke!==0&&Ke!==Pe&&(He=Ge)}const nt=V??0,st=bt(nt+Ce,0,O),Re=Number.isFinite(He)&&Math.abs(He)>=Xf?bt(He,-qf,qf)*RE:0,Te=h?st:bt(st+Re,0,O),Ue=Ae(ls,R),Be=()=>(M.current=$,N?.(null,Ue),Ee(u),!0);if(h){const Ke=[...D].sort((Ne,Me)=>Ne.offset-Me.offset);if(Ke.length===0)return ae(),!1;let q=0,re=Math.abs(nt-Ke[0].offset);for(let Ne=1;Ne<Ke.length;Ne+=1){const Me=Math.abs(nt-Ke[Ne].offset);Me<re&&(re=Me,q=Ne)}let be=Ke[0];re=Math.abs(Te-be.offset);for(const Ne of Ke){const Me=Math.abs(Te-Ne.offset);Me<re&&(re=Me,be=Ne)}const Le=Math.sign(He),je=Pe!==0&&Le!==0&&Le===Pe&&Math.abs(He)>=Xf;let De=Te;if(je){const Ne=bt(q+Pe,0,Ke.length-1);if(Ne!==q){const Me=Ke[Ne];(Pe>0?Te<Me.offset:Te>Me.offset)&&(be=Me,De=Me.offset)}else if(Pe>0)return Be()}const Oe=Math.abs(De-O),xe=Math.abs(De-be.offset);return Oe<xe?Be():(N?.(be.value,Ue),ae(),!1)}if(He>=Yf&&Ce>0)return Be();let ct=D[0],Ye=Math.abs(Te-ct.offset);for(const Ke of D){const q=Math.abs(Te-Ke.offset);q<Ye&&(Ye=q,ct=Ke)}return Math.abs(Te-O)<Ye?Be():(N?.(ct.value,Ue),ae(),!1)},onDismiss(R){g?.set({swipeProgress:0,frontmostHeight:0});const H=c.context.backdropRef.current;H&&(H.style.setProperty(Fn.swipeProgress,"0"),H.style.removeProperty(Tt.height));const L=Ae(ls,R);if(c.setOpen(!1,L),L.isCanceled){const F=M.current;F!==void 0&&N?.(F,Ae(ls,R)),M.current=void 0,A.current?.(),ae();return}if(c.select("open")){const F=R;j.request(()=>{if(c.select("open")){const Q=M.current;Q!==void 0&&N?.(Q,Ae(ls,F)),M.current=void 0,ae(),A.current?.()}else M.current=void 0});return}M.current=void 0,se(!0)}}),le=fe.getPointerProps(),ce=fe.getTouchProps(),ve=fe.reset;A.current=ve,f.useEffect(()=>{const R=E??b;if(!R)return;const H=R,L=Ie(H),F=tt(L);function Q(ne){if(G.current)return;const te=Z.current,ye=ne.touches[0];if(!ye||!te)return;const _e=P?ye.clientY-te.lastY:ye.clientX-te.lastX;if(ip(ne,F)){te.allowSwipe=!1,gr(te,ye);return}if(ne.touches.length===2){gr(te,ye);return}if(sp(L,H)||!v||!y||x){gr(te,ye);return}if(FE(te,ye,P)){gr(te,ye);return}const Ce=te.scrollTarget;if(!Ce||Ce===L.documentElement||Ce===L.body){ne.cancelable&&ne.preventDefault(),gr(te,ye);return}if(!VE(Ce,T)){ne.cancelable&&ne.preventDefault(),gr(te,ye);return}const Ve=_e;if(Ve!==0){const Ge=$E(Ce,T,u,Ve);te.allowSwipe?ne.cancelable&&ne.preventDefault():ne.cancelable&&Ge?(te.allowSwipe=!0,ne.preventDefault()):te.allowSwipe=!1}gr(te,ye)}return Fe(L,"touchmove",Q,{passive:!1,capture:!0})},[y,x,v,b,P,T,u,E]),f.useEffect(()=>{if(!X||fe.swiping)return;Y({resolvedProgress:!v||C?0:K??0,shouldTrackProgress:!0,notifyParent:!1})},[Y,p,C,d,v,K,X,fe.swiping,c,g]),f.useEffect(()=>{if(d)return v||d(0),()=>{d(0)}},[d,v]),f.useEffect(()=>{v&&(ve(),ae())},[ae,v,ve]),f.useEffect(()=>()=>{g?.set({swipeProgress:0,frontmostHeight:0}),np(c.context.backdropRef.current,!1),pe()},[pe,c,g]);const ue=f.useMemo(()=>({swiping:fe.swiping,getDragStyles:fe.getDragStyles,swipeStrength:k??null,setSwipeDismissed(R){tp(c.context.popupRef.current,c.context.backdropRef.current,R)}}),[c,fe.getDragStyles,fe.swiping,k]);function Se(){G.current=!1,Z.current=null,U.current="",W.current=!1}return w.jsx(Tf,{ref:n,className:r,render:o,...En(a,{onPointerDown(R){if(U.current=R.pointerType,W.current=R.pointerType==="pen",!v||!y||x)return;const H=Ie(R.currentTarget),L=Hs(H,R.clientX,R.clientY);mc(L)||AE(L)||R.pointerType!=="touch"&&le.onPointerDown?.(R)},onPointerMove(R){R.pointerType!=="touch"&&le.onPointerMove?.(R)},onPointerUp(R){U.current===R.pointerType&&(U.current=""),R.pointerType!=="touch"&&le.onPointerUp?.(R)},onPointerCancel(R){U.current===R.pointerType&&(U.current=""),R.pointerType!=="touch"&&le.onPointerCancel?.(R)},onTouchStart(R){if(U.current==="pen"&&W.current){W.current=!1,G.current=!1,Z.current=null;return}if(!v||!y||x){G.current=!1,Z.current=null;return}const L=R.touches[0];if(!L)return;if(ap(R)){G.current=!1,Z.current=null;return}const F=Ie(R.currentTarget),Q=Hs(F,L.clientX,L.clientY);if(G.current=mc(Q),G.current){Z.current=null;return}const ne=E??b,te=lt(R.nativeEvent),ye=$e(te)?te:null;if(ne&&ye&&!we(ne,ye)){G.current=!0,Z.current=null;return}let _e=null,Ee=!1;ne&&ye&&(_e=Br(ye,ne,T),Ee=Br(ye,ne,z)!=null);let Ce=null;_e&&(Ce=zE(_e,T,u)?null:!1),Z.current={startX:L.clientX,startY:L.clientY,lastX:L.clientX,lastY:L.clientY,scrollTarget:_e,hasCrossAxisScrollableContent:Ee,allowSwipe:Ce,preserveNativeCrossAxisScroll:!1},ce.onTouchStart?.(R)},onTouchMove(R){if(G.current||ap(R))return;const H=Z.current;H?.preserveNativeCrossAxisScroll||H?.allowSwipe===!1||H?.scrollTarget!=null&&!H.allowSwipe||ce.onTouchMove?.(R)},onTouchEnd(R){Se(),ce.onTouchEnd?.(R)},onTouchCancel(R){Se(),ce.onTouchCancel?.(R)},"data-nested-dialog-open":void 0}),children:w.jsx(cc.Provider,{value:ue,children:i})})});process.env.NODE_ENV!=="production"&&(ep.displayName="DrawerViewport");function tp(e,t,n){if(n){e?.setAttribute(ln.swipeDismiss,""),t?.setAttribute(ln.swipeDismiss,"");return}e?.removeAttribute(ln.swipeDismiss),t?.removeAttribute(ln.swipeDismiss)}function np(e,t){if(e){if(t){e.setAttribute(ln.swiping,"");return}e.removeAttribute(ln.swiping)}}function mc(e){return!!e?.closest(Wl)}function AE(e){return!!e?.closest(ME)}function rp(e,t){const n=t==="left"||t==="right"?e.offsetWidth:e.offsetHeight;return Math.max(n*.5,fc)}function op(e,t){return e instanceof t.HTMLInputElement&&e.type==="range"}function DE(e){return $e(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA":!1}function LE(e,t){const n=$e(e.anchorNode)?e.anchorNode:e.anchorNode?.parentElement,r=$e(e.focusNode)?e.focusNode:e.focusNode?.parentElement;return e.containsNode(t,!0)||we(t,n)||we(t,r)}function sp(e,t){const n=Pt(e);if(!!(n&&we(t,n))&&DE(n)){const{selectionStart:s,selectionEnd:i}=n;if(s!=null&&i!=null&&s<i)return!0}const o=e.getSelection?.();return!o||o.isCollapsed?!1:LE(o,t)}function ip(e,t){const n=e.composedPath();return n?n.some(r=>op(r,t)):op(lt(e),t)}function ap(e){return ip(e.nativeEvent,tt(e.currentTarget))}function gr(e,t){e.lastX=t.clientX,e.lastY=t.clientY}function FE(e,t,n){if(e.preserveNativeCrossAxisScroll)return!0;if(e.allowSwipe===!0||!e.hasCrossAxisScrollableContent)return!1;const r=n?t.clientY-e.startY:t.clientX-e.startX,o=n?t.clientX-e.startX:t.clientY-e.startY,s=Math.abs(r),i=Math.abs(o);return i<6||i<=s+2?!1:(e.preserveNativeCrossAxisScroll=!0,!0)}function VE(e,t){return t==="vertical"?e.scrollHeight>e.clientHeight:e.scrollWidth>e.clientWidth}function cp(e,t){if(t==="vertical"){const r=Math.max(0,e.scrollHeight-e.clientHeight);return{offset:e.scrollTop,max:r}}const n=Math.max(0,e.scrollWidth-e.clientWidth);return{offset:e.scrollLeft,max:n}}function zE(e,t,n){const{offset:r,max:o}=cp(e,t),s=up(n,t);return s===null?!1:s?r<=0:r>=o}function $E(e,t,n,r){const{offset:o,max:s}=cp(e,t),i=up(n,t);return i===null||!(i?r>0:r<0)?!1:i?o<=0:o>=s}function up(e,t){return t==="vertical"?e==="down"?!0:e==="up"?!1:null:e==="right"?!0:e==="left"?!1:null}const lp=f.createContext({legendId:void 0,setLegendId:()=>{},disabled:void 0});process.env.NODE_ENV!=="production"&&(lp.displayName="FieldsetRootContext");function jE(e=!1){const t=f.useContext(lp);if(!t&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>.":ft(86));return t}const dp=function(t){const n=qt(),r=t.controlId===void 0?n:t.controlId,[o,s]=f.useState(r),[i,a]=f.useState(t.labelId),[c,u]=f.useState([]),l=wt(()=>new Map),{messageIds:d}=Ln(),p=ie((g,v)=>{const y=l.current;if(v===void 0){y.delete(g);return}y.set(g,v),s(C=>{if(y.size===0)return;let S;for(const E of y.values()){if(C!==void 0&&E===C)return C;S===void 0&&(S=E)}return S})}),h=f.useCallback(g=>En({"aria-describedby":d.concat(c).join(" ")||void 0},g),[d,c]),m=f.useMemo(()=>({controlId:o,registerControlId:p,labelId:i,setLabelId:a,messageIds:c,setMessageIds:u,getDescriptionProps:h}),[o,p,i,a,c,u,h]);return w.jsx(nc.Provider,{value:m,children:t.children})};process.env.NODE_ENV!=="production"&&(dp.displayName="LabelableProvider");function Bs(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}const Ws=Object.keys($s);function HE(e){if(!e||e.valid||!e.valueMissing)return!1;let t=!1;for(const n of Ws)n!=="valid"&&(n==="valueMissing"&&(t=e[n]),e[n]&&(t=!1));return t}function UE(e){const{formRef:t,clearErrors:n}=Ur(),{setValidityData:r,validate:o,validityData:s,validationDebounceTime:i,invalid:a,markedDirtyRef:c,state:u,name:l,shouldValidateOnChange:d}=e,{controlId:p,getDescriptionProps:h}=Ln(),m=Gt(),g=f.useRef(null),v=ie(async(S,E=!1)=>{const b=g.current;if(!b)return;if(E){if(u.valid!==!1)return;const V=b.validity;if(!V.valueMissing){const O={value:S,state:{...$s,valid:!0},error:"",errors:[],initialValue:s.initialValue};if(b.setCustomValidity(""),p){const k=t.current.fields.get(p);k&&t.current.fields.set(p,{...k,...Bs(O,!1)})}r(O);return}const N=Ws.reduce((O,k)=>(O[k]=V[k],O),{});if(!N.valid&&!HE(N))return}function x(V){const N=Ws.reduce((k,_)=>(k[_]=V.validity[_],k),{});let O=!1;for(const k of Ws)if(k!=="valid"){if(k==="valueMissing"&&N[k])O=!0;else if(N[k])return N}return O&&!c.current&&(N.valid=!0,N.valueMissing=!1),N}m.clear();let T=null,P=[];const z=x(b);let I;const D=d();if(b.validationMessage&&!D)I=b.validationMessage,P=[b.validationMessage];else{const V=Array.from(t.current.fields.values()).reduce((O,k)=>(k.name&&(O[k.name]=k.getValue()),O),{}),N=o(S,V);typeof N=="object"&&N!==null&&"then"in N?T=await N:T=N,T!==null?(z.valid=!1,z.customError=!0,Array.isArray(T)?(P=T,b.setCustomValidity(T.join(`
19
- `))):T&&(P=[T],b.setCustomValidity(T))):D&&(b.setCustomValidity(""),z.customError=!1,b.validationMessage?(I=b.validationMessage,P=[b.validationMessage]):b.validity.valid&&!z.valid&&(z.valid=!0))}const $={value:S,state:z,error:I??(Array.isArray(T)?T[0]:T??""),errors:P,initialValue:s.initialValue};if(p){const V=t.current.fields.get(p);V&&t.current.fields.set(p,{...V,...Bs($,a)})}r($)}),y=f.useCallback((S={})=>En(h,u.valid===!1?{"aria-invalid":!0}:mt,S),[h,u.valid]),C=f.useCallback((S={})=>En({onChange(E){if(E.nativeEvent.defaultPrevented)return;if(n(l),!d()){v(E.currentTarget.value,!0);return}const b=E.currentTarget;if(b.value===""){v(b.value);return}m.clear(),i?m.start(i,()=>{v(b.value)}):v(b.value)}},y(S)),[y,n,l,m,v,i,d]);return f.useMemo(()=>({getValidationProps:y,getInputValidationProps:C,inputRef:g,commit:v}),[y,C,v])}function BE(e){const{commit:t,invalid:n,markedDirtyRef:r,name:o,setValidityData:s,validityData:i}=e,{formRef:a}=Ur(),c=f.useRef(null),u=f.useRef(null),l=f.useRef(null),d=ie(()=>{const v=u.current;if(v)return v.getValue?v.getValue():v.value}),p=ie((v=!0)=>{const y=u.current;if(!y)return;let C=y.value;C===void 0&&(C=d()),r.current=!0,v?Kt.flushSync(()=>t(C)):t(C)});function h(){const v=u.current;!v||!v.id||a.current.fields.set(v.id,{getValue:d,name:o,controlRef:v.controlRef??l,validityData:Bs(i,n),validate:p})}function m(v=u.current?.id){v&&a.current.fields.delete(v)}function g(){const v=u.current;if(!v)return;let y=v.value;y===void 0&&(y=d()),i.initialValue===null&&y!==null&&s(C=>({...C,initialValue:y}))}return he(()=>{const v=u.current;!v||!v.id||a.current.fields.set(v.id,{getValue:d,name:o,controlRef:v.controlRef??l,validityData:Bs(i,n),validate:p})},[a,d,n,o,p,i]),he(()=>{const v=a.current.fields;return()=>{const y=u.current?.id;y&&v.delete(y)}},[a]),ie((v,y)=>{if(!y){c.current===v&&(c.current=null,m(),u.current=null);return}const C=u.current?.id;c.current=v,u.current=y,C&&C!==y.id&&m(C),g(),h()})}const fp=f.forwardRef(function(t,n){const{errors:r,validationMode:o,submitAttemptedRef:s}=Ur(),{render:i,className:a,validate:c,validationDebounceTime:u=0,validationMode:l=o,name:d,disabled:p=!1,invalid:h,dirty:m,touched:g,actionsRef:v,style:y,...C}=t,{disabled:S}=jE(),E=ie(c||(()=>null)),b=S||p,[x,T]=f.useState(!1),[P,z]=f.useState(!1),[I,D]=f.useState(!1),[$,V]=f.useState(!1),N=m??P,O=g??x,k=f.useRef(!1),_=ie(pe=>{m===void 0&&(pe&&(k.current=!0),z(pe))}),M=ie(pe=>{g===void 0&&T(pe)}),A=ie(()=>l==="onChange"||l==="onSubmit"&&s.current),j=!!d&&Object.hasOwn(r,d)&&r[d]!==void 0,B=h===!0||j,[U,W]=f.useState({state:$s,error:"",errors:[],value:null,initialValue:null}),G=!B&&U.state.valid,Z=f.useMemo(()=>({disabled:b,touched:O,dirty:N,valid:G,filled:I,focused:$}),[b,O,N,G,I,$]),X=UE({setValidityData:W,validate:E,validityData:U,validationDebounceTime:u,invalid:B,markedDirtyRef:k,state:Z,name:d,shouldValidateOnChange:A}),K=f.useCallback(()=>{k.current=!0,X.commit(U.value)},[X,U]),J=BE({commit:X.commit,invalid:B,markedDirtyRef:k,name:d,setValidityData:W,validityData:U});f.useImperativeHandle(v,()=>({validate:K}),[K]);const se=f.useMemo(()=>({invalid:B,name:d,validityData:U,setValidityData:W,disabled:b,touched:O,setTouched:M,dirty:N,setDirty:_,filled:I,setFilled:D,focused:$,setFocused:V,validate:E,validationMode:l,validationDebounceTime:u,shouldValidateOnChange:A,state:Z,markedDirtyRef:k,registerFieldControl:J,validation:X}),[B,d,U,b,O,M,N,_,I,D,$,V,E,l,u,A,Z,J,X]),ae=qe("div",t,{ref:n,state:Z,props:C,stateAttributesMapping:hr});return w.jsx(Qa.Provider,{value:se,children:ae})});process.env.NODE_ENV!=="production"&&(fp.displayName="FieldRootInner");const Wr=f.forwardRef(function(t,n){return w.jsx(dp,{children:w.jsx(fp,{...t,ref:n})})});process.env.NODE_ENV!=="production"&&(Wr.displayName="FieldRoot");const gc=f.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,nativeLabel:a=!0,...c}=t,u=mr(!1),{labelId:l}=Ln(),d=f.useRef(null),p=sE({id:l??i,native:a});return process.env.NODE_ENV!=="production"&&f.useEffect(()=>{if(!d.current)return;const m=d.current.tagName==="LABEL";if(a){if(!m){const g=Dr.captureOwnerStack?.()||"";ar(`<Field.Label> expected a <label> element because the \`nativeLabel\` prop is true. Rendering a non-<label> disables native label association, so \`htmlFor\` will not work. Use a real <label> in the \`render\` prop, or set \`nativeLabel\` to \`false\`.${g}`)}}else if(m){const g=Dr.captureOwnerStack?.()||"";ar(`<Field.Label> expected a non-<label> element because the \`nativeLabel\` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the \`render\` prop, or set \`nativeLabel\` to \`true\`.${g}`)}},[a]),qe("label",t,{ref:[n,d],state:u.state,props:[p,c],stateAttributesMapping:hr})});process.env.NODE_ENV!=="production"&&(gc.displayName="FieldLabel");const WE={...hr,...tn},Zs=f.forwardRef(function(t,n){const{render:r,id:o,className:s,match:i,style:a,...c}=t,u=qt(o),{validityData:l,state:d,name:p}=mr(!1),{setMessageIds:h}=Ln(),{errors:m}=Ur(),g=p?m[p]:null,v=typeof i=="string";let y=!1;i===!0?y=!0:v?y=!!l.state[i]:y=!!g||l.state.valid===!1;const{mounted:C,transitionStatus:S,setMounted:E}=vo(y);he(()=>{if(!(!y||!u))return h(O=>O.concat(u)),()=>{h(O=>O.filter(k=>k!==u))}},[y,u,h]);const b=f.useRef(null),[x,T]=f.useState(null),[P,z]=f.useState(null),I=l.errors.length>1?w.jsx("ul",{children:l.errors.map(O=>w.jsx("li",{children:O},O))}):l.error,D=v?I:g||I;let $=l.error;g!=null?$=Array.isArray(g)?JSON.stringify(g):g:l.errors.length>1&&($=JSON.stringify(l.errors)),y&&$!==P&&(z($),T(D)),xn({open:y,ref:b,onComplete(){y||E(!1)}});const V={...d,transitionStatus:S},N=qe("div",t,{ref:[n,b],state:V,props:[{id:u,children:y?D:x},c],stateAttributesMapping:WE,enabled:C});return C?N:null});process.env.NODE_ENV!=="production"&&(Zs.displayName="FieldError");const Gs=f.forwardRef(function(t,n){const{render:r,className:o,id:s,name:i,value:a,disabled:c=!1,onValueChange:u,defaultValue:l,autoFocus:d=!1,style:p,...h}=t,{state:m,name:g,disabled:v,setTouched:y,setDirty:C,validityData:S,setFocused:E,setFilled:b,validationMode:x,validation:T}=mr(),P=v||c,z=g??i,I={...m,disabled:P},{labelId:D}=Ln(),$=rc({id:s});he(()=>{const A=a!=null;T.inputRef.current?.value||A&&a!==""?b(!0):A&&a===""&&b(!1)},[T.inputRef,b,a]);const V=f.useRef(null);he(()=>{d&&V.current===Pt(Ie(V.current))&&E(!0)},[d,E]);const[N]=Eo({controlled:a,default:l,name:"FieldControl",state:"value"}),O=a!==void 0,k=O?N:void 0,_=ie(()=>T.inputRef.current?.value);return ec(T.inputRef,{id:$,value:k,getValue:_}),qe("input",t,{ref:[n,V],state:I,props:[{id:$,disabled:P,name:z,ref:T.inputRef,"aria-labelledby":D,autoFocus:d,...O?{value:k}:{defaultValue:l},onChange(A){const j=A.currentTarget.value;u?.(j,Ae(cr,A.nativeEvent)),C(j!==S.initialValue),b(j!=="")},onFocus(){E(!0)},onBlur(A){y(!0),E(!1),x==="onBlur"&&T.commit(A.currentTarget.value)},onKeyDown(A){A.currentTarget.tagName==="INPUT"&&A.key==="Enter"&&(y(!0),T.commit(A.currentTarget.value))}},T.getInputValidationProps(),h],stateAttributesMapping:hr})});process.env.NODE_ENV!=="production"&&(Gs.displayName="FieldControl");const To=f.forwardRef(function(t,n){const{render:r,className:o,validationMode:s="onSubmit",errors:i,onSubmit:a,onFormSubmit:c,actionsRef:u,style:l,...d}=t,p=f.useRef({fields:new Map}),h=f.useRef(!1),m=f.useRef(!1),g=ie(x=>{x&&(x.focus(),x.tagName==="INPUT"&&x.select())}),[v,y]=f.useState(i);As(i,()=>{y(i)}),f.useEffect(()=>{if(!h.current)return;h.current=!1;const x=Array.from(p.current.fields.values()).filter(T=>T.validityData.state.valid===!1);x.length&&g(x[0].controlRef.current)},[v,g]);const C=f.useCallback(x=>{const T=Array.from(p.current.fields.values());if(x){const P=T.find(z=>z.name===x);P&&P.validate(!1)}else T.forEach(P=>{P.validate(!1)})},[]);f.useImperativeHandle(u,()=>({validate:C}),[C]);const S=qe("form",t,{ref:n,props:[{noValidate:!0,onSubmit(x){m.current=!0;let T=Array.from(p.current.fields.values());T.forEach(z=>{z.validate()}),T=Array.from(p.current.fields.values());const P=T.filter(z=>!z.validityData.state.valid);if(P.length)x.preventDefault(),g(P[0].controlRef.current);else if(h.current=!0,a?.(x),c){x.preventDefault();const z=T.reduce((I,D)=>(D.name&&(I[D.name]=D.getValue()),I),{});c(z,_0(cr,x.nativeEvent))}}},d]}),E=ie(x=>{if(x&&v&&mt.hasOwnProperty.call(v,x)){const T={...v};delete T[x],y(T)}}),b=f.useMemo(()=>({formRef:p,validationMode:s,errors:v??mt,clearErrors:E,submitAttemptedRef:m}),[p,s,v,E]);return w.jsx(tc.Provider,{value:b,children:S})});process.env.NODE_ENV!=="production"&&(To.displayName="Form");const yc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(yc.displayName="PopoverRootContext");function Vn(e){const t=f.useContext(yc);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PopoverRootContext is missing. Popover parts must be placed within <Popover.Root>.":ft(47));return t}function ZE(){return{...Nd(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const GE={...Md,disabled:de(e=>e.disabled),instantType:de(e=>e.instantType),openMethod:de(e=>e.openMethod),openChangeReason:de(e=>e.openChangeReason),modal:de(e=>e.modal),focusManagerModal:de(e=>e.focusManagerModal),stickIfOpen:de(e=>e.stickIfOpen),titleElementId:de(e=>e.titleElementId),descriptionElementId:de(e=>e.descriptionElementId),openOnHover:de(e=>e.openOnHover),closeDelay:de(e=>e.closeDelay),hasViewport:de(e=>e.hasViewport)};class vc extends Wo{constructor(t){const n={...ZE(),...t};n.open&&t?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:f.createRef(),backdropRef:f.createRef(),internalBackdropRef:f.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:f.createRef(),beforeContentFocusGuardRef:f.createRef(),stickIfOpenTimeout:new Zt,triggerElements:new bs},GE)}setOpen=(t,n)=>{const r=n.reason===Lt,o=n.reason===Fr&&n.event.detail===0,s=!t&&(n.reason===ed||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const i=()=>{const a={open:t,openChangeReason:n.reason},c=n.trigger?.id??null;(c||t)&&(a.activeTriggerId=c,a.activeTriggerElement=n.trigger??null),this.update(a)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(i0,()=>{this.set("stickIfOpen",!1)}),Kt.flushSync(i)):i(),o||s?this.set("instantType",o?"click":"dismiss"):n.reason===ur?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(t,n){const r=wt(()=>new vc(n)).current,o=t??r;return so(r.disposeEffect),o}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function pp({props:e}){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:s,modal:i=!1,handle:a,triggerId:c,defaultTriggerId:u=null}=e,l=vc.useStore(a?.store,{modal:i,open:r,openProp:n,activeTriggerId:u,triggerIdProp:c});ja(()=>{n===void 0&&l.state.open===!1&&r===!0&&l.update({open:!0,activeTriggerId:u})}),l.useControlledProp("openProp",n),l.useControlledProp("triggerIdProp",c);const d=l.useState("open"),p=l.useState("payload");l.useContextCallback("onOpenChange",o),l.useContextCallback("onOpenChangeComplete",s);const{openMethod:h,triggerProps:m}=Ha(d);kd(l);const{forceUnmount:g}=Rd(d,l,()=>{l.update({stickIfOpen:!0,openChangeReason:null})});f.useEffect(()=>{d||l.context.stickIfOpenTimeout.clear()},[l,d]);const v=f.useCallback(()=>{l.setOpen(!1,Ae(td))},[l]);f.useImperativeHandle(e.actionsRef,()=>({unmount:g,close:v}),[g,v]);const y=Dd({popupStore:l,onOpenChange:l.setOpen}),C=ka(y,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),S=zd(y),{getReferenceProps:E,getFloatingProps:b,getTriggerProps:x}=bo([C,S]),T=f.useMemo(()=>E(m),[E,m]),P=f.useMemo(()=>x(m),[x,m]),z=f.useMemo(()=>b(),[b]);l.useSyncedValues({modal:i,openMethod:h,activeTriggerProps:T,inactiveTriggerProps:P,popupProps:z,floatingRootContext:y,nested:qn()!=null});const I=f.useMemo(()=>({store:l}),[l]);return w.jsx(yc.Provider,{value:I,children:typeof t=="function"?t({payload:p}):t})}function YE(e){return Vn(!0)?w.jsx(pp,{props:e}):w.jsx(L0,{children:w.jsx(pp,{props:e})})}const XE=300,hp=f.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,handle:a,payload:c,openOnHover:u=!1,delay:l=XE,closeDelay:d=0,id:p,style:h,...m}=t,g=Vn(!0),v=a?.store??g?.store;if(!v)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Popover.Trigger> must be either used within a <Popover.Root> component or provided with a handle.":ft(74));const y=qt(p),C=v.useState("isTriggerActive",y),S=v.useState("floatingRootContext"),E=v.useState("isOpenedByTrigger",y),b=f.useRef(null),{registerTrigger:x,isMountedByThisTrigger:T}=Id(y,b,v,{payload:c,disabled:s,openOnHover:u,closeDelay:d}),P=v.useState("openChangeReason"),z=v.useState("stickIfOpen"),I=v.useState("openMethod"),D=v.useState("focusManagerModal"),$=Dw(S,{enabled:S!=null&&u&&(I!=="touch"||P!==Fr),mouseOnly:!0,move:!1,handleClose:Bw(),restMs:l,delay:{close:d},triggerElementRef:b,isActiveTrigger:C,isClosing:()=>v.select("transitionStatus")==="ending"}),V=Ia(S,{enabled:S!=null,stickIfOpen:z}),N=bo([V]),O=v.useState("triggerProps",T),k={disabled:s,open:E},{getButtonProps:_,buttonRef:M}=Lr({disabled:s,native:i}),A=f.useMemo(()=>({open(G){return G&&P===Fr?Xd.open(G):Yd.open(G)}}),[P]),j=qe("button",t,{state:k,ref:[M,n,x,b],props:[N.getReferenceProps(),$,O,{[ha]:"",id:y},m,_],stateAttributesMapping:A}),{preFocusGuardRef:B,handlePreFocusGuardFocus:U,handleFocusTargetFocus:W}=aE(v,b);return C&&!D?w.jsxs(f.Fragment,{children:[w.jsx(Sn,{ref:B,onFocus:U}),w.jsx(f.Fragment,{children:j},y),w.jsx(Sn,{ref:v.context.triggerFocusTargetRef,onFocus:W})]}):w.jsx(f.Fragment,{children:j},y)});process.env.NODE_ENV!=="production"&&(hp.displayName="PopoverTrigger");const bc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(bc.displayName="PopoverPortalContext");function qE(){const e=f.useContext(bc);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Popover.Portal> is missing.":ft(45));return e}const mp=f.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=Vn();return s.useState("mounted")||r?w.jsx(bc.Provider,{value:r,children:w.jsx(hs,{ref:n,...o})}):null});process.env.NODE_ENV!=="production"&&(mp.displayName="PopoverPortal");const wc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(wc.displayName="PopoverPositionerContext");function gp(){const e=f.useContext(wc);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PopoverPositionerContext is missing. PopoverPositioner parts must be placed within <Popover.Positioner>.":ft(46));return e}const yp=f.forwardRef(function(t,n){const{render:r,className:o,anchor:s,positionMethod:i="absolute",side:a="bottom",align:c="center",sideOffset:u=0,alignOffset:l=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:h=5,sticky:m=!1,disableAnchorTracking:g=!1,collisionAvoidance:v=f0,style:y,...C}=t,{store:S}=Vn(),E=qE(),b=A0(),x=S.useState("floatingRootContext"),T=S.useState("mounted"),P=S.useState("open"),z=S.useState("openChangeReason"),I=S.useState("activeTriggerElement"),D=S.useState("modal"),$=S.useState("openMethod"),V=S.useState("positionerElement"),N=S.useState("instantType"),O=S.useState("transitionStatus"),k=S.useState("hasViewport"),_=f.useRef(null),M=Bl(V,!1,!1),A=Zd({anchor:s,floatingRootContext:x,positionMethod:i,mounted:T,side:a,sideOffset:u,align:c,alignOffset:l,arrowPadding:h,collisionBoundary:d,collisionPadding:p,sticky:m,disableAnchorTracking:g,keepMounted:E,nodeId:b,collisionAvoidance:v,adaptiveOrigin:k?Xw:void 0}),j=x.useState("domReferenceElement");he(()=>{const G=j,Z=_.current;if(G&&(_.current=G),Z&&G&&G!==Z){S.set("instantType",void 0);const X=new AbortController;return M(()=>{S.set("instantType","trigger-change")},X.signal),()=>{X.abort()}}},[j,M,S]);const B={open:P,side:A.side,align:A.align,anchorHidden:A.anchorHidden,instant:N};Pf(P&&D===!0&&z!==Lt,$==="touch",V,I);const U=f.useCallback(G=>{S.set("positionerElement",G)},[S]),W=qd(t,B,{styles:A.positionerStyles,transitionStatus:O,props:C,refs:[n,U],hidden:!T,inert:!P});return w.jsxs(wc.Provider,{value:A,children:[T&&D===!0&&z!==Lt&&w.jsx(Ls,{ref:S.context.internalBackdropRef,inert:cs(!P),cutout:I}),w.jsx(D0,{id:b,children:W})]})});process.env.NODE_ENV!=="production"&&(yp.displayName="PopoverPositioner");const vp=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(vp.displayName="ClosePartContext");function KE(){const[e,t]=f.useState(0),n=ie(()=>(t(o=>o+1),()=>{t(o=>Math.max(0,o-1))}));return{context:f.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function JE(e){const{value:t,children:n}=e;return w.jsx(vp.Provider,{value:t,children:n})}const QE={...Cn,...tn},bp=f.forwardRef(function(t,n){const{className:r,render:o,initialFocus:s,finalFocus:i,style:a,...c}=t,{store:u}=Vn(),l=gp(),d=Mf()!=null,{context:p,hasClosePart:h}=KE(),m=u.useState("open"),g=u.useState("openMethod"),v=u.useState("instantType"),y=u.useState("transitionStatus"),C=u.useState("popupProps"),S=u.useState("titleElementId"),E=u.useState("descriptionElementId"),b=u.useState("modal"),x=u.useState("mounted"),T=u.useState("openChangeReason"),P=u.useState("activeTriggerElement"),z=u.useState("floatingRootContext");xn({open:m,ref:u.context.popupRef,onComplete(){m&&u.context.onOpenChangeComplete?.(!0)}});const I=u.useState("disabled"),D=u.useState("openOnHover"),$=u.useState("closeDelay");Mw(z,{enabled:D&&!I,closeDelay:$});function V(A){return A==="touch"?u.context.popupRef.current:!0}const N=s===void 0?V:s,O={open:m,side:l.side,align:l.align,instant:v,transitionStatus:y},k=b!==!1&&h;u.useSyncedValue("focusManagerModal",k);const _=f.useCallback(A=>{u.set("popupElement",A)},[u]),M=qe("div",t,{state:O,ref:[n,u.context.popupRef,_],props:[C,{"aria-labelledby":S,"aria-describedby":E,onKeyDown(A){d&&Ms.has(A.key)&&A.stopPropagation()}},Va(y),c],stateAttributesMapping:QE});return w.jsx(ms,{context:z,openInteractionType:g,modal:k,disabled:!x||T===Lt,initialFocus:N,returnFocus:i,restoreFocus:"popup",previousFocusableElement:it(P)?P:void 0,nextFocusableElement:u.context.triggerFocusTargetRef,beforeContentFocusGuardRef:u.context.beforeContentFocusGuardRef,children:w.jsx(JE,{value:p,children:M})})});process.env.NODE_ENV!=="production"&&(bp.displayName="PopoverPopup");const wp=f.forwardRef(function(t,n){const{className:r,render:o,style:s,...i}=t,{store:a}=Vn(),c=a.useState("open"),{arrowRef:u,side:l,align:d,arrowUncentered:p,arrowStyles:h}=gp();return qe("div",t,{state:{open:c,side:l,align:d,uncentered:p},ref:[n,u],props:[{style:h,"aria-hidden":!0},i],stateAttributesMapping:Cn})});process.env.NODE_ENV!=="production"&&(wp.displayName="PopoverArrow");const e1={...Cn,...tn},Sp=f.forwardRef(function(t,n){const{className:r,render:o,style:s,...i}=t,{store:a}=Vn(),c=a.useState("open"),u=a.useState("mounted"),l=a.useState("transitionStatus"),d=a.useState("openChangeReason");return qe("div",t,{state:{open:c,transitionStatus:l},ref:[a.context.backdropRef,n],props:[{role:"presentation",hidden:!u,style:{pointerEvents:d===Lt?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},i],stateAttributesMapping:e1})});process.env.NODE_ENV!=="production"&&(Sp.displayName="PopoverBackdrop");const Ep=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a}=Vn(),c=qt(i.id);return he(()=>(a.set("titleElementId",c),()=>{a.set("titleElementId",void 0)}),[a,c]),qe("h2",t,{ref:n,props:[{id:c},i]})});process.env.NODE_ENV!=="production"&&(Ep.displayName="PopoverTitle");const xp=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a}=Vn(),c=qt(i.id);return he(()=>(a.set("descriptionElementId",c),()=>{a.set("descriptionElementId",void 0)}),[a,c]),qe("p",t,{ref:n,props:[{id:c},i]})});process.env.NODE_ENV!=="production"&&(xp.displayName="PopoverDescription");const Ys="base-ui-disable-scrollbar",Sc={className:Ys,getElement(e){return w.jsx("style",{nonce:e,href:Ys,precedence:"base-ui:low",children:`.${Ys}{scrollbar-width:none}.${Ys}::-webkit-scrollbar{display:none}`})}};process.env.NODE_ENV!=="production"&&(Sc.getElement.displayName="styleDisableScrollbar.getElement");const zn=1;function Cp(e,t){return Math.max(0,e-t)}function t1(e,t){if(t<=0)return 0;const n=bt(e,0,t),r=n,o=t-n,s=r<=zn,i=o<=zn;return s&&i?r<=o?0:t:s?0:i?t:n}const Ec=f.createContext(null);process.env.NODE_ENV!=="production"&&(Ec.displayName="SelectRootContext");const xc=f.createContext(null);process.env.NODE_ENV!=="production"&&(xc.displayName="SelectFloatingContext");function Zr(){const e=f.useContext(Ec);if(e===null)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectRootContext is missing. Select parts must be placed within <Select.Root>.":ft(60));return e}function Tp(){const e=f.useContext(xc);if(e===null)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectFloatingContext is missing. Select parts must be placed within <Select.Root>.":ft(61));return e}const Ze={id:de(e=>e.id),labelId:de(e=>e.labelId),modal:de(e=>e.modal),multiple:de(e=>e.multiple),items:de(e=>e.items),itemToStringLabel:de(e=>e.itemToStringLabel),itemToStringValue:de(e=>e.itemToStringValue),isItemEqualToValue:de(e=>e.isItemEqualToValue),value:de(e=>e.value),hasSelectedValue:de(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Hr(t,r)!==""}),hasNullItemLabel:de((e,t)=>t?WS(e.items):!1),open:de(e=>e.open),mounted:de(e=>e.mounted),forceMount:de(e=>e.forceMount),transitionStatus:de(e=>e.transitionStatus),openMethod:de(e=>e.openMethod),activeIndex:de(e=>e.activeIndex),selectedIndex:de(e=>e.selectedIndex),isActive:de((e,t)=>e.activeIndex===t),isSelected:de((e,t,n)=>{const r=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(s=>jr(n,s,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:jr(n,o,r)}),isSelectedByFocus:de((e,t)=>e.selectedIndex===t),popupProps:de(e=>e.popupProps),triggerProps:de(e=>e.triggerProps),triggerElement:de(e=>e.triggerElement),positionerElement:de(e=>e.positionerElement),listElement:de(e=>e.listElement),scrollUpArrowVisible:de(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:de(e=>e.scrollDownArrowVisible),hasScrollArrows:de(e=>e.hasScrollArrows)};function n1(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:s,defaultOpen:i=!1,onOpenChange:a,name:c,form:u,autoComplete:l,disabled:d=!1,readOnly:p=!1,required:h=!1,modal:m=!0,actionsRef:g,inputRef:v,onOpenChangeComplete:y,items:C,multiple:S=!1,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:x=jS,highlightItemOnHover:T=!0,children:P}=e,{clearErrors:z}=Ur(),{setDirty:I,setTouched:D,setFocused:$,shouldValidateOnChange:V,validityData:N,setFilled:O,name:k,disabled:_,validation:M,validationMode:A}=mr(),j=rc({id:t}),B=_||d,U=k??c,[W,G]=Eo({controlled:n,default:S?r??tl:r,name:"Select",state:"value"}),[Z,X]=Eo({controlled:s,default:i,name:"Select",state:"open"}),K=f.useRef([]),J=f.useRef([]),se=f.useRef(null),ae=f.useRef(null),pe=f.useRef(0),Y=f.useRef(null),me=f.useRef([]),ge=f.useRef(!1),fe=f.useRef(!1),le=f.useRef(null),ce=f.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),ve=f.useRef(!1),{mounted:ue,setMounted:Se,transitionStatus:R}=vo(Z),{openMethod:H,triggerProps:L}=Ha(Z),F=wt(()=>new el({id:j,labelId:void 0,modal:m,multiple:S,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:x,value:W,open:Z,mounted:ue,transitionStatus:R,items:C,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Q=We(F,Ze.activeIndex),ne=We(F,Ze.selectedIndex),te=We(F,Ze.triggerElement),ye=We(F,Ze.positionerElement),_e=cE(H),Ee=H??_e,Ce=f.useMemo(()=>S&&Array.isArray(W)&&W.length===0?"":Hr(W,b),[S,W,b]),Pe=f.useMemo(()=>S&&Array.isArray(W)?W.map(Oe=>Hr(Oe,b)):Hr(W,b),[S,W,b]),Ve=vt(F.state.triggerElement),Ge=ie(()=>Pe);ec(Ve,{id:j,value:W,getValue:Ge});const He=f.useRef(W);he(()=>{W!==He.current&&F.set("forceMount",!0)},[F,W]),he(()=>{O(S?Array.isArray(W)&&W.length>0:W!=null)},[S,W,O]),he(function(){if(Z)return;const xe=me.current;if(S){const Me=Array.isArray(W)?W:[];if(Me.length===0){F.set("selectedIndex",null);return}const Xe=Me[Me.length-1],Je=xo(xe,Xe,x);F.set("selectedIndex",Je===-1?null:Je);return}const Ne=xo(xe,W,x);F.set("selectedIndex",Ne===-1?null:Ne)},[S,Z,W,me,x,F]),As(W,()=>{z(U),I(W!==N.initialValue),V()?M.commit(W):M.commit(W,!0)});const nt=ie((Oe,xe)=>{if(a?.(Oe,xe),!xe.isCanceled&&(X(Oe),!Oe&&(xe.reason===ur||xe.reason===ya)&&(D(!0),$(!1),A==="onBlur"&&M.commit(W)),!Oe&&F.state.activeIndex!==null)){const Ne=K.current[F.state.activeIndex];queueMicrotask(()=>{Ne?.setAttribute("tabindex","-1")})}}),st=ie(()=>{Se(!1),F.update({activeIndex:null,openMethod:null}),y?.(!1)});xn({enabled:!g,open:Z,ref:se,onComplete(){Z||st()}}),f.useImperativeHandle(g,()=>({unmount:st}),[st]);const Re=ie((Oe,xe)=>{o?.(Oe,xe),!xe.isCanceled&&G(Oe)}),Te=ie(()=>{const Oe=F.state.listElement||se.current;if(!Oe)return;const xe=Cp(Oe.scrollHeight,Oe.clientHeight),Ne=t1(Oe.scrollTop,xe),Me=Ne>0,Xe=Ne<xe;F.state.scrollUpArrowVisible!==Me&&F.set("scrollUpArrowVisible",Me),F.state.scrollDownArrowVisible!==Xe&&F.set("scrollDownArrowVisible",Xe)}),Ue=Ad({open:Z,onOpenChange:nt,elements:{reference:te,floating:ye}}),Be=Ia(Ue,{enabled:!p&&!B,event:"mousedown"}),ct=ka(Ue,{bubbles:!1}),Ye=zw(Ue,{enabled:!p&&!B,listRef:K,activeIndex:Q,selectedIndex:ne,disabledIndices:tl,onNavigate(Oe){Oe===null&&!Z||F.set("activeIndex",Oe)},focusItemOnHover:T}),Ut=jw(Ue,{enabled:!p&&!B&&(Z||!S),listRef:J,activeIndex:Q,selectedIndex:ne,onMatch(Oe){Z?F.set("activeIndex",Oe):Re(me.current[Oe],Ae("none"))},onTypingChange(Oe){ge.current=Oe}}),{getReferenceProps:$t,getFloatingProps:Ke,getItemProps:q}=bo([Be,ct,Ye,Ut]),re=f.useMemo(()=>En($t(),L,j?{id:j}:mt),[$t,L,j]);ja(()=>{F.update({popupProps:Ke(),triggerProps:re})}),he(()=>{F.update({id:j,modal:m,multiple:S,value:W,open:Z,mounted:ue,transitionStatus:R,popupProps:Ke(),triggerProps:re,items:C,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:x,openMethod:Ee})},[F,j,m,S,W,Z,ue,R,Ke,re,C,E,b,x,Ee]);const be=f.useMemo(()=>({store:F,name:U,required:h,disabled:B,readOnly:p,multiple:S,highlightItemOnHover:T,setValue:Re,setOpen:nt,listRef:K,popupRef:se,scrollHandlerRef:ae,handleScrollArrowVisibility:Te,scrollArrowsMountedCountRef:pe,getItemProps:q,events:Ue.context.events,valueRef:Y,valuesRef:me,labelsRef:J,typingRef:ge,selectionRef:ce,selectedItemTextRef:le,validation:M,onOpenChangeComplete:y,keyboardActiveRef:fe,alignItemWithTriggerActiveRef:ve,initialValueRef:He}),[F,U,h,B,p,S,T,Re,nt,q,Ue.context.events,M,y,Te]),Le=or(v,M.inputRef),je=S&&Array.isArray(W)&&W.length>0,De=S?void 0:U,Qe=f.useMemo(()=>!S||!Array.isArray(W)||!U?null:W.map(Oe=>{const xe=Hr(Oe,b);return w.jsx("input",{type:"hidden",form:u,name:U,value:xe},xe)}),[S,W,u,U,b]);return w.jsx(Ec.Provider,{value:be,children:w.jsxs(xc.Provider,{value:Ue,children:[P,w.jsx("input",{...M.getInputValidationProps({onFocus(){F.state.triggerElement?.focus({focusVisible:!0})},onChange(Oe){if(Oe.nativeEvent.defaultPrevented)return;const xe=Oe.currentTarget.value,Ne=Ae(cr,Oe.nativeEvent);function Me(){if(S)return;const Xe=me.current.find(Je=>Hr(Je,b).toLowerCase()===xe.toLowerCase()||ZS(Je,E).toLowerCase()===xe.toLowerCase());Xe!=null&&(I(Xe!==N.initialValue),Re(Xe,Ne),V()&&M.commit(Xe))}F.set("forceMount",!0),queueMicrotask(Me)}}),id:j&&De==null?`${j}-hidden-input`:void 0,form:u,name:De,autoComplete:l,value:Ce,disabled:B,required:h&&!je,readOnly:p,ref:Le,style:U?Al:ss,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Qe]})})}const Xs=2,r1=400,Op=200,o1={...Xd,...hr,value:()=>null},Pp=f.forwardRef(function(t,n){const{render:r,className:o,id:s,disabled:i=!1,nativeButton:a=!0,style:c,...u}=t,{setTouched:l,setFocused:d,validationMode:p,state:h,disabled:m}=mr(),{labelId:g}=Ln(),{store:v,setOpen:y,selectionRef:C,validation:S,readOnly:E,required:b,alignItemWithTriggerActiveRef:x,disabled:T,keyboardActiveRef:P}=Zr(),z=m||T||i,I=We(v,Ze.open),D=We(v,Ze.value),$=We(v,Ze.triggerProps),V=We(v,Ze.positionerElement),N=We(v,Ze.listElement),O=We(v,Ze.id),k=We(v,Ze.labelId),_=We(v,Ze.hasSelectedValue),M=!_&&I,A=We(v,Ze.hasNullItemLabel,M),j=s??O,B=XS(g,k);rc({id:j});const U=vt(V),W=f.useRef(null),{getButtonProps:G,buttonRef:Z}=Lr({disabled:z,native:a}),X=ie(fe=>{v.set("triggerElement",fe)}),K=or(n,W,Z,X),J=Gt(),se=Gt(),ae=Gt(),pe=Gt();f.useEffect(()=>{if(I)return!(_||A)?ae.start(r1,()=>{C.current.allowUnselectedMouseUp=!0,C.current.allowSelectedMouseUp=!0}):pe.start(Op,()=>{C.current.allowUnselectedMouseUp=!0,ae.start(Op,()=>{C.current.allowSelectedMouseUp=!0})}),()=>{ae.clear(),pe.clear()};C.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},se.clear()},[I,_,A,C,se,ae,pe]);const Y=f.useMemo(()=>N?.id??lo(V)?.id,[N,V]),me=En($,{id:j,role:"combobox","aria-expanded":I?"true":"false","aria-haspopup":"listbox","aria-controls":I?Y:void 0,"aria-labelledby":B,"aria-readonly":E||void 0,"aria-required":b||void 0,tabIndex:z?-1:0,ref:K,onFocus(fe){d(!0),I&&x.current&&y(!1,Ae(cr,fe.nativeEvent)),J.start(0,()=>{v.set("forceMount",!0)})},onBlur(fe){we(V,fe.relatedTarget)||(l(!0),d(!1),p==="onBlur"&&S.commit(D))},onPointerMove(){P.current=!1},onKeyDown(){P.current=!0},onMouseDown(fe){if(I)return;const le=Ie(fe.currentTarget);function ce(ve){if(!W.current)return;const ue=ve.target;if(we(W.current,ue)||we(U.current,ue)||ue===W.current)return;const Se=YS(W.current);ve.clientX>=Se.left-Xs&&ve.clientX<=Se.right+Xs&&ve.clientY>=Se.top-Xs&&ve.clientY<=Se.bottom+Xs||y(!1,Ae(O0,ve))}se.start(0,()=>{le.addEventListener("mouseup",ce,{once:!0})})}},S.getValidationProps,u,G);me.role="combobox";const ge={...h,open:I,disabled:z,value:D,readOnly:E,placeholder:!_};return qe("button",t,{ref:[n,W],state:ge,stateAttributesMapping:o1,props:me})});process.env.NODE_ENV!=="production"&&(Pp.displayName="SelectTrigger");const _p=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(_p.displayName="SelectPortalContext");const Ip=f.forwardRef(function(t,n){const{store:r}=Zr(),o=We(r,Ze.mounted),s=We(r,Ze.forceMount);return o||s?w.jsx(_p.Provider,{value:!0,children:w.jsx(hs,{ref:n,...t})}):null});process.env.NODE_ENV!=="production"&&(Ip.displayName="SelectPortal");const Cc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Cc.displayName="SelectPositionerContext");function s1(){const e=f.useContext(Cc);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectPositionerContext is missing. SelectPositioner parts must be placed within <Select.Positioner>.":ft(59));return e}function qs(e,t){e&&Object.assign(e.style,t)}const i1={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},a1={position:"fixed"},kp=f.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:a="bottom",align:c="center",sideOffset:u=0,alignOffset:l=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p,arrowPadding:h=5,sticky:m=!1,disableAnchorTracking:g,alignItemWithTrigger:v=!0,collisionAvoidance:y=d0,style:C,...S}=t,{store:E,listRef:b,labelsRef:x,alignItemWithTriggerActiveRef:T,selectedItemTextRef:P,valuesRef:z,initialValueRef:I,popupRef:D,setValue:$}=Zr(),V=Tp(),N=We(E,Ze.open),O=We(E,Ze.mounted),k=We(E,Ze.modal),_=We(E,Ze.value),M=We(E,Ze.openMethod),A=We(E,Ze.positionerElement),j=We(E,Ze.triggerElement),B=We(E,Ze.isItemEqualToValue),U=We(E,Ze.transitionStatus),W=f.useRef(null),G=f.useRef(null),[Z,X]=f.useState(v),K=O&&Z&&M!=="touch";!O&&Z!==v&&X(v),he(()=>{O||(Ze.scrollUpArrowVisible(E.state)&&E.set("scrollUpArrowVisible",!1),Ze.scrollDownArrowVisible(E.state)&&E.set("scrollDownArrowVisible",!1))},[E,O]),f.useImperativeHandle(T,()=>K),Pf((K||k)&&N,M==="touch",A,j);const J=Zd({anchor:r,floatingRootContext:V,positionMethod:o,mounted:O,side:a,sideOffset:u,align:c,alignOffset:l,arrowPadding:h,collisionBoundary:d,collisionPadding:p,sticky:m,disableAnchorTracking:g??K,collisionAvoidance:y,keepMounted:!0}),se=K?"none":J.side,ae=K?a1:J.positionerStyles,pe={open:N,side:se,align:J.align,anchorHidden:J.anchorHidden},Y=ie(ce=>{E.set("positionerElement",ce)}),me=qd(t,pe,{styles:ae,transitionStatus:U,props:S,refs:[n,Y],hidden:!O,inert:!N}),ge=f.useRef(0),fe=ie(ce=>{if(ce.size===0&&ge.current===0||z.current.length===0)return;const ve=ge.current;if(ge.current=ce.size,ce.size===ve)return;const ue=Ae(cr);if(ve!==0&&!E.state.multiple&&_!==null&&xo(z.current,_,B)===-1){const R=I.current,L=R!=null&&xo(z.current,R,B)!==-1?R:null;$(L,ue),L===null&&(E.set("selectedIndex",null),P.current=null)}if(ve!==0&&E.state.multiple&&Array.isArray(_)){const Se=H=>xo(z.current,H,B)!==-1,R=_.filter(H=>Se(H));(R.length!==_.length||R.some(H=>!HS(_,H,B)))&&($(R,ue),R.length===0&&(E.set("selectedIndex",null),P.current=null))}if(N&&K){E.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Se={height:""};qs(A,Se),qs(D.current,Se)}}),le=f.useMemo(()=>({...J,side:se,alignItemWithTriggerActive:K,setControlledAlignItemWithTrigger:X,scrollUpArrowRef:W,scrollDownArrowRef:G}),[J,se,K,X]);return w.jsx(vS,{elementsRef:b,labelsRef:x,onMapChange:fe,children:w.jsxs(Cc.Provider,{value:le,children:[O&&k&&w.jsx(Ls,{inert:cs(!N),cutout:j}),me]})})});process.env.NODE_ENV!=="production"&&(kp.displayName="SelectPositioner");const c1={...Cn,...tn},Rp=f.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...a}=t,{store:c,popupRef:u,onOpenChangeComplete:l,setOpen:d,valueRef:p,selectedItemTextRef:h,keyboardActiveRef:m,multiple:g,handleScrollArrowVisibility:v,scrollHandlerRef:y,listRef:C,highlightItemOnHover:S}=Zr(),{side:E,align:b,alignItemWithTriggerActive:x,isPositioned:T,setControlledAlignItemWithTrigger:P,scrollDownArrowRef:z,scrollUpArrowRef:I}=s1(),D=Mf()!=null,$=Tp(),V=Ud(),{nonce:N,disableStyleElements:O}=lE(),k=We(c,Ze.id),_=We(c,Ze.open),M=We(c,Ze.mounted),A=We(c,Ze.popupProps),j=We(c,Ze.transitionStatus),B=We(c,Ze.triggerElement),U=We(c,Ze.positionerElement),W=We(c,Ze.listElement),G=f.useRef(!1),Z=f.useRef(!1),X=f.useRef({}),K=ao(),J=ie(Y=>{if(!U||!u.current||!Z.current)return;if(G.current||!x){v();return}const me=U.style.top==="0px",ge=U.style.bottom==="0px";if(!me&&!ge){v();return}const fe=Mp(U),le=Oo(U.getBoundingClientRect().height,"y",fe),ce=Ie(U),ve=getComputedStyle(U),ue=parseFloat(ve.marginTop),Se=parseFloat(ve.marginBottom),R=Np(getComputedStyle(u.current)),H=Math.min(ce.documentElement.clientHeight-ue-Se,R),L=Y.scrollTop,F=Ks(Y);let Q=0,ne=null,te=!1,ye=!1;const _e=Ve=>{U.style.height=`${Ve}px`},Ee=(Ve,Ge)=>{const He=bt(Ve,0,H-le);He>0&&_e(le+He),Y.scrollTop=Ge,H-(le+He)<=zn&&(G.current=!0),v()},Ce=me?F-L:L,Pe=Math.min(le+Ce,H);if(Q=Pe,Ce<=zn){Ee(Ce,me?F:0);return}if(H-Pe>zn)me?ye=!0:ne=0;else if(te=!0,ge&&L<F){const Ve=le+Ce-H;ne=L-(Ce-Ve)}if(Q=Math.ceil(Q),Q!==0&&_e(Q),ye||ne!=null){const Ve=Ks(Y),Ge=ye?Ve:bt(ne,0,Ve);Math.abs(Y.scrollTop-Ge)>zn&&(Y.scrollTop=Ge)}(te||Q>=H-zn)&&(G.current=!0),v()});f.useImperativeHandle(y,()=>J,[J]),xn({open:_,ref:u,onComplete(){_&&l?.(!0)}});const se={open:_,transitionStatus:j,side:E,align:b};he(()=>{!U||!u.current||Object.keys(X.current).length||(X.current={top:U.style.top||"0",left:U.style.left||"0",right:U.style.right,height:U.style.height,bottom:U.style.bottom,minHeight:U.style.minHeight,maxHeight:U.style.maxHeight,marginTop:U.style.marginTop,marginBottom:U.style.marginBottom})},[u,U]),he(()=>{_||x||(Z.current=!1,G.current=!1,qs(U,X.current))},[_,x,U,u]),he(()=>{const Y=u.current;if(!_||!B||!U||!Y||x&&!T||c.state.transitionStatus==="ending")return;if(!x){Z.current=!0,K.request(v),Y.style.removeProperty("--transform-origin");return}const me=u1(Y);Y.style.removeProperty("--transform-origin");try{const ge=h.current,fe=p.current,le=getComputedStyle(U),ce=getComputedStyle(Y),ve=Ie(B),ue=tt(U),Se=Mp(B),R=Js(B.getBoundingClientRect(),Se),H=Js(U.getBoundingClientRect(),Se),L=R.height,F=W||Y,Q=F.scrollHeight,ne=parseFloat(ce.borderBottomWidth),te=parseFloat(le.marginTop)||10,ye=parseFloat(le.marginBottom)||10,_e=parseFloat(le.minHeight)||100,Ee=Np(ce),Ce=5,Pe=5,Ve=20,Ge=ve.documentElement.clientHeight-te-ye,He=ve.documentElement.clientWidth,nt=Ge-R.bottom+L;let st,Re=V==="rtl"?R.right-H.width:R.left,Te=0;if(ge&&fe){const Le=Js(fe.getBoundingClientRect(),Se);st=Js(ge.getBoundingClientRect(),Se),Re=H.left+(V==="rtl"?Le.right-st.right:Le.left-st.left);const je=Le.top-R.top+Le.height/2;Te=st.top-H.top+st.height/2-je}const Ue=nt+Te+ye+ne;let Be=Math.min(Ge,Ue);const ct=Ge-te-ye,Ye=Ue-Be,Ut=He-Pe;U.style.left=`${bt(Re,Ce,Ut-H.width)}px`,U.style.height=`${Be}px`,U.style.maxHeight="auto",U.style.marginTop=`${te}px`,U.style.marginBottom=`${ye}px`,Y.style.height="100%";const $t=Ks(F),Ke=Ye>=$t-zn;Ke&&(Be=Math.min(Ge,H.height)-(Ye-$t));const q=R.top<Ve||R.bottom>Ge-Ve||Math.ceil(Be)+zn<Math.min(Q,_e),re=(ue.visualViewport?.scale??1)!==1&&Gi;if(q||re){Z.current=!0,qs(U,X.current),P(!1);return}const be=Math.max(_e,Be);if(Ke){const Le=Math.max(0,Ge-Ue);U.style.top=H.height>=ct?"0":`${Le}px`,U.style.height=`${Be}px`,F.scrollTop=Ks(F)}else U.style.bottom="0",F.scrollTop=Ye;if(st){const Le=H.top,je=H.height,De=st.top+st.height/2,Qe=je>0?(De-Le)/je*100:50,Oe=bt(Qe,0,100);Y.style.setProperty("--transform-origin",`50% ${Oe}%`)}(be===Ge||Be>=Ee)&&(G.current=!0),v(),S&&c.state.selectedIndex===null&&c.state.activeIndex===null&&C.current[0]!=null&&c.set("activeIndex",0),Z.current=!0}finally{me()}},[c,_,U,B,p,h,u,v,x,P,K,z,I,W,C,S,V,T]),f.useEffect(()=>{if(!x||!U||!_)return;const Y=tt(U);function me(ge){d(!1,Ae(P0,ge))}return Fe(Y,"resize",me)},[d,x,U,_]);const ae={...W?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":g||void 0,id:`${k}-list`},onKeyDown(Y){m.current=!0,D&&Ms.has(Y.key)&&Y.stopPropagation()},onMouseMove(){m.current=!1},onScroll(Y){W||J(Y.currentTarget)},...x&&{style:W?{height:"100%"}:i1}},pe=qe("div",t,{ref:[n,u],state:se,stateAttributesMapping:c1,props:[A,ae,Va(j),{className:!W&&x?Sc.className:void 0},a]});return w.jsxs(f.Fragment,{children:[!O&&Sc.getElement(N),w.jsx(ms,{context:$,modal:!1,disabled:!M,returnFocus:i,restoreFocus:!0,children:pe})]})});process.env.NODE_ENV!=="production"&&(Rp.displayName="SelectPopup");function Np(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Ks(e){return Cp(e.scrollHeight,e.clientHeight)}function Mp(e){return Cd.getScale(e)}function Oo(e,t,n){return e/n[t]}function Js(e,t){return po({x:Oo(e.x,"x",t),y:Oo(e.y,"y",t),width:Oo(e.width,"x",t),height:Oo(e.height,"y",t)})}const Ap=[["transform","none"],["scale","1"],["translate","0 0"]];function u1(e){const{style:t}=e,n={};for(const[r,o]of Ap)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of Ap){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}const Tc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Tc.displayName="SelectItemContext");function Oc(){const e=f.useContext(Tc);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>.":ft(57));return e}const Dp=f.memo(f.forwardRef(function(t,n){const{render:r,className:o,value:s=null,label:i,disabled:a=!1,nativeButton:c=!1,style:u,...l}=t,d=f.useRef(null),p=ES({label:i,textRef:d,indexGuessBehavior:pf.GuessFromOrder}),{store:h,getItemProps:m,setOpen:g,setValue:v,selectionRef:y,typingRef:C,valuesRef:S,multiple:E,selectedItemTextRef:b}=Zr(),x=We(h,Ze.isActive,p.index),T=We(h,Ze.isSelected,p.index,s),P=We(h,Ze.isSelectedByFocus,p.index),z=We(h,Ze.isItemEqualToValue),I=p.index,D=I!==-1,$=f.useRef(null),V=vt(I);he(()=>{if(!D)return;const Z=S.current;return Z[I]=s,()=>{delete Z[I]}},[D,I,s,S]),he(()=>{if(!D)return;const Z=h.state.value;let X=Z;E&&Array.isArray(Z)&&Z.length>0&&(X=Z[Z.length-1]),X!==void 0&&jr(s,X,z)&&(h.set("selectedIndex",I),d.current&&(b.current=d.current))},[D,I,E,z,h,s,b]);const N={disabled:a,selected:T,highlighted:x},O=m({active:x,selected:T});O.id=void 0;const k=f.useRef(null),_=f.useRef("mouse"),M=f.useRef(!1),{getButtonProps:A,buttonRef:j}=Lr({disabled:a,focusableWhenDisabled:!0,native:c,composite:!0});function B(Z){const X=h.state.value;if(E){const K=Array.isArray(X)?X:[],J=T?US(K,s,z):[...K,s];v(J,Ae(va,Z))}else v(s,Ae(va,Z)),g(!1,Ae(va,Z))}const U={role:"option","aria-selected":T,tabIndex:x?0:-1,onTouchStart(){y.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(Z){k.current=Z.key,h.set("activeIndex",I),Z.key===" "&&C.current&&Z.preventDefault()},onClick(Z){M.current=!1,!(Z.type==="keydown"&&k.current===null)&&(a||Z.type==="keydown"&&k.current===" "&&C.current||_.current!=="touch"&&!x||(k.current=null,B(Z.nativeEvent)))},onPointerEnter(Z){_.current=Z.pointerType},onPointerDown(Z){_.current=Z.pointerType,M.current=!0},onMouseUp(){if(a)return;if(M.current){M.current=!1;return}const Z=!y.current.allowSelectedMouseUp&&T,X=!y.current.allowUnselectedMouseUp&&!T;Z||X||_.current!=="touch"&&!x||$.current?.click()}},W=qe("div",t,{ref:[j,n,p.ref,$],state:N,props:[O,U,l,A]}),G=f.useMemo(()=>({selected:T,indexRef:V,textRef:d,selectedByFocus:P,hasRegistered:D}),[T,V,d,P,D]);return w.jsx(Tc.Provider,{value:G,children:W})}));process.env.NODE_ENV!=="production"&&(Dp.displayName="SelectItem");const Lp=f.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:o}=Oc();return r||o?w.jsx(Fp,{...t,ref:n}):null});process.env.NODE_ENV!=="production"&&(Lp.displayName="SelectItemIndicator");const Fp=f.memo(f.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:s,...i}=e,{selected:a}=Oc(),c=f.useRef(null),{transitionStatus:u,setMounted:l}=vo(a),p=qe("span",e,{ref:[t,c],state:{selected:a,transitionStatus:u},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:tn});return xn({open:a,ref:c,onComplete(){a||l(!1)}}),p}));process.env.NODE_ENV!=="production"&&(Fp.displayName="Inner");const Vp=f.memo(f.forwardRef(function(t,n){const{indexRef:r,textRef:o,selectedByFocus:s,hasRegistered:i}=Oc(),{selectedItemTextRef:a}=Zr(),{className:c,render:u,style:l,...d}=t,p=f.useCallback(m=>{if(!m||!i)return;const g=a.current===null||!a.current.isConnected;(s||g&&r.current===0)&&(a.current=m)},[a,r,s,i]);return qe("div",t,{ref:[p,n,o],props:d})}));process.env.NODE_ENV!=="production"&&(Vp.displayName="SelectItemText");function Rt({as:e,children:t,className:n,disabled:r,...o}){const s=e||"button",i=s==="button";return w.jsx(s,{className:Mi("align-middle inline-flex items-center justify-center transition-all cursor-pointer hover:brightness-110 active:brightness-90 active:scale-90 disabled:cursor-not-allowed disabled:grayscale",n),...i?{disabled:r}:{"aria-disabled":r},...r&&!i?{onClick:a=>{a.preventDefault(),a.stopPropagation()}}:{},...o,children:t})}const l1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),d1=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),zp=e=>{const t=d1(e);return t.charAt(0).toUpperCase()+t.slice(1)},$p=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),f1=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var p1={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"};const h1=oe.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},c)=>oe.createElement("svg",{ref:c,...p1,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:$p("lucide",o),...!s&&!f1(a)&&{"aria-hidden":"true"},...a},[...i.map(([u,l])=>oe.createElement(u,l)),...Array.isArray(s)?s:[s]]));const $n=(e,t)=>{const n=oe.forwardRef(({className:r,...o},s)=>oe.createElement(h1,{ref:s,iconNode:t,className:$p(`lucide-${l1(zp(e))}`,`lucide-${e}`,r),...o}));return n.displayName=zp(e),n};const Pc=$n("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const jp=$n("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Hp=$n("eye-closed",[["path",{d:"m15 18-.722-3.25",key:"1j64jw"}],["path",{d:"M2 8a10.645 10.645 0 0 0 20 0",key:"1e7gxb"}],["path",{d:"m20 15-1.726-2.05",key:"1cnuld"}],["path",{d:"m4 15 1.726-2.05",key:"1dsqqd"}],["path",{d:"m9 18 .722-3.25",key:"ypw2yx"}]]);const Up=$n("eye",[["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"}]]);const m1=$n("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);const g1=$n("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const y1=$n("user-round",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);const v1=$n("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const Bp=$n("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function b1(e){return _t.get("/channel/game/role/mail-captcha",e)}function w1(e){return _t.get("/channel/game/role/auth",e)}function S1(e){return _t.post("/passport-api/v2/ztgame/auth/login",{account:e.account,password:e.password,channel_login:1,channel_id:6})}function E1(e){return _t.post("/passport-api/v2/sms-captchas",{mobile:e.mobile,type:e.type||"register",is_voice:0,nationcode:e.countryCode})}function x1(e){return _t.post("/passport-api/v2/ztgame/auth/mobile-register",{mobile:e.mobile,captcha:e.captcha,channel_login:1,channel_id:6,nationcode:e.countryCode,ad_id:""})}function Wp(){return _t.post("/passport-api/v2/ztgame/auth/auth",{channel_login:1,channel_id:6})}function C1(e){return _t.post(`/passport-api/v2/ztgame/users/${e.uid}/idcard`,{name:e.name,idcard:e.idcard},{headers:{Authentication:e.authorization}})}function T1(e){return _t.post("/passport-api/v2/ztgame/auth/re-auth",{type:"auth",channel_id:6,ad_id:"",channel_login:1},{headers:{Authentication:e}})}function O1(e){return _t.post("/passport-api/v2/ztgame/user-center/forget-password/",e)}function P1(e){return _t.post("/passport-api/v2/ztgame/user-center/forget-password/sms-captchas",e)}function Zp(e){return _t.post("/passport-api/v2/ztgame/user-center/forget-password/forget-password-keys",e)}function _1(e){return _t.post("/passport-api/v2/ztgame/user-center/forget-password/forget-password-update",e)}const I1="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAXCAYAAADk3wSdAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFJ0lEQVQ4jW2VW4ydVRXHf2tfvu87Z+5znEtnxnLR0pYJatEHWxhBEZUSCE8YESImRnzwQTEEY6KJGrQJXiFGXzAxaowkSkyoIgjYlEqEIIrSS6KmpTPDdJgz55w5t++29/bhjDQFVrKf9lq/rGSt/3/J+v2XExRQgNsKuJbH9QLFKaE4BWqUu6TCvXhGQsajOD6D4BJfQBCuvvaLLE/uhLTN/8PwVlGCxIJZCJ9XYzwYBEIGdLkztBE8d1rvSJWlbSLw/oJy9UZe8AOAGglfNbt4UE2CSkBikASwfKpE6blOncdndtOauAjy3gWM8516wCGiuFGPyT2Mhw+EQvC9wZ+UEAw4UfXZtBU6cZX7Fm+C4IDwBmgAPHdguEGPy1VqSO0MObhewHc9UgC5gAKXKmpbW3fV8i1/8JovsDyzG5ortxK4DpFzwP1A2yAcUpHciwURCLngOgFVBkIOOPBd/qrWir/MrTV/k6nk2N3v/Rx/uHgJmqvfrqb5l3sioBVofTsi18hrDywGqQ46IQBFwHcCRT1QrrmfDjXaP/TrvNRerrIiM/xq98d4bH6ROK3fV3XlV0QU60azajTOGND6R4YIpAqiAsEDVnB1UM30lonQ/t0/G3t4uXkZqxM1TkztpDmUXP7uzVcO2SA3FVrR0hoEOkrRCAFCGDMScUJX3V6lPCEIrqexsb82quVHnji6xJ9PH8Bbtc9G2f4dW42PznbDzc5qerGlnURURMidEPT2sIw5bFTMYVMp94rxEASfyananu6RI0/t49G/f4gdMxu/jExxm/QF1fMURtEdshRKMSo5GZa1OKJlDVSSc1STx4wedi/paomKPMELSfAv9NKY5569jNGk89nIFLeFIAQFISiMC9jCMZzlHJ+cfPn5uem9G6AQBdXkReKoacxw0TDDHhWX4BQqLjY3z4zTaVapVLODIch5YchAHNa7rJ4k1//pit3LRRT9h9a2RCvJJtai7JgbN1ObqOlzqJlzMJxPjF7cZnSkT78V/1Hk/GJLgKBlKyqLfUcX33m0mJu9lLIU4giSGOJ4gjhG2Zn6uxhvk+kqfRvDWPdKc8UrfPgTz+E2R34cUvMwKhAEvOL0Rcud95+pLZw4eeB94N2VGAtRNHjW7qOajBlG+gcb3QXq3XHaZUzFdvfOmY2r5JNnjw39+2/Iz3Z9vGbCDyTORyr94ul/LEbFr+8YhWoLmvJpbDSQqggYPUsSf0TSjYmw0p6nnlnqmWUji8Frp4bzm1eS7PfHf3sJ5eMLjHQtJ/eUPH39GAzNvI2txUdIZ66mtzVwKQGshaHqz00ImsxruqWmkRleS4W1VOvQqBz2OvnJ2aW1B55cXD1BfQqG50fpRbdTn/oG0UQNayC24MIAGllQqiO+FX13pXnp3Sebk5zuaZZ7hvVU86+e5vlMcIWjwDxJmG3i3/5B9PwkageoKWAanAKXDUzCmrMovWRE5V+aH//vcaS8oe+n97/at3ObheLFAtK+h7wCevo6dA10ddsjuxASEAW6UqLNMSR6BpHv4GkaPIjJH1oYXn+onY1E3UJuXE3VPb0tvZ9Cg66A0oNz4FNQMfg20Gkj5lvI+C9Qc8vI1GCJX3d+D6mzlEHy2PhH3lF1B95T8d9ECYQAFBByCH3wLXBnnsWd2QP9Q6CXt+X2Fs6/7Xy5F4oAOyxfQ/sGRfa919NCAX75GVBLmF1AzGBCF8abDp8ARuDVnoJMvo/JSrz/OpIaKJ7CN25Batul4U1AgP8BRjZPP9WeeTQAAAAASUVORK5CYII=";function k1(e){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 500 500",...e,children:[w.jsx("path",{fill:"url(#a)",d:"M0 250C0 111.929 111.929 0 250 0s250 111.929 250 250-111.929 250-250 250S0 388.071 0 250Z"}),w.jsx("path",{fill:"#fff",d:"M159.432 341h-33.008V158.949h33.008V341Zm220.263-76.172c0 11.087-1.946 21.286-5.84 30.596-3.808 9.31-9.098 17.35-15.869 24.121-6.771 6.686-14.811 11.934-24.121 15.742-9.31 3.809-19.424 5.713-30.342 5.713h-89.121c-2.369 0-4.57-.423-6.601-1.27-2.031-.846-3.809-1.988-5.332-3.427-1.439-1.524-2.582-3.301-3.428-5.332-.846-2.032-1.27-4.232-1.27-6.602V175.58c0-2.285.424-4.443 1.27-6.475.846-2.031 1.989-3.808 3.428-5.332a16.354 16.354 0 0 1 5.332-3.554c2.031-.847 4.232-1.27 6.601-1.27h89.121c10.918 0 21.032 1.905 30.342 5.713 9.31 3.809 17.35 9.098 24.121 15.869 6.771 6.686 12.061 14.727 15.869 24.121 3.894 9.31 5.84 19.466 5.84 30.469v29.707Zm-33.007-29.707c0-6.432-1.058-12.314-3.174-17.646-2.032-5.332-4.952-9.86-8.76-13.584-3.809-3.809-8.379-6.729-13.711-8.76-5.247-2.116-11.087-3.174-17.52-3.174h-72.744v116.035h72.744c6.433 0 12.273-1.015 17.52-3.047 5.332-2.116 9.902-5.035 13.711-8.759 3.808-3.809 6.728-8.337 8.76-13.584 2.116-5.332 3.174-11.257 3.174-17.774v-29.707Z"}),w.jsx("defs",{children:w.jsxs("linearGradient",{id:"a",x1:250,x2:250,y1:0,y2:500,gradientUnits:"userSpaceOnUse",children:[w.jsx("stop",{stopColor:"#497EFE"}),w.jsx("stop",{offset:1,stopColor:"#947AFA"})]})})]})}function Qs(){const{gameId:e,loginTypes:t,currentLoginType:n,setCurrentLoginType:r}=Dn(),o=tf({loginTypes:t,gameId:e}),s=nf({loginTypes:t,gameId:e}),i=ef({loginTypes:t,gameId:e}),a=[];return i&&n!==at.GIANT&&a.push({type:at.GIANT,label:e==="5327"?"账号密码登录":"巨人账号",icon:e==="5327"?null:w.jsx("img",{className:"size-4",src:I1})}),s&&n!==at.MOBILE&&a.push({type:at.MOBILE,label:"手机号登录",icon:w.jsx(m1,{className:"size-4"})}),o&&n!==at.ROLE_ID&&a.push({type:at.ROLE_ID,label:"ID 登录",icon:w.jsx(k1,{className:"size-4"})}),n!=="quick"&&$r(e).length>0&&a.push({type:"quick",label:"快捷登录",icon:w.jsx(v1,{className:"size-4"})}),a.length?w.jsx("div",{className:"text-gray-500 text-xs flex justify-center items-center gap-2 mb-4",children:a.map((c,u)=>w.jsxs(Rt,{className:"h-7 px-3 border rounded-full border-gray-300 gap-1.5",onClick:()=>r(c.type),children:[c.icon,w.jsx("span",{children:c.label})]},c.type))}):null}function R1(e){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 90 90",fill:"currentColor",...e,children:w.jsx("path",{d:"M41.415 1.601c6.427-2.244 13.363 2.04 14.18 8.773.611 5.508-2.959 10.609-8.365 11.833-.408.102-.918.203-1.326.305-.918.204-1.735.409-2.653.613-.306.102-.714.204-1.122.306h-.101c-.816.306-1.633.51-2.448.816-.306.102-.715.306-1.021.408l-2.754 1.223c-.408.103-.714.307-1.02.511-1.224.612-2.346 1.326-3.468 2.142l-.307.306c-.612.409-1.122.919-1.632 1.327-.51.408-1.02.816-1.53 1.326-.408.306-.714.713-1.122 1.02-.408.407-.816.918-1.326 1.428-.306.612-.409 1.224-.612 1.836-.204 1.122-.51 2.143-.714 3.265-.204 1.02-.408 2.04-.51 3.06 0 .611-.103 1.122-.103 1.734v1.632c0 1.02 0 1.938.103 2.958.102 1.02.306 2.143.51 3.163.204.816.408 1.733.612 2.55.204.816.408 1.53.612 2.346.102.306.204.51.408.714.51.612 1.122 1.122 1.632 1.734 1.02.918 2.04 1.836 3.162 2.754.816.612 1.734 1.224 2.55 1.836.51.306.919.612 1.429.918.102 0 .204 0 .204.103.204 0 .306.102.51.204.408.204.714.408 1.122.612.918.408 1.734.714 2.652 1.122.714.204 1.326.51 2.04.714 1.122.306 2.143.612 3.265.918.51.204 1.122.204 1.632 0 .306-.102.51-.102.816-.204.816-.204 1.53-.51 2.346-.714 1.53-.408 2.958-1.02 4.386-1.633h.102c.816-.408 1.735-.815 2.55-1.325.307-.204.714-.408 1.02-.612 1.02-.714 2.04-1.428 3.06-2.244.613-.51 1.123-1.02 1.735-1.53l2.142-2.143c.408-.408.714-.816.816-1.428 0-.102.103-.102.103-.204.306-1.02.611-2.142.815-3.162.306-1.326.612-2.755.714-4.183v-.204c.102-1.224.103-2.448.103-3.672-.102-.816-.102-1.53-.204-2.346 0-.102 0-.204-.102-.205-.918.408-1.735.715-2.55 1.225-1.633.918-3.061 1.938-4.489 3.06-.102.101-.204.102-.306.204-1.02.918-1.938 1.734-2.856 2.652-1.02 1.02-2.041 2.04-2.96 3.162-1.937 2.244-4.487 3.469-7.445 3.673-5.713.306-10.61-3.673-11.324-9.283-.816-5.61 2.959-10.813 8.467-11.935a52.639 52.639 0 0 0 7.856-2.142h.101c.816-.408 1.734-.715 2.55-1.122 3.264-1.53 6.121-3.672 8.773-6.12 1.327-1.327 2.652-2.653 3.876-4.082 2.347-2.55 5.305-3.774 8.773-3.57 5.1.306 9.283 4.285 9.895 9.283.204 1.53.102 3.06-.408 4.489-.612 1.938-1.224 3.876-1.734 5.916-.102 1.02-.408 1.939-.51 2.958-.408 2.449-.51 4.795-.306 7.141v.306c.102.816.204 1.53.306 2.347a46.28 46.28 0 0 0 1.224 5.406c.102 0 .102.102.102.204.51 1.632 1.224 3.264 1.224 4.794.306 3.162-.51 5.917-2.55 8.365-1.632 1.938-3.774 3.06-6.223 3.57-1.734.408-3.57.817-5.304 1.326-.102.102-.204.102-.306.102-1.836.612-3.775 1.326-5.509 2.244h-.101c-.918.408-1.735.919-2.551 1.429-.306.204-.714.51-1.02.714a30.738 30.738 0 0 0-2.856 2.244c-.816.714-1.633 1.53-2.347 2.244a.22.22 0 0 1-.204.204c-.918.918-1.734 1.836-2.55 2.754-2.346 2.55-5.202 3.877-8.67 3.775-3.06-.102-5.61-1.428-7.651-3.672-1.428-1.633-2.958-3.163-4.488-4.591v-.102c-.51-.408-1.02-.918-1.53-1.326-.715-.612-1.53-1.122-2.245-1.734l-1.53-.918c-.612-.306-1.122-.612-1.734-.918l-2.754-1.225c-1.326-.612-2.653-1.02-4.081-1.428-1.326-.407-2.652-.714-3.978-1.02a11.146 11.146 0 0 1-3.673-1.224c-3.264-1.734-5.1-4.489-5.61-8.16-.204-1.633 0-3.265.51-4.795.816-2.244 1.428-4.59 1.938-6.936.102-.102.102-.103.102-.204.102-.715.204-1.531.306-2.347.102-.714.205-1.428.205-2.142V43.63l-.087-.956a39.328 39.328 0 0 0-1.24-6.695c-.102-.102-.102-.205-.102-.306-.51-1.734-1.224-3.469-1.53-5.203-1.122-5.712 2.55-11.22 8.263-12.445.714-.204 1.53-.306 2.244-.51 1.224-.306 2.55-.612 3.775-1.02 1.224-.408 2.448-.816 3.672-1.326l1.223-.612c.918-.408 1.837-.918 2.755-1.428 1.122-.714 2.244-1.53 3.366-2.346.408-.306.715-.612 1.122-.918.408-.408.918-.918 1.428-1.326a40.49 40.49 0 0 0 2.96-2.96c1.53-1.835 3.161-3.16 5.405-3.977Z"})})}function N1(e){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",fill:"currentColor",...e,children:w.jsx("path",{d:"M842.667 384H768V277.333a234.667 234.667 0 1 0-469.333 0V384H224a53.393 53.393 0 0 0-53.333 53.333V928A53.393 53.393 0 0 0 224 981.333h618.667A53.393 53.393 0 0 0 896 928V437.333A53.393 53.393 0 0 0 842.667 384zm-288 295.007v110.326a21.333 21.333 0 0 1-42.667 0V679.007a64 64 0 1 1 42.667 0zM725.333 384h-384V277.333c0-105.866 86.134-192 192-192s192 86.134 192 192z"})})}var _c,Gp;function M1(){if(Gp)return _c;Gp=1;var e="Expected a function",t=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt,c=typeof Ho=="object"&&Ho&&Ho.Object===Object&&Ho,u=typeof self=="object"&&self&&self.Object===Object&&self,l=c||u||Function("return this")(),d=Object.prototype,p=d.toString,h=Math.max,m=Math.min,g=function(){return l.Date.now()};function v(b,x,T){var P,z,I,D,$,V,N=0,O=!1,k=!1,_=!0;if(typeof b!="function")throw new TypeError(e);x=E(x)||0,y(T)&&(O=!!T.leading,k="maxWait"in T,I=k?h(E(T.maxWait)||0,x):I,_="trailing"in T?!!T.trailing:_);function M(K){var J=P,se=z;return P=z=void 0,N=K,D=b.apply(se,J),D}function A(K){return N=K,$=setTimeout(U,x),O?M(K):D}function j(K){var J=K-V,se=K-N,ae=x-J;return k?m(ae,I-se):ae}function B(K){var J=K-V,se=K-N;return V===void 0||J>=x||J<0||k&&se>=I}function U(){var K=g();if(B(K))return W(K);$=setTimeout(U,j(K))}function W(K){return $=void 0,_&&P?M(K):(P=z=void 0,D)}function G(){$!==void 0&&clearTimeout($),N=0,P=V=z=$=void 0}function Z(){return $===void 0?D:W(g())}function X(){var K=g(),J=B(K);if(P=arguments,z=this,V=K,J){if($===void 0)return A(V);if(k)return $=setTimeout(U,x),M(V)}return $===void 0&&($=setTimeout(U,x)),D}return X.cancel=G,X.flush=Z,X}function y(b){var x=typeof b;return!!b&&(x=="object"||x=="function")}function C(b){return!!b&&typeof b=="object"}function S(b){return typeof b=="symbol"||C(b)&&p.call(b)==n}function E(b){if(typeof b=="number")return b;if(S(b))return t;if(y(b)){var x=typeof b.valueOf=="function"?b.valueOf():b;b=y(x)?x+"":x}if(typeof b!="string")return b===0?b:+b;b=b.replace(r,"");var T=s.test(b);return T||i.test(b)?a(b.slice(2),T?2:8):o.test(b)?t:+b}return _c=v,_c}M1();function A1(e=!1){if(typeof e!="boolean")throw new Error("defaultValue must be `true` or `false`");const[t,n]=oe.useState(e),r=oe.useCallback(()=>{n(!0)},[]),o=oe.useCallback(()=>{n(!1)},[]),s=oe.useCallback(()=>{n(i=>!i)},[]);return{value:t,setValue:n,setTrue:r,setFalse:o,toggle:s}}var Yp=typeof window<"u"?oe.useLayoutEffect:oe.useEffect;function D1(e){const[t,n]=oe.useState(e),r=oe.useCallback(()=>{n(i=>i+1)},[]),o=oe.useCallback(()=>{n(i=>i-1)},[]),s=oe.useCallback(()=>{n(e)},[e]);return{count:t,increment:r,decrement:o,reset:s,setCount:n}}function L1(e,t){const n=oe.useRef(e);Yp(()=>{n.current=e},[e]),oe.useEffect(()=>{if(t===null)return;const r=setInterval(()=>{n.current()},t);return()=>{clearInterval(r)}},[t])}function F1({countStart:e,countStop:t=0,intervalMs:n=1e3,isIncrement:r=!1}){const{count:o,increment:s,decrement:i,reset:a}=D1(e),{value:c,setTrue:u,setFalse:l}=A1(!1),d=oe.useCallback(()=>{l(),a()},[l,a]),p=oe.useCallback(()=>{if(o===t){l();return}r?s():i()},[o,t,i,s,r,l]);return L1(p,c?n:null),[o,{startCountdown:u,stopCountdown:l,resetCountdown:d}]}var V1=typeof window>"u";function z1(e,{defaultValue:t=!1,initializeWithValue:n=!0}={}){const r=a=>V1?t:window.matchMedia(a).matches,[o,s]=oe.useState(()=>n?r(e):t);function i(){s(r(e))}return Yp(()=>{const a=window.matchMedia(e);return i(),a.addListener?a.addListener(i):a.addEventListener("change",i),()=>{a.removeListener?a.removeListener(i):a.removeEventListener("change",i)}},[e]),o}function Xp({trigger:e,title:t,description:n,children:r,open:o,showCloseIcon:s=!0,onOpenChange:i,zIndex:a,classNames:c}){return z1("(min-width: 1024px)")?w.jsxs(Wa,{open:o,onOpenChange:i,disablePointerDismissal:!0,children:[e&&w.jsx(zs,{className:c?.trigger,children:e}),w.jsxs(Fs,{children:[w.jsx(Za,{style:{zIndex:a},className:"fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm"}),w.jsxs(Ka,{style:{zIndex:a},className:fr("fixed top-1/2 left-1/2 w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg bg-gray-50 p-4 text-gray-900 transition-all duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 z-[991]",c?.desktopPopup),children:[t&&w.jsx(Vs,{className:fr("-mt-1.5 mb-1 text-lg font-medium",c?.title),children:t}),n&&w.jsx(Ya,{className:fr("mb-6 text-base text-gray-600",c?.description),children:n}),s&&w.jsx(Ga,{className:"absolute right-4 top-4 text-gray-700 hover:bg-gray-200 rounded p-0.5",children:w.jsx(Bp,{})}),w.jsx("div",{children:r})]})]})]}):w.jsxs(yE,{open:o,onOpenChange:i,children:[e&&w.jsx(kE,{className:c?.trigger,children:e}),w.jsxs(gE,{children:[w.jsx(Df,{style:{zIndex:a},className:fr("fixed inset-0 bg-black/70 transition-opacity duration-300 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm",c?.backdrop)}),w.jsx(ep,{style:{zIndex:a},className:"fixed inset-0 z-[991]",children:w.jsx(Uf,{className:fr("fixed bottom-0 left-0 right-0 rounded-t-xl bg-white p-4 transition-transform duration-300 data-[starting-style]:translate-y-full data-[ending-style]:translate-y-full","[transform:translateY(var(--drawer-swipe-movement-y))]",c?.mobilePopup),children:w.jsxs(Ff,{children:[w.jsx("div",{"aria-hidden":!0,className:"mx-auto w-12 h-1.5 flex-shrink-0 rounded-full bg-gray-300 mb-4"}),w.jsx(IE,{className:"sr-only",children:t}),w.jsx("div",{children:r})]})})})]})]})}function qp({checked:e,onChange:t}){const[n,r]=oe.useState(!1),[o,s]=oe.useState(!1);return w.jsxs("div",{children:[w.jsx(Xp,{title:"用户协议",open:n,onOpenChange:r,zIndex:993,classNames:{desktopPopup:"w-[90vw] lg:w-[60vw]"},children:w.jsx("iframe",{src:"https://www.gatribe.com/license-light.html?channel_id=1&game_id=5327",className:"w-full h-[70vh]"})}),w.jsx(Xp,{title:"隐私政策",open:o,onOpenChange:s,zIndex:993,classNames:{desktopPopup:"w-[90vw] lg:w-[60vw]"},children:w.jsx("iframe",{src:"https://www.gatribe.com/privacy-light.html?channel_id=1&game_id=5327",className:"w-full h-[70vh]"})}),w.jsx(Wr,{name:"rememberLogin",children:w.jsxs(gc,{className:"flex items-center justify-center text-gray-500 text-xs md:text-sm",children:[w.jsx(sc,{checked:e,className:"size-4 md:size-5 flex items-center justify-center rounded-full border-2 data-[checked]:border-[var(--jssdk-primary-color)] data-[unchecked]:border-[var(--jssdk-input-border-color)]",onCheckedChange:i=>t(!!i),children:w.jsx(ic,{children:w.jsx(Pc,{className:"size-3 text-[var(--jssdk-primary-color)]",strokeWidth:4})})}),w.jsx("span",{className:"ml-2",children:"我已详细阅读并同意"}),w.jsx(Rt,{className:"text-[var(--jssdk-primary-color)]",onClick:()=>r(!0),type:"button",children:"《用户协议》"}),w.jsx("span",{children:"及"}),w.jsx(Rt,{className:"text-[var(--jssdk-primary-color)]",onClick:()=>s(!0),type:"button",children:"《隐私政策》"})]})})]})}function Po({trigger:e,title:t,description:n,children:r,open:o,showCloseIcon:s=!0,onOpenChange:i,disablePointerDismissal:a=!1,classNames:c}){return w.jsxs(Wa,{open:o,onOpenChange:i,disablePointerDismissal:a,children:[e&&w.jsx(zs,{className:c?.trigger,children:e}),w.jsxs(Fs,{children:[w.jsx(Za,{className:"fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm",forceRender:!0}),w.jsxs(Ka,{className:St("fixed top-1/2 left-1/2 w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg bg-gray-50 p-4 text-gray-900 transition-all duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 z-[990]",c?.popup),children:[t&&w.jsx(Vs,{className:St("-mt-1.5 mb-1 text-lg font-medium",c?.title),children:t}),n&&w.jsx(Ya,{className:St("mb-6 text-base text-gray-600",c?.description),children:n}),s&&w.jsx(Ga,{className:St("absolute right-4 top-4 text-gray-700 hover:bg-gray-200 rounded p-0.5",c?.close),children:w.jsx(Bp,{})}),w.jsx("div",{children:r})]})]})]})}function Tn({name:e,prefix:t,suffix:n,className:r,inputClassName:o,error:s,...i}){return w.jsxs(Wr,{name:e,className:"group",children:[w.jsxs("div",{className:St("flex items-center border border-[var(--jssdk-input-border-color)] group-data-[focused]:border-[var(--jssdk-primary-color)] group-data-[focused]:shadow-[0_0_6px_color-mix(in_srgb,var(--jssdk-primary-color),transparent_80%)] rounded-full bg-white px-3 gap-2 h-12 transition-all duration-200",s&&"border-red-500",r),children:[t,w.jsx(Gs,{className:St("flex-1 w-0 outline-none rounded-full h-full pl-1",o),...i}),n]}),w.jsx(Zs,{className:"text-red-500 text-xs mt-1 ml-3"})]})}function $1({account:e,forgetPasswordKey:t,onSuccess:n}){const[r,o]=oe.useState(""),[s,i]=oe.useState(!1),{mutate:a,isPending:c}=sn({mutationFn:()=>_1({account:e,forget_password_key:t,password:r}),onSuccess:l=>{l?.code===0||!l?.error?n():gt.warning(l.detail||l.error||"重置失败")}}),u=()=>{if(!r){gt.warning("请输入新密码");return}if(r.length<6||r.length>18){gt.warning("密码长度需要在6-18位之间");return}a()};return w.jsxs("div",{className:"space-y-4",children:[w.jsx("div",{className:"text-sm text-gray-500 mb-4 text-center",children:"请设置新的登录密码"}),w.jsx(Tn,{name:"password",type:s?"text":"password",autoComplete:"off",inputClassName:"placeholder:text-sm",placeholder:"请输入6-18位由数字、字母组成的密码",value:r,autoFocus:!0,onValueChange:l=>o(l),suffix:w.jsx(Rt,{onClick:()=>i(!s),type:"button",children:s?w.jsx(Up,{className:"size-5 text-gray-400"}):w.jsx(Hp,{className:"size-5 text-gray-400"})})}),w.jsx(Rt,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:u,disabled:!r||c,children:c?"重置中...":"确定修改"})]})}var j1=function(e){return typeof e=="number"};function H1(e){var t=oe.useRef(e);return t.current=e,t}var ei={exports:{}},U1=ei.exports,Kp;function B1(){return Kp||(Kp=1,(function(e,t){(function(n,r){e.exports=r()})(U1,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",i="second",a="minute",c="hour",u="day",l="week",d="month",p="quarter",h="year",m="date",g="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var O=["th","st","nd","rd"],k=N%100;return"["+N+(O[(k-20)%10]||O[k]||O[0])+"]"}},S=function(N,O,k){var _=String(N);return!_||_.length>=O?N:""+Array(O+1-_.length).join(k)+N},E={s:S,z:function(N){var O=-N.utcOffset(),k=Math.abs(O),_=Math.floor(k/60),M=k%60;return(O<=0?"+":"-")+S(_,2,"0")+":"+S(M,2,"0")},m:function N(O,k){if(O.date()<k.date())return-N(k,O);var _=12*(k.year()-O.year())+(k.month()-O.month()),M=O.clone().add(_,d),A=k-M<0,j=O.clone().add(_+(A?-1:1),d);return+(-(_+(k-M)/(A?M-j:j-M))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:d,y:h,w:l,d:u,D:m,h:c,m:a,s:i,ms:s,Q:p}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},b="en",x={};x[b]=C;var T="$isDayjsObject",P=function(N){return N instanceof $||!(!N||!N[T])},z=function N(O,k,_){var M;if(!O)return b;if(typeof O=="string"){var A=O.toLowerCase();x[A]&&(M=A),k&&(x[A]=k,M=A);var j=O.split("-");if(!M&&j.length>1)return N(j[0])}else{var B=O.name;x[B]=O,M=B}return!_&&M&&(b=M),M||!_&&b},I=function(N,O){if(P(N))return N.clone();var k=typeof O=="object"?O:{};return k.date=N,k.args=arguments,new $(k)},D=E;D.l=z,D.i=P,D.w=function(N,O){return I(N,{locale:O.$L,utc:O.$u,x:O.$x,$offset:O.$offset})};var $=(function(){function N(k){this.$L=z(k.locale,null,!0),this.parse(k),this.$x=this.$x||k.x||{},this[T]=!0}var O=N.prototype;return O.parse=function(k){this.$d=(function(_){var M=_.date,A=_.utc;if(M===null)return new Date(NaN);if(D.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var j=M.match(v);if(j){var B=j[2]-1||0,U=(j[7]||"0").substring(0,3);return A?new Date(Date.UTC(j[1],B,j[3]||1,j[4]||0,j[5]||0,j[6]||0,U)):new Date(j[1],B,j[3]||1,j[4]||0,j[5]||0,j[6]||0,U)}}return new Date(M)})(k),this.init()},O.init=function(){var k=this.$d;this.$y=k.getFullYear(),this.$M=k.getMonth(),this.$D=k.getDate(),this.$W=k.getDay(),this.$H=k.getHours(),this.$m=k.getMinutes(),this.$s=k.getSeconds(),this.$ms=k.getMilliseconds()},O.$utils=function(){return D},O.isValid=function(){return this.$d.toString()!==g},O.isSame=function(k,_){var M=I(k);return this.startOf(_)<=M&&M<=this.endOf(_)},O.isAfter=function(k,_){return I(k)<this.startOf(_)},O.isBefore=function(k,_){return this.endOf(_)<I(k)},O.$g=function(k,_,M){return D.u(k)?this[_]:this.set(M,k)},O.unix=function(){return Math.floor(this.valueOf()/1e3)},O.valueOf=function(){return this.$d.getTime()},O.startOf=function(k,_){var M=this,A=!!D.u(_)||_,j=D.p(k),B=function(se,ae){var pe=D.w(M.$u?Date.UTC(M.$y,ae,se):new Date(M.$y,ae,se),M);return A?pe:pe.endOf(u)},U=function(se,ae){return D.w(M.toDate()[se].apply(M.toDate("s"),(A?[0,0,0,0]:[23,59,59,999]).slice(ae)),M)},W=this.$W,G=this.$M,Z=this.$D,X="set"+(this.$u?"UTC":"");switch(j){case h:return A?B(1,0):B(31,11);case d:return A?B(1,G):B(0,G+1);case l:var K=this.$locale().weekStart||0,J=(W<K?W+7:W)-K;return B(A?Z-J:Z+(6-J),G);case u:case m:return U(X+"Hours",0);case c:return U(X+"Minutes",1);case a:return U(X+"Seconds",2);case i:return U(X+"Milliseconds",3);default:return this.clone()}},O.endOf=function(k){return this.startOf(k,!1)},O.$set=function(k,_){var M,A=D.p(k),j="set"+(this.$u?"UTC":""),B=(M={},M[u]=j+"Date",M[m]=j+"Date",M[d]=j+"Month",M[h]=j+"FullYear",M[c]=j+"Hours",M[a]=j+"Minutes",M[i]=j+"Seconds",M[s]=j+"Milliseconds",M)[A],U=A===u?this.$D+(_-this.$W):_;if(A===d||A===h){var W=this.clone().set(m,1);W.$d[B](U),W.init(),this.$d=W.set(m,Math.min(this.$D,W.daysInMonth())).$d}else B&&this.$d[B](U);return this.init(),this},O.set=function(k,_){return this.clone().$set(k,_)},O.get=function(k){return this[D.p(k)]()},O.add=function(k,_){var M,A=this;k=Number(k);var j=D.p(_),B=function(G){var Z=I(A);return D.w(Z.date(Z.date()+Math.round(G*k)),A)};if(j===d)return this.set(d,this.$M+k);if(j===h)return this.set(h,this.$y+k);if(j===u)return B(1);if(j===l)return B(7);var U=(M={},M[a]=r,M[c]=o,M[i]=n,M)[j]||1,W=this.$d.getTime()+k*U;return D.w(W,this)},O.subtract=function(k,_){return this.add(-1*k,_)},O.format=function(k){var _=this,M=this.$locale();if(!this.isValid())return M.invalidDate||g;var A=k||"YYYY-MM-DDTHH:mm:ssZ",j=D.z(this),B=this.$H,U=this.$m,W=this.$M,G=M.weekdays,Z=M.months,X=M.meridiem,K=function(ae,pe,Y,me){return ae&&(ae[pe]||ae(_,A))||Y[pe].slice(0,me)},J=function(ae){return D.s(B%12||12,ae,"0")},se=X||function(ae,pe,Y){var me=ae<12?"AM":"PM";return Y?me.toLowerCase():me};return A.replace(y,(function(ae,pe){return pe||(function(Y){switch(Y){case"YY":return String(_.$y).slice(-2);case"YYYY":return D.s(_.$y,4,"0");case"M":return W+1;case"MM":return D.s(W+1,2,"0");case"MMM":return K(M.monthsShort,W,Z,3);case"MMMM":return K(Z,W);case"D":return _.$D;case"DD":return D.s(_.$D,2,"0");case"d":return String(_.$W);case"dd":return K(M.weekdaysMin,_.$W,G,2);case"ddd":return K(M.weekdaysShort,_.$W,G,3);case"dddd":return G[_.$W];case"H":return String(B);case"HH":return D.s(B,2,"0");case"h":return J(1);case"hh":return J(2);case"a":return se(B,U,!0);case"A":return se(B,U,!1);case"m":return String(U);case"mm":return D.s(U,2,"0");case"s":return String(_.$s);case"ss":return D.s(_.$s,2,"0");case"SSS":return D.s(_.$ms,3,"0");case"Z":return j}return null})(ae)||j.replace(":","")}))},O.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},O.diff=function(k,_,M){var A,j=this,B=D.p(_),U=I(k),W=(U.utcOffset()-this.utcOffset())*r,G=this-U,Z=function(){return D.m(j,U)};switch(B){case h:A=Z()/12;break;case d:A=Z();break;case p:A=Z()/3;break;case l:A=(G-W)/6048e5;break;case u:A=(G-W)/864e5;break;case c:A=G/o;break;case a:A=G/r;break;case i:A=G/n;break;default:A=G}return M?A:D.a(A)},O.daysInMonth=function(){return this.endOf(d).$D},O.$locale=function(){return x[this.$L]},O.locale=function(k,_){if(!k)return this.$L;var M=this.clone(),A=z(k,_,!0);return A&&(M.$L=A),M},O.clone=function(){return D.w(this.$d,this)},O.toDate=function(){return new Date(this.valueOf())},O.toJSON=function(){return this.isValid()?this.toISOString():null},O.toISOString=function(){return this.$d.toISOString()},O.toString=function(){return this.$d.toUTCString()},N})(),V=$.prototype;return I.prototype=V,[["$ms",s],["$s",i],["$m",a],["$H",c],["$W",u],["$M",d],["$y",h],["$D",m]].forEach((function(N){V[N[1]]=function(O){return this.$g(O,N[0],N[1])}})),I.extend=function(N,O){return N.$i||(N(O,$,I),N.$i=!0),I},I.locale=z,I.isDayjs=P,I.unix=function(N){return I(1e3*N)},I.en=x[b],I.Ls=x,I.p={},I}))})(ei)),ei.exports}var W1=B1();const Z1=zv(W1);var Ic=function(e){if(!e)return 0;var t=Z1(e).valueOf()-Date.now();return t<0?0:t},G1=function(e){return{days:Math.floor(e/864e5),hours:Math.floor(e/36e5)%24,minutes:Math.floor(e/6e4)%60,seconds:Math.floor(e/1e3)%60,milliseconds:Math.floor(e)%1e3}},Jp=function(e){e===void 0&&(e={});var t=e||{},n=t.leftTime,r=t.targetDate,o=t.interval,s=o===void 0?1e3:o,i=t.onEnd,a=oe.useMemo(function(){return j1(n)&&n>0?Date.now()+n:void 0},[n]),c="leftTime"in e?a:r,u=Im(oe.useState(function(){return Ic(c)}),2),l=u[0],d=u[1],p=H1(i);oe.useEffect(function(){if(!c){d(0);return}d(Ic(c));var m=setInterval(function(){var g,v=Ic(c);d(v),v===0&&(clearInterval(m),(g=p.current)===null||g===void 0||g.call(p))},s);return function(){return clearInterval(m)}},[c,s]);var h=oe.useMemo(function(){return G1(l)},[l]);return[l,h]};function Y1({account:e,mobile:t,onNext:n}){const[r,o]=oe.useState(""),[s,i]=oe.useState(),[a]=Jp({leftTime:s?s*1e3:void 0,interval:1e3,onEnd(){i(void 0)}}),{mutate:c,isPending:u}=sn({mutationFn:()=>P1({account:e,type:"reset-password",is_voice:0,t:"ctoken"}),onSuccess:h=>{i(h.lock_time),gt.success("验证码已发送,请注意查收")}}),{mutate:l,isPending:d}=sn({mutationFn:()=>Zp({account:e,captcha:r,t:"reset-password"}),onSuccess:h=>{h?.forget_password_key?n(h.forget_password_key):gt.warning("安全验证失败")},onError:h=>{gt.warning(h?.message||h?.detail||"验证失败")}}),p=()=>{if(!r){gt.warning("请输入验证码");return}l()};return w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",w.jsx("br",{}),"请输入验证码,短信将发送至您的绑定手机"," ",w.jsx("span",{className:"font-semibold text-gray-700",children:t})]}),w.jsx(Tn,{name:"verificationCode",placeholder:"请输入验证码",value:r,type:"number",autoFocus:!0,onValueChange:h=>o(h),suffix:w.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-white inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onClick:()=>c(),disabled:!!s||u,children:u?"发送中...":s?`${Math.round(a/1e3)}s 后重新获取`:"获取验证码"})}),w.jsx(Rt,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:p,disabled:d,children:d?"验证中...":"下一步"})]})}function X1({account:e,onNext:t}){const[n,r]=oe.useState(""),{mutate:o,isPending:s}=sn({mutationFn:()=>Zp({account:e,idcard:n,t:"reset-password"}),onSuccess:a=>{a?.forget_password_key?t(a.forget_password_key):gt.warning("安全验证失败")}}),i=()=>{if(!n){gt.warning("请输入身份证号");return}o()};return w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",w.jsx("br",{}),"该账号未绑定手机,请输入注册时填写的身份证信息"]}),w.jsx(Tn,{name:"idCard",placeholder:"请输入身份证号",value:n,autoFocus:!0,onChange:a=>r(a.currentTarget.value)}),w.jsx(Rt,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:i,disabled:s,children:s?"验证中...":"下一步"})]})}function q1({onClose:e,defaultAccount:t=""}){const[n,r]=oe.useState("account"),[o,s]=oe.useState(t),[i,a]=oe.useState(""),[c,u]=oe.useState(2),[l,d]=oe.useState(""),p=oe.useRef(null);oe.useEffect(()=>{if(!window.captchaZtgame){const y=document.createElement("script");y.type="text/javascript",y.src=`//nocaptcha.ztgame.com/static/verify2023/js/captcha.js?t=${new Date().getTime()}`,y.id="captchaZtgameScript",document.body.appendChild(y)}},[]);const{mutate:h,isPending:m}=sn({mutationFn:async y=>O1({account:o,nonce:y.nonce,token:y.token,type:y.type,t:"ctoken"}),onSuccess:y=>{const C=y.type;u(C),a(C===2?y.mobile:""),r("secure"),p.current?.onRefresh?.()},onError:y=>{gt.warning(y?.message||y?.detail||"验证失败"),p.current?.onRefresh?.()}}),g=()=>{if(!o){gt.warning("请输入账号信息");return}window.captchaZtgame?window.captchaZtgame.init({appsceneid:"pt_login",usertype:"1",el:"captcha-forget-pwd",mode:"popup",styles:{width:300,height:150,fontSize:"14px"},popupStyles:{position:"fixed",top:"30%",left:"50%",zIndex:"99999"},onSuccess(y,C){p.current=y,h({nonce:y.nonce,token:C.data.token,type:y.type})},onLoad(y){p.current=y,y.onVerify()},onFail(){}}):gt.warning("安全组件未加载,请稍后再试")},v=y=>{d(y),r("reset")};return w.jsxs("div",{className:"space-y-5",children:[w.jsx("div",{id:"captcha-forget-pwd"}),n==="account"&&w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",w.jsx("br",{}),"请输入您的账号信息"]}),w.jsx(Tn,{name:"account",placeholder:"请输入账号信息",autoFocus:!0,value:o,onChange:y=>s(y.currentTarget.value)}),w.jsx(Rt,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:g,disabled:!o||m,children:m?"验证中...":"下一步"})]}),n==="secure"&&(c===2?w.jsx(Y1,{account:o,mobile:i,onNext:v}):w.jsx(X1,{account:o,onNext:v})),n==="reset"&&w.jsx($1,{account:o,forgetPasswordKey:l,onSuccess:()=>r("success")}),n==="success"&&w.jsxs("div",{className:"space-y-4 py-6",children:[w.jsx("div",{className:"text-center text-lg font-medium text-gray-800",children:"重置密码成功"}),w.jsx(Rt,{className:"mt-6 h-10 w-full bg-gray-100 text-gray-700 rounded-full hover:bg-gray-200",onClick:()=>e?.(),children:"返回登录"})]})]})}function K1(){const{gameId:e,onAccountLoginSuccess:t,onLoginSuccess:n,onLoginError:r,triggerRealNameAuth:o}=Dn(),s=oe.useRef(null),[i,a]=oe.useState(""),[c,u]=oe.useState(""),[l,d]=oe.useState(!1),[p,h]=oe.useState(!0),[m,g]=oe.useState(!1),{mutate:v,isPending:y}=sn({mutationFn:()=>S1({account:i,password:c}),onSuccess:S=>{const E={account:S.account,entity:S.channel_info.entity,token:S.channel_info.token,sign:S.channel_info.sign,accid:S.channel_info.entity.openid,extra_data:S.channel_info.extra_data,gaplaySign:S.channel_info.gaplaySign,realname:S.channel_info.realname};if(Ns(E,S._auth,e),E.realname&&E.realname.reject>=2){o();return}t?.(E),n?.(E)},onError:S=>{r?.(S)}});async function C(S){if(S.preventDefault(),!p){gt.warning("请先阅读并同意用户协议和隐私政策");return}if(!i||!c){gt.warning("请输入账号和密码");return}v()}return w.jsx(w.Fragment,{children:w.jsxs(To,{ref:s,onSubmit:C,className:"space-y-5",children:[w.jsx(Tn,{name:"account",placeholder:e==="5327"?"请输入账号":"请输入巨人通行证账号",autoFocus:!0,onChange:S=>a(S.currentTarget.value),prefix:e==="5327"?w.jsx(y1,{className:"size-5 text-gray-400"}):w.jsx(R1,{className:"size-5 text-gray-400"})}),w.jsx(Tn,{name:"password",type:l?"text":"password",autoComplete:"off",placeholder:"请输入密码",value:c,onValueChange:S=>u(S),prefix:w.jsx(N1,{className:"size-5 text-gray-400"}),suffix:w.jsx(Rt,{onClick:()=>d(!l),type:"button",children:l?w.jsx(Up,{className:"size-5 text-gray-400"}):w.jsx(Hp,{className:"size-5 text-gray-400"})})}),w.jsxs("section",{children:[w.jsx("div",{className:"flex justify-end mb-1",children:w.jsx(Po,{title:"忘记密码",open:m,onOpenChange:g,trigger:w.jsx("button",{type:"button",className:"text-[var(--jssdk-primary-color)] text-sm",children:"忘记密码"}),children:w.jsx(q1,{onClose:()=>g(!1),defaultAccount:i})})}),w.jsx(Rt,{className:"h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",type:"submit",disabled:y,children:"登录"})]}),w.jsx(Qs,{}),w.jsx(qp,{checked:p,onChange:h})]})})}var Qp;function ee(e,t,n){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const u=i.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){const p=l[d];p in a||(a[p]=u[p].bind(a))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const u=n?.Parent?new s:this;r(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Gr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class eh extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Qp=globalThis).__zod_globalConfig??(Qp.__zod_globalConfig={});const kc=globalThis.__zod_globalConfig;function yr(e){return kc}function th(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Rc(e,t){return typeof t=="bigint"?t.toString():t}function Nc(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Mc(e){return e==null}function Ac(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const nh=Symbol("evaluating");function ot(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==nh)return r===void 0&&(r=nh,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function vr(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Jn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function rh(e){return JSON.stringify(e)}function J1(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const oh="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ti(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Q1=Nc(()=>{if(kc.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function _o(e){if(ti(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(ti(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function sh(e){return _o(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const ex=new Set(["string","number","symbol"]);function ni(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function ke(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function tx(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function nx(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=Jn(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=n.shape[a])}return vr(this,"shape",i),i},checks:[]});return Qn(e,s)}function rx(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=Jn(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return vr(this,"shape",i),i},checks:[]});return Qn(e,s)}function ox(e,t){if(!_o(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Jn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return vr(this,"shape",s),s}});return Qn(e,o)}function sx(e,t){if(!_o(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Jn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return vr(this,"shape",r),r}});return Qn(e,n)}function ix(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=Jn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return vr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Qn(e,n)}function ax(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=Jn(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(n)for(const u in n){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return vr(this,"shape",c),c},checks:[]});return Qn(t,i)}function cx(e,t,n){const r=Jn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return vr(this,"shape",s),s}});return Qn(t,r)}function Yr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ux(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ih(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function ri(e){return typeof e=="string"?e:e?.message}function br(e,t,n){const r=e.message?e.message:ri(e.inst?._zod.def?.error?.(e))??ri(t?.error?.(e))??ri(n.customError?.(e))??ri(n.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...a}=e;return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=i),a}function Dc(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Io(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const ah=(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,Rc,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ch=ee("$ZodError",ah),uh=ee("$ZodError",ah,{Parent:Error});function oi(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function lx(e,t=n=>n.message){const n={_errors:[]},r=(o,s=[])=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")r({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")r({issues:i.issues},[...s,...i.path]);else{const a=[...s,...i.path];if(a.length===0)n._errors.push(t(i));else{let c=n,u=0;for(;u<a.length;){const l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return r(e),n}const Lc=e=>(t,n,r,o)=>{const s=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Gr;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>br(c,s,yr())));throw oh(a,o?.callee),a}return i.value},Fc=e=>async(t,n,r,o)=>{const s=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>br(c,s,yr())));throw oh(a,o?.callee),a}return i.value},si=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Gr;return s.issues.length?{success:!1,error:new(e??ch)(s.issues.map(i=>br(i,o,yr())))}:{success:!0,data:s.value}},dx=si(uh),ii=e=>async(t,n,r)=>{const o=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>br(i,o,yr())))}:{success:!0,data:s.value}},fx=ii(uh),px=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Lc(e)(t,n,o)},hx=e=>(t,n,r)=>Lc(e)(t,n,r),mx=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Fc(e)(t,n,o)},gx=e=>async(t,n,r)=>Fc(e)(t,n,r),yx=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return si(e)(t,n,o)},vx=e=>(t,n,r)=>si(e)(t,n,r),bx=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return ii(e)(t,n,o)},wx=e=>async(t,n,r)=>ii(e)(t,n,r),Sx=/^[cC][0-9a-z]{6,}$/,Ex=/^[0-9a-z]+$/,xx=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Cx=/^[0-9a-vA-V]{20}$/,Tx=/^[A-Za-z0-9]{27}$/,Ox=/^[a-zA-Z0-9_-]{21}$/,Px=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_x=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,lh=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ix=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,kx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Rx(){return new RegExp(kx,"u")}const Nx=/^(?:(?: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])$/,Mx=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ax=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Dx=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Lx=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dh=/^[A-Za-z0-9_-]*$/,Fx=/^https?$/,Vx=/^\+[1-9]\d{6,14}$/,fh="(?:(?:\\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])))",zx=new RegExp(`^${fh}$`);function ph(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function $x(e){return new RegExp(`^${ph(e)}$`)}function jx(e){const t=ph({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${fh}T(?:${r})$`)}const Hx=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ux=/^[^A-Z]*$/,Bx=/^[^a-z]*$/,On=ee("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Wx=ee("$ZodCheckMaxLength",(e,t)=>{var n;On.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mc(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const i=Dc(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Zx=ee("$ZodCheckMinLength",(e,t)=>{var n;On.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mc(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const i=Dc(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Gx=ee("$ZodCheckLengthEquals",(e,t)=>{var n;On.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mc(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const i=Dc(o),a=s>t.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ai=ee("$ZodCheckStringFormat",(e,t)=>{var n,r;On.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Yx=ee("$ZodCheckRegex",(e,t)=>{ai.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xx=ee("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ux),ai.init(e,t)}),qx=ee("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Bx),ai.init(e,t)}),Kx=ee("$ZodCheckIncludes",(e,t)=>{On.init(e,t);const n=ni(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Jx=ee("$ZodCheckStartsWith",(e,t)=>{On.init(e,t);const n=new RegExp(`^${ni(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Qx=ee("$ZodCheckEndsWith",(e,t)=>{On.init(e,t);const n=new RegExp(`.*${ni(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),eC=ee("$ZodCheckOverwrite",(e,t)=>{On.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class tC{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
18
+ `))},[t])}const c=f.useCallback(u=>{o||i(u)},[]);return[a,c]}function ff(e){let t=0;const n=new WeakMap;try{return JSON.stringify(e,function(s,i){if(!(s==="_owner"&&this!=null&&typeof this=="object"&&"$$typeof"in this)){if(typeof i=="bigint")return`__bigint__:${i}`;if(i!==null&&typeof i=="object"){const a=n.get(i);if(a!==void 0)return`__object__:${a}`;n.set(i,t),t+=1}return i}})??`__top__:${typeof e}`}catch{return"__unserializable__"}}const $a=f.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});process.env.NODE_ENV!=="production"&&($a.displayName="CompositeListContext");function yS(){return f.useContext($a)}function vS(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=ie(o),i=f.useRef(0),a=wt(wS).current,c=wt(bS).current,[u,l]=f.useState(0),d=f.useRef(u),p=ie((y,C)=>{c.set(y,C??null),d.current+=1,l(d.current)}),h=ie(y=>{c.delete(y),d.current+=1,l(d.current)}),m=f.useMemo(()=>{const y=new Map;return Array.from(c.keys()).filter(S=>S.isConnected).sort(SS).forEach((S,E)=>{const b=c.get(S)??{};y.set(S,{...b,index:E})}),y},[c,u]);he(()=>{if(typeof MutationObserver!="function"||m.size===0)return;const y=new MutationObserver(C=>{const S=new Set,E=b=>S.has(b)?S.delete(b):S.add(b);C.forEach(b=>{b.removedNodes.forEach(E),b.addedNodes.forEach(E)}),S.size===0&&(d.current+=1,l(d.current))});return m.forEach((C,S)=>{S.parentElement&&y.observe(S.parentElement,{childList:!0})}),()=>{y.disconnect()}},[m]),he(()=>{d.current===u&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),i.current=m.size),s(m)},[s,m,n,r,u]),he(()=>()=>{n.current=[]},[n]),he(()=>()=>{r&&(r.current=[])},[r]);const g=ie(y=>(a.add(y),()=>{a.delete(y)}));he(()=>{a.forEach(y=>y(m))},[a,m]);const v=f.useMemo(()=>({register:p,unregister:h,subscribeMapChange:g,elementsRef:n,labelsRef:r,nextIndexRef:i}),[p,h,g,n,r,i]);return w.jsx($a.Provider,{value:v,children:t})}function bS(){return new Map}function wS(){return new Set}function SS(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}function qt(e){return Xn(e,"base-ui")}let pf=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function ES(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:i,unregister:a,subscribeMapChange:c,elementsRef:u,labelsRef:l,nextIndexRef:d}=yS(),p=f.useRef(-1),[h,m]=f.useState(s??(o===pf.GuessFromOrder?()=>{if(p.current===-1){const y=d.current;d.current+=1,p.current=y}return p.current}:-1)),g=f.useRef(null),v=f.useCallback(y=>{if(g.current=y,h!==-1&&y!==null&&(u.current[h]=y,l)){const C=t!==void 0;l.current[h]=C?t:r?.current?.textContent??y.textContent}},[h,u,l,t,r]);return he(()=>{if(s!=null)return;const y=g.current;if(y)return i(y,n),()=>{a(y)}},[s,i,a,n]),he(()=>{if(s==null)return c(y=>{const C=g.current?y.get(g.current)?.index:null;C!=null&&m(C)})},[s,c,m]),f.useMemo(()=>({ref:v,index:h}),[h,v])}const hf="ArrowUp",mf="ArrowDown",gf="ArrowLeft",yf="ArrowRight",vf="Home",bf="End",xS=new Set([gf,yf]),CS=new Set([hf,mf]),TS=new Set([...xS,...CS]);[...TS];const Ms=new Set([hf,mf,gf,yf,vf,bf]);function ja(e){const t=f.useRef(!0);t.current&&(t.current=!1,e())}let wf={},Sf={},Ef="";function OS(e){if(typeof document>"u")return!1;const t=Ie(e);return tt(t).innerWidth-t.documentElement.clientWidth>0}function PS(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=Ie(e),r=n.documentElement,o=n.body,s=Bn(r)?r:o,i=s.style.overflowY,a=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",s.style.overflowY="scroll";const c=s.offsetWidth;s.style.overflowY="hidden";const u=s.offsetWidth;return s.style.overflowY=i,r.style.scrollbarGutter=a,c===u}function _S(e){const t=Ie(e),n=t.documentElement,r=t.body,o=Bn(n)?n:r,s={overflowY:o.style.overflowY,overflowX:o.style.overflowX};return Object.assign(o.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(o.style,s)}}function IS(e){const t=Ie(e),n=t.documentElement,r=t.body,o=tt(n);let s=0,i=0,a=!1;const c=yn.create();if(Gi&&(o.visualViewport?.scale??1)!==1)return()=>{};function u(){const h=o.getComputedStyle(n),m=o.getComputedStyle(r),y=(h.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,wf={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Ef=n.style.scrollBehavior,Sf={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const C=n.scrollHeight>n.clientHeight,S=n.scrollWidth>n.clientWidth,E=h.overflowY==="scroll"||m.overflowY==="scroll",b=h.overflowX==="scroll"||m.overflowX==="scroll",x=Math.max(0,o.innerWidth-r.clientWidth),T=Math.max(0,o.innerHeight-r.clientHeight),P=parseFloat(m.marginTop)+parseFloat(m.marginBottom),$=parseFloat(m.marginLeft)+parseFloat(m.marginRight),M=Bn(n)?n:r;if(a=PS(e),a){n.style.scrollbarGutter=y,M.style.overflowY="hidden",M.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:y,overflowY:"hidden",overflowX:"hidden"}),(C||E)&&(n.style.overflowY="scroll"),(S||b)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:P||T?`calc(100dvh - ${P+T}px)`:"100dvh",width:$||x?`calc(100vw - ${$+x}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=s,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function l(){Object.assign(n.style,wf),Object.assign(r.style,Sf),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Ef)}function d(){l(),c.request(u)}u();const p=Fe(o,"resize",d);return()=>{c.cancel(),l(),typeof o.removeEventListener=="function"&&p()}}class kS{lockCount=0;restore=null;timeoutLock=Zt.create();timeoutUnlock=Zt.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const r=Ie(t).documentElement,o=tt(r).getComputedStyle(r).overflowY;if(o==="hidden"||o==="clip"){this.restore=Ct;return}const s=al||!OS(t);this.restore=s?_S(t):IS(t)}}const RS=new kS;function xf(e=!0,t=null){he(()=>{if(e)return RS.acquire(t)},[e,t])}function NS(e){const t=f.useRef(""),n=f.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:f.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function As(e,t){const n=f.useRef(e),r=ie(t);he(()=>{n.current!==e&&r(n.current)},[e,r]),he(()=>{n.current=e},[e])}function Ha(e){const[t,n]=f.useState(null),r=ie((i,a)=>{e||n(a||(al?"touch":""))});As(e,i=>{i&&!e&&n(null)});const{onClick:o,onPointerDown:s}=NS(r);return f.useMemo(()=>({openMethod:t,triggerProps:{onClick:o,onPointerDown:s}}),[t,o,s])}function MS(e){const{store:t,parentContext:n,actionsRef:r,isDrawer:o}=e,s=t.useState("open"),i=t.useState("disablePointerDismissal"),a=t.useState("modal"),c=t.useState("popupElement"),{openMethod:u,triggerProps:l}=Ha(s);kd(t);const{forceUnmount:d}=Rd(s,t),p=f.useCallback(()=>{t.setOpen(!1,Ae(td))},[t]);f.useImperativeHandle(r,()=>({unmount:d,close:p}),[d,p]);const h=Dd({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[m,g]=f.useState(0),[v,y]=f.useState(0),C=m===0,S=zd(h),E=ka(h,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:a==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(V){if(!t.context.outsidePressEnabledRef.current||"button"in V&&V.button!==0||"touches"in V&&V.touches.length!==1)return!1;const L=lt(V);if(C&&!i){const D=L;return a&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===D||t.context.backdropRef.current===D||we(D,c)&&!D?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:C});xf(s&&a===!0,c);const{getReferenceProps:b,getFloatingProps:x,getTriggerProps:T}=bo([S,E]);t.useContextCallback("onNestedDialogOpen",(V,L)=>{g(V),y(L)}),t.useContextCallback("onNestedDialogClose",()=>{g(0),y(0)}),f.useEffect(()=>(n?.onNestedDialogOpen&&s&&n.onNestedDialogOpen(m+1,v+(o?1:0)),n?.onNestedDialogClose&&!s&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&s&&n.onNestedDialogClose()}),[o,s,m,v,n]);const P=f.useMemo(()=>b(l),[b,l]),$=f.useMemo(()=>T(l),[T,l]),M=f.useMemo(()=>x(),[x]);t.useSyncedValues({openMethod:u,activeTriggerProps:P,inactiveTriggerProps:$,popupProps:M,floatingRootContext:h,nestedOpenDialogCount:m,nestedOpenDrawerCount:v})}const Ua=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ua.displayName="DialogRootContext");function Vt(e){const t=f.useContext(Ua);if(e===!1&&t===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.":ft(27));return t}const AS={...Md,modal:de(e=>e.modal),nested:de(e=>e.nested),nestedOpenDialogCount:de(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:de(e=>e.nestedOpenDrawerCount),disablePointerDismissal:de(e=>e.disablePointerDismissal),openMethod:de(e=>e.openMethod),descriptionElementId:de(e=>e.descriptionElementId),titleElementId:de(e=>e.titleElementId),viewportElement:de(e=>e.viewportElement),role:de(e=>e.role)};class Ba extends Wo{constructor(t){super(DS(t),{popupRef:f.createRef(),backdropRef:f.createRef(),internalBackdropRef:f.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new bs,onOpenChange:void 0,onOpenChangeComplete:void 0},AS)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const r={open:t},o=n.trigger?.id??null;(o||t)&&(r.activeTriggerId=o,r.activeTriggerElement=n.trigger??null),this.update(r)};static useStore(t,n){const r=wt(()=>new Ba(n)).current;return t??r}}function DS(e={}){return{...Nd(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}const Ds=f.createContext(!1);process.env.NODE_ENV!=="production"&&(Ds.displayName="IsDrawerContext");function Wa(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:s,disablePointerDismissal:i=!1,modal:a=!0,actionsRef:c,handle:u,triggerId:l,defaultTriggerId:d=null}=e,p=Vt(!0),h=f.useContext(Ds),m=!!p,g=Ba.useStore(u?.store,{open:r,openProp:n,activeTriggerId:d,triggerIdProp:l,modal:a,disablePointerDismissal:i,nested:m});ja(()=>{n===void 0&&g.state.open===!1&&r===!0&&g.update({open:!0,activeTriggerId:d})}),g.useControlledProp("openProp",n),g.useControlledProp("triggerIdProp",l),g.useSyncedValues({disablePointerDismissal:i,nested:m,modal:a}),g.useContextCallback("onOpenChange",o),g.useContextCallback("onOpenChangeComplete",s);const v=g.useState("payload");MS({store:g,actionsRef:c,parentContext:p?.store.context,isDrawer:h});const y=f.useMemo(()=>({store:g}),[g]);return w.jsx(Ds.Provider,{value:!1,children:w.jsx(Ua.Provider,{value:y,children:typeof t=="function"?t({payload:v}):t})})}const LS={...Cn,...tn},Za=f.forwardRef(function(t,n){const{render:r,className:o,style:s,forceRender:i=!1,...a}=t,{store:c}=Vt(),u=c.useState("open"),l=c.useState("nested"),d=c.useState("mounted"),p=c.useState("transitionStatus");return qe("div",t,{state:{open:u,transitionStatus:p},ref:[c.context.backdropRef,n],stateAttributesMapping:LS,props:[{role:"presentation",hidden:!d,style:{userSelect:"none",WebkitUserSelect:"none"}},a],enabled:i||!l})});process.env.NODE_ENV!=="production"&&(Za.displayName="DialogBackdrop");const Ga=f.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,style:a,...c}=t,{store:u}=Vt(),l=u.useState("open");function d(g){l&&u.setOpen(!1,Ae(C0,g.nativeEvent))}const{getButtonProps:p,buttonRef:h}=Lr({disabled:s,native:i});return qe("button",t,{state:{disabled:s},ref:[n,h],props:[{onClick:d},c,p]})});process.env.NODE_ENV!=="production"&&(Ga.displayName="DialogClose");const Ya=f.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,{store:c}=Vt(),u=qt(i);return c.useSyncedValueWithCleanup("descriptionElementId",u),qe("p",t,{ref:n,props:[{id:u},a]})});process.env.NODE_ENV!=="production"&&(Ya.displayName="DialogDescription");let FS=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),VS=(function(e){return e[e.open=Ft.open]="open",e[e.closed=Ft.closed]="closed",e[e.startingStyle=Ft.startingStyle]="startingStyle",e[e.endingStyle=Ft.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Xa=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Xa.displayName="DialogPortalContext");function qa(){const e=f.useContext(Xa);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Dialog.Portal> is missing.":ft(26));return e}const zS={...Cn,...tn,nestedDialogOpen(e){return e?{[VS.nestedDialogOpen]:""}:null}},Ka=f.forwardRef(function(t,n){const{className:r,finalFocus:o,initialFocus:s,render:i,style:a,...c}=t,{store:u}=Vt(),l=u.useState("descriptionElementId"),d=u.useState("disablePointerDismissal"),p=u.useState("floatingRootContext"),h=u.useState("popupProps"),m=u.useState("modal"),g=u.useState("mounted"),v=u.useState("nested"),y=u.useState("nestedOpenDialogCount"),C=u.useState("open"),S=u.useState("openMethod"),E=u.useState("titleElementId"),b=u.useState("transitionStatus"),x=u.useState("role");qa(),xn({open:C,ref:u.context.popupRef,onComplete(){C&&u.context.onOpenChangeComplete?.(!0)}});function T(L){return L==="touch"?u.context.popupRef.current:!0}const P=s===void 0?T:s,$=y>0,V=qe("div",t,{state:{open:C,nested:v,transitionStatus:b,nestedDialogOpen:$},props:[h,{"aria-labelledby":E??void 0,"aria-describedby":l??void 0,role:x,tabIndex:-1,hidden:!g,onKeyDown(L){Ms.has(L.key)&&L.stopPropagation()},style:{[FS.nestedDialogs]:y}},c],ref:[n,u.context.popupRef,u.useStateSetter("popupElement")],stateAttributesMapping:zS});return w.jsx(ms,{context:p,openInteractionType:S,disabled:!g,closeOnFocusOut:!d,initialFocus:P,returnFocus:o,modal:m!==!1,restoreFocus:"popup",children:V})});process.env.NODE_ENV!=="production"&&(Ka.displayName="DialogPopup");const Ls=f.forwardRef(function(t,n){const{cutout:r,...o}=t;let s;if(r){const i=r.getBoundingClientRect();s=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return w.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})});process.env.NODE_ENV!=="production"&&(Ls.displayName="InternalBackdrop");const Fs=f.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=Vt(),i=s.useState("mounted"),a=s.useState("modal"),c=s.useState("open");return i||r?w.jsx(Xa.Provider,{value:r,children:w.jsxs(hs,{ref:n,...o,children:[i&&a===!0&&w.jsx(Ls,{ref:s.context.internalBackdropRef,inert:cs(!c)}),t.children]})}):null});process.env.NODE_ENV!=="production"&&(Fs.displayName="DialogPortal");const Vs=f.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,...a}=t,{store:c}=Vt(),u=qt(i);return c.useSyncedValueWithCleanup("titleElementId",u),qe("h2",t,{ref:n,props:[{id:u},a]})});process.env.NODE_ENV!=="production"&&(Vs.displayName="DialogTitle");const zs=f.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,id:a,payload:c,handle:u,style:l,...d}=t,p=Vt(!0),h=u?.store??p?.store;if(!h)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Dialog.Trigger> must be used within <Dialog.Root> or provided with a handle.":ft(79));const m=qt(a),g=h.useState("floatingRootContext"),v=h.useState("isOpenedByTrigger",m),y=f.useRef(null),{registerTrigger:C,isMountedByThisTrigger:S}=Id(m,y,h,{payload:c}),{getButtonProps:E,buttonRef:b}=Lr({disabled:s,native:i}),x=Ia(g,{enabled:g!=null}),T=bo([x]),P={disabled:s,open:v},$=h.useState("triggerProps",S);return qe("button",t,{state:P,ref:[b,n,C,y],props:[T.getReferenceProps(),$,{[ha]:"",id:m},d,E],stateAttributesMapping:Yd})});process.env.NODE_ENV!=="production"&&(zs.displayName="DialogTrigger");let Cf=(function(e){return e[e.open=Ft.open]="open",e[e.closed=Ft.closed]="closed",e[e.startingStyle=Ft.startingStyle]="startingStyle",e[e.endingStyle=Ft.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const $S={...Cn,...tn,nested(e){return e?{[Cf.nested]:""}:null},nestedDialogOpen(e){return e?{[Cf.nestedDialogOpen]:""}:null}},Tf=f.forwardRef(function(t,n){const{className:r,render:o,children:s,style:i,...a}=t,c=qa(),{store:u}=Vt(),l=u.useState("open"),d=u.useState("nested"),p=u.useState("transitionStatus"),h=u.useState("nestedOpenDialogCount"),m=u.useState("mounted"),g=h>0;return qe("div",t,{enabled:c||m,state:{open:l,nested:d,transitionStatus:p,nestedDialogOpen:g},ref:[n,u.useStateSetter("viewportElement")],stateAttributesMapping:$S,props:[{role:"presentation",hidden:!m,style:{pointerEvents:l?void 0:"none"},children:s},a]})});process.env.NODE_ENV!=="production"&&(Tf.displayName="DialogViewport");const jS=(e,t)=>Object.is(e,t);function jr(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function HS(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:jr(t,r,n))}function xo(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:jr(r,t,n))}function US(e,t,n){return e.filter(r=>!jr(t,r,n))}function Ja(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function BS(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function WS(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(BS(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function ZS(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Ja(e)}function Hr(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Ja(e.value):Ja(e)}let Of=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const $s={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Co={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},GS={disabled:!1,...Co},hr={valid(e){return e===null?null:e?{[Of.valid]:""}:{[Of.invalid]:""}}},Qa=f.createContext({invalid:void 0,name:void 0,validityData:{state:$s,errors:[],error:"",value:"",initialValue:null},setValidityData:Ct,disabled:void 0,touched:Co.touched,setTouched:Ct,dirty:Co.dirty,setDirty:Ct,filled:Co.filled,setFilled:Ct,focused:Co.focused,setFocused:Ct,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:GS,markedDirtyRef:{current:!1},registerFieldControl:Ct,validation:{getValidationProps:(e=mt)=>e,getInputValidationProps:(e=mt)=>e,inputRef:{current:null},commit:async()=>{}}});process.env.NODE_ENV!=="production"&&(Qa.displayName="FieldRootContext");function mr(e=!0){const t=f.useContext(Qa);if(t.setValidityData===Ct&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.":ft(28));return t}function ec(e,t){const{enabled:n=!0,getValue:r,id:o,value:s}=t,{registerFieldControl:i}=mr(),a=f.useRef(null);a.current||(a.current=Symbol()),he(()=>{const c=a.current;if(!(!c||!n))return i(c,{controlRef:e,getValue:r,id:o,value:s}),()=>{i(c,void 0)}},[e,n,r,o,i,s])}const tc=f.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Ct,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});process.env.NODE_ENV!=="production"&&(tc.displayName="FormContext");function Ur(){return f.useContext(tc)}const nc=f.createContext({controlId:void 0,registerControlId:Ct,labelId:void 0,setLabelId:Ct,messageIds:[],setMessageIds:Ct,getDescriptionProps:e=>e});process.env.NODE_ENV!=="production"&&(nc.displayName="LabelableContext");function Ln(){return f.useContext(nc)}function rc(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:o,registerControlId:s}=Ln(),i=qt(t),a=n?o:void 0,c=wt(()=>Symbol("labelable-control")),u=f.useRef(!1),l=f.useRef(t!=null),d=ie(()=>{!u.current||s===Ct||(u.current=!1,s(c.current,void 0))});return he(()=>{if(s===Ct)return;let p;if(n){const h=r?.current;$e(h)&&h.closest("label")!=null?p=t??null:p=a??i}else if(t!=null)l.current=!0,p=t;else if(l.current)p=i;else{d();return}if(p===void 0){d();return}u.current=!0,s(c.current,p)},[t,r,a,s,n,i,c,d]),f.useEffect(()=>d,[d]),o??i}function YS(e){const t=e.getBoundingClientRect();if(process.env.NODE_ENV!=="production")return t;const n=tt(e),r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||o.content!=="none"))return t;const i=parseFloat(r.width)||0,a=parseFloat(r.height)||0,c=parseFloat(o.width)||0,u=parseFloat(o.height)||0,l=Math.max(t.width,i,c),d=Math.max(t.height,a,u),p=l-t.width,h=d-t.height;return{left:t.left-p/2,right:t.right+p/2,top:t.top-h/2,bottom:t.bottom+h/2}}function XS(e,t){return e??t}const qS=20;function Pf(e,t,n,r){const[o,s]=f.useState(!1);he(()=>{if(!e||!t||n==null){s(!1);return}const i=Ie(n).documentElement.clientWidth,a=n.offsetWidth;s(i>0&&a>0&&a>=i-qS)},[e,t,n]),xf(e&&(!t||o),r)}let _f=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.indeterminate="data-indeterminate",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});function If(e){return f.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[_f.checked]:""}:{[_f.unchecked]:""}},...hr}),[e.indeterminate])}const kf=f.createContext({disabled:!1});process.env.NODE_ENV!=="production"&&(kf.displayName="FieldItemContext");function KS(){return f.useContext(kf)}function JS(e,t,n,r=!0,o){const[s,i]=f.useState(),a=qt(o?`${o}-label`:void 0),c=e??t??s;return he(()=>{const u=e||t||!r?void 0:QS(n.current,a);s!==u&&i(u)}),c}function QS(e,t){const n=eE(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function eE(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const n=e.id;if(n){const o=e.nextElementSibling;if(o&&o.htmlFor===n)return o}const r=e.labels;return r&&r[0]}const Rf=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Rf.displayName="CheckboxGroupContext");function tE(e=!0){const t=f.useContext(Rf);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CheckboxGroupContext is missing. CheckboxGroup parts must be placed within <CheckboxGroup>.":ft(3));return t}const oc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(oc.displayName="CheckboxRootContext");function nE(){const e=f.useContext(oc);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CheckboxRootContext is missing. Checkbox parts must be placed within <Checkbox.Root>.":ft(14));return e}const rE="data-parent",sc=f.forwardRef(function(t,n){const{checked:r,className:o,defaultChecked:s=!1,"aria-labelledby":i,disabled:a=!1,form:c,id:u,indeterminate:l=!1,inputRef:d,name:p,onCheckedChange:h,parent:m=!1,readOnly:g=!1,render:v,required:y=!1,uncheckedValue:C,value:S,nativeButton:E=!1,style:b,...x}=t,{clearErrors:T}=Ur(),{disabled:P,name:$,setDirty:M,setFilled:V,setFocused:L,setTouched:D,state:R,validationMode:O,validityData:I,shouldValidateOnChange:_,validation:N}=mr(),A=KS(),{labelId:j,controlId:B,registerControlId:U,getDescriptionProps:W}=Ln(),G=tE(),Z=G?.parent,X=Z&&G.allValues,K=P||A.disabled||G?.disabled||a,J=$??p,se=S??J,ae=qt(),pe=qt();let Y=B;X?Y=m?pe:`${Z.id}-${se}`:u&&(Y=u);let me={};X&&(m?me=G.parent.getParentProps():se&&(me=G.parent.getChildProps(se)));const ge=ie(h),{checked:fe=r,indeterminate:le=l,onCheckedChange:ce,...ve}=me,ue=G?.value,Se=G?.setValue,k=G?.defaultValue,H=f.useRef(null),F=wt(()=>Symbol("checkbox-control")),z=f.useRef(!1),{getButtonProps:Q,buttonRef:ne}=Lr({disabled:K,native:E}),te=G?.validation??N,[ye,_e]=Eo({controlled:se&&ue&&!m?ue.includes(se):fe,default:se&&k&&!m?k.includes(se):s,name:"Checkbox",state:"checked"});he(()=>{U!==Ct&&(z.current=!0,U(F.current,Y))},[Y,G,U,m,F]),f.useEffect(()=>{const Te=F.current;return()=>{!z.current||U===Ct||(z.current=!1,U(Te,void 0))}},[U,F]),ec(H,{enabled:!G,id:ae,value:ye});const Ee=f.useRef(null),Ce=or(d,Ee,te.inputRef),Pe=JS(i,j,Ee,!E,Y??void 0);he(()=>{Ee.current&&(Ee.current.indeterminate=le,ye&&V(!0))},[ye,le,V]),As(ye,()=>{G&&!m||(T(J),V(ye),M(ye!==I.initialValue),_()?te.commit(ye):te.commit(ye,!0))});const Ve=En({checked:ye,disabled:K,form:c,name:m?void 0:J,id:E?void 0:Y??void 0,required:y,ref:Ce,style:J?Al:ss,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(Te){if(Te.nativeEvent.defaultPrevented)return;if(g){Te.preventDefault();return}const Ue=Te.currentTarget.checked,Be=Ae(cr,Te.nativeEvent);if(ce?.(Ue,Be),ge(Ue,Be),!Be.isCanceled&&(_e(Ue),se&&ue&&Se&&!m&&!X)){const ct=Ue?[...ue,se]:ue.filter(Ye=>Ye!==se);Se(ct,Be)}},onFocus(){H.current?.focus()}},S!==void 0?{value:(G?ye&&S:S)||""}:mt,W,G?te.getValidationProps:te.getInputValidationProps),Ge=X?!!fe:ye,He=X&&le||l;f.useEffect(()=>{if(!Z||!se)return;const Te=Z.disabledStatesRef.current;return Te.set(se,K),()=>{Te.delete(se)}},[Z,K,se]);const nt=f.useMemo(()=>({...R,checked:Ge,disabled:K,readOnly:g,required:y,indeterminate:He}),[R,Ge,K,g,y,He]),st=If(nt),Re=qe("span",t,{state:nt,ref:[ne,H,n,G?.registerControlRef],props:[{id:E?Y??void 0:ae,role:"checkbox","aria-checked":le?"mixed":ye,"aria-readonly":g||void 0,"aria-required":y||void 0,"aria-labelledby":Pe,[rE]:m?"":void 0,onFocus(){L(!0)},onBlur(){const Te=Ee.current;Te&&(D(!0),L(!1),O==="onBlur"&&te.commit(G?ue:Te.checked))},onClick(Te){g||K||(Te.preventDefault(),Ee.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:Te.shiftKey,ctrlKey:Te.ctrlKey,altKey:Te.altKey,metaKey:Te.metaKey})))}},W,te.getValidationProps,x,ve,Q],stateAttributesMapping:st});return w.jsxs(oc.Provider,{value:nt,children:[Re,!ye&&!G&&J&&!m&&C!==void 0&&w.jsx("input",{type:"hidden",form:c,name:J,value:C}),w.jsx("input",{...Ve,suppressHydrationWarning:!0})]})});process.env.NODE_ENV!=="production"&&(sc.displayName="CheckboxRoot");const ic=f.forwardRef(function(t,n){const{render:r,className:o,style:s,keepMounted:i=!1,...a}=t,c=nE(),u=c.checked||c.indeterminate,{mounted:l,transitionStatus:d,setMounted:p}=vo(u),h=f.useRef(null),m={...c,transitionStatus:d};xn({open:u,ref:h,onComplete(){u||p(!1)}});const g=If(c),v=f.useMemo(()=>({...g,...tn,...hr}),[g]),y=i||l,C=qe("span",t,{ref:[n,h],state:m,stateAttributesMapping:v,props:a});return y?C:null});process.env.NODE_ENV!=="production"&&(ic.displayName="CheckboxIndicator");function oE(e,t){const n=qt(e);return he(()=>(t(n),()=>{t(void 0)}),[n,t]),n}function sE(e={}){const{id:t,fallbackControlId:n,native:r=!1,setLabelId:o,focusControl:s}=e,{controlId:i,setLabelId:a}=Ln(),c=ie(h=>{a(h),o?.(h)}),u=oE(t,c),l=i??n;function d(h){if(s){s(h,l);return}if(!l)return;const m=Ie(h.currentTarget).getElementById(l);it(m)&&iE(m)}function p(h){lt(h.nativeEvent)?.closest("button,input,select,textarea")||(!h.defaultPrevented&&h.detail>1&&h.preventDefault(),!r&&d(h))}return r?{id:u,htmlFor:l??void 0,onMouseDown:p}:{id:u,onClick:p,onPointerDown(h){h.preventDefault()}}}function iE(e){e.focus({focusVisible:!0})}const Nf=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Nf.displayName="ToolbarRootContext");function Mf(e){return f.useContext(Nf)}function aE(e,t){const n=f.useRef(null),r=ie(s=>{Kt.flushSync(()=>{e.setOpen(!1,Ae(ur,s.nativeEvent,s.currentTarget))}),Ab(n.current)?.focus()}),o=ie(s=>{const i=e.select("positionerElement");if(i&&Ar(s,i))e.context.beforeContentFocusGuardRef.current?.focus();else{Kt.flushSync(()=>{e.setOpen(!1,Ae(ur,s.nativeEvent,s.currentTarget))});let a=Mb(e.context.triggerFocusTargetRef.current||t.current);for(;a!==null&&we(i,a);){const c=a;if(a=ca(a),a===c)break}a?.focus()}});return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:o}}function cE(e){const[t,n]=f.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}const Af=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Af.displayName="CSPContext");const uE={disableStyleElements:!1};function lE(){return f.useContext(Af)??uE}let Tt=(function(e){return e.nestedDrawers="--nested-drawers",e.height="--drawer-height",e.frontmostHeight="--drawer-frontmost-height",e.swipeMovementX="--drawer-swipe-movement-x",e.swipeMovementY="--drawer-swipe-movement-y",e.snapPointOffset="--drawer-snap-point-offset",e.swipeStrength="--drawer-swipe-strength",e})({}),Fn=(function(e){return e.swipeProgress="--drawer-swipe-progress",e})({});const dE={...Cn,...tn},Df=f.forwardRef(function(t,n){const{render:r,className:o,style:s,forceRender:i=!1,...a}=t,{store:c}=Vt(),u=c.useState("open"),l=c.useState("nested"),d=c.useState("mounted"),p=c.useState("transitionStatus");return qe("div",t,{state:{open:u,transitionStatus:p},ref:[c.context.backdropRef,n],stateAttributesMapping:dE,props:[{role:"presentation",hidden:!d,style:{pointerEvents:u?void 0:"none",userSelect:"none",WebkitUserSelect:"none",[Fn.swipeProgress]:"0",[Tt.swipeStrength]:"1"}},a],enabled:i||!l})});process.env.NODE_ENV!=="production"&&(Df.displayName="DrawerBackdrop");const Lf="data-drawer-content",Ff=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t;return Vt(),qe("div",t,{ref:n,props:[{[Lf]:""},i]})});process.env.NODE_ENV!=="production"&&(Ff.displayName="DrawerContent");const Vf=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Vf.displayName="DrawerProviderContext");function zf(e){return f.useContext(Vf)}let ln=(function(e){return e[e.open=Ft.open]="open",e[e.closed=Ft.closed]="closed",e[e.startingStyle=Ft.startingStyle]="startingStyle",e[e.endingStyle=Ft.endingStyle]="endingStyle",e.expanded="data-expanded",e.nestedDrawerOpen="data-nested-drawer-open",e.nestedDrawerSwiping="data-nested-drawer-swiping",e.swipeDismiss="data-swipe-dismiss",e.swipeDirection="data-swipe-direction",e.swiping="data-swiping",e})({});const ac=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(ac.displayName="DrawerRootContext");function js(e){const t=f.useContext(ac);if(e===!1&&t===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: DrawerRootContext is missing. Drawer parts must be placed within <Drawer.Root>.":ft(90));return t}function bt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function $f(e,t,n){if(!Number.isFinite(t)||t<=0)return null;if(typeof e=="number")return Number.isFinite(e)?e<=1?bt(e,0,1)*t:e:null;const r=e.trim();if(r.endsWith("px")){const o=Number.parseFloat(r);return Number.isFinite(o)?o:null}if(r.endsWith("rem")){const o=Number.parseFloat(r);return Number.isFinite(o)?o*n:null}return null}function fE(e,t){let n=null,r=1/0;for(const o of t){const s=Math.abs(o.height-e);s<r&&(r=s,n=o)}return n}function jf(){const{store:e}=Vt(),{snapPoints:t,activeSnapPoint:n,setActiveSnapPoint:r,popupHeight:o}=js(),s=e.useState("viewportElement"),[i,a]=f.useState(0),[c,u]=f.useState(16),l=ie(()=>{const m=Ie(s).documentElement;s&&a(s.offsetHeight),s||a(m.clientHeight);const g=parseFloat(getComputedStyle(m).fontSize);Number.isFinite(g)&&u(g)});he(()=>{if(l(),!s||typeof ResizeObserver!="function")return;const h=new ResizeObserver(l);return h.observe(s),()=>{h.disconnect()}},[l,s]);const d=f.useMemo(()=>{if(!t||t.length===0||i<=0||o<=0)return[];const h=Math.min(o,i);if(!Number.isFinite(h)||h<=0)return[];const m=t.map(y=>{const C=$f(y,i,c);if(C===null||!Number.isFinite(C))return null;const S=bt(C,0,h);return{value:y,height:S,offset:Math.max(0,o-S)}}).filter(y=>!!y);if(m.length<=1)return m;const g=[],v=[];for(let y=m.length-1;y>=0;y-=1){const C=m[y];v.some(E=>Math.abs(E-C.height)<=1)||(v.push(C.height),g.push(C))}return g.reverse(),g},[o,c,t,i]),p=f.useMemo(()=>{if(n===void 0)return d[0];if(n===null)return;const h=d.find(y=>Object.is(y.value,n));if(h)return h;const m=Math.min(o,i),g=$f(n,i,c);if(g===null||!Number.isFinite(g))return;const v=bt(g,0,m);return fE(v,d)??void 0},[n,o,d,c,i]);return{snapPoints:t,activeSnapPoint:n,setActiveSnapPoint:r,popupHeight:o,viewportHeight:i,resolvedSnapPoints:d,activeSnapPointOffset:p?.offset??null}}const cc=f.createContext(null);process.env.NODE_ENV!=="production"&&(cc.displayName="DrawerViewportContext");function pE(e){return f.useContext(cc)}let Hf=!1;function hE(){Hf||(typeof CSS<"u"&&"registerProperty"in CSS&&([Tt.swipeMovementX,Tt.swipeMovementY,Tt.snapPointOffset].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),[{name:Fn.swipeProgress,initialValue:"0"},{name:Tt.swipeStrength,initialValue:"1"}].forEach(({name:e,initialValue:t})=>{try{CSS.registerProperty({name:e,syntax:"<number>",inherits:!1,initialValue:t})}catch{}})),Hf=!0)}const mE={...Cn,...tn,expanded(e){return e?{[ln.expanded]:""}:null},nestedDrawerOpen(e){return e?{[ln.nestedDrawerOpen]:""}:null},nestedDrawerSwiping(e){return e?{[ln.nestedDrawerSwiping]:""}:null},swipeDirection(e){return e?{[ln.swipeDirection]:e}:null},swiping(e){return e?{[ln.swiping]:""}:null}},Uf=f.forwardRef(function(t,n){const{className:r,finalFocus:o,initialFocus:s,render:i,style:a,...c}=t,{store:u}=Vt(),{swipeDirection:l,frontmostHeight:d,hasNestedDrawer:p,nestedSwiping:h,nestedSwipeProgressStore:m,onPopupHeightChange:g,notifyParentFrontmostHeight:v,notifyParentHasNestedDrawer:y}=js(),C=u.useState("descriptionElementId"),S=u.useState("disablePointerDismissal"),E=u.useState("floatingRootContext"),b=u.useState("popupProps"),x=u.useState("modal"),T=u.useState("mounted"),P=u.useState("nested"),$=u.useState("nestedOpenDrawerCount"),M=u.useState("transitionStatus"),V=u.useState("open"),L=u.useState("openMethod"),D=u.useState("titleElementId"),R=u.useState("role"),O=$>0,I=pE(),_=I?.swiping??!1,N=I?.swipeStrength??null,{snapPoints:A,activeSnapPoint:j,activeSnapPointOffset:B}=jf();qa();const[U,W]=f.useState(0),G=f.useRef(0);process.env.NODE_ENV!=="production"&&f.useEffect(()=>{if(I)return;const ge=Dr.captureOwnerStack?.()||"";ar(`<Drawer.Popup> expected to be rendered within <Drawer.Viewport>. Omitting the viewport disables drawer swipe handling and touch scroll locking. Wrap <Drawer.Popup> in <Drawer.Viewport>.${ge}`)},[I]);const Z=ie(()=>{const ge=u.context.popupRef.current;if(!ge)return;const fe=ge.offsetHeight;if(G.current>0&&d>G.current&&fe>G.current)return;if(G.current>0&&p){const ve=G.current;W(ve),g(ve);return}const ce=fe;ce!==G.current&&(G.current=ce,W(ce),g(ce))});he(()=>{if(!T){G.current=0,W(0),g(0);return}const ge=u.context.popupRef.current;if(!ge||(hE(),Z(),typeof ResizeObserver!="function"))return;const fe=new ResizeObserver(Z);return fe.observe(ge),()=>{fe.disconnect()}},[Z,T,O,g,u.context.popupRef]),he(()=>{const ge=u.context.popupRef,fe=()=>{const ce=ge.current;if(!ce)return;const ve=m.getSnapshot();ve>0?ce.style.setProperty(Fn.swipeProgress,`${ve}`):ce.style.setProperty(Fn.swipeProgress,"0")};fe();const le=m.subscribe(fe);return()=>{le();const ce=ge.current;ce&&ce.style.setProperty(Fn.swipeProgress,"0")}},[m,u.context.popupRef]),f.useEffect(()=>{if(V)return v?.(d),()=>{v?.(0)}},[d,V,v]),f.useEffect(()=>y?(y(V||M==="ending"),()=>{y(!1)}):void 0,[y,V,M]),xn({open:V,ref:u.context.popupRef,onComplete(){V&&u.context.onOpenChangeComplete?.(!0)}});const X=s===void 0?u.context.popupRef:s,K={open:V,nested:P,transitionStatus:M,expanded:j===1,nestedDrawerOpen:O,nestedDrawerSwiping:h,swipeDirection:l,swiping:_};let J;U&&!(!p&&M!=="ending")&&(J=`${U}px`);const ae=A&&A.length>0&&(l==="down"||l==="up");let pe=null;ae&&B!==null&&(pe=l==="up"?-B:B);let Y=I?I.getDragStyles():mt;if(ae&&l==="down"){const ge=B??0,fe=Number.parseFloat(String(Y[Tt.swipeMovementY]??0)),le=Number.isFinite(fe)?ge+fe:ge,ce=le<0;if(_&&ce&&Number.isFinite(fe)){const ve=Math.abs(le),Se=-Math.sqrt(ve)-ge;Y={...Y,transform:void 0,[Tt.swipeMovementY]:`${Se}px`}}else Y={...Y,transform:void 0}}const me=qe("div",t,{state:K,props:[b,{"aria-labelledby":D,"aria-describedby":C,role:R,tabIndex:-1,hidden:!T,onKeyDown(ge){Ms.has(ge.key)&&ge.stopPropagation()},style:{...Y,[Fn.swipeProgress]:"0",[Tt.nestedDrawers]:$,[Tt.height]:J,[Tt.snapPointOffset]:typeof pe=="number"?`${pe}px`:"0px",[Tt.frontmostHeight]:d?`${d}px`:void 0,[Tt.swipeStrength]:typeof N=="number"&&Number.isFinite(N)&&N>0?`${N}`:"1"}},c],ref:[n,u.context.popupRef,u.useStateSetter("popupElement")],stateAttributesMapping:mE});return w.jsx(ms,{context:E,openInteractionType:L,disabled:!T,closeOnFocusOut:!S,initialFocus:X,returnFocus:o,modal:x!==!1,restoreFocus:"popup",children:me})});process.env.NODE_ENV!=="production"&&(Uf.displayName="DrawerPopup");const gE=Fs;var Bf,Wf;function yE(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:s,disablePointerDismissal:i=!1,modal:a=!0,actionsRef:c,handle:u,triggerId:l,defaultTriggerId:d=null,swipeDirection:p="down",snapToSequentialPoints:h=!1,snapPoints:m,snapPoint:g,defaultSnapPoint:v,onSnapPointChange:y}=e,C=ie(y),S=js(!0),E=S?.onNestedSwipeProgressChange,b=S?.onNestedFrontmostHeightChange,x=S?.onNestedSwipingChange,T=S?.onNestedDrawerPresenceChange,[P,$]=f.useState(0),[M,V]=f.useState(0),[L,D]=f.useState(!1),[R,O]=f.useState(!1),[I]=f.useState(vE),_=v!==void 0?v:m?.[0]??null,N=g!==void 0,[A,j]=Eo({controlled:g,default:_,name:"Drawer",state:"snapPoint"}),B=f.useRef(!1),U=ie((Y,me)=>{const ge=me??Ae(cr);C?.(Y,ge),!ge.isCanceled&&j(Y)}),W=f.useMemo(()=>N||!m||m.length===0?A:A===null||!m.some(Y=>Object.is(Y,A))?_:A,[A,N,_,m]),G=ie(Y=>{$(Y),!B.current&&Y>0&&V(Y)}),Z=ie(Y=>{if(Y>0){B.current=!0,V(Y);return}B.current=!1,P>0&&V(P)}),X=ie(Y=>{D(Y)}),K=ie(Y=>{I.set(Y),E?.(Y)}),J=ie(Y=>{O(Y),x?.(Y)}),se=ie((Y,me)=>{o?.(Y,me),!me.isCanceled&&!Y&&m&&m.length>0&&U(_,Ae(me.reason,me.event,me.trigger))}),ae=f.useMemo(()=>({swipeDirection:p,snapToSequentialPoints:h,snapPoints:m,activeSnapPoint:W,setActiveSnapPoint:U,frontmostHeight:M,popupHeight:P,hasNestedDrawer:L,nestedSwiping:R,nestedSwipeProgressStore:I,onNestedDrawerPresenceChange:X,onPopupHeightChange:G,onNestedFrontmostHeightChange:Z,onNestedSwipingChange:J,onNestedSwipeProgressChange:K,notifyParentFrontmostHeight:b,notifyParentSwipingChange:x,notifyParentSwipeProgressChange:E,notifyParentHasNestedDrawer:T}),[W,M,L,R,I,T,E,x,b,X,Z,K,J,G,P,U,m,h,p]),pe=typeof t=="function"?Y=>w.jsxs(f.Fragment,{children:[Bf||(Bf=w.jsx(Zf,{})),t(Y)]}):w.jsxs(f.Fragment,{children:[Wf||(Wf=w.jsx(Zf,{})),t]});return w.jsx(ac.Provider,{value:ae,children:w.jsx(Ds.Provider,{value:!0,children:w.jsx(Wa,{open:n,defaultOpen:r,onOpenChange:se,onOpenChangeComplete:s,disablePointerDismissal:i,modal:a,actionsRef:c,handle:u,triggerId:l,defaultTriggerId:d,children:pe})})})}function vE(){let e=0;const t=new Set;return{getSnapshot:()=>e,set(n){const r=Number.isFinite(n)?n:0;r!==e&&(e=r,t.forEach(o=>{o()}))},subscribe(n){return t.add(n),()=>{t.delete(n)}}}}function Zf(){const e=Xn(),t=zf(),n=Vt(!1),r=n.store.useState("open"),o=n.store.useState("nestedOpenDialogCount"),s=n.store.useState("popupElement"),i=o===0;return f.useEffect(()=>{if(!(!t||e==null))return()=>{t.removeDrawer(e)}},[e,t]),f.useEffect(()=>{e!=null&&t?.setDrawerOpen(e,r)},[e,r,t]),f.useEffect(()=>{if(!r||!i||!Jo)return;const c=tt(s).CloseWatcher;if(!c)return;function u(p){n.store.select("open")&&n.store.setOpen(!1,Ae(T0,p))}const l=new c,d=Fe(l,"close",u);return()=>{d(),l.destroy()}},[n.store,i,r,s]),null}function uc(e,t){const n=At(e);if(t==="vertical"){const o=n.overflowY;return(o==="auto"||o==="scroll")&&e.scrollHeight>e.clientHeight}const r=n.overflowX;return(r==="auto"||r==="scroll")&&e.scrollWidth>e.clientWidth}function bE(e,t,n){let r=e;for(;r&&r!==t;){for(const o of n)if(uc(r,o))return!0;r=r.parentElement}return!1}function Br(e,t,n="vertical"){let r=it(e)?e:null;for(;r&&r!==t;){if(uc(r,n))return r;r=r.parentElement}return uc(t,n)?t:null}function Hs(e,t,n){return typeof e?.elementFromPoint=="function"?e.elementFromPoint(t,n):null}const wE=40,SE=10,EE=1,xE=50,Gf=16,CE=80,TE='button,a,input,select,textarea,label,[role="button"]';function lc(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}function OE(e){const n=tt(e).getComputedStyle(e).transform;let r=0,o=0,s=1;if(n&&n!=="none"){const i=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(i){const a=i[1].split(", ").map(parseFloat);a.length===6?(r=a[4],o=a[5],s=Math.sqrt(a[0]*a[0]+a[1]*a[1])):a.length===16&&(r=a[12],o=a[13],s=a[0])}}return{x:r,y:o,scale:s}}function Us(e){return Number.isFinite(e)&&e>0?e:null}function PE(e){return e%2===1}function dc(e,t,n){const r=e[n];if(typeof r=="function")try{r.call(e,t)}catch(o){if(o&&typeof o=="object"&&"name"in o&&o.name==="NotFoundError")return;throw o}}function _E(e){const{enabled:t,directions:n,elementRef:r,movementCssVars:o,canStart:s,ignoreSelectorWhenTouch:i=!0,ignoreScrollableAncestors:a=!1,swipeThreshold:c,onDismiss:u,onProgress:l,onCancel:d,onSwipeStart:p,onRelease:h,onSwipingChange:m,trackDrag:g=!0}=e,v=TE,y=n.length===1?n[0]:void 0,C=Math.max(0,typeof c=="number"?c:wE),S=n.includes("left"),E=n.includes("right"),b=n.includes("up"),x=n.includes("down"),T=S||E,P=b||x,$=f.useMemo(()=>{const q=[];return P&&q.push("vertical"),T&&q.push("horizontal"),q},[T,P]),[M,V]=f.useState(void 0),[L,D]=f.useState(!1),[R,O]=f.useState(!1),[I,_]=f.useState(!1),[N,A]=f.useState({x:0,y:0}),[j,B]=f.useState({x:0,y:0,scale:1}),[U,W]=f.useState(null),G=f.useRef({x:0,y:0}),Z=f.useRef({x:0,y:0}),X=f.useRef(null),K=f.useRef({x:0,y:0,scale:1}),J=f.useRef(void 0),se=f.useRef(0),ae=f.useRef(!1),pe=f.useRef({x:0,y:0}),Y=f.useRef(!1),me=f.useRef(!1),ge=f.useRef(null),fe=f.useRef(!1),le=f.useRef(!1),ce=f.useRef({width:0,height:0}),ve=f.useRef(0),ue=f.useRef(C),Se=f.useRef(null),k=f.useRef(null),H=f.useRef({x:0,y:0}),F=f.useRef(null),z=f.useRef(!1),Q=ie(q=>{z.current!==q&&(z.current=q,D(q),m?.(q))});function ne(q){if(!q)return;if(typeof c!="function"){ue.current=C;return}const re=r.current;if(!re)return;const be=c({element:re,direction:q});ue.current=Math.max(0,be)}const te=ie((q,re)=>{const be=Number.isFinite(q)?bt(q,0,1):0,Le=be!==ve.current;let je=!1;if(re){const De=F.current;je=!De||De.deltaX!==re.deltaX||De.deltaY!==re.deltaY||De.direction!==re.direction}!Le&&!je||(ve.current=be,re?F.current=re:Le&&(F.current=null),l?.(be,re))});function ye(q,re){if(re===null)return;const be=k.current;if(be&&re>be.time){const Le=Math.max(re-be.time,Gf);H.current={x:(q.x-be.x)/Le,y:(q.y-be.y)/Le}}k.current={x:q.x,y:q.y,time:re}}const _e=f.useCallback(()=>{V(void 0),Q(!1),O(!1),_(!1),A({x:0,y:0}),B({x:0,y:0,scale:1}),W(null),te(0),ue.current=C,G.current={x:0,y:0},Z.current={x:0,y:0},K.current={x:0,y:0,scale:1},J.current=void 0,se.current=0,ae.current=!1,pe.current={x:0,y:0},Y.current=!1,X.current=null,me.current=!1,ge.current=null,fe.current=!1,le.current=!1,ce.current={width:0,height:0},Se.current=null,k.current=null,H.current={x:0,y:0},F.current=null},[Q,C,te]);f.useEffect(()=>{typeof c!="function"&&(ue.current=C)},[C,c]);function Ee(q){if("touches"in q){const re=q.touches[0];return re?{x:re.clientX,y:re.clientY}:null}return{x:q.clientX,y:q.clientY}}function Ce(q){return"touches"in q?!0:q.pointerType==="touch"}function Pe(q,re){const be=Ie(r.current);return Hs(be,q.x,q.y)??lt(re)}function Ve(q,re){return T&&!P?Br(q,re,"horizontal"):P&&!T?Br(q,re,"vertical"):Br(q,re,"vertical")??Br(q,re,"horizontal")}function Ge(q,re,be){fe.current=!1;const Le=Ce(q),je=Pe(re,q.nativeEvent),Qe=Ie(r.current).body,Oe=Le&&Qe?Ve(je,Qe):null,xe=be?.ignoreScrollableTarget??!1;if(Oe&&!xe||(fe.current=!!(Oe&&xe),(je?je.closest(v):!1)&&(!Le||i)))return!1;const Me=r.current;if(a&&Me&&je&&$.length>0&&!(be?.ignoreScrollableAncestors??!1)&&bE(je,Me,$))return!1;if(ae.current=!1,J.current=void 0,se.current=0,G.current=re,Se.current=Us(q.timeStamp),pe.current=re,X.current=re,Me){ce.current={width:Me.offsetWidth,height:Me.offsetHeight},ne(y);const Xe=OE(Me);K.current=Xe,Z.current={x:Xe.x,y:Xe.y},B(Xe),A({x:Xe.x,y:Xe.y}),ye({x:Xe.x,y:Xe.y},Se.current),"touches"in q||dc(Me,q.pointerId,"setPointerCapture")}return p?.(q.nativeEvent),Q(!0),O(!1),W(null),Y.current=!0,te(0),!0}function He(){nt(),fe.current=!1,X.current=null}function nt(){me.current=!1,ge.current=null}function st(q){if(He(),!z.current)return;Q(!1),O(!1),W(null);const re=g?j:K.current;Z.current={x:re.x,y:re.y},A({x:re.x,y:re.y}),V(void 0),le.current=!1;const be=r.current;be&&dc(be,q.pointerId,"releasePointerCapture"),te(0,{deltaX:0,deltaY:0,direction:void 0}),d?.(q.nativeEvent)}function Re(q,re){const be=Qe=>Qe>=0?Qe**.5:-(Math.abs(Qe)**.5),Le=(Qe,Oe,xe)=>!Oe&&Qe<0||!xe&&Qe>0?be(Qe):Qe,je=T?Le(q,S,E):be(q),De=P?Le(re,b,x):be(re);return{x:je,y:De}}function Te(q,re,be){const Le=Math.abs(re),je=Math.abs(be);if(P&&be!==0&&(!T||je>=Le)){const Oe=Math.max(0,q.scrollHeight-q.clientHeight),xe=q.scrollTop<=0,Ne=q.scrollTop>=Oe,Me=be>0,Xe=be<0;return Me&&xe&&x||Xe&&Ne&&b}if(T&&re!==0&&(!P||Le>je)){const Oe=Math.max(0,q.scrollWidth-q.clientWidth),xe=q.scrollLeft<=0,Ne=q.scrollLeft>=Oe,Me=re>0,Xe=re<0;return Me&&xe&&E||Xe&&Ne&&S}return null}const Ue=ie(q=>{if(!t||q.defaultPrevented||q.nativeEvent.defaultPrevented||!("touches"in q)&&q.button!==0)return;const re=Ee(q);!re||(me.current=!0,ge.current=re,fe.current=!1,le.current=!1,!(s?s(re,{nativeEvent:q.nativeEvent,direction:y}):!0))||Ge(q,re)&&nt()});function Be(q,re,be){if(!t||!z.current)return;const Le=lt(q.nativeEvent);if(Ce(q)&&!fe.current){const on=q.currentTarget;if(Ve(Le,on))return}if("touches"in q||q.preventDefault(),Y.current){G.current=re;const on=Us(q.timeStamp);on!==null&&(Se.current=on),Y.current=!1}const je=re.x,De=re.y,Qe=be.x,Oe=be.y;(Oe<0&&De>pe.current.y||Oe>0&&De<pe.current.y)&&(pe.current={x:pe.current.x,y:De}),(Qe<0&&je>pe.current.x||Qe>0&&je<pe.current.x)&&(pe.current={x:je,y:pe.current.y});const xe=je-G.current.x,Ne=De-G.current.y,Me=De-pe.current.y,Xe=je-pe.current.x;if(!R&&Math.sqrt(xe*xe+Ne*Ne)>=EE&&(O(!0),U===null&&T&&P)){const qr=Math.abs(xe),Hc=Math.abs(Ne);W(qr>Hc?"horizontal":"vertical")}let Je;if(!J.current)U==="vertical"?Ne>0?Je="down":Ne<0&&(Je="up"):U==="horizontal"?xe>0?Je="right":xe<0&&(Je="left"):Math.abs(xe)>=Math.abs(Ne)?Je=xe>0?"right":"left":Je=Ne>0?"down":"up",Je&&(Je==="left"&&S||Je==="right"&&E||Je==="up"&&b||Je==="down"&&x)&&(J.current=Je,se.current=lc(Je,xe,Ne),V(Je),ne(Je));else{const on=J.current,qr=lc(on,Xe,Me);qr>ue.current?(ae.current=!1,V(on)):!(S&&E)&&!(b&&x)&&se.current-qr>=SE&&(ae.current=!0)}const dn=Re(xe,Ne);let rn=K.current.x,Bt=K.current.y;U==="horizontal"?T&&(rn+=dn.x):(U==="vertical"||T&&(rn+=dn.x),P&&(Bt+=dn.y)),Z.current={x:rn,y:Bt},g&&A({x:rn,y:Bt}),ye({x:rn,y:Bt},Us(q.timeStamp));const er=rn-K.current.x,Pn=Bt-K.current.y,Er=J.current,xr=y??J.current;if(!xr){te(0,{deltaX:er,deltaY:Pn,direction:Er});return}const _n=xr==="left"||xr==="right"?ce.current.width:ce.current.height,fn=K.current.scale||1;if(_n<=0||fn<=0){te(0,{deltaX:er,deltaY:Pn,direction:Er});return}const Cr=lc(xr,rn-K.current.x,Bt-K.current.y);if(Cr<=0){te(0,{deltaX:er,deltaY:Pn,direction:Er});return}te(Cr/(_n*fn),{deltaX:er,deltaY:Pn,direction:Er})}const ct=ie(q=>{const re=Ee(q);if(!re)return;if(!("touches"in q)){const je=PE(q.buttons);je&&(le.current=!0);const De=q.buttons===0&&le.current;if(q.buttons!==0&&!je||De){st(q);return}}if(!L&&me.current){if(!Ce(q)&&(q.defaultPrevented||q.nativeEvent.defaultPrevented)){He();return}if(s?s(re,{nativeEvent:q.nativeEvent,direction:y}):!0){const De=ge.current;let Qe=!1;if(Ce(q)){const xe=r.current;if(De&&xe){const Ne=Pe(re,q.nativeEvent),Xe=Ie(xe).body,Je=Xe?Ve(Ne,Xe):null;if(Je&&(we(xe,Je)||we(Je,xe))){const dn=re.x-De.x,rn=re.y-De.y,Bt=Te(Je,dn,rn);if(Bt===!1)return;Bt===!0&&(Qe=!0)}}}Ge(q,re,{ignoreScrollableTarget:Qe,ignoreScrollableAncestors:Qe})&&(De&&Qe?(nt(),G.current=De,pe.current=De,X.current=De,Y.current=!1):(nt(),fe.current=!1))}}const be=X.current,Le=be===null?{x:0,y:0}:{x:re.x-be.x,y:re.y-be.y};X.current=re,Be(q,re,Le)}),Ye=ie(q=>{if(!t)return;const re=Z.current,be=K.current,Le=re.x-be.x,je=re.y-be.y,De={deltaX:Le,deltaY:je,direction:M??J.current};if(!z.current){He(),te(0,De);return}Q(!1),O(!1),W(null),He(),le.current=!1;const Qe=r.current;Qe&&("touches"in q||dc(Qe,q.pointerId,"releasePointerCapture"));const Oe=Le,xe=je,Ne=Se.current,Me=Us(q.timeStamp),Xe=Ne!==null&&Me!==null&&Me>Ne?Me-Ne:0,Je=Xe>0?Math.max(Xe,xE):0,dn=Je>0?Oe/Je:0,rn=Je>0?xe/Je:0;let Bt=H.current.x,er=H.current.y;const Pn=k.current;if(Pn&&Me!==null&&Me>=Pn.time){const Cr=Me-Pn.time;if(Cr<=CE){const on=Math.max(Cr,Gf),qr=re.x-Pn.x,Hc=re.y-Pn.y,Jh=qr/on,Qh=Hc/on;Jh!==0&&(Bt=Jh),Qh!==0&&(er=Qh)}else Bt=0,er=0}const Er=h?.({event:q.nativeEvent,direction:M??J.current,deltaX:Oe,deltaY:xe,velocityX:dn,velocityY:rn,releaseVelocityX:Bt,releaseVelocityY:er}),xr=typeof Er=="boolean";if(ae.current&&!xr){Z.current={x:be.x,y:be.y},A({x:be.x,y:be.y}),V(void 0),te(0,De);return}let _n=!1,fn;if(xr)_n=Er,fn=M??J.current??y;else for(const Cr of n){switch(Cr){case"right":Oe>ue.current&&(_n=!0,fn="right");break;case"left":Oe<-ue.current&&(_n=!0,fn="left");break;case"down":xe>ue.current&&(_n=!0,fn="down");break;case"up":xe<-ue.current&&(_n=!0,fn="up");break}if(_n)break}_n&&fn?(V(fn),_(!0),u?.(q.nativeEvent,{direction:fn})):(Z.current={x:be.x,y:be.y},A({x:be.x,y:be.y}),V(void 0),te(0,De))}),Ut=f.useCallback(()=>{const q=g?N:Z.current,re=g?j:K.current;if(!L&&q.x===re.x&&q.y===re.y&&!I)return{[o.x]:"0px",[o.y]:"0px"};const be=q.x-re.x,Le=q.y-re.y;return{transition:L?"none":void 0,transform:L?`translateX(${q.x}px) translateY(${q.y}px) scale(${re.scale})`:void 0,[o.x]:`${be}px`,[o.y]:`${Le}px`}},[I,N,j,L,o,g]),$t=f.useCallback(()=>t?{onPointerDown:Ue,onPointerMove:ct,onPointerUp:Ye,onPointerCancel:Ye}:{},[t,Ye,ct,Ue]),Ke=f.useCallback(()=>t?{onTouchStart:Ue,onTouchMove:ct,onTouchEnd:Ye,onTouchCancel:Ye}:{},[t,Ye,ct,Ue]);return{swiping:L,swipeDirection:M,dragDismissed:I,getPointerProps:$t,getTouchProps:Ke,getDragStyles:Ut,reset:_e}}const IE=Vs,kE=zs,fc=10,Yf=.5,Xf=.5,RE=300,qf=4,Kf=.2,NE=4,pc=80,Jf=360,hc=.1,Qf=1,ME=`[${Lf}]`,ep=f.forwardRef(function(t,n){const{className:r,render:o,style:s,children:i,...a}=t,{store:c}=Vt(),{swipeDirection:u,notifyParentSwipingChange:l,notifyParentSwipeProgressChange:d,frontmostHeight:p,snapToSequentialPoints:h}=js(),g=zf()?.visualStateStore,v=c.useState("open"),y=c.useState("mounted"),C=c.useState("nested"),S=c.useState("nestedOpenDrawerCount"),E=c.useState("viewportElement"),b=c.useState("popupElement"),x=S>0,T=u==="left"||u==="right"?"horizontal":"vertical",P=T==="vertical",$=P?"horizontal":"vertical",{snapPoints:M,resolvedSnapPoints:V,activeSnapPoint:L,activeSnapPointOffset:D,setActiveSnapPoint:R,popupHeight:O}=jf(),[I,_]=f.useState(null),N=f.useRef(void 0),A=f.useRef(null),j=ao(),B=f.useRef(!1),U=f.useRef(""),W=f.useRef(!1),G=f.useRef(!1),Z=f.useRef(null),X=f.useMemo(()=>{if(!M||M.length<2||u!=="down"&&u!=="up"||V.length<2)return null;const k=V.map(ne=>ne.offset).filter(ne=>Number.isFinite(ne)).sort((ne,te)=>ne-te);if(k.length<2)return null;const H=k[0],F=k[1],z=k[k.length-1];let Q=F-H;if(!Number.isFinite(Q)||Q<=0){const ne=z-H;if(!Number.isFinite(ne)||ne<=0)return null;Q=ne}return{minOffset:H,range:Q}},[V,M,u]),K=f.useMemo(()=>!X||D===null?null:bt((D-X.minOffset)/X.range,0,1),[D,X]),J=f.useMemo(()=>M&&M.length>0&&(u==="down"||u==="up")?u==="down"?["down","up"]:["up","down"]:[u],[M,u]),se=ie(k=>{tp(c.context.popupRef.current,c.context.backdropRef.current,k)}),ae=ie(()=>{se(!1),c.context.popupRef.current?.removeAttribute(sr.endingStyle),_(null)}),pe=ie(()=>{B.current&&(B.current=!1,l?.(!1))}),Y=ie(({resolvedProgress:k,shouldTrackProgress:H,notifyParent:F})=>{const z=v&&!C&&H,Q=z?k:0,ne=v&&H?k:0;F&&d&&(d(ne),ne<=0&&pe()),g?.set({swipeProgress:Q,frontmostHeight:Q>0?p:0});const te=c.context.backdropRef.current;if(te){if(!z||Q<=0){te.style.setProperty(Fn.swipeProgress,"0"),te.style.removeProperty(Tt.height);return}te.style.setProperty(Fn.swipeProgress,`${Q}`),p>0?te.style.setProperty(Tt.height,`${p}px`):te.style.removeProperty(Tt.height)}});function me({direction:k,deltaX:H,deltaY:F,velocityX:z,velocityY:Q,releaseVelocityX:ne,releaseVelocityY:te}){if(!k)return null;const ye=c.context.popupRef.current;if(!ye)return null;const _e=k==="left"||k==="right"?ye.offsetWidth:ye.offsetHeight;if(!Number.isFinite(_e)||_e<=0)return null;const Ee=k==="left"||k==="right"?H:F,Ce=M&&M.length>0?D??0:0;let Pe=0;k==="down"?Pe=Ce:k==="up"&&(Pe=-Ce);const Ve=Pe+Ee,Ge=k==="left"||k==="up"?-Ve:Ve,He=Math.max(0,_e-Ge);if(!Number.isFinite(He)||He<=0)return null;const nt=k==="left"||k==="right"?ne:te,st=k==="left"||k==="right"?z:Q,Re=Math.abs(nt)>0&&Number.isFinite(nt)?nt:st,Te=k==="left"||k==="up"?-Re:Re;if(!Number.isFinite(Te)||Te<=Kf)return null;const Ue=bt(Te,Kf,NE),Be=bt(He/Ue,pc,Jf);if(!Number.isFinite(Be))return null;const ct=(Be-pc)/(Jf-pc),Ye=bt(hc+ct*(Qf-hc),hc,Qf);return!Number.isFinite(Ye)||Ye<=0?null:Ye}function ge(k){if(B.current||!k)return;const H=k.direction??u,F=H==="left"||H==="right"?k.deltaX:k.deltaY;!Number.isFinite(F)||Math.abs(F)<fc||(B.current=!0,l?.(!0))}const fe=_E({enabled:y&&!x,directions:J,elementRef:c.context.popupRef,ignoreSelectorWhenTouch:!1,ignoreScrollableAncestors:!0,movementCssVars:{x:Tt.swipeMovementX,y:Tt.swipeMovementY},onSwipeStart(k){if("touches"in k||"pointerType"in k&&k.pointerType==="touch")return;const H=c.context.popupRef.current;if(!H)return;const z=Ie(H).getSelection?.();if(!z||z.isCollapsed)return;const Q=$e(z.anchorNode)?z.anchorNode:z.anchorNode?.parentElement,ne=$e(z.focusNode)?z.focusNode:z.focusNode?.parentElement;!we(H,Q)&&!we(H,ne)||z.removeAllRanges()},onSwipingChange(k){np(c.context.backdropRef.current,k),!k&&!d&&pe()},swipeThreshold({element:k,direction:H}){return rp(k,H)},canStart(k,H){const F=c.context.popupRef.current;if(!F)return!1;const z=F.ownerDocument,Q=Hs(z,k.x,k.y);if(!Q||!we(F,Q))return!1;const ne=H.nativeEvent;return!(("touches"in ne||"pointerType"in ne&&ne.pointerType==="touch")&&sp(z,F)||ne.type==="touchstart"&&mc(Q))},onProgress(k,H){ge(H);const F=H?.direction??fe.swipeDirection,z=F===void 0||F===u,Q=!!(M&&M.length>0),te=Q&&(u==="down"||u==="up")||!Q||u==="left"||u==="right"||z;let ye=k;if(X&&O>0){if(H&&Number.isFinite(H.deltaY)){const _e=D??X.minOffset,Ee=bt(_e+H.deltaY,0,O);ye=bt((Ee-X.minOffset)/X.range,0,1)}else if(K!==null)ye=K;else if(F==="down"||F==="up"){const _e=k*O,Ee=D??X.minOffset,Ce=F==="down"?Ee+_e:Ee-_e;ye=bt((Ce-X.minOffset)/X.range,0,1)}}Y({resolvedProgress:ye,shouldTrackProgress:te,notifyParent:!0})},onRelease({event:k,deltaX:H,deltaY:F,direction:z,velocityX:Q,velocityY:ne,releaseVelocityX:te,releaseVelocityY:ye}){const _e={deltaX:H,deltaY:F,velocityX:Q,velocityY:ne,releaseVelocityX:te,releaseVelocityY:ye};function Ee(Ke){const q=c.context.popupRef.current;q&&(pe(),se(!0),q.style.removeProperty("transition"),q.setAttribute(sr.endingStyle,""),Kt.flushSync(()=>{_(me({direction:Ke,..._e}))}))}if(!M||M.length===0){if(!z){ae();return}const Ke=c.context.popupRef.current;if(!Ke){ae();return}const q=rp(Ke,z),re=z==="left"||z==="right"?H:F;if(!Number.isFinite(re)){ae();return}const be=z==="left"||z==="up"?-re:re;if(be<=0)return ae(),!1;const Le=z==="left"||z==="right"?Q:ne;if((z==="left"||z==="up"?-Le:Le)>=Yf&&be>0)return Ee(z),!0;const De=be>q;return De?Ee(z):ae(),De}if(u!=="down"&&u!=="up"){ae();return}if(!O||V.length===0){ae();return}const Ce=u==="down"?F:-F;if(!Number.isFinite(Ce)){ae();return}const Pe=Math.sign(Ce),Ve=u==="down"?ye:-ye,Ge=u==="down"?ne:-ne;let He=Number.isFinite(Ve)?Ve:Ge;if(Pe!==0&&Math.abs(Ce)>=fc&&Number.isFinite(He)){const Ke=Math.sign(He);Ke!==0&&Ke!==Pe&&(He=Ge)}const nt=D??0,st=bt(nt+Ce,0,O),Re=Number.isFinite(He)&&Math.abs(He)>=Xf?bt(He,-qf,qf)*RE:0,Te=h?st:bt(st+Re,0,O),Ue=Ae(ls,k),Be=()=>(N.current=L,R?.(null,Ue),Ee(u),!0);if(h){const Ke=[...V].sort((Ne,Me)=>Ne.offset-Me.offset);if(Ke.length===0)return ae(),!1;let q=0,re=Math.abs(nt-Ke[0].offset);for(let Ne=1;Ne<Ke.length;Ne+=1){const Me=Math.abs(nt-Ke[Ne].offset);Me<re&&(re=Me,q=Ne)}let be=Ke[0];re=Math.abs(Te-be.offset);for(const Ne of Ke){const Me=Math.abs(Te-Ne.offset);Me<re&&(re=Me,be=Ne)}const Le=Math.sign(He),je=Pe!==0&&Le!==0&&Le===Pe&&Math.abs(He)>=Xf;let De=Te;if(je){const Ne=bt(q+Pe,0,Ke.length-1);if(Ne!==q){const Me=Ke[Ne];(Pe>0?Te<Me.offset:Te>Me.offset)&&(be=Me,De=Me.offset)}else if(Pe>0)return Be()}const Oe=Math.abs(De-O),xe=Math.abs(De-be.offset);return Oe<xe?Be():(R?.(be.value,Ue),ae(),!1)}if(He>=Yf&&Ce>0)return Be();let ct=V[0],Ye=Math.abs(Te-ct.offset);for(const Ke of V){const q=Math.abs(Te-Ke.offset);q<Ye&&(Ye=q,ct=Ke)}return Math.abs(Te-O)<Ye?Be():(R?.(ct.value,Ue),ae(),!1)},onDismiss(k){g?.set({swipeProgress:0,frontmostHeight:0});const H=c.context.backdropRef.current;H&&(H.style.setProperty(Fn.swipeProgress,"0"),H.style.removeProperty(Tt.height));const F=Ae(ls,k);if(c.setOpen(!1,F),F.isCanceled){const z=N.current;z!==void 0&&R?.(z,Ae(ls,k)),N.current=void 0,A.current?.(),ae();return}if(c.select("open")){const z=k;j.request(()=>{if(c.select("open")){const Q=N.current;Q!==void 0&&R?.(Q,Ae(ls,z)),N.current=void 0,ae(),A.current?.()}else N.current=void 0});return}N.current=void 0,se(!0)}}),le=fe.getPointerProps(),ce=fe.getTouchProps(),ve=fe.reset;A.current=ve,f.useEffect(()=>{const k=E??b;if(!k)return;const H=k,F=Ie(H),z=tt(F);function Q(ne){if(G.current)return;const te=Z.current,ye=ne.touches[0];if(!ye||!te)return;const _e=P?ye.clientY-te.lastY:ye.clientX-te.lastX;if(ip(ne,z)){te.allowSwipe=!1,gr(te,ye);return}if(ne.touches.length===2){gr(te,ye);return}if(sp(F,H)||!v||!y||x){gr(te,ye);return}if(FE(te,ye,P)){gr(te,ye);return}const Ce=te.scrollTarget;if(!Ce||Ce===F.documentElement||Ce===F.body){ne.cancelable&&ne.preventDefault(),gr(te,ye);return}if(!VE(Ce,T)){ne.cancelable&&ne.preventDefault(),gr(te,ye);return}const Ve=_e;if(Ve!==0){const Ge=$E(Ce,T,u,Ve);te.allowSwipe?ne.cancelable&&ne.preventDefault():ne.cancelable&&Ge?(te.allowSwipe=!0,ne.preventDefault()):te.allowSwipe=!1}gr(te,ye)}return Fe(F,"touchmove",Q,{passive:!1,capture:!0})},[y,x,v,b,P,T,u,E]),f.useEffect(()=>{if(!X||fe.swiping)return;Y({resolvedProgress:!v||C?0:K??0,shouldTrackProgress:!0,notifyParent:!1})},[Y,p,C,d,v,K,X,fe.swiping,c,g]),f.useEffect(()=>{if(d)return v||d(0),()=>{d(0)}},[d,v]),f.useEffect(()=>{v&&(ve(),ae())},[ae,v,ve]),f.useEffect(()=>()=>{g?.set({swipeProgress:0,frontmostHeight:0}),np(c.context.backdropRef.current,!1),pe()},[pe,c,g]);const ue=f.useMemo(()=>({swiping:fe.swiping,getDragStyles:fe.getDragStyles,swipeStrength:I??null,setSwipeDismissed(k){tp(c.context.popupRef.current,c.context.backdropRef.current,k)}}),[c,fe.getDragStyles,fe.swiping,I]);function Se(){G.current=!1,Z.current=null,U.current="",W.current=!1}return w.jsx(Tf,{ref:n,className:r,render:o,...En(a,{onPointerDown(k){if(U.current=k.pointerType,W.current=k.pointerType==="pen",!v||!y||x)return;const H=Ie(k.currentTarget),F=Hs(H,k.clientX,k.clientY);mc(F)||AE(F)||k.pointerType!=="touch"&&le.onPointerDown?.(k)},onPointerMove(k){k.pointerType!=="touch"&&le.onPointerMove?.(k)},onPointerUp(k){U.current===k.pointerType&&(U.current=""),k.pointerType!=="touch"&&le.onPointerUp?.(k)},onPointerCancel(k){U.current===k.pointerType&&(U.current=""),k.pointerType!=="touch"&&le.onPointerCancel?.(k)},onTouchStart(k){if(U.current==="pen"&&W.current){W.current=!1,G.current=!1,Z.current=null;return}if(!v||!y||x){G.current=!1,Z.current=null;return}const F=k.touches[0];if(!F)return;if(ap(k)){G.current=!1,Z.current=null;return}const z=Ie(k.currentTarget),Q=Hs(z,F.clientX,F.clientY);if(G.current=mc(Q),G.current){Z.current=null;return}const ne=E??b,te=lt(k.nativeEvent),ye=$e(te)?te:null;if(ne&&ye&&!we(ne,ye)){G.current=!0,Z.current=null;return}let _e=null,Ee=!1;ne&&ye&&(_e=Br(ye,ne,T),Ee=Br(ye,ne,$)!=null);let Ce=null;_e&&(Ce=zE(_e,T,u)?null:!1),Z.current={startX:F.clientX,startY:F.clientY,lastX:F.clientX,lastY:F.clientY,scrollTarget:_e,hasCrossAxisScrollableContent:Ee,allowSwipe:Ce,preserveNativeCrossAxisScroll:!1},ce.onTouchStart?.(k)},onTouchMove(k){if(G.current||ap(k))return;const H=Z.current;H?.preserveNativeCrossAxisScroll||H?.allowSwipe===!1||H?.scrollTarget!=null&&!H.allowSwipe||ce.onTouchMove?.(k)},onTouchEnd(k){Se(),ce.onTouchEnd?.(k)},onTouchCancel(k){Se(),ce.onTouchCancel?.(k)},"data-nested-dialog-open":void 0}),children:w.jsx(cc.Provider,{value:ue,children:i})})});process.env.NODE_ENV!=="production"&&(ep.displayName="DrawerViewport");function tp(e,t,n){if(n){e?.setAttribute(ln.swipeDismiss,""),t?.setAttribute(ln.swipeDismiss,"");return}e?.removeAttribute(ln.swipeDismiss),t?.removeAttribute(ln.swipeDismiss)}function np(e,t){if(e){if(t){e.setAttribute(ln.swiping,"");return}e.removeAttribute(ln.swiping)}}function mc(e){return!!e?.closest(Wl)}function AE(e){return!!e?.closest(ME)}function rp(e,t){const n=t==="left"||t==="right"?e.offsetWidth:e.offsetHeight;return Math.max(n*.5,fc)}function op(e,t){return e instanceof t.HTMLInputElement&&e.type==="range"}function DE(e){return $e(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA":!1}function LE(e,t){const n=$e(e.anchorNode)?e.anchorNode:e.anchorNode?.parentElement,r=$e(e.focusNode)?e.focusNode:e.focusNode?.parentElement;return e.containsNode(t,!0)||we(t,n)||we(t,r)}function sp(e,t){const n=Pt(e);if(!!(n&&we(t,n))&&DE(n)){const{selectionStart:s,selectionEnd:i}=n;if(s!=null&&i!=null&&s<i)return!0}const o=e.getSelection?.();return!o||o.isCollapsed?!1:LE(o,t)}function ip(e,t){const n=e.composedPath();return n?n.some(r=>op(r,t)):op(lt(e),t)}function ap(e){return ip(e.nativeEvent,tt(e.currentTarget))}function gr(e,t){e.lastX=t.clientX,e.lastY=t.clientY}function FE(e,t,n){if(e.preserveNativeCrossAxisScroll)return!0;if(e.allowSwipe===!0||!e.hasCrossAxisScrollableContent)return!1;const r=n?t.clientY-e.startY:t.clientX-e.startX,o=n?t.clientX-e.startX:t.clientY-e.startY,s=Math.abs(r),i=Math.abs(o);return i<6||i<=s+2?!1:(e.preserveNativeCrossAxisScroll=!0,!0)}function VE(e,t){return t==="vertical"?e.scrollHeight>e.clientHeight:e.scrollWidth>e.clientWidth}function cp(e,t){if(t==="vertical"){const r=Math.max(0,e.scrollHeight-e.clientHeight);return{offset:e.scrollTop,max:r}}const n=Math.max(0,e.scrollWidth-e.clientWidth);return{offset:e.scrollLeft,max:n}}function zE(e,t,n){const{offset:r,max:o}=cp(e,t),s=up(n,t);return s===null?!1:s?r<=0:r>=o}function $E(e,t,n,r){const{offset:o,max:s}=cp(e,t),i=up(n,t);return i===null||!(i?r>0:r<0)?!1:i?o<=0:o>=s}function up(e,t){return t==="vertical"?e==="down"?!0:e==="up"?!1:null:e==="right"?!0:e==="left"?!1:null}const lp=f.createContext({legendId:void 0,setLegendId:()=>{},disabled:void 0});process.env.NODE_ENV!=="production"&&(lp.displayName="FieldsetRootContext");function jE(e=!1){const t=f.useContext(lp);if(!t&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>.":ft(86));return t}const dp=function(t){const n=qt(),r=t.controlId===void 0?n:t.controlId,[o,s]=f.useState(r),[i,a]=f.useState(t.labelId),[c,u]=f.useState([]),l=wt(()=>new Map),{messageIds:d}=Ln(),p=ie((g,v)=>{const y=l.current;if(v===void 0){y.delete(g);return}y.set(g,v),s(C=>{if(y.size===0)return;let S;for(const E of y.values()){if(C!==void 0&&E===C)return C;S===void 0&&(S=E)}return S})}),h=f.useCallback(g=>En({"aria-describedby":d.concat(c).join(" ")||void 0},g),[d,c]),m=f.useMemo(()=>({controlId:o,registerControlId:p,labelId:i,setLabelId:a,messageIds:c,setMessageIds:u,getDescriptionProps:h}),[o,p,i,a,c,u,h]);return w.jsx(nc.Provider,{value:m,children:t.children})};process.env.NODE_ENV!=="production"&&(dp.displayName="LabelableProvider");function Bs(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}const Ws=Object.keys($s);function HE(e){if(!e||e.valid||!e.valueMissing)return!1;let t=!1;for(const n of Ws)n!=="valid"&&(n==="valueMissing"&&(t=e[n]),e[n]&&(t=!1));return t}function UE(e){const{formRef:t,clearErrors:n}=Ur(),{setValidityData:r,validate:o,validityData:s,validationDebounceTime:i,invalid:a,markedDirtyRef:c,state:u,name:l,shouldValidateOnChange:d}=e,{controlId:p,getDescriptionProps:h}=Ln(),m=Gt(),g=f.useRef(null),v=ie(async(S,E=!1)=>{const b=g.current;if(!b)return;if(E){if(u.valid!==!1)return;const D=b.validity;if(!D.valueMissing){const O={value:S,state:{...$s,valid:!0},error:"",errors:[],initialValue:s.initialValue};if(b.setCustomValidity(""),p){const I=t.current.fields.get(p);I&&t.current.fields.set(p,{...I,...Bs(O,!1)})}r(O);return}const R=Ws.reduce((O,I)=>(O[I]=D[I],O),{});if(!R.valid&&!HE(R))return}function x(D){const R=Ws.reduce((I,_)=>(I[_]=D.validity[_],I),{});let O=!1;for(const I of Ws)if(I!=="valid"){if(I==="valueMissing"&&R[I])O=!0;else if(R[I])return R}return O&&!c.current&&(R.valid=!0,R.valueMissing=!1),R}m.clear();let T=null,P=[];const $=x(b);let M;const V=d();if(b.validationMessage&&!V)M=b.validationMessage,P=[b.validationMessage];else{const D=Array.from(t.current.fields.values()).reduce((O,I)=>(I.name&&(O[I.name]=I.getValue()),O),{}),R=o(S,D);typeof R=="object"&&R!==null&&"then"in R?T=await R:T=R,T!==null?($.valid=!1,$.customError=!0,Array.isArray(T)?(P=T,b.setCustomValidity(T.join(`
19
+ `))):T&&(P=[T],b.setCustomValidity(T))):V&&(b.setCustomValidity(""),$.customError=!1,b.validationMessage?(M=b.validationMessage,P=[b.validationMessage]):b.validity.valid&&!$.valid&&($.valid=!0))}const L={value:S,state:$,error:M??(Array.isArray(T)?T[0]:T??""),errors:P,initialValue:s.initialValue};if(p){const D=t.current.fields.get(p);D&&t.current.fields.set(p,{...D,...Bs(L,a)})}r(L)}),y=f.useCallback((S={})=>En(h,u.valid===!1?{"aria-invalid":!0}:mt,S),[h,u.valid]),C=f.useCallback((S={})=>En({onChange(E){if(E.nativeEvent.defaultPrevented)return;if(n(l),!d()){v(E.currentTarget.value,!0);return}const b=E.currentTarget;if(b.value===""){v(b.value);return}m.clear(),i?m.start(i,()=>{v(b.value)}):v(b.value)}},y(S)),[y,n,l,m,v,i,d]);return f.useMemo(()=>({getValidationProps:y,getInputValidationProps:C,inputRef:g,commit:v}),[y,C,v])}function BE(e){const{commit:t,invalid:n,markedDirtyRef:r,name:o,setValidityData:s,validityData:i}=e,{formRef:a}=Ur(),c=f.useRef(null),u=f.useRef(null),l=f.useRef(null),d=ie(()=>{const v=u.current;if(v)return v.getValue?v.getValue():v.value}),p=ie((v=!0)=>{const y=u.current;if(!y)return;let C=y.value;C===void 0&&(C=d()),r.current=!0,v?Kt.flushSync(()=>t(C)):t(C)});function h(){const v=u.current;!v||!v.id||a.current.fields.set(v.id,{getValue:d,name:o,controlRef:v.controlRef??l,validityData:Bs(i,n),validate:p})}function m(v=u.current?.id){v&&a.current.fields.delete(v)}function g(){const v=u.current;if(!v)return;let y=v.value;y===void 0&&(y=d()),i.initialValue===null&&y!==null&&s(C=>({...C,initialValue:y}))}return he(()=>{const v=u.current;!v||!v.id||a.current.fields.set(v.id,{getValue:d,name:o,controlRef:v.controlRef??l,validityData:Bs(i,n),validate:p})},[a,d,n,o,p,i]),he(()=>{const v=a.current.fields;return()=>{const y=u.current?.id;y&&v.delete(y)}},[a]),ie((v,y)=>{if(!y){c.current===v&&(c.current=null,m(),u.current=null);return}const C=u.current?.id;c.current=v,u.current=y,C&&C!==y.id&&m(C),g(),h()})}const fp=f.forwardRef(function(t,n){const{errors:r,validationMode:o,submitAttemptedRef:s}=Ur(),{render:i,className:a,validate:c,validationDebounceTime:u=0,validationMode:l=o,name:d,disabled:p=!1,invalid:h,dirty:m,touched:g,actionsRef:v,style:y,...C}=t,{disabled:S}=jE(),E=ie(c||(()=>null)),b=S||p,[x,T]=f.useState(!1),[P,$]=f.useState(!1),[M,V]=f.useState(!1),[L,D]=f.useState(!1),R=m??P,O=g??x,I=f.useRef(!1),_=ie(pe=>{m===void 0&&(pe&&(I.current=!0),$(pe))}),N=ie(pe=>{g===void 0&&T(pe)}),A=ie(()=>l==="onChange"||l==="onSubmit"&&s.current),j=!!d&&Object.hasOwn(r,d)&&r[d]!==void 0,B=h===!0||j,[U,W]=f.useState({state:$s,error:"",errors:[],value:null,initialValue:null}),G=!B&&U.state.valid,Z=f.useMemo(()=>({disabled:b,touched:O,dirty:R,valid:G,filled:M,focused:L}),[b,O,R,G,M,L]),X=UE({setValidityData:W,validate:E,validityData:U,validationDebounceTime:u,invalid:B,markedDirtyRef:I,state:Z,name:d,shouldValidateOnChange:A}),K=f.useCallback(()=>{I.current=!0,X.commit(U.value)},[X,U]),J=BE({commit:X.commit,invalid:B,markedDirtyRef:I,name:d,setValidityData:W,validityData:U});f.useImperativeHandle(v,()=>({validate:K}),[K]);const se=f.useMemo(()=>({invalid:B,name:d,validityData:U,setValidityData:W,disabled:b,touched:O,setTouched:N,dirty:R,setDirty:_,filled:M,setFilled:V,focused:L,setFocused:D,validate:E,validationMode:l,validationDebounceTime:u,shouldValidateOnChange:A,state:Z,markedDirtyRef:I,registerFieldControl:J,validation:X}),[B,d,U,b,O,N,R,_,M,V,L,D,E,l,u,A,Z,J,X]),ae=qe("div",t,{ref:n,state:Z,props:C,stateAttributesMapping:hr});return w.jsx(Qa.Provider,{value:se,children:ae})});process.env.NODE_ENV!=="production"&&(fp.displayName="FieldRootInner");const Wr=f.forwardRef(function(t,n){return w.jsx(dp,{children:w.jsx(fp,{...t,ref:n})})});process.env.NODE_ENV!=="production"&&(Wr.displayName="FieldRoot");const gc=f.forwardRef(function(t,n){const{render:r,className:o,style:s,id:i,nativeLabel:a=!0,...c}=t,u=mr(!1),{labelId:l}=Ln(),d=f.useRef(null),p=sE({id:l??i,native:a});return process.env.NODE_ENV!=="production"&&f.useEffect(()=>{if(!d.current)return;const m=d.current.tagName==="LABEL";if(a){if(!m){const g=Dr.captureOwnerStack?.()||"";ar(`<Field.Label> expected a <label> element because the \`nativeLabel\` prop is true. Rendering a non-<label> disables native label association, so \`htmlFor\` will not work. Use a real <label> in the \`render\` prop, or set \`nativeLabel\` to \`false\`.${g}`)}}else if(m){const g=Dr.captureOwnerStack?.()||"";ar(`<Field.Label> expected a non-<label> element because the \`nativeLabel\` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the \`render\` prop, or set \`nativeLabel\` to \`true\`.${g}`)}},[a]),qe("label",t,{ref:[n,d],state:u.state,props:[p,c],stateAttributesMapping:hr})});process.env.NODE_ENV!=="production"&&(gc.displayName="FieldLabel");const WE={...hr,...tn},Zs=f.forwardRef(function(t,n){const{render:r,id:o,className:s,match:i,style:a,...c}=t,u=qt(o),{validityData:l,state:d,name:p}=mr(!1),{setMessageIds:h}=Ln(),{errors:m}=Ur(),g=p?m[p]:null,v=typeof i=="string";let y=!1;i===!0?y=!0:v?y=!!l.state[i]:y=!!g||l.state.valid===!1;const{mounted:C,transitionStatus:S,setMounted:E}=vo(y);he(()=>{if(!(!y||!u))return h(O=>O.concat(u)),()=>{h(O=>O.filter(I=>I!==u))}},[y,u,h]);const b=f.useRef(null),[x,T]=f.useState(null),[P,$]=f.useState(null),M=l.errors.length>1?w.jsx("ul",{children:l.errors.map(O=>w.jsx("li",{children:O},O))}):l.error,V=v?M:g||M;let L=l.error;g!=null?L=Array.isArray(g)?JSON.stringify(g):g:l.errors.length>1&&(L=JSON.stringify(l.errors)),y&&L!==P&&($(L),T(V)),xn({open:y,ref:b,onComplete(){y||E(!1)}});const D={...d,transitionStatus:S},R=qe("div",t,{ref:[n,b],state:D,props:[{id:u,children:y?V:x},c],stateAttributesMapping:WE,enabled:C});return C?R:null});process.env.NODE_ENV!=="production"&&(Zs.displayName="FieldError");const Gs=f.forwardRef(function(t,n){const{render:r,className:o,id:s,name:i,value:a,disabled:c=!1,onValueChange:u,defaultValue:l,autoFocus:d=!1,style:p,...h}=t,{state:m,name:g,disabled:v,setTouched:y,setDirty:C,validityData:S,setFocused:E,setFilled:b,validationMode:x,validation:T}=mr(),P=v||c,$=g??i,M={...m,disabled:P},{labelId:V}=Ln(),L=rc({id:s});he(()=>{const A=a!=null;T.inputRef.current?.value||A&&a!==""?b(!0):A&&a===""&&b(!1)},[T.inputRef,b,a]);const D=f.useRef(null);he(()=>{d&&D.current===Pt(Ie(D.current))&&E(!0)},[d,E]);const[R]=Eo({controlled:a,default:l,name:"FieldControl",state:"value"}),O=a!==void 0,I=O?R:void 0,_=ie(()=>T.inputRef.current?.value);return ec(T.inputRef,{id:L,value:I,getValue:_}),qe("input",t,{ref:[n,D],state:M,props:[{id:L,disabled:P,name:$,ref:T.inputRef,"aria-labelledby":V,autoFocus:d,...O?{value:I}:{defaultValue:l},onChange(A){const j=A.currentTarget.value;u?.(j,Ae(cr,A.nativeEvent)),C(j!==S.initialValue),b(j!=="")},onFocus(){E(!0)},onBlur(A){y(!0),E(!1),x==="onBlur"&&T.commit(A.currentTarget.value)},onKeyDown(A){A.currentTarget.tagName==="INPUT"&&A.key==="Enter"&&(y(!0),T.commit(A.currentTarget.value))}},T.getInputValidationProps(),h],stateAttributesMapping:hr})});process.env.NODE_ENV!=="production"&&(Gs.displayName="FieldControl");const To=f.forwardRef(function(t,n){const{render:r,className:o,validationMode:s="onSubmit",errors:i,onSubmit:a,onFormSubmit:c,actionsRef:u,style:l,...d}=t,p=f.useRef({fields:new Map}),h=f.useRef(!1),m=f.useRef(!1),g=ie(x=>{x&&(x.focus(),x.tagName==="INPUT"&&x.select())}),[v,y]=f.useState(i);As(i,()=>{y(i)}),f.useEffect(()=>{if(!h.current)return;h.current=!1;const x=Array.from(p.current.fields.values()).filter(T=>T.validityData.state.valid===!1);x.length&&g(x[0].controlRef.current)},[v,g]);const C=f.useCallback(x=>{const T=Array.from(p.current.fields.values());if(x){const P=T.find($=>$.name===x);P&&P.validate(!1)}else T.forEach(P=>{P.validate(!1)})},[]);f.useImperativeHandle(u,()=>({validate:C}),[C]);const S=qe("form",t,{ref:n,props:[{noValidate:!0,onSubmit(x){m.current=!0;let T=Array.from(p.current.fields.values());T.forEach($=>{$.validate()}),T=Array.from(p.current.fields.values());const P=T.filter($=>!$.validityData.state.valid);if(P.length)x.preventDefault(),g(P[0].controlRef.current);else if(h.current=!0,a?.(x),c){x.preventDefault();const $=T.reduce((M,V)=>(V.name&&(M[V.name]=V.getValue()),M),{});c($,_0(cr,x.nativeEvent))}}},d]}),E=ie(x=>{if(x&&v&&mt.hasOwnProperty.call(v,x)){const T={...v};delete T[x],y(T)}}),b=f.useMemo(()=>({formRef:p,validationMode:s,errors:v??mt,clearErrors:E,submitAttemptedRef:m}),[p,s,v,E]);return w.jsx(tc.Provider,{value:b,children:S})});process.env.NODE_ENV!=="production"&&(To.displayName="Form");const yc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(yc.displayName="PopoverRootContext");function Vn(e){const t=f.useContext(yc);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PopoverRootContext is missing. Popover parts must be placed within <Popover.Root>.":ft(47));return t}function ZE(){return{...Nd(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const GE={...Md,disabled:de(e=>e.disabled),instantType:de(e=>e.instantType),openMethod:de(e=>e.openMethod),openChangeReason:de(e=>e.openChangeReason),modal:de(e=>e.modal),focusManagerModal:de(e=>e.focusManagerModal),stickIfOpen:de(e=>e.stickIfOpen),titleElementId:de(e=>e.titleElementId),descriptionElementId:de(e=>e.descriptionElementId),openOnHover:de(e=>e.openOnHover),closeDelay:de(e=>e.closeDelay),hasViewport:de(e=>e.hasViewport)};class vc extends Wo{constructor(t){const n={...ZE(),...t};n.open&&t?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:f.createRef(),backdropRef:f.createRef(),internalBackdropRef:f.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:f.createRef(),beforeContentFocusGuardRef:f.createRef(),stickIfOpenTimeout:new Zt,triggerElements:new bs},GE)}setOpen=(t,n)=>{const r=n.reason===Lt,o=n.reason===Fr&&n.event.detail===0,s=!t&&(n.reason===ed||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const i=()=>{const a={open:t,openChangeReason:n.reason},c=n.trigger?.id??null;(c||t)&&(a.activeTriggerId=c,a.activeTriggerElement=n.trigger??null),this.update(a)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(i0,()=>{this.set("stickIfOpen",!1)}),Kt.flushSync(i)):i(),o||s?this.set("instantType",o?"click":"dismiss"):n.reason===ur?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(t,n){const r=wt(()=>new vc(n)).current,o=t??r;return so(r.disposeEffect),o}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function pp({props:e}){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:s,modal:i=!1,handle:a,triggerId:c,defaultTriggerId:u=null}=e,l=vc.useStore(a?.store,{modal:i,open:r,openProp:n,activeTriggerId:u,triggerIdProp:c});ja(()=>{n===void 0&&l.state.open===!1&&r===!0&&l.update({open:!0,activeTriggerId:u})}),l.useControlledProp("openProp",n),l.useControlledProp("triggerIdProp",c);const d=l.useState("open"),p=l.useState("payload");l.useContextCallback("onOpenChange",o),l.useContextCallback("onOpenChangeComplete",s);const{openMethod:h,triggerProps:m}=Ha(d);kd(l);const{forceUnmount:g}=Rd(d,l,()=>{l.update({stickIfOpen:!0,openChangeReason:null})});f.useEffect(()=>{d||l.context.stickIfOpenTimeout.clear()},[l,d]);const v=f.useCallback(()=>{l.setOpen(!1,Ae(td))},[l]);f.useImperativeHandle(e.actionsRef,()=>({unmount:g,close:v}),[g,v]);const y=Dd({popupStore:l,onOpenChange:l.setOpen}),C=ka(y,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),S=zd(y),{getReferenceProps:E,getFloatingProps:b,getTriggerProps:x}=bo([C,S]),T=f.useMemo(()=>E(m),[E,m]),P=f.useMemo(()=>x(m),[x,m]),$=f.useMemo(()=>b(),[b]);l.useSyncedValues({modal:i,openMethod:h,activeTriggerProps:T,inactiveTriggerProps:P,popupProps:$,floatingRootContext:y,nested:qn()!=null});const M=f.useMemo(()=>({store:l}),[l]);return w.jsx(yc.Provider,{value:M,children:typeof t=="function"?t({payload:p}):t})}function YE(e){return Vn(!0)?w.jsx(pp,{props:e}):w.jsx(L0,{children:w.jsx(pp,{props:e})})}const XE=300,hp=f.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,handle:a,payload:c,openOnHover:u=!1,delay:l=XE,closeDelay:d=0,id:p,style:h,...m}=t,g=Vn(!0),v=a?.store??g?.store;if(!v)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Popover.Trigger> must be either used within a <Popover.Root> component or provided with a handle.":ft(74));const y=qt(p),C=v.useState("isTriggerActive",y),S=v.useState("floatingRootContext"),E=v.useState("isOpenedByTrigger",y),b=f.useRef(null),{registerTrigger:x,isMountedByThisTrigger:T}=Id(y,b,v,{payload:c,disabled:s,openOnHover:u,closeDelay:d}),P=v.useState("openChangeReason"),$=v.useState("stickIfOpen"),M=v.useState("openMethod"),V=v.useState("focusManagerModal"),L=Dw(S,{enabled:S!=null&&u&&(M!=="touch"||P!==Fr),mouseOnly:!0,move:!1,handleClose:Bw(),restMs:l,delay:{close:d},triggerElementRef:b,isActiveTrigger:C,isClosing:()=>v.select("transitionStatus")==="ending"}),D=Ia(S,{enabled:S!=null,stickIfOpen:$}),R=bo([D]),O=v.useState("triggerProps",T),I={disabled:s,open:E},{getButtonProps:_,buttonRef:N}=Lr({disabled:s,native:i}),A=f.useMemo(()=>({open(G){return G&&P===Fr?Xd.open(G):Yd.open(G)}}),[P]),j=qe("button",t,{state:I,ref:[N,n,x,b],props:[R.getReferenceProps(),L,O,{[ha]:"",id:y},m,_],stateAttributesMapping:A}),{preFocusGuardRef:B,handlePreFocusGuardFocus:U,handleFocusTargetFocus:W}=aE(v,b);return C&&!V?w.jsxs(f.Fragment,{children:[w.jsx(Sn,{ref:B,onFocus:U}),w.jsx(f.Fragment,{children:j},y),w.jsx(Sn,{ref:v.context.triggerFocusTargetRef,onFocus:W})]}):w.jsx(f.Fragment,{children:j},y)});process.env.NODE_ENV!=="production"&&(hp.displayName="PopoverTrigger");const bc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(bc.displayName="PopoverPortalContext");function qE(){const e=f.useContext(bc);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Popover.Portal> is missing.":ft(45));return e}const mp=f.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=Vn();return s.useState("mounted")||r?w.jsx(bc.Provider,{value:r,children:w.jsx(hs,{ref:n,...o})}):null});process.env.NODE_ENV!=="production"&&(mp.displayName="PopoverPortal");const wc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(wc.displayName="PopoverPositionerContext");function gp(){const e=f.useContext(wc);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PopoverPositionerContext is missing. PopoverPositioner parts must be placed within <Popover.Positioner>.":ft(46));return e}const yp=f.forwardRef(function(t,n){const{render:r,className:o,anchor:s,positionMethod:i="absolute",side:a="bottom",align:c="center",sideOffset:u=0,alignOffset:l=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:h=5,sticky:m=!1,disableAnchorTracking:g=!1,collisionAvoidance:v=f0,style:y,...C}=t,{store:S}=Vn(),E=qE(),b=A0(),x=S.useState("floatingRootContext"),T=S.useState("mounted"),P=S.useState("open"),$=S.useState("openChangeReason"),M=S.useState("activeTriggerElement"),V=S.useState("modal"),L=S.useState("openMethod"),D=S.useState("positionerElement"),R=S.useState("instantType"),O=S.useState("transitionStatus"),I=S.useState("hasViewport"),_=f.useRef(null),N=Bl(D,!1,!1),A=Zd({anchor:s,floatingRootContext:x,positionMethod:i,mounted:T,side:a,sideOffset:u,align:c,alignOffset:l,arrowPadding:h,collisionBoundary:d,collisionPadding:p,sticky:m,disableAnchorTracking:g,keepMounted:E,nodeId:b,collisionAvoidance:v,adaptiveOrigin:I?Xw:void 0}),j=x.useState("domReferenceElement");he(()=>{const G=j,Z=_.current;if(G&&(_.current=G),Z&&G&&G!==Z){S.set("instantType",void 0);const X=new AbortController;return N(()=>{S.set("instantType","trigger-change")},X.signal),()=>{X.abort()}}},[j,N,S]);const B={open:P,side:A.side,align:A.align,anchorHidden:A.anchorHidden,instant:R};Pf(P&&V===!0&&$!==Lt,L==="touch",D,M);const U=f.useCallback(G=>{S.set("positionerElement",G)},[S]),W=qd(t,B,{styles:A.positionerStyles,transitionStatus:O,props:C,refs:[n,U],hidden:!T,inert:!P});return w.jsxs(wc.Provider,{value:A,children:[T&&V===!0&&$!==Lt&&w.jsx(Ls,{ref:S.context.internalBackdropRef,inert:cs(!P),cutout:M}),w.jsx(D0,{id:b,children:W})]})});process.env.NODE_ENV!=="production"&&(yp.displayName="PopoverPositioner");const vp=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(vp.displayName="ClosePartContext");function KE(){const[e,t]=f.useState(0),n=ie(()=>(t(o=>o+1),()=>{t(o=>Math.max(0,o-1))}));return{context:f.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function JE(e){const{value:t,children:n}=e;return w.jsx(vp.Provider,{value:t,children:n})}const QE={...Cn,...tn},bp=f.forwardRef(function(t,n){const{className:r,render:o,initialFocus:s,finalFocus:i,style:a,...c}=t,{store:u}=Vn(),l=gp(),d=Mf()!=null,{context:p,hasClosePart:h}=KE(),m=u.useState("open"),g=u.useState("openMethod"),v=u.useState("instantType"),y=u.useState("transitionStatus"),C=u.useState("popupProps"),S=u.useState("titleElementId"),E=u.useState("descriptionElementId"),b=u.useState("modal"),x=u.useState("mounted"),T=u.useState("openChangeReason"),P=u.useState("activeTriggerElement"),$=u.useState("floatingRootContext");xn({open:m,ref:u.context.popupRef,onComplete(){m&&u.context.onOpenChangeComplete?.(!0)}});const M=u.useState("disabled"),V=u.useState("openOnHover"),L=u.useState("closeDelay");Mw($,{enabled:V&&!M,closeDelay:L});function D(A){return A==="touch"?u.context.popupRef.current:!0}const R=s===void 0?D:s,O={open:m,side:l.side,align:l.align,instant:v,transitionStatus:y},I=b!==!1&&h;u.useSyncedValue("focusManagerModal",I);const _=f.useCallback(A=>{u.set("popupElement",A)},[u]),N=qe("div",t,{state:O,ref:[n,u.context.popupRef,_],props:[C,{"aria-labelledby":S,"aria-describedby":E,onKeyDown(A){d&&Ms.has(A.key)&&A.stopPropagation()}},Va(y),c],stateAttributesMapping:QE});return w.jsx(ms,{context:$,openInteractionType:g,modal:I,disabled:!x||T===Lt,initialFocus:R,returnFocus:i,restoreFocus:"popup",previousFocusableElement:it(P)?P:void 0,nextFocusableElement:u.context.triggerFocusTargetRef,beforeContentFocusGuardRef:u.context.beforeContentFocusGuardRef,children:w.jsx(JE,{value:p,children:N})})});process.env.NODE_ENV!=="production"&&(bp.displayName="PopoverPopup");const wp=f.forwardRef(function(t,n){const{className:r,render:o,style:s,...i}=t,{store:a}=Vn(),c=a.useState("open"),{arrowRef:u,side:l,align:d,arrowUncentered:p,arrowStyles:h}=gp();return qe("div",t,{state:{open:c,side:l,align:d,uncentered:p},ref:[n,u],props:[{style:h,"aria-hidden":!0},i],stateAttributesMapping:Cn})});process.env.NODE_ENV!=="production"&&(wp.displayName="PopoverArrow");const e1={...Cn,...tn},Sp=f.forwardRef(function(t,n){const{className:r,render:o,style:s,...i}=t,{store:a}=Vn(),c=a.useState("open"),u=a.useState("mounted"),l=a.useState("transitionStatus"),d=a.useState("openChangeReason");return qe("div",t,{state:{open:c,transitionStatus:l},ref:[a.context.backdropRef,n],props:[{role:"presentation",hidden:!u,style:{pointerEvents:d===Lt?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},i],stateAttributesMapping:e1})});process.env.NODE_ENV!=="production"&&(Sp.displayName="PopoverBackdrop");const Ep=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a}=Vn(),c=qt(i.id);return he(()=>(a.set("titleElementId",c),()=>{a.set("titleElementId",void 0)}),[a,c]),qe("h2",t,{ref:n,props:[{id:c},i]})});process.env.NODE_ENV!=="production"&&(Ep.displayName="PopoverTitle");const xp=f.forwardRef(function(t,n){const{render:r,className:o,style:s,...i}=t,{store:a}=Vn(),c=qt(i.id);return he(()=>(a.set("descriptionElementId",c),()=>{a.set("descriptionElementId",void 0)}),[a,c]),qe("p",t,{ref:n,props:[{id:c},i]})});process.env.NODE_ENV!=="production"&&(xp.displayName="PopoverDescription");const Ys="base-ui-disable-scrollbar",Sc={className:Ys,getElement(e){return w.jsx("style",{nonce:e,href:Ys,precedence:"base-ui:low",children:`.${Ys}{scrollbar-width:none}.${Ys}::-webkit-scrollbar{display:none}`})}};process.env.NODE_ENV!=="production"&&(Sc.getElement.displayName="styleDisableScrollbar.getElement");const zn=1;function Cp(e,t){return Math.max(0,e-t)}function t1(e,t){if(t<=0)return 0;const n=bt(e,0,t),r=n,o=t-n,s=r<=zn,i=o<=zn;return s&&i?r<=o?0:t:s?0:i?t:n}const Ec=f.createContext(null);process.env.NODE_ENV!=="production"&&(Ec.displayName="SelectRootContext");const xc=f.createContext(null);process.env.NODE_ENV!=="production"&&(xc.displayName="SelectFloatingContext");function Zr(){const e=f.useContext(Ec);if(e===null)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectRootContext is missing. Select parts must be placed within <Select.Root>.":ft(60));return e}function Tp(){const e=f.useContext(xc);if(e===null)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectFloatingContext is missing. Select parts must be placed within <Select.Root>.":ft(61));return e}const Ze={id:de(e=>e.id),labelId:de(e=>e.labelId),modal:de(e=>e.modal),multiple:de(e=>e.multiple),items:de(e=>e.items),itemToStringLabel:de(e=>e.itemToStringLabel),itemToStringValue:de(e=>e.itemToStringValue),isItemEqualToValue:de(e=>e.isItemEqualToValue),value:de(e=>e.value),hasSelectedValue:de(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Hr(t,r)!==""}),hasNullItemLabel:de((e,t)=>t?WS(e.items):!1),open:de(e=>e.open),mounted:de(e=>e.mounted),forceMount:de(e=>e.forceMount),transitionStatus:de(e=>e.transitionStatus),openMethod:de(e=>e.openMethod),activeIndex:de(e=>e.activeIndex),selectedIndex:de(e=>e.selectedIndex),isActive:de((e,t)=>e.activeIndex===t),isSelected:de((e,t,n)=>{const r=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(s=>jr(n,s,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:jr(n,o,r)}),isSelectedByFocus:de((e,t)=>e.selectedIndex===t),popupProps:de(e=>e.popupProps),triggerProps:de(e=>e.triggerProps),triggerElement:de(e=>e.triggerElement),positionerElement:de(e=>e.positionerElement),listElement:de(e=>e.listElement),scrollUpArrowVisible:de(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:de(e=>e.scrollDownArrowVisible),hasScrollArrows:de(e=>e.hasScrollArrows)};function n1(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:s,defaultOpen:i=!1,onOpenChange:a,name:c,form:u,autoComplete:l,disabled:d=!1,readOnly:p=!1,required:h=!1,modal:m=!0,actionsRef:g,inputRef:v,onOpenChangeComplete:y,items:C,multiple:S=!1,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:x=jS,highlightItemOnHover:T=!0,children:P}=e,{clearErrors:$}=Ur(),{setDirty:M,setTouched:V,setFocused:L,shouldValidateOnChange:D,validityData:R,setFilled:O,name:I,disabled:_,validation:N,validationMode:A}=mr(),j=rc({id:t}),B=_||d,U=I??c,[W,G]=Eo({controlled:n,default:S?r??tl:r,name:"Select",state:"value"}),[Z,X]=Eo({controlled:s,default:i,name:"Select",state:"open"}),K=f.useRef([]),J=f.useRef([]),se=f.useRef(null),ae=f.useRef(null),pe=f.useRef(0),Y=f.useRef(null),me=f.useRef([]),ge=f.useRef(!1),fe=f.useRef(!1),le=f.useRef(null),ce=f.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),ve=f.useRef(!1),{mounted:ue,setMounted:Se,transitionStatus:k}=vo(Z),{openMethod:H,triggerProps:F}=Ha(Z),z=wt(()=>new el({id:j,labelId:void 0,modal:m,multiple:S,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:x,value:W,open:Z,mounted:ue,transitionStatus:k,items:C,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Q=We(z,Ze.activeIndex),ne=We(z,Ze.selectedIndex),te=We(z,Ze.triggerElement),ye=We(z,Ze.positionerElement),_e=cE(H),Ee=H??_e,Ce=f.useMemo(()=>S&&Array.isArray(W)&&W.length===0?"":Hr(W,b),[S,W,b]),Pe=f.useMemo(()=>S&&Array.isArray(W)?W.map(Oe=>Hr(Oe,b)):Hr(W,b),[S,W,b]),Ve=vt(z.state.triggerElement),Ge=ie(()=>Pe);ec(Ve,{id:j,value:W,getValue:Ge});const He=f.useRef(W);he(()=>{W!==He.current&&z.set("forceMount",!0)},[z,W]),he(()=>{O(S?Array.isArray(W)&&W.length>0:W!=null)},[S,W,O]),he(function(){if(Z)return;const xe=me.current;if(S){const Me=Array.isArray(W)?W:[];if(Me.length===0){z.set("selectedIndex",null);return}const Xe=Me[Me.length-1],Je=xo(xe,Xe,x);z.set("selectedIndex",Je===-1?null:Je);return}const Ne=xo(xe,W,x);z.set("selectedIndex",Ne===-1?null:Ne)},[S,Z,W,me,x,z]),As(W,()=>{$(U),M(W!==R.initialValue),D()?N.commit(W):N.commit(W,!0)});const nt=ie((Oe,xe)=>{if(a?.(Oe,xe),!xe.isCanceled&&(X(Oe),!Oe&&(xe.reason===ur||xe.reason===ya)&&(V(!0),L(!1),A==="onBlur"&&N.commit(W)),!Oe&&z.state.activeIndex!==null)){const Ne=K.current[z.state.activeIndex];queueMicrotask(()=>{Ne?.setAttribute("tabindex","-1")})}}),st=ie(()=>{Se(!1),z.update({activeIndex:null,openMethod:null}),y?.(!1)});xn({enabled:!g,open:Z,ref:se,onComplete(){Z||st()}}),f.useImperativeHandle(g,()=>({unmount:st}),[st]);const Re=ie((Oe,xe)=>{o?.(Oe,xe),!xe.isCanceled&&G(Oe)}),Te=ie(()=>{const Oe=z.state.listElement||se.current;if(!Oe)return;const xe=Cp(Oe.scrollHeight,Oe.clientHeight),Ne=t1(Oe.scrollTop,xe),Me=Ne>0,Xe=Ne<xe;z.state.scrollUpArrowVisible!==Me&&z.set("scrollUpArrowVisible",Me),z.state.scrollDownArrowVisible!==Xe&&z.set("scrollDownArrowVisible",Xe)}),Ue=Ad({open:Z,onOpenChange:nt,elements:{reference:te,floating:ye}}),Be=Ia(Ue,{enabled:!p&&!B,event:"mousedown"}),ct=ka(Ue,{bubbles:!1}),Ye=zw(Ue,{enabled:!p&&!B,listRef:K,activeIndex:Q,selectedIndex:ne,disabledIndices:tl,onNavigate(Oe){Oe===null&&!Z||z.set("activeIndex",Oe)},focusItemOnHover:T}),Ut=jw(Ue,{enabled:!p&&!B&&(Z||!S),listRef:J,activeIndex:Q,selectedIndex:ne,onMatch(Oe){Z?z.set("activeIndex",Oe):Re(me.current[Oe],Ae("none"))},onTypingChange(Oe){ge.current=Oe}}),{getReferenceProps:$t,getFloatingProps:Ke,getItemProps:q}=bo([Be,ct,Ye,Ut]),re=f.useMemo(()=>En($t(),F,j?{id:j}:mt),[$t,F,j]);ja(()=>{z.update({popupProps:Ke(),triggerProps:re})}),he(()=>{z.update({id:j,modal:m,multiple:S,value:W,open:Z,mounted:ue,transitionStatus:k,popupProps:Ke(),triggerProps:re,items:C,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:x,openMethod:Ee})},[z,j,m,S,W,Z,ue,k,Ke,re,C,E,b,x,Ee]);const be=f.useMemo(()=>({store:z,name:U,required:h,disabled:B,readOnly:p,multiple:S,highlightItemOnHover:T,setValue:Re,setOpen:nt,listRef:K,popupRef:se,scrollHandlerRef:ae,handleScrollArrowVisibility:Te,scrollArrowsMountedCountRef:pe,getItemProps:q,events:Ue.context.events,valueRef:Y,valuesRef:me,labelsRef:J,typingRef:ge,selectionRef:ce,selectedItemTextRef:le,validation:N,onOpenChangeComplete:y,keyboardActiveRef:fe,alignItemWithTriggerActiveRef:ve,initialValueRef:He}),[z,U,h,B,p,S,T,Re,nt,q,Ue.context.events,N,y,Te]),Le=or(v,N.inputRef),je=S&&Array.isArray(W)&&W.length>0,De=S?void 0:U,Qe=f.useMemo(()=>!S||!Array.isArray(W)||!U?null:W.map(Oe=>{const xe=Hr(Oe,b);return w.jsx("input",{type:"hidden",form:u,name:U,value:xe},xe)}),[S,W,u,U,b]);return w.jsx(Ec.Provider,{value:be,children:w.jsxs(xc.Provider,{value:Ue,children:[P,w.jsx("input",{...N.getInputValidationProps({onFocus(){z.state.triggerElement?.focus({focusVisible:!0})},onChange(Oe){if(Oe.nativeEvent.defaultPrevented)return;const xe=Oe.currentTarget.value,Ne=Ae(cr,Oe.nativeEvent);function Me(){if(S)return;const Xe=me.current.find(Je=>Hr(Je,b).toLowerCase()===xe.toLowerCase()||ZS(Je,E).toLowerCase()===xe.toLowerCase());Xe!=null&&(M(Xe!==R.initialValue),Re(Xe,Ne),D()&&N.commit(Xe))}z.set("forceMount",!0),queueMicrotask(Me)}}),id:j&&De==null?`${j}-hidden-input`:void 0,form:u,name:De,autoComplete:l,value:Ce,disabled:B,required:h&&!je,readOnly:p,ref:Le,style:U?Al:ss,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Qe]})})}const Xs=2,r1=400,Op=200,o1={...Xd,...hr,value:()=>null},Pp=f.forwardRef(function(t,n){const{render:r,className:o,id:s,disabled:i=!1,nativeButton:a=!0,style:c,...u}=t,{setTouched:l,setFocused:d,validationMode:p,state:h,disabled:m}=mr(),{labelId:g}=Ln(),{store:v,setOpen:y,selectionRef:C,validation:S,readOnly:E,required:b,alignItemWithTriggerActiveRef:x,disabled:T,keyboardActiveRef:P}=Zr(),$=m||T||i,M=We(v,Ze.open),V=We(v,Ze.value),L=We(v,Ze.triggerProps),D=We(v,Ze.positionerElement),R=We(v,Ze.listElement),O=We(v,Ze.id),I=We(v,Ze.labelId),_=We(v,Ze.hasSelectedValue),N=!_&&M,A=We(v,Ze.hasNullItemLabel,N),j=s??O,B=XS(g,I);rc({id:j});const U=vt(D),W=f.useRef(null),{getButtonProps:G,buttonRef:Z}=Lr({disabled:$,native:a}),X=ie(fe=>{v.set("triggerElement",fe)}),K=or(n,W,Z,X),J=Gt(),se=Gt(),ae=Gt(),pe=Gt();f.useEffect(()=>{if(M)return!(_||A)?ae.start(r1,()=>{C.current.allowUnselectedMouseUp=!0,C.current.allowSelectedMouseUp=!0}):pe.start(Op,()=>{C.current.allowUnselectedMouseUp=!0,ae.start(Op,()=>{C.current.allowSelectedMouseUp=!0})}),()=>{ae.clear(),pe.clear()};C.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},se.clear()},[M,_,A,C,se,ae,pe]);const Y=f.useMemo(()=>R?.id??lo(D)?.id,[R,D]),me=En(L,{id:j,role:"combobox","aria-expanded":M?"true":"false","aria-haspopup":"listbox","aria-controls":M?Y:void 0,"aria-labelledby":B,"aria-readonly":E||void 0,"aria-required":b||void 0,tabIndex:$?-1:0,ref:K,onFocus(fe){d(!0),M&&x.current&&y(!1,Ae(cr,fe.nativeEvent)),J.start(0,()=>{v.set("forceMount",!0)})},onBlur(fe){we(D,fe.relatedTarget)||(l(!0),d(!1),p==="onBlur"&&S.commit(V))},onPointerMove(){P.current=!1},onKeyDown(){P.current=!0},onMouseDown(fe){if(M)return;const le=Ie(fe.currentTarget);function ce(ve){if(!W.current)return;const ue=ve.target;if(we(W.current,ue)||we(U.current,ue)||ue===W.current)return;const Se=YS(W.current);ve.clientX>=Se.left-Xs&&ve.clientX<=Se.right+Xs&&ve.clientY>=Se.top-Xs&&ve.clientY<=Se.bottom+Xs||y(!1,Ae(O0,ve))}se.start(0,()=>{le.addEventListener("mouseup",ce,{once:!0})})}},S.getValidationProps,u,G);me.role="combobox";const ge={...h,open:M,disabled:$,value:V,readOnly:E,placeholder:!_};return qe("button",t,{ref:[n,W],state:ge,stateAttributesMapping:o1,props:me})});process.env.NODE_ENV!=="production"&&(Pp.displayName="SelectTrigger");const _p=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(_p.displayName="SelectPortalContext");const Ip=f.forwardRef(function(t,n){const{store:r}=Zr(),o=We(r,Ze.mounted),s=We(r,Ze.forceMount);return o||s?w.jsx(_p.Provider,{value:!0,children:w.jsx(hs,{ref:n,...t})}):null});process.env.NODE_ENV!=="production"&&(Ip.displayName="SelectPortal");const Cc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Cc.displayName="SelectPositionerContext");function s1(){const e=f.useContext(Cc);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectPositionerContext is missing. SelectPositioner parts must be placed within <Select.Positioner>.":ft(59));return e}function qs(e,t){e&&Object.assign(e.style,t)}const i1={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},a1={position:"fixed"},kp=f.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:a="bottom",align:c="center",sideOffset:u=0,alignOffset:l=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p,arrowPadding:h=5,sticky:m=!1,disableAnchorTracking:g,alignItemWithTrigger:v=!0,collisionAvoidance:y=d0,style:C,...S}=t,{store:E,listRef:b,labelsRef:x,alignItemWithTriggerActiveRef:T,selectedItemTextRef:P,valuesRef:$,initialValueRef:M,popupRef:V,setValue:L}=Zr(),D=Tp(),R=We(E,Ze.open),O=We(E,Ze.mounted),I=We(E,Ze.modal),_=We(E,Ze.value),N=We(E,Ze.openMethod),A=We(E,Ze.positionerElement),j=We(E,Ze.triggerElement),B=We(E,Ze.isItemEqualToValue),U=We(E,Ze.transitionStatus),W=f.useRef(null),G=f.useRef(null),[Z,X]=f.useState(v),K=O&&Z&&N!=="touch";!O&&Z!==v&&X(v),he(()=>{O||(Ze.scrollUpArrowVisible(E.state)&&E.set("scrollUpArrowVisible",!1),Ze.scrollDownArrowVisible(E.state)&&E.set("scrollDownArrowVisible",!1))},[E,O]),f.useImperativeHandle(T,()=>K),Pf((K||I)&&R,N==="touch",A,j);const J=Zd({anchor:r,floatingRootContext:D,positionMethod:o,mounted:O,side:a,sideOffset:u,align:c,alignOffset:l,arrowPadding:h,collisionBoundary:d,collisionPadding:p,sticky:m,disableAnchorTracking:g??K,collisionAvoidance:y,keepMounted:!0}),se=K?"none":J.side,ae=K?a1:J.positionerStyles,pe={open:R,side:se,align:J.align,anchorHidden:J.anchorHidden},Y=ie(ce=>{E.set("positionerElement",ce)}),me=qd(t,pe,{styles:ae,transitionStatus:U,props:S,refs:[n,Y],hidden:!O,inert:!R}),ge=f.useRef(0),fe=ie(ce=>{if(ce.size===0&&ge.current===0||$.current.length===0)return;const ve=ge.current;if(ge.current=ce.size,ce.size===ve)return;const ue=Ae(cr);if(ve!==0&&!E.state.multiple&&_!==null&&xo($.current,_,B)===-1){const k=M.current,F=k!=null&&xo($.current,k,B)!==-1?k:null;L(F,ue),F===null&&(E.set("selectedIndex",null),P.current=null)}if(ve!==0&&E.state.multiple&&Array.isArray(_)){const Se=H=>xo($.current,H,B)!==-1,k=_.filter(H=>Se(H));(k.length!==_.length||k.some(H=>!HS(_,H,B)))&&(L(k,ue),k.length===0&&(E.set("selectedIndex",null),P.current=null))}if(R&&K){E.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Se={height:""};qs(A,Se),qs(V.current,Se)}}),le=f.useMemo(()=>({...J,side:se,alignItemWithTriggerActive:K,setControlledAlignItemWithTrigger:X,scrollUpArrowRef:W,scrollDownArrowRef:G}),[J,se,K,X]);return w.jsx(vS,{elementsRef:b,labelsRef:x,onMapChange:fe,children:w.jsxs(Cc.Provider,{value:le,children:[O&&I&&w.jsx(Ls,{inert:cs(!R),cutout:j}),me]})})});process.env.NODE_ENV!=="production"&&(kp.displayName="SelectPositioner");const c1={...Cn,...tn},Rp=f.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...a}=t,{store:c,popupRef:u,onOpenChangeComplete:l,setOpen:d,valueRef:p,selectedItemTextRef:h,keyboardActiveRef:m,multiple:g,handleScrollArrowVisibility:v,scrollHandlerRef:y,listRef:C,highlightItemOnHover:S}=Zr(),{side:E,align:b,alignItemWithTriggerActive:x,isPositioned:T,setControlledAlignItemWithTrigger:P,scrollDownArrowRef:$,scrollUpArrowRef:M}=s1(),V=Mf()!=null,L=Tp(),D=Ud(),{nonce:R,disableStyleElements:O}=lE(),I=We(c,Ze.id),_=We(c,Ze.open),N=We(c,Ze.mounted),A=We(c,Ze.popupProps),j=We(c,Ze.transitionStatus),B=We(c,Ze.triggerElement),U=We(c,Ze.positionerElement),W=We(c,Ze.listElement),G=f.useRef(!1),Z=f.useRef(!1),X=f.useRef({}),K=ao(),J=ie(Y=>{if(!U||!u.current||!Z.current)return;if(G.current||!x){v();return}const me=U.style.top==="0px",ge=U.style.bottom==="0px";if(!me&&!ge){v();return}const fe=Mp(U),le=Oo(U.getBoundingClientRect().height,"y",fe),ce=Ie(U),ve=getComputedStyle(U),ue=parseFloat(ve.marginTop),Se=parseFloat(ve.marginBottom),k=Np(getComputedStyle(u.current)),H=Math.min(ce.documentElement.clientHeight-ue-Se,k),F=Y.scrollTop,z=Ks(Y);let Q=0,ne=null,te=!1,ye=!1;const _e=Ve=>{U.style.height=`${Ve}px`},Ee=(Ve,Ge)=>{const He=bt(Ve,0,H-le);He>0&&_e(le+He),Y.scrollTop=Ge,H-(le+He)<=zn&&(G.current=!0),v()},Ce=me?z-F:F,Pe=Math.min(le+Ce,H);if(Q=Pe,Ce<=zn){Ee(Ce,me?z:0);return}if(H-Pe>zn)me?ye=!0:ne=0;else if(te=!0,ge&&F<z){const Ve=le+Ce-H;ne=F-(Ce-Ve)}if(Q=Math.ceil(Q),Q!==0&&_e(Q),ye||ne!=null){const Ve=Ks(Y),Ge=ye?Ve:bt(ne,0,Ve);Math.abs(Y.scrollTop-Ge)>zn&&(Y.scrollTop=Ge)}(te||Q>=H-zn)&&(G.current=!0),v()});f.useImperativeHandle(y,()=>J,[J]),xn({open:_,ref:u,onComplete(){_&&l?.(!0)}});const se={open:_,transitionStatus:j,side:E,align:b};he(()=>{!U||!u.current||Object.keys(X.current).length||(X.current={top:U.style.top||"0",left:U.style.left||"0",right:U.style.right,height:U.style.height,bottom:U.style.bottom,minHeight:U.style.minHeight,maxHeight:U.style.maxHeight,marginTop:U.style.marginTop,marginBottom:U.style.marginBottom})},[u,U]),he(()=>{_||x||(Z.current=!1,G.current=!1,qs(U,X.current))},[_,x,U,u]),he(()=>{const Y=u.current;if(!_||!B||!U||!Y||x&&!T||c.state.transitionStatus==="ending")return;if(!x){Z.current=!0,K.request(v),Y.style.removeProperty("--transform-origin");return}const me=u1(Y);Y.style.removeProperty("--transform-origin");try{const ge=h.current,fe=p.current,le=getComputedStyle(U),ce=getComputedStyle(Y),ve=Ie(B),ue=tt(U),Se=Mp(B),k=Js(B.getBoundingClientRect(),Se),H=Js(U.getBoundingClientRect(),Se),F=k.height,z=W||Y,Q=z.scrollHeight,ne=parseFloat(ce.borderBottomWidth),te=parseFloat(le.marginTop)||10,ye=parseFloat(le.marginBottom)||10,_e=parseFloat(le.minHeight)||100,Ee=Np(ce),Ce=5,Pe=5,Ve=20,Ge=ve.documentElement.clientHeight-te-ye,He=ve.documentElement.clientWidth,nt=Ge-k.bottom+F;let st,Re=D==="rtl"?k.right-H.width:k.left,Te=0;if(ge&&fe){const Le=Js(fe.getBoundingClientRect(),Se);st=Js(ge.getBoundingClientRect(),Se),Re=H.left+(D==="rtl"?Le.right-st.right:Le.left-st.left);const je=Le.top-k.top+Le.height/2;Te=st.top-H.top+st.height/2-je}const Ue=nt+Te+ye+ne;let Be=Math.min(Ge,Ue);const ct=Ge-te-ye,Ye=Ue-Be,Ut=He-Pe;U.style.left=`${bt(Re,Ce,Ut-H.width)}px`,U.style.height=`${Be}px`,U.style.maxHeight="auto",U.style.marginTop=`${te}px`,U.style.marginBottom=`${ye}px`,Y.style.height="100%";const $t=Ks(z),Ke=Ye>=$t-zn;Ke&&(Be=Math.min(Ge,H.height)-(Ye-$t));const q=k.top<Ve||k.bottom>Ge-Ve||Math.ceil(Be)+zn<Math.min(Q,_e),re=(ue.visualViewport?.scale??1)!==1&&Gi;if(q||re){Z.current=!0,qs(U,X.current),P(!1);return}const be=Math.max(_e,Be);if(Ke){const Le=Math.max(0,Ge-Ue);U.style.top=H.height>=ct?"0":`${Le}px`,U.style.height=`${Be}px`,z.scrollTop=Ks(z)}else U.style.bottom="0",z.scrollTop=Ye;if(st){const Le=H.top,je=H.height,De=st.top+st.height/2,Qe=je>0?(De-Le)/je*100:50,Oe=bt(Qe,0,100);Y.style.setProperty("--transform-origin",`50% ${Oe}%`)}(be===Ge||Be>=Ee)&&(G.current=!0),v(),S&&c.state.selectedIndex===null&&c.state.activeIndex===null&&C.current[0]!=null&&c.set("activeIndex",0),Z.current=!0}finally{me()}},[c,_,U,B,p,h,u,v,x,P,K,$,M,W,C,S,D,T]),f.useEffect(()=>{if(!x||!U||!_)return;const Y=tt(U);function me(ge){d(!1,Ae(P0,ge))}return Fe(Y,"resize",me)},[d,x,U,_]);const ae={...W?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":g||void 0,id:`${I}-list`},onKeyDown(Y){m.current=!0,V&&Ms.has(Y.key)&&Y.stopPropagation()},onMouseMove(){m.current=!1},onScroll(Y){W||J(Y.currentTarget)},...x&&{style:W?{height:"100%"}:i1}},pe=qe("div",t,{ref:[n,u],state:se,stateAttributesMapping:c1,props:[A,ae,Va(j),{className:!W&&x?Sc.className:void 0},a]});return w.jsxs(f.Fragment,{children:[!O&&Sc.getElement(R),w.jsx(ms,{context:L,modal:!1,disabled:!N,returnFocus:i,restoreFocus:!0,children:pe})]})});process.env.NODE_ENV!=="production"&&(Rp.displayName="SelectPopup");function Np(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Ks(e){return Cp(e.scrollHeight,e.clientHeight)}function Mp(e){return Cd.getScale(e)}function Oo(e,t,n){return e/n[t]}function Js(e,t){return po({x:Oo(e.x,"x",t),y:Oo(e.y,"y",t),width:Oo(e.width,"x",t),height:Oo(e.height,"y",t)})}const Ap=[["transform","none"],["scale","1"],["translate","0 0"]];function u1(e){const{style:t}=e,n={};for(const[r,o]of Ap)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of Ap){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}const Tc=f.createContext(void 0);process.env.NODE_ENV!=="production"&&(Tc.displayName="SelectItemContext");function Oc(){const e=f.useContext(Tc);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>.":ft(57));return e}const Dp=f.memo(f.forwardRef(function(t,n){const{render:r,className:o,value:s=null,label:i,disabled:a=!1,nativeButton:c=!1,style:u,...l}=t,d=f.useRef(null),p=ES({label:i,textRef:d,indexGuessBehavior:pf.GuessFromOrder}),{store:h,getItemProps:m,setOpen:g,setValue:v,selectionRef:y,typingRef:C,valuesRef:S,multiple:E,selectedItemTextRef:b}=Zr(),x=We(h,Ze.isActive,p.index),T=We(h,Ze.isSelected,p.index,s),P=We(h,Ze.isSelectedByFocus,p.index),$=We(h,Ze.isItemEqualToValue),M=p.index,V=M!==-1,L=f.useRef(null),D=vt(M);he(()=>{if(!V)return;const Z=S.current;return Z[M]=s,()=>{delete Z[M]}},[V,M,s,S]),he(()=>{if(!V)return;const Z=h.state.value;let X=Z;E&&Array.isArray(Z)&&Z.length>0&&(X=Z[Z.length-1]),X!==void 0&&jr(s,X,$)&&(h.set("selectedIndex",M),d.current&&(b.current=d.current))},[V,M,E,$,h,s,b]);const R={disabled:a,selected:T,highlighted:x},O=m({active:x,selected:T});O.id=void 0;const I=f.useRef(null),_=f.useRef("mouse"),N=f.useRef(!1),{getButtonProps:A,buttonRef:j}=Lr({disabled:a,focusableWhenDisabled:!0,native:c,composite:!0});function B(Z){const X=h.state.value;if(E){const K=Array.isArray(X)?X:[],J=T?US(K,s,$):[...K,s];v(J,Ae(va,Z))}else v(s,Ae(va,Z)),g(!1,Ae(va,Z))}const U={role:"option","aria-selected":T,tabIndex:x?0:-1,onTouchStart(){y.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(Z){I.current=Z.key,h.set("activeIndex",M),Z.key===" "&&C.current&&Z.preventDefault()},onClick(Z){N.current=!1,!(Z.type==="keydown"&&I.current===null)&&(a||Z.type==="keydown"&&I.current===" "&&C.current||_.current!=="touch"&&!x||(I.current=null,B(Z.nativeEvent)))},onPointerEnter(Z){_.current=Z.pointerType},onPointerDown(Z){_.current=Z.pointerType,N.current=!0},onMouseUp(){if(a)return;if(N.current){N.current=!1;return}const Z=!y.current.allowSelectedMouseUp&&T,X=!y.current.allowUnselectedMouseUp&&!T;Z||X||_.current!=="touch"&&!x||L.current?.click()}},W=qe("div",t,{ref:[j,n,p.ref,L],state:R,props:[O,U,l,A]}),G=f.useMemo(()=>({selected:T,indexRef:D,textRef:d,selectedByFocus:P,hasRegistered:V}),[T,D,d,P,V]);return w.jsx(Tc.Provider,{value:G,children:W})}));process.env.NODE_ENV!=="production"&&(Dp.displayName="SelectItem");const Lp=f.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:o}=Oc();return r||o?w.jsx(Fp,{...t,ref:n}):null});process.env.NODE_ENV!=="production"&&(Lp.displayName="SelectItemIndicator");const Fp=f.memo(f.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:s,...i}=e,{selected:a}=Oc(),c=f.useRef(null),{transitionStatus:u,setMounted:l}=vo(a),p=qe("span",e,{ref:[t,c],state:{selected:a,transitionStatus:u},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:tn});return xn({open:a,ref:c,onComplete(){a||l(!1)}}),p}));process.env.NODE_ENV!=="production"&&(Fp.displayName="Inner");const Vp=f.memo(f.forwardRef(function(t,n){const{indexRef:r,textRef:o,selectedByFocus:s,hasRegistered:i}=Oc(),{selectedItemTextRef:a}=Zr(),{className:c,render:u,style:l,...d}=t,p=f.useCallback(m=>{if(!m||!i)return;const g=a.current===null||!a.current.isConnected;(s||g&&r.current===0)&&(a.current=m)},[a,r,s,i]);return qe("div",t,{ref:[p,n,o],props:d})}));process.env.NODE_ENV!=="production"&&(Vp.displayName="SelectItemText");function Rt({as:e,children:t,className:n,disabled:r,...o}){const s=e||"button",i=s==="button";return w.jsx(s,{className:Mi("align-middle inline-flex items-center justify-center transition-all cursor-pointer hover:brightness-110 active:brightness-90 active:scale-90 disabled:cursor-not-allowed disabled:grayscale",n),...i?{disabled:r}:{"aria-disabled":r},...r&&!i?{onClick:a=>{a.preventDefault(),a.stopPropagation()}}:{},...o,children:t})}const l1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),d1=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),zp=e=>{const t=d1(e);return t.charAt(0).toUpperCase()+t.slice(1)},$p=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),f1=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var p1={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"};const h1=oe.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},c)=>oe.createElement("svg",{ref:c,...p1,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:$p("lucide",o),...!s&&!f1(a)&&{"aria-hidden":"true"},...a},[...i.map(([u,l])=>oe.createElement(u,l)),...Array.isArray(s)?s:[s]]));const $n=(e,t)=>{const n=oe.forwardRef(({className:r,...o},s)=>oe.createElement(h1,{ref:s,iconNode:t,className:$p(`lucide-${l1(zp(e))}`,`lucide-${e}`,r),...o}));return n.displayName=zp(e),n};const Pc=$n("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const jp=$n("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Hp=$n("eye-closed",[["path",{d:"m15 18-.722-3.25",key:"1j64jw"}],["path",{d:"M2 8a10.645 10.645 0 0 0 20 0",key:"1e7gxb"}],["path",{d:"m20 15-1.726-2.05",key:"1cnuld"}],["path",{d:"m4 15 1.726-2.05",key:"1dsqqd"}],["path",{d:"m9 18 .722-3.25",key:"ypw2yx"}]]);const Up=$n("eye",[["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"}]]);const m1=$n("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);const g1=$n("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const y1=$n("user-round",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);const v1=$n("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const Bp=$n("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function b1(e){return _t.get("/channel/game/role/mail-captcha",e)}function w1(e){return _t.get("/channel/game/role/auth",e)}function S1(e){return _t.post("/passport-api/v2/ztgame/auth/login",{account:e.account,password:e.password,channel_login:1,channel_id:6})}function E1(e){return _t.post("/passport-api/v2/sms-captchas",{mobile:e.mobile,type:e.type||"register",is_voice:0,nationcode:e.countryCode})}function x1(e){return _t.post("/passport-api/v2/ztgame/auth/mobile-register",{mobile:e.mobile,captcha:e.captcha,channel_login:1,channel_id:6,nationcode:e.countryCode,ad_id:""})}function Wp(){return _t.post("/passport-api/v2/ztgame/auth/auth",{channel_login:1,channel_id:6})}function C1(e){return _t.post(`/passport-api/v2/ztgame/users/${e.uid}/idcard`,{name:e.name,idcard:e.idcard},{headers:{Authentication:e.authorization}})}function T1(e){return _t.post("/passport-api/v2/ztgame/auth/re-auth",{type:"auth",channel_id:6,ad_id:"",channel_login:1},{headers:{Authentication:e}})}function O1(e){return _t.post("/passport-api/v2/ztgame/user-center/forget-password/",e)}function P1(e){return _t.post("/passport-api/v2/ztgame/user-center/forget-password/sms-captchas",e)}function Zp(e){return _t.post("/passport-api/v2/ztgame/user-center/forget-password/forget-password-keys",e)}function _1(e){return _t.post("/passport-api/v2/ztgame/user-center/forget-password/forget-password-update",e)}const I1="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAXCAYAAADk3wSdAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFJ0lEQVQ4jW2VW4ydVRXHf2tfvu87Z+5znEtnxnLR0pYJatEHWxhBEZUSCE8YESImRnzwQTEEY6KJGrQJXiFGXzAxaowkSkyoIgjYlEqEIIrSS6KmpTPDdJgz55w5t++29/bhjDQFVrKf9lq/rGSt/3/J+v2XExRQgNsKuJbH9QLFKaE4BWqUu6TCvXhGQsajOD6D4BJfQBCuvvaLLE/uhLTN/8PwVlGCxIJZCJ9XYzwYBEIGdLkztBE8d1rvSJWlbSLw/oJy9UZe8AOAGglfNbt4UE2CSkBikASwfKpE6blOncdndtOauAjy3gWM8516wCGiuFGPyT2Mhw+EQvC9wZ+UEAw4UfXZtBU6cZX7Fm+C4IDwBmgAPHdguEGPy1VqSO0MObhewHc9UgC5gAKXKmpbW3fV8i1/8JovsDyzG5ortxK4DpFzwP1A2yAcUpHciwURCLngOgFVBkIOOPBd/qrWir/MrTV/k6nk2N3v/Rx/uHgJmqvfrqb5l3sioBVofTsi18hrDywGqQ46IQBFwHcCRT1QrrmfDjXaP/TrvNRerrIiM/xq98d4bH6ROK3fV3XlV0QU60azajTOGND6R4YIpAqiAsEDVnB1UM30lonQ/t0/G3t4uXkZqxM1TkztpDmUXP7uzVcO2SA3FVrR0hoEOkrRCAFCGDMScUJX3V6lPCEIrqexsb82quVHnji6xJ9PH8Bbtc9G2f4dW42PznbDzc5qerGlnURURMidEPT2sIw5bFTMYVMp94rxEASfyananu6RI0/t49G/f4gdMxu/jExxm/QF1fMURtEdshRKMSo5GZa1OKJlDVSSc1STx4wedi/paomKPMELSfAv9NKY5569jNGk89nIFLeFIAQFISiMC9jCMZzlHJ+cfPn5uem9G6AQBdXkReKoacxw0TDDHhWX4BQqLjY3z4zTaVapVLODIch5YchAHNa7rJ4k1//pit3LRRT9h9a2RCvJJtai7JgbN1ObqOlzqJlzMJxPjF7cZnSkT78V/1Hk/GJLgKBlKyqLfUcX33m0mJu9lLIU4giSGOJ4gjhG2Zn6uxhvk+kqfRvDWPdKc8UrfPgTz+E2R34cUvMwKhAEvOL0Rcud95+pLZw4eeB94N2VGAtRNHjW7qOajBlG+gcb3QXq3XHaZUzFdvfOmY2r5JNnjw39+2/Iz3Z9vGbCDyTORyr94ul/LEbFr+8YhWoLmvJpbDSQqggYPUsSf0TSjYmw0p6nnlnqmWUji8Frp4bzm1eS7PfHf3sJ5eMLjHQtJ/eUPH39GAzNvI2txUdIZ66mtzVwKQGshaHqz00ImsxruqWmkRleS4W1VOvQqBz2OvnJ2aW1B55cXD1BfQqG50fpRbdTn/oG0UQNayC24MIAGllQqiO+FX13pXnp3Sebk5zuaZZ7hvVU86+e5vlMcIWjwDxJmG3i3/5B9PwkageoKWAanAKXDUzCmrMovWRE5V+aH//vcaS8oe+n97/at3ObheLFAtK+h7wCevo6dA10ddsjuxASEAW6UqLNMSR6BpHv4GkaPIjJH1oYXn+onY1E3UJuXE3VPb0tvZ9Cg66A0oNz4FNQMfg20Gkj5lvI+C9Qc8vI1GCJX3d+D6mzlEHy2PhH3lF1B95T8d9ECYQAFBByCH3wLXBnnsWd2QP9Q6CXt+X2Fs6/7Xy5F4oAOyxfQ/sGRfa919NCAX75GVBLmF1AzGBCF8abDp8ARuDVnoJMvo/JSrz/OpIaKJ7CN25Batul4U1AgP8BRjZPP9WeeTQAAAAASUVORK5CYII=";function k1(e){return w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 500 500",...e,children:[w.jsx("path",{fill:"url(#a)",d:"M0 250C0 111.929 111.929 0 250 0s250 111.929 250 250-111.929 250-250 250S0 388.071 0 250Z"}),w.jsx("path",{fill:"#fff",d:"M159.432 341h-33.008V158.949h33.008V341Zm220.263-76.172c0 11.087-1.946 21.286-5.84 30.596-3.808 9.31-9.098 17.35-15.869 24.121-6.771 6.686-14.811 11.934-24.121 15.742-9.31 3.809-19.424 5.713-30.342 5.713h-89.121c-2.369 0-4.57-.423-6.601-1.27-2.031-.846-3.809-1.988-5.332-3.427-1.439-1.524-2.582-3.301-3.428-5.332-.846-2.032-1.27-4.232-1.27-6.602V175.58c0-2.285.424-4.443 1.27-6.475.846-2.031 1.989-3.808 3.428-5.332a16.354 16.354 0 0 1 5.332-3.554c2.031-.847 4.232-1.27 6.601-1.27h89.121c10.918 0 21.032 1.905 30.342 5.713 9.31 3.809 17.35 9.098 24.121 15.869 6.771 6.686 12.061 14.727 15.869 24.121 3.894 9.31 5.84 19.466 5.84 30.469v29.707Zm-33.007-29.707c0-6.432-1.058-12.314-3.174-17.646-2.032-5.332-4.952-9.86-8.76-13.584-3.809-3.809-8.379-6.729-13.711-8.76-5.247-2.116-11.087-3.174-17.52-3.174h-72.744v116.035h72.744c6.433 0 12.273-1.015 17.52-3.047 5.332-2.116 9.902-5.035 13.711-8.759 3.808-3.809 6.728-8.337 8.76-13.584 2.116-5.332 3.174-11.257 3.174-17.774v-29.707Z"}),w.jsx("defs",{children:w.jsxs("linearGradient",{id:"a",x1:250,x2:250,y1:0,y2:500,gradientUnits:"userSpaceOnUse",children:[w.jsx("stop",{stopColor:"#497EFE"}),w.jsx("stop",{offset:1,stopColor:"#947AFA"})]})})]})}function Qs(){const{gameId:e,loginTypes:t,currentLoginType:n,setCurrentLoginType:r}=Dn(),o=tf({loginTypes:t,gameId:e}),s=nf({loginTypes:t,gameId:e}),i=ef({loginTypes:t,gameId:e}),a=[];return i&&n!==at.GIANT&&a.push({type:at.GIANT,label:e==="5327"?"账号密码登录":"巨人账号",icon:e==="5327"?null:w.jsx("img",{className:"size-4",src:I1})}),s&&n!==at.MOBILE&&a.push({type:at.MOBILE,label:"手机号登录",icon:w.jsx(m1,{className:"size-4"})}),o&&n!==at.ROLE_ID&&a.push({type:at.ROLE_ID,label:"ID 登录",icon:w.jsx(k1,{className:"size-4"})}),n!=="quick"&&$r(e).length>0&&a.push({type:"quick",label:"快捷登录",icon:w.jsx(v1,{className:"size-4"})}),a.length?w.jsx("div",{className:"text-gray-500 text-xs flex justify-center items-center gap-2 mb-4",children:a.map((c,u)=>w.jsxs(Rt,{className:"h-7 px-3 border rounded-full border-gray-300 gap-1.5 text-xs",onClick:()=>r(c.type),children:[c.icon,w.jsx("span",{children:c.label})]},c.type))}):null}function R1(e){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 90 90",fill:"currentColor",...e,children:w.jsx("path",{d:"M41.415 1.601c6.427-2.244 13.363 2.04 14.18 8.773.611 5.508-2.959 10.609-8.365 11.833-.408.102-.918.203-1.326.305-.918.204-1.735.409-2.653.613-.306.102-.714.204-1.122.306h-.101c-.816.306-1.633.51-2.448.816-.306.102-.715.306-1.021.408l-2.754 1.223c-.408.103-.714.307-1.02.511-1.224.612-2.346 1.326-3.468 2.142l-.307.306c-.612.409-1.122.919-1.632 1.327-.51.408-1.02.816-1.53 1.326-.408.306-.714.713-1.122 1.02-.408.407-.816.918-1.326 1.428-.306.612-.409 1.224-.612 1.836-.204 1.122-.51 2.143-.714 3.265-.204 1.02-.408 2.04-.51 3.06 0 .611-.103 1.122-.103 1.734v1.632c0 1.02 0 1.938.103 2.958.102 1.02.306 2.143.51 3.163.204.816.408 1.733.612 2.55.204.816.408 1.53.612 2.346.102.306.204.51.408.714.51.612 1.122 1.122 1.632 1.734 1.02.918 2.04 1.836 3.162 2.754.816.612 1.734 1.224 2.55 1.836.51.306.919.612 1.429.918.102 0 .204 0 .204.103.204 0 .306.102.51.204.408.204.714.408 1.122.612.918.408 1.734.714 2.652 1.122.714.204 1.326.51 2.04.714 1.122.306 2.143.612 3.265.918.51.204 1.122.204 1.632 0 .306-.102.51-.102.816-.204.816-.204 1.53-.51 2.346-.714 1.53-.408 2.958-1.02 4.386-1.633h.102c.816-.408 1.735-.815 2.55-1.325.307-.204.714-.408 1.02-.612 1.02-.714 2.04-1.428 3.06-2.244.613-.51 1.123-1.02 1.735-1.53l2.142-2.143c.408-.408.714-.816.816-1.428 0-.102.103-.102.103-.204.306-1.02.611-2.142.815-3.162.306-1.326.612-2.755.714-4.183v-.204c.102-1.224.103-2.448.103-3.672-.102-.816-.102-1.53-.204-2.346 0-.102 0-.204-.102-.205-.918.408-1.735.715-2.55 1.225-1.633.918-3.061 1.938-4.489 3.06-.102.101-.204.102-.306.204-1.02.918-1.938 1.734-2.856 2.652-1.02 1.02-2.041 2.04-2.96 3.162-1.937 2.244-4.487 3.469-7.445 3.673-5.713.306-10.61-3.673-11.324-9.283-.816-5.61 2.959-10.813 8.467-11.935a52.639 52.639 0 0 0 7.856-2.142h.101c.816-.408 1.734-.715 2.55-1.122 3.264-1.53 6.121-3.672 8.773-6.12 1.327-1.327 2.652-2.653 3.876-4.082 2.347-2.55 5.305-3.774 8.773-3.57 5.1.306 9.283 4.285 9.895 9.283.204 1.53.102 3.06-.408 4.489-.612 1.938-1.224 3.876-1.734 5.916-.102 1.02-.408 1.939-.51 2.958-.408 2.449-.51 4.795-.306 7.141v.306c.102.816.204 1.53.306 2.347a46.28 46.28 0 0 0 1.224 5.406c.102 0 .102.102.102.204.51 1.632 1.224 3.264 1.224 4.794.306 3.162-.51 5.917-2.55 8.365-1.632 1.938-3.774 3.06-6.223 3.57-1.734.408-3.57.817-5.304 1.326-.102.102-.204.102-.306.102-1.836.612-3.775 1.326-5.509 2.244h-.101c-.918.408-1.735.919-2.551 1.429-.306.204-.714.51-1.02.714a30.738 30.738 0 0 0-2.856 2.244c-.816.714-1.633 1.53-2.347 2.244a.22.22 0 0 1-.204.204c-.918.918-1.734 1.836-2.55 2.754-2.346 2.55-5.202 3.877-8.67 3.775-3.06-.102-5.61-1.428-7.651-3.672-1.428-1.633-2.958-3.163-4.488-4.591v-.102c-.51-.408-1.02-.918-1.53-1.326-.715-.612-1.53-1.122-2.245-1.734l-1.53-.918c-.612-.306-1.122-.612-1.734-.918l-2.754-1.225c-1.326-.612-2.653-1.02-4.081-1.428-1.326-.407-2.652-.714-3.978-1.02a11.146 11.146 0 0 1-3.673-1.224c-3.264-1.734-5.1-4.489-5.61-8.16-.204-1.633 0-3.265.51-4.795.816-2.244 1.428-4.59 1.938-6.936.102-.102.102-.103.102-.204.102-.715.204-1.531.306-2.347.102-.714.205-1.428.205-2.142V43.63l-.087-.956a39.328 39.328 0 0 0-1.24-6.695c-.102-.102-.102-.205-.102-.306-.51-1.734-1.224-3.469-1.53-5.203-1.122-5.712 2.55-11.22 8.263-12.445.714-.204 1.53-.306 2.244-.51 1.224-.306 2.55-.612 3.775-1.02 1.224-.408 2.448-.816 3.672-1.326l1.223-.612c.918-.408 1.837-.918 2.755-1.428 1.122-.714 2.244-1.53 3.366-2.346.408-.306.715-.612 1.122-.918.408-.408.918-.918 1.428-1.326a40.49 40.49 0 0 0 2.96-2.96c1.53-1.835 3.161-3.16 5.405-3.977Z"})})}function N1(e){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",fill:"currentColor",...e,children:w.jsx("path",{d:"M842.667 384H768V277.333a234.667 234.667 0 1 0-469.333 0V384H224a53.393 53.393 0 0 0-53.333 53.333V928A53.393 53.393 0 0 0 224 981.333h618.667A53.393 53.393 0 0 0 896 928V437.333A53.393 53.393 0 0 0 842.667 384zm-288 295.007v110.326a21.333 21.333 0 0 1-42.667 0V679.007a64 64 0 1 1 42.667 0zM725.333 384h-384V277.333c0-105.866 86.134-192 192-192s192 86.134 192 192z"})})}var _c,Gp;function M1(){if(Gp)return _c;Gp=1;var e="Expected a function",t=NaN,n="[object Symbol]",r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt,c=typeof Ho=="object"&&Ho&&Ho.Object===Object&&Ho,u=typeof self=="object"&&self&&self.Object===Object&&self,l=c||u||Function("return this")(),d=Object.prototype,p=d.toString,h=Math.max,m=Math.min,g=function(){return l.Date.now()};function v(b,x,T){var P,$,M,V,L,D,R=0,O=!1,I=!1,_=!0;if(typeof b!="function")throw new TypeError(e);x=E(x)||0,y(T)&&(O=!!T.leading,I="maxWait"in T,M=I?h(E(T.maxWait)||0,x):M,_="trailing"in T?!!T.trailing:_);function N(K){var J=P,se=$;return P=$=void 0,R=K,V=b.apply(se,J),V}function A(K){return R=K,L=setTimeout(U,x),O?N(K):V}function j(K){var J=K-D,se=K-R,ae=x-J;return I?m(ae,M-se):ae}function B(K){var J=K-D,se=K-R;return D===void 0||J>=x||J<0||I&&se>=M}function U(){var K=g();if(B(K))return W(K);L=setTimeout(U,j(K))}function W(K){return L=void 0,_&&P?N(K):(P=$=void 0,V)}function G(){L!==void 0&&clearTimeout(L),R=0,P=D=$=L=void 0}function Z(){return L===void 0?V:W(g())}function X(){var K=g(),J=B(K);if(P=arguments,$=this,D=K,J){if(L===void 0)return A(D);if(I)return L=setTimeout(U,x),N(D)}return L===void 0&&(L=setTimeout(U,x)),V}return X.cancel=G,X.flush=Z,X}function y(b){var x=typeof b;return!!b&&(x=="object"||x=="function")}function C(b){return!!b&&typeof b=="object"}function S(b){return typeof b=="symbol"||C(b)&&p.call(b)==n}function E(b){if(typeof b=="number")return b;if(S(b))return t;if(y(b)){var x=typeof b.valueOf=="function"?b.valueOf():b;b=y(x)?x+"":x}if(typeof b!="string")return b===0?b:+b;b=b.replace(r,"");var T=s.test(b);return T||i.test(b)?a(b.slice(2),T?2:8):o.test(b)?t:+b}return _c=v,_c}M1();function A1(e=!1){if(typeof e!="boolean")throw new Error("defaultValue must be `true` or `false`");const[t,n]=oe.useState(e),r=oe.useCallback(()=>{n(!0)},[]),o=oe.useCallback(()=>{n(!1)},[]),s=oe.useCallback(()=>{n(i=>!i)},[]);return{value:t,setValue:n,setTrue:r,setFalse:o,toggle:s}}var Yp=typeof window<"u"?oe.useLayoutEffect:oe.useEffect;function D1(e){const[t,n]=oe.useState(e),r=oe.useCallback(()=>{n(i=>i+1)},[]),o=oe.useCallback(()=>{n(i=>i-1)},[]),s=oe.useCallback(()=>{n(e)},[e]);return{count:t,increment:r,decrement:o,reset:s,setCount:n}}function L1(e,t){const n=oe.useRef(e);Yp(()=>{n.current=e},[e]),oe.useEffect(()=>{if(t===null)return;const r=setInterval(()=>{n.current()},t);return()=>{clearInterval(r)}},[t])}function F1({countStart:e,countStop:t=0,intervalMs:n=1e3,isIncrement:r=!1}){const{count:o,increment:s,decrement:i,reset:a}=D1(e),{value:c,setTrue:u,setFalse:l}=A1(!1),d=oe.useCallback(()=>{l(),a()},[l,a]),p=oe.useCallback(()=>{if(o===t){l();return}r?s():i()},[o,t,i,s,r,l]);return L1(p,c?n:null),[o,{startCountdown:u,stopCountdown:l,resetCountdown:d}]}var V1=typeof window>"u";function z1(e,{defaultValue:t=!1,initializeWithValue:n=!0}={}){const r=a=>V1?t:window.matchMedia(a).matches,[o,s]=oe.useState(()=>n?r(e):t);function i(){s(r(e))}return Yp(()=>{const a=window.matchMedia(e);return i(),a.addListener?a.addListener(i):a.addEventListener("change",i),()=>{a.removeListener?a.removeListener(i):a.removeEventListener("change",i)}},[e]),o}function Xp({trigger:e,title:t,description:n,children:r,open:o,showCloseIcon:s=!0,onOpenChange:i,zIndex:a,classNames:c}){return z1("(min-width: 1024px)")?w.jsxs(Wa,{open:o,onOpenChange:i,disablePointerDismissal:!0,children:[e&&w.jsx(zs,{className:c?.trigger,children:e}),w.jsxs(Fs,{children:[w.jsx(Za,{style:{zIndex:a},className:"fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm"}),w.jsxs(Ka,{style:{zIndex:a},className:fr("fixed top-1/2 left-1/2 w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg bg-gray-50 p-4 text-gray-900 transition-all duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 z-[991]",c?.desktopPopup),children:[t&&w.jsx(Vs,{className:fr("-mt-1.5 mb-1 text-lg font-medium",c?.title),children:t}),n&&w.jsx(Ya,{className:fr("mb-6 text-base text-gray-600",c?.description),children:n}),s&&w.jsx(Ga,{className:"absolute right-4 top-4 text-gray-700 hover:bg-gray-200 rounded p-0.5",children:w.jsx(Bp,{})}),w.jsx("div",{children:r})]})]})]}):w.jsxs(yE,{open:o,onOpenChange:i,children:[e&&w.jsx(kE,{className:c?.trigger,children:e}),w.jsxs(gE,{children:[w.jsx(Df,{style:{zIndex:a},className:fr("fixed inset-0 bg-black/70 transition-opacity duration-300 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm",c?.backdrop)}),w.jsx(ep,{style:{zIndex:a},className:"fixed inset-0 z-[991]",children:w.jsx(Uf,{className:fr("fixed bottom-0 left-0 right-0 rounded-t-xl bg-white p-4 transition-transform duration-300 data-[starting-style]:translate-y-full data-[ending-style]:translate-y-full","[transform:translateY(var(--drawer-swipe-movement-y))]",c?.mobilePopup),children:w.jsxs(Ff,{children:[w.jsx("div",{"aria-hidden":!0,className:"mx-auto w-12 h-1.5 flex-shrink-0 rounded-full bg-gray-300 mb-4"}),w.jsx(IE,{className:"sr-only",children:t}),w.jsx("div",{children:r})]})})})]})]})}function qp({checked:e,onChange:t}){const[n,r]=oe.useState(!1),[o,s]=oe.useState(!1);return w.jsxs("div",{children:[w.jsx(Xp,{title:"用户协议",open:n,onOpenChange:r,zIndex:993,classNames:{desktopPopup:"w-[90vw] lg:w-[60vw]"},children:w.jsx("iframe",{src:"https://www.gatribe.com/license-light.html?channel_id=1&game_id=5327",className:"w-full h-[70vh]"})}),w.jsx(Xp,{title:"隐私政策",open:o,onOpenChange:s,zIndex:993,classNames:{desktopPopup:"w-[90vw] lg:w-[60vw]"},children:w.jsx("iframe",{src:"https://www.gatribe.com/privacy-light.html?channel_id=1&game_id=5327",className:"w-full h-[70vh]"})}),w.jsx(Wr,{name:"rememberLogin",children:w.jsxs(gc,{className:"flex items-center justify-center text-gray-500 text-xs md:text-sm",children:[w.jsx(sc,{checked:e,className:"size-4 md:size-5 flex items-center justify-center rounded-full border-2 data-[checked]:border-[var(--jssdk-primary-color)] data-[unchecked]:border-[var(--jssdk-input-border-color)]",onCheckedChange:i=>t(!!i),children:w.jsx(ic,{children:w.jsx(Pc,{className:"size-3 text-[var(--jssdk-primary-color)]",strokeWidth:4})})}),w.jsx("span",{className:"ml-2 text-xs md:text-sm",children:"我已详细阅读并同意"}),w.jsx(Rt,{className:"text-[var(--jssdk-primary-color)] text-xs md:text-sm",onClick:()=>r(!0),type:"button",children:"《用户协议》"}),w.jsx("span",{className:"text-xs md:text-sm",children:"及"}),w.jsx(Rt,{className:"text-[var(--jssdk-primary-color)] text-xs md:text-sm",onClick:()=>s(!0),type:"button",children:"《隐私政策》"})]})})]})}function Po({trigger:e,title:t,description:n,children:r,open:o,showCloseIcon:s=!0,onOpenChange:i,disablePointerDismissal:a=!1,classNames:c}){return w.jsxs(Wa,{open:o,onOpenChange:i,disablePointerDismissal:a,children:[e&&w.jsx(zs,{className:c?.trigger,children:e}),w.jsxs(Fs,{children:[w.jsx(Za,{className:"fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm",forceRender:!0}),w.jsxs(Ka,{className:St("fixed top-1/2 left-1/2 w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg bg-gray-50 p-4 text-gray-900 transition-all duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 z-[990]",c?.popup),children:[t&&w.jsx(Vs,{className:St("-mt-1.5 mb-1 text-lg font-medium",c?.title),children:t}),n&&w.jsx(Ya,{className:St("mb-6 text-base text-gray-600",c?.description),children:n}),s&&w.jsx(Ga,{className:St("absolute right-4 top-4 text-gray-700 hover:bg-gray-200 rounded p-0.5",c?.close),children:w.jsx(Bp,{})}),w.jsx("div",{children:r})]})]})]})}function Tn({name:e,prefix:t,suffix:n,className:r,inputClassName:o,error:s,...i}){return w.jsxs(Wr,{name:e,className:"group",children:[w.jsxs("div",{className:St("flex items-center border border-[var(--jssdk-input-border-color)] group-data-[focused]:border-[var(--jssdk-primary-color)] group-data-[focused]:shadow-[0_0_6px_color-mix(in_srgb,var(--jssdk-primary-color),transparent_80%)] rounded-full bg-white px-3 gap-2 h-12 transition-all duration-200",s&&"border-red-500",r),children:[t,w.jsx(Gs,{className:St("flex-1 w-0 outline-none rounded-full h-full pl-1",o),...i}),n]}),w.jsx(Zs,{className:"text-red-500 text-xs mt-1 ml-3"})]})}function $1({account:e,forgetPasswordKey:t,onSuccess:n}){const[r,o]=oe.useState(""),[s,i]=oe.useState(!1),{mutate:a,isPending:c}=sn({mutationFn:()=>_1({account:e,forget_password_key:t,password:r}),onSuccess:l=>{l?.code===0||!l?.error?n():gt.warning(l.detail||l.error||"重置失败")}}),u=()=>{if(!r){gt.warning("请输入新密码");return}if(r.length<6||r.length>18){gt.warning("密码长度需要在6-18位之间");return}a()};return w.jsxs("div",{className:"space-y-4",children:[w.jsx("div",{className:"text-sm text-gray-500 mb-4 text-center",children:"请设置新的登录密码"}),w.jsx(Tn,{name:"password",type:s?"text":"password",autoComplete:"off",inputClassName:"placeholder:text-sm",placeholder:"请输入6-18位由数字、字母组成的密码",value:r,autoFocus:!0,onValueChange:l=>o(l),suffix:w.jsx(Rt,{onClick:()=>i(!s),type:"button",children:s?w.jsx(Up,{className:"size-5 text-gray-400"}):w.jsx(Hp,{className:"size-5 text-gray-400"})})}),w.jsx(Rt,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:u,disabled:!r||c,children:c?"重置中...":"确定修改"})]})}var j1=function(e){return typeof e=="number"};function H1(e){var t=oe.useRef(e);return t.current=e,t}var ei={exports:{}},U1=ei.exports,Kp;function B1(){return Kp||(Kp=1,(function(e,t){(function(n,r){e.exports=r()})(U1,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",i="second",a="minute",c="hour",u="day",l="week",d="month",p="quarter",h="year",m="date",g="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(R){var O=["th","st","nd","rd"],I=R%100;return"["+R+(O[(I-20)%10]||O[I]||O[0])+"]"}},S=function(R,O,I){var _=String(R);return!_||_.length>=O?R:""+Array(O+1-_.length).join(I)+R},E={s:S,z:function(R){var O=-R.utcOffset(),I=Math.abs(O),_=Math.floor(I/60),N=I%60;return(O<=0?"+":"-")+S(_,2,"0")+":"+S(N,2,"0")},m:function R(O,I){if(O.date()<I.date())return-R(I,O);var _=12*(I.year()-O.year())+(I.month()-O.month()),N=O.clone().add(_,d),A=I-N<0,j=O.clone().add(_+(A?-1:1),d);return+(-(_+(I-N)/(A?N-j:j-N))||0)},a:function(R){return R<0?Math.ceil(R)||0:Math.floor(R)},p:function(R){return{M:d,y:h,w:l,d:u,D:m,h:c,m:a,s:i,ms:s,Q:p}[R]||String(R||"").toLowerCase().replace(/s$/,"")},u:function(R){return R===void 0}},b="en",x={};x[b]=C;var T="$isDayjsObject",P=function(R){return R instanceof L||!(!R||!R[T])},$=function R(O,I,_){var N;if(!O)return b;if(typeof O=="string"){var A=O.toLowerCase();x[A]&&(N=A),I&&(x[A]=I,N=A);var j=O.split("-");if(!N&&j.length>1)return R(j[0])}else{var B=O.name;x[B]=O,N=B}return!_&&N&&(b=N),N||!_&&b},M=function(R,O){if(P(R))return R.clone();var I=typeof O=="object"?O:{};return I.date=R,I.args=arguments,new L(I)},V=E;V.l=$,V.i=P,V.w=function(R,O){return M(R,{locale:O.$L,utc:O.$u,x:O.$x,$offset:O.$offset})};var L=(function(){function R(I){this.$L=$(I.locale,null,!0),this.parse(I),this.$x=this.$x||I.x||{},this[T]=!0}var O=R.prototype;return O.parse=function(I){this.$d=(function(_){var N=_.date,A=_.utc;if(N===null)return new Date(NaN);if(V.u(N))return new Date;if(N instanceof Date)return new Date(N);if(typeof N=="string"&&!/Z$/i.test(N)){var j=N.match(v);if(j){var B=j[2]-1||0,U=(j[7]||"0").substring(0,3);return A?new Date(Date.UTC(j[1],B,j[3]||1,j[4]||0,j[5]||0,j[6]||0,U)):new Date(j[1],B,j[3]||1,j[4]||0,j[5]||0,j[6]||0,U)}}return new Date(N)})(I),this.init()},O.init=function(){var I=this.$d;this.$y=I.getFullYear(),this.$M=I.getMonth(),this.$D=I.getDate(),this.$W=I.getDay(),this.$H=I.getHours(),this.$m=I.getMinutes(),this.$s=I.getSeconds(),this.$ms=I.getMilliseconds()},O.$utils=function(){return V},O.isValid=function(){return this.$d.toString()!==g},O.isSame=function(I,_){var N=M(I);return this.startOf(_)<=N&&N<=this.endOf(_)},O.isAfter=function(I,_){return M(I)<this.startOf(_)},O.isBefore=function(I,_){return this.endOf(_)<M(I)},O.$g=function(I,_,N){return V.u(I)?this[_]:this.set(N,I)},O.unix=function(){return Math.floor(this.valueOf()/1e3)},O.valueOf=function(){return this.$d.getTime()},O.startOf=function(I,_){var N=this,A=!!V.u(_)||_,j=V.p(I),B=function(se,ae){var pe=V.w(N.$u?Date.UTC(N.$y,ae,se):new Date(N.$y,ae,se),N);return A?pe:pe.endOf(u)},U=function(se,ae){return V.w(N.toDate()[se].apply(N.toDate("s"),(A?[0,0,0,0]:[23,59,59,999]).slice(ae)),N)},W=this.$W,G=this.$M,Z=this.$D,X="set"+(this.$u?"UTC":"");switch(j){case h:return A?B(1,0):B(31,11);case d:return A?B(1,G):B(0,G+1);case l:var K=this.$locale().weekStart||0,J=(W<K?W+7:W)-K;return B(A?Z-J:Z+(6-J),G);case u:case m:return U(X+"Hours",0);case c:return U(X+"Minutes",1);case a:return U(X+"Seconds",2);case i:return U(X+"Milliseconds",3);default:return this.clone()}},O.endOf=function(I){return this.startOf(I,!1)},O.$set=function(I,_){var N,A=V.p(I),j="set"+(this.$u?"UTC":""),B=(N={},N[u]=j+"Date",N[m]=j+"Date",N[d]=j+"Month",N[h]=j+"FullYear",N[c]=j+"Hours",N[a]=j+"Minutes",N[i]=j+"Seconds",N[s]=j+"Milliseconds",N)[A],U=A===u?this.$D+(_-this.$W):_;if(A===d||A===h){var W=this.clone().set(m,1);W.$d[B](U),W.init(),this.$d=W.set(m,Math.min(this.$D,W.daysInMonth())).$d}else B&&this.$d[B](U);return this.init(),this},O.set=function(I,_){return this.clone().$set(I,_)},O.get=function(I){return this[V.p(I)]()},O.add=function(I,_){var N,A=this;I=Number(I);var j=V.p(_),B=function(G){var Z=M(A);return V.w(Z.date(Z.date()+Math.round(G*I)),A)};if(j===d)return this.set(d,this.$M+I);if(j===h)return this.set(h,this.$y+I);if(j===u)return B(1);if(j===l)return B(7);var U=(N={},N[a]=r,N[c]=o,N[i]=n,N)[j]||1,W=this.$d.getTime()+I*U;return V.w(W,this)},O.subtract=function(I,_){return this.add(-1*I,_)},O.format=function(I){var _=this,N=this.$locale();if(!this.isValid())return N.invalidDate||g;var A=I||"YYYY-MM-DDTHH:mm:ssZ",j=V.z(this),B=this.$H,U=this.$m,W=this.$M,G=N.weekdays,Z=N.months,X=N.meridiem,K=function(ae,pe,Y,me){return ae&&(ae[pe]||ae(_,A))||Y[pe].slice(0,me)},J=function(ae){return V.s(B%12||12,ae,"0")},se=X||function(ae,pe,Y){var me=ae<12?"AM":"PM";return Y?me.toLowerCase():me};return A.replace(y,(function(ae,pe){return pe||(function(Y){switch(Y){case"YY":return String(_.$y).slice(-2);case"YYYY":return V.s(_.$y,4,"0");case"M":return W+1;case"MM":return V.s(W+1,2,"0");case"MMM":return K(N.monthsShort,W,Z,3);case"MMMM":return K(Z,W);case"D":return _.$D;case"DD":return V.s(_.$D,2,"0");case"d":return String(_.$W);case"dd":return K(N.weekdaysMin,_.$W,G,2);case"ddd":return K(N.weekdaysShort,_.$W,G,3);case"dddd":return G[_.$W];case"H":return String(B);case"HH":return V.s(B,2,"0");case"h":return J(1);case"hh":return J(2);case"a":return se(B,U,!0);case"A":return se(B,U,!1);case"m":return String(U);case"mm":return V.s(U,2,"0");case"s":return String(_.$s);case"ss":return V.s(_.$s,2,"0");case"SSS":return V.s(_.$ms,3,"0");case"Z":return j}return null})(ae)||j.replace(":","")}))},O.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},O.diff=function(I,_,N){var A,j=this,B=V.p(_),U=M(I),W=(U.utcOffset()-this.utcOffset())*r,G=this-U,Z=function(){return V.m(j,U)};switch(B){case h:A=Z()/12;break;case d:A=Z();break;case p:A=Z()/3;break;case l:A=(G-W)/6048e5;break;case u:A=(G-W)/864e5;break;case c:A=G/o;break;case a:A=G/r;break;case i:A=G/n;break;default:A=G}return N?A:V.a(A)},O.daysInMonth=function(){return this.endOf(d).$D},O.$locale=function(){return x[this.$L]},O.locale=function(I,_){if(!I)return this.$L;var N=this.clone(),A=$(I,_,!0);return A&&(N.$L=A),N},O.clone=function(){return V.w(this.$d,this)},O.toDate=function(){return new Date(this.valueOf())},O.toJSON=function(){return this.isValid()?this.toISOString():null},O.toISOString=function(){return this.$d.toISOString()},O.toString=function(){return this.$d.toUTCString()},R})(),D=L.prototype;return M.prototype=D,[["$ms",s],["$s",i],["$m",a],["$H",c],["$W",u],["$M",d],["$y",h],["$D",m]].forEach((function(R){D[R[1]]=function(O){return this.$g(O,R[0],R[1])}})),M.extend=function(R,O){return R.$i||(R(O,L,M),R.$i=!0),M},M.locale=$,M.isDayjs=P,M.unix=function(R){return M(1e3*R)},M.en=x[b],M.Ls=x,M.p={},M}))})(ei)),ei.exports}var W1=B1();const Z1=zv(W1);var Ic=function(e){if(!e)return 0;var t=Z1(e).valueOf()-Date.now();return t<0?0:t},G1=function(e){return{days:Math.floor(e/864e5),hours:Math.floor(e/36e5)%24,minutes:Math.floor(e/6e4)%60,seconds:Math.floor(e/1e3)%60,milliseconds:Math.floor(e)%1e3}},Jp=function(e){e===void 0&&(e={});var t=e||{},n=t.leftTime,r=t.targetDate,o=t.interval,s=o===void 0?1e3:o,i=t.onEnd,a=oe.useMemo(function(){return j1(n)&&n>0?Date.now()+n:void 0},[n]),c="leftTime"in e?a:r,u=Im(oe.useState(function(){return Ic(c)}),2),l=u[0],d=u[1],p=H1(i);oe.useEffect(function(){if(!c){d(0);return}d(Ic(c));var m=setInterval(function(){var g,v=Ic(c);d(v),v===0&&(clearInterval(m),(g=p.current)===null||g===void 0||g.call(p))},s);return function(){return clearInterval(m)}},[c,s]);var h=oe.useMemo(function(){return G1(l)},[l]);return[l,h]};function Y1({account:e,mobile:t,onNext:n}){const[r,o]=oe.useState(""),[s,i]=oe.useState(),[a]=Jp({leftTime:s?s*1e3:void 0,interval:1e3,onEnd(){i(void 0)}}),{mutate:c,isPending:u}=sn({mutationFn:()=>P1({account:e,type:"reset-password",is_voice:0,t:"ctoken"}),onSuccess:h=>{i(h.lock_time),gt.success("验证码已发送,请注意查收")}}),{mutate:l,isPending:d}=sn({mutationFn:()=>Zp({account:e,captcha:r,t:"reset-password"}),onSuccess:h=>{h?.forget_password_key?n(h.forget_password_key):gt.warning("安全验证失败")},onError:h=>{gt.warning(h?.message||h?.detail||"验证失败")}}),p=()=>{if(!r){gt.warning("请输入验证码");return}l()};return w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",w.jsx("br",{}),"请输入验证码,短信将发送至您的绑定手机"," ",w.jsx("span",{className:"font-semibold text-gray-700",children:t})]}),w.jsx(Tn,{name:"verificationCode",placeholder:"请输入验证码",value:r,type:"number",autoFocus:!0,onValueChange:h=>o(h),suffix:w.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-white inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onClick:()=>c(),disabled:!!s||u,children:u?"发送中...":s?`${Math.round(a/1e3)}s 后重新获取`:"获取验证码"})}),w.jsx(Rt,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:p,disabled:d,children:d?"验证中...":"下一步"})]})}function X1({account:e,onNext:t}){const[n,r]=oe.useState(""),{mutate:o,isPending:s}=sn({mutationFn:()=>Zp({account:e,idcard:n,t:"reset-password"}),onSuccess:a=>{a?.forget_password_key?t(a.forget_password_key):gt.warning("安全验证失败")}}),i=()=>{if(!n){gt.warning("请输入身份证号");return}o()};return w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",w.jsx("br",{}),"该账号未绑定手机,请输入注册时填写的身份证信息"]}),w.jsx(Tn,{name:"idCard",placeholder:"请输入身份证号",value:n,autoFocus:!0,onChange:a=>r(a.currentTarget.value)}),w.jsx(Rt,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:i,disabled:s,children:s?"验证中...":"下一步"})]})}function q1({onClose:e,defaultAccount:t=""}){const[n,r]=oe.useState("account"),[o,s]=oe.useState(t),[i,a]=oe.useState(""),[c,u]=oe.useState(2),[l,d]=oe.useState(""),p=oe.useRef(null);oe.useEffect(()=>{if(!window.captchaZtgame){const y=document.createElement("script");y.type="text/javascript",y.src=`//nocaptcha.ztgame.com/static/verify2023/js/captcha.js?t=${new Date().getTime()}`,y.id="captchaZtgameScript",document.body.appendChild(y)}},[]);const{mutate:h,isPending:m}=sn({mutationFn:async y=>O1({account:o,nonce:y.nonce,token:y.token,type:y.type,t:"ctoken"}),onSuccess:y=>{const C=y.type;u(C),a(C===2?y.mobile:""),r("secure"),p.current?.onRefresh?.()},onError:y=>{gt.warning(y?.message||y?.detail||"验证失败"),p.current?.onRefresh?.()}}),g=()=>{if(!o){gt.warning("请输入账号信息");return}window.captchaZtgame?window.captchaZtgame.init({appsceneid:"pt_login",usertype:"1",el:"captcha-forget-pwd",mode:"popup",styles:{width:300,height:150,fontSize:"14px"},popupStyles:{position:"fixed",top:"30%",left:"50%",zIndex:"99999"},onSuccess(y,C){p.current=y,h({nonce:y.nonce,token:C.data.token,type:y.type})},onLoad(y){p.current=y,y.onVerify()},onFail(){}}):gt.warning("安全组件未加载,请稍后再试")},v=y=>{d(y),r("reset")};return w.jsxs("div",{className:"space-y-5",children:[w.jsx("div",{id:"captcha-forget-pwd"}),n==="account"&&w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",w.jsx("br",{}),"请输入您的账号信息"]}),w.jsx(Tn,{name:"account",placeholder:"请输入账号信息",autoFocus:!0,value:o,onChange:y=>s(y.currentTarget.value)}),w.jsx(Rt,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:g,disabled:!o||m,children:m?"验证中...":"下一步"})]}),n==="secure"&&(c===2?w.jsx(Y1,{account:o,mobile:i,onNext:v}):w.jsx(X1,{account:o,onNext:v})),n==="reset"&&w.jsx($1,{account:o,forgetPasswordKey:l,onSuccess:()=>r("success")}),n==="success"&&w.jsxs("div",{className:"space-y-4 py-6",children:[w.jsx("div",{className:"text-center text-lg font-medium text-gray-800",children:"重置密码成功"}),w.jsx(Rt,{className:"mt-6 h-10 w-full bg-gray-100 text-gray-700 rounded-full hover:bg-gray-200",onClick:()=>e?.(),children:"返回登录"})]})]})}function K1(){const{gameId:e,onAccountLoginSuccess:t,onLoginSuccess:n,onLoginError:r,triggerRealNameAuth:o}=Dn(),s=oe.useRef(null),[i,a]=oe.useState(""),[c,u]=oe.useState(""),[l,d]=oe.useState(!1),[p,h]=oe.useState(!0),[m,g]=oe.useState(!1),{mutate:v,isPending:y}=sn({mutationFn:()=>S1({account:i,password:c}),onSuccess:S=>{const E={account:S.account,entity:S.channel_info.entity,token:S.channel_info.token,sign:S.channel_info.sign,accid:S.channel_info.entity.openid,extra_data:S.channel_info.extra_data,gaplaySign:S.channel_info.gaplaySign,realname:S.channel_info.realname};if(Ns(E,S._auth,e),E.realname&&E.realname.reject>=2){o();return}t?.(E),n?.(E)},onError:S=>{r?.(S)}});async function C(S){if(S.preventDefault(),!p){gt.warning("请先阅读并同意用户协议和隐私政策");return}if(!i||!c){gt.warning("请输入账号和密码");return}v()}return w.jsx(w.Fragment,{children:w.jsxs(To,{ref:s,onSubmit:C,className:"space-y-5",children:[w.jsx(Tn,{name:"account",placeholder:e==="5327"?"请输入账号":"请输入巨人通行证账号",autoFocus:!0,onChange:S=>a(S.currentTarget.value),prefix:e==="5327"?w.jsx(y1,{className:"size-5 text-gray-400"}):w.jsx(R1,{className:"size-5 text-gray-400"})}),w.jsx(Tn,{name:"password",type:l?"text":"password",autoComplete:"off",placeholder:"请输入密码",value:c,onValueChange:S=>u(S),prefix:w.jsx(N1,{className:"size-5 text-gray-400"}),suffix:w.jsx(Rt,{onClick:()=>d(!l),type:"button",children:l?w.jsx(Up,{className:"size-5 text-gray-400"}):w.jsx(Hp,{className:"size-5 text-gray-400"})})}),w.jsxs("section",{children:[w.jsx("div",{className:"flex justify-end mb-1",children:w.jsx(Po,{title:"忘记密码",open:m,onOpenChange:g,trigger:w.jsx("button",{type:"button",className:"text-[var(--jssdk-primary-color)] text-sm",children:"忘记密码"}),children:w.jsx(q1,{onClose:()=>g(!1),defaultAccount:i})})}),w.jsx(Rt,{className:"h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",type:"submit",disabled:y,children:"登录"})]}),w.jsx(Qs,{}),w.jsx(qp,{checked:p,onChange:h})]})})}var Qp;function ee(e,t,n){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const u=i.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){const p=l[d];p in a||(a[p]=u[p].bind(a))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const u=n?.Parent?new s:this;r(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Gr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class eh extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Qp=globalThis).__zod_globalConfig??(Qp.__zod_globalConfig={});const kc=globalThis.__zod_globalConfig;function yr(e){return kc}function th(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Rc(e,t){return typeof t=="bigint"?t.toString():t}function Nc(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Mc(e){return e==null}function Ac(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const nh=Symbol("evaluating");function ot(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==nh)return r===void 0&&(r=nh,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function vr(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Jn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function rh(e){return JSON.stringify(e)}function J1(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const oh="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ti(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Q1=Nc(()=>{if(kc.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function _o(e){if(ti(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(ti(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function sh(e){return _o(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const ex=new Set(["string","number","symbol"]);function ni(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function ke(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function tx(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function nx(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=Jn(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=n.shape[a])}return vr(this,"shape",i),i},checks:[]});return Qn(e,s)}function rx(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=Jn(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return vr(this,"shape",i),i},checks:[]});return Qn(e,s)}function ox(e,t){if(!_o(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Jn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return vr(this,"shape",s),s}});return Qn(e,o)}function sx(e,t){if(!_o(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Jn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return vr(this,"shape",r),r}});return Qn(e,n)}function ix(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=Jn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return vr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Qn(e,n)}function ax(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=Jn(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(n)for(const u in n){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return vr(this,"shape",c),c},checks:[]});return Qn(t,i)}function cx(e,t,n){const r=Jn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return vr(this,"shape",s),s}});return Qn(t,r)}function Yr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ux(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ih(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function ri(e){return typeof e=="string"?e:e?.message}function br(e,t,n){const r=e.message?e.message:ri(e.inst?._zod.def?.error?.(e))??ri(t?.error?.(e))??ri(n.customError?.(e))??ri(n.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...a}=e;return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=i),a}function Dc(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Io(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const ah=(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,Rc,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ch=ee("$ZodError",ah),uh=ee("$ZodError",ah,{Parent:Error});function oi(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function lx(e,t=n=>n.message){const n={_errors:[]},r=(o,s=[])=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")r({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")r({issues:i.issues},[...s,...i.path]);else{const a=[...s,...i.path];if(a.length===0)n._errors.push(t(i));else{let c=n,u=0;for(;u<a.length;){const l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return r(e),n}const Lc=e=>(t,n,r,o)=>{const s=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Gr;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>br(c,s,yr())));throw oh(a,o?.callee),a}return i.value},Fc=e=>async(t,n,r,o)=>{const s=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>br(c,s,yr())));throw oh(a,o?.callee),a}return i.value},si=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Gr;return s.issues.length?{success:!1,error:new(e??ch)(s.issues.map(i=>br(i,o,yr())))}:{success:!0,data:s.value}},dx=si(uh),ii=e=>async(t,n,r)=>{const o=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>br(i,o,yr())))}:{success:!0,data:s.value}},fx=ii(uh),px=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Lc(e)(t,n,o)},hx=e=>(t,n,r)=>Lc(e)(t,n,r),mx=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Fc(e)(t,n,o)},gx=e=>async(t,n,r)=>Fc(e)(t,n,r),yx=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return si(e)(t,n,o)},vx=e=>(t,n,r)=>si(e)(t,n,r),bx=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return ii(e)(t,n,o)},wx=e=>async(t,n,r)=>ii(e)(t,n,r),Sx=/^[cC][0-9a-z]{6,}$/,Ex=/^[0-9a-z]+$/,xx=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Cx=/^[0-9a-vA-V]{20}$/,Tx=/^[A-Za-z0-9]{27}$/,Ox=/^[a-zA-Z0-9_-]{21}$/,Px=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_x=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,lh=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ix=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,kx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Rx(){return new RegExp(kx,"u")}const Nx=/^(?:(?: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])$/,Mx=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ax=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Dx=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Lx=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dh=/^[A-Za-z0-9_-]*$/,Fx=/^https?$/,Vx=/^\+[1-9]\d{6,14}$/,fh="(?:(?:\\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])))",zx=new RegExp(`^${fh}$`);function ph(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function $x(e){return new RegExp(`^${ph(e)}$`)}function jx(e){const t=ph({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${fh}T(?:${r})$`)}const Hx=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ux=/^[^A-Z]*$/,Bx=/^[^a-z]*$/,On=ee("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Wx=ee("$ZodCheckMaxLength",(e,t)=>{var n;On.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mc(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const i=Dc(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Zx=ee("$ZodCheckMinLength",(e,t)=>{var n;On.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mc(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const i=Dc(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Gx=ee("$ZodCheckLengthEquals",(e,t)=>{var n;On.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mc(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const i=Dc(o),a=s>t.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ai=ee("$ZodCheckStringFormat",(e,t)=>{var n,r;On.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Yx=ee("$ZodCheckRegex",(e,t)=>{ai.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xx=ee("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ux),ai.init(e,t)}),qx=ee("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Bx),ai.init(e,t)}),Kx=ee("$ZodCheckIncludes",(e,t)=>{On.init(e,t);const n=ni(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Jx=ee("$ZodCheckStartsWith",(e,t)=>{On.init(e,t);const n=new RegExp(`^${ni(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Qx=ee("$ZodCheckEndsWith",(e,t)=>{On.init(e,t);const n=new RegExp(`.*${ni(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),eC=ee("$ZodCheckOverwrite",(e,t)=>{On.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class tC{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
20
20
  `).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
21
21
  `))}}const nC={major:4,minor:4,patch:3},Et=ee("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=nC;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const s of o._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,a,c)=>{let u=Yr(i),l;for(const d of a){if(d._zod.def.when){if(ux(i)||!d._zod.def.when(i))continue}else if(u)continue;const p=i.issues.length,h=d._zod.check(i);if(h instanceof Promise&&c?.async===!1)throw new Gr;if(l||h instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await h,i.issues.length!==p&&(u||(u=Yr(i,p)))});else{if(i.issues.length===p)continue;u||(u=Yr(i,p))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(Yr(i))return i.aborted=!0,i;const u=o(a,r,c);if(u instanceof Promise){if(c.async===!1)throw new Gr;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Gr;return c.then(u=>o(u,r,a))}return o(c,r,a)}}ot(e,"~standard",()=>({validate:o=>{try{const s=dx(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return fx(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Vc=ee("$ZodString",(e,t)=>{Et.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Hx(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),pt=ee("$ZodStringFormat",(e,t)=>{ai.init(e,t),Vc.init(e,t)}),rC=ee("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=_x),pt.init(e,t)}),oC=ee("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=lh(r))}else t.pattern??(t.pattern=lh());pt.init(e,t)}),sC=ee("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ix),pt.init(e,t)}),iC=ee("$ZodURL",(e,t)=>{pt.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===Fx.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),aC=ee("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Rx()),pt.init(e,t)}),cC=ee("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ox),pt.init(e,t)}),uC=ee("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Sx),pt.init(e,t)}),lC=ee("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ex),pt.init(e,t)}),dC=ee("$ZodULID",(e,t)=>{t.pattern??(t.pattern=xx),pt.init(e,t)}),fC=ee("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Cx),pt.init(e,t)}),pC=ee("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Tx),pt.init(e,t)}),hC=ee("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=jx(t)),pt.init(e,t)}),mC=ee("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=zx),pt.init(e,t)}),gC=ee("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=$x(t)),pt.init(e,t)}),yC=ee("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Px),pt.init(e,t)}),vC=ee("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Nx),pt.init(e,t),e._zod.bag.format="ipv4"}),bC=ee("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Mx),pt.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),wC=ee("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ax),pt.init(e,t)}),SC=ee("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Dx),pt.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,s]=r;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function hh(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const EC=ee("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Lx),pt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{hh(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function xC(e){if(!dh.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return hh(n)}const CC=ee("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=dh),pt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{xC(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),TC=ee("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Vx),pt.init(e,t)});function OC(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const PC=ee("$ZodJWT",(e,t)=>{pt.init(e,t),e._zod.check=n=>{OC(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),_C=ee("$ZodUnknown",(e,t)=>{Et.init(e,t),e._zod.parse=n=>n}),IC=ee("$ZodNever",(e,t)=>{Et.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function mh(e,t,n){e.issues.length&&t.issues.push(...ih(n,e.issues)),t.value[n]=e.value}const kC=ee("$ZodArray",(e,t)=>{Et.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const a=o[i],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(u=>mh(u,n,i))):mh(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function ci(e,t,n,r,o,s){const i=n in r;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...ih(n,e.issues))}if(!i&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?i&&(t.value[n]=void 0):t.value[n]=e.value}function gh(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=tx(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function yh(e,t,n,r,o,s){const i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optin==="optional",d=c.optout==="optional";for(const p in t){if(p==="__proto__"||a.has(p))continue;if(u==="never"){i.push(p);continue}const h=c.run({value:t[p],issues:[]},r);h instanceof Promise?e.push(h.then(m=>ci(m,n,p,t,l,d))):ci(h,n,p,t,l,d)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const RC=ee("$ZodObject",(e,t)=>{if(Et.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=Nc(()=>gh(t));ot(e._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(const d of l.values)c[u].add(d)}}return c});const o=ti,s=t.catchall;let i;e._zod.parse=(a,c)=>{i??(i=r.value);const u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};const l=[],d=i.shape;for(const p of i.keys){const h=d[p],m=h._zod.optin==="optional",g=h._zod.optout==="optional",v=h._zod.run({value:u[p],issues:[]},c);v instanceof Promise?l.push(v.then(y=>ci(y,a,p,u,m,g))):ci(v,a,p,u,m,g)}return s?yh(l,u,a,c,r.value,e):l.length?Promise.all(l).then(()=>a):a}}),NC=ee("$ZodObjectJIT",(e,t)=>{RC.init(e,t);const n=e._zod.parse,r=Nc(()=>gh(t)),o=p=>{const h=new tC(["shape","payload","ctx"]),m=r.value,g=S=>{const E=rh(S);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};h.write("const input = payload.value;");const v=Object.create(null);let y=0;for(const S of m.keys)v[S]=`key_${y++}`;h.write("const newResult = {};");for(const S of m.keys){const E=v[S],b=rh(S),x=p[S],T=x?._zod?.optin==="optional",P=x?._zod?.optout==="optional";h.write(`const ${E} = ${g(S)};`),T&&P?h.write(`
22
22
  if (${E}.issues.length) {
@@ -79,4 +79,4 @@ Avoid returning a new reference inside your input selector, e.g.
79
79
 
80
80
  `)}h.write("payload.value = newResult;"),h.write("return payload;");const C=h.compile();return(S,E)=>C(p,S,E)};let s;const i=ti,a=!kc.jitless,u=a&&Q1.value,l=t.catchall;let d;e._zod.parse=(p,h)=>{d??(d=r.value);const m=p.value;return i(m)?a&&u&&h?.async===!1&&h.jitless!==!0?(s||(s=o(t.shape)),p=s(p,h),l?yh([],m,p,h,d,e):p):n(p,h):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),p)}});function vh(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Yr(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>br(i,r,yr())))}),t)}const MC=ee("$ZodUnion",(e,t)=>{Et.init(e,t),ot(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ot(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ot(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),ot(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${r.map(o=>Ac(o.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let s=!1;const i=[];for(const a of t.options){const c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>vh(a,r,e,o)):vh(i,r,e,o)}}),AC=ee("$ZodIntersection",(e,t)=>{Et.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>bh(n,c,u)):bh(n,s,i)}});function zc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(_o(e)&&_o(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const i=zc(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],i=zc(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function bh(e,t,n){const r=new Map;let o;for(const a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&e.issues.push({...o,keys:s}),Yr(e))return e;const i=zc(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const DC=ee("$ZodEnum",(e,t)=>{Et.init(e,t);const n=th(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>ex.has(typeof o)).map(o=>typeof o=="string"?ni(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:n,input:i,inst:e}),o}}),LC=ee("$ZodTransform",(e,t)=>{Et.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new eh(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n.fallback=!0,n));if(o instanceof Promise)throw new Gr;return n.value=o,n.fallback=!0,n}});function wh(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Sh=ee("$ZodOptional",(e,t)=>{Et.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ot(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ot(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ac(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=n.value,s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>wh(i,o)):wh(s,o)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),FC=ee("$ZodExactOptional",(e,t)=>{Sh.init(e,t),ot(e._zod,"values",()=>t.innerType._zod.values),ot(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),VC=ee("$ZodNullable",(e,t)=>{Et.init(e,t),ot(e._zod,"optin",()=>t.innerType._zod.optin),ot(e._zod,"optout",()=>t.innerType._zod.optout),ot(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ac(n.source)}|null)$`):void 0}),ot(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),zC=ee("$ZodDefault",(e,t)=>{Et.init(e,t),e._zod.optin="optional",ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Eh(s,t)):Eh(o,t)}});function Eh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const $C=ee("$ZodPrefault",(e,t)=>{Et.init(e,t),e._zod.optin="optional",ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),jC=ee("$ZodNonOptional",(e,t)=>{Et.init(e,t),ot(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>xh(s,e)):xh(o,e)}});function xh(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const HC=ee("$ZodCatch",(e,t)=>{Et.init(e,t),e._zod.optin="optional",ot(e._zod,"optout",()=>t.innerType._zod.optout),ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>br(i,r,yr()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>br(s,r,yr()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),UC=ee("$ZodPipe",(e,t)=>{Et.init(e,t),ot(e._zod,"values",()=>t.in._zod.values),ot(e._zod,"optin",()=>t.in._zod.optin),ot(e._zod,"optout",()=>t.out._zod.optout),ot(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>ui(i,t.in,r)):ui(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>ui(s,t.out,r)):ui(o,t.out,r)}});function ui(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const BC=ee("$ZodReadonly",(e,t)=>{Et.init(e,t),ot(e._zod,"propValues",()=>t.innerType._zod.propValues),ot(e._zod,"values",()=>t.innerType._zod.values),ot(e._zod,"optin",()=>t.innerType?._zod?.optin),ot(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Ch):Ch(o)}});function Ch(e){return e.value=Object.freeze(e.value),e}const WC=ee("$ZodCustom",(e,t)=>{On.init(e,t),Et.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>Th(s,n,r,e));Th(o,n,r,e)}});function Th(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Io(o))}}var Oh;class ZC{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function GC(){return new ZC}(Oh=globalThis).__zod_globalRegistry??(Oh.__zod_globalRegistry=GC());const ko=globalThis.__zod_globalRegistry;function YC(e,t){return new e({type:"string",...ke(t)})}function XC(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ke(t)})}function Ph(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ke(t)})}function qC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ke(t)})}function KC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ke(t)})}function JC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ke(t)})}function QC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ke(t)})}function eT(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ke(t)})}function tT(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ke(t)})}function nT(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ke(t)})}function rT(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ke(t)})}function oT(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ke(t)})}function sT(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ke(t)})}function iT(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ke(t)})}function aT(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ke(t)})}function cT(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ke(t)})}function uT(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ke(t)})}function lT(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ke(t)})}function dT(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ke(t)})}function fT(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ke(t)})}function pT(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ke(t)})}function hT(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ke(t)})}function mT(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ke(t)})}function gT(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ke(t)})}function yT(e,t){return new e({type:"string",format:"date",check:"string_format",...ke(t)})}function vT(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ke(t)})}function bT(e,t){return new e({type:"string",format:"duration",check:"string_format",...ke(t)})}function wT(e){return new e({type:"unknown"})}function ST(e,t){return new e({type:"never",...ke(t)})}function _h(e,t){return new Wx({check:"max_length",...ke(t),maximum:e})}function li(e,t){return new Zx({check:"min_length",...ke(t),minimum:e})}function Ih(e,t){return new Gx({check:"length_equals",...ke(t),length:e})}function ET(e,t){return new Yx({check:"string_format",format:"regex",...ke(t),pattern:e})}function xT(e){return new Xx({check:"string_format",format:"lowercase",...ke(e)})}function CT(e){return new qx({check:"string_format",format:"uppercase",...ke(e)})}function TT(e,t){return new Kx({check:"string_format",format:"includes",...ke(t),includes:e})}function OT(e,t){return new Jx({check:"string_format",format:"starts_with",...ke(t),prefix:e})}function PT(e,t){return new Qx({check:"string_format",format:"ends_with",...ke(t),suffix:e})}function Xr(e){return new eC({check:"overwrite",tx:e})}function _T(e){return Xr(t=>t.normalize(e))}function IT(){return Xr(e=>e.trim())}function kT(){return Xr(e=>e.toLowerCase())}function RT(){return Xr(e=>e.toUpperCase())}function NT(){return Xr(e=>J1(e))}function MT(e,t,n){return new e({type:"array",element:t,...ke(n)})}function AT(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ke(n)})}function DT(e,t){const n=LT(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Io(o,r.value,n._zod.def));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(Io(s))}},e(r.value,r)),t);return n}function LT(e,t){const n=new On({check:"custom",...ke(t)});return n._zod.check=e,n}function kh(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ko,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function It(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{const p=i.schema,h=t.processors[o.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);h(e,t,p,l)}const d=e._zod.parent;d&&(i.ref||(i.ref=d),It(d,t,l),t.seen.get(d).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&zt(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Rh(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const i of e.seen.entries()){const a=e.metadataRegistry.get(i[0])?.id;if(a){const c=r.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,i[0])}}const o=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const d=e.external.registry.get(i[0])?.id,p=e.external.uri??(m=>m);if(d)return{ref:p(d)};const h=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=h,{defId:h,ref:`${p("__shared")}#/${a}/${h}`}}if(i[1]===n)return{ref:"#"};const u=`#/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:c,defId:u}=o(i);a.def={...a.schema},u&&(a.defId=u);const l=a.schema;for(const d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
81
81
 
82
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(t===i[0]){s(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Nh(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=a=>{const c=e.seen.get(a);if(c.ref===null)return;const u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){r(d);const h=e.seen.get(d),m=h.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Object.assign(u,m),Object.assign(u,l),a._zod.parent===d)for(const v in u)v==="$ref"||v==="allOf"||v in l||delete u[v];if(m.$ref&&h.def)for(const v in u)v==="$ref"||v==="allOf"||v in h.def&&JSON.stringify(u[v])===JSON.stringify(h.def[v])&&delete u[v]}const p=a._zod.parent;if(p&&p!==d){r(p);const h=e.seen.get(p);if(h?.schema.$ref&&(u.$ref=h.schema.$ref,h.def))for(const m in u)m==="$ref"||m==="allOf"||m in h.def&&JSON.stringify(u[m])===JSON.stringify(h.def[m])&&delete u[m]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(const a of[...e.seen.entries()].reverse())r(a[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,n.def??n.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;const i=e.external?.defs??{};for(const a of e.seen.entries()){const c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:di(t,"input",e.processors),output:di(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function zt(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return zt(r.element,n);if(r.type==="set")return zt(r.valueType,n);if(r.type==="lazy")return zt(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return zt(r.innerType,n);if(r.type==="intersection")return zt(r.left,n)||zt(r.right,n);if(r.type==="record"||r.type==="map")return zt(r.keyType,n)||zt(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:zt(r.in,n)||zt(r.out,n);if(r.type==="object"){for(const o in r.shape)if(zt(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(zt(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(zt(o,n))return!0;return!!(r.rest&&zt(r.rest,n))}return!1}const FT=(e,t={})=>n=>{const r=kh({...n,processors:t});return It(e,r),Rh(r,e),Nh(r,e)},di=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=kh({...o??{},target:s,io:t,processors:n});return It(e,i),Rh(i,e),Nh(i,e)},VT={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},zT=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=VT[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){const l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},$T=(e,t,n,r)=>{n.not={}},jT=(e,t,n,r)=>{},HT=(e,t,n,r)=>{const o=e._zod.def,s=th(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},UT=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},BT=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},WT=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=It(s.element,t,{...r,path:[...r.path,"items"]})},ZT=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object",o.properties={};const i=s.shape;for(const u in i)o.properties[u]=It(i[u],t,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{const l=s.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=It(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},GT=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>It(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},YT=(e,t,n,r)=>{const o=e._zod.def,s=It(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=It(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=c},XT=(e,t,n,r)=>{const o=e._zod.def,s=It(o.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},qT=(e,t,n,r)=>{const o=e._zod.def;It(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},KT=(e,t,n,r)=>{const o=e._zod.def;It(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},JT=(e,t,n,r)=>{const o=e._zod.def;It(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},QT=(e,t,n,r)=>{const o=e._zod.def;It(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},eO=(e,t,n,r)=>{const o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;It(i,t,r);const a=t.seen.get(e);a.ref=i},tO=(e,t,n,r)=>{const o=e._zod.def;It(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},Mh=(e,t,n,r)=>{const o=e._zod.def;It(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},nO=ee("ZodISODateTime",(e,t)=>{hC.init(e,t),ht.init(e,t)});function rO(e){return gT(nO,e)}const oO=ee("ZodISODate",(e,t)=>{mC.init(e,t),ht.init(e,t)});function sO(e){return yT(oO,e)}const iO=ee("ZodISOTime",(e,t)=>{gC.init(e,t),ht.init(e,t)});function aO(e){return vT(iO,e)}const cO=ee("ZodISODuration",(e,t)=>{yC.init(e,t),ht.init(e,t)});function uO(e){return bT(cO,e)}const nn=ee("ZodError",(e,t)=>{ch.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>lx(e,n)},flatten:{value:n=>oi(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Rc,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Rc,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),lO=Lc(nn),dO=Fc(nn),fO=si(nn),pO=ii(nn),hO=px(nn),mO=hx(nn),gO=mx(nn),yO=gx(nn),vO=yx(nn),bO=vx(nn),wO=bx(nn),SO=wx(nn),Ah=new WeakMap;function fi(e,t,n){const r=Object.getPrototypeOf(e);let o=Ah.get(r);if(o||(o=new Set,Ah.set(r,o)),!o.has(t)){o.add(t);for(const s in n){const i=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){const a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const xt=ee("ZodType",(e,t)=>(Et.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:di(e,"input"),output:di(e,"output")}}),e.toJSONSchema=FT(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>lO(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>fO(e,n,r),e.parseAsync=async(n,r)=>dO(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>pO(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>hO(e,n,r),e.decode=(n,r)=>mO(e,n,r),e.encodeAsync=async(n,r)=>gO(e,n,r),e.decodeAsync=async(n,r)=>yO(e,n,r),e.safeEncode=(n,r)=>vO(e,n,r),e.safeDecode=(n,r)=>bO(e,n,r),e.safeEncodeAsync=async(n,r)=>wO(e,n,r),e.safeDecodeAsync=async(n,r)=>SO(e,n,r),fi(e,"ZodType",{check(...n){const r=this.def;return this.clone(Jn(r,{checks:[...r.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return Qn(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(pP(n,r))},superRefine(n,r){return this.check(hP(n,r))},overwrite(n){return this.check(Xr(n))},optional(){return $h(this)},exactOptional(){return eP(this)},nullable(){return jh(this)},nullish(){return $h(jh(this))},nonoptional(n){return iP(this,n)},array(){return BO(this)},or(n){return GO([this,n])},and(n){return XO(this,n)},transform(n){return Uh(this,JO(n))},default(n){return rP(this,n)},prefault(n){return sP(this,n)},catch(n){return cP(this,n)},pipe(n){return Uh(this,n)},readonly(){return dP(this)},describe(n){const r=this.clone();return ko.add(r,{description:n}),r},meta(...n){if(n.length===0)return ko.get(this);const r=this.clone();return ko.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return ko.get(e)?.description},configurable:!0}),e)),Dh=ee("_ZodString",(e,t)=>{Vc.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(r,o,s)=>zT(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,fi(e,"_ZodString",{regex(...r){return this.check(ET(...r))},includes(...r){return this.check(TT(...r))},startsWith(...r){return this.check(OT(...r))},endsWith(...r){return this.check(PT(...r))},min(...r){return this.check(li(...r))},max(...r){return this.check(_h(...r))},length(...r){return this.check(Ih(...r))},nonempty(...r){return this.check(li(1,...r))},lowercase(r){return this.check(xT(r))},uppercase(r){return this.check(CT(r))},trim(){return this.check(IT())},normalize(...r){return this.check(_T(...r))},toLowerCase(){return this.check(kT())},toUpperCase(){return this.check(RT())},slugify(){return this.check(NT())}})}),EO=ee("ZodString",(e,t)=>{Vc.init(e,t),Dh.init(e,t),e.email=n=>e.check(XC(xO,n)),e.url=n=>e.check(eT(CO,n)),e.jwt=n=>e.check(mT(zO,n)),e.emoji=n=>e.check(tT(TO,n)),e.guid=n=>e.check(Ph(Lh,n)),e.uuid=n=>e.check(qC(hi,n)),e.uuidv4=n=>e.check(KC(hi,n)),e.uuidv6=n=>e.check(JC(hi,n)),e.uuidv7=n=>e.check(QC(hi,n)),e.nanoid=n=>e.check(nT(OO,n)),e.guid=n=>e.check(Ph(Lh,n)),e.cuid=n=>e.check(rT(PO,n)),e.cuid2=n=>e.check(oT(_O,n)),e.ulid=n=>e.check(sT(IO,n)),e.base64=n=>e.check(fT(LO,n)),e.base64url=n=>e.check(pT(FO,n)),e.xid=n=>e.check(iT(kO,n)),e.ksuid=n=>e.check(aT(RO,n)),e.ipv4=n=>e.check(cT(NO,n)),e.ipv6=n=>e.check(uT(MO,n)),e.cidrv4=n=>e.check(lT(AO,n)),e.cidrv6=n=>e.check(dT(DO,n)),e.e164=n=>e.check(hT(VO,n)),e.datetime=n=>e.check(rO(n)),e.date=n=>e.check(sO(n)),e.time=n=>e.check(aO(n)),e.duration=n=>e.check(uO(n))});function pi(e){return YC(EO,e)}const ht=ee("ZodStringFormat",(e,t)=>{pt.init(e,t),Dh.init(e,t)}),xO=ee("ZodEmail",(e,t)=>{sC.init(e,t),ht.init(e,t)}),Lh=ee("ZodGUID",(e,t)=>{rC.init(e,t),ht.init(e,t)}),hi=ee("ZodUUID",(e,t)=>{oC.init(e,t),ht.init(e,t)}),CO=ee("ZodURL",(e,t)=>{iC.init(e,t),ht.init(e,t)}),TO=ee("ZodEmoji",(e,t)=>{aC.init(e,t),ht.init(e,t)}),OO=ee("ZodNanoID",(e,t)=>{cC.init(e,t),ht.init(e,t)}),PO=ee("ZodCUID",(e,t)=>{uC.init(e,t),ht.init(e,t)}),_O=ee("ZodCUID2",(e,t)=>{lC.init(e,t),ht.init(e,t)}),IO=ee("ZodULID",(e,t)=>{dC.init(e,t),ht.init(e,t)}),kO=ee("ZodXID",(e,t)=>{fC.init(e,t),ht.init(e,t)}),RO=ee("ZodKSUID",(e,t)=>{pC.init(e,t),ht.init(e,t)}),NO=ee("ZodIPv4",(e,t)=>{vC.init(e,t),ht.init(e,t)}),MO=ee("ZodIPv6",(e,t)=>{bC.init(e,t),ht.init(e,t)}),AO=ee("ZodCIDRv4",(e,t)=>{wC.init(e,t),ht.init(e,t)}),DO=ee("ZodCIDRv6",(e,t)=>{SC.init(e,t),ht.init(e,t)}),LO=ee("ZodBase64",(e,t)=>{EC.init(e,t),ht.init(e,t)}),FO=ee("ZodBase64URL",(e,t)=>{CC.init(e,t),ht.init(e,t)}),VO=ee("ZodE164",(e,t)=>{TC.init(e,t),ht.init(e,t)}),zO=ee("ZodJWT",(e,t)=>{PC.init(e,t),ht.init(e,t)}),$O=ee("ZodUnknown",(e,t)=>{_C.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jT()});function Fh(){return wT($O)}const jO=ee("ZodNever",(e,t)=>{IC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$T(e,n,r)});function HO(e){return ST(jO,e)}const UO=ee("ZodArray",(e,t)=>{kC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>WT(e,n,r,o),e.element=t.element,fi(e,"ZodArray",{min(n,r){return this.check(li(n,r))},nonempty(n){return this.check(li(1,n))},max(n,r){return this.check(_h(n,r))},length(n,r){return this.check(Ih(n,r))},unwrap(){return this.element}})});function BO(e,t){return MT(UO,e,t)}const WO=ee("ZodObject",(e,t)=>{NC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ZT(e,n,r,o),ot(e,"shape",()=>t.shape),fi(e,"ZodObject",{keyof(){return qO(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Fh()})},loose(){return this.clone({...this._zod.def,catchall:Fh()})},strict(){return this.clone({...this._zod.def,catchall:HO()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return ox(this,n)},safeExtend(n){return sx(this,n)},merge(n){return ix(this,n)},pick(n){return nx(this,n)},omit(n){return rx(this,n)},partial(...n){return ax(zh,this,n[0])},required(...n){return cx(Hh,this,n[0])}})});function Vh(e,t){const n={type:"object",shape:e??{},...ke(t)};return new WO(n)}const ZO=ee("ZodUnion",(e,t)=>{MC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>GT(e,n,r,o),e.options=t.options});function GO(e,t){return new ZO({type:"union",options:e,...ke(t)})}const YO=ee("ZodIntersection",(e,t)=>{AC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>YT(e,n,r,o)});function XO(e,t){return new YO({type:"intersection",left:e,right:t})}const $c=ee("ZodEnum",(e,t)=>{DC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(r,o,s)=>HT(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new $c({...t,checks:[],...ke(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new $c({...t,checks:[],...ke(o),entries:s})}});function qO(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new $c({type:"enum",entries:n,...ke(t)})}const KO=ee("ZodTransform",(e,t)=>{LC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>BT(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new eh(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Io(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(Io(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function JO(e){return new KO({type:"transform",transform:e})}const zh=ee("ZodOptional",(e,t)=>{Sh.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function $h(e){return new zh({type:"optional",innerType:e})}const QO=ee("ZodExactOptional",(e,t)=>{FC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function eP(e){return new QO({type:"optional",innerType:e})}const tP=ee("ZodNullable",(e,t)=>{VC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>XT(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function jh(e){return new tP({type:"nullable",innerType:e})}const nP=ee("ZodDefault",(e,t)=>{zC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>KT(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function rP(e,t){return new nP({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():sh(t)}})}const oP=ee("ZodPrefault",(e,t)=>{$C.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>JT(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function sP(e,t){return new oP({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():sh(t)}})}const Hh=ee("ZodNonOptional",(e,t)=>{jC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qT(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function iP(e,t){return new Hh({type:"nonoptional",innerType:e,...ke(t)})}const aP=ee("ZodCatch",(e,t)=>{HC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>QT(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function cP(e,t){return new aP({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const uP=ee("ZodPipe",(e,t)=>{UC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>eO(e,n,r,o),e.in=t.in,e.out=t.out});function Uh(e,t){return new uP({type:"pipe",in:e,out:t})}const lP=ee("ZodReadonly",(e,t)=>{BC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tO(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function dP(e){return new lP({type:"readonly",innerType:e})}const fP=ee("ZodCustom",(e,t)=>{WC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>UT(e,n)});function pP(e,t={}){return AT(fP,e,t)}function hP(e,t){return DT(e,t)}const wr={trigger:"_trigger_1e3h3_1",popup:"_popup_1e3h3_5",item:"_item_1e3h3_24",indicator:"_indicator_1e3h3_40",itemText:"_itemText_1e3h3_44",itemCode:"_itemCode_1e3h3_48",itemLabel:"_itemLabel_1e3h3_52"};function mP({value:e,onValueChange:t}){const{gameId:n}=Dn(),r=dS(),o=f.useMemo(()=>r.find(i=>i.id===e||i.value===e)?.id||e,[r,e]);return w.jsxs(n1,{value:o,onValueChange:s=>{const i=r.find(a=>a.id===s);i&&t?.(i.value)},children:[w.jsxs(Pp,{className:wr.trigger,children:[w.jsx("span",{children:r.find(s=>s.id===o)?.value}),w.jsx(jp,{className:"size-4"})]}),w.jsx(Ip,{children:w.jsx(kp,{className:"outline-none z-[999]",sideOffset:-4,align:"start",children:w.jsx(Rp,{className:wr.popup,children:r.map(({label:s,value:i,id:a})=>w.jsxs(Dp,{value:a,className:wr.item,children:[w.jsx(Lp,{className:wr.indicator,children:w.jsx(Pc,{className:"size-3"})}),w.jsxs(Vp,{className:wr.itemText,children:[w.jsx("span",{className:wr.itemCode,children:i}),w.jsx("span",{className:wr.itemLabel,children:s})]})]},a))})})})]})}const Bh=Vh({phoneNumber:pi().regex(/^[1-9]\d{10}$/,"请输入正确的手机号"),verificationCode:pi().length(4,"请输入 6 位验证码")});function Wh(){const{mobileLoginConfig:e={},gameId:t,onPhoneLoginSuccess:n,onLoginSuccess:r,onLoginError:o,triggerRealNameAuth:s}=Dn(),[i,a]=oe.useState("86"),[c,u]=oe.useState(""),l=oe.useRef(null),[d,p]=oe.useState(""),[h,m]=oe.useState(),[g,v]=oe.useState(!0),[y,C]=oe.useState({}),[S]=Jp({leftTime:h?h*1e3:void 0,interval:1e3,onEnd(){m(void 0)}}),{mutate:E,isPending:b}=sn({mutationFn:()=>E1({mobile:c,countryCode:i,type:e.smsType}),onSuccess:I=>{m(I.lock_time),gt.success("验证码已发送,请注意查收")}}),{mutate:x,isPending:T}=sn({mutationFn:async()=>{const I=await x1({mobile:c,countryCode:i,captcha:d});m(void 0);const D={account:I.account,entity:I.channel_info.entity,token:I.channel_info.token,sign:I.channel_info.sign,accid:I.channel_info.entity.openid,extra_data:I.channel_info.extra_data,gaplaySign:I.channel_info.gaplaySign,realname:I.channel_info.realname};if(Ns(D,I._auth,t),D.realname&&D.realname.reject>=2){s();return}return n&&await n(D),r?.(D),I},onError:I=>{o?.(I)}});function P(){if(!g){gt.warning("请先阅读并同意用户协议和隐私政策");return}const I=new FormData(l.current),D=Bh.pick({phoneNumber:!0}).safeParse(Object.fromEntries(I));if(!D.success){C(oi(D.error).fieldErrors);return}E()}async function z(I){if(I.preventDefault(),!g)return gt.warning("请先阅读并同意用户协议和隐私政策"),{errors:{}};const D=new FormData(I.currentTarget),$=Bh.safeParse(Object.fromEntries(D));return $.success?(x(),{errors:{}}):{errors:oi($.error).fieldErrors}}return w.jsx(w.Fragment,{children:w.jsxs(To,{ref:l,errors:y,onSubmit:async I=>{const D=await z(I);C(D.errors)},className:"space-y-5",children:[w.jsx(Tn,{name:"phoneNumber",placeholder:"请输入手机号码",autoFocus:!0,type:"tel",onChange:I=>u(I.currentTarget.value),prefix:w.jsx(mP,{value:i,onValueChange:a})}),w.jsx(Tn,{name:"verificationCode",placeholder:"请输入验证码",value:d,type:"number",onValueChange:I=>p(I),suffix:w.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-white inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onClick:()=>P(),disabled:!!h||b,children:b?"发送中...":h?`${Math.round(S/1e3)}s 后重新获取`:"获取验证码"})}),w.jsx(Rt,{className:St("my-5 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",e.buttonClassName),disabled:T,type:"submit",children:T?"登录中...":e.buttonText||"登录"}),w.jsx(Qs,{}),w.jsx(qp,{checked:g,onChange:v})]})})}function gP(e){return w.jsxs("svg",{width:"20",height:"10",viewBox:"0 0 20 10",fill:"none",...e,children:[w.jsx("path",{d:"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z",className:"fill-current"}),w.jsx("path",{d:"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z",className:"fill-current"})]})}function yP({children:e,title:t,description:n,content:r,classNames:o={}}){return w.jsxs(YE,{children:[w.jsx(hp,{className:o.trigger,delay:0,children:e}),w.jsxs(mp,{children:[w.jsx(Sp,{className:St("fixed inset-0 bg-black/20 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",o.backdrop)}),w.jsx(yp,{sideOffset:8,className:o.positioner,children:w.jsxs(bp,{className:St("origin-[var(--transform-origin)] bg-white p-1 rounded shadow-sm text-gray-900 transition-[transform,scale,opacity] data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 dark:shadow-none dark:-outline-offset-1 dark:outline-gray-300",o.popup),children:[w.jsx(wp,{className:St("data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=left]:rotate-90 data-[side=right]:left-[-13px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180",o.arrow),children:w.jsx(gP,{})}),t&&w.jsx(Ep,{className:"text-base font-medium",children:t}),n&&w.jsx(xp,{className:"text-base text-gray-600",children:n}),r]})})]})]})}const Sr={uidGet:"_uidGet_os9yc_1",mailCodeGet:"_mailCodeGet_os9yc_5",uidGetPopup:"_uidGetPopup_os9yc_79",uidGetArrow:"_uidGetArrow_os9yc_83",inputControl:"_inputControl_os9yc_86",form:"_form_os9yc_89"};function Zh({onUidLoginSuccess:e,customSendUidMailCaptcha:t,customValidateUidMailCaptcha:n}={}){const{gameId:r,autoLoginConfig:o,sceneId:s,onUidLoginSuccess:i,onLoginSuccess:a,onLoginError:c,uidLoginConfig:u={}}=Dn(),l=oe.useRef(null),[d,p]=oe.useState(""),[h,m]=oe.useState(""),[g,v]=oe.useState(!0),[y,C]=oe.useState(!1),[S,{startCountdown:E,resetCountdown:b}]=F1({countStart:120,intervalMs:1e3}),{mutate:x}=sn({mutationFn:()=>{const I=o.enabled?o.days:void 0;return n?n({gameId:r,captcha:h,expireInDays:g?I:void 0,accountId:d,sceneId:s}):w1({game_id:r,charid:d,captcha_type:"login",captcha:h,expires_day:g?I:void 0,scene_id:s,...u.uidMailExtraParams})},onSuccess:I=>{i?.(I),e?.(I),a?.(I)},onError:I=>{c?.(I)}}),{mutate:T,isPending:P}=sn({mutationFn:()=>t?t({gameId:r,accountId:d}):b1({game_id:r,captcha_type:"login",charid:d,scene_id:s,...u.uidMailExtraParams}),onSuccess:I=>{E(),gt.success(I.error)}});async function z(I){I.preventDefault(),x()}return oe.useEffect(()=>{h.length===6&&d&&setTimeout(()=>{l.current?.requestSubmit()},0)},[h,d]),oe.useEffect(()=>{S===0&&b(),C(S!==120)},[S,b]),w.jsxs(To,{ref:l,onSubmit:z,className:St("space-y-6",Sr.form),autoComplete:"off",children:[["5199","5012"].includes(r)?w.jsx("p",{className:"text-center text-xs text-white/80",children:"请点击游戏右上角“设置”查看账号ID"}):null,w.jsx(Tn,{name:"accountId",className:St(Sr.inputControl,"bg-[var(--jssdk-input-bg-color)]"),inputClassName:"bg-inherit",placeholder:"请输入账号 ID",autoFocus:!0,type:"tel",onChange:I=>p(I.currentTarget.value),prefix:w.jsx(yP,{content:w.jsx("div",{className:St(Sr.uidGet,u.uidGetterImageClassName)}),classNames:{backdrop:"z-[992]",positioner:"z-[992]",popup:St("rounded-2xl shadow-lg",Sr.uidGetPopup),arrow:Sr.uidGetArrow,trigger:"size-5 lg:size-6 lg:text-2xl rounded-full bg-[var(--jssdk-icon-color)] inline-flex items-center justify-center text-white focus:outline focus:outline-2"},children:w.jsx("span",{children:"!"})})}),w.jsx(Tn,{name:"verificationCode",className:St(Sr.inputControl,"bg-[var(--jssdk-input-bg-color)]"),inputClassName:"bg-inherit",placeholder:"请输入口令码",value:h,type:"tel",onValueChange:I=>m(I),prefix:w.jsx(Po,{trigger:w.jsx("span",{children:"!"}),classNames:{trigger:"size-5 lg:size-6 lg:text-2xl rounded-full bg-[var(--jssdk-icon-color)] inline-flex items-center justify-center text-white focus:outline focus:outline-2",popup:"w-full lg:w-4/5 lg:max-w-5xl p-0 bg-transparent"},children:w.jsx("div",{className:St(Sr.mailCodeGet,u.mailCodeGetterImageClassName)})}),suffix:w.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-[var(--jssdk-primary-foregroud-color)] inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onMouseDown:I=>{I.preventDefault()},onClick:()=>T(),disabled:y||P||!d,children:y?`${S}s`:P?"发送中...":"发送口令码"})}),o.enabled?w.jsx(Wr,{name:"rememberLogin",children:w.jsxs(gc,{className:"flex items-center gap-2 text-gray-500",onMouseDown:I=>{I.preventDefault()},children:[w.jsx(sc,{checked:g,className:"size-5 flex items-center justify-center rounded-full border-2 data-[checked]:border-[var(--jssdk-primary-color)] data-[unchecked]:border-gray-300",onCheckedChange:I=>v(!!I),children:w.jsx(ic,{children:w.jsx(Pc,{className:"size-3 text-[var(--jssdk-primary-color)]",strokeWidth:4})})}),w.jsxs("div",{children:[w.jsx("span",{className:"mr-0.5",children:o.days}),w.jsx("span",{children:"天内自动登录"})]})]})}):null,["5199","5012"].includes(r)?w.jsx("div",{className:"text-[#f59e9e] text-center text-[11px]",children:"请点击游戏内“邮件”查收口令码,未收到请重启游戏再次查看"}):null,w.jsx(Qs,{})]})}const Ht={quickLogin:"_quickLogin_1ibz1_1",quickAccounts:"_quickAccounts_1ibz1_5",selectedAccount:"_selectedAccount_1ibz1_9",accountInfo:"_accountInfo_1ibz1_21",accountName:"_accountName_1ibz1_26",arrow:"_arrow_1ibz1_31",arrowRotate:"_arrowRotate_1ibz1_37",accountList:"_accountList_1ibz1_41",listScroll:"_listScroll_1ibz1_49",accountItem:"_accountItem_1ibz1_58",active:"_active_1ibz1_77",itemName:"_itemName_1ibz1_81",itemInfo:"_itemInfo_1ibz1_86",deleteBtn:"_deleteBtn_1ibz1_97"};function vP(){const{gameId:e,onLoginSuccess:t,triggerRealNameAuth:n,setCurrentLoginType:r,defaultLoginType:o}=Dn(),[s,i]=oe.useState([]),[a,c]=oe.useState(null),[u,l]=oe.useState(!1),[d,p]=oe.useState(!1),[h,m]=oe.useState(!1),[g,v]=oe.useState(-1);oe.useEffect(()=>{y()},[e]);const y=()=>{const x=$r(e);i(x),x.length>0?(!a||!x.find(T=>T.openid===a.openid))&&c(x[0]):c(null)},C=x=>{c(s[x]),l(!1)},S=(x,T)=>{x.stopPropagation(),v(T),m(!0)},E=()=>{const x=s[g];if(x){sf(x.openid,e);const T=$r(e);if(T.length===0){r(o);return}i(T),T.find(P=>P.openid===a?.openid)||c(T[0])}m(!1),v(-1)},b=async()=>{if(a){p(!0);try{Qd(a.authorization);const x=await Wp(),T={account:x.account,entity:x.channel_info.entity,token:x.channel_info.token,sign:x.channel_info.sign,accid:x.channel_info.entity.openid,extra_data:x.channel_info.extra_data,gaplaySign:x.channel_info.gaplaySign,realname:x.channel_info.realname};if(Ns(T,a.authorization,e),T.realname&&T.realname.reject>=2){n();return}t?.(T)}catch(x){gt.error(x?.detail),console.error("Quick login failed:",x)}finally{p(!1)}}};return s.length===0?null:w.jsxs("div",{className:Ht.quickLogin,children:[w.jsxs("div",{className:Ht.quickAccounts,children:[w.jsxs("div",{className:Ht.selectedAccount,onClick:()=>l(!u),children:[w.jsx("div",{className:Ht.accountInfo,children:w.jsx("span",{className:Ht.accountName,children:a?.username})}),w.jsx(jp,{className:St(Ht.arrow,u&&Ht.arrowRotate)})]}),u&&w.jsx("div",{className:Ht.accountList,children:w.jsx("div",{className:Ht.listScroll,children:s.map((x,T)=>w.jsxs("div",{className:St(Ht.accountItem,x.openid===a?.openid&&Ht.active),onClick:()=>C(T),children:[w.jsx("div",{className:Ht.itemInfo,children:w.jsx("span",{className:Ht.itemName,children:x.username})}),w.jsx("div",{className:Ht.deleteBtn,onClick:P=>S(P,T),children:w.jsx(g1,{className:"size-4 text-gray-400 hover:text-red-500"})})]},x.openid))})})]}),w.jsx(Rt,{className:"w-full h-10 mt-4 mb-6 text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",disabled:d,onClick:b,children:d?"登录中...":"登录"}),w.jsx(Qs,{}),w.jsx(Po,{open:h,onOpenChange:m,showCloseIcon:!1,classNames:{popup:"w-[300px] p-6"},children:w.jsxs("div",{className:"text-center",children:[w.jsxs("div",{className:"mb-4",children:[w.jsx("p",{className:"text-base font-medium text-gray-900",children:"是否确认删除该条账号登录记录?"}),w.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"删除后登录记录将不会保存。"})]}),w.jsxs("div",{className:"flex gap-3 mt-6",children:[w.jsx(Rt,{className:"flex-1 h-9 border border-gray-300 rounded-full text-gray-600",onClick:()=>m(!1),children:"取消"}),w.jsx(Rt,{className:"flex-1 h-9 bg-gradient-to-r from-[#497efe] to-[#947afa] text-white rounded-full",onClick:E,children:"确认删除"})]})]})})]})}const bP=Vh({name:pi().refine(e=>e.length>=1,{error:"请输入真实姓名",abort:!0}).refine(e=>/^[\u4e00-\u9fa5]{2,6}$/.test(e),{error:"姓名须由 2-6 个汉字组成",abort:!0}),idcard:pi().refine(e=>e.length>=1,{error:"请输入身份证号",abort:!0}).refine(e=>/^\d{17}(\d|X|x)$/.test(e),{error:"身份证号格式不正确",abort:!0})});function wP(){const{gameId:e,onLoginSuccess:t,onAccountLoginSuccess:n,onPhoneLoginSuccess:r,showRealNameModal:o,setShowRealNameModal:s,onClose:i}=Dn(),[a,c]=f.useState({}),{mutate:u,isPending:l}=sn({mutationFn:async p=>{const m=$r(e)[0];if(!m)throw new Error("未找到登录账号信息");await C1({uid:m.uid,authorization:m.authorization,name:p.name,idcard:p.idcard});const g=await T1(m.authorization),v={account:g.account,entity:g.channel_info.entity,token:g.channel_info.token,sign:g.channel_info.sign,accid:g.channel_info.entity.openid,extra_data:g.channel_info.extra_data,gaplaySign:g.channel_info.gaplaySign,realname:g.channel_info.realname};gt.success("实名认证成功"),s(!1),v.account?.mobile?r?.(v):n?.(v),t?.(v)},onError:p=>{gt.error(p.message||"实名认证失败")}}),d=p=>{const h=bP.safeParse(p);if(!h.success){c(oi(h.error).fieldErrors);return}c({}),u(h.data)};return w.jsxs(Po,{open:o,onOpenChange:s,title:"实名认证",showCloseIcon:!1,disablePointerDismissal:!0,classNames:{popup:"w-[400px] p-6 rounded-2xl",title:"text-center text-xl mb-3"},children:[w.jsx("div",{className:"text-sm text-gray-500 mb-6 text-center",children:"根据《关于防止未成年人沉迷网络游戏的通知》,游戏用户需使用有效身份证进行实名认证。"}),w.jsxs(To,{onFormSubmit:d,errors:a,className:"space-y-4",children:[w.jsxs(Wr,{name:"name",children:[w.jsx("div",{className:"flex items-center border border-gray-300 rounded-full px-4 h-12 focus-within:border-[#787bf4] transition-colors",children:w.jsx(Gs,{className:"flex-1 outline-none text-base bg-transparent",placeholder:"请输入您的真实姓名"})}),w.jsx(Zs,{className:"mt-1 ml-2 text-xs text-red-500"})]}),w.jsxs(Wr,{name:"idcard",children:[w.jsx("div",{className:"flex items-center border border-gray-300 rounded-full px-4 h-12 focus-within:border-[#787bf4] transition-colors",children:w.jsx(Gs,{className:"flex-1 outline-none text-base bg-transparent",placeholder:"请输入您的身份证号",maxLength:18})}),w.jsx(Zs,{className:"mt-1 ml-2 text-xs text-red-500"})]}),w.jsx(Rt,{type:"submit",className:"w-full h-12 mt-6 text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full font-bold shadow-lg disabled:opacity-50",disabled:l,children:l?"提交中...":"提交认证"}),w.jsx("button",{type:"button",className:"w-full mt-4 text-sm text-gray-400 hover:text-gray-600 transition-colors",onClick:i,children:"退出游戏"})]})]})}const Gh={modal:"_modal_1pbx2_2",close:"_close_1pbx2_8"},mi={autoLoginHint:"_autoLoginHint_h58ls_1",left:"_left_h58ls_22",loading:"_loading_h58ls_28",switchBtn:"_switchBtn_h58ls_37"};function SP({onSwitch:e}){const{autoLoginAccountName:t,setIsAutoLoggingIn:n}=Dn(),r=()=>{n(!1),e()};return w.jsxs("div",{className:mi.autoLoginHint,children:[w.jsxs("div",{className:mi.left,children:[w.jsx("div",{className:mi.loading}),w.jsxs("span",{children:[t," 正在登录..."]})]}),w.jsx("button",{className:mi.switchBtn,onClick:r,children:"切换账号"})]})}function EP({open:e,onOpenChange:t}){const{gameId:n,loginTypes:r,currentLoginType:o,closeable:s,isShowGiantLogo:i,onLoginSuccess:a,triggerRealNameAuth:c,showRealNameModal:u,setIsAutoLoggingIn:l,setAutoLoginAccountName:d}=Dn(),[p,h]=oe.useState(!1),m=oe.useMemo(()=>$r(n),[n,e]),g=e&&m.length>0&&!p;oe.useEffect(()=>{if(!e){h(!1),l(!1);return}if(g){const S=m[0];(async()=>{if(!S){h(!0);return}l(!0),d(S.username);try{Qd(S.authorization);const b=await Wp(),x={account:b.account,entity:b.channel_info.entity,token:b.channel_info.token,sign:b.channel_info.sign,accid:b.channel_info.entity.openid,extra_data:b.channel_info.extra_data,gaplaySign:b.channel_info.gaplaySign,realname:b.channel_info.realname};if(Ns(x,S.authorization,n),x.realname&&x.realname.reject>=2){l(!1),h(!0),c();return}l(!1),h(!0),t?.(!1),a?.(x)}catch(b){console.error("Auto quick login failed:",b),l(!1),h(!0)}})()}},[e,n,g]);const v=tf({loginTypes:r,gameId:n}),y=nf({loginTypes:r,gameId:n}),C=ef({loginTypes:r,gameId:n});return w.jsxs(w.Fragment,{children:[g&&w.jsx(SP,{onSwitch:()=>h(!0)}),w.jsxs(Po,{open:e&&!g&&!u,onOpenChange:t,classNames:{popup:St("w-[400px] p-5",Gh.modal),close:Gh.close},showCloseIcon:s,children:[i&&!iS(n)&&w.jsx("section",{className:"flex items-center justify-center mb-6",children:w.jsx("img",{src:n==="5327"?"https://cdn-imgs.sdk.mobileztgame.com/paycenter/260511150749961295.png":"https://h5.sdk.mobileztgame.com/dist/bg_logo.png",className:"aspect-[240/85] w-32"})}),w.jsxs("section",{children:[o==="quick"&&w.jsx(vP,{}),o===at.MOBILE&&y&&w.jsx(Wh,{}),o===at.ROLE_ID&&v&&w.jsx(Zh,{}),o===at.GIANT&&C&&w.jsx(K1,{})]})]}),w.jsx(wP,{})]})}class xP extends oe.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("[Login SDK] Uncaught error:",t)}render(){return this.state.hasError?null:this.props.children}}function jc({open:e,onOpenChange:t,sceneId:n,onPhoneLoginSuccess:r,onAccountLoginSuccess:o,onUidLoginSuccess:s,onLoginSuccess:i,onLoginError:a,closeable:c=!0,mountToaster:u=!0,toastConfigs:l,...d}){const[p]=oe.useState(()=>new Tm);return w.jsxs(oe.StrictMode,{children:[w.jsx(_m,{client:p,children:w.jsx(df,{value:{sceneId:n,onPhoneLoginSuccess:r,onAccountLoginSuccess:o,onUidLoginSuccess:s,onLoginSuccess:h=>{mS(pS({gameId:pr(d.gameId),serverUserInfo:h})),i?.(h)},onLoginError:a,closeable:c,onClose:()=>t?.(!1),...d},children:w.jsx(xP,{children:w.jsx(EP,{open:e,onOpenChange:t})})})}),u&&w.jsx(nS,{toastConfigs:l})]})}const Yh=e=>za(pr(e)),Xh=e=>hS(pr(e)),qh=e=>!!za(pr(e));function Kh({loginTypes:e,defaultLoginType:t,gameId:n,onLoginSuccess:r,onLoginError:o}){const s=pr(n);if(document.querySelector(".login-sdk-container"))return console.warn("Login component is already active. Multiple instances are not allowed."),{close:()=>{}};const i=document.createElement("div");i.className="login-sdk-container",document.body.appendChild(i);const a=em.createRoot(i),c=()=>{setTimeout(()=>{a.unmount(),i.remove()},200)},u=()=>{a.render(w.jsx(jc,{gameId:s,loginTypes:e,defaultLoginType:t,open:!1,onOpenChange:l,onLoginSuccess:r,onLoginError:o})),c()},l=d=>{d||u()};return a.render(w.jsx(jc,{gameId:s,loginTypes:e,defaultLoginType:t,open:!0,onOpenChange:l,onLoginSuccess:r,onLoginError:o})),{close:u}}const CP={init:cf,login:Kh,logout:Xh,getUserInfo:Yh,isLoggedIn:qh};yt.ConfigProvider=df,yt.Login=jc,yt.MobileLogin=Wh,yt.SDK=CP,yt.UidLogin=Zh,yt.getGameId=pr,yt.getUserInfo=Yh,yt.init=cf,yt.isLoggedIn=qh,yt.login=Kh,yt.logout=Xh,Object.defineProperty(yt,Symbol.toStringTag,{value:"Module"})}));
82
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(t===i[0]){s(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Nh(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=a=>{const c=e.seen.get(a);if(c.ref===null)return;const u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){r(d);const h=e.seen.get(d),m=h.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Object.assign(u,m),Object.assign(u,l),a._zod.parent===d)for(const v in u)v==="$ref"||v==="allOf"||v in l||delete u[v];if(m.$ref&&h.def)for(const v in u)v==="$ref"||v==="allOf"||v in h.def&&JSON.stringify(u[v])===JSON.stringify(h.def[v])&&delete u[v]}const p=a._zod.parent;if(p&&p!==d){r(p);const h=e.seen.get(p);if(h?.schema.$ref&&(u.$ref=h.schema.$ref,h.def))for(const m in u)m==="$ref"||m==="allOf"||m in h.def&&JSON.stringify(u[m])===JSON.stringify(h.def[m])&&delete u[m]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(const a of[...e.seen.entries()].reverse())r(a[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,n.def??n.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;const i=e.external?.defs??{};for(const a of e.seen.entries()){const c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:di(t,"input",e.processors),output:di(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function zt(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return zt(r.element,n);if(r.type==="set")return zt(r.valueType,n);if(r.type==="lazy")return zt(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return zt(r.innerType,n);if(r.type==="intersection")return zt(r.left,n)||zt(r.right,n);if(r.type==="record"||r.type==="map")return zt(r.keyType,n)||zt(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:zt(r.in,n)||zt(r.out,n);if(r.type==="object"){for(const o in r.shape)if(zt(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(zt(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(zt(o,n))return!0;return!!(r.rest&&zt(r.rest,n))}return!1}const FT=(e,t={})=>n=>{const r=kh({...n,processors:t});return It(e,r),Rh(r,e),Nh(r,e)},di=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=kh({...o??{},target:s,io:t,processors:n});return It(e,i),Rh(i,e),Nh(i,e)},VT={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},zT=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=VT[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){const l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},$T=(e,t,n,r)=>{n.not={}},jT=(e,t,n,r)=>{},HT=(e,t,n,r)=>{const o=e._zod.def,s=th(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},UT=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},BT=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},WT=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=It(s.element,t,{...r,path:[...r.path,"items"]})},ZT=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object",o.properties={};const i=s.shape;for(const u in i)o.properties[u]=It(i[u],t,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{const l=s.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=It(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},GT=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>It(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},YT=(e,t,n,r)=>{const o=e._zod.def,s=It(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=It(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=c},XT=(e,t,n,r)=>{const o=e._zod.def,s=It(o.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},qT=(e,t,n,r)=>{const o=e._zod.def;It(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},KT=(e,t,n,r)=>{const o=e._zod.def;It(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},JT=(e,t,n,r)=>{const o=e._zod.def;It(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},QT=(e,t,n,r)=>{const o=e._zod.def;It(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},eO=(e,t,n,r)=>{const o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;It(i,t,r);const a=t.seen.get(e);a.ref=i},tO=(e,t,n,r)=>{const o=e._zod.def;It(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},Mh=(e,t,n,r)=>{const o=e._zod.def;It(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},nO=ee("ZodISODateTime",(e,t)=>{hC.init(e,t),ht.init(e,t)});function rO(e){return gT(nO,e)}const oO=ee("ZodISODate",(e,t)=>{mC.init(e,t),ht.init(e,t)});function sO(e){return yT(oO,e)}const iO=ee("ZodISOTime",(e,t)=>{gC.init(e,t),ht.init(e,t)});function aO(e){return vT(iO,e)}const cO=ee("ZodISODuration",(e,t)=>{yC.init(e,t),ht.init(e,t)});function uO(e){return bT(cO,e)}const nn=ee("ZodError",(e,t)=>{ch.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>lx(e,n)},flatten:{value:n=>oi(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Rc,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Rc,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),lO=Lc(nn),dO=Fc(nn),fO=si(nn),pO=ii(nn),hO=px(nn),mO=hx(nn),gO=mx(nn),yO=gx(nn),vO=yx(nn),bO=vx(nn),wO=bx(nn),SO=wx(nn),Ah=new WeakMap;function fi(e,t,n){const r=Object.getPrototypeOf(e);let o=Ah.get(r);if(o||(o=new Set,Ah.set(r,o)),!o.has(t)){o.add(t);for(const s in n){const i=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){const a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const xt=ee("ZodType",(e,t)=>(Et.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:di(e,"input"),output:di(e,"output")}}),e.toJSONSchema=FT(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>lO(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>fO(e,n,r),e.parseAsync=async(n,r)=>dO(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>pO(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>hO(e,n,r),e.decode=(n,r)=>mO(e,n,r),e.encodeAsync=async(n,r)=>gO(e,n,r),e.decodeAsync=async(n,r)=>yO(e,n,r),e.safeEncode=(n,r)=>vO(e,n,r),e.safeDecode=(n,r)=>bO(e,n,r),e.safeEncodeAsync=async(n,r)=>wO(e,n,r),e.safeDecodeAsync=async(n,r)=>SO(e,n,r),fi(e,"ZodType",{check(...n){const r=this.def;return this.clone(Jn(r,{checks:[...r.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return Qn(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(pP(n,r))},superRefine(n,r){return this.check(hP(n,r))},overwrite(n){return this.check(Xr(n))},optional(){return $h(this)},exactOptional(){return eP(this)},nullable(){return jh(this)},nullish(){return $h(jh(this))},nonoptional(n){return iP(this,n)},array(){return BO(this)},or(n){return GO([this,n])},and(n){return XO(this,n)},transform(n){return Uh(this,JO(n))},default(n){return rP(this,n)},prefault(n){return sP(this,n)},catch(n){return cP(this,n)},pipe(n){return Uh(this,n)},readonly(){return dP(this)},describe(n){const r=this.clone();return ko.add(r,{description:n}),r},meta(...n){if(n.length===0)return ko.get(this);const r=this.clone();return ko.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return ko.get(e)?.description},configurable:!0}),e)),Dh=ee("_ZodString",(e,t)=>{Vc.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(r,o,s)=>zT(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,fi(e,"_ZodString",{regex(...r){return this.check(ET(...r))},includes(...r){return this.check(TT(...r))},startsWith(...r){return this.check(OT(...r))},endsWith(...r){return this.check(PT(...r))},min(...r){return this.check(li(...r))},max(...r){return this.check(_h(...r))},length(...r){return this.check(Ih(...r))},nonempty(...r){return this.check(li(1,...r))},lowercase(r){return this.check(xT(r))},uppercase(r){return this.check(CT(r))},trim(){return this.check(IT())},normalize(...r){return this.check(_T(...r))},toLowerCase(){return this.check(kT())},toUpperCase(){return this.check(RT())},slugify(){return this.check(NT())}})}),EO=ee("ZodString",(e,t)=>{Vc.init(e,t),Dh.init(e,t),e.email=n=>e.check(XC(xO,n)),e.url=n=>e.check(eT(CO,n)),e.jwt=n=>e.check(mT(zO,n)),e.emoji=n=>e.check(tT(TO,n)),e.guid=n=>e.check(Ph(Lh,n)),e.uuid=n=>e.check(qC(hi,n)),e.uuidv4=n=>e.check(KC(hi,n)),e.uuidv6=n=>e.check(JC(hi,n)),e.uuidv7=n=>e.check(QC(hi,n)),e.nanoid=n=>e.check(nT(OO,n)),e.guid=n=>e.check(Ph(Lh,n)),e.cuid=n=>e.check(rT(PO,n)),e.cuid2=n=>e.check(oT(_O,n)),e.ulid=n=>e.check(sT(IO,n)),e.base64=n=>e.check(fT(LO,n)),e.base64url=n=>e.check(pT(FO,n)),e.xid=n=>e.check(iT(kO,n)),e.ksuid=n=>e.check(aT(RO,n)),e.ipv4=n=>e.check(cT(NO,n)),e.ipv6=n=>e.check(uT(MO,n)),e.cidrv4=n=>e.check(lT(AO,n)),e.cidrv6=n=>e.check(dT(DO,n)),e.e164=n=>e.check(hT(VO,n)),e.datetime=n=>e.check(rO(n)),e.date=n=>e.check(sO(n)),e.time=n=>e.check(aO(n)),e.duration=n=>e.check(uO(n))});function pi(e){return YC(EO,e)}const ht=ee("ZodStringFormat",(e,t)=>{pt.init(e,t),Dh.init(e,t)}),xO=ee("ZodEmail",(e,t)=>{sC.init(e,t),ht.init(e,t)}),Lh=ee("ZodGUID",(e,t)=>{rC.init(e,t),ht.init(e,t)}),hi=ee("ZodUUID",(e,t)=>{oC.init(e,t),ht.init(e,t)}),CO=ee("ZodURL",(e,t)=>{iC.init(e,t),ht.init(e,t)}),TO=ee("ZodEmoji",(e,t)=>{aC.init(e,t),ht.init(e,t)}),OO=ee("ZodNanoID",(e,t)=>{cC.init(e,t),ht.init(e,t)}),PO=ee("ZodCUID",(e,t)=>{uC.init(e,t),ht.init(e,t)}),_O=ee("ZodCUID2",(e,t)=>{lC.init(e,t),ht.init(e,t)}),IO=ee("ZodULID",(e,t)=>{dC.init(e,t),ht.init(e,t)}),kO=ee("ZodXID",(e,t)=>{fC.init(e,t),ht.init(e,t)}),RO=ee("ZodKSUID",(e,t)=>{pC.init(e,t),ht.init(e,t)}),NO=ee("ZodIPv4",(e,t)=>{vC.init(e,t),ht.init(e,t)}),MO=ee("ZodIPv6",(e,t)=>{bC.init(e,t),ht.init(e,t)}),AO=ee("ZodCIDRv4",(e,t)=>{wC.init(e,t),ht.init(e,t)}),DO=ee("ZodCIDRv6",(e,t)=>{SC.init(e,t),ht.init(e,t)}),LO=ee("ZodBase64",(e,t)=>{EC.init(e,t),ht.init(e,t)}),FO=ee("ZodBase64URL",(e,t)=>{CC.init(e,t),ht.init(e,t)}),VO=ee("ZodE164",(e,t)=>{TC.init(e,t),ht.init(e,t)}),zO=ee("ZodJWT",(e,t)=>{PC.init(e,t),ht.init(e,t)}),$O=ee("ZodUnknown",(e,t)=>{_C.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jT()});function Fh(){return wT($O)}const jO=ee("ZodNever",(e,t)=>{IC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$T(e,n,r)});function HO(e){return ST(jO,e)}const UO=ee("ZodArray",(e,t)=>{kC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>WT(e,n,r,o),e.element=t.element,fi(e,"ZodArray",{min(n,r){return this.check(li(n,r))},nonempty(n){return this.check(li(1,n))},max(n,r){return this.check(_h(n,r))},length(n,r){return this.check(Ih(n,r))},unwrap(){return this.element}})});function BO(e,t){return MT(UO,e,t)}const WO=ee("ZodObject",(e,t)=>{NC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ZT(e,n,r,o),ot(e,"shape",()=>t.shape),fi(e,"ZodObject",{keyof(){return qO(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Fh()})},loose(){return this.clone({...this._zod.def,catchall:Fh()})},strict(){return this.clone({...this._zod.def,catchall:HO()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return ox(this,n)},safeExtend(n){return sx(this,n)},merge(n){return ix(this,n)},pick(n){return nx(this,n)},omit(n){return rx(this,n)},partial(...n){return ax(zh,this,n[0])},required(...n){return cx(Hh,this,n[0])}})});function Vh(e,t){const n={type:"object",shape:e??{},...ke(t)};return new WO(n)}const ZO=ee("ZodUnion",(e,t)=>{MC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>GT(e,n,r,o),e.options=t.options});function GO(e,t){return new ZO({type:"union",options:e,...ke(t)})}const YO=ee("ZodIntersection",(e,t)=>{AC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>YT(e,n,r,o)});function XO(e,t){return new YO({type:"intersection",left:e,right:t})}const $c=ee("ZodEnum",(e,t)=>{DC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(r,o,s)=>HT(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new $c({...t,checks:[],...ke(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new $c({...t,checks:[],...ke(o),entries:s})}});function qO(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new $c({type:"enum",entries:n,...ke(t)})}const KO=ee("ZodTransform",(e,t)=>{LC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>BT(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new eh(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Io(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(Io(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function JO(e){return new KO({type:"transform",transform:e})}const zh=ee("ZodOptional",(e,t)=>{Sh.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function $h(e){return new zh({type:"optional",innerType:e})}const QO=ee("ZodExactOptional",(e,t)=>{FC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function eP(e){return new QO({type:"optional",innerType:e})}const tP=ee("ZodNullable",(e,t)=>{VC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>XT(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function jh(e){return new tP({type:"nullable",innerType:e})}const nP=ee("ZodDefault",(e,t)=>{zC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>KT(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function rP(e,t){return new nP({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():sh(t)}})}const oP=ee("ZodPrefault",(e,t)=>{$C.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>JT(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function sP(e,t){return new oP({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():sh(t)}})}const Hh=ee("ZodNonOptional",(e,t)=>{jC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qT(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function iP(e,t){return new Hh({type:"nonoptional",innerType:e,...ke(t)})}const aP=ee("ZodCatch",(e,t)=>{HC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>QT(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function cP(e,t){return new aP({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const uP=ee("ZodPipe",(e,t)=>{UC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>eO(e,n,r,o),e.in=t.in,e.out=t.out});function Uh(e,t){return new uP({type:"pipe",in:e,out:t})}const lP=ee("ZodReadonly",(e,t)=>{BC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tO(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function dP(e){return new lP({type:"readonly",innerType:e})}const fP=ee("ZodCustom",(e,t)=>{WC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>UT(e,n)});function pP(e,t={}){return AT(fP,e,t)}function hP(e,t){return DT(e,t)}const wr={trigger:"_trigger_1e3h3_1",popup:"_popup_1e3h3_5",item:"_item_1e3h3_24",indicator:"_indicator_1e3h3_40",itemText:"_itemText_1e3h3_44",itemCode:"_itemCode_1e3h3_48",itemLabel:"_itemLabel_1e3h3_52"};function mP({value:e,onValueChange:t}){const{gameId:n}=Dn(),r=dS(),o=f.useMemo(()=>r.find(i=>i.id===e||i.value===e)?.id||e,[r,e]);return w.jsxs(n1,{value:o,onValueChange:s=>{const i=r.find(a=>a.id===s);i&&t?.(i.value)},children:[w.jsxs(Pp,{className:wr.trigger,children:[w.jsx("span",{children:r.find(s=>s.id===o)?.value}),w.jsx(jp,{className:"size-4"})]}),w.jsx(Ip,{children:w.jsx(kp,{className:"outline-none z-[999]",sideOffset:-4,align:"start",children:w.jsx(Rp,{className:wr.popup,children:r.map(({label:s,value:i,id:a})=>w.jsxs(Dp,{value:a,className:wr.item,children:[w.jsx(Lp,{className:wr.indicator,children:w.jsx(Pc,{className:"size-3"})}),w.jsxs(Vp,{className:wr.itemText,children:[w.jsx("span",{className:wr.itemCode,children:i}),w.jsx("span",{className:wr.itemLabel,children:s})]})]},a))})})})]})}const Bh=Vh({phoneNumber:pi().regex(/^[1-9]\d{10}$/,"请输入正确的手机号"),verificationCode:pi().length(4,"请输入 6 位验证码")});function Wh(){const{mobileLoginConfig:e={},gameId:t,onPhoneLoginSuccess:n,onLoginSuccess:r,onLoginError:o,triggerRealNameAuth:s}=Dn(),[i,a]=oe.useState("86"),[c,u]=oe.useState(""),l=oe.useRef(null),[d,p]=oe.useState(""),[h,m]=oe.useState(),[g,v]=oe.useState(!0),[y,C]=oe.useState({}),[S,E]=oe.useState(!1),[b]=Jp({leftTime:h?h*1e3:void 0,interval:1e3,onEnd(){m(void 0)}}),{mutate:x,isPending:T}=sn({mutationFn:()=>E1({mobile:c,countryCode:i,type:e.smsType}),onSuccess:L=>{E(!0),m(L.lock_time),gt.success("验证码已发送,请注意查收")}}),{mutate:P,isPending:$}=sn({mutationFn:async()=>{const L=await x1({mobile:c,countryCode:i,captcha:d});m(void 0);const D={account:L.account,entity:L.channel_info.entity,token:L.channel_info.token,sign:L.channel_info.sign,accid:L.channel_info.entity.openid,extra_data:L.channel_info.extra_data,gaplaySign:L.channel_info.gaplaySign,realname:L.channel_info.realname};if(Ns(D,L._auth,t),D.realname&&D.realname.reject>=2){s();return}return n&&await n(D),r?.(D),L},onError:L=>{o?.(L)}});function M(){if(!g){gt.warning("请先阅读并同意用户协议和隐私政策");return}const L=new FormData(l.current),D=Bh.pick({phoneNumber:!0}).safeParse(Object.fromEntries(L));if(!D.success){C(oi(D.error).fieldErrors);return}x()}async function V(L){if(L.preventDefault(),!g)return gt.warning("请先阅读并同意用户协议和隐私政策"),{errors:{}};const D=new FormData(L.currentTarget),R=Bh.safeParse(Object.fromEntries(D));return R.success?(P(),{errors:{}}):{errors:oi(R.error).fieldErrors}}return w.jsx(w.Fragment,{children:w.jsxs(To,{ref:l,errors:y,onSubmit:async L=>{const D=await V(L);C(D.errors)},className:"space-y-5",children:[w.jsx(Tn,{name:"phoneNumber",placeholder:"请输入手机号码",autoFocus:!0,type:"tel",onChange:L=>u(L.currentTarget.value),prefix:w.jsx(mP,{value:i,onValueChange:a})}),w.jsx(Tn,{name:"verificationCode",placeholder:"请输入验证码",value:d,type:"number",onValueChange:L=>{const D=L;p(D),D.length===4&&S&&setTimeout(()=>{l.current?.requestSubmit()},0)},suffix:w.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-white inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onClick:()=>M(),disabled:!!h||T,children:T?"发送中...":h?`${Math.round(b/1e3)}s 后重新获取`:"获取验证码"})}),w.jsx(Rt,{className:St("my-5 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",e.buttonClassName),disabled:$,type:"submit",children:$?"登录中...":e.buttonText||"登录"}),w.jsx(Qs,{}),w.jsx(qp,{checked:g,onChange:v})]})})}function gP(e){return w.jsxs("svg",{width:"20",height:"10",viewBox:"0 0 20 10",fill:"none",...e,children:[w.jsx("path",{d:"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z",className:"fill-current"}),w.jsx("path",{d:"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z",className:"fill-current"})]})}function yP({children:e,title:t,description:n,content:r,classNames:o={}}){return w.jsxs(YE,{children:[w.jsx(hp,{className:o.trigger,delay:0,children:e}),w.jsxs(mp,{children:[w.jsx(Sp,{className:St("fixed inset-0 bg-black/20 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",o.backdrop)}),w.jsx(yp,{sideOffset:8,className:o.positioner,children:w.jsxs(bp,{className:St("origin-[var(--transform-origin)] bg-white p-1 rounded shadow-sm text-gray-900 transition-[transform,scale,opacity] data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 dark:shadow-none dark:-outline-offset-1 dark:outline-gray-300",o.popup),children:[w.jsx(wp,{className:St("data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=left]:rotate-90 data-[side=right]:left-[-13px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180",o.arrow),children:w.jsx(gP,{})}),t&&w.jsx(Ep,{className:"text-base font-medium",children:t}),n&&w.jsx(xp,{className:"text-base text-gray-600",children:n}),r]})})]})]})}const Sr={uidGet:"_uidGet_os9yc_1",mailCodeGet:"_mailCodeGet_os9yc_5",uidGetPopup:"_uidGetPopup_os9yc_79",uidGetArrow:"_uidGetArrow_os9yc_83",inputControl:"_inputControl_os9yc_86",form:"_form_os9yc_89"};function Zh({onUidLoginSuccess:e,customSendUidMailCaptcha:t,customValidateUidMailCaptcha:n}={}){const{gameId:r,autoLoginConfig:o,sceneId:s,onUidLoginSuccess:i,onLoginSuccess:a,onLoginError:c,uidLoginConfig:u={}}=Dn(),l=oe.useRef(null),[d,p]=oe.useState(""),[h,m]=oe.useState(""),[g,v]=oe.useState(!0),[y,C]=oe.useState(!1),[S,{startCountdown:E,resetCountdown:b}]=F1({countStart:120,intervalMs:1e3}),{mutate:x}=sn({mutationFn:()=>{const M=o.enabled?o.days:void 0;return n?n({gameId:r,captcha:h,expireInDays:g?M:void 0,accountId:d,sceneId:s}):w1({game_id:r,charid:d,captcha_type:"login",captcha:h,expires_day:g?M:void 0,scene_id:s,...u.uidMailExtraParams})},onSuccess:M=>{i?.(M),e?.(M),a?.(M)},onError:M=>{c?.(M)}}),{mutate:T,isPending:P}=sn({mutationFn:()=>t?t({gameId:r,accountId:d}):b1({game_id:r,captcha_type:"login",charid:d,scene_id:s,...u.uidMailExtraParams}),onSuccess:M=>{E(),gt.success(M.error)}});async function $(M){M.preventDefault(),x()}return oe.useEffect(()=>{h.length===6&&d&&setTimeout(()=>{l.current?.requestSubmit()},0)},[h,d]),oe.useEffect(()=>{S===0&&b(),C(S!==120)},[S,b]),w.jsxs(To,{ref:l,onSubmit:$,className:St("space-y-6",Sr.form),autoComplete:"off",children:[["5199","5012"].includes(r)?w.jsx("p",{className:"text-center text-xs text-white/80",children:"请点击游戏右上角“设置”查看账号ID"}):null,w.jsx(Tn,{name:"accountId",className:St(Sr.inputControl,"bg-[var(--jssdk-input-bg-color)]"),inputClassName:"bg-inherit",placeholder:"请输入账号 ID",autoFocus:!0,type:"tel",onChange:M=>p(M.currentTarget.value),prefix:w.jsx(yP,{content:w.jsx("div",{className:St(Sr.uidGet,u.uidGetterImageClassName)}),classNames:{backdrop:"z-[992]",positioner:"z-[992]",popup:St("rounded-2xl shadow-lg",Sr.uidGetPopup),arrow:Sr.uidGetArrow,trigger:"size-5 lg:size-6 lg:text-2xl rounded-full bg-[var(--jssdk-icon-color)] inline-flex items-center justify-center text-white focus:outline focus:outline-2"},children:w.jsx("span",{children:"!"})})}),w.jsx(Tn,{name:"verificationCode",className:St(Sr.inputControl,"bg-[var(--jssdk-input-bg-color)]"),inputClassName:"bg-inherit",placeholder:"请输入口令码",value:h,type:"tel",onValueChange:M=>m(M),prefix:w.jsx(Po,{trigger:w.jsx("span",{children:"!"}),classNames:{trigger:"size-5 lg:size-6 lg:text-2xl rounded-full bg-[var(--jssdk-icon-color)] inline-flex items-center justify-center text-white focus:outline focus:outline-2",popup:"w-full lg:w-4/5 lg:max-w-5xl p-0 bg-transparent"},children:w.jsx("div",{className:St(Sr.mailCodeGet,u.mailCodeGetterImageClassName)})}),suffix:w.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-[var(--jssdk-primary-foregroud-color)] inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onMouseDown:M=>{M.preventDefault()},onClick:()=>T(),disabled:y||P||!d,children:y?`${S}s`:P?"发送中...":"发送口令码"})}),o.enabled?w.jsx(Wr,{name:"rememberLogin",children:w.jsxs(gc,{className:"flex items-center gap-2 text-gray-500",onMouseDown:M=>{M.preventDefault()},children:[w.jsx(sc,{checked:g,className:"size-5 flex items-center justify-center rounded-full border-2 data-[checked]:border-[var(--jssdk-primary-color)] data-[unchecked]:border-gray-300",onCheckedChange:M=>v(!!M),children:w.jsx(ic,{children:w.jsx(Pc,{className:"size-3 text-[var(--jssdk-primary-color)]",strokeWidth:4})})}),w.jsxs("div",{children:[w.jsx("span",{className:"mr-0.5",children:o.days}),w.jsx("span",{children:"天内自动登录"})]})]})}):null,["5199","5012"].includes(r)?w.jsx("div",{className:"text-[#f59e9e] text-center text-[11px]",children:"请点击游戏内“邮件”查收口令码,未收到请重启游戏再次查看"}):null,w.jsx(Qs,{})]})}const Ht={quickLogin:"_quickLogin_1ibz1_1",quickAccounts:"_quickAccounts_1ibz1_5",selectedAccount:"_selectedAccount_1ibz1_9",accountInfo:"_accountInfo_1ibz1_21",accountName:"_accountName_1ibz1_26",arrow:"_arrow_1ibz1_31",arrowRotate:"_arrowRotate_1ibz1_37",accountList:"_accountList_1ibz1_41",listScroll:"_listScroll_1ibz1_49",accountItem:"_accountItem_1ibz1_58",active:"_active_1ibz1_77",itemName:"_itemName_1ibz1_81",itemInfo:"_itemInfo_1ibz1_86",deleteBtn:"_deleteBtn_1ibz1_97"};function vP(){const{gameId:e,onLoginSuccess:t,triggerRealNameAuth:n,setCurrentLoginType:r,defaultLoginType:o}=Dn(),[s,i]=oe.useState([]),[a,c]=oe.useState(null),[u,l]=oe.useState(!1),[d,p]=oe.useState(!1),[h,m]=oe.useState(!1),[g,v]=oe.useState(-1);oe.useEffect(()=>{y()},[e]);const y=()=>{const x=$r(e);i(x),x.length>0?(!a||!x.find(T=>T.openid===a.openid))&&c(x[0]):c(null)},C=x=>{c(s[x]),l(!1)},S=(x,T)=>{x.stopPropagation(),v(T),m(!0)},E=()=>{const x=s[g];if(x){sf(x.openid,e);const T=$r(e);if(T.length===0){r(o);return}i(T),T.find(P=>P.openid===a?.openid)||c(T[0])}m(!1),v(-1)},b=async()=>{if(a){p(!0);try{Qd(a.authorization);const x=await Wp(),T={account:x.account,entity:x.channel_info.entity,token:x.channel_info.token,sign:x.channel_info.sign,accid:x.channel_info.entity.openid,extra_data:x.channel_info.extra_data,gaplaySign:x.channel_info.gaplaySign,realname:x.channel_info.realname};if(Ns(T,a.authorization,e),T.realname&&T.realname.reject>=2){n();return}t?.(T)}catch(x){gt.error(x?.detail),console.error("Quick login failed:",x)}finally{p(!1)}}};return s.length===0?null:w.jsxs("div",{className:Ht.quickLogin,children:[w.jsxs("div",{className:Ht.quickAccounts,children:[w.jsxs("div",{className:Ht.selectedAccount,onClick:()=>l(!u),children:[w.jsx("div",{className:Ht.accountInfo,children:w.jsx("span",{className:Ht.accountName,children:a?.username})}),w.jsx(jp,{className:St(Ht.arrow,u&&Ht.arrowRotate)})]}),u&&w.jsx("div",{className:Ht.accountList,children:w.jsx("div",{className:Ht.listScroll,children:s.map((x,T)=>w.jsxs("div",{className:St(Ht.accountItem,x.openid===a?.openid&&Ht.active),onClick:()=>C(T),children:[w.jsx("div",{className:Ht.itemInfo,children:w.jsx("span",{className:Ht.itemName,children:x.username})}),w.jsx("div",{className:Ht.deleteBtn,onClick:P=>S(P,T),children:w.jsx(g1,{className:"size-4 text-gray-400 hover:text-red-500"})})]},x.openid))})})]}),w.jsx(Rt,{className:"w-full h-10 mt-4 mb-6 text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",disabled:d,onClick:b,children:d?"登录中...":"登录"}),w.jsx(Qs,{}),w.jsx(Po,{open:h,onOpenChange:m,showCloseIcon:!1,classNames:{popup:"w-[300px] p-6"},children:w.jsxs("div",{className:"text-center",children:[w.jsxs("div",{className:"mb-4",children:[w.jsx("p",{className:"text-base font-medium text-gray-900",children:"是否确认删除该条账号登录记录?"}),w.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"删除后登录记录将不会保存。"})]}),w.jsxs("div",{className:"flex gap-3 mt-6",children:[w.jsx(Rt,{className:"flex-1 h-9 border border-gray-300 rounded-full text-gray-600",onClick:()=>m(!1),children:"取消"}),w.jsx(Rt,{className:"flex-1 h-9 bg-gradient-to-r from-[#497efe] to-[#947afa] text-white rounded-full",onClick:E,children:"确认删除"})]})]})})]})}const bP=Vh({name:pi().refine(e=>e.length>=1,{error:"请输入真实姓名",abort:!0}).refine(e=>/^[\u4e00-\u9fa5]{2,6}$/.test(e),{error:"姓名须由 2-6 个汉字组成",abort:!0}),idcard:pi().refine(e=>e.length>=1,{error:"请输入身份证号",abort:!0}).refine(e=>/^\d{17}(\d|X|x)$/.test(e),{error:"身份证号格式不正确",abort:!0})});function wP(){const{gameId:e,onLoginSuccess:t,onAccountLoginSuccess:n,onPhoneLoginSuccess:r,showRealNameModal:o,setShowRealNameModal:s,onClose:i}=Dn(),[a,c]=f.useState({}),{mutate:u,isPending:l}=sn({mutationFn:async p=>{const m=$r(e)[0];if(!m)throw new Error("未找到登录账号信息");await C1({uid:m.uid,authorization:m.authorization,name:p.name,idcard:p.idcard});const g=await T1(m.authorization),v={account:g.account,entity:g.channel_info.entity,token:g.channel_info.token,sign:g.channel_info.sign,accid:g.channel_info.entity.openid,extra_data:g.channel_info.extra_data,gaplaySign:g.channel_info.gaplaySign,realname:g.channel_info.realname};gt.success("实名认证成功"),s(!1),v.account?.mobile?r?.(v):n?.(v),t?.(v)},onError:p=>{gt.error(p.message||"实名认证失败")}}),d=p=>{const h=bP.safeParse(p);if(!h.success){c(oi(h.error).fieldErrors);return}c({}),u(h.data)};return w.jsxs(Po,{open:o,onOpenChange:s,title:"实名认证",showCloseIcon:!1,disablePointerDismissal:!0,classNames:{popup:"w-[400px] p-6 rounded-2xl",title:"text-center text-xl mb-3"},children:[w.jsx("div",{className:"text-sm text-gray-500 mb-6 text-center",children:"根据《关于防止未成年人沉迷网络游戏的通知》,游戏用户需使用有效身份证进行实名认证。"}),w.jsxs(To,{onFormSubmit:d,errors:a,className:"space-y-4",children:[w.jsxs(Wr,{name:"name",children:[w.jsx("div",{className:"flex items-center border border-gray-300 rounded-full px-4 h-12 focus-within:border-[#787bf4] transition-colors",children:w.jsx(Gs,{className:"flex-1 outline-none text-base bg-transparent",placeholder:"请输入您的真实姓名"})}),w.jsx(Zs,{className:"mt-1 ml-2 text-xs text-red-500"})]}),w.jsxs(Wr,{name:"idcard",children:[w.jsx("div",{className:"flex items-center border border-gray-300 rounded-full px-4 h-12 focus-within:border-[#787bf4] transition-colors",children:w.jsx(Gs,{className:"flex-1 outline-none text-base bg-transparent",placeholder:"请输入您的身份证号",maxLength:18})}),w.jsx(Zs,{className:"mt-1 ml-2 text-xs text-red-500"})]}),w.jsx(Rt,{type:"submit",className:"w-full h-12 mt-6 text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full font-bold shadow-lg disabled:opacity-50",disabled:l,children:l?"提交中...":"提交认证"}),w.jsx("button",{type:"button",className:"w-full mt-4 text-sm text-gray-400 hover:text-gray-600 transition-colors",onClick:i,children:"退出游戏"})]})]})}const Gh={modal:"_modal_1pbx2_2",close:"_close_1pbx2_8"},mi={autoLoginHint:"_autoLoginHint_h58ls_1",left:"_left_h58ls_22",loading:"_loading_h58ls_28",switchBtn:"_switchBtn_h58ls_37"};function SP({onSwitch:e}){const{autoLoginAccountName:t,setIsAutoLoggingIn:n}=Dn(),r=()=>{n(!1),e()};return w.jsxs("div",{className:mi.autoLoginHint,children:[w.jsxs("div",{className:mi.left,children:[w.jsx("div",{className:mi.loading}),w.jsxs("span",{children:[t," 正在登录..."]})]}),w.jsx("button",{className:mi.switchBtn,onClick:r,children:"切换账号"})]})}function EP({open:e,onOpenChange:t}){const{gameId:n,loginTypes:r,currentLoginType:o,closeable:s,isShowGiantLogo:i,onLoginSuccess:a,triggerRealNameAuth:c,showRealNameModal:u,setIsAutoLoggingIn:l,setAutoLoginAccountName:d}=Dn(),[p,h]=oe.useState(!1),m=oe.useMemo(()=>$r(n),[n,e]),g=e&&m.length>0&&!p;oe.useEffect(()=>{if(!e){h(!1),l(!1);return}if(g){const S=m[0];(async()=>{if(!S){h(!0);return}l(!0),d(S.username);try{Qd(S.authorization);const b=await Wp(),x={account:b.account,entity:b.channel_info.entity,token:b.channel_info.token,sign:b.channel_info.sign,accid:b.channel_info.entity.openid,extra_data:b.channel_info.extra_data,gaplaySign:b.channel_info.gaplaySign,realname:b.channel_info.realname};if(Ns(x,S.authorization,n),x.realname&&x.realname.reject>=2){l(!1),h(!0),c();return}l(!1),h(!0),t?.(!1),a?.(x)}catch(b){console.error("Auto quick login failed:",b),l(!1),h(!0)}})()}},[e,n,g]);const v=tf({loginTypes:r,gameId:n}),y=nf({loginTypes:r,gameId:n}),C=ef({loginTypes:r,gameId:n});return w.jsxs(w.Fragment,{children:[g&&w.jsx(SP,{onSwitch:()=>h(!0)}),w.jsxs(Po,{open:e&&!g&&!u,onOpenChange:t,classNames:{popup:St("w-[400px] p-5",Gh.modal),close:Gh.close},showCloseIcon:s,children:[i&&!iS(n)&&w.jsx("section",{className:"flex items-center justify-center mb-6",children:w.jsx("img",{src:n==="5327"?"https://cdn-imgs.sdk.mobileztgame.com/paycenter/260511150749961295.png":"https://h5.sdk.mobileztgame.com/dist/bg_logo.png",className:"aspect-[240/85] w-32"})}),w.jsxs("section",{children:[o==="quick"&&w.jsx(vP,{}),o===at.MOBILE&&y&&w.jsx(Wh,{}),o===at.ROLE_ID&&v&&w.jsx(Zh,{}),o===at.GIANT&&C&&w.jsx(K1,{})]})]}),w.jsx(wP,{})]})}class xP extends oe.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("[Login SDK] Uncaught error:",t)}render(){return this.state.hasError?null:this.props.children}}function jc({open:e,onOpenChange:t,sceneId:n,onPhoneLoginSuccess:r,onAccountLoginSuccess:o,onUidLoginSuccess:s,onLoginSuccess:i,onLoginError:a,closeable:c=!0,mountToaster:u=!0,toastConfigs:l,...d}){const[p]=oe.useState(()=>new Tm);return w.jsxs(oe.StrictMode,{children:[w.jsx(_m,{client:p,children:w.jsx(df,{value:{sceneId:n,onPhoneLoginSuccess:r,onAccountLoginSuccess:o,onUidLoginSuccess:s,onLoginSuccess:h=>{mS(pS({gameId:pr(d.gameId),serverUserInfo:h})),i?.(h)},onLoginError:a,closeable:c,onClose:()=>t?.(!1),...d},children:w.jsx(xP,{children:w.jsx(EP,{open:e,onOpenChange:t})})})}),u&&w.jsx(nS,{toastConfigs:l})]})}const Yh=e=>za(pr(e)),Xh=e=>hS(pr(e)),qh=e=>!!za(pr(e));function Kh({loginTypes:e,defaultLoginType:t,gameId:n,onLoginSuccess:r,onLoginError:o}){const s=pr(n);if(document.querySelector(".login-sdk-container"))return console.warn("Login component is already active. Multiple instances are not allowed."),{close:()=>{}};const i=document.createElement("div");i.className="login-sdk-container",document.body.appendChild(i);const a=em.createRoot(i),c=()=>{setTimeout(()=>{a.unmount(),i.remove()},200)},u=()=>{a.render(w.jsx(jc,{gameId:s,loginTypes:e,defaultLoginType:t,open:!1,onOpenChange:l,onLoginSuccess:r,onLoginError:o})),c()},l=d=>{d||u()};return a.render(w.jsx(jc,{gameId:s,loginTypes:e,defaultLoginType:t,open:!0,onOpenChange:l,onLoginSuccess:r,onLoginError:o})),{close:u}}const CP={init:cf,login:Kh,logout:Xh,getUserInfo:Yh,isLoggedIn:qh};yt.ConfigProvider=df,yt.Login=jc,yt.MobileLogin=Wh,yt.SDK=CP,yt.UidLogin=Zh,yt.getGameId=pr,yt.getUserInfo=Yh,yt.init=cf,yt.isLoggedIn=qh,yt.login=Kh,yt.logout=Xh,Object.defineProperty(yt,Symbol.toStringTag,{value:"Module"})}));